summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/Authoring/Client/Code/Core/Utility/StudioObjectTypes.h2
-rw-r--r--src/Authoring/Studio/Palettes/Timeline/Bindings/MaterialTimelineItemBinding.cpp5
-rw-r--r--src/Authoring/Studio/Palettes/Timeline/Bindings/MaterialTimelineItemBinding.h1
-rw-r--r--src/Authoring/Studio/Palettes/TimelineGraphicsView/RowManager.cpp12
-rw-r--r--src/Authoring/Studio/Palettes/TimelineGraphicsView/RowMover.cpp29
-rw-r--r--src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineGraphicsScene.cpp4
-rw-r--r--src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTimeline.cpp20
-rw-r--r--src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTree.cpp43
-rw-r--r--src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTree.h6
-rw-r--r--src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTreeContextMenu.cpp45
10 files changed, 70 insertions, 97 deletions
diff --git a/src/Authoring/Client/Code/Core/Utility/StudioObjectTypes.h b/src/Authoring/Client/Code/Core/Utility/StudioObjectTypes.h
index 2b484190..79eafc19 100644
--- a/src/Authoring/Client/Code/Core/Utility/StudioObjectTypes.h
+++ b/src/Authoring/Client/Code/Core/Utility/StudioObjectTypes.h
@@ -72,6 +72,8 @@ enum EStudioObjectType {
OBJTYPE_IS_VARIANT = OBJTYPE_LAYER | OBJTYPE_TEXT | OBJTYPE_MODEL | OBJTYPE_GROUP
| OBJTYPE_COMPONENT,
OBJTYPE_IS_MATERIAL = OBJTYPE_MATERIAL | OBJTYPE_CUSTOMMATERIAL | OBJTYPE_REFERENCEDMATERIAL,
+ OBJTYPE_IS_CONTAINER = ~(OBJTYPE_ALIAS | OBJTYPE_IS_MATERIAL | OBJTYPE_IMAGE | OBJTYPE_TEXT
+ | OBJTYPE_BEHAVIOR | OBJTYPE_EFFECT),
OBJTYPE_IS_SINGULAR = OBJTYPE_SCENE | OBJTYPE_LAYER | OBJTYPE_BEHAVIOR | OBJTYPE_EFFECT
| OBJTYPE_IS_MATERIAL, // Singular: cannot be multiselected
OBJTYPE_IS_UNGROUPABLE = OBJTYPE_IS_SINGULAR | OBJTYPE_IMAGE
diff --git a/src/Authoring/Studio/Palettes/Timeline/Bindings/MaterialTimelineItemBinding.cpp b/src/Authoring/Studio/Palettes/Timeline/Bindings/MaterialTimelineItemBinding.cpp
index d34faf1b..e3483969 100644
--- a/src/Authoring/Studio/Palettes/Timeline/Bindings/MaterialTimelineItemBinding.cpp
+++ b/src/Authoring/Studio/Palettes/Timeline/Bindings/MaterialTimelineItemBinding.cpp
@@ -81,11 +81,6 @@ ITimelineTimebar *CMaterialTimelineItemBinding::GetTimebar()
return new CEmptyTimelineTimebar();
}
-EStudioObjectType CMaterialTimelineItemBinding::GetObjectType() const
-{
- return OBJTYPE_MATERIAL;
-}
-
bool CMaterialTimelineItemBinding::ShowToggleControls() const
{
// Materials have no toggle controls, by design
diff --git a/src/Authoring/Studio/Palettes/Timeline/Bindings/MaterialTimelineItemBinding.h b/src/Authoring/Studio/Palettes/Timeline/Bindings/MaterialTimelineItemBinding.h
index 9f5bebdd..8e188a52 100644
--- a/src/Authoring/Studio/Palettes/Timeline/Bindings/MaterialTimelineItemBinding.h
+++ b/src/Authoring/Studio/Palettes/Timeline/Bindings/MaterialTimelineItemBinding.h
@@ -63,7 +63,6 @@ public: // Construction
public: // Qt3DSDMTimelineItemBinding
ITimelineTimebar *GetTimebar() override;
- EStudioObjectType GetObjectType() const override;
bool ShowToggleControls() const override;
// Hierarchy
long GetChildrenCount() override;
diff --git a/src/Authoring/Studio/Palettes/TimelineGraphicsView/RowManager.cpp b/src/Authoring/Studio/Palettes/TimelineGraphicsView/RowManager.cpp
index 9b52667b..50eff996 100644
--- a/src/Authoring/Studio/Palettes/TimelineGraphicsView/RowManager.cpp
+++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/RowManager.cpp
@@ -224,7 +224,7 @@ void RowManager::selectRow(RowTree *row, bool multiSelect)
if (multiSelect && m_selectedRows.size() > 0) {
// Do not allow singular object types into multiselection
- if ((row->rowType() | m_selectedRows[0]->rowType()) & OBJTYPE_IS_SINGULAR)
+ if ((row->objectType() | m_selectedRows[0]->objectType()) & OBJTYPE_IS_SINGULAR)
return;
}
@@ -275,13 +275,15 @@ void RowManager::updateRulerDuration(bool updateMaxDuration)
long maxDuration = 0; // for setting correct size for the view so scrollbars appear correctly
if (m_layoutTree->count() > 1) {
auto rootRow = static_cast<RowTree *>(m_layoutTree->itemAt(1)->graphicsItem());
- bool isComponent = rootRow->rowType() == OBJTYPE_COMPONENT;
+ bool isComponent = rootRow->objectType() == OBJTYPE_COMPONENT;
for (int i = 1; i < m_layoutTree->count(); ++i) {
RowTree *row_i = static_cast<RowTree *>(m_layoutTree->itemAt(i)->graphicsItem());
long dur_i = row_i->rowTimeline()->getEndTime();
- if (((isComponent && i != 1) || row_i->rowType() == OBJTYPE_LAYER) && dur_i > duration)
+ if (((isComponent && i != 1) || row_i->objectType() == OBJTYPE_LAYER)
+ && dur_i > duration) {
duration = dur_i;
+ }
if (dur_i > maxDuration)
maxDuration = dur_i;
@@ -316,7 +318,7 @@ void RowManager::updateRowFilterRecursive(RowTree *row)
void RowManager::deleteRow(RowTree *row)
{
- if (row && row->rowType() != OBJTYPE_SCENE) {
+ if (row && row->objectType() != OBJTYPE_SCENE) {
if (row->parentRow())
row->parentRow()->removeChild(row);
@@ -379,7 +381,7 @@ bool RowManager::isComponentRoot() const
{
if (m_layoutTree->count() > 1) {
RowTree *root = static_cast<RowTree *>(m_layoutTree->itemAt(1)->graphicsItem());
- return root->rowType() == OBJTYPE_COMPONENT;
+ return root->objectType() == OBJTYPE_COMPONENT;
}
return false;
}
diff --git a/src/Authoring/Studio/Palettes/TimelineGraphicsView/RowMover.cpp b/src/Authoring/Studio/Palettes/TimelineGraphicsView/RowMover.cpp
index 4641753b..3e96f2dc 100644
--- a/src/Authoring/Studio/Palettes/TimelineGraphicsView/RowMover.cpp
+++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/RowMover.cpp
@@ -182,7 +182,7 @@ bool RowMover::isNextSiblingRow(RowTree *rowMain, RowTree *rowSibling) const
bool RowMover::sourceRowsHasMaster() const
{
for (auto sourceRow : qAsConst(m_sourceRows)) {
- if (sourceRow->isMaster() && sourceRow->rowType() != OBJTYPE_LAYER)
+ if (sourceRow->isMaster() && sourceRow->objectType() != OBJTYPE_LAYER)
return true;
}
@@ -208,8 +208,7 @@ void RowMover::updateTargetRow(const QPointF &scenePos, EStudioObjectType rowTyp
bool firstTry)
{
// DnD a presentation / Qml stream from the project panel (to set it as a subpresentation)
- if (rowType == OBJTYPE_PRESENTATION || rowType == OBJTYPE_QML_STREAM
- || rowType == OBJTYPE_MATERIALDATA) {
+ if (rowType & (OBJTYPE_PRESENTATION | OBJTYPE_QML_STREAM | OBJTYPE_MATERIALDATA)) {
if (!m_insertionTarget.isNull())
m_insertionTarget->setDnDState(RowTree::DnDState::None, RowTree::DnDState::SP_TARGET);
@@ -221,16 +220,11 @@ void RowMover::updateTargetRow(const QPointF &scenePos, EStudioObjectType rowTyp
m_insertType = Q3DStudio::DocumentEditorInsertType::LastChild;
if (rowType == OBJTYPE_MATERIALDATA) {
- if (rowAtMouse->rowType() == OBJTYPE_MATERIAL
- || rowAtMouse->rowType() == OBJTYPE_CUSTOMMATERIAL
- || rowAtMouse->rowType() == OBJTYPE_REFERENCEDMATERIAL) {
+ if (rowAtMouse->objectType() & OBJTYPE_IS_MATERIAL)
m_insertionTarget->setDnDState(RowTree::DnDState::SP_TARGET);
- }
} else {
- if ((rowAtMouse->rowType() == OBJTYPE_LAYER
- || rowAtMouse->rowType() == OBJTYPE_MATERIAL
- || rowAtMouse->rowType() == OBJTYPE_IMAGE)
- && !rowAtMouse->isDefaultMaterial()) {
+ if (rowAtMouse->objectType() & (OBJTYPE_LAYER | OBJTYPE_IS_MATERIAL | OBJTYPE_IMAGE)
+ && !rowAtMouse->isDefaultMaterial()) {
m_insertionTarget->setDnDState(RowTree::DnDState::SP_TARGET);
}
}
@@ -249,7 +243,7 @@ void RowMover::updateTargetRow(const QPointF &scenePos, EStudioObjectType rowTyp
if (rowAtMouse) {
double y = rowAtMouse->mapFromScene(scenePos).y();
if (y > TimelineConstants::ROW_H * .25 && y < TimelineConstants::ROW_H * .75) {
- if (rowAtMouse->rowType() & (OBJTYPE_LAYER | OBJTYPE_MATERIAL | OBJTYPE_IMAGE)
+ if (rowAtMouse->objectType() & (OBJTYPE_LAYER | OBJTYPE_IS_MATERIAL | OBJTYPE_IMAGE)
&& !rowAtMouse->isDefaultMaterial()) {
m_rowAutoExpand = nullptr;
m_autoExpandTimer.stop();
@@ -267,7 +261,7 @@ void RowMover::updateTargetRow(const QPointF &scenePos, EStudioObjectType rowTyp
EStudioObjectType theRowType = rowType;
if (theRowType == OBJTYPE_UNKNOWN && m_sourceRows.size() == 1)
- theRowType = m_sourceRows[0]->rowType();
+ theRowType = m_sourceRows[0]->objectType();
// row will be inserted just below rowInsert1 and just above rowInsert2 (if it exists)
RowTree *rowInsert1 = m_scene->rowManager()
@@ -283,8 +277,7 @@ void RowMover::updateTargetRow(const QPointF &scenePos, EStudioObjectType rowTyp
->getRowAtPos(scenePos + QPointF(0, TimelineConstants::ROW_H));
}
- bool valid = rowInsert1 && theRowType != OBJTYPE_MATERIAL
- && theRowType != OBJTYPE_CUSTOMMATERIAL;
+ bool valid = rowInsert1 != nullptr;
if (valid) {
// if dragging over a property or a parent of a property, move to the first row
@@ -362,7 +355,7 @@ void RowMover::updateTargetRow(const QPointF &scenePos, EStudioObjectType rowTyp
if (depth < depthMin || depth > depthMax
|| (theRowType != OBJTYPE_UNKNOWN
&& !CStudioObjectTypes::AcceptableParent(theRowType,
- m_insertionParent->rowType()))
+ m_insertionParent->objectType()))
|| m_insertionParent->locked()) {
valid = false;
}
@@ -370,8 +363,8 @@ void RowMover::updateTargetRow(const QPointF &scenePos, EStudioObjectType rowTyp
for (auto sourceRow : qAsConst(m_sourceRows)) {
if (m_insertionParent == sourceRow
|| m_insertionParent->isDecendentOf(sourceRow)
- || !CStudioObjectTypes::AcceptableParent(sourceRow->rowType(),
- m_insertionParent->rowType())) {
+ || !CStudioObjectTypes::AcceptableParent(sourceRow->objectType(),
+ m_insertionParent->objectType())) {
// prevent insertion under itself, or under unacceptable parent
valid = false;
break;
diff --git a/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineGraphicsScene.cpp b/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineGraphicsScene.cpp
index d7b2d091..b4a52760 100644
--- a/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineGraphicsScene.cpp
+++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineGraphicsScene.cpp
@@ -866,8 +866,8 @@ void TimelineGraphicsScene::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *even
if (treeLabelItem->parentRow()->isProperty()) {
treeLabelItem->parentRow()->togglePropertyExpanded();
} else if (!treeLabelItem->isLocked()
- && treeLabelItem->parentRow()->rowType() != OBJTYPE_SCENE
- && treeLabelItem->parentRow()->rowType() != OBJTYPE_IMAGE) {
+ && treeLabelItem->parentRow()->objectType() != OBJTYPE_SCENE
+ && treeLabelItem->parentRow()->objectType() != OBJTYPE_IMAGE) {
int instance = treeLabelItem->parentRow()->instance();
const auto bridge = g_StudioApp.GetCore()->GetDoc()->GetStudioSystem()
->GetClientDataModelBridge();
diff --git a/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTimeline.cpp b/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTimeline.cpp
index 67b4cea8..25b66911 100644
--- a/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTimeline.cpp
+++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTimeline.cpp
@@ -642,7 +642,7 @@ void RowTimeline::moveDurationBy(double dx)
m_startX += dx;
m_endX += dx;
- if (!m_rowTree->parentRow() || m_rowTree->rowType() == OBJTYPE_LAYER
+ if (!m_rowTree->parentRow() || m_rowTree->objectType() == OBJTYPE_LAYER
|| m_rowTree->hasComponentAncestor()) {
m_minStartX = m_startX;
m_maxEndX = m_endX;
@@ -682,7 +682,7 @@ void RowTimeline::moveDurationTo(double newX)
m_startX = newX;
m_endX = m_startX + durationX;
- if (!m_rowTree->parentRow() || m_rowTree->rowType() == OBJTYPE_LAYER
+ if (!m_rowTree->parentRow() || m_rowTree->objectType() == OBJTYPE_LAYER
|| m_rowTree->hasComponentAncestor()) {
m_minStartX = m_startX;
m_maxEndX = m_endX;
@@ -756,7 +756,7 @@ void RowTimeline::setStartX(double startX)
m_startX = startX;
m_startTime = m_rowTree->m_scene->ruler()->distanceToTime(startX);
- if (!m_rowTree->parentRow() || m_rowTree->parentRow()->rowType() == OBJTYPE_SCENE
+ if (!m_rowTree->parentRow() || m_rowTree->parentRow()->objectType() == OBJTYPE_SCENE
|| m_rowTree->hasComponentAncestor()) {
m_minStartX = 0;
}
@@ -775,7 +775,7 @@ void RowTimeline::setEndX(double endX)
m_endX = endX;
m_endTime = m_rowTree->m_scene->ruler()->distanceToTime(endX);
- if (!m_rowTree->parentRow() || m_rowTree->parentRow()->rowType() == OBJTYPE_SCENE
+ if (!m_rowTree->parentRow() || m_rowTree->parentRow()->objectType() == OBJTYPE_SCENE
|| m_rowTree->hasComponentAncestor()) {
m_maxEndX = 999999;
}
@@ -828,9 +828,9 @@ void RowTimeline::updateChildrenEndRecursive()
void RowTimeline::updateChildrenMinStartXRecursive(RowTree *rowTree)
{
- if (m_rowTree->rowType() != OBJTYPE_SCENE && !rowTree->empty()) {
+ if (m_rowTree->objectType() != OBJTYPE_SCENE && !rowTree->empty()) {
const auto childRows = rowTree->childRows();
- bool isComponentChild = m_rowTree->rowType() == OBJTYPE_COMPONENT
+ bool isComponentChild = m_rowTree->objectType() == OBJTYPE_COMPONENT
|| m_rowTree->hasComponentAncestor();
for (auto child : childRows) {
if (isComponentChild) {
@@ -848,9 +848,9 @@ void RowTimeline::updateChildrenMinStartXRecursive(RowTree *rowTree)
void RowTimeline::updateChildrenMaxEndXRecursive(RowTree *rowTree)
{
- if (m_rowTree->rowType() != OBJTYPE_SCENE && !rowTree->empty()) {
+ if (m_rowTree->objectType() != OBJTYPE_SCENE && !rowTree->empty()) {
const auto childRows = rowTree->childRows();
- bool isComponentChild = m_rowTree->rowType() == OBJTYPE_COMPONENT
+ bool isComponentChild = m_rowTree->objectType() == OBJTYPE_COMPONENT
|| m_rowTree->hasComponentAncestor();
for (auto child : childRows) {
if (isComponentChild) {
@@ -896,7 +896,7 @@ void RowTimeline::setStartTime(long startTime)
m_startTime = startTime;
m_startX = m_rowTree->m_scene->ruler()->timeToDistance(startTime);
- if (!m_rowTree->parentRow() || m_rowTree->parentRow()->rowType() == OBJTYPE_SCENE
+ if (!m_rowTree->parentRow() || m_rowTree->parentRow()->objectType() == OBJTYPE_SCENE
|| m_rowTree->hasComponentAncestor()) {
m_minStartX = 0;
}
@@ -911,7 +911,7 @@ void RowTimeline::setEndTime(long endTime)
m_endTime = endTime;
m_endX = m_rowTree->m_scene->ruler()->timeToDistance(endTime);
- if (!m_rowTree->parentRow() || m_rowTree->parentRow()->rowType() == OBJTYPE_SCENE
+ if (!m_rowTree->parentRow() || m_rowTree->parentRow()->objectType() == OBJTYPE_SCENE
|| m_rowTree->hasComponentAncestor()) {
m_maxEndX = 999999;
}
diff --git a/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTree.cpp b/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTree.cpp
index f92fc58d..e15258cd 100644
--- a/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTree.cpp
+++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTree.cpp
@@ -54,11 +54,11 @@
#include <QtWidgets/qgraphicssceneevent.h>
// object row constructor
-RowTree::RowTree(TimelineGraphicsScene *timelineScene, EStudioObjectType rowType,
+RowTree::RowTree(TimelineGraphicsScene *timelineScene, EStudioObjectType objType,
const QString &label)
: m_rowTimeline(new RowTimeline())
, m_scene(timelineScene)
- , m_rowType(rowType)
+ , m_objectType(objType)
, m_label(label)
{
CDoc *doc = g_StudioApp.GetCore()->GetDoc();
@@ -428,7 +428,7 @@ void RowTree::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, Q
pixRowType = hiResIcons ? (m_locked ? pixPropertyDisabled2x : pixPropertyNormal2x)
: (m_locked ? pixPropertyDisabled : pixPropertyNormal);
} else {
- switch (m_rowType) {
+ switch (m_objectType) {
case OBJTYPE_SCENE:
pixRowType = hiResIcons ? (m_locked ? pixSceneDisabled2x : pixSceneNormal2x)
: (m_locked ? pixSceneDisabled : pixSceneNormal);
@@ -466,6 +466,8 @@ void RowTree::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, Q
: (m_locked ? pixComponentDisabled : pixComponentNormal);
break;
case OBJTYPE_MATERIAL:
+ case OBJTYPE_CUSTOMMATERIAL:
+ case OBJTYPE_REFERENCEDMATERIAL:
pixRowType = hiResIcons ? (m_locked ? pixMaterialDisabled2x : pixMaterialNormal2x)
: (m_locked ? pixMaterialDisabled : pixMaterialNormal);
break;
@@ -509,7 +511,7 @@ void RowTree::setBinding(ITimelineItemBinding *binding)
if (m_expandState == ExpandState::Unknown) {
// Everything but scene/component is initially collapsed and hidden
- if (m_rowType == OBJTYPE_SCENE || m_rowType == OBJTYPE_COMPONENT)
+ if (m_objectType == OBJTYPE_SCENE || m_objectType == OBJTYPE_COMPONENT)
m_expandState = ExpandState::Expanded;
else
m_expandState = ExpandState::HiddenCollapsed;
@@ -597,9 +599,9 @@ int RowTree::depth() const
return m_depth;
}
-EStudioObjectType RowTree::rowType() const
+EStudioObjectType RowTree::objectType() const
{
- return m_rowType;
+ return m_objectType;
}
QString RowTree::propertyType() const
@@ -668,7 +670,7 @@ bool RowTree::isInVariantsFilter() const
{
const QString filterStr = g_StudioApp.m_pMainWnd->getVariantsFilterStr();
- if (m_rowType & ~OBJTYPE_IS_VARIANT || filterStr.isEmpty()
+ if (m_objectType & ~OBJTYPE_IS_VARIANT || filterStr.isEmpty()
|| !m_scene->widgetTimeline()->toolbar()->isVariantsFilterOn()) {
return true;
}
@@ -856,9 +858,7 @@ int RowTree::removeChildFromLayout(RowTree *child) const
bool RowTree::draggable() const
{
return !m_locked && !isProperty()
- && m_rowType != OBJTYPE_IMAGE
- && m_rowType != OBJTYPE_SCENE
- && m_rowType != OBJTYPE_MATERIAL;
+ && m_objectType & ~(OBJTYPE_IMAGE | OBJTYPE_SCENE | OBJTYPE_IS_MATERIAL);
}
void RowTree::updateDepthRecursive()
@@ -1157,13 +1157,7 @@ void RowTree::setActionStates(ActionStates states)
bool RowTree::isContainer() const
{
- return !m_isProperty
- && m_rowType != OBJTYPE_ALIAS
- && m_rowType != OBJTYPE_MATERIAL
- && m_rowType != OBJTYPE_IMAGE
- && m_rowType != OBJTYPE_TEXT
- && m_rowType != OBJTYPE_BEHAVIOR
- && m_rowType != OBJTYPE_EFFECT;
+ return !m_isProperty && m_objectType & OBJTYPE_IS_CONTAINER;
}
bool RowTree::isProperty() const
@@ -1184,17 +1178,17 @@ RowTree *RowTree::getPropertyRow(const QString &type) const
bool RowTree::isPropertyOrMaterial() const
{
- return m_isProperty || m_rowType == OBJTYPE_MATERIAL || m_rowType == OBJTYPE_IMAGE;
+ return m_isProperty || m_objectType & (OBJTYPE_IS_MATERIAL | OBJTYPE_IMAGE);
}
bool RowTree::isComponent() const
{
- return m_rowType == OBJTYPE_COMPONENT;
+ return m_objectType == OBJTYPE_COMPONENT;
}
bool RowTree::isComponentRoot() const
{
- if (m_rowType == OBJTYPE_COMPONENT && m_binding)
+ if (m_objectType == OBJTYPE_COMPONENT && m_binding)
return static_cast<Qt3DSDMTimelineItemBinding *>(m_binding)->isRootComponent();
return false;
@@ -1289,18 +1283,15 @@ bool RowTree::locked() const
// Returns true for items with shy/visible/lock buttons
bool RowTree::hasActionButtons() const
{
- return (!m_isProperty
- && m_indexInLayout != 1
- && m_rowType != OBJTYPE_SCENE
- && m_rowType != OBJTYPE_MATERIAL
- && m_rowType != OBJTYPE_IMAGE);
+ return !m_isProperty && m_indexInLayout != 1
+ && m_objectType & ~(OBJTYPE_SCENE | OBJTYPE_IS_MATERIAL | OBJTYPE_IMAGE);
}
bool RowTree::hasComponentAncestor() const
{
RowTree *parentRow = m_parentRow;
while (parentRow) {
- if (parentRow->rowType() == OBJTYPE_COMPONENT)
+ if (parentRow->objectType() == OBJTYPE_COMPONENT)
return true;
parentRow = parentRow->parentRow();
}
diff --git a/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTree.h b/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTree.h
index 08e85dc5..b028e94d 100644
--- a/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTree.h
+++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTree.h
@@ -78,7 +78,7 @@ public:
Q_DECLARE_FLAGS(ActionStates, ActionState)
explicit RowTree(TimelineGraphicsScene *timelineScene,
- EStudioObjectType rowType = OBJTYPE_UNKNOWN, const QString &label = {});
+ EStudioObjectType objectType = OBJTYPE_UNKNOWN, const QString &label = {});
// property row constructor
explicit RowTree(TimelineGraphicsScene *timelineScene, const QString &propType);
~RowTree();
@@ -127,7 +127,7 @@ public:
int index() const;
int indexInLayout() const;
int treeWidth() const;
- EStudioObjectType rowType() const;
+ EStudioObjectType objectType() const;
QString propertyType() const;
RowTree *getChildAt(int index) const;
RowTree *parentRow() const;
@@ -197,7 +197,7 @@ private:
ExpandState m_expandState = ExpandState::HiddenCollapsed;
TimelineGraphicsScene *m_scene;
RowTreeLabelItem m_labelItem;
- EStudioObjectType m_rowType = OBJTYPE_UNKNOWN;
+ EStudioObjectType m_objectType = OBJTYPE_UNKNOWN;
QString m_propertyType; // for property rows
QString m_label;
QList<RowTree *> m_childRows;
diff --git a/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTreeContextMenu.cpp b/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTreeContextMenu.cpp
index 9544903e..ae5c0bbb 100644
--- a/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTreeContextMenu.cpp
+++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/RowTreeContextMenu.cpp
@@ -54,11 +54,10 @@ RowTreeContextMenu::~RowTreeContextMenu()
void RowTreeContextMenu::initialize()
{
CDoc &doc(*g_StudioApp.GetCore()->GetDoc());
- qt3dsdm::Qt3DSDMInstanceHandle instance
- = static_cast<Qt3DSDMTimelineItemBinding *>(m_TimelineItemBinding)->GetInstance();
+ qt3dsdm::Qt3DSDMInstanceHandle instance = m_RowTree->instance();
// add sub-presentations submenu
- if (m_RowTree->rowType() & (OBJTYPE_LAYER | OBJTYPE_MATERIAL | OBJTYPE_IMAGE)) {
+ if (m_RowTree->objectType() & (OBJTYPE_LAYER | OBJTYPE_IS_MATERIAL | OBJTYPE_IMAGE)) {
m_subpMenu = addMenu(tr("Set sub-presentation"));
connect(m_subpMenu, &QMenu::triggered, this, &RowTreeContextMenu::addSubPresentation);
@@ -70,9 +69,9 @@ void RowTreeContextMenu::initialize()
}
// add datainput controller submenu
- if (m_RowTree->rowType() & ~(OBJTYPE_GUIDE | OBJTYPE_EFFECT | OBJTYPE_ALIAS | OBJTYPE_SCENE)
- && !static_cast<Qt3DSDMTimelineItemBinding *>(m_TimelineItemBinding)
- ->isDefaultMaterial()) {
+ if (m_RowTree->objectType() & ~(OBJTYPE_GUIDE | OBJTYPE_EFFECT | OBJTYPE_ALIAS | OBJTYPE_SCENE)
+ && !m_RowTree->isDefaultMaterial()) {
+
m_diMenu = addMenu(tr("Set datainput controller"));
connect(m_diMenu, &QMenu::triggered, this, &RowTreeContextMenu::addDiController);
@@ -82,9 +81,9 @@ void RowTreeContextMenu::initialize()
// the referenced source, and set datainput control to point to the property
// in the referenced source.
auto refInstance = doc.GetStudioSystem()->GetClientDataModelBridge()
- ->getMaterialReference(instance);
+ ->getMaterialReference(instance);
propList = doc.GetStudioSystem()->GetPropertySystem()
- ->GetControllableProperties(refInstance ? refInstance : instance);
+ ->GetControllableProperties(refInstance ? refInstance : instance);
QMap<int, QAction *> sections;
for (const auto &prop : propList) {
@@ -236,29 +235,21 @@ bool RowTreeContextMenu::canRenameObject() const
void RowTreeContextMenu::addSubPresentation(QAction *action)
{
CDoc &doc(*g_StudioApp.GetCore()->GetDoc());
- qt3dsdm::Qt3DSDMInstanceHandle instance =
- static_cast<Qt3DSDMTimelineItemBinding *>(m_TimelineItemBinding)->GetInstance();
+ auto &bridge(*doc.GetStudioSystem()->GetClientDataModelBridge());
+
+ qt3dsdm::Qt3DSDMInstanceHandle instance = m_RowTree->instance();
Q3DStudio::CString presentationId;
if (action->text() != tr("[None]"))
presentationId = Q3DStudio::CString::fromQString(action->text());
- if (m_RowTree->rowType() == OBJTYPE_LAYER) {
- qt3dsdm::Qt3DSDMPropertyHandle propHandle = doc.GetPropertySystem()
- ->GetAggregateInstancePropertyByName(instance, L"sourcepath");
+ if (m_RowTree->objectType() == OBJTYPE_LAYER) {
+ qt3dsdm::Qt3DSDMPropertyHandle propHandle = bridge.GetSourcePathProperty();
+
Q3DStudio::SCOPED_DOCUMENT_EDITOR(doc, tr("Set layer sub-presentation"))
->SetInstancePropertyValueAsRenderable(instance, propHandle, presentationId);
- } else if (m_RowTree->rowType() == OBJTYPE_MATERIAL) {
- auto &bridge(*doc.GetStudioSystem()->GetClientDataModelBridge());
+ } else if (m_RowTree->objectType() & OBJTYPE_IS_MATERIAL) {
// if this is a ref material, update the material it references
-
- qt3dsdm::Qt3DSDMInstanceHandle refInstance = 0;
- if (bridge.GetObjectType(instance) == OBJTYPE_REFERENCEDMATERIAL) {
- auto optValue = doc.getSceneEditor()->GetInstancePropertyValue(instance,
- bridge.GetObjectDefinitions().m_ReferencedMaterial
- .m_ReferencedMaterial.m_Property);
- if (optValue.hasValue())
- refInstance = bridge.GetInstance(doc.GetSceneInstance(), optValue.getValue());
- }
+ qt3dsdm::Qt3DSDMInstanceHandle refInstance = bridge.getMaterialReference(instance);
ChooseImagePropertyDlg dlg(refInstance ? refInstance : instance, refInstance != 0);
if (dlg.exec() == QDialog::Accepted) {
@@ -276,9 +267,9 @@ void RowTreeContextMenu::addSubPresentation(QAction *action)
presentationId);
}
}
- } else if (m_RowTree->rowType() == OBJTYPE_IMAGE) {
- qt3dsdm::Qt3DSDMPropertyHandle propHandle = doc.GetPropertySystem()
- ->GetAggregateInstancePropertyByName(instance, L"subpresentation");
+ } else if (m_RowTree->objectType() == OBJTYPE_IMAGE) {
+ qt3dsdm::Qt3DSDMPropertyHandle propHandle = bridge.getSubpresentationProperty();
+
Q3DStudio::SCOPED_DOCUMENT_EDITOR(doc, tr("Set image sub-presentation"))
->SetInstancePropertyValueAsRenderable(instance, propHandle, presentationId);
}