From 54c2ecd76378d1f152733f383c0a0249324c6430 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Wed, 30 May 2018 15:44:18 +0300 Subject: Remove old timeline code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove unused files and unused functionality from remaining files. Moved some still used functionality to better places. It is likely that a lot of unnecessary code still remains. Task-number: QT3DS-1828 Change-Id: I199f67e7d34acbc4d707b75502a4b54e0f9a7d02 Reviewed-by: Kaj Grönholm Reviewed-by: Mahmoud Badri Reviewed-by: Tomi Korpipää --- .../Bindings/Qt3DSDMTimelineItemBinding.cpp | 251 +-------------------- 1 file changed, 5 insertions(+), 246 deletions(-) (limited to 'src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemBinding.cpp') diff --git a/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemBinding.cpp b/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemBinding.cpp index 999062da..f1e5c9cc 100644 --- a/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemBinding.cpp +++ b/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemBinding.cpp @@ -40,14 +40,12 @@ #include "TimeEditDlg.h" #include "EmptyTimelineTimebar.h" #include "Qt3DSDMTimelineTimebar.h" -#include "BaseStateRow.h" -#include "PropertyRow.h" -#include "KeyframesManager.h" #include "StudioApp.h" #include "Core.h" #include "Dialogs.h" #include "GraphUtils.h" #include "Qt3DSDMDataCore.h" +#include "DropTarget.h" // Data model specific #include "IDoc.h" @@ -72,8 +70,7 @@ using namespace qt3dsdm; Qt3DSDMTimelineItemBinding::Qt3DSDMTimelineItemBinding(CTimelineTranslationManager *inMgr, Qt3DSDMInstanceHandle inDataHandle) - : m_Row(nullptr) - , m_TransMgr(inMgr) + : m_TransMgr(inMgr) , m_DataHandle(inDataHandle) , m_Parent(nullptr) , m_TimelineTimebar(nullptr) @@ -84,8 +81,7 @@ Qt3DSDMTimelineItemBinding::Qt3DSDMTimelineItemBinding(CTimelineTranslationManag } Qt3DSDMTimelineItemBinding::Qt3DSDMTimelineItemBinding(CTimelineTranslationManager *inMgr) - : m_Row(nullptr) - , m_TransMgr(inMgr) + : m_TransMgr(inMgr) , m_DataHandle(0) , m_Parent(nullptr) , m_TimelineTimebar(nullptr) @@ -210,17 +206,6 @@ void Qt3DSDMTimelineItemBinding::SetVisible(bool inVisible) inVisible, QObject::tr("Visibility Toggle")); } -// remember the expanded state for the current presentation -bool Qt3DSDMTimelineItemBinding::IsExpanded() const -{ - return m_TransMgr->IsExpanded(m_DataHandle); -} -// remember the expanded state for the current presentation -void Qt3DSDMTimelineItemBinding::SetExpanded(bool inExpanded) -{ - m_TransMgr->SetExpanded(m_DataHandle, inExpanded); -} - bool Qt3DSDMTimelineItemBinding::HasAction(bool inMaster) { TActionHandleList theActions; @@ -373,12 +358,6 @@ 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; @@ -412,11 +391,6 @@ void Qt3DSDMTimelineItemBinding::OnCollapsed() } } -void Qt3DSDMTimelineItemBinding::ClearKeySelection() -{ - m_TransMgr->ClearKeyframeSelection(); -} - bool Qt3DSDMTimelineItemBinding::OpenAssociatedEditor() { return false; // nothing to do by default @@ -552,34 +526,6 @@ bool Qt3DSDMTimelineItemBinding::IsVisibleEnabled() const != 0; } -void Qt3DSDMTimelineItemBinding::Bind(CBaseStateRow *inRow) -{ - ASSERT(!m_Row); - m_Row = inRow; - - // Because children(properties included) may only be loaded later, check if there are any - // keyframes without having to have the UI created. - TPropertyHandleList theProperties; - m_StudioSystem->GetPropertySystem()->GetAggregateInstanceProperties(m_DataHandle, - theProperties); - for (size_t thePropertyIndex = 0; thePropertyIndex < theProperties.size(); ++thePropertyIndex) { - if (m_StudioSystem->GetAnimationSystem()->IsPropertyAnimated( - m_DataHandle, theProperties[thePropertyIndex])) - AddKeyframes(GetOrCreatePropertyBinding(theProperties[thePropertyIndex])); - } - - // Set selection status - Qt3DSDMInstanceHandle theSelectedInstance = m_TransMgr->GetDoc()->GetSelectedInstance(); - m_Row->OnSelected(m_DataHandle == theSelectedInstance); -} - -void Qt3DSDMTimelineItemBinding::Release() -{ - m_Row = nullptr; - RemoveAllPropertyBindings(); - m_TransMgr->Unregister(this); -} - bool Qt3DSDMTimelineItemBinding::IsValidTransaction(EUserTransaction inTransaction) { qt3dsdm::Qt3DSDMInstanceHandle theInstance = GetInstance(); @@ -712,31 +658,6 @@ Q3DStudio::CString Qt3DSDMTimelineItemBinding::GetObjectPath() return CRelativePathTools::BuildAbsoluteReferenceString(m_DataHandle, theDoc); } -ITimelineKeyframesManager *Qt3DSDMTimelineItemBinding::GetKeyframesManager() const -{ - return m_TransMgr->GetKeyframesManager(); -} - -void Qt3DSDMTimelineItemBinding::RemoveProperty(ITimelineItemProperty *inProperty) -{ - Q_UNUSED(inProperty); - // TODO: This function has no use in DataModel world. This is replaced by RemovePropertyRow( - // Qt3DSDMPropertyHandle inPropertyHandle ). - // Decide if this function should be removed from ITimelineItemBinding. -} - -void Qt3DSDMTimelineItemBinding::LoadProperties() -{ - TPropertyHandleList theProperties; - m_StudioSystem->GetPropertySystem()->GetAggregateInstanceProperties(m_DataHandle, - theProperties); - for (size_t thePropertyIndex = 0; thePropertyIndex < theProperties.size(); ++thePropertyIndex) { - if (m_StudioSystem->GetAnimationSystem()->IsPropertyAnimated( - m_DataHandle, theProperties[thePropertyIndex])) - AddPropertyRow(theProperties[thePropertyIndex], true); - } -} - int Qt3DSDMTimelineItemBinding::getAnimatedPropertyIndex(int propertyHandle) const { TPropertyHandleList theProperties; @@ -800,12 +721,6 @@ void Qt3DSDMTimelineItemBinding::DeleteAllChannelKeyframes() } } -long Qt3DSDMTimelineItemBinding::GetKeyframeCount() const -{ - // This list is updated when properties are loaded and when keyframes are added & deleted. - return (long)m_Keyframes.size(); -} - IKeyframe *Qt3DSDMTimelineItemBinding::GetKeyframeByTime(long inTime) const { TAssetKeyframeList::const_iterator theIter = m_Keyframes.begin(); @@ -816,39 +731,6 @@ IKeyframe *Qt3DSDMTimelineItemBinding::GetKeyframeByTime(long inTime) const return nullptr; } -IKeyframe *Qt3DSDMTimelineItemBinding::GetKeyframeByIndex(long inIndex) const -{ - if (inIndex >= 0 && inIndex < (long)m_Keyframes.size()) - return const_cast(&m_Keyframes[inIndex]); - - ASSERT(0); // should not happen - return nullptr; -} - -long Qt3DSDMTimelineItemBinding::OffsetSelectedKeyframes(long inOffset) -{ - return m_TransMgr->GetKeyframesManager()->OffsetSelectedKeyframes(inOffset); -} - -void Qt3DSDMTimelineItemBinding::CommitChangedKeyframes() -{ - m_TransMgr->GetKeyframesManager()->CommitChangedKeyframes(); -} - -void Qt3DSDMTimelineItemBinding::OnEditKeyframeTime(long inCurrentTime, long inObjectAssociation) -{ - CTimeEditDlg theTimeEditDlg; - theTimeEditDlg.setKeyframesManager(m_TransMgr->GetKeyframesManager()); - theTimeEditDlg.showDialog(inCurrentTime, g_StudioApp.GetCore()->GetDoc(), - inObjectAssociation); -} - -void Qt3DSDMTimelineItemBinding::SelectKeyframes(bool inSelected, long inTime /*= -1 */) -{ - // Callback from UI, hence skip the UI update - DoSelectKeyframes(inSelected, inTime, false); -} - Qt3DSDMInstanceHandle Qt3DSDMTimelineItemBinding::GetInstanceHandle() const { return m_DataHandle; @@ -884,20 +766,6 @@ void Qt3DSDMTimelineItemBinding::OnImmediateRefreshInstanceMultiple( void Qt3DSDMTimelineItemBinding::RefreshStateRow(bool inRefreshChildren) { - CStateRow *theRow = dynamic_cast(m_Row); - if (theRow) { - theRow->OnTimeChange(); - theRow->setDirty(false); - if (inRefreshChildren) { - const QList children = GetChildren(); - for (auto child : children) { - Qt3DSDMTimelineItemBinding *theBinding = - static_cast(child); - if (theBinding) - theBinding->RefreshStateRow(inRefreshChildren); - } - } - } } ITimelineTimebar *Qt3DSDMTimelineItemBinding::CreateTimelineTimebar() @@ -941,7 +809,7 @@ void Qt3DSDMTimelineItemBinding::AddPropertyRow(Qt3DSDMPropertyHandle inProperty bool inAppend /*= false */) { ITimelineItemProperty *theTimelineProperty = GetPropertyBinding(inPropertyHandle); - if (theTimelineProperty && theTimelineProperty->GetRow()) // if created, bail + if (theTimelineProperty) // if created, bail return; if (!theTimelineProperty) @@ -1001,57 +869,13 @@ void Qt3DSDMTimelineItemBinding::RefreshPropertyKeyframe( if (theProperty->RefreshKeyframe(inKeyframe, inTransaction)) { // Update asset keyframes UpdateKeyframe(theProperty->GetKeyframeByHandle(inKeyframe), inTransaction); - if (m_Row) // UI update - m_Row->setDirty(true); } } } } -// called when the keyframes are updated in the UI and data model hasn't committed the change, ie no -// event callback from DataModel -void Qt3DSDMTimelineItemBinding::UIRefreshPropertyKeyframe(long inOffset) -{ - if (!m_Row) - return; - - // TODO: figure out a better way to sync m_Keyframes - TAssetKeyframeList::iterator theKeyIter = m_Keyframes.begin(); - for (; theKeyIter != m_Keyframes.end(); ++theKeyIter) { - if (theKeyIter->IsSelected()) - theKeyIter->UpdateTime(theKeyIter->GetTime() + inOffset); - } - // If a asset keyframe was "shared" by several properties' keyframes - // we need to 'break' this sharing and create for the remaining unmoved keyframes. - TPropertyBindingMap::const_iterator theIter = m_PropertyBindingMap.begin(); - for (; theIter != m_PropertyBindingMap.end(); ++theIter) { - (*theIter).second->RefreshKeyFrames(); - - for (long i = 0; i < theIter->second->GetKeyframeCount(); ++i) { - IKeyframe *theKeyframe = theIter->second->GetKeyframeByIndex(i); - UpdateKeyframe(theKeyframe, ETimelineKeyframeTransaction_Add); - - // Unfortunately, this is the way we can propagate UI updates to ALL selected keyframes - if (theKeyframe->IsSelected()) { - CPropertyRow *thePropertyRow = theIter->second->GetRow(); - if (thePropertyRow) - thePropertyRow->setDirty(true); - } - } - } - m_Row->setDirty(true); -} - void Qt3DSDMTimelineItemBinding::OnPropertyChanged(Qt3DSDMPropertyHandle inPropertyHandle) -{ // Refresh UI - CClientDataModelBridge *theBridge = m_StudioSystem->GetClientDataModelBridge(); - if (m_Row && (inPropertyHandle == theBridge->GetNameProperty() - || inPropertyHandle == theBridge->GetSceneAsset().m_Eyeball - || inPropertyHandle == theBridge->GetSceneAsset().m_Locked - || inPropertyHandle == theBridge->GetSceneAsset().m_Shy - || inPropertyHandle == theBridge->GetSceneAsset().m_StartTime - || inPropertyHandle == theBridge->GetSceneAsset().m_EndTime)) - m_Row->setDirty(true); +{ } void Qt3DSDMTimelineItemBinding::OnPropertyLinked(Qt3DSDMPropertyHandle inPropertyHandle) @@ -1096,59 +920,6 @@ void Qt3DSDMTimelineItemBinding::SetDynamicKeyframes(long inTime, bool inDynamic } } -// Update UI on the selection state of all keyframes on this row and all its properties' keyframes. -void Qt3DSDMTimelineItemBinding::DoSelectKeyframes(bool inSelected, long inTime, bool inUpdateUI) -{ - if (inTime == -1) // all keyframes - { - TAssetKeyframeList::iterator theKeyIter = m_Keyframes.begin(); - for (; theKeyIter != m_Keyframes.end(); ++theKeyIter) - theKeyIter->SetSelected(inSelected); - } else { - Qt3DSDMAssetTimelineKeyframe *theKeyframe = - dynamic_cast(GetKeyframeByTime(inTime)); - if (theKeyframe) - theKeyframe->SetSelected(inSelected); - } - if (inUpdateUI && m_Row) - m_Row->RequestSelectKeysByTime(-1, inSelected); - - // legacy feature: all properties with keyframes at inTime or all if inTime is -1 are selected - // as well. - TPropertyBindingMap::iterator theIter = m_PropertyBindingMap.begin(); - for (; theIter != m_PropertyBindingMap.end(); ++theIter) - theIter->second->DoSelectKeyframes(inSelected, inTime, true, this); -} - -// When selecting by mouse-drag, if all properties are selected, select the asset keyframe. And if -// one gets de-selected, de-select. Legacy feature. -// Note that if only 1 property has a keyframe at time t, the asset keyframe gets selected -// automatically when that keyframe is selected. Its odd to me but -// that's how it has always behaved. -void Qt3DSDMTimelineItemBinding::OnPropertySelection(long inTime) -{ - IKeyframe *theAssetKeyframe = GetKeyframeByTime(inTime); - if (theAssetKeyframe) { - bool theAllSelectedFlag = true; - TPropertyBindingMap::iterator theIter = m_PropertyBindingMap.begin(); - for (; theIter != m_PropertyBindingMap.end(); ++theIter) { - IKeyframe *theKeyframe = theIter->second->GetKeyframeByTime(inTime); - if (theKeyframe && !theKeyframe->IsSelected()) { - // done, i.e selection remain unchanged. - theAllSelectedFlag = false; - break; - } - } - if (theAssetKeyframe->IsSelected() != theAllSelectedFlag) { - dynamic_cast(theAssetKeyframe) - ->SetSelected(theAllSelectedFlag); - // Update UI - if (m_Row) - m_Row->RequestSelectKeysByTime(inTime, theAllSelectedFlag); - } - } -} - Q3DStudio::CId Qt3DSDMTimelineItemBinding::GetGuid() const { CClientDataModelBridge *theClientBridge = m_StudioSystem->GetClientDataModelBridge(); @@ -1244,11 +1015,6 @@ void Qt3DSDMTimelineItemBinding::UpdateKeyframe(IKeyframe *inKeyframe, m_Keyframes.push_back(Qt3DSDMAssetTimelineKeyframe(this, theKeyframeTime)); } } - if (m_Row && (theDoAddFlag - || inTransaction == ETimelineKeyframeTransaction_DynamicChanged)) { - // dynamic => only UI needs to refresh - m_Row->setDirty(true); - } } void Qt3DSDMTimelineItemBinding::OnAddChild(Qt3DSDMInstanceHandle inInstance) @@ -1286,17 +1052,10 @@ void Qt3DSDMTimelineItemBinding::OnAddChild(Qt3DSDMInstanceHandle inInstance) void Qt3DSDMTimelineItemBinding::OnDeleteChild(Qt3DSDMInstanceHandle inInstance) { - ITimelineItemBinding *theChild = m_TransMgr->GetOrCreate(inInstance); - if (theChild) { - m_Row->RemoveChildRow(theChild); - } } void Qt3DSDMTimelineItemBinding::UpdateActionStatus() { - if (m_Row) { - m_Row->requestUpdateActionStatus(); - } } //============================================================================= -- cgit v1.2.3