diff options
author | Miikka Heikkinen <miikka.heikkinen@qt.io> | 2018-05-30 15:44:18 +0300 |
---|---|---|
committer | Miikka Heikkinen <miikka.heikkinen@qt.io> | 2018-05-31 10:11:16 +0000 |
commit | 54c2ecd76378d1f152733f383c0a0249324c6430 (patch) | |
tree | f1dd6925c6378b3360d293528f1c1907d5371177 /src/Authoring | |
parent | 2fc003ab76967190be51243b6d8f5e14296582bc (diff) |
Remove old timeline code
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 <kaj.gronholm@qt.io>
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
Diffstat (limited to 'src/Authoring')
90 files changed, 27 insertions, 10842 deletions
diff --git a/src/Authoring/Studio/Controls/BreadCrumbControl.cpp b/src/Authoring/Studio/Controls/BreadCrumbControl.cpp index 5a873fd6..3a912b43 100644 --- a/src/Authoring/Studio/Controls/BreadCrumbControl.cpp +++ b/src/Authoring/Studio/Controls/BreadCrumbControl.cpp @@ -37,7 +37,7 @@ //============================================================================== #include "BreadCrumbControl.h" #include "StudioPreferences.h" -#include "IBreadCrumbProvider.h" +#include "Bindings/IBreadCrumbProvider.h" #include <QtGui/qpixmap.h> diff --git a/src/Authoring/Studio/Controls/BreadCrumbControl.h b/src/Authoring/Studio/Controls/BreadCrumbControl.h index c8fc519a..8e20357c 100644 --- a/src/Authoring/Studio/Controls/BreadCrumbControl.h +++ b/src/Authoring/Studio/Controls/BreadCrumbControl.h @@ -39,7 +39,7 @@ #include "ProceduralButton.h" #include "ToggleButton.h" #include "TextButton.h" -#include "IBreadCrumbProvider.h" +#include "Bindings/IBreadCrumbProvider.h" //============================================================================== // Forwards diff --git a/src/Authoring/Studio/Palettes/PaletteManager.cpp b/src/Authoring/Studio/Palettes/PaletteManager.cpp index b141d763..fbac281d 100644 --- a/src/Authoring/Studio/Palettes/PaletteManager.cpp +++ b/src/Authoring/Studio/Palettes/PaletteManager.cpp @@ -33,7 +33,6 @@ #include "PaletteManager.h" #include "StudioApp.h" #include "MainFrm.h" -#include "TimelineView.h" #include "TimelineWidget.h" #include "BasicObjectsView.h" #include "SlideView.h" diff --git a/src/Authoring/Studio/Palettes/Timeline/AbstractTimelineRowUI.cpp b/src/Authoring/Studio/Palettes/Timeline/AbstractTimelineRowUI.cpp deleted file mode 100644 index 0331a6d2..00000000 --- a/src/Authoring/Studio/Palettes/Timeline/AbstractTimelineRowUI.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt 3D Studio. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "AbstractTimelineRowUI.h" -#include "TimelineRow.h" -#include "ITimelineControl.h" - -#include "Bindings/ITimelineItemBinding.h" - -CAbstractTimelineRowUI::CAbstractTimelineRowUI(CTimelineRow *timelineRow, - CAbstractTimelineRowUI *parentUiRow) - : QObject(parentUiRow) - , m_timelineRow(timelineRow) - , m_parentRowUI(parentUiRow) - , m_Indent(0) -{ -} - -CAbstractTimelineRowUI::~CAbstractTimelineRowUI() -{ -} - -void CAbstractTimelineRowUI::SetParentRow(CAbstractTimelineRowUI *parentUiRow) -{ - m_parentRowUI = parentUiRow; - setParent(parentUiRow); -} - -CTimelineRow *CAbstractTimelineRowUI::GetTimelineRow() const -{ - return m_timelineRow; -} - -void CAbstractTimelineRowUI::SetTimelineControl(ITimelineControl *inTimelineControl) -{ - m_TimelineControl = inTimelineControl; -} - -ITimelineControl *CAbstractTimelineRowUI::GetTopControl() const -{ - auto *parentRow = m_timelineRow->GetParentRow(); - ITimelineControl *theControl = parentRow ? m_parentRowUI->GetTopControl() : m_TimelineControl; - // GetTopControl() should be not used if SetTimeLineControl() was not called in this item - Q_ASSERT(theControl); - return theControl; -} - -void CAbstractTimelineRowUI::SetIndent(long indent) -{ - m_Indent = indent; -} - -long CAbstractTimelineRowUI::GetIndent() const -{ - return m_Indent; -} diff --git a/src/Authoring/Studio/Palettes/Timeline/AbstractTimelineRowUI.h b/src/Authoring/Studio/Palettes/Timeline/AbstractTimelineRowUI.h deleted file mode 100644 index a3b86013..00000000 --- a/src/Authoring/Studio/Palettes/Timeline/AbstractTimelineRowUI.h +++ /dev/null @@ -1,95 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt 3D Studio. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef CABSTRACTTIMELINEROWUI_H -#define CABSTRACTTIMELINEROWUI_H - -#include <QObject> - -class CTimelineRow; -class ITimelineItemBinding; -class ITimelineControl; -class ISnappingListProvider; - -class CControl; -class CDropTarget; -class CRct; -class CSnapper; - -class CAbstractTimelineRowUI : public QObject -{ - Q_OBJECT -public: - CAbstractTimelineRowUI(CTimelineRow *timelineRow, CAbstractTimelineRowUI *parentUiRow); - virtual ~CAbstractTimelineRowUI(); - - void SetParentRow(CAbstractTimelineRowUI *parentUiRow); - - CTimelineRow *GetTimelineRow() const; - - virtual CControl *GetColorControl() = 0; - virtual CControl *GetTreeControl() = 0; - virtual CControl *GetToggleControl() = 0; - virtual CControl *GetTimebarControl() = 0; - - virtual void SetTimelineControl(ITimelineControl *inTimelineControl); - virtual ITimelineControl *GetTopControl() const; - - virtual void SetSnappingListProvider(ISnappingListProvider *inProvider) = 0; - virtual ISnappingListProvider *GetSnappingListProvider() const = 0; - - virtual void SetIndent(long indent); - virtual long GetIndent() const; - - virtual void SetEnabled(bool inEnabled) = 0; - virtual void SetFocus() = 0; - virtual void SetNameReadOnly(bool inReadOnly) = 0; - - virtual void OnChildVisibilityChanged() = 0; - virtual void SelectKeysInRect(CRct inRect, bool inModifierKeyDown, - bool inGlobalCommitSelectionFlag) = 0; - virtual void PopulateSnappingList(CSnapper *inSnappingList) = 0; - - virtual void AcceptDropAfter(bool inAccept) = 0; - virtual void AcceptDropBefore(bool inAccept) = 0; - virtual void SetDropTarget(CDropTarget *inDropTarget) = 0; - - virtual void UpdateActionStatus() = 0; - -public Q_SLOTS: - virtual void Initialize() = 0; - -protected: - CTimelineRow *m_timelineRow = nullptr; - CAbstractTimelineRowUI *m_parentRowUI = nullptr; - ITimelineControl *m_TimelineControl = nullptr; - - long m_Indent; -}; - -#endif // CABSTRACTTIMELINEROWUI_H diff --git a/src/Authoring/Studio/Palettes/Timeline/BaseStateRow.cpp b/src/Authoring/Studio/Palettes/Timeline/BaseStateRow.cpp deleted file mode 100644 index a9a65b9a..00000000 --- a/src/Authoring/Studio/Palettes/Timeline/BaseStateRow.cpp +++ /dev/null @@ -1,740 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 NVIDIA Corporation. -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt 3D Studio. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "stdafx.h" - -#include "BaseStateRow.h" -#include "PropertyRow.h" -#include "StateRowFactory.h" -#include "ResourceCache.h" -#include "StudioUtils.h" -#include "Bindings/ITimelineItemBinding.h" -#include "Bindings/ITimelineTimebar.h" - - -CBaseStateRow::CBaseStateRow(CTimelineRow *parent, bool loaded) - : CTimelineRow(parent) - , m_Loaded(loaded) - , m_Selected(false) -{ -} - -CBaseStateRow::~CBaseStateRow() -{ - // Go through all the state rows and delete them, this control owns all child controls. - TStateRowList::iterator thePos = m_StateRows.begin(); - for (; thePos != m_StateRows.end(); ++thePos) - (*thePos)->Dispose(); - - // Go through all the properties and delete them, this control owns all child controls. - TPropertyRowList::iterator thePropertyPos = m_PropertyRows.begin(); - for (; thePropertyPos != m_PropertyRows.end(); ++thePropertyPos) { - CPropertyRow *theRow = (*thePropertyPos); - delete theRow; - } -} - -void CBaseStateRow::Initialize(ITimelineItemBinding *inTimelineItemBinding) -{ - // Bind after all the UI is setup. - Q_ASSERT(inTimelineItemBinding); - m_TimelineItemBinding = inTimelineItemBinding; - m_TimelineItemBinding->Bind(this); // see Dispose where it properly unbinds. - - emit initialized(); -} - -//============================================================================= -/** - * Expand this node of the tree control. - * This will display all children the fit the filter. - */ -void CBaseStateRow::Expand(bool inExpandAll /*= false*/, bool inExpandUp) -{ - if (!m_IsExpanded) { - m_Filter.SetExpanded(true); - - // Expand/Collapse is done by adding and removing the children, add all the - // properties first so they are at the top of the list. - TPropertyRowList::iterator thePropPos = m_PropertyRows.begin(); - for (; thePropPos != m_PropertyRows.end(); ++thePropPos) { - CPropertyRow *thePropRow = (*thePropPos); - if (thePropRow) - thePropRow->Filter(m_Filter, false); - } - // Add all the State rows after the properties. - TStateRowList::iterator thePos = m_StateRows.begin(); - for (; thePos != m_StateRows.end(); ++thePos) { - CStateRow *theRow = (*thePos); - theRow->Filter(m_Filter, false); - } - - m_IsExpanded = true; - - emit expanded(true); - } - - if (inExpandAll) { - TStateRowList::iterator thePos = m_StateRows.begin(); - for (; thePos != m_StateRows.end(); ++thePos) - (*thePos)->Expand(inExpandAll); - } - - if (inExpandUp && m_ParentRow) - m_ParentRow->Expand(false, inExpandUp); -} - -//============================================================================= -/** - * Collapse this node of the tree control. - * This will hide all children of this control. - */ -void CBaseStateRow::Collapse(bool inCollapseAll /* = false */) -{ - if (m_IsExpanded) { - CFilter theFilter = m_Filter; - theFilter.SetExpanded(false); - - TPropertyRowList::iterator thePropPos = m_PropertyRows.begin(); - for (; thePropPos != m_PropertyRows.end(); ++thePropPos) { - CPropertyRow *thePropRow = (*thePropPos); - if (thePropRow) - thePropRow->Filter(theFilter); - } - - TStateRowList::iterator thePos = m_StateRows.begin(); - for (; thePos != m_StateRows.end(); ++thePos) { - CStateRow *theRow = (*thePos); - theRow->Filter(theFilter); - } - - m_TimelineItemBinding->OnCollapsed(); - - m_IsExpanded = false; - - emit expanded(false); - } - - if (inCollapseAll) { - TStateRowList::iterator thePos = m_StateRows.begin(); - for (; thePos != m_StateRows.end(); ++thePos) { - (*thePos)->Collapse(inCollapseAll); - } - } -} - -//============================================================================= -/** - * Toggle the expansion state of this control. - * This will expand the control if it is closed, or collapse it if it is - * open. - */ -void CBaseStateRow::ToggleExpansion(CToggleButton *, CButtonControl::EButtonState inButtonState) -{ - if (inButtonState == CButtonControl::EBUTTONSTATE_UP) - Collapse(); - else - Expand(); -} - -//============================================================================= -/** - * Shows or hides rows for all children, based on the filter. - * @param inFilter Object specifying the filters currently applied to the timeline. - * @param inFilterChildren true if the filter should go recursively to children. - */ -void CBaseStateRow::Filter(const CFilter &inFilter, bool inFilterChildren /*= true*/) -{ - m_Filter = inFilter; - - // For each child object - if (inFilterChildren) { - CFilter theChildFilter = inFilter; - theChildFilter.SetExpanded(m_IsExpanded); - - TStateRowList::iterator thePos = m_StateRows.begin(); - for (; thePos != m_StateRows.end(); ++thePos) { - // Apply the filter - CStateRow *theRow = (*thePos); - theRow->Filter(theChildFilter); - } - } - - // This flag determines whether or not the controls on this row should be shown, based on the - // filter - bool theVisibleFlag = PerformFilter(m_Filter); - - m_IsViewable = theVisibleFlag; - - theVisibleFlag &= inFilter.IsExpanded(); - - // Show or hide the controls on this row before we iterate through the properties - emit visibleChanged(theVisibleFlag); - - if (inFilterChildren) { - CFilter theChildFilter = inFilter; - theChildFilter.SetExpanded(m_IsExpanded); - - // For each property on this object - TPropertyRowList::iterator thePropPos = m_PropertyRows.begin(); - for (; thePropPos != m_PropertyRows.end(); ++thePropPos) { - // Apply the filter - CPropertyRow *thePropRow = (*thePropPos); - if (thePropRow) - thePropRow->Filter(theChildFilter); - } - } - - emit hasChildrenChanged(HasVisibleChildren()); -} - - - -//============================================================================= -/** - * Remove a row from this control. - * @param inState the state of the row to be removed. - */ -void CBaseStateRow::RemoveRow(CStateRow *inRow) -{ - TStateRowList::iterator thePos = m_StateRows.begin(); - for (; thePos != m_StateRows.end(); ++thePos) { - CStateRow *theRow = (*thePos); - if (theRow == inRow) { - DeleteRow(theRow); - m_StateRows.erase(thePos); - break; - } - } - emit hasChildrenChanged(HasVisibleChildren()); -} - -//============================================================================= -/** - * Helper function to remove all controls of this property row and dispose of it. - */ -void CBaseStateRow::DeletePropertyRow(CPropertyRow *inPropertyRow) -{ - if (!inPropertyRow) - return; - - emit rowAboutToBeRemoved(inPropertyRow); - delete inPropertyRow; -} - -//============================================================================= -/** - * Get the StateRow that is representing this child timeline item. - * @param inTimelineItem child timeline item - * @return the StateRow for inState. - */ -CStateRow *CBaseStateRow::GetRow(ITimelineItem *inTimelineItem) -{ - if (inTimelineItem) { - TStateRowList::iterator thePos = m_StateRows.begin(); - for (; thePos != m_StateRows.end(); ++thePos) { - if ((*thePos)->GetTimelineItem() == inTimelineItem) - return (*thePos); - } - } - return nullptr; -} - -//============================================================================= -/** - * Called when a row is to be completely removed from the UI - */ -void CBaseStateRow::DeleteRow(CStateRow *inRow) -{ - emit rowAboutToBeRemoved(inRow); - inRow->Dispose(); -} - - -//============================================================================= -/** - * Recursively load the children of this control, used by derived classes - * This will load all the properties and states, and create controls for them. - */ -void CBaseStateRow::LoadChildren() -{ - if (!m_Loaded) { - m_Loaded = true; - - LoadProperties(); - - CTimelineItemOrderedIterator theChildIter(m_TimelineItemBinding); - // Go through all the children and load them too. - for (; !theChildIter.IsDone(); ++theChildIter) - CreateChildRow(*theChildIter, nullptr); - - emit childrenLoaded(); - } -} - -//============================================================================= -/** - * Add a row that represents this child timeline item - * @param inNextItem indicates row to follow behind the row for inTimeLineItem, nullptr to append inRow - * to the end of the current list. - */ -void CBaseStateRow::AddChildRow(ITimelineItemBinding *inTimeLineItem, - ITimelineItemBinding *inNextItem) -{ - if (!inTimeLineItem) - return; - - // only add if loaded, else it will get added twice. - if (m_Loaded) { - CStateRow *theStateRow = CreateChildRow( - inTimeLineItem, inNextItem ? GetRow(inNextItem->GetTimelineItem()) : nullptr); - if (theStateRow) - theStateRow->LoadChildren(); - } - Expand(false, true); - - CBaseStateRow *theRow = GetRow(inTimeLineItem->GetTimelineItem()); - if (theRow) { - emit rowAdded(theRow); - } -} - -void CBaseStateRow::RemoveChildRow(ITimelineItemBinding *inTimelineItem) -{ - CStateRow *theChildRow = GetRow(inTimelineItem->GetTimelineItem()); - inTimelineItem->SetParent(nullptr); - if (theChildRow) { - RemoveRow(theChildRow); - // KDAB_TODO check if needed - // preserving legacy behavior. -// GetTopControl()->HideTimelineMoveableTooltip(); - } -} - -//============================================================================= -/** - * Removes all child rows from this row. Called prior to a load. The load call is responsible for - * updating the UI. - */ -void CBaseStateRow::RemoveAllChildren() -{ - RemoveAllProperties(); - - TStateRowList::iterator thePos = m_StateRows.begin(); - for (; thePos != m_StateRows.end(); ++thePos) - DeleteRow(*thePos); - - m_StateRows.clear(); -} - -//============================================================================= -/** - * Remove all the properties from this object. Called prior to a load. The load call is responsible - * for updating the UI. - */ -void CBaseStateRow::RemoveAllProperties() -{ - TPropertyRowList::iterator thePropPos = m_PropertyRows.begin(); - for (; thePropPos != m_PropertyRows.end(); ++thePropPos) - DeletePropertyRow(*thePropPos); - - m_PropertyRows.clear(); -} - -//============================================================================= -/** - * Set this row to selected - */ -void CBaseStateRow::Select(Qt::KeyboardModifiers modifier, - bool inCheckKeySelection /*= true */) -{ - bool alreadySelected = m_Selected; - m_TimelineItemBinding->SetSelected(modifier.testFlag(Qt::ControlModifier)); - if (inCheckKeySelection) { - if (modifier.testFlag(Qt::ShiftModifier)) - emit selectAllKeys(); - else if (!alreadySelected) - m_TimelineItemBinding->ClearKeySelection(); - } -} - -//============================================================================= -/** - * Change the selection state of the row. - */ -void CBaseStateRow::OnSelected(bool inSelection) -{ - if (inSelection == m_Selected) - return; - - m_Selected = inSelection; - if (inSelection) { - if (m_ParentRow) - m_ParentRow->Expand(false, true); - } - - emit selectedChanged(inSelection); -} - -void CBaseStateRow::RequestRefreshRowMetaData() -{ - emit refreshRowMetaData(); -} - -void CBaseStateRow::ForceEmitChildrenChanged() -{ - emit hasChildrenChanged(HasVisibleChildren()); -} - -void CBaseStateRow::requestSetNameReadOnly() -{ - emit setNameReadOnly(); -} - -void CBaseStateRow::requestUpdateActionStatus() -{ - emit updateActionStatus(); -} - -//============================================================================= -/** - * Call to add a property row as a child of this control. - * @param inRow the row to be added. - */ -void CBaseStateRow::AddPropertyRow(CPropertyRow *inRow, CTimelineRow *inNextRow /*= nullptr */) -{ - m_PropertyRows.push_back(inRow); - InitializePropertyRow(inRow, inNextRow); - - emit propertyRowAdded(inRow); -} - -//============================================================================= -/** - * Remove the property row. - */ -void CBaseStateRow::RemovePropertyRow(const CPropertyRow *inRow) -{ - if (!inRow) - return; - - TPropertyRowList::iterator thePropPos = m_PropertyRows.begin(); - for (; thePropPos != m_PropertyRows.end(); ++thePropPos) { - CPropertyRow *theRow = *thePropPos; - if (theRow == inRow) { - DeletePropertyRow(theRow); - m_PropertyRows.erase(thePropPos); - - // Update flippy - emit hasChildrenChanged(HasVisibleChildren()); - break; - } - } -} - -//============================================================================= -/** - * Helper function to initialize a new property row - * @param inRow the row to be added. - * @param inNextRow if specified, row that should be after inRow after - * insertion. - */ -void CBaseStateRow::InitializePropertyRow(CPropertyRow *inRow, CTimelineRow *inNextRow /*= nullptr */) -{ - CFilter theFilter = m_Filter; - theFilter.SetExpanded(m_IsExpanded); - - if (!inNextRow) { // not provided, this property row would be inserted before the first - // non-property row. - CTimelineItemOrderedIterator theIterator(m_TimelineItemBinding); - if (!theIterator.IsDone()) - inNextRow = GetRow(theIterator.GetCurrent()->GetTimelineItem()); - } - emit addRowToUILists(inRow, inNextRow, theFilter); -} - -CStateRow *CBaseStateRow::CreateChildRow(ITimelineItemBinding *inChildBinding, CStateRow *inNextRow) -{ - CStateRow *theRow = - CStateRowFactory::CreateStateRow(inChildBinding, this); - if (theRow) { // add by appending to the list - AddStateRow(theRow, inNextRow); - } - inChildBinding->SetParent(m_TimelineItemBinding); - return theRow; -} - -long CBaseStateRow::GetNumNonPropertyRows() const -{ - return static_cast<long>(m_StateRows.size()); -} - -CBaseStateRow *CBaseStateRow::GetNonPropertyRow(long inIndex) const -{ - return m_StateRows.at(inIndex); -} - -long CBaseStateRow::GetNumPropertyRows() const -{ - return static_cast<long>(m_PropertyRows.size()); -} -CPropertyRow *CBaseStateRow::GetPropertyRow(long inIndex) const -{ - return m_PropertyRows.at(inIndex); -} - -//============================================================================= -/** - * Call to add a state row as a child of this control. - * @param inRow the row to be added. - * @param inNextRow row to follow behind the row that would be added, nullptr to append inRow to the - * end of the current list. - */ -void CBaseStateRow::AddStateRow(CStateRow *inRow, CStateRow *inNextRow) -{ - if (inNextRow != nullptr) { - TStateRowList::iterator thePos = m_StateRows.begin(); - while (thePos != m_StateRows.end()) { - if ((*thePos) == inNextRow) { - m_StateRows.insert(thePos, inRow); - thePos = m_StateRows.end(); - } else - ++thePos; - } - } else { - m_StateRows.push_back(inRow); - } - - emit addRowToUILists(inRow, inNextRow, m_Filter); -} - -//============================================================================= -/** - * Checks to see if there are any visible children of this row. - * This is used for figuring out whether the expand button should be displayed - * or not. - */ -bool CBaseStateRow::HasVisibleChildren() -{ - TStateRowList::iterator thePos = m_StateRows.begin(); - for (; thePos != m_StateRows.end(); ++thePos) { - // Apply the filter - if ((*thePos)->IsViewable()) - return true; - } - - // For each property on this object - TPropertyRowList::iterator thePropPos = m_PropertyRows.begin(); - for (; thePropPos != m_PropertyRows.end(); ++thePropPos) { - // Apply the filter - CPropertyRow *thePropRow = (*thePropPos); - if (thePropRow && thePropRow->IsViewable()) - return true; - } - return false; -} - -//============================================================================= -/** - * Set the amount of time that is represented by a pixel. - * This modifies the length of this control. - * @param inTimePerPixel the time per pixel. - */ -void CBaseStateRow::SetTimeRatio(double inTimeRatio) -{ - if (m_TimeRatio != inTimeRatio) { - m_TimeRatio = inTimeRatio; - - TStateRowList::iterator thePos = m_StateRows.begin(); - for (; thePos != m_StateRows.end(); ++thePos) { - (*thePos)->SetTimeRatio(inTimeRatio); - } - - TPropertyRowList::iterator thePropPos = m_PropertyRows.begin(); - for (; thePropPos != m_PropertyRows.end(); ++thePropPos) { - CPropertyRow *thePropRow = (*thePropPos); - if (thePropRow) - thePropRow->SetTimeRatio(inTimeRatio); - } - emit timeRatioChanged(inTimeRatio); - } -} - - -//============================================================================= -/** - * Deletes all the keys for the asset that was chosen by the user - * @param inBatch the batch used to batch all the deletes together - */ -void CBaseStateRow::DeleteAllKeys() -{ - // Iterate through all the property rows and delete all their keys - TPropertyRowList::iterator thePropPos = m_PropertyRows.begin(); - for (; thePropPos != m_PropertyRows.end(); ++thePropPos) { - CPropertyRow *thePropRow = (*thePropPos); - if (thePropRow) - thePropRow->DeleteAllKeys(); - } -} - -// KDAB_TODO unused? -/* -void CBaseStateRow::SetTimelineLatestTime(long inTime) -{ - long theLength = ::TimeToPos(inTime, m_TimeRatio) + CTimelineTimelineLayout::END_BUFFER_SIZE; - m_TimebarControl->SetAbsoluteSize(CPt(theLength, m_TimebarControl->GetSize().y)); - - TStateRowList::iterator thePos = m_StateRows.begin(); - for (; thePos != m_StateRows.end(); ++thePos) - (*thePos)->SetTimelineLatestTime(inTime); -} -*/ - -//============================================================================= -/** - * Determines whether or not a row is expanded. A row can be expanded even if - * it is not visible. - * @return true if the row is currently expanded, otherwise false - */ -bool CBaseStateRow::IsExpanded() -{ - return m_IsExpanded; -} - -//============================================================================= -/** - * Determines whether or not a row is loaded. The rows are delayed loaded, i.e. - * it will be loaded when it's visible for the first time. Before it's loaded, any - * updates to the structure, say, adding dynamic properties does not need to update the - * timeline. - * @return true if the row is currently loaded, otherwise false - */ -bool CBaseStateRow::IsLoaded() -{ - return m_Loaded; -} - -long CBaseStateRow::GetStartTime() -{ - ITimelineTimebar *theTimebar = m_TimelineItemBinding->GetTimelineItem()->GetTimebar(); - if (theTimebar) - return theTimebar->GetStartTime(); - return 0; -} - -long CBaseStateRow::GetEndTime() -{ - ITimelineTimebar *theTimebar = m_TimelineItemBinding->GetTimelineItem()->GetTimebar(); - if (theTimebar) - return theTimebar->GetEndTime(); - return 0; -} - -//============================================================================= -/** - * Get the start time of this row, which is accumulative of all its descendants. - */ -long CBaseStateRow::GetEarliestStartTime() -{ - long theEarliestStartTime = 0; - TStateRowList::iterator thePos = m_StateRows.begin(); - for (; thePos != m_StateRows.end(); ++thePos) { - CStateRow *theRow = (*thePos); - long theStartTime = theRow->GetEarliestStartTime(); - if (theStartTime < theEarliestStartTime) - theEarliestStartTime = theStartTime; - } - return theEarliestStartTime; -} - -//============================================================================= -/** - * Get the end time of this row, which is accumulative of all its descendants. - */ -long CBaseStateRow::GetLatestEndTime() -{ - long theLatestTime = 0; - TStateRowList::iterator thePos = m_StateRows.begin(); - for (; thePos != m_StateRows.end(); ++thePos) { - CStateRow *theRow = (*thePos); - long theEndTime = theRow->GetLatestEndTime(); - if (theEndTime > theLatestTime) - theLatestTime = theEndTime; - } - return theLatestTime; -} - -//============================================================================= -/** - * Lame switch to get the normal state object specific icon. - * @return the icon to be used in the 'normal' state. - */ -QPixmap CBaseStateRow::GetIcon() -{ - return CResourceCache::GetInstance()->GetBitmap( - CStudioObjectTypes::GetNormalIconName(GetObjectType())); -} - -//============================================================================= -/** - * Lame switch to get the disabled state object specific icon. - * @return the icon to be used in the disabled state. - */ -QPixmap CBaseStateRow::GetDisabledIcon() -{ - return CResourceCache::GetInstance()->GetBitmap( - CStudioObjectTypes::GetDisabledIconName(GetObjectType())); -} - - - -//============================================================================= -/** - * When this row is no longer useful, clean up. - */ -void CBaseStateRow::Dispose() -{ - // Disconnection point - if (m_TimelineItemBinding) - m_TimelineItemBinding->Release(); - - CTimelineRow::Dispose(); -} - - -CBaseStateRow::TPropertyRowList CBaseStateRow::GetPropertyRows() const -{ - return m_PropertyRows; -} - -CBaseStateRow::TStateRowList CBaseStateRow::GetStateRows() const -{ - return m_StateRows; -} - diff --git a/src/Authoring/Studio/Palettes/Timeline/BaseStateRow.h b/src/Authoring/Studio/Palettes/Timeline/BaseStateRow.h deleted file mode 100644 index e4ccd95c..00000000 --- a/src/Authoring/Studio/Palettes/Timeline/BaseStateRow.h +++ /dev/null @@ -1,147 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 NVIDIA Corporation. -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt 3D Studio. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef INCLUDED_BASE_STATE_ROW_H -#define INCLUDED_BASE_STATE_ROW_H 1 - -#pragma once - -#include "stdafx.h" - -#include "TimelineRow.h" -#include "ToggleButton.h" -#include "DispatchListeners.h" - -#include <Qt> - -class CPropertyRow; -class CStateRow; -class CCmdBatch; -class ITimelineItem; - -class CBaseStateRow : public CTimelineRow -{ - Q_OBJECT -public: - typedef std::vector<CPropertyRow *> TPropertyRowList; - typedef std::vector<CStateRow *> TStateRowList; - -public: - CBaseStateRow(CTimelineRow *parent, bool loaded = false); - virtual ~CBaseStateRow(); - - void Initialize(ITimelineItemBinding *inTimelineItemBinding) override; - - bool IsExpanded(); - bool IsLoaded(); - void Expand(bool inExpandAll = false, bool inExpandUp = false) override; - void Collapse(bool inCollapseAll = false) override; - void ToggleExpansion(CToggleButton *, CButtonControl::EButtonState); - - void SetTimeRatio(double inTimePerPixel) override; - - void Select(Qt::KeyboardModifiers inKeyState, bool inCheckKeySelection = true); - bool IsSelected() const override { return m_Selected; } - void DeleteAllKeys(); - - void LoadChildren() override; - void AddChildRow(ITimelineItemBinding *inTimeLineItem, ITimelineItemBinding *inNextItem); - void RemoveChildRow(ITimelineItemBinding *inTimeLineItem); - - void RemoveRow(CStateRow *inRow); - void AddStateRow(CStateRow *inRow, CStateRow *inNextRow); - void AddPropertyRow(CPropertyRow *inRow, CTimelineRow *inNextRow = nullptr); - void RemovePropertyRow(const CPropertyRow *inRow); - void RemoveAllChildren(); - void RemoveAllProperties(); - - long GetNumNonPropertyRows() const; - CBaseStateRow *GetNonPropertyRow(long inIndex) const; - long GetNumPropertyRows() const; - CPropertyRow *GetPropertyRow(long inIndex) const; - - void Filter(const CFilter &inFilter, bool inFilterChildren = true) override; - CFilter *GetFilter() { return &m_Filter; } - - virtual bool HasVisibleChildren(); - - // CTimelineRow - virtual long GetEarliestStartTime(); - long GetLatestEndTime() override; - - long GetStartTime(); - long GetEndTime(); - void Dispose() override; - - virtual QPixmap GetIcon(); - virtual QPixmap GetDisabledIcon(); - - TPropertyRowList GetPropertyRows() const; - TStateRowList GetStateRows() const; - - virtual void OnSelected(bool inSelected); - void RequestRefreshRowMetaData(); - void ForceEmitChildrenChanged(); - void requestSetNameReadOnly(); - void requestUpdateActionStatus(); - -Q_SIGNALS: - void expanded(bool isExpanded); - void visibleChanged(bool visible); - void hasChildrenChanged(bool hasChildren); - void rowAboutToBeRemoved(CTimelineRow *row); - void selectAllKeys(); - void addRowToUILists(CTimelineRow *inRow, CTimelineRow *inNextRow, CFilter &inFilter); - void rowAdded(CBaseStateRow *row); - void refreshRowMetaData(); - void setNameReadOnly(); - void updateActionStatus(); - -protected: - void DeletePropertyRow(CPropertyRow *inPropertyRow); - virtual bool PerformFilter(const CFilter &inFilter) = 0; - CStateRow *GetRow(ITimelineItem *inTimelineItem); - void DeleteRow(CStateRow *inRow); - // KDAB_TODO unused? -// void SetTimelineLatestTime(long inLength); - - virtual void LoadProperties() {} - void InitializePropertyRow(CPropertyRow *inRow, CTimelineRow *inNextRow = nullptr); - - CStateRow *CreateChildRow(ITimelineItemBinding *inChildBinding, CStateRow *inNextRow); - - CFilter m_Filter; - - TStateRowList m_StateRows; - TPropertyRowList m_PropertyRows; - - bool m_Loaded; - bool m_Selected; -}; -#endif // INCLUDED_BASE_STATE_ROW_H diff --git a/src/Authoring/Studio/Palettes/Timeline/Bindings/GroupTimelineItemBinding.cpp b/src/Authoring/Studio/Palettes/Timeline/Bindings/GroupTimelineItemBinding.cpp index 32e19a15..909efdbb 100644 --- a/src/Authoring/Studio/Palettes/Timeline/Bindings/GroupTimelineItemBinding.cpp +++ b/src/Authoring/Studio/Palettes/Timeline/Bindings/GroupTimelineItemBinding.cpp @@ -36,7 +36,6 @@ // Includes //============================================================================== #include "GroupTimelineItemBinding.h" -#include "BaseStateRow.h" #include "TimelineTranslationManager.h" #include "StudioApp.h" #include "Core.h" diff --git a/src/Authoring/Studio/Palettes/Timeline/Bindings/GroupTimelineItemBinding.h b/src/Authoring/Studio/Palettes/Timeline/Bindings/GroupTimelineItemBinding.h index 3ac8a6e3..cd7f9dad 100644 --- a/src/Authoring/Studio/Palettes/Timeline/Bindings/GroupTimelineItemBinding.h +++ b/src/Authoring/Studio/Palettes/Timeline/Bindings/GroupTimelineItemBinding.h @@ -42,7 +42,6 @@ //============================================================================== class ITimelineItem; class CTimelineTranslationManager; -class CBaseStateRow; //============================================================================= /** diff --git a/src/Authoring/Studio/Palettes/Timeline/IBreadCrumbProvider.h b/src/Authoring/Studio/Palettes/Timeline/Bindings/IBreadCrumbProvider.h index 1a8beb0a..1a8beb0a 100644 --- a/src/Authoring/Studio/Palettes/Timeline/IBreadCrumbProvider.h +++ b/src/Authoring/Studio/Palettes/Timeline/Bindings/IBreadCrumbProvider.h diff --git a/src/Authoring/Studio/Palettes/Timeline/Bindings/IKeyframeSelector.h b/src/Authoring/Studio/Palettes/Timeline/Bindings/IKeyframeSelector.h deleted file mode 100644 index db8b551f..00000000 --- a/src/Authoring/Studio/Palettes/Timeline/Bindings/IKeyframeSelector.h +++ /dev/null @@ -1,52 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 NVIDIA Corporation. -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt 3D Studio. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef INCLUDED_IKEYFRAME_SELECTOR_H -#define INCLUDED_IKEYFRAME_SELECTOR_H 1 - -#pragma once - -//============================================================================= -/** - * Interface that performs keyframe selection. - */ -//============================================================================= -class IKeyframeSelector -{ -public: - virtual ~IKeyframeSelector() {} - - //============================================================================= - /** - * @param inTime -1 to selected (or deselect) ALL keyframes, otherwise only by time. - */ - virtual void SelectKeyframes(bool inSelected, long inTime = -1) = 0; -}; - -#endif // INCLUDED_IKEYFRAME_SELECTOR_H diff --git a/src/Authoring/Studio/Palettes/Timeline/Bindings/ITimelineItem.h b/src/Authoring/Studio/Palettes/Timeline/Bindings/ITimelineItem.h index e5af8671..b4cbe7e9 100644 --- a/src/Authoring/Studio/Palettes/Timeline/Bindings/ITimelineItem.h +++ b/src/Authoring/Studio/Palettes/Timeline/Bindings/ITimelineItem.h @@ -58,8 +58,6 @@ public: virtual void SetLocked(bool) = 0; virtual bool IsVisible() const = 0; virtual void SetVisible(bool) = 0; - virtual bool IsExpanded() const = 0; - virtual void SetExpanded(bool) = 0; virtual bool IsImported() const { return false; } // Actions diff --git a/src/Authoring/Studio/Palettes/Timeline/Bindings/ITimelineItemBinding.h b/src/Authoring/Studio/Palettes/Timeline/Bindings/ITimelineItemBinding.h index 5f1dfe40..2e804d85 100644 --- a/src/Authoring/Studio/Palettes/Timeline/Bindings/ITimelineItemBinding.h +++ b/src/Authoring/Studio/Palettes/Timeline/Bindings/ITimelineItemBinding.h @@ -33,10 +33,8 @@ #include "ITimelineItem.h" #include "ITimelineItemProperty.h" -#include "IKeyframeSelector.h" #include "SIterator.h" -class CBaseStateRow; class RowTree; class CControlWindowListener; class ITimelineKeyframesManager; @@ -51,12 +49,7 @@ public: virtual void InsertKeyframe() = 0; virtual void DeleteAllChannelKeyframes() = 0; - virtual long GetKeyframeCount() const = 0; virtual IKeyframe *GetKeyframeByTime(long inTime) const = 0; - virtual IKeyframe *GetKeyframeByIndex(long inIndex) const = 0; - virtual long OffsetSelectedKeyframes(long inOffset) = 0; - virtual void CommitChangedKeyframes() = 0; - virtual void OnEditKeyframeTime(long inCurrentTime, long inObjectAssociation) = 0; }; //============================================================================= @@ -64,7 +57,7 @@ public: * Interface to encapsulate data model specific functions, that Timeline UI objects can talk to. */ //============================================================================= -class ITimelineItemBinding : public ITimelineItemKeyframesHolder, public IKeyframeSelector +class ITimelineItemBinding : public ITimelineItemKeyframesHolder { public: // List of possible transactions that requires querying the data model if they are valid @@ -84,14 +77,12 @@ public: virtual ~ITimelineItemBinding() {} virtual ITimelineItem *GetTimelineItem() = 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; virtual void OnCollapsed() = 0; - virtual void ClearKeySelection() = 0; virtual bool OpenAssociatedEditor() = 0; virtual void SetDropTarget(CDropTarget *inTarget) = 0; @@ -110,10 +101,6 @@ public: virtual bool IsLockedEnabled() const = 0; virtual bool IsVisibleEnabled() const = 0; - // Init/Cleanup - virtual void Bind(CBaseStateRow *inRow) = 0; - virtual void Release() = 0; - // ContextMenu virtual bool IsValidTransaction(EUserTransaction inTransaction) = 0; virtual void PerformTransaction(EUserTransaction inTransaction) = 0; @@ -124,13 +111,6 @@ public: virtual bool IsInternalizeable() { return false; } virtual void Internalize() {} - // Selected keyframes - virtual ITimelineKeyframesManager *GetKeyframesManager() const = 0; - - // Properties - virtual void RemoveProperty(ITimelineItemProperty *inProperty) = 0; - virtual void LoadProperties() = 0; - void setCreateUIRow(bool create) { m_createUIRow = create; } protected: diff --git a/src/Authoring/Studio/Palettes/Timeline/Bindings/ITimelineItemProperty.h b/src/Authoring/Studio/Palettes/Timeline/Bindings/ITimelineItemProperty.h index 26b00c09..72488480 100644 --- a/src/Authoring/Studio/Palettes/Timeline/Bindings/ITimelineItemProperty.h +++ b/src/Authoring/Studio/Palettes/Timeline/Bindings/ITimelineItemProperty.h @@ -32,21 +32,18 @@ #pragma once -#include "IKeyframeSelector.h" #include "Qt3DSDMMetaData.h" #include "Qt3DSString.h" class RowTree; -class CPropertyRow; class IKeyframe; -class ITimelineKeyframesManager; //============================================================================= /** * Abstraction of a data model item's property that is displayed in the Timeline. */ //============================================================================= -class ITimelineItemProperty : public IKeyframeSelector +class ITimelineItemProperty { public: virtual ~ITimelineItemProperty() {} @@ -58,26 +55,18 @@ public: virtual float GetMinimumValue() const = 0; virtual void SetSelected() = 0; - virtual void ClearKeySelection() = 0; virtual void DeleteAllKeys() = 0; - virtual void Bind(CPropertyRow *inRow) = 0; - virtual void Release() = 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; virtual IKeyframe *GetKeyframeByTime(long inTime) const = 0; virtual IKeyframe *GetKeyframeByIndex(long inIndex) const = 0; virtual long GetKeyframeCount() const = 0; virtual long GetChannelCount() const = 0; virtual float GetChannelValueAtTime(long inChannelIndex, long inTime) = 0; virtual void SetChannelValueAtTime(long inChannelIndex, long inTime, float inValue) = 0; - virtual long OffsetSelectedKeyframes(long inOffset) = 0; - virtual void CommitChangedKeyframes() = 0; - virtual void OnEditKeyframeTime(long inCurrentTime, long inObjectAssociation) = 0; virtual bool IsDynamicAnimation() = 0; }; diff --git a/src/Authoring/Studio/Palettes/Timeline/Bindings/ImageTimelineItemBinding.cpp b/src/Authoring/Studio/Palettes/Timeline/Bindings/ImageTimelineItemBinding.cpp index 8b53aba0..169d1667 100644 --- a/src/Authoring/Studio/Palettes/Timeline/Bindings/ImageTimelineItemBinding.cpp +++ b/src/Authoring/Studio/Palettes/Timeline/Bindings/ImageTimelineItemBinding.cpp @@ -38,7 +38,6 @@ #include "ImageTimelineItemBinding.h" #include "TimelineTranslationManager.h" #include "Qt3DSDMHandles.h" -#include "BaseStateRow.h" #include "Doc.h" #include "IObjectReferenceHelper.h" #include "EmptyTimelineTimebar.h" @@ -81,12 +80,6 @@ bool CImageTimelineItemBinding::ShowToggleControls() const return false; } -void CImageTimelineItemBinding::Bind(CBaseStateRow *inRow) -{ - Qt3DSDMTimelineItemBinding::Bind(inRow); - inRow->requestSetNameReadOnly(); -} - //============================================================================= /** * Open the associated item as though it was double-clicked in explorer diff --git a/src/Authoring/Studio/Palettes/Timeline/Bindings/ImageTimelineItemBinding.h b/src/Authoring/Studio/Palettes/Timeline/Bindings/ImageTimelineItemBinding.h index 187cb78a..b9343872 100644 --- a/src/Authoring/Studio/Palettes/Timeline/Bindings/ImageTimelineItemBinding.h +++ b/src/Authoring/Studio/Palettes/Timeline/Bindings/ImageTimelineItemBinding.h @@ -41,7 +41,6 @@ // Classes //============================================================================== class CTimelineTranslationManager; -class CBaseStateRow; class ITimelineTimebar; //============================================================================= @@ -61,7 +60,6 @@ public: void SetName(const Q3DStudio::CString &inName) override; EStudioObjectType GetObjectType() const override; bool ShowToggleControls() const override; - void Bind(CBaseStateRow *inRow) override; bool OpenAssociatedEditor() override; void SetPropertyHandle(qt3dsdm::Qt3DSDMPropertyHandle inProperty) diff --git a/src/Authoring/Studio/Palettes/Timeline/Bindings/KeyframesManager.cpp b/src/Authoring/Studio/Palettes/Timeline/Bindings/KeyframesManager.cpp deleted file mode 100644 index 91b24663..00000000 --- a/src/Authoring/Studio/Palettes/Timeline/Bindings/KeyframesManager.cpp +++ /dev/null @@ -1,507 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2008 NVIDIA Corporation. -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt 3D Studio. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -//============================================================================== -// Prefix -//============================================================================== -#include "stdafx.h" - -#include "KeyframesManager.h" -#include "IDoc.h" -#include "TimeEditDlg.h" -#include "TimelineTranslationManager.h" -#include "Qt3DSDMTimelineKeyframe.h" -#include "Qt3DSDMTimelineItemBinding.h" -#include "CmdDataModelRemoveKeyframe.h" -#include "CmdDataModelInsertKeyframe.h" -#include "CmdDataModelChangeKeyframe.h" -#include "Qt3DSDMAnimation.h" -#include "ClientDataModelBridge.h" -#include "PasteKeyframesCommandHelper.h" -#include "IDocumentEditor.h" -#include "IKeyframe.h" -#include "Dispatch.h" -#include "StudioPreferences.h" - -#include "StudioApp.h" //for CommitCurrentCommand -#include "Core.h" -#include "Dialogs.h" - -using namespace qt3dsdm; - -bool SortKeyframeInstancePairByTime(const CKeyframesManager::SKeyframeInstancePair &inLHS, - const CKeyframesManager::SKeyframeInstancePair &inRHS) -{ - return inLHS.m_Keyframe->GetTime() < inRHS.m_Keyframe->GetTime(); -} - -//============================================================================== -// Keyframe specific. -// DataModel selection is handled by CTimelineTranslationManager. -//============================================================================== -CKeyframesManager::CKeyframesManager(CTimelineTranslationManager *inTransMgr) - : m_TransMgr(inTransMgr) - , m_OffsetKeyframeCommandHelper(*(g_StudioApp.GetCore()->GetDoc())) - , m_PasteKeyframeCommandHelper(nullptr) -{ - // Mahmoud_TODO: to be removed after further clean up -// g_StudioApp.GetCore()->GetDoc()->SetKeyframesManager(this); -} - -CKeyframesManager::~CKeyframesManager() -{ - delete m_PasteKeyframeCommandHelper; -} - -bool CKeyframesManager::HasSelectedKeyframes(bool inOnlyDynamic /*= false */) -{ - // specifically only to know if there are any selected keyframes that are dynamic - if (inOnlyDynamic) { - for (size_t theIndex = 0; theIndex < m_SelectedKeyframes.size(); ++theIndex) - if (m_SelectedKeyframes[theIndex].m_Keyframe->IsDynamic()) - return true; - - return false; - } - - bool theRetVal = !m_SelectedKeyframes.empty(); - - return theRetVal; -} - -bool CKeyframesManager::CanPerformKeyframeCopy() -{ - bool theCanCopyNewData = false; - // Legacy system actually prevents copy/pasting between different instances, so let's preserve - // that - if (!m_SelectedKeyframes.empty()) { - theCanCopyNewData = true; - if (m_SelectedKeyframes.size() > 1) { - Qt3DSDMTimelineItemBinding *theInstance = m_SelectedKeyframes[0].m_Instance; - TSelectedKeyframeList::iterator theIter = m_SelectedKeyframes.begin(); - ++theIter; - for (; theIter != m_SelectedKeyframes.end() && theCanCopyNewData; ++theIter) { - if (theIter->m_Instance != theInstance) // fail! - theCanCopyNewData = false; - } - } - } - return theCanCopyNewData; -} - -bool CKeyframesManager::CanPerformKeyframePaste() -{ - if (m_PasteKeyframeCommandHelper && m_PasteKeyframeCommandHelper->HasCopiedKeyframes()) { - qt3dsdm::Qt3DSDMInstanceHandle theSelectedInstance = - g_StudioApp.GetCore()->GetDoc()->GetSelectedInstance(); - if (theSelectedInstance.Valid()) { - return true; - } - } - return false; -} - -void CKeyframesManager::CopyKeyframes() -{ - CopySelectedKeyframes(); -} - -// legacy stuff that we have to support for animation tracks in the old data model to work -inline void PostExecuteCommand(IDoc *inDoc) -{ - CDoc *theDoc = dynamic_cast<CDoc *>(inDoc); - theDoc->GetCore()->CommitCurrentCommand(); - // fire render event. - // theDoc->UpdateClientScene( true ); -} - -//@param inPerformCopy true if that is a copy/cut command. false if this is a delete. -// Note: Keyframes are never explicitly copied to the clipboard (only as part of a asset copy), -// hence that means that the keyframes (only) are never copied across different instances of studio. -bool CKeyframesManager::RemoveKeyframes(bool inPerformCopy) -{ - bool theRetVal = HasSelectedKeyframes(); - - CDoc *theDoc = g_StudioApp.GetCore()->GetDoc(); - - if (inPerformCopy) // copy prior to removing the keyframes - CopySelectedKeyframes(); - - CCmdDataModelRemoveKeyframe *theCmd = nullptr; - if (!m_SelectedKeyframes.empty()) { - TSelectedKeyframeList::iterator theKeyIter = m_SelectedKeyframes.begin(); - for (; theKeyIter != m_SelectedKeyframes.end(); ++theKeyIter) { - Qt3DSDMTimelineKeyframe::TKeyframeHandleList theKeyframeHandles; - theKeyIter->m_Keyframe->GetKeyframeHandles(theKeyframeHandles); - ASSERT(!theKeyframeHandles.empty()); - Qt3DSDMTimelineKeyframe::TKeyframeHandleList::iterator theIter = - theKeyframeHandles.begin(); - if (!theCmd) { - theCmd = new CCmdDataModelRemoveKeyframe(theDoc, *theIter); - ++theIter; - } - for (; theIter != theKeyframeHandles.end(); ++theIter) - theCmd->AddKeyframeHandle(*theIter); - } - } - - if (theCmd) { - g_StudioApp.GetCore()->ExecuteCommand(theCmd); - PostExecuteCommand(theDoc); - } - return theRetVal; -} - -// note: we can't paste data from old data model system to the new one, and vice versa. so either -// the old Or the new system succeeds in pasting, never both. -void CKeyframesManager::PasteKeyframes() -{ - CDoc *theDoc = g_StudioApp.GetCore()->GetDoc(); - - if (m_PasteKeyframeCommandHelper && m_PasteKeyframeCommandHelper->HasCopiedKeyframes()) { - qt3dsdm::Qt3DSDMInstanceHandle theSelectedInstance = theDoc->GetSelectedInstance(); - if (theSelectedInstance.Valid()) { - long theCurrentViewTimeInMilliseconds = theDoc->GetCurrentViewTime(); - CCmdDataModelInsertKeyframe *theInsertKeyframesCommand = - m_PasteKeyframeCommandHelper->GetCommand(theDoc, theCurrentViewTimeInMilliseconds, - theSelectedInstance); - if (theInsertKeyframesCommand) - g_StudioApp.GetCore()->ExecuteCommand(theInsertKeyframesCommand); - } - } -} - -//============================================================================= -/** - * Sets interpolation values of all selected keyframes to the values specified - * by the user. Pops up a dialog prompting the user to choose new ease in and - * ease out values. Values in the dialog are initialized to the left-most - * selected keyframe's interpolation values. - */ -void CKeyframesManager::SetKeyframeInterpolation() -{ - if (!HasSelectedKeyframes()) - return; - - float theEaseIn = 0; - float theEaseOut = 0; - if (CStudioPreferences::GetInterpolation()) - theEaseIn = theEaseOut = 100; - - IAnimationCore *theAnimationCore = m_TransMgr->GetStudioSystem()->GetAnimationCore(); - - if (!m_SelectedKeyframes.empty()) // this is a sorted list, so we only need to grab tge ease - // in/out values from the first item in this list. - { - Qt3DSDMTimelineKeyframe *theTimelineKeyframe = m_SelectedKeyframes.front().m_Keyframe; - Qt3DSDMTimelineKeyframe::TKeyframeHandleList theKeyframeHandles; - theTimelineKeyframe->GetKeyframeHandles(theKeyframeHandles); - TKeyframe theKeyframeData = theAnimationCore->GetKeyframeData(theKeyframeHandles[0]); - GetEaseInOutValues(theKeyframeData, theEaseIn, theEaseOut); - } - - if (g_StudioApp.GetDialogs()->PromptForKeyframeInterpolation(theEaseIn, theEaseOut)) { - CDoc *theDoc = g_StudioApp.GetCore()->GetDoc(); - Q3DStudio::ScopedDocumentEditor editor(*theDoc, L"Set Keyframe Interpolation", __FILE__, - __LINE__); - TSelectedKeyframeList::iterator theKeyIter = m_SelectedKeyframes.begin(); - for (; theKeyIter != m_SelectedKeyframes.end(); ++theKeyIter) { - Qt3DSDMTimelineKeyframe *theTimelineKeyframe = theKeyIter->m_Keyframe; - Qt3DSDMTimelineKeyframe::TKeyframeHandleList theKeyframeHandles; - theTimelineKeyframe->GetKeyframeHandles(theKeyframeHandles); - for (size_t i = 0; i < theKeyframeHandles.size(); ++i) { - TKeyframe theKeyframeData = - theAnimationCore->GetKeyframeData(theKeyframeHandles[i]); - SetEaseInOutValues(theKeyframeData, theEaseIn, theEaseOut); - theAnimationCore->SetKeyframeData(theKeyframeHandles[i], theKeyframeData); - } - } - } -} - -bool CKeyframesManager::HasDynamicKeyframes() -{ - Qt3DSDMTimelineItemBinding *theBinding = m_TransMgr->GetSelectedBinding(); - if (theBinding) { - return theBinding->HasDynamicKeyframes(-1); - } - return false; -} - -void CKeyframesManager::SelectAllKeyframes() -{ - ITimelineItemBinding *theBinding = m_TransMgr->GetSelectedBinding(); - if (theBinding) - theBinding->SelectKeyframes(true); -} - -void CKeyframesManager::DeselectAllKeyframes() -{ - m_TransMgr->ClearBindingsKeyframeSelection(); - m_SelectedKeyframes.clear(); -} - -//============================================================================== -/** - * Sets keyframes on all the changed properties of the selected object. - * Also known as autoset keyframes, but it only applies to one object, and is - * the result of an F6 key press. Tells the TimelineCtrl to autoset keyframes. - */ -void CKeyframesManager::SetChangedKeyframes() -{ - - CDoc *theDoc = g_StudioApp.GetCore()->GetDoc(); - qt3dsdm::Qt3DSDMInstanceHandle theSelectedInstance = theDoc->GetSelectedInstance(); - if (theSelectedInstance.Valid()) { - using namespace Q3DStudio; - Q3DStudio::ScopedDocumentEditor editor(*theDoc, L"Set Changed Keyframes", __FILE__, - __LINE__); - CStudioSystem *theStudioSystem = theDoc->GetStudioSystem(); - // Get all animated properties. - TPropertyHandleList theProperties; - theStudioSystem->GetPropertySystem()->GetAggregateInstanceProperties(theSelectedInstance, - theProperties); - for (size_t thePropertyIndex = 0; thePropertyIndex < theProperties.size(); - ++thePropertyIndex) { - if (theStudioSystem->GetAnimationSystem()->IsPropertyAnimated( - theSelectedInstance, theProperties[thePropertyIndex])) - editor->KeyframeProperty(theSelectedInstance, theProperties[thePropertyIndex], - true); - } - } -} - -void CKeyframesManager::SetKeyframeTime(long inTime) -{ - CTimeEditDlg theTimeEditDlg; - theTimeEditDlg.setKeyframesManager(this); - theTimeEditDlg.showDialog(inTime, g_StudioApp.GetCore()->GetDoc(), ASSETKEYFRAME); -} - -void CKeyframesManager::SetKeyframeDynamic(Qt3DSDMTimelineKeyframe *inKeyframe, bool inDynamic) -{ - CDoc *theDoc = g_StudioApp.GetCore()->GetDoc(); - qt3dsdm::TKeyframeHandleList theKeyframeHandle; - CCmdDataModelChangeDynamicKeyframe *theCmd = nullptr; - - if (inKeyframe != nullptr) - inKeyframe->GetKeyframeHandles(theKeyframeHandle); - - qt3dsdm::IAnimationCore *theAnimationCore = theDoc->GetStudioSystem()->GetAnimationCore(); - for (size_t theKeyframe = 0; theKeyframe < theKeyframeHandle.size(); ++theKeyframe) { - qt3dsdm::Qt3DSDMAnimationHandle theAnimation( - theAnimationCore->GetAnimationForKeyframe(theKeyframeHandle.at(theKeyframe))); - if (!theCmd) - theCmd = new CCmdDataModelChangeDynamicKeyframe(theDoc, theAnimation, inDynamic); - else - theCmd->AddHandle(theAnimation); - } - - if (theCmd) - g_StudioApp.GetCore()->ExecuteCommand(theCmd); -} - -void CKeyframesManager::SetKeyframesDynamic(bool inDynamic) -{ - - Qt3DSDMTimelineKeyframe *theKeyframe; - - if (m_SelectedKeyframes.size() == 0) { - Qt3DSDMTimelineItemBinding *theBinding = m_TransMgr->GetSelectedBinding(); - IKeyframe *key = theBinding->GetKeyframeByIndex(0); - theKeyframe = dynamic_cast<Qt3DSDMTimelineKeyframe *>(key); - SetKeyframeDynamic(theKeyframe, inDynamic); - } else { - for (int i = 0; i < (int)m_SelectedKeyframes.size(); ++i) { - theKeyframe = m_SelectedKeyframes[i].m_Keyframe; - SetKeyframeDynamic(theKeyframe, inDynamic); - } - } -} - -long CKeyframesManager::OffsetSelectedKeyframes(long inOffset) -{ - m_InstanceSet.clear(); - m_InstanceList.clear(); - std::set<Qt3DSDMTimelineItemBinding *> &theInstances(m_InstanceSet); - - TSelectedKeyframeList::iterator theKeyIter = m_SelectedKeyframes.begin(); - for (; theKeyIter != m_SelectedKeyframes.end(); ++theKeyIter) { - // since this list is sorted by time and we are iterating from the first in the list - long theKeyframeTime = theKeyIter->m_Keyframe->GetTime(); - if (inOffset < 0 && theKeyframeTime + inOffset < 0) - inOffset = -theKeyframeTime; - - theKeyIter->m_Keyframe->UpdateKeyframesTime(&m_OffsetKeyframeCommandHelper, - theKeyframeTime + inOffset); - - // this contains unique instancs, i.e. mulitple keyframe can map to the same instances - if (theInstances.insert(theKeyIter->m_Instance).second) - m_InstanceList.push_back(theKeyIter->m_Instance->GetInstance()); - } - - // UI update, explicitly because this doesn't generate any events till action is committed - std::set<Qt3DSDMTimelineItemBinding *>::iterator theInstanceIter = theInstances.begin(); - for (; theInstanceIter != theInstances.end(); ++theInstanceIter) - (*theInstanceIter)->UIRefreshPropertyKeyframe(inOffset); - - if (m_InstanceList.size()) - m_TransMgr->GetDoc()->GetCore()->GetDispatch()->FireImmediateRefreshInstance( - &m_InstanceList[0], (long)m_InstanceList.size()); - - // by contract, this functions returns the "legal" offset, ie time cannot be offset to negative. - return inOffset; -} - -void CKeyframesManager::CommitChangedKeyframes() -{ - m_OffsetKeyframeCommandHelper.Finalize(); -} - -void CKeyframesManager::RollbackChangedKeyframes() -{ - m_OffsetKeyframeCommandHelper.Rollback(); -} - -bool CKeyframesManager::CanMakeSelectedKeyframesDynamic() -{ - using namespace qt3dsdm; - TKeyframeHandleList theKeyframes; - TKeyframeHandleList allTheKeyframes; - IAnimationCore &theAnimationCore( - *g_StudioApp.GetCore()->GetDoc()->GetStudioSystem()->GetAnimationCore()); - // Ensure that all keyframes selected are the first keyframes from the animation track. - for (size_t idx = 0, end = m_SelectedKeyframes.size(); idx < end; ++idx) { - theKeyframes.clear(); - m_SelectedKeyframes.at(idx).m_Keyframe->GetKeyframeHandles(theKeyframes); - for (size_t specificKeyframeIdx = 0, specificKeyframeEnd = theKeyframes.size(); - specificKeyframeIdx < specificKeyframeEnd; ++specificKeyframeIdx) { - Qt3DSDMKeyframeHandle theKeyframe = theKeyframes[specificKeyframeIdx]; - Qt3DSDMAnimationHandle theAnimation = - theAnimationCore.GetAnimationForKeyframe(theKeyframe); - allTheKeyframes.clear(); - theAnimationCore.GetKeyframes(theAnimation, allTheKeyframes); - if (allTheKeyframes[0] != theKeyframe) - return false; - } - } - return true; -} - -// keeps track of selected keyframes so that we don't have to iterate through the entire hierarchy -// to find them -void CKeyframesManager::SetKeyframeSelected(Qt3DSDMTimelineKeyframe *inKeyframe, bool inSelected, - Qt3DSDMTimelineItemBinding *inOwningInstance /*= nullptr */) -{ - TSelectedKeyframeList::iterator theKeyIter = m_SelectedKeyframes.begin(); - for (; theKeyIter != m_SelectedKeyframes.end(); ++theKeyIter) { - if (theKeyIter->m_Keyframe == inKeyframe) - break; - } - if (inSelected) { - ASSERT(inOwningInstance); - if (theKeyIter == m_SelectedKeyframes.end()) { // only this is not already selected - m_SelectedKeyframes.push_back(SKeyframeInstancePair(inKeyframe, inOwningInstance)); - std::sort(m_SelectedKeyframes.begin(), m_SelectedKeyframes.end(), - SortKeyframeInstancePairByTime); - } - } else if (theKeyIter != m_SelectedKeyframes.end()) { - m_SelectedKeyframes.erase(theKeyIter); - } -} - -qt3dsdm::SGetOrSetKeyframeInfo SetupKeyframeInfo(qt3dsdm::Qt3DSDMKeyframeHandle inKeyframe, - qt3dsdm::IAnimationCore &inCore) -{ - TKeyframe theKeyframeData = inCore.GetKeyframeData(inKeyframe); - SEaseInEaseOutKeyframe theKeyframe = qt3dsdm::get<SEaseInEaseOutKeyframe>(theKeyframeData); - // Is this the first keyframe? - bool isDynamic = false; - if (inCore.IsFirstKeyframe(inKeyframe)) - isDynamic = inCore.GetAnimationInfo(inCore.GetAnimationForKeyframe(inKeyframe)) - .m_DynamicFirstKeyframe; - - return SGetOrSetKeyframeInfo(theKeyframe.m_KeyframeValue, theKeyframe.m_EaseIn, - theKeyframe.m_EaseOut, isDynamic); -} - -// only deal with this manager's selected keyframes -void CKeyframesManager::CopySelectedKeyframes() -{ - if (!m_SelectedKeyframes.empty()) { - if (m_PasteKeyframeCommandHelper) - m_PasteKeyframeCommandHelper->Clear(); // clear out previously copied data - else - m_PasteKeyframeCommandHelper = new CPasteKeyframeCommandHelper(); - - // note: m_SelectedKeyframes is already sorted by time - float theEarliestKeyframeTimeInSecs = - Qt3DSDMTimelineKeyframe::GetTimeInSecs(m_SelectedKeyframes[0].m_Keyframe->GetTime()); - - IAnimationCore *theAnimationCore = m_TransMgr->GetStudioSystem()->GetAnimationCore(); - TSelectedKeyframeList::iterator theIter = m_SelectedKeyframes.begin(); - for (; theIter != m_SelectedKeyframes.end(); ++theIter) { - Qt3DSDMTimelineKeyframe *theKeyframe = (*theIter).m_Keyframe; - Qt3DSDMTimelineKeyframe::TKeyframeHandleList theKeyframeHandles; - theKeyframe->GetKeyframeHandles(theKeyframeHandles); - qt3dsdm::SGetOrSetKeyframeInfo theInfos[3]; - size_t theValidInfos = 0; - if (!theKeyframeHandles.empty()) { - // TODO: need to figure out a good way to convert from individual keyframes back to - // SValue - SValue theValue; - switch (theKeyframeHandles.size()) { - case 1: { - theInfos[0] = SetupKeyframeInfo(theKeyframeHandles[0], *theAnimationCore); - theValidInfos = 1; - - } break; - case 3: { - theInfos[0] = SetupKeyframeInfo(theKeyframeHandles[0], *theAnimationCore); - theInfos[1] = SetupKeyframeInfo(theKeyframeHandles[1], *theAnimationCore); - theInfos[2] = SetupKeyframeInfo(theKeyframeHandles[2], *theAnimationCore); - theValidInfos = 3; - } break; - default: // not handled - break; - } - // time is relative to the earliest keyframe time. - float theRelativeTimeInSecs = - Qt3DSDMTimelineKeyframe::GetTimeInSecs(theKeyframe->GetTime()) - - theEarliestKeyframeTimeInSecs; - - Qt3DSDMAnimationHandle theAnimation = - theAnimationCore->GetAnimationForKeyframe(theKeyframeHandles[0]); - m_PasteKeyframeCommandHelper->AddKeyframeData( - theAnimationCore->GetAnimationInfo(theAnimation).m_Property, - theRelativeTimeInSecs, theInfos, theValidInfos); - } - } - } -} diff --git a/src/Authoring/Studio/Palettes/Timeline/Bindings/KeyframesManager.h b/src/Authoring/Studio/Palettes/Timeline/Bindings/KeyframesManager.h deleted file mode 100644 index c20de57e..00000000 --- a/src/Authoring/Studio/Palettes/Timeline/Bindings/KeyframesManager.h +++ /dev/null @@ -1,108 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2008 NVIDIA Corporation. -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt 3D Studio. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef INCLUDED_KEYFRAMES_MANAGER_H -#define INCLUDED_KEYFRAMES_MANAGER_H 1 - -#pragma once - -#include "ITimelineKeyframesManager.h" -#include "OffsetKeyframesCommandHelper.h" - -class CTimelineTranslationManager; -class Qt3DSDMTimelineKeyframe; -class Qt3DSDMTimelineItemBinding; -class CPasteKeyframeCommandHelper; - -//============================================================================= -/** - * Abstraction layer to the class that manages both selected keyframes. - */ -//============================================================================= -class CKeyframesManager : public ITimelineKeyframesManager -{ -public: - CKeyframesManager(CTimelineTranslationManager *inTransMgr); - virtual ~CKeyframesManager(); - - // IKeyframesManager - bool HasSelectedKeyframes(bool inOnlyDynamic = false) override; - bool HasDynamicKeyframes() override; - bool CanPerformKeyframeCopy() override; - bool CanPerformKeyframePaste() override; - void CopyKeyframes() override; - bool RemoveKeyframes(bool inPerformCopy) override; - void PasteKeyframes() override; - void SetKeyframeInterpolation() override; - void DeselectAllKeyframes() override; - void SelectAllKeyframes() override; - void SetChangedKeyframes() override; - // ITimelineKeyframesManager - void SetKeyframeTime(long inTime) override; - void SetKeyframesDynamic(bool inDynamic) override; - bool CanMakeSelectedKeyframesDynamic() override; - long OffsetSelectedKeyframes(long inOffset) override; - void CommitChangedKeyframes() override; - void RollbackChangedKeyframes() override; - - void SetKeyframeSelected(Qt3DSDMTimelineKeyframe *inKeyframe, bool inSelected, - Qt3DSDMTimelineItemBinding *inOwningInstance = nullptr); - -protected: - void SetKeyframeDynamic(Qt3DSDMTimelineKeyframe *inKeyframe, bool inDynamic); - void CopySelectedKeyframes(); - -public: - struct SKeyframeInstancePair - { - Qt3DSDMTimelineKeyframe *m_Keyframe; - Qt3DSDMTimelineItemBinding *m_Instance; - - SKeyframeInstancePair(Qt3DSDMTimelineKeyframe *inKeyframe, - Qt3DSDMTimelineItemBinding *inInstance) - { - m_Keyframe = inKeyframe; - m_Instance = inInstance; - } - }; - -protected: - typedef std::vector<SKeyframeInstancePair> TSelectedKeyframeList; ///< handle multiple keyframes - ///manipulation, e.g. - ///offsetting by dragging - - CTimelineTranslationManager *m_TransMgr; - TSelectedKeyframeList m_SelectedKeyframes; - COffsetKeyframesCommandHelper m_OffsetKeyframeCommandHelper; // so that we can commit on mouseup - CPasteKeyframeCommandHelper *m_PasteKeyframeCommandHelper; - std::set<Qt3DSDMTimelineItemBinding *> m_InstanceSet; - std::vector<qt3dsdm::Qt3DSDMInstanceHandle> m_InstanceList; -}; - -#endif // INCLUDED_IKEYFRAMES_MANAGER_H diff --git a/src/Authoring/Studio/Palettes/Timeline/Bindings/LayerTimelineItemBinding.cpp b/src/Authoring/Studio/Palettes/Timeline/Bindings/LayerTimelineItemBinding.cpp index 9b11c389..0e7b0b19 100644 --- a/src/Authoring/Studio/Palettes/Timeline/Bindings/LayerTimelineItemBinding.cpp +++ b/src/Authoring/Studio/Palettes/Timeline/Bindings/LayerTimelineItemBinding.cpp @@ -37,7 +37,6 @@ //============================================================================== #include "LayerTimelineItemBinding.h" #include "TimelineTranslationManager.h" -#include "BaseStateRow.h" #include "ImageTimelineItemBinding.h" #include "EmptyTimelineTimebar.h" @@ -74,25 +73,6 @@ bool ImageSlotIsFilled(qt3dsdm::IPropertySystem *inPropertySystem, Qt3DSDMInstan return theReturn; } - -// helper function to find the image binding class that 'represents' this property -inline CImageTimelineItemBinding *FindImageBindingByProperty(CBaseStateRow *inRow, - Qt3DSDMPropertyHandle inProperty) -{ - if (!inRow || !inProperty.Valid()) - return nullptr; - - CImageTimelineItemBinding *theInvalidImageBinding = nullptr; - for (long theIndex = 0; theIndex < inRow->GetNumNonPropertyRows(); ++theIndex) { - CImageTimelineItemBinding *theImageBinding = dynamic_cast<CImageTimelineItemBinding *>( - inRow->GetNonPropertyRow(theIndex)->GetTimelineItemBinding()); - if (theImageBinding && theImageBinding->GetPropertyHandle() == inProperty) { - theInvalidImageBinding = theImageBinding; - break; - } - } - return theInvalidImageBinding; -} } CLayerTimelineItemBinding::CLayerTimelineItemBinding(CTimelineTranslationManager *inMgr, @@ -176,66 +156,7 @@ void CLayerTimelineItemBinding::OnAddChild(qt3dsdm::Qt3DSDMInstanceHandle inInst void CLayerTimelineItemBinding::OnPropertyChanged(Qt3DSDMPropertyHandle inPropertyHandle) { - bool theHandled = false; - if (m_Row) { - qt3dsdm::IPropertySystem *thePropertySystem = - m_TransMgr->GetStudioSystem()->GetPropertySystem(); - CClientDataModelBridge *theBridge = - m_TransMgr->GetStudioSystem()->GetClientDataModelBridge(); - qt3dsdm::TCharStr thePropertyName = thePropertySystem->GetName(inPropertyHandle); - size_t theSlotCount = m_ImageNameFormalNamePairs.size(); - for (size_t theSlotIndex = 0; theSlotIndex < theSlotCount; ++theSlotIndex) { - qt3dsdm::TCharStr thePropName = std::get<0>(m_ImageNameFormalNamePairs[theSlotIndex]); - if (thePropertyName == thePropName) { - if (ImageSlotIsFilled(thePropertySystem, m_DataHandle, thePropName)) { - // already created, bail! - if (m_TransMgr->GetBinding(GetImage(inPropertyHandle))) - return; - - // Image property was changed from one non-zero guid value to another, delete - // the old and and create a new one - CImageTimelineItemBinding *theReplacedImageBinding = - FindImageBindingByProperty(m_Row, inPropertyHandle); - if (theReplacedImageBinding) - m_Row->RemoveChildRow(theReplacedImageBinding); - - ITimelineItemBinding *theNextImageBinding = nullptr; - // Determine if this is inserted somewhere in the existing list. - for (size_t theNextImage = theSlotIndex + 1; theNextImage < theSlotCount; - ++theNextImage) { - qt3dsdm::TCharStr theTempName = - std::get<0>(m_ImageNameFormalNamePairs[theNextImage]); - if (ImageSlotIsFilled(thePropertySystem, m_DataHandle, theTempName)) { - Qt3DSDMPropertyHandle theNextImageProperty = - theBridge->GetAggregateInstancePropertyByName(m_DataHandle, - theTempName); - theNextImageBinding = - m_TransMgr->GetBinding(GetImage(theNextImageProperty)); - break; - } - } - m_Row->AddChildRow( - GetOrCreateImageBinding( - inPropertyHandle, - std::get<1>(m_ImageNameFormalNamePairs[theSlotIndex]).wide_str()), - theNextImageBinding); - } else // check for delete - { - // GetImage will not return anything valid since the value is nuked. - // From the UI end, there is no way we can tell which image is associated with - // this property, since that is "encapsulated" in the property value. - CImageTimelineItemBinding *theInvalidImageBinding = - FindImageBindingByProperty(m_Row, inPropertyHandle); - if (theInvalidImageBinding) - m_Row->RemoveChildRow(theInvalidImageBinding); - } - theHandled = true; - break; - } - } - } - if (!theHandled) - Qt3DSDMTimelineItemBinding::OnPropertyChanged(inPropertyHandle); + Qt3DSDMTimelineItemBinding::OnPropertyChanged(inPropertyHandle); } qt3dsdm::Qt3DSDMInstanceHandle diff --git a/src/Authoring/Studio/Palettes/Timeline/Bindings/MaterialTimelineItemBinding.cpp b/src/Authoring/Studio/Palettes/Timeline/Bindings/MaterialTimelineItemBinding.cpp index 55598353..59069db7 100644 --- a/src/Authoring/Studio/Palettes/Timeline/Bindings/MaterialTimelineItemBinding.cpp +++ b/src/Authoring/Studio/Palettes/Timeline/Bindings/MaterialTimelineItemBinding.cpp @@ -37,7 +37,6 @@ //============================================================================== #include "MaterialTimelineItemBinding.h" #include "TimelineTranslationManager.h" -#include "BaseStateRow.h" #include "ImageTimelineItemBinding.h" #include "EmptyTimelineTimebar.h" @@ -182,138 +181,14 @@ void CMaterialTimelineItemBinding::OnAddChild(qt3dsdm::Qt3DSDMInstanceHandle inI Qt3DSDMTimelineItemBinding::OnAddChild(inInstance); } -// helper function to find the image binding class that 'represents' this property -inline CImageTimelineItemBinding *FindImageBindingByProperty(CBaseStateRow *inRow, - Qt3DSDMPropertyHandle inProperty) -{ - if (!inRow || !inProperty.Valid()) - return nullptr; - - CImageTimelineItemBinding *theInvalidImageBinding = nullptr; - for (long theIndex = 0; theIndex < inRow->GetNumNonPropertyRows(); ++theIndex) { - CImageTimelineItemBinding *theImageBinding = dynamic_cast<CImageTimelineItemBinding *>( - inRow->GetNonPropertyRow(theIndex)->GetTimelineItemBinding()); - if (theImageBinding && theImageBinding->GetPropertyHandle() == inProperty) { - theInvalidImageBinding = theImageBinding; - break; - } - } - return theInvalidImageBinding; -} - void CMaterialTimelineItemBinding::OnPropertyChanged(Qt3DSDMPropertyHandle inPropertyHandle) { - bool theHandled = false; - if (m_Row) { - qt3dsdm::IPropertySystem *thePropertySystem = - m_TransMgr->GetStudioSystem()->GetPropertySystem(); - CClientDataModelBridge *theBridge = - m_TransMgr->GetStudioSystem()->GetClientDataModelBridge(); - qt3dsdm::TCharStr thePropertyName = thePropertySystem->GetName(inPropertyHandle); - size_t theSlotCount = m_ImageNameFormalNamePairs.size(); - for (size_t theSlotIndex = 0; theSlotIndex < theSlotCount; ++theSlotIndex) { - qt3dsdm::TCharStr thePropName = std::get<0>(m_ImageNameFormalNamePairs[theSlotIndex]); - if (thePropertyName == thePropName) { - if (ImageSlotIsFilled(thePropertySystem, m_DataHandle, thePropName)) { - // already created, bail! - if (m_TransMgr->GetBinding(GetImage(inPropertyHandle))) - return; - - // Image property was changed from one non-zero guid value to another, delete - // the old and and create a new one - CImageTimelineItemBinding *theReplacedImageBinding = - FindImageBindingByProperty(m_Row, inPropertyHandle); - if (theReplacedImageBinding) - m_Row->RemoveChildRow(theReplacedImageBinding); - - ITimelineItemBinding *theNextImageBinding = nullptr; - // Determine if this is inserted somewhere in the existing list. - for (size_t theNextImage = theSlotIndex + 1; theNextImage < theSlotCount; - ++theNextImage) { - qt3dsdm::TCharStr theTempName = - std::get<0>(m_ImageNameFormalNamePairs[theNextImage]); - if (ImageSlotIsFilled(thePropertySystem, m_DataHandle, theTempName)) { - Qt3DSDMPropertyHandle theNextImageProperty = - theBridge->GetAggregateInstancePropertyByName(m_DataHandle, - theTempName); - theNextImageBinding = - m_TransMgr->GetBinding(GetImage(theNextImageProperty)); - break; - } - } - m_Row->AddChildRow( - GetOrCreateImageBinding( - inPropertyHandle, - std::get<1>(m_ImageNameFormalNamePairs[theSlotIndex]).wide_str()), - theNextImageBinding); - } else // check for delete - { - // GetImage will not return anything valid since the value is nuked. - // From the UI end, there is no way we can tell which image is associated with - // this property, since that is "encapsulated" in the property value. - CImageTimelineItemBinding *theInvalidImageBinding = - FindImageBindingByProperty(m_Row, inPropertyHandle); - if (theInvalidImageBinding) - m_Row->RemoveChildRow(theInvalidImageBinding); - } - theHandled = true; - break; - } - } - } - if (!theHandled) - Qt3DSDMTimelineItemBinding::OnPropertyChanged(inPropertyHandle); + Qt3DSDMTimelineItemBinding::OnPropertyChanged(inPropertyHandle); } void CMaterialTimelineItemBinding::OnPropertyLinked(Qt3DSDMPropertyHandle inPropertyHandle) { - bool theHandled = false; - if (m_Row) { - qt3dsdm::IPropertySystem *thePropertySystem = - m_TransMgr->GetStudioSystem()->GetPropertySystem(); - CClientDataModelBridge *theBridge = - m_TransMgr->GetStudioSystem()->GetClientDataModelBridge(); - qt3dsdm::TCharStr thePropertyName = thePropertySystem->GetName(inPropertyHandle); - size_t theSlotCount = m_ImageNameFormalNamePairs.size(); - for (size_t theSlotIndex = 0; theSlotIndex < theSlotCount; ++theSlotIndex) { - qt3dsdm::TCharStr thePropName = std::get<0>(m_ImageNameFormalNamePairs[theSlotIndex]); - if (thePropertyName == thePropName) { - // Refresh image child row by delete and recreate - CImageTimelineItemBinding *theInvalidImageBinding = - FindImageBindingByProperty(m_Row, inPropertyHandle); - if (theInvalidImageBinding) - m_Row->RemoveChildRow(theInvalidImageBinding); - - if (ImageSlotIsFilled(thePropertySystem, m_DataHandle, thePropName)) { - ITimelineItemBinding *theNextImageBinding = nullptr; - // Determine if this is inserted somewhere in the existing list. - for (size_t theNextImage = theSlotIndex + 1; theNextImage < theSlotCount; - ++theNextImage) { - qt3dsdm::TCharStr theTempName = - std::get<0>(m_ImageNameFormalNamePairs[theNextImage]); - if (ImageSlotIsFilled(thePropertySystem, m_DataHandle, theTempName)) { - Qt3DSDMPropertyHandle theNextImageProperty = - theBridge->GetAggregateInstancePropertyByName(m_DataHandle, - theTempName); - theNextImageBinding = - m_TransMgr->GetBinding(GetImage(theNextImageProperty)); - break; - } - } - m_Row->AddChildRow( - GetOrCreateImageBinding( - inPropertyHandle, - std::get<1>(m_ImageNameFormalNamePairs[theSlotIndex]).wide_str()), - theNextImageBinding); - } - - theHandled = true; - break; - } - } - } - if (!theHandled) - Qt3DSDMTimelineItemBinding::OnPropertyLinked(inPropertyHandle); + Qt3DSDMTimelineItemBinding::OnPropertyLinked(inPropertyHandle); } qt3dsdm::Qt3DSDMInstanceHandle diff --git a/src/Authoring/Studio/Palettes/Timeline/Bindings/MaterialTimelineItemBinding.h b/src/Authoring/Studio/Palettes/Timeline/Bindings/MaterialTimelineItemBinding.h index 80e7bc47..9f5bebdd 100644 --- a/src/Authoring/Studio/Palettes/Timeline/Bindings/MaterialTimelineItemBinding.h +++ b/src/Authoring/Studio/Palettes/Timeline/Bindings/MaterialTimelineItemBinding.h @@ -42,7 +42,6 @@ // Classes //============================================================================== class CTimelineTranslationManager; -class CBaseStateRow; //============================================================================= /** diff --git a/src/Authoring/Studio/Palettes/Timeline/Bindings/PathAnchorPointTimelineItemBinding.h b/src/Authoring/Studio/Palettes/Timeline/Bindings/PathAnchorPointTimelineItemBinding.h index 402f8cea..83997cd1 100644 --- a/src/Authoring/Studio/Palettes/Timeline/Bindings/PathAnchorPointTimelineItemBinding.h +++ b/src/Authoring/Studio/Palettes/Timeline/Bindings/PathAnchorPointTimelineItemBinding.h @@ -41,7 +41,6 @@ // Classes //============================================================================== class CTimelineTranslationManager; -class CBaseStateRow; //============================================================================= /** diff --git a/src/Authoring/Studio/Palettes/Timeline/Bindings/PathTimelineItemBinding.h b/src/Authoring/Studio/Palettes/Timeline/Bindings/PathTimelineItemBinding.h index 833a265c..ea006044 100644 --- a/src/Authoring/Studio/Palettes/Timeline/Bindings/PathTimelineItemBinding.h +++ b/src/Authoring/Studio/Palettes/Timeline/Bindings/PathTimelineItemBinding.h @@ -40,7 +40,6 @@ // Classes //============================================================================== class CTimelineTranslationManager; -class CBaseStateRow; //============================================================================= /** 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<Qt3DSDMAssetTimelineKeyframe *>(&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<CStateRow *>(m_Row); - if (theRow) { - theRow->OnTimeChange(); - theRow->setDirty(false); - if (inRefreshChildren) { - const QList<ITimelineItemBinding *> children = GetChildren(); - for (auto child : children) { - Qt3DSDMTimelineItemBinding *theBinding = - static_cast<Qt3DSDMTimelineItemBinding *>(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<Qt3DSDMAssetTimelineKeyframe *>(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<Qt3DSDMAssetTimelineKeyframe *>(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(); - } } //============================================================================= diff --git a/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemBinding.h b/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemBinding.h index 9d14cc84..198ec8a3 100644 --- a/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemBinding.h +++ b/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemBinding.h @@ -51,7 +51,6 @@ // Classes //============================================================================== class CTimelineTranslationManager; -class CBaseStateRow; class Qt3DSDMTimelineItemProperty; class CCmdDataModelSetKeyframeTime; class RowTree; @@ -75,7 +74,6 @@ protected: // Typedef typedef std::vector<Qt3DSDMAssetTimelineKeyframe> TAssetKeyframeList; protected: - CBaseStateRow *m_Row; // TODO: remove after finishing the new timeline RowTree *m_rowTree = nullptr; CTimelineTranslationManager *m_TransMgr; qt3dsdm::Qt3DSDMInstanceHandle m_DataHandle; @@ -110,8 +108,6 @@ public: void SetLocked(bool) override; bool IsVisible() const override; void SetVisible(bool) override; - bool IsExpanded() const override; - void SetExpanded(bool inExpanded) override; bool HasAction(bool inMaster) override; bool ChildrenHasAction(bool inMaster) override; bool ComponentHasAction(bool inMaster) override; @@ -123,12 +119,10 @@ public: // ITimelineItemBinding ITimelineItem *GetTimelineItem() 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; bool OpenAssociatedEditor() override; void SetDropTarget(CDropTarget *inTarget) override; // Hierarchy @@ -144,31 +138,15 @@ public: bool ShowToggleControls() const override; bool IsLockedEnabled() const override; bool IsVisibleEnabled() const override; - // Init/Cleanup - void Bind(CBaseStateRow *inRow) override; - void Release() override; // ContextMenu bool IsValidTransaction(EUserTransaction inTransaction) override; void PerformTransaction(EUserTransaction inTransaction) override; Q3DStudio::CString GetObjectPath() override; - // Selected keyframes - ITimelineKeyframesManager *GetKeyframesManager() const override; - // Properties - void RemoveProperty(ITimelineItemProperty *inProperty) override; - void LoadProperties() override; // ITimelineItemKeyframesHolder void InsertKeyframe() override; void DeleteAllChannelKeyframes() override; - long GetKeyframeCount() const override; IKeyframe *GetKeyframeByTime(long inTime) const override; - IKeyframe *GetKeyframeByIndex(long inIndex) const override; - long OffsetSelectedKeyframes(long inOffset) override; - void CommitChangedKeyframes() override; - void OnEditKeyframeTime(long inCurrentTime, long inObjectAssociation) override; - - // IKeyframeSelector - void SelectKeyframes(bool inSelected, long inTime = -1) override; // IUICDMSelectable virtual qt3dsdm::Qt3DSDMInstanceHandle GetInstanceHandle() const; @@ -192,12 +170,9 @@ public: virtual void OnPropertyChanged(qt3dsdm::Qt3DSDMPropertyHandle inPropertyHandle); virtual void OnPropertyLinked(qt3dsdm::Qt3DSDMPropertyHandle inPropertyHandle); - virtual void UIRefreshPropertyKeyframe(long inOffset); // Keyframe manipulation virtual bool HasDynamicKeyframes(long inTime); virtual void SetDynamicKeyframes(long inTime, bool inDynamic); - virtual void DoSelectKeyframes(bool inSelected, long inTime, bool inUpdateUI); - virtual void OnPropertySelection(long inTime); virtual void OnAddChild(qt3dsdm::Qt3DSDMInstanceHandle inInstance); virtual void OnDeleteChild(qt3dsdm::Qt3DSDMInstanceHandle inInstance); diff --git a/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemProperty.cpp b/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemProperty.cpp index 56783576..de9502bb 100644 --- a/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemProperty.cpp +++ b/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemProperty.cpp @@ -36,12 +36,10 @@ // Includes //============================================================================== #include "Qt3DSDMTimelineItemProperty.h" -#include "PropertyRow.h" #include "TimelineTranslationManager.h" #include "ITimelineItemBinding.h" #include "Qt3DSDMTimelineItemBinding.h" #include "Qt3DSDMTimelineKeyframe.h" -#include "KeyframesManager.h" #include "CmdDataModelChangeKeyframe.h" #include "CmdDataModelRemoveKeyframe.h" #include "StudioApp.h" @@ -74,8 +72,7 @@ inline float DataModelToColor(float inValue) Qt3DSDMTimelineItemProperty::Qt3DSDMTimelineItemProperty(CTimelineTranslationManager *inTransMgr, Qt3DSDMPropertyHandle inPropertyHandle, Qt3DSDMInstanceHandle inInstance) - : m_Row(nullptr) - , m_InstanceHandle(inInstance) + : m_InstanceHandle(inInstance) , m_PropertyHandle(inPropertyHandle) , m_TransMgr(inTransMgr) , m_SetKeyframeValueCommand(nullptr) @@ -102,7 +99,6 @@ Qt3DSDMTimelineItemProperty::Qt3DSDMTimelineItemProperty(CTimelineTranslationMan Qt3DSDMTimelineItemProperty::~Qt3DSDMTimelineItemProperty() { ReleaseKeyframes(); - Release(); } void Qt3DSDMTimelineItemProperty::CreateKeyframes() @@ -133,13 +129,6 @@ void Qt3DSDMTimelineItemProperty::CreateKeyframes() void Qt3DSDMTimelineItemProperty::ReleaseKeyframes() { - // clear any selection from m_TransMgr - TKeyframeList::iterator theIter = m_Keyframes.begin(); - for (; theIter != m_Keyframes.end(); ++theIter) { - m_TransMgr->GetKeyframesManager()->SetKeyframeSelected(*theIter, false); - - SAFE_DELETE(*theIter); - } m_Keyframes.clear(); m_AnimationHandles.clear(); } @@ -179,8 +168,7 @@ inline ITimelineItemBinding *GetParentBinding(RowTree *inRow) RowTree *theParentRow = inRow->parentRow(); if (theParentRow) { theParentBinding = theParentRow->getBinding(); - ASSERT(theParentBinding); // TimelineItemBinding should be set properly during - // CBaseStateRow::Initialize + ASSERT(theParentBinding); } } return theParentBinding; @@ -229,23 +217,11 @@ float Qt3DSDMTimelineItemProperty::GetMinimumValue() const return theRetVal; } -void Qt3DSDMTimelineItemProperty::Bind(CPropertyRow *inRow) -{ - ASSERT(!m_Row); - - m_Row = inRow; -} - RowTree *Qt3DSDMTimelineItemProperty::getRowTree() const { return m_rowTree; } -void Qt3DSDMTimelineItemProperty::Release() -{ - m_Row = nullptr; -} - // Ensures the object that owns this property is selected. void Qt3DSDMTimelineItemProperty::SetSelected() { @@ -256,11 +232,6 @@ void Qt3DSDMTimelineItemProperty::SetSelected() } } -void Qt3DSDMTimelineItemProperty::ClearKeySelection() -{ - m_TransMgr->ClearKeyframeSelection(); -} - void Qt3DSDMTimelineItemProperty::DeleteAllKeys() { if (m_Keyframes.empty()) @@ -273,11 +244,6 @@ void Qt3DSDMTimelineItemProperty::DeleteAllKeys() editor->DeleteAllKeyframes(m_AnimationHandles[idx]); } -ITimelineKeyframesManager *Qt3DSDMTimelineItemProperty::GetKeyframesManager() const -{ - return m_TransMgr->GetKeyframesManager(); -} - IKeyframe *Qt3DSDMTimelineItemProperty::GetKeyframeByTime(long inTime) const { std::vector<long> theTest; @@ -384,51 +350,11 @@ void Qt3DSDMTimelineItemProperty::SetChannelValueAtTime(long inChannelIndex, lon } } -long Qt3DSDMTimelineItemProperty::OffsetSelectedKeyframes(long inOffset) -{ - long theRetVal = m_TransMgr->GetKeyframesManager()->OffsetSelectedKeyframes(inOffset); - if (m_Row) // UI update, since the data model sends no event while the change isn't commited. - { - m_Row->Refresh(); - } - return theRetVal; -} - -void Qt3DSDMTimelineItemProperty::CommitChangedKeyframes() -{ - if (m_SetKeyframeValueCommand) { // if this is moving a keyframe value - m_SetKeyframeValueCommand->Finalize(m_SetKeyframeValueCommand->GetValue()); - g_StudioApp.GetCore()->ExecuteCommand(m_SetKeyframeValueCommand, false); - m_SetKeyframeValueCommand = nullptr; - } else // otherwise its changing keyframe times - m_TransMgr->GetKeyframesManager()->CommitChangedKeyframes(); -} - -void Qt3DSDMTimelineItemProperty::OnEditKeyframeTime(long inCurrentTime, long inObjectAssociation) -{ - (void)inObjectAssociation; - CTimeEditDlg theTimeEditDlg; - theTimeEditDlg.setKeyframesManager(m_TransMgr->GetKeyframesManager()); - theTimeEditDlg.showDialog(inCurrentTime, g_StudioApp.GetCore()->GetDoc(), ASSETKEYFRAME); -} - -void Qt3DSDMTimelineItemProperty::SelectKeyframes(bool inSelected, long inTime /*= -1 */) -{ - Qt3DSDMTimelineItemBinding *theParent = - static_cast<Qt3DSDMTimelineItemBinding *>(GetParentBinding(m_rowTree)); - DoSelectKeyframes(inSelected, inTime, false, theParent); -} - void Qt3DSDMTimelineItemProperty::setRowTree(RowTree *rowTree) { m_rowTree = rowTree; } -CPropertyRow *Qt3DSDMTimelineItemProperty::GetRow() -{ - return m_Row; -} - bool Qt3DSDMTimelineItemProperty::IsDynamicAnimation() { return m_Keyframes.size() > 0 && m_Keyframes[0]->IsDynamic(); @@ -447,10 +373,8 @@ bool Qt3DSDMTimelineItemProperty::RefreshKeyframe(qt3dsdm::Qt3DSDMKeyframeHandle TKeyframeList::iterator theIter = m_Keyframes.begin(); for (; theIter != m_Keyframes.end(); ++theIter) { Qt3DSDMTimelineKeyframe *theKeyframe = *theIter; - if (theKeyframe->HasKeyframeHandle(inKeyframe)) { // clear selection - m_TransMgr->GetKeyframesManager()->SetKeyframeSelected(theKeyframe, false); + if (theKeyframe->HasKeyframeHandle(inKeyframe)) { m_Keyframes.erase(theIter); - theHandled = true; break; } @@ -477,8 +401,6 @@ bool Qt3DSDMTimelineItemProperty::RefreshKeyframe(qt3dsdm::Qt3DSDMKeyframeHandle default: return false; } - if (theHandled && m_Row) - m_Row->Refresh(); return theHandled; } @@ -494,49 +416,6 @@ IKeyframe *Qt3DSDMTimelineItemProperty::GetKeyframeByHandle(qt3dsdm::Qt3DSDMKeyf return nullptr; } -// This is either triggered from this property's keyframe selection OR from a parent's keyframe -// selection. -void Qt3DSDMTimelineItemProperty::DoSelectKeyframes(bool inSelected, long inTime, - bool inParentTriggered, - Qt3DSDMTimelineItemBinding *inParent) -{ - // this is what it used to do before the refactor. selecting a keyframe always selects the - // asset. - if (inSelected) - SetSelected(); - - if (!inParent) - return; - - if (inTime == -1) // all keyframes - { - TKeyframeList::iterator theIter = m_Keyframes.begin(); - for (; theIter != m_Keyframes.end(); ++theIter) { - (*theIter)->SetSelected(inSelected); - m_TransMgr->GetKeyframesManager()->SetKeyframeSelected(*theIter, inSelected, inParent); - } - } else { - Qt3DSDMTimelineKeyframe *theKeyframe = - dynamic_cast<Qt3DSDMTimelineKeyframe *>(GetKeyframeByTime(inTime)); - if (theKeyframe) { - theKeyframe->SetSelected(inSelected); - m_TransMgr->GetKeyframesManager()->SetKeyframeSelected(theKeyframe, inSelected, - inParent); - } - } - // Requires UI to be updated explicitly - if (inParentTriggered && m_Row) - m_Row->RequestSelectKeysByTime(inTime, inSelected); - - // Support existing feature, selection by mouse-drag a rect, when all property keyframes are - // selected, the asset keyframe is automatically selected as well. - // and the mouse drags 'outside' a keyframe and de-selecting it, the asset keyframe has to be - // deselected as well. - if (!inParentTriggered && inTime != -1) - inParent->OnPropertySelection(inTime); -} - -//============================================================================= /** * Create a wrapper for this keyframe if doesn't exists. * @return true if created, false if already exists. diff --git a/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemProperty.h b/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemProperty.h index 0a8e5e76..1b1524e4 100644 --- a/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemProperty.h +++ b/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineItemProperty.h @@ -63,33 +63,21 @@ public: float GetMaximumValue() const override; float GetMinimumValue() const override; void SetSelected() override; - void ClearKeySelection() override; void DeleteAllKeys() override; - ITimelineKeyframesManager *GetKeyframesManager() const override; IKeyframe *GetKeyframeByTime(long inTime) const override; IKeyframe *GetKeyframeByIndex(long inIndex) const override; long GetKeyframeCount() const override; long GetChannelCount() const override; float GetChannelValueAtTime(long inChannelIndex, long inTime) override; void SetChannelValueAtTime(long inChannelIndex, long inTime, float inValue) override; - long OffsetSelectedKeyframes(long inOffset) override; - void CommitChangedKeyframes() override; - void OnEditKeyframeTime(long inCurrentTime, long inObjectAssociation) override; bool IsDynamicAnimation() override; - // 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; // Mahmoud_TODO: delete bool RefreshKeyframe(qt3dsdm::Qt3DSDMKeyframeHandle inKeyframe, ETimelineKeyframeTransaction inTransaction); IKeyframe *GetKeyframeByHandle(qt3dsdm::Qt3DSDMKeyframeHandle inKeyframe); - void DoSelectKeyframes(bool inSelected, long inTime, bool inParentTriggered, - Qt3DSDMTimelineItemBinding *inParent); void RefreshKeyFrames(void); @@ -108,7 +96,6 @@ protected: protected: typedef std::vector<Qt3DSDMTimelineKeyframe *> TKeyframeList; - CPropertyRow *m_Row; // Mahmoud_TODO: remove qt3dsdm::Qt3DSDMInstanceHandle m_InstanceHandle; qt3dsdm::Qt3DSDMPropertyHandle m_PropertyHandle; CTimelineTranslationManager *m_TransMgr; diff --git a/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineTimebar.cpp b/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineTimebar.cpp index 67e7275c..4f7ed646 100644 --- a/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineTimebar.cpp +++ b/src/Authoring/Studio/Palettes/Timeline/Bindings/Qt3DSDMTimelineTimebar.cpp @@ -46,7 +46,6 @@ #include "Core.h" #include "DurationEditDlg.h" #include "IDocumentEditor.h" -#include "BaseStateRow.h" #include "StudioFullSystem.h" #include "StudioPreferences.h" #include "ITimelineItemBinding.h" diff --git a/src/Authoring/Studio/Palettes/Timeline/Bindings/SlideTimelineItemBinding.cpp b/src/Authoring/Studio/Palettes/Timeline/Bindings/SlideTimelineItemBinding.cpp index 1afb57fc..b1a75b39 100644 --- a/src/Authoring/Studio/Palettes/Timeline/Bindings/SlideTimelineItemBinding.cpp +++ b/src/Authoring/Studio/Palettes/Timeline/Bindings/SlideTimelineItemBinding.cpp @@ -36,7 +36,6 @@ // Includes //============================================================================== #include "SlideTimelineItemBinding.h" -#include "BaseStateRow.h" // Data model specific #include "Doc.h" @@ -83,12 +82,6 @@ void CSlideTimelineItemBinding::SetName(const Q3DStudio::CString & /*inName*/) // Do nothing because name is read only } -void CSlideTimelineItemBinding::Bind(CBaseStateRow *inRow) -{ - Qt3DSDMTimelineItemBinding::Bind(inRow); - inRow->requestSetNameReadOnly(); -} - bool CSlideTimelineItemBinding::IsValidTransaction(EUserTransaction inTransaction) { qt3dsdm::Qt3DSDMInstanceHandle theInstance = GetInstance(); diff --git a/src/Authoring/Studio/Palettes/Timeline/Bindings/SlideTimelineItemBinding.h b/src/Authoring/Studio/Palettes/Timeline/Bindings/SlideTimelineItemBinding.h index eb6a5f45..cf12c0a2 100644 --- a/src/Authoring/Studio/Palettes/Timeline/Bindings/SlideTimelineItemBinding.h +++ b/src/Authoring/Studio/Palettes/Timeline/Bindings/SlideTimelineItemBinding.h @@ -42,7 +42,6 @@ //============================================================================== class ITimelineItem; class CTimelineTranslationManager; -class CBaseStateRow; //============================================================================= /** @@ -58,13 +57,11 @@ public: // Qt3DSDMTimelineItemBinding ITimelineTimebar *GetTimebar() override; void SetName(const Q3DStudio::CString &inName) override; - void Bind(CBaseStateRow *inRow) override; bool IsValidTransaction(EUserTransaction inTransaction) override; // No properties long GetPropertyCount() override { return 0; } ITimelineItemProperty *GetProperty(long) override { return nullptr; } - void LoadProperties() override {} // Eye/Lock toggles are not applicable bool ShowToggleControls() const override { return false; } @@ -82,17 +79,9 @@ public: // Keyframes, not applicable to a Slide void InsertKeyframe() override {} void DeleteAllChannelKeyframes() override {} - long GetKeyframeCount() const override { return 0; } IKeyframe *GetKeyframeByTime(long) const override { return nullptr; } - IKeyframe *GetKeyframeByIndex(long) const override { return nullptr; } - long OffsetSelectedKeyframes(long) override { return 0; } - void CommitChangedKeyframes() override {} - void OnEditKeyframeTime(long, long) override {} - // IKeyframeSelector - void SelectKeyframes(bool, long inTime = -1) override { Q_UNUSED(inTime); } // Keyframe manipulation, not applicable - void UIRefreshPropertyKeyframe(long inOffset) override { Q_UNUSED(inOffset); } bool HasDynamicKeyframes(long inTime) override { Q_UNUSED(inTime); @@ -103,13 +92,6 @@ public: Q_UNUSED(inTime); Q_UNUSED(inDynamic); } - void DoSelectKeyframes(bool inSelected, long inTime, bool inUpdateUI) override - { - Q_UNUSED(inSelected); - Q_UNUSED(inTime); - Q_UNUSED(inUpdateUI); - } - void OnPropertySelection(long inTime) override { Q_UNUSED(inTime); } protected: std::shared_ptr<qt3dsdm::ISignalConnection> diff --git a/src/Authoring/Studio/Palettes/Timeline/Bindings/TimelineTranslationManager.cpp b/src/Authoring/Studio/Palettes/Timeline/Bindings/TimelineTranslationManager.cpp index ffd01c3d..627fb387 100644 --- a/src/Authoring/Studio/Palettes/Timeline/Bindings/TimelineTranslationManager.cpp +++ b/src/Authoring/Studio/Palettes/Timeline/Bindings/TimelineTranslationManager.cpp @@ -44,15 +44,9 @@ #include "PathAnchorPointTimelineItemBinding.h" #include "PathTimelineItemBinding.h" #include "LayerTimelineItemBinding.h" -#include "KeyframesManager.h" -#include "TimelineBreadCrumbProvider.h" -#include "BaseStateRow.h" -#include "PropertyRow.h" #include "IDoc.h" #include "Qt3DSDMStudioSystem.h" #include "Qt3DSDMSlides.h" -#include "Qt3DSDMSignals.h" -#include "TimelineUIFactory.h" // Link to Data model #include "ClientDataModelBridge.h" @@ -65,17 +59,12 @@ using namespace qt3dsdm; CTimelineTranslationManager::CTimelineTranslationManager() { - m_KeyframesManager = new CKeyframesManager(this); - m_BreadCrumbProvider = new CTimelineBreadCrumbProvider(g_StudioApp.GetCore()->GetDoc()); } CTimelineTranslationManager::~CTimelineTranslationManager() { // clean up all bindings Clear(); - m_Connections.clear(); - delete m_KeyframesManager; - delete m_BreadCrumbProvider; } ITimelineItemBinding *CTimelineTranslationManager::GetOrCreate(Qt3DSDMInstanceHandle inInstance) @@ -121,7 +110,6 @@ ITimelineItemBinding *CTimelineTranslationManager::GetOrCreate(Qt3DSDMInstanceHa m_InstanceHandleBindingMap.insert( std::make_pair(theReturn->GetInstanceHandle(), theReturn)); - m_InstanceHandleExpandedMap.insert(std::make_pair(theReturn->GetInstanceHandle(), false)); theBinding = theReturn; } @@ -130,41 +118,6 @@ ITimelineItemBinding *CTimelineTranslationManager::GetOrCreate(Qt3DSDMInstanceHa //============================================================================== /** - * Create a new CPropertyRow that maps to this ITimelineItemProperty. - * The caller is assumed to have ensured that this is only called once per property binding. - */ -CPropertyRow *CTimelineTranslationManager::CreateNewPropertyRow( - ITimelineItemProperty *inTimelineItemPropertyBinding, CBaseStateRow *inParentRow, - CPropertyRow *inNextRow) -{ - if (!inParentRow || !inTimelineItemPropertyBinding) - return {}; - - return TimelineUIFactory::instance()->createPropertyRow(inParentRow, inNextRow, - inTimelineItemPropertyBinding); -} - -//============================================================================== -/** - * Does the reverse of CreateNewPropertyRow, when a property has been de-animated. - */ -void CTimelineTranslationManager::RemovePropertyRow( - ITimelineItemProperty *inTimelineItemPropertyBinding) -{ - CPropertyRow *theRow = nullptr; - if (!inTimelineItemPropertyBinding - || (theRow = inTimelineItemPropertyBinding->GetRow()) == nullptr) - return; - - CBaseStateRow *theParentRow = dynamic_cast<CBaseStateRow*>(theRow->GetParentRow()); - if (theParentRow) { - inTimelineItemPropertyBinding->Release(); - theParentRow->RemovePropertyRow(theRow); // this implicitly delete the row - } -} - -//============================================================================== -/** * Clear all bindings, typically when a presentation is closed. */ void CTimelineTranslationManager::Clear() @@ -173,55 +126,6 @@ void CTimelineTranslationManager::Clear() m_InstanceHandleBindingMap.clear(); } -//============================================================================== -/** - * Called when the associated UI is no longer valid. - */ -void CTimelineTranslationManager::Unregister(ITimelineItemBinding *inTimelineItem) -{ - // DataModel - bool theDeselectItem = false; - TInstanceHandleBindingMap::iterator theInstanceIter = m_InstanceHandleBindingMap.begin(); - for (; theInstanceIter != m_InstanceHandleBindingMap.end(); ++theInstanceIter) { - if (theInstanceIter->second == inTimelineItem) { - // If this is the currently selected object and make sure that is cleared. - qt3dsdm::Qt3DSDMInstanceHandle theSelectedInstance = - g_StudioApp.GetCore()->GetDoc()->GetSelectedInstance(); - if (theSelectedInstance.Valid() && theSelectedInstance == theInstanceIter->first) - theDeselectItem = true; - - m_InstanceHandleBindingMap.erase(theInstanceIter); - break; - } - } - - delete inTimelineItem; -} - -CKeyframesManager *CTimelineTranslationManager::GetKeyframesManager() const -{ - return m_KeyframesManager; -} - -IBreadCrumbProvider *CTimelineTranslationManager::GetBreadCrumbProvider() const -{ - return m_BreadCrumbProvider; -} - -CBaseStateRow *CTimelineTranslationManager::GetSelectedRow() const -{ - ITimelineItemBinding *theBinding = GetSelectedBinding(); - if (theBinding) - return theBinding->GetRow(); - return nullptr; -} - -long CTimelineTranslationManager::GetCurrentViewTime() const -{ - return g_StudioApp.GetCore()->GetDoc()->GetCurrentViewTime(); -} - -//============================================================================== /** * @return the Binding object that corresponds to this instance. */ @@ -234,90 +138,6 @@ CTimelineTranslationManager::GetBinding(Qt3DSDMInstanceHandle inHandle) const return nullptr; } -Qt3DSDMTimelineItemBinding *CTimelineTranslationManager::GetSelectedBinding() const -{ - qt3dsdm::Qt3DSDMInstanceHandle theSelectedInstance = - g_StudioApp.GetCore()->GetDoc()->GetSelectedInstance(); - if (theSelectedInstance.Valid()) { - Qt3DSDMTimelineItemBinding *theBinding = GetBinding(theSelectedInstance); - return theBinding; - } - return nullptr; -} - -//============================================================================== -/** - * Triggered from individual binding classes, to clear all keyframe selection - */ -void CTimelineTranslationManager::ClearKeyframeSelection() -{ - m_KeyframesManager->DeselectAllKeyframes(); -} - -//============================================================================== -/** - * Set up callbacks for animation changes - */ -void CTimelineTranslationManager::OnNewPresentation() -{ - m_Connections.clear(); - m_InstanceHandleExpandedMap.clear(); - - IStudioFullSystemSignalProvider *theSignalProvider = - g_StudioApp.GetCore()->GetDoc()->GetStudioSystem()->GetFullSystemSignalProvider(); - m_Connections.push_back(theSignalProvider->ConnectAnimationCreated( - std::bind(&CTimelineTranslationManager::OnAnimationCreated, this, - std::placeholders::_2, std::placeholders::_3))); - m_Connections.push_back(theSignalProvider->ConnectAnimationDeleted( - std::bind(&CTimelineTranslationManager::OnAnimationDeleted, this, - std::placeholders::_2, std::placeholders::_3))); - m_Connections.push_back(theSignalProvider->ConnectPropertyLinked( - std::bind(&CTimelineTranslationManager::OnPropertyLinked, this, - std::placeholders::_2, std::placeholders::_3))); - m_Connections.push_back(theSignalProvider->ConnectPropertyUnlinked( - std::bind(&CTimelineTranslationManager::OnPropertyUnlinked, this, - std::placeholders::_2, std::placeholders::_3))); - m_Connections.push_back(theSignalProvider->ConnectKeyframeInserted( - std::bind(&CTimelineTranslationManager::OnKeyframeInserted, this, - std::placeholders::_1, std::placeholders::_2))); - m_Connections.push_back(theSignalProvider->ConnectKeyframeErased( - std::bind(&CTimelineTranslationManager::OnKeyframeDeleted, this, - std::placeholders::_1, std::placeholders::_2))); - m_Connections.push_back(theSignalProvider->ConnectKeyframeUpdated( - std::bind(&CTimelineTranslationManager::OnKeyframeUpdated, this, std::placeholders::_1))); - m_Connections.push_back(theSignalProvider->ConnectInstancePropertyValue( - std::bind(&CTimelineTranslationManager::OnPropertyChanged, this, - std::placeholders::_1, std::placeholders::_2))); - m_Connections.push_back(theSignalProvider->ConnectFirstKeyframeDynamicSet( - std::bind(&CTimelineTranslationManager::OnDynamicKeyframeChanged, this, - std::placeholders::_1, std::placeholders::_2))); - - m_Connections.push_back(theSignalProvider->ConnectInstanceCreated( - std::bind(&CTimelineTranslationManager::OnAssetCreated, this, std::placeholders::_1))); - m_Connections.push_back(theSignalProvider->ConnectInstanceDeleted( - std::bind(&CTimelineTranslationManager::OnAssetDeleted, this, std::placeholders::_1))); - - m_Connections.push_back(theSignalProvider->ConnectActionCreated( - std::bind(&CTimelineTranslationManager::OnActionEvent, this, - std::placeholders::_1, std::placeholders::_2, std::placeholders::_3))); - m_Connections.push_back(theSignalProvider->ConnectActionDeleted( - std::bind(&CTimelineTranslationManager::OnActionEvent, this, - std::placeholders::_1, std::placeholders::_2, std::placeholders::_3))); - - Q3DStudio::CGraph &theGraph(*g_StudioApp.GetCore()->GetDoc()->GetAssetGraph()); - m_Connections.push_back(theGraph.ConnectChildAdded( - std::bind(&CTimelineTranslationManager::OnChildAdded, this, - std::placeholders::_1, std::placeholders::_2, std::placeholders::_3))); - m_Connections.push_back(theGraph.ConnectChildRemoved( - std::bind(&CTimelineTranslationManager::OnChildRemoved, this, - std::placeholders::_1, std::placeholders::_2, std::placeholders::_3))); - m_Connections.push_back(theGraph.ConnectChildMoved( - std::bind(&CTimelineTranslationManager::OnChildMoved, this, std::placeholders::_1, - std::placeholders::_2, std::placeholders::_3, std::placeholders::_4))); -} - -//============================================================================== - CDoc *CTimelineTranslationManager::GetDoc() const { return dynamic_cast<CDoc *>(g_StudioApp.GetCore()->GetDoc()); @@ -329,233 +149,3 @@ CStudioSystem *CTimelineTranslationManager::GetStudioSystem() const return g_StudioApp.GetCore()->GetDoc()->GetStudioSystem(); } -void CTimelineTranslationManager::OnAnimationCreated(Qt3DSDMInstanceHandle inInstance, - Qt3DSDMPropertyHandle inProperty) -{ - Qt3DSDMTimelineItemBinding *theTimelineBinding = - dynamic_cast<Qt3DSDMTimelineItemBinding *>(GetBinding(inInstance)); - if (theTimelineBinding) - theTimelineBinding->AddPropertyRow(inProperty); -} - -void CTimelineTranslationManager::OnAnimationDeleted(Qt3DSDMInstanceHandle inInstance, - Qt3DSDMPropertyHandle inProperty) -{ - Qt3DSDMTimelineItemBinding *theTimelineBinding = - dynamic_cast<Qt3DSDMTimelineItemBinding *>(GetBinding(inInstance)); - if (theTimelineBinding) - theTimelineBinding->RemovePropertyRow(inProperty); -} - -void CTimelineTranslationManager::OnPropertyLinked(Qt3DSDMInstanceHandle inInstance, - Qt3DSDMPropertyHandle inProperty) -{ - Qt3DSDMTimelineItemBinding *theTimelineBinding = - dynamic_cast<Qt3DSDMTimelineItemBinding *>(GetBinding(inInstance)); - if (theTimelineBinding) - theTimelineBinding->OnPropertyLinked(inProperty); -} - -void CTimelineTranslationManager::OnPropertyUnlinked(Qt3DSDMInstanceHandle inInstance, - Qt3DSDMPropertyHandle inProperty) -{ - OnPropertyLinked(inInstance, inProperty); -} - -void CTimelineTranslationManager::RefreshKeyframe(Qt3DSDMAnimationHandle inAnimation, - Qt3DSDMKeyframeHandle inKeyframe, - ETimelineKeyframeTransaction inTransaction) -{ - Qt3DSDMTimelineItemBinding *theTimelineBinding = nullptr; - if (GetStudioSystem()->GetAnimationCore()->AnimationValid(inAnimation)) { - SAnimationInfo theAnimationInfo = - GetStudioSystem()->GetAnimationCore()->GetAnimationInfo(inAnimation); - theTimelineBinding = - dynamic_cast<Qt3DSDMTimelineItemBinding *>(GetBinding(theAnimationInfo.m_Instance)); - - if (theTimelineBinding) - theTimelineBinding->RefreshPropertyKeyframe(theAnimationInfo.m_Property, inKeyframe, - inTransaction); - } - // else, animation has been nuked, ignore this event, we'll get a AnimationDelete -} - -void CTimelineTranslationManager::OnKeyframeInserted(Qt3DSDMAnimationHandle inAnimation, - Qt3DSDMKeyframeHandle inKeyframe) -{ - RefreshKeyframe(inAnimation, inKeyframe, ETimelineKeyframeTransaction_Add); -} - -void CTimelineTranslationManager::OnKeyframeDeleted(Qt3DSDMAnimationHandle inAnimation, - Qt3DSDMKeyframeHandle inKeyframe) -{ - RefreshKeyframe(inAnimation, inKeyframe, ETimelineKeyframeTransaction_Delete); -} - -void CTimelineTranslationManager::OnKeyframeUpdated(Qt3DSDMKeyframeHandle inKeyframe) -{ - IAnimationCore *theAnimationCore = GetStudioSystem()->GetAnimationCore(); - if (theAnimationCore->KeyframeValid(inKeyframe)) { - Qt3DSDMAnimationHandle theAnimationHandle = - theAnimationCore->GetAnimationForKeyframe(inKeyframe); - RefreshKeyframe(theAnimationHandle, inKeyframe, ETimelineKeyframeTransaction_Update); - } - // else, keyframe has been nuked, ignore this event, we'll get a KeyframeDeleted -} - -void CTimelineTranslationManager::OnPropertyChanged(qt3dsdm::Qt3DSDMInstanceHandle inInstance, - qt3dsdm::Qt3DSDMPropertyHandle inProperty) -{ - Qt3DSDMTimelineItemBinding *theTimelineBinding = - dynamic_cast<Qt3DSDMTimelineItemBinding *>(GetBinding(inInstance)); - if (theTimelineBinding) - theTimelineBinding->OnPropertyChanged(inProperty); -} - -void CTimelineTranslationManager::OnDynamicKeyframeChanged(qt3dsdm::Qt3DSDMAnimationHandle inAnimation, - bool inDynamic) -{ - Q_UNUSED(inDynamic); - - Qt3DSDMTimelineItemBinding *theTimelineBinding = nullptr; - if (GetStudioSystem()->GetAnimationCore()->AnimationValid(inAnimation)) { - SAnimationInfo theAnimationInfo = - GetStudioSystem()->GetAnimationCore()->GetAnimationInfo(inAnimation); - theTimelineBinding = - dynamic_cast<Qt3DSDMTimelineItemBinding *>(GetBinding(theAnimationInfo.m_Instance)); - if (theTimelineBinding) - theTimelineBinding->RefreshPropertyKeyframe( - theAnimationInfo.m_Property, 0, ETimelineKeyframeTransaction_DynamicChanged); - } -} - -void CTimelineTranslationManager::OnAssetCreated(qt3dsdm::Qt3DSDMInstanceHandle inInstance) -{ - CClientDataModelBridge *theDataModelBridge = GetStudioSystem()->GetClientDataModelBridge(); - - if (theDataModelBridge->IsSceneGraphInstance(inInstance)) - EnsureLoaded(inInstance); -} - -void CTimelineTranslationManager::OnAssetDeleted(qt3dsdm::Qt3DSDMInstanceHandle inInstance) -{ - // You can't assume the instance is valid. Someone may have deleted a large number of items - // from the model and then decided to send notifications after the fact. - // if the created asset is library asset, do nothing - // start to add the scene asset to the timeline - Qt3DSDMTimelineItemBinding *theItemBinding = - dynamic_cast<Qt3DSDMTimelineItemBinding *>(GetBinding(inInstance)); - if (theItemBinding) { - Qt3DSDMTimelineItemBinding *theParentBinding = - dynamic_cast<Qt3DSDMTimelineItemBinding *>(theItemBinding->GetParent()); - if (theParentBinding) - theParentBinding->OnDeleteChild(inInstance); - } -} - -void CTimelineTranslationManager::OnChildAdded(int /*inParent*/, int inChild, long /*inIndex*/) -{ - OnAssetCreated(inChild); -} -void CTimelineTranslationManager::OnChildRemoved(int /*inParent*/, int inChild, long /*inIndex*/) -{ - OnAssetDeleted(inChild); -} -void CTimelineTranslationManager::OnChildMoved(int /*inParent*/, int inChild, long /*inOldIndex*/, - long /*inNewIndex*/) -{ - OnAssetDeleted(inChild); - OnAssetCreated(inChild); -} - -//============================================================================== -/** - * Callback method whenever an action is either created or removed. - * Basically, it tells the owner of the action to update its timeline control to - * update the icon that shows action association status - */ -void CTimelineTranslationManager::OnActionEvent(qt3dsdm::Qt3DSDMActionHandle inAction, - qt3dsdm::Qt3DSDMSlideHandle inSlide, - qt3dsdm::Qt3DSDMInstanceHandle inOwner) -{ - Q_UNUSED(inAction); - - // the slide that action is added to is the current slide or - // is added to the master slide of the current slide - Qt3DSDMTimelineItemBinding *theTimelineBinding = - dynamic_cast<Qt3DSDMTimelineItemBinding *>(GetBinding(inOwner)); - if (theTimelineBinding) - theTimelineBinding->UpdateActionStatus(); -} - -//============================================================================== -/** - * Helper functions to go through ALL binding and clear any keyframes selection. - */ -void CTimelineTranslationManager::ClearBindingsKeyframeSelection() -{ - // DataModel bindings handle their own selections - TInstanceHandleBindingMap::const_iterator theIter = m_InstanceHandleBindingMap.begin(); - for (; theIter != m_InstanceHandleBindingMap.end(); ++theIter) - theIter->second->DoSelectKeyframes(false, -1, true); -} - -//============================================================================== - -ITimelineItemBinding *CTimelineTranslationManager::EnsureLoaded(Qt3DSDMInstanceHandle inHandle) -{ - ITimelineItemBinding *theBinding = GetBinding(inHandle); - bool rowLoaded = theBinding != nullptr && theBinding->GetRow() != nullptr; - if (rowLoaded == false) { - // tell my parent to load me - CClientDataModelBridge *theDataModelBridge = GetStudioSystem()->GetClientDataModelBridge(); - Qt3DSDMInstanceHandle theParent = theDataModelBridge->GetParentInstance(inHandle); - if (theParent.Valid()) { - ITimelineItemBinding *theParentBinding = EnsureLoaded(theParent); - if (theParentBinding) - theParentBinding->GetRow()->LoadChildren(); - - // The LoadChildren has an optimzation such that if it's already loaded, it won't - // recreate again - // So, if we still can't get the binding after LoadChildren, it very likely means that - // this is newly added - // so call OnAddChild to let it just add this. - theBinding = GetBinding(inHandle); - bool rowLoaded = theBinding != nullptr && theBinding->GetRow() != nullptr; - if (theParentBinding && rowLoaded == false) { - // start to add the scene asset to the timeline - Qt3DSDMTimelineItemBinding *theDMBinding = - dynamic_cast<Qt3DSDMTimelineItemBinding *>(theParentBinding); - theDMBinding->OnAddChild(inHandle); - theBinding = GetBinding(inHandle); - } - } - } - return theBinding; -} - -//============================================================================== -/** - * remember the expanded state for the current presentation - */ -bool CTimelineTranslationManager::IsExpanded(Qt3DSDMInstanceHandle inInstance) const -{ - TInstanceHandleExpandedMap::const_iterator theIter = - m_InstanceHandleExpandedMap.find(inInstance); - if (theIter != m_InstanceHandleExpandedMap.end()) { - return theIter->second; - } - return false; -} - -//============================================================================== -/** - * remember the expanded state for the current presentation - */ -void CTimelineTranslationManager::SetExpanded(Qt3DSDMInstanceHandle inInstance, bool inExpanded) -{ - TInstanceHandleExpandedMap::iterator theIter = m_InstanceHandleExpandedMap.find(inInstance); - if (theIter != m_InstanceHandleExpandedMap.end()) { - theIter->second = inExpanded; - } -} diff --git a/src/Authoring/Studio/Palettes/Timeline/Bindings/TimelineTranslationManager.h b/src/Authoring/Studio/Palettes/Timeline/Bindings/TimelineTranslationManager.h index 83443c2c..18851b20 100644 --- a/src/Authoring/Studio/Palettes/Timeline/Bindings/TimelineTranslationManager.h +++ b/src/Authoring/Studio/Palettes/Timeline/Bindings/TimelineTranslationManager.h @@ -26,9 +26,6 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -//============================================================================== -// Prefix -//============================================================================== #ifndef INCLUDED_TIMELINE_TRANSLATIONMANAGER_H #define INCLUDED_TIMELINE_TRANSLATIONMANAGER_H 1 @@ -39,31 +36,16 @@ #include "Doc.h" -//============================================================================== -// Classes -//============================================================================== class ITimelineItemBinding; -class ITimelineItemProperty; class Qt3DSDMTimelineItemBinding; -class CBaseStateRow; -class CPropertyRow; -class CKeyframesManager; -class IBreadCrumbProvider; - -// Link to data model -class CAsset; -class IUICDMSelectable; -class CClientDataModelBridge; // DataModel namespace qt3dsdm { class CStudioSystem; -class ISignalConnection; } class CDoc; -//============================================================================= /** * There is a TranslationManager per presentation (project) */ @@ -81,79 +63,19 @@ protected: // Properties // DataModel support TInstanceHandleBindingMap m_InstanceHandleBindingMap; - CKeyframesManager *m_KeyframesManager; - IBreadCrumbProvider *m_BreadCrumbProvider; - std::vector<std::shared_ptr<qt3dsdm::ISignalConnection>> - m_Connections; /// connections to the DataModel - - TInstanceHandleExpandedMap m_InstanceHandleExpandedMap; - public: CTimelineTranslationManager(); ~CTimelineTranslationManager(); public: ITimelineItemBinding *GetOrCreate(qt3dsdm::Qt3DSDMInstanceHandle inInstance); - CPropertyRow *CreateNewPropertyRow(ITimelineItemProperty *inTimelineItemPropertyBinding, - CBaseStateRow *inParentRow, CPropertyRow *inNextRow); - void RemovePropertyRow(ITimelineItemProperty *inTimelineItemPropertyBinding); - void Clear(); - void Unregister(ITimelineItemBinding *inTimelineItem); - CKeyframesManager *GetKeyframesManager() const; - IBreadCrumbProvider *GetBreadCrumbProvider() const; - CBaseStateRow *GetSelectedRow() const; - long GetCurrentViewTime() const; Qt3DSDMTimelineItemBinding *GetBinding(qt3dsdm::Qt3DSDMInstanceHandle inHandle) const; - Qt3DSDMTimelineItemBinding *GetSelectedBinding() const; - - void ClearKeyframeSelection(); - void OnNewPresentation(); qt3dsdm::CStudioSystem *GetStudioSystem() const; - // DataModel callback - void OnAnimationCreated(qt3dsdm::Qt3DSDMInstanceHandle inInstance, - qt3dsdm::Qt3DSDMPropertyHandle inProperty); - void OnAnimationDeleted(qt3dsdm::Qt3DSDMInstanceHandle inInstance, - qt3dsdm::Qt3DSDMPropertyHandle inProperty); - void OnPropertyLinked(qt3dsdm::Qt3DSDMInstanceHandle inInstance, - qt3dsdm::Qt3DSDMPropertyHandle inProperty); - void OnPropertyUnlinked(qt3dsdm::Qt3DSDMInstanceHandle inInstance, - qt3dsdm::Qt3DSDMPropertyHandle inProperty); - void RefreshKeyframe(qt3dsdm::Qt3DSDMAnimationHandle inAnimation, - qt3dsdm::Qt3DSDMKeyframeHandle inKeyframe, - ETimelineKeyframeTransaction inTransaction); - void OnKeyframeInserted(qt3dsdm::Qt3DSDMAnimationHandle inAnimation, - qt3dsdm::Qt3DSDMKeyframeHandle inKeyframe); - void OnKeyframeDeleted(qt3dsdm::Qt3DSDMAnimationHandle inAnimation, - qt3dsdm::Qt3DSDMKeyframeHandle inKeyframe); - void OnKeyframeUpdated(qt3dsdm::Qt3DSDMKeyframeHandle inKeyframe); - void OnPropertyChanged(qt3dsdm::Qt3DSDMInstanceHandle inInstance, - qt3dsdm::Qt3DSDMPropertyHandle inProperty); - void OnDynamicKeyframeChanged(qt3dsdm::Qt3DSDMAnimationHandle inAnimation, bool inDynamic); - - void OnAssetCreated(qt3dsdm::Qt3DSDMInstanceHandle inInstance); - void OnAssetDeleted(qt3dsdm::Qt3DSDMInstanceHandle inInstance); - void OnChildAdded(int inParent, int inChild, long inIndex); - void OnChildRemoved(int inParent, int inChild, long inIndex); - void OnChildMoved(int inParent, int inChild, long inOldIndex, long inNewIndex); - - void OnActionEvent(qt3dsdm::Qt3DSDMActionHandle inAction, qt3dsdm::Qt3DSDMSlideHandle inSlide, - qt3dsdm::Qt3DSDMInstanceHandle inOwner); - - // Helper function to iterate over all bindings - void ClearBindingsKeyframeSelection(); CDoc *GetDoc() const; - - // Store expanded state - bool IsExpanded(qt3dsdm::Qt3DSDMInstanceHandle inInstance) const; - void SetExpanded(qt3dsdm::Qt3DSDMInstanceHandle inInstance, bool inExpanded); - -protected: - void SetSelected(Q3DStudio::SSelectedValue inSelectable, bool inSelected); - ITimelineItemBinding *EnsureLoaded(qt3dsdm::Qt3DSDMInstanceHandle inHandle); }; #endif // INCLUDED_TIMELINE_TRANSLATIONMANAGER_H diff --git a/src/Authoring/Studio/Palettes/Timeline/ColorBlankControl.cpp b/src/Authoring/Studio/Palettes/Timeline/ColorBlankControl.cpp deleted file mode 100644 index 2564d087..00000000 --- a/src/Authoring/Studio/Palettes/Timeline/ColorBlankControl.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2002 NVIDIA Corporation. -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt 3D Studio. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -//============================================================================== -// Prefix -//============================================================================== -#include "stdafx.h" - -//============================================================================== -// Includes -//============================================================================== -#include "ColorBlankControl.h" -#include "Renderer.h" -#include "StudioPreferences.h" - -//============================================================================= -/** - * Constructor - */ -CColorBlankControl::CColorBlankControl(CColor inColor) - : CBlankControl(inColor) -{ -} - -//============================================================================= -/** - * Destructor - */ -CColorBlankControl::~CColorBlankControl() -{ -} - -//============================================================================= -/** - * Handles custom drawing of the blank control underneath the tree control - * on the timeline palette. - */ -void CColorBlankControl::Draw(CRenderer *inRenderer) -{ - CBlankControl::Draw(inRenderer); - - // Draw the line on the right side of this control - CPt theSize = GetSize(); - inRenderer->PushPen(CStudioPreferences::GetPropertyFloorColor()); - inRenderer->MoveTo(theSize.x - 1, 0); - inRenderer->LineTo(theSize.x - 1, theSize.y - 1); - inRenderer->PopPen(); - - // Draw the line on the left side of this control - inRenderer->PushPen(CStudioPreferences::GetRowTopColor()); - inRenderer->MoveTo(0, 0); - inRenderer->LineTo(0, theSize.y - 1); - inRenderer->PopPen(); - - // Draw the highlight on the left side of this control - inRenderer->PushPen(CStudioPreferences::GetButtonHighlightColor()); - inRenderer->MoveTo(CPt(1, 0)); - inRenderer->LineTo(CPt(1, theSize.y - 1)); - inRenderer->PopPen(); -} diff --git a/src/Authoring/Studio/Palettes/Timeline/ColorBlankControl.h b/src/Authoring/Studio/Palettes/Timeline/ColorBlankControl.h deleted file mode 100644 index bb85b2aa..00000000 --- a/src/Authoring/Studio/Palettes/Timeline/ColorBlankControl.h +++ /dev/null @@ -1,60 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2002 NVIDIA Corporation. -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt 3D Studio. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef INCLUDED_COLOR_BLANK_CONTROL_H -#define INCLUDED_COLOR_BLANK_CONTROL_H 1 - -#pragma once - -//============================================================================== -// Includes -//============================================================================== -#include "BlankControl.h" - -//============================================================================== -// Forwards -//============================================================================== -class CRenderer; - -//============================================================================= -/** - * Extends the blank control to draw items specific to the tree view side of the - * timeline palette. - */ -class CColorBlankControl : public CBlankControl -{ -public: - CColorBlankControl(CColor inColor = CStudioPreferences::GetBaseColor()); - virtual ~CColorBlankControl(); - void Draw(CRenderer *inRenderer) override; - -protected: -}; - -#endif // INCLUDED_COLOR_BLANK_CONTROL_H diff --git a/src/Authoring/Studio/Palettes/Timeline/ColorControl.cpp b/src/Authoring/Studio/Palettes/Timeline/ColorControl.cpp deleted file mode 100644 index 71d1c392..00000000 --- a/src/Authoring/Studio/Palettes/Timeline/ColorControl.cpp +++ /dev/null @@ -1,307 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 NVIDIA Corporation. -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt 3D Studio. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "stdafx.h" - -#include "CColor.h" -#include "ColorControl.h" -#include "CoreUtils.h" -#include "BaseStateRow.h" -#include "Renderer.h" -#include "StudioPreferences.h" -#include "HotKeys.h" -#include "Dispatch.h" -#include "ResourceCache.h" -#include "Bindings/ITimelineItem.h" - -//============================================================================== -/** - * The control (of each row) to the left of the tree view, where it indicates if there are - *actions associated with this row. - */ -CColorControl::CColorControl(CBaseStateRow *inRow) - : m_Shaded(true) - , m_Selected(false) - , m_HasAction(false) - , m_HasMasterAction(false) - , m_ChildHasAction(false) - , m_ChildHasMasterAction(false) - , m_ComponentHasAction(false) - , m_ComponentHasMasterAction(false) -{ - m_ParentRow = inRow; - m_BackgroundColor = m_ParentRow->GetTimebarBackgroundColor(m_ParentRow->GetObjectType()); - - UpdateIconStatus(); -} - -CColorControl::~CColorControl() -{ -} - -void CColorControl::SetShaded(bool inIsShaded) -{ - m_Shaded = inIsShaded; -} - -//============================================================================== -/** - * Draw - * - * draws this object - * - * @param inRenderer a renderer object - */ -void CColorControl::Draw(CRenderer *inRenderer) -{ - CRct theRect(GetSize()); - - inRenderer->FillSolidRect(theRect, m_BackgroundColor); - // - inRenderer->PushPen(CStudioPreferences::GetPropertyFloorColor()); - // bottom - inRenderer->MoveTo(CPt(1, theRect.size.y - 1)); - inRenderer->LineTo(CPt(theRect.size.x - 1, theRect.size.y - 1)); - // left - inRenderer->MoveTo(CPt(0, 1)); - inRenderer->LineTo(CPt(0, theRect.size.y - 1)); - // right - inRenderer->MoveTo(CPt(theRect.size.x - 1, 1)); - inRenderer->LineTo(CPt(theRect.size.x - 1, theRect.size.y - 1)); - // - inRenderer->PopPen(); - - CPt thePos(0, 0); - if (m_HasMasterAction) { - if (m_ActionImages[IMAGETYPE_MASTERACTION].isNull()) - m_ActionImages[IMAGETYPE_MASTERACTION] = - CResourceCache::GetInstance()->GetBitmap("Action-MasterAction.png"); - - inRenderer->DrawBitmap(thePos, m_ActionImages[IMAGETYPE_MASTERACTION]); - } else if (m_HasAction) { - if (m_ActionImages[IMAGETYPE_ACTION].isNull()) - m_ActionImages[IMAGETYPE_ACTION] = - CResourceCache::GetInstance()->GetBitmap("Action-Action.png"); - - inRenderer->DrawBitmap(thePos, m_ActionImages[IMAGETYPE_ACTION]); - } - if (m_ChildHasMasterAction) { - if (m_ActionImages[IMAGETYPE_CHILDMASTERACTION].isNull()) - m_ActionImages[IMAGETYPE_CHILDMASTERACTION] = - CResourceCache::GetInstance()->GetBitmap("Action-ChildMasterAction.png"); - - inRenderer->DrawBitmap(thePos, m_ActionImages[IMAGETYPE_CHILDMASTERACTION]); - } else if (m_ChildHasAction) { - if (m_ActionImages[IMAGETYPE_CHILDACTION].isNull()) - m_ActionImages[IMAGETYPE_CHILDACTION] = - CResourceCache::GetInstance()->GetBitmap("Action-ChildAction.png"); - - inRenderer->DrawBitmap(thePos, m_ActionImages[IMAGETYPE_CHILDACTION]); - } - if (m_ComponentHasMasterAction) { - if (m_ActionImages[IMAGETYPE_COMPONENTMASTERACTION].isNull()) - m_ActionImages[IMAGETYPE_COMPONENTMASTERACTION] = - CResourceCache::GetInstance()->GetBitmap("Action-ComponentMasterAction.png"); - - inRenderer->DrawBitmap(thePos, m_ActionImages[IMAGETYPE_COMPONENTMASTERACTION]); - } else if (m_ComponentHasAction) { - if (m_ActionImages[IMAGETYPE_COMPONENTACTION].isNull()) - m_ActionImages[IMAGETYPE_COMPONENTACTION] = - CResourceCache::GetInstance()->GetBitmap("Action-ComponentAction.png"); - - inRenderer->DrawBitmap(thePos, m_ActionImages[IMAGETYPE_COMPONENTACTION]); - } - - // the old code with selection - - // inRenderer->DrawGradientBitmap( theRect, m_ParentRow->GetAsset( )->GetTimebarColor( ), false - // ); - // if ( m_Selected ) - //{ - // long theXSize = theRect.size.x / 2; - // long theYSize = theRect.size.y / 2; - // inRenderer->FillSolidRect( CRct( CPt( theXSize / 2, theYSize / 2 ), CPt( theXSize, theYSize) - //), CalculateSelectedColor( m_ParentRow->GetAsset( )->GetTimebarColor( ) ) ); - //} - - // if this is selected then do something special - // if ( m_Shaded ) - //{ - // // This is used for the left line of the color control - // CColor theNonGradiantHighlight = m_ParentRow->GetAsset( )->GetTimebarColor( ); - // float theLuminance = theNonGradiantHighlight.GetLuminance( ); - // theLuminance = theLuminance * (float)1.15; - // if ( theLuminance > 1.0 ) - // { - // theLuminance = (float)1.0; - // } - // - // // Highlight on left edge - // theNonGradiantHighlight.SetLuminance( theLuminance ); - // inRenderer->PushPen( theNonGradiantHighlight ); - // inRenderer->MoveTo( CPt( 1, 0 ) ); - // inRenderer->LineTo( CPt( 1, theRect.size.y - 1 ) ); - // inRenderer->PopPen( ); - - // // Dark line on far left edge - // inRenderer->PushPen( CStudioPreferences::GetRowTopColor( ) ); - // inRenderer->MoveTo( CPt( 0, 0 ) ); - // inRenderer->LineTo( CPt( 0, theRect.size.y - 1 ) ); - // inRenderer->PopPen( ); - // - // inRenderer->PushPen( CStudioPreferences::GetRowTopColor( ) ); - // inRenderer->MoveTo( CPt( 0,theRect.size.y - 1 ) ); - // inRenderer->LineTo( CPt( theRect.size.x, theRect.size.y - 1 ) ); - // inRenderer->MoveTo( CPt( theRect.size.x - 1, 0 ) ); - // inRenderer->LineTo( CPt( theRect.size.x - 1, theRect.size.y - 1 ) ); - // inRenderer->PopPen( ); - //} - - // inRenderer->Draw3dRect( CRct( theRect.position, CPt( theRect.size.x, theRect.size.y + 1 ) ), - // CColor( 0, 255, 0 ), CColor( 0, 255, 0 ) ); -} - -//============================================================================== -/** - * CalculateNonGradiantHighlight - * - * calculates the highlight for this color - * - * @param inColor color to multiply - */ -CColor CColorControl::CalculateNonGradiantHighlight(CColor inColor) -{ - double theNonGradiantHighlightR = inColor.GetRed() * 1.15; - double theNonGradiantHighlightG = inColor.GetGreen() * 1.15; - double theNonGradiantHighlightB = inColor.GetBlue() * 1.15; - if (theNonGradiantHighlightR > 255) { - theNonGradiantHighlightR = 255; - } - if (theNonGradiantHighlightG > 255) { - theNonGradiantHighlightG = 255; - } - if (theNonGradiantHighlightB > 255) { - theNonGradiantHighlightB = 255; - } - return CColor(::dtol(theNonGradiantHighlightR), ::dtol(theNonGradiantHighlightG), - ::dtol(theNonGradiantHighlightB)); -} - -//============================================================================== -/** - * CalculateNonGradiantHighlight - * - * calculates the highlight for this color - * - * @param inColor color to multiply - */ -CColor CColorControl::CalculateSelectedColor(CColor inColor) -{ - double theNonGradiantHighlightR = inColor.GetRed() * 0.65; - double theNonGradiantHighlightG = inColor.GetGreen() * 0.65; - double theNonGradiantHighlightB = inColor.GetBlue() * 0.65; - if (theNonGradiantHighlightR > 255) { - theNonGradiantHighlightR = 255; - } - if (theNonGradiantHighlightG > 255) { - theNonGradiantHighlightG = 255; - } - if (theNonGradiantHighlightB > 255) { - theNonGradiantHighlightB = 255; - } - return CColor(::dtol(theNonGradiantHighlightR), ::dtol(theNonGradiantHighlightG), - ::dtol(theNonGradiantHighlightB)); -} - -//============================================================================== -/** - * Handles the OnMouseDownEvent - */ -bool CColorControl::OnMouseDown(CPt inPoint, Qt::KeyboardModifiers inFlags) -{ - Q_UNUSED(inPoint); - Q_UNUSED(inFlags); - return true; -} - -//============================================================================== -/** - * Called when this row becomes selected - */ -void CColorControl::OnSelect() -{ - m_Selected = true; - this->Invalidate(); -} - -//============================================================================== -/** - * Called when this row becomes deselected - */ -void CColorControl::OnDeselect() -{ - m_Selected = false; - this->Invalidate(); -} - -//============================================================================== -/** - * Updates the icon used for display based on the following logic: - * 1. Self has actions - * 2. Descendents have actions - * Results in 4 states. - */ -void CColorControl::UpdateIconStatus() -{ - ITimelineItem *theTimelineItem = m_ParentRow->GetTimelineItem(); - - if (!theTimelineItem) - return; - - // Master 'supersede' non-master - m_HasMasterAction = theTimelineItem->HasAction(true); - if (!m_HasMasterAction) - m_HasAction = theTimelineItem->HasAction(false); - - // no descendent info if current row is expanded - if (!m_ParentRow->IsExpanded()) { - m_ChildHasMasterAction = theTimelineItem->ChildrenHasAction(true); - if (!m_ChildHasMasterAction) - m_ChildHasAction = theTimelineItem->ChildrenHasAction(false); - } else { - m_ChildHasMasterAction = false; - m_ChildHasAction = false; - } - - m_ComponentHasMasterAction = theTimelineItem->ComponentHasAction(true); - if (!m_ComponentHasMasterAction) - m_ComponentHasAction = theTimelineItem->ComponentHasAction(false); - - this->Invalidate(); -} diff --git a/src/Authoring/Studio/Palettes/Timeline/ColorControl.h b/src/Authoring/Studio/Palettes/Timeline/ColorControl.h deleted file mode 100644 index ec5b156d..00000000 --- a/src/Authoring/Studio/Palettes/Timeline/ColorControl.h +++ /dev/null @@ -1,98 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 NVIDIA Corporation. -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt 3D Studio. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef INCLUDED_COLOR_CONTROL_H -#define INCLUDED_COLOR_CONTROL_H 1 - -#pragma once - -#include "Control.h" -#include "CColor.h" -#include "CmdStack.h" - -#include <QPixmap> - -class CBaseStateRow; - -//============================================================================== -/** - * The control at the left side of the TimeContextRow. - * It is currently being used to indicate if the Asset or its descendents have any Action. - */ -class CColorControl : public CControl -{ -protected: - enum EImageType { - IMAGETYPE_ACTION = 0, ///< Types of action image - IMAGETYPE_MASTERACTION, - IMAGETYPE_CHILDACTION, - IMAGETYPE_CHILDMASTERACTION, - IMAGETYPE_COMPONENTACTION, - IMAGETYPE_COMPONENTMASTERACTION, - IMAGETYPE_MAXCOUNT - }; - -public: - CColorControl(CBaseStateRow *inRow); - virtual ~CColorControl(); - - void SetColor(::CColor inColor); - - void SetShaded(bool inIsShaded); - bool OnMouseDown(CPt inPoint, Qt::KeyboardModifiers inFlags) override; - - void Draw(CRenderer *inRenderer) override; - ::CColor CalculateNonGradiantHighlight(::CColor inColor); - - void OnSelect(); - void OnDeselect(); - - static ::CColor CalculateSelectedColor(::CColor inCOLOR); - - void UpdateIconStatus(); - -protected: - ::CColor m_BackgroundColor; - bool m_Shaded; - bool m_Selected; - CBaseStateRow *m_ParentRow; - - /////////////////////////////////////////////////// - // Action icons - // Action status - bool m_HasAction; - bool m_HasMasterAction; - bool m_ChildHasAction; - bool m_ChildHasMasterAction; - bool m_ComponentHasAction; - bool m_ComponentHasMasterAction; - // Action images - QPixmap m_ActionImages[IMAGETYPE_MAXCOUNT]; -}; -#endif // INCLUDED_COLOR_CONTROL_H diff --git a/src/Authoring/Studio/Palettes/Timeline/CommentEdit.cpp b/src/Authoring/Studio/Palettes/Timeline/CommentEdit.cpp deleted file mode 100644 index d0d5325f..00000000 --- a/src/Authoring/Studio/Palettes/Timeline/CommentEdit.cpp +++ /dev/null @@ -1,231 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2002 NVIDIA Corporation. -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt 3D Studio. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -//============================================================================== -// Prefix -//============================================================================== -#include "stdafx.h" - -//============================================================================== -// Includes -//============================================================================== -#include "CommentEdit.h" -#include "Renderer.h" -#include "ColorControl.h" -#include "Bindings/ITimelineTimebar.h" -#include "CoreUtils.h" -//============================================================================= -/** - * Constructor - */ -CCommentEdit::CCommentEdit(ITimelineTimebar *inTimelineItemTimebar) - : m_TimelineItemTimebar(inTimelineItemTimebar) - , m_IsSelected(false) -{ - AddCommitListener(this); -} - -//============================================================================= -/** - * Destructor - */ -CCommentEdit::~CCommentEdit() -{ - RemoveCommitListener(this); -} - -//============================================================================= -/** - * Called when a property changes. - * @param inProperty the property that was changed - * @param inIsVisibleChange true if this is a change that effects the property's visibility in the - * Timeline - */ -void CCommentEdit::OnSetData(CControl *inControl) -{ - if (inControl == this && m_TimelineItemTimebar) { - m_TimelineItemTimebar->SetTimebarComment(GetString()); - } -} - -//============================================================================= -/** - * Called when this control receives a double click, edit the comment. - * - * @param inPoint the point where the double click occured - * @param inFlags the flags at the time of the click - */ -bool CCommentEdit::OnMouseDoubleClick(CPt inPoint, Qt::KeyboardModifiers inFlags) -{ - Q_UNUSED(inPoint); - Q_UNUSED(inFlags); - - if (GetDisplayString().Length() > 0) { - DoChangeComment(); - return true; - } - return false; -} - -//============================================================================= -/** - * Edit the Comment - * - */ -void CCommentEdit::DoChangeComment() -{ - SetEditMode(true); - SelectAllText(); -} - -//============================================================================= -/** - * Called when this control receives a mouse down, don't do anything unless we're in edit mode - * - * @param inPoint the point where the click occured - * @param inFlags the flags at the time of the click - */ -bool CCommentEdit::OnMouseDown(CPt inPoint, Qt::KeyboardModifiers inFlags) -{ - bool theRetVal = false; - if (GetEditMode()) { - theRetVal = CTextEditInPlace::OnMouseDown(inPoint, inFlags); - } - return theRetVal; -} - -//============================================================================= -/** - * Called when this control loses focus - */ -void CCommentEdit::OnLoseFocus() -{ - CStringEdit::OnLoseFocus(); - SetEditMode(false); -} - -//============================================================================= -/** - * Called when this control gains focus, don't do anytihng - */ -void CCommentEdit::OnGainFocus() -{ -} - -//============================================================================= -/** - * Override for the draw, don't set the size of this control here since we are in - * a comment and wouldn't want the size changing - */ -void CCommentEdit::Draw(CRenderer *inRenderer) -{ - CPt theRectPoint = CPt(::dtol(CalculateCharWidths(inRenderer) + GetRightBuffer()), GetSize().y); - CPt theSize = GetSize(); - if (theSize.x < theRectPoint.x) - theRectPoint.x = theSize.x; - CRct theRect = CRct(theRectPoint); - ::CColor theOutlineColor = ::CColor(0, 0, 0); - bool theFillFlag = m_FillBackground; - - if (theFillFlag && !GetEditMode()) - SetFillBackground(false); - - if (GetEditMode()) - SetTextColor(::CColor(0, 0, 0)); - - inRenderer->PushClippingRect(theRect); - CStringEdit::Draw(inRenderer); - inRenderer->PopClippingRect(); - - if (!GetEditMode()) - SetFillBackground(theFillFlag); - - if (GetEditMode()) - inRenderer->DrawRectOutline(theRect, theOutlineColor, theOutlineColor, theOutlineColor, - theOutlineColor); -} - -//============================================================================= -/** - * Called when the timebar comment or the time bar color changes on an asset - */ -void CCommentEdit::RefreshMetaData() -{ - m_Color = ::CColor(m_TimelineItemTimebar->GetTimebarColor()); - CalculateTextColor(); - SetData(m_TimelineItemTimebar->GetTimebarComment()); - - Invalidate(); -} - -//============================================================================= -/** - * Calculates the text color based on whether the object is selected or not - */ -void CCommentEdit::CalculateTextColor() -{ - ::CColor theColor = m_Color; - float theLuminance = theColor.GetLuminance(); - if (m_IsSelected) { - theLuminance = theLuminance * 0.8f; - } - // Duplicated Code to check luminance when the timebar changes color - - if (theLuminance < 0.5) { - SetTextColor(::CColor(255, 255, 255)); - } else { - SetTextColor(::CColor(0, 0, 0)); - } -} - -//============================================================================= -/** - * Sets this object as selected - * @param inPoint the point to check - */ -void CCommentEdit::SetSelected(bool inState) -{ - m_IsSelected = inState; - CalculateTextColor(); -} - -//============================================================================= -/** - * Overrides the hit test for the case when the click occurs in the object, but outside the text - * @param inPoint the point to check - */ -bool CCommentEdit::HitTest(const CPt &inPoint) const -{ - // rp this seems wrong but apparently it magically works - bool theRetVal = false; - if (inPoint.x - < m_TotalCharWidth + GetRightBuffer() + 2 * CStudioPreferences::GetTimebarTipSize()) - theRetVal = CTextEditInPlace::HitTest(inPoint); - return theRetVal; -} diff --git a/src/Authoring/Studio/Palettes/Timeline/CommentEdit.h b/src/Authoring/Studio/Palettes/Timeline/CommentEdit.h deleted file mode 100644 index 8ae37ad9..00000000 --- a/src/Authoring/Studio/Palettes/Timeline/CommentEdit.h +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2002 NVIDIA Corporation. -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt 3D Studio. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef INCLUDED_COMMENT_EDIT -#define INCLUDED_COMMENT_EDIT 1 - -#pragma once - -//============================================================================== -// Includes -//============================================================================== -#include "TextEditInPlace.h" - -//============================================================================== -// Forwards -//============================================================================== -class CRenderer; -class ITimelineTimebar; - -//============================================================================= -/** - * @class CCommentEdit this class handles changing the comments for a timebar in - * the timeline. This class seems necessary only to change the color of the text - * depending on the timebar color - */ -class CCommentEdit : public CTextEditInPlace, public CCommitDataListener -{ -public: - CCommentEdit(ITimelineTimebar *inTimelineItemTimebar); - virtual ~CCommentEdit(); - void OnSetData(CControl *inControl) override; - bool OnMouseDoubleClick(CPt inPoint, Qt::KeyboardModifiers inFlags) override; - bool OnMouseDown(CPt inPoint, Qt::KeyboardModifiers inFlags) override; - void Draw(CRenderer *inRenderer) override; - void RefreshMetaData(); - void CalculateTextColor(); - bool HitTest(const CPt &inPoint) const override; - void SetSelected(bool inState); - - void OnLoseFocus() override; - void OnGainFocus() override; - - void DoChangeComment(); - -protected: - ITimelineTimebar *m_TimelineItemTimebar; - ::CColor m_Color; - bool m_IsSelected; -}; - -#endif // INCLUDED_COMMENT_EDIT diff --git a/src/Authoring/Studio/Palettes/Timeline/ITimelineControl.h b/src/Authoring/Studio/Palettes/Timeline/ITimelineControl.h deleted file mode 100644 index 05af776e..00000000 --- a/src/Authoring/Studio/Palettes/Timeline/ITimelineControl.h +++ /dev/null @@ -1,53 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2008 NVIDIA Corporation. -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt 3D Studio. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -//============================================================================== -// Prefix -//============================================================================== -#ifndef INCLUDED_ITIMELINE_CONTROL_H -#define INCLUDED_ITIMELINE_CONTROL_H 1 - -#pragma once - -#include "Rct.h" - -class ISnappingListProvider; - -class ITimelineControl -{ -public: - virtual ~ITimelineControl() {} - - virtual void OnLayoutChanged() = 0; - virtual CRct GetBounds() const = 0; - virtual void HideTimelineMoveableTooltip() = 0; - virtual ISnappingListProvider *GetSnappingListProvider() const = 0; -}; - -#endif // INCLUDED_TIMELINE_CONTROL_H diff --git a/src/Authoring/Studio/Palettes/Timeline/KeyframeContextMenu.cpp b/src/Authoring/Studio/Palettes/Timeline/KeyframeContextMenu.cpp deleted file mode 100644 index c3d8bc4d..00000000 --- a/src/Authoring/Studio/Palettes/Timeline/KeyframeContextMenu.cpp +++ /dev/null @@ -1,412 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2002 NVIDIA Corporation. -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt 3D Studio. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "stdafx.h" - -//============================================================================== -// Includes -//============================================================================== -#include "KeyframeContextMenu.h" -#include "IDoc.h" -#include "CColor.h" -#include "Preferences.h" -#include "Dialogs.h" -#include "TimebarControl.h" -#include "Bindings/ITimelineTimebar.h" -#include "Bindings/ITimelineKeyframesManager.h" -#include "Bindings/ITimelineItemBinding.h" -#include "Bindings/ITimelineItemProperty.h" -#include "IKeyframe.h" -#include "MainFrm.h" -#include "StudioApp.h" - -#include <QtWidgets/qcolordialog.h> - -#define IDC_KEYFRAME_COLOR_BOX 1002 - -//============================================================================= -/** - * Constructor - */ -CBaseKeyframeContextMenu::CBaseKeyframeContextMenu(QWidget *parent) - : QMenu(parent) - , m_HasDynamicSelectedKeyframes(false) - , m_KeyframesManager(nullptr) -{ -} - -//============================================================================= -/** - * Destructor - */ -CBaseKeyframeContextMenu::~CBaseKeyframeContextMenu() -{ -} - -void CBaseKeyframeContextMenu::Initialize(ITimelineKeyframesManager *inKeyframesManager) -{ - m_KeyframesManager = inKeyframesManager; - ASSERT(m_KeyframesManager); - - //"Insert Keyframe" - ITimelineItemKeyframesHolder *theKeyframesHolder = GetKeyframesHolder(); - if (theKeyframesHolder) { - m_insertAction = new QAction(tr("Insert Keyframe")); - connect(m_insertAction, &QAction::triggered, - this, &CBaseKeyframeContextMenu::InsertKeyframe); - addAction(m_insertAction); - } - - bool theHasKeysSelected = m_KeyframesManager->HasSelectedKeyframes(); - bool theCanCopyKeys = m_KeyframesManager->CanPerformKeyframeCopy(); - bool theCanPasteKeys = m_KeyframesManager->CanPerformKeyframePaste(); - - m_cutAction = new QAction(tr("Cut Selected Keyframes")); - connect(m_cutAction, &QAction::triggered, this, &CBaseKeyframeContextMenu::CutSelectedKeys); - m_cutAction->setEnabled(theCanCopyKeys); - addAction(m_cutAction); - - m_copyAction = new QAction(tr("Copy Selected Keyframes")); - connect(m_copyAction, &QAction::triggered, this, &CBaseKeyframeContextMenu::CopySelectedKeys); - m_copyAction->setEnabled(theCanCopyKeys); - addAction(m_copyAction); - - m_pasteAction = new QAction(tr("Paste Keyframes")); - connect(m_pasteAction, &QAction::triggered, this, &CBaseKeyframeContextMenu::PasteSelectedKeys); - m_pasteAction->setEnabled(theCanPasteKeys); - addAction(m_pasteAction); - - m_deleteSelectedAction = new QAction(tr("Delete Selected Keyframes")); - connect(m_deleteSelectedAction, &QAction::triggered, - this, &CBaseKeyframeContextMenu::DeleteSelectedKeys); - m_deleteSelectedAction->setEnabled(theHasKeysSelected); - addAction(m_deleteSelectedAction); - - //"Delete All Channel Keyframes" - if (theKeyframesHolder) { - m_deleteChannelKeysAction = new QAction(tr("Delete All Channel Keyframes")); - connect(m_deleteChannelKeysAction, &QAction::triggered, - this, &CBaseKeyframeContextMenu::DeleteChannelKeys); - addAction(m_deleteChannelKeysAction); - } -} - -//============================================================================= -/** - * Called when the cut selected keys option is chosen by the user. Makes a call - * to the doc to handle the request - */ -void CBaseKeyframeContextMenu::InsertKeyframe() -{ - GetKeyframesHolder()->InsertKeyframe(); -} - -//============================================================================= -/** - * Called when the cut selected keys option is chosen by the user. Makes a call - * to the doc to handle the request - */ -void CBaseKeyframeContextMenu::DeleteChannelKeys() -{ - GetKeyframesHolder()->DeleteAllChannelKeyframes(); -} - -//============================================================================= -/** - * Called when the cut selected keys option is chosen by the user. Makes a call - * to the doc to handle the request - */ -void CBaseKeyframeContextMenu::CutSelectedKeys() -{ - m_KeyframesManager->RemoveKeyframes(true); -} - -//============================================================================= -/** - * Called when the copy selected keys option is chosen by the user. Makes a call - * to the doc to handle the request - */ -void CBaseKeyframeContextMenu::CopySelectedKeys() -{ - m_KeyframesManager->CopyKeyframes(); -} - -//============================================================================= -/** - * Called when the paste selected keys option is chosen by the user. Makes a call - * to the doc to handle the request - */ -void CBaseKeyframeContextMenu::PasteSelectedKeys() -{ - m_KeyframesManager->PasteKeyframes(); -} - -//============================================================================= -/** - * Called when the delete selected keys option is chosen by the user. Makes a call - * to the doc to handle the request - */ -void CBaseKeyframeContextMenu::DeleteSelectedKeys() -{ - m_KeyframesManager->RemoveKeyframes(false); -} - -//============================================================================= -/** - * Toggle if the selected keyframe(s) is dynamic - */ -void CBaseKeyframeContextMenu::MakeDynamic() -{ - m_KeyframesManager->SetKeyframesDynamic(!m_HasDynamicSelectedKeyframes); // toggle -} - -//============================================================================== -// CTimebarKeyframeContextMenu -//============================================================================== -CTimebarKeyframeContextMenu::CTimebarKeyframeContextMenu( - ITimebarControl *inTimebarControl, ITimelineKeyframesManager *inKeyframesManager, - bool inShowTimebarPropertiesOptions /*= true */, QWidget *parent) - : CBaseKeyframeContextMenu(parent) - , m_TimebarControl(inTimebarControl) - , m_ShowTimebarPropertiesOptions(inShowTimebarPropertiesOptions) -{ - Initialize(inKeyframesManager); -} - -CTimebarKeyframeContextMenu::~CTimebarKeyframeContextMenu() -{ -} - -void CTimebarKeyframeContextMenu::Initialize(ITimelineKeyframesManager *inKeyframesManager) -{ - CBaseKeyframeContextMenu::Initialize(inKeyframesManager); - - // Dynamic keyframes ( the way it was set up before was, this option is still shown, but grayed - // out even if this context menu isn't triggered from right-clicking on a timebar ) - QString theMakeDynamicOption = tr("Make Animations Static"); - - if (m_TimebarControl->GetKeyframesHolder()->GetKeyframeCount() > 0) { - m_HasDynamicSelectedKeyframes = m_KeyframesManager->HasDynamicKeyframes(); - - if (!m_HasDynamicSelectedKeyframes) - theMakeDynamicOption = tr("Make Animations Dynamic"); - - m_makeDynamicAction = new QAction(theMakeDynamicOption); - connect(m_makeDynamicAction, &QAction::triggered, - this, &CTimebarKeyframeContextMenu::MakeDynamic); - addAction(m_makeDynamicAction); - } - - if (m_ShowTimebarPropertiesOptions) { - // Timebar specific actions - addSeparator(); - m_timeBarColorAction = new QAction(tr("Change Time Bar Color")); - CMainFrame *theMainFrame = g_StudioApp.m_pMainWnd; - connect(m_timeBarColorAction, &QAction::triggered, - theMainFrame, &CMainFrame::OnTimelineSetTimeBarColor); - addAction(m_timeBarColorAction); - - // TODO: If these will become into main menu, combine with CMainFrame - // like m_timeBarColorAction to not duplicate code - m_timeBarTextAction = new QAction(tr("Change Time Bar Text")); - connect(m_timeBarTextAction, &QAction::triggered, - this, &CTimebarKeyframeContextMenu::ChangeTimebarText); - addAction(m_timeBarTextAction); - - // Change the text for the timebar option depending on whether they are currently being - // shown or not - QString theTimebarHandleTextID = tr("Show Time Bar Handles"); - if (CPreferences::GetUserPreferences("Timeline").GetValue("ShowTimebarHandles", false)) - theTimebarHandleTextID = tr("Hide Time Bar Handles"); - - m_timeBarHandlesAction = new QAction(theTimebarHandleTextID); - connect(m_timeBarHandlesAction, &QAction::triggered, - this, &CTimebarKeyframeContextMenu::ToggleTimebarHandles); - addAction(m_timeBarHandlesAction); - - m_timeBarTimeAction = new QAction(tr("Set Timebar Time")); - connect(m_timeBarTimeAction, &QAction::triggered, - this, &CTimebarKeyframeContextMenu::SetTimebarTime); - addAction(m_timeBarTimeAction); - } -} - -void CTimebarKeyframeContextMenu::MakeDynamic() -{ - m_KeyframesManager->SelectAllKeyframes(); - CBaseKeyframeContextMenu::MakeDynamic(); -} - -//============================================================================= -/** - * To show "Insert Keyframe" and "Delete All Channel Keyframes" - */ -ITimelineItemKeyframesHolder *CTimebarKeyframeContextMenu::GetKeyframesHolder() -{ - return m_TimebarControl->GetKeyframesHolder(); -} - -//============================================================================= -/** - * Called when the copy selected keys option is chosen by the user. - */ -void CTimebarKeyframeContextMenu::ChangeTimebarText() -{ - m_TimebarControl->OnEditTimeComment(); -} - -//============================================================================= -/** - * Shows or hides timebar handles in the timeline. If timebar handles are - * currently being shown, they are hidden, and the preference is stored. If - * timebar handles are being hidden, they are shown. - */ -void CTimebarKeyframeContextMenu::ToggleTimebarHandles() -{ - // Get the current timebar handle preference - bool theHandlesAreShowing = - CPreferences::GetUserPreferences("Timeline").GetValue("ShowTimebarHandles", false); - // Switch the preference. - CPreferences::GetUserPreferences("Timeline") - .SetValue("ShowTimebarHandles", !theHandlesAreShowing); - if (m_TimebarControl) - m_TimebarControl->OnToggleTimebarHandles(); -} - -//============================================================================= -/** - * SetTimebarTime: This is the event handler that will be called when the user - * chooses set timebar time from a pop up menu. This pop up - *menu - * is triggered when the user right click on the selected - *timebar. - * It displays a time edit dialog to allow the user to set the - * start and end time of the timebar time. - * @param NONE - * @return NONE - */ -void CTimebarKeyframeContextMenu::SetTimebarTime() -{ - m_TimebarControl->SetTimebarTime(); -} - -//============================================================================== -// CKeyframeContextMenu -//============================================================================== -CKeyframeContextMenu::CKeyframeContextMenu(ITimelineKeyframesManager *inKeyframesManager, - ITimelineItemProperty *inTimelineItemProperty, - QWidget *parent) - : CBaseKeyframeContextMenu(parent) - , m_TimelineItemProperty(inTimelineItemProperty) -{ - Initialize(inKeyframesManager); -} - -CKeyframeContextMenu::~CKeyframeContextMenu() -{ -} - -void CKeyframeContextMenu::Initialize(ITimelineKeyframesManager *inKeyframesManager) -{ - CBaseKeyframeContextMenu::Initialize(inKeyframesManager); - - // Dynamic keyframes ( the way it was set up before was, this option is still shown, but grayed - // out even if this context menu isn't triggered from right-clicking on a timebar ) - QString theMakeDynamicOption = tr("Make Animations Static"); - m_HasDynamicSelectedKeyframes = - m_TimelineItemProperty && m_TimelineItemProperty->IsDynamicAnimation(); - - if (!m_HasDynamicSelectedKeyframes) - theMakeDynamicOption = tr("Make Animations Dynamic"); - - m_makeDynamicAction = new QAction(theMakeDynamicOption); - connect(m_makeDynamicAction, &QAction::triggered, this, &CKeyframeContextMenu::MakeDynamic); - addAction(m_makeDynamicAction); - - addSeparator(); - bool theHasKeysSelected = m_KeyframesManager->HasSelectedKeyframes(); - m_setInterpolationAction = new QAction(tr("Set Interpolation")); - connect(m_setInterpolationAction, &QAction::triggered, - this, &CKeyframeContextMenu::SetInterpolation); - addAction(m_setInterpolationAction); - - m_setKeyframeTimeAction = new QAction(tr("Set Keyframe Time")); - connect(m_setKeyframeTimeAction, &QAction::triggered, - this, &CKeyframeContextMenu::SetKeyframeTime); - m_setKeyframeTimeAction->setEnabled(theHasKeysSelected); - addAction(m_setKeyframeTimeAction); -} - -void CKeyframeContextMenu::MakeDynamic() -{ - if (m_TimelineItemProperty != nullptr && m_TimelineItemProperty->GetKeyframeCount() > 0) { - m_TimelineItemProperty->SelectKeyframes( - true, m_TimelineItemProperty->GetKeyframeByIndex(0)->GetTime()); - } - - CBaseKeyframeContextMenu::MakeDynamic(); -} - -//============================================================================= -/** - * SetTime: Saves the keyframe time - * @param inTime is the keyframe time - */ -void CKeyframeContextMenu::SetTime(long inTime) -{ - m_Time = inTime; -} - -//============================================================================= -/** - * Called when the set interpolation option is taken by the user. Uses the left most - * selected key for the base interpolation in the dialog box. User can then set the interpolation - * and it is propagated to all teh keys - */ -void CKeyframeContextMenu::SetInterpolation() -{ - m_KeyframesManager->SetKeyframeInterpolation(); -} - -//============================================================================= -/** - * SetKeyframeTime: This is the event handler that will be called when the user - * chooses set keyframe time from a pop up menu. This pop up - *menu - * is triggered when the user right click on the selected - *keyframe. - * It displays a time edit dialog to allow the user to set the - * keyframe time. - * @param NONE - * @return NONE - */ -void CKeyframeContextMenu::SetKeyframeTime() -{ - m_KeyframesManager->SetKeyframeTime(m_Time); -} diff --git a/src/Authoring/Studio/Palettes/Timeline/KeyframeContextMenu.h b/src/Authoring/Studio/Palettes/Timeline/KeyframeContextMenu.h deleted file mode 100644 index bb28de3a..00000000 --- a/src/Authoring/Studio/Palettes/Timeline/KeyframeContextMenu.h +++ /dev/null @@ -1,153 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2002 NVIDIA Corporation. -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt 3D Studio. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef INCLUDED_KEYFRAME_CONTEXT_MENU -#define INCLUDED_KEYFRAME_CONTEXT_MENU 1 - -#pragma once - -//============================================================================== -// Includes -//============================================================================== -#include <QMenu> - -class ITimelineKeyframesManager; -class ITimelineItemProperty; -class ITimelineTimebar; -class ITimeChangeCallback; -class ITimelineItemKeyframesHolder; -class ITimebarControl; - -QT_FORWARD_DECLARE_CLASS(QAction) - -//============================================================================= -/** - * Abstract class that contain the common items for the keyframes-related context menu. - */ -class CBaseKeyframeContextMenu : public QMenu -{ - Q_OBJECT -public: - CBaseKeyframeContextMenu(QWidget *parent = nullptr); - virtual ~CBaseKeyframeContextMenu(); - -protected: - virtual void Initialize(ITimelineKeyframesManager *inKeyframesManager); - virtual void MakeDynamic(); - virtual ITimelineItemKeyframesHolder *GetKeyframesHolder() { return nullptr; } - -protected Q_SLOTS: - void CutSelectedKeys(); - void CopySelectedKeys(); - void PasteSelectedKeys(); - void DeleteSelectedKeys(); - void InsertKeyframe(); - void DeleteChannelKeys(); - -protected: - bool m_HasDynamicSelectedKeyframes; - ITimelineKeyframesManager *m_KeyframesManager; - QAction *m_insertAction; - QAction *m_cutAction; - QAction *m_copyAction; - QAction *m_pasteAction; - QAction *m_deleteSelectedAction; - QAction *m_deleteChannelKeysAction; -}; - -//============================================================================= -/** - * Context menu right-clicking on a timebar, - */ -class CTimebarKeyframeContextMenu : public CBaseKeyframeContextMenu -{ - Q_OBJECT -public: - CTimebarKeyframeContextMenu(ITimebarControl *inTimebarControl, - ITimelineKeyframesManager *inKeyframesManager, - bool inShowTimebarPropertiesOptions = true, - QWidget *parent = nullptr); - ~CTimebarKeyframeContextMenu(); - -protected: - void Initialize(ITimelineKeyframesManager *inKeyframesManager) override; - ITimelineItemKeyframesHolder *GetKeyframesHolder() override; - void MakeDynamic() override; - - void ChangeTimebarText(); - void ToggleTimebarHandles(); - void SetTimebarTime(); - -protected: - ITimebarControl *m_TimebarControl; - bool m_ShowTimebarPropertiesOptions; - - QAction *m_makeDynamicAction; - QAction *m_timeBarColorAction; - QAction *m_timeBarTextAction; - QAction *m_timeBarHandlesAction; - QAction *m_timeBarTimeAction; -}; - -//============================================================================= -/** - * Context menu for right-clicking on selected keyframe(s) - * so even though the assoicated action isn't limited to the keyframe that was right-clicked on, - * this is still a different one from right-clicking on outside the keyframe. - * This is how the old system used to be. - */ -class CKeyframeContextMenu : public CBaseKeyframeContextMenu -{ - Q_OBJECT -public: - CKeyframeContextMenu(ITimelineKeyframesManager *inKeyframesManager, - ITimelineItemProperty *inTimelineItemProperty = nullptr, - QWidget *parent = nullptr); - ~CKeyframeContextMenu(); - - void SetTime(long inTime); - -protected: - void Initialize(ITimelineKeyframesManager *inKeyframesManager) override; - void MakeDynamic() override; - -protected Q_SLOTS: - void SetInterpolation(); - void SetKeyframeTime(); - -protected: - long m_Time; - -private: - ITimelineItemProperty *m_TimelineItemProperty; - QAction *m_makeDynamicAction; - QAction *m_setKeyframeTimeAction; - QAction *m_setInterpolationAction; -}; -#endif // INCLUDED_KEYFRAME_CONTEXT_MENU diff --git a/src/Authoring/Studio/Palettes/Timeline/Keyframes.qml b/src/Authoring/Studio/Palettes/Timeline/Keyframes.qml deleted file mode 100644 index 70563ba0..00000000 --- a/src/Authoring/Studio/Palettes/Timeline/Keyframes.qml +++ /dev/null @@ -1,55 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt 3D Studio. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQuick 2.8 -import QtQuick.Controls 2.2 -import QtQuick.Layouts 1.3 -import "../controls" - -Item { - id: root - - property var keyframes - - Repeater { - // TODO use the same graphic as in the old code: CAssetTimelineKeyframe::GetImage() - - model: keyframes - delegate: Rectangle { - x: modelData.position - y: -width / 2 - - color: "white" - border.color: "black" - border.width: 1 - width: 8 - height: 8 - radius: width / 2 - - } - } -} diff --git a/src/Authoring/Studio/Palettes/Timeline/MultiSelectAspect.h b/src/Authoring/Studio/Palettes/Timeline/MultiSelectAspect.h deleted file mode 100644 index 7a686522..00000000 --- a/src/Authoring/Studio/Palettes/Timeline/MultiSelectAspect.h +++ /dev/null @@ -1,148 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2002 NVIDIA Corporation. -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt 3D Studio. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef INCLUDED_MULTISELECT_ASPECT_H -#define INCLUDED_MULTISELECT_ASPECT_H 1 - -#pragma once - -//============================================================================== -// Includes -//============================================================================== -#include "StateRow.h" -#include "Bindings/IKeyframeSelector.h" - -//============================================================================== -/** - * This class handles the multi selection aspect for keyframes in the timeline. - * It toggles each keyframe's select state on or off, depending on whether the - * mouse rectangle is over them and if the modifier key is down. - */ -template <typename TSTLKeyFrameList> -class CMultiSelectAspect -{ - -public: - typedef typename TSTLKeyFrameList::iterator TSTLKeyframesItr; - -protected: - TSTLKeyFrameList &m_STLKeyframes; ///< stores list of keyframes in a vector (STL) - IKeyframeSelector *m_KeyframeSelector; ///< the interface that performs the keyframes selection - -public: - //============================================================================= - /** - * Constructor - * @param inSTLKeyframes stores a list of keyframes in a vector - * @param inDoc stores the studio document - */ - CMultiSelectAspect(TSTLKeyFrameList &inSTLKeyframes, IKeyframeSelector *inKeyframeSelector) - : m_STLKeyframes(inSTLKeyframes) - , m_KeyframeSelector(inKeyframeSelector) - { - } - - //============================================================================= - /** - * Destructor - */ - ~CMultiSelectAspect() {} - - //============================================================================= - /** - * CommitSelections: Overwrites all previous keyframe states with the current keyframe states. - * This will prevent the keyframes in the current selection -*from -* switching states as we select other keyframes. - */ - void CommitSelections() - { - // Iterates each keyframe and set the previous state to the current one. - TSTLKeyframesItr thePos = m_STLKeyframes.begin(); - for (; thePos != m_STLKeyframes.end(); ++thePos) { - (*thePos)->SetPreviousSelectState((*thePos)->IsSelected()); - } - } - - //============================================================================= - /** - * MultiSelect: Handles the selection of keyframes in a given rect. - * @param inRect stores the rectangle that will be used to select the keyframes within it. - * @param inModifierKeyDown indicates if thte modifier key is pressed. - */ - void MultiSelect(CRct inRect, bool inModifierKeyDown) - { - // Iterates through the keyframes and checks if the keys are in the rect and - // perform the necessary selection operations on each keyframe. - TSTLKeyframesItr thePos = m_STLKeyframes.begin(); - for (; thePos != m_STLKeyframes.end(); ++thePos) { - bool isInRect = (*thePos)->IsInRect(inRect); - if ((*thePos)->IsEnabled()) { - if (inModifierKeyDown) { - if (isInRect) { - if (!(*thePos)->GetRectOverHandled()) { - bool theSelectState = (*thePos)->IsSelected(); - - // Update the previous select state - (*thePos)->SetPreviousSelectState(theSelectState); - // Negate the keyframe state when it is in the rectangle - theSelectState = !theSelectState; - (*thePos)->Select(theSelectState); - m_KeyframeSelector->SelectKeyframes(theSelectState, - (*thePos)->GetTime()); - - // Set the RectOverFlag to true, so that we will not repeat the negation - // in indefinitely. - (*thePos)->SetRectOverHandled(true); - } - } else { - // When the rectangle is not over the current keyframe, revert its state to - // the previous one - if ((*thePos)->IsSelected() != (*thePos)->GetPreviousSelectState()) { - (*thePos)->Select((*thePos)->GetPreviousSelectState()); - m_KeyframeSelector->SelectKeyframes((*thePos)->GetPreviousSelectState(), - (*thePos)->GetTime()); - } - (*thePos)->SetRectOverHandled(false); - } - } else { - // When modifier is not pressed we will just select the keyframes if it is over - // in the rectangle and deselect it when it isn't. - if ((*thePos)->IsSelected() != isInRect) { - (*thePos)->SetPreviousSelectState((*thePos)->IsSelected()); - m_KeyframeSelector->SelectKeyframes(isInRect, (*thePos)->GetTime()); - (*thePos)->Select(isInRect); - } - (*thePos)->SetRectOverHandled(false); - } - } - } - } -}; -#endif // INCLUDED_MULTISELECT_ASPECT_H diff --git a/src/Authoring/Studio/Palettes/Timeline/PlayHead.qml b/src/Authoring/Studio/Palettes/Timeline/PlayHead.qml deleted file mode 100644 index 3385db84..00000000 --- a/src/Authoring/Studio/Palettes/Timeline/PlayHead.qml +++ /dev/null @@ -1,51 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt 3D Studio. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.8 -import Qt3DStudio 1.0 - -Item { - id: root - - implicitWidth: playHeadImage.width - - Image { - id: playHeadImage - - anchors.horizontalCenter: parent.horizontalCenter - source: _resDir + "PlaybackHead.png" - } - - Rectangle { - anchors.horizontalCenter: parent.horizontalCenter - anchors.top: playHeadImage.bottom - width: 1 - height: parent.height - playHeadImage.height - color: "red" - } -} diff --git a/src/Authoring/Studio/Palettes/Timeline/PropertyColorControl.cpp b/src/Authoring/Studio/Palettes/Timeline/PropertyColorControl.cpp deleted file mode 100644 index 3cffd417..00000000 --- a/src/Authoring/Studio/Palettes/Timeline/PropertyColorControl.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2002 NVIDIA Corporation. -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt 3D Studio. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "stdafx.h" - -#include "PropertyColorControl.h" -#include "Renderer.h" -#include "PropertyRow.h" -#include "StudioPreferences.h" -#include "HotKeys.h" - -CPropertyColorControl::CPropertyColorControl(CPropertyRow *inPropertyRow) -{ - m_ParentRow = inPropertyRow; -} - -CPropertyColorControl::~CPropertyColorControl() -{ -} - -//============================================================================== -/** - * Draw - * - * draws this object - * - * @param inRenderer a renderer object - */ -void CPropertyColorControl::Draw(CRenderer *inRenderer) -{ - // Fill the control with the solid color - CRct theRect(GetSize()); - CColor theBgColor(CStudioPreferences::GetPropertyBackgroundColor()); - inRenderer->FillSolidRect(theRect, theBgColor); - - // Define the colors for the side and bottom outline - CColor theBorderColor(CStudioPreferences::GetPropertyFloorColor()); - - // Right - inRenderer->PushPen(theBorderColor); - inRenderer->MoveTo(CPt(theRect.size.x - 1, 0)); - inRenderer->LineTo(CPt(theRect.size.x - 1, theRect.size.y - 1)); - - // Left - inRenderer->MoveTo(CPt(0, 0)); - inRenderer->LineTo(CPt(0, theRect.size.y - 1)); - - // Bottom - inRenderer->MoveTo(CPt(1, theRect.size.y - 1)); - inRenderer->LineTo(CPt(theRect.size.x - 2, theRect.size.y - 1)); - inRenderer->PopPen(); -} - -//============================================================================== -/** - * Handles the OnMouseDownEvent - */ -bool CPropertyColorControl::OnMouseDown(CPt inPoint, Qt::KeyboardModifiers inFlags) -{ - Q_UNUSED(inPoint); - m_ParentRow->Select((CHotKeys::MODIFIER_SHIFT & inFlags) == CHotKeys::MODIFIER_SHIFT); - return true; -} diff --git a/src/Authoring/Studio/Palettes/Timeline/PropertyColorControl.h b/src/Authoring/Studio/Palettes/Timeline/PropertyColorControl.h deleted file mode 100644 index cc3263b8..00000000 --- a/src/Authoring/Studio/Palettes/Timeline/PropertyColorControl.h +++ /dev/null @@ -1,55 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2002 NVIDIA Corporation. -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt 3D Studio. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef INCLUDED_PROPERTYCOLOR_CONTROL_H -#define INCLUDED_PROPERTYCOLOR_CONTROL_H 1 - -#pragma once - -#include "Control.h" -#include "CColor.h" - -class CRenderer; -class CPropertyRow; - -class CPropertyColorControl : public CControl -{ -public: - CPropertyColorControl(CPropertyRow *inPropertyRow); - virtual ~CPropertyColorControl(); - - void SetColor(::CColor inColor); - bool OnMouseDown(CPt inPoint, Qt::KeyboardModifiers inFlags) override; - - void Draw(CRenderer *inRenderer) override; - -protected: - CPropertyRow *m_ParentRow; -}; -#endif // INCLUDED_ diff --git a/src/Authoring/Studio/Palettes/Timeline/PropertyGraphKeyframe.cpp b/src/Authoring/Studio/Palettes/Timeline/PropertyGraphKeyframe.cpp deleted file mode 100644 index ffe83da3..00000000 --- a/src/Authoring/Studio/Palettes/Timeline/PropertyGraphKeyframe.cpp +++ /dev/null @@ -1,152 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 NVIDIA Corporation. -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt 3D Studio. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "stdafx.h" - -#include "PropertyGraphKeyframe.h" -#include "Renderer.h" -#include "Bindings/ITimelineItemProperty.h" -#include "StudioUtils.h" -#include "CColor.h" - -CPropertyGraphKeyframe::CPropertyGraphKeyframe(ITimelineItemProperty *inProperty, - long inChannelIndex, long inKeyframeTime, - double inTimeRatio, long inMinY, long inMaxY, - float inMinVal, float inMaxVal) - : m_Property(inProperty) - , m_ChannelIndex(inChannelIndex) - , m_KeyframeTime(inKeyframeTime) - , m_TimeRatio(inTimeRatio) - , m_MinVal(inMinVal) - , m_MaxVal(inMaxVal) - , m_MinY(inMinY) - , m_MaxY(inMaxY) - , m_IsMouseDown(false) -{ - SetSize(CPt(6, 8)); - PositionKeyframe(); -} - -CPropertyGraphKeyframe::~CPropertyGraphKeyframe() -{ -} - -long CPropertyGraphKeyframe::GetTime() -{ - return m_KeyframeTime; -} - -long CPropertyGraphKeyframe::GetChannelIndex() const -{ - return m_ChannelIndex; -} - -void CPropertyGraphKeyframe::PositionKeyframe() -{ - long theXPos = ::TimeToPos(m_KeyframeTime, m_TimeRatio); - float theValue = GetKeyframeValue(); - long theYPos = (long)((1.0 - (theValue - m_MinVal) / (m_MaxVal - m_MinVal)) * (m_MaxY - m_MinY) - + m_MinY - GetSize().y / 2 + .5); - - if (theYPos < m_MinY) - theYPos = m_MinY; - else if (theYPos > m_MaxY) - theYPos = m_MaxY; - - SetPosition(CPt(theXPos, theYPos)); -} - -void CPropertyGraphKeyframe::SetTimeRatio(double inTimeRatio) -{ - m_TimeRatio = inTimeRatio; - PositionKeyframe(); -} - -float CPropertyGraphKeyframe::GetKeyframeValue() -{ - return m_Property->GetChannelValueAtTime(m_ChannelIndex, m_KeyframeTime); -} - -void CPropertyGraphKeyframe::SetKeyframeValue(float inValue) -{ - m_Property->SetChannelValueAtTime(m_ChannelIndex, m_KeyframeTime, inValue); -} - -void CPropertyGraphKeyframe::Draw(CRenderer *inRenderer) -{ - CPt mySize = GetSize(); - inRenderer->MoveTo(0, 0); - inRenderer->LineTo(mySize.x, 0); - inRenderer->LineTo(mySize.x, mySize.y); - inRenderer->LineTo(0, mySize.y); - inRenderer->LineTo(0, 0); - - if (m_IsMouseDown) { - inRenderer->FillSolidRect(CRct(GetSize()), CColor::black); - } -} - -bool CPropertyGraphKeyframe::OnMouseDown(CPt inPoint, Qt::KeyboardModifiers inFlags) -{ - if (!CControl::OnMouseDown(inPoint, inFlags)) { - m_IsMouseDown = true; - m_MouseDownLoc = inPoint; - } - return true; -} - -void CPropertyGraphKeyframe::OnMouseUp(CPt inPoint, Qt::KeyboardModifiers inFlags) -{ - CControl::OnMouseUp(inPoint, inFlags); - m_IsMouseDown = false; - m_Property->CommitChangedKeyframes(); - GetParent()->Invalidate(); -} - -void CPropertyGraphKeyframe::OnMouseMove(CPt inPoint, Qt::KeyboardModifiers inFlags) -{ - CControl::OnMouseMove(inPoint, inFlags); - - if (m_IsMouseDown) { - long theDiff = inPoint.y - m_MouseDownLoc.y; - long theYPos = GetPosition().y + theDiff; - if (theYPos < m_MinY) - theYPos = m_MinY; - if (theYPos > m_MaxY) - theYPos = m_MaxY; - SetPosition(GetPosition().x, theYPos); - - float theValue = (m_MaxVal - m_MinVal) - * (((m_MaxY + m_MinY) - theYPos - GetSize().y / 2) - m_MinY) / (m_MaxY - m_MinY) - + m_MinVal; - SetKeyframeValue(theValue); - - GetParent()->Invalidate(); - } -} diff --git a/src/Authoring/Studio/Palettes/Timeline/PropertyGraphKeyframe.h b/src/Authoring/Studio/Palettes/Timeline/PropertyGraphKeyframe.h deleted file mode 100644 index daffc8ab..00000000 --- a/src/Authoring/Studio/Palettes/Timeline/PropertyGraphKeyframe.h +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 NVIDIA Corporation. -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt 3D Studio. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef INCLUDED_PROPERTY_GRAPH_KEYFRAME_H -#define INCLUDED_PROPERTY_GRAPH_KEYFRAME_H 1 - -#pragma once - -#include "Control.h" - -class ITimelineItemProperty; - -class CPropertyGraphKeyframe : public CControl -{ -public: - CPropertyGraphKeyframe(ITimelineItemProperty *inProperty, long inChannelIndex, - long inKeyframeTime, double inTimeRatio, long inHeight, long inOffset, - float inMinVal, float inMaxVal); - virtual ~CPropertyGraphKeyframe(); - - void Draw(CRenderer *inRenderer) override; - - bool OnMouseDown(CPt inPoint, Qt::KeyboardModifiers inFlags) override; - void OnMouseUp(CPt inPoint, Qt::KeyboardModifiers inFlags) override; - void OnMouseMove(CPt inPoint, Qt::KeyboardModifiers inFlags) override; - - long GetTime(); - long GetChannelIndex() const; - void SetTimeRatio(double inTimeRatio); - void PositionKeyframe(); - -protected: - float GetKeyframeValue(); - void SetKeyframeValue(float inValue); - - ITimelineItemProperty *m_Property; - long m_ChannelIndex; // index that identifies the channel for a animated property - long m_KeyframeTime; - double m_TimeRatio; - float m_MinVal; - float m_MaxVal; - long m_MinY; - long m_MaxY; - CPt m_MouseDownLoc; - bool m_IsMouseDown; -}; -#endif // INCLUDED_PROPERTY_GRAPH_KEYFRAME_H diff --git a/src/Authoring/Studio/Palettes/Timeline/PropertyRow.cpp b/src/Authoring/Studio/Palettes/Timeline/PropertyRow.cpp deleted file mode 100644 index 1da7ee2c..00000000 --- a/src/Authoring/Studio/Palettes/Timeline/PropertyRow.cpp +++ /dev/null @@ -1,161 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2002 NVIDIA Corporation. -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt 3D Studio. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "stdafx.h" - -//============================================================================== -// Includes -//============================================================================== -#include "PropertyRow.h" - -#include "StudioPreferences.h" -#include "StateRow.h" -#include "Bindings/ITimelineItemProperty.h" - -//============================================================================= -/** - * Create a property row for inProperty. - * @param inProperty the property that this is displaying. - */ -CPropertyRow::CPropertyRow(ITimelineItemProperty *inProperty, CTimelineRow *parent) - : CTimelineRow(parent) - , m_Property(inProperty) -{ - m_IsViewable = true; -} - -CPropertyRow::~CPropertyRow() -{ -} - -//============================================================================= -/** - * Filter this property. - * This controls whether or not this row should be displayed. The filter will - * be stored and used for future operations that may change whether or not - * this should be visible. - * @param inFilter the filter to filter on. - * @param inFilterChildren true if the call is recursive. - */ -void CPropertyRow::Filter(const CFilter &inFilter, bool inFilterChildren /*= true*/) -{ - Q_UNUSED(inFilterChildren); - - m_Filter = inFilter; - - bool theVisibleFlag = inFilter.Filter(m_Property); - emit visibleChanged(theVisibleFlag); - m_IsViewable = theVisibleFlag; -} - -//============================================================================= -/** - * @return true if this property is animated and is not currently being filtered out - */ -bool CPropertyRow::IsViewable() const -{ - return m_Filter.GetProperties(); -} - -//============================================================================= -/** - * Call from one of the child controls to select this object. - * Currently this just causes the Asset to be selected. - */ -void CPropertyRow::Select(bool inIsShiftKeyPressed /*= false */) -{ - m_Property->SetSelected(); - - if (inIsShiftKeyPressed) - emit selectAllKeys(); - else - m_Property->ClearKeySelection(); -} - -bool CPropertyRow::IsSelected() const -{ - return false; // KDAB_TODO check! -} - -//============================================================================= -/** - * Retrieves the background color for the row based upon the type of asset - * passed in. Overridden so that properties can have a different background - * color than their parent asset does. - * @return background color to use for this row - */ -::CColor CPropertyRow::GetTimebarBackgroundColor() -{ - return CStudioPreferences::GetPropertyBackgroundColor(); -} - -//============================================================================= -/** - * Retrieves the background color for the row when the mouse is over the row - * based upon the type of asset passed in. Overridden so that properties can - * have a different highlight background color than their parent asset does. - * @return background color to use for this row when the mouse is over it - */ -::CColor CPropertyRow::GetTimebarHighlightBackgroundColor() -{ - return CStudioPreferences::GetPropertyMouseOverColor(); -} - -//============================================================================= -/** - * Set the amount of time that is represented by a pixel. - * This modifies the length of this control. - * @param inTimePerPixel the time per pixel. - */ -void CPropertyRow::SetTimeRatio(double inTimeRatio) -{ - m_TimeRatio = inTimeRatio; - emit timeRatioChanged(inTimeRatio); -} - -//============================================================================= -/** - * Deletes keyframes on this property row - */ -void CPropertyRow::DeleteAllKeys() -{ - m_Property->DeleteAllKeys(); - emit deleteAllKeys(); -} - - -//============================================================================= -/** - * Callback from the ITimelineProperty. - */ -void CPropertyRow::Refresh() -{ - emit refreshRequested(); -} - diff --git a/src/Authoring/Studio/Palettes/Timeline/PropertyRow.h b/src/Authoring/Studio/Palettes/Timeline/PropertyRow.h deleted file mode 100644 index 7b76b955..00000000 --- a/src/Authoring/Studio/Palettes/Timeline/PropertyRow.h +++ /dev/null @@ -1,103 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2002 NVIDIA Corporation. -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt 3D Studio. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef INCLUDED_PROPERTY_ROW_H -#define INCLUDED_PROPERTY_ROW_H 1 - -#pragma once - -//============================================================================== -// Includes -//============================================================================== - -#include "AbstractTimelineRowUI.h" -#include "TimelineRow.h" -#include "StateRow.h" -#include "Rct.h" -#include <vector> - -//============================================================================== -// Forwards -//============================================================================== -class CPropertyColorControl; -class CBlankControl; -class CPropertyTreeControl; -class ITimelineItemProperty; - -class CPropertyRow : public CTimelineRow -{ - Q_OBJECT -public: - CPropertyRow(ITimelineItemProperty *inProperty, CTimelineRow *parent); - virtual ~CPropertyRow(); - - void SetTimeRatio(double inTimePerPixel) override; - void Filter(const CFilter &inFilter, bool inFilterChildren = true) override; - - void Select(Qt::KeyboardModifiers inKeyState, bool inCheckKeySelection = true) override {} - void Select(bool inIsShiftKeyPressed = false); - bool IsSelected() const override; - - void DeleteAllKeys(); - bool IsViewable() const override; - - using CTimelineRow::GetTimebarBackgroundColor; - virtual ::CColor GetTimebarBackgroundColor(); - using CTimelineRow::GetTimebarHighlightBackgroundColor; - virtual ::CColor GetTimebarHighlightBackgroundColor(); - - void Refresh(); - ITimelineItemProperty *GetProperty() const { return m_Property; } - - void setExpanded(bool expanded) { m_Expanded = expanded; } - bool expanded() const { return m_Expanded; } - - void Expand(bool inExpandAll = false, bool inExpandUp = false) override {} - void Collapse(bool inCollapseAll = false) override {} - bool CalculateActiveStartTime() override { return true; } - bool CalculateActiveEndTime() override { return true; } - - // not implemented methods - void Initialize(ITimelineItemBinding *) override {} - void LoadChildren() override {} - bool HasVisibleChildren() override {return false;} - -Q_SIGNALS: - void visibleChanged(bool visible); - void deleteAllKeys(); - void selectAllKeys(); - void refreshRequested(); - - -protected: - CFilter m_Filter; - ITimelineItemProperty *m_Property; - bool m_Expanded = false; -}; -#endif // INCLUDED_PROPERTY_CONTROL_H diff --git a/src/Authoring/Studio/Palettes/Timeline/PropertyTimebarGraph.cpp b/src/Authoring/Studio/Palettes/Timeline/PropertyTimebarGraph.cpp deleted file mode 100644 index ecd3b5df..00000000 --- a/src/Authoring/Studio/Palettes/Timeline/PropertyTimebarGraph.cpp +++ /dev/null @@ -1,234 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 NVIDIA Corporation. -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt 3D Studio. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "stdafx.h" - -#include "PropertyTimebarGraph.h" -#include "IKeyframe.h" -#include "Renderer.h" -#include "PropertyGraphKeyframe.h" -#include "Bindings/ITimelineItemProperty.h" -#include "StudioUtils.h" - -//============================================================================= -/** - * Create a graph for the specified property. - * @param inProperty the property this is graphing. - */ -CPropertyTimebarGraph::CPropertyTimebarGraph(ITimelineItemProperty *inProperty) - : m_Property(inProperty) - , m_TimeRatio(0.0f) - , m_MaxVal(0.0f) - , m_MinVal(0.0f) - , m_MinY(0) - , m_MaxY(0) -{ -} - -CPropertyTimebarGraph::~CPropertyTimebarGraph() -{ - TKeyframeList::iterator thePos = m_Keyframes.begin(); - for (; thePos != m_Keyframes.end(); ++thePos) - delete (*thePos); -} - -//============================================================================= -/** - * Toggle whether this is visible or not. - * Overrides CControl::SetVisible. If this is not visible then it removes - * a bunch of the refresh logic to speed stuff up. - * @param inIsVisible true if this control is to be visible. - */ -void CPropertyTimebarGraph::SetVisible(bool inIsVisible) -{ - CControl::SetVisible(inIsVisible); - - // If this is visible then add the appropriate keyframes and listeners. - if (inIsVisible) { - m_MaxVal = m_Property->GetMaximumValue(); - m_MinVal = m_Property->GetMinimumValue(); - - m_MinY = 10; - m_MaxY = GetSize().y - m_MinY; - - RefreshKeyframes(); - } else - RemoveKeyframes(); -} - -//============================================================================= -/** - * Set the time ratio for this display. - * The time ratio controls how much time is displayed in how much space. - * @param inTimeRatio the time ratio. - */ -void CPropertyTimebarGraph::SetTimeRatio(double inTimeRatio) -{ - m_TimeRatio = inTimeRatio; -} - -//============================================================================= -/** - * Draw this to the specified renderer. - * This will perform the graphing of all the channels on the property. - * @param inRenderer the renderer to draw to. - */ -void CPropertyTimebarGraph::Draw(CRenderer *inRenderer) -{ - CRct theRect(CPt(0, 0), GetSize()); - inRenderer->PushClippingRect(theRect); - - // the available line colors, tried to use Rainbow.bvs code to do it dynamically but didn't - // quite work. - ::CColor theColors[6] = { ::CColor(255, 0, 0), ::CColor(0, 255, 0), ::CColor(0, 0, 255), - ::CColor(255, 255, 0), ::CColor(255, 0, 255), ::CColor(0, 255, 255) }; - - long theChannelCount = m_Property->GetChannelCount(); - // Don't want to overflow the color array - if (theChannelCount <= 6) { - // For each channel graph it. - for (long theIndex = 0; theIndex < theChannelCount; ++theIndex) - DrawDetailedChannel(inRenderer, theIndex, theColors[theIndex]); - } - - inRenderer->PopClippingRect(); -} - -void CPropertyTimebarGraph::DrawDetailedChannel(CRenderer *inRenderer, long inChannelIndex, - ::CColor inColor) -{ - inRenderer->PushPen(inColor, 2); - - CRct theClipRect = inRenderer->GetClippingRect(); - float theValue = m_Property->GetChannelValueAtTime(inChannelIndex, 0); - long theYPos = (long)((1.0 - (theValue - m_MinVal) / (m_MaxVal - m_MinVal)) * (m_MaxY - m_MinY) - + m_MinY + .5); - - inRenderer->MoveTo(CPt(0, theYPos)); - - long theInterval = 5; - long theSize = theClipRect.position.x + theClipRect.size.x + theInterval; - - for (long thePixel = theClipRect.position.x; thePixel < theSize; thePixel += theInterval) { - long theTime = ::PosToTime(thePixel, m_TimeRatio); //(long)( thePixel / m_TimeRatio + .5 ); - theValue = m_Property->GetChannelValueAtTime(inChannelIndex, theTime); - theYPos = (long)((1.0 - (theValue - m_MinVal) / (m_MaxVal - m_MinVal)) * (m_MaxY - m_MinY) - + m_MinY + .5); - - inRenderer->LineTo(CPt(thePixel, theYPos)); - } - - inRenderer->PopPen(); -} - -void CPropertyTimebarGraph::AddKeyframes() -{ - long theChannelCount = m_Property->GetChannelCount(); - long theKeyframeCount = - m_Property->GetKeyframeCount(); // the way it works now (and hence the assumption is), the - // number of keyframes for all the channels is the same. - for (long theIndex = 0; theIndex < theChannelCount; ++theIndex) { - for (long theKeyIndex = 0; theKeyIndex < theKeyframeCount; ++theKeyIndex) { - CPropertyGraphKeyframe *theGraphKeyframe = new CPropertyGraphKeyframe( - m_Property, theIndex, m_Property->GetKeyframeByIndex(theKeyIndex)->GetTime(), - m_TimeRatio, m_MinY, m_MaxY, m_MinVal, m_MaxVal); - AddChild(theGraphKeyframe); - m_Keyframes.push_back(theGraphKeyframe); - } - } -} - -void CPropertyTimebarGraph::Invalidate(bool inIsInvalidated) -{ - CControl::Invalidate(inIsInvalidated); - - if (inIsInvalidated && GetParent() != nullptr) { - GetParent()->Invalidate(inIsInvalidated); - } -} - -void CPropertyTimebarGraph::RemoveKeyframes() -{ - TKeyframeList::iterator thePos = m_Keyframes.begin(); - for (; thePos != m_Keyframes.end(); ++thePos) { - CPropertyGraphKeyframe *theKeyframe = (*thePos); - RemoveChild(theKeyframe); - delete theKeyframe; - } - m_Keyframes.clear(); -} - -void CPropertyTimebarGraph::RefreshKeyframes() -{ - TKeyframeList::iterator thePos = m_Keyframes.begin(); - while (thePos != m_Keyframes.end()) { - CPropertyGraphKeyframe *theKeyframe = (*thePos); - if (m_Property->GetKeyframeByTime(theKeyframe->GetTime())) { - theKeyframe->PositionKeyframe(); - ++thePos; - } else { - RemoveChild(theKeyframe); - delete theKeyframe; - thePos = m_Keyframes.erase(thePos); - } - } - long theChannelCount = m_Property->GetChannelCount(); - long theKeyframeCount = - m_Property->GetKeyframeCount(); // the way it works now (and hence the assumption is), the - // number of keyframes for all the channels is the same. - for (long theIndex = 0; theIndex < theChannelCount; ++theIndex) { - for (long theKeyIndex = 0; theKeyIndex < theKeyframeCount; ++theKeyIndex) { - IKeyframe *theKeyframe = m_Property->GetKeyframeByIndex(theKeyIndex); - CPropertyGraphKeyframe *theExistingKeyframe = - GetKeyframe(theKeyframe->GetTime(), theIndex); - if (!theExistingKeyframe) { - CPropertyGraphKeyframe *theGraphKeyframe = - new CPropertyGraphKeyframe(m_Property, theIndex, theKeyframe->GetTime(), - m_TimeRatio, m_MinY, m_MaxY, m_MinVal, m_MaxVal); - AddChild(theGraphKeyframe); - - m_Keyframes.push_back(theGraphKeyframe); - } - } - } - - Invalidate(); -} - -CPropertyGraphKeyframe *CPropertyTimebarGraph::GetKeyframe(long inTime, long inChannelIndex) -{ - TKeyframeList::iterator thePos = m_Keyframes.begin(); - for (; thePos != m_Keyframes.end(); ++thePos) { - CPropertyGraphKeyframe *theKeyframe = (*thePos); - if (theKeyframe->GetChannelIndex() == inChannelIndex && theKeyframe->GetTime() == inTime) { - return theKeyframe; - } - } - return nullptr; -} diff --git a/src/Authoring/Studio/Palettes/Timeline/PropertyTimebarGraph.h b/src/Authoring/Studio/Palettes/Timeline/PropertyTimebarGraph.h deleted file mode 100644 index 76379bcd..00000000 --- a/src/Authoring/Studio/Palettes/Timeline/PropertyTimebarGraph.h +++ /dev/null @@ -1,70 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 NVIDIA Corporation. -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt 3D Studio. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef INCLUDED_PROPERTY_TIMEBAR_GRAPH_H -#define INCLUDED_PROPERTY_TIMEBAR_GRAPH_H 1 - -#pragma once - -#include "Control.h" -#include "CColor.h" - -class CPropertyGraphKeyframe; -class ITimelineItemProperty; - -class CPropertyTimebarGraph : public CControl -{ - typedef std::vector<CPropertyGraphKeyframe *> TKeyframeList; - -public: - CPropertyTimebarGraph(ITimelineItemProperty *inProperty); - virtual ~CPropertyTimebarGraph(); - void SetVisible(bool inIsVisible) override; - void Draw(CRenderer *inRenderer) override; - void SetTimeRatio(double inTimeRatio); - void Invalidate(bool inIsInvalidated = true) override; - void RefreshKeyframes(); - -protected: - void DrawDetailedChannel(CRenderer *inRenderer, long inChannelIndex, ::CColor inColor); - void AddKeyframes(); - void RemoveKeyframes(); - - CPropertyGraphKeyframe *GetKeyframe(long inTime, long inChannelIndex); - -protected: - ITimelineItemProperty *m_Property; - double m_TimeRatio; - TKeyframeList m_Keyframes; - float m_MaxVal; - float m_MinVal; - long m_MinY; - long m_MaxY; -}; -#endif // INCLUDED_PROPERTY_TIMEBAR_GRAPH_H diff --git a/src/Authoring/Studio/Palettes/Timeline/ScalableScroller.cpp b/src/Authoring/Studio/Palettes/Timeline/ScalableScroller.cpp deleted file mode 100644 index b445db83..00000000 --- a/src/Authoring/Studio/Palettes/Timeline/ScalableScroller.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 NVIDIA Corporation. -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt 3D Studio. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "stdafx.h" - -#include "ScalableScroller.h" -#include "ScalableScrollerBar.h" - -CScalableScroller::CScalableScroller() - : CScroller(false) - , m_ScalableBar(nullptr) - , m_ScalingListener(nullptr) -{ - Initialize(); -} - -CScalableScroller::~CScalableScroller() -{ -} - -CScrollerBar *CScalableScroller::CreateHorizontalBar() -{ - if (m_ScalableBar == nullptr) { - m_ScalableBar = new CScalableBar(this); - m_ScalableBar->SetOrientation(CScrollerBar::HORIZONTAL); - m_ScalableBar->SetScalingListener(m_ScalingListener); - } - return m_ScalableBar; -} - -void CScalableScroller::SetScalingListener(CScalingListener *inListener) -{ - m_ScalingListener = inListener; - - if (m_ScalableBar != nullptr) { - m_ScalableBar->SetScalingListener(inListener); - } -} - -//==================================================================== -/** - * Protected function for seting the display size of the scroller. - * Overridden because the scaleable scroller thumb at the bottom of - * the timeline was getting messed up. Yes, it's a hack, but I couldn't - * fix it any other way. - */ -void CScalableScroller::SetVisibleSize(CPt inSize) -{ - m_VisibleSize = inSize; - - // Don't call the base class because it messes things up -} diff --git a/src/Authoring/Studio/Palettes/Timeline/ScalableScroller.h b/src/Authoring/Studio/Palettes/Timeline/ScalableScroller.h deleted file mode 100644 index 9fd6df3b..00000000 --- a/src/Authoring/Studio/Palettes/Timeline/ScalableScroller.h +++ /dev/null @@ -1,57 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 NVIDIA Corporation. -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt 3D Studio. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef INCLUDED_SCALABLE_SCROLLER_H -#define INCLUDED_SCALABLE_SCROLLER_H 1 - -#pragma once - -#include "Scroller.h" - -class CScalingListener; -class CScalableBar; - -class CScalableScroller : public CScroller -{ -public: - CScalableScroller(); - virtual ~CScalableScroller(); - - void SetScalingListener(CScalingListener *inScalingListener); - - void SetVisibleSize(CPt inSize) override; - -protected: - CScrollerBar *CreateHorizontalBar() override; - - CScalableBar *m_ScalableBar; - - CScalingListener *m_ScalingListener; -}; -#endif // INCLUDED_SCALABLE_SCROLLER_H diff --git a/src/Authoring/Studio/Palettes/Timeline/ScalableScrollerBar.cpp b/src/Authoring/Studio/Palettes/Timeline/ScalableScrollerBar.cpp deleted file mode 100644 index f0822f0f..00000000 --- a/src/Authoring/Studio/Palettes/Timeline/ScalableScrollerBar.cpp +++ /dev/null @@ -1,348 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 NVIDIA Corporation. -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt 3D Studio. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "stdafx.h" - -#include "ScrollerBackground.h" -#include "ScalableScrollerBar.h" -#include "ScalableScroller.h" -#include "Renderer.h" -#include "MouseCursor.h" -#include "ResourceCache.h" - -#include <QApplication> - -//============================================================================= -/** - * Creates a new ThumbTab (the scalable ends of the thumb). - * @param inThumb the thumb this belongs to. - * @param inIsRight true if this is the right side, false for left. - * @param inBar the ScalableBar this belongs to. - */ -CScalableThumbTab::CScalableThumbTab(CScalableThumb *inThumb, bool inIsRightTab, - CScalableBar *inBar) - : m_Bar(inBar) - , m_IsMouseDown(false) - , m_IsRightTab(inIsRightTab) -{ - m_Thumb = inThumb; -} - -CScalableThumbTab::~CScalableThumbTab() -{ -} - -//============================================================================= -/** - * MouseOver handler, modifies the cursor. - * @param inPoint the mouse location. - * @param inFlags the mouse state. - */ -void CScalableThumbTab::OnMouseOver(CPt inPoint, Qt::KeyboardModifiers inFlags) -{ - CControl::OnMouseOver(inPoint, inFlags); - - setCursorIfNotSet(CMouseCursor::CURSOR_RESIZE_LEFTRIGHT); - Invalidate(); -} - -//============================================================================= -/** - * Mouse out handler, invalidates the control to clear the mouse over drawing. - * @param inPoint the location of the mouse. - * @param inFlags the state of the mouse. - */ -void CScalableThumbTab::OnMouseOut(CPt inPoint, Qt::KeyboardModifiers inFlags) -{ - CControl::OnMouseOut(inPoint, inFlags); - - if (!m_IsMouseDown) - resetCursor(); - - Invalidate(); -} - -//============================================================================= -/** - * Mouse move handlers, if this was clicked on then drags the control. - * @param inPoint the location of the mouse. - * @param inFlags the state of the mouse. - */ -void CScalableThumbTab::OnMouseMove(CPt inPoint, Qt::KeyboardModifiers inFlags) -{ - CControl::OnMouseMove(inPoint, inFlags); - - // Only drag if this was clicked on - if (m_IsMouseDown) { - long theDiff = inPoint.x - m_MouseDownLoc.x; - // Fire the scaling event for the delta size. - if (m_IsRightTab) - m_Bar->OnScalingRight(theDiff); - else - m_Bar->OnScalingLeft(theDiff); - } - - CRct theRect(GetSize()); - if (theRect.IsInRect(inPoint)) - setCursorIfNotSet(CMouseCursor::CURSOR_RESIZE_LEFTRIGHT); -} - -//============================================================================= -/** - * Mouse click handler, starts resizing the control. - * @param inPoint the location of the mouse. - * @param inFlags the state of the mouse. - */ -bool CScalableThumbTab::OnMouseDown(CPt inPoint, Qt::KeyboardModifiers inFlags) -{ - CControl::OnMouseDown(inPoint, inFlags); - - setCursorIfNotSet(CMouseCursor::CURSOR_RESIZE_LEFTRIGHT); - m_IsMouseDown = true; - m_MouseDownLoc = inPoint; - - return true; -} - -//============================================================================= -/** - * Mouse up handler, ends resizing this control. - * @param inPoint the location of the mouse. - * @param inFlags the state of the mouse. - */ -void CScalableThumbTab::OnMouseUp(CPt inPoint, Qt::KeyboardModifiers inFlags) -{ - CControl::OnMouseUp(inPoint, inFlags); - - resetCursor(); - - m_IsMouseDown = false; -} - -//============================================================================= -/** - * Draw this control. - * @param inRenderer the renderer to draw to. - */ -void CScalableThumbTab::Draw(CRenderer *inRenderer) -{ - CPt theSize = GetSize(); - CRct theRect(theSize); - - inRenderer->FillSolidRect(theRect, CStudioPreferences::GetScrollThumbHighlightColor()); -} - -//============================================================================= -/** - * Create a scalable thumb, this is the dragging component of the bar. - * @param inScrollerBar the bar this belongs to. - */ -CScalableThumb::CScalableThumb(CScalableBar *inScrollerBar) - : CScrollerThumb(inScrollerBar) - , m_LeftTab(this, false, inScrollerBar) - , m_RightTab(this, true, inScrollerBar) -{ - m_ScrollerBar = inScrollerBar; - - m_LeftTab.SetPosition(CPt(0, 0)); - - AddChild(&m_LeftTab); - AddChild(&m_RightTab); -} - -CScalableThumb::~CScalableThumb() -{ -} - -//============================================================================= -/** - * Set the size of this component, overrides to update the location of the tabs. - * @param inSize the new size of this control. - */ -void CScalableThumb::SetSize(CPt inSize) -{ - CScrollerThumb::SetSize(inSize); - m_LeftTab.SetSize(CPt(7, inSize.y)); - m_RightTab.SetSize(CPt(7, inSize.y)); - m_RightTab.SetPosition(CPt(inSize.x - m_RightTab.GetSize().x, 0)); -} - -//============================================================================= -/** - * On double click this sends off a reset scaling notification. - * @param inPoint the mouse location. - * @param inFlags the state of the mouse. - */ -bool CScalableThumb::OnMouseDoubleClick(CPt inPoint, Qt::KeyboardModifiers inFlags) -{ - if (!CControl::OnMouseDoubleClick(inPoint, inFlags)) - m_ScrollerBar->OnScalingReset(); - - return true; -} - -//============================================================================= -/** - * Creates a new scalable scroller bar. - * This object can only be used for horizontal scrolling. - * @param inScroller the scalable scroller this is operating on. - */ -CScalableBar::CScalableBar(CScalableScroller *inScroller) - : CScrollerBar(inScroller, false) - , m_ScalableScroller(inScroller) - , m_Listener(nullptr) - , m_Thumb(nullptr) -{ - Initialize(); -} - -CScalableBar::~CScalableBar() -{ -} - -//============================================================================= -/** - * Create a new thumb control. - * This method is here so the ScalableBar can override it and return the Scalable - * Thumb instead of a normal thumb. - */ -CControl *CScalableBar::CreateThumb() -{ - if (m_Thumb == nullptr) - m_Thumb = new CScalableThumb(this); - return m_Thumb; -} - -//============================================================================= -/** - * This control is not allowed to become disabled (it should always allow scaling). - * @param inIsEnabled ignored. - */ -void CScalableBar::SetEnabled(bool inIsEnabled) -{ - Q_UNUSED(inIsEnabled); - CControl::SetEnabled(true); -} - -//============================================================================= -/** - * Set the single scaling listener that is to carry out the actual scaling work. - * @param inListener the scaling listener, there is only one. - */ -void CScalableBar::SetScalingListener(CScalingListener *inListener) -{ - m_Listener = inListener; -} - -//============================================================================= -/** - * Event from the left ThumbTab that it is scaling. - * @param inAmount the amount that the left ThumbTab is being scaled by. - */ -void CScalableBar::OnScalingLeft(long inAmount) -{ - CPt theLoc = m_Thumb->GetPosition(); - CPt theSize = m_Thumb->GetSize(); - - // Don't let the loc go before the end of the control. - if (theLoc.x + inAmount < 0) - inAmount = -theLoc.x; - - // Anchors the scroller position when its size reaches the minimum size - // The algorithm does not modify the inAmount as the scale can be further reduced, - // when the scroller reaches the minimum size. - - CPt thePreviousPosition; - bool theAnchor = false; - if (theSize.x - inAmount < m_Thumb->GetMinimumSize().x) { - thePreviousPosition = m_Thumb->GetPosition(); - theAnchor = true; - } - - // Tell the listener of the scaling, it's the listener that will do the actual scaling work. - if (m_Listener != nullptr) - m_Listener->OnScalingLeft(theSize.x - inAmount, m_Background->GetSize().x, - m_Thumb->GetPosition().x + inAmount); - - // When the Anchor flag is true (i.e. when the scroller has reach its minimum size), stop the - // scroller - // from moving by restoring its previous position. - if (theAnchor) { - m_Thumb->SetPosition(thePreviousPosition); - } - - Invalidate(); -} - -//============================================================================= -/** - * Event from the right ThumbTab that it is scaling. - * @param inAmount the amount that the left ThumbTab is being scaled by. - */ -void CScalableBar::OnScalingRight(long inAmount) -{ - CPt theLoc = m_Thumb->GetPosition(); - CPt theSize = m_Thumb->GetSize(); - // Don't let the loc go after the end of the control. - if (theLoc.x + theSize.x + inAmount > m_Background->GetSize().x) - inAmount = m_Background->GetSize().x - (theLoc.x + theSize.x); - - // Anchors the scroller position when its size reaches the minimum size - // The algorithm does not modify the inAmount as the scale can be further reduced, - // when the scroller reaches the minimum size. - - CPt thePreviousPosition; - bool theAnchor = false; - if (theSize.x + inAmount < m_Thumb->GetMinimumSize().x) { - thePreviousPosition = m_Thumb->GetPosition(); - theAnchor = true; - } - - // Tell the listener of the scaling, it's the listener that will do the actual scaling work. - if (m_Listener != nullptr) - m_Listener->OnScalingRight(theSize.x + inAmount, m_Background->GetSize().x, - m_Thumb->GetPosition().x); - - // When the Anchor flag is true (i.e. when the scroller has reach its minimum size), stop the - // scroller - // from moving by restoring its previous position. - if (theAnchor) { - m_Thumb->SetPosition(thePreviousPosition); - } - Invalidate(); -} - -//============================================================================= -/** - * Handles scaling reset messages commands, just routes them to the listener. - */ -void CScalableBar::OnScalingReset() -{ - m_Listener->OnScalingReset(); -} diff --git a/src/Authoring/Studio/Palettes/Timeline/ScalableScrollerBar.h b/src/Authoring/Studio/Palettes/Timeline/ScalableScrollerBar.h deleted file mode 100644 index afc0ef1e..00000000 --- a/src/Authoring/Studio/Palettes/Timeline/ScalableScrollerBar.h +++ /dev/null @@ -1,112 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 NVIDIA Corporation. -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt 3D Studio. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef INCLUDED_SCALABLE_SCROLLER_BAR_H -#define INCLUDED_SCALABLE_SCROLLER_BAR_H 1 - -#pragma once - -#include "ScrollerThumb.h" -#include "ScrollerBar.h" - -#include <QCursor> - -class CScalableBar; -class CScalableScroller; -class CScalableThumb; - -class CScalingListener -{ -public: - virtual void OnScalingLeft(long inLength, long inTotalLength, long inOffset) = 0; - virtual void OnScalingRight(long inLength, long inTotalLength, long inOffset) = 0; - virtual void OnScalingReset() = 0; -}; - -class CScalableThumbTab : public CControl -{ -public: - CScalableThumbTab(CScalableThumb *inThumb, bool inIsRightTab, CScalableBar *inBar); - virtual ~CScalableThumbTab(); - - void Draw(CRenderer *inRenderer) override; - - void OnMouseOver(CPt inPoint, Qt::KeyboardModifiers inFlags) override; - void OnMouseOut(CPt inPoint, Qt::KeyboardModifiers inFlags) override; - void OnMouseMove(CPt inPoint, Qt::KeyboardModifiers inFlags) override; - bool OnMouseDown(CPt inPoint, Qt::KeyboardModifiers inFlags) override; - void OnMouseUp(CPt inPoint, Qt::KeyboardModifiers inFlags) override; - -protected: - CScalableThumb *m_Thumb; - CScalableBar *m_Bar; - bool m_IsMouseDown; - bool m_IsRightTab; - CPt m_MouseDownLoc; -}; - -class CScalableThumb : public CScrollerThumb -{ -public: - CScalableThumb(CScalableBar *inScrollerBar); - virtual ~CScalableThumb(); - - void SetSize(CPt inSize) override; - bool OnMouseDoubleClick(CPt inPoint, Qt::KeyboardModifiers inFlags) override; - -protected: - CScalableBar *m_ScrollerBar; - CScalableThumbTab m_LeftTab; - CScalableThumbTab m_RightTab; -}; - -class CScalableBar : public CScrollerBar -{ -public: - CScalableBar(CScalableScroller *inScroller); - virtual ~CScalableBar(); - - void SetEnabled(bool inIsEnabled) override; - - void SetScalingListener(CScalingListener *inListener); - - void OnScalingRight(long inAmount); - void OnScalingLeft(long inAmount); - void OnScalingReset(); - -protected: - CControl *CreateThumb() override; - - CScalableScroller *m_ScalableScroller; - - CScalingListener *m_Listener; - CScalableThumb *m_Thumb; -}; - -#endif // INCLUDED_SCALABLE_SCROLLER_BAR_H diff --git a/src/Authoring/Studio/Palettes/Timeline/SlideRow.cpp b/src/Authoring/Studio/Palettes/Timeline/SlideRow.cpp deleted file mode 100644 index 04dfe7fc..00000000 --- a/src/Authoring/Studio/Palettes/Timeline/SlideRow.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 NVIDIA Corporation. -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt 3D Studio. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "stdafx.h" - -#include "SlideRow.h" -#include "ColorControl.h" -#include "Bindings/ITimelineItemBinding.h" - -CSlideRow::CSlideRow(CTimelineRow *parent) - : CBaseStateRow(parent) -{ -} - -CSlideRow::~CSlideRow() -{ -} - -//============================================================================= -/** - * Expand this node of the tree control. - * This will display all children the fit the filter. - */ -void CSlideRow::Expand(bool inExpandAll /*= false*/, bool inExpandUp) -{ - if (!m_Loaded) { - m_Loaded = true; - LoadChildren(); - } - - CBaseStateRow::Expand(inExpandAll, inExpandUp); -} - -//============================================================================= -/** - * This do not 'contribute' to its child's active start time - */ -bool CSlideRow::CalculateActiveStartTime() -{ - return false; -} -//============================================================================= -/** - * This do not 'contribute' to its child's active end time - */ -bool CSlideRow::CalculateActiveEndTime() -{ - return false; -} - -bool CSlideRow::PerformFilter(const CFilter &inFilter) -{ - Q_UNUSED(inFilter); - return true; -} diff --git a/src/Authoring/Studio/Palettes/Timeline/SlideRow.h b/src/Authoring/Studio/Palettes/Timeline/SlideRow.h deleted file mode 100644 index cccc550c..00000000 --- a/src/Authoring/Studio/Palettes/Timeline/SlideRow.h +++ /dev/null @@ -1,57 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 NVIDIA Corporation. -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt 3D Studio. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef INCLUDED_TIME_CONTEXT_ROW_H -#define INCLUDED_TIME_CONTEXT_ROW_H 1 - -#pragma once - -#include "BaseStateRow.h" - -class ISnappingListProvider; -class ITimelineControl; - -class CSlideRow : public CBaseStateRow -{ - Q_OBJECT -public: - CSlideRow(CTimelineRow *parent); - virtual ~CSlideRow(); - - // BaseStateRow - void Expand(bool inExpandAll = false, bool inExpandUp = false) override; - bool CalculateActiveStartTime() override; - bool CalculateActiveEndTime() override; - -protected: - // CBaseStateRow - bool PerformFilter(const CFilter &inFilter) override; - -}; -#endif // INCLUDED_TIME_CONTEXT_ROW_H diff --git a/src/Authoring/Studio/Palettes/Timeline/Snapper.cpp b/src/Authoring/Studio/Palettes/Timeline/Snapper.cpp deleted file mode 100644 index 2b405e70..00000000 --- a/src/Authoring/Studio/Palettes/Timeline/Snapper.cpp +++ /dev/null @@ -1,455 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 NVIDIA Corporation. -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt 3D Studio. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "stdafx.h" - -#include "Snapper.h" -#include "StudioPreferences.h" -#include "Control.h" -#include "CoreUtils.h" -#include "StudioUtils.h" -#include "HotKeys.h" - -//============================================================================= -/** - * Create a new snapper object. - * @param inTimeRatio the default time ratio. - */ -CSnapper::CSnapper(double inTimeRatio) - : m_theStartTime(0) - , m_theEndTime(0) - , m_TimeRatio(inTimeRatio) - , m_IsSnappingKeyframes(false) - , m_IsSnappingSelectedKeyframes(true) - , m_Offset(0) - , m_StartHeight(0) - , m_EndHeight(0) - , m_PeriodicInterval(LONG_MAX) - , m_InitialOffset(0) - , m_ObjectTimeOffset(0) - , m_TimeOffset(0) - , m_KeyFrameClicked(false) - , m_Source(nullptr) -{ - SetSnappingDistance(CStudioPreferences::GetSnapRange()); -} - -CSnapper::~CSnapper() -{ -} -//============================================================================= -/** - * Set if keyframe is clicked - * @param inKeyFrameClicked toggles snapping to end handles at 1 pixel range, - * if true. - */ -void CSnapper::SetKeyFrameClicked(bool inKeyFrameClicked) -{ - m_KeyFrameClicked = inKeyFrameClicked; -} -//============================================================================= -/** - * Clear all the snapping points from this. - * This effectively erases this object. - */ -void CSnapper::Clear() -{ - m_PeriodicInterval = LONG_MAX; - m_Times.clear(); - m_KeyFrameClicked = false; - SetSnappingDistance(CStudioPreferences::GetSnapRange()); -} - -//============================================================================= -/** - * Add a snapping point at the specified time. - * @param inTime the time to add the point at. - */ -void CSnapper::AddTime(long inTime) -{ - m_Times.insert(inTime); -} - -//============================================================================= -/** - * Add a snapping point at the specified pixel location. - * @param inPosition the position of the snapping point to add. - */ -void CSnapper::AddPixelLocation(long inPosition) -{ - AddTime(::PosToTime(inPosition, m_TimeRatio)); -} - -//============================================================================= -/** - * Set whether or not keyframes should be added as snapping points. - * @param true if keyframes should be added as snapping points. - */ -void CSnapper::SetSnappingKeyframes(bool inIsSnappingKeyframes) -{ - m_IsSnappingKeyframes = inIsSnappingKeyframes; -} - -//============================================================================= -/** - * Checks whether or not keyframes are being snapped to. - * @return true if keyframes should be snapped to. - */ -bool CSnapper::IsSnappingKeyframes() -{ - return m_IsSnappingKeyframes; -} - -//============================================================================= -/** - * Sets whether or not selected keyframes are being snapped to. - * This is used to ignore all selected keyframes when keyframes are being - * dragged. - * @param inIsSnappingSelectedKeyframes true if selected keys should be snapped. - */ -void CSnapper::SetSnappingSelectedKeyframes(bool inIsSnappingSelectedKeyframes) -{ - m_IsSnappingSelectedKeyframes = inIsSnappingSelectedKeyframes; -} - -//============================================================================= -/** - * Checks whether or not selected keyframes are being snapped to. - * This is used to ignore all selected keyframes when keyframes are being - * dragged. - * @return true if selected keyframes should be snapping points. - */ -bool CSnapper::IsSnappingSelectedKeyframes() -{ - return m_IsSnappingKeyframes && m_IsSnappingSelectedKeyframes; -} - -//============================================================================= -/** - * Set the current time ratio. - * This will effect all time based positions as well as the intervals. It is - * suggested that this is called on an empty snapper when possible for speed. - * @param inTimeRatio the new time ratio. - */ -void CSnapper::SetTimeRatio(double inTimeRatio) -{ - m_SnapDistance = ::dtol(m_SnapDistance * m_TimeRatio / inTimeRatio); - m_TimeRatio = inTimeRatio; -} - -//============================================================================= -/** - * Set the visible area of this snapper. - * This is used to limit snapping to visible areas only. The visibility limit - * is only on vertical because the user can scroll horizontally and expose - * previously non visible objects. The heights are relative to the initial - * offset and - * @param inStartHeight the minimum height for visibility. - * @param inEndHeight the maximum height for visibility. - */ -void CSnapper::SetVisibleArea(long inStartHeight, long inEndHeight) -{ - m_StartHeight = inStartHeight; - m_EndHeight = inEndHeight; -} - -//============================================================================= -/** - * Push an offset into this for calculating later visibilities. - * This is accumulated with previous offsets. - * @param inHeight the amount to modify the offset by. - */ -void CSnapper::PushOffset(long inHeight) -{ - m_Offsets.push_back(inHeight); - m_Offset += inHeight; -} - -//============================================================================= -/** - * Remove an offset that was pushed on. - * This will update the current offset to be what it was before the push. - */ -void CSnapper::PopOffset() -{ - m_Offset -= m_Offsets.back(); - m_Offsets.pop_back(); -} - -//============================================================================= -/** - * Checks to see if an object at inPosition of height inHeight is visible. - * This uses the current offset with the visible area to check visibility. - * @param inPosition the position of the object to be checked. - * @param inHeight the height of the object to be checked. - */ -bool CSnapper::IsVisible(long inPosition, long inHeight) -{ - return (inPosition + m_Offset < m_EndHeight - && inPosition + m_Offset + inHeight > m_StartHeight); -} - -//============================================================================= -/** - * Add a periodic interval to the snapping points. - * This will make snapping points at every multiple of inInterval. The interval - * starts at time 0. - * @param inInterval time in millis for the periodic points. - */ -void CSnapper::SetPeriodicInterval(long inInterval) -{ - m_PeriodicInterval = inInterval; -} - -//============================================================================= -/** - * Interpret the given position into a snapped/nonsnapped position. - * This will use the inFlags to determine whether or not this should be snapping - * and uses inPosition to figure out the closest snapping position. If the - * closest position is not within the tolerances then inPosition will be - * returned. - * @param inPosition to position to check for snapping. - * @param inFlags the mouse state flags, to determine whether or not snapping. - */ -bool CSnapper::InterpretTimeEx(long &ioTime, long inFlags) -{ - // Only snap if shift key is down. - if (inFlags & CHotKeys::MODIFIER_SHIFT) - return GetSnapTime(ioTime, true); - else - return GetSnapTime(ioTime, false); -} - -//============================================================================= -/** - * Interpret the given position into a snapped/nonsnapped position. - * This will use the inFlags to determine whether or not this should be snapping - * and uses inPosition to figure out the closest snapping position. If the - * closest position is not within the tolerances then inPosition will be - * returned. - * @param inPosition to position to check for snapping. - * @param inFlags the mouse state flags, to determine whether or not snapping. - */ -long CSnapper::InterpretTime(long inTime, long inFlags) -{ - if (inFlags & CHotKeys::MODIFIER_SHIFT) { - GetSnapTime(inTime, true); - return inTime; - } - GetSnapTime(inTime, false); - return inTime; -} - -//============================================================================= -/** - * Set the maximum distance that snapping will occur at. - * This sets the maximum tolerances for a position to be away from a snapping - * point and still get snapped to it. - * @param inSnapDistance the snap distance, in pixels. - */ -void CSnapper::SetSnappingDistance(long inSnapDistance) -{ - m_SnapDistance = ::dtol(inSnapDistance / m_TimeRatio); -} - -//============================================================================= -/** - * Helper method to find the closer of two values to a third. - * If both values are the same distance then the first value will be returned. - * @param inFirst the first value to check the distance to inBase. - * @param inSecond the second value to check the distance to inBase. - * @param inBase the value the others are being compared to. - * @return the value, either first or second, that is closest to inBase. - */ -long GetClosestValue(long inFirst, long inSecond, long inBase) -{ - return (::labs(inFirst - inBase) <= ::labs(inSecond - inBase)) ? inFirst : inSecond; -} - -//============================================================================= -/** - * Given the current time, it is adjusted if necessary to snap. - * @param ioTime the current time on input; on output the adjusted time - * @param inShiftKeyDown true if the shift key was down, otherwise false - * @return true if a snap occurred, otherwise false - */ -bool CSnapper::GetSnapTime(long &ioTime, bool inShiftKeyDown) -{ - bool theReturnValue = false; - - if (inShiftKeyDown) // If user hits the shift key (i.e. snapping is toggled on) - { - long thePreviousTime = 0; - long theNextTime = 0; - - // Go through all the snapping positions finding the positions on either - // side of ioPosition. Bsically just loop through until a snap position - // is larger than in position and use that with the previous value to get - // the closest snapping location. - TTimeList::iterator thePos = m_Times.begin(); - for (; thePos != m_Times.end(); ++thePos) { - thePreviousTime = theNextTime; - theNextTime = (*thePos); - - // Don't need to go any further because we've hit the first point larget than - // ioPosition. - if (theNextTime >= ioTime) { - break; - } - } - - // Use the last snap position less than ioPosition and the first snap position greater than - // ioPosition - // to find the closest of the two. - long theClosestTime = GetClosestValue(thePreviousTime, theNextTime, ioTime); - long theClosestInterval = GetClosestPeriodicInterval(ioTime); - - // Get the closest snapping position between the periodic interval and the position - theClosestTime = GetClosestValue(theClosestTime, theClosestInterval, ioTime); - - // If the closest position is within tolerances then use it, otherwise return the original - // value. - if (::labs(theClosestTime - ioTime) <= m_SnapDistance) { - ioTime = theClosestTime; - theReturnValue = true; - } - } else // If user does not hit the shift key (i.e. snapping is toggled off) - { - // Snap to end handles at 1 pixel range if the current object dragged - // is a keyframe - if (m_KeyFrameClicked) { - // Returns if the startTime or the endTime of a Time Bar is closer to the dragged - // keyframe - long theClosestTime = GetClosestValue(m_theStartTime, m_theEndTime, ioTime); - - // Set snapping range to 1 pixel and converts it to time. - // The snapping range of 1 pixel applies for keyframes that are dragged really - // close to the end handles. - long thePixel = 1; - long theTime = ::dtol(thePixel / m_TimeRatio); - - // Determines if the closest time is within 1 pixel range - // If so returns the closest time, which is the snapping time, and true indicating - // that snapping occurs. - if (::labs(theClosestTime - ioTime) <= theTime) { - ioTime = theClosestTime; - theReturnValue = true; - } - } - } - - return theReturnValue; -} -//============================================================================= -/** - * Get the closest periodic interval to inPosition. - * Since it is too expensive to store every possible periodic interval in the - * snapping list, this just dynamically figures out the closest periodic - * interval. - */ -void CSnapper::SetStartEndTime(long theStartTime, long theEndTime) -{ - m_theStartTime = theStartTime; - m_theEndTime = theEndTime; -} -//============================================================================= -/** - * Get the closest periodic interval to inPosition. - * Since it is too expensive to store every possible periodic interval in the - * snapping list, this just dynamically figures out the closest periodic - * interval. - */ -long CSnapper::GetClosestPeriodicInterval(long inTime) -{ - long theIntervalLow = inTime / m_PeriodicInterval * m_PeriodicInterval; - long theIntervalHigh = (inTime / m_PeriodicInterval + 1) * m_PeriodicInterval; - - return GetClosestValue(theIntervalLow, theIntervalHigh, inTime); -} - -//============================================================================= -/** - * Used to pass off snapping logic to this for objects being dragged. - * This does all the work of an object when the object itself is being dragged - * and it's position is being modified by the drag, but it needs to be snapped - * as well. It is not necessary to call this unless ProcessDrag is being - * used. - * @param inClickPosition the mouse click location, usually just inPoint.x. - * @param inCenterOffset the center of the object where it should be snapped to. - */ -void CSnapper::BeginDrag(long inClickLocation, long inCenterTimeOffset) -{ - m_InitialOffset = inClickLocation; - m_ObjectTimeOffset = inCenterTimeOffset; -} - -//============================================================================= -/** - * Process an object's drag event and figure out where the object should be. - * This does all the work of figuring out where the object should be snapped - * to. It is not necessary to call this, but it may make implementing snapping - * much easier. BeginDrag needs to be called on OnMouseDown to use this. - * @param inPosition the position of the mouse, GetPosition( ).x + inPoint.x. - * @param inFlags the mouse state flags, used to determine snapping state. - */ -long CSnapper::ProcessDrag(long inTime, long inOffset, long inFlags) -{ - long theModPos = inTime + m_TimeOffset + ::dtol((inOffset - m_InitialOffset) / m_TimeRatio); - InterpretTimeEx(theModPos, inFlags); - theModPos -= m_TimeOffset; - - return theModPos; -} - -//============================================================================= -/** - * Set the source for this Snapper object. - * This is so that objects may choose to no add themselves to snapping lists - * that they originated. This is only meant for comparison with the 'this' ptr. - * @param inSource the source object for this snapping list. - */ -void CSnapper::SetSource(void *inSource) -{ - m_Source = inSource; -} - -//============================================================================= -/** - * Get the source for this snapper object. - * @return the source of the snapping. - */ -void *CSnapper::GetSource() -{ - return m_Source; -} - -void CSnapper::SetTimeOffset(long inTimeOffset) -{ - m_TimeOffset = inTimeOffset; -} diff --git a/src/Authoring/Studio/Palettes/Timeline/Snapper.h b/src/Authoring/Studio/Palettes/Timeline/Snapper.h deleted file mode 100644 index ea230bc0..00000000 --- a/src/Authoring/Studio/Palettes/Timeline/Snapper.h +++ /dev/null @@ -1,118 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 NVIDIA Corporation. -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt 3D Studio. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef INCLUDED_SNAPPER_H -#define INCLUDED_SNAPPER_H 1 - -#pragma once - -#include <set> -#include <vector> - -class CSnapper -{ - typedef std::set<long> TTimeList; - typedef std::vector<long> TOffsetList; - -public: - CSnapper(double inTimeRatio = .1); - virtual ~CSnapper(); - - void AddTime(long inTime); - void AddPixelLocation(long inPixelLoc); - - void SetSnappingKeyframes(bool inIsSnappingKeyframes); - bool IsSnappingKeyframes(); - void SetSnappingSelectedKeyframes(bool inIsSnappingSelectedKeyframes); - bool IsSnappingSelectedKeyframes(); - - void Clear(); - - void SetVisibleArea(long inStartHeight, long inEndHeight); - void PushOffset(long inHeight); - void PopOffset(); - bool IsVisible(long inPosition, long inHeight); - - void SetTimeRatio(double inTimeRatio); - - void SetPeriodicInterval(long inInterval); - - bool InterpretTimeEx(long &ioTime, long inFlags); - long InterpretTime(long inTime, long inFlags); - - void SetSnappingDistance(long inSnapDistance); - - void BeginDrag(long inPosition, long inOffset = 0); - long ProcessDrag(long inTime, long inPosition, long inFlags); - - void SetSource(void *inSource); - void *GetSource(); - - void SetTimeOffset(long inTimeOffset); - void SetStartEndTime(long theStartTime, long theEndTime); - void SetKeyFrameClicked(bool inKeyFrameClicked); - -protected: - bool GetSnapTime(long &inTime, bool inShiftKeyDown); - long GetClosestPeriodicInterval(long inTime); - - long m_theStartTime; - long m_theEndTime; - - TTimeList m_Times; - TOffsetList m_Offsets; - - double m_TimeRatio; - - bool m_IsSnappingKeyframes; - bool m_IsSnappingSelectedKeyframes; - long m_Offset; - long m_StartHeight; - long m_EndHeight; - long m_SnapDistance; - - long m_PeriodicInterval; - - long m_InitialOffset; - long m_ObjectTimeOffset; - long m_TimeOffset; - bool m_KeyFrameClicked; - void *m_Source; -}; - -// Interface that will provider the info for snapping logic in the timebars and keyframes -class ISnappingListProvider -{ -public: - virtual ~ISnappingListProvider() {} - - virtual void PopulateSnappingList(CSnapper *inSnappingList) = 0; -}; - -#endif // INCLUDED_SNAPPER_H
\ No newline at end of file diff --git a/src/Authoring/Studio/Palettes/Timeline/StateRow.cpp b/src/Authoring/Studio/Palettes/Timeline/StateRow.cpp deleted file mode 100644 index 7e21b29b..00000000 --- a/src/Authoring/Studio/Palettes/Timeline/StateRow.cpp +++ /dev/null @@ -1,218 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2002 NVIDIA Corporation. -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt 3D Studio. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -//============================================================================== -// Prefix -//============================================================================== - -#include "stdafx.h" - -//============================================================================== -// Includes -//============================================================================== -#include "StateRow.h" -#include "PropertyRow.h" -#include "Bindings/ITimelineItemBinding.h" - -//============================================================================= -/** - * Creates a new CStateRow for the Asset. - * @param inParentRow the parent of this row. - */ -CStateRow::CStateRow(CBaseStateRow *inParentRow, bool loaded) - : CBaseStateRow(inParentRow, loaded) -{ - m_ParentRow = inParentRow; -} - -CStateRow::~CStateRow() -{ -} - -//============================================================================= -/** - * Initialize this object. - * This must be called after construction and may only be called once. - */ -void CStateRow::Initialize(ITimelineItemBinding *inTimelineItemBinding) -{ - CBaseStateRow::Initialize(inTimelineItemBinding); - - // cache these numbers. I believe caching these numbers is to avoid having to incur expensive - // recursive calculations on ever draw. - CalculateActiveStartTime(); - CalculateActiveEndTime(); - - if (GetTimelineItem()->IsExpanded()) // this is stored for the current opened presentation and - // conveniently help you remember the last view before you - // switch slides. - Expand(); - // sk - Delay loading till this is expanded. I think it makes more sense to not have to incur - // work till the UI needs to be displayed - // Plus it would not work now since the parent always needs to be 'fully' initialized for the - //SnappingListProvider, prior to any child creation. - // else - // LoadChildren( ); -} - -//============================================================================= -/** - * Expand this node of the tree control. - * This will display all children the fit the filter. - */ -void CStateRow::Expand(bool inExpandAll /*= false*/, bool inExpandUp) -{ - // Only RecalcLayout if loaded children or expanded. - bool theDoRecalLayout = !m_Loaded; - - if (!m_Loaded) - LoadChildren(); - - bool theWasExpanded = m_IsExpanded; - CBaseStateRow::Expand(inExpandAll, inExpandUp); - // Check if this is expanded - theDoRecalLayout |= (theWasExpanded != m_IsExpanded); - GetTimelineItem()->SetExpanded( - m_IsExpanded); // remember this setting so that it persist when this row is recreated - - if (theDoRecalLayout) - emit layoutRecalcRequested(); -} - -//============================================================================= -/** - * Collapse this node of the tree control. - * This will hide all children of this control. - */ -void CStateRow::Collapse(bool inCollapseAll /* = false */) -{ - bool theWasExpanded = m_IsExpanded; - CBaseStateRow::Collapse(inCollapseAll); - - GetTimelineItem()->SetExpanded( - m_IsExpanded); // remember this setting so that it persist when this row is recreated - // only RecalcLayout if this is collapsed - if (theWasExpanded != m_IsExpanded) - emit layoutRecalcRequested(); -} - -bool CStateRow::PerformFilter(const CFilter &inFilter) -{ - return inFilter.Filter(m_TimelineItemBinding->GetTimelineItem()); -} - -bool CStateRow::HasVisibleChildren() -{ - if (!m_Loaded) { - CTimelineItemOrderedIterator theChildren(m_TimelineItemBinding); - // Return true if has children but do not load the children. - if (!theChildren.IsDone()) { - return true; - } - CTimelineItemPropertyIterator theProperties(m_TimelineItemBinding); - if (!theProperties.IsDone()) { - return true; - } - } - return CBaseStateRow::HasVisibleChildren(); -} - -void CStateRow::OnTimeChange() -{ - CalculateActiveStartTime(); - CalculateActiveEndTime(); - - // sk - I don't see the need to DoTimelineRecalcLayout here, because that is usually when height - // of the control change - // this should just change width.. but maybe I am missing something, so I am leaving this - //here for 'easy' debugging - // emit layoutRecalcRequested(); - - emit timeChanged(); -} - -//============================================================================= -/** - * calculate the active start time... this function set the active start to its - * parent's start time if it comes after the objects start time - */ -bool CStateRow::CalculateActiveStartTime() -{ - long theRetVal = GetStartTime(); - - if (m_ParentRow) { - if (m_ParentRow->CalculateActiveStartTime()) { - long theParentActiveStart = m_ParentRow->GetActiveStart(); - if (theParentActiveStart > theRetVal) - theRetVal = theParentActiveStart; - } - } - m_ActiveStart = theRetVal; - return true; -} - -//============================================================================= -/** - * calculate the active end time... this function set the active end to its - * parent's end time if it comes before the objects end time - */ -bool CStateRow::CalculateActiveEndTime() -{ - long theRetVal = GetEndTime(); - if (m_ParentRow) { - if (m_ParentRow->CalculateActiveEndTime()) { - long theParentActiveEnd = m_ParentRow->GetActiveEnd(); - if (theParentActiveEnd < theRetVal) - theRetVal = theParentActiveEnd; - } - } - m_ActiveEnd = theRetVal; - return true; -} - -//============================================================================== -/** - * - */ -long CStateRow::GetLatestEndTime() -{ - if (m_IsExpanded) // if its children are not visible, they do not have any affect - return CBaseStateRow::GetLatestEndTime(); - - return GetActiveEnd(); -} - -//============================================================================= -/** - * Load all the properties on this object. - */ -void CStateRow::LoadProperties() -{ - m_TimelineItemBinding->LoadProperties(); -} diff --git a/src/Authoring/Studio/Palettes/Timeline/StateRow.h b/src/Authoring/Studio/Palettes/Timeline/StateRow.h deleted file mode 100644 index 46a96a51..00000000 --- a/src/Authoring/Studio/Palettes/Timeline/StateRow.h +++ /dev/null @@ -1,83 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2002 NVIDIA Corporation. -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt 3D Studio. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -//============================================================================== -// Prefix -//============================================================================== -#ifndef INCLUDED_STATE_ROW_H -#define INCLUDED_STATE_ROW_H 1 - -#pragma once - -//============================================================================== -// Includes -//============================================================================== -#include "BaseStateRow.h" - -//============================================================================== -// Forwards -//============================================================================== -class CButtonControl; -class CButtonDownListener; -class CColorControl; -class CStateTreeControl; -class CToggleControl; -class CPropertyRow; -class CCmdBatch; -class CSnapper; -class CResImage; - -class CStateRow : public CBaseStateRow -{ - Q_OBJECT -public: - CStateRow(CBaseStateRow *inParentRow, bool loaded = false); - virtual ~CStateRow(); - - using CBaseStateRow::Initialize; - virtual void Initialize(ITimelineItemBinding *inTimelineItemBinding); - - void Expand(bool inExpandAll = false, bool inExpandUp = false) override; - void Collapse(bool inCollapseAll = false) override; - virtual void OnTimeChange(); - - long GetLatestEndTime() override; - bool CalculateActiveStartTime() override; - bool CalculateActiveEndTime() override; - bool HasVisibleChildren() override; - -Q_SIGNALS: - void timeChanged(); - void layoutRecalcRequested(); - -protected: - bool PerformFilter(const CFilter &inFilter) override; - void LoadProperties() override; -}; -#endif // INCLUDED_STATE_ROW_H diff --git a/src/Authoring/Studio/Palettes/Timeline/StateRowFactory.cpp b/src/Authoring/Studio/Palettes/Timeline/StateRowFactory.cpp deleted file mode 100644 index 78419f0f..00000000 --- a/src/Authoring/Studio/Palettes/Timeline/StateRowFactory.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 NVIDIA Corporation. -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt 3D Studio. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "stdafx.h" - -#include "StateRowFactory.h" -#include "Bindings/ITimelineItemBinding.h" -#include "StateRow.h" -#include "TimelineUIFactory.h" - -//============================================================================= -/** - * Create the type specific StateRow for the Asset. - * Different asset use different derivations of StateRow, and this will - * return the proper state row for the asset. - * @param inTimelineItem the timeline item to create the state row for. - * @param inParentRow the parent row of the state row being created. - * @param inSnappingListProvider For keyframe/timebar snapping - * @return CStateRow the row that represents the state, or nullptr if it should not show up. - */ -CStateRow *CStateRowFactory::CreateStateRow(ITimelineItemBinding *inTimelineItem, - CBaseStateRow *inParentRow) -{ - CStateRow *theRow = nullptr; - if (inTimelineItem) { - theRow = TimelineUIFactory::instance()->createStateRow(inParentRow, inTimelineItem); - } - - return theRow; -} diff --git a/src/Authoring/Studio/Palettes/Timeline/StateRowFactory.h b/src/Authoring/Studio/Palettes/Timeline/StateRowFactory.h deleted file mode 100644 index 2610159f..00000000 --- a/src/Authoring/Studio/Palettes/Timeline/StateRowFactory.h +++ /dev/null @@ -1,49 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 NVIDIA Corporation. -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt 3D Studio. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef INCLUDED_STATE_ROW_FACTORY_H -#define INCLUDED_STATE_ROW_FACTORY_H 1 - -#pragma once - -class ITimelineItemBinding; -class CStateRow; -class CBaseStateRow; -class ISnappingListProvider; - -class CStateRowFactory -{ -protected: - CStateRowFactory(); - virtual ~CStateRowFactory(); - -public: - static CStateRow *CreateStateRow(ITimelineItemBinding *inTimelineItem, CBaseStateRow *inParent); -}; -#endif // INCLUDED_STATE_ROW_FACTORY_H
\ No newline at end of file diff --git a/src/Authoring/Studio/Palettes/Timeline/TimeMeasureItem.cpp b/src/Authoring/Studio/Palettes/Timeline/TimeMeasureItem.cpp deleted file mode 100644 index 92b87390..00000000 --- a/src/Authoring/Studio/Palettes/Timeline/TimeMeasureItem.cpp +++ /dev/null @@ -1,207 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt 3D Studio. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "TimeMeasureItem.h" -#include "CoreUtils.h" -#include "StudioUtils.h" -#include "StudioPreferences.h" - -#include <QPainter> - -TimeMeasureItem::TimeMeasureItem(QQuickItem *parent) - : QQuickPaintedItem(parent) -{ -} - -TimeMeasureItem::~TimeMeasureItem() -{ -} - -void TimeMeasureItem::paint(QPainter *painter) -{ - const double edgeMargin = 2; - const double largeHashOffset = 5; - const double mediumHashOffset = 6; - const double smallHashOffset = 3; - - QPen pen(CStudioPreferences::GetRulerTickColor()); - painter->setPen(pen); - - long theLength = width(); - long theHeight = height() - edgeMargin; - - double theTotalMeasure = theLength / m_Ratio; - - long theNumLargeHashes = (long)(theTotalMeasure / m_LargeHashInterval) + 1; - - long theOffset = m_Offset - (m_Offset % ::dtol(m_LargeHashInterval)); - - for (long i = 0; i < theNumLargeHashes + 1; ++i) { - double theMeasure = m_LargeHashInterval * i + theOffset; - - long thePos = ::TimeToPos(theMeasure - m_Offset, m_Ratio); - - if (thePos > 0) - painter->drawLine(thePos, theHeight, thePos, theHeight - largeHashOffset); - - DrawMeasureText(painter, thePos, long(theMeasure)); - - // sanity check - if (m_MediumHashInterval > 0) { - thePos = ::TimeToPos(theMeasure - m_Offset + m_MediumHashInterval, m_Ratio); - if (thePos > 0) - painter->drawLine(thePos, theHeight, thePos, theHeight - mediumHashOffset); - - for (double theSmallInterval = 0; theSmallInterval < m_LargeHashInterval; - theSmallInterval += m_SmallHashInterval) { - thePos = ::TimeToPos(theMeasure - m_Offset + theSmallInterval, m_Ratio); - - if (thePos > 0) - painter->drawLine(thePos, theHeight, thePos, theHeight - smallHashOffset); - } - } // if medium is valid - } - - // Draw the top outline - painter->drawLine(0, theHeight, theLength, theHeight); -} - -void TimeMeasureItem::setTimeRatio(double inTimeRatio) -{ - if (qFuzzyCompare(m_Ratio, inTimeRatio)) - return; - - m_Ratio = inTimeRatio; - - double theTimePerPixel = (double)(1 / inTimeRatio); - - // Only go through this if it has actually changed - if (theTimePerPixel != m_TimePerPixel) { - m_TimePerPixel = theTimePerPixel; - - // Go through the possible hash settings and find the one that best suits the - // time per pixel. - double theMillisPerLargeHash = theTimePerPixel * 50; - if (theMillisPerLargeHash <= 100) // 100ms - theMillisPerLargeHash = 100; - else if (theMillisPerLargeHash <= 200) // 200ms - theMillisPerLargeHash = 200; - else if (theMillisPerLargeHash <= 500) // .5s - theMillisPerLargeHash = 500; - else if (theMillisPerLargeHash <= 1000) // 1s - theMillisPerLargeHash = 1000; - else if (theMillisPerLargeHash <= 2000) // 2s - theMillisPerLargeHash = 2000; - else if (theMillisPerLargeHash <= 5000) // 5s - theMillisPerLargeHash = 5000; - else if (theMillisPerLargeHash <= 10000) // 10s - theMillisPerLargeHash = 10000; - else if (theMillisPerLargeHash <= 20000) // 20s - theMillisPerLargeHash = 20000; - else if (theMillisPerLargeHash <= 30000) // 30s - theMillisPerLargeHash = 30000; - else if (theMillisPerLargeHash <= 60000) // 1m - theMillisPerLargeHash = 60000; - else if (theMillisPerLargeHash <= 120000) // 2m - theMillisPerLargeHash = 120000; - else if (theMillisPerLargeHash <= 300000) // 5m - theMillisPerLargeHash = 300000; - else if (theMillisPerLargeHash <= 600000) // 10m - theMillisPerLargeHash = 600000; - else if (theMillisPerLargeHash <= 1200000) // 20m - theMillisPerLargeHash = 1200000; - else if (theMillisPerLargeHash <= 1800000) // 30m - theMillisPerLargeHash = 1800000; - else if (theMillisPerLargeHash <= 3600000) // 1h - theMillisPerLargeHash = 3600000; - else - theMillisPerLargeHash = 7200000; // 2h - - // Set the distances between the hashes - m_LargeHashInterval = theMillisPerLargeHash; - m_MediumHashInterval = theMillisPerLargeHash / 2; - m_SmallHashInterval = theMillisPerLargeHash / 10; - - update(); - } - - emit timeRatioChanged(inTimeRatio); -} - -double TimeMeasureItem::timeRatio() const -{ - return m_Ratio; -} - -void TimeMeasureItem::DrawMeasureText(QPainter *painter, long inPosition, long inMeasure) const -{ - QString theTimeFormat(FormatTime(inMeasure)); - - // Offset the position by half the text size to center it over the hash. - QFontMetrics fm = painter->fontMetrics(); - const auto textSize = fm.size(Qt::TextSingleLine, theTimeFormat); - inPosition -= ::dtol(textSize.width() / 2); - - QRectF rect(0, 0, width(), height()); - rect.translate(inPosition, -3); - - painter->drawText(rect, Qt::AlignLeft | Qt::AlignVCenter, theTimeFormat); -} - -QString TimeMeasureItem::FormatTime(long inTime) const -{ - long theHours = inTime / 3600000; - long theMinutes = inTime % 3600000 / 60000; - long theSeconds = inTime % 60000 / 1000; - long theMillis = inTime % 1000; - - bool theHoursOnlyFlag = theHours != 0 && theMinutes == 0 && theSeconds == 0 && theMillis == 0; - bool theMinutesOnlyFlag = - !theHoursOnlyFlag && theMinutes != 0 && theSeconds == 0 && theMillis == 0; - bool theSecondsOnlyFlag = !theMinutesOnlyFlag && theMillis == 0; - - QString theTime; - // If only hours are being displayed then format it as hours. - if (theHoursOnlyFlag) { - theTime = tr("%1h").arg(theHours); - } - // If only minutes are being displayed then format it as minutes. - else if (theMinutesOnlyFlag) { - theTime = tr("%1m").arg(theMinutes); - } - // If only seconds are being displayed then format as seconds - else if (theSecondsOnlyFlag) { - theTime = tr("%1s").arg(theSeconds); - } - // If the intervals are correct then this should only be tenths of seconds, so do that. - else { - theTime = tr("0.%1s").arg(theMillis / 100); - } - - return theTime; -} diff --git a/src/Authoring/Studio/Palettes/Timeline/TimeMeasureItem.h b/src/Authoring/Studio/Palettes/Timeline/TimeMeasureItem.h deleted file mode 100644 index 5304929d..00000000 --- a/src/Authoring/Studio/Palettes/Timeline/TimeMeasureItem.h +++ /dev/null @@ -1,63 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt 3D Studio. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef TIMEMEASUREITEM_H -#define TIMEMEASUREITEM_H - -#include <QQuickPaintedItem> - -class TimeMeasureItem : public QQuickPaintedItem -{ - Q_OBJECT - Q_PROPERTY(double timeRatio READ timeRatio WRITE setTimeRatio NOTIFY timeRatioChanged) - -public: - explicit TimeMeasureItem(QQuickItem *parent = nullptr); - ~TimeMeasureItem() override; - - void paint(QPainter *painter) override; - - double timeRatio() const; - void setTimeRatio(double timeRatio); - -Q_SIGNALS: - void timeRatioChanged(double timeRatio); - -private: - void DrawMeasureText(QPainter *painter, long inPosition, long inMeasure) const; - QString FormatTime(long inTime) const; - - double m_SmallHashInterval = 0.0; - double m_MediumHashInterval = 0.0; - double m_LargeHashInterval = 0.0; - double m_Ratio = 0.0; - long m_Offset = 0; - double m_TimePerPixel = 0.0; -}; - -#endif // TIMEMEASUREITEM_H diff --git a/src/Authoring/Studio/Palettes/Timeline/TimePropertyItem.cpp b/src/Authoring/Studio/Palettes/Timeline/TimePropertyItem.cpp deleted file mode 100644 index df3ea28f..00000000 --- a/src/Authoring/Studio/Palettes/Timeline/TimePropertyItem.cpp +++ /dev/null @@ -1,144 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt 3D Studio. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "TimePropertyItem.h" -#include "CoreUtils.h" -#include "StudioUtils.h" -#include "StudioPreferences.h" -#include "TimelineRow.h" -#include "PropertyRow.h" -#include "Bindings/ITimelineItemProperty.h" - -#include <QPainter> - -TimePropertyItem::TimePropertyItem(QQuickItem *parent) - : QQuickPaintedItem(parent) -{ -} - -TimePropertyItem::~TimePropertyItem() -{ -} - -void TimePropertyItem::paint(QPainter *painter) -{ - if (!m_property) - return; - - static const QVector<QColor> channelColors{ - QColor(255, 0, 0), - QColor(0, 255, 0), - QColor(0, 0, 255), - QColor(255, 255, 0), - QColor(255, 0, 255), - QColor(0, 255, 255) - }; - - m_MaxVal = m_property->GetMaximumValue(); - m_MinVal = m_property->GetMinimumValue(); - - m_MinY = 10; - m_MaxY = height() - m_MinY; - - painter->save(); - painter->fillRect(0, 0, width(), height(), CStudioPreferences::backgroundColor()); - long channelCount = m_property->GetChannelCount(); - // Don't want to overflow the color array - if (channelCount <= 6) { - // For each channel graph it. - for (long i = 0; i < channelCount; ++i) - drawDetailedChannel(painter, i, channelColors[i]); - } - painter->restore(); -} - -double TimePropertyItem::timeRatio() const -{ - return m_timeRatio; -} - -void TimePropertyItem::setTimeRatio(double timeRatio) -{ - if (qFuzzyCompare(m_timeRatio, timeRatio)) - return; - - m_timeRatio = timeRatio; - - update(); - Q_EMIT timeRatioChanged(m_timeRatio); -} - -CTimelineRow *TimePropertyItem::timelineRow() const -{ - return m_timelineRow; -} - -void TimePropertyItem::setTimelineRow(CTimelineRow *timelineRow) -{ - if (timelineRow != m_timelineRow) { - m_timelineRow = timelineRow; - auto propertyRow = dynamic_cast<CPropertyRow*>(timelineRow); - if (propertyRow) { - m_property = propertyRow->GetProperty(); - } else { - m_timelineRow = nullptr; - m_property = nullptr; - } - Q_EMIT timelineRowChanged(); - } - // intentionally request and update, as this might indicate the parent changes, eg. - // keyframes were moved around - update(); -} - -void TimePropertyItem::drawDetailedChannel(QPainter *painter, long channelIndex, const QColor &color) -{ - painter->setPen(color); - - - float theValue = m_property->GetChannelValueAtTime(channelIndex, 0); - long theYPos = (long)((1.0 - (theValue - m_MinVal) / (m_MaxVal - m_MinVal)) * (m_MaxY - m_MinY) - + m_MinY + .5); - - auto pos = QPoint(0, theYPos); - - long theInterval = 5; - long theSize = width() + theInterval; - - for (long thePixel = 0; thePixel < theSize; thePixel += theInterval) { - long theTime = ::PosToTime(thePixel, m_timeRatio); //(long)( thePixel / m_TimeRatio + .5 ); - theValue = m_property->GetChannelValueAtTime(channelIndex, theTime); - theYPos = (long)((1.0 - (theValue - m_MinVal) / (m_MaxVal - m_MinVal)) * (m_MaxY - m_MinY) - + m_MinY + .5); - - auto newPos = QPoint(thePixel, theYPos); - painter->drawLine(pos, newPos); - pos = newPos; - } -} - diff --git a/src/Authoring/Studio/Palettes/Timeline/TimePropertyItem.h b/src/Authoring/Studio/Palettes/Timeline/TimePropertyItem.h deleted file mode 100644 index 4f0ef2fd..00000000 --- a/src/Authoring/Studio/Palettes/Timeline/TimePropertyItem.h +++ /dev/null @@ -1,72 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt 3D Studio. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef TIMEPROPERTYITEM_H -#define TIMEPROPERTYITEM_H - -#include <QQuickPaintedItem> - -class CTimelineRow; -class ITimelineItemProperty; - -class TimePropertyItem : public QQuickPaintedItem -{ - Q_PROPERTY(double timeRatio READ timeRatio WRITE setTimeRatio NOTIFY timeRatioChanged) - Q_PROPERTY(CTimelineRow *timelineRow READ timelineRow WRITE setTimelineRow - NOTIFY timelineRowChanged) - - Q_OBJECT -public: - explicit TimePropertyItem(QQuickItem *parent = nullptr); - ~TimePropertyItem() override; - - void paint(QPainter *painter) override; - - double timeRatio() const; - void setTimeRatio(double timeRatio); - - CTimelineRow *timelineRow() const; - void setTimelineRow(CTimelineRow *property); - -Q_SIGNALS: - void timeRatioChanged(double timeRatio); - void timelineRowChanged(); - -private: - void drawDetailedChannel(QPainter *painter, long channelIndex, const QColor &color); - - double m_timeRatio = 0.0; - float m_MaxVal = 0.0f; - float m_MinVal = 0.0f; - long m_MinY = 0; - long m_MaxY = 0; - CTimelineRow *m_timelineRow = nullptr; - ITimelineItemProperty *m_property = nullptr; -}; - -#endif // TIMEPROPERTYITEM_H diff --git a/src/Authoring/Studio/Palettes/Timeline/TimeToolbar.cpp b/src/Authoring/Studio/Palettes/Timeline/TimeToolbar.cpp deleted file mode 100644 index 639e61d2..00000000 --- a/src/Authoring/Studio/Palettes/Timeline/TimeToolbar.cpp +++ /dev/null @@ -1,135 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2002 NVIDIA Corporation. -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt 3D Studio. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -//============================================================================== -// Prefix -//============================================================================== - -#include "stdafx.h" - -//============================================================================== -// Includes -//============================================================================== - -#include "TimeToolbar.h" -#include "Renderer.h" -#include "StudioPreferences.h" -#include "BlankControl.h" -#include "IDoc.h" - -//============================================================================= -/** - * Constructor - */ -CTimeToolbar::CTimeToolbar(IDoc *inDoc) -{ - m_Doc = inDoc; - m_TimeEdit = new CTimeEdit(inDoc); - m_Color = CStudioPreferences::GetBaseColor(); - m_TimeEdit->SetBackgroundColor(m_Color); - AddChild(m_TimeEdit); - - m_TimeEdit->AddTimeChangeListener(this); -} - -//============================================================================= -/** - * Destructor - */ -CTimeToolbar::~CTimeToolbar() -{ - delete m_TimeEdit; -} - -//============================================================================= -/** - * Fills in the background color for this layout. - */ -void CTimeToolbar::Draw(CRenderer *inRenderer) -{ - // Fill in the background color and draw the child controls - - // Draw the shadow lines at the top and bottom of the layout - CRct theRect(GetSize()); - inRenderer->FillSolidRect(theRect, m_Color); - - inRenderer->PushPen(CStudioPreferences::GetButtonShadowColor()); - inRenderer->MoveTo(CPt(0, 0)); - inRenderer->LineTo(CPt(theRect.size.x, 0)); - inRenderer->MoveTo(CPt(0, 0)); - inRenderer->LineTo(CPt(0, theRect.size.y - 2)); - inRenderer->MoveTo(CPt(0, theRect.size.y - 2)); - inRenderer->LineTo(CPt(theRect.size.x, theRect.size.y - 2)); - inRenderer->PopPen(); - inRenderer->PushPen(CStudioPreferences::GetButtonHighlightColor()); - inRenderer->MoveTo(CPt(0, theRect.size.y - 1)); - inRenderer->LineTo(CPt(theRect.size.x, theRect.size.y - 1)); - inRenderer->PopPen(); -} - -//============================================================================= -/** - * Override of Control's set size to reposition the TimeEdit. - * @param inSize the new size. - */ -void CTimeToolbar::SetSize(CPt inSize) -{ - m_TimeEdit->SetSize(CPt(m_TimeEdit->GetWidth(), inSize.y - 4)); - m_TimeEdit->SetPosition(inSize.x - m_TimeEdit->GetWidth(), 2); - - CControl::SetSize(inSize); -} - -//============================================================================= -/** - * Call from the TimelineView (or thereabouts) that the scene time changed. - * @param inTime the new time. - */ -void CTimeToolbar::SetTime(long inTime) -{ - m_TimeEdit->SetTime(inTime); -} -//============================================================================= -/** - * Returns the playhead time - */ -long CTimeToolbar::GetTime() -{ - return m_TimeEdit->GetTime(); -} - -//============================================================================= -/** - * Callback from the TimeEdit that it's time was manually changed. - * @param inNewTime the new time. - */ -void CTimeToolbar::OnTimeChanged(long inNewTime) -{ - m_Doc->NotifyTimeChanged(inNewTime); -}
\ No newline at end of file diff --git a/src/Authoring/Studio/Palettes/Timeline/TimeToolbar.h b/src/Authoring/Studio/Palettes/Timeline/TimeToolbar.h deleted file mode 100644 index c1ed948d..00000000 --- a/src/Authoring/Studio/Palettes/Timeline/TimeToolbar.h +++ /dev/null @@ -1,75 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2002 NVIDIA Corporation. -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt 3D Studio. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -//============================================================================== -// Prefix -//============================================================================== - -#ifndef INCLUDED_TIME_TOOLBAR_H -#define INCLUDED_TIME_TOOLBAR_H 1 - -#pragma once - -//============================================================================== -// Includes -//============================================================================== - -#include "TimeEdit.h" -#include "Control.h" - -//============================================================================== -// Forwards -//============================================================================== -class CRenderer; -class IDoc; - -//============================================================================= -/** - * Control at the top of the time display and a header for the toggle column. - */ -class CTimeToolbar : public CControl, public CTimeEditChangeListener -{ -public: - CTimeToolbar(IDoc *inDoc); - virtual ~CTimeToolbar(); - void Draw(CRenderer *inRenderer) override; - - void SetSize(CPt inSize) override; - void SetTime(long inTime); - virtual long GetTime(); - - void OnTimeChanged(long inNewTime) override; - -protected: - CTimeEdit *m_TimeEdit; - IDoc *m_Doc; - CColor m_Color; -}; - -#endif // INCLUDED_TIME_TOOLBAR_H diff --git a/src/Authoring/Studio/Palettes/Timeline/Timeline.qml b/src/Authoring/Studio/Palettes/Timeline/Timeline.qml deleted file mode 100644 index dd4bc088..00000000 --- a/src/Authoring/Studio/Palettes/Timeline/Timeline.qml +++ /dev/null @@ -1,329 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt 3D Studio. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.8 -import QtQuick.Controls 2.2 -import QtQuick.Layouts 1.3 -import Qt3DStudio 1.0 -import "../controls" - -Rectangle { - id: root - - property real splitterPos: 300 - property int itemHeight: 20 - property int itemExtraHeight: 80 - - color: _backgroundColor - - ScrollBar { - id: scrollBar - } - - RowLayout { - anchors.fill: parent - - spacing: 5 - - ColumnLayout { - anchors.fill: parent - - spacing: 0 - Layout.minimumWidth: root.splitterPos - Layout.maximumWidth: root.splitterPos - Layout.preferredWidth: root.width - - Item { - Layout.fillWidth: true - Layout.preferredWidth: parent.width - Layout.preferredHeight: itemHeight - - Row { - anchors.right: parent.right - StyledToggleButton { - width: 20 - height: 20 - - enabledImage: "Toggle-Shy.png" - checkedImage: "Toggle-Shy.png" - toolTipText: checked ? qsTr("Show shy objects") - : qsTr("Hide shy objects") - - checked: _timelineView.hideShy - onClicked: _timelineView.hideShy = checked - } - - StyledToggleButton { - width: 20 - height: 20 - - enabledImage: "filter-toggle-eye-up.png" - checkedImage: "filter-toggle-eye-down.png" - toolTipText: checked ? qsTr("Show inactive objects") - : qsTr("Hide inactive objects") - - checked: _timelineView.hideHidden - onClicked: _timelineView.hideHidden = checked - } - - StyledToggleButton { - width: 20 - height: 20 - - checkedImage: "Toggle-Lock.png" - enabledImage: "Toggle-Lock.png" - toolTipText: checked ? qsTr("Show locked objects") - : qsTr("Hide locked objects") - - checked: _timelineView.hideLocked - onClicked: _timelineView.hideLocked = checked - } - } - - } - - ListView { - id: browserList - - Layout.fillWidth: true - Layout.fillHeight: true - Layout.minimumHeight: 80 - Layout.preferredHeight: count * itemHeight - Layout.preferredWidth: root.width - - ScrollBar.vertical: scrollBar - - model: _timelineView.objectModel - boundsBehavior: Flickable.StopAtBounds - clip: true - currentIndex: _timelineView.selection - - delegate: TimelineTreeDelegate { - id: delegateItem - - property int extraHeight: model.propertyExpanded ? itemExtraHeight : 0 - - splitterPos: root.splitterPos - width: parent.width - height: model.parentExpanded && model.visible ? itemHeight + extraHeight : 0 - - visible: height > 0 - - Behavior on height { - NumberAnimation { - duration: 100 - easing.type: Easing.OutQuad - } - } - - onDoubleClicked: { - if (model.isProperty) - model.propertyExpanded = !model.propertyExpanded; - } - } - - onCurrentIndexChanged: _timelineView.selection = currentIndex - - Connections { - target: _timelineView - onSelectionChanged: { - if (browserList.currentIndex !== _timelineView.selection) - browserList.currentIndex = _timelineView.selection; - } - } - } - } - - Flickable { - id: timelineFlickable - - property bool movingPlayHead: false - - Layout.fillWidth: true - Layout.fillHeight: true - Layout.minimumHeight: 80 - Layout.preferredHeight: (timelineItemsList.count + 1) * itemHeight - Layout.preferredWidth: root.width - boundsBehavior: Flickable.StopAtBounds - - contentHeight: height - contentWidth: 2000 - clip: true - interactive: !movingPlayHead - - ScrollBar.horizontal: ScrollBar { - policy: ScrollBar.AlwaysOn - } - - Connections { - target: _timelineView - onCurrentTimePosChanged: { - // -10 compensates the width of the playhead - var pos = _timelineView.currentTimePos - 10; - if (pos < timelineFlickable.contentX || - pos > timelineFlickable.contentX + timelineFlickable.width) - timelineFlickable.contentX = pos; - } - } - - Item { - anchors.fill: parent - - ColumnLayout { - anchors.fill: parent - - spacing: 0 - - TimeMeasureItem { - Layout.fillWidth: true - Layout.preferredWidth: parent.width - Layout.preferredHeight: itemHeight - timeRatio: _timelineView.timeRatio - - MouseArea { - id: timeMeasureItemMouseArea - - anchors.fill: parent - - onPressed: { - timelineFlickable.movingPlayHead = true; - _timelineView.setNewTimePosition(mouse.x) - } - onPositionChanged: _timelineView.setNewTimePosition(mouse.x) - onReleased: timelineFlickable.movingPlayHead = false; - } - } - - ListView { - id: timelineItemsList - - Layout.fillWidth: true - Layout.fillHeight: true - Layout.preferredHeight: count * itemHeight - Layout.preferredWidth: root.width - - ScrollBar.vertical: scrollBar - - model: browserList.model - boundsBehavior: Flickable.StopAtBounds - clip: true - currentIndex: browserList.currentIndex - - delegate: Rectangle { - id: timelineItemsDelegateItem - - property int extraHeight: model.propertyExpanded ? itemExtraHeight : 0 - - width: parent.width - height: model.parentExpanded && model.visible ? itemHeight + extraHeight - : 0 - - color: model.selected ? _selectionColor : "#404244" - border.color: _backgroundColor - - visible: height > 0 - - MouseArea { - id: timelineItemsDelegateArea - - anchors.fill: parent - onClicked: _timelineView.select(model.index, mouse.modifiers) - } - - Component { - id: standardTimelineItem - - TimelineItem { - height: parent ? parent.height : 0 - visible: timeInfo.endPosition > timeInfo.startPosition - - timeInfo: model.timeInfo - color: model.itemColor - borderColor: root.color - selected: model.selected - selectionColor: model.selectedColor - } - } - - Component { - id: propertyTimelineItem - - TimePropertyItem { - height: parent ? parent.height : 0 - width: parent ? parent.width : 0 - timeRatio: _timelineView.timeRatio - timelineRow: model.timelineRow - } - } - - Loader { - anchors.fill: parent - sourceComponent: model.propertyExpanded ? propertyTimelineItem - : standardTimelineItem - } - - Keyframes { - anchors { - top: parent.top - topMargin: 10 - } - keyframes: model.keyframes - } - } - } - } - - PlayHead { - x: _timelineView.currentTimePos - width / 2 - height: parent.height - scrollBar.height - } - } - } - } - - Rectangle { - color: root.color - x: splitterPos - width: 5 - height: parent.height - - MouseArea { - anchors { - fill: parent - margins: -3 // small trick to avoid the cursor changing back to arrow when dragging - } - - hoverEnabled: true - cursorShape: containsMouse ? Qt.SplitHCursor : Qt.ArrowCursor - onPositionChanged: { - if (mouse.buttons === Qt.LeftButton) - root.splitterPos = mapToItem(root, mouse.x, mouse.y).x - } - } - } -} diff --git a/src/Authoring/Studio/Palettes/Timeline/TimelineFilter.cpp b/src/Authoring/Studio/Palettes/Timeline/TimelineFilter.cpp deleted file mode 100644 index 5ef25911..00000000 --- a/src/Authoring/Studio/Palettes/Timeline/TimelineFilter.cpp +++ /dev/null @@ -1,246 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2002 NVIDIA Corporation. -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt 3D Studio. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -//============================================================================== -// Prefix -//============================================================================== - -#include "stdafx.h" - -//============================================================================== -// Includes -//============================================================================== -#include "TimelineFilter.h" -#include "Bindings/ITimelineItemProperty.h" -#include "Bindings/ITimelineItem.h" - -//============================================================================= -/** - * Constructor - */ -CFilter::CFilter() - : m_ShowBehaviors(true) - , m_ShowMaterials(true) - , m_ShowProperties(true) - , m_ShowShy(true) - , m_ShowLocked(true) - , m_ShowVisible(true) - , m_IsExpanded(true) -{ -} - -//============================================================================= -/** - * Destructor - */ -CFilter::~CFilter() -{ -} - -//============================================================================= -/** - * @return true if behaviors should be shown, false if they should be hidden - */ -bool CFilter::GetBehaviors() const -{ - return m_ShowBehaviors; -} - -//============================================================================= -/** - * @return true if materials should be shown, false if they should be hidden - */ -bool CFilter::GetMaterials() const -{ - return m_ShowMaterials; -} - -//============================================================================= -/** - * @return true if properties should be shown, false if they should be hidden - */ -bool CFilter::GetProperties() const -{ - return m_ShowProperties; -} - -//============================================================================= -/** - * @return true if shy objects should still be shown, false if they should be hidden - */ -bool CFilter::GetShy() const -{ - return m_ShowShy; -} - -//============================================================================= -/** - * @return true if locked objects should still be shown, false if they should be hidden - */ -bool CFilter::GetLocked() const -{ - return m_ShowLocked; -} - -//============================================================================= -/** - * Sets whether or not to show behaviors on objects. - * @param inShow true to show behaviors, false to hide behaviors - */ -void CFilter::SetBehaviors(bool inShow /*= true*/) -{ - m_ShowBehaviors = inShow; -} - -//============================================================================= -/** - * Sets whether or not to show materials on objects. - * @param inShow true to show materials, false to hide materials - */ -void CFilter::SetMaterials(bool inShow /*= true*/) -{ - m_ShowMaterials = inShow; -} - -//============================================================================= -/** - * Sets whether or not to show properties on objects. - * @param inShow true to show properties, false to hide properties - */ -void CFilter::SetProperties(bool inShow /*= true*/) -{ - m_ShowProperties = inShow; -} - -//============================================================================= -/** - * Sets whether or not to show objects with the shy flag. - * @param inShow true to show shy objects, false to hide shy objects - */ -void CFilter::SetShy(bool inShow /*= true*/) -{ - m_ShowShy = inShow; -} - -//============================================================================= -/** - * Sets whether or not to show objects with the locked flag. - * @param inShow true to show locked objects, false to hide locked objects - */ -void CFilter::SetLocked(bool inShow /*= true*/) -{ - m_ShowLocked = inShow; -} - -//============================================================================= -/** - * Sets whether or not the parent object is expanded. - * If the parent is not expanded then nothing should be visible. - */ -void CFilter::SetExpanded(bool inIsExpanded /*= true*/) -{ - m_IsExpanded = inIsExpanded; -} - -//============================================================================= -/** - * Sets whether or not to show objects that are not visible. - * @param inIsVisible true to show non-visible objects, false to hide them. - */ -void CFilter::SetVisible(bool inIsVisible /*= true*/) -{ - m_ShowVisible = inIsVisible; -} - -//============================================================================= -/** - * Gets whether or not non-visible objects should be displayed. - * @return true if non-visible objects should be displayed. - */ -bool CFilter::GetVisible() const -{ - return m_ShowVisible; -} - -//============================================================================= -/** - * Gets whether or not the parent object is expanded. - * If the parent is not expanded then nothing should be visible. - */ -bool CFilter::IsExpanded() const -{ - return m_IsExpanded; -} - -//============================================================================= -/** - * Checks to see if the specified property should be displayed or not. - * @return true if the property should be visible. - */ -bool CFilter::Filter(ITimelineItemProperty *inTimelineItemProperty) const -{ - Q_UNUSED(inTimelineItemProperty); - - bool theVisibleFlag = GetProperties(); - theVisibleFlag &= IsExpanded(); - - return theVisibleFlag; -} - -//============================================================================= -/** - * Checks to see if the specified state should be displayed or not. - * @return true if the state should be visible. - */ -bool CFilter::Filter(ITimelineItem *inTimelineItem) const -{ - bool theVisibleFlag = true; - - // If this row is shy, we need to check the filter for shy objects - if (inTimelineItem->IsShy()) - theVisibleFlag &= GetShy(); - - // If this row is locked, we need to check the filter for locked objects - if (inTimelineItem->IsLocked()) - theVisibleFlag &= GetLocked(); - - // This is for hiding visible eye toggle objects - if (!inTimelineItem->IsVisible()) - theVisibleFlag &= GetVisible(); - - // If this row is a behavior, we need to check the filter for behaviors - if (inTimelineItem->GetObjectType() == OBJTYPE_BEHAVIOR) - theVisibleFlag &= GetBehaviors(); - - // If this row is a material, we need to check the filter for materials - if (inTimelineItem->GetObjectType() == OBJTYPE_MATERIAL) - theVisibleFlag &= GetMaterials(); - - return theVisibleFlag; -}
\ No newline at end of file diff --git a/src/Authoring/Studio/Palettes/Timeline/TimelineFilter.h b/src/Authoring/Studio/Palettes/Timeline/TimelineFilter.h deleted file mode 100644 index e956b4da..00000000 --- a/src/Authoring/Studio/Palettes/Timeline/TimelineFilter.h +++ /dev/null @@ -1,84 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2002 NVIDIA Corporation. -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt 3D Studio. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -//============================================================================== -// Prefix -//============================================================================== - -#ifndef INCLUDED_FILTER_H -#define INCLUDED_FILTER_H 1 - -#pragma once - -//============================================================================== -// Forward -//============================================================================== -class ITimelineItem; -class ITimelineItemProperty; - -//============================================================================= -/** - * Filter class for determining what objects to show in the timeline. - */ -class CFilter -{ -public: - CFilter(); - virtual ~CFilter(); - - bool GetBehaviors() const; - bool GetMaterials() const; - bool GetProperties() const; - bool GetShy() const; - bool GetLocked() const; - bool GetVisible() const; - void SetBehaviors(bool inShow = true); - void SetMaterials(bool inShow = true); - void SetProperties(bool inShow = true); - void SetShy(bool inShow = true); - void SetLocked(bool inShow = true); - void SetVisible(bool inShow = true); - - void SetExpanded(bool inExpanded = true); - bool IsExpanded() const; - - bool Filter(ITimelineItemProperty *inTimelineItemProperty) const; - bool Filter(ITimelineItem *inTimelineItem) const; - -protected: - bool m_ShowBehaviors; - bool m_ShowMaterials; - bool m_ShowProperties; - bool m_ShowShy; - bool m_ShowLocked; - bool m_ShowVisible; - bool m_IsExpanded; -}; - -#endif // INCLUDED_FILTER_H diff --git a/src/Authoring/Studio/Palettes/Timeline/TimelineItem.qml b/src/Authoring/Studio/Palettes/Timeline/TimelineItem.qml deleted file mode 100644 index ca4a3f9f..00000000 --- a/src/Authoring/Studio/Palettes/Timeline/TimelineItem.qml +++ /dev/null @@ -1,101 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt 3D Studio. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQuick 2.8 -import QtQuick.Controls 2.2 -import QtQuick.Layouts 1.3 -import "../controls" - -Item { - id: root - - property var timeInfo - property bool selected: false - property alias color: itemRect.color - property string selectionColor: "black" - property string borderColor: "black" - - x: timeInfo.lifeStart - width: timeInfo.lifeEnd - timeInfo.lifeStart - - Row { - Rectangle { - width: timeInfo.startPosition - timeInfo.lifeStart - height: root.height - border.color: borderColor - border.width: 1 - color: "gray" // TODO: use a real hashed rectangle - } - - Rectangle { - id: itemRect - - width: timeInfo.endPosition - timeInfo.startPosition - height: root.height - border.color: borderColor - border.width: 1 - gradient: Gradient { - GradientStop { - position: 0.0 - color: Qt.lighter(root.color, 1.1) - } - - GradientStop { - position: 0.5 - color: root.color - } - - GradientStop { - position: 1.0 - color: Qt.darker(root.color, 1.1) - } - } - } - - Rectangle { - width: timeInfo.lifeEnd - timeInfo.endPosition - height: root.height - border.color: borderColor - border.width: 1 - color: "gray" // TODO: use a real hashed rectangle - } - } - - Rectangle { - id: selectionRect - - anchors { - fill: parent - topMargin: 3 - bottomMargin: 7 - leftMargin: 2 - rightMargin: 2 - } - visible: root.selected - color: selectionColor - } -} diff --git a/src/Authoring/Studio/Palettes/Timeline/TimelineKeyframe.cpp b/src/Authoring/Studio/Palettes/Timeline/TimelineKeyframe.cpp deleted file mode 100644 index 36946432..00000000 --- a/src/Authoring/Studio/Palettes/Timeline/TimelineKeyframe.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 NVIDIA Corporation. -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt 3D Studio. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "stdafx.h" - -#include "TimelineKeyframe.h" -#include "Renderer.h" - -CTimelineKeyframe::CTimelineKeyframe() - : m_Time(0) - , m_IsDynamic(false) -{ -} - -CTimelineKeyframe::~CTimelineKeyframe() -{ -} - -void CTimelineKeyframe::SetTime(long inTime) -{ - m_Time = inTime; -} - -long CTimelineKeyframe::GetTime() -{ - return m_Time; -} - -//============================================================================= -/** - * called when this key is made dynamic - * @param inIsDynamic true if the keyframe is dynamic - */ -void CTimelineKeyframe::SetDynamic(bool inIsDynamic) -{ - if (m_IsDynamic != inIsDynamic) { - m_IsDynamic = inIsDynamic; - // Invalidate( ); - } -} - -//============================================================================= -/** - * @return true if dynamic - */ -bool CTimelineKeyframe::IsDynamic() -{ - return m_IsDynamic; -} diff --git a/src/Authoring/Studio/Palettes/Timeline/TimelineKeyframe.h b/src/Authoring/Studio/Palettes/Timeline/TimelineKeyframe.h deleted file mode 100644 index a08f553c..00000000 --- a/src/Authoring/Studio/Palettes/Timeline/TimelineKeyframe.h +++ /dev/null @@ -1,57 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 NVIDIA Corporation. -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt 3D Studio. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef INCLUDED_TIMELINE_KEYFRAME -#define INCLUDED_TIMELINE_KEYFRAME 1 - -#pragma once -class CRenderer; - -class CTimelineKeyframe -{ -public: - CTimelineKeyframe(); - ~CTimelineKeyframe(); - virtual void Draw(CRenderer *inRenderer) = 0; - - virtual void SetTime(long inTime); - virtual long GetTime(); - - void SetDynamic(bool inIsDynamic); - bool IsDynamic(); - - static const long DRAGBUFFER = - 3; // Specifies how many pixels a keframe should be dragged before it actually moves - -protected: - long m_Time; - bool m_IsDynamic; -}; - -#endif // INCLUDED_TIMELINE_KEYFRAME
\ No newline at end of file diff --git a/src/Authoring/Studio/Palettes/Timeline/TimelineObjectModel.cpp b/src/Authoring/Studio/Palettes/Timeline/TimelineObjectModel.cpp deleted file mode 100644 index 0f908aa9..00000000 --- a/src/Authoring/Studio/Palettes/Timeline/TimelineObjectModel.cpp +++ /dev/null @@ -1,572 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt 3D Studio. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "TimelineObjectModel.h" - -#include "ClientDataModelBridge.h" -#include "ColorControl.h" -#include "Core.h" -#include "Doc.h" -#include "IKeyframe.h" -#include "SlideRow.h" -#include "StateRow.h" -#include "PropertyRow.h" -#include "Bindings/ITimelineItemBinding.h" -#include "Bindings/ITimelineItem.h" -#include "Bindings/ITimelineTimebar.h" -#include "Bindings/Qt3DSDMTimelineItemBinding.h" -#include "Qt3DSDMAnimation.h" -#include "Qt3DSDMDataCore.h" -#include "Qt3DSDMHandles.h" -#include "Qt3DSDMStudioSystem.h" -#include "StudioUtils.h" -#include "StudioPreferences.h" - -#include <QDebug> - - -TimelineObjectModel::~TimelineObjectModel() -{ - m_rows.clear(); - m_timelineItemBinding = nullptr; -} - -QHash<int, QByteArray> TimelineObjectModel::roleNames() const -{ - auto names = ObjectListModel::roleNames(); - names.insert(TimelineRowRole, "timelineRow"); - names.insert(SelectedRole, "selected"); - names.insert(SelectedColorRole, "selectedColor"); - names.insert(ItemColorRole, "itemColor"); - names.insert(TimeInfoRole, "timeInfo"); - names.insert(KeyframesRole, "keyframes"); - names.insert(ShyRowRole, "shy"); - names.insert(VisibleRowRole, "rowVisible"); - names.insert(LockedRowRole, "locked"); - names.insert(IsPropertyRole, "isProperty"); - names.insert(PropertyExpandedRole, "propertyExpanded"); - names.insert(VisibleRole, "visible"); - names.insert(HasActionRole, "hasAction"); - names.insert(HasMasterActionRole, "hasMasterAction"); - names.insert(HasChildActionRole, "hasChildAction"); - names.insert(HasMasterChildActionRole, "hasMasterChildAction"); - names.insert(HasComponentActionRole, "hasComponentAction"); - names.insert(HasMasterComponentActionRole, "hasMasterComponentAction"); - - return names; -} - -QVariant TimelineObjectModel::data(const QModelIndex &index, int role) const -{ - if (!hasIndex(index.row(), index.column(), index.parent())) - return {}; - - auto timelineRow = const_cast<TimelineObjectModel*>(this)->timelineRowForIndex(index); - - if (!timelineRow) { - return {}; - } - - auto propertyRow = dynamic_cast<CPropertyRow *>(timelineRow); - if (propertyRow) { - return dataForProperty(propertyRow, index, role); - } - - auto timelineItemBinding = timelineRow->GetTimelineItemBinding(); - auto timelineItem = timelineItemBinding->GetTimelineItem(); - - switch (role) { - case TimelineRowRole: { - return QVariant::fromValue(timelineRow); - } - case SelectedRole: { - return timelineRow->IsSelected(); - } - case ItemColorRole: { - auto timebar = timelineItem->GetTimebar(); - - auto color = timebar->GetTimebarColor().getQColor(); - return color.name(); - } - case SelectedColorRole: { - auto timebar = timelineItem->GetTimebar(); - - auto color = CColorControl::CalculateSelectedColor(timebar->GetTimebarColor()).getQColor(); - return color.name(); - } - case TimeInfoRole: { - auto timebar = timelineItem->GetTimebar(); - - const auto startTime = timebar->GetStartTime(); - const auto endTime = timebar->GetEndTime(); - const auto timeRatio = timelineRow->GetTimeRatio(); - - TimebarTimeInfo timeInfo; - timeInfo.m_lifeStart = ::TimeToPos(startTime, timeRatio); - timeInfo.m_lifeEnd = ::TimeToPos(endTime, timeRatio); - timeInfo.m_startPosition = ::TimeToPos(timelineRow->GetActiveStart(), timeRatio); - timeInfo.m_endPosition = ::TimeToPos(timelineRow->GetActiveEnd(), timeRatio); - - return QVariant::fromValue(timeInfo); - } - case KeyframesRole: { - QVariantList keyframes; - const auto timeRatio = timelineRow->GetTimeRatio(); - - long keyframeCount = timelineItemBinding->GetKeyframeCount(); - for (long i = 0; i < keyframeCount; ++i) { - auto key = timelineItemBinding->GetKeyframeByIndex(i); - appendKey(keyframes, key, timeRatio); - } - - - return keyframes; - } - - case ShyRowRole: { - return timelineItem->IsShy(); - } - - case VisibleRowRole: { - return timelineItem->IsVisible(); - } - - case LockedRowRole: { - return timelineItem->IsLocked(); - } - - case VisibleRole: { - return isVisible(index); - } - - case IsPropertyRole: { - return false; - } - case PropertyExpandedRole: { - return false; - } - case HasActionRole: { - return timelineItem->HasAction(false); - } - - case HasMasterActionRole:{ - return timelineItem->HasAction(true); - } - - case HasChildActionRole: { - return timelineItem->ChildrenHasAction(false); - } - - case HasMasterChildActionRole: { - return timelineItem->ChildrenHasAction(true); - } - - case HasComponentActionRole: { - return timelineItem->ComponentHasAction(false); - } - - case HasMasterComponentActionRole: { - return timelineItem->ComponentHasAction(true); - } - - default: ; - } - - return ObjectListModel::data(index, role); -} - -bool TimelineObjectModel::setData(const QModelIndex &index, const QVariant &value, int role) -{ - if (!hasIndex(index.row(), index.column(), index.parent())) - return false; - - auto timelineRow = const_cast<TimelineObjectModel*>(this)->timelineRowForIndex(index); - - if (!timelineRow) - return false; - - auto propertyRow = dynamic_cast<CPropertyRow *>(timelineRow); - if (propertyRow) { - switch (role) { - case PropertyExpandedRole: - propertyRow->setExpanded(value.toBool()); - emit dataChanged(index, index, {role}); - return true; - } - return false; - } - - auto timelineItemBinding = timelineRow->GetTimelineItemBinding(); - auto timelineItem = timelineItemBinding->GetTimelineItem(); - - QVariant result; - switch (role) { - case ShyRowRole: - timelineItem->SetShy(value.toBool()); - break; - case VisibleRowRole: - timelineItem->SetVisible(value.toBool()); - break; - case LockedRowRole: - timelineItem->SetLocked(value.toBool()); - break; - } - if (!result.isValid()) - return ObjectListModel::setData(index, value, role); - - emit dataChanged(index, index, {role}); - - return true; -} - -QVariant TimelineObjectModel::dataForProperty(CPropertyRow *propertyRow, const QModelIndex &index, int role) const -{ - auto timelineItemProperty = propertyRow->GetProperty(); - if (!timelineItemProperty) - return {}; - - switch (role) { - case PropertyExpandedRole: { - return propertyRow->expanded(); - } - case TimelineRowRole: { - return QVariant::fromValue(propertyRow); - } - case SelectedRole: { - return propertyRow->IsSelected(); - } - case ItemColorRole: { - return propertyRow->GetTimebarBackgroundColor().getQColor().name(); - } - case SelectedColorRole: { - return propertyRow->GetTimebarHighlightBackgroundColor().getQColor().name(); - } - case TimeInfoRole: { - return data(index.parent(), role); - } - case KeyframesRole: { - QVariantList keyframes; - const auto timeRatio = propertyRow->GetTimeRatio(); - - auto timelineItemProperty = propertyRow->GetProperty(); - long keyframeCount = timelineItemProperty->GetKeyframeCount(); - for (long i = 0; i < keyframeCount; ++i) { - auto key = timelineItemProperty->GetKeyframeByIndex(i); - appendKey(keyframes, key, timeRatio); - } - - return keyframes; - } - - // roles from ObjectListModel - case NameRole: { - return timelineItemProperty->GetName().toQString(); - } - - case IconRole: { - return resourceImageUrl() + "Objects-Property-Normal.png"; - } - case TextColorRole: { - auto textColor = CStudioPreferences::GetNormalColor(); - if (timelineItemProperty->IsMaster()) - textColor = CStudioPreferences::GetMasterColor(); - - return textColor.getQColor().name(); - } - - case PathReferenceRole: - case AbsolutePathRole: - return {}; - - - case IsPropertyRole: { - return true; - } - - case VisibleRole: { - return isVisible(index); - } - - case HasActionRole: - case HasMasterActionRole: - case HasChildActionRole: - case HasMasterChildActionRole: - case HasComponentActionRole: - case HasMasterComponentActionRole: - return false; - - default: ; - } - - return ObjectListModel::data(index, role); -} - -QModelIndex TimelineObjectModel::parent(const QModelIndex &index) const -{ - const auto handle = handleForIndex(index); - auto it = m_properties.constBegin(); - while (it != m_properties.constEnd()) { - if (it->contains(handle)) { - return indexForHandle(it.key()); - } - ++it; - } - - return ObjectListModel::parent(index); -} - -void TimelineObjectModel::setTimelineItemBinding(ITimelineItemBinding *inTimelineItem) -{ - Q_ASSERT(inTimelineItem); - m_timelineItemBinding = inTimelineItem; -} - -CTimelineRow* TimelineObjectModel::timelineRowForIndex(const QModelIndex &index) -{ - if (!index.parent().isValid()) { - if (!m_slideRow) { - m_slideRow.reset(new CSlideRow(nullptr)); - Q_ASSERT(m_timelineItemBinding); - m_slideRow->Initialize(m_timelineItemBinding); - m_rows[m_baseHandle.GetHandleValue()] = m_slideRow.data(); - } - return m_slideRow.data(); - } else { - const auto handle = handleForIndex(index).GetHandleValue(); - - if (!m_rows.contains(handle)) { - int propertyCount = m_properties.value(handleForIndex(index.parent()), {}).count(); - - auto parentRow = dynamic_cast<CBaseStateRow*>(timelineRowForIndex(index.parent())); - Q_ASSERT(parentRow); - auto parentBinding = parentRow->GetTimelineItemBinding(); - - if (propertyCount > 0 && index.row() < propertyCount && - dynamic_cast<Qt3DSDMTimelineItemBinding *>(parentBinding)) { - auto binding = static_cast<Qt3DSDMTimelineItemBinding *>(parentBinding); - - CPropertyRow *propertyRow = nullptr; - - // check if the property row was already created - // KDAB_TODO can we remove this once we get rid of the legacy timeline view? - if (auto propertyBinding = binding->GetPropertyBinding(handle)) - propertyRow = propertyBinding->GetRow(); - - // Mahmoud_TODO: this whole class will be removed -// if (propertyRow == nullptr) -// propertyRow = binding->AddPropertyRow(handle); - - Q_ASSERT(propertyRow); - - connect(propertyRow, &CTimelineRow::timeRatioChanged, this, [this, index] { - emit dataChanged(index, index, {TimeInfoRole, KeyframesRole}); - }); - - connect(propertyRow, &CTimelineRow::dirtyChanged, this, [this, index] { - emit dataChanged(index, index, {}); - }); - - m_rows[handle] = propertyRow; - - return propertyRow; - } else { - // TODO: - // the second "true" argument assumes it is loaded, avoids calling LoadChildren - // this is temporary here, as long as the old timeline code is still used - auto stateRow = new CStateRow(parentRow, true); - auto itemBinding = parentBinding->GetChild(index.row() - propertyCount); - itemBinding->setCreateUIRow(false); - stateRow->Initialize(itemBinding); - itemBinding->SetParent(parentBinding); // KDAB_TODO do we really need it? - m_rows[handle] = stateRow; - - connect(stateRow, &CTimelineRow::selectedChanged, this, [this, index] { - emit dataChanged(index, index, {SelectedRole}); - }); - - connect(stateRow, &CTimelineRow::timeRatioChanged, this, [this, index] { - emit dataChanged(index, index, {TimeInfoRole, KeyframesRole}); - }); - - connect(stateRow, &CTimelineRow::dirtyChanged, this, [this, index] { - // update item and its children - auto nextIndex = this->index(index.row() + 1, 0, index.parent()); - if (!nextIndex.isValid()) - nextIndex = index; - emit dataChanged(index, nextIndex, {}); - }); - - return stateRow; - } - } - - return m_rows[handle]; - } - - Q_ASSERT(0); - return nullptr; -} - -void TimelineObjectModel::addProperty(qt3dsdm::Qt3DSDMInstanceHandle parentInstance, - qt3dsdm::Qt3DSDMPropertyHandle property) -{ - auto parentIndex = indexForHandle(parentInstance); - - // addProperty and removeProperty are called multiple times for properties with multiple - // components, e.g. Position, so check if the property was already inserted in m_properties - if (m_properties.value(parentInstance.GetHandleValue(), {}).contains(property)) - return; - - auto children = childrenList(m_slideHandle, parentInstance); - auto it = std::find(children.begin(), children.end(), property); - Q_ASSERT(it != children.end()); - int propertyIndex = std::distance(children.begin(), it); - - // Now we rely on rowCount calling childrenList, thus getting the new rows automatically - beginInsertRows(parentIndex, propertyIndex, propertyIndex); - endInsertRows(); -} - -void TimelineObjectModel::removeProperty(qt3dsdm::Qt3DSDMInstanceHandle parentInstance, - qt3dsdm::Qt3DSDMPropertyHandle property) -{ - auto parentIndex = indexForHandle(parentInstance); - - auto parentHandle = parentInstance.GetHandleValue(); - if (!m_properties.contains(parentHandle)) - return; - - auto& properties = m_properties[parentHandle]; - - auto propertyIndex = properties.indexOf(property); - if (propertyIndex == -1) - return; - - properties.remove(propertyIndex); - - // Now we rely on rowCount calling childrenList, thus getting the new rows automatically - beginRemoveRows(parentIndex, propertyIndex, propertyIndex); - endRemoveRows(); -} - -void TimelineObjectModel::setHideShy(bool enabled) -{ - m_hideShy = enabled; - Q_EMIT roleUpdated(VisibleRole); -} - -void TimelineObjectModel::setHideHidden(bool enabled) -{ - m_hideHidden = enabled; - Q_EMIT roleUpdated(VisibleRole); -} - -void TimelineObjectModel::setHideLocked(bool enabled) -{ - m_hideLocked = enabled; - Q_EMIT roleUpdated(VisibleRole); -} - -void TimelineObjectModel::updateActions() -{ - Q_EMIT rolesUpdated({HasActionRole, HasChildActionRole, HasComponentActionRole, - HasMasterActionRole, HasMasterChildActionRole, - HasMasterComponentActionRole}); -} - -qt3dsdm::TInstanceHandleList TimelineObjectModel::childrenList(const qt3dsdm::Qt3DSDMSlideHandle &slideHandle, const qt3dsdm::Qt3DSDMInstanceHandle &handle) const -{ - auto studioSystem = m_core->GetDoc()->GetStudioSystem(); - auto propertySystem = studioSystem->GetPropertySystem(); - qt3dsdm::SValue typeValue; - propertySystem->GetInstancePropertyValue(handle, studioSystem->GetClientDataModelBridge() - ->GetTypeProperty(), typeValue); - qt3dsdm::DataModelDataType::Value valueType(qt3dsdm::GetValueType(typeValue)); - if (valueType == qt3dsdm::DataModelDataType::None) - return {}; - - qt3dsdm::TPropertyHandleList properties; - propertySystem->GetAggregateInstanceProperties(handle, properties); - QVector<qt3dsdm::Qt3DSDMInstanceHandle> animatedProperties; - for (const auto &propertyHandle: properties) { - if (studioSystem->GetAnimationSystem()->IsPropertyAnimated( - handle, propertyHandle)) { - animatedProperties.append(propertyHandle); - } - } - m_properties[handle] = animatedProperties; - - qt3dsdm::TInstanceHandleList children(animatedProperties.begin(), animatedProperties.end()); - auto objectChildren = ObjectListModel::childrenList(slideHandle, handle); - children.insert(children.end(), objectChildren.begin(), objectChildren.end()); - - return children; -} - -void TimelineObjectModel::appendKey(QVariantList &keyframes, IKeyframe *key, double timeRatio) const -{ - try { - KeyframeInfo keyInfo; - keyInfo.m_time = key->GetTime(); - keyInfo.m_selected = key->IsSelected(); - keyInfo.m_dynamic = key->IsDynamic(); - keyInfo.m_position = ::TimeToPos(keyInfo.m_time, timeRatio); - - keyframes.append(QVariant::fromValue(keyInfo)); - } catch (qt3dsdm::AnimationKeyframeNotFound) { - // happens when the keyframe was removed and added again. This is because - // CStudioAnimationSystem::Deanimate does not erase the keyframes, just - // marks as being deleted for later reuse. If the UI requests an update - // while a keyframe has no associated animation, this exception is triggered - } -} - -bool TimelineObjectModel::isVisible(const QModelIndex &index) const -{ - auto idx = index; - while (idx.isValid()) { - auto row = const_cast<TimelineObjectModel*>(this)->timelineRowForIndex(idx); - - if (!row) - return false; - - auto binding = row->GetTimelineItemBinding(); - if (binding) { - auto item = binding->GetTimelineItem(); - - auto hidden = (m_hideShy && item->IsShy()) || - (m_hideHidden && !item->IsVisible()) || - (m_hideLocked && item->IsLocked()); - - if (hidden) - return false; - } - idx = idx.parent(); - } - - return true; -} diff --git a/src/Authoring/Studio/Palettes/Timeline/TimelineObjectModel.h b/src/Authoring/Studio/Palettes/Timeline/TimelineObjectModel.h deleted file mode 100644 index 57e2e36e..00000000 --- a/src/Authoring/Studio/Palettes/Timeline/TimelineObjectModel.h +++ /dev/null @@ -1,149 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt 3D Studio. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef TIMELINEOBJECTMODEL_H -#define TIMELINEOBJECTMODEL_H - -#include "ObjectListModel.h" - -#include "TimelineRow.h" - -#include <QSharedPointer> - -class CSlideRow; -class CPropertyRow; -class IKeyframe; -class ITimelineItemBinding; - -struct TimebarTimeInfo { - Q_PROPERTY(double startPosition MEMBER m_startPosition FINAL) - Q_PROPERTY(double endPosition MEMBER m_endPosition FINAL) - Q_PROPERTY(double lifeStart MEMBER m_lifeStart FINAL) - Q_PROPERTY(double lifeEnd MEMBER m_lifeEnd FINAL) - - double m_startPosition = 0; - double m_endPosition = 0; - double m_lifeStart = 0; - double m_lifeEnd = 0; - - Q_GADGET -}; - -struct KeyframeInfo { - Q_PROPERTY(double position MEMBER m_position FINAL) - Q_PROPERTY(long time MEMBER m_time FINAL) - Q_PROPERTY(bool selected MEMBER m_selected FINAL) - Q_PROPERTY(bool dynamic MEMBER m_dynamic FINAL) - - long m_time; - bool m_selected; - bool m_dynamic; - double m_position; - - Q_GADGET -}; - -Q_DECLARE_METATYPE(TimebarTimeInfo) -Q_DECLARE_METATYPE(KeyframeInfo) - -class TimelineObjectModel : public ObjectListModel -{ - Q_OBJECT - -public: - using ObjectListModel::ObjectListModel; - ~TimelineObjectModel() override; - - enum Roles { - TimelineRowRole = ObjectListModel::LastRole + 100, - ItemColorRole, - SelectedColorRole, - SelectedRole, - TimeInfoRole, - KeyframesRole, - ShyRowRole, - VisibleRowRole, - LockedRowRole, - IsPropertyRole, - PropertyExpandedRole, - VisibleRole, - HasActionRole, - HasMasterActionRole, - HasChildActionRole, - HasMasterChildActionRole, - HasComponentActionRole, - HasMasterComponentActionRole - }; - - QHash<int, QByteArray> roleNames() const override; - QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; - bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override; - QVariant dataForProperty(CPropertyRow *propertyRow, const QModelIndex &index, - int role = Qt::DisplayRole) const; - QModelIndex parent(const QModelIndex &index) const override; - - void setTimelineItemBinding(ITimelineItemBinding *inTimelineItem); - - CTimelineRow* timelineRowForIndex(const QModelIndex &index); - - void addProperty(qt3dsdm::Qt3DSDMInstanceHandle parentInstance, - qt3dsdm::Qt3DSDMPropertyHandle property); - void removeProperty(qt3dsdm::Qt3DSDMInstanceHandle parentInstance, - qt3dsdm::Qt3DSDMPropertyHandle property); - - void setHideShy(bool enabled); - bool hideShy() const { return m_hideShy; } - void setHideHidden(bool enabled); - bool hideHidden() const { return m_hideHidden; } - void setHideLocked(bool enabled); - bool hideLocked() const { return m_hideLocked; } - - void updateActions(); - -protected: - qt3dsdm::TInstanceHandleList childrenList(const qt3dsdm::Qt3DSDMSlideHandle &slideHandle, - const qt3dsdm::Qt3DSDMInstanceHandle &handle) const override; - - - -private: - void appendKey(QVariantList &keyframes, IKeyframe *key, double timeRatio) const; - bool isVisible(const QModelIndex &index) const; - - QSharedPointer<CSlideRow> m_slideRow; - ITimelineItemBinding *m_timelineItemBinding = nullptr; - QHash<int, CTimelineRow* > m_rows; - mutable QHash<int, QVector<qt3dsdm::Qt3DSDMInstanceHandle> > m_properties; - - bool m_hideShy = false; - bool m_hideHidden = false; - bool m_hideLocked = true; -}; - -Q_DECLARE_METATYPE(CTimelineRow *); - -#endif // TIMELINEOBJECTMODEL_H diff --git a/src/Authoring/Studio/Palettes/Timeline/TimelineRow.cpp b/src/Authoring/Studio/Palettes/Timeline/TimelineRow.cpp deleted file mode 100644 index 3eb27132..00000000 --- a/src/Authoring/Studio/Palettes/Timeline/TimelineRow.cpp +++ /dev/null @@ -1,204 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 NVIDIA Corporation. -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt 3D Studio. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "stdafx.h" - -#include "TimelineRow.h" -#include "TimelineUIFactory.h" -#include "StudioPreferences.h" -#include "StudioObjectTypes.h" - -#include "Bindings/ITimelineItemBinding.h" - -const long CTimelineRow::TREE_INDENT = CStudioPreferences::GetRowSize(); - -CTimelineRow::CTimelineRow(CTimelineRow *parent) - : QObject(parent) - , m_ParentRow(nullptr) - , m_IsViewable(false) - , m_ActiveStart(0) - , m_ActiveEnd(0) -{ -} - -CTimelineRow::~CTimelineRow() -{ - TimelineUIFactory::instance()->deleteRowUI(this); -} - -void CTimelineRow::SetParent(CTimelineRow *inParent) -{ - if (m_ParentRow != inParent) { - m_ParentRow = inParent; - TimelineUIFactory::instance()->setParentForRowUI(this, m_ParentRow); - } -} - -//============================================================================= -/** - * Gets the Parent Row - */ -CTimelineRow *CTimelineRow::GetParentRow() const -{ - return m_ParentRow; -} - -void CTimelineRow::SetTimeRatio(double inTimeRatio) -{ - if (m_TimeRatio != inTimeRatio) { - m_TimeRatio = inTimeRatio; - emit timeRatioChanged(inTimeRatio); - } -} - -double CTimelineRow::GetTimeRatio() -{ - return m_TimeRatio; -} - -bool CTimelineRow::IsViewable() const -{ - return m_IsViewable; -} - - -//============================================================================= -/** - * Retrieves the background color for the row based upon the type of asset - * passed in. - * @param inType specifies which asset type you want the color for - * @return background color to use for this row - */ -::CColor CTimelineRow::GetTimebarBackgroundColor(EStudioObjectType inType) -{ - ::CColor theColor; - - switch (inType) { - case OBJTYPE_LAYER: - theColor = CStudioPreferences::GetLayerBackgroundColor(); - break; - - case OBJTYPE_GROUP: - case OBJTYPE_COMPONENT: - theColor = CStudioPreferences::GetGroupBackgroundColor(); - break; - - default: - theColor = CStudioPreferences::GetObjectBackgroundColor(); - break; - } - - return theColor; -} - -//============================================================================= -/** - * Retrieves the background color for the row when the mouse is over the row, - * based upon the type of asset passed in. - * @param inType specifies which asset type you want the color for - * @return background color to use for this row when the mouse is over the row - */ -::CColor CTimelineRow::GetTimebarHighlightBackgroundColor(EStudioObjectType inType) -{ - ::CColor theColor; - - switch (inType) { - case OBJTYPE_LAYER: - theColor = CStudioPreferences::GetMouseOverHighlightColor(); - break; - - case OBJTYPE_GROUP: - case OBJTYPE_COMPONENT: - theColor = CStudioPreferences::GetMouseOverHighlightColor(); - break; - - default: - theColor = CStudioPreferences::GetMouseOverHighlightColor(); - break; - } - - return theColor; -} - -long CTimelineRow::GetLatestEndTime() -{ - return 0; -} - -void CTimelineRow::Dispose() -{ - delete this; -} - -bool CTimelineRow::isExpanded() const -{ - return m_IsExpanded; -} - -long CTimelineRow::GetActiveStart() -{ - return m_ActiveStart; -} - -long CTimelineRow::GetActiveEnd() -{ - return m_ActiveEnd; -} - -void CTimelineRow::setDirty(bool dirty) -{ - if (m_Dirty == dirty) - return; - m_Dirty = dirty; - emit dirtyChanged(dirty); -} - -ITimelineItemBinding *CTimelineRow::GetTimelineItemBinding() const -{ - return m_TimelineItemBinding; -} - -//============================================================================= -/** - * @return the studio type of the object represented by this row - */ -EStudioObjectType CTimelineRow::GetObjectType() const -{ - return GetTimelineItem()->GetObjectType(); -} - -ITimelineItem *CTimelineRow::GetTimelineItem() const -{ - return m_TimelineItemBinding->GetTimelineItem(); -} - -void CTimelineRow::RequestSelectKeysByTime(long inTime, bool inSelected) -{ - emit selectKeysByTime(inTime, inSelected); -} diff --git a/src/Authoring/Studio/Palettes/Timeline/TimelineRow.h b/src/Authoring/Studio/Palettes/Timeline/TimelineRow.h deleted file mode 100644 index f1d7ba16..00000000 --- a/src/Authoring/Studio/Palettes/Timeline/TimelineRow.h +++ /dev/null @@ -1,121 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 NVIDIA Corporation. -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt 3D Studio. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef INCLUDED_TIMELINE_ROW_H -#define INCLUDED_TIMELINE_ROW_H 1 - -#pragma once - -#include <QObject> - -#include "TimelineFilter.h" -#include "CColor.h" -#include "StudioObjectTypes.h" - -#include <vector> - -class CSnapper; -class CControl; -class ISnappingListProvider; -class ITimelineItemBinding; -class CPropertyRow; - -const double DEFAULT_TIME_RATIO = .05; - -class CTimelineRow : public QObject -{ - Q_OBJECT -public: - static const long TREE_INDENT; - - explicit CTimelineRow(CTimelineRow *parent); - virtual ~CTimelineRow(); - - virtual void Initialize(ITimelineItemBinding *inTimelineItemBinding) = 0; - virtual void Filter(const CFilter &inFilter, bool inFilterChildren = true) = 0; - - virtual void Select(Qt::KeyboardModifiers inKeyState, bool inCheckKeySelection = true) = 0; - virtual bool IsSelected() const = 0; - - void SetParent(CTimelineRow *inParent); - CTimelineRow *GetParentRow() const; - virtual void SetTimeRatio(double inTimeRatio); - virtual double GetTimeRatio(); - virtual bool IsViewable() const; - - virtual ::CColor GetTimebarBackgroundColor(EStudioObjectType inType); - virtual ::CColor GetTimebarHighlightBackgroundColor(EStudioObjectType inType); - - virtual long GetLatestEndTime(); - - virtual void Dispose(); - - virtual void Expand(bool inExpandAll = false, bool inExpandUp = false) = 0; - virtual void Collapse(bool inCollapseAll = false) = 0; - bool isExpanded() const; - - virtual bool CalculateActiveStartTime() = 0; - virtual bool CalculateActiveEndTime() = 0; - long GetActiveStart(); - long GetActiveEnd(); - - void setDirty(bool dirty); - - virtual void LoadChildren() = 0; - virtual bool HasVisibleChildren() = 0; - - ITimelineItemBinding *GetTimelineItemBinding() const; - EStudioObjectType GetObjectType() const; - ITimelineItem *GetTimelineItem() const; - - void RequestSelectKeysByTime(long inTime, bool inSelected); - -Q_SIGNALS: - void initialized(); - void dirtyChanged(bool dirty); - void propertyRowAdded(CPropertyRow *newRow); - void childrenLoaded(); - void selectKeysByTime(long inTime, bool inSelected); - void selectedChanged(bool selected); - void timeRatioChanged(double timeRatio); - -protected: - CTimelineRow *m_ParentRow; - - ITimelineItemBinding *m_TimelineItemBinding = nullptr; - - bool m_IsViewable; - long m_ActiveStart; - long m_ActiveEnd; - bool m_Dirty = false; - bool m_IsExpanded = false; - - double m_TimeRatio = DEFAULT_TIME_RATIO; -}; -#endif // INCLUDED_TIMELINE_ROW_H diff --git a/src/Authoring/Studio/Palettes/Timeline/TimelineTreeDelegate.qml b/src/Authoring/Studio/Palettes/Timeline/TimelineTreeDelegate.qml deleted file mode 100644 index ebaa7db9..00000000 --- a/src/Authoring/Studio/Palettes/Timeline/TimelineTreeDelegate.qml +++ /dev/null @@ -1,220 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt 3D Studio. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.8 -import QtQuick.Controls 2.2 -import QtQuick.Layouts 1.3 -import Qt3DStudio 1.0 -import "../controls" - -Item { - id: root - - property real splitterPos: 0 - - signal doubleClicked(var mouse) - - Row { - id: delegateRow - - anchors.fill: parent - spacing: 2 - - Rectangle { - id: actionStatusRect - - width: 20 - height: 20 - color: model.selected ? _selectionColor : - model.isProperty ? _backgroundColor : _studioColor2 - border.color: _backgroundColor - - Image { - anchors.fill: parent - fillMode: Image.Pad - source: { - if (model.hasAction) - return _resDir + "Action-Action.png"; - else if (model.hasMasterAction) - return _resDir + "Action-MasterAction.png"; - return ""; - } - } - - Image { - anchors.fill: parent - fillMode: Image.Pad - source: { - if (model.expanded) - return ""; - if (model.hasChildAction) - return _resDir + "Action-ChildAction.png"; - else if (model.hasMasterChildAction) - return _resDir + "Action-ChildMasterAction.png"; - return ""; - } - } - - Image { - anchors.fill: parent - fillMode: Image.Pad - source: { - if (model.hasComponentAction) - return _resDir + "Action-ComponentAction.png"; - else if (model.hasMasterComponentAction) - return _resDir + "Action-ComponentMasterAction.png"; - return ""; - } - } - - } - - Rectangle { - id: itemDescription - - width: root.width - buttons.width - actionStatusRect.width - 2 * delegateRow.spacing - height: root.height - - color: model.selected ? _selectionColor : - model.isProperty ? _backgroundColor : _studioColor2 - border.color: _backgroundColor - - MouseArea { - id: delegateArea - - anchors.fill: parent - onClicked: _timelineView.select(model.index, mouse.modifiers) - onDoubleClicked: root.doubleClicked(mouse) - } - - Row { - id: row - - x: model.depth * 20 - anchors.verticalCenter: parent.verticalCenter - height: root.height - width: splitterPos - x - spacing: 5 - - Image { - source: { - if (!model.hasChildren) - return ""; - model.expanded ? _resDir + "arrow_down.png" - : _resDir + "arrow.png"; - } - - MouseArea { - anchors.fill: parent - onClicked: model.expanded = !model.expanded - } - } - - Item { - height: root.height - width: typeIcon.width + name.width + 10 - - Row { - spacing: 10 - Image { - id: typeIcon - - source: model.icon - } - - StyledLabel { - id: name - anchors.verticalCenter: typeIcon.verticalCenter - color: model.textColor - text: model.name - } - } - } - } - } - - Loader { - id: buttons - - active: !model.isProperty - - sourceComponent: buttonsComponent - } - - Component { - id: buttonsComponent - - - Row { - id: buttonsRow - - Layout.alignment: Qt.AlignRight - - StyledToggleButton { - width: 20 - height: 20 - checked: model.shy - - backgroundColor: itemDescription.color - downColor: backgroundColor - enabledImage: "Toggle-Empty.png" - checkedImage: "Toggle-Shy.png" - - onClicked: model.shy = checked - } - - StyledToggleButton { - width: 20 - height: 20 - checked: model.rowVisible - - backgroundColor: itemDescription.color - downColor: backgroundColor - enabledImage: "Toggle-Empty.png" - checkedImage: "filter-toggle-eye-up.png" - - onClicked: model.rowVisible = checked - } - - StyledToggleButton { - width: 20 - height: 20 - - checked: model.locked - - backgroundColor: itemDescription.color - downColor: backgroundColor - checkedImage: "Toggle-Lock.png" - enabledImage: "Toggle-Empty.png" - - onClicked: model.locked = checked - } - } - } - } -} diff --git a/src/Authoring/Studio/Palettes/Timeline/TimelineUIFactory.cpp b/src/Authoring/Studio/Palettes/Timeline/TimelineUIFactory.cpp deleted file mode 100644 index 32d3958e..00000000 --- a/src/Authoring/Studio/Palettes/Timeline/TimelineUIFactory.cpp +++ /dev/null @@ -1,107 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt 3D Studio. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "TimelineUIFactory.h" - -#include "TimelineRow.h" -#include "StateRow.h" -#include "SlideRow.h" -#include "PropertyRow.h" - -#include "Bindings/ITimelineItemProperty.h" - -TimelineUIFactory *TimelineUIFactory::instance() -{ - static TimelineUIFactory *s_instance = new TimelineUIFactory(); - return s_instance; -} - -TimelineUIFactory::~TimelineUIFactory() -{ - -} - -CAbstractTimelineRowUI *TimelineUIFactory::uiForRow(CTimelineRow *row) -{ - auto uiRow = m_uiRows.value(row, nullptr); - Q_ASSERT(uiRow); - return uiRow; -} - -CPropertyRow *TimelineUIFactory::createPropertyRow(CBaseStateRow *parentRow, - CPropertyRow *nextRow, - ITimelineItemProperty *inTimelineItemPropertyBinding) -{ - auto propertyRow = new CPropertyRow(inTimelineItemPropertyBinding, parentRow); - - inTimelineItemPropertyBinding->Bind(propertyRow); - - return propertyRow; -} - -CStateRow *TimelineUIFactory::createStateRow(CBaseStateRow *parentRow, - ITimelineItemBinding *inTimelineItem) -{ - auto stateRow = new CStateRow(parentRow); - - stateRow->Initialize(inTimelineItem); - - return stateRow; -} - -CSlideRow *TimelineUIFactory::createSlideRow(CBaseStateRow *parentRow, - ITimelineItemBinding *inTimelineItem) -{ - auto slideRow = new CSlideRow(parentRow); - - slideRow->Initialize(inTimelineItem); - - return slideRow; -} - -void TimelineUIFactory::deleteRowUI(CTimelineRow *row) -{ - auto it = m_uiRows.find(row); - if (it != m_uiRows.end()) { - delete *it; - m_uiRows.erase(it); - } -} - -void TimelineUIFactory::setParentForRowUI(CTimelineRow *row, CTimelineRow *parentRow) -{ - CAbstractTimelineRowUI *uiRow = m_uiRows.value(row, nullptr); - if (uiRow) { - CAbstractTimelineRowUI *parentUiRow = m_uiRows.value(parentRow, nullptr); - uiRow->SetParentRow(parentUiRow); - } -} - -TimelineUIFactory::TimelineUIFactory(QObject *parent) -{ - -} diff --git a/src/Authoring/Studio/Palettes/Timeline/TimelineUIFactory.h b/src/Authoring/Studio/Palettes/Timeline/TimelineUIFactory.h deleted file mode 100644 index e9a85c22..00000000 --- a/src/Authoring/Studio/Palettes/Timeline/TimelineUIFactory.h +++ /dev/null @@ -1,66 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt 3D Studio. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef TIMELINEUIFACTORY_H -#define TIMELINEUIFACTORY_H - -#include <QObject> -#include <QHash> - -#include "TimelineRow.h" -#include "AbstractTimelineRowUI.h" - -class CBaseStateRow; -class CPropertyRow; -class CSlideRow; -class CStateRow; - -class TimelineUIFactory : public QObject -{ - Q_OBJECT - -public: - static TimelineUIFactory *instance(); - virtual ~TimelineUIFactory(); - - CAbstractTimelineRowUI *uiForRow(CTimelineRow *row); - - CPropertyRow *createPropertyRow(CBaseStateRow *parentRow, CPropertyRow *nextRow, ITimelineItemProperty *inTimelineItemPropertyBinding); - CStateRow *createStateRow(CBaseStateRow *parentRow, ITimelineItemBinding *inTimelineItem); - CSlideRow *createSlideRow(CBaseStateRow *parentRow, ITimelineItemBinding *inTimelineItem); - - void deleteRowUI(CTimelineRow *row); - void setParentForRowUI(CTimelineRow *row, CTimelineRow *parentRow); - -private: - CAbstractTimelineRowUI *createRowUI(CTimelineRow *row, CTimelineRow *parentRow); - - TimelineUIFactory(QObject *parent = nullptr); - QHash<CTimelineRow *, CAbstractTimelineRowUI *> m_uiRows; -}; - -#endif // TIMELINEUIFACTORY_H diff --git a/src/Authoring/Studio/Palettes/Timeline/TimelineView.cpp b/src/Authoring/Studio/Palettes/Timeline/TimelineView.cpp deleted file mode 100644 index 25ce1bcd..00000000 --- a/src/Authoring/Studio/Palettes/Timeline/TimelineView.cpp +++ /dev/null @@ -1,335 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt 3D Studio. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "TimelineView.h" -#include "Core.h" -#include "Doc.h" -#include "Dispatch.h" -#include "Bindings/TimelineTranslationManager.h" -#include "HotKeys.h" - -#include "Literals.h" -#include "StudioApp.h" -#include "StudioPreferences.h" -#include "StudioUtils.h" - -#include "TimeMeasureItem.h" -#include "TimePropertyItem.h" - -#include "Qt3DSDMStudioSystem.h" -#include "Qt3DSDMSlides.h" -#include "Qt3DSDMHandles.h" - -#include <QtQml/qqmlcontext.h> -#include <QtQml/qqmlengine.h> -#include <QtCore/qtimer.h> -#include <QtWidgets/qaction.h> - -namespace { -const qreal SCALING_PERCENTAGE_INC = 1.1; -const qreal SCALING_PERCENTAGE_DEC = 0.9; -} - -TimelineView::TimelineView(QWidget *parent) : QQuickWidget(parent) -{ - g_StudioApp.GetCore()->GetDispatch()->AddPresentationChangeListener(this); - g_StudioApp.GetCore()->GetDispatch()->AddClientPlayChangeListener(this); - setResizeMode(QQuickWidget::SizeRootObjectToView); - - m_translationManager = new CTimelineTranslationManager(); - - QTimer::singleShot(0, this, &TimelineView::initialize); -} - -QAbstractItemModel *TimelineView::objectModel() const -{ - return m_model; // should be safe as it is passed only to QML -} - -void TimelineView::setSelection(int index) -{ - if (m_selection != index) { - m_selection = index; - Q_EMIT selectionChanged(); - } -} - -void TimelineView::setTimeRatio(qreal timeRatio) -{ - timeRatio = qMin(timeRatio, 1.0); - - if (!qFuzzyCompare(m_timeRatio, timeRatio)) { - m_timeRatio = timeRatio; - - for (int i = 0; i < m_model->rowCount(); ++i) { - auto timelineRow = m_model->index(i, 0) - .data(TimelineObjectModel::TimelineRowRole).value<CTimelineRow*>(); - timelineRow->SetTimeRatio(timeRatio); - } - - Q_EMIT timeRatioChanged(timeRatio); - } -} - -void TimelineView::OnNewPresentation() -{ - m_translationManager->OnNewPresentation(); - - // Register callbacks - qt3dsdm::IStudioFullSystemSignalProvider *theSignalProvider = - GetDoc()->GetStudioSystem()->GetFullSystemSignalProvider(); - - m_Connections.push_back(theSignalProvider->ConnectActiveSlide( - std::bind(&TimelineView::OnActiveSlide, this, std::placeholders::_1, - std::placeholders::_2, std::placeholders::_3))); - - CDispatch *theDispatch = g_StudioApp.GetCore()->GetDispatch(); - m_Connections.push_back(theDispatch->ConnectSelectionChange( - std::bind(&TimelineView::OnSelectionChange, this, std::placeholders::_1))); - - m_Connections.push_back(theSignalProvider->ConnectAnimationCreated( - std::bind(&TimelineView::OnAnimationCreated, this, - std::placeholders::_2, std::placeholders::_3))); - m_Connections.push_back(theSignalProvider->ConnectAnimationDeleted( - std::bind(&TimelineView::OnAnimationDeleted, this, - std::placeholders::_2, std::placeholders::_3))); - - m_Connections.push_back(theSignalProvider->ConnectActionCreated( - std::bind(&TimelineView::OnActionEvent, this, - std::placeholders::_1, std::placeholders::_2, std::placeholders::_3))); - m_Connections.push_back(theSignalProvider->ConnectActionDeleted( - std::bind(&TimelineView::OnActionEvent, this, - std::placeholders::_1, std::placeholders::_2, std::placeholders::_3))); -} - -void TimelineView::OnClosingPresentation() -{ - m_Connections.clear(); -} - -void TimelineView::OnSelectionChange(Q3DStudio::SSelectedValue inNewSelectable) -{ - // Expand the tree so the selection is visible - qt3dsdm::TInstanceHandleList theInstances = inNewSelectable.GetSelectedInstances(); - for (size_t idx = 0, end = theInstances.size(); idx < end; ++idx) { - qt3dsdm::Qt3DSDMInstanceHandle theInstance(theInstances[idx]); - if (GetDoc()->GetStudioSystem()->IsInstance(theInstance)) { - auto index = m_model->sourceIndexForHandle(theInstance); - m_model->expandTo(QModelIndex(), index); - } - } -} - -void TimelineView::OnTimeChanged(long inTime) -{ - setCurrentTime(inTime); -} - -void TimelineView::select(int index, Qt::KeyboardModifiers modifiers) -{ - auto timelineRow = m_model->index(index, 0) - .data(TimelineObjectModel::TimelineRowRole).value<CTimelineRow*>(); - timelineRow->Select(modifiers); - setSelection(index); -} - -void TimelineView::setNewTimePosition(double position) -{ - auto time = ::PosToTime(position, m_timeRatio); - GetDoc()->NotifyTimeChanged(time); -} - -void TimelineView::setHideShy(bool enabled) -{ - if (m_objectListModel && m_objectListModel->hideShy() != enabled) { - m_objectListModel->setHideShy(enabled); - emit hideShyChanged(); - } -} - -bool TimelineView::hideShy() const -{ - if (m_objectListModel) - return m_objectListModel->hideShy(); - - return false; -} - -void TimelineView::setHideHidden(bool enabled) -{ - if (m_objectListModel && m_objectListModel->hideHidden() != enabled) { - m_objectListModel->setHideHidden(enabled); - emit hideHiddenChanged(); - } -} - -bool TimelineView::hideHidden() const -{ - if (m_objectListModel) - return m_objectListModel->hideHidden(); - - return false; -} - -void TimelineView::setHideLocked(bool enabled) -{ - if (m_objectListModel && m_objectListModel->hideLocked() != enabled) { - m_objectListModel->setHideLocked(enabled); - emit hideLockedChanged(); - } -} - -bool TimelineView::hideLocked() const -{ - if (m_objectListModel) - return m_objectListModel->hideLocked(); - - return false; -} - -void TimelineView::setCurrentTime(long newTime) -{ - if (m_currentTime != newTime) { - m_currentTime = newTime; - - Q_EMIT currentTimeChanged(); - } -} - -long TimelineView::currentTime() const -{ - return m_currentTime; -} - -double TimelineView::currentTimePos() const -{ - return ::TimeToPos(m_currentTime, m_timeRatio); -} - -void TimelineView::OnAnimationCreated(qt3dsdm::Qt3DSDMInstanceHandle parentInstance, - qt3dsdm::Qt3DSDMPropertyHandle property) -{ - if (m_objectListModel) - m_objectListModel->addProperty(parentInstance, property); -} - -void TimelineView::OnActionEvent(qt3dsdm::Qt3DSDMActionHandle inAction, - qt3dsdm::Qt3DSDMSlideHandle inSlide, - qt3dsdm::Qt3DSDMInstanceHandle inOwner) -{ - Q_UNUSED(inAction); - Q_UNUSED(inSlide); - Q_UNUSED(inOwner); - if (m_objectListModel) { - m_objectListModel->updateActions(); - } -} - -void TimelineView::OnAnimationDeleted(qt3dsdm::Qt3DSDMInstanceHandle parentInstance, - qt3dsdm::Qt3DSDMPropertyHandle property) -{ - if (m_objectListModel) - m_objectListModel->removeProperty(parentInstance, property); -} - -void TimelineView::OnActiveSlide(const qt3dsdm::Qt3DSDMSlideHandle &inMaster, int inIndex, - const qt3dsdm::Qt3DSDMSlideHandle &inSlide) -{ - Q_UNUSED(inMaster); - Q_UNUSED(inIndex); - - if (m_activeSlide == inSlide) - return; - - m_translationManager->Clear(); - m_activeSlide = inSlide; - - auto *theSlideSystem = GetDoc()->GetStudioSystem()->GetSlideSystem(); - auto theSlideInstance = theSlideSystem->GetSlideInstance(inSlide); - - m_objectListModel = new TimelineObjectModel(g_StudioApp.GetCore(), - GetDoc()->GetActiveRootInstance(), this); - m_objectListModel->setTimelineItemBinding(m_translationManager->GetOrCreate(theSlideInstance)); - if (!m_model) - m_model = new FlatObjectListModel(m_objectListModel, this); - else - m_model->setSourceModel(m_objectListModel); - - // expand by default the first level - m_model->expandTo(QModelIndex(), m_objectListModel->index(0, 0, m_objectListModel->index(0,0))); - emit objectModelChanged(); -} - -void TimelineView::initialize() -{ - CStudioPreferences::setQmlContextProperties(rootContext()); - rootContext()->setContextProperty("_timelineView"_L1, this); - rootContext()->setContextProperty("_resDir"_L1, resourceImageUrl()); - - qmlRegisterUncreatableType<TimelineView>("Qt3DStudio", 1, 0, "TimelineView" - , tr("Creation of TimelineView not allowed from QML")); - qmlRegisterUncreatableType<TimebarTimeInfo>("Qt3DStudio", 1, 0, "TimebarTimeInfo" - , tr("Creation of TimebarTimeInfo not allowed from QML")); - qmlRegisterUncreatableType<KeyframeInfo>("Qt3DStudio", 1, 0, "KeyframeInfo" - , tr("Creation of KeyframeInfo not allowed from QML")); - qmlRegisterUncreatableType<CTimelineRow>("Qt3DStudio", 1, 0, "TimelineRow" - , tr("Creation of TimelineRow not allowed from QML")); - qmlRegisterType<TimeMeasureItem>("Qt3DStudio", 1, 0, "TimeMeasureItem"); - qmlRegisterType<TimePropertyItem>("Qt3DStudio", 1, 0, "TimePropertyItem"); - engine()->addImportPath(qmlImportPath()); - setSource(QUrl("qrc:/Palettes/Timeline/Timeline.qml"_L1)); -} - -CDoc *TimelineView::GetDoc() -{ - return g_StudioApp.GetCore()->GetDoc(); -} - -void TimelineView::OnScalingZoomIn() -{ - const qreal timeRatio = m_timeRatio * SCALING_PERCENTAGE_INC; - setTimeRatio(timeRatio); -} - -void TimelineView::OnScalingZoomOut() -{ - const qreal timeRatio = m_timeRatio * SCALING_PERCENTAGE_DEC; - setTimeRatio(timeRatio); -} - -void TimelineView::RegisterGlobalKeyboardShortcuts(CHotKeys *inShortcutHandler, QWidget *actionParent) -{ - Q_UNUSED(inShortcutHandler); - - ADD_GLOBAL_SHORTCUT(actionParent, - QKeySequence(Qt::Key_Plus), - TimelineView::OnScalingZoomIn); - ADD_GLOBAL_SHORTCUT(actionParent, - QKeySequence(Qt::Key_Minus), - TimelineView::OnScalingZoomOut); -} diff --git a/src/Authoring/Studio/Palettes/Timeline/TimelineView.h b/src/Authoring/Studio/Palettes/Timeline/TimelineView.h deleted file mode 100644 index d94ed9e3..00000000 --- a/src/Authoring/Studio/Palettes/Timeline/TimelineView.h +++ /dev/null @@ -1,140 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt 3D Studio. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef TIMELINEVIEW_H -#define TIMELINEVIEW_H - -#include <QQuickWidget> - -#include "DispatchListeners.h" -#include "ObjectListModel.h" -#include "Qt3DSDMHandles.h" -#include "Qt3DSDMSignals.h" -#include "SelectedValueImpl.h" -#include "TimelineObjectModel.h" - -#include "TimelineRow.h" // for DEFAULT_TIME_RATIO - -class CDoc; -class CTimelineTranslationManager; -class CHotKeys; - -QT_FORWARD_DECLARE_CLASS(QAbstractItemModel) - -class TimelineView : public QQuickWidget, - public CPresentationChangeListener, - public CClientPlayChangeListener - -{ - Q_OBJECT - Q_PROPERTY(QAbstractItemModel *objectModel READ objectModel NOTIFY objectModelChanged FINAL) - Q_PROPERTY(int selection READ selection WRITE setSelection NOTIFY selectionChanged FINAL) - Q_PROPERTY(bool hideShy READ hideShy WRITE setHideShy NOTIFY hideShyChanged) - Q_PROPERTY(bool hideHidden READ hideHidden WRITE setHideHidden NOTIFY hideHiddenChanged) - Q_PROPERTY(bool hideLocked READ hideLocked WRITE setHideLocked NOTIFY hideLockedChanged) - Q_PROPERTY(qreal timeRatio READ timeRatio WRITE setTimeRatio NOTIFY timeRatioChanged FINAL) - Q_PROPERTY(long currentTime READ currentTime WRITE setCurrentTime NOTIFY currentTimeChanged FINAL) - Q_PROPERTY(double currentTimePos READ currentTimePos NOTIFY currentTimeChanged FINAL) -public: - explicit TimelineView(QWidget *parent = nullptr); - - QAbstractItemModel *objectModel() const; - - int selection() const { return m_selection; } - void setSelection(int index); - - qreal timeRatio() const { return m_timeRatio; } - void setTimeRatio(qreal timeRatio); - - void RegisterGlobalKeyboardShortcuts(CHotKeys *inShortcutHandler, QWidget *actionParent); - - // Presentation Change Listener - void OnNewPresentation() override; - void OnClosingPresentation() override; - void OnSelectionChange(Q3DStudio::SSelectedValue inNewSelectable); - - //CClientPlayChangeListener - void OnTimeChanged(long inTime) override; - - Q_INVOKABLE void select(int index, Qt::KeyboardModifiers modifiers); - Q_INVOKABLE void setNewTimePosition(double position); - - void setHideShy(bool enabled); - bool hideShy() const; - void setHideHidden(bool enabled); - bool hideHidden() const; - void setHideLocked(bool enabled); - bool hideLocked() const; - - void setCurrentTime(long newTime); - long currentTime() const; - double currentTimePos() const; - -Q_SIGNALS: - void objectModelChanged(); - void selectionChanged(); - void hideShyChanged(); - void hideHiddenChanged(); - void hideLockedChanged(); - void timeRatioChanged(qreal timeRatio); - void currentTimeChanged(); - -protected: - void OnScalingZoomIn(); - void OnScalingZoomOut(); - - // DataModel callbacks - virtual void OnActiveSlide(const qt3dsdm::Qt3DSDMSlideHandle &inMaster, int inIndex, - const qt3dsdm::Qt3DSDMSlideHandle &inSlide); - void OnAnimationDeleted(qt3dsdm::Qt3DSDMInstanceHandle parentInstance, - qt3dsdm::Qt3DSDMPropertyHandle property); - void OnAnimationCreated(qt3dsdm::Qt3DSDMInstanceHandle parentInstance, - qt3dsdm::Qt3DSDMPropertyHandle property); - void OnActionEvent(qt3dsdm::Qt3DSDMActionHandle inAction, qt3dsdm::Qt3DSDMSlideHandle inSlide, - qt3dsdm::Qt3DSDMInstanceHandle inOwner); - - -private: - void initialize(); - inline CDoc *GetDoc(); - - std::vector<std::shared_ptr<qt3dsdm::ISignalConnection>> - m_Connections; /// connections to the DataModel - FlatObjectListModel *m_model = nullptr; - TimelineObjectModel *m_objectListModel = nullptr; - qt3dsdm::Qt3DSDMSlideHandle m_activeSlide; - - CTimelineTranslationManager *m_translationManager = nullptr; - - int m_selection = -1; - QColor m_BaseColor = QColor::fromRgb(75, 75, 75); - qreal m_timeRatio = DEFAULT_TIME_RATIO; - long m_currentTime = 0; -}; - -#endif // TIMELINEVIEW_H diff --git a/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineWidget.cpp b/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineWidget.cpp index 97a39690..e60d7ddd 100644 --- a/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineWidget.cpp +++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineWidget.cpp @@ -51,6 +51,7 @@ #include "Bindings/ITimelineTimebar.h" #include "Bindings/Qt3DSDMTimelineItemBinding.h" #include "Bindings/Qt3DSDMTimelineItemProperty.h" +#include "Bindings/TimelineBreadCrumbProvider.h" #include "TimeEditDlg.h" #include "IDocumentEditor.h" #include "Control.h" @@ -141,6 +142,7 @@ TimelineWidget::TimelineWidget(const QSize &preferredSize, QWidget *parent) // Mahmoud_TODO: CTimelineTranslationManager should be eventually removed or cleaned. Already // most of its functionality is implemented in this class m_translationManager = new CTimelineTranslationManager(); + m_BreadCrumbProvider = new CTimelineBreadCrumbProvider(g_StudioApp.GetCore()->GetDoc()); setWindowTitle(tr("Timeline", "Title of timeline view")); setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); @@ -345,6 +347,7 @@ Q3DStudio::CString TimelineWidget::getPlaybackMode() TimelineWidget::~TimelineWidget() { m_graphicsScene->keyframeManager()->deselectAllKeyframes(); + delete m_BreadCrumbProvider; } QSize TimelineWidget::sizeHint() const @@ -678,7 +681,7 @@ void TimelineWidget::onAsyncUpdate() m_graphicsScene->rowManager()->recreateRowsFromBinding(m_binding); m_handlesMap.clear(); insertToHandlesMapRecursive(m_binding); - m_navigationBar->updateNavigationItems(m_translationManager->GetBreadCrumbProvider()); + m_navigationBar->updateNavigationItems(m_BreadCrumbProvider); m_graphicsScene->updateSnapSteps(); m_fullReconstruct = false; m_graphicsScene->rowManager()->updateFiltering(); diff --git a/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineWidget.h b/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineWidget.h index d34d0ec7..d7b22925 100644 --- a/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineWidget.h +++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/TimelineWidget.h @@ -36,7 +36,6 @@ #include "Qt3DSDMHandles.h" #include "Qt3DSDMSignals.h" #include "SelectedValueImpl.h" -#include "TimelineObjectModel.h" #include "TreeHeaderView.h" #include "Bindings/Qt3DSDMTimeline.h" #include "NavigationBar.h" @@ -49,6 +48,7 @@ class TimelineGraphicsScene; class CTimelineTranslationManager; class Qt3DSDMTimelineItemBinding; class CClientDataModelBridge; +class IBreadCrumbProvider; QT_FORWARD_DECLARE_CLASS(QMouseEvent) QT_FORWARD_DECLARE_CLASS(QGraphicsView) @@ -138,6 +138,10 @@ private: void insertToHandlesMapRecursive(Qt3DSDMTimelineItemBinding *binding); void insertToHandlesMap(Qt3DSDMTimelineItemBinding *binding); Q3DStudio::CString getPlaybackMode(); + void refreshKeyframe(qt3dsdm::Qt3DSDMAnimationHandle inAnimation, + qt3dsdm::Qt3DSDMKeyframeHandle inKeyframe, + ETimelineKeyframeTransaction inTransaction); + TreeHeaderView *m_viewTreeHeader = nullptr; QGraphicsView *m_viewTreeContent = nullptr; QGraphicsView *m_viewTimelineHeader = nullptr; @@ -147,7 +151,6 @@ private: TimelineGraphicsScene *m_graphicsScene; TimelineSplitter *m_splitter = nullptr; CTimelineTranslationManager *m_translationManager = nullptr; - TimelineObjectModel *m_objectListModel = nullptr; FlatObjectListModel *m_model = nullptr; Qt3DSDMTimelineItemBinding *m_binding = nullptr; bool m_splitterPressed = false; @@ -157,14 +160,12 @@ private: QTimer m_asyncUpdateTimer; bool m_fullReconstruct = false; CClientDataModelBridge *m_bridge = nullptr; + IBreadCrumbProvider *m_BreadCrumbProvider = nullptr; // data model connection std::vector<std::shared_ptr<qt3dsdm::ISignalConnection>> m_connections; qt3dsdm::Qt3DSDMSlideHandle m_activeSlide; THandleMap m_handlesMap; - void refreshKeyframe(qt3dsdm::Qt3DSDMAnimationHandle inAnimation, - qt3dsdm::Qt3DSDMKeyframeHandle inKeyframe, - ETimelineKeyframeTransaction inTransaction); }; #endif // TIMELINEWIDGET_H diff --git a/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/NavigationBar.h b/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/NavigationBar.h index c25f6482..f08e4220 100644 --- a/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/NavigationBar.h +++ b/src/Authoring/Studio/Palettes/TimelineGraphicsView/ui/NavigationBar.h @@ -32,7 +32,7 @@ #include <QtCore/qpropertyanimation.h> #include <QtWidgets/qwidget.h> #include <QtWidgets/qboxlayout.h> -#include "IBreadCrumbProvider.h" +#include "Bindings/IBreadCrumbProvider.h" class NavigationBar : public QWidget { diff --git a/src/Authoring/Studio/Qt3DStudio.pro b/src/Authoring/Studio/Qt3DStudio.pro index 0e479438..68b0a740 100644 --- a/src/Authoring/Studio/Qt3DStudio.pro +++ b/src/Authoring/Studio/Qt3DStudio.pro @@ -161,24 +161,12 @@ HEADERS += \ Palettes/Slide/SlideContextMenu.h \ Palettes/Slide/SlideModel.h \ Palettes/Slide/SlideView.h \ - Palettes/Timeline/AbstractTimelineRowUI.h \ - Palettes/Timeline/BaseStateRow.h \ - Palettes/Timeline/Bindings/IKeyframeSelector.h \ Palettes/Timeline/Bindings/ITimelineItem.h \ Palettes/Timeline/Bindings/ITimelineItemBinding.h \ Palettes/Timeline/Bindings/ITimelineItemProperty.h \ Palettes/Timeline/Bindings/ITimelineKeyframesManager.h \ Palettes/Timeline/Bindings/ITimelineTimebar.h \ - Palettes/Timeline/IBreadCrumbProvider.h \ - Palettes/Timeline/PropertyRow.h \ - Palettes/Timeline/SlideRow.h \ - Palettes/Timeline/StateRow.h \ - Palettes/Timeline/TimelineObjectModel.h \ - Palettes/Timeline/TimelineRow.h \ - Palettes/Timeline/TimelineUIFactory.h \ - Palettes/Timeline/TimelineView.h \ - Palettes/Timeline/TimeMeasureItem.h \ - Palettes/Timeline/TimePropertyItem.h \ + Palettes/Timeline/Bindings/IBreadCrumbProvider.h \ Palettes/TimelineGraphicsView/Keyframe.h \ Palettes/TimelineGraphicsView/KeyframeManager.h \ Palettes/TimelineGraphicsView/RowManager.h \ @@ -352,13 +340,10 @@ SOURCES += \ Palettes/Slide/SlideContextMenu.cpp \ Palettes/Slide/SlideModel.cpp \ Palettes/Slide/SlideView.cpp \ - Palettes/Timeline/AbstractTimelineRowUI.cpp \ - Palettes/Timeline/BaseStateRow.cpp \ Palettes/Timeline/Bindings/BehaviorTimelineItemBinding.cpp \ Palettes/Timeline/Bindings/EmptyTimelineTimebar.cpp \ Palettes/Timeline/Bindings/GroupTimelineItemBinding.cpp \ Palettes/Timeline/Bindings/ImageTimelineItemBinding.cpp \ - Palettes/Timeline/Bindings/KeyframesManager.cpp \ Palettes/Timeline/Bindings/LayerTimelineItemBinding.cpp \ Palettes/Timeline/Bindings/MaterialTimelineItemBinding.cpp \ Palettes/Timeline/Bindings/OffsetKeyframesCommandHelper.cpp \ @@ -372,27 +357,6 @@ SOURCES += \ Palettes/Timeline/Bindings/SlideTimelineItemBinding.cpp \ Palettes/Timeline/Bindings/TimelineBreadCrumbProvider.cpp \ Palettes/Timeline/Bindings/TimelineTranslationManager.cpp \ - Palettes/Timeline/ColorBlankControl.cpp \ - Palettes/Timeline/ColorControl.cpp \ - Palettes/Timeline/CommentEdit.cpp \ - Palettes/Timeline/PropertyColorControl.cpp \ - Palettes/Timeline/PropertyGraphKeyframe.cpp \ - Palettes/Timeline/PropertyRow.cpp \ - Palettes/Timeline/PropertyTimebarGraph.cpp \ - Palettes/Timeline/ScalableScroller.cpp \ - Palettes/Timeline/ScalableScrollerBar.cpp \ - Palettes/Timeline/SlideRow.cpp \ - Palettes/Timeline/Snapper.cpp \ - Palettes/Timeline/StateRow.cpp \ - Palettes/Timeline/StateRowFactory.cpp \ - Palettes/Timeline/TimelineFilter.cpp \ - Palettes/Timeline/TimelineKeyframe.cpp \ - Palettes/Timeline/TimelineObjectModel.cpp \ - Palettes/Timeline/TimelineRow.cpp \ - Palettes/Timeline/TimelineUIFactory.cpp \ - Palettes/Timeline/TimelineView.cpp \ - Palettes/Timeline/TimeMeasureItem.cpp \ - Palettes/Timeline/TimePropertyItem.cpp \ Palettes/TimelineGraphicsView/KeyframeManager.cpp \ Palettes/TimelineGraphicsView/RowManager.cpp \ Palettes/TimelineGraphicsView/RowMover.cpp \ diff --git a/src/Authoring/Studio/qml.qrc b/src/Authoring/Studio/qml.qrc index 325d91ae..a3f2aa1d 100644 --- a/src/Authoring/Studio/qml.qrc +++ b/src/Authoring/Studio/qml.qrc @@ -38,11 +38,6 @@ <file>Palettes/controls/StyledTooltip.qml</file> <file>Palettes/controls/StyledToolButton.qml</file> <file>Palettes/controls/StyledMenuSeparator.qml</file> - <file>Palettes/Timeline/Timeline.qml</file> - <file>Palettes/Timeline/TimelineItem.qml</file> - <file>Palettes/Timeline/Keyframes.qml</file> <file>Palettes/controls/StyledToggleButton.qml</file> - <file>Palettes/Timeline/TimelineTreeDelegate.qml</file> - <file>Palettes/Timeline/PlayHead.qml</file> </qresource> </RCC> |