summaryrefslogtreecommitdiffstats
path: root/src/Authoring/Studio/Palettes
diff options
context:
space:
mode:
Diffstat (limited to 'src/Authoring/Studio/Palettes')
-rw-r--r--src/Authoring/Studio/Palettes/Action/ActionView.cpp10
-rw-r--r--src/Authoring/Studio/Palettes/Action/ActionView.h1
-rw-r--r--src/Authoring/Studio/Palettes/Action/HandlerGenericBaseColor.qml2
-rw-r--r--src/Authoring/Studio/Palettes/Action/HandlerProperty.qml7
-rw-r--r--src/Authoring/Studio/Palettes/Inspector/InspectorControlModel.cpp6
-rw-r--r--src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp28
-rw-r--r--src/Authoring/Studio/Palettes/Inspector/InspectorControlView.h6
-rw-r--r--src/Authoring/Studio/Palettes/Inspector/InspectorControlView.qml6
-rw-r--r--src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemProperty.cpp25
-rw-r--r--src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineTimebar.cpp4
-rw-r--r--src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTimeline.cpp2
11 files changed, 53 insertions, 44 deletions
diff --git a/src/Authoring/Studio/Palettes/Action/ActionView.cpp b/src/Authoring/Studio/Palettes/Action/ActionView.cpp
index 92a532f2..ec7c9be4 100644
--- a/src/Authoring/Studio/Palettes/Action/ActionView.cpp
+++ b/src/Authoring/Studio/Palettes/Action/ActionView.cpp
@@ -1164,16 +1164,6 @@ bool ActionView::toolTipsEnabled()
return CStudioPreferences::ShouldShowTooltips();
}
-QColor ActionView::showColorDialog(const QColor &color)
-{
- m_currentColor = color;
- CDialogs *dialogs = g_StudioApp.GetDialogs();
- connect(dialogs, &CDialogs::onColorChanged, this, &ActionView::dialogCurrentColorChanged);
- QColor currentColor = dialogs->displayColorDialog(color);
- disconnect(dialogs, &CDialogs::onColorChanged, this, &ActionView::dialogCurrentColorChanged);
- return currentColor;
-}
-
void ActionView::updateActionStates()
{
bool hasValidAction = (m_currentActionIndex != -1) && m_itemHandle.Valid();
diff --git a/src/Authoring/Studio/Palettes/Action/ActionView.h b/src/Authoring/Studio/Palettes/Action/ActionView.h
index 4cdd2c58..ab2976f3 100644
--- a/src/Authoring/Studio/Palettes/Action/ActionView.h
+++ b/src/Authoring/Studio/Palettes/Action/ActionView.h
@@ -130,7 +130,6 @@ public:
Q_INVOKABLE QStringList slideNames();
Q_INVOKABLE int slideNameToIndex(const QString &name);
Q_INVOKABLE bool toolTipsEnabled();
- Q_INVOKABLE QColor showColorDialog(const QColor &color);
// CPresentationChangeListener
void OnNewPresentation() override;
diff --git a/src/Authoring/Studio/Palettes/Action/HandlerGenericBaseColor.qml b/src/Authoring/Studio/Palettes/Action/HandlerGenericBaseColor.qml
index 2d2c04f3..b0b9b01f 100644
--- a/src/Authoring/Studio/Palettes/Action/HandlerGenericBaseColor.qml
+++ b/src/Authoring/Studio/Palettes/Action/HandlerGenericBaseColor.qml
@@ -68,7 +68,7 @@ RowLayout {
anchors.fill: parent
onClicked: {
root.listenToColorChanges = true;
- root.selectedColor = _parentView.showColorDialog(rect.color);
+ root.selectedColor = _parentView.showColorDialog(rect.color, instance, handle);
root.listenToColorChanges = false;
root.colorSelected();
}
diff --git a/src/Authoring/Studio/Palettes/Action/HandlerProperty.qml b/src/Authoring/Studio/Palettes/Action/HandlerProperty.qml
index ec618624..a101488e 100644
--- a/src/Authoring/Studio/Palettes/Action/HandlerProperty.qml
+++ b/src/Authoring/Studio/Palettes/Action/HandlerProperty.qml
@@ -249,13 +249,16 @@ ColumnLayout {
case AdditionalMetaDataType.None:
case AdditionalMetaDataType.Rotation:
return xyzPropertyComponent;
- case AdditionalMetaDataType.Color:
- return colorBox;
default:
console.warn("KDAB_TODO implement property handler for additional " +
"typeDataModelDataType.Float3: ", actionProperty.additionalType);
return xyzPropertyComponent;
}
+ case DataModelDataType.Float4:
+ if (actionProperty.additionalType === AdditionalMetaDataType.Color)
+ return colorBox;
+ break;
+
case DataModelDataType.String:
switch (actionProperty.additionalType) {
case AdditionalMetaDataType.StringList:
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;
diff --git a/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemProperty.cpp b/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemProperty.cpp
index 73a7bb7d..d89fcc98 100644
--- a/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemProperty.cpp
+++ b/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemProperty.cpp
@@ -195,7 +195,7 @@ float Qt3DSDMTimelineItemProperty::GetMaximumValue() const
{
float theRetVal = FLT_MIN;
do_all(m_Keyframes, std::bind(CompareAndSet, std::placeholders::_1, std::ref(theRetVal), true));
- if (m_Type.first == DataModelDataType::Float3 && m_Type.second == AdditionalMetaDataType::Color)
+ if (m_Type.first == DataModelDataType::Float4 && m_Type.second == AdditionalMetaDataType::Color)
theRetVal = DataModelToColor(theRetVal);
return theRetVal;
}
@@ -205,7 +205,7 @@ float Qt3DSDMTimelineItemProperty::GetMinimumValue() const
{
float theRetVal = FLT_MAX;
do_all(m_Keyframes, std::bind(CompareAndSet, std::placeholders::_1, std::ref(theRetVal), false));
- if (m_Type.first == DataModelDataType::Float3 && m_Type.second == AdditionalMetaDataType::Color)
+ if (m_Type.first == DataModelDataType::Float4 && m_Type.second == AdditionalMetaDataType::Color)
theRetVal = DataModelToColor(theRetVal);
return theRetVal;
}
@@ -286,18 +286,21 @@ float Qt3DSDMTimelineItemProperty::GetChannelValueAtTime(long inChannelIndex, lo
thePropertySystem->GetInstancePropertyValue(theParentBinding->GetInstanceHandle(),
m_PropertyHandle, theValue);
switch (m_Type.first) {
- case DataModelDataType::Float3: {
+ case DataModelDataType::Float4: {
if (m_Type.second == AdditionalMetaDataType::Color) {
- SFloat3 theFloat3 = qt3dsdm::get<SFloat3>(theValue);
- if (inChannelIndex >= 0 && inChannelIndex < 3)
- return DataModelToColor(theFloat3[inChannelIndex]);
- } else {
- SFloat3 theFloat3 = qt3dsdm::get<SFloat3>(theValue);
- if (inChannelIndex >= 0 && inChannelIndex < 3)
- return theFloat3[inChannelIndex];
+ SFloat4 theFloat4 = qt3dsdm::get<SFloat4>(theValue);
+ if (inChannelIndex >= 0 && inChannelIndex < 4)
+ return DataModelToColor(theFloat4[inChannelIndex]);
}
break;
}
+ case DataModelDataType::Float3: {
+
+ SFloat3 theFloat3 = qt3dsdm::get<SFloat3>(theValue);
+ if (inChannelIndex >= 0 && inChannelIndex < 3)
+ return theFloat3[inChannelIndex];
+ break;
+ }
case DataModelDataType::Float2: {
SFloat2 theFloat2 = qt3dsdm::get<SFloat2>(theValue);
if (inChannelIndex >= 0 && inChannelIndex < 2)
@@ -317,7 +320,7 @@ float Qt3DSDMTimelineItemProperty::GetChannelValueAtTime(long inChannelIndex, lo
&& inChannelIndex < (long)m_AnimationHandles.size()) {
float theValue = theAnimationCore->EvaluateAnimation(
m_AnimationHandles[inChannelIndex], Qt3DSDMTimelineKeyframe::GetTimeInSecs(inTime));
- if (m_Type.first == DataModelDataType::Float3
+ if (m_Type.first == DataModelDataType::Float4
&& m_Type.second == AdditionalMetaDataType::Color)
theValue = DataModelToColor(theValue);
diff --git a/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineTimebar.cpp b/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineTimebar.cpp
index 0cf78a30..0ecefefd 100644
--- a/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineTimebar.cpp
+++ b/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineTimebar.cpp
@@ -61,7 +61,7 @@ Qt3DSDMTimelineTimebar::Qt3DSDMTimelineTimebar(
qt3dsdm::SValue theValue;
if (m_PropertySystem->GetInstancePropertyValue(
m_DataHandle, theClientDataModelBridge->GetSceneAsset().m_TimebarColor, theValue)) {
- qt3dsdm::SFloat3 theTimebarColor = qt3dsdm::get<qt3dsdm::SFloat3>(theValue);
+ qt3dsdm::SFloat4 theTimebarColor = qt3dsdm::get<qt3dsdm::SFloat4>(theValue);
m_Color.SetRGB(static_cast<int>(theTimebarColor.m_Floats[0] * 255.0f),
static_cast<int>(theTimebarColor.m_Floats[1] * 255.0f),
@@ -90,7 +90,7 @@ void Qt3DSDMTimelineTimebar::OnPropertyChanged(qt3dsdm::Qt3DSDMInstanceHandle in
if (m_PropertySystem->GetInstancePropertyValue(
m_DataHandle, theClientDataModelBridge->GetSceneAsset().m_TimebarColor,
theValue)) {
- qt3dsdm::SFloat3 theTimebarColor = qt3dsdm::get<qt3dsdm::SFloat3>(theValue);
+ qt3dsdm::SFloat4 theTimebarColor = qt3dsdm::get<qt3dsdm::SFloat4>(theValue);
m_Color.SetRGB(static_cast<int>(theTimebarColor.m_Floats[0] * 255.0f),
static_cast<int>(theTimebarColor.m_Floats[1] * 255.0f),
diff --git a/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTimeline.cpp b/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTimeline.cpp
index b84d6018..67b4cea8 100644
--- a/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTimeline.cpp
+++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTimeline.cpp
@@ -388,7 +388,7 @@ bool RowTimeline::isColorProperty() const
if (propBinding) {
qt3dsdm::TDataTypePair type = propBinding->GetType();
if (m_rowTree->isProperty()
- && type.first == qt3dsdm::DataModelDataType::Float3
+ && type.first == qt3dsdm::DataModelDataType::Float4
&& type.second == qt3dsdm::AdditionalMetaDataType::Color) {
return true;
}