diff options
author | Mahmoud Badri <mahmoud.badri@qt.io> | 2018-02-27 14:37:41 +0200 |
---|---|---|
committer | Mahmoud Badri <mahmoud.badri@qt.io> | 2018-03-19 09:03:27 +0000 |
commit | 089ab17e462646dcd9edf785aa6850ad92b3a8e0 (patch) | |
tree | a58f0c08022bb2ca1a0dae672ff796dd1a7a62ac /src/Authoring/Studio/Palettes/Timeline/Bindings | |
parent | 6741e0b808aef4992c81df1128b8db0f8113f49f (diff) |
Continue timeline work
Split timeline and tree views, implement layer locking, filter rows, start connection to the app data mode.
Task-number: QT3DS-1262
Change-Id: I54fb659e5c4f1103b8cf792b04bcaf012779cf1a
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
Diffstat (limited to 'src/Authoring/Studio/Palettes/Timeline/Bindings')
12 files changed, 74 insertions, 72 deletions
diff --git a/src/Authoring/Studio/Palettes/Timeline/Bindings/ITimelineItemBinding.h b/src/Authoring/Studio/Palettes/Timeline/Bindings/ITimelineItemBinding.h index bac7136c..9469981d 100644 --- a/src/Authoring/Studio/Palettes/Timeline/Bindings/ITimelineItemBinding.h +++ b/src/Authoring/Studio/Palettes/Timeline/Bindings/ITimelineItemBinding.h @@ -37,6 +37,7 @@ #include "SIterator.h" class CBaseStateRow; +class RowTree; class CControlWindowListener; class ITimelineKeyframesManager; @@ -83,7 +84,9 @@ public: virtual ~ITimelineItemBinding() {} virtual ITimelineItem *GetTimelineItem() = 0; - virtual CBaseStateRow *GetRow() = 0; + virtual CBaseStateRow *GetRow() = 0; // Mahmoud_TODO: remove after timeline is complete + virtual RowTree *getRowTree() const = 0; // UI + virtual void setRowTree(RowTree *row) = 0; // Events virtual void SetSelected(bool multiSelect) = 0; diff --git a/src/Authoring/Studio/Palettes/Timeline/Bindings/ITimelineItemProperty.h b/src/Authoring/Studio/Palettes/Timeline/Bindings/ITimelineItemProperty.h index f8ee3fa3..26b00c09 100644 --- a/src/Authoring/Studio/Palettes/Timeline/Bindings/ITimelineItemProperty.h +++ b/src/Authoring/Studio/Palettes/Timeline/Bindings/ITimelineItemProperty.h @@ -36,6 +36,7 @@ #include "Qt3DSDMMetaData.h" #include "Qt3DSString.h" +class RowTree; class CPropertyRow; class IKeyframe; class ITimelineKeyframesManager; @@ -62,7 +63,9 @@ public: virtual void Bind(CPropertyRow *inRow) = 0; virtual void Release() = 0; - virtual CPropertyRow *GetRow() = 0; + virtual void setRowTree(RowTree *row) = 0; + virtual RowTree *getRowTree() const = 0; + virtual CPropertyRow *GetRow() = 0; // Mahmoud_TODO: delete after new timeline is done // Keyframes virtual ITimelineKeyframesManager *GetKeyframesManager() const = 0; diff --git a/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMAssetTimelineKeyframe.cpp b/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMAssetTimelineKeyframe.cpp index 51fd2377..4626545c 100644 --- a/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMAssetTimelineKeyframe.cpp +++ b/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMAssetTimelineKeyframe.cpp @@ -45,6 +45,11 @@ Qt3DSDMAssetTimelineKeyframe::~Qt3DSDMAssetTimelineKeyframe() { } +void Qt3DSDMAssetTimelineKeyframe::setUI(Keyframe *kfUI) +{ + m_ui = kfUI; +} + bool Qt3DSDMAssetTimelineKeyframe::IsSelected() const { return m_Selected; @@ -77,4 +82,4 @@ bool Qt3DSDMAssetTimelineKeyframe::IsDynamic() const void Qt3DSDMAssetTimelineKeyframe::SetSelected(bool inSelected) { m_Selected = inSelected; -}
\ No newline at end of file +} diff --git a/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMAssetTimelineKeyframe.h b/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMAssetTimelineKeyframe.h index c57837da..fc22302c 100644 --- a/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMAssetTimelineKeyframe.h +++ b/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMAssetTimelineKeyframe.h @@ -60,10 +60,14 @@ public: long GetTime() const override; void SetTime(const long inNewTime) override; void SetDynamic(bool inIsDynamic) override; + void setUI(Keyframe *kfUI) override; bool IsDynamic() const override; void SetSelected(bool inSelected); void UpdateTime(const long inTime) { m_Time = inTime; } + +private: + Keyframe *m_ui; }; #endif // QT3DSDM_ASSET_KEYFRAME_H diff --git a/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemBinding.cpp b/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemBinding.cpp index 02ff7c58..eefe295a 100644 --- a/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemBinding.cpp +++ b/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemBinding.cpp @@ -375,11 +375,22 @@ ITimelineItem *Qt3DSDMTimelineItemBinding::GetTimelineItem() return this; } +// Mahmoud_TODO: remove after finishing the new timeline CBaseStateRow *Qt3DSDMTimelineItemBinding::GetRow() { return m_Row; } +RowTree *Qt3DSDMTimelineItemBinding::getRowTree() const +{ + return m_rowTree; +} + +void Qt3DSDMTimelineItemBinding::setRowTree(RowTree *row) +{ + m_rowTree = row; +} + void Qt3DSDMTimelineItemBinding::SetSelected(bool inMultiSelect) { if (!inMultiSelect) @@ -880,12 +891,12 @@ Qt3DSDMTimelineItemBinding::GetOrCreatePropertyBinding(Qt3DSDMPropertyHandle inP * @param inAppend true to skip the check to find where to insert. ( true if this is a * loading/initializing step, where the call is already done in order ) */ -CPropertyRow *Qt3DSDMTimelineItemBinding::AddPropertyRow(Qt3DSDMPropertyHandle inPropertyHandle, +void Qt3DSDMTimelineItemBinding::AddPropertyRow(Qt3DSDMPropertyHandle inPropertyHandle, bool inAppend /*= false */) { ITimelineItemProperty *theTimelineProperty = GetPropertyBinding(inPropertyHandle); if (theTimelineProperty && theTimelineProperty->GetRow()) // if created, bail - return {}; + return; if (!theTimelineProperty) theTimelineProperty = GetOrCreatePropertyBinding(inPropertyHandle); @@ -917,21 +928,8 @@ CPropertyRow *Qt3DSDMTimelineItemBinding::AddPropertyRow(Qt3DSDMPropertyHandle i } } - CPropertyRow *propertyRow = nullptr; - // Create a new property row - if (m_createUIRow) { - propertyRow = m_TransMgr->CreateNewPropertyRow(theTimelineProperty, m_Row, - theNextProperty ? theNextProperty->GetRow() : nullptr); - } else { - propertyRow = new CPropertyRow(theTimelineProperty, m_Row); - m_Row->AddPropertyRow(propertyRow, theNextProperty ? theNextProperty->GetRow() : nullptr); - theTimelineProperty->Bind(propertyRow); - } - // Update keyframes AddKeyframes(theTimelineProperty); - - return propertyRow; } void Qt3DSDMTimelineItemBinding::RemovePropertyRow(Qt3DSDMPropertyHandle inPropertyHandle) @@ -940,16 +938,8 @@ void Qt3DSDMTimelineItemBinding::RemovePropertyRow(Qt3DSDMPropertyHandle inPrope if (theIter != m_PropertyBindingMap.end()) { ITimelineItemProperty *thePropertyBinding = theIter->second; - bool theUpdateUI = DeleteAssetKeyframesWhereApplicable(thePropertyBinding); - - m_TransMgr->RemovePropertyRow(thePropertyBinding); + DeleteAssetKeyframesWhereApplicable(thePropertyBinding); m_PropertyBindingMap.erase(theIter); - - // UI must update - if (m_Row && theUpdateUI) { - m_Row->ForceEmitChildrenChanged(); - m_Row->setDirty(true); - } } } @@ -1243,7 +1233,8 @@ void Qt3DSDMTimelineItemBinding::OnAddChild(Qt3DSDMInstanceHandle inInstance) if (theNextChild != 0) theNextItem = m_TransMgr->GetOrCreate(theNextChild); - m_Row->AddChildRow(m_TransMgr->GetOrCreate(inInstance), theNextItem); + // Mahmoud_TODO: remove +// m_Row->AddChildRow(m_TransMgr->GetOrCreate(inInstance), theNextItem); } } diff --git a/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemBinding.h b/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemBinding.h index 81e0df0b..9b6a5b84 100644 --- a/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemBinding.h +++ b/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemBinding.h @@ -54,6 +54,7 @@ class CTimelineTranslationManager; class CBaseStateRow; class Qt3DSDMTimelineItemProperty; class CCmdDataModelSetKeyframeTime; +class RowTree; namespace qt3dsdm { class CStudioSystem; @@ -74,7 +75,8 @@ protected: // Typedef typedef std::vector<Qt3DSDMAssetTimelineKeyframe> TAssetKeyframeList; protected: - CBaseStateRow *m_Row; + CBaseStateRow *m_Row; // TODO: remove after finishing the new timeline + RowTree *m_rowTree = nullptr; CTimelineTranslationManager *m_TransMgr; qt3dsdm::Qt3DSDMInstanceHandle m_DataHandle; ITimelineItemBinding *m_Parent; @@ -121,7 +123,9 @@ public: // ITimelineItemBinding ITimelineItem *GetTimelineItem() override; - CBaseStateRow *GetRow() override; + CBaseStateRow *GetRow() override; // Mahmoud_TODO: remove after finishing the new timeline + RowTree *getRowTree() const override; + void setRowTree(RowTree *row) override; void SetSelected(bool inMultiSelect) override; void OnCollapsed() override; void ClearKeySelection() override; @@ -179,8 +183,8 @@ public: long inInstanceCount) override; void RefreshStateRow(bool inRefreshChildren = false); - virtual CPropertyRow* AddPropertyRow(qt3dsdm::Qt3DSDMPropertyHandle inPropertyHandle, - bool inAppend = false); + virtual void AddPropertyRow(qt3dsdm::Qt3DSDMPropertyHandle inPropertyHandle, + bool inAppend = false); virtual void RemovePropertyRow(qt3dsdm::Qt3DSDMPropertyHandle inPropertyHandle); virtual void RefreshPropertyKeyframe(qt3dsdm::Qt3DSDMPropertyHandle inPropertyHandle, qt3dsdm::Qt3DSDMKeyframeHandle, diff --git a/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemProperty.cpp b/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemProperty.cpp index eb6f4864..b6e79d5b 100644 --- a/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemProperty.cpp +++ b/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemProperty.cpp @@ -143,6 +143,11 @@ void Qt3DSDMTimelineItemProperty::ReleaseKeyframes() m_AnimationHandles.clear(); } +qt3dsdm::Qt3DSDMPropertyHandle Qt3DSDMTimelineItemProperty::getPropertyHandle() const +{ + return m_PropertyHandle; +} + // Type doesn't change and due to the logic required to figure this out, cache it. void Qt3DSDMTimelineItemProperty::InitializeCachedVariables(qt3dsdm::Qt3DSDMInstanceHandle inInstance) { @@ -230,6 +235,11 @@ void Qt3DSDMTimelineItemProperty::Bind(CPropertyRow *inRow) m_Row = inRow; } +RowTree *Qt3DSDMTimelineItemProperty::getRowTree() const +{ + return m_rowTree; +} + void Qt3DSDMTimelineItemProperty::Release() { m_Row = nullptr; @@ -408,6 +418,11 @@ void Qt3DSDMTimelineItemProperty::SelectKeyframes(bool inSelected, long inTime / DoSelectKeyframes(inSelected, inTime, false, theParent); } +void Qt3DSDMTimelineItemProperty::setRowTree(RowTree *rowTree) +{ + m_rowTree = rowTree; +} + CPropertyRow *Qt3DSDMTimelineItemProperty::GetRow() { return m_Row; diff --git a/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemProperty.h b/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemProperty.h index 29ba585d..9f304167 100644 --- a/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemProperty.h +++ b/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemProperty.h @@ -37,6 +37,7 @@ #include "Qt3DSDMTimeline.h" #include "Qt3DSDMPropertyDefinition.h" +class RowTree; class CTimelineTranslationManager; class CCmdDataModelSetKeyframeValue; class Qt3DSDMTimelineItemBinding; @@ -78,9 +79,11 @@ public: // IKeyframeSelector void SelectKeyframes(bool inSelected, long inTime = -1) override; + void setRowTree(RowTree *rowTree) override; void Bind(CPropertyRow *inRow) override; + RowTree *getRowTree() const override; void Release() override; - CPropertyRow *GetRow() override; + CPropertyRow *GetRow() override; // Mahmoud_TODO: delete bool RefreshKeyframe(qt3dsdm::Qt3DSDMKeyframeHandle inKeyframe, ETimelineKeyframeTransaction inTransaction); @@ -90,6 +93,8 @@ public: void RefreshKeyFrames(void); + qt3dsdm::Qt3DSDMPropertyHandle getPropertyHandle() const; + protected: void InitializeCachedVariables(qt3dsdm::Qt3DSDMInstanceHandle inInstance); bool CreateKeyframeIfNonExistent(qt3dsdm::Qt3DSDMKeyframeHandle inKeyframe, @@ -114,6 +119,9 @@ protected: qt3dsdm::TDataTypePair m_Type; Q3DStudio::CString m_Name; std::vector<std::shared_ptr<qt3dsdm::ISignalConnection>> m_Signals; + +private: + RowTree *m_rowTree = nullptr; }; #endif // QT3DSDM_TIMELINE_ITEM_PROPERTY_H diff --git a/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineKeyframe.cpp b/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineKeyframe.cpp index b97261fc..072fe8d9 100644 --- a/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineKeyframe.cpp +++ b/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineKeyframe.cpp @@ -131,6 +131,11 @@ void Qt3DSDMTimelineKeyframe::SetDynamic(bool inIsDynamic) } } +void Qt3DSDMTimelineKeyframe::setUI(Keyframe *kfUI) +{ + m_ui = kfUI; +} + // Only the first key of a track can be dynamic. bool Qt3DSDMTimelineKeyframe::IsDynamic() const { diff --git a/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineKeyframe.h b/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineKeyframe.h index ccec6ef0..1d6d410e 100644 --- a/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineKeyframe.h +++ b/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineKeyframe.h @@ -40,6 +40,7 @@ class IDoc; class CDoc; class CCmdBatch; class COffsetKeyframesCommandHelper; +struct Keyframe; //============================================================================== /** @@ -56,6 +57,7 @@ protected: m_KeyframeHandles; ///< no. corresponds to the channels the animated property has. CDoc *m_Doc; bool m_Selected; + Keyframe *m_ui; public: Qt3DSDMTimelineKeyframe(IDoc *inDoc); @@ -66,6 +68,7 @@ public: long GetTime() const override; void SetTime(const long inNewTime) override; void SetDynamic(bool inIsDynamic) override; + void setUI(Keyframe *kfUI) override; bool IsDynamic() const override; void AddKeyframeHandle(qt3dsdm::Qt3DSDMKeyframeHandle inHandle); diff --git a/src/Authoring/Studio/Palettes/Timeline/Bindings/TimelineTranslationManager.cpp b/src/Authoring/Studio/Palettes/Timeline/Bindings/TimelineTranslationManager.cpp index bc10a373..c97a046f 100644 --- a/src/Authoring/Studio/Palettes/Timeline/Bindings/TimelineTranslationManager.cpp +++ b/src/Authoring/Studio/Palettes/Timeline/Bindings/TimelineTranslationManager.cpp @@ -320,25 +320,6 @@ void CTimelineTranslationManager::OnNewPresentation() } //============================================================================== -/** - * Selection events on the old data model was triggered via signals on the actual objects. - * For the new data model, it would be via this OnSelectionChange event. - */ -void CTimelineTranslationManager::OnSelectionChange(Q3DStudio::SSelectedValue inNewSelectable) -{ - // Deselect all items - TInstanceHandleBindingMap::const_iterator theIter = m_InstanceHandleBindingMap.begin(); - for (; theIter != m_InstanceHandleBindingMap.end(); ++theIter) { - ITimelineItemBinding *theBinding = theIter->second; - CBaseStateRow *theRow = theBinding->GetRow(); - if (theRow) - theRow->OnSelected(false); - } - - // Select new - if (inNewSelectable) - SetSelected(inNewSelectable, true); -} CDoc *CTimelineTranslationManager::GetDoc() const { @@ -523,25 +504,6 @@ void CTimelineTranslationManager::ClearBindingsKeyframeSelection() } //============================================================================== -/** - * Helper function to find the binding that corresponds to inSelectable and set its selection state - */ -void CTimelineTranslationManager::SetSelected(Q3DStudio::SSelectedValue inSelectable, - bool inSelected) -{ - qt3dsdm::TInstanceHandleList theInstances = inSelectable.GetSelectedInstances(); - for (size_t idx = 0, end = theInstances.size(); idx < end; ++idx) { - Qt3DSDMInstanceHandle theInstance(theInstances[idx]); - if (GetStudioSystem()->IsInstance(theInstance)) { - ITimelineItemBinding *theBinding = EnsureLoaded(theInstance); - if (theBinding) { - CBaseStateRow *theRow = theBinding->GetRow(); - if (theRow) - theRow->OnSelected(inSelected); - } - } - } -} ITimelineItemBinding *CTimelineTranslationManager::EnsureLoaded(Qt3DSDMInstanceHandle inHandle) { diff --git a/src/Authoring/Studio/Palettes/Timeline/Bindings/TimelineTranslationManager.h b/src/Authoring/Studio/Palettes/Timeline/Bindings/TimelineTranslationManager.h index 14e34f4b..83443c2c 100644 --- a/src/Authoring/Studio/Palettes/Timeline/Bindings/TimelineTranslationManager.h +++ b/src/Authoring/Studio/Palettes/Timeline/Bindings/TimelineTranslationManager.h @@ -110,7 +110,6 @@ public: void ClearKeyframeSelection(); void OnNewPresentation(); - void OnSelectionChange(Q3DStudio::SSelectedValue inNewSelectable); qt3dsdm::CStudioSystem *GetStudioSystem() const; |