aboutsummaryrefslogtreecommitdiffstats
path: root/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@qt.io>2021-05-12 14:15:47 +0300
committerMiikka Heikkinen <miikka.heikkinen@qt.io>2021-05-27 08:43:50 +0000
commit125cdcc3a03e1cb0ce7e8260618d4d9abe7d383e (patch)
treefbed7330db9d33ce227f77326c4c0ce5ed500742 /share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d
parenta3c51cdd4a5882e4990fe2d44ab9afaf7b25a3dc (diff)
QmlDesigner: Block changing eulerRotation for 3D Node that has rotation
QtQuick3D doesn't support both rotation and eulerRotation set on same node, so we delete existing quaternion rotation if user sets an euler rotation to the node. If node has quaternion rotation animation, we block any change to eulerRotation in the node. 3D editor also disables the rotation gizmo for blocked nodes. Task-number: QDS-4335 Change-Id: I4ce7b022c732a9547751f101548ecea948279db8 Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Diffstat (limited to 'share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d')
-rw-r--r--share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/generalhelper.cpp18
-rw-r--r--share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/generalhelper.h6
2 files changed, 24 insertions, 0 deletions
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/generalhelper.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/generalhelper.cpp
index 133035de20..f65e3ccc4f 100644
--- a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/generalhelper.cpp
+++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/generalhelper.cpp
@@ -356,6 +356,24 @@ bool GeneralHelper::isMacOS() const
#endif
}
+void GeneralHelper::addRotationBlocks(const QSet<QQuick3DNode *> &nodes)
+{
+ m_rotationBlockedNodes.unite(nodes);
+ emit rotationBlocksChanged();
+}
+
+void GeneralHelper::removeRotationBlocks(const QSet<QQuick3DNode *> &nodes)
+{
+ for (auto node : nodes)
+ m_rotationBlockedNodes.remove(node);
+ emit rotationBlocksChanged();
+}
+
+bool GeneralHelper::isRotationBlocked(QQuick3DNode *node) const
+{
+ return m_rotationBlockedNodes.contains(node);
+}
+
bool GeneralHelper::eventFilter(QObject *obj, QEvent *event)
{
if (event->type() == QEvent::DynamicPropertyChange) {
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/generalhelper.h b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/generalhelper.h
index 6347520e69..212411eee4 100644
--- a/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/generalhelper.h
+++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/editor3d/generalhelper.h
@@ -93,11 +93,16 @@ public:
bool isMacOS() const;
+ void addRotationBlocks(const QSet<QQuick3DNode *> &nodes);
+ void removeRotationBlocks(const QSet<QQuick3DNode *> &nodes);
+ Q_INVOKABLE bool isRotationBlocked(QQuick3DNode *node) const;
+
signals:
void overlayUpdateNeeded();
void toolStateChanged(const QString &sceneId, const QString &tool, const QVariant &toolState);
void hiddenStateChanged(QQuick3DNode *node);
void lockedStateChanged(QQuick3DNode *node);
+ void rotationBlocksChanged();
protected:
bool eventFilter(QObject *obj, QEvent *event) final;
@@ -110,6 +115,7 @@ private:
QHash<QString, QVariantMap> m_toolStates;
QHash<QString, QVariantMap> m_toolStatesPending;
QSet<QQuick3DNode *> m_gizmoTargets;
+ QSet<QQuick3DNode *> m_rotationBlockedNodes;
};
}