|
@@ -275,44 +275,6 @@ void CUiAnimViewSequence::OnKeysChanged()
|
|
//////////////////////////////////////////////////////////////////////////
|
|
//////////////////////////////////////////////////////////////////////////
|
|
void CUiAnimViewSequence::OnNodeChanged(CUiAnimViewNode* pNode, IUiAnimViewSequenceListener::ENodeChangeType type)
|
|
void CUiAnimViewSequence::OnNodeChanged(CUiAnimViewNode* pNode, IUiAnimViewSequenceListener::ENodeChangeType type)
|
|
{
|
|
{
|
|
-#if UI_ANIMATION_REMOVED // UI_ANIMATION_REVISIT do we need any of this?
|
|
|
|
- if (pNode && pNode->GetNodeType() == eUiAVNT_AnimNode)
|
|
|
|
- {
|
|
|
|
- CUiAnimViewAnimNode* pAnimNode = static_cast<CUiAnimViewAnimNode*>(pNode);
|
|
|
|
- CEntityObject* pNodeEntity = pAnimNode->GetNodeEntity();
|
|
|
|
-
|
|
|
|
- if (pAnimNode->IsActive() && pNodeEntity)
|
|
|
|
- {
|
|
|
|
- switch (type)
|
|
|
|
- {
|
|
|
|
- case IUiAnimViewSequenceListener::eNodeChangeType_Added:
|
|
|
|
- pNodeEntity->SetTransformDelegate(pAnimNode);
|
|
|
|
- pNodeEntity->RegisterListener(pAnimNode);
|
|
|
|
- ForceAnimation();
|
|
|
|
- break;
|
|
|
|
- case IUiAnimViewSequenceListener::eNodeChangeType_Removed:
|
|
|
|
- pNodeEntity->SetTransformDelegate(nullptr);
|
|
|
|
- pNodeEntity->UnregisterListener(pAnimNode);
|
|
|
|
- ForceAnimation();
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- switch (type)
|
|
|
|
- {
|
|
|
|
- case IUiAnimViewSequenceListener::eNodeChangeType_Enabled:
|
|
|
|
- // Fall through
|
|
|
|
- case IUiAnimViewSequenceListener::eNodeChangeType_Hidden:
|
|
|
|
- // Fall through
|
|
|
|
- case IUiAnimViewSequenceListener::eNodeChangeType_SetAsActiveDirector:
|
|
|
|
- // Fall through
|
|
|
|
- case IUiAnimViewSequenceListener::eNodeChangeType_NodeOwnerChanged:
|
|
|
|
- ForceAnimation();
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-#endif
|
|
|
|
-
|
|
|
|
if (m_bNoNotifications)
|
|
if (m_bNoNotifications)
|
|
{
|
|
{
|
|
return;
|
|
return;
|
|
@@ -328,12 +290,6 @@ void CUiAnimViewSequence::OnNodeChanged(CUiAnimViewNode* pNode, IUiAnimViewSeque
|
|
//////////////////////////////////////////////////////////////////////////
|
|
//////////////////////////////////////////////////////////////////////////
|
|
void CUiAnimViewSequence::OnNodeRenamed(CUiAnimViewNode* pNode, const char* pOldName)
|
|
void CUiAnimViewSequence::OnNodeRenamed(CUiAnimViewNode* pNode, const char* pOldName)
|
|
{
|
|
{
|
|
- bool bLightAnimationSetActive = GetFlags() & IUiAnimSequence::eSeqFlags_LightAnimationSet;
|
|
|
|
- if (bLightAnimationSetActive)
|
|
|
|
- {
|
|
|
|
- UpdateLightAnimationRefs(pOldName, pNode->GetName().c_str());
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
if (m_bNoNotifications)
|
|
if (m_bNoNotifications)
|
|
{
|
|
{
|
|
return;
|
|
return;
|
|
@@ -422,45 +378,9 @@ void CUiAnimViewSequence::DeleteSelectedNodes()
|
|
}
|
|
}
|
|
|
|
|
|
CUiAnimViewAnimNodeBundle selectedNodes = GetSelectedAnimNodes();
|
|
CUiAnimViewAnimNodeBundle selectedNodes = GetSelectedAnimNodes();
|
|
- const unsigned int numSelectedNodes = selectedNodes.GetCount();
|
|
|
|
-
|
|
|
|
-#if UI_ANIMATION_REMOVED // lights
|
|
|
|
- // Check if any reference to the light animation to be deleted exists, and abort the removal, if any.
|
|
|
|
- const bool bLightAnimationSetActive = GetFlags() & IUiAnimSequence::eSeqFlags_LightAnimationSet;
|
|
|
|
- if (bLightAnimationSetActive)
|
|
|
|
- {
|
|
|
|
- QStringList lightNodes;
|
|
|
|
-
|
|
|
|
- // Construct set of selected light nodes
|
|
|
|
- for (unsigned int i = 0; i < numSelectedNodes; ++i)
|
|
|
|
- {
|
|
|
|
- CUiAnimViewAnimNode* pCurrentNode = selectedNodes.GetNode(i);
|
|
|
|
- if (pCurrentNode->GetType() == eUiAnimNodeType_Light)
|
|
|
|
- {
|
|
|
|
- stl::push_back_unique(lightNodes, pCurrentNode->GetName());
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- // Check all entities if any is referencing any selected light node
|
|
|
|
- std::vector<CBaseObject*> entityObjects;
|
|
|
|
- GetIEditor()->GetObjectManager()->FindObjectsOfType(&CEntityObject::staticMetaObject, entityObjects);
|
|
|
|
-
|
|
|
|
- for (size_t i = 0; i < entityObjects.size(); ++i)
|
|
|
|
- {
|
|
|
|
- QString lightAnimationName = static_cast<CEntityObject*>(entityObjects[i])->GetLightAnimation();
|
|
|
|
- if (stl::find(lightNodes, lightAnimationName))
|
|
|
|
- {
|
|
|
|
- QMessageBox::critical(QApplication::activeWindow(), QString(), QObject::tr("The node '%1' cannot be removed since there is a light entity still using it.").arg(lightAnimationName));
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-#endif
|
|
|
|
-
|
|
|
|
CUiAnimViewTrackBundle selectedTracks = GetSelectedTracks();
|
|
CUiAnimViewTrackBundle selectedTracks = GetSelectedTracks();
|
|
- const unsigned int numSelectedTracks = selectedTracks.GetCount();
|
|
|
|
|
|
|
|
- for (unsigned int i = 0; i < numSelectedTracks; ++i)
|
|
|
|
|
|
+ for (unsigned int i = 0; i < selectedTracks.GetCount(); ++i)
|
|
{
|
|
{
|
|
CUiAnimViewTrack* pTrack = selectedTracks.GetTrack(i);
|
|
CUiAnimViewTrack* pTrack = selectedTracks.GetTrack(i);
|
|
|
|
|
|
@@ -471,7 +391,7 @@ void CUiAnimViewSequence::DeleteSelectedNodes()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- for (unsigned int i = 0; i < numSelectedNodes; ++i)
|
|
|
|
|
|
+ for (unsigned int i = 0; i < selectedNodes.GetCount(); ++i)
|
|
{
|
|
{
|
|
CUiAnimViewAnimNode* pNode = selectedNodes.GetNode(i);
|
|
CUiAnimViewAnimNode* pNode = selectedNodes.GetNode(i);
|
|
CUiAnimViewAnimNode* pParentNode = static_cast<CUiAnimViewAnimNode*>(pNode->GetParentNode());
|
|
CUiAnimViewAnimNode* pParentNode = static_cast<CUiAnimViewAnimNode*>(pNode->GetParentNode());
|
|
@@ -479,83 +399,6 @@ void CUiAnimViewSequence::DeleteSelectedNodes()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-//////////////////////////////////////////////////////////////////////////
|
|
|
|
-void CUiAnimViewSequence::SelectSelectedNodesInViewport()
|
|
|
|
-{
|
|
|
|
- assert(UiAnimUndo::IsRecording());
|
|
|
|
-
|
|
|
|
- CUiAnimViewAnimNodeBundle selectedNodes = GetSelectedAnimNodes();
|
|
|
|
-
|
|
|
|
-#if UI_ANIMATION_REMOVED // lights
|
|
|
|
- const unsigned int numSelectedNodes = selectedNodes.GetCount();
|
|
|
|
-
|
|
|
|
- // Also select objects that refer to light animation
|
|
|
|
- const bool bLightAnimationSetActive = GetFlags() & IUiAnimSequence::eSeqFlags_LightAnimationSet;
|
|
|
|
- if (bLightAnimationSetActive)
|
|
|
|
- {
|
|
|
|
- QStringList lightNodes;
|
|
|
|
-
|
|
|
|
- // Construct set of selected light nodes
|
|
|
|
- for (unsigned int i = 0; i < numSelectedNodes; ++i)
|
|
|
|
- {
|
|
|
|
- CUiAnimViewAnimNode* pCurrentNode = selectedNodes.GetNode(i);
|
|
|
|
- if (pCurrentNode->GetType() == eUiAnimNodeType_Light)
|
|
|
|
- {
|
|
|
|
- stl::push_back_unique(lightNodes, pCurrentNode->GetName());
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- // Check all entities if any is referencing any selected light node
|
|
|
|
- std::vector<CBaseObject*> entityObjects;
|
|
|
|
- GetIEditor()->GetObjectManager()->FindObjectsOfType(&CEntityObject::staticMetaObject, entityObjects);
|
|
|
|
-
|
|
|
|
- for (size_t i = 0; i < entityObjects.size(); ++i)
|
|
|
|
- {
|
|
|
|
- QString lightAnimationName = static_cast<CEntityObject*>(entityObjects[i])->GetLightAnimation();
|
|
|
|
- if (stl::find(lightNodes, lightAnimationName))
|
|
|
|
- {
|
|
|
|
- stl::push_back_unique(entitiesToBeSelected, entityObjects[i]);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- else
|
|
|
|
- {
|
|
|
|
- for (unsigned int i = 0; i < numSelectedNodes; ++i)
|
|
|
|
- {
|
|
|
|
- CUiAnimViewAnimNode* pNode = selectedNodes.GetNode(i);
|
|
|
|
- CEntityObject* pEntity = pNode->GetNodeEntity();
|
|
|
|
- if (pEntity)
|
|
|
|
- {
|
|
|
|
- stl::push_back_unique(entitiesToBeSelected, pEntity);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-#endif
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-//////////////////////////////////////////////////////////////////////////
|
|
|
|
-void CUiAnimViewSequence::UpdateLightAnimationRefs([[maybe_unused]] const char* pOldName, [[maybe_unused]] const char* pNewName)
|
|
|
|
-{
|
|
|
|
-#if UI_ANIMATION_REMOVED // lights
|
|
|
|
- std::vector<CBaseObject*> entityObjects;
|
|
|
|
- GetIEditor()->GetObjectManager()->FindObjectsOfType(&CEntityObject::staticMetaObject, entityObjects);
|
|
|
|
- std::for_each(std::begin(entityObjects), std::end(entityObjects),
|
|
|
|
- [&pOldName, &pNewName](CBaseObject* pBaseObject)
|
|
|
|
- {
|
|
|
|
- CEntityObject* pEntityObject = static_cast<CEntityObject*>(pBaseObject);
|
|
|
|
- bool bLight = pEntityObject && pEntityObject->GetEntityClass().Compare("Light") == 0;
|
|
|
|
- if (bLight)
|
|
|
|
- {
|
|
|
|
- string lightAnimation = pEntityObject->GetEntityPropertyString("lightanimation_LightAnimation");
|
|
|
|
- if (lightAnimation == pOldName)
|
|
|
|
- {
|
|
|
|
- pEntityObject->SetEntityPropertyString("lightanimation_LightAnimation", pNewName);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
-#endif
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
//////////////////////////////////////////////////////////////////////////
|
|
bool CUiAnimViewSequence::SetName(const char* pName)
|
|
bool CUiAnimViewSequence::SetName(const char* pName)
|
|
{
|
|
{
|