summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomi Korpipaa <tomi.korpipaa@qt.io>2019-01-29 09:20:21 +0200
committerTomi Korpipää <tomi.korpipaa@qt.io>2019-01-31 05:17:12 +0000
commit8e0f95b4dcf98042900b2351dfdd5edf7053195d (patch)
tree1faf6777a2d860f2a9460d15ce5603f016e2aa0f
parent410cd933be319f0f79e63aac368636e0988291c3 (diff)
Disable toggling eyeball on master slide
Task-number: QT3DS-2924 Change-Id: I497fa2357018403a4b946adb54ad76a96c706aa5 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io> Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io> Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
-rw-r--r--src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp13
-rw-r--r--src/Authoring/Studio/Palettes/Inspector/InspectorControlView.h1
-rw-r--r--src/Authoring/Studio/Palettes/Inspector/InspectorControlView.qml1
-rw-r--r--src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTree.cpp21
-rw-r--r--src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTree.h1
5 files changed, 33 insertions, 4 deletions
diff --git a/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp b/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp
index 79e76f3b..69543a12 100644
--- a/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp
+++ b/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.cpp
@@ -57,6 +57,7 @@
#include "ProjectFile.h"
#include "MaterialRefView.h"
#include "BasicObjectsModel.h"
+#include "Qt3DSDMSlides.h"
#include <QtCore/qtimer.h>
#include <QtQml/qqmlcontext.h>
@@ -293,6 +294,8 @@ bool InspectorControlView::canLinkProperty(int instance, int handle) const
&& (type & (OBJTYPE_CUSTOMMATERIAL | OBJTYPE_MATERIAL | OBJTYPE_REFERENCEDMATERIAL))) {
return false;
}
+ if (doc->GetStudioSystem()->GetPropertySystem()->GetName(handle) == L"eyeball")
+ return false;
return doc->GetDocumentReader().CanPropertyBeLinked(instance, handle);
}
@@ -377,6 +380,16 @@ QString InspectorControlView::titleIcon() const
return {};
}
+bool InspectorControlView::isEditable(int handle) const
+{
+ CDoc *doc = g_StudioApp.GetCore()->GetDoc();
+ if (doc->GetStudioSystem()->GetSlideSystem()->IsMasterSlide(doc->GetActiveSlide())
+ && doc->GetStudioSystem()->GetPropertySystem()->GetName(handle) == L"eyeball") {
+ return false;
+ }
+ return true;
+}
+
void InspectorControlView::OnSelectionSet(Q3DStudio::SSelectedValue inSelectable)
{
updateInspectable(g_StudioApp.GetInspectableFromSelectable(inSelectable));
diff --git a/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.h b/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.h
index 6cb7fd21..98d67f41 100644
--- a/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.h
+++ b/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.h
@@ -84,6 +84,7 @@ public:
Q_INVOKABLE QString convertPathToProjectRoot(const QString &presentationPath);
Q_INVOKABLE bool isRefMaterial(int instance) const;
Q_INVOKABLE QString noneString() const;
+ Q_INVOKABLE bool isEditable(int handle) const;
// IDataModelListener
void OnBeginDataModelNotifications() override;
diff --git a/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.qml b/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.qml
index 3677bc0e..9a9c0c01 100644
--- a/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.qml
+++ b/src/Authoring/Studio/Palettes/Inspector/InspectorControlView.qml
@@ -237,6 +237,7 @@ Rectangle {
RowLayout {
id: groupDelegateItem
spacing: 0
+ enabled: _parentView.isEditable(modelData.handle)
property alias loadedItem: loader.item
diff --git a/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTree.cpp b/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTree.cpp
index 4ecd05b8..ffa04bb8 100644
--- a/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTree.cpp
+++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTree.cpp
@@ -38,6 +38,11 @@
#include "TreeHeader.h"
#include "StudioPreferences.h"
#include "KeyframeManager.h"
+#include "StudioApp.h"
+#include "Core.h"
+#include "Doc.h"
+#include "Qt3DSDMStudioSystem.h"
+#include "Qt3DSDMSlides.h"
#include <QtGui/qpainter.h>
#include "QtGui/qtextcursor.h"
@@ -53,6 +58,9 @@ RowTree::RowTree(TimelineGraphicsScene *timelineScene, EStudioObjectType rowType
m_scene = timelineScene;
m_rowType = rowType;
m_label = label;
+ CDoc *doc = g_StudioApp.GetCore()->GetDoc();
+ m_onMasterSlide = doc->GetStudioSystem()->GetSlideSystem()->IsMasterSlide(
+ doc->GetActiveSlide());
initialize();
}
@@ -222,17 +230,21 @@ void RowTree::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, Q
static const QPixmap pixEmpty = QPixmap(":/images/Toggle-Empty.png");
static const QPixmap pixShy = QPixmap(":/images/Toggle-Shy.png");
static const QPixmap pixHide = QPixmap(":/images/Toggle-HideShow.png");
+ static const QPixmap pixHideDisabled = QPixmap(":/images/Toggle-HideShow-disabled.png");
static const QPixmap pixHideCtrld = QPixmap(":/images/Toggle-HideShowControlled.png");
static const QPixmap pixLock = QPixmap(":/images/Toggle-Lock.png");
if (hasActionButtons()) {
- painter->drawPixmap(m_rectShy , m_shy ? pixShy : pixEmpty);
+ painter->drawPixmap(m_rectShy, m_shy ? pixShy : pixEmpty);
// Eyeball visibility follows the visibility setting for the object even if it has
// datainput controller
- if (m_visibilityCtrld)
+ // Disable eyeball from master slide
+ if (m_onMasterSlide)
+ painter->drawPixmap(m_rectVisible, pixHideDisabled);
+ else if (m_visibilityCtrld)
painter->drawPixmap(m_rectVisible, m_visible ? pixHideCtrld : pixEmpty);
else
painter->drawPixmap(m_rectVisible, m_visible ? pixHide : pixEmpty);
- painter->drawPixmap(m_rectLocked , m_locked ? pixLock : pixEmpty);
+ painter->drawPixmap(m_rectLocked, m_locked ? pixLock : pixEmpty);
}
static const QPixmap pixInsertLeft = QPixmap(":/images/Insert-Left.png");
@@ -795,7 +807,8 @@ TreeControlType RowTree::getClickedControl(const QPointF &scenePos)
if (m_rectShy.contains(p.x(), p.y())) {
toggleShy();
return TreeControlType::Shy;
- } else if (m_rectVisible.contains(p.x(), p.y())) {
+ } else if (!m_onMasterSlide && m_rectVisible.contains(p.x(), p.y())) {
+ // Prevent toggling hide on master slide
toggleVisible();
return TreeControlType::Hide;
} else if (m_rectLocked.contains(p.x(), p.y())) {
diff --git a/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTree.h b/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTree.h
index bde2da48..845cdbcf 100644
--- a/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTree.h
+++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTree.h
@@ -181,6 +181,7 @@ private:
bool m_arrowVisible = false;
bool m_dndHover = false;
bool m_visibilityCtrld = false;
+ bool m_onMasterSlide = false;
DnDState m_dndState = DnDState::None;
ActionStates m_actionStates = ActionState::None;
bool m_hasSubpresentation = false;