diff options
Diffstat (limited to 'src/Authoring/Studio/Palettes/Inspector')
4 files changed, 30 insertions, 16 deletions
diff --git a/src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.cpp b/src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.cpp index ee6af48f..de29cdc4 100644 --- a/src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.cpp +++ b/src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.cpp @@ -1309,6 +1309,11 @@ void InspectorControlModel::updatePropertyValue(InspectorControlBase *element) c element->m_values = QVariant::fromValue<QList<double> >(float3Values); } break; + case qt3dsdm::DataModelDataType::Float4: + if (element->m_propertyType == qt3dsdm::AdditionalMetaDataType::Color) { + element->m_value = qt3dsdm::get<QColor>(value); + } + break; case qt3dsdm::DataModelDataType::Float2: if (element->m_propertyType == qt3dsdm::AdditionalMetaDataType::None) { const QVector2D theFloat2 = qt3dsdm::get<QVector2D>(value); @@ -1813,7 +1818,6 @@ void InspectorControlModel::setPropertyValue(long instance, int handle, const QV // initialize vertex buffers), so the renderer's OpenGL context must be current Q3DStudio::IStudioRenderer &theRenderer(g_StudioApp.getRenderer()); theRenderer.MakeContextCurrent(); - m_UpdatableEditor.EnsureEditor(QObject::tr("Set Property"), __FILE__, __LINE__) .SetInstancePropertyValue(instance, handle, v); diff --git a/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp b/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp index ad980d36..66f8c868 100644 --- a/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp +++ b/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp @@ -321,7 +321,8 @@ void InspectorControlView::openInInspector() const auto doc = g_StudioApp.GetCore()->GetDoc(); const auto bridge = doc->GetStudioSystem()->GetClientDataModelBridge(); qt3dsdm::SValue value; - doc->GetPropertySystem()->GetInstancePropertyValue(m_instance, m_handle, value); + doc->GetPropertySystem()->GetInstancePropertyValue(m_contextMenuInstance, m_contextMenuHandle, + value); qt3dsdm::SLong4 guid = qt3dsdm::get<qt3dsdm::SLong4>(value); const auto instance = bridge->GetInstanceByGUID(guid); doc->SelectDataModelObject(instance); @@ -474,8 +475,8 @@ void InspectorControlView::setInspectable(CInspectableBase *inInspectable) void InspectorControlView::showContextMenu(int x, int y, int handle, int instance) { - m_instance = instance; - m_handle = handle; + m_contextMenuInstance = instance; + m_contextMenuHandle = handle; QMenu theContextMenu; @@ -497,8 +498,8 @@ void InspectorControlView::showContextMenu(int x, int y, int handle, int instanc } theContextMenu.exec(mapToGlobal({x, y})); - m_instance = 0; - m_handle = 0; + m_contextMenuInstance = 0; + m_contextMenuHandle = 0; } // context menu for the variants tags @@ -584,12 +585,12 @@ void InspectorControlView::toggleMasterLink() { Q3DStudio::ScopedDocumentEditor editor(*g_StudioApp.GetCore()->GetDoc(), QObject::tr("Link Property"), __FILE__, __LINE__); - bool wasLinked = editor->IsPropertyLinked(m_instance, m_handle); + bool wasLinked = editor->IsPropertyLinked(m_contextMenuInstance, m_contextMenuHandle); if (wasLinked) - editor->UnlinkProperty(m_instance, m_handle); + editor->UnlinkProperty(m_contextMenuInstance, m_contextMenuHandle); else - editor->LinkProperty(m_instance, m_handle); + editor->LinkProperty(m_contextMenuInstance, m_contextMenuHandle); } void InspectorControlView::setPropertyValueFromFilename(long instance, int handle, @@ -828,13 +829,20 @@ void InspectorControlView::showDataInputChooser(int handle, int instance, const m_activeBrowser.setData(m_dataInputChooserView, handle, instance); } -QColor InspectorControlView::showColorDialog(const QColor &color) +QColor InspectorControlView::showColorDialog(const QColor &color, int instance, int handle) { + bool showAlpha = false; + if (instance && handle) { + auto bridge = g_StudioApp.GetCore()->GetDoc()->GetStudioSystem() + ->GetClientDataModelBridge(); + showAlpha = bridge->getBGColorProperty(instance).GetHandleValue() == handle; + } + m_currentColor = color; CDialogs *dialogs = g_StudioApp.GetDialogs(); connect(dialogs, &CDialogs::onColorChanged, this, &InspectorControlView::dialogCurrentColorChanged); - QColor currentColor = dialogs->displayColorDialog(color); + QColor currentColor = dialogs->displayColorDialog(color, showAlpha); disconnect(dialogs, &CDialogs::onColorChanged, this, &InspectorControlView::dialogCurrentColorChanged); return currentColor; diff --git a/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.h b/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.h index 29cff25b..75d07d73 100644 --- a/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.h +++ b/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.h @@ -75,7 +75,7 @@ public: VariantsGroupModel *variantsModel() const { return m_variantsGroupModel; } Q_INVOKABLE QColor titleColor(int instance = 0, int handle = 0) const; - Q_INVOKABLE QColor showColorDialog(const QColor &color); + Q_INVOKABLE QColor showColorDialog(const QColor &color, int instance = 0, int handle = 0); Q_INVOKABLE void showContextMenu(int x, int y, int handle, int instance); Q_INVOKABLE void showTagContextMenu(int x, int y, const QString &group, const QString &tag); Q_INVOKABLE void showDataInputChooser(int handle, int instance, const QPoint &point); @@ -147,8 +147,8 @@ private: MouseHelper m_mouseHelper; QmlUtils m_qmlUtils; - int m_instance = 0; - int m_handle = 0; + int m_contextMenuInstance = 0; + int m_contextMenuHandle = 0; QSize m_preferredSize; QColor m_currentColor; diff --git a/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.qml b/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.qml index 7d059773..ebb56023 100644 --- a/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.qml +++ b/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.qml @@ -504,8 +504,6 @@ Rectangle { model.modelData.title); return null; case DataModelDataType.Float3: - if (modelData.propertyType === AdditionalMetaDataType.Color) - return colorBox; if (modelData.propertyType === AdditionalMetaDataType.Rotation) return xyzPropertyComponent; if (modelData.propertyType === AdditionalMetaDataType.None) @@ -514,6 +512,10 @@ Rectangle { modelData.propertyType, "text ", model.modelData.title); return null; + case DataModelDataType.Float4: + if (modelData.propertyType === AdditionalMetaDataType.Color) + return colorBox; + return null; case DataModelDataType.StringRef: if (modelData.propertyType === AdditionalMetaDataType.None) return materialTypeDropDown; |