diff --git a/Gems/AtomLyIntegration/EMotionFXAtom/Code/Source/ActorAsset.cpp b/Gems/AtomLyIntegration/EMotionFXAtom/Code/Source/ActorAsset.cpp index ece2c2aca7..8d247eaf45 100644 --- a/Gems/AtomLyIntegration/EMotionFXAtom/Code/Source/ActorAsset.cpp +++ b/Gems/AtomLyIntegration/EMotionFXAtom/Code/Source/ActorAsset.cpp @@ -562,8 +562,8 @@ namespace AZ for (size_t i = 0; i < numBoneTransforms; ++i) { MCore::DualQuaternion dualQuat = MCore::DualQuaternion::ConvertFromTransform(AZ::Transform::CreateFromMatrix3x4(skinningMatrices[i])); - dualQuat.mReal.StoreToFloat4(&boneTransforms[i * DualQuaternionSkinningFloatsPerBone]); - dualQuat.mDual.StoreToFloat4(&boneTransforms[i * DualQuaternionSkinningFloatsPerBone + 4]); + dualQuat.m_real.StoreToFloat4(&boneTransforms[i * DualQuaternionSkinningFloatsPerBone]); + dualQuat.m_dual.StoreToFloat4(&boneTransforms[i * DualQuaternionSkinningFloatsPerBone + 4]); } } } diff --git a/Gems/AtomLyIntegration/EMotionFXAtom/Code/Source/AtomActorInstance.cpp b/Gems/AtomLyIntegration/EMotionFXAtom/Code/Source/AtomActorInstance.cpp index c8a09ddaf8..d5a48b900d 100644 --- a/Gems/AtomLyIntegration/EMotionFXAtom/Code/Source/AtomActorInstance.cpp +++ b/Gems/AtomLyIntegration/EMotionFXAtom/Code/Source/AtomActorInstance.cpp @@ -151,10 +151,10 @@ namespace AZ continue; } - const AZ::Vector3 parentPos = pose->GetWorldSpaceTransform(parentIndex).mPosition; + const AZ::Vector3 parentPos = pose->GetWorldSpaceTransform(parentIndex).m_position; m_auxVertices.emplace_back(parentPos); - const AZ::Vector3 bonePos = pose->GetWorldSpaceTransform(jointIndex).mPosition; + const AZ::Vector3 bonePos = pose->GetWorldSpaceTransform(jointIndex).m_position; m_auxVertices.emplace_back(bonePos); } @@ -615,7 +615,7 @@ namespace AZ { // Morph targets that don't deform any vertices (e.g. joint-based morph targets) are not registered in the render proxy. Skip adding their weights. const EMotionFX::MorphTargetStandard::DeformData* deformData = morphTargetStandard->GetDeformData(deformDataIndex); - if (deformData->mNumVerts > 0) + if (deformData->m_numVerts > 0) { float weight = morphTargetSetupInstance->GetWeight(); m_morphTargetWeights.push_back(weight); diff --git a/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/ActorCommands.cpp b/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/ActorCommands.cpp index 85d9c699e1..da5366f6cf 100644 --- a/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/ActorCommands.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/ActorCommands.cpp @@ -57,7 +57,7 @@ namespace CommandSystem // Set motion extraction node. if (parameters.CheckIfHasParameter("motionExtractionNodeName")) { - mOldMotionExtractionNodeIndex = actor->GetMotionExtractionNodeIndex(); + m_oldMotionExtractionNodeIndex = actor->GetMotionExtractionNodeIndex(); AZStd::string motionExtractionNodeName; parameters.GetValue("motionExtractionNodeName", this, motionExtractionNodeName); @@ -91,7 +91,7 @@ namespace CommandSystem // Set retarget root node. if (parameters.CheckIfHasParameter("retargetRootNodeName")) { - mOldRetargetRootNodeIndex = actor->GetRetargetRootNodeIndex(); + m_oldRetargetRootNodeIndex = actor->GetRetargetRootNodeIndex(); AZStd::string retargetRootNodeName = parameters.GetValue("retargetRootNodeName", this); if (retargetRootNodeName.empty() || retargetRootNodeName == "$NULL$") @@ -108,7 +108,7 @@ namespace CommandSystem // Set actor name. if (parameters.CheckIfHasParameter("name")) { - mOldName = actor->GetName(); + m_oldName = actor->GetName(); AZStd::string actorName; parameters.GetValue("name", this, actorName); @@ -119,7 +119,7 @@ namespace CommandSystem if (parameters.CheckIfHasParameter("attachmentNodes")) { // Store old attachment nodes for undo. - mOldAttachmentNodes = ""; + m_oldAttachmentNodes = ""; const size_t numNodes = actor->GetNumNodes(); for (size_t i = 0; i < numNodes; ++i) { @@ -132,8 +132,8 @@ namespace CommandSystem // Check if the node has the attachment flag enabled and add it. if (node->GetIsAttachmentNode()) { - mOldAttachmentNodes += node->GetName(); - mOldAttachmentNodes += ";"; + m_oldAttachmentNodes += node->GetName(); + m_oldAttachmentNodes += ";"; } } @@ -198,7 +198,7 @@ namespace CommandSystem if (parameters.CheckIfHasParameter("nodesExcludedFromBounds")) { // Store old nodes for undo. - mOldExcludedFromBoundsNodes = ""; + m_oldExcludedFromBoundsNodes = ""; const size_t numNodes = actor->GetNumNodes(); for (size_t i = 0; i < numNodes; ++i) { @@ -211,8 +211,8 @@ namespace CommandSystem // Check if the node has the attachment flag enabled and add it. if (!node->GetIncludeInBoundsCalc()) { - mOldExcludedFromBoundsNodes += node->GetName(); - mOldExcludedFromBoundsNodes += ";"; + m_oldExcludedFromBoundsNodes += node->GetName(); + m_oldExcludedFromBoundsNodes += ";"; } } @@ -276,7 +276,7 @@ namespace CommandSystem // Adjust the mirror setup. if (parameters.CheckIfHasParameter("mirrorSetup")) { - mOldMirrorSetup = actor->GetNodeMirrorInfos(); + m_oldMirrorSetup = actor->GetNodeMirrorInfos(); AZStd::string mirrorSetupString; parameters.GetValue("mirrorSetup", this, mirrorSetupString); @@ -308,8 +308,8 @@ namespace CommandSystem EMotionFX::Node* nodeB = actor->GetSkeleton()->FindNodeByName(pairValues[1]); if (nodeA && nodeB) { - actor->GetNodeMirrorInfo(nodeA->GetNodeIndex()).mSourceNode = static_cast(nodeB->GetNodeIndex()); - actor->GetNodeMirrorInfo(nodeB->GetNodeIndex()).mSourceNode = static_cast(nodeA->GetNodeIndex()); + actor->GetNodeMirrorInfo(nodeA->GetNodeIndex()).m_sourceNode = static_cast(nodeB->GetNodeIndex()); + actor->GetNodeMirrorInfo(nodeB->GetNodeIndex()).m_sourceNode = static_cast(nodeA->GetNodeIndex()); } } @@ -318,7 +318,7 @@ namespace CommandSystem } } - mOldDirtyFlag = actor->GetDirtyFlag(); + m_oldDirtyFlag = actor->GetDirtyFlag(); actor->SetDirtyFlag(true); return true; } @@ -338,29 +338,29 @@ namespace CommandSystem if (parameters.CheckIfHasParameter("motionExtractionNodeName")) { - actor->SetMotionExtractionNodeIndex(mOldMotionExtractionNodeIndex); + actor->SetMotionExtractionNodeIndex(m_oldMotionExtractionNodeIndex); } if (parameters.CheckIfHasParameter("retargetRootNodeName")) { - actor->SetRetargetRootNodeIndex(mOldRetargetRootNodeIndex); + actor->SetRetargetRootNodeIndex(m_oldRetargetRootNodeIndex); } if (parameters.CheckIfHasParameter("name")) { - actor->SetName(mOldName.c_str()); + actor->SetName(m_oldName.c_str()); } if (parameters.CheckIfHasParameter("mirrorSetup")) { - actor->SetNodeMirrorInfos(mOldMirrorSetup); + actor->SetNodeMirrorInfos(m_oldMirrorSetup); actor->AutoDetectMirrorAxes(); } // Set the attachment nodes. if (parameters.CheckIfHasParameter("attachmentNodes")) { - const AZStd::string command = AZStd::string::format("AdjustActor -actorID %i -nodeAction \"select\" -attachmentNodes \"%s\"", actorID, mOldAttachmentNodes.c_str()); + const AZStd::string command = AZStd::string::format("AdjustActor -actorID %i -nodeAction \"select\" -attachmentNodes \"%s\"", actorID, m_oldAttachmentNodes.c_str()); if (!GetCommandManager()->ExecuteCommandInsideCommand(command, outResult)) { @@ -372,7 +372,7 @@ namespace CommandSystem // Set the nodes that are not taken into account in the bounding volume calculations. if (parameters.CheckIfHasParameter("nodesExcludedFromBounds")) { - const AZStd::string command = AZStd::string::format("AdjustActor -actorID %i -nodeAction \"select\" -nodesExcludedFromBounds \"%s\"", actorID, mOldExcludedFromBoundsNodes.c_str()); + const AZStd::string command = AZStd::string::format("AdjustActor -actorID %i -nodeAction \"select\" -nodesExcludedFromBounds \"%s\"", actorID, m_oldExcludedFromBoundsNodes.c_str()); if (!GetCommandManager()->ExecuteCommandInsideCommand(command, outResult)) { @@ -382,7 +382,7 @@ namespace CommandSystem } // Set the dirty flag back to the old value. - actor->SetDirtyFlag(mOldDirtyFlag); + actor->SetDirtyFlag(m_oldDirtyFlag); return true; } @@ -479,18 +479,18 @@ namespace CommandSystem EMotionFX::Skeleton* skeleton = actor->GetSkeleton(); // Store the old nodes for the undo. - mOldNodeList = ""; + m_oldNodeList = ""; for (size_t i = 0; i < numNodes; ++i) { EMotionFX::Mesh* mesh = actor->GetMesh(lod, i); if (mesh && mesh->GetIsCollisionMesh()) { - if (!mOldNodeList.empty()) + if (!m_oldNodeList.empty()) { - mOldNodeList += ";"; + m_oldNodeList += ";"; } - mOldNodeList += skeleton->GetNode(i)->GetName(); + m_oldNodeList += skeleton->GetNode(i)->GetName(); } } @@ -517,7 +517,7 @@ namespace CommandSystem } // Save the current dirty flag and tell the actor that something changed. - mOldDirtyFlag = actor->GetDirtyFlag(); + m_oldDirtyFlag = actor->GetDirtyFlag(); actor->SetDirtyFlag(true); // Reinit the renderable actors. @@ -542,11 +542,11 @@ namespace CommandSystem const uint32 lod = parameters.GetValueAsInt("lod", MCORE_INVALIDINDEX32); // Undo command. - const AZStd::string command = AZStd::string::format("ActorSetCollisionMeshes -actorID %i -lod %i -nodeList %s", actorID, lod, mOldNodeList.c_str()); + const AZStd::string command = AZStd::string::format("ActorSetCollisionMeshes -actorID %i -lod %i -nodeList %s", actorID, lod, m_oldNodeList.c_str()); GetCommandManager()->ExecuteCommandInsideCommand(command, outResult); // Set the dirty flag back to the old value - actor->SetDirtyFlag(mOldDirtyFlag); + actor->SetDirtyFlag(m_oldDirtyFlag); return true; } @@ -686,7 +686,7 @@ namespace CommandSystem CommandRemoveActor::CommandRemoveActor(MCore::Command* orgCommand) : MCore::Command("RemoveActor", orgCommand) { - mPreviouslyUsedID = MCORE_INVALIDINDEX32; + m_previouslyUsedId = MCORE_INVALIDINDEX32; } @@ -725,10 +725,10 @@ namespace CommandSystem } // store the previously used id and the actor filename - mPreviouslyUsedID = actor->GetID(); - mOldFileName = actor->GetFileName(); - mOldDirtyFlag = actor->GetDirtyFlag(); - mOldWorkspaceDirtyFlag = GetCommandManager()->GetWorkspaceDirtyFlag(); + m_previouslyUsedId = actor->GetID(); + m_oldFileName = actor->GetFileName(); + m_oldDirtyFlag = actor->GetDirtyFlag(); + m_oldWorkspaceDirtyFlag = GetCommandManager()->GetWorkspaceDirtyFlag(); // get rid of the actor EMotionFX::GetActorManager().UnregisterActor(EMotionFX::GetActorManager().FindSharedActorByID(actor->GetID())); @@ -747,7 +747,7 @@ namespace CommandSystem { MCORE_UNUSED(parameters); - const AZStd::string command = AZStd::string::format("ImportActor -filename \"%s\" -actorID %i", mOldFileName.c_str(), mPreviouslyUsedID); + const AZStd::string command = AZStd::string::format("ImportActor -filename \"%s\" -actorID %i", m_oldFileName.c_str(), m_previouslyUsedId); if (!GetCommandManager()->ExecuteCommandInsideCommand(command, outResult)) { return false; @@ -761,7 +761,7 @@ namespace CommandSystem } // restore the workspace dirty flag - GetCommandManager()->SetWorkspaceDirtyFlag(mOldWorkspaceDirtyFlag); + GetCommandManager()->SetWorkspaceDirtyFlag(m_oldWorkspaceDirtyFlag); return true; } @@ -973,10 +973,10 @@ namespace CommandSystem CommandScaleActorData::CommandScaleActorData(MCore::Command* orgCommand) : MCore::Command("ScaleActorData", orgCommand) { - mActorID = MCORE_INVALIDINDEX32; - mScaleFactor = 1.0f; - mOldActorDirtyFlag = false; - mUseUnitType = false; + m_actorId = MCORE_INVALIDINDEX32; + m_scaleFactor = 1.0f; + m_oldActorDirtyFlag = false; + m_useUnitType = false; } @@ -1020,32 +1020,32 @@ namespace CommandSystem return false; } - mActorID = actor->GetID(); - mScaleFactor = parameters.GetValueAsFloat("scaleFactor", this); + m_actorId = actor->GetID(); + m_scaleFactor = parameters.GetValueAsFloat("scaleFactor", this); AZStd::string targetUnitTypeString; parameters.GetValue("unitType", this, &targetUnitTypeString); - mUseUnitType = parameters.CheckIfHasParameter("unitType"); + m_useUnitType = parameters.CheckIfHasParameter("unitType"); MCore::Distance::EUnitType targetUnitType; bool stringConvertSuccess = MCore::Distance::StringToUnitType(targetUnitTypeString, &targetUnitType); - if (mUseUnitType && stringConvertSuccess == false) + if (m_useUnitType && stringConvertSuccess == false) { outResult = AZStd::string::format("The passed unitType '%s' is not a valid unit type.", targetUnitTypeString.c_str()); return false; } MCore::Distance::EUnitType beforeUnitType = actor->GetUnitType(); - mOldUnitType = MCore::Distance::UnitTypeToString(beforeUnitType); + m_oldUnitType = MCore::Distance::UnitTypeToString(beforeUnitType); - mOldActorDirtyFlag = actor->GetDirtyFlag(); + m_oldActorDirtyFlag = actor->GetDirtyFlag(); actor->SetDirtyFlag(true); // perform the scaling - if (mUseUnitType == false) + if (m_useUnitType == false) { - actor->Scale(mScaleFactor); + actor->Scale(m_scaleFactor); } else { @@ -1083,21 +1083,21 @@ namespace CommandSystem { MCORE_UNUSED(parameters); - if (!mUseUnitType) + if (!m_useUnitType) { - const AZStd::string command = AZStd::string::format("ScaleActorData -id %d -scaleFactor %.8f", mActorID, 1.0f / mScaleFactor); + const AZStd::string command = AZStd::string::format("ScaleActorData -id %d -scaleFactor %.8f", m_actorId, 1.0f / m_scaleFactor); GetCommandManager()->ExecuteCommandInsideCommand(command, outResult); } else { - const AZStd::string command = AZStd::string::format("ScaleActorData -id %d -unitType \"%s\"", mActorID, mOldUnitType.c_str()); + const AZStd::string command = AZStd::string::format("ScaleActorData -id %d -unitType \"%s\"", m_actorId, m_oldUnitType.c_str()); GetCommandManager()->ExecuteCommandInsideCommand(command, outResult); } - EMotionFX::Actor* actor = EMotionFX::GetActorManager().FindActorByID(mActorID); + EMotionFX::Actor* actor = EMotionFX::GetActorManager().FindActorByID(m_actorId); if (actor) { - actor->SetDirtyFlag(mOldActorDirtyFlag); + actor->SetDirtyFlag(m_oldActorDirtyFlag); } return true; diff --git a/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/ActorCommands.h b/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/ActorCommands.h index 94c6e0ff42..6495577de7 100644 --- a/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/ActorCommands.h +++ b/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/ActorCommands.h @@ -19,14 +19,14 @@ namespace CommandSystem { // Adjust the given actor. MCORE_DEFINECOMMAND_START(CommandAdjustActor, "Adjust actor", true) - size_t mOldMotionExtractionNodeIndex; - size_t mOldRetargetRootNodeIndex; - size_t mOldTrajectoryNodeIndex; - AZStd::string mOldAttachmentNodes; - AZStd::string mOldExcludedFromBoundsNodes; - AZStd::string mOldName; - AZStd::vector mOldMirrorSetup; - bool mOldDirtyFlag; + size_t m_oldMotionExtractionNodeIndex; + size_t m_oldRetargetRootNodeIndex; + size_t m_oldTrajectoryNodeIndex; + AZStd::string m_oldAttachmentNodes; + AZStd::string m_oldExcludedFromBoundsNodes; + AZStd::string m_oldName; + AZStd::vector m_oldMirrorSetup; + bool m_oldDirtyFlag; void SetIsAttachmentNode(EMotionFX::Actor* actor, bool isAttachmentNode); void SetIsExcludedFromBoundsNode(EMotionFX::Actor* actor, bool excludedFromBounds); @@ -34,8 +34,8 @@ namespace CommandSystem // Set the collision meshes of the given actor. MCORE_DEFINECOMMAND_START(CommandActorSetCollisionMeshes, "Actor set collison meshes", true) - AZStd::string mOldNodeList; - bool mOldDirtyFlag; + AZStd::string m_oldNodeList; + bool m_oldDirtyFlag; MCORE_DEFINECOMMAND_END // Reset actor instance to bind pose. @@ -50,21 +50,21 @@ namespace CommandSystem // Remove actor. MCORE_DEFINECOMMAND_START(CommandRemoveActor, "Remove actor", true) public: - uint32 mPreviouslyUsedID; - AZStd::string mOldFileName; - bool mOldDirtyFlag; - bool mOldWorkspaceDirtyFlag; + uint32 m_previouslyUsedId; + AZStd::string m_oldFileName; + bool m_oldDirtyFlag; + bool m_oldWorkspaceDirtyFlag; MCORE_DEFINECOMMAND_END // Scale actor data. MCORE_DEFINECOMMAND_START(CommandScaleActorData, "Scale actor data", true) public: - AZStd::string mOldUnitType; - uint32 mActorID; - float mScaleFactor; - bool mOldActorDirtyFlag; - bool mUseUnitType; + AZStd::string m_oldUnitType; + uint32 m_actorId; + float m_scaleFactor; + bool m_oldActorDirtyFlag; + bool m_useUnitType; MCORE_DEFINECOMMAND_END ////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/ActorInstanceCommands.cpp b/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/ActorInstanceCommands.cpp index 45603b298e..ba25318944 100644 --- a/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/ActorInstanceCommands.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/ActorInstanceCommands.cpp @@ -25,7 +25,7 @@ namespace CommandSystem CommandCreateActorInstance::CommandCreateActorInstance(MCore::Command* orgCommand) : MCore::Command("CreateActorInstance", orgCommand) { - mPreviouslyUsedID = MCORE_INVALIDINDEX32; + m_previouslyUsedId = MCORE_INVALIDINDEX32; } @@ -109,15 +109,15 @@ namespace CommandSystem } // in case of redoing the command set the previously used id - if (mPreviouslyUsedID != MCORE_INVALIDINDEX32) + if (m_previouslyUsedId != MCORE_INVALIDINDEX32) { - newInstance->SetID(mPreviouslyUsedID); + newInstance->SetID(m_previouslyUsedId); } - mPreviouslyUsedID = newInstance->GetID(); + m_previouslyUsedId = newInstance->GetID(); // setup the position, rotation and scale - AZ::Vector3 newPos = newInstance->GetLocalSpaceTransform().mPosition; + AZ::Vector3 newPos = newInstance->GetLocalSpaceTransform().m_position; if (parameters.CheckIfHasParameter("xPos")) { newPos.SetX(parameters.GetValueAsFloat("xPos", this)); @@ -155,7 +155,7 @@ namespace CommandSystem } // mark the workspace as dirty - mOldWorkspaceDirtyFlag = GetCommandManager()->GetWorkspaceDirtyFlag(); + m_oldWorkspaceDirtyFlag = GetCommandManager()->GetWorkspaceDirtyFlag(); GetCommandManager()->SetWorkspaceDirtyFlag(true); // return the id of the newly created actor instance @@ -174,7 +174,7 @@ namespace CommandSystem uint32 actorInstanceID = parameters.GetValueAsInt("actorInstanceID", MCORE_INVALIDINDEX32); if (actorInstanceID == MCORE_INVALIDINDEX32) { - actorInstanceID = mPreviouslyUsedID; + actorInstanceID = m_previouslyUsedId; } // find the actor intance based on the given id @@ -202,7 +202,7 @@ namespace CommandSystem } // restore the workspace dirty flag - GetCommandManager()->SetWorkspaceDirtyFlag(mOldWorkspaceDirtyFlag); + GetCommandManager()->SetWorkspaceDirtyFlag(m_oldWorkspaceDirtyFlag); // get rid of the actor instance if (actorInstance) @@ -274,7 +274,7 @@ namespace CommandSystem if (parameters.CheckIfHasParameter("pos")) { AZ::Vector3 value = parameters.GetValueAsVector3("pos", this); - mOldPosition = actorInstance->GetLocalSpaceTransform().mPosition; + m_oldPosition = actorInstance->GetLocalSpaceTransform().m_position; actorInstance->SetLocalSpacePosition(value); } @@ -282,7 +282,7 @@ namespace CommandSystem if (parameters.CheckIfHasParameter("rot")) { AZ::Vector4 value = parameters.GetValueAsVector4("rot", this); - mOldRotation = actorInstance->GetLocalSpaceTransform().mRotation; + m_oldRotation = actorInstance->GetLocalSpaceTransform().m_rotation; actorInstance->SetLocalSpaceRotation(AZ::Quaternion(value.GetX(), value.GetY(), value.GetZ(), value.GetW())); } @@ -292,7 +292,7 @@ namespace CommandSystem if (parameters.CheckIfHasParameter("scale")) { AZ::Vector3 value = parameters.GetValueAsVector3("scale", this); - mOldScale = actorInstance->GetLocalSpaceTransform().mScale; + m_oldScale = actorInstance->GetLocalSpaceTransform().m_scale; actorInstance->SetLocalSpaceScale(value); } ) @@ -301,7 +301,7 @@ namespace CommandSystem if (parameters.CheckIfHasParameter("lodLevel")) { uint32 value = parameters.GetValueAsInt("lodLevel", this); - mOldLODLevel = actorInstance->GetLODLevel(); + m_oldLodLevel = actorInstance->GetLODLevel(); actorInstance->SetLODLevel(value); } @@ -309,7 +309,7 @@ namespace CommandSystem if (parameters.CheckIfHasParameter("isVisible")) { bool value = parameters.GetValueAsBool("isVisible", this); - mOldIsVisible = actorInstance->GetIsVisible(); + m_oldIsVisible = actorInstance->GetIsVisible(); actorInstance->SetIsVisible(value); } @@ -317,12 +317,12 @@ namespace CommandSystem if (parameters.CheckIfHasParameter("doRender")) { bool value = parameters.GetValueAsBool("doRender", this); - mOldDoRender = actorInstance->GetRender(); + m_oldDoRender = actorInstance->GetRender(); actorInstance->SetRender(value); } // mark the workspace as dirty - mOldWorkspaceDirtyFlag = GetCommandManager()->GetWorkspaceDirtyFlag(); + m_oldWorkspaceDirtyFlag = GetCommandManager()->GetWorkspaceDirtyFlag(); GetCommandManager()->SetWorkspaceDirtyFlag(true); return true; @@ -345,13 +345,13 @@ namespace CommandSystem // set the position if (parameters.CheckIfHasParameter("pos")) { - actorInstance->SetLocalSpacePosition(mOldPosition); + actorInstance->SetLocalSpacePosition(m_oldPosition); } // set the rotation if (parameters.CheckIfHasParameter("rot")) { - actorInstance->SetLocalSpaceRotation(mOldRotation); + actorInstance->SetLocalSpaceRotation(m_oldRotation); } // set the scale @@ -359,30 +359,30 @@ namespace CommandSystem ( if (parameters.CheckIfHasParameter("scale")) { - actorInstance->SetLocalSpaceScale(mOldScale); + actorInstance->SetLocalSpaceScale(m_oldScale); } ) // set the LOD level if (parameters.CheckIfHasParameter("lodLevel")) { - actorInstance->SetLODLevel(mOldLODLevel); + actorInstance->SetLODLevel(m_oldLodLevel); } // set the visibility flag if (parameters.CheckIfHasParameter("isVisible")) { - actorInstance->SetIsVisible(mOldIsVisible); + actorInstance->SetIsVisible(m_oldIsVisible); } // set the rendering flag if (parameters.CheckIfHasParameter("doRender")) { - actorInstance->SetRender(mOldDoRender); + actorInstance->SetRender(m_oldDoRender); } // restore the workspace dirty flag - GetCommandManager()->SetWorkspaceDirtyFlag(mOldWorkspaceDirtyFlag); + GetCommandManager()->SetWorkspaceDirtyFlag(m_oldWorkspaceDirtyFlag); return true; } @@ -440,15 +440,15 @@ namespace CommandSystem } // store the old values before removing the instance - mOldPosition = actorInstance->GetLocalSpaceTransform().mPosition; - mOldRotation = actorInstance->GetLocalSpaceTransform().mRotation; + m_oldPosition = actorInstance->GetLocalSpaceTransform().m_position; + m_oldRotation = actorInstance->GetLocalSpaceTransform().m_rotation; EMFX_SCALECODE ( - mOldScale = actorInstance->GetLocalSpaceTransform().mScale; + m_oldScale = actorInstance->GetLocalSpaceTransform().m_scale; ) - mOldLODLevel = actorInstance->GetLODLevel(); - mOldIsVisible = actorInstance->GetIsVisible(); - mOldDoRender = actorInstance->GetRender(); + m_oldLodLevel = actorInstance->GetLODLevel(); + m_oldIsVisible = actorInstance->GetIsVisible(); + m_oldDoRender = actorInstance->GetRender(); // remove the actor instance from the selection if (GetCommandManager()->GetLockSelection()) @@ -458,7 +458,7 @@ namespace CommandSystem // get the id from the corresponding actor and save it for undo EMotionFX::Actor* actor = actorInstance->GetActor(); - mOldActorID = actor->GetID(); + m_oldActorId = actor->GetID(); // get rid of the actor instance if (actorInstance) @@ -467,7 +467,7 @@ namespace CommandSystem } // mark the workspace as dirty - mOldWorkspaceDirtyFlag = GetCommandManager()->GetWorkspaceDirtyFlag(); + m_oldWorkspaceDirtyFlag = GetCommandManager()->GetWorkspaceDirtyFlag(); GetCommandManager()->SetWorkspaceDirtyFlag(true); return true; @@ -489,17 +489,17 @@ namespace CommandSystem AZStd::string commandString; MCore::CommandGroup commandGroup("Undo remove actor instance", 2); - commandString = AZStd::string::format("CreateActorInstance -actorID %i -actorInstanceID %i", mOldActorID, actorInstanceID); + commandString = AZStd::string::format("CreateActorInstance -actorID %i -actorInstanceID %i", m_oldActorId, actorInstanceID); commandGroup.AddCommandString(commandString.c_str()); commandString = AZStd::string::format("AdjustActorInstance -actorInstanceID %i -pos \"%s\" -rot \"%s\" -scale \"%s\" -lodLevel %zu -isVisible \"%s\" -doRender \"%s\"", actorInstanceID, - AZStd::to_string(mOldPosition).c_str(), - AZStd::to_string(mOldRotation).c_str(), - AZStd::to_string(mOldScale).c_str(), - mOldLODLevel, - AZStd::to_string(mOldIsVisible).c_str(), - AZStd::to_string(mOldDoRender).c_str() + AZStd::to_string(m_oldPosition).c_str(), + AZStd::to_string(m_oldRotation).c_str(), + AZStd::to_string(m_oldScale).c_str(), + m_oldLodLevel, + AZStd::to_string(m_oldIsVisible).c_str(), + AZStd::to_string(m_oldDoRender).c_str() ); commandGroup.AddCommandString(commandString); @@ -507,7 +507,7 @@ namespace CommandSystem bool result = GetCommandManager()->ExecuteCommandGroupInsideCommand(commandGroup, outResult); // restore the workspace dirty flag - GetCommandManager()->SetWorkspaceDirtyFlag(mOldWorkspaceDirtyFlag); + GetCommandManager()->SetWorkspaceDirtyFlag(m_oldWorkspaceDirtyFlag); return result; } @@ -538,10 +538,10 @@ namespace CommandSystem return; } - const AZ::Vector3& pos = actorInstance->GetLocalSpaceTransform().mPosition; - const AZ::Quaternion& rot = actorInstance->GetLocalSpaceTransform().mRotation; + const AZ::Vector3& pos = actorInstance->GetLocalSpaceTransform().m_position; + const AZ::Quaternion& rot = actorInstance->GetLocalSpaceTransform().m_rotation; #ifndef EMFX_SCALE_DISABLED - const AZ::Vector3& scale = actorInstance->GetLocalSpaceTransform().mScale; + const AZ::Vector3& scale = actorInstance->GetLocalSpaceTransform().m_scale; #else const AZ::Vector3 scale = AZ::Vector3::CreateOne(); #endif diff --git a/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/ActorInstanceCommands.h b/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/ActorInstanceCommands.h index 69509822fe..604d88d037 100644 --- a/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/ActorInstanceCommands.h +++ b/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/ActorInstanceCommands.h @@ -20,34 +20,34 @@ namespace CommandSystem // create a new actor instance MCORE_DEFINECOMMAND_START(CommandCreateActorInstance, "Create actor instance", true) public: - uint32 mPreviouslyUsedID; - bool mOldWorkspaceDirtyFlag; + uint32 m_previouslyUsedId; + bool m_oldWorkspaceDirtyFlag; MCORE_DEFINECOMMAND_END // adjust a given actor instance MCORE_DEFINECOMMAND_START(CommandAdjustActorInstance, "Adjust actor instance", true) public: - AZ::Vector3 mOldPosition; - AZ::Quaternion mOldRotation; - AZ::Vector3 mOldScale; - size_t mOldLODLevel; - bool mOldIsVisible; - bool mOldDoRender; - bool mOldWorkspaceDirtyFlag; + AZ::Vector3 m_oldPosition; + AZ::Quaternion m_oldRotation; + AZ::Vector3 m_oldScale; + size_t m_oldLodLevel; + bool m_oldIsVisible; + bool m_oldDoRender; + bool m_oldWorkspaceDirtyFlag; MCORE_DEFINECOMMAND_END // remove an actor instance MCORE_DEFINECOMMAND_START(CommandRemoveActorInstance, "Remove actor instance", true) - uint32 mOldActorID; - AZ::Vector3 mOldPosition; - AZ::Quaternion mOldRotation; - AZ::Vector3 mOldScale; - size_t mOldLODLevel; - bool mOldIsVisible; - bool mOldDoRender; - bool mOldWorkspaceDirtyFlag; + uint32 m_oldActorId; + AZ::Vector3 m_oldPosition; + AZ::Quaternion m_oldRotation; + AZ::Vector3 m_oldScale; + size_t m_oldLodLevel; + bool m_oldIsVisible; + bool m_oldDoRender; + bool m_oldWorkspaceDirtyFlag; MCORE_DEFINECOMMAND_END ////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/AnimGraphCommands.cpp b/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/AnimGraphCommands.cpp index 1458107bcf..dbc25d7a60 100644 --- a/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/AnimGraphCommands.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/AnimGraphCommands.cpp @@ -39,7 +39,7 @@ namespace CommandSystem CommandLoadAnimGraph::CommandLoadAnimGraph(MCore::Command* orgCommand) : MCore::Command("LoadAnimGraph", orgCommand) { - mOldAnimGraphID = MCORE_INVALIDINDEX32; + m_oldAnimGraphId = MCORE_INVALIDINDEX32; } @@ -107,11 +107,11 @@ namespace CommandSystem } // in case we are in a redo call assign the previously used id - if (mOldAnimGraphID != MCORE_INVALIDINDEX32) + if (m_oldAnimGraphId != MCORE_INVALIDINDEX32) { - animGraph->SetID(mOldAnimGraphID); + animGraph->SetID(m_oldAnimGraphId); } - mOldAnimGraphID = animGraph->GetID(); + m_oldAnimGraphId = animGraph->GetID(); animGraph->RecursiveInvalidateUniqueDatas(); @@ -126,7 +126,7 @@ namespace CommandSystem } // mark the workspace as dirty - mOldWorkspaceDirtyFlag = GetCommandManager()->GetWorkspaceDirtyFlag(); + m_oldWorkspaceDirtyFlag = GetCommandManager()->GetWorkspaceDirtyFlag(); GetCommandManager()->SetWorkspaceDirtyFlag(true); // automatically select the anim graph after loading it @@ -144,18 +144,18 @@ namespace CommandSystem MCORE_UNUSED(parameters); // get the anim graph the command created - EMotionFX::AnimGraph* animGraph = EMotionFX::GetAnimGraphManager().FindAnimGraphByID(mOldAnimGraphID); + EMotionFX::AnimGraph* animGraph = EMotionFX::GetAnimGraphManager().FindAnimGraphByID(m_oldAnimGraphId); if (animGraph == nullptr) { - outResult = AZStd::string::format("Cannot undo load anim graph command. Previously used anim graph id '%i' is not valid.", mOldAnimGraphID); + outResult = AZStd::string::format("Cannot undo load anim graph command. Previously used anim graph id '%i' is not valid.", m_oldAnimGraphId); return false; } // Remove the newly created anim graph. - const bool result = GetCommandManager()->ExecuteCommandInsideCommand(AZStd::string::format("RemoveAnimGraph -animGraphID %i", mOldAnimGraphID), outResult); + const bool result = GetCommandManager()->ExecuteCommandInsideCommand(AZStd::string::format("RemoveAnimGraph -animGraphID %i", m_oldAnimGraphId), outResult); // restore the workspace dirty flag - GetCommandManager()->SetWorkspaceDirtyFlag(mOldWorkspaceDirtyFlag); + GetCommandManager()->SetWorkspaceDirtyFlag(m_oldWorkspaceDirtyFlag); return result; } @@ -184,7 +184,7 @@ namespace CommandSystem CommandCreateAnimGraph::CommandCreateAnimGraph(MCore::Command* orgCommand) : MCore::Command("CreateAnimGraph", orgCommand) { - mPreviouslyUsedID = MCORE_INVALIDINDEX32; + m_previouslyUsedId = MCORE_INVALIDINDEX32; } @@ -221,11 +221,11 @@ namespace CommandSystem { animGraph->SetID(parameters.GetValueAsInt("animGraphID", this)); } - if (mPreviouslyUsedID != MCORE_INVALIDINDEX32) + if (m_previouslyUsedId != MCORE_INVALIDINDEX32) { - animGraph->SetID(mPreviouslyUsedID); + animGraph->SetID(m_previouslyUsedId); } - mPreviouslyUsedID = animGraph->GetID(); + m_previouslyUsedId = animGraph->GetID(); animGraph->RecursiveReinit(); animGraph->RecursiveInvalidateUniqueDatas(); @@ -238,7 +238,7 @@ namespace CommandSystem AZStd::to_string(outResult, animGraph->GetID()); // mark the workspace as dirty - mOldWorkspaceDirtyFlag = GetCommandManager()->GetWorkspaceDirtyFlag(); + m_oldWorkspaceDirtyFlag = GetCommandManager()->GetWorkspaceDirtyFlag(); GetCommandManager()->SetWorkspaceDirtyFlag(true); return true; @@ -251,18 +251,18 @@ namespace CommandSystem MCORE_UNUSED(parameters); // get the anim graph the command created - EMotionFX::AnimGraph* animGraph = EMotionFX::GetAnimGraphManager().FindAnimGraphByID(mPreviouslyUsedID); + EMotionFX::AnimGraph* animGraph = EMotionFX::GetAnimGraphManager().FindAnimGraphByID(m_previouslyUsedId); if (animGraph == nullptr) { - outResult = AZStd::string::format("Cannot undo create anim graph command. Previously used anim graph id '%i' is not valid.", mPreviouslyUsedID); + outResult = AZStd::string::format("Cannot undo create anim graph command. Previously used anim graph id '%i' is not valid.", m_previouslyUsedId); return false; } // remove the newly created anim graph again - const bool result = GetCommandManager()->ExecuteCommandInsideCommand(AZStd::string::format("RemoveAnimGraph -animGraphID %i", mPreviouslyUsedID), outResult); + const bool result = GetCommandManager()->ExecuteCommandInsideCommand(AZStd::string::format("RemoveAnimGraph -animGraphID %i", m_previouslyUsedId), outResult); // restore the workspace dirty flag - GetCommandManager()->SetWorkspaceDirtyFlag(mOldWorkspaceDirtyFlag); + GetCommandManager()->SetWorkspaceDirtyFlag(m_oldWorkspaceDirtyFlag); return result; } @@ -334,7 +334,7 @@ namespace CommandSystem if (someAnimGraphRemoved) { - mOldWorkspaceDirtyFlag = GetCommandManager()->GetWorkspaceDirtyFlag(); + m_oldWorkspaceDirtyFlag = GetCommandManager()->GetWorkspaceDirtyFlag(); GetCommandManager()->SetWorkspaceDirtyFlag(true); } @@ -388,7 +388,7 @@ namespace CommandSystem } // mark the workspace as dirty - mOldWorkspaceDirtyFlag = GetCommandManager()->GetWorkspaceDirtyFlag(); + m_oldWorkspaceDirtyFlag = GetCommandManager()->GetWorkspaceDirtyFlag(); GetCommandManager()->SetWorkspaceDirtyFlag(true); return true; @@ -414,7 +414,7 @@ namespace CommandSystem } // restore the workspace dirty flag - GetCommandManager()->SetWorkspaceDirtyFlag(mOldWorkspaceDirtyFlag); + GetCommandManager()->SetWorkspaceDirtyFlag(m_oldWorkspaceDirtyFlag); return result; } @@ -440,9 +440,9 @@ namespace CommandSystem CommandActivateAnimGraph::CommandActivateAnimGraph(MCore::Command* orgCommand) : MCore::Command(s_activateAnimGraphCmdName, orgCommand) { - mActorInstanceID = MCORE_INVALIDINDEX32; - mOldAnimGraphUsed = MCORE_INVALIDINDEX32; - mOldMotionSetUsed = MCORE_INVALIDINDEX32; + m_actorInstanceId = MCORE_INVALIDINDEX32; + m_oldAnimGraphUsed = MCORE_INVALIDINDEX32; + m_oldMotionSetUsed = MCORE_INVALIDINDEX32; } CommandActivateAnimGraph::~CommandActivateAnimGraph() @@ -509,7 +509,7 @@ namespace CommandSystem } // store the actor instance ID - mActorInstanceID = actorInstance->GetID(); + m_actorInstanceId = actorInstance->GetID(); // get the motion system from the actor instance EMotionFX::MotionSystem* motionSystem = actorInstance->GetMotionSystem(); @@ -533,9 +533,9 @@ namespace CommandSystem EMotionFX::MotionSet* animGraphInstanceMotionSet = animGraphInstance->GetMotionSet(); // store the currently used anim graph ID, motion set ID and the visualize scale - mOldAnimGraphUsed = animGraphInstanceAnimGraph->GetID(); - mOldMotionSetUsed = (animGraphInstanceMotionSet) ? animGraphInstanceMotionSet->GetID() : MCORE_INVALIDINDEX32; - mOldVisualizeScaleUsed = animGraphInstance->GetVisualizeScale(); + m_oldAnimGraphUsed = animGraphInstanceAnimGraph->GetID(); + m_oldMotionSetUsed = (animGraphInstanceMotionSet) ? animGraphInstanceMotionSet->GetID() : MCORE_INVALIDINDEX32; + m_oldVisualizeScaleUsed = animGraphInstance->GetVisualizeScale(); // check if the anim graph is valid if (animGraph) @@ -566,8 +566,8 @@ namespace CommandSystem else // no one anim graph instance set on the actor instance, create a new one { // store the currently used ID as invalid - mOldAnimGraphUsed = MCORE_INVALIDINDEX32; - mOldMotionSetUsed = MCORE_INVALIDINDEX32; + m_oldAnimGraphUsed = MCORE_INVALIDINDEX32; + m_oldMotionSetUsed = MCORE_INVALIDINDEX32; // check if the anim graph is valid if (animGraph) @@ -585,7 +585,7 @@ namespace CommandSystem AZStd::to_string(outResult, animGraph ? animGraph->GetID() : MCORE_INVALIDINDEX32); // mark the workspace as dirty - mOldWorkspaceDirtyFlag = GetCommandManager()->GetWorkspaceDirtyFlag(); + m_oldWorkspaceDirtyFlag = GetCommandManager()->GetWorkspaceDirtyFlag(); GetCommandManager()->SetWorkspaceDirtyFlag(true); AZStd::string resultString; @@ -598,12 +598,12 @@ namespace CommandSystem if (parameters.GetValueAsBool("startRecording", this)) { EMotionFX::Recorder::RecordSettings settings; - settings.mFPS = 1000000; - settings.mRecordTransforms = true; - settings.mRecordAnimGraphStates = true; - settings.mRecordNodeHistory = true; - settings.mRecordScale = true; - settings.mInitialAnimGraphAnimBytes = 4 * 1024 * 1024; // 4 mb + settings.m_fps = 1000000; + settings.m_recordTransforms = true; + settings.m_recordAnimGraphStates = true; + settings.m_recordNodeHistory = true; + settings.m_recordScale = true; + settings.m_initialAnimGraphAnimBytes = 4 * 1024 * 1024; // 4 mb EMotionFX::GetRecorder().StartRecording(settings); } @@ -616,41 +616,41 @@ namespace CommandSystem MCORE_UNUSED(parameters); // get the actor instance id and check if it is valid - EMotionFX::ActorInstance* actorInstance = EMotionFX::GetActorManager().FindActorInstanceByID(mActorInstanceID); + EMotionFX::ActorInstance* actorInstance = EMotionFX::GetActorManager().FindActorInstanceByID(m_actorInstanceId); if (actorInstance == nullptr) { - outResult = AZStd::string::format("Cannot undo activate anim graph. Actor instance id '%i' is not valid.", mActorInstanceID); + outResult = AZStd::string::format("Cannot undo activate anim graph. Actor instance id '%i' is not valid.", m_actorInstanceId); return false; } // get the anim graph, invalid index is a special case to allow the anim graph to be nullptr EMotionFX::AnimGraph* animGraph; - if (mOldAnimGraphUsed == MCORE_INVALIDINDEX32) + if (m_oldAnimGraphUsed == MCORE_INVALIDINDEX32) { animGraph = nullptr; } else { - animGraph = EMotionFX::GetAnimGraphManager().FindAnimGraphByID(mOldAnimGraphUsed); + animGraph = EMotionFX::GetAnimGraphManager().FindAnimGraphByID(m_oldAnimGraphUsed); if (animGraph == nullptr) { - outResult = AZStd::string::format("Cannot undo activate anim graph. Anim graph id '%i' is not valid.", mOldAnimGraphUsed); + outResult = AZStd::string::format("Cannot undo activate anim graph. Anim graph id '%i' is not valid.", m_oldAnimGraphUsed); return false; } } // get the motion set, invalid index is a special case to allow the motion set to be nullptr EMotionFX::MotionSet* motionSet; - if (mOldMotionSetUsed == MCORE_INVALIDINDEX32) + if (m_oldMotionSetUsed == MCORE_INVALIDINDEX32) { motionSet = nullptr; } else { - motionSet = EMotionFX::GetMotionManager().FindMotionSetByID(mOldMotionSetUsed); + motionSet = EMotionFX::GetMotionManager().FindMotionSetByID(m_oldMotionSetUsed); if (motionSet == nullptr) { - outResult = AZStd::string::format("Cannot undo activate anim graph. Motion set id '%i' is not valid.", mOldMotionSetUsed); + outResult = AZStd::string::format("Cannot undo activate anim graph. Motion set id '%i' is not valid.", m_oldMotionSetUsed); return false; } } @@ -683,7 +683,7 @@ namespace CommandSystem // create a new anim graph instance animGraphInstance = EMotionFX::AnimGraphInstance::Create(animGraph, actorInstance, motionSet); - animGraphInstance->SetVisualizeScale(mOldVisualizeScaleUsed); + animGraphInstance->SetVisualizeScale(m_oldVisualizeScaleUsed); actorInstance->SetAnimGraphInstance(animGraphInstance); animGraphInstance->RecursiveInvalidateUniqueDatas(); @@ -702,7 +702,7 @@ namespace CommandSystem { // create a new anim graph instance animGraphInstance = EMotionFX::AnimGraphInstance::Create(animGraph, actorInstance, motionSet); - animGraphInstance->SetVisualizeScale(mOldVisualizeScaleUsed); + animGraphInstance->SetVisualizeScale(m_oldVisualizeScaleUsed); actorInstance->SetAnimGraphInstance(animGraphInstance); animGraphInstance->RecursiveInvalidateUniqueDatas(); @@ -713,7 +713,7 @@ namespace CommandSystem AZStd::to_string(outResult, animGraph ? animGraph->GetID() : MCORE_INVALIDINDEX32); // restore the workspace dirty flag - GetCommandManager()->SetWorkspaceDirtyFlag(mOldWorkspaceDirtyFlag); + GetCommandManager()->SetWorkspaceDirtyFlag(m_oldWorkspaceDirtyFlag); AZStd::string resultString; GetCommandManager()->ExecuteCommandInsideCommand("Unselect -animGraphIndex SELECT_ALL", resultString); diff --git a/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/AnimGraphCommands.h b/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/AnimGraphCommands.h index 963e80fd8d..ae09420a29 100644 --- a/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/AnimGraphCommands.h +++ b/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/AnimGraphCommands.h @@ -23,16 +23,16 @@ namespace CommandSystem public: using RelocateFilenameFunction = AZStd::function; RelocateFilenameFunction m_relocateFilenameFunction; - uint32 mOldAnimGraphID; - bool mOldWorkspaceDirtyFlag; + uint32 m_oldAnimGraphId; + bool m_oldWorkspaceDirtyFlag; MCORE_DEFINECOMMAND_END // create a new anim graph MCORE_DEFINECOMMAND_START(CommandCreateAnimGraph, "Create a anim graph", true) public: - uint32 mPreviouslyUsedID; - bool mOldWorkspaceDirtyFlag; + uint32 m_previouslyUsedId; + bool m_oldWorkspaceDirtyFlag; MCORE_DEFINECOMMAND_END @@ -40,18 +40,18 @@ public: MCORE_DEFINECOMMAND_START(CommandRemoveAnimGraph, "Remove a anim graph", true) public: AZStd::vector> m_oldFileNamesAndIds; - bool mOldWorkspaceDirtyFlag; + bool m_oldWorkspaceDirtyFlag; MCORE_DEFINECOMMAND_END // Activate the given anim graph. MCORE_DEFINECOMMAND_START(CommandActivateAnimGraph, "Activate a anim graph", true) public: - uint32 mActorInstanceID; - uint32 mOldAnimGraphUsed; - uint32 mOldMotionSetUsed; - float mOldVisualizeScaleUsed; - bool mOldWorkspaceDirtyFlag; + uint32 m_actorInstanceId; + uint32 m_oldAnimGraphUsed; + uint32 m_oldMotionSetUsed; + float m_oldVisualizeScaleUsed; + bool m_oldWorkspaceDirtyFlag; static const char* s_activateAnimGraphCmdName; MCORE_DEFINECOMMAND_END diff --git a/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/AnimGraphConnectionCommands.cpp b/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/AnimGraphConnectionCommands.cpp index 7707d8fa8b..b6a3870073 100644 --- a/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/AnimGraphConnectionCommands.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/AnimGraphConnectionCommands.cpp @@ -63,7 +63,7 @@ namespace CommandSystem CommandAnimGraphCreateConnection::CommandAnimGraphCreateConnection(MCore::Command* orgCommand) : MCore::Command("AnimGraphCreateConnection", orgCommand) { - mTransitionType = AZ::TypeId::CreateNull(); + m_transitionType = AZ::TypeId::CreateNull(); } // destructor @@ -83,13 +83,13 @@ namespace CommandSystem } // store the anim graph id for undo - mAnimGraphID = animGraph->GetID(); + m_animGraphId = animGraph->GetID(); // get the transition type AZ::Outcome transitionTypeString = parameters.GetValueIfExists("transitionType", this); if (transitionTypeString.IsSuccess()) { - mTransitionType = AZ::TypeId::CreateString(transitionTypeString.GetValue().c_str()); + m_transitionType = AZ::TypeId::CreateString(transitionTypeString.GetValue().c_str()); } // get the node names @@ -116,18 +116,18 @@ namespace CommandSystem } // get the ports - mSourcePort = parameters.GetValueAsInt("sourcePort", 0); - mTargetPort = parameters.GetValueAsInt("targetPort", 0); - parameters.GetValue("sourcePortName", this, mSourcePortName); - parameters.GetValue("targetPortName", this, mTargetPortName); + m_sourcePort = parameters.GetValueAsInt("sourcePort", 0); + m_targetPort = parameters.GetValueAsInt("targetPort", 0); + parameters.GetValue("sourcePortName", this, m_sourcePortName); + parameters.GetValue("targetPortName", this, m_targetPortName); // in case the source port got specified by name, overwrite the source port number - if (!mSourcePortName.empty()) + if (!m_sourcePortName.empty()) { - mSourcePort = sourceNode->FindOutputPortIndex(mSourcePortName); + m_sourcePort = sourceNode->FindOutputPortIndex(m_sourcePortName); // in case we want to add this connection to a parameter node while the parameter name doesn't exist, still return true so that copy paste doesn't fail - if (azrtti_typeid(sourceNode) == azrtti_typeid() && mSourcePort == InvalidIndex) + if (azrtti_typeid(sourceNode) == azrtti_typeid() && m_sourcePort == InvalidIndex) { m_connectionId.SetInvalid(); return true; @@ -135,9 +135,9 @@ namespace CommandSystem } // in case the target port got specified by name, overwrite the target port number - if (!mTargetPortName.empty()) + if (!m_targetPortName.empty()) { - mTargetPort = targetNode->FindInputPortIndex(mTargetPortName.c_str()); + m_targetPort = targetNode->FindInputPortIndex(m_targetPortName.c_str()); } // get the parent of the source node @@ -157,27 +157,27 @@ namespace CommandSystem } // verify port ranges - if (mSourcePort >= sourceNode->GetOutputPorts().size()) + if (m_sourcePort >= sourceNode->GetOutputPorts().size()) { outResult = AZStd::string::format("The output port number is not valid for the given node. Node '%s' only has %zu output ports.", sourceNode->GetName(), sourceNode->GetOutputPorts().size()); return false; } - if (mTargetPort >= targetNode->GetInputPorts().size()) + if (m_targetPort >= targetNode->GetInputPorts().size()) { outResult = AZStd::string::format("The input port number is not valid for the given node. Node '%s' only has %zu input ports.", targetNode->GetName(), targetNode->GetInputPorts().size()); return false; } // check if connection already exists - if (targetNode->GetHasConnection(sourceNode, static_cast(mSourcePort), static_cast(mTargetPort))) + if (targetNode->GetHasConnection(sourceNode, static_cast(m_sourcePort), static_cast(m_targetPort))) { outResult = AZStd::string::format("The connection you are trying to create already exists!"); return false; } // create the connection and auto assign an id first of all - EMotionFX::BlendTreeConnection* connection = targetNode->AddConnection(sourceNode, static_cast(mSourcePort), static_cast(mTargetPort)); + EMotionFX::BlendTreeConnection* connection = targetNode->AddConnection(sourceNode, static_cast(m_sourcePort), static_cast(m_targetPort)); // Overwrite the connection id if specified by a command parameter. if (parameters.CheckIfHasParameter("id")) @@ -201,8 +201,8 @@ namespace CommandSystem if (azrtti_istypeof(targetNode)) { EMotionFX::BlendTreeBlendNNode* blendTreeBlendNNode = static_cast(targetNode); - mUpdateParamFlag = parameters.GetValueAsBool("updateParam", true); - if (mUpdateParamFlag) + m_updateParamFlag = parameters.GetValueAsBool("updateParam", true); + if (m_updateParamFlag) { blendTreeBlendNNode->UpdateParamWeights(); } @@ -214,17 +214,17 @@ namespace CommandSystem EMotionFX::AnimGraphStateMachine* machine = (EMotionFX::AnimGraphStateMachine*)targetNode->GetParentNode(); // try to create the anim graph node - EMotionFX::AnimGraphObject* object = EMotionFX::AnimGraphObjectFactory::Create(mTransitionType, animGraph); + EMotionFX::AnimGraphObject* object = EMotionFX::AnimGraphObjectFactory::Create(m_transitionType, animGraph); if (!object) { - outResult = AZStd::string::format("Cannot create transition of type %s", mTransitionType.ToString().c_str()); + outResult = AZStd::string::format("Cannot create transition of type %s", m_transitionType.ToString().c_str()); return false; } // check if this is really a transition if (!azrtti_istypeof(object)) { - outResult = AZStd::string::format("Cannot create state transition of type %s, because this object type is not inherited from AnimGraphStateTransition.", mTransitionType.ToString().c_str()); + outResult = AZStd::string::format("Cannot create state transition of type %s, because this object type is not inherited from AnimGraphStateTransition.", m_transitionType.ToString().c_str()); return false; } @@ -255,13 +255,13 @@ namespace CommandSystem transition->SetTargetNode(targetNode); // get the offsets - mStartOffsetX = parameters.GetValueAsInt("startOffsetX", 0); - mStartOffsetY = parameters.GetValueAsInt("startOffsetY", 0); - mEndOffsetX = parameters.GetValueAsInt("endOffsetX", 0); - mEndOffsetY = parameters.GetValueAsInt("endOffsetY", 0); + m_startOffsetX = parameters.GetValueAsInt("startOffsetX", 0); + m_startOffsetY = parameters.GetValueAsInt("startOffsetY", 0); + m_endOffsetX = parameters.GetValueAsInt("endOffsetX", 0); + m_endOffsetY = parameters.GetValueAsInt("endOffsetY", 0); if (parameters.CheckIfHasValue("startOffsetX") || parameters.CheckIfHasValue("startOffsetY") || parameters.CheckIfHasValue("endOffsetX") || parameters.CheckIfHasValue("endOffsetY")) { - transition->SetVisualOffsets(mStartOffsetX, mStartOffsetY, mEndOffsetX, mEndOffsetY); + transition->SetVisualOffsets(m_startOffsetX, m_startOffsetY, m_endOffsetX, m_endOffsetY); } transition->SetIsWildcardTransition(isWildcardTransition); @@ -290,19 +290,19 @@ namespace CommandSystem transition->Reinit(); } - mTargetNodeId.SetInvalid(); - mSourceNodeId.SetInvalid(); + m_targetNodeId.SetInvalid(); + m_sourceNodeId.SetInvalid(); if (targetNode) { - mTargetNodeId = targetNode->GetId(); + m_targetNodeId = targetNode->GetId(); } if (sourceNode) { - mSourceNodeId = sourceNode->GetId(); + m_sourceNodeId = sourceNode->GetId(); } // save the current dirty flag and tell the anim graph that something got changed - mOldDirtyFlag = animGraph->GetDirtyFlag(); + m_oldDirtyFlag = animGraph->GetDirtyFlag(); animGraph->SetDirtyFlag(true); // set the command result to the connection id @@ -319,16 +319,16 @@ namespace CommandSystem MCORE_UNUSED(parameters); // get the anim graph - EMotionFX::AnimGraph* animGraph = EMotionFX::GetAnimGraphManager().FindAnimGraphByID(mAnimGraphID); + EMotionFX::AnimGraph* animGraph = EMotionFX::GetAnimGraphManager().FindAnimGraphByID(m_animGraphId); if (animGraph == nullptr) { - outResult = AZStd::string::format("The anim graph with id '%i' does not exist anymore.", mAnimGraphID); + outResult = AZStd::string::format("The anim graph with id '%i' does not exist anymore.", m_animGraphId); return false; } // in case of a wildcard transition the source node is the invalid index, so that's all fine - EMotionFX::AnimGraphNode* sourceNode = animGraph->RecursiveFindNodeById(mSourceNodeId); - EMotionFX::AnimGraphNode* targetNode = animGraph->RecursiveFindNodeById(mTargetNodeId); + EMotionFX::AnimGraphNode* sourceNode = animGraph->RecursiveFindNodeById(m_sourceNodeId); + EMotionFX::AnimGraphNode* targetNode = animGraph->RecursiveFindNodeById(m_targetNodeId); // NOTE: When source node is a nullptr, we are dealing with a wildcard transition, so there a nullptr is allowed. if (!targetNode) @@ -348,9 +348,9 @@ namespace CommandSystem const AZStd::string commandString = AZStd::string::format("AnimGraphRemoveConnection -animGraphID %i -targetNode \"%s\" -targetPort %zu -sourceNode \"%s\" -sourcePort %zu -id %s", animGraph->GetID(), targetNode->GetName(), - mTargetPort, + m_targetPort, sourceNodeName.c_str(), - mSourcePort, + m_sourcePort, m_connectionId.ToString().c_str()); // execute the command without putting it in the history @@ -365,11 +365,11 @@ namespace CommandSystem } // reset the data used for undo and redo - mSourceNodeId.SetInvalid(); - mTargetNodeId.SetInvalid(); + m_sourceNodeId.SetInvalid(); + m_targetNodeId.SetInvalid(); // set the dirty flag back to the old value - animGraph->SetDirtyFlag(mOldDirtyFlag); + animGraph->SetDirtyFlag(m_oldDirtyFlag); return true; } @@ -414,13 +414,13 @@ namespace CommandSystem CommandAnimGraphRemoveConnection::CommandAnimGraphRemoveConnection(MCore::Command* orgCommand) : MCore::Command("AnimGraphRemoveConnection", orgCommand) { - mSourcePort = InvalidIndex; - mTargetPort = InvalidIndex; - mTransitionType = AZ::TypeId::CreateNull(); - mStartOffsetX = 0; - mStartOffsetY = 0; - mEndOffsetX = 0; - mEndOffsetY = 0; + m_sourcePort = InvalidIndex; + m_targetPort = InvalidIndex; + m_transitionType = AZ::TypeId::CreateNull(); + m_startOffsetX = 0; + m_startOffsetY = 0; + m_endOffsetX = 0; + m_endOffsetY = 0; } @@ -441,7 +441,7 @@ namespace CommandSystem } // store the anim graph id for undo - mAnimGraphID = animGraph->GetID(); + m_animGraphId = animGraph->GetID(); // get the node names AZStd::string sourceNodeName; @@ -466,19 +466,19 @@ namespace CommandSystem } // get the ids from the source and destination nodes - mSourceNodeId.SetInvalid(); - mSourceNodeName.clear(); + m_sourceNodeId.SetInvalid(); + m_sourceNodeName.clear(); if (sourceNode) { - mSourceNodeId = sourceNode->GetId(); - mSourceNodeName = sourceNode->GetName(); + m_sourceNodeId = sourceNode->GetId(); + m_sourceNodeName = sourceNode->GetName(); } - mTargetNodeId = targetNode->GetId(); - mTargetNodeName = targetNode->GetName(); + m_targetNodeId = targetNode->GetId(); + m_targetNodeName = targetNode->GetName(); // get the ports - mSourcePort = parameters.GetValueAsInt("sourcePort", 0); - mTargetPort = parameters.GetValueAsInt("targetPort", 0); + m_sourcePort = parameters.GetValueAsInt("sourcePort", 0); + m_targetPort = parameters.GetValueAsInt("targetPort", 0); // get the parent of the source node if (targetNode->GetParentNode() == nullptr) @@ -497,34 +497,34 @@ namespace CommandSystem } // verify port ranges - if (mSourcePort >= static_cast(sourceNode->GetOutputPorts().size()) || mSourcePort < 0) + if (m_sourcePort >= static_cast(sourceNode->GetOutputPorts().size()) || m_sourcePort < 0) { outResult = AZStd::string::format("The output port number is not valid for the given node. Node '%s' only has %zu output ports.", sourceNode->GetName(), sourceNode->GetOutputPorts().size()); return false; } - if (mTargetPort >= static_cast(targetNode->GetInputPorts().size()) || mTargetPort < 0) + if (m_targetPort >= static_cast(targetNode->GetInputPorts().size()) || m_targetPort < 0) { outResult = AZStd::string::format("The input port number is not valid for the given node. Node '%s' only has %zu input ports.", targetNode->GetName(), targetNode->GetInputPorts().size()); return false; } // check if connection already exists - if (!targetNode->GetHasConnection(sourceNode, static_cast(mSourcePort), static_cast(mTargetPort))) + if (!targetNode->GetHasConnection(sourceNode, static_cast(m_sourcePort), static_cast(m_targetPort))) { outResult = AZStd::string::format("The connection you are trying to remove doesn't exist!"); return false; } // get the connection ID and store it - EMotionFX::BlendTreeConnection* connection = targetNode->FindConnection(sourceNode, static_cast(mSourcePort), static_cast(mTargetPort)); + EMotionFX::BlendTreeConnection* connection = targetNode->FindConnection(sourceNode, static_cast(m_sourcePort), static_cast(m_targetPort)); if (connection) { m_connectionId = connection->GetId(); } // create the connection - targetNode->RemoveConnection(sourceNode, static_cast(mSourcePort), static_cast(mTargetPort)); + targetNode->RemoveConnection(sourceNode, static_cast(m_sourcePort), static_cast(m_targetPort)); if (azrtti_istypeof(targetNode)) { @@ -558,13 +558,13 @@ namespace CommandSystem // save the transition information for undo EMotionFX::AnimGraphStateTransition* transition = stateMachine->GetTransition(transitionIndex.GetValue()); - mStartOffsetX = transition->GetVisualStartOffsetX(); - mStartOffsetY = transition->GetVisualStartOffsetY(); - mEndOffsetX = transition->GetVisualEndOffsetX(); - mEndOffsetY = transition->GetVisualEndOffsetY(); - mTransitionType = azrtti_typeid(transition); + m_startOffsetX = transition->GetVisualStartOffsetX(); + m_startOffsetY = transition->GetVisualStartOffsetY(); + m_endOffsetX = transition->GetVisualEndOffsetX(); + m_endOffsetY = transition->GetVisualEndOffsetY(); + m_transitionType = azrtti_typeid(transition); m_connectionId = transition->GetId(); - mOldContents = MCore::ReflectionSerializer::Serialize(transition).GetValue(); + m_oldContents = MCore::ReflectionSerializer::Serialize(transition).GetValue(); // remove all unique datas for the transition itself animGraph->RemoveAllObjectData(transition, true); @@ -574,7 +574,7 @@ namespace CommandSystem } // save the current dirty flag and tell the anim graph that something got changed - mOldDirtyFlag = animGraph->GetDirtyFlag(); + m_oldDirtyFlag = animGraph->GetDirtyFlag(); animGraph->SetDirtyFlag(true); if(parameters.GetValueAsBool("updateUniqueData", true)) @@ -591,34 +591,34 @@ namespace CommandSystem const AZStd::string updateUniqueData = parameters.GetValue("updateUniqueData", this); // get the anim graph - EMotionFX::AnimGraph* animGraph = EMotionFX::GetAnimGraphManager().FindAnimGraphByID(mAnimGraphID); + EMotionFX::AnimGraph* animGraph = EMotionFX::GetAnimGraphManager().FindAnimGraphByID(m_animGraphId); if (animGraph == nullptr) { - outResult = AZStd::string::format("The anim graph with id '%i' does not exist anymore.", mAnimGraphID); + outResult = AZStd::string::format("The anim graph with id '%i' does not exist anymore.", m_animGraphId); return false; } - if (!mTargetNodeId.IsValid()) + if (!m_targetNodeId.IsValid()) { return false; } AZStd::string commandString = AZStd::string::format("AnimGraphCreateConnection -animGraphID %i -sourceNode \"%s\" -targetNode \"%s\" -sourcePort %zu -targetPort %zu -startOffsetX %d -startOffsetY %d -endOffsetX %d -endOffsetY %d -id %s -transitionType \"%s\" -updateUniqueData %s", animGraph->GetID(), - mSourceNodeName.c_str(), - mTargetNodeName.c_str(), - mSourcePort, - mTargetPort, - mStartOffsetX, mStartOffsetY, - mEndOffsetX, mEndOffsetY, + m_sourceNodeName.c_str(), + m_targetNodeName.c_str(), + m_sourcePort, + m_targetPort, + m_startOffsetX, m_startOffsetY, + m_endOffsetX, m_endOffsetY, m_connectionId.ToString().c_str(), - mTransitionType.ToString().c_str(), + m_transitionType.ToString().c_str(), updateUniqueData.c_str()); // add the old attributes - if (mOldContents.empty() == false) + if (m_oldContents.empty() == false) { - commandString += AZStd::string::format(" -contents {%s}", mOldContents.c_str()); + commandString += AZStd::string::format(" -contents {%s}", m_oldContents.c_str()); } if (!GetCommandManager()->ExecuteCommandInsideCommand(commandString, outResult)) @@ -631,18 +631,18 @@ namespace CommandSystem return false; } - mTargetNodeId.SetInvalid(); - mSourceNodeId.SetInvalid(); + m_targetNodeId.SetInvalid(); + m_sourceNodeId.SetInvalid(); m_connectionId.SetInvalid(); - mSourcePort = InvalidIndex; - mTargetPort = InvalidIndex; - mStartOffsetX = 0; - mStartOffsetY = 0; - mEndOffsetX = 0; - mEndOffsetY = 0; + m_sourcePort = InvalidIndex; + m_targetPort = InvalidIndex; + m_startOffsetX = 0; + m_startOffsetY = 0; + m_endOffsetX = 0; + m_endOffsetY = 0; // set the dirty flag back to the old value - animGraph->SetDirtyFlag(mOldDirtyFlag); + animGraph->SetDirtyFlag(m_oldDirtyFlag); return true; } @@ -839,7 +839,7 @@ namespace CommandSystem } // save the current dirty flag and tell the anim graph that something got changed - mOldDirtyFlag = animGraph->GetDirtyFlag(); + m_oldDirtyFlag = animGraph->GetDirtyFlag(); animGraph->SetDirtyFlag(true); transition->Reinit(); @@ -865,14 +865,14 @@ namespace CommandSystem } AdjustTransition(transition, - /*mOldDisabledFlag=*/AZStd::nullopt, - /*sourceNodeName=*/AZStd::nullopt, /*targetNodeName=*/AZStd::nullopt, + /*isDisabled=*/AZStd::nullopt, + /*sourceNode=*/AZStd::nullopt, /*targetNode=*/AZStd::nullopt, /*startOffsetX=*/AZStd::nullopt, /*startOffsetY=*/AZStd::nullopt, /*endOffsetX=*/AZStd::nullopt, /*endOffsetY=*/AZStd::nullopt, /*attributesString=*/AZStd::nullopt, /*serializedMembers=*/m_oldSerializedMembers.GetValue(), /*commandGroup*/nullptr, /*executeInsideCommand*/true); - animGraph->SetDirtyFlag(mOldDirtyFlag); + animGraph->SetDirtyFlag(m_oldDirtyFlag); return true; } diff --git a/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/AnimGraphConnectionCommands.h b/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/AnimGraphConnectionCommands.h index d0ef5549e0..2f0a03a191 100644 --- a/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/AnimGraphConnectionCommands.h +++ b/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/AnimGraphConnectionCommands.h @@ -26,64 +26,64 @@ namespace CommandSystem { // create a connection MCORE_DEFINECOMMAND_START(CommandAnimGraphCreateConnection, "Connect two anim graph nodes", true) - uint32 mAnimGraphID; - EMotionFX::AnimGraphNodeId mTargetNodeId; - EMotionFX::AnimGraphNodeId mSourceNodeId; + uint32 m_animGraphId; + EMotionFX::AnimGraphNodeId m_targetNodeId; + EMotionFX::AnimGraphNodeId m_sourceNodeId; EMotionFX::AnimGraphConnectionId m_connectionId; - AZ::TypeId mTransitionType; - int32 mStartOffsetX; - int32 mStartOffsetY; - int32 mEndOffsetX; - int32 mEndOffsetY; - size_t mSourcePort; - size_t mTargetPort; - AZStd::string mSourcePortName; - AZStd::string mTargetPortName; - bool mOldDirtyFlag; - bool mUpdateParamFlag; + AZ::TypeId m_transitionType; + int32 m_startOffsetX; + int32 m_startOffsetY; + int32 m_endOffsetX; + int32 m_endOffsetY; + size_t m_sourcePort; + size_t m_targetPort; + AZStd::string m_sourcePortName; + AZStd::string m_targetPortName; + bool m_oldDirtyFlag; + bool m_updateParamFlag; public: EMotionFX::AnimGraphConnectionId GetConnectionId() const{ return m_connectionId; } - EMotionFX::AnimGraphNodeId GetTargetNodeId() const { return mTargetNodeId; } - EMotionFX::AnimGraphNodeId GetSourceNodeId() const { return mSourceNodeId; } - AZ::TypeId GetTransitionType() const { return mTransitionType; } - size_t GetSourcePort() const { return mSourcePort; } - size_t GetTargetPort() const { return mTargetPort; } - int32 GetStartOffsetX() const { return mStartOffsetX; } - int32 GetStartOffsetY() const { return mStartOffsetY; } - int32 GetEndOffsetX() const { return mEndOffsetX; } - int32 GetEndOffsetY() const { return mEndOffsetY; } + EMotionFX::AnimGraphNodeId GetTargetNodeId() const { return m_targetNodeId; } + EMotionFX::AnimGraphNodeId GetSourceNodeId() const { return m_sourceNodeId; } + AZ::TypeId GetTransitionType() const { return m_transitionType; } + size_t GetSourcePort() const { return m_sourcePort; } + size_t GetTargetPort() const { return m_targetPort; } + int32 GetStartOffsetX() const { return m_startOffsetX; } + int32 GetStartOffsetY() const { return m_startOffsetY; } + int32 GetEndOffsetX() const { return m_endOffsetX; } + int32 GetEndOffsetY() const { return m_endOffsetY; } MCORE_DEFINECOMMAND_END // remove a connection MCORE_DEFINECOMMAND_START(CommandAnimGraphRemoveConnection, "Remove a anim graph connection", true) - uint32 mAnimGraphID; - EMotionFX::AnimGraphNodeId mTargetNodeId; - AZStd::string mTargetNodeName; - EMotionFX::AnimGraphNodeId mSourceNodeId; - AZStd::string mSourceNodeName; + uint32 m_animGraphId; + EMotionFX::AnimGraphNodeId m_targetNodeId; + AZStd::string m_targetNodeName; + EMotionFX::AnimGraphNodeId m_sourceNodeId; + AZStd::string m_sourceNodeName; EMotionFX::AnimGraphConnectionId m_connectionId; - AZ::TypeId mTransitionType; - int32 mStartOffsetX; - int32 mStartOffsetY; - int32 mEndOffsetX; - int32 mEndOffsetY; - size_t mSourcePort; - size_t mTargetPort; - bool mOldDirtyFlag; - AZStd::string mOldContents; + AZ::TypeId m_transitionType; + int32 m_startOffsetX; + int32 m_startOffsetY; + int32 m_endOffsetX; + int32 m_endOffsetY; + size_t m_sourcePort; + size_t m_targetPort; + bool m_oldDirtyFlag; + AZStd::string m_oldContents; public: - EMotionFX::AnimGraphNodeId GetTargetNodeID() const { return mTargetNodeId; } - EMotionFX::AnimGraphNodeId GetSourceNodeID() const { return mSourceNodeId; } - AZ::TypeId GetTransitionType() const { return mTransitionType; } - size_t GetSourcePort() const { return mSourcePort; } - size_t GetTargetPort() const { return mTargetPort; } - int32 GetStartOffsetX() const { return mStartOffsetX; } - int32 GetStartOffsetY() const { return mStartOffsetY; } - int32 GetEndOffsetX() const { return mEndOffsetX; } - int32 GetEndOffsetY() const { return mEndOffsetY; } + EMotionFX::AnimGraphNodeId GetTargetNodeID() const { return m_targetNodeId; } + EMotionFX::AnimGraphNodeId GetSourceNodeID() const { return m_sourceNodeId; } + AZ::TypeId GetTransitionType() const { return m_transitionType; } + size_t GetSourcePort() const { return m_sourcePort; } + size_t GetTargetPort() const { return m_targetPort; } + int32 GetStartOffsetX() const { return m_startOffsetX; } + int32 GetStartOffsetY() const { return m_startOffsetY; } + int32 GetEndOffsetX() const { return m_endOffsetX; } + int32 GetEndOffsetY() const { return m_endOffsetY; } EMotionFX::AnimGraphConnectionId GetConnectionId() const{ return m_connectionId; } MCORE_DEFINECOMMAND_END @@ -127,7 +127,7 @@ namespace CommandSystem private: AZ::Outcome m_oldSerializedMembers; // Without actions and conditions. - bool mOldDirtyFlag = false; + bool m_oldDirtyFlag = false; }; ////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/AnimGraphGroupParameterCommands.cpp b/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/AnimGraphGroupParameterCommands.cpp index a349059799..9131706b69 100644 --- a/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/AnimGraphGroupParameterCommands.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/AnimGraphGroupParameterCommands.cpp @@ -54,7 +54,7 @@ namespace CommandSystem { // Get the parameter name. const AZStd::string& name = parameters.GetValue("name", this); - mOldName = name; + m_oldName = name; // Find the anim graph by using the id from command parameter. const uint32 animGraphID = parameters.GetValueAsInt("animGraphID", this); @@ -108,7 +108,7 @@ namespace CommandSystem } const size_t numParameters = parameterNames.size(); - mOldGroupParameterNames.resize(numParameters); + m_oldGroupParameterNames.resize(numParameters); EMotionFX::ValueParameterVector valueParametersBeforeChange = animGraph->RecursivelyGetValueParameters(); @@ -118,13 +118,13 @@ namespace CommandSystem const EMotionFX::Parameter* parameter = animGraph->FindParameterByName(parameterNames[i]); if (!parameter) { - mOldGroupParameterNames[i].clear(); + m_oldGroupParameterNames[i].clear(); continue; } // Save the group parameter (for undo) to which the parameter belonged before command execution. const EMotionFX::GroupParameter* parentParameter = animGraph->FindParentGroupParameter(parameter); - mOldGroupParameterNames[i] = parentParameter ? parentParameter->GetName() : ""; + m_oldGroupParameterNames[i] = parentParameter ? parentParameter->GetName() : ""; // Make sure the parameter is not in any other group. animGraph->TakeParameterFromParent(parameter); @@ -175,7 +175,7 @@ namespace CommandSystem } // save the current dirty flag and tell the anim graph that something got changed - mOldDirtyFlag = animGraph->GetDirtyFlag(); + m_oldDirtyFlag = animGraph->GetDirtyFlag(); animGraph->SetDirtyFlag(true); animGraph->RecursiveInvalidateUniqueDatas(); @@ -196,13 +196,13 @@ namespace CommandSystem MCore::CommandGroup commandGroup; - // Undo the group name as first step. All commands afterwards have to use mOldName as group name. + // Undo the group name as first step. All commands afterwards have to use m_oldName as group name. if (parameters.CheckIfHasParameter("newName")) { const AZStd::string& newName = parameters.GetValue("newName", this); const AZStd::string command = AZStd::string::format("AnimGraphAdjustGroupParameter -animGraphID %i -name \"%s\" -newName \"%s\"", - animGraph->GetID(), newName.c_str(), mOldName.c_str()); + animGraph->GetID(), newName.c_str(), m_oldName.c_str()); commandGroup.AddCommandString(command); } @@ -210,7 +210,7 @@ namespace CommandSystem if (parameters.CheckIfHasParameter("description")) { const AZStd::string command = AZStd::string::format("AnimGraphAdjustGroupParameter -animGraphID %i -name \"%s\" -description \"%s\"", - animGraph->GetID(), mOldName.c_str(), m_oldDescription.c_str()); + animGraph->GetID(), m_oldName.c_str(), m_oldDescription.c_str()); commandGroup.AddCommandString(command); } @@ -225,12 +225,12 @@ namespace CommandSystem AzFramework::StringFunc::Tokenize(parametersString.c_str(), parameterNames, ";", false, true); const size_t parameterCount = parameterNames.size(); - AZ_Assert(parameterCount == mOldGroupParameterNames.size(), "The number of parameter names has to match the saved group parameter info for undo."); + AZ_Assert(parameterCount == m_oldGroupParameterNames.size(), "The number of parameter names has to match the saved group parameter info for undo."); for (size_t i = 0; i < parameterCount; ++i) { const AZStd::string& parameterName = parameterNames[i]; - const AZStd::string& oldGroupName = mOldGroupParameterNames[i]; + const AZStd::string& oldGroupName = m_oldGroupParameterNames[i]; switch (action) { @@ -240,7 +240,7 @@ namespace CommandSystem { // An empty old group name means that the parameter was in the Default group before, so in this case just remove the parameter from the group. const AZStd::string command = AZStd::string::format("AnimGraphAdjustGroupParameter -animGraphID %i -name \"%s\" -action \"remove\" -parameterNames \"%s\"", - animGraph->GetID(), mOldName.c_str(), parameterName.c_str()); + animGraph->GetID(), m_oldName.c_str(), parameterName.c_str()); commandGroup.AddCommandString(command); } @@ -277,7 +277,7 @@ namespace CommandSystem } // Set the dirty flag back to the old value. - animGraph->SetDirtyFlag(mOldDirtyFlag); + animGraph->SetDirtyFlag(m_oldDirtyFlag); return true; } @@ -364,8 +364,8 @@ namespace CommandSystem } // save the current dirty flag and tell the anim graph that something got changed - mOldDirtyFlag = animGraph->GetDirtyFlag(); - mOldName = groupParameter->GetName(); + m_oldDirtyFlag = animGraph->GetDirtyFlag(); + m_oldName = groupParameter->GetName(); animGraph->SetDirtyFlag(true); animGraph->RecursiveInvalidateUniqueDatas(); @@ -385,7 +385,7 @@ namespace CommandSystem } // Construct and execute the command. - const AZStd::string command = AZStd::string::format("AnimGraphRemoveGroupParameter -animGraphID %i -name \"%s\"", animGraphID, mOldName.c_str()); + const AZStd::string command = AZStd::string::format("AnimGraphRemoveGroupParameter -animGraphID %i -name \"%s\"", animGraphID, m_oldName.c_str()); AZStd::string result; if (!GetCommandManager()->ExecuteCommandInsideCommand(command, result)) @@ -394,7 +394,7 @@ namespace CommandSystem } // Set the dirty flag back to the old value. - animGraph->SetDirtyFlag(mOldDirtyFlag); + animGraph->SetDirtyFlag(m_oldDirtyFlag); return true; } @@ -457,23 +457,23 @@ namespace CommandSystem } // read out information for the command undo - mOldName = parameter->GetName(); + m_oldName = parameter->GetName(); const EMotionFX::GroupParameter* parentGroup = animGraph->FindParentGroupParameter(parameter); if (parentGroup) { - mOldParent = parentGroup->GetName(); - mOldIndex = parentGroup->FindParameterIndex(parameter).GetValue(); + m_oldParent = parentGroup->GetName(); + m_oldIndex = parentGroup->FindParameterIndex(parameter).GetValue(); } else { - mOldParent = ""; - mOldIndex = animGraph->FindParameterIndex(parameter).GetValue(); + m_oldParent = ""; + m_oldIndex = animGraph->FindParameterIndex(parameter).GetValue(); } - mOldParameterNames.clear(); + m_oldParameterNames.clear(); // Collect all child parameters and move them to the default group. Keep the child hierarchy as it is. - // Add the immediate child ones to mOldParameterNames so they get moved back on undo + // Add the immediate child ones to m_oldParameterNames so they get moved back on undo const EMotionFX::GroupParameter* groupParameter = static_cast(parameter); const EMotionFX::ParameterVector childParameters = groupParameter->RecursivelyGetChildParameters(); AZStd::vector childParents; @@ -497,7 +497,7 @@ namespace CommandSystem const EMotionFX::GroupParameter* parent = childParents[i]; if (parent == groupParameter) { - mOldParameterNames += childParameters[i]->GetName() + ";"; + m_oldParameterNames += childParameters[i]->GetName() + ";"; animGraph->AddParameter(childParameters[i]); // add to default group } else @@ -505,9 +505,9 @@ namespace CommandSystem animGraph->AddParameter(childParameters[i], parent); // add to default group } } - if (!mOldParameterNames.empty()) + if (!m_oldParameterNames.empty()) { - mOldParameterNames.pop_back(); // remove trailing ";" + m_oldParameterNames.pop_back(); // remove trailing ";" } // remove the group parameter @@ -529,7 +529,7 @@ namespace CommandSystem } // save the current dirty flag and tell the anim graph that something got changed - mOldDirtyFlag = animGraph->GetDirtyFlag(); + m_oldDirtyFlag = animGraph->GetDirtyFlag(); animGraph->SetDirtyFlag(true); animGraph->RecursiveInvalidateUniqueDatas(); @@ -555,18 +555,18 @@ namespace CommandSystem command = AZStd::string::format("AnimGraphAddGroupParameter -animGraphID %i -name \"%s\" -index %zu -parent \"%s\" -updateUI %s", animGraph->GetID(), - mOldName.c_str(), - mOldIndex, - mOldParent.c_str(), + m_oldName.c_str(), + m_oldIndex, + m_oldParent.c_str(), updateWindow.c_str()); commandGroup.AddCommandString(command); - if (!mOldParameterNames.empty()) + if (!m_oldParameterNames.empty()) { command = AZStd::string::format("AnimGraphAdjustGroupParameter -animGraphID %i -name \"%s\" -parameterNames \"%s\" -action \"add\" -updateUI %s", animGraph->GetID(), - mOldName.c_str(), - mOldParameterNames.c_str(), + m_oldName.c_str(), + m_oldParameterNames.c_str(), updateWindow.c_str()); commandGroup.AddCommandString(command); } @@ -579,7 +579,7 @@ namespace CommandSystem } // Set the dirty flag back to the old value. - animGraph->SetDirtyFlag(mOldDirtyFlag); + animGraph->SetDirtyFlag(m_oldDirtyFlag); return true; } diff --git a/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/AnimGraphGroupParameterCommands.h b/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/AnimGraphGroupParameterCommands.h index 80e43818c7..3bdc7f3e0e 100644 --- a/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/AnimGraphGroupParameterCommands.h +++ b/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/AnimGraphGroupParameterCommands.h @@ -27,25 +27,25 @@ namespace CommandSystem }; Action GetAction(const MCore::CommandLine& parameters); - AZStd::string mOldName; //! group parameter name before command execution. - AZStd::vector mOldGroupParameterNames; - bool mOldDirtyFlag; + AZStd::string m_oldName; //! group parameter name before command execution. + AZStd::vector m_oldGroupParameterNames; + bool m_oldDirtyFlag; AZStd::string m_oldDescription; MCORE_DEFINECOMMAND_END // Add a group parameter. MCORE_DEFINECOMMAND_START(CommandAnimGraphAddGroupParameter, "Add anim graph group parameter", true) - bool mOldDirtyFlag; - AZStd::string mOldName; + bool m_oldDirtyFlag; + AZStd::string m_oldName; MCORE_DEFINECOMMAND_END // Remove a group parameter. MCORE_DEFINECOMMAND_START(CommandAnimGraphRemoveGroupParameter, "Remove anim graph group parameter", true) - AZStd::string mOldName; - AZStd::string mOldParameterNames; - AZStd::string mOldParent; - size_t mOldIndex; - bool mOldDirtyFlag; + AZStd::string m_oldName; + AZStd::string m_oldParameterNames; + AZStd::string m_oldParent; + size_t m_oldIndex; + bool m_oldDirtyFlag; MCORE_DEFINECOMMAND_END // helper functions diff --git a/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/AnimGraphNodeCommands.cpp b/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/AnimGraphNodeCommands.cpp index 6142fe151e..d81d495a4d 100644 --- a/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/AnimGraphNodeCommands.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/AnimGraphNodeCommands.cpp @@ -113,7 +113,7 @@ namespace CommandSystem return EMotionFX::AnimGraphNodeId::CreateFromString(nodeIdString); } - return mNodeId; + return m_nodeId; } void CommandAnimGraphCreateNode::DeleteGraphNode(EMotionFX::AnimGraphNode* node) @@ -142,7 +142,7 @@ namespace CommandSystem } // store the anim graph id for undo - mAnimGraphID = animGraph->GetID(); + m_animGraphId = animGraph->GetID(); // find the graph EMotionFX::AnimGraphNode* parentNode = nullptr; @@ -204,7 +204,7 @@ namespace CommandSystem EMotionFX::AnimGraphNode* node = static_cast(object); // store the node id for the callbacks - mNodeId = node->GetId(); + m_nodeId = node->GetId(); if (parameters.CheckIfHasParameter("contents")) { @@ -213,7 +213,7 @@ namespace CommandSystem MCore::ReflectionSerializer::DeserializeMembers(node, contents); // The deserialize method will deserialize back the old id - node->SetId(mNodeId); + node->SetId(m_nodeId); // Verify we have not serialized connections, child nodes and transitions AZ_Assert(node->GetNumConnections() == 0, "Unexpected serialized connections"); @@ -232,7 +232,7 @@ namespace CommandSystem const EMotionFX::AnimGraphNodeId nodeId = EMotionFX::AnimGraphNodeId::CreateFromString(nodeIdString); node->SetId(nodeId); - mNodeId = nodeId; + m_nodeId = nodeId; } // if the name is not empty, set it @@ -317,7 +317,7 @@ namespace CommandSystem node->SetIsCollapsed(collapsed); // store the anim graph id for undo - mAnimGraphID = animGraph->GetID(); + m_animGraphId = animGraph->GetID(); // check if the parent is valid if (parentNode) @@ -357,7 +357,7 @@ namespace CommandSystem } // save the current dirty flag and tell the anim graph that something got changed - mOldDirtyFlag = animGraph->GetDirtyFlag(); + m_oldDirtyFlag = animGraph->GetDirtyFlag(); animGraph->SetDirtyFlag(true); // return the node name @@ -397,21 +397,21 @@ namespace CommandSystem MCORE_UNUSED(parameters); // get the anim graph - EMotionFX::AnimGraph* animGraph = EMotionFX::GetAnimGraphManager().FindAnimGraphByID(mAnimGraphID); + EMotionFX::AnimGraph* animGraph = EMotionFX::GetAnimGraphManager().FindAnimGraphByID(m_animGraphId); if (animGraph == nullptr) { - outResult = AZStd::string::format("The anim graph with id '%i' does not exist anymore.", mAnimGraphID); + outResult = AZStd::string::format("The anim graph with id '%i' does not exist anymore.", m_animGraphId); return false; } // locate the node - EMotionFX::AnimGraphNode* node = animGraph->RecursiveFindNodeById(mNodeId); + EMotionFX::AnimGraphNode* node = animGraph->RecursiveFindNodeById(m_nodeId); if (node == nullptr) { return false; } - mNodeId.SetInvalid(); + m_nodeId.SetInvalid(); const AZStd::string commandString = AZStd::string::format("AnimGraphRemoveNode -animGraphID %i -name \"%s\"", animGraph->GetID(), node->GetName()); if (GetCommandManager()->ExecuteCommandInsideCommand(commandString, outResult) == false) @@ -424,7 +424,7 @@ namespace CommandSystem } // set the dirty flag back to the old value - animGraph->SetDirtyFlag(mOldDirtyFlag); + animGraph->SetDirtyFlag(m_oldDirtyFlag); return true; } @@ -463,8 +463,8 @@ namespace CommandSystem CommandAnimGraphAdjustNode::CommandAnimGraphAdjustNode(MCore::Command* orgCommand) : MCore::Command("AnimGraphAdjustNode", orgCommand) { - mOldPosX = 0; - mOldPosY = 0; + m_oldPosX = 0; + m_oldPosY = 0; } // destructor @@ -483,7 +483,7 @@ namespace CommandSystem } // store the anim graph id for undo - mAnimGraphID = animGraph->GetID(); + m_animGraphId = animGraph->GetID(); // get the name of the node AZStd::string name; @@ -506,8 +506,8 @@ namespace CommandSystem // get the x and y pos int32 xPos = node->GetVisualPosX(); int32 yPos = node->GetVisualPosY(); - mOldPosX = xPos; - mOldPosY = yPos; + m_oldPosX = xPos; + m_oldPosY = yPos; // get the new position values if (parameters.CheckIfHasParameter("xPos")) @@ -529,17 +529,17 @@ namespace CommandSystem { // find the node group the node was in before the name change EMotionFX::AnimGraphNodeGroup* nodeGroup = animGraph->FindNodeGroupForNode(node); - mNodeGroupName.clear(); + m_nodeGroupName.clear(); if (nodeGroup) { // remember the node group name for undo - mNodeGroupName = nodeGroup->GetName(); + m_nodeGroupName = nodeGroup->GetName(); // remove the node from the node group as its id is going to change nodeGroup->RemoveNodeById(node->GetId()); } - mOldName = node->GetName(); + m_oldName = node->GetName(); node->SetName(newName.c_str()); // as the id of the node changed after renaming it, we have to readd the node with the new id @@ -549,27 +549,27 @@ namespace CommandSystem } // call the post rename node event - EMotionFX::GetEventManager().OnRenamedNode(animGraph, node, mOldName.c_str()); + EMotionFX::GetEventManager().OnRenamedNode(animGraph, node, m_oldName.c_str()); } // remember and set the new value to the enabled flag - mOldEnabled = node->GetIsEnabled(); + m_oldEnabled = node->GetIsEnabled(); if (parameters.CheckIfHasParameter("enabled")) { node->SetIsEnabled(parameters.GetValueAsBool("enabled", this)); } // remember and set the new value to the visualization flag - mOldVisualized = node->GetIsVisualizationEnabled(); + m_oldVisualized = node->GetIsVisualizationEnabled(); if (parameters.CheckIfHasParameter("visualize")) { node->SetVisualization(parameters.GetValueAsBool("visualize", this)); } - mNodeId = node->GetId(); + m_nodeId = node->GetId(); // save the current dirty flag and tell the anim graph that something got changed - mOldDirtyFlag = animGraph->GetDirtyFlag(); + m_oldDirtyFlag = animGraph->GetDirtyFlag(); animGraph->SetDirtyFlag(true); // only update attributes in case it is wanted @@ -586,22 +586,22 @@ namespace CommandSystem bool CommandAnimGraphAdjustNode::Undo(const MCore::CommandLine& parameters, AZStd::string& outResult) { // get the anim graph - EMotionFX::AnimGraph* animGraph = EMotionFX::GetAnimGraphManager().FindAnimGraphByID(mAnimGraphID); + EMotionFX::AnimGraph* animGraph = EMotionFX::GetAnimGraphManager().FindAnimGraphByID(m_animGraphId); if (animGraph == nullptr) { - outResult = AZStd::string::format("The anim graph with id '%i' does not exist anymore.", mAnimGraphID); + outResult = AZStd::string::format("The anim graph with id '%i' does not exist anymore.", m_animGraphId); return false; } - EMotionFX::AnimGraphNode* node = animGraph->RecursiveFindNodeById(mNodeId); + EMotionFX::AnimGraphNode* node = animGraph->RecursiveFindNodeById(m_nodeId); if (node == nullptr) { - outResult = AZStd::string::format("Cannot find node with ID %s.", mNodeId.ToString().c_str()); + outResult = AZStd::string::format("Cannot find node with ID %s.", m_nodeId.ToString().c_str()); return false; } // restore the name - if (!mOldName.empty()) + if (!m_oldName.empty()) { AZStd::string currentName = node->GetName(); @@ -614,7 +614,7 @@ namespace CommandSystem nodeGroup->RemoveNodeById(node->GetId()); } - node->SetName(mOldName.c_str()); + node->SetName(m_oldName.c_str()); // as the id of the node changed after renaming it, we have to readd the node with the new id if (nodeGroup) @@ -626,12 +626,12 @@ namespace CommandSystem EMotionFX::GetEventManager().OnRenamedNode(animGraph, node, node->GetName()); } - mNodeId = node->GetId(); - node->SetVisualPos(mOldPosX, mOldPosY); + m_nodeId = node->GetId(); + node->SetVisualPos(m_oldPosX, m_oldPosY); // set the old values to the enabled flag and the visualization flag - node->SetIsEnabled(mOldEnabled); - node->SetVisualization(mOldVisualized); + node->SetIsEnabled(m_oldEnabled); + node->SetVisualization(m_oldVisualized); // do only for parameter nodes if (azrtti_typeid(node) == azrtti_typeid() && parameters.CheckIfHasParameter("parameterMask")) @@ -640,11 +640,11 @@ namespace CommandSystem EMotionFX::BlendTreeParameterNode* parameterNode = static_cast(node); // get the parameter mask attribute and update the mask - parameterNode->SetParameters(mOldParameterMask); + parameterNode->SetParameters(m_oldParameterMask); } // set the dirty flag back to the old value - animGraph->SetDirtyFlag(mOldDirtyFlag); + animGraph->SetDirtyFlag(m_oldDirtyFlag); node->Reinit(); animGraph->RecursiveInvalidateUniqueDatas(); @@ -681,7 +681,7 @@ namespace CommandSystem CommandAnimGraphRemoveNode::CommandAnimGraphRemoveNode(MCore::Command* orgCommand) : MCore::Command("AnimGraphRemoveNode", orgCommand) { - mIsEntryNode = false; + m_isEntryNode = false; } // destructor @@ -700,7 +700,7 @@ namespace CommandSystem } // store the anim graph id for undo - mAnimGraphID = animGraph->GetID(); + m_animGraphId = animGraph->GetID(); // find the emfx node AZStd::string name; @@ -712,20 +712,20 @@ namespace CommandSystem return false; } - mType = azrtti_typeid(emfxNode); - mName = emfxNode->GetName(); - mPosX = emfxNode->GetVisualPosX(); - mPosY = emfxNode->GetVisualPosY(); - mCollapsed = emfxNode->GetIsCollapsed(); - mOldContents = MCore::ReflectionSerializer::SerializeMembersExcept(emfxNode, { "childNodes", "connections", "transitions" }).GetValue(); - mNodeId = emfxNode->GetId(); + m_type = azrtti_typeid(emfxNode); + m_name = emfxNode->GetName(); + m_posX = emfxNode->GetVisualPosX(); + m_posY = emfxNode->GetVisualPosY(); + m_collapsed = emfxNode->GetIsCollapsed(); + m_oldContents = MCore::ReflectionSerializer::SerializeMembersExcept(emfxNode, { "childNodes", "connections", "transitions" }).GetValue(); + m_nodeId = emfxNode->GetId(); // remember the node group for the node for undo - mNodeGroupName.clear(); + m_nodeGroupName.clear(); EMotionFX::AnimGraphNodeGroup* nodeGroup = animGraph->FindNodeGroupForNode(emfxNode); if (nodeGroup) { - mNodeGroupName = nodeGroup->GetName(); + m_nodeGroupName = nodeGroup->GetName(); } // get the parent node @@ -737,7 +737,7 @@ namespace CommandSystem EMotionFX::AnimGraphStateMachine* stateMachine = static_cast(parentNode); if (stateMachine->GetEntryState() == emfxNode) { - mIsEntryNode = true; + m_isEntryNode = true; // Find a new entry node if we can //-------------------------- @@ -766,8 +766,8 @@ namespace CommandSystem } } - mParentName = parentNode->GetName(); - mParentNodeId = parentNode->GetId(); + m_parentName = parentNode->GetName(); + m_parentNodeId = parentNode->GetId(); // call the pre remove node event EMotionFX::GetEventManager().OnRemoveNode(animGraph, emfxNode); @@ -780,15 +780,15 @@ namespace CommandSystem } else { - mParentNodeId.SetInvalid(); - mParentName.clear(); + m_parentNodeId.SetInvalid(); + m_parentName.clear(); MCore::LogError("Cannot remove root state machine."); MCORE_ASSERT(false); return false; } // save the current dirty flag and tell the anim graph that something got changed - mOldDirtyFlag = animGraph->GetDirtyFlag(); + m_oldDirtyFlag = animGraph->GetDirtyFlag(); animGraph->SetDirtyFlag(true); animGraph->RecursiveInvalidateUniqueDatas(); @@ -801,34 +801,34 @@ namespace CommandSystem { MCORE_UNUSED(parameters); - EMotionFX::AnimGraph* animGraph = EMotionFX::GetAnimGraphManager().FindAnimGraphByID(mAnimGraphID); + EMotionFX::AnimGraph* animGraph = EMotionFX::GetAnimGraphManager().FindAnimGraphByID(m_animGraphId); if (!animGraph) { - outResult = AZStd::string::format("The anim graph with id '%i' does not exist anymore.", mAnimGraphID); + outResult = AZStd::string::format("The anim graph with id '%i' does not exist anymore.", m_animGraphId); return false; } // create the node again MCore::CommandGroup group("Recreating node"); AZStd::string commandString; - if (!mParentName.empty()) + if (!m_parentName.empty()) { commandString = AZStd::string::format("AnimGraphCreateNode -animGraphID %i -type \"%s\" -parentName \"%s\" -name \"%s\" -nodeId \"%s\" -xPos %d -yPos %d -collapsed %s -center false -contents {%s}", animGraph->GetID(), - mType.ToString().c_str(), - mParentName.c_str(), - mName.c_str(), - mNodeId.ToString().c_str(), - mPosX, - mPosY, - AZStd::to_string(mCollapsed).c_str(), - mOldContents.c_str()); + m_type.ToString().c_str(), + m_parentName.c_str(), + m_name.c_str(), + m_nodeId.ToString().c_str(), + m_posX, + m_posY, + AZStd::to_string(m_collapsed).c_str(), + m_oldContents.c_str()); group.AddCommandString(commandString); - if (mIsEntryNode) + if (m_isEntryNode) { - commandString = AZStd::string::format("AnimGraphSetEntryState -animGraphID %i -entryNodeName \"%s\"", animGraph->GetID(), mName.c_str()); + commandString = AZStd::string::format("AnimGraphSetEntryState -animGraphID %i -entryNodeName \"%s\"", animGraph->GetID(), m_name.c_str()); group.AddCommandString(commandString); } } @@ -836,13 +836,13 @@ namespace CommandSystem { commandString = AZStd::string::format("AnimGraphCreateNode -animGraphID %i -type \"%s\" -name \"%s\" -nodeId \"%s\" -xPos %d -yPos %d -collapsed %s -center false -contents {%s}", animGraph->GetID(), - mType.ToString().c_str(), - mName.c_str(), - mNodeId.ToString().c_str(), - mPosX, - mPosY, - AZStd::to_string(mCollapsed).c_str(), - mOldContents.c_str()); + m_type.ToString().c_str(), + m_name.c_str(), + m_nodeId.ToString().c_str(), + m_posX, + m_posY, + AZStd::to_string(m_collapsed).c_str(), + m_oldContents.c_str()); group.AddCommandString(commandString); } @@ -857,15 +857,15 @@ namespace CommandSystem } // add it to the old node group if it was assigned to one before - if (!mNodeGroupName.empty()) + if (!m_nodeGroupName.empty()) { auto* command = aznew CommandSystem::CommandAnimGraphAdjustNodeGroup( GetCommandManager()->FindCommand(CommandSystem::CommandAnimGraphAdjustNodeGroup::s_commandName), /*animGraphId = */ animGraph->GetID(), - /*name = */ mNodeGroupName, + /*name = */ m_nodeGroupName, /*visible = */ AZStd::nullopt, /*newName = */ AZStd::nullopt, - /*nodeNames = */ {{mName}}, + /*nodeNames = */ {{m_name}}, /*nodeAction = */ CommandSystem::CommandAnimGraphAdjustNodeGroup::NodeAction::Add ); if (GetCommandManager()->ExecuteCommandInsideCommand(command, outResult) == false) @@ -880,7 +880,7 @@ namespace CommandSystem } // set the dirty flag back to the old value - animGraph->SetDirtyFlag(mOldDirtyFlag); + animGraph->SetDirtyFlag(m_oldDirtyFlag); return true; } @@ -925,7 +925,7 @@ namespace CommandSystem } // store the anim graph id for undo - mAnimGraphID = animGraph->GetID(); + m_animGraphId = animGraph->GetID(); AZStd::string entryNodeName; parameters.GetValue("entryNodeName", this, entryNodeName); @@ -960,21 +960,21 @@ namespace CommandSystem EMotionFX::AnimGraphNode* oldEntryNode = stateMachine->GetEntryState(); if (oldEntryNode) { - mOldEntryStateNodeId = oldEntryNode->GetId(); + m_oldEntryStateNodeId = oldEntryNode->GetId(); } else { - mOldEntryStateNodeId.SetInvalid(); + m_oldEntryStateNodeId.SetInvalid(); } // store the id of the state machine - mOldStateMachineNodeId = stateMachineNode->GetId(); + m_oldStateMachineNodeId = stateMachineNode->GetId(); // set the new entry state for the state machine stateMachine->SetEntryState(entryNode); // save the current dirty flag and tell the anim graph that something got changed - mOldDirtyFlag = animGraph->GetDirtyFlag(); + m_oldDirtyFlag = animGraph->GetDirtyFlag(); animGraph->SetDirtyFlag(true); stateMachine->Reinit(); @@ -989,15 +989,15 @@ namespace CommandSystem MCORE_UNUSED(parameters); // get the anim graph - EMotionFX::AnimGraph* animGraph = EMotionFX::GetAnimGraphManager().FindAnimGraphByID(mAnimGraphID); + EMotionFX::AnimGraph* animGraph = EMotionFX::GetAnimGraphManager().FindAnimGraphByID(m_animGraphId); if (animGraph == nullptr) { - outResult = AZStd::string::format("The anim graph with id '%i' does not exist anymore.", mAnimGraphID); + outResult = AZStd::string::format("The anim graph with id '%i' does not exist anymore.", m_animGraphId); return false; } // get the state machine - EMotionFX::AnimGraphNode* stateMachineNode = animGraph->RecursiveFindNodeById(mOldStateMachineNodeId); + EMotionFX::AnimGraphNode* stateMachineNode = animGraph->RecursiveFindNodeById(m_oldStateMachineNodeId); if (stateMachineNode == nullptr || azrtti_typeid(stateMachineNode) != azrtti_typeid()) { outResult = "Cannot undo set entry node. Parent node is not a state machine or not valid at all."; @@ -1008,9 +1008,9 @@ namespace CommandSystem EMotionFX::AnimGraphStateMachine* stateMachine = (EMotionFX::AnimGraphStateMachine*)stateMachineNode; // find the entry anim graph node - if (mOldEntryStateNodeId.IsValid()) + if (m_oldEntryStateNodeId.IsValid()) { - EMotionFX::AnimGraphNode* entryNode = animGraph->RecursiveFindNodeById(mOldEntryStateNodeId); + EMotionFX::AnimGraphNode* entryNode = animGraph->RecursiveFindNodeById(m_oldEntryStateNodeId); if (!entryNode) { outResult = "Cannot undo set entry node. Old entry node cannot be found."; @@ -1027,7 +1027,7 @@ namespace CommandSystem } // set the dirty flag back to the old value - animGraph->SetDirtyFlag(mOldDirtyFlag); + animGraph->SetDirtyFlag(m_oldDirtyFlag); stateMachine->Reinit(); animGraph->RecursiveInvalidateUniqueDatas(); diff --git a/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/AnimGraphNodeCommands.h b/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/AnimGraphNodeCommands.h index 6a5a991809..4d02d55921 100644 --- a/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/AnimGraphNodeCommands.h +++ b/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/AnimGraphNodeCommands.h @@ -25,60 +25,60 @@ public: EMotionFX::AnimGraphNodeId GetNodeId(const MCore::CommandLine& parameters); void DeleteGraphNode(EMotionFX::AnimGraphNode* node); - uint32 mAnimGraphID; - bool mOldDirtyFlag; - EMotionFX::AnimGraphNodeId mNodeId; + uint32 m_animGraphId; + bool m_oldDirtyFlag; + EMotionFX::AnimGraphNodeId m_nodeId; MCORE_DEFINECOMMAND_END // adjust a node MCORE_DEFINECOMMAND_START(CommandAnimGraphAdjustNode, "Adjust a anim graph node", true) - EMotionFX::AnimGraphNodeId mNodeId; - int32 mOldPosX; - int32 mOldPosY; - AZStd::string mOldName; - AZStd::string mOldParameterMask; - bool mOldDirtyFlag; - bool mOldEnabled; - bool mOldVisualized; - AZStd::string mNodeGroupName; + EMotionFX::AnimGraphNodeId m_nodeId; + int32 m_oldPosX; + int32 m_oldPosY; + AZStd::string m_oldName; + AZStd::string m_oldParameterMask; + bool m_oldDirtyFlag; + bool m_oldEnabled; + bool m_oldVisualized; + AZStd::string m_nodeGroupName; public: - EMotionFX::AnimGraphNodeId GetNodeId() const { return mNodeId; } - const AZStd::string& GetOldName() const { return mOldName; } - uint32 mAnimGraphID; + EMotionFX::AnimGraphNodeId GetNodeId() const { return m_nodeId; } + const AZStd::string& GetOldName() const { return m_oldName; } + uint32 m_animGraphId; MCORE_DEFINECOMMAND_END // remove a node MCORE_DEFINECOMMAND_START(CommandAnimGraphRemoveNode, "Remove a anim graph node", true) - EMotionFX::AnimGraphNodeId mNodeId; - uint32 mAnimGraphID; - EMotionFX::AnimGraphNodeId mParentNodeId; - AZ::TypeId mType; - AZStd::string mParentName; - AZStd::string mName; - AZStd::string mNodeGroupName; - int32 mPosX; - int32 mPosY; - AZStd::string mOldContents; - bool mCollapsed; - bool mOldDirtyFlag; - bool mIsEntryNode; + EMotionFX::AnimGraphNodeId m_nodeId; + uint32 m_animGraphId; + EMotionFX::AnimGraphNodeId m_parentNodeId; + AZ::TypeId m_type; + AZStd::string m_parentName; + AZStd::string m_name; + AZStd::string m_nodeGroupName; + int32 m_posX; + int32 m_posY; + AZStd::string m_oldContents; + bool m_collapsed; + bool m_oldDirtyFlag; + bool m_isEntryNode; public: - EMotionFX::AnimGraphNodeId GetNodeId() const { return mNodeId; } - EMotionFX::AnimGraphNodeId GetParentNodeId() const { return mParentNodeId; } + EMotionFX::AnimGraphNodeId GetNodeId() const { return m_nodeId; } + EMotionFX::AnimGraphNodeId GetParentNodeId() const { return m_parentNodeId; } MCORE_DEFINECOMMAND_END // set the entry state of a state machine MCORE_DEFINECOMMAND_START(CommandAnimGraphSetEntryState, "Set entry state", true) public: - uint32 mAnimGraphID; - EMotionFX::AnimGraphNodeId mOldEntryStateNodeId; - EMotionFX::AnimGraphNodeId mOldStateMachineNodeId; - bool mOldDirtyFlag; + uint32 m_animGraphId; + EMotionFX::AnimGraphNodeId m_oldEntryStateNodeId; + EMotionFX::AnimGraphNodeId m_oldStateMachineNodeId; + bool m_oldDirtyFlag; MCORE_DEFINECOMMAND_END diff --git a/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/AnimGraphNodeGroupCommands.cpp b/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/AnimGraphNodeGroupCommands.cpp index a11af1399d..0f04bb0e79 100644 --- a/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/AnimGraphNodeGroupCommands.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/AnimGraphNodeGroupCommands.cpp @@ -334,8 +334,8 @@ namespace CommandSystem nodeGroup->SetColor(color.ToU32()); // save the current dirty flag and tell the anim graph that something got changed - mOldDirtyFlag = animGraph->GetDirtyFlag(); - mOldName = nodeGroup->GetName(); + m_oldDirtyFlag = animGraph->GetDirtyFlag(); + m_oldName = nodeGroup->GetName(); animGraph->SetDirtyFlag(true); return true; } @@ -349,7 +349,7 @@ namespace CommandSystem return false; } - AZStd::string commandString = AZStd::string::format("AnimGraphRemoveNodeGroup -animGraphID %i -name \"%s\"", animGraph->GetID(), mOldName.c_str()); + AZStd::string commandString = AZStd::string::format("AnimGraphRemoveNodeGroup -animGraphID %i -name \"%s\"", animGraph->GetID(), m_oldName.c_str()); // execute the command AZStd::string result; @@ -359,7 +359,7 @@ namespace CommandSystem } // set the dirty flag back to the old value - animGraph->SetDirtyFlag(mOldDirtyFlag); + animGraph->SetDirtyFlag(m_oldDirtyFlag); return true; } @@ -413,16 +413,16 @@ namespace CommandSystem // read out information for the command undo EMotionFX::AnimGraphNodeGroup* nodeGroup = animGraph->GetNodeGroup(groupIndex); - mOldName = nodeGroup->GetName(); - mOldColor = nodeGroup->GetColor(); - mOldIsVisible = nodeGroup->GetIsVisible(); - mOldNodeIds = CommandAnimGraphAdjustNodeGroup::CollectNodeIdsFromGroup(nodeGroup); + m_oldName = nodeGroup->GetName(); + m_oldColor = nodeGroup->GetColor(); + m_oldIsVisible = nodeGroup->GetIsVisible(); + m_oldNodeIds = CommandAnimGraphAdjustNodeGroup::CollectNodeIdsFromGroup(nodeGroup); // remove the node group animGraph->RemoveNodeGroup(groupIndex); // save the current dirty flag and tell the anim graph that something got changed - mOldDirtyFlag = animGraph->GetDirtyFlag(); + m_oldDirtyFlag = animGraph->GetDirtyFlag(); animGraph->SetDirtyFlag(true); return true; } @@ -439,17 +439,17 @@ namespace CommandSystem MCore::CommandGroup commandGroup; - commandGroup.AddCommandString(AZStd::string::format("AnimGraphAddNodeGroup -animGraphID %i -name \"%s\" -updateUI %s",animGraph->GetID(), mOldName.c_str(), updateWindow.c_str())); + commandGroup.AddCommandString(AZStd::string::format("AnimGraphAddNodeGroup -animGraphID %i -name \"%s\" -updateUI %s",animGraph->GetID(), m_oldName.c_str(), updateWindow.c_str())); auto* command = aznew CommandAnimGraphAdjustNodeGroup( GetCommandManager()->FindCommand(CommandAnimGraphAdjustNodeGroup::s_commandName), /*animGraphId = */ animGraph->GetID(), - /*name = */ mOldName, - /*visible = */ mOldIsVisible, + /*name = */ m_oldName, + /*visible = */ m_oldIsVisible, /*newName = */ AZStd::nullopt, - /*nodeNames = */ CommandAnimGraphAdjustNodeGroup::GenerateNodeNameVector(animGraph, mOldNodeIds), + /*nodeNames = */ CommandAnimGraphAdjustNodeGroup::GenerateNodeNameVector(animGraph, m_oldNodeIds), /*nodeAction = */ CommandAnimGraphAdjustNodeGroup::NodeAction::Add, - /*color = */ mOldColor + /*color = */ m_oldColor ); commandGroup.AddCommand(command); @@ -461,7 +461,7 @@ namespace CommandSystem } // set the dirty flag back to the old value - animGraph->SetDirtyFlag(mOldDirtyFlag); + animGraph->SetDirtyFlag(m_oldDirtyFlag); return true; } diff --git a/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/AnimGraphNodeGroupCommands.h b/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/AnimGraphNodeGroupCommands.h index 0fc497d2f1..014d3b0398 100644 --- a/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/AnimGraphNodeGroupCommands.h +++ b/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/AnimGraphNodeGroupCommands.h @@ -83,18 +83,18 @@ namespace CommandSystem // add node group MCORE_DEFINECOMMAND_START(CommandAnimGraphAddNodeGroup, "Add anim graph node group", true) - bool mOldDirtyFlag; - AZStd::string mOldName; + bool m_oldDirtyFlag; + AZStd::string m_oldName; MCORE_DEFINECOMMAND_END // remove a node group MCORE_DEFINECOMMAND_START(CommandAnimGraphRemoveNodeGroup, "Remove anim graph node group", true) - AZStd::string mOldName; - bool mOldIsVisible; - AZ::u32 mOldColor; - AZStd::vector mOldNodeIds; - bool mOldDirtyFlag; + AZStd::string m_oldName; + bool m_oldIsVisible; + AZ::u32 m_oldColor; + AZStd::vector m_oldNodeIds; + bool m_oldDirtyFlag; MCORE_DEFINECOMMAND_END // helper function diff --git a/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/AnimGraphParameterCommands.cpp b/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/AnimGraphParameterCommands.cpp index b0c03e4df2..571b6c5e97 100644 --- a/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/AnimGraphParameterCommands.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/AnimGraphParameterCommands.cpp @@ -188,7 +188,7 @@ namespace CommandSystem outResult = name.c_str(); // Save the current dirty flag and tell the anim graph that something got changed. - mOldDirtyFlag = animGraph->GetDirtyFlag(); + m_oldDirtyFlag = animGraph->GetDirtyFlag(); animGraph->SetDirtyFlag(true); return true; @@ -219,7 +219,7 @@ namespace CommandSystem } // Set the dirty flag back to the old value. - animGraph->SetDirtyFlag(mOldDirtyFlag); + animGraph->SetDirtyFlag(m_oldDirtyFlag); return true; } @@ -258,22 +258,22 @@ namespace CommandSystem bool CommandAnimGraphRemoveParameter::Execute(const MCore::CommandLine& parameters, AZStd::string& outResult) { // Get the parameter name. - parameters.GetValue("name", this, mName); + parameters.GetValue("name", this, m_name); // Find the anim graph by using the id from command parameter. const uint32 animGraphID = parameters.GetValueAsInt("animGraphID", this); EMotionFX::AnimGraph* animGraph = EMotionFX::GetAnimGraphManager().FindAnimGraphByID(animGraphID); if (!animGraph) { - outResult = AZStd::string::format("Cannot remove parameter '%s' from anim graph. Anim graph id '%i' is not valid.", mName.c_str(), animGraphID); + outResult = AZStd::string::format("Cannot remove parameter '%s' from anim graph. Anim graph id '%i' is not valid.", m_name.c_str(), animGraphID); return false; } // Check if there is a parameter with the given name. - const EMotionFX::Parameter* parameter = animGraph->FindParameterByName(mName); + const EMotionFX::Parameter* parameter = animGraph->FindParameterByName(m_name); if (!parameter) { - outResult = AZStd::string::format("Cannot remove parameter '%s' from anim graph. There is no parameter with the given name.", mName.c_str()); + outResult = AZStd::string::format("Cannot remove parameter '%s' from anim graph. There is no parameter with the given name.", m_name.c_str()); return false; } AZ_Assert(azrtti_typeid(parameter) != azrtti_typeid(), "CommmandAnimGraphRemoveParameter called for a group parameter"); @@ -284,13 +284,13 @@ namespace CommandSystem AZ_Assert(parameterIndex.IsSuccess(), "Expected valid parameter index"); // Store undo info before we remove it, so that we can recreate it later. - mType = azrtti_typeid(parameter); - mIndex = parameterIndex.GetValue(); - mParent = parentGroup ? parentGroup->GetName() : ""; - mContents = MCore::ReflectionSerializer::Serialize(parameter).GetValue(); + m_type = azrtti_typeid(parameter); + m_index = parameterIndex.GetValue(); + m_parent = parentGroup ? parentGroup->GetName() : ""; + m_contents = MCore::ReflectionSerializer::Serialize(parameter).GetValue(); AZ::Outcome valueParameterIndex = AZ::Failure(); - if (mType != azrtti_typeid()) + if (m_type != azrtti_typeid()) { valueParameterIndex = animGraph->FindValueParameterIndex(static_cast(parameter)); } @@ -299,7 +299,7 @@ namespace CommandSystem if (animGraph->RemoveParameter(const_cast(parameter))) { // Remove the parameter from all corresponding anim graph instances if it is a value parameter - if (mType != azrtti_typeid()) + if (m_type != azrtti_typeid()) { AZStd::vector affectedObjects; animGraph->RecursiveCollectObjectsOfType(azrtti_typeid(), affectedObjects); @@ -308,7 +308,7 @@ namespace CommandSystem for (EMotionFX::AnimGraphObject* affectedObject : affectedObjects) { EMotionFX::ObjectAffectedByParameterChanges* parameterDriven = azdynamic_cast(affectedObject); - parameterDriven->ParameterRemoved(mName); + parameterDriven->ParameterRemoved(m_name); } const size_t numInstances = animGraph->GetNumAnimGraphInstances(); @@ -320,7 +320,7 @@ namespace CommandSystem } // Save the current dirty flag and tell the anim graph that something got changed. - mOldDirtyFlag = animGraph->GetDirtyFlag(); + m_oldDirtyFlag = animGraph->GetDirtyFlag(); animGraph->SetDirtyFlag(true); } return true; @@ -336,7 +336,7 @@ namespace CommandSystem EMotionFX::AnimGraph* animGraph = EMotionFX::GetAnimGraphManager().FindAnimGraphByID(animGraphID); if (!animGraph) { - outResult = AZStd::string::format("Cannot undo remove parameter '%s' from anim graph. Anim graph id '%i' is not valid.", mName.c_str(), animGraphID); + outResult = AZStd::string::format("Cannot undo remove parameter '%s' from anim graph. Anim graph id '%i' is not valid.", m_name.c_str(), animGraphID); return false; } @@ -347,11 +347,11 @@ namespace CommandSystem commandString = AZStd::string::format("AnimGraphCreateParameter -animGraphID %i -name \"%s\" -index %zu -type \"%s\" -contents {%s} -parent \"%s\" -updateUI %s", animGraph->GetID(), - mName.c_str(), - mIndex, - mType.ToString().c_str(), - mContents.c_str(), - mParent.c_str(), + m_name.c_str(), + m_index, + m_type.ToString().c_str(), + m_contents.c_str(), + m_parent.c_str(), updateUI.c_str()); // The parameter will be restored to the right parent group because the index is absolute @@ -364,7 +364,7 @@ namespace CommandSystem } // Set the dirty flag back to the old value. - animGraph->SetDirtyFlag(mOldDirtyFlag); + animGraph->SetDirtyFlag(m_oldDirtyFlag); return true; } @@ -399,21 +399,21 @@ namespace CommandSystem bool CommandAnimGraphAdjustParameter::Execute(const MCore::CommandLine& parameters, AZStd::string& outResult) { // Get the parameter name. - parameters.GetValue("name", this, mOldName); + parameters.GetValue("name", this, m_oldName); // Find the anim graph by using the id from command parameter. const uint32 animGraphID = parameters.GetValueAsInt("animGraphID", this); EMotionFX::AnimGraph* animGraph = EMotionFX::GetAnimGraphManager().FindAnimGraphByID(animGraphID); if (!animGraph) { - outResult = AZStd::string::format("Cannot adjust parameter '%s'. Anim graph with id '%d' not found.", mOldName.c_str(), animGraphID); + outResult = AZStd::string::format("Cannot adjust parameter '%s'. Anim graph with id '%d' not found.", m_oldName.c_str(), animGraphID); return false; } - const EMotionFX::Parameter* parameter = animGraph->FindParameterByName(mOldName); + const EMotionFX::Parameter* parameter = animGraph->FindParameterByName(m_oldName); if (!parameter) { - outResult = AZStd::string::format("There is no parameter with the name '%s'.", mOldName.c_str()); + outResult = AZStd::string::format("There is no parameter with the name '%s'.", m_oldName.c_str()); return false; } AZ::Outcome oldValueParameterIndex = AZ::Failure(); @@ -426,15 +426,15 @@ namespace CommandSystem const EMotionFX::GroupParameter* currentParent = animGraph->FindParentGroupParameter(parameter); // Store the undo info. - mOldType = azrtti_typeid(parameter); - mOldContents = MCore::ReflectionSerializer::Serialize(parameter).GetValue(); + m_oldType = azrtti_typeid(parameter); + m_oldContents = MCore::ReflectionSerializer::Serialize(parameter).GetValue(); // Get the new name and check if it is valid. AZStd::string newName; parameters.GetValue("newName", this, newName); if (!newName.empty()) { - if (newName == mOldName) + if (newName == m_oldName) { newName.clear(); } @@ -461,10 +461,10 @@ namespace CommandSystem outResult = AZStd::string::format("The type is not a valid UUID type. Please use -help or use the command browser to see a list of valid options."); return false; } - if (type != mOldType) + if (type != m_oldType) { AZStd::unique_ptr newParameter(EMotionFX::ParameterFactory::Create(type)); - newParameter->SetName(newName.empty() ? mOldName : newName); + newParameter->SetName(newName.empty() ? m_oldName : newName); newParameter->SetDescription(parameter->GetDescription()); const AZ::Outcome paramIndexRelativeToParent = currentParent ? currentParent->FindRelativeParameterIndex(parameter) : animGraph->FindRelativeParameterIndex(parameter); @@ -472,7 +472,7 @@ namespace CommandSystem if (!animGraph->RemoveParameter(const_cast(parameter))) { - outResult = AZStd::string::format("Could not remove current parameter '%s' to change its type.", mOldName.c_str()); + outResult = AZStd::string::format("Could not remove current parameter '%s' to change its type.", m_oldName.c_str()); return false; } if (!animGraph->InsertParameter(paramIndexRelativeToParent.GetValue(), newParameter.get(), currentParent)) @@ -525,7 +525,7 @@ namespace CommandSystem { EMotionFX::AnimGraphInstance* animGraphInstance = animGraph->GetAnimGraphInstance(i); // reinit the modified parameters - if (mOldType != azrtti_typeid()) + if (m_oldType != azrtti_typeid()) { animGraphInstance->ReInitParameterValue(valueParameterIndex.GetValue()); } @@ -547,7 +547,7 @@ namespace CommandSystem for (EMotionFX::AnimGraphObject* affectedObject : affectedObjects) { EMotionFX::ObjectAffectedByParameterChanges* affectedObjectByParameterChanges = azdynamic_cast(affectedObject); - affectedObjectByParameterChanges->ParameterRenamed(mOldName, newName); + affectedObjectByParameterChanges->ParameterRenamed(m_oldName, newName); } } } @@ -561,16 +561,16 @@ namespace CommandSystem for (EMotionFX::AnimGraphObject* affectedObject : affectedObjects) { EMotionFX::ObjectAffectedByParameterChanges* affectedObjectByParameterChanges = azdynamic_cast(affectedObject); - affectedObjectByParameterChanges->ParameterRemoved(mOldName); + affectedObjectByParameterChanges->ParameterRemoved(m_oldName); affectedObjectByParameterChanges->ParameterAdded(newName); } } // Save the current dirty flag and tell the anim graph that something got changed. - mOldDirtyFlag = animGraph->GetDirtyFlag(); + m_oldDirtyFlag = animGraph->GetDirtyFlag(); animGraph->SetDirtyFlag(true); } - else if (mOldType != azrtti_typeid()) + else if (m_oldType != azrtti_typeid()) { AZ_Assert(oldValueParameterIndex.IsSuccess(), "Unable to find parameter index when changing parameter to a group"); @@ -582,11 +582,11 @@ namespace CommandSystem for (EMotionFX::AnimGraphObject* affectedObject : affectedObjects) { EMotionFX::ObjectAffectedByParameterChanges* affectedObjectByParameterChanges = azdynamic_cast(affectedObject); - affectedObjectByParameterChanges->ParameterRemoved(mOldName); + affectedObjectByParameterChanges->ParameterRemoved(m_oldName); } // Save the current dirty flag and tell the anim graph that something got changed. - mOldDirtyFlag = animGraph->GetDirtyFlag(); + m_oldDirtyFlag = animGraph->GetDirtyFlag(); animGraph->SetDirtyFlag(true); } @@ -638,15 +638,15 @@ namespace CommandSystem animGraph->GetID(), newName.c_str(), name.c_str(), - mOldType.ToString().c_str(), - mOldContents.c_str()); + m_oldType.ToString().c_str(), + m_oldContents.c_str()); if (!GetCommandManager()->ExecuteCommandInsideCommand(commandString, outResult)) { AZ_Error("EMotionFX", false, outResult.c_str()); } - animGraph->SetDirtyFlag(mOldDirtyFlag); + animGraph->SetDirtyFlag(m_oldDirtyFlag); return true; } @@ -728,13 +728,13 @@ namespace CommandSystem const EMotionFX::GroupParameter* currentParent = animGraph->FindParentGroupParameter(parameter); if (currentParent) { - mOldParent = currentParent->GetName(); - mOldIndex = currentParent->FindRelativeParameterIndex(parameter).GetValue(); + m_oldParent = currentParent->GetName(); + m_oldIndex = currentParent->FindRelativeParameterIndex(parameter).GetValue(); } else { - mOldParent.clear(); // means the root - mOldIndex = animGraph->FindRelativeParameterIndex(parameter).GetValue(); + m_oldParent.clear(); // means the root + m_oldIndex = animGraph->FindRelativeParameterIndex(parameter).GetValue(); } EMotionFX::ValueParameterVector valueParametersBeforeChange = animGraph->RecursivelyGetValueParameters(); @@ -789,7 +789,7 @@ namespace CommandSystem } // Save the current dirty flag and tell the anim graph that something got changed. - mOldDirtyFlag = animGraph->GetDirtyFlag(); + m_oldDirtyFlag = animGraph->GetDirtyFlag(); animGraph->SetDirtyFlag(true); return true; @@ -813,10 +813,10 @@ namespace CommandSystem AZStd::string commandString = AZStd::string::format("AnimGraphMoveParameter -animGraphID %i -name \"%s\" -index %zu", animGraphID, name.c_str(), - mOldIndex); - if (!mOldParent.empty()) + m_oldIndex); + if (!m_oldParent.empty()) { - commandString += AZStd::string::format(" -parent \"%s\"", mOldParent.c_str()); + commandString += AZStd::string::format(" -parent \"%s\"", m_oldParent.c_str()); } if (!GetCommandManager()->ExecuteCommandInsideCommand(commandString, outResult)) @@ -825,7 +825,7 @@ namespace CommandSystem return false; } - animGraph->SetDirtyFlag(mOldDirtyFlag); + animGraph->SetDirtyFlag(m_oldDirtyFlag); return true; } diff --git a/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/AnimGraphParameterCommands.h b/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/AnimGraphParameterCommands.h index f93a93d0f9..b1adbcbbab 100644 --- a/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/AnimGraphParameterCommands.h +++ b/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/AnimGraphParameterCommands.h @@ -22,35 +22,35 @@ namespace CommandSystem { // Create a new anim graph parameter. MCORE_DEFINECOMMAND_START(CommandAnimGraphCreateParameter, "Create an anim graph parameter", true) - bool mOldDirtyFlag; + bool m_oldDirtyFlag; MCORE_DEFINECOMMAND_END // Remove a given anim graph parameter. MCORE_DEFINECOMMAND_START(CommandAnimGraphRemoveParameter, "Remove an anim graph parameter", true) - size_t mIndex; - AZ::TypeId mType; - AZStd::string mName; - AZStd::string mContents; - AZStd::string mParent; - bool mOldDirtyFlag; + size_t m_index; + AZ::TypeId m_type; + AZStd::string m_name; + AZStd::string m_contents; + AZStd::string m_parent; + bool m_oldDirtyFlag; MCORE_DEFINECOMMAND_END // Adjust a given anim graph parameter. MCORE_DEFINECOMMAND_START(CommandAnimGraphAdjustParameter, "Adjust an anim graph parameter", true) - AZ::TypeId mOldType; - AZStd::string mOldName; - AZStd::string mOldContents; - bool mOldDirtyFlag; + AZ::TypeId m_oldType; + AZStd::string m_oldName; + AZStd::string m_oldContents; + bool m_oldDirtyFlag; MCORE_DEFINECOMMAND_END // Move the parameter to another position. MCORE_DEFINECOMMAND_START(CommandAnimGraphMoveParameter, "Move an anim graph parameter", true) - AZStd::string mOldParent; - size_t mOldIndex; - bool mOldDirtyFlag; + AZStd::string m_oldParent; + size_t m_oldIndex; + bool m_oldDirtyFlag; MCORE_DEFINECOMMAND_END ////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -59,18 +59,18 @@ namespace CommandSystem struct COMMANDSYSTEM_API ParameterConnectionItem { - void SetParameterNodeName(const char* name) { mParameterNodeNameID = MCore::GetStringIdPool().GenerateIdForString(name); } - void SetTargetNodeName(const char* name) { mTargetNodeNameID = MCore::GetStringIdPool().GenerateIdForString(name); } - void SetParameterName(const char* name) { mParameterNameID = MCore::GetStringIdPool().GenerateIdForString(name); } + void SetParameterNodeName(const char* name) { m_parameterNodeNameId = MCore::GetStringIdPool().GenerateIdForString(name); } + void SetTargetNodeName(const char* name) { m_targetNodeNameId = MCore::GetStringIdPool().GenerateIdForString(name); } + void SetParameterName(const char* name) { m_parameterNameId = MCore::GetStringIdPool().GenerateIdForString(name); } - const char* GetParameterNodeName() const { return MCore::GetStringIdPool().GetName(mParameterNodeNameID).c_str(); } - const char* GetTargetNodeName() const { return MCore::GetStringIdPool().GetName(mTargetNodeNameID).c_str(); } - const char* GetParameterName() const { return MCore::GetStringIdPool().GetName(mParameterNameID).c_str(); } + const char* GetParameterNodeName() const { return MCore::GetStringIdPool().GetName(m_parameterNodeNameId).c_str(); } + const char* GetTargetNodeName() const { return MCore::GetStringIdPool().GetName(m_targetNodeNameId).c_str(); } + const char* GetParameterName() const { return MCore::GetStringIdPool().GetName(m_parameterNameId).c_str(); } private: - uint32 mParameterNodeNameID; - uint32 mTargetNodeNameID; - uint32 mParameterNameID; + uint32 m_parameterNodeNameId; + uint32 m_targetNodeNameId; + uint32 m_parameterNameId; }; COMMANDSYSTEM_API void RemoveConnectionsForParameter(EMotionFX::AnimGraph* animGraph, const char* parameterName, MCore::CommandGroup& commandGroup); diff --git a/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/CommandManager.cpp b/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/CommandManager.cpp index 893fea2224..be4626f592 100644 --- a/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/CommandManager.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/CommandManager.cpp @@ -147,8 +147,8 @@ namespace CommandSystem RegisterCommand(new CommandRecorderClear()); gCommandManager = this; - mLockSelection = false; - mWorkspaceDirtyFlag = false; + m_lockSelection = false; + m_workspaceDirtyFlag = false; } CommandManager::~CommandManager() diff --git a/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/CommandManager.h b/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/CommandManager.h index b2c6986297..8fe7e05895 100644 --- a/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/CommandManager.h +++ b/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/CommandManager.h @@ -33,28 +33,28 @@ namespace CommandSystem * Get current selection. * @return The selection list containing all selected actors, motions and nodes. */ - MCORE_INLINE SelectionList& GetCurrentSelection() { mCurrentSelection.MakeValid(); return mCurrentSelection; } + MCORE_INLINE SelectionList& GetCurrentSelection() { m_currentSelection.MakeValid(); return m_currentSelection; } /** * Set current selection. * @param selection The selection list containing all selected actors, motions and nodes. */ - MCORE_INLINE void SetCurrentSelection(SelectionList& selection) { mCurrentSelection.Clear(); mCurrentSelection.Add(selection); } + MCORE_INLINE void SetCurrentSelection(SelectionList& selection) { m_currentSelection.Clear(); m_currentSelection.Add(selection); } - MCORE_INLINE bool GetLockSelection() const { return mLockSelection; } - void SetLockSelection(bool lockSelection) { mLockSelection = lockSelection; } + MCORE_INLINE bool GetLockSelection() const { return m_lockSelection; } + void SetLockSelection(bool lockSelection) { m_lockSelection = lockSelection; } - void SetWorkspaceDirtyFlag(bool dirty) { mWorkspaceDirtyFlag = dirty; } - MCORE_INLINE bool GetWorkspaceDirtyFlag() const { return mWorkspaceDirtyFlag; } + void SetWorkspaceDirtyFlag(bool dirty) { m_workspaceDirtyFlag = dirty; } + MCORE_INLINE bool GetWorkspaceDirtyFlag() const { return m_workspaceDirtyFlag; } // Only true when user create or open a workspace. void SetUserOpenedWorkspaceFlag(bool flag); bool GetUserOpenedWorkspaceFlag() const { return m_userOpenedWorkspaceFlag; } private: - SelectionList mCurrentSelection; /**< The current selected actors, motions and nodes. */ - bool mLockSelection; - bool mWorkspaceDirtyFlag; + SelectionList m_currentSelection; /**< The current selected actors, motions and nodes. */ + bool m_lockSelection; + bool m_workspaceDirtyFlag; bool m_userOpenedWorkspaceFlag = false; }; diff --git a/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/ImporterCommands.cpp b/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/ImporterCommands.cpp index b86c23677c..168de93e38 100644 --- a/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/ImporterCommands.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/ImporterCommands.cpp @@ -29,7 +29,7 @@ namespace CommandSystem CommandImportActor::CommandImportActor(MCore::Command* orgCommand) : MCore::Command("ImportActor", orgCommand) { - mPreviouslyUsedID = MCORE_INVALIDINDEX32; + m_previouslyUsedId = MCORE_INVALIDINDEX32; } @@ -77,10 +77,10 @@ namespace CommandSystem EMotionFX::Importer::ActorSettings settings; // extract default values from the command syntax automatically, if they aren't specified explicitly - settings.mLoadLimits = parameters.GetValueAsBool("loadLimits", this); - settings.mLoadMorphTargets = parameters.GetValueAsBool("loadMorphTargets", this); - settings.mLoadSkeletalLODs = parameters.GetValueAsBool("loadSkeletalLODs", this); - settings.mDualQuatSkinning = parameters.GetValueAsBool("dualQuatSkinning", this); + settings.m_loadLimits = parameters.GetValueAsBool("loadLimits", this); + settings.m_loadMorphTargets = parameters.GetValueAsBool("loadMorphTargets", this); + settings.m_loadSkeletalLoDs = parameters.GetValueAsBool("loadSkeletalLODs", this); + settings.m_dualQuatSkinning = parameters.GetValueAsBool("dualQuatSkinning", this); // try to load the actor AZStd::shared_ptr actor {EMotionFX::GetImporter().LoadActor(filename.c_str(), &settings)}; @@ -101,11 +101,11 @@ namespace CommandSystem } // in case we are in a redo call assign the previously used id - if (mPreviouslyUsedID != MCORE_INVALIDINDEX32) + if (m_previouslyUsedId != MCORE_INVALIDINDEX32) { - actor->SetID(mPreviouslyUsedID); + actor->SetID(m_previouslyUsedId); } - mPreviouslyUsedID = actor->GetID(); + m_previouslyUsedId = actor->GetID(); // select the actor automatically if (parameters.GetValueAsBool("autoSelect", this)) @@ -115,7 +115,7 @@ namespace CommandSystem // mark the workspace as dirty - mOldWorkspaceDirtyFlag = GetCommandManager()->GetWorkspaceDirtyFlag(); + m_oldWorkspaceDirtyFlag = GetCommandManager()->GetWorkspaceDirtyFlag(); GetCommandManager()->SetWorkspaceDirtyFlag(true); // return the id of the newly created actor @@ -134,7 +134,7 @@ namespace CommandSystem uint32 actorID = parameters.GetValueAsInt("actorID", MCORE_INVALIDINDEX32); if (actorID == MCORE_INVALIDINDEX32) { - actorID = mPreviouslyUsedID; + actorID = m_previouslyUsedId; } // check if we have to unselect the actors created by this command @@ -159,7 +159,7 @@ namespace CommandSystem GetCommandManager()->ExecuteCommandInsideCommand("UpdateRenderActors", updateRenderActorsResult); // restore the workspace dirty flag - GetCommandManager()->SetWorkspaceDirtyFlag(mOldWorkspaceDirtyFlag); + GetCommandManager()->SetWorkspaceDirtyFlag(m_oldWorkspaceDirtyFlag); return true; } @@ -203,7 +203,7 @@ namespace CommandSystem CommandImportMotion::CommandImportMotion(MCore::Command* orgCommand) : MCore::Command("ImportMotion", orgCommand) { - mOldMotionID = MCORE_INVALIDINDEX32; + m_oldMotionId = MCORE_INVALIDINDEX32; } @@ -255,7 +255,7 @@ namespace CommandSystem if (AzFramework::StringFunc::Equal(extension.c_str(), "motion", false /* no case */)) { EMotionFX::Importer::MotionSettings settings; - settings.mLoadMotionEvents = parameters.GetValueAsBool("loadMotionEvents", this); + settings.m_loadMotionEvents = parameters.GetValueAsBool("loadMotionEvents", this); motion = EMotionFX::GetImporter().LoadMotion(filename.c_str(), &settings); } @@ -273,12 +273,12 @@ namespace CommandSystem } // in case we are in a redo call assign the previously used id - if (mOldMotionID != MCORE_INVALIDINDEX32) + if (m_oldMotionId != MCORE_INVALIDINDEX32) { - motion->SetID(mOldMotionID); + motion->SetID(m_oldMotionId); } - mOldMotionID = motion->GetID(); - mOldFileName = motion->GetFileName(); + m_oldMotionId = motion->GetID(); + m_oldFileName = motion->GetFileName(); // set the motion name AZStd::string motionName; @@ -292,7 +292,7 @@ namespace CommandSystem } // mark the workspace as dirty - mOldWorkspaceDirtyFlag = GetCommandManager()->GetWorkspaceDirtyFlag(); + m_oldWorkspaceDirtyFlag = GetCommandManager()->GetWorkspaceDirtyFlag(); GetCommandManager()->SetWorkspaceDirtyFlag(true); // reset the dirty flag @@ -308,11 +308,11 @@ namespace CommandSystem // execute the group command AZStd::string commandString; - commandString = AZStd::string::format("RemoveMotion -filename \"%s\"", mOldFileName.c_str()); + commandString = AZStd::string::format("RemoveMotion -filename \"%s\"", m_oldFileName.c_str()); bool result = GetCommandManager()->ExecuteCommandInsideCommand(commandString.c_str(), outResult); // restore the workspace dirty flag - GetCommandManager()->SetWorkspaceDirtyFlag(mOldWorkspaceDirtyFlag); + GetCommandManager()->SetWorkspaceDirtyFlag(m_oldWorkspaceDirtyFlag); return result; } diff --git a/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/ImporterCommands.h b/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/ImporterCommands.h index 9eb27a06f6..6e8f4728c7 100644 --- a/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/ImporterCommands.h +++ b/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/ImporterCommands.h @@ -21,17 +21,17 @@ namespace CommandSystem // add actor MCORE_DEFINECOMMAND_START(CommandImportActor, "Import actor", true) public: - uint32 mPreviouslyUsedID; - uint32 mOldIndex; - bool mOldWorkspaceDirtyFlag; + uint32 m_previouslyUsedId; + uint32 m_oldIndex; + bool m_oldWorkspaceDirtyFlag; MCORE_DEFINECOMMAND_END // add motion MCORE_DEFINECOMMAND_START(CommandImportMotion, "Import motion", true) public: - uint32 mOldMotionID; - AZStd::string mOldFileName; - bool mOldWorkspaceDirtyFlag; + uint32 m_oldMotionId; + AZStd::string m_oldFileName; + bool m_oldWorkspaceDirtyFlag; MCORE_DEFINECOMMAND_END } // namespace CommandSystem diff --git a/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/MetaData.cpp b/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/MetaData.cpp index aade6e8358..9a0913a5db 100644 --- a/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/MetaData.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/MetaData.cpp @@ -153,7 +153,7 @@ namespace CommandSystem for (uint32 i = 0; i < actor->GetNumNodes(); ++i) { const EMotionFX::Actor::NodeMirrorInfo& mirrorInfo = actor->GetNodeMirrorInfo(i); - uint16 sourceNode = mirrorInfo.mSourceNode; + uint16 sourceNode = mirrorInfo.m_sourceNode; if (sourceNode != MCORE_INVALIDINDEX16 && sourceNode != static_cast(i)) { outMetaDataString += actor->GetSkeleton()->GetNode(i)->GetNameString(); diff --git a/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/MorphTargetCommands.cpp b/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/MorphTargetCommands.cpp index 0abec28850..0a48952bfc 100644 --- a/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/MorphTargetCommands.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/MorphTargetCommands.cpp @@ -122,7 +122,7 @@ namespace CommandSystem if (parameters.CheckIfHasParameter("weight") && morphTargetInstance) { const float value = parameters.GetValueAsFloat("weight", this); - mOldWeight = morphTargetInstance->GetWeight(); + m_oldWeight = morphTargetInstance->GetWeight(); morphTargetInstance->SetWeight(value); } @@ -130,7 +130,7 @@ namespace CommandSystem if (parameters.CheckIfHasParameter("manualMode") && morphTargetInstance) { const bool value = parameters.GetValueAsBool("manualMode", this); - mOldManualModeEnabled = morphTargetInstance->GetIsInManualMode(); + m_oldManualModeEnabled = morphTargetInstance->GetIsInManualMode(); morphTargetInstance->SetManualMode(value); } @@ -138,7 +138,7 @@ namespace CommandSystem if (parameters.CheckIfHasParameter("rangeMin") && morphTarget) { const float value = parameters.GetValueAsFloat("rangeMin", this); - mOldRangeMin = morphTarget->GetRangeMin(); + m_oldRangeMin = morphTarget->GetRangeMin(); morphTarget->SetRangeMin(value); } @@ -146,7 +146,7 @@ namespace CommandSystem if (parameters.CheckIfHasParameter("rangeMax") && morphTarget) { const float value = parameters.GetValueAsFloat("rangeMax", this); - mOldRangeMax = morphTarget->GetRangeMax(); + m_oldRangeMax = morphTarget->GetRangeMax(); morphTarget->SetRangeMax(value); } @@ -159,7 +159,7 @@ namespace CommandSystem parameters.GetValue("phonemeSets", this, &phonemeSetsString); // store old phoneme sets - mOldPhonemeSets = morphTarget->GetPhonemeSets(); + m_oldPhonemeSets = morphTarget->GetPhonemeSets(); // remove the phoneme set if (AzFramework::StringFunc::Equal(valueString.c_str(), "remove", false /* no case */)) @@ -203,7 +203,7 @@ namespace CommandSystem } // save the current dirty flag and tell the actor that something got changed - mOldDirtyFlag = actor->GetDirtyFlag(); + m_oldDirtyFlag = actor->GetDirtyFlag(); actor->SetDirtyFlag(true); return true; } @@ -240,35 +240,35 @@ namespace CommandSystem // set the old weight of the morph target if (parameters.CheckIfHasParameter("weight") && morphTargetInstance) { - morphTargetInstance->SetWeight(mOldWeight); + morphTargetInstance->SetWeight(m_oldWeight); } // set the old manual mode if (parameters.CheckIfHasParameter("manualMode") && morphTargetInstance) { - morphTargetInstance->SetManualMode(mOldManualModeEnabled); + morphTargetInstance->SetManualMode(m_oldManualModeEnabled); } // set the old range min if (parameters.CheckIfHasParameter("rangeMin") && morphTarget) { - morphTarget->SetRangeMin(mOldRangeMin); + morphTarget->SetRangeMin(m_oldRangeMin); } // set the old range max if (parameters.CheckIfHasParameter("rangeMax") && morphTarget) { - morphTarget->SetRangeMax(mOldRangeMax); + morphTarget->SetRangeMax(m_oldRangeMax); } // set the old phoneme sets if (parameters.CheckIfHasParameter("phonemeAction") && morphTarget) { - morphTarget->SetPhonemeSets(mOldPhonemeSets); + morphTarget->SetPhonemeSets(m_oldPhonemeSets); } // set the dirty flag back to the old value - actor->SetDirtyFlag(mOldDirtyFlag); + actor->SetDirtyFlag(m_oldDirtyFlag); return true; } diff --git a/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/MorphTargetCommands.h b/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/MorphTargetCommands.h index 4ab06fe827..2ae284e907 100644 --- a/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/MorphTargetCommands.h +++ b/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/MorphTargetCommands.h @@ -20,12 +20,12 @@ namespace CommandSystem { // adjust a given morph target of an actor MCORE_DEFINECOMMAND_START(CommandAdjustMorphTarget, "Adjust morph target", true) - float mOldWeight; - float mOldRangeMin; - float mOldRangeMax; - bool mOldManualModeEnabled; - EMotionFX::MorphTarget::EPhonemeSet mOldPhonemeSets; - bool mOldDirtyFlag; + float m_oldWeight; + float m_oldRangeMin; + float m_oldRangeMax; + bool m_oldManualModeEnabled; + EMotionFX::MorphTarget::EPhonemeSet m_oldPhonemeSets; + bool m_oldDirtyFlag; bool GetMorphTarget(EMotionFX::Actor* actor, EMotionFX::ActorInstance* actorInstance, uint32 lodLevel, const char* morphTargetName, EMotionFX::MorphTarget** outMorphTarget, EMotionFX::MorphSetupInstance::MorphTarget** outMorphTargetInstance, AZStd::string& outResult); MCORE_DEFINECOMMAND_END diff --git a/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/MotionCommands.cpp b/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/MotionCommands.cpp index 677b4ec5ff..2bec066549 100644 --- a/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/MotionCommands.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/MotionCommands.cpp @@ -79,27 +79,27 @@ namespace CommandSystem AZStd::string CommandPlayMotion::PlayBackInfoToCommandParameters(const EMotionFX::PlayBackInfo* playbackInfo) { return AZStd::string::format("-blendInTime %f -blendOutTime %f -playSpeed %f -targetWeight %f -eventWeightThreshold %f -maxPlayTime %f -numLoops %i -priorityLevel %i -blendMode %i -playMode %i -mirrorMotion %s -mix %s -playNow %s -motionExtraction %s -retarget %s -freezeAtLastFrame %s -enableMotionEvents %s -blendOutBeforeEnded %s -canOverwrite %s -deleteOnZeroWeight %s -inPlace %s", - playbackInfo->mBlendInTime, - playbackInfo->mBlendOutTime, - playbackInfo->mPlaySpeed, - playbackInfo->mTargetWeight, - playbackInfo->mEventWeightThreshold, - playbackInfo->mMaxPlayTime, - playbackInfo->mNumLoops, - playbackInfo->mPriorityLevel, - static_cast(playbackInfo->mBlendMode), - static_cast(playbackInfo->mPlayMode), - AZStd::to_string(playbackInfo->mMirrorMotion).c_str(), - AZStd::to_string(playbackInfo->mMix).c_str(), - AZStd::to_string(playbackInfo->mPlayNow).c_str(), - AZStd::to_string(playbackInfo->mMotionExtractionEnabled).c_str(), - AZStd::to_string(playbackInfo->mRetarget).c_str(), - AZStd::to_string(playbackInfo->mFreezeAtLastFrame).c_str(), - AZStd::to_string(playbackInfo->mEnableMotionEvents).c_str(), - AZStd::to_string(playbackInfo->mBlendOutBeforeEnded).c_str(), - AZStd::to_string(playbackInfo->mCanOverwrite).c_str(), - AZStd::to_string(playbackInfo->mDeleteOnZeroWeight).c_str(), - AZStd::to_string(playbackInfo->mInPlace).c_str()); + playbackInfo->m_blendInTime, + playbackInfo->m_blendOutTime, + playbackInfo->m_playSpeed, + playbackInfo->m_targetWeight, + playbackInfo->m_eventWeightThreshold, + playbackInfo->m_maxPlayTime, + playbackInfo->m_numLoops, + playbackInfo->m_priorityLevel, + static_cast(playbackInfo->m_blendMode), + static_cast(playbackInfo->m_playMode), + AZStd::to_string(playbackInfo->m_mirrorMotion).c_str(), + AZStd::to_string(playbackInfo->m_mix).c_str(), + AZStd::to_string(playbackInfo->m_playNow).c_str(), + AZStd::to_string(playbackInfo->m_motionExtractionEnabled).c_str(), + AZStd::to_string(playbackInfo->m_retarget).c_str(), + AZStd::to_string(playbackInfo->m_freezeAtLastFrame).c_str(), + AZStd::to_string(playbackInfo->m_enableMotionEvents).c_str(), + AZStd::to_string(playbackInfo->m_blendOutBeforeEnded).c_str(), + AZStd::to_string(playbackInfo->m_canOverwrite).c_str(), + AZStd::to_string(playbackInfo->m_deleteOnZeroWeight).c_str(), + AZStd::to_string(playbackInfo->m_inPlace).c_str()); } @@ -108,87 +108,87 @@ namespace CommandSystem { if (parameters.CheckIfHasParameter("blendInTime") == true) { - outPlaybackInfo->mBlendInTime = parameters.GetValueAsFloat("blendInTime", command); + outPlaybackInfo->m_blendInTime = parameters.GetValueAsFloat("blendInTime", command); } if (parameters.CheckIfHasParameter("blendOutTime")) { - outPlaybackInfo->mBlendOutTime = parameters.GetValueAsFloat("blendOutTime", command); + outPlaybackInfo->m_blendOutTime = parameters.GetValueAsFloat("blendOutTime", command); } if (parameters.CheckIfHasParameter("playSpeed")) { - outPlaybackInfo->mPlaySpeed = parameters.GetValueAsFloat("playSpeed", command); + outPlaybackInfo->m_playSpeed = parameters.GetValueAsFloat("playSpeed", command); } if (parameters.CheckIfHasParameter("targetWeight")) { - outPlaybackInfo->mTargetWeight = parameters.GetValueAsFloat("targetWeight", command); + outPlaybackInfo->m_targetWeight = parameters.GetValueAsFloat("targetWeight", command); } if (parameters.CheckIfHasParameter("eventWeightThreshold")) { - outPlaybackInfo->mEventWeightThreshold = parameters.GetValueAsFloat("eventWeightThreshold", command); + outPlaybackInfo->m_eventWeightThreshold = parameters.GetValueAsFloat("eventWeightThreshold", command); } if (parameters.CheckIfHasParameter("maxPlayTime")) { - outPlaybackInfo->mMaxPlayTime = parameters.GetValueAsFloat("maxPlayTime", command); + outPlaybackInfo->m_maxPlayTime = parameters.GetValueAsFloat("maxPlayTime", command); } if (parameters.CheckIfHasParameter("numLoops")) { - outPlaybackInfo->mNumLoops = parameters.GetValueAsInt("numLoops", command); + outPlaybackInfo->m_numLoops = parameters.GetValueAsInt("numLoops", command); } if (parameters.CheckIfHasParameter("priorityLevel")) { - outPlaybackInfo->mPriorityLevel = parameters.GetValueAsInt("priorityLevel", command); + outPlaybackInfo->m_priorityLevel = parameters.GetValueAsInt("priorityLevel", command); } if (parameters.CheckIfHasParameter("blendMode")) { - outPlaybackInfo->mBlendMode = (EMotionFX::EMotionBlendMode)parameters.GetValueAsInt("blendMode", command); + outPlaybackInfo->m_blendMode = (EMotionFX::EMotionBlendMode)parameters.GetValueAsInt("blendMode", command); } if (parameters.CheckIfHasParameter("playMode")) { - outPlaybackInfo->mPlayMode = (EMotionFX::EPlayMode)parameters.GetValueAsInt("playMode", command); + outPlaybackInfo->m_playMode = (EMotionFX::EPlayMode)parameters.GetValueAsInt("playMode", command); } if (parameters.CheckIfHasParameter("mirrorMotion")) { - outPlaybackInfo->mMirrorMotion = parameters.GetValueAsBool("mirrorMotion", command); + outPlaybackInfo->m_mirrorMotion = parameters.GetValueAsBool("mirrorMotion", command); } if (parameters.CheckIfHasParameter("mix")) { - outPlaybackInfo->mMix = parameters.GetValueAsBool("mix", command); + outPlaybackInfo->m_mix = parameters.GetValueAsBool("mix", command); } if (parameters.CheckIfHasParameter("playNow")) { - outPlaybackInfo->mPlayNow = parameters.GetValueAsBool("playNow", command); + outPlaybackInfo->m_playNow = parameters.GetValueAsBool("playNow", command); } if (parameters.CheckIfHasParameter("motionExtraction")) { - outPlaybackInfo->mMotionExtractionEnabled = parameters.GetValueAsBool("motionExtraction", command); + outPlaybackInfo->m_motionExtractionEnabled = parameters.GetValueAsBool("motionExtraction", command); } if (parameters.CheckIfHasParameter("retarget")) { - outPlaybackInfo->mRetarget = parameters.GetValueAsBool("retarget", command); + outPlaybackInfo->m_retarget = parameters.GetValueAsBool("retarget", command); } if (parameters.CheckIfHasParameter("freezeAtLastFrame")) { - outPlaybackInfo->mFreezeAtLastFrame = parameters.GetValueAsBool("freezeAtLastFrame", command); + outPlaybackInfo->m_freezeAtLastFrame = parameters.GetValueAsBool("freezeAtLastFrame", command); } if (parameters.CheckIfHasParameter("enableMotionEvents")) { - outPlaybackInfo->mEnableMotionEvents = parameters.GetValueAsBool("enableMotionEvents", command); + outPlaybackInfo->m_enableMotionEvents = parameters.GetValueAsBool("enableMotionEvents", command); } if (parameters.CheckIfHasParameter("blendOutBeforeEnded")) { - outPlaybackInfo->mBlendOutBeforeEnded = parameters.GetValueAsBool("blendOutBeforeEnded", command); + outPlaybackInfo->m_blendOutBeforeEnded = parameters.GetValueAsBool("blendOutBeforeEnded", command); } if (parameters.CheckIfHasParameter("canOverwrite")) { - outPlaybackInfo->mCanOverwrite = parameters.GetValueAsBool("canOverwrite", command); + outPlaybackInfo->m_canOverwrite = parameters.GetValueAsBool("canOverwrite", command); } if (parameters.CheckIfHasParameter("deleteOnZeroWeight")) { - outPlaybackInfo->mDeleteOnZeroWeight = parameters.GetValueAsBool("deleteOnZeroWeight", command); + outPlaybackInfo->m_deleteOnZeroWeight = parameters.GetValueAsBool("deleteOnZeroWeight", command); } if (parameters.CheckIfHasParameter("inPlace")) { - outPlaybackInfo->mInPlace = parameters.GetValueAsBool("inPlace", command); + outPlaybackInfo->m_inPlace = parameters.GetValueAsBool("inPlace", command); } } @@ -327,7 +327,7 @@ namespace CommandSystem #define SYNTAX_MOTIONCOMMANDS \ GetSyntax().ReserveParameters(30); \ GetSyntax().AddRequiredParameter("filename", "The filename of the motion file to play.", MCore::CommandSyntax::PARAMTYPE_STRING); \ - /*GetSyntax().AddParameter( "mirrorPlaneNormal", "The motion mirror plane normal, which is (1,0,0) on default. This setting is only used when mMirrorMotion is set to true.", MCore::CommandSyntax::PARAMTYPE_VECTOR3, "(1, 0, 0)" );*/ \ + /*GetSyntax().AddParameter( "mirrorPlaneNormal", "The motion mirror plane normal, which is (1,0,0) on default. This setting is only used when mirrorMotion is set to true.", MCore::CommandSyntax::PARAMTYPE_VECTOR3, "(1, 0, 0)" );*/ \ GetSyntax().AddParameter("blendInTime", "The time, in seconds, which it will take to fully have blended to the target weight.", MCore::CommandSyntax::PARAMTYPE_FLOAT, "0.3"); \ GetSyntax().AddParameter("blendOutTime", "The time, in seconds, which it takes to smoothly fadeout the motion, after it has been stopped playing.", MCore::CommandSyntax::PARAMTYPE_FLOAT, "0.3"); \ GetSyntax().AddParameter("playSpeed", "The playback speed factor. A value of 1 stands for the original speed, while for example 2 means twice the original speed.", MCore::CommandSyntax::PARAMTYPE_FLOAT, "1.0"); \ @@ -340,7 +340,7 @@ namespace CommandSystem GetSyntax().AddParameter("retargetRootIndex", "The retargeting root node index.", MCore::CommandSyntax::PARAMTYPE_INT, "0"); \ GetSyntax().AddParameter("blendMode", "The motion blend mode. Please read the MotionInstance::SetBlendMode(...) method for more information.", MCore::CommandSyntax::PARAMTYPE_INT, "0"); /* 4294967296 == MCORE_INVALIDINDEX32 */ \ GetSyntax().AddParameter("playMode", "The motion playback mode. This means forward or backward playback.", MCore::CommandSyntax::PARAMTYPE_INT, "0"); \ - GetSyntax().AddParameter("mirrorMotion", "Is motion mirroring enabled or not? When set to true, the mMirrorPlaneNormal is used as mirroring axis.", MCore::CommandSyntax::PARAMTYPE_BOOLEAN, "false"); \ + GetSyntax().AddParameter("mirrorMotion", "Is motion mirroring enabled or not? When set to true, the mirrorPlaneNormal is used as mirroring axis.", MCore::CommandSyntax::PARAMTYPE_BOOLEAN, "false"); \ GetSyntax().AddParameter("mix", "Set to true if you want this motion to mix or not.", MCore::CommandSyntax::PARAMTYPE_BOOLEAN, "false"); \ GetSyntax().AddParameter("playNow", "Set to true if you want to start playing the motion right away. If set to false it will be scheduled for later by inserting it into the motion queue.", MCore::CommandSyntax::PARAMTYPE_BOOLEAN, "true"); \ GetSyntax().AddParameter("motionExtraction", "Set to true when you want to use motion extraction.", MCore::CommandSyntax::PARAMTYPE_BOOLEAN, "true"); \ @@ -546,13 +546,13 @@ namespace CommandSystem EMotionFX::PlayBackInfo* defaultPlayBackInfo = motion->GetDefaultPlayBackInfo(); // copy the current playback info to the undo data - mOldPlaybackInfo = *defaultPlayBackInfo; + m_oldPlaybackInfo = *defaultPlayBackInfo; // adjust the playback info based on the parameters CommandPlayMotion::CommandParametersToPlaybackInfo(this, parameters, defaultPlayBackInfo); // save the current dirty flag and tell the motion that something got changed - mOldDirtyFlag = motion->GetDirtyFlag(); + m_oldDirtyFlag = motion->GetDirtyFlag(); return true; } @@ -585,10 +585,10 @@ namespace CommandSystem } // copy the saved playback info to the actual one - *defaultPlayBackInfo = mOldPlaybackInfo; + *defaultPlayBackInfo = m_oldPlaybackInfo; // set the dirty flag back to the old value - motion->SetDirtyFlag(mOldDirtyFlag); + motion->SetDirtyFlag(m_oldDirtyFlag); return true; } @@ -614,9 +614,6 @@ namespace CommandSystem // execute bool CommandStopMotionInstances::Execute(const MCore::CommandLine& parameters, AZStd::string& outResult) { - // clear our old data so that we start fresh in case of a redo - //mOldData.Clear(); - // get the number of selected actor instances const size_t numSelectedActorInstances = GetCommandManager()->GetCurrentSelection().GetNumSelectedActorInstances(); @@ -716,9 +713,6 @@ namespace CommandSystem MCORE_UNUSED(parameters); MCORE_UNUSED(outResult); - // clear our old data so that we start fresh in case of a redo - //mOldData.Clear(); - // iterate through all actor instances and stop all selected motion instances const size_t numActorInstances = EMotionFX::GetActorManager().GetNumActorInstances(); for (size_t i = 0; i < numActorInstances; ++i) @@ -823,26 +817,26 @@ namespace CommandSystem // adjust the dirty flag if (m_dirtyFlag) { - mOldDirtyFlag = motion->GetDirtyFlag(); + m_oldDirtyFlag = motion->GetDirtyFlag(); motion->SetDirtyFlag(m_dirtyFlag.value()); } // adjust the name if (m_name) { - mOldName = motion->GetName(); + m_oldName = motion->GetName(); motion->SetName(m_name.value().c_str()); - mOldDirtyFlag = motion->GetDirtyFlag(); + m_oldDirtyFlag = motion->GetDirtyFlag(); motion->SetDirtyFlag(true); } // Adjust the motion extraction flags. if (m_extractionFlags) { - mOldExtractionFlags = motion->GetMotionExtractionFlags(); + m_oldExtractionFlags = motion->GetMotionExtractionFlags(); motion->SetMotionExtractionFlags(m_extractionFlags.value()); - mOldDirtyFlag = motion->GetDirtyFlag(); + m_oldDirtyFlag = motion->GetDirtyFlag(); motion->SetDirtyFlag(true); } @@ -866,20 +860,20 @@ namespace CommandSystem // adjust the dirty flag if (m_dirtyFlag) { - motion->SetDirtyFlag(mOldDirtyFlag); + motion->SetDirtyFlag(m_oldDirtyFlag); } // adjust the name if (m_name) { - motion->SetName(mOldName.c_str()); - motion->SetDirtyFlag(mOldDirtyFlag); + motion->SetName(m_oldName.c_str()); + motion->SetDirtyFlag(m_oldDirtyFlag); } if (m_extractionFlags) { - motion->SetMotionExtractionFlags(mOldExtractionFlags); - motion->SetDirtyFlag(mOldDirtyFlag); + motion->SetMotionExtractionFlags(m_oldExtractionFlags); + motion->SetDirtyFlag(m_oldDirtyFlag); } return true; @@ -933,7 +927,7 @@ namespace CommandSystem CommandRemoveMotion::CommandRemoveMotion(MCore::Command* orgCommand) : MCore::Command("RemoveMotion", orgCommand) { - mOldMotionID = MCORE_INVALIDINDEX32; + m_oldMotionId = MCORE_INVALIDINDEX32; } @@ -992,12 +986,12 @@ namespace CommandSystem GetCommandManager()->ExecuteCommandInsideCommand(commandString, outResult); // store the previously used id and remove the motion - mOldIndex = EMotionFX::GetMotionManager().FindMotionIndex(motion); - mOldMotionID = motion->GetID(); - mOldFileName = motion->GetFileName(); + m_oldIndex = EMotionFX::GetMotionManager().FindMotionIndex(motion); + m_oldMotionId = motion->GetID(); + m_oldFileName = motion->GetFileName(); // mark the workspace as dirty - mOldWorkspaceDirtyFlag = GetCommandManager()->GetWorkspaceDirtyFlag(); + m_oldWorkspaceDirtyFlag = GetCommandManager()->GetWorkspaceDirtyFlag(); GetCommandManager()->SetWorkspaceDirtyFlag(true); EMotionFX::GetMotionManager().RemoveMotionByID(motion->GetID()); @@ -1012,11 +1006,11 @@ namespace CommandSystem // execute the group command AZStd::string commandString; - commandString = AZStd::string::format("ImportMotion -filename \"%s\" -motionID %i", mOldFileName.c_str(), mOldMotionID); + commandString = AZStd::string::format("ImportMotion -filename \"%s\" -motionID %i", m_oldFileName.c_str(), m_oldMotionId); bool result = GetCommandManager()->ExecuteCommandInsideCommand(commandString.c_str(), outResult); // restore the workspace dirty flag - GetCommandManager()->SetWorkspaceDirtyFlag(mOldWorkspaceDirtyFlag); + GetCommandManager()->SetWorkspaceDirtyFlag(m_oldWorkspaceDirtyFlag); return result; } @@ -1045,9 +1039,9 @@ namespace CommandSystem CommandScaleMotionData::CommandScaleMotionData(MCore::Command* orgCommand) : MCore::Command("ScaleMotionData", orgCommand) { - mMotionID = MCORE_INVALIDINDEX32; - mScaleFactor = 1.0f; - mOldDirtyFlag = false; + m_motionId = MCORE_INVALIDINDEX32; + m_scaleFactor = 1.0f; + m_oldDirtyFlag = false; } @@ -1092,29 +1086,29 @@ namespace CommandSystem return false; } - mMotionID = motion->GetID(); - mScaleFactor = parameters.GetValueAsFloat("scaleFactor", 1.0f); + m_motionId = motion->GetID(); + m_scaleFactor = parameters.GetValueAsFloat("scaleFactor", 1.0f); AZStd::string targetUnitTypeString; parameters.GetValue("unitType", this, &targetUnitTypeString); - mUseUnitType = parameters.CheckIfHasParameter("unitType"); + m_useUnitType = parameters.CheckIfHasParameter("unitType"); MCore::Distance::EUnitType targetUnitType; bool stringConvertSuccess = MCore::Distance::StringToUnitType(targetUnitTypeString, &targetUnitType); - if (mUseUnitType && stringConvertSuccess == false) + if (m_useUnitType && stringConvertSuccess == false) { outResult = AZStd::string::format("The passed unitType '%s' is not a valid unit type.", targetUnitTypeString.c_str()); return false; } - mOldUnitType = MCore::Distance::UnitTypeToString(motion->GetUnitType()); + m_oldUnitType = MCore::Distance::UnitTypeToString(motion->GetUnitType()); - mOldDirtyFlag = motion->GetDirtyFlag(); + m_oldDirtyFlag = motion->GetDirtyFlag(); motion->SetDirtyFlag(true); // perform the scaling - if (mUseUnitType == false) + if (m_useUnitType == false) { - motion->Scale(mScaleFactor); + motion->Scale(m_scaleFactor); } else { @@ -1130,23 +1124,23 @@ namespace CommandSystem { MCORE_UNUSED(parameters); - if (mUseUnitType == false) + if (m_useUnitType == false) { AZStd::string commandString; - commandString = AZStd::string::format("ScaleMotionData -id %d -scaleFactor %.8f", mMotionID, 1.0f / mScaleFactor); + commandString = AZStd::string::format("ScaleMotionData -id %d -scaleFactor %.8f", m_motionId, 1.0f / m_scaleFactor); GetCommandManager()->ExecuteCommandInsideCommand(commandString.c_str(), outResult); } else { AZStd::string commandString; - commandString = AZStd::string::format("ScaleMotionData -id %d -unitType \"%s\"", mMotionID, mOldUnitType.c_str()); + commandString = AZStd::string::format("ScaleMotionData -id %d -unitType \"%s\"", m_motionId, m_oldUnitType.c_str()); GetCommandManager()->ExecuteCommandInsideCommand(commandString.c_str(), outResult); } - EMotionFX::Motion* motion = EMotionFX::GetMotionManager().FindMotionByID(mMotionID); + EMotionFX::Motion* motion = EMotionFX::GetMotionManager().FindMotionByID(m_motionId); if (motion) { - motion->SetDirtyFlag(mOldDirtyFlag); + motion->SetDirtyFlag(m_oldDirtyFlag); } return true; diff --git a/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/MotionCommands.h b/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/MotionCommands.h index 2e68d7b2cc..2a87b11627 100644 --- a/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/MotionCommands.h +++ b/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/MotionCommands.h @@ -69,33 +69,33 @@ namespace CommandSystem private: AZStd::optional m_dirtyFlag; - bool mOldDirtyFlag; + bool m_oldDirtyFlag; AZStd::optional m_extractionFlags; - EMotionFX::EMotionExtractionFlags mOldExtractionFlags; + EMotionFX::EMotionExtractionFlags m_oldExtractionFlags; AZStd::optional m_name; - AZStd::string mOldName; - AZStd::string mOldMotionExtractionNodeName; + AZStd::string m_oldName; + AZStd::string m_oldMotionExtractionNodeName; }; // Remove motion command. MCORE_DEFINECOMMAND_START(CommandRemoveMotion, "Remove motion", true) public: - uint32 mOldMotionID; - AZStd::string mOldFileName; - size_t mOldIndex; - bool mOldWorkspaceDirtyFlag; + uint32 m_oldMotionId; + AZStd::string m_oldFileName; + size_t m_oldIndex; + bool m_oldWorkspaceDirtyFlag; MCORE_DEFINECOMMAND_END // Scale motion data. MCORE_DEFINECOMMAND_START(CommandScaleMotionData, "Scale motion data", true) public: - AZStd::string mOldUnitType; - uint32 mMotionID; - float mScaleFactor; - bool mOldDirtyFlag; - bool mUseUnitType; + AZStd::string m_oldUnitType; + uint32 m_motionId; + float m_scaleFactor; + bool m_oldDirtyFlag; + bool m_useUnitType; MCORE_DEFINECOMMAND_END @@ -129,8 +129,8 @@ namespace CommandSystem // Adjust default playback info command. MCORE_DEFINECOMMAND_START(CommandAdjustDefaultPlayBackInfo, "Adjust default playback info", true) - EMotionFX::PlayBackInfo mOldPlaybackInfo; - bool mOldDirtyFlag; + EMotionFX::PlayBackInfo m_oldPlaybackInfo; + bool m_oldDirtyFlag; MCORE_DEFINECOMMAND_END diff --git a/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/MotionEventCommands.cpp b/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/MotionEventCommands.cpp index b1d896ccd4..7c02972b78 100644 --- a/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/MotionEventCommands.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/MotionEventCommands.cpp @@ -293,7 +293,7 @@ namespace CommandSystem CommandRemoveMotionEventTrack::CommandRemoveMotionEventTrack(MCore::Command* orgCommand) : MCore::Command("RemoveMotionEventTrack", orgCommand) { - mOldTrackIndex = InvalidIndex; + m_oldTrackIndex = InvalidIndex; } @@ -332,8 +332,8 @@ namespace CommandSystem } // store information for undo - mOldTrackIndex = eventTrackIndex.GetValue(); - mOldEnabled = eventTable->GetTrack(eventTrackIndex.GetValue())->GetIsEnabled(); + m_oldTrackIndex = eventTrackIndex.GetValue(); + m_oldEnabled = eventTable->GetTrack(eventTrackIndex.GetValue())->GetIsEnabled(); // remove the motion event track eventTable->RemoveTrack(eventTrackIndex.GetValue()); @@ -353,7 +353,7 @@ namespace CommandSystem const int32 motionID = parameters.GetValueAsInt("motionID", this); AZStd::string command; - command = AZStd::string::format("CreateMotionEventTrack -motionID %i -eventTrackName \"%s\" -index %zu -enabled %s", motionID, eventTrackName.c_str(), mOldTrackIndex, mOldEnabled ? "true" : "false"); + command = AZStd::string::format("CreateMotionEventTrack -motionID %i -eventTrackName \"%s\" -index %zu -enabled %s", motionID, eventTrackName.c_str(), m_oldTrackIndex, m_oldEnabled ? "true" : "false"); return GetCommandManager()->ExecuteCommandInsideCommand(command.c_str(), outResult); } @@ -586,9 +586,9 @@ namespace CommandSystem } // add the motion event and check if everything worked fine - mMotionEventNr = eventTrack->AddEvent(m_startTime, m_endTime, m_eventDatas.value_or(EMotionFX::EventDataSet())); + m_motionEventNr = eventTrack->AddEvent(m_startTime, m_endTime, m_eventDatas.value_or(EMotionFX::EventDataSet())); - if (mMotionEventNr == InvalidIndex) + if (m_motionEventNr == InvalidIndex) { outResult = AZStd::string::format("Cannot create motion event. The returned motion event index is not valid."); return false; @@ -604,7 +604,7 @@ namespace CommandSystem { AZ_UNUSED(parameters); - const AZStd::string command = AZStd::string::format("RemoveMotionEvent -motionID %i -eventTrackName \"%s\" -eventNr %zu", m_motionID, m_eventTrackName.c_str(), mMotionEventNr); + const AZStd::string command = AZStd::string::format("RemoveMotionEvent -motionID %i -eventTrackName \"%s\" -eventNr %zu", m_motionID, m_eventTrackName.c_str(), m_motionEventNr); return GetCommandManager()->ExecuteCommandInsideCommand(command.c_str(), outResult); } @@ -700,8 +700,8 @@ namespace CommandSystem // get the motion event and store the old values of the motion event for undo const EMotionFX::MotionEvent& motionEvent = eventTrack->GetEvent(eventNr); - mOldStartTime = motionEvent.GetStartTime(); - mOldEndTime = motionEvent.GetEndTime(); + m_oldStartTime = motionEvent.GetStartTime(); + m_oldEndTime = motionEvent.GetEndTime(); m_oldEventDatas = motionEvent.GetEventDatas(); // remove the motion event @@ -728,7 +728,7 @@ namespace CommandSystem } MCore::CommandGroup commandGroup; - CommandHelperAddMotionEvent(motion, eventTrackName.c_str(), mOldStartTime, mOldEndTime, m_oldEventDatas, &commandGroup); + CommandHelperAddMotionEvent(motion, eventTrackName.c_str(), m_oldStartTime, m_oldEndTime, m_oldEventDatas, &commandGroup); return GetCommandManager()->ExecuteCommandGroupInsideCommand(commandGroup, outResult); } diff --git a/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/MotionEventCommands.h b/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/MotionEventCommands.h index 629e1e72c5..54dce0fca6 100644 --- a/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/MotionEventCommands.h +++ b/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/MotionEventCommands.h @@ -60,8 +60,8 @@ namespace CommandSystem }; MCORE_DEFINECOMMAND_START(CommandRemoveMotionEventTrack, "Remove motion event track", true) - size_t mOldTrackIndex; - bool mOldEnabled; + size_t m_oldTrackIndex; + bool m_oldEnabled; MCORE_DEFINECOMMAND_END class DEFINECOMMAND_API CommandAdjustMotionEventTrack @@ -151,12 +151,12 @@ namespace CommandSystem AZStd::optional m_eventDatas; float m_startTime = 0.0f; float m_endTime = 0.0f; - size_t mMotionEventNr; + size_t m_motionEventNr; }; MCORE_DEFINECOMMAND_START(CommandRemoveMotionEvent, "Remove motion event", true) - float mOldStartTime; - float mOldEndTime; + float m_oldStartTime; + float m_oldEndTime; EMotionFX::EventDataSet m_oldEventDatas; MCORE_DEFINECOMMAND_END diff --git a/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/MotionSetCommands.cpp b/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/MotionSetCommands.cpp index 051a0e0797..c3d9a88471 100644 --- a/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/MotionSetCommands.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/MotionSetCommands.cpp @@ -68,7 +68,7 @@ namespace CommandSystem CommandCreateMotionSet::CommandCreateMotionSet(MCore::Command* orgCommand) : MCore::Command("CreateMotionSet", orgCommand) { - mPreviouslyUsedID = MCORE_INVALIDINDEX32; + m_previouslyUsedId = MCORE_INVALIDINDEX32; } @@ -130,9 +130,9 @@ namespace CommandSystem } // In case of redoing the command set the previously used id. - if (mPreviouslyUsedID != MCORE_INVALIDINDEX32) + if (m_previouslyUsedId != MCORE_INVALIDINDEX32) { - motionSet->SetID(mPreviouslyUsedID); + motionSet->SetID(m_previouslyUsedId); } // Set the filename. @@ -145,14 +145,14 @@ namespace CommandSystem } // Store info for undo. - mPreviouslyUsedID = motionSet->GetID(); - AZStd::to_string(outResult, mPreviouslyUsedID); + m_previouslyUsedId = motionSet->GetID(); + AZStd::to_string(outResult, m_previouslyUsedId); // Set the motion set callback for custom motion loading. motionSet->SetCallback(aznew CommandSystemMotionSetCallback(motionSet), true); // Set the dirty flag. - const AZStd::string commandString = AZStd::string::format("AdjustMotionSet -motionSetID %i -dirtyFlag true", mPreviouslyUsedID); + const AZStd::string commandString = AZStd::string::format("AdjustMotionSet -motionSetID %i -dirtyFlag true", m_previouslyUsedId); GetCommandManager()->ExecuteCommandInsideCommand(commandString, outResult); // Seturn the id of the newly created motion set. @@ -176,7 +176,7 @@ namespace CommandSystem EMotionFX::GetAnimGraphManager().InvalidateInstanceUniqueDataUsingMotionSet(motionSet); // Mark the workspace as dirty - mOldWorkspaceDirtyFlag = GetCommandManager()->GetWorkspaceDirtyFlag(); + m_oldWorkspaceDirtyFlag = GetCommandManager()->GetWorkspaceDirtyFlag(); GetCommandManager()->SetWorkspaceDirtyFlag(true); return true; } @@ -186,11 +186,11 @@ namespace CommandSystem { MCORE_UNUSED(parameters); - const AZStd::string commandString = AZStd::string::format("RemoveMotionSet -motionSetID %i", mPreviouslyUsedID); + const AZStd::string commandString = AZStd::string::format("RemoveMotionSet -motionSetID %i", m_previouslyUsedId); bool result = GetCommandManager()->ExecuteCommandInsideCommand(commandString, outResult); // Restore the workspace dirty flag. - GetCommandManager()->SetWorkspaceDirtyFlag(mOldWorkspaceDirtyFlag); + GetCommandManager()->SetWorkspaceDirtyFlag(m_oldWorkspaceDirtyFlag); return result; } @@ -218,7 +218,7 @@ namespace CommandSystem CommandRemoveMotionSet::CommandRemoveMotionSet(MCore::Command* orgCommand) : MCore::Command("RemoveMotionSet", orgCommand) { - mPreviouslyUsedID = MCORE_INVALIDINDEX32; + m_previouslyUsedId = MCORE_INVALIDINDEX32; } @@ -240,20 +240,20 @@ namespace CommandSystem } // Store information used by undo. - mPreviouslyUsedID = motionSet->GetID(); - mOldName = motionSet->GetName(); - mOldFileName = motionSet->GetFilename(); + m_previouslyUsedId = motionSet->GetID(); + m_oldName = motionSet->GetName(); + m_oldFileName = motionSet->GetFilename(); if (!motionSet->GetParentSet()) { - mOldParentSetID = MCORE_INVALIDINDEX32; + m_oldParentSetId = MCORE_INVALIDINDEX32; } else { - mOldParentSetID = motionSet->GetParentSet()->GetID(); + m_oldParentSetId = motionSet->GetParentSet()->GetID(); // Set the dirty flag on the parent. - const AZStd::string commandString = AZStd::string::format("AdjustMotionSet -motionSetID %i -dirtyFlag true", mOldParentSetID); + const AZStd::string commandString = AZStd::string::format("AdjustMotionSet -motionSetID %i -dirtyFlag true", m_oldParentSetId); GetCommandManager()->ExecuteCommandInsideCommand(commandString, outResult); } @@ -280,7 +280,7 @@ namespace CommandSystem } // Mark the workspace as dirty. - mOldWorkspaceDirtyFlag = GetCommandManager()->GetWorkspaceDirtyFlag(); + m_oldWorkspaceDirtyFlag = GetCommandManager()->GetWorkspaceDirtyFlag(); GetCommandManager()->SetWorkspaceDirtyFlag(true); return true; @@ -291,22 +291,22 @@ namespace CommandSystem { MCORE_UNUSED(parameters); - AZStd::string commandString = AZStd::string::format("CreateMotionSet -name \"%s\" -motionSetID %i", mOldName.c_str(), mPreviouslyUsedID); + AZStd::string commandString = AZStd::string::format("CreateMotionSet -name \"%s\" -motionSetID %i", m_oldName.c_str(), m_previouslyUsedId); - if (!mOldFileName.empty()) + if (!m_oldFileName.empty()) { - commandString += AZStd::string::format(" -fileName \"%s\"", mOldFileName.c_str()); + commandString += AZStd::string::format(" -fileName \"%s\"", m_oldFileName.c_str()); } - if (mOldParentSetID != MCORE_INVALIDINDEX32) + if (m_oldParentSetId != MCORE_INVALIDINDEX32) { - commandString += AZStd::string::format(" -parentSetID %i", mOldParentSetID); + commandString += AZStd::string::format(" -parentSetID %i", m_oldParentSetId); } const bool result = GetCommandManager()->ExecuteCommandInsideCommand(commandString, outResult); // Restore the workspace dirty flag. - GetCommandManager()->SetWorkspaceDirtyFlag(mOldWorkspaceDirtyFlag); + GetCommandManager()->SetWorkspaceDirtyFlag(m_oldWorkspaceDirtyFlag); return result; } @@ -353,7 +353,7 @@ namespace CommandSystem // Adjust the dirty flag. if (parameters.CheckIfHasParameter("dirtyFlag")) { - mOldDirtyFlag = motionSet->GetDirtyFlag(); + m_oldDirtyFlag = motionSet->GetDirtyFlag(); const bool dirtyFlag = parameters.GetValueAsBool("dirtyFlag", this); motionSet->SetDirtyFlag(dirtyFlag); } @@ -361,12 +361,12 @@ namespace CommandSystem // Set the new name in case the name parameter is specified. if (parameters.CheckIfHasParameter("newName")) { - mOldSetName = motionSet->GetName(); + m_oldSetName = motionSet->GetName(); AZStd::string name; parameters.GetValue("newName", this, name); motionSet->SetName(name.c_str()); - mOldDirtyFlag = motionSet->GetDirtyFlag(); + m_oldDirtyFlag = motionSet->GetDirtyFlag(); motionSet->SetDirtyFlag(true); } @@ -389,13 +389,13 @@ namespace CommandSystem // Adjust the dirty flag if (parameters.CheckIfHasParameter("dirtyFlag")) { - motionSet->SetDirtyFlag(mOldDirtyFlag); + motionSet->SetDirtyFlag(m_oldDirtyFlag); } // Adjust the name. if (parameters.CheckIfHasParameter("newName")) { - motionSet->SetName(mOldSetName.c_str()); + motionSet->SetName(m_oldSetName.c_str()); } return true; @@ -719,8 +719,8 @@ namespace CommandSystem } // Save the old infos for undo. - mOldIdString = motionEntry->GetId(); - mOldMotionFilename = motionEntry->GetFilename(); + m_oldIdString = motionEntry->GetId(); + m_oldMotionFilename = motionEntry->GetFilename(); if (parameters.CheckIfHasParameter("motionFileName")) { @@ -782,7 +782,7 @@ namespace CommandSystem // Update all motion nodes and link them to the new motion id. if (parameters.GetValueAsBool("updateMotionNodeStringIDs", this)) { - UpdateMotionNodes(mOldIdString.c_str(), newId.c_str()); + UpdateMotionNodes(m_oldIdString.c_str(), newId.c_str()); } } @@ -833,12 +833,12 @@ namespace CommandSystem if (idStringChanged) { - command += AZStd::string::format(" -newIDString \"%s\"", mOldIdString.c_str()); + command += AZStd::string::format(" -newIDString \"%s\"", m_oldIdString.c_str()); } if (parameters.CheckIfHasParameter("motionFileName")) { - command += AZStd::string::format(" -motionFileName \"%s\"", mOldMotionFilename.c_str()); + command += AZStd::string::format(" -motionFileName \"%s\"", m_oldMotionFilename.c_str()); } return GetCommandManager()->ExecuteCommandInsideCommand(command, outResult); @@ -869,7 +869,7 @@ namespace CommandSystem CommandLoadMotionSet::CommandLoadMotionSet(MCore::Command* orgCommand) : MCore::Command("LoadMotionSet", orgCommand) { - mOldMotionSetID = MCORE_INVALIDINDEX32; + m_oldMotionSetId = MCORE_INVALIDINDEX32; } @@ -910,11 +910,11 @@ namespace CommandSystem } // In case we are in a redo call assign the previously used id. - if (mOldMotionSetID != MCORE_INVALIDINDEX32) + if (m_oldMotionSetId != MCORE_INVALIDINDEX32) { - motionSet->SetID(mOldMotionSetID); + motionSet->SetID(m_oldMotionSetId); } - mOldMotionSetID = motionSet->GetID(); + m_oldMotionSetId = motionSet->GetID(); // Set the custom loading callback and preload all motions. motionSet->SetCallback(aznew CommandSystemMotionSetCallback(motionSet), true); @@ -924,7 +924,7 @@ namespace CommandSystem AZStd::to_string(outResult, motionSet->GetID()); // Mark the workspace as dirty. - mOldWorkspaceDirtyFlag = GetCommandManager()->GetWorkspaceDirtyFlag(); + m_oldWorkspaceDirtyFlag = GetCommandManager()->GetWorkspaceDirtyFlag(); GetCommandManager()->SetWorkspaceDirtyFlag(true); // Restore original log levels. @@ -938,10 +938,10 @@ namespace CommandSystem MCORE_UNUSED(parameters); // Get the motion set the command created earlier by id. - EMotionFX::MotionSet* motionSet = EMotionFX::GetMotionManager().FindMotionSetByID(mOldMotionSetID); + EMotionFX::MotionSet* motionSet = EMotionFX::GetMotionManager().FindMotionSetByID(m_oldMotionSetId); if (motionSet == nullptr) { - outResult = AZStd::string::format("Cannot undo load motion set command. Previously used motion set id '%i' is not valid.", mOldMotionSetID); + outResult = AZStd::string::format("Cannot undo load motion set command. Previously used motion set id '%i' is not valid.", m_oldMotionSetId); return false; } @@ -952,7 +952,7 @@ namespace CommandSystem const bool result = GetCommandManager()->ExecuteCommandGroupInsideCommand(commandGroup, outResult); // Restore the workspace dirty flag. - GetCommandManager()->SetWorkspaceDirtyFlag(mOldWorkspaceDirtyFlag); + GetCommandManager()->SetWorkspaceDirtyFlag(m_oldWorkspaceDirtyFlag); return result; } diff --git a/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/MotionSetCommands.h b/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/MotionSetCommands.h index 70f08b1c67..d630f98a45 100644 --- a/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/MotionSetCommands.h +++ b/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/MotionSetCommands.h @@ -40,22 +40,22 @@ namespace CommandSystem ////////////////////////////////////////////////////////////////////////////////////////////////////////// MCORE_DEFINECOMMAND_START(CommandCreateMotionSet, "Create motion set", true) public: - uint32 mPreviouslyUsedID; - bool mOldWorkspaceDirtyFlag; + uint32 m_previouslyUsedId; + bool m_oldWorkspaceDirtyFlag; MCORE_DEFINECOMMAND_END MCORE_DEFINECOMMAND_START(CommandRemoveMotionSet, "Remove motion set", true) public: - AZStd::string mOldName; - AZStd::string mOldFileName; - uint32 mOldParentSetID; - uint32 mPreviouslyUsedID; - bool mOldWorkspaceDirtyFlag; + AZStd::string m_oldName; + AZStd::string m_oldFileName; + uint32 m_oldParentSetId; + uint32 m_previouslyUsedId; + bool m_oldWorkspaceDirtyFlag; MCORE_DEFINECOMMAND_END MCORE_DEFINECOMMAND_START(CommandAdjustMotionSet, "Adjust motion set", true) - AZStd::string mOldSetName; - bool mOldDirtyFlag; + AZStd::string m_oldSetName; + bool m_oldDirtyFlag; MCORE_DEFINECOMMAND_END ////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -73,8 +73,8 @@ namespace CommandSystem MCORE_DEFINECOMMAND_START(CommandMotionSetAdjustMotion, "Adjust motion set", true) public: - AZStd::string mOldIdString; - AZStd::string mOldMotionFilename; + AZStd::string m_oldIdString; + AZStd::string m_oldMotionFilename; void UpdateMotionNodes(const char* oldID, const char* newID); MCORE_DEFINECOMMAND_END @@ -85,8 +85,8 @@ namespace CommandSystem public: using RelocateFilenameFunction = AZStd::function; RelocateFilenameFunction m_relocateFilenameFunction; - uint32 mOldMotionSetID; - bool mOldWorkspaceDirtyFlag; + uint32 m_oldMotionSetId; + bool m_oldWorkspaceDirtyFlag; MCORE_DEFINECOMMAND_END ////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/NodeGroupCommands.cpp b/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/NodeGroupCommands.cpp index ea83d90d4b..c65429ab83 100644 --- a/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/NodeGroupCommands.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/NodeGroupCommands.cpp @@ -264,7 +264,7 @@ namespace CommandSystem actor->AddNodeGroup(nodeGroup); // save the current dirty flag and tell the actor that something got changed - mOldDirtyFlag = actor->GetDirtyFlag(); + m_oldDirtyFlag = actor->GetDirtyFlag(); actor->SetDirtyFlag(true); return true; } @@ -295,7 +295,7 @@ namespace CommandSystem } // set the dirty flag back to the old value - actor->SetDirtyFlag(mOldDirtyFlag); + actor->SetDirtyFlag(m_oldDirtyFlag); return true; } @@ -322,7 +322,7 @@ namespace CommandSystem // constructor CommandRemoveNodeGroup::CommandRemoveNodeGroup(MCore::Command* orgCommand) : MCore::Command("RemoveNodeGroup", orgCommand) - , mOldNodeGroup(nullptr) + , m_oldNodeGroup(nullptr) { } @@ -330,7 +330,7 @@ namespace CommandSystem // destructor CommandRemoveNodeGroup::~CommandRemoveNodeGroup() { - delete mOldNodeGroup; + delete m_oldNodeGroup; } @@ -360,14 +360,14 @@ namespace CommandSystem } // copy the old node group for undo - delete mOldNodeGroup; - mOldNodeGroup = aznew EMotionFX::NodeGroup(*nodeGroup); + delete m_oldNodeGroup; + m_oldNodeGroup = aznew EMotionFX::NodeGroup(*nodeGroup); // remove the node group actor->RemoveNodeGroup(nodeGroup); // save the current dirty flag and tell the actor that something got changed - mOldDirtyFlag = actor->GetDirtyFlag(); + m_oldDirtyFlag = actor->GetDirtyFlag(); actor->SetDirtyFlag(true); return true; } @@ -377,7 +377,7 @@ namespace CommandSystem bool CommandRemoveNodeGroup::Undo(const MCore::CommandLine& parameters, AZStd::string& outResult) { // check if old node group exists - if (!mOldNodeGroup) + if (!m_oldNodeGroup) { return false; } @@ -397,13 +397,13 @@ namespace CommandSystem } // add the node to the group again - if (name == mOldNodeGroup->GetName()) + if (name == m_oldNodeGroup->GetName()) { - actor->AddNodeGroup(aznew EMotionFX::NodeGroup(*mOldNodeGroup)); + actor->AddNodeGroup(aznew EMotionFX::NodeGroup(*m_oldNodeGroup)); } // set the dirty flag back to the old value - actor->SetDirtyFlag(mOldDirtyFlag); + actor->SetDirtyFlag(m_oldDirtyFlag); return true; } diff --git a/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/NodeGroupCommands.h b/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/NodeGroupCommands.h index d29918822d..6c57877bd5 100644 --- a/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/NodeGroupCommands.h +++ b/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/NodeGroupCommands.h @@ -79,14 +79,14 @@ namespace CommandSystem // add node group MCORE_DEFINECOMMAND_START(CommandAddNodeGroup, "Add node group", true) - bool mOldDirtyFlag; + bool m_oldDirtyFlag; MCORE_DEFINECOMMAND_END // remove a node group MCORE_DEFINECOMMAND_START(CommandRemoveNodeGroup, "Remove node group", true) - EMotionFX::NodeGroup * mOldNodeGroup; - bool mOldDirtyFlag; + EMotionFX::NodeGroup * m_oldNodeGroup; + bool m_oldDirtyFlag; MCORE_DEFINECOMMAND_END diff --git a/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/RagdollCommands.cpp b/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/RagdollCommands.cpp index 37657699d4..e51c9ece0b 100644 --- a/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/RagdollCommands.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/RagdollCommands.cpp @@ -90,8 +90,8 @@ namespace EMotionFX const Transform& parentBindTransform = node->GetParentNode() ? bindPose->GetModelSpaceTransform(node->GetParentIndex()) : Transform::CreateIdentity(); - const AZ::Quaternion& nodeBindRotationWorld = nodeBindTransform.mRotation; - const AZ::Quaternion& parentBindRotationWorld = parentBindTransform.mRotation; + const AZ::Quaternion& nodeBindRotationWorld = nodeBindTransform.m_rotation; + const AZ::Quaternion& parentBindRotationWorld = parentBindTransform.m_rotation; AZ::Vector3 boneDirection = GetBoneDirection(skeleton, node); AZStd::vector exampleRotationsLocal; diff --git a/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/SelectionCommands.cpp b/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/SelectionCommands.cpp index 72c7338512..bcc9769c44 100644 --- a/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/SelectionCommands.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/SelectionCommands.cpp @@ -547,7 +547,7 @@ namespace CommandSystem bool CommandSelect::Execute(const MCore::CommandLine& parameters, AZStd::string& outResult) { // store the old selection list for undo - mData = GetCommandManager()->GetCurrentSelection(); + m_data = GetCommandManager()->GetCurrentSelection(); // selection add mode return Select(this, parameters, outResult, false); @@ -561,7 +561,7 @@ namespace CommandSystem MCORE_UNUSED(outResult); // restore the old selection and return success - GetCommandManager()->SetCurrentSelection(mData); + GetCommandManager()->SetCurrentSelection(m_data); return true; } @@ -604,7 +604,7 @@ namespace CommandSystem bool CommandUnselect::Execute(const MCore::CommandLine& parameters, AZStd::string& outResult) { // store the old selection list for undo - mData = GetCommandManager()->GetCurrentSelection(); + m_data = GetCommandManager()->GetCurrentSelection(); // unselect mode return CommandSelect::Select(this, parameters, outResult, true); @@ -618,7 +618,7 @@ namespace CommandSystem MCORE_UNUSED(outResult); // restore the old selection and return success - GetCommandManager()->SetCurrentSelection(mData); + GetCommandManager()->SetCurrentSelection(m_data); return true; } @@ -665,7 +665,7 @@ namespace CommandSystem // get the current selection, store it for the undo function and unselect everything SelectionList& selection = GetCommandManager()->GetCurrentSelection(); - mData = selection; + m_data = selection; // if we are in selection lock mode return directly //if (GetCommandManager()->GetLockSelection()) @@ -686,7 +686,7 @@ namespace CommandSystem MCORE_UNUSED(outResult); // restore the old selection and return success - GetCommandManager()->SetCurrentSelection(mData); + GetCommandManager()->SetCurrentSelection(m_data); return true; } @@ -721,10 +721,10 @@ namespace CommandSystem MCORE_UNUSED(outResult); // store the selection locked flag for the undo function - mData = GetCommandManager()->GetLockSelection(); + m_data = GetCommandManager()->GetLockSelection(); // toggle the flag - GetCommandManager()->SetLockSelection(!mData); + GetCommandManager()->SetLockSelection(!m_data); return true; } @@ -737,7 +737,7 @@ namespace CommandSystem MCORE_UNUSED(outResult); // restore the old selection locked flag and return success - GetCommandManager()->SetLockSelection(mData); + GetCommandManager()->SetLockSelection(m_data); return true; } diff --git a/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/SelectionCommands.h b/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/SelectionCommands.h index 0c1fad6588..13a39e5e8a 100644 --- a/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/SelectionCommands.h +++ b/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/SelectionCommands.h @@ -19,7 +19,7 @@ namespace CommandSystem { MCORE_DEFINECOMMAND_START(CommandSelect, "Select object", true) - SelectionList mData; + SelectionList m_data; public: static const char* s_SelectCmdName; static bool Select(MCore::Command* command, const MCore::CommandLine& parameters, AZStd::string& outResult, bool unselect); diff --git a/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/SelectionList.cpp b/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/SelectionList.cpp index 5910ae84f7..e115c24221 100644 --- a/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/SelectionList.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/SelectionList.cpp @@ -27,39 +27,39 @@ namespace CommandSystem size_t SelectionList::GetNumTotalItems() const { - return mSelectedNodes.size() + - mSelectedActors.size() + - mSelectedActorInstances.size() + - mSelectedMotions.size() + - mSelectedMotionInstances.size() + - mSelectedAnimGraphs.size(); + return m_selectedNodes.size() + + m_selectedActors.size() + + m_selectedActorInstances.size() + + m_selectedMotions.size() + + m_selectedMotionInstances.size() + + m_selectedAnimGraphs.size(); } bool SelectionList::GetIsEmpty() const { - return (mSelectedNodes.empty() && - mSelectedActors.empty() && - mSelectedActorInstances.empty() && - mSelectedMotions.empty() && - mSelectedMotionInstances.empty() && - mSelectedAnimGraphs.empty()); + return (m_selectedNodes.empty() && + m_selectedActors.empty() && + m_selectedActorInstances.empty() && + m_selectedMotions.empty() && + m_selectedMotionInstances.empty() && + m_selectedAnimGraphs.empty()); } void SelectionList::Clear() { - mSelectedNodes.clear(); - mSelectedActors.clear(); - mSelectedActorInstances.clear(); - mSelectedMotions.clear(); - mSelectedMotionInstances.clear(); - mSelectedAnimGraphs.clear(); + m_selectedNodes.clear(); + m_selectedActors.clear(); + m_selectedActorInstances.clear(); + m_selectedMotions.clear(); + m_selectedMotionInstances.clear(); + m_selectedAnimGraphs.clear(); } void SelectionList::AddNode(EMotionFX::Node* node) { if (!CheckIfHasNode(node)) { - mSelectedNodes.emplace_back(node); + m_selectedNodes.emplace_back(node); } } @@ -67,7 +67,7 @@ namespace CommandSystem { if (!CheckIfHasActor(actor)) { - mSelectedActors.emplace_back(actor); + m_selectedActors.emplace_back(actor); } } @@ -76,7 +76,7 @@ namespace CommandSystem { if (!CheckIfHasActorInstance(actorInstance)) { - mSelectedActorInstances.emplace_back(actorInstance); + m_selectedActorInstances.emplace_back(actorInstance); } } @@ -86,7 +86,7 @@ namespace CommandSystem { if (!CheckIfHasMotion(motion)) { - mSelectedMotions.emplace_back(motion); + m_selectedMotions.emplace_back(motion); } } @@ -96,7 +96,7 @@ namespace CommandSystem { if (!CheckIfHasMotionInstance(motionInstance)) { - mSelectedMotionInstances.emplace_back(motionInstance); + m_selectedMotionInstances.emplace_back(motionInstance); } } @@ -106,7 +106,7 @@ namespace CommandSystem { if (!CheckIfHasAnimGraph(animGraph)) { - mSelectedAnimGraphs.emplace_back(animGraph); + m_selectedAnimGraphs.emplace_back(animGraph); } } @@ -209,52 +209,52 @@ namespace CommandSystem void SelectionList::RemoveNode(EMotionFX::Node* node) { - mSelectedNodes.erase(AZStd::remove(mSelectedNodes.begin(), mSelectedNodes.end(), node), mSelectedNodes.end()); + m_selectedNodes.erase(AZStd::remove(m_selectedNodes.begin(), m_selectedNodes.end(), node), m_selectedNodes.end()); } void SelectionList::RemoveActor(EMotionFX::Actor* actor) { - mSelectedActors.erase(AZStd::remove(mSelectedActors.begin(), mSelectedActors.end(), actor), mSelectedActors.end()); + m_selectedActors.erase(AZStd::remove(m_selectedActors.begin(), m_selectedActors.end(), actor), m_selectedActors.end()); } // remove the actor from the selection list void SelectionList::RemoveActorInstance(EMotionFX::ActorInstance* actorInstance) { - mSelectedActorInstances.erase(AZStd::remove(mSelectedActorInstances.begin(), mSelectedActorInstances.end(), actorInstance), mSelectedActorInstances.end()); + m_selectedActorInstances.erase(AZStd::remove(m_selectedActorInstances.begin(), m_selectedActorInstances.end(), actorInstance), m_selectedActorInstances.end()); } // remove the motion from the selection list void SelectionList::RemoveMotion(EMotionFX::Motion* motion) { - mSelectedMotions.erase(AZStd::remove(mSelectedMotions.begin(), mSelectedMotions.end(), motion), mSelectedMotions.end()); + m_selectedMotions.erase(AZStd::remove(m_selectedMotions.begin(), m_selectedMotions.end(), motion), m_selectedMotions.end()); } // remove the motion instance from the selection list void SelectionList::RemoveMotionInstance(EMotionFX::MotionInstance* motionInstance) { - mSelectedMotionInstances.erase(AZStd::remove(mSelectedMotionInstances.begin(), mSelectedMotionInstances.end(), motionInstance), mSelectedMotionInstances.end()); + m_selectedMotionInstances.erase(AZStd::remove(m_selectedMotionInstances.begin(), m_selectedMotionInstances.end(), motionInstance), m_selectedMotionInstances.end()); } // remove the anim graph void SelectionList::RemoveAnimGraph(EMotionFX::AnimGraph* animGraph) { - mSelectedAnimGraphs.erase(AZStd::remove(mSelectedAnimGraphs.begin(), mSelectedAnimGraphs.end(), animGraph), mSelectedAnimGraphs.end()); + m_selectedAnimGraphs.erase(AZStd::remove(m_selectedAnimGraphs.begin(), m_selectedAnimGraphs.end(), animGraph), m_selectedAnimGraphs.end()); } // make the selection valid void SelectionList::MakeValid() { // iterate through all actor instances and remove the invalid ones - for (size_t i = 0; i < mSelectedActorInstances.size();) + for (size_t i = 0; i < m_selectedActorInstances.size();) { - EMotionFX::ActorInstance* actorInstance = mSelectedActorInstances[i]; + EMotionFX::ActorInstance* actorInstance = m_selectedActorInstances[i]; if (EMotionFX::GetActorManager().CheckIfIsActorInstanceRegistered(actorInstance) == false) { - mSelectedActorInstances.erase(mSelectedActorInstances.begin() + i); + m_selectedActorInstances.erase(m_selectedActorInstances.begin() + i); } else { @@ -263,13 +263,13 @@ namespace CommandSystem } // iterate through all anim graphs and remove all valid ones - for (size_t i = 0; i < mSelectedAnimGraphs.size();) + for (size_t i = 0; i < m_selectedAnimGraphs.size();) { - EMotionFX::AnimGraph* animGraph = mSelectedAnimGraphs[i]; + EMotionFX::AnimGraph* animGraph = m_selectedAnimGraphs[i]; if (EMotionFX::GetAnimGraphManager().FindAnimGraphIndex(animGraph) == MCORE_INVALIDINDEX32) { - mSelectedAnimGraphs.erase(mSelectedAnimGraphs.begin() + i); + m_selectedAnimGraphs.erase(m_selectedAnimGraphs.begin() + i); } else { @@ -294,7 +294,7 @@ namespace CommandSystem return nullptr; } - return mSelectedActors[0]; + return m_selectedActors[0]; } @@ -313,7 +313,7 @@ namespace CommandSystem return nullptr; } - EMotionFX::ActorInstance* actorInstance = mSelectedActorInstances[0]; + EMotionFX::ActorInstance* actorInstance = m_selectedActorInstances[0]; if (!actorInstance) { return nullptr; @@ -324,7 +324,7 @@ namespace CommandSystem return nullptr; } - return mSelectedActorInstances[0]; + return m_selectedActorInstances[0]; } @@ -341,7 +341,7 @@ namespace CommandSystem return nullptr; } - EMotionFX::Motion* motion = mSelectedMotions[0]; + EMotionFX::Motion* motion = m_selectedMotions[0]; if (!motion) { return nullptr; diff --git a/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/SelectionList.h b/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/SelectionList.h index 6dd1d2d4e2..ce53a1378f 100644 --- a/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/SelectionList.h +++ b/Gems/EMotionFX/Code/EMotionFX/CommandSystem/Source/SelectionList.h @@ -45,36 +45,36 @@ namespace CommandSystem * Get the number of selected nodes. * @return The number of selected nodes. */ - MCORE_INLINE size_t GetNumSelectedNodes() const { return mSelectedNodes.size(); } + MCORE_INLINE size_t GetNumSelectedNodes() const { return m_selectedNodes.size(); } /** * Get the number of selected actors */ - MCORE_INLINE size_t GetNumSelectedActors() const { return mSelectedActors.size(); } + MCORE_INLINE size_t GetNumSelectedActors() const { return m_selectedActors.size(); } /** * Get the number of selected actor instances. * @return The number of selected actor instances. */ - MCORE_INLINE size_t GetNumSelectedActorInstances() const { return mSelectedActorInstances.size(); } + MCORE_INLINE size_t GetNumSelectedActorInstances() const { return m_selectedActorInstances.size(); } /** * Get the number of selected motion instances. * @return The number of selected motion instances. */ - MCORE_INLINE size_t GetNumSelectedMotionInstances() const { return mSelectedMotionInstances.size(); } + MCORE_INLINE size_t GetNumSelectedMotionInstances() const { return m_selectedMotionInstances.size(); } /** * Get the number of selected motions. * @return The number of selected motions. */ - MCORE_INLINE size_t GetNumSelectedMotions() const { return mSelectedMotions.size(); } + MCORE_INLINE size_t GetNumSelectedMotions() const { return m_selectedMotions.size(); } /** * Get the number of selected anim graphs. * @return The number of selected anim graphs. */ - MCORE_INLINE size_t GetNumSelectedAnimGraphs() const { return mSelectedAnimGraphs.size(); } + MCORE_INLINE size_t GetNumSelectedAnimGraphs() const { return m_selectedAnimGraphs.size(); } /** * Get the total number of selected objects. @@ -139,7 +139,7 @@ namespace CommandSystem * @param index The index of the node to get from the selection list. * @return A pointer to the given node from the selection list. */ - MCORE_INLINE EMotionFX::Node* GetNode(size_t index) const { return mSelectedNodes[index]; } + MCORE_INLINE EMotionFX::Node* GetNode(size_t index) const { return m_selectedNodes[index]; } /** * Get the first node from the selection list. @@ -147,11 +147,11 @@ namespace CommandSystem */ MCORE_INLINE EMotionFX::Node* GetFirstNode() const { - if (mSelectedNodes.empty()) + if (m_selectedNodes.empty()) { return nullptr; } - return mSelectedNodes[0]; + return m_selectedNodes[0]; } /** @@ -159,7 +159,7 @@ namespace CommandSystem * @param index The index of the actor to get from the selection list. * @return A pointer to the given actor from the selection list. */ - MCORE_INLINE EMotionFX::Actor* GetActor(size_t index) const { return mSelectedActors[index]; } + MCORE_INLINE EMotionFX::Actor* GetActor(size_t index) const { return m_selectedActors[index]; } /** * Get the first actor from the selection list. @@ -167,11 +167,11 @@ namespace CommandSystem */ MCORE_INLINE EMotionFX::Actor* GetFirstActor() const { - if (mSelectedActors.empty()) + if (m_selectedActors.empty()) { return nullptr; } - return mSelectedActors[0]; + return m_selectedActors[0]; } /** @@ -179,7 +179,7 @@ namespace CommandSystem * @param index The index of the actor instance to get from the selection list. * @return A pointer to the given actor instance from the selection list. */ - MCORE_INLINE EMotionFX::ActorInstance* GetActorInstance(size_t index) const { return mSelectedActorInstances[index]; } + MCORE_INLINE EMotionFX::ActorInstance* GetActorInstance(size_t index) const { return m_selectedActorInstances[index]; } /** * Get the first actor instance from the selection list. @@ -187,11 +187,11 @@ namespace CommandSystem */ MCORE_INLINE EMotionFX::ActorInstance* GetFirstActorInstance() const { - if (mSelectedActorInstances.empty()) + if (m_selectedActorInstances.empty()) { return nullptr; } - return mSelectedActorInstances[0]; + return m_selectedActorInstances[0]; } /** @@ -199,7 +199,7 @@ namespace CommandSystem * @param index The index of the anim graph to get from the selection list. * @return A pointer to the given anim graph from the selection list. */ - MCORE_INLINE EMotionFX::AnimGraph* GetAnimGraph(size_t index) const { return mSelectedAnimGraphs[index]; } + MCORE_INLINE EMotionFX::AnimGraph* GetAnimGraph(size_t index) const { return m_selectedAnimGraphs[index]; } /** * Get the first anim graph from the selection list. @@ -207,11 +207,11 @@ namespace CommandSystem */ MCORE_INLINE EMotionFX::AnimGraph* GetFirstAnimGraph() const { - if (mSelectedAnimGraphs.empty()) + if (m_selectedAnimGraphs.empty()) { return nullptr; } - return mSelectedAnimGraphs[0]; + return m_selectedAnimGraphs[0]; } /** @@ -231,7 +231,7 @@ namespace CommandSystem * @param index The index of the motion to get from the selection list. * @return A pointer to the given motion from the selection list. */ - MCORE_INLINE EMotionFX::Motion* GetMotion(size_t index) const { return mSelectedMotions[index]; } + MCORE_INLINE EMotionFX::Motion* GetMotion(size_t index) const { return m_selectedMotions[index]; } /** * Get the first motion from the selection list. @@ -239,11 +239,11 @@ namespace CommandSystem */ MCORE_INLINE EMotionFX::Motion* GetFirstMotion() const { - if (mSelectedMotions.empty()) + if (m_selectedMotions.empty()) { return nullptr; } - return mSelectedMotions[0]; + return m_selectedMotions[0]; } /** @@ -257,7 +257,7 @@ namespace CommandSystem * @param index The index of the motion instance to get from the selection list. * @return A pointer to the given motion instance from the selection list. */ - MCORE_INLINE EMotionFX::MotionInstance* GetMotionInstance(size_t index) const { return mSelectedMotionInstances[index]; } + MCORE_INLINE EMotionFX::MotionInstance* GetMotionInstance(size_t index) const { return m_selectedMotionInstances[index]; } /** * Get the first motion instance from the selection list. @@ -265,48 +265,48 @@ namespace CommandSystem */ MCORE_INLINE EMotionFX::MotionInstance* GetFirstMotionInstance() const { - if (mSelectedMotionInstances.empty()) + if (m_selectedMotionInstances.empty()) { return nullptr; } - return mSelectedMotionInstances[0]; + return m_selectedMotionInstances[0]; } /** * Remove the given node from the selection list. * @param index The index of the node to be removed from the selection list. */ - MCORE_INLINE void RemoveNode(size_t index) { mSelectedNodes.erase(mSelectedNodes.begin() + index); } + MCORE_INLINE void RemoveNode(size_t index) { m_selectedNodes.erase(m_selectedNodes.begin() + index); } /** * Remove the given actor instance from the selection list. * @param index The index of the actor instance to be removed from the selection list. */ - MCORE_INLINE void RemoveActor(size_t index) { mSelectedActors.erase(mSelectedActors.begin() + index); } + MCORE_INLINE void RemoveActor(size_t index) { m_selectedActors.erase(m_selectedActors.begin() + index); } /** * Remove the given actor instance from the selection list. * @param index The index of the actor instance to be removed from the selection list. */ - MCORE_INLINE void RemoveActorInstance(size_t index) { mSelectedActorInstances.erase(mSelectedActorInstances.begin() + index); } + MCORE_INLINE void RemoveActorInstance(size_t index) { m_selectedActorInstances.erase(m_selectedActorInstances.begin() + index); } /** * Remove the given motion from the selection list. * @param index The index of the motion to be removed from the selection list. */ - MCORE_INLINE void RemoveMotion(size_t index) { mSelectedMotions.erase(mSelectedMotions.begin() + index); } + MCORE_INLINE void RemoveMotion(size_t index) { m_selectedMotions.erase(m_selectedMotions.begin() + index); } /** * Remove the given motion instance from the selection list. * @param index The index of the motion instance to be removed from the selection list. */ - MCORE_INLINE void RemoveMotionInstance(size_t index) { mSelectedMotionInstances.erase(mSelectedMotionInstances.begin() + index); } + MCORE_INLINE void RemoveMotionInstance(size_t index) { m_selectedMotionInstances.erase(m_selectedMotionInstances.begin() + index); } /** * Remove the given anim graph from the selection list. * @param index The index of the anim graph to remove from the selection list. */ - MCORE_INLINE void RemoveAnimGraph(size_t index) { mSelectedAnimGraphs.erase(mSelectedAnimGraphs.begin() + index); } + MCORE_INLINE void RemoveAnimGraph(size_t index) { m_selectedAnimGraphs.erase(m_selectedAnimGraphs.begin() + index); } /** * Remove the given node from the selection list. @@ -349,47 +349,47 @@ namespace CommandSystem * @param node A pointer to the node to be checked. * @return True if the node is inside this selection list, false if not. */ - MCORE_INLINE bool CheckIfHasNode(EMotionFX::Node* node) const { return(AZStd::find(mSelectedNodes.begin(), mSelectedNodes.end(), node) != mSelectedNodes.end()); } + MCORE_INLINE bool CheckIfHasNode(EMotionFX::Node* node) const { return(AZStd::find(m_selectedNodes.begin(), m_selectedNodes.end(), node) != m_selectedNodes.end()); } /** * Has actor */ - MCORE_INLINE bool CheckIfHasActor(EMotionFX::Actor* actor) const { return (AZStd::find(mSelectedActors.begin(), mSelectedActors.end(), actor) != mSelectedActors.end()); } + MCORE_INLINE bool CheckIfHasActor(EMotionFX::Actor* actor) const { return (AZStd::find(m_selectedActors.begin(), m_selectedActors.end(), actor) != m_selectedActors.end()); } /** * Check if a given actor instance is selected / is in this selection list. * @param node A pointer to the actor instance to be checked. * @return True if the actor instance is inside this selection list, false if not. */ - MCORE_INLINE bool CheckIfHasActorInstance(EMotionFX::ActorInstance* actorInstance) const { return (AZStd::find(mSelectedActorInstances.begin(), mSelectedActorInstances.end(), actorInstance) != mSelectedActorInstances.end()); } + MCORE_INLINE bool CheckIfHasActorInstance(EMotionFX::ActorInstance* actorInstance) const { return (AZStd::find(m_selectedActorInstances.begin(), m_selectedActorInstances.end(), actorInstance) != m_selectedActorInstances.end()); } /** * Check if a given motion is selected / is in this selection list. * @param node A pointer to the motion to be checked. * @return True if the motion is inside this selection list, false if not. */ - MCORE_INLINE bool CheckIfHasMotion(EMotionFX::Motion* motion) const { return (AZStd::find(mSelectedMotions.begin(), mSelectedMotions.end(), motion) != mSelectedMotions.end()); } + MCORE_INLINE bool CheckIfHasMotion(EMotionFX::Motion* motion) const { return (AZStd::find(m_selectedMotions.begin(), m_selectedMotions.end(), motion) != m_selectedMotions.end()); } /** * Check if a given anim graph is in this selection list. * @param animGraph The anim graph to check for. * @return True if the anim graph is selected inside the selection list, otherwise false is returned. */ - MCORE_INLINE bool CheckIfHasAnimGraph(EMotionFX::AnimGraph* animGraph) const { return (AZStd::find(mSelectedAnimGraphs.begin(), mSelectedAnimGraphs.end(), animGraph) != mSelectedAnimGraphs.end()); } + MCORE_INLINE bool CheckIfHasAnimGraph(EMotionFX::AnimGraph* animGraph) const { return (AZStd::find(m_selectedAnimGraphs.begin(), m_selectedAnimGraphs.end(), animGraph) != m_selectedAnimGraphs.end()); } /** * Check if a given motion instance is selected / is in this selection list. * @param node A pointer to the motion instance to be checked. * @return True if the motion instance is inside this selection list, false if not. */ - MCORE_INLINE bool CheckIfHasMotionInstance(EMotionFX::MotionInstance* motionInstance) const { return (AZStd::find(mSelectedMotionInstances.begin(), mSelectedMotionInstances.end(), motionInstance) != mSelectedMotionInstances.end()); } + MCORE_INLINE bool CheckIfHasMotionInstance(EMotionFX::MotionInstance* motionInstance) const { return (AZStd::find(m_selectedMotionInstances.begin(), m_selectedMotionInstances.end(), motionInstance) != m_selectedMotionInstances.end()); } - MCORE_INLINE void ClearActorSelection() { mSelectedActors.clear(); } - MCORE_INLINE void ClearActorInstanceSelection() { mSelectedActorInstances.clear(); } - MCORE_INLINE void ClearNodeSelection() { mSelectedNodes.clear(); } - MCORE_INLINE void ClearMotionSelection() { mSelectedMotions.clear(); } - MCORE_INLINE void ClearMotionInstanceSelection() { mSelectedMotionInstances.clear(); } - MCORE_INLINE void ClearAnimGraphSelection() { mSelectedAnimGraphs.clear(); } + MCORE_INLINE void ClearActorSelection() { m_selectedActors.clear(); } + MCORE_INLINE void ClearActorInstanceSelection() { m_selectedActorInstances.clear(); } + MCORE_INLINE void ClearNodeSelection() { m_selectedNodes.clear(); } + MCORE_INLINE void ClearMotionSelection() { m_selectedMotions.clear(); } + MCORE_INLINE void ClearMotionInstanceSelection() { m_selectedMotionInstances.clear(); } + MCORE_INLINE void ClearAnimGraphSelection() { m_selectedAnimGraphs.clear(); } void Log(); void MakeValid(); @@ -401,11 +401,11 @@ namespace CommandSystem // ActorInstanceNotificationBus overrides void OnActorInstanceDestroyed(EMotionFX::ActorInstance* actorInstance) override; - AZStd::vector mSelectedNodes; /**< Array of selected nodes. */ - AZStd::vector mSelectedActors; /**< The selected actors. */ - AZStd::vector mSelectedActorInstances; /**< Array of selected actor instances. */ - AZStd::vector mSelectedMotionInstances; /**< Array of selected motion instances. */ - AZStd::vector mSelectedMotions; /**< Array of selected motions. */ - AZStd::vector mSelectedAnimGraphs; /**< Array of selected anim graphs. */ + AZStd::vector m_selectedNodes; /**< Array of selected nodes. */ + AZStd::vector m_selectedActors; /**< The selected actors. */ + AZStd::vector m_selectedActorInstances; /**< Array of selected actor instances. */ + AZStd::vector m_selectedMotionInstances; /**< Array of selected motion instances. */ + AZStd::vector m_selectedMotions; /**< Array of selected motions. */ + AZStd::vector m_selectedAnimGraphs; /**< Array of selected anim graphs. */ }; } // namespace CommandSystem diff --git a/Gems/EMotionFX/Code/EMotionFX/Exporters/ExporterLib/Exporter/EndianConversion.cpp b/Gems/EMotionFX/Code/EMotionFX/Exporters/ExporterLib/Exporter/EndianConversion.cpp index 153ec6e701..064c786b0a 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Exporters/ExporterLib/Exporter/EndianConversion.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Exporters/ExporterLib/Exporter/EndianConversion.cpp @@ -14,15 +14,15 @@ namespace ExporterLib { void CopyVector2(EMotionFX::FileFormat::FileVector2& to, const AZ::Vector2& from) { - to.mX = from.GetX(); - to.mY = from.GetY(); + to.m_x = from.GetX(); + to.m_y = from.GetY(); } void CopyVector(EMotionFX::FileFormat::FileVector3& to, const AZ::PackedVector3f& from) { - to.mX = from.GetX(); - to.mY = from.GetY(); - to.mZ = from.GetZ(); + to.m_x = from.GetX(); + to.m_y = from.GetY(); + to.m_z = from.GetZ(); } void CopyQuaternion(EMotionFX::FileFormat::FileQuaternion& to, const AZ::Quaternion& from) @@ -33,10 +33,10 @@ namespace ExporterLib q = -q; } - to.mX = q.GetX(); - to.mY = q.GetY(); - to.mZ = q.GetZ(); - to.mW = q.GetW(); + to.m_x = q.GetX(); + to.m_y = q.GetY(); + to.m_z = q.GetZ(); + to.m_w = q.GetW(); } @@ -49,37 +49,37 @@ namespace ExporterLib } const MCore::Compressed16BitQuaternion compressedQuat(q); - to.mX = compressedQuat.mX; - to.mY = compressedQuat.mY; - to.mZ = compressedQuat.mZ; - to.mW = compressedQuat.mW; + to.m_x = compressedQuat.m_x; + to.m_y = compressedQuat.m_y; + to.m_z = compressedQuat.m_z; + to.m_w = compressedQuat.m_w; } void Copy16BitQuaternion(EMotionFX::FileFormat::File16BitQuaternion& to, const MCore::Compressed16BitQuaternion& from) { MCore::Compressed16BitQuaternion q = from; - if (q.mW < 0) + if (q.m_w < 0) { - q.mX = -q.mX; - q.mY = -q.mY; - q.mZ = -q.mZ; - q.mW = -q.mW; + q.m_x = -q.m_x; + q.m_y = -q.m_y; + q.m_z = -q.m_z; + q.m_w = -q.m_w; } - to.mX = q.mX; - to.mY = q.mY; - to.mZ = q.mZ; - to.mW = q.mW; + to.m_x = q.m_x; + to.m_y = q.m_y; + to.m_z = q.m_z; + to.m_w = q.m_w; } void CopyColor(const MCore::RGBAColor& from, EMotionFX::FileFormat::FileColor& to) { - to.mR = from.r; - to.mG = from.g; - to.mB = from.b; - to.mA = from.a; + to.m_r = from.m_r; + to.m_g = from.m_g; + to.m_b = from.m_b; + to.m_a = from.m_a; } @@ -114,87 +114,87 @@ namespace ExporterLib void ConvertFileChunk(EMotionFX::FileFormat::FileChunk* value, MCore::Endian::EEndianType targetEndianType) { - MCore::Endian::ConvertUnsignedInt32(&value->mChunkID, EXPLIB_PLATFORM_ENDIAN, targetEndianType); - MCore::Endian::ConvertUnsignedInt32(&value->mSizeInBytes, EXPLIB_PLATFORM_ENDIAN, targetEndianType); - MCore::Endian::ConvertUnsignedInt32(&value->mVersion, EXPLIB_PLATFORM_ENDIAN, targetEndianType); + MCore::Endian::ConvertUnsignedInt32(&value->m_chunkId, EXPLIB_PLATFORM_ENDIAN, targetEndianType); + MCore::Endian::ConvertUnsignedInt32(&value->m_sizeInBytes, EXPLIB_PLATFORM_ENDIAN, targetEndianType); + MCore::Endian::ConvertUnsignedInt32(&value->m_version, EXPLIB_PLATFORM_ENDIAN, targetEndianType); } void ConvertFileColor(EMotionFX::FileFormat::FileColor* value, MCore::Endian::EEndianType targetEndianType) { - MCore::Endian::ConvertFloat(&value->mR, EXPLIB_PLATFORM_ENDIAN, targetEndianType); - MCore::Endian::ConvertFloat(&value->mG, EXPLIB_PLATFORM_ENDIAN, targetEndianType); - MCore::Endian::ConvertFloat(&value->mB, EXPLIB_PLATFORM_ENDIAN, targetEndianType); - MCore::Endian::ConvertFloat(&value->mA, EXPLIB_PLATFORM_ENDIAN, targetEndianType); + MCore::Endian::ConvertFloat(&value->m_r, EXPLIB_PLATFORM_ENDIAN, targetEndianType); + MCore::Endian::ConvertFloat(&value->m_g, EXPLIB_PLATFORM_ENDIAN, targetEndianType); + MCore::Endian::ConvertFloat(&value->m_b, EXPLIB_PLATFORM_ENDIAN, targetEndianType); + MCore::Endian::ConvertFloat(&value->m_a, EXPLIB_PLATFORM_ENDIAN, targetEndianType); } void ConvertFileVector2(EMotionFX::FileFormat::FileVector2* value, MCore::Endian::EEndianType targetEndianType) { - MCore::Endian::ConvertFloat(&value->mX, EXPLIB_PLATFORM_ENDIAN, targetEndianType); - MCore::Endian::ConvertFloat(&value->mY, EXPLIB_PLATFORM_ENDIAN, targetEndianType); + MCore::Endian::ConvertFloat(&value->m_x, EXPLIB_PLATFORM_ENDIAN, targetEndianType); + MCore::Endian::ConvertFloat(&value->m_y, EXPLIB_PLATFORM_ENDIAN, targetEndianType); } void ConvertFileVector3(EMotionFX::FileFormat::FileVector3* value, MCore::Endian::EEndianType targetEndianType) { - MCore::Endian::ConvertFloat(&value->mX, EXPLIB_PLATFORM_ENDIAN, targetEndianType); - MCore::Endian::ConvertFloat(&value->mY, EXPLIB_PLATFORM_ENDIAN, targetEndianType); - MCore::Endian::ConvertFloat(&value->mZ, EXPLIB_PLATFORM_ENDIAN, targetEndianType); + MCore::Endian::ConvertFloat(&value->m_x, EXPLIB_PLATFORM_ENDIAN, targetEndianType); + MCore::Endian::ConvertFloat(&value->m_y, EXPLIB_PLATFORM_ENDIAN, targetEndianType); + MCore::Endian::ConvertFloat(&value->m_z, EXPLIB_PLATFORM_ENDIAN, targetEndianType); } void ConvertFile16BitVector3(EMotionFX::FileFormat::File16BitVector3* value, MCore::Endian::EEndianType targetEndianType) { - MCore::Endian::ConvertUnsignedInt16(&value->mX, EXPLIB_PLATFORM_ENDIAN, targetEndianType); - MCore::Endian::ConvertUnsignedInt16(&value->mY, EXPLIB_PLATFORM_ENDIAN, targetEndianType); - MCore::Endian::ConvertUnsignedInt16(&value->mZ, EXPLIB_PLATFORM_ENDIAN, targetEndianType); + MCore::Endian::ConvertUnsignedInt16(&value->m_x, EXPLIB_PLATFORM_ENDIAN, targetEndianType); + MCore::Endian::ConvertUnsignedInt16(&value->m_y, EXPLIB_PLATFORM_ENDIAN, targetEndianType); + MCore::Endian::ConvertUnsignedInt16(&value->m_z, EXPLIB_PLATFORM_ENDIAN, targetEndianType); } void ConvertFileQuaternion(EMotionFX::FileFormat::FileQuaternion* value, MCore::Endian::EEndianType targetEndianType) { - MCore::Endian::ConvertFloat(&value->mX, EXPLIB_PLATFORM_ENDIAN, targetEndianType); - MCore::Endian::ConvertFloat(&value->mY, EXPLIB_PLATFORM_ENDIAN, targetEndianType); - MCore::Endian::ConvertFloat(&value->mZ, EXPLIB_PLATFORM_ENDIAN, targetEndianType); - MCore::Endian::ConvertFloat(&value->mW, EXPLIB_PLATFORM_ENDIAN, targetEndianType); + MCore::Endian::ConvertFloat(&value->m_x, EXPLIB_PLATFORM_ENDIAN, targetEndianType); + MCore::Endian::ConvertFloat(&value->m_y, EXPLIB_PLATFORM_ENDIAN, targetEndianType); + MCore::Endian::ConvertFloat(&value->m_z, EXPLIB_PLATFORM_ENDIAN, targetEndianType); + MCore::Endian::ConvertFloat(&value->m_w, EXPLIB_PLATFORM_ENDIAN, targetEndianType); } void ConvertFile16BitQuaternion(EMotionFX::FileFormat::File16BitQuaternion* value, MCore::Endian::EEndianType targetEndianType) { - MCore::Endian::ConvertSignedInt16(&value->mX, EXPLIB_PLATFORM_ENDIAN, targetEndianType); - MCore::Endian::ConvertSignedInt16(&value->mY, EXPLIB_PLATFORM_ENDIAN, targetEndianType); - MCore::Endian::ConvertSignedInt16(&value->mZ, EXPLIB_PLATFORM_ENDIAN, targetEndianType); - MCore::Endian::ConvertSignedInt16(&value->mW, EXPLIB_PLATFORM_ENDIAN, targetEndianType); + MCore::Endian::ConvertSignedInt16(&value->m_x, EXPLIB_PLATFORM_ENDIAN, targetEndianType); + MCore::Endian::ConvertSignedInt16(&value->m_y, EXPLIB_PLATFORM_ENDIAN, targetEndianType); + MCore::Endian::ConvertSignedInt16(&value->m_z, EXPLIB_PLATFORM_ENDIAN, targetEndianType); + MCore::Endian::ConvertSignedInt16(&value->m_w, EXPLIB_PLATFORM_ENDIAN, targetEndianType); } void ConvertFileMotionEvent(EMotionFX::FileFormat::FileMotionEvent* value, MCore::Endian::EEndianType targetEndianType) { - MCore::Endian::ConvertFloat(&value->mStartTime, EXPLIB_PLATFORM_ENDIAN, targetEndianType); - MCore::Endian::ConvertFloat(&value->mEndTime, EXPLIB_PLATFORM_ENDIAN, targetEndianType); - MCore::Endian::ConvertUnsignedInt32(&value->mEventTypeIndex, EXPLIB_PLATFORM_ENDIAN, targetEndianType); - MCore::Endian::ConvertUnsignedInt32(&value->mMirrorTypeIndex, EXPLIB_PLATFORM_ENDIAN, targetEndianType); - MCore::Endian::ConvertUnsignedInt16(&value->mParamIndex, EXPLIB_PLATFORM_ENDIAN, targetEndianType); + MCore::Endian::ConvertFloat(&value->m_startTime, EXPLIB_PLATFORM_ENDIAN, targetEndianType); + MCore::Endian::ConvertFloat(&value->m_endTime, EXPLIB_PLATFORM_ENDIAN, targetEndianType); + MCore::Endian::ConvertUnsignedInt32(&value->m_eventTypeIndex, EXPLIB_PLATFORM_ENDIAN, targetEndianType); + MCore::Endian::ConvertUnsignedInt32(&value->m_mirrorTypeIndex, EXPLIB_PLATFORM_ENDIAN, targetEndianType); + MCore::Endian::ConvertUnsignedInt16(&value->m_paramIndex, EXPLIB_PLATFORM_ENDIAN, targetEndianType); } void ConvertFileMotionEventTable(EMotionFX::FileFormat::FileMotionEventTrack* value, MCore::Endian::EEndianType targetEndianType) { - MCore::Endian::ConvertUnsignedInt32(&value->mNumEvents, EXPLIB_PLATFORM_ENDIAN, targetEndianType); - MCore::Endian::ConvertUnsignedInt32(&value->mNumTypeStrings, EXPLIB_PLATFORM_ENDIAN, targetEndianType); - MCore::Endian::ConvertUnsignedInt32(&value->mNumParamStrings, EXPLIB_PLATFORM_ENDIAN, targetEndianType); - MCore::Endian::ConvertUnsignedInt32(&value->mNumMirrorTypeStrings, EXPLIB_PLATFORM_ENDIAN, targetEndianType); + MCore::Endian::ConvertUnsignedInt32(&value->m_numEvents, EXPLIB_PLATFORM_ENDIAN, targetEndianType); + MCore::Endian::ConvertUnsignedInt32(&value->m_numTypeStrings, EXPLIB_PLATFORM_ENDIAN, targetEndianType); + MCore::Endian::ConvertUnsignedInt32(&value->m_numParamStrings, EXPLIB_PLATFORM_ENDIAN, targetEndianType); + MCore::Endian::ConvertUnsignedInt32(&value->m_numMirrorTypeStrings, EXPLIB_PLATFORM_ENDIAN, targetEndianType); } void ConvertRGBAColor(MCore::RGBAColor* value, MCore::Endian::EEndianType targetEndianType) { - MCore::Endian::ConvertFloat(&value->r, EXPLIB_PLATFORM_ENDIAN, targetEndianType); - MCore::Endian::ConvertFloat(&value->g, EXPLIB_PLATFORM_ENDIAN, targetEndianType); - MCore::Endian::ConvertFloat(&value->b, EXPLIB_PLATFORM_ENDIAN, targetEndianType); - MCore::Endian::ConvertFloat(&value->a, EXPLIB_PLATFORM_ENDIAN, targetEndianType); + MCore::Endian::ConvertFloat(&value->m_r, EXPLIB_PLATFORM_ENDIAN, targetEndianType); + MCore::Endian::ConvertFloat(&value->m_g, EXPLIB_PLATFORM_ENDIAN, targetEndianType); + MCore::Endian::ConvertFloat(&value->m_b, EXPLIB_PLATFORM_ENDIAN, targetEndianType); + MCore::Endian::ConvertFloat(&value->m_a, EXPLIB_PLATFORM_ENDIAN, targetEndianType); } diff --git a/Gems/EMotionFX/Code/EMotionFX/Exporters/ExporterLib/Exporter/ExporterActor.cpp b/Gems/EMotionFX/Code/EMotionFX/Exporters/ExporterLib/Exporter/ExporterActor.cpp index 491326552e..598e5fcc9e 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Exporters/ExporterLib/Exporter/ExporterActor.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Exporters/ExporterLib/Exporter/ExporterActor.cpp @@ -52,9 +52,9 @@ namespace ExporterLib const AZ::u32 bufferSize = static_cast(buffer.size()); EMotionFX::FileFormat::FileChunk chunkHeader; - chunkHeader.mChunkID = EMotionFX::FileFormat::ACTOR_CHUNK_PHYSICSSETUP; - chunkHeader.mVersion = 1; - chunkHeader.mSizeInBytes = bufferSize + sizeof(AZ::u32); + chunkHeader.m_chunkId = EMotionFX::FileFormat::ACTOR_CHUNK_PHYSICSSETUP; + chunkHeader.m_version = 1; + chunkHeader.m_sizeInBytes = bufferSize + sizeof(AZ::u32); ConvertFileChunk(&chunkHeader, targetEndianType); file->Write(&chunkHeader, sizeof(EMotionFX::FileFormat::FileChunk)); @@ -90,9 +90,9 @@ namespace ExporterLib const AZ::u32 bufferSize = static_cast(buffer.size()); EMotionFX::FileFormat::FileChunk chunkHeader; - chunkHeader.mChunkID = EMotionFX::FileFormat::ACTOR_CHUNK_SIMULATEDOBJECTSETUP; - chunkHeader.mVersion = 1; - chunkHeader.mSizeInBytes = bufferSize + sizeof(AZ::u32); + chunkHeader.m_chunkId = EMotionFX::FileFormat::ACTOR_CHUNK_SIMULATEDOBJECTSETUP; + chunkHeader.m_version = 1; + chunkHeader.m_sizeInBytes = bufferSize + sizeof(AZ::u32); ConvertFileChunk(&chunkHeader, targetEndianType); file->Write(&chunkHeader, sizeof(EMotionFX::FileFormat::FileChunk)); @@ -122,9 +122,9 @@ namespace ExporterLib // Write the chunk header EMotionFX::FileFormat::FileChunk chunkHeader; - chunkHeader.mChunkID = EMotionFX::FileFormat::ACTOR_CHUNK_MESHASSET; - chunkHeader.mSizeInBytes = sizeof(EMotionFX::FileFormat::Actor_MeshAsset) + GetStringChunkSize(meshAssetIdString.c_str()); - chunkHeader.mVersion = 1; + chunkHeader.m_chunkId = EMotionFX::FileFormat::ACTOR_CHUNK_MESHASSET; + chunkHeader.m_sizeInBytes = sizeof(EMotionFX::FileFormat::Actor_MeshAsset) + GetStringChunkSize(meshAssetIdString.c_str()); + chunkHeader.m_version = 1; ConvertFileChunk(&chunkHeader, targetEndianType); file->Write(&chunkHeader, sizeof(EMotionFX::FileFormat::FileChunk)); diff --git a/Gems/EMotionFX/Code/EMotionFX/Exporters/ExporterLib/Exporter/FileHeaderExport.cpp b/Gems/EMotionFX/Code/EMotionFX/Exporters/ExporterLib/Exporter/FileHeaderExport.cpp index bafc899d4e..ffeab884a5 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Exporters/ExporterLib/Exporter/FileHeaderExport.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Exporters/ExporterLib/Exporter/FileHeaderExport.cpp @@ -23,14 +23,13 @@ namespace ExporterLib // the header information EMotionFX::FileFormat::Actor_Header header; memset(&header, 0, sizeof(EMotionFX::FileFormat::Actor_Header)); - header.mFourcc[0] = 'A'; - header.mFourcc[1] = 'C'; - header.mFourcc[2] = 'T'; - header.mFourcc[3] = 'R'; - header.mHiVersion = static_cast(GetFileHighVersion()); - header.mLoVersion = static_cast(GetFileLowVersion()); - header.mEndianType = static_cast(targetEndianType); - //header.mMulOrder = EMotionFX::FileFormat::MULORDER_ROT_SCALE_TRANS; + header.m_fourcc[0] = 'A'; + header.m_fourcc[1] = 'C'; + header.m_fourcc[2] = 'T'; + header.m_fourcc[3] = 'R'; + header.m_hiVersion = static_cast(GetFileHighVersion()); + header.m_loVersion = static_cast(GetFileLowVersion()); + header.m_endianType = static_cast(targetEndianType); // write the header to the stream file->Write(&header, sizeof(EMotionFX::FileFormat::Actor_Header)); @@ -50,42 +49,42 @@ namespace ExporterLib { // chunk header EMotionFX::FileFormat::FileChunk chunkHeader; - chunkHeader.mChunkID = EMotionFX::FileFormat::ACTOR_CHUNK_INFO; + chunkHeader.m_chunkId = EMotionFX::FileFormat::ACTOR_CHUNK_INFO; - chunkHeader.mSizeInBytes = sizeof(EMotionFX::FileFormat::Actor_Info3); - chunkHeader.mSizeInBytes += GetStringChunkSize(sourceApp); - chunkHeader.mSizeInBytes += GetStringChunkSize(orgFileName); - chunkHeader.mSizeInBytes += GetStringChunkSize(GetCompilationDate()); - chunkHeader.mSizeInBytes += GetStringChunkSize(actorName); + chunkHeader.m_sizeInBytes = sizeof(EMotionFX::FileFormat::Actor_Info3); + chunkHeader.m_sizeInBytes += GetStringChunkSize(sourceApp); + chunkHeader.m_sizeInBytes += GetStringChunkSize(orgFileName); + chunkHeader.m_sizeInBytes += GetStringChunkSize(GetCompilationDate()); + chunkHeader.m_sizeInBytes += GetStringChunkSize(actorName); - chunkHeader.mVersion = 3; + chunkHeader.m_version = 3; EMotionFX::FileFormat::Actor_Info3 infoChunk; memset(&infoChunk, 0, sizeof(EMotionFX::FileFormat::Actor_Info3)); - infoChunk.mNumLODs = aznumeric_caster(numLODLevels); - infoChunk.mMotionExtractionNodeIndex = aznumeric_caster(motionExtractionNodeIndex); - infoChunk.mRetargetRootNodeIndex = aznumeric_caster(retargetRootNodeIndex); - infoChunk.mExporterHighVersion = static_cast(EMotionFX::GetEMotionFX().GetHighVersion()); - infoChunk.mExporterLowVersion = static_cast(EMotionFX::GetEMotionFX().GetLowVersion()); - infoChunk.mUnitType = static_cast(unitType); - infoChunk.mOptimizeSkeleton = optimizeSkeleton ? 1 : 0; + infoChunk.m_numLoDs = aznumeric_caster(numLODLevels); + infoChunk.m_motionExtractionNodeIndex = aznumeric_caster(motionExtractionNodeIndex); + infoChunk.m_retargetRootNodeIndex = aznumeric_caster(retargetRootNodeIndex); + infoChunk.m_exporterHighVersion = static_cast(EMotionFX::GetEMotionFX().GetHighVersion()); + infoChunk.m_exporterLowVersion = static_cast(EMotionFX::GetEMotionFX().GetLowVersion()); + infoChunk.m_unitType = static_cast(unitType); + infoChunk.m_optimizeSkeleton = optimizeSkeleton ? 1 : 0; // print repositioning node information MCore::LogDetailedInfo("- File Info"); MCore::LogDetailedInfo(" + Actor Name: '%s'", actorName); MCore::LogDetailedInfo(" + Source Application: '%s'", sourceApp); MCore::LogDetailedInfo(" + Original File: '%s'", orgFileName); - MCore::LogDetailedInfo(" + Exporter Version: v%d.%d", infoChunk.mExporterHighVersion, infoChunk.mExporterLowVersion); + MCore::LogDetailedInfo(" + Exporter Version: v%d.%d", infoChunk.m_exporterHighVersion, infoChunk.m_exporterLowVersion); MCore::LogDetailedInfo(" + Exporter Compilation Date: '%s'", GetCompilationDate()); - MCore::LogDetailedInfo(" + Num LODs = %d", infoChunk.mNumLODs); - MCore::LogDetailedInfo(" + Motion extraction node index = %d", infoChunk.mMotionExtractionNodeIndex); - MCore::LogDetailedInfo(" + Retarget root node index = %d", infoChunk.mRetargetRootNodeIndex); + MCore::LogDetailedInfo(" + Num LODs = %d", infoChunk.m_numLoDs); + MCore::LogDetailedInfo(" + Motion extraction node index = %d", infoChunk.m_motionExtractionNodeIndex); + MCore::LogDetailedInfo(" + Retarget root node index = %d", infoChunk.m_retargetRootNodeIndex); // endian conversion ConvertFileChunk(&chunkHeader, targetEndianType); - ConvertUnsignedInt(&infoChunk.mMotionExtractionNodeIndex, targetEndianType); - ConvertUnsignedInt(&infoChunk.mRetargetRootNodeIndex, targetEndianType); - ConvertUnsignedInt(&infoChunk.mNumLODs, targetEndianType); + ConvertUnsignedInt(&infoChunk.m_motionExtractionNodeIndex, targetEndianType); + ConvertUnsignedInt(&infoChunk.m_retargetRootNodeIndex, targetEndianType); + ConvertUnsignedInt(&infoChunk.m_numLoDs, targetEndianType); file->Write(&chunkHeader, sizeof(EMotionFX::FileFormat::FileChunk)); file->Write(&infoChunk, sizeof(EMotionFX::FileFormat::Actor_Info3)); @@ -104,14 +103,14 @@ namespace ExporterLib EMotionFX::FileFormat::Motion_Header header; memset(&header, 0, sizeof(EMotionFX::FileFormat::Motion_Header)); - header.mFourcc[0] = 'M'; - header.mFourcc[1] = 'O'; - header.mFourcc[2] = 'T'; - header.mFourcc[3] = ' '; + header.m_fourcc[0] = 'M'; + header.m_fourcc[1] = 'O'; + header.m_fourcc[2] = 'T'; + header.m_fourcc[3] = ' '; - header.mHiVersion = static_cast(GetFileHighVersion()); - header.mLoVersion = static_cast(GetFileLowVersion()); - header.mEndianType = static_cast(targetEndianType); + header.m_hiVersion = static_cast(GetFileHighVersion()); + header.m_loVersion = static_cast(GetFileLowVersion()); + header.m_endianType = static_cast(targetEndianType); // write the header to the stream file->Write(&header, sizeof(EMotionFX::FileFormat::Motion_Header)); @@ -122,26 +121,26 @@ namespace ExporterLib { // chunk header EMotionFX::FileFormat::FileChunk chunkHeader; - chunkHeader.mChunkID = EMotionFX::FileFormat::MOTION_CHUNK_INFO; - chunkHeader.mSizeInBytes = sizeof(EMotionFX::FileFormat::Motion_Info3); - chunkHeader.mVersion = 3; + chunkHeader.m_chunkId = EMotionFX::FileFormat::MOTION_CHUNK_INFO; + chunkHeader.m_sizeInBytes = sizeof(EMotionFX::FileFormat::Motion_Info3); + chunkHeader.m_version = 3; EMotionFX::FileFormat::Motion_Info3 infoChunk; memset(&infoChunk, 0, sizeof(EMotionFX::FileFormat::Motion_Info3)); - infoChunk.mMotionExtractionFlags = motion->GetMotionExtractionFlags(); - infoChunk.mMotionExtractionNodeIndex= MCORE_INVALIDINDEX32; // not used anymore - infoChunk.mUnitType = static_cast(motion->GetUnitType()); - infoChunk.mIsAdditive = motion->GetMotionData()->IsAdditive() ? 1 : 0; + infoChunk.m_motionExtractionFlags = motion->GetMotionExtractionFlags(); + infoChunk.m_motionExtractionNodeIndex= MCORE_INVALIDINDEX32; // not used anymore + infoChunk.m_unitType = static_cast(motion->GetUnitType()); + infoChunk.m_isAdditive = motion->GetMotionData()->IsAdditive() ? 1 : 0; MCore::LogDetailedInfo("- File Info"); MCore::LogDetailedInfo(" + Exporter Compilation Date = '%s'", GetCompilationDate()); - MCore::LogDetailedInfo(" + Motion Extraction Flags = 0x%x [capZ=%d]", infoChunk.mMotionExtractionFlags, (infoChunk.mMotionExtractionFlags & EMotionFX::MOTIONEXTRACT_CAPTURE_Z) ? 1 : 0); + MCore::LogDetailedInfo(" + Motion Extraction Flags = 0x%x [capZ=%d]", infoChunk.m_motionExtractionFlags, (infoChunk.m_motionExtractionFlags & EMotionFX::MOTIONEXTRACT_CAPTURE_Z) ? 1 : 0); // endian conversion ConvertFileChunk(&chunkHeader, targetEndianType); - ConvertUnsignedInt(&infoChunk.mMotionExtractionFlags, targetEndianType); - ConvertUnsignedInt(&infoChunk.mMotionExtractionNodeIndex, targetEndianType); + ConvertUnsignedInt(&infoChunk.m_motionExtractionFlags, targetEndianType); + ConvertUnsignedInt(&infoChunk.m_motionExtractionNodeIndex, targetEndianType); file->Write(&chunkHeader, sizeof(EMotionFX::FileFormat::FileChunk)); file->Write(&infoChunk, sizeof(EMotionFX::FileFormat::Motion_Info2)); diff --git a/Gems/EMotionFX/Code/EMotionFX/Exporters/ExporterLib/Exporter/MaterialExport.cpp b/Gems/EMotionFX/Code/EMotionFX/Exporters/ExporterLib/Exporter/MaterialExport.cpp deleted file mode 100644 index 8bd005af6c..0000000000 --- a/Gems/EMotionFX/Code/EMotionFX/Exporters/ExporterLib/Exporter/MaterialExport.cpp +++ /dev/null @@ -1,298 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include "Exporter.h" -#include -#include -#include - -#include -#include - - -namespace ExporterLib -{ - // write the material attribute set - void SaveMaterialAttributeSet(MCore::Stream* file, EMotionFX::Material* material, uint32 lodLevel, uint32 materialNumber, MCore::Endian::EEndianType targetEndianType) - { - AZ_UNUSED(material); - // write the chunk header - EMotionFX::FileFormat::FileChunk chunkHeader; - chunkHeader.mChunkID = EMotionFX::FileFormat::ACTOR_CHUNK_MATERIALATTRIBUTESET; - chunkHeader.mSizeInBytes = sizeof(EMotionFX::FileFormat::Actor_MaterialAttributeSet); - chunkHeader.mVersion = 1; - ConvertFileChunk(&chunkHeader, targetEndianType); - file->Write(&chunkHeader, sizeof(EMotionFX::FileFormat::FileChunk)); - - // write the attribute set info header - EMotionFX::FileFormat::Actor_MaterialAttributeSet setInfo; - setInfo.mMaterialIndex = materialNumber; - setInfo.mLODLevel = lodLevel; - ConvertUnsignedInt(&setInfo.mMaterialIndex, targetEndianType); - ConvertUnsignedInt(&setInfo.mLODLevel, targetEndianType); - file->Write(&setInfo, sizeof(EMotionFX::FileFormat::Actor_MaterialAttributeSet)); - - // Write a former empty attribute set. - uint8 version = 1; - file->Write(&version, sizeof(uint8)); - - uint32 numAttributes = 0; - ConvertUnsignedInt(&numAttributes, targetEndianType); - file->Write(&numAttributes, sizeof(uint32)); - } - - - // save the given material for the given LOD level - void SaveMaterial(MCore::Stream* file, EMotionFX::Material* material, uint32 lodLevel, uint32 materialNumber, MCore::Endian::EEndianType targetEndianType) - { - //---------------------------------------- - // Generic EMotionFX::Material - //---------------------------------------- - if (material->GetType() == EMotionFX::Material::TYPE_ID) - { - // chunk header - EMotionFX::FileFormat::FileChunk chunkHeader; - chunkHeader.mChunkID = EMotionFX::FileFormat::ACTOR_CHUNK_GENERICMATERIAL; - chunkHeader.mSizeInBytes = sizeof(EMotionFX::FileFormat::Actor_GenericMaterial) + GetStringChunkSize(material->GetName()); - chunkHeader.mVersion = 1; - - EMotionFX::FileFormat::Actor_GenericMaterial materialChunk; - materialChunk.mLOD = lodLevel; - - ConvertFileChunk(&chunkHeader, targetEndianType); - ConvertUnsignedInt(&materialChunk.mLOD, targetEndianType); - - // write header and material - file->Write(&chunkHeader, sizeof(EMotionFX::FileFormat::FileChunk)); - file->Write(&materialChunk, sizeof(EMotionFX::FileFormat::Actor_GenericMaterial)); - - // followed by: - SaveString(material->GetName(), file, targetEndianType); - - MCore::LogDetailedInfo("- Generic material:"); - MCore::LogDetailedInfo(" + Name: '%s'", material->GetName()); - MCore::LogDetailedInfo(" + LOD: %d", lodLevel); - } - - //---------------------------------------- - // Standard EMotionFX::Material - //---------------------------------------- - if (material->GetType() == EMotionFX::StandardMaterial::TYPE_ID) - { - // typecast to a standard material - EMotionFX::StandardMaterial* standardMaterial = (EMotionFX::StandardMaterial*)material; - - // chunk header - EMotionFX::FileFormat::FileChunk chunkHeader; - chunkHeader.mChunkID = EMotionFX::FileFormat::ACTOR_CHUNK_STDMATERIAL; - chunkHeader.mSizeInBytes = sizeof(EMotionFX::FileFormat::Actor_StandardMaterial) + GetStringChunkSize(standardMaterial->GetName()); - chunkHeader.mVersion = 1; - - const uint32 numLayers = standardMaterial->GetNumLayers(); - for (uint32 i = 0; i < numLayers; ++i) - { - chunkHeader.mSizeInBytes += sizeof(EMotionFX::FileFormat::Actor_StandardMaterialLayer); - chunkHeader.mSizeInBytes += GetStringChunkSize(standardMaterial->GetLayer(i)->GetFileName()); - } - - EMotionFX::FileFormat::Actor_StandardMaterial materialChunk; - CopyColor(standardMaterial->GetAmbient(), materialChunk.mAmbient); - CopyColor(standardMaterial->GetDiffuse(), materialChunk.mDiffuse); - CopyColor(standardMaterial->GetSpecular(), materialChunk.mSpecular); - CopyColor(standardMaterial->GetEmissive(), materialChunk.mEmissive); - materialChunk.mDoubleSided = standardMaterial->GetDoubleSided(); - materialChunk.mIOR = standardMaterial->GetIOR(); - materialChunk.mOpacity = standardMaterial->GetOpacity(); - materialChunk.mShine = standardMaterial->GetShine(); - materialChunk.mShineStrength = standardMaterial->GetShineStrength(); - materialChunk.mTransparencyType = 'F';//standardMaterial->GetTransparencyType(); - materialChunk.mWireFrame = standardMaterial->GetWireFrame(); - materialChunk.mNumLayers = static_cast(standardMaterial->GetNumLayers()); - materialChunk.mLOD = lodLevel; - - // add it to the log file - MCore::LogDetailedInfo("- Standard material:"); - MCore::LogDetailedInfo(" + Name: '%s'", standardMaterial->GetName()); - MCore::LogDetailedInfo(" + LOD: %d", lodLevel); - MCore::LogDetailedInfo(" + Ambient: r=%f g=%f b=%f", materialChunk.mAmbient.mR, materialChunk.mAmbient.mG, materialChunk.mAmbient.mB); - MCore::LogDetailedInfo(" + Diffuse: r=%f g=%f b=%f", materialChunk.mDiffuse.mR, materialChunk.mDiffuse.mG, materialChunk.mDiffuse.mB); - MCore::LogDetailedInfo(" + Specular: r=%f g=%f b=%f", materialChunk.mSpecular.mR, materialChunk.mSpecular.mG, materialChunk.mSpecular.mB); - MCore::LogDetailedInfo(" + Emissive: r=%f g=%f b=%f", materialChunk.mEmissive.mR, materialChunk.mEmissive.mG, materialChunk.mEmissive.mB); - MCore::LogDetailedInfo(" + Shine: %f", materialChunk.mShine); - MCore::LogDetailedInfo(" + ShineStrength: %f", materialChunk.mShineStrength); - MCore::LogDetailedInfo(" + Opacity: %f", materialChunk.mOpacity); - MCore::LogDetailedInfo(" + IndexOfRefraction: %f", materialChunk.mIOR); - MCore::LogDetailedInfo(" + DoubleSided: %i", (int)materialChunk.mDoubleSided); - MCore::LogDetailedInfo(" + WireFrame: %i", (int)materialChunk.mWireFrame); - MCore::LogDetailedInfo(" + TransparencyType: %c", (char)materialChunk.mTransparencyType); - MCore::LogDetailedInfo(" + NumLayers: %i", materialChunk.mNumLayers); - - // endian conversion - ConvertFileChunk(&chunkHeader, targetEndianType); - ConvertFileColor(&materialChunk.mAmbient, targetEndianType); - ConvertFileColor(&materialChunk.mDiffuse, targetEndianType); - ConvertFileColor(&materialChunk.mSpecular, targetEndianType); - ConvertFileColor(&materialChunk.mEmissive, targetEndianType); - ConvertFloat(&materialChunk.mIOR, targetEndianType); - ConvertFloat(&materialChunk.mOpacity, targetEndianType); - ConvertFloat(&materialChunk.mShine, targetEndianType); - ConvertFloat(&materialChunk.mShineStrength, targetEndianType); - ConvertUnsignedInt(&materialChunk.mLOD, targetEndianType); - - // write header and material - file->Write(&chunkHeader, sizeof(EMotionFX::FileFormat::FileChunk)); - file->Write(&materialChunk, sizeof(EMotionFX::FileFormat::Actor_StandardMaterial)); - - // followed by: - SaveString(standardMaterial->GetName(), file, targetEndianType); - - // save all material layers - for (uint32 i = 0; i < numLayers; ++i) - { - // get the layer - EMotionFX::StandardMaterialLayer* layer = standardMaterial->GetLayer(i); - - EMotionFX::FileFormat::Actor_StandardMaterialLayer materialChunkLayer; - materialChunkLayer.mAmount = layer->GetAmount(); - materialChunkLayer.mMapType = static_cast(layer->GetType()); - materialChunkLayer.mMaterialNumber = (uint16)materialNumber; - materialChunkLayer.mRotationRadians = layer->GetRotationRadians(); - materialChunkLayer.mUOffset = layer->GetUOffset(); - materialChunkLayer.mVOffset = layer->GetVOffset(); - materialChunkLayer.mUTiling = layer->GetUTiling(); - materialChunkLayer.mVTiling = layer->GetVTiling(); - materialChunkLayer.mBlendMode = layer->GetBlendMode(); - - // add to log file - MCore::LogDetailedInfo(" - Material layer #%d:", i); - MCore::LogDetailedInfo(" + Name: '%s' (MatNr=%i)", layer->GetFileName(), materialNumber); - MCore::LogDetailedInfo(" + Amount: %f", materialChunkLayer.mAmount); - MCore::LogDetailedInfo(" + Type: %i", (int)materialChunkLayer.mMapType); - MCore::LogDetailedInfo(" + BlendMode: %i", (int)materialChunkLayer.mBlendMode); - MCore::LogDetailedInfo(" + MaterialNumber: %i", (uint32)materialChunkLayer.mMaterialNumber); - MCore::LogDetailedInfo(" + UOffset: %f", materialChunkLayer.mUOffset); - MCore::LogDetailedInfo(" + VOffset: %f", materialChunkLayer.mVOffset); - MCore::LogDetailedInfo(" + UTiling: %f", materialChunkLayer.mUTiling); - MCore::LogDetailedInfo(" + VTiling: %f", materialChunkLayer.mVTiling); - MCore::LogDetailedInfo(" + RotationRadians: %f", materialChunkLayer.mRotationRadians); - - // endian conversion - ConvertFloat(&materialChunkLayer.mAmount, targetEndianType); - ConvertUnsignedShort(&materialChunkLayer.mMaterialNumber, targetEndianType); - ConvertFloat(&materialChunkLayer.mRotationRadians, targetEndianType); - ConvertFloat(&materialChunkLayer.mUOffset, targetEndianType); - ConvertFloat(&materialChunkLayer.mVOffset, targetEndianType); - ConvertFloat(&materialChunkLayer.mUTiling, targetEndianType); - ConvertFloat(&materialChunkLayer.mVTiling, targetEndianType); - - // write header and material layer - file->Write(&materialChunkLayer, sizeof(EMotionFX::FileFormat::Actor_StandardMaterialLayer)); - SaveString(layer->GetFileName(), file, targetEndianType); - } - } - } - - - // save the given materials - void SaveMaterials(MCore::Stream* file, AZStd::vector& materials, uint32 lodLevel, MCore::Endian::EEndianType targetEndianType) - { - // get the number of materials - const uint32 numMaterials = materials.size(); - - // chunk header - EMotionFX::FileFormat::FileChunk chunkHeader; - chunkHeader.mChunkID = EMotionFX::FileFormat::ACTOR_CHUNK_MATERIALINFO; - chunkHeader.mSizeInBytes = sizeof(EMotionFX::FileFormat::Actor_MaterialInfo); - chunkHeader.mVersion = 1; - - // convert endian and write to file - ConvertFileChunk(&chunkHeader, targetEndianType); - file->Write(&chunkHeader, sizeof(EMotionFX::FileFormat::FileChunk)); - - EMotionFX::FileFormat::Actor_MaterialInfo materialInfoChunk; - materialInfoChunk.mLOD = lodLevel; - materialInfoChunk.mNumTotalMaterials = numMaterials; - materialInfoChunk.mNumStandardMaterials = 0; - materialInfoChunk.mNumFXMaterials = 0; - materialInfoChunk.mNumGenericMaterials = 0; - - for (uint32 i = 0; i < numMaterials; i++) - { - if (materials[i]->GetType() == EMotionFX::Material::TYPE_ID) - { - materialInfoChunk.mNumGenericMaterials++; - } - - if (materials[i]->GetType() == EMotionFX::StandardMaterial::TYPE_ID) - { - materialInfoChunk.mNumStandardMaterials++; - } - } - - MCore::LogDetailedInfo("============================================================"); - MCore::LogInfo("Materials (%d)", numMaterials); - MCore::LogDetailedInfo("============================================================"); - - MCORE_ASSERT(materialInfoChunk.mNumTotalMaterials == materialInfoChunk.mNumStandardMaterials + materialInfoChunk.mNumFXMaterials + materialInfoChunk.mNumGenericMaterials); - - // convert endian and write to disk - ConvertUnsignedInt(&materialInfoChunk.mNumTotalMaterials, targetEndianType); - ConvertUnsignedInt(&materialInfoChunk.mNumStandardMaterials, targetEndianType); - ConvertUnsignedInt(&materialInfoChunk.mNumFXMaterials, targetEndianType); - ConvertUnsignedInt(&materialInfoChunk.mNumGenericMaterials, targetEndianType); - ConvertUnsignedInt(&materialInfoChunk.mLOD, targetEndianType); - file->Write(&materialInfoChunk, sizeof(EMotionFX::FileFormat::Actor_MaterialInfo)); - - // export all materials - for (uint32 i = 0; i < numMaterials; i++) - { - SaveMaterial(file, materials[i], lodLevel, i, targetEndianType); - } - - // save all material attribute sets - for (uint32 i = 0; i < numMaterials; i++) - { - SaveMaterialAttributeSet(file, materials[i], lodLevel, i, targetEndianType); - } - } - - - // save out all materials for a given LOD level - void SaveMaterials(MCore::Stream* file, EMotionFX::Actor* actor, uint32 lodLevel, MCore::Endian::EEndianType targetEndianType) - { - // get the number of materials in the given lod level - const uint32 numMaterials = actor->GetNumMaterials(lodLevel); - - // create our materials array and reserve some elements - AZStd::vector materials; - materials.reserve(numMaterials); - - // iterate through the materials - for (uint32 j = 0; j < numMaterials; j++) - { - // get the base material - EMotionFX::Material* baseMaterial = actor->GetMaterial(lodLevel, j); - materials.emplace_back(baseMaterial); - } - - // save the materials - SaveMaterials(file, materials, lodLevel, targetEndianType); - } - - - // save all materials for all LOD levels - void SaveMaterials(MCore::Stream* file, EMotionFX::Actor* actor, MCore::Endian::EEndianType targetEndianType) - { - // get the number of LOD levels and iterate through them - const uint32 numLODLevels = actor->GetNumLODLevels(); - for (uint32 i = 0; i < numLODLevels; ++i) - { - SaveMaterials(file, actor, i, targetEndianType); - } - } -} // namespace ExporterLib diff --git a/Gems/EMotionFX/Code/EMotionFX/Exporters/ExporterLib/Exporter/MeshExport.cpp b/Gems/EMotionFX/Code/EMotionFX/Exporters/ExporterLib/Exporter/MeshExport.cpp deleted file mode 100644 index 40b13d896f..0000000000 --- a/Gems/EMotionFX/Code/EMotionFX/Exporters/ExporterLib/Exporter/MeshExport.cpp +++ /dev/null @@ -1,270 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include "Exporter.h" -#include -#include -#include -#include -#include -#include -#include - - -namespace ExporterLib -{ - // save the given mesh - void SaveMesh(MCore::Stream* file, EMotionFX::Mesh* mesh, uint32 nodeIndex, bool isCollisionMesh, uint32 lodLevel, MCore::Endian::EEndianType targetEndianType) - { - // convert endian for abstract layers - for (uint32 i = 0; i < mesh->GetNumVertexAttributeLayers(); ++i) - { - EMotionFX::VertexAttributeLayer* layer = mesh->GetVertexAttributeLayer(i); - if (!layer->GetIsAbstractDataClass()) - { - continue; - } - - EMotionFX::VertexAttributeLayerAbstractData* abstractLayer = static_cast(layer); - - const uint32 type = abstractLayer->GetType(); - - EMotionFX::Importer::AbstractLayerConverter layerConvertFunction; - layerConvertFunction = EMotionFX::Importer::StandardLayerConvert; - - // convert endian and coordinate systems of all data - if (layerConvertFunction(abstractLayer, targetEndianType) == false) - { - MCore::LogError("Don't know how to endian and/or coordinate system convert layer with type %d (%s)", type, EMotionFX::Importer::ActorVertexAttributeLayerTypeToString(type)); - } - } - - uint32 totalSize = sizeof(EMotionFX::FileFormat::Actor_Mesh); - - // add all layers to the total size - uint32 numMeshVerts = mesh->GetNumVertices(); - for (uint32 i = 0; i < mesh->GetNumVertexAttributeLayers(); ++i) - { - EMotionFX::VertexAttributeLayer* layer = mesh->GetVertexAttributeLayer(i); - if (!layer->GetIsAbstractDataClass()) - { - continue; - } - - EMotionFX::VertexAttributeLayerAbstractData* abstractLayer = static_cast(layer); - - totalSize += sizeof(EMotionFX::FileFormat::Actor_VertexAttributeLayer); - totalSize += numMeshVerts * abstractLayer->GetAttributeSizeInBytes(); - totalSize += GetStringChunkSize(layer->GetNameString()); - } - - // add the submeshes - for (uint32 i = 0; i < mesh->GetNumSubMeshes(); ++i) - { - EMotionFX::SubMesh* subMesh = mesh->GetSubMesh(i); - totalSize += sizeof(EMotionFX::FileFormat::Actor_SubMesh); - totalSize += sizeof(uint32) * subMesh->GetNumIndices(); - totalSize += sizeof(uint8) * subMesh->GetNumPolygons(); - totalSize += sizeof(uint32) * subMesh->GetNumBones(); - } - - // write the chunk header - EMotionFX::FileFormat::FileChunk chunkHeader; - chunkHeader.mChunkID = EMotionFX::FileFormat::ACTOR_CHUNK_MESH; - chunkHeader.mSizeInBytes = totalSize; - chunkHeader.mVersion = 1; - ConvertFileChunk(&chunkHeader, targetEndianType); - file->Write(&chunkHeader, sizeof(EMotionFX::FileFormat::FileChunk)); - - // write the mesh header - EMotionFX::FileFormat::Actor_Mesh meshHeader; - memset(&meshHeader, 0, sizeof(EMotionFX::FileFormat::Actor_Mesh)); - meshHeader.mIsCollisionMesh = isCollisionMesh ? 1 : 0; - meshHeader.mNodeIndex = nodeIndex; - meshHeader.mNumLayers = mesh->GetNumVertexAttributeLayers(); - meshHeader.mNumOrgVerts = mesh->GetNumOrgVertices(); - meshHeader.mNumSubMeshes = mesh->GetNumSubMeshes(); - meshHeader.mNumPolygons = mesh->GetNumPolygons(); - meshHeader.mTotalIndices = mesh->GetNumIndices(); - meshHeader.mLOD = lodLevel; - meshHeader.mTotalVerts = (mesh->GetNumVertexAttributeLayers() > 0) ? mesh->GetNumVertices() : 0; - meshHeader.mIsTriangleMesh = mesh->CheckIfIsTriangleMesh(); - - MCore::LogDetailedInfo("- Mesh for node with node number %d:", meshHeader.mNodeIndex); - MCore::LogDetailedInfo(" + LOD: %d", meshHeader.mLOD); - MCore::LogDetailedInfo(" + Num original vertices: %d", meshHeader.mNumOrgVerts); - MCore::LogDetailedInfo(" + Total vertices: %d", meshHeader.mTotalVerts); - MCore::LogDetailedInfo(" + Total polygons: %d", meshHeader.mNumPolygons); - MCore::LogDetailedInfo(" + Total indices: %d", meshHeader.mTotalIndices); - MCore::LogDetailedInfo(" + Num submeshes: %d", meshHeader.mNumSubMeshes); - MCore::LogDetailedInfo(" + Num attribute layers: %d", meshHeader.mNumLayers); - MCore::LogDetailedInfo(" + Is collision mesh: %s", meshHeader.mIsCollisionMesh ? "Yes" : "No"); - MCore::LogDetailedInfo(" + Is triangle mesh: %s", meshHeader.mIsTriangleMesh ? "Yes" : "No"); - - //for (uint32 i=0; iGetNumPolygons(); ++i) - //MCore::LogInfo("poly %d = %d verts", i, mesh->GetPolygonVertexCounts()[i] ); - - // convert endian - ConvertUnsignedInt(&meshHeader.mNodeIndex, targetEndianType); - ConvertUnsignedInt(&meshHeader.mNumLayers, targetEndianType); - ConvertUnsignedInt(&meshHeader.mNumSubMeshes, targetEndianType); - ConvertUnsignedInt(&meshHeader.mNumPolygons, targetEndianType); - ConvertUnsignedInt(&meshHeader.mTotalIndices, targetEndianType); - ConvertUnsignedInt(&meshHeader.mTotalVerts, targetEndianType); - ConvertUnsignedInt(&meshHeader.mNumOrgVerts, targetEndianType); - ConvertUnsignedInt(&meshHeader.mLOD, targetEndianType); - - // write to file - file->Write(&meshHeader, sizeof(EMotionFX::FileFormat::Actor_Mesh)); - - // now save all layers - const uint32 numLayers = mesh->GetNumVertexAttributeLayers(); - for (uint32 layerNr = 0; layerNr < numLayers; ++layerNr) - { - EMotionFX::VertexAttributeLayer* layer = mesh->GetVertexAttributeLayer(layerNr); - if (!layer->GetIsAbstractDataClass()) - { - continue; - } - - EMotionFX::VertexAttributeLayerAbstractData* abstractLayer = static_cast(layer); - - EMotionFX::FileFormat::Actor_VertexAttributeLayer fileLayer; - memset(&fileLayer, 0, sizeof(EMotionFX::FileFormat::Actor_VertexAttributeLayer)); - fileLayer.mLayerTypeID = layer->GetType(); - fileLayer.mAttribSizeInBytes = abstractLayer->GetAttributeSizeInBytes(); - fileLayer.mEnableDeformations = layer->GetKeepOriginals() ? 1 : 0; - fileLayer.mIsScale = 0;// TODO: not used - - MCore::LogDetailedInfo(" - Layer #%d (%s):", layerNr, EMotionFX::Importer::ActorVertexAttributeLayerTypeToString(fileLayer.mLayerTypeID)); - MCore::LogDetailedInfo(" + Type ID: %d", fileLayer.mLayerTypeID); - MCore::LogDetailedInfo(" + Attrib size: %d bytes", fileLayer.mAttribSizeInBytes); - MCore::LogDetailedInfo(" + Enable deforms: %s", fileLayer.mEnableDeformations ? "Yes" : "No"); - MCore::LogDetailedInfo(" + Name: %s", layer->GetName()); - - // convert endian - ConvertUnsignedInt(&fileLayer.mAttribSizeInBytes, targetEndianType); - ConvertUnsignedInt(&fileLayer.mLayerTypeID, targetEndianType); - - // write the layer header - file->Write(&fileLayer, sizeof(EMotionFX::FileFormat::Actor_VertexAttributeLayer)); - - // write the name - SaveString(layer->GetNameString(), file, targetEndianType); - - // write the layer - file->Write((uint8*)abstractLayer->GetOriginalData(), abstractLayer->CalcTotalDataSizeInBytes(false)); - } - - - // and finally save all submeshes - const uint32 numSubMeshes = mesh->GetNumSubMeshes(); - for (uint32 s = 0; s < numSubMeshes; ++s) - { - EMotionFX::SubMesh* subMesh = mesh->GetSubMesh(s); - - EMotionFX::FileFormat::Actor_SubMesh fileSubMesh; - fileSubMesh.mMaterialIndex = subMesh->GetMaterial(); - fileSubMesh.mNumBones = subMesh->GetNumBones(); - fileSubMesh.mNumIndices = subMesh->GetNumIndices(); - fileSubMesh.mNumVerts = subMesh->GetNumVertices(); - fileSubMesh.mNumPolygons = subMesh->GetNumPolygons(); - - MCore::LogDetailedInfo(" - SubMesh #%d:", s); - MCore::LogDetailedInfo(" + Material: %d", fileSubMesh.mMaterialIndex); - MCore::LogDetailedInfo(" + Num vertices: %d", fileSubMesh.mNumVerts); - MCore::LogDetailedInfo(" + Num indices: %d (%d polygons)", fileSubMesh.mNumIndices, fileSubMesh.mNumPolygons); - MCore::LogDetailedInfo(" + Num bones: %d", fileSubMesh.mNumBones); - - // convert endian - ConvertUnsignedInt(&fileSubMesh.mMaterialIndex, targetEndianType); - ConvertUnsignedInt(&fileSubMesh.mNumBones, targetEndianType); - ConvertUnsignedInt(&fileSubMesh.mNumIndices, targetEndianType); - ConvertUnsignedInt(&fileSubMesh.mNumPolygons, targetEndianType); - ConvertUnsignedInt(&fileSubMesh.mNumVerts, targetEndianType); - - // write the submesh header - file->Write(&fileSubMesh, sizeof(EMotionFX::FileFormat::Actor_SubMesh)); - - // write the index data - const uint32 numIndices = subMesh->GetNumIndices(); - const uint32 numPolygons = subMesh->GetNumPolygons(); - const uint32 startVertex = subMesh->GetStartVertex(); - uint32* indices = subMesh->GetIndices(); - uint8* polyVertCounts = subMesh->GetPolygonVertexCounts(); - - for (uint32 i = 0; i < numIndices; ++i) - { - uint32 index = indices[i] - startVertex; - ConvertUnsignedInt(&index, targetEndianType); - file->Write(&index, sizeof(uint32)); - } - - for (uint32 i = 0; i < numPolygons; ++i) - { - uint8 numPolyVerts = polyVertCounts[i]; - file->Write(&numPolyVerts, sizeof(uint8)); - } - - // write the bone numbers - const uint32 numBones = subMesh->GetNumBones(); - for (uint32 i = 0; i < numBones; ++i) - { - uint32 value = subMesh->GetBone(i); - ConvertUnsignedInt(&value, targetEndianType); - file->Write(&value, sizeof(uint32)); - } - } - } - - - // save meshes for all nodes for a given LOD level - void SaveMeshes(MCore::Stream* file, EMotionFX::Actor* actor, uint32 lodLevel, MCore::Endian::EEndianType targetEndianType) - { - MCORE_ASSERT(file); - MCORE_ASSERT(actor); - - MCore::LogDetailedInfo("============================================================"); - MCore::LogInfo("Meshes (LOD=%i", lodLevel); - MCore::LogDetailedInfo("============================================================"); - - // get the number of nodes - const uint32 numNodes = actor->GetNumNodes(); - - // iterate through all nodes - for (uint32 i = 0; i < numNodes; i++) - { - // get the node from the actor - //EMotionFX::Node* node = actor->GetSkeleton()->GetNode(i); - - // get the mesh and save it - EMotionFX::Mesh* mesh = actor->GetMesh(lodLevel, i); - if (mesh) - { - SaveMesh(file, mesh, i, mesh->GetIsCollisionMesh(), lodLevel, targetEndianType); - } - - // get the collision mesh and save it - /* EMotionFX::Mesh* collisionMesh = actor->GetCollisionMesh(lodLevel, i); - if (collisionMesh) - SaveMesh( file, collisionMesh, i, true, lodLevel, targetEndianType );*/ - } - } - - - // save all meshes for all nodes and all LOD levels - void SaveMeshes(MCore::Stream* file, EMotionFX::Actor* actor, MCore::Endian::EEndianType targetEndianType) - { - // get the number of LOD levels, iterate through them and save all meshes - const uint32 numLODLevels = actor->GetNumLODLevels(); - for (uint32 i = 0; i < numLODLevels; ++i) - { - SaveMeshes(file, actor, i, targetEndianType); - } - } -} // namespace ExporterLib diff --git a/Gems/EMotionFX/Code/EMotionFX/Exporters/ExporterLib/Exporter/MorphTargetExport.cpp b/Gems/EMotionFX/Code/EMotionFX/Exporters/ExporterLib/Exporter/MorphTargetExport.cpp index 723669d3f1..5205dcbc97 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Exporters/ExporterLib/Exporter/MorphTargetExport.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Exporters/ExporterLib/Exporter/MorphTargetExport.cpp @@ -32,11 +32,11 @@ namespace ExporterLib // copy over the information to the chunk EMotionFX::FileFormat::Actor_MorphTarget morphTargetChunk; - morphTargetChunk.mLOD = aznumeric_caster(lodLevel); - morphTargetChunk.mNumTransformations = aznumeric_caster(numTransformations); - morphTargetChunk.mRangeMin = morphTarget->GetRangeMin(); - morphTargetChunk.mRangeMax = morphTarget->GetRangeMax(); - morphTargetChunk.mPhonemeSets = morphTarget->GetPhonemeSets(); + morphTargetChunk.m_lod = aznumeric_caster(lodLevel); + morphTargetChunk.m_numTransformations = aznumeric_caster(numTransformations); + morphTargetChunk.m_rangeMin = morphTarget->GetRangeMin(); + morphTargetChunk.m_rangeMax = morphTarget->GetRangeMax(); + morphTargetChunk.m_phonemeSets = morphTarget->GetPhonemeSets(); // log it MCore::LogDetailedInfo(" - Morph Target: Name='%s'", morphTarget->GetName()); @@ -47,11 +47,11 @@ namespace ExporterLib MCore::LogDetailedInfo(" + PhonemesSets: %s", EMotionFX::MorphTarget::GetPhonemeSetString((EMotionFX::MorphTarget::EPhonemeSet)morphTarget->GetPhonemeSets()).c_str()); // convert endian - ConvertFloat(&morphTargetChunk.mRangeMin, targetEndianType); - ConvertFloat(&morphTargetChunk.mRangeMax, targetEndianType); - ConvertUnsignedInt(&morphTargetChunk.mLOD, targetEndianType); - ConvertUnsignedInt(&morphTargetChunk.mNumTransformations, targetEndianType); - ConvertUnsignedInt(&morphTargetChunk.mPhonemeSets, targetEndianType); + ConvertFloat(&morphTargetChunk.m_rangeMin, targetEndianType); + ConvertFloat(&morphTargetChunk.m_rangeMax, targetEndianType); + ConvertUnsignedInt(&morphTargetChunk.m_lod, targetEndianType); + ConvertUnsignedInt(&morphTargetChunk.m_numTransformations, targetEndianType); + ConvertUnsignedInt(&morphTargetChunk.m_phonemeSets, targetEndianType); // write the bones expression part file->Write(&morphTargetChunk, sizeof(EMotionFX::FileFormat::Actor_MorphTarget)); @@ -63,34 +63,34 @@ namespace ExporterLib for (size_t i = 0; i < numTransformations; i++) { EMotionFX::MorphTargetStandard::Transformation transform = morphTarget->GetTransformation(i); - EMotionFX::Node* node = actor->GetSkeleton()->GetNode(transform.mNodeIndex); + EMotionFX::Node* node = actor->GetSkeleton()->GetNode(transform.m_nodeIndex); if (node == nullptr) { - MCore::LogError("Can't get node '%i'. File is corrupt!", transform.mNodeIndex); + MCore::LogError("Can't get node '%i'. File is corrupt!", transform.m_nodeIndex); continue; } // create and fill the transformation EMotionFX::FileFormat::Actor_MorphTargetTransform transformChunk; - transformChunk.mNodeIndex = aznumeric_caster(transform.mNodeIndex); - CopyVector(transformChunk.mPosition, AZ::PackedVector3f(transform.mPosition)); - CopyVector(transformChunk.mScale, AZ::PackedVector3f(transform.mScale)); - CopyQuaternion(transformChunk.mRotation, transform.mRotation); - CopyQuaternion(transformChunk.mScaleRotation, transform.mScaleRotation); + transformChunk.m_nodeIndex = aznumeric_caster(transform.m_nodeIndex); + CopyVector(transformChunk.m_position, AZ::PackedVector3f(transform.m_position)); + CopyVector(transformChunk.m_scale, AZ::PackedVector3f(transform.m_scale)); + CopyQuaternion(transformChunk.m_rotation, transform.m_rotation); + CopyQuaternion(transformChunk.m_scaleRotation, transform.m_scaleRotation); MCore::LogDetailedInfo(" - EMotionFX::Transform #%i: Node='%s' NodeNr=#%i", i, node->GetName(), node->GetNodeIndex()); - MCore::LogDetailedInfo(" + Pos: %f, %f, %f", transformChunk.mPosition.mX, transformChunk.mPosition.mY, transformChunk.mPosition.mZ); - MCore::LogDetailedInfo(" + Rotation: %f, %f, %f %f", transformChunk.mRotation.mX, transformChunk.mRotation.mY, transformChunk.mRotation.mZ, transformChunk.mRotation.mW); - MCore::LogDetailedInfo(" + Scale: %f, %f, %f", transformChunk.mScale.mX, transformChunk.mScale.mY, transformChunk.mScale.mZ); - MCore::LogDetailedInfo(" + ScaleRot: %f, %f, %f %f", transformChunk.mScaleRotation.mX, transformChunk.mScaleRotation.mY, transformChunk.mScaleRotation.mZ, transformChunk.mScaleRotation.mW); + MCore::LogDetailedInfo(" + Pos: %f, %f, %f", transformChunk.m_position.m_x, transformChunk.m_position.m_y, transformChunk.m_position.m_z); + MCore::LogDetailedInfo(" + Rotation: %f, %f, %f %f", transformChunk.m_rotation.m_x, transformChunk.m_rotation.m_y, transformChunk.m_rotation.m_z, transformChunk.m_rotation.m_w); + MCore::LogDetailedInfo(" + Scale: %f, %f, %f", transformChunk.m_scale.m_x, transformChunk.m_scale.m_y, transformChunk.m_scale.m_z); + MCore::LogDetailedInfo(" + ScaleRot: %f, %f, %f %f", transformChunk.m_scaleRotation.m_x, transformChunk.m_scaleRotation.m_y, transformChunk.m_scaleRotation.m_z, transformChunk.m_scaleRotation.m_w); // convert endian and coordinate system - ConvertUnsignedInt(&transformChunk.mNodeIndex, targetEndianType); - ConvertFileVector3(&transformChunk.mPosition, targetEndianType); - ConvertFileVector3(&transformChunk.mScale, targetEndianType); - ConvertFileQuaternion(&transformChunk.mRotation, targetEndianType); - ConvertFileQuaternion(&transformChunk.mScaleRotation, targetEndianType); + ConvertUnsignedInt(&transformChunk.m_nodeIndex, targetEndianType); + ConvertFileVector3(&transformChunk.m_position, targetEndianType); + ConvertFileVector3(&transformChunk.m_scale, targetEndianType); + ConvertFileQuaternion(&transformChunk.m_rotation, targetEndianType); + ConvertFileQuaternion(&transformChunk.m_scaleRotation, targetEndianType); // write the transformation file->Write(&transformChunk, sizeof(EMotionFX::FileFormat::Actor_MorphTargetTransform)); @@ -175,9 +175,9 @@ namespace ExporterLib // fill in the chunk header EMotionFX::FileFormat::FileChunk chunkHeader; - chunkHeader.mChunkID = EMotionFX::FileFormat::ACTOR_CHUNK_STDPMORPHTARGETS; - chunkHeader.mSizeInBytes = aznumeric_caster(GetMorphSetupChunkSize(morphSetup)); - chunkHeader.mVersion = 2; + chunkHeader.m_chunkId = EMotionFX::FileFormat::ACTOR_CHUNK_STDPMORPHTARGETS; + chunkHeader.m_sizeInBytes = aznumeric_caster(GetMorphSetupChunkSize(morphSetup)); + chunkHeader.m_version = 2; // endian convert the chunk and write it to the file ConvertFileChunk(&chunkHeader, targetEndianType); @@ -185,16 +185,16 @@ namespace ExporterLib // fill in the chunk header EMotionFX::FileFormat::Actor_MorphTargets morphTargetsChunk; - morphTargetsChunk.mNumMorphTargets = aznumeric_caster(numSavedMorphTargets); - morphTargetsChunk.mLOD = aznumeric_caster(lodLevel); + morphTargetsChunk.m_numMorphTargets = aznumeric_caster(numSavedMorphTargets); + morphTargetsChunk.m_lod = aznumeric_caster(lodLevel); MCore::LogDetailedInfo("============================================================"); - MCore::LogInfo("Morph Targets (%i, LOD=%d)", morphTargetsChunk.mNumMorphTargets, morphTargetsChunk.mLOD); + MCore::LogInfo("Morph Targets (%i, LOD=%d)", morphTargetsChunk.m_numMorphTargets, morphTargetsChunk.m_lod); MCore::LogDetailedInfo("============================================================"); // endian convert the chunk and write it to the file - ConvertUnsignedInt(&morphTargetsChunk.mNumMorphTargets, targetEndianType); - ConvertUnsignedInt(&morphTargetsChunk.mLOD, targetEndianType); + ConvertUnsignedInt(&morphTargetsChunk.m_numMorphTargets, targetEndianType); + ConvertUnsignedInt(&morphTargetsChunk.m_lod, targetEndianType); file->Write(&morphTargetsChunk, sizeof(EMotionFX::FileFormat::Actor_MorphTargets)); // save morph targets diff --git a/Gems/EMotionFX/Code/EMotionFX/Exporters/ExporterLib/Exporter/MotionEventExport.cpp b/Gems/EMotionFX/Code/EMotionFX/Exporters/ExporterLib/Exporter/MotionEventExport.cpp index 1d29ca1056..e1bde1ff79 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Exporters/ExporterLib/Exporter/MotionEventExport.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Exporters/ExporterLib/Exporter/MotionEventExport.cpp @@ -66,10 +66,10 @@ namespace ExporterLib // the motion event table chunk header EMotionFX::FileFormat::FileChunk chunkHeader; - chunkHeader.mChunkID = EMotionFX::FileFormat::SHARED_CHUNK_MOTIONEVENTTABLE; - chunkHeader.mVersion = 3; + chunkHeader.m_chunkId = EMotionFX::FileFormat::SHARED_CHUNK_MOTIONEVENTTABLE; + chunkHeader.m_version = 3; - chunkHeader.mSizeInBytes = static_cast(serializedTableSizeInBytes + sizeof(EMotionFX::FileFormat::FileMotionEventTableSerialized)); + chunkHeader.m_sizeInBytes = static_cast(serializedTableSizeInBytes + sizeof(EMotionFX::FileFormat::FileMotionEventTableSerialized)); EMotionFX::FileFormat::FileMotionEventTableSerialized tableHeader; tableHeader.m_size = serializedTableSizeInBytes; diff --git a/Gems/EMotionFX/Code/EMotionFX/Exporters/ExporterLib/Exporter/NodeExport.cpp b/Gems/EMotionFX/Code/EMotionFX/Exporters/ExporterLib/Exporter/NodeExport.cpp index e7f0fa011e..91727b2113 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Exporters/ExporterLib/Exporter/NodeExport.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Exporters/ExporterLib/Exporter/NodeExport.cpp @@ -29,11 +29,11 @@ namespace ExporterLib const size_t parentIndex = node->GetParentIndex(); const size_t numChilds = node->GetNumChildNodes(); const EMotionFX::Transform& transform = actor->GetBindPose()->GetLocalSpaceTransform(nodeIndex); - AZ::PackedVector3f position = AZ::PackedVector3f(transform.mPosition); - AZ::Quaternion rotation = transform.mRotation.GetNormalized(); + AZ::PackedVector3f position = AZ::PackedVector3f(transform.m_position); + AZ::Quaternion rotation = transform.m_rotation.GetNormalized(); #ifndef EMFX_SCALE_DISABLED - AZ::PackedVector3f scale = AZ::PackedVector3f(transform.mScale); + AZ::PackedVector3f scale = AZ::PackedVector3f(transform.m_scale); #else AZ::PackedVector3f scale(1.0f, 1.0f, 1.0f); #endif @@ -42,12 +42,12 @@ namespace ExporterLib EMotionFX::FileFormat::Actor_Node2 nodeChunk; memset(&nodeChunk, 0, sizeof(EMotionFX::FileFormat::Actor_Node2)); - CopyVector(nodeChunk.mLocalPos, position); - CopyQuaternion(nodeChunk.mLocalQuat, rotation); - CopyVector(nodeChunk.mLocalScale, scale); + CopyVector(nodeChunk.m_localPos, position); + CopyQuaternion(nodeChunk.m_localQuat, rotation); + CopyVector(nodeChunk.m_localScale, scale); - nodeChunk.mNumChilds = aznumeric_caster(numChilds); - nodeChunk.mParentIndex = aznumeric_caster(parentIndex); + nodeChunk.m_numChilds = aznumeric_caster(numChilds); + nodeChunk.m_parentIndex = aznumeric_caster(parentIndex); // calculate and copy over the skeletal LODs uint32 skeletalLODs = 0; @@ -58,26 +58,26 @@ namespace ExporterLib skeletalLODs |= (1 << l); } } - nodeChunk.mSkeletalLODs = skeletalLODs; + nodeChunk.m_skeletalLoDs = skeletalLODs; // will this node be involved in the bounding volume calculations? if (node->GetIncludeInBoundsCalc()) { - nodeChunk.mNodeFlags |= EMotionFX::Node::ENodeFlags::FLAG_INCLUDEINBOUNDSCALC;// first bit + nodeChunk.m_nodeFlags |= EMotionFX::Node::ENodeFlags::FLAG_INCLUDEINBOUNDSCALC;// first bit } else { - nodeChunk.mNodeFlags &= ~EMotionFX::Node::ENodeFlags::FLAG_INCLUDEINBOUNDSCALC; + nodeChunk.m_nodeFlags &= ~EMotionFX::Node::ENodeFlags::FLAG_INCLUDEINBOUNDSCALC; } // Add an isCritical option in node flag so it won't be optimized out. if (node->GetIsCritical()) { - nodeChunk.mNodeFlags |= EMotionFX::Node::ENodeFlags::FLAG_CRITICAL; // third bit + nodeChunk.m_nodeFlags |= EMotionFX::Node::ENodeFlags::FLAG_CRITICAL; // third bit } else { - nodeChunk.mNodeFlags &= ~EMotionFX::Node::ENodeFlags::FLAG_CRITICAL; + nodeChunk.m_nodeFlags &= ~EMotionFX::Node::ENodeFlags::FLAG_CRITICAL; } // log the node chunk information @@ -90,15 +90,15 @@ namespace ExporterLib { MCore::LogDetailedInfo(" + Parent: name='%s' index=%i", actor->GetSkeleton()->GetNode(parentIndex)->GetName(), parentIndex); } - MCore::LogDetailedInfo(" + NumChilds: %i", nodeChunk.mNumChilds); - MCore::LogDetailedInfo(" + Position: x=%f y=%f z=%f", nodeChunk.mLocalPos.mX, nodeChunk.mLocalPos.mY, nodeChunk.mLocalPos.mZ); - MCore::LogDetailedInfo(" + Rotation: x=%f y=%f z=%f w=%f", nodeChunk.mLocalQuat.mX, nodeChunk.mLocalQuat.mY, nodeChunk.mLocalQuat.mZ, nodeChunk.mLocalQuat.mW); + MCore::LogDetailedInfo(" + NumChilds: %i", nodeChunk.m_numChilds); + MCore::LogDetailedInfo(" + Position: x=%f y=%f z=%f", nodeChunk.m_localPos.m_x, nodeChunk.m_localPos.m_y, nodeChunk.m_localPos.m_z); + MCore::LogDetailedInfo(" + Rotation: x=%f y=%f z=%f w=%f", nodeChunk.m_localQuat.m_x, nodeChunk.m_localQuat.m_y, nodeChunk.m_localQuat.m_z, nodeChunk.m_localQuat.m_w); const AZ::Vector3 euler = MCore::AzQuaternionToEulerAngles(rotation); MCore::LogDetailedInfo(" + Rotation Euler: x=%f y=%f z=%f", float(euler.GetX()) * 180.0 / MCore::Math::pi, float(euler.GetY()) * 180.0 / MCore::Math::pi, float(euler.GetZ()) * 180.0 / MCore::Math::pi); - MCore::LogDetailedInfo(" + Scale: x=%f y=%f z=%f", nodeChunk.mLocalScale.mX, nodeChunk.mLocalScale.mY, nodeChunk.mLocalScale.mZ); + MCore::LogDetailedInfo(" + Scale: x=%f y=%f z=%f", nodeChunk.m_localScale.m_x, nodeChunk.m_localScale.m_y, nodeChunk.m_localScale.m_z); MCore::LogDetailedInfo(" + IncludeInBoundsCalc: %d", node->GetIncludeInBoundsCalc()); // log skeletal lods @@ -111,12 +111,12 @@ namespace ExporterLib MCore::LogDetailedInfo(lodString.c_str()); // endian conversion - ConvertFileVector3(&nodeChunk.mLocalPos, targetEndianType); - ConvertFileQuaternion(&nodeChunk.mLocalQuat, targetEndianType); - ConvertFileVector3(&nodeChunk.mLocalScale, targetEndianType); - ConvertUnsignedInt(&nodeChunk.mParentIndex, targetEndianType); - ConvertUnsignedInt(&nodeChunk.mNumChilds, targetEndianType); - ConvertUnsignedInt(&nodeChunk.mSkeletalLODs, targetEndianType); + ConvertFileVector3(&nodeChunk.m_localPos, targetEndianType); + ConvertFileQuaternion(&nodeChunk.m_localQuat, targetEndianType); + ConvertFileVector3(&nodeChunk.m_localScale, targetEndianType); + ConvertUnsignedInt(&nodeChunk.m_parentIndex, targetEndianType); + ConvertUnsignedInt(&nodeChunk.m_numChilds, targetEndianType); + ConvertUnsignedInt(&nodeChunk.m_skeletalLoDs, targetEndianType); // write it file->Write(&nodeChunk, sizeof(EMotionFX::FileFormat::Actor_Node2)); @@ -136,14 +136,14 @@ namespace ExporterLib // chunk information EMotionFX::FileFormat::FileChunk chunkHeader; - chunkHeader.mChunkID = EMotionFX::FileFormat::ACTOR_CHUNK_NODES; - chunkHeader.mVersion = 2; + chunkHeader.m_chunkId = EMotionFX::FileFormat::ACTOR_CHUNK_NODES; + chunkHeader.m_version = 2; // get the nodes chunk size - chunkHeader.mSizeInBytes = aznumeric_caster(sizeof(EMotionFX::FileFormat::Actor_Nodes2) + numNodes * sizeof(EMotionFX::FileFormat::Actor_Node2)); + chunkHeader.m_sizeInBytes = aznumeric_caster(sizeof(EMotionFX::FileFormat::Actor_Nodes2) + numNodes * sizeof(EMotionFX::FileFormat::Actor_Node2)); for (size_t i = 0; i < numNodes; i++) { - chunkHeader.mSizeInBytes += GetStringChunkSize(actor->GetSkeleton()->GetNode(i)->GetName()); + chunkHeader.m_sizeInBytes += GetStringChunkSize(actor->GetSkeleton()->GetNode(i)->GetName()); } // endian conversion and write it @@ -152,12 +152,12 @@ namespace ExporterLib // nodes chunk EMotionFX::FileFormat::Actor_Nodes2 nodesChunk; - nodesChunk.mNumNodes = aznumeric_caster(numNodes); - nodesChunk.mNumRootNodes = aznumeric_caster(actor->GetSkeleton()->GetNumRootNodes()); + nodesChunk.m_numNodes = aznumeric_caster(numNodes); + nodesChunk.m_numRootNodes = aznumeric_caster(actor->GetSkeleton()->GetNumRootNodes()); // endian conversion and write it - ConvertUnsignedInt(&nodesChunk.mNumNodes, targetEndianType); - ConvertUnsignedInt(&nodesChunk.mNumRootNodes, targetEndianType); + ConvertUnsignedInt(&nodesChunk.m_numNodes, targetEndianType); + ConvertUnsignedInt(&nodesChunk.m_numRootNodes, targetEndianType); file->Write(&nodesChunk, sizeof(EMotionFX::FileFormat::Actor_Nodes2)); @@ -182,12 +182,12 @@ namespace ExporterLib memset(&groupChunk, 0, sizeof(EMotionFX::FileFormat::Actor_NodeGroup)); // set the data - groupChunk.mNumNodes = static_cast(numNodes); - groupChunk.mDisabledOnDefault = nodeGroup->GetIsEnabledOnDefault() ? false : true; + groupChunk.m_numNodes = static_cast(numNodes); + groupChunk.m_disabledOnDefault = nodeGroup->GetIsEnabledOnDefault() ? false : true; // logging MCore::LogDetailedInfo("- Group: name='%s'", nodeGroup->GetName()); - MCore::LogDetailedInfo(" + DisabledOnDefault: %i", groupChunk.mDisabledOnDefault); + MCore::LogDetailedInfo(" + DisabledOnDefault: %i", groupChunk.m_disabledOnDefault); AZStd::string nodesString; for (size_t i = 0; i < numNodes; ++i) { @@ -197,10 +197,10 @@ namespace ExporterLib nodesString += ", "; } } - MCore::LogDetailedInfo(" + Nodes (%i): %s", groupChunk.mNumNodes, nodesString.c_str()); + MCore::LogDetailedInfo(" + Nodes (%i): %s", groupChunk.m_numNodes, nodesString.c_str()); // endian conversion - ConvertUnsignedShort(&groupChunk.mNumNodes, targetEndianType); + ConvertUnsignedShort(&groupChunk.m_numNodes, targetEndianType); // write it file->Write(&groupChunk, sizeof(EMotionFX::FileFormat::Actor_NodeGroup)); @@ -240,16 +240,16 @@ namespace ExporterLib // chunk information EMotionFX::FileFormat::FileChunk chunkHeader; - chunkHeader.mChunkID = EMotionFX::FileFormat::ACTOR_CHUNK_NODEGROUPS; - chunkHeader.mVersion = 1; + chunkHeader.m_chunkId = EMotionFX::FileFormat::ACTOR_CHUNK_NODEGROUPS; + chunkHeader.m_version = 1; // calculate the chunk size - chunkHeader.mSizeInBytes = sizeof(uint16); + chunkHeader.m_sizeInBytes = sizeof(uint16); for (const EMotionFX::NodeGroup* nodeGroup : nodeGroups) { - chunkHeader.mSizeInBytes += sizeof(EMotionFX::FileFormat::Actor_NodeGroup); - chunkHeader.mSizeInBytes += GetStringChunkSize(nodeGroup->GetNameString()); - chunkHeader.mSizeInBytes += sizeof(uint16) * nodeGroup->GetNumNodes(); + chunkHeader.m_sizeInBytes += sizeof(EMotionFX::FileFormat::Actor_NodeGroup); + chunkHeader.m_sizeInBytes += GetStringChunkSize(nodeGroup->GetNameString()); + chunkHeader.m_sizeInBytes += sizeof(uint16) * nodeGroup->GetNumNodes(); } // endian conversion @@ -309,9 +309,9 @@ namespace ExporterLib // chunk information EMotionFX::FileFormat::FileChunk chunkHeader; - chunkHeader.mChunkID = EMotionFX::FileFormat::ACTOR_CHUNK_NODEMOTIONSOURCES; - chunkHeader.mSizeInBytes = aznumeric_caster(sizeof(EMotionFX::FileFormat::Actor_NodeMotionSources2) + (numNodes * sizeof(uint16)) + (numNodes * sizeof(uint8) * 2)); - chunkHeader.mVersion = 1; + chunkHeader.m_chunkId = EMotionFX::FileFormat::ACTOR_CHUNK_NODEMOTIONSOURCES; + chunkHeader.m_sizeInBytes = aznumeric_caster(sizeof(EMotionFX::FileFormat::Actor_NodeMotionSources2) + (numNodes * sizeof(uint16)) + (numNodes * sizeof(uint8) * 2)); + chunkHeader.m_version = 1; // endian conversion and write it ConvertFileChunk(&chunkHeader, targetEndianType); @@ -320,10 +320,10 @@ namespace ExporterLib // the node motion sources chunk data EMotionFX::FileFormat::Actor_NodeMotionSources2 nodeMotionSourcesChunk; - nodeMotionSourcesChunk.mNumNodes = aznumeric_caster(numNodes); + nodeMotionSourcesChunk.m_numNodes = aznumeric_caster(numNodes); // convert endian and save to the file - ConvertUnsignedInt(&nodeMotionSourcesChunk.mNumNodes, targetEndianType); + ConvertUnsignedInt(&nodeMotionSourcesChunk.m_numNodes, targetEndianType); file->Write(&nodeMotionSourcesChunk, sizeof(EMotionFX::FileFormat::Actor_NodeMotionSources2)); @@ -336,7 +336,7 @@ namespace ExporterLib for (const EMotionFX::Actor::NodeMirrorInfo& nodeMirrorInfo : *nodeMirrorInfos) { // get the motion node source - uint16 nodeMotionSource = nodeMirrorInfo.mSourceNode; + uint16 nodeMotionSource = nodeMirrorInfo.m_sourceNode; // convert endian and save to the file ConvertUnsignedShort(&nodeMotionSource, targetEndianType); @@ -346,14 +346,14 @@ namespace ExporterLib // write all axes for (const EMotionFX::Actor::NodeMirrorInfo& nodeMirrorInfo : *nodeMirrorInfos) { - uint8 axis = static_cast(nodeMirrorInfo.mAxis); + uint8 axis = static_cast(nodeMirrorInfo.m_axis); file->Write(&axis, sizeof(uint8)); } // write all flags for (const EMotionFX::Actor::NodeMirrorInfo& nodeMirrorInfo : *nodeMirrorInfos) { - uint8 flags = static_cast(nodeMirrorInfo.mFlags); + uint8 flags = static_cast(nodeMirrorInfo.m_flags); file->Write(&flags, sizeof(uint8)); } } @@ -398,9 +398,9 @@ namespace ExporterLib // chunk information EMotionFX::FileFormat::FileChunk chunkHeader; - chunkHeader.mChunkID = EMotionFX::FileFormat::ACTOR_CHUNK_ATTACHMENTNODES; - chunkHeader.mSizeInBytes = aznumeric_caster(sizeof(EMotionFX::FileFormat::Actor_AttachmentNodes) + numAttachmentNodes * sizeof(uint16)); - chunkHeader.mVersion = 1; + chunkHeader.m_chunkId = EMotionFX::FileFormat::ACTOR_CHUNK_ATTACHMENTNODES; + chunkHeader.m_sizeInBytes = aznumeric_caster(sizeof(EMotionFX::FileFormat::Actor_AttachmentNodes) + numAttachmentNodes * sizeof(uint16)); + chunkHeader.m_version = 1; // endian conversion and write it ConvertFileChunk(&chunkHeader, targetEndianType); @@ -409,10 +409,10 @@ namespace ExporterLib // the attachment nodes chunk data EMotionFX::FileFormat::Actor_AttachmentNodes attachmentNodesChunk; - attachmentNodesChunk.mNumNodes = aznumeric_caster(numAttachmentNodes); + attachmentNodesChunk.m_numNodes = aznumeric_caster(numAttachmentNodes); // convert endian and save to the file - ConvertUnsignedInt(&attachmentNodesChunk.mNumNodes, targetEndianType); + ConvertUnsignedInt(&attachmentNodesChunk.m_numNodes, targetEndianType); file->Write(&attachmentNodesChunk, sizeof(EMotionFX::FileFormat::Actor_AttachmentNodes)); // log details diff --git a/Gems/EMotionFX/Code/EMotionFX/Exporters/ExporterLib/Exporter/SkeletalMotionExport.cpp b/Gems/EMotionFX/Code/EMotionFX/Exporters/ExporterLib/Exporter/SkeletalMotionExport.cpp index 17c5011275..26c2c2c59e 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Exporters/ExporterLib/Exporter/SkeletalMotionExport.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Exporters/ExporterLib/Exporter/SkeletalMotionExport.cpp @@ -26,9 +26,9 @@ namespace ExporterLib EMotionFX::MotionData::SaveSettings saveSettings; saveSettings.m_targetEndianType = targetEndianType; EMotionFX::FileFormat::FileChunk chunkHeader; - chunkHeader.mChunkID = EMotionFX::FileFormat::MOTION_CHUNK_MOTIONDATA; - chunkHeader.mVersion = 1; - chunkHeader.mSizeInBytes = static_cast( + chunkHeader.m_chunkId = EMotionFX::FileFormat::MOTION_CHUNK_MOTIONDATA; + chunkHeader.m_version = 1; + chunkHeader.m_sizeInBytes = static_cast( sizeof(EMotionFX::FileFormat::Motion_MotionData) + ExporterLib::GetAzStringChunkSize(uuidString) + ExporterLib::GetAzStringChunkSize(nameString) + diff --git a/Gems/EMotionFX/Code/EMotionFX/Exporters/ExporterLib/Exporter/SkinExport.cpp b/Gems/EMotionFX/Code/EMotionFX/Exporters/ExporterLib/Exporter/SkinExport.cpp deleted file mode 100644 index 3c0c30ff53..0000000000 --- a/Gems/EMotionFX/Code/EMotionFX/Exporters/ExporterLib/Exporter/SkinExport.cpp +++ /dev/null @@ -1,186 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#include "Exporter.h" -#include -#include -#include -#include -#include -#include - - -namespace ExporterLib -{ - // save the given skin for the given LOD level - void SaveSkin(MCore::Stream* file, EMotionFX::Mesh* mesh, uint32 nodeIndex, bool isCollisionMesh, uint32 lodLevel, MCore::Endian::EEndianType targetEndianType) - { - MCORE_ASSERT(mesh); - - const uint32 numLayers = mesh->GetNumSharedVertexAttributeLayers(); - for (uint32 layerNr = 0; layerNr < numLayers; ++layerNr) - { - EMotionFX::VertexAttributeLayer* vertexAttributeLayer = mesh->GetSharedVertexAttributeLayer(layerNr); - - if (vertexAttributeLayer->GetType() != EMotionFX::SkinningInfoVertexAttributeLayer::TYPE_ID) - { - continue; - } - - EMotionFX::SkinningInfoVertexAttributeLayer* skinLayer = static_cast(vertexAttributeLayer); - - // get the number of original vertices - const uint32 numOrgVerts = skinLayer->GetNumAttributes(); - - // get the number of total influences - uint32 numTotalInfluences = 0; - uint32 v; - for (v = 0; v < numOrgVerts; ++v) - { - numTotalInfluences += aznumeric_cast(skinLayer->GetNumInfluences(v)); - } - - // skip meshes which don't contain any influences - if (numOrgVerts <= 0) - { - continue; - } - - if (numOrgVerts != mesh->GetNumOrgVertices()) - { - MCore::LogWarning("More/Less skinning influences (%i) found than the mesh actually has original vertices (%i).", numOrgVerts, mesh->GetNumOrgVertices()); - } - - // chunk header - EMotionFX::FileFormat::FileChunk chunkHeader; - - // calculate the total size and write the chunk header - uint32 totalSize = sizeof(EMotionFX::FileFormat::Actor_SkinningInfo); - totalSize += numTotalInfluences * sizeof(EMotionFX::FileFormat::Actor_SkinInfluence); - totalSize += numOrgVerts * sizeof(EMotionFX::FileFormat::Actor_SkinningInfoTableEntry); - - chunkHeader.mChunkID = EMotionFX::FileFormat::ACTOR_CHUNK_SKINNINGINFO; - chunkHeader.mSizeInBytes = totalSize; - chunkHeader.mVersion = 1; - - // endian conversion - ConvertFileChunk(&chunkHeader, targetEndianType); - - // write header and influence - file->Write(&chunkHeader, sizeof(EMotionFX::FileFormat::FileChunk)); - - if (nodeIndex == MCORE_INVALIDINDEX32) - { - MCore::LogError("Skin (Nr=%i) is not connected to a valid transform node.", nodeIndex); - } - - MCore::LogDetailedInfo(" - Skinning Info (NodeNr=%i):", nodeIndex); - MCore::LogDetailedInfo(" + Total data size: %d kB", totalSize / 1024); - MCore::LogDetailedInfo(" + Num org vertices: %d", numOrgVerts); - MCore::LogDetailedInfo(" + Num total influences: %d", numTotalInfluences); - - EMotionFX::FileFormat::Actor_SkinningInfo skinningInfoChunk; - memset(&skinningInfoChunk, 0, sizeof(EMotionFX::FileFormat::Actor_SkinningInfo)); - skinningInfoChunk.mIsForCollisionMesh = isCollisionMesh ? 1 : 0; - skinningInfoChunk.mNodeIndex = nodeIndex; - skinningInfoChunk.mLOD = lodLevel; - skinningInfoChunk.mNumTotalInfluences = numTotalInfluences; - - AZStd::set localJointIndices = skinLayer->CalcLocalJointIndices(numOrgVerts); - skinningInfoChunk.mNumLocalBones = static_cast(localJointIndices.size()); - - ConvertUnsignedInt(&skinningInfoChunk.mNodeIndex, targetEndianType); - ConvertUnsignedInt(&skinningInfoChunk.mLOD, targetEndianType); - ConvertUnsignedInt(&skinningInfoChunk.mNumTotalInfluences, targetEndianType); - ConvertUnsignedInt(&skinningInfoChunk.mNumLocalBones, targetEndianType); - - file->Write(&skinningInfoChunk, sizeof(EMotionFX::FileFormat::Actor_SkinningInfo)); - - for (v = 0; v < numOrgVerts; ++v) - { - const uint32 weightCount = aznumeric_cast(skinLayer->GetNumInfluences(v)); - - //LogDebug(" - Vertex#%i: NumWeights='%i'", v, weightCount); - - for (uint32 w = 0; w < weightCount; ++w) - { - EMotionFX::FileFormat::Actor_SkinInfluence skinInfluence; - memset(&skinInfluence, 0, sizeof(EMotionFX::FileFormat::Actor_SkinInfluence)); - skinInfluence.mNodeNr = skinLayer->GetInfluence(v, w)->GetNodeNr(); - skinInfluence.mWeight = skinLayer->GetInfluence(v, w)->GetWeight(); - - //LogDebug(" + SkingInfluence#%i: NodeNr='%i', Weight='%f'", w, skinInfluence.mNodeNr, skinInfluence.mWeight); - - ConvertUnsignedShort(&skinInfluence.mNodeNr, targetEndianType); - ConvertFloat(&skinInfluence.mWeight, targetEndianType); - - file->Write(&skinInfluence, sizeof(EMotionFX::FileFormat::Actor_SkinInfluence)); - } - } - - uint32 currentInfluence = 0; - for (v = 0; v < numOrgVerts; ++v) - { - const uint32 weightCount = aznumeric_cast(skinLayer->GetNumInfluences(v)); - - EMotionFX::FileFormat::Actor_SkinningInfoTableEntry skinningTableEntryChunk; - skinningTableEntryChunk.mNumElements = weightCount; - skinningTableEntryChunk.mStartIndex = currentInfluence; - - ConvertUnsignedInt(&skinningTableEntryChunk.mNumElements, targetEndianType); - ConvertUnsignedInt(&skinningTableEntryChunk.mStartIndex, targetEndianType); - - file->Write(&skinningTableEntryChunk, sizeof(EMotionFX::FileFormat::Actor_SkinningInfoTableEntry)); - - currentInfluence += weightCount; - } - } - } - - - // save skins for all nodes for the given LOD level - void SaveSkins(MCore::Stream* file, EMotionFX::Actor* actor, uint32 lodLevel, MCore::Endian::EEndianType targetEndianType) - { - MCORE_ASSERT(file); - - // get the number of nodes - const uint32 numNodes = actor->GetNumNodes(); - - MCore::LogDetailedInfo("============================================================"); - MCore::LogInfo("Skins (LOD=%d", lodLevel); - MCore::LogDetailedInfo("============================================================"); - - // iterate through all nodes - for (uint32 i = 0; i < numNodes; i++) - { - // get the mesh and save it - EMotionFX::Mesh* mesh = actor->GetMesh(lodLevel, i); - if (mesh) - { - SaveSkin(file, mesh, i, false, lodLevel, targetEndianType); - } - - // get the collision mesh and save it - //EMotionFX::Mesh* collisionMesh = actor->GetCollisionMesh(lodLevel, i); - //if (collisionMesh) - //SaveSkin( file, collisionMesh, i, true, lodLevel, targetEndianType ); - } - } - - - // save all skins for all LOD levels - void SaveSkins(MCore::Stream* file, EMotionFX::Actor* actor, MCore::Endian::EEndianType targetEndianType) - { - // get the number of LOD levels, iterate through them and save all skins - const uint32 numLODLevels = actor->GetNumLODLevels(); - for (uint32 i = 0; i < numLODLevels; ++i) - { - SaveSkins(file, actor, i, targetEndianType); - } - } -} // namespace ExporterLib diff --git a/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/Camera.cpp b/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/Camera.cpp index fe33cff6e5..f4447c1b10 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/Camera.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/Camera.cpp @@ -17,10 +17,10 @@ namespace MCommon Camera::Camera() { Reset(); - mPosition = AZ::Vector3::CreateZero(); - mScreenWidth = 0; - mScreenHeight = 0; - mProjectionMode = PROJMODE_PERSPECTIVE; + m_position = AZ::Vector3::CreateZero(); + m_screenWidth = 0; + m_screenHeight = 0; + m_projectionMode = PROJMODE_PERSPECTIVE; } @@ -36,27 +36,27 @@ namespace MCommon MCORE_UNUSED(timeDelta); // setup projection matrix - switch (mProjectionMode) + switch (m_projectionMode) { // initialize for perspective projection case PROJMODE_PERSPECTIVE: { - MCore::PerspectiveRH(mProjectionMatrix, MCore::Math::DegreesToRadians(mFOV), mAspect, mNearClipDistance, mFarClipDistance); + MCore::PerspectiveRH(m_projectionMatrix, MCore::Math::DegreesToRadians(m_fov), m_aspect, m_nearClipDistance, m_farClipDistance); break; } // initialize for orthographic projection case PROJMODE_ORTHOGRAPHIC: { - const float halfX = mOrthoClipDimensions.GetX() * 0.5f; - const float halfY = mOrthoClipDimensions.GetY() * 0.5f; - MCore::OrthoOffCenterRH(mProjectionMatrix, -halfX, halfX, halfY, -halfY, -mFarClipDistance, mFarClipDistance); + const float halfX = m_orthoClipDimensions.GetX() * 0.5f; + const float halfY = m_orthoClipDimensions.GetY() * 0.5f; + MCore::OrthoOffCenterRH(m_projectionMatrix, -halfX, halfX, halfY, -halfY, -m_farClipDistance, m_farClipDistance); break; } } // calculate the viewproj matrix - mViewProjMatrix = mProjectionMatrix * mViewMatrix; + m_viewProjMatrix = m_projectionMatrix * m_viewMatrix; } @@ -65,24 +65,24 @@ namespace MCommon { MCORE_UNUSED(flightTime); - mFOV = 55.0f; - mNearClipDistance = 0.1f; - mFarClipDistance = 200.0f; - mAspect = 16.0f / 9.0f; - mRotationSpeed = 0.5f; - mTranslationSpeed = 1.0f; - mViewMatrix = AZ::Matrix4x4::CreateIdentity(); + m_fov = 55.0f; + m_nearClipDistance = 0.1f; + m_farClipDistance = 200.0f; + m_aspect = 16.0f / 9.0f; + m_rotationSpeed = 0.5f; + m_translationSpeed = 1.0f; + m_viewMatrix = AZ::Matrix4x4::CreateIdentity(); } // unproject screen coordinates to a ray MCore::Ray Camera::Unproject(int32 screenX, int32 screenY) { - const AZ::Matrix4x4 invProj = MCore::InvertProjectionMatrix(mProjectionMatrix); - const AZ::Matrix4x4 invView = MCore::InvertProjectionMatrix(mViewMatrix); + const AZ::Matrix4x4 invProj = MCore::InvertProjectionMatrix(m_projectionMatrix); + const AZ::Matrix4x4 invView = MCore::InvertProjectionMatrix(m_viewMatrix); - const AZ::Vector3 start = MCore::Unproject(static_cast(screenX), static_cast(screenY), static_cast(mScreenWidth), static_cast(mScreenHeight), mNearClipDistance, invProj, invView); - const AZ::Vector3 end = MCore::Unproject(static_cast(screenX), static_cast(screenY), static_cast(mScreenWidth), static_cast(mScreenHeight), mFarClipDistance, invProj, invView); + const AZ::Vector3 start = MCore::Unproject(static_cast(screenX), static_cast(screenY), static_cast(m_screenWidth), static_cast(m_screenHeight), m_nearClipDistance, invProj, invView); + const AZ::Vector3 end = MCore::Unproject(static_cast(screenX), static_cast(screenY), static_cast(m_screenWidth), static_cast(m_screenHeight), m_farClipDistance, invProj, invView); return MCore::Ray(start, end); } diff --git a/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/Camera.h b/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/Camera.h index 6a95621b0d..46b81a9d25 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/Camera.h +++ b/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/Camera.h @@ -148,24 +148,24 @@ namespace MCommon * The projection matrix will be calculated every Update(). * @return The projection matrix. */ - MCORE_INLINE AZ::Matrix4x4& GetProjectionMatrix() { return mProjectionMatrix; } - MCORE_INLINE const AZ::Matrix4x4& GetProjectionMatrix() const { return mProjectionMatrix; } + MCORE_INLINE AZ::Matrix4x4& GetProjectionMatrix() { return m_projectionMatrix; } + MCORE_INLINE const AZ::Matrix4x4& GetProjectionMatrix() const { return m_projectionMatrix; } /** * Get the view matrix of the camera. * The view matrix will be calculated every Update(). * @return The view matrix. */ - MCORE_INLINE AZ::Matrix4x4& GetViewMatrix() { return mViewMatrix; } - MCORE_INLINE const AZ::Matrix4x4& GetViewMatrix() const { return mViewMatrix; } + MCORE_INLINE AZ::Matrix4x4& GetViewMatrix() { return m_viewMatrix; } + MCORE_INLINE const AZ::Matrix4x4& GetViewMatrix() const { return m_viewMatrix; } /** * Get the precalculated viewMatrix * projectionMatrix of the camera. * The viewproj matrix will be calculated every Update(). * @return The precalculated matrix containing the result of viewMatrix * projectionMatrix. */ - MCORE_INLINE AZ::Matrix4x4& GetViewProjMatrix() { return mViewProjMatrix; } - MCORE_INLINE const AZ::Matrix4x4& GetViewProjMatrix() const { return mViewProjMatrix; } + MCORE_INLINE AZ::Matrix4x4& GetViewProjMatrix() { return m_viewProjMatrix; } + MCORE_INLINE const AZ::Matrix4x4& GetViewProjMatrix() const { return m_viewProjMatrix; } /** * Get the translation speed. @@ -261,20 +261,20 @@ namespace MCommon virtual void AutoUpdateLimits() {} protected: - AZ::Matrix4x4 mProjectionMatrix; /**< The projection matrix. */ - AZ::Matrix4x4 mViewMatrix; /**< The view matrix. */ - AZ::Matrix4x4 mViewProjMatrix; /**< ViewMatrix * projectionMatrix. Will be recalculated every update call. */ - AZ::Vector3 mPosition; /**< The camera position. */ - AZ::Vector2 mOrthoClipDimensions; /**< A two component vector which defines the distance to the left (x component) and to the top (y component) from the view origin. */ - float mFOV; /**< The vertical field-of-view in degrees. */ - float mNearClipDistance; /**< Distance to the near clipping plane. */ - float mFarClipDistance; /**< Distance to the far clipping plane. */ - float mAspect; /**< x/y viewport ratio. */ - float mRotationSpeed; /**< The angle in degrees that will be applied to the current rotation when the mouse is moving one pixel. */ - float mTranslationSpeed; /**< The value that will be applied to the current camera position when moving the mouse one pixel. */ - ProjectionMode mProjectionMode; /**< The projection mode. The camera supports either perspective or orthographic projection. */ - uint32 mScreenWidth; /**< The screen width in pixels where the camera is used. */ - uint32 mScreenHeight; /**< The screen height in pixels where the camera is used. */ + AZ::Matrix4x4 m_projectionMatrix; /**< The projection matrix. */ + AZ::Matrix4x4 m_viewMatrix; /**< The view matrix. */ + AZ::Matrix4x4 m_viewProjMatrix; /**< ViewMatrix * projectionMatrix. Will be recalculated every update call. */ + AZ::Vector3 m_position; /**< The camera position. */ + AZ::Vector2 m_orthoClipDimensions; /**< A two component vector which defines the distance to the left (x component) and to the top (y component) from the view origin. */ + float m_fov; /**< The vertical field-of-view in degrees. */ + float m_nearClipDistance; /**< Distance to the near clipping plane. */ + float m_farClipDistance; /**< Distance to the far clipping plane. */ + float m_aspect; /**< x/y viewport ratio. */ + float m_rotationSpeed; /**< The angle in degrees that will be applied to the current rotation when the mouse is moving one pixel. */ + float m_translationSpeed; /**< The value that will be applied to the current camera position when moving the mouse one pixel. */ + ProjectionMode m_projectionMode; /**< The projection mode. The camera supports either perspective or orthographic projection. */ + uint32 m_screenWidth; /**< The screen width in pixels where the camera is used. */ + uint32 m_screenHeight; /**< The screen height in pixels where the camera is used. */ }; // include inline code diff --git a/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/Camera.inl b/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/Camera.inl index c6947576d3..43e2ce6fbd 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/Camera.inl +++ b/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/Camera.inl @@ -12,139 +12,139 @@ // set the camera position MCORE_INLINE void Camera::SetPosition(const AZ::Vector3& position) { - mPosition = position; + m_position = position; } // get the camera position MCORE_INLINE const AZ::Vector3& Camera::GetPosition() const { - return mPosition; + return m_position; } // set the projection type MCORE_INLINE void Camera::SetProjectionMode(ProjectionMode projectionMode) { - mProjectionMode = projectionMode; + m_projectionMode = projectionMode; } // get the projection type MCORE_INLINE Camera::ProjectionMode Camera::GetProjectionMode() const { - return mProjectionMode; + return m_projectionMode; } // set the clip dimensions for the orthographic projection mode MCORE_INLINE void Camera::SetOrthoClipDimensions(const AZ::Vector2& clipDimensions) { - mOrthoClipDimensions = clipDimensions; + m_orthoClipDimensions = clipDimensions; } // set the screen dimensions where this camera is used in MCORE_INLINE void Camera::SetScreenDimensions(uint32 width, uint32 height) { - mScreenWidth = width; - mScreenHeight = height; + m_screenWidth = width; + m_screenHeight = height; } // set the field of view in degrees MCORE_INLINE void Camera::SetFOV(float fieldOfView) { - mFOV = fieldOfView; + m_fov = fieldOfView; } // set near clip plane distance MCORE_INLINE void Camera::SetNearClipDistance(float nearClipDistance) { - mNearClipDistance = nearClipDistance; + m_nearClipDistance = nearClipDistance; } // set far clip plane distance MCORE_INLINE void Camera::SetFarClipDistance(float farClipDistance) { - mFarClipDistance = farClipDistance; + m_farClipDistance = farClipDistance; } // set the aspect ratio - the aspect ratio is calculated by width/height MCORE_INLINE void Camera::SetAspectRatio(float aspect) { - mAspect = aspect; + m_aspect = aspect; } // return the field of view in degrees MCORE_INLINE float Camera::GetFOV() const { - return mFOV; + return m_fov; } // return the near clip plane distance MCORE_INLINE float Camera::GetNearClipDistance() const { - return mNearClipDistance; + return m_nearClipDistance; } // return the far clip plane distance MCORE_INLINE float Camera::GetFarClipDistance() const { - return mFarClipDistance; + return m_farClipDistance; } // return the aspect ratio MCORE_INLINE float Camera::GetAspectRatio() const { - return mAspect; + return m_aspect; } // get the translation speed MCORE_INLINE float Camera::GetTranslationSpeed() const { - return mTranslationSpeed; + return m_translationSpeed; } // set the translation speed MCORE_INLINE void Camera::SetTranslationSpeed(float translationSpeed) { - mTranslationSpeed = translationSpeed; + m_translationSpeed = translationSpeed; } // get the rotation speed in degrees MCORE_INLINE float Camera::GetRotationSpeed() const { - return mRotationSpeed; + return m_rotationSpeed; } // set the rotation speed in degrees MCORE_INLINE void Camera::SetRotationSpeed(float rotationSpeed) { - mRotationSpeed = rotationSpeed; + m_rotationSpeed = rotationSpeed; } // Get the screen width. MCORE_INLINE uint32 Camera::GetScreenWidth() { - return mScreenWidth; + return m_screenWidth; } // Get the screen height MCORE_INLINE uint32 Camera::GetScreenHeight() { - return mScreenHeight; + return m_screenHeight; } diff --git a/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/FirstPersonCamera.cpp b/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/FirstPersonCamera.cpp index cebfc350b1..112d3c1dc1 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/FirstPersonCamera.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/FirstPersonCamera.cpp @@ -32,20 +32,20 @@ namespace MCommon MCORE_UNUSED(timeDelta); // lock pitching to [-90.0°, 90.0°] - if (mPitch < -90.0f + 0.1f) + if (m_pitch < -90.0f + 0.1f) { - mPitch = -90.0f + 0.1f; + m_pitch = -90.0f + 0.1f; } - if (mPitch > 90.0f - 0.1f) + if (m_pitch > 90.0f - 0.1f) { - mPitch = 90.0f - 0.1f; + m_pitch = 90.0f - 0.1f; } // calculate the camera direction vector based on the yaw and pitch - AZ::Vector3 direction = (AZ::Matrix4x4::CreateRotationX(MCore::Math::DegreesToRadians(mPitch)) * AZ::Matrix4x4::CreateRotationY(MCore::Math::DegreesToRadians(mYaw))) * (AZ::Vector3(0.0f, 0.0f, 1.0f)).GetNormalized(); + AZ::Vector3 direction = (AZ::Matrix4x4::CreateRotationX(MCore::Math::DegreesToRadians(m_pitch)) * AZ::Matrix4x4::CreateRotationY(MCore::Math::DegreesToRadians(m_yaw))) * (AZ::Vector3(0.0f, 0.0f, 1.0f)).GetNormalized(); // look from the camera position into the newly calculated direction - MCore::LookAt(mViewMatrix, mPosition, mPosition + direction * 10.0f, AZ::Vector3(0.0f, 1.0f, 0.0f)); + MCore::LookAt(m_viewMatrix, m_position, m_position + direction * 10.0f, AZ::Vector3(0.0f, 1.0f, 0.0f)); // update our base camera Camera::Update(); @@ -62,7 +62,7 @@ namespace MCommon EKeyboardButtonState buttonState = (EKeyboardButtonState)keyboardKeyFlags; - AZ::Matrix4x4 transposedViewMatrix(mViewMatrix); + AZ::Matrix4x4 transposedViewMatrix(m_viewMatrix); transposedViewMatrix.Transpose(); // get the movement direction vector based on the keyboard input @@ -95,14 +95,14 @@ namespace MCommon // only move the camera when the delta movement is not the zero vector if (MCore::SafeLength(deltaMovement) > MCore::Math::epsilon) { - mPosition += deltaMovement.GetNormalized() * mTranslationSpeed; + m_position += deltaMovement.GetNormalized() * m_translationSpeed; } // rotate the camera if (buttonState & ENABLE_MOUSELOOK) { - mYaw += mouseMovementX * mRotationSpeed; - mPitch += mouseMovementY * mRotationSpeed; + m_yaw += mouseMovementX * m_rotationSpeed; + m_pitch += mouseMovementY * m_rotationSpeed; } } @@ -115,8 +115,8 @@ namespace MCommon // reset the base class attributes Camera::Reset(); - mPitch = 0.0f; - mYaw = 0.0f; - mRoll = 0.0f; + m_pitch = 0.0f; + m_yaw = 0.0f; + m_roll = 0.0f; } } // namespace MCommon diff --git a/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/FirstPersonCamera.h b/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/FirstPersonCamera.h index 54addd0bc4..e0abe7922c 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/FirstPersonCamera.h +++ b/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/FirstPersonCamera.h @@ -60,37 +60,37 @@ namespace MCommon * Set the pitch angle in degrees. Looking up and down is limited to 90°. (0=Straight Ahead, +Up, -Down) * @param The pitch angle in degrees, range[-90.0°, 90.0°]. */ - MCORE_INLINE void SetPitch(float pitch) { mPitch = pitch; } + MCORE_INLINE void SetPitch(float pitch) { m_pitch = pitch; } /** * Set the yaw angle in degrees. Vertical rotation. (0=East, +North, -South). * @param yaw The yaw angle in degrees. */ - MCORE_INLINE void SetYaw(float yaw) { mYaw = yaw; } + MCORE_INLINE void SetYaw(float yaw) { m_yaw = yaw; } /** * Set the roll angle in degrees. Rotation around the direction axis (0=Straight, +Clockwise, -CCW). * @param roll The roll angle in degrees. */ - MCORE_INLINE void SetRoll(float roll) { mRoll = roll; } + MCORE_INLINE void SetRoll(float roll) { m_roll = roll; } /** * Get the pitch angle in degrees. Looking up and down is limited to 90°. (0=Straight Ahead, +Up, -Down) * @return The pitch angle in degrees, range[-90.0°, 90.0°]. */ - MCORE_INLINE float GetPitch() const { return mPitch; } + MCORE_INLINE float GetPitch() const { return m_pitch; } /** * Get the yaw angle in degrees. Vertical rotation. (0=East, +North, -South). * @return The yaw angle in degrees. */ - MCORE_INLINE float GetYaw() const { return mYaw; } + MCORE_INLINE float GetYaw() const { return m_yaw; } /** * Get the roll angle in degrees. Rotation around the direction axis (0=Straight, +Clockwise, -CCW). * @return The roll angle in degrees. */ - MCORE_INLINE float GetRoll() const { return mRoll; } + MCORE_INLINE float GetRoll() const { return m_roll; } /** * Update the camera transformation. @@ -119,9 +119,9 @@ namespace MCommon void Reset(float flightTime = 0.0f); private: - float mPitch; /**< Up and down. (0=straight ahead, +up, -down) */ - float mYaw; /**< Steering. (0=east, +north, -south) */ - float mRoll; /**< Rotation around axis of screen. (0=straight, +clockwise, -CCW) */ + float m_pitch; /**< Up and down. (0=straight ahead, +up, -down) */ + float m_yaw; /**< Steering. (0=east, +north, -south) */ + float m_roll; /**< Rotation around axis of screen. (0=straight, +clockwise, -CCW) */ }; } // namespace MCommon diff --git a/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/LookAtCamera.cpp b/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/LookAtCamera.cpp index 9cb0355ca0..1599433f9e 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/LookAtCamera.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/LookAtCamera.cpp @@ -29,8 +29,8 @@ namespace MCommon // look at target void LookAtCamera::LookAt(const AZ::Vector3& target, const AZ::Vector3& up) { - mTarget = target; - mUp = up; + m_target = target; + m_up = up; } @@ -39,7 +39,7 @@ namespace MCommon { MCORE_UNUSED(timeDelta); - MCore::LookAtRH(mViewMatrix, mPosition, mTarget, mUp); + MCore::LookAtRH(m_viewMatrix, m_position, m_target, m_up); // update our base camera at the very end Camera::Update(); @@ -53,6 +53,6 @@ namespace MCommon // reset the base class attributes Camera::Reset(); - mUp.Set(0.0f, 0.0f, 1.0f); + m_up.Set(0.0f, 0.0f, 1.0f); } } // namespace MCommon diff --git a/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/LookAtCamera.h b/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/LookAtCamera.h index 00b86e3b05..e17fe65985 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/LookAtCamera.h +++ b/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/LookAtCamera.h @@ -66,29 +66,29 @@ namespace MCommon * Set the target position. Note that the camera needs an update after setting a new target. * @param[in] target The new camera target. */ - MCORE_INLINE void SetTarget(const AZ::Vector3& target) { mTarget = target; } + MCORE_INLINE void SetTarget(const AZ::Vector3& target) { m_target = target; } /** * Get the target position. * @return The current camera target. */ - MCORE_INLINE AZ::Vector3 GetTarget() const { return mTarget; } + MCORE_INLINE AZ::Vector3 GetTarget() const { return m_target; } /** * Set the up vector for the camera. Note that the camera needs an update after setting a new up vector. * @param[in] up The new camera up vector. */ - MCORE_INLINE void SetUp(const AZ::Vector3& up) { mUp = up; } + MCORE_INLINE void SetUp(const AZ::Vector3& up) { m_up = up; } /** * Get the camera up vector. * @return The current up vector. */ - MCORE_INLINE AZ::Vector3 GetUp() const { return mUp; } + MCORE_INLINE AZ::Vector3 GetUp() const { return m_up; } protected: - AZ::Vector3 mTarget; /**< The camera target. */ - AZ::Vector3 mUp; /**< The up vector of the camera. */ + AZ::Vector3 m_target; /**< The camera target. */ + AZ::Vector3 m_up; /**< The up vector of the camera. */ }; } // namespace MCommon diff --git a/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/OrbitCamera.cpp b/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/OrbitCamera.cpp index 471d4439c6..7a2769ea4d 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/OrbitCamera.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/OrbitCamera.cpp @@ -33,32 +33,32 @@ namespace MCommon // reset the parent class attributes LookAtCamera::Reset(); - mMinDistance = mNearClipDistance; - mMaxDistance = mFarClipDistance * 0.5f; - mPosition = AZ::Vector3::CreateZero(); - mPositionDelta = AZ::Vector2(0.0f, 0.0f); + m_minDistance = m_nearClipDistance; + m_maxDistance = m_farClipDistance * 0.5f; + m_position = AZ::Vector3::CreateZero(); + m_positionDelta = AZ::Vector2(0.0f, 0.0f); if (flightTime < MCore::Math::epsilon) { - mFlightActive = false; - mCurrentDistance = (float)MCore::Distance::ConvertValue(5.0f, MCore::Distance::UNITTYPE_METERS, EMotionFX::GetEMotionFX().GetUnitType()); - mAlpha = GetDefaultAlpha(); - mBeta = GetDefaultBeta(); - mTarget = AZ::Vector3::CreateZero(); + m_flightActive = false; + m_currentDistance = (float)MCore::Distance::ConvertValue(5.0f, MCore::Distance::UNITTYPE_METERS, EMotionFX::GetEMotionFX().GetUnitType()); + m_alpha = GetDefaultAlpha(); + m_beta = GetDefaultBeta(); + m_target = AZ::Vector3::CreateZero(); } else { - mFlightActive = true; - mFlightMaxTime = flightTime; - mFlightCurrentTime = 0.0f; - mFlightSourceDistance = mCurrentDistance; - mFlightTargetDistance = (float)MCore::Distance::ConvertValue(5.0f, MCore::Distance::UNITTYPE_METERS, EMotionFX::GetEMotionFX().GetUnitType()); - mFlightSourcePosition = mTarget; - mFlightTargetPosition = AZ::Vector3::CreateZero(); - mFlightSourceAlpha = mAlpha; - mFlightTargetAlpha = GetDefaultAlpha(); - mFlightSourceBeta = mBeta; - mFlightTargetBeta = GetDefaultBeta(); + m_flightActive = true; + m_flightMaxTime = flightTime; + m_flightCurrentTime = 0.0f; + m_flightSourceDistance = m_currentDistance; + m_flightTargetDistance = (float)MCore::Distance::ConvertValue(5.0f, MCore::Distance::UNITTYPE_METERS, EMotionFX::GetEMotionFX().GetUnitType()); + m_flightSourcePosition = m_target; + m_flightTargetPosition = AZ::Vector3::CreateZero(); + m_flightSourceAlpha = m_alpha; + m_flightTargetAlpha = GetDefaultAlpha(); + m_flightSourceBeta = m_beta; + m_flightTargetBeta = GetDefaultBeta(); } } @@ -66,53 +66,53 @@ namespace MCommon // update limits void OrbitCamera::AutoUpdateLimits() { - mMinDistance = mNearClipDistance; - mMaxDistance = mFarClipDistance * 0.5f; + m_minDistance = m_nearClipDistance; + m_maxDistance = m_farClipDistance * 0.5f; } void OrbitCamera::StartFlight(float distance, const AZ::Vector3& position, float alpha, float beta, float flightTime) { - mFlightActive = true; - mFlightMaxTime = flightTime; - mFlightCurrentTime = 0.0f; - mFlightSourceDistance = mCurrentDistance; - mFlightSourcePosition = mTarget; - mFlightTargetDistance = distance; - mFlightTargetPosition = position; - mFlightSourceAlpha = mAlpha; - mFlightTargetAlpha = alpha; - mFlightSourceBeta = mBeta; - mFlightTargetBeta = beta; + m_flightActive = true; + m_flightMaxTime = flightTime; + m_flightCurrentTime = 0.0f; + m_flightSourceDistance = m_currentDistance; + m_flightSourcePosition = m_target; + m_flightTargetDistance = distance; + m_flightTargetPosition = position; + m_flightSourceAlpha = m_alpha; + m_flightTargetAlpha = alpha; + m_flightSourceBeta = m_beta; + m_flightTargetBeta = beta; } // closeup view of the given bounding box void OrbitCamera::ViewCloseup(const MCore::AABB& boundingBox, float flightTime) { - mFlightActive = true; - mFlightMaxTime = flightTime; - mFlightCurrentTime = 0.0f; - mFlightSourceDistance = mCurrentDistance; - mFlightSourcePosition = mTarget; - const float distanceHorizontalFOV = boundingBox.CalcRadius() / MCore::Math::Tan(0.5f * MCore::Math::DegreesToRadians(mFOV)); - const float distanceVerticalFOV = boundingBox.CalcRadius() / MCore::Math::Tan(0.5f * MCore::Math::DegreesToRadians(mFOV * mAspect)); - mFlightTargetDistance = MCore::Max(distanceHorizontalFOV, distanceVerticalFOV) * 0.9f; - mFlightTargetPosition = boundingBox.CalcMiddle(); - mFlightSourceAlpha = mAlpha; - mFlightSourceAlpha = mAlpha; - mFlightTargetAlpha = GetDefaultAlpha(); - mFlightSourceBeta = mBeta; - mFlightTargetBeta = GetDefaultBeta(); + m_flightActive = true; + m_flightMaxTime = flightTime; + m_flightCurrentTime = 0.0f; + m_flightSourceDistance = m_currentDistance; + m_flightSourcePosition = m_target; + const float distanceHorizontalFOV = boundingBox.CalcRadius() / MCore::Math::Tan(0.5f * MCore::Math::DegreesToRadians(m_fov)); + const float distanceVerticalFOV = boundingBox.CalcRadius() / MCore::Math::Tan(0.5f * MCore::Math::DegreesToRadians(m_fov * m_aspect)); + m_flightTargetDistance = MCore::Max(distanceHorizontalFOV, distanceVerticalFOV) * 0.9f; + m_flightTargetPosition = boundingBox.CalcMiddle(); + m_flightSourceAlpha = m_alpha; + m_flightSourceAlpha = m_alpha; + m_flightTargetAlpha = GetDefaultAlpha(); + m_flightSourceBeta = m_beta; + m_flightTargetBeta = GetDefaultBeta(); // make sure the target flight distance is in range - if (mFlightTargetDistance < mMinDistance) + if (m_flightTargetDistance < m_minDistance) { - mFlightTargetDistance = mMinDistance; + m_flightTargetDistance = m_minDistance; } - if (mFlightTargetDistance > mMaxDistance) + if (m_flightTargetDistance > m_maxDistance) { - mFlightTargetDistance = mMaxDistance; + m_flightTargetDistance = m_maxDistance; } } @@ -127,24 +127,24 @@ namespace MCommon if (leftButtonPressed && rightButtonPressed == false && middleButtonPressed == false) { // rotate our camera - mAlpha += mRotationSpeed * (float)-mouseMovementX; - mBeta += mRotationSpeed * (float) mouseMovementY; + m_alpha += m_rotationSpeed * (float)-mouseMovementX; + m_beta += m_rotationSpeed * (float) mouseMovementY; // prevent the camera from looking upside down - if (mBeta >= 90.0f - 0.01f) + if (m_beta >= 90.0f - 0.01f) { - mBeta = 90.0f - 0.01f; + m_beta = 90.0f - 0.01f; } - if (mBeta <= -90.0f + 0.01f) + if (m_beta <= -90.0f + 0.01f) { - mBeta = -90.0f + 0.01f; + m_beta = -90.0f + 0.01f; } // reset the camera to no rotation if we made a whole circle - if (mAlpha >= 360.0f || mAlpha <= -360.0f) + if (m_alpha >= 360.0f || m_alpha <= -360.0f) { - mAlpha = 0.0f; + m_alpha = 0.0f; } } @@ -152,8 +152,8 @@ namespace MCommon // zoom camera in or out if (leftButtonPressed == false && rightButtonPressed && middleButtonPressed == false) { - const float distanceScale = mCurrentDistance * 0.002f; - mCurrentDistance += (float)-mouseMovementY * distanceScale; + const float distanceScale = m_currentDistance * 0.002f; + m_currentDistance += (float)-mouseMovementY * distanceScale; } // is middle (or left+right) mouse button pressed? @@ -161,13 +161,13 @@ namespace MCommon if ((leftButtonPressed == false && rightButtonPressed == false && middleButtonPressed) || (leftButtonPressed && rightButtonPressed && middleButtonPressed == false)) { - const float distanceScale = mCurrentDistance * 0.002f; + const float distanceScale = m_currentDistance * 0.002f; //if (MCore::GetCoordinateSystem().IsRightHanded()) //distanceScale *= -1.0f; - mPositionDelta.SetX((float)mouseMovementX * distanceScale); - mPositionDelta.SetY((float)mouseMovementY * distanceScale); + m_positionDelta.SetX((float)mouseMovementX * distanceScale); + m_positionDelta.SetY((float)mouseMovementY * distanceScale); } } @@ -175,59 +175,59 @@ namespace MCommon // update the camera void OrbitCamera::Update(float timeDelta) { - if (mFlightActive) + if (m_flightActive) { - mFlightCurrentTime += timeDelta; + m_flightCurrentTime += timeDelta; - const float normalizedTime = mFlightCurrentTime / mFlightMaxTime; + const float normalizedTime = m_flightCurrentTime / m_flightMaxTime; const float interpolatedTime = MCore::CosineInterpolate(0.0f, 1.0f, normalizedTime); - mTarget = mFlightSourcePosition + (mFlightTargetPosition - mFlightSourcePosition) * interpolatedTime; - mCurrentDistance = mFlightSourceDistance + (mFlightTargetDistance - mFlightSourceDistance) * interpolatedTime; - mAlpha = mFlightSourceAlpha + (mFlightTargetAlpha - mFlightSourceAlpha) * interpolatedTime; - mBeta = mFlightSourceBeta + (mFlightTargetBeta - mFlightSourceBeta) * interpolatedTime; + m_target = m_flightSourcePosition + (m_flightTargetPosition - m_flightSourcePosition) * interpolatedTime; + m_currentDistance = m_flightSourceDistance + (m_flightTargetDistance - m_flightSourceDistance) * interpolatedTime; + m_alpha = m_flightSourceAlpha + (m_flightTargetAlpha - m_flightSourceAlpha) * interpolatedTime; + m_beta = m_flightSourceBeta + (m_flightTargetBeta - m_flightSourceBeta) * interpolatedTime; - if (mFlightCurrentTime >= mFlightMaxTime) + if (m_flightCurrentTime >= m_flightMaxTime) { - mFlightActive = false; - mTarget = mFlightTargetPosition; - mCurrentDistance = mFlightTargetDistance; - mAlpha = mFlightTargetAlpha; - mBeta = mFlightTargetBeta; + m_flightActive = false; + m_target = m_flightTargetPosition; + m_currentDistance = m_flightTargetDistance; + m_alpha = m_flightTargetAlpha; + m_beta = m_flightTargetBeta; } } // HACK TODO REMOVEME !!! const float scale = 1.0f; - mCurrentDistance *= scale; + m_currentDistance *= scale; - if (mCurrentDistance <= mMinDistance * scale) + if (m_currentDistance <= m_minDistance * scale) { - mCurrentDistance = mMinDistance * scale; + m_currentDistance = m_minDistance * scale; } - if (mCurrentDistance >= mMaxDistance * scale) + if (m_currentDistance >= m_maxDistance * scale) { - mCurrentDistance = mMaxDistance * scale; + m_currentDistance = m_maxDistance * scale; } // calculate unit direction vector based on our two angles AZ::Vector3 unitSphereVector; - unitSphereVector.SetX(MCore::Math::Cos(MCore::Math::DegreesToRadians(mAlpha)) * MCore::Math::Cos(MCore::Math::DegreesToRadians(mBeta))); - unitSphereVector.SetY(MCore::Math::Sin(MCore::Math::DegreesToRadians(mAlpha)) * MCore::Math::Cos(MCore::Math::DegreesToRadians(mBeta))); - unitSphereVector.SetZ(MCore::Math::Sin(MCore::Math::DegreesToRadians(mBeta))); + unitSphereVector.SetX(MCore::Math::Cos(MCore::Math::DegreesToRadians(m_alpha)) * MCore::Math::Cos(MCore::Math::DegreesToRadians(m_beta))); + unitSphereVector.SetY(MCore::Math::Sin(MCore::Math::DegreesToRadians(m_alpha)) * MCore::Math::Cos(MCore::Math::DegreesToRadians(m_beta))); + unitSphereVector.SetZ(MCore::Math::Sin(MCore::Math::DegreesToRadians(m_beta))); // calculate the right and the up vector based on the direction vector AZ::Vector3 rightVec = unitSphereVector.Cross(AZ::Vector3(0.0f, 0.0f, 1.0f)).GetNormalized(); AZ::Vector3 upVec = rightVec.Cross(unitSphereVector).GetNormalized(); // calculate the lookat target and the camera position using our rotation sphere vectors - mTarget += (rightVec * mPositionDelta.GetX()) * mTranslationSpeed + (upVec * mPositionDelta.GetY()) * mTranslationSpeed; - mPosition = mTarget + (unitSphereVector * mCurrentDistance); + m_target += (rightVec * m_positionDelta.GetX()) * m_translationSpeed + (upVec * m_positionDelta.GetY()) * m_translationSpeed; + m_position = m_target + (unitSphereVector * m_currentDistance); // reset the position delta - mPositionDelta = AZ::Vector2(0.0f, 0.0f); + m_positionDelta = AZ::Vector2(0.0f, 0.0f); // update our lookat camera at the very end LookAtCamera::Update(); diff --git a/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/OrbitCamera.h b/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/OrbitCamera.h index c3c33a3ef4..8aaa465da9 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/OrbitCamera.h +++ b/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/OrbitCamera.h @@ -76,27 +76,27 @@ namespace MCommon void ViewCloseup(const MCore::AABB& boundingBox, float flightTime) override; void StartFlight(float distance, const AZ::Vector3& position, float alpha, float beta, float flightTime); - bool GetIsFlightActive() const { return mFlightActive; } - void SetFlightTargetPosition(const AZ::Vector3& targetPos) { mFlightTargetPosition = targetPos; } + bool GetIsFlightActive() const { return m_flightActive; } + void SetFlightTargetPosition(const AZ::Vector3& targetPos) { m_flightTargetPosition = targetPos; } float FlightTimeLeft() const { - if (mFlightActive == false) + if (m_flightActive == false) { return 0.0f; } - return mFlightMaxTime - mFlightCurrentTime; + return m_flightMaxTime - m_flightCurrentTime; } - MCORE_INLINE float GetCurrentDistance() const { return mCurrentDistance; } - void SetCurrentDistance(float distance) { mCurrentDistance = distance; } + MCORE_INLINE float GetCurrentDistance() const { return m_currentDistance; } + void SetCurrentDistance(float distance) { m_currentDistance = distance; } - MCORE_INLINE float GetAlpha() const { return mAlpha; } + MCORE_INLINE float GetAlpha() const { return m_alpha; } static float GetDefaultAlpha() { return 110.0f; } - void SetAlpha(float alpha) { mAlpha = alpha; } + void SetAlpha(float alpha) { m_alpha = alpha; } - MCORE_INLINE float GetBeta() const { return mBeta; } + MCORE_INLINE float GetBeta() const { return m_beta; } static float GetDefaultBeta() { return 20.0f; } - void SetBeta(float beta) { mBeta = beta; } + void SetBeta(float beta) { m_beta = beta; } // automatically updates the camera afterwards void Set(float alpha, float beta, float currentDistance, const AZ::Vector3& target); @@ -105,24 +105,24 @@ namespace MCommon private: - AZ::Vector2 mPositionDelta; /**< The position delta which will be applied to the camera position when calling update. After adjusting the position it will be reset again. */ - float mMinDistance; /**< The minimum distance from the orbit camera to its target in the orbit sphere. */ - float mMaxDistance; /**< The maximum distance from the orbit camera to its target in the orbit sphere. */ - float mCurrentDistance; /**< The current distance from the orbit camera to its target in the orbit sphere. */ - float mAlpha; /**< The horizontal angle in our orbit sphere. */ - float mBeta; /**< The vertical angle in our orbit sphere. */ + AZ::Vector2 m_positionDelta; /**< The position delta which will be applied to the camera position when calling update. After adjusting the position it will be reset again. */ + float m_minDistance; /**< The minimum distance from the orbit camera to its target in the orbit sphere. */ + float m_maxDistance; /**< The maximum distance from the orbit camera to its target in the orbit sphere. */ + float m_currentDistance; /**< The current distance from the orbit camera to its target in the orbit sphere. */ + float m_alpha; /**< The horizontal angle in our orbit sphere. */ + float m_beta; /**< The vertical angle in our orbit sphere. */ - bool mFlightActive; - float mFlightMaxTime; - float mFlightCurrentTime; - float mFlightSourceDistance; - float mFlightTargetDistance; - AZ::Vector3 mFlightSourcePosition; - AZ::Vector3 mFlightTargetPosition; - float mFlightSourceAlpha; - float mFlightTargetAlpha; - float mFlightSourceBeta; - float mFlightTargetBeta; + bool m_flightActive; + float m_flightMaxTime; + float m_flightCurrentTime; + float m_flightSourceDistance; + float m_flightTargetDistance; + AZ::Vector3 m_flightSourcePosition; + AZ::Vector3 m_flightTargetPosition; + float m_flightSourceAlpha; + float m_flightTargetAlpha; + float m_flightSourceBeta; + float m_flightTargetBeta; }; } // namespace MCommon diff --git a/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/OrthographicCamera.cpp b/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/OrthographicCamera.cpp index 722f43c113..a64cdcc97f 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/OrthographicCamera.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/OrthographicCamera.cpp @@ -21,7 +21,7 @@ namespace MCommon { Reset(); SetMode(viewMode); - mProjectionMode = PROJMODE_ORTHOGRAPHIC; + m_projectionMode = PROJMODE_ORTHOGRAPHIC; } @@ -34,50 +34,50 @@ namespace MCommon // update the camera position, orientation and it's matrices void OrthographicCamera::Update(float timeDelta) { - if (mFlightActive) + if (m_flightActive) { - mFlightCurrentTime += timeDelta; + m_flightCurrentTime += timeDelta; - const float normalizedTime = mFlightCurrentTime / mFlightMaxTime; + const float normalizedTime = m_flightCurrentTime / m_flightMaxTime; const float interpolatedTime = MCore::CosineInterpolate(0.0f, 1.0f, normalizedTime); - mPosition = mFlightSourcePosition + (mFlightTargetPosition - mFlightSourcePosition) * interpolatedTime; - mCurrentDistance = mFlightSourceDistance + (mFlightTargetDistance - mFlightSourceDistance) * interpolatedTime; + m_position = m_flightSourcePosition + (m_flightTargetPosition - m_flightSourcePosition) * interpolatedTime; + m_currentDistance = m_flightSourceDistance + (m_flightTargetDistance - m_flightSourceDistance) * interpolatedTime; - if (mFlightCurrentTime >= mFlightMaxTime) + if (m_flightCurrentTime >= m_flightMaxTime) { - mFlightActive = false; - mPosition = mFlightTargetPosition; - mCurrentDistance = mFlightTargetDistance; + m_flightActive = false; + m_position = m_flightTargetPosition; + m_currentDistance = m_flightTargetDistance; } } // HACK TODO REMOVEME !!! const float scale = 1.0f; - mCurrentDistance *= scale; + m_currentDistance *= scale; - if (mCurrentDistance <= mMinDistance * scale) + if (m_currentDistance <= m_minDistance * scale) { - mCurrentDistance = mMinDistance * scale; + m_currentDistance = m_minDistance * scale; } - if (mCurrentDistance >= mMaxDistance * scale) + if (m_currentDistance >= m_maxDistance * scale) { - mCurrentDistance = mMaxDistance * scale; + m_currentDistance = m_maxDistance * scale; } // fake zoom the orthographic camera const float orthoScale = scale * 0.001f; - const float deltaX = mCurrentDistance * mScreenWidth * orthoScale; - const float deltaY = mCurrentDistance * mScreenHeight * orthoScale; + const float deltaX = m_currentDistance * m_screenWidth * orthoScale; + const float deltaY = m_currentDistance * m_screenHeight * orthoScale; SetOrthoClipDimensions(AZ::Vector2(deltaX, deltaY)); // adjust the mouse delta movement so that one pixel mouse movement is exactly one pixel on screen - mPositionDelta.SetX(mPositionDelta.GetX() * mCurrentDistance * orthoScale); - mPositionDelta.SetY(mPositionDelta.GetY() * mCurrentDistance * orthoScale); + m_positionDelta.SetX(m_positionDelta.GetX() * m_currentDistance * orthoScale); + m_positionDelta.SetY(m_positionDelta.GetY() * m_currentDistance * orthoScale); AZ::Vector3 xAxis, yAxis, zAxis; - switch (mMode) + switch (m_mode) { case VIEWMODE_FRONT: { @@ -86,11 +86,11 @@ namespace MCommon zAxis = AZ::Vector3(0.0f, 1.0f, 0.0f); // depth axis // translate the camera - mPosition += xAxis * -mPositionDelta.GetX(); - mPosition += yAxis * mPositionDelta.GetY(); + m_position += xAxis * -m_positionDelta.GetX(); + m_position += yAxis * m_positionDelta.GetY(); // setup the view matrix - MCore::LookAtRH(mViewMatrix, mPosition + zAxis * mCurrentDistance, mPosition, yAxis); + MCore::LookAtRH(m_viewMatrix, m_position + zAxis * m_currentDistance, m_position, yAxis); break; } @@ -101,11 +101,11 @@ namespace MCommon zAxis = AZ::Vector3(0.0f, -1.0f, 0.0f); // depth axis // translate the camera - mPosition += xAxis * -mPositionDelta.GetX(); - mPosition += yAxis * mPositionDelta.GetY(); + m_position += xAxis * -m_positionDelta.GetX(); + m_position += yAxis * m_positionDelta.GetY(); // setup the view matrix - MCore::LookAtRH(mViewMatrix, mPosition + zAxis * mCurrentDistance, mPosition, yAxis); + MCore::LookAtRH(m_viewMatrix, m_position + zAxis * m_currentDistance, m_position, yAxis); break; } @@ -117,11 +117,11 @@ namespace MCommon zAxis = AZ::Vector3(-1.0f, 0.0f, 0.0f); // depth axis // translate the camera - mPosition += xAxis * mPositionDelta.GetX(); - mPosition += yAxis * mPositionDelta.GetY(); + m_position += xAxis * m_positionDelta.GetX(); + m_position += yAxis * m_positionDelta.GetY(); // setup the view matrix - MCore::LookAtRH(mViewMatrix, mPosition + zAxis * mCurrentDistance, mPosition, yAxis); + MCore::LookAtRH(m_viewMatrix, m_position + zAxis * m_currentDistance, m_position, yAxis); break; } @@ -132,11 +132,11 @@ namespace MCommon zAxis = AZ::Vector3(1.0f, 0.0f, 0.0f); // depth axis // translate the camera - mPosition += xAxis * mPositionDelta.GetX(); - mPosition += yAxis * mPositionDelta.GetY(); + m_position += xAxis * m_positionDelta.GetX(); + m_position += yAxis * m_positionDelta.GetY(); // setup the view matrix - MCore::LookAtRH(mViewMatrix, mPosition + zAxis * mCurrentDistance, mPosition, yAxis); + MCore::LookAtRH(m_viewMatrix, m_position + zAxis * m_currentDistance, m_position, yAxis); break; } @@ -147,11 +147,11 @@ namespace MCommon zAxis = AZ::Vector3(0.0f, 0.0f, 1.0f); // depth axis // translate the camera - mPosition += -xAxis* mPositionDelta.GetX(); - mPosition += yAxis * mPositionDelta.GetY(); + m_position += -xAxis* m_positionDelta.GetX(); + m_position += yAxis * m_positionDelta.GetY(); // setup the view matrix - MCore::LookAtRH(mViewMatrix, mPosition + zAxis * mCurrentDistance, mPosition, yAxis); + MCore::LookAtRH(m_viewMatrix, m_position + zAxis * m_currentDistance, m_position, yAxis); break; } @@ -162,18 +162,18 @@ namespace MCommon zAxis = AZ::Vector3(0.0f, 0.0f, -1.0f); // depth axis // translate the camera - mPosition += -xAxis* mPositionDelta.GetX(); - mPosition += yAxis * mPositionDelta.GetY(); + m_position += -xAxis* m_positionDelta.GetX(); + m_position += yAxis * m_positionDelta.GetY(); // setup the view matrix - MCore::LookAtRH(mViewMatrix, mPosition + zAxis * mCurrentDistance, mPosition, yAxis); + MCore::LookAtRH(m_viewMatrix, m_position + zAxis * m_currentDistance, m_position, yAxis); break; } } ; // reset the position delta - mPositionDelta = AZ::Vector2(0.0f, 0.0f); + m_positionDelta = AZ::Vector2(0.0f, 0.0f); // update our base camera Camera::Update(); @@ -189,8 +189,8 @@ namespace MCommon // zoom camera in or out if (leftButtonPressed == false && rightButtonPressed && middleButtonPressed == false) { - const float distanceScale = mCurrentDistance * 0.002f; - mCurrentDistance += (float)-mouseMovementY * distanceScale; + const float distanceScale = m_currentDistance * 0.002f; + m_currentDistance += (float)-mouseMovementY * distanceScale; } // is middle (or left+right) mouse button pressed? @@ -198,8 +198,8 @@ namespace MCommon if ((leftButtonPressed == false && rightButtonPressed == false && middleButtonPressed) || (leftButtonPressed && rightButtonPressed && middleButtonPressed == false)) { - mPositionDelta.SetX((float)mouseMovementX); - mPositionDelta.SetY((float)mouseMovementY); + m_positionDelta.SetX((float)mouseMovementX); + m_positionDelta.SetY((float)mouseMovementY); } } @@ -207,41 +207,41 @@ namespace MCommon // reset the camera attributes void OrthographicCamera::Reset(float flightTime) { - mPositionDelta = AZ::Vector2(0.0f, 0.0f); - mMinDistance = MCore::Math::epsilon; - mMaxDistance = mFarClipDistance * 0.5f; + m_positionDelta = AZ::Vector2(0.0f, 0.0f); + m_minDistance = MCore::Math::epsilon; + m_maxDistance = m_farClipDistance * 0.5f; AZ::Vector3 resetPosition(0.0f, 0.0f, 0.0f); - switch (mMode) + switch (m_mode) { case VIEWMODE_FRONT: { - resetPosition.SetY(mCurrentDistance); + resetPosition.SetY(m_currentDistance); break; } case VIEWMODE_BACK: { - resetPosition.SetY(-mCurrentDistance); + resetPosition.SetY(-m_currentDistance); break; } case VIEWMODE_LEFT: { - resetPosition.SetX(-mCurrentDistance); + resetPosition.SetX(-m_currentDistance); break; } case VIEWMODE_RIGHT: { - resetPosition.SetX(mCurrentDistance); + resetPosition.SetX(m_currentDistance); break; } case VIEWMODE_TOP: { - resetPosition.SetZ(mCurrentDistance); + resetPosition.SetZ(m_currentDistance); break; } case VIEWMODE_BOTTOM: { - resetPosition.SetZ(-mCurrentDistance); + resetPosition.SetZ(-m_currentDistance); break; } } @@ -249,19 +249,19 @@ namespace MCommon if (flightTime < MCore::Math::epsilon) { - mFlightActive = false; - mCurrentDistance = (float)MCore::Distance::ConvertValue(5.0f, MCore::Distance::UNITTYPE_METERS, EMotionFX::GetEMotionFX().GetUnitType()); - mPosition = resetPosition; + m_flightActive = false; + m_currentDistance = (float)MCore::Distance::ConvertValue(5.0f, MCore::Distance::UNITTYPE_METERS, EMotionFX::GetEMotionFX().GetUnitType()); + m_position = resetPosition; } else { - mFlightActive = true; - mFlightMaxTime = flightTime; - mFlightCurrentTime = 0.0f; - mFlightSourceDistance = mCurrentDistance; - mFlightTargetDistance = (float)MCore::Distance::ConvertValue(5.0f, MCore::Distance::UNITTYPE_METERS, EMotionFX::GetEMotionFX().GetUnitType()); - mFlightSourcePosition = mPosition; - mFlightTargetPosition = resetPosition; + m_flightActive = true; + m_flightMaxTime = flightTime; + m_flightCurrentTime = 0.0f; + m_flightSourceDistance = m_currentDistance; + m_flightTargetDistance = (float)MCore::Distance::ConvertValue(5.0f, MCore::Distance::UNITTYPE_METERS, EMotionFX::GetEMotionFX().GetUnitType()); + m_flightSourcePosition = m_position; + m_flightTargetPosition = resetPosition; } // reset the base class attributes @@ -271,22 +271,22 @@ namespace MCommon void OrthographicCamera::StartFlight(float distance, const AZ::Vector3& position, float flightTime) { - mFlightMaxTime = flightTime; - mFlightCurrentTime = 0.0f; - mFlightSourceDistance = mCurrentDistance; - mFlightSourcePosition = mPosition; + m_flightMaxTime = flightTime; + m_flightCurrentTime = 0.0f; + m_flightSourceDistance = m_currentDistance; + m_flightSourcePosition = m_position; if (flightTime < MCore::Math::epsilon) { - mFlightActive = false; - mCurrentDistance = distance; - mPosition = position; + m_flightActive = false; + m_currentDistance = distance; + m_position = position; } else { - mFlightActive = true; - mFlightTargetDistance = distance; - mFlightTargetPosition = position; + m_flightActive = true; + m_flightTargetDistance = distance; + m_flightTargetPosition = position; } } @@ -294,14 +294,14 @@ namespace MCommon // closeup view of the given bounding box void OrthographicCamera::ViewCloseup(const MCore::AABB& boundingBox, float flightTime) { - mFlightMaxTime = flightTime; - mFlightCurrentTime = 0.0f; - mFlightSourceDistance = mCurrentDistance; - mFlightSourcePosition = mPosition; + m_flightMaxTime = flightTime; + m_flightCurrentTime = 0.0f; + m_flightSourceDistance = m_currentDistance; + m_flightSourcePosition = m_position; float boxWidth = 0.0f; float boxHeight = 0.0f; - switch (mMode) + switch (m_mode) { case VIEWMODE_FRONT: { @@ -343,32 +343,32 @@ namespace MCommon ; const float orthoScale = 0.001f; - assert(mScreenWidth != 0 && mScreenHeight != 0); - const float distanceX = (boxWidth) / (mScreenWidth * orthoScale); - const float distanceY = (boxHeight) / (mScreenHeight * orthoScale); + assert(m_screenWidth != 0 && m_screenHeight != 0); + const float distanceX = (boxWidth) / (m_screenWidth * orthoScale); + const float distanceY = (boxHeight) / (m_screenHeight * orthoScale); //LOG("box: x=%f y=%f, boxAspect=%f, orthoAspect=%f, distX=%f, distY=%f", boxWidth, boxHeight, boxAspect, orthoAspect, distanceX, distanceY); if (flightTime < MCore::Math::epsilon) { - mFlightActive = false; - mCurrentDistance = MCore::Max(distanceX, distanceY) * 1.1f; - mPosition = boundingBox.CalcMiddle(); + m_flightActive = false; + m_currentDistance = MCore::Max(distanceX, distanceY) * 1.1f; + m_position = boundingBox.CalcMiddle(); } else { - mFlightActive = true; - mFlightTargetDistance = MCore::Max(distanceX, distanceY) * 1.1f; - mFlightTargetPosition = boundingBox.CalcMiddle(); + m_flightActive = true; + m_flightTargetDistance = MCore::Max(distanceX, distanceY) * 1.1f; + m_flightTargetPosition = boundingBox.CalcMiddle(); } // make sure the target flight distance is in range - if (mFlightTargetDistance < mMinDistance) + if (m_flightTargetDistance < m_minDistance) { - mFlightTargetDistance = mMinDistance; + m_flightTargetDistance = m_minDistance; } - if (mFlightTargetDistance > mMaxDistance) + if (m_flightTargetDistance > m_maxDistance) { - mFlightTargetDistance = mMaxDistance; + m_flightTargetDistance = m_maxDistance; } } @@ -376,7 +376,7 @@ namespace MCommon // get the type identification string const char* OrthographicCamera::GetTypeString() const { - switch (mMode) + switch (m_mode) { case VIEWMODE_FRONT: { @@ -419,8 +419,8 @@ namespace MCommon // unproject screen coordinates to a ray MCore::Ray OrthographicCamera::Unproject(int32 screenX, int32 screenY) { - AZ::Vector3 start = MCore::UnprojectOrtho(static_cast(screenX), static_cast(screenY), static_cast(mScreenWidth), static_cast(mScreenHeight), -1.0f, mProjectionMatrix, mViewMatrix); - AZ::Vector3 end = MCore::UnprojectOrtho(static_cast(screenX), static_cast(screenY), static_cast(mScreenWidth), static_cast(mScreenHeight), 1.0f, mProjectionMatrix, mViewMatrix); + AZ::Vector3 start = MCore::UnprojectOrtho(static_cast(screenX), static_cast(screenY), static_cast(m_screenWidth), static_cast(m_screenHeight), -1.0f, m_projectionMatrix, m_viewMatrix); + AZ::Vector3 end = MCore::UnprojectOrtho(static_cast(screenX), static_cast(screenY), static_cast(m_screenWidth), static_cast(m_screenHeight), 1.0f, m_projectionMatrix, m_viewMatrix); return MCore::Ray(start, end); } @@ -429,7 +429,7 @@ namespace MCommon // update limits void OrthographicCamera::AutoUpdateLimits() { - mMinDistance = mNearClipDistance; - mMaxDistance = mFarClipDistance * 0.5f; + m_minDistance = m_nearClipDistance; + m_maxDistance = m_farClipDistance * 0.5f; } } // namespace MCommon diff --git a/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/OrthographicCamera.h b/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/OrthographicCamera.h index 4fc1b47778..e735cc22bb 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/OrthographicCamera.h +++ b/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/OrthographicCamera.h @@ -60,8 +60,8 @@ namespace MCommon */ const char* GetTypeString() const override; - MCORE_INLINE void SetMode(ViewMode viewMode) { mMode = viewMode; } - MCORE_INLINE ViewMode GetMode() const { return mMode; } + MCORE_INLINE void SetMode(ViewMode viewMode) { m_mode = viewMode; } + MCORE_INLINE ViewMode GetMode() const { return m_mode; } /** * Update the camera transformation. @@ -99,15 +99,15 @@ namespace MCommon void AutoUpdateLimits() override; void StartFlight(float distance, const AZ::Vector3& position, float flightTime); - bool GetIsFlightActive() const { return mFlightActive; } - void SetFlightTargetPosition(const AZ::Vector3& targetPos) { mFlightTargetPosition = targetPos; } + bool GetIsFlightActive() const { return m_flightActive; } + void SetFlightTargetPosition(const AZ::Vector3& targetPos) { m_flightTargetPosition = targetPos; } float FlightTimeLeft() const { - if (mFlightActive == false) + if (m_flightActive == false) { return 0.0f; } - return mFlightMaxTime - mFlightCurrentTime; + return m_flightMaxTime - m_flightCurrentTime; } /** @@ -118,22 +118,22 @@ namespace MCommon */ MCore::Ray Unproject(int32 screenX, int32 screenY) override; - MCORE_INLINE void SetCurrentDistance(float distance) { mCurrentDistance = distance; } - MCORE_INLINE float GetCurrentDistance() const { return mCurrentDistance; } + MCORE_INLINE void SetCurrentDistance(float distance) { m_currentDistance = distance; } + MCORE_INLINE float GetCurrentDistance() const { return m_currentDistance; } private: - ViewMode mMode; - AZ::Vector2 mPositionDelta; /**< The position delta which will be applied to the camera position when calling update. After adjusting the position it will be reset again. */ - float mMinDistance; /**< The minimum distance from the orbit camera to its target in the orbit sphere. */ - float mMaxDistance; /**< The maximum distance from the orbit camera to its target in the orbit sphere. */ - float mCurrentDistance; /**< The current distance from the orbit camera to its target in the orbit sphere. */ - bool mFlightActive; - float mFlightMaxTime; - float mFlightCurrentTime; - float mFlightSourceDistance; - AZ::Vector3 mFlightSourcePosition; - float mFlightTargetDistance; - AZ::Vector3 mFlightTargetPosition; + ViewMode m_mode; + AZ::Vector2 m_positionDelta; /**< The position delta which will be applied to the camera position when calling update. After adjusting the position it will be reset again. */ + float m_minDistance; /**< The minimum distance from the orbit camera to its target in the orbit sphere. */ + float m_maxDistance; /**< The maximum distance from the orbit camera to its target in the orbit sphere. */ + float m_currentDistance; /**< The current distance from the orbit camera to its target in the orbit sphere. */ + bool m_flightActive; + float m_flightMaxTime; + float m_flightCurrentTime; + float m_flightSourceDistance; + AZ::Vector3 m_flightSourcePosition; + float m_flightTargetDistance; + AZ::Vector3 m_flightTargetPosition; }; } // namespace MCommon diff --git a/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/RenderUtil.cpp b/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/RenderUtil.cpp index 34dba922ca..183d56a07f 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/RenderUtil.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/RenderUtil.cpp @@ -22,51 +22,51 @@ namespace MCommon { // gizmo colors - MCore::RGBAColor ManipulatorColors::mSelectionColor = MCore::RGBAColor(1.0f, 1.0f, 0.0f); - MCore::RGBAColor ManipulatorColors::mSelectionColorDarker = MCore::RGBAColor(0.5f, 0.5f, 0.0f, 0.5f); - MCore::RGBAColor ManipulatorColors::mRed = MCore::RGBAColor(0.781f, 0.0f, 0.0f); - MCore::RGBAColor ManipulatorColors::mGreen = MCore::RGBAColor(0.0f, 0.609f, 0.0f); - MCore::RGBAColor ManipulatorColors::mBlue = MCore::RGBAColor(0.0f, 0.0f, 0.762f); + MCore::RGBAColor ManipulatorColors::s_selectionColor = MCore::RGBAColor(1.0f, 1.0f, 0.0f); + MCore::RGBAColor ManipulatorColors::s_selectionColorDarker = MCore::RGBAColor(0.5f, 0.5f, 0.0f, 0.5f); + MCore::RGBAColor ManipulatorColors::s_red = MCore::RGBAColor(0.781f, 0.0f, 0.0f); + MCore::RGBAColor ManipulatorColors::s_green = MCore::RGBAColor(0.0f, 0.609f, 0.0f); + MCore::RGBAColor ManipulatorColors::s_blue = MCore::RGBAColor(0.0f, 0.0f, 0.762f); // static variables - uint32 RenderUtil::mNumMaxLineVertices = 8192 * 16;// 8096 * 16 * sizeof(LineVertex) = 3,5 MB - uint32 RenderUtil::mNumMaxMeshVertices = 1024; - uint32 RenderUtil::mNumMaxMeshIndices = 1024 * 3; - uint32 RenderUtil::mNumMax2DLines = 8192; - uint32 RenderUtil::mNumMaxTriangleVertices = 8192 * 16;// 8096 * 16 * sizeof(LineVertex) = 3,5 MB - float RenderUtil::m_wireframeSphereSegmentCount = 16.0f; + uint32 RenderUtil::s_numMaxLineVertices = 8192 * 16;// 8096 * 16 * sizeof(LineVertex) = 3,5 MB + uint32 RenderUtil::s_numMaxMeshVertices = 1024; + uint32 RenderUtil::s_numMaxMeshIndices = 1024 * 3; + uint32 RenderUtil::s_numMax2DLines = 8192; + uint32 RenderUtil::s_numMaxTriangleVertices = 8192 * 16;// 8096 * 16 * sizeof(LineVertex) = 3,5 MB + float RenderUtil::s_wireframeSphereSegmentCount = 16.0f; // constructor RenderUtil::RenderUtil() : m_devicePixelRatio(1.0f) { - mVertexBuffer = new LineVertex[mNumMaxLineVertices]; - m2DLines = new Line2D[mNumMax2DLines]; - mNumVertices = 0; - mNum2DLines = 0; - mUnitSphereMesh = CreateSphere(1.0f); - mCylinderMesh = CreateCylinder(2.0f, 1.0f, 2.0f); - mArrowHeadMesh = CreateArrowHead(1.0f, 0.5f); - mUnitCubeMesh = CreateCube(1.0f); - mFont = new VectorFont(this); + m_vertexBuffer = new LineVertex[s_numMaxLineVertices]; + m_m2DLines = new Line2D[s_numMax2DLines]; + m_numVertices = 0; + m_num2DLines = 0; + m_unitSphereMesh = CreateSphere(1.0f); + m_cylinderMesh = CreateCylinder(2.0f, 1.0f, 2.0f); + m_arrowHeadMesh = CreateArrowHead(1.0f, 0.5f); + m_unitCubeMesh = CreateCube(1.0f); + m_font = new VectorFont(this); } // destructor RenderUtil::~RenderUtil() { - delete[] mVertexBuffer; - delete[] m2DLines; - delete mUnitSphereMesh; - delete mCylinderMesh; - delete mUnitCubeMesh; - delete mArrowHeadMesh; - delete mFont; + delete[] m_vertexBuffer; + delete[] m_m2DLines; + delete m_unitSphereMesh; + delete m_cylinderMesh; + delete m_unitCubeMesh; + delete m_arrowHeadMesh; + delete m_font; // get rid of the world space positions - mWorldSpacePositions.clear(); + m_worldSpacePositions.clear(); } @@ -74,14 +74,14 @@ namespace MCommon void RenderUtil::RenderLines() { // check if we have to render anything and skip directly in case the line vertex buffer is empty - if (mNumVertices == 0) + if (m_numVertices == 0) { return; } // render the lines and reset the number of vertices - RenderLines(mVertexBuffer, mNumVertices); - mNumVertices = 0; + RenderLines(m_vertexBuffer, m_numVertices); + m_numVertices = 0; } @@ -89,14 +89,14 @@ namespace MCommon void RenderUtil::Render2DLines() { // check if we have to render anything and skip directly in case the line buffer is empty - if (mNum2DLines == 0) + if (m_num2DLines == 0) { return; } // render the lines and reset the number of lines - Render2DLines(m2DLines, mNum2DLines); - mNum2DLines = 0; + Render2DLines(m_m2DLines, m_num2DLines); + m_num2DLines = 0; } @@ -104,14 +104,14 @@ namespace MCommon void RenderUtil::RenderTriangles() { // check if we have to render anything and skip directly in case there are no triangles - if (mTriangleVertices.empty()) + if (m_triangleVertices.empty()) { return; } // render the triangles and clear the array - RenderTriangles(mTriangleVertices); - mTriangleVertices.clear(); + RenderTriangles(m_triangleVertices); + m_triangleVertices.clear(); } @@ -302,12 +302,12 @@ namespace MCommon // constructor RenderUtil::AABBRenderSettings::AABBRenderSettings() { - mNodeBasedAABB = true; - mMeshBasedAABB = true; - mStaticBasedAABB = true; - mStaticBasedColor = MCore::RGBAColor(0.0f, 0.7f, 0.7f); - mNodeBasedColor = MCore::RGBAColor(1.0f, 0.0f, 0.0f); - mMeshBasedColor = MCore::RGBAColor(0.0f, 0.0f, 0.7f); + m_nodeBasedAabb = true; + m_meshBasedAabb = true; + m_staticBasedAabb = true; + m_staticBasedColor = MCore::RGBAColor(0.0f, 0.7f, 0.7f); + m_nodeBasedColor = MCore::RGBAColor(1.0f, 0.0f, 0.0f); + m_meshBasedColor = MCore::RGBAColor(0.0f, 0.0f, 0.7f); } @@ -317,7 +317,7 @@ namespace MCommon const size_t lodLevel = actorInstance->GetLODLevel(); // handle the node based AABB - if (renderSettings.mNodeBasedAABB) + if (renderSettings.m_nodeBasedAabb) { // calculate the node based AABB AZ::Aabb box; @@ -326,12 +326,12 @@ namespace MCommon // render the aabb if (box.IsValid()) { - RenderAabb(box, renderSettings.mNodeBasedColor); + RenderAabb(box, renderSettings.m_nodeBasedColor); } } // handle the mesh based AABB - if (renderSettings.mMeshBasedAABB) + if (renderSettings.m_meshBasedAabb) { // calculate the mesh based AABB AZ::Aabb box; @@ -340,11 +340,11 @@ namespace MCommon // render the aabb if (box.IsValid()) { - RenderAabb(box, renderSettings.mMeshBasedColor); + RenderAabb(box, renderSettings.m_meshBasedColor); } } - if (renderSettings.mStaticBasedAABB) + if (renderSettings.m_staticBasedAabb) { // calculate the static based AABB AZ::Aabb box; @@ -353,7 +353,7 @@ namespace MCommon // render the aabb if (box.IsValid()) { - RenderAabb(box, renderSettings.mStaticBasedColor); + RenderAabb(box, renderSettings.m_staticBasedColor); } } @@ -382,14 +382,14 @@ namespace MCommon if (!visibleJointIndices || visibleJointIndices->empty() || (visibleJointIndices->find(jointIndex) != visibleJointIndices->end())) { - const AZ::Vector3 currentJointPos = pose->GetWorldSpaceTransform(jointIndex).mPosition; + const AZ::Vector3 currentJointPos = pose->GetWorldSpaceTransform(jointIndex).m_position; const bool jointSelected = selectedJointIndices->find(jointIndex) != selectedJointIndices->end(); const size_t parentIndex = joint->GetParentIndex(); if (parentIndex != InvalidIndex) { const bool parentSelected = selectedJointIndices->find(parentIndex) != selectedJointIndices->end(); - const AZ::Vector3 parentJointPos = pose->GetWorldSpaceTransform(parentIndex).mPosition; + const AZ::Vector3 parentJointPos = pose->GetWorldSpaceTransform(parentIndex).m_position; RenderLine(currentJointPos, parentJointPos, parentSelected ? selectedColor : color); } @@ -434,9 +434,9 @@ namespace MCommon const uint32 indexB = indices[triangleStartIndex + 1] + startVertex; const uint32 indexC = indices[triangleStartIndex + 2] + startVertex; - const AZ::Vector3 posA = mWorldSpacePositions[indexA] + normals[indexA] * scale; - const AZ::Vector3 posB = mWorldSpacePositions[indexB] + normals[indexB] * scale; - const AZ::Vector3 posC = mWorldSpacePositions[indexC] + normals[indexC] * scale; + const AZ::Vector3 posA = m_worldSpacePositions[indexA] + normals[indexA] * scale; + const AZ::Vector3 posB = m_worldSpacePositions[indexB] + normals[indexB] * scale; + const AZ::Vector3 posC = m_worldSpacePositions[indexC] + normals[indexC] * scale; if (vertexColors) { @@ -496,9 +496,9 @@ namespace MCommon const uint32 indexB = indices[triangleStartIndex + 1] + startVertex; const uint32 indexC = indices[triangleStartIndex + 2] + startVertex; - const AZ::Vector3& posA = mWorldSpacePositions[ indexA ]; - const AZ::Vector3& posB = mWorldSpacePositions[ indexB ]; - const AZ::Vector3& posC = mWorldSpacePositions[ indexC ]; + const AZ::Vector3& posA = m_worldSpacePositions[ indexA ]; + const AZ::Vector3& posB = m_worldSpacePositions[ indexB ]; + const AZ::Vector3& posC = m_worldSpacePositions[ indexC ]; const AZ::Vector3 normalDir = (posB - posA).Cross(posC - posA).GetNormalized(); @@ -524,7 +524,7 @@ namespace MCommon for (uint32 j = 0; j < numVertices; ++j) { const uint32 vertexIndex = j + startVertex; - const AZ::Vector3& position = mWorldSpacePositions[vertexIndex]; + const AZ::Vector3& position = m_worldSpacePositions[vertexIndex]; const AZ::Vector3 normal = worldTM.TransformVector(normals[vertexIndex]).GetNormalizedSafe() * vertexNormalsScale; RenderLine(position, position + normal, colorVertexNormals); } @@ -578,15 +578,15 @@ namespace MCommon } bitangent = (worldTM.TransformVector(bitangent)).GetNormalizedSafe(); - RenderLine(mWorldSpacePositions[i], mWorldSpacePositions[i] + (tangent * scale), colorTangents); + RenderLine(m_worldSpacePositions[i], m_worldSpacePositions[i] + (tangent * scale), colorTangents); if (tangents[i].GetW() < 0.0f) { - RenderLine(mWorldSpacePositions[i], mWorldSpacePositions[i] + (bitangent * scale), mirroredBitangentColor); + RenderLine(m_worldSpacePositions[i], m_worldSpacePositions[i] + (bitangent * scale), mirroredBitangentColor); } else { - RenderLine(mWorldSpacePositions[i], mWorldSpacePositions[i] + (bitangent * scale), colorBitangent); + RenderLine(m_worldSpacePositions[i], m_worldSpacePositions[i] + (bitangent * scale), colorBitangent); } } @@ -601,28 +601,28 @@ namespace MCommon void RenderUtil::PrepareForMesh(EMotionFX::Mesh* mesh, const AZ::Transform& worldTM) { // check if we have already prepared for the given mesh - if (mCurrentMesh == mesh) + if (m_currentMesh == mesh) { return; } // set our new current mesh - mCurrentMesh = mesh; + m_currentMesh = mesh; // get the number of vertices and the data - const uint32 numVertices = mCurrentMesh->GetNumVertices(); - AZ::Vector3* positions = (AZ::Vector3*)mCurrentMesh->FindVertexData(EMotionFX::Mesh::ATTRIB_POSITIONS); + const uint32 numVertices = m_currentMesh->GetNumVertices(); + AZ::Vector3* positions = (AZ::Vector3*)m_currentMesh->FindVertexData(EMotionFX::Mesh::ATTRIB_POSITIONS); // check if the vertices fits in our buffer - if (mWorldSpacePositions.size() < numVertices) + if (m_worldSpacePositions.size() < numVertices) { - mWorldSpacePositions.resize(numVertices); + m_worldSpacePositions.resize(numVertices); } // pre-calculate the world space positions for (uint32 i = 0; i < numVertices; ++i) { - mWorldSpacePositions[i] = worldTM.TransformPoint(positions[i]); + m_worldSpacePositions[i] = worldTM.TransformPoint(positions[i]); } } @@ -636,11 +636,11 @@ namespace MCommon const size_t nodeIndex = node->GetNodeIndex(); const size_t parentIndex = node->GetParentIndex(); - const AZ::Vector3 nodeWorldPos = pose->GetWorldSpaceTransform(nodeIndex).mPosition; + const AZ::Vector3 nodeWorldPos = pose->GetWorldSpaceTransform(nodeIndex).m_position; if (parentIndex != InvalidIndex) { - const AZ::Vector3 parentWorldPos = pose->GetWorldSpaceTransform(parentIndex).mPosition; + const AZ::Vector3 parentWorldPos = pose->GetWorldSpaceTransform(parentIndex).m_position; const AZ::Vector3 bone = parentWorldPos - nodeWorldPos; const float boneLength = MCore::SafeLength(bone); @@ -686,8 +686,8 @@ namespace MCommon if (!visibleJointIndices || visibleJointIndices->empty() || (visibleJointIndices->find(jointIndex) != visibleJointIndices->end())) { - const AZ::Vector3 nodeWorldPos = pose->GetWorldSpaceTransform(jointIndex).mPosition; - const AZ::Vector3 parentWorldPos = pose->GetWorldSpaceTransform(parentIndex).mPosition; + const AZ::Vector3 nodeWorldPos = pose->GetWorldSpaceTransform(jointIndex).m_position; + const AZ::Vector3 parentWorldPos = pose->GetWorldSpaceTransform(parentIndex).m_position; const AZ::Vector3 bone = parentWorldPos - nodeWorldPos; const AZ::Vector3 boneDirection = MCore::SafeNormalize(bone); const float boneLength = MCore::SafeLength(bone); @@ -740,24 +740,24 @@ namespace MCommon if (scaleBonesOnLength && parentIndex != InvalidIndex && AZStd::find(begin(boneList), end(boneList), jointIndex) != end(boneList)) { static const float axisBoneScale = 50.0f; - axisRenderingSettings.mSize = GetBoneScale(actorInstance, joint) * constPreScale * axisBoneScale; + axisRenderingSettings.m_size = GetBoneScale(actorInstance, joint) * constPreScale * axisBoneScale; } else { - axisRenderingSettings.mSize = constPreScale; + axisRenderingSettings.m_size = constPreScale; } // check if the current bone is selected and set the color according to it if (selectedJointIndices && selectedJointIndices->find(jointIndex) != selectedJointIndices->end()) { - axisRenderingSettings.mSelected = true; + axisRenderingSettings.m_selected = true; } else { - axisRenderingSettings.mSelected = false; + axisRenderingSettings.m_selected = false; } - axisRenderingSettings.mWorldTM = pose->GetWorldSpaceTransform(jointIndex).ToAZTransform(); + axisRenderingSettings.m_worldTm = pose->GetWorldSpaceTransform(jointIndex).ToAZTransform(); RenderLineAxis(axisRenderingSettings); } } @@ -783,8 +783,8 @@ namespace MCommon // render node orientation const EMotionFX::Transform worldTransform = pose->GetWorldSpaceTransform(nodeIndex); - axisRenderingSettings.mSize = GetBoneScale(actorInstance, node) * 5.0f; - axisRenderingSettings.mWorldTM = worldTransform.ToAZTransform(); + axisRenderingSettings.m_size = GetBoneScale(actorInstance, node) * 5.0f; + axisRenderingSettings.m_worldTm = worldTransform.ToAZTransform(); RenderLineAxis(axisRenderingSettings);// line based axis rendering // skip root nodes for the line based skeleton rendering, you could also use curNode->IsRootNode() @@ -792,8 +792,8 @@ namespace MCommon size_t parentIndex = node->GetParentIndex(); if (parentIndex != InvalidIndex) { - const AZ::Vector3 endPos = pose->GetWorldSpaceTransform(parentIndex).mPosition; - RenderLine(worldTransform.mPosition, endPos, color); + const AZ::Vector3 endPos = pose->GetWorldSpaceTransform(parentIndex).m_position; + RenderLine(worldTransform.m_position, endPos, color); } } @@ -821,14 +821,14 @@ namespace MCommon void RenderUtil::UtilMesh::CalculateNormals(bool counterClockWise) { // check if the normals actually got allocated - if (mNormals.empty()) + if (m_normals.empty()) { return; } // reset all normals to the zero vector - const size_t numNormals = mNormals.size(); - MCore::MemSet(&mNormals[0], 0, sizeof(AZ::Vector3) * numNormals); + const size_t numNormals = m_normals.size(); + MCore::MemSet(&m_normals[0], 0, sizeof(AZ::Vector3) * numNormals); // iterate through all vertices and sum up the face normals uint32 i; @@ -837,24 +837,24 @@ namespace MCommon for (i = 0; i < numNormals; i += 3) { - indexA = mIndices[i]; - indexB = mIndices[i + (counterClockWise ? 1 : 2)]; - indexC = mIndices[i + (counterClockWise ? 2 : 1)]; + indexA = m_indices[i]; + indexB = m_indices[i + (counterClockWise ? 1 : 2)]; + indexC = m_indices[i + (counterClockWise ? 2 : 1)]; - v1 = mPositions[indexB] - mPositions[indexA]; - v2 = mPositions[indexC] - mPositions[indexA]; + v1 = m_positions[indexB] - m_positions[indexA]; + v2 = m_positions[indexC] - m_positions[indexA]; normal = v1.Cross(v2); - mNormals[indexA] = mNormals[indexA] + normal; - mNormals[indexB] = mNormals[indexB] + normal; - mNormals[indexC] = mNormals[indexC] + normal; + m_normals[indexA] = m_normals[indexA] + normal; + m_normals[indexB] = m_normals[indexB] + normal; + m_normals[indexC] = m_normals[indexC] + normal; } // normalize all the normals for (i = 0; i < numNormals; ++i) { - mNormals[i] = mNormals[i].GetNormalized(); + m_normals[i] = m_normals[i].GetNormalized(); } } @@ -863,14 +863,14 @@ namespace MCommon void RenderUtil::UtilMesh::Allocate(uint32 numVertices, uint32 numIndices, bool hasNormals) { AZ_Assert(numVertices > 0 && numIndices % 3 == 0, "Invalid numVertices or numIndices"); - AZ_Assert(mPositions.empty() && mIndices.empty() && mNormals.empty(), "data already initialized"); + AZ_Assert(m_positions.empty() && m_indices.empty() && m_normals.empty(), "data already initialized"); // allocate the buffers - mPositions.resize(numVertices); - mIndices.resize(numIndices); + m_positions.resize(numVertices); + m_indices.resize(numIndices); if (hasNormals) { - mNormals.resize(numVertices); + m_normals.resize(numVertices); } } @@ -897,13 +897,13 @@ namespace MCommon void RenderUtil::FillCylinder(UtilMesh* mesh, float baseRadius, float topRadius, float length, bool calculateNormals) { // check if the positions and the indices have been allocated already by the CreateCylinder() function - if (mesh->mPositions.empty() || mesh->mIndices.empty()) + if (mesh->m_positions.empty() || mesh->m_indices.empty()) { return; } // number of segments/sides of the cylinder - const uint32 numSegments = static_cast(mesh->mPositions.size()) / 2; + const uint32 numSegments = static_cast(mesh->m_positions.size()) / 2; // fill in the vertices uint32 i; @@ -913,24 +913,24 @@ namespace MCommon const float z = MCore::Math::Sin(p); const float y = MCore::Math::Cos(p); - mesh->mPositions[i] = AZ::Vector3(0.0f, y * baseRadius, z * baseRadius); - mesh->mPositions[i + numSegments] = AZ::Vector3(-length, y * topRadius, z * topRadius); + mesh->m_positions[i] = AZ::Vector3(0.0f, y * baseRadius, z * baseRadius); + mesh->m_positions[i + numSegments] = AZ::Vector3(-length, y * topRadius, z * topRadius); } // fill in the indices uint32 c = 0; for (i = 0; i < numSegments; ++i) { - mesh->mIndices[c++] = i; - mesh->mIndices[c++] = ((i + 1) % numSegments); - mesh->mIndices[c++] = i + numSegments; + mesh->m_indices[c++] = i; + mesh->m_indices[c++] = ((i + 1) % numSegments); + mesh->m_indices[c++] = i + numSegments; } for (i = 0; i < numSegments; ++i) { - mesh->mIndices[c++] = i + numSegments; - mesh->mIndices[c++] = ((i + 1) % numSegments); - mesh->mIndices[c++] = ((i + 1) % numSegments) + numSegments; + mesh->m_indices[c++] = i + numSegments; + mesh->m_indices[c++] = ((i + 1) % numSegments); + mesh->m_indices[c++] = ((i + 1) % numSegments) + numSegments; } // recalculate normals if desired @@ -995,19 +995,19 @@ namespace MCommon const float x = r * MCore::Math::Sin(p); const float y = r * MCore::Math::Cos(p); - sphereMesh->mPositions[(i - 1) * numSegments + j] = AZ::Vector3(x, y, z * radius); + sphereMesh->m_positions[(i - 1) * numSegments + j] = AZ::Vector3(x, y, z * radius); } } // the highest and lowest vertices - sphereMesh->mPositions[(numSegments - 2) * numSegments + 0] = AZ::Vector3(0.0f, 0.0f, radius); - sphereMesh->mPositions[(numSegments - 2) * numSegments + 1] = AZ::Vector3(0.0f, 0.0f, -radius); + sphereMesh->m_positions[(numSegments - 2) * numSegments + 0] = AZ::Vector3(0.0f, 0.0f, radius); + sphereMesh->m_positions[(numSegments - 2) * numSegments + 1] = AZ::Vector3(0.0f, 0.0f, -radius); // calculate normals - const size_t numPositions = sphereMesh->mPositions.size(); + const size_t numPositions = sphereMesh->m_positions.size(); for (i = 0; i < numPositions; ++i) { - sphereMesh->mNormals[i] = -sphereMesh->mPositions[i].GetNormalized(); + sphereMesh->m_normals[i] = -sphereMesh->m_positions[i].GetNormalized(); } // fill the indices @@ -1016,46 +1016,46 @@ namespace MCommon { for (uint32 j = 0; j < numSegments - 1; j++) { - sphereMesh->mIndices[c++] = (i - 1) * numSegments + j; - sphereMesh->mIndices[c++] = (i - 1) * numSegments + j + 1; - sphereMesh->mIndices[c++] = i * numSegments + j; + sphereMesh->m_indices[c++] = (i - 1) * numSegments + j; + sphereMesh->m_indices[c++] = (i - 1) * numSegments + j + 1; + sphereMesh->m_indices[c++] = i * numSegments + j; - sphereMesh->mIndices[c++] = (i - 1) * numSegments + j + 1; - sphereMesh->mIndices[c++] = i * numSegments + j + 1; - sphereMesh->mIndices[c++] = i * numSegments + j; + sphereMesh->m_indices[c++] = (i - 1) * numSegments + j + 1; + sphereMesh->m_indices[c++] = i * numSegments + j + 1; + sphereMesh->m_indices[c++] = i * numSegments + j; } - sphereMesh->mIndices[c++] = (i - 1) * numSegments + numSegments - 1; - sphereMesh->mIndices[c++] = (i - 1) * numSegments; - sphereMesh->mIndices[c++] = i * numSegments + numSegments - 1; + sphereMesh->m_indices[c++] = (i - 1) * numSegments + numSegments - 1; + sphereMesh->m_indices[c++] = (i - 1) * numSegments; + sphereMesh->m_indices[c++] = i * numSegments + numSegments - 1; - sphereMesh->mIndices[c++] = i * numSegments; - sphereMesh->mIndices[c++] = (i - 1) * numSegments; - sphereMesh->mIndices[c++] = i * numSegments + numSegments - 1; + sphereMesh->m_indices[c++] = i * numSegments; + sphereMesh->m_indices[c++] = (i - 1) * numSegments; + sphereMesh->m_indices[c++] = i * numSegments + numSegments - 1; } // highest and deepest indices for (i = 0; i < numSegments - 1; ++i) { - sphereMesh->mIndices[c++] = i; - sphereMesh->mIndices[c++] = i + 1; - sphereMesh->mIndices[c++] = (numSegments - 2) * numSegments; + sphereMesh->m_indices[c++] = i; + sphereMesh->m_indices[c++] = i + 1; + sphereMesh->m_indices[c++] = (numSegments - 2) * numSegments; } - sphereMesh->mIndices[c++] = numSegments - 1; - sphereMesh->mIndices[c++] = 0; - sphereMesh->mIndices[c++] = (numSegments - 2) * numSegments; + sphereMesh->m_indices[c++] = numSegments - 1; + sphereMesh->m_indices[c++] = 0; + sphereMesh->m_indices[c++] = (numSegments - 2) * numSegments; for (i = 0; i < numSegments - 1; ++i) { - sphereMesh->mIndices[c++] = (numSegments - 3) * numSegments + i; - sphereMesh->mIndices[c++] = (numSegments - 3) * numSegments + i + 1; - sphereMesh->mIndices[c++] = (numSegments - 2) * numSegments + 1; + sphereMesh->m_indices[c++] = (numSegments - 3) * numSegments + i; + sphereMesh->m_indices[c++] = (numSegments - 3) * numSegments + i + 1; + sphereMesh->m_indices[c++] = (numSegments - 2) * numSegments + 1; } - sphereMesh->mIndices[c++] = (numSegments - 3) * numSegments + (numSegments - 1); - sphereMesh->mIndices[c++] = (numSegments - 3) * numSegments; - sphereMesh->mIndices[c++] = (numSegments - 2) * numSegments + 1; + sphereMesh->m_indices[c++] = (numSegments - 3) * numSegments + (numSegments - 1); + sphereMesh->m_indices[c++] = (numSegments - 3) * numSegments; + sphereMesh->m_indices[c++] = (numSegments - 2) * numSegments + 1; return sphereMesh; } @@ -1139,63 +1139,63 @@ namespace MCommon mesh->Allocate(numVertices, numTriangles * 3, true); // define the vertices - mesh->mPositions[0] = AZ::Vector3(-0.5f, -0.5f, -0.5f) * size; - mesh->mPositions[1] = AZ::Vector3(0.5f, -0.5f, -0.5f) * size; - mesh->mPositions[2] = AZ::Vector3(0.5f, 0.5f, -0.5f) * size; - mesh->mPositions[3] = AZ::Vector3(-0.5f, 0.5f, -0.5f) * size; - mesh->mPositions[4] = AZ::Vector3(-0.5f, -0.5f, 0.5f) * size; - mesh->mPositions[5] = AZ::Vector3(0.5f, -0.5f, 0.5f) * size; - mesh->mPositions[6] = AZ::Vector3(0.5f, 0.5f, 0.5f) * size; - mesh->mPositions[7] = AZ::Vector3(-0.5f, 0.5f, 0.5f) * size; + mesh->m_positions[0] = AZ::Vector3(-0.5f, -0.5f, -0.5f) * size; + mesh->m_positions[1] = AZ::Vector3(0.5f, -0.5f, -0.5f) * size; + mesh->m_positions[2] = AZ::Vector3(0.5f, 0.5f, -0.5f) * size; + mesh->m_positions[3] = AZ::Vector3(-0.5f, 0.5f, -0.5f) * size; + mesh->m_positions[4] = AZ::Vector3(-0.5f, -0.5f, 0.5f) * size; + mesh->m_positions[5] = AZ::Vector3(0.5f, -0.5f, 0.5f) * size; + mesh->m_positions[6] = AZ::Vector3(0.5f, 0.5f, 0.5f) * size; + mesh->m_positions[7] = AZ::Vector3(-0.5f, 0.5f, 0.5f) * size; // define the indices - mesh->mIndices[0] = 0; - mesh->mIndices[1] = 1; - mesh->mIndices[2] = 2; + mesh->m_indices[0] = 0; + mesh->m_indices[1] = 1; + mesh->m_indices[2] = 2; - mesh->mIndices[3] = 0; - mesh->mIndices[4] = 2; - mesh->mIndices[5] = 3; + mesh->m_indices[3] = 0; + mesh->m_indices[4] = 2; + mesh->m_indices[5] = 3; - mesh->mIndices[6] = 1; - mesh->mIndices[7] = 5; - mesh->mIndices[8] = 6; + mesh->m_indices[6] = 1; + mesh->m_indices[7] = 5; + mesh->m_indices[8] = 6; - mesh->mIndices[9] = 1; - mesh->mIndices[10] = 6; - mesh->mIndices[11] = 2; + mesh->m_indices[9] = 1; + mesh->m_indices[10] = 6; + mesh->m_indices[11] = 2; - mesh->mIndices[12] = 5; - mesh->mIndices[13] = 4; - mesh->mIndices[14] = 7; + mesh->m_indices[12] = 5; + mesh->m_indices[13] = 4; + mesh->m_indices[14] = 7; - mesh->mIndices[15] = 5; - mesh->mIndices[16] = 7; - mesh->mIndices[17] = 6; + mesh->m_indices[15] = 5; + mesh->m_indices[16] = 7; + mesh->m_indices[17] = 6; - mesh->mIndices[18] = 4; - mesh->mIndices[19] = 0; - mesh->mIndices[20] = 3; + mesh->m_indices[18] = 4; + mesh->m_indices[19] = 0; + mesh->m_indices[20] = 3; - mesh->mIndices[21] = 4; - mesh->mIndices[22] = 3; - mesh->mIndices[23] = 7; + mesh->m_indices[21] = 4; + mesh->m_indices[22] = 3; + mesh->m_indices[23] = 7; - mesh->mIndices[24] = 1; - mesh->mIndices[25] = 0; - mesh->mIndices[26] = 4; + mesh->m_indices[24] = 1; + mesh->m_indices[25] = 0; + mesh->m_indices[26] = 4; - mesh->mIndices[27] = 1; - mesh->mIndices[28] = 4; - mesh->mIndices[29] = 5; + mesh->m_indices[27] = 1; + mesh->m_indices[28] = 4; + mesh->m_indices[29] = 5; - mesh->mIndices[30] = 3; - mesh->mIndices[31] = 2; - mesh->mIndices[32] = 6; + mesh->m_indices[30] = 3; + mesh->m_indices[31] = 2; + mesh->m_indices[32] = 6; - mesh->mIndices[33] = 3; - mesh->mIndices[34] = 6; - mesh->mIndices[35] = 7; + mesh->m_indices[33] = 3; + mesh->m_indices[34] = 6; + mesh->m_indices[35] = 7; // calculate the normals mesh->CalculateNormals(); @@ -1219,7 +1219,7 @@ namespace MCommon // fill in the indices for (uint32 i = 0; i < numVertices; ++i) { - mesh->mIndices[i] = i; + mesh->m_indices[i] = i; } // fill in the vertices and recalculate the normals @@ -1234,7 +1234,7 @@ namespace MCommon { static AZ::Vector3 points[12]; size_t pointNr = 0; - const size_t numVertices = mesh->mPositions.size(); + const size_t numVertices = mesh->m_positions.size(); const size_t numTriangles = numVertices / 3; assert(numTriangles * 3 == numVertices); const size_t numSegments = numTriangles / 2; @@ -1273,14 +1273,14 @@ namespace MCommon vertexNr = i * 6; // triangle 1 - mesh->mPositions[vertexNr + 0] = segmentPoint; - mesh->mPositions[vertexNr + 1] = previousPoint; - mesh->mPositions[vertexNr + 2] = center; + mesh->m_positions[vertexNr + 0] = segmentPoint; + mesh->m_positions[vertexNr + 1] = previousPoint; + mesh->m_positions[vertexNr + 2] = center; // triangle 2 - mesh->mPositions[vertexNr + 3] = previousPoint; - mesh->mPositions[vertexNr + 4] = segmentPoint; - mesh->mPositions[vertexNr + 5] = top; + mesh->m_positions[vertexNr + 3] = previousPoint; + mesh->m_positions[vertexNr + 4] = segmentPoint; + mesh->m_positions[vertexNr + 5] = top; // postprocess data previousPoint = segmentPoint; @@ -1350,36 +1350,36 @@ namespace MCommon // constructor RenderUtil::AxisRenderingSettings::AxisRenderingSettings() { - mSize = 1.0f; - mRenderXAxis = true; - mRenderYAxis = true; - mRenderZAxis = true; - mRenderXAxisName = false; - mRenderYAxisName = false; - mRenderZAxisName = false; - mSelected = false; + m_size = 1.0f; + m_renderXAxis = true; + m_renderYAxis = true; + m_renderZAxis = true; + m_renderXAxisName = false; + m_renderYAxisName = false; + m_renderZAxisName = false; + m_selected = false; } // render line based axis void RenderUtil::RenderLineAxis(const AxisRenderingSettings& settings) { - const float size = settings.mSize; - const AZ::Transform& worldTM = settings.mWorldTM; - const AZ::Vector3& cameraRight = settings.mCameraRight; - const AZ::Vector3& cameraUp = settings.mCameraUp; + const float size = settings.m_size; + const AZ::Transform& worldTM = settings.m_worldTm; + const AZ::Vector3& cameraRight = settings.m_cameraRight; + const AZ::Vector3& cameraUp = settings.m_cameraUp; const float arrowHeadRadius = size * 0.1f; const float arrowHeadHeight = size * 0.3f; const float axisHeight = size * 0.7f; const AZ::Vector3 position = worldTM.GetTranslation(); - if (settings.mRenderXAxis) + if (settings.m_renderXAxis) { // set the color MCore::RGBAColor xAxisColor = MCore::RGBAColor(1.0f, 0.0f, 0.0f); MCore::RGBAColor xSelectedColor; - if (settings.mSelected) + if (settings.m_selected) { xSelectedColor = MCore::RGBAColor(1.0f, 0.647f, 0.0f); } @@ -1393,7 +1393,7 @@ namespace MCommon RenderArrowHead(arrowHeadHeight, arrowHeadRadius, xAxisArrowStart, xAxisDir, xSelectedColor); RenderLine(position, xAxisArrowStart, xAxisColor); - if (settings.mRenderXAxisName) + if (settings.m_renderXAxisName) { const AZ::Vector3 xNamePos = position + xAxisDir * (size * 1.15f); RenderLine(xNamePos + cameraUp * (-0.15f * size) + cameraRight * (0.1f * size), xNamePos + cameraUp * (0.15f * size) + cameraRight * (-0.1f * size), xAxisColor); @@ -1401,13 +1401,13 @@ namespace MCommon } } - if (settings.mRenderYAxis) + if (settings.m_renderYAxis) { // set the color MCore::RGBAColor yAxisColor = MCore::RGBAColor(0.0f, 1.0f, 0.0f); MCore::RGBAColor ySelectedColor; - if (settings.mSelected) + if (settings.m_selected) { ySelectedColor = MCore::RGBAColor(1.0f, 0.647f, 0.0f); } @@ -1421,7 +1421,7 @@ namespace MCommon RenderArrowHead(arrowHeadHeight, arrowHeadRadius, yAxisArrowStart, yAxisDir, ySelectedColor); RenderLine(position, yAxisArrowStart, yAxisColor); - if (settings.mRenderYAxisName) + if (settings.m_renderYAxisName) { const AZ::Vector3 yNamePos = position + yAxisDir * (size * 1.15f); RenderLine(yNamePos, yNamePos + cameraRight * (-0.1f * size) + cameraUp * (0.15f * size), yAxisColor); @@ -1430,13 +1430,13 @@ namespace MCommon } } - if (settings.mRenderZAxis) + if (settings.m_renderZAxis) { // set the color MCore::RGBAColor zAxisColor = MCore::RGBAColor(0.0f, 0.0f, 1.0f); MCore::RGBAColor zSelectedColor; - if (settings.mSelected) + if (settings.m_selected) { zSelectedColor = MCore::RGBAColor(1.0f, 0.647f, 0.0f); } @@ -1450,7 +1450,7 @@ namespace MCommon RenderArrowHead(arrowHeadHeight, arrowHeadRadius, zAxisArrowStart, zAxisDir, zSelectedColor); RenderLine(position, zAxisArrowStart, zAxisColor); - if (settings.mRenderZAxisName) + if (settings.m_renderZAxisName) { const AZ::Vector3 zNamePos = position + zAxisDir * (size * 1.15f); RenderLine(zNamePos + cameraRight * (-0.1f * size) + cameraUp * (0.15f * size), zNamePos + cameraRight * (0.1f * size) + cameraUp * (0.15f * size), zAxisColor); @@ -1700,7 +1700,7 @@ namespace MCommon } // get some helper variables and check if there is a motion extraction node set - EMotionFX::ActorInstance* actorInstance = trajectoryPath->mActorInstance; + EMotionFX::ActorInstance* actorInstance = trajectoryPath->m_actorInstance; EMotionFX::Actor* actor = actorInstance->GetActor(); EMotionFX::Node* extractionNode = actor->GetMotionExtractionNode(); if (extractionNode == NULL) @@ -1709,7 +1709,7 @@ namespace MCommon } // fast access to the trajectory trace particles - const AZStd::vector& traceParticles = trajectoryPath->mTraceParticles; + const AZStd::vector& traceParticles = trajectoryPath->m_traceParticles; const size_t numTraceParticles = traceParticles.size(); if (traceParticles.empty()) { @@ -1728,7 +1728,7 @@ namespace MCommon // Render arrow head ////////////////////////////////////////////////////////////////////////////////////////////////////// // get the position and some direction vectors of the trajectory node matrix - EMotionFX::Transform worldTM = traceParticles[numTraceParticles - 1].mWorldTM; + EMotionFX::Transform worldTM = traceParticles[numTraceParticles - 1].m_worldTm; AZ::Vector3 right = MCore::GetRight(trajectoryWorldTM).GetNormalized(); AZ::Vector3 center = trajectoryWorldTM.GetTranslation(); AZ::Vector3 forward = MCore::GetForward(trajectoryWorldTM).GetNormalized(); @@ -1787,17 +1787,17 @@ namespace MCommon float normalizedDistance = (float)i / numTraceParticles; // get the start and end point of the line segment and calculate the delta between them - worldTM = traceParticles[i].mWorldTM; - a = worldTM.mPosition; - b = traceParticles[i - 1].mWorldTM.mPosition; + worldTM = traceParticles[i].m_worldTm; + a = worldTM.m_position; + b = traceParticles[i - 1].m_worldTm.m_position; right = MCore::GetRight(worldTM.ToAZTransform()).GetNormalized(); if (i > 1 && i < numTraceParticles - 3) { - const AZ::Vector3 deltaA = traceParticles[i - 2].mWorldTM.mPosition - traceParticles[i - 1].mWorldTM.mPosition; - const AZ::Vector3 deltaB = traceParticles[i - 1].mWorldTM.mPosition - traceParticles[i ].mWorldTM.mPosition; - const AZ::Vector3 deltaC = traceParticles[i ].mWorldTM.mPosition - traceParticles[i + 1].mWorldTM.mPosition; - const AZ::Vector3 deltaD = traceParticles[i + 1].mWorldTM.mPosition - traceParticles[i + 2].mWorldTM.mPosition; + const AZ::Vector3 deltaA = traceParticles[i - 2].m_worldTm.m_position - traceParticles[i - 1].m_worldTm.m_position; + const AZ::Vector3 deltaB = traceParticles[i - 1].m_worldTm.m_position - traceParticles[i ].m_worldTm.m_position; + const AZ::Vector3 deltaC = traceParticles[i ].m_worldTm.m_position - traceParticles[i + 1].m_worldTm.m_position; + const AZ::Vector3 deltaD = traceParticles[i + 1].m_worldTm.m_position - traceParticles[i + 2].m_worldTm.m_position; AZ::Vector3 delta = deltaA + deltaB + deltaC + deltaD; delta = MCore::SafeNormalize(delta); @@ -1832,7 +1832,7 @@ namespace MCommon } // render the solid arrow - color.a = normalizedDistance; + color.m_a = normalizedDistance; RenderTriangle(vertices[0] + liftFromGround, vertices[2] + liftFromGround, vertices[1] + liftFromGround, color); RenderTriangle(vertices[1] + liftFromGround, vertices[2] + liftFromGround, vertices[3] + liftFromGround, color); @@ -1856,7 +1856,7 @@ namespace MCommon } // remove all particles while keeping the data in memory - trajectoryPath->mTraceParticles.clear(); + trajectoryPath->m_traceParticles.clear(); } @@ -1895,7 +1895,7 @@ namespace MCommon { const EMotionFX::Node* joint = skeleton->GetNode(actorInstance->GetEnabledNode(i)); const size_t jointIndex = joint->GetNodeIndex(); - const AZ::Vector3 worldPos = pose->GetWorldSpaceTransform(jointIndex).mPosition; + const AZ::Vector3 worldPos = pose->GetWorldSpaceTransform(jointIndex).m_position; // check if the current enabled node is along the visible nodes and render it if that is the case if (visibleJointIndices.empty() || @@ -1961,7 +1961,7 @@ namespace MCommon void RenderUtil::RenderWireframeSphere(float radius, const AZ::Transform& worldTM, const MCore::RGBAColor& color, bool directlyRender) { - const float stepSize = AZ::Constants::TwoPi / m_wireframeSphereSegmentCount; + const float stepSize = AZ::Constants::TwoPi / s_wireframeSphereSegmentCount; AZ::Vector3 pos1, pos2; float x1, y1, x2, y2; @@ -1997,7 +1997,7 @@ namespace MCommon // The end points of these half circles connect the bottom cap to the top cap (the cylinder part in the middle). void RenderUtil::RenderWireframeCapsule(float radius, float height, const AZ::Transform& worldTM, const MCore::RGBAColor& color, bool directlyRender) { - float stepSize = AZ::Constants::TwoPi / m_wireframeSphereSegmentCount; + float stepSize = AZ::Constants::TwoPi / s_wireframeSphereSegmentCount; const float cylinderHeight = height - 2.0f * radius; const float halfCylinderHeight = cylinderHeight * 0.5f; @@ -2341,73 +2341,68 @@ namespace MCommon RenderUtil::FontChar::FontChar() { - mIndexCount = 0; - mIndices = 0; - mX1 = mY1 = mX2 = mY2 = 0; + m_indexCount = 0; + m_indices = 0; + m_x1 = m_y1 = m_x2 = m_y2 = 0; } const unsigned char* RenderUtil::FontChar::Init(const unsigned char* data, const float* vertices) { - data = getUShort(data, mIndexCount); - mIndices = (const unsigned short*)data; - data += mIndexCount * sizeof(unsigned short); + data = getUShort(data, m_indexCount); + m_indices = (const unsigned short*)data; + data += m_indexCount * sizeof(unsigned short); - for (uint32 i = 0; i < mIndexCount; ++i) + for (uint32 i = 0; i < m_indexCount; ++i) { - uint32 index = mIndices[i]; + uint32 index = m_indices[i]; const float* vertex = &vertices[index * 2]; //assert( _finite(vertex[0]) ); //assert( _finite(vertex[1]) ); if (i == 0) { - mX1 = mX2 = vertex[0]; - mY1 = mY2 = vertex[1]; + m_x1 = m_x2 = vertex[0]; + m_y1 = m_y2 = vertex[1]; } else { - if (vertex[0] < mX1) + if (vertex[0] < m_x1) { - mX1 = vertex[0]; + m_x1 = vertex[0]; } - if (vertex[1] < mY1) + if (vertex[1] < m_y1) { - mY1 = vertex[1]; + m_y1 = vertex[1]; } - if (vertex[0] > mX2) + if (vertex[0] > m_x2) { - mX2 = vertex[0]; + m_x2 = vertex[0]; } - if (vertex[1] > mY2) + if (vertex[1] > m_y2) { - mY2 = vertex[1]; + m_y2 = vertex[1]; } } } - //assert( _finite(mX1) ); - //assert( _finite(mX2) ); - //assert( _finite(mY1) ); - //assert( _finite(mY2) ); - return data; } void RenderUtil::FontChar::Render(const float* vertices, RenderUtil* renderUtil, float textScale, float& x, float& y, float posX, float posY, const MCore::RGBAColor& color) { - if (mIndices) + if (m_indices) { - const uint32 lineCount = mIndexCount / 2; - const float spacing = (mX2 - mX1) + 0.05f; + const uint32 lineCount = m_indexCount / 2; + const float spacing = (m_x2 - m_x1) + 0.05f; AZ::Vector2 p1; AZ::Vector2 p2; for (uint32 i = 0; i < lineCount; ++i) { - const float* v1 = &vertices[ mIndices[i * 2 + 0] * 2 ]; - const float* v2 = &vertices[ mIndices[i * 2 + 1] * 2 ]; + const float* v1 = &vertices[ m_indices[i * 2 + 0] * 2 ]; + const float* v2 = &vertices[ m_indices[i * 2 + 1] * 2 ]; p1.SetX((v1[0] + x) * textScale + posX); p1.SetY((v1[1] + y) * textScale); p2.SetX((v2[0] + x) * textScale + posX); @@ -2427,11 +2422,11 @@ namespace MCommon RenderUtil::VectorFont::VectorFont(RenderUtil* renderUtil) { - mRenderUtil = renderUtil; - mVersion = 0; - mVcount = 0; - mCount = 0; - mVertices = NULL; + m_renderUtil = renderUtil; + m_version = 0; + m_vcount = 0; + m_count = 0; + m_vertices = NULL; Init(gFontData); } @@ -2445,10 +2440,10 @@ namespace MCommon void RenderUtil::VectorFont::Release() { - mVersion = 0; - mVcount = 0; - mCount = 0; - mVertices = NULL; + m_version = 0; + m_vcount = 0; + m_count = 0; + m_vertices = NULL; } @@ -2458,22 +2453,22 @@ namespace MCommon if (fontData[0] == 'F' && fontData[1] == 'O' && fontData[2] == 'N' && fontData[3] == 'T') { fontData += 4; - fontData = getUint(fontData, mVersion); + fontData = getUint(fontData, m_version); - if (mVersion == FONT_VERSION) + if (m_version == FONT_VERSION) { - fontData = getUint(fontData, mVcount); - fontData = getUint(fontData, mCount); - fontData = getUint(fontData, mIcount); + fontData = getUint(fontData, m_vcount); + fontData = getUint(fontData, m_count); + fontData = getUint(fontData, m_icount); - uint32 vsize = sizeof(float) * mVcount * 2; - mVertices = (float*)fontData; + uint32 vsize = sizeof(float) * m_vcount * 2; + m_vertices = (float*)fontData; fontData += vsize; - for (uint32 i = 0; i < mCount; ++i) + for (uint32 i = 0; i < m_count; ++i) { unsigned char c = *fontData++; - fontData = mCharacters[c].Init(fontData, mVertices); + fontData = m_characters[c].Init(fontData, m_vertices); } } } @@ -2487,10 +2482,7 @@ namespace MCommon while (*text) { char codeUnit = *text++; - //if (codeUnit <= 255) - textWidth += mCharacters[(int)codeUnit].GetWidth(); - //else - // textWidth += mCharacters['?'].GetWidth(); + textWidth += m_characters[(int)codeUnit].GetWidth(); } return textWidth; @@ -2511,10 +2503,7 @@ namespace MCommon while (*text) { const char c = *text++; - // if (c <= 255) - mCharacters[(int)c].Render(mVertices, mRenderUtil, fontScale, x, y, posX, posY, color); - // else - // mCharacters['?'].Render( mVertices, mRenderUtil, fontScale, x, y, posX, posY, color ); + m_characters[(int)c].Render(m_vertices, m_renderUtil, fontScale, x, y, posX, posY, color); } } } // namespace MCommon diff --git a/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/RenderUtil.h b/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/RenderUtil.h index 6e870c870e..c21c18fd07 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/RenderUtil.h +++ b/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/RenderUtil.h @@ -33,11 +33,11 @@ namespace MCommon public: // colors - static MCore::RGBAColor mSelectionColor; - static MCore::RGBAColor mSelectionColorDarker; - static MCore::RGBAColor mRed; - static MCore::RGBAColor mGreen; - static MCore::RGBAColor mBlue; + static MCore::RGBAColor s_selectionColor; + static MCore::RGBAColor s_selectionColorDarker; + static MCore::RGBAColor s_red; + static MCore::RGBAColor s_green; + static MCore::RGBAColor s_blue; }; @@ -149,12 +149,12 @@ namespace MCommon */ AABBRenderSettings(); - bool mNodeBasedAABB; /**< Enable in case you want to render the node based AABB (default=true). */ - bool mMeshBasedAABB; /**< Enable in case you want to render the mesh based AABB (default=true). */ - bool mStaticBasedAABB; /**< Enable in case you want to render the static based AABB (default=true). */ - MCore::RGBAColor mNodeBasedColor; /**< The color of the node based AABB. */ - MCore::RGBAColor mMeshBasedColor; /**< The color of the mesh based AABB. */ - MCore::RGBAColor mStaticBasedColor; /**< The color of the static based AABB. */ + bool m_nodeBasedAabb; /**< Enable in case you want to render the node based AABB (default=true). */ + bool m_meshBasedAabb; /**< Enable in case you want to render the mesh based AABB (default=true). */ + bool m_staticBasedAabb; /**< Enable in case you want to render the static based AABB (default=true). */ + MCore::RGBAColor m_nodeBasedColor; /**< The color of the node based AABB. */ + MCore::RGBAColor m_meshBasedColor; /**< The color of the mesh based AABB. */ + MCore::RGBAColor m_staticBasedColor; /**< The color of the static based AABB. */ }; /** @@ -239,7 +239,7 @@ namespace MCommon * @param color The desired sphere color. * @param worldTM The world space transformation matrix. */ - MCORE_INLINE void RenderSphere(const MCore::RGBAColor& color, const AZ::Transform& worldTM) { RenderUtilMesh(mUnitSphereMesh, color, worldTM); } + MCORE_INLINE void RenderSphere(const MCore::RGBAColor& color, const AZ::Transform& worldTM) { RenderUtilMesh(m_unitSphereMesh, color, worldTM); } /** * Render a circle, consisting of lines. @@ -255,7 +255,7 @@ namespace MCommon * @param color The desired cube color. * @param worldTM The world space transformation matrix. */ - MCORE_INLINE void RenderCube(const MCore::RGBAColor& color, const AZ::Transform& worldTM) { RenderUtilMesh(mUnitCubeMesh, color, worldTM); } + MCORE_INLINE void RenderCube(const MCore::RGBAColor& color, const AZ::Transform& worldTM) { RenderUtilMesh(m_unitCubeMesh, color, worldTM); } /** * Render a cylinder. @@ -265,7 +265,7 @@ namespace MCommon * @param color The desired cylinder color. * @param worldTM The world space transformation matrix. */ - MCORE_INLINE void RenderCylinder(float baseRadius, float topRadius, float length, const MCore::RGBAColor& color, const AZ::Transform& worldTM) { FillCylinder(mCylinderMesh, baseRadius, topRadius, length); RenderUtilMesh(mCylinderMesh, color, worldTM); } + MCORE_INLINE void RenderCylinder(float baseRadius, float topRadius, float length, const MCore::RGBAColor& color, const AZ::Transform& worldTM) { FillCylinder(m_cylinderMesh, baseRadius, topRadius, length); RenderUtilMesh(m_cylinderMesh, color, worldTM); } /** * Render a cylinder. @@ -302,7 +302,7 @@ namespace MCommon * @param color The desired arrow head color. * @param worldTM The world space transformation matrix. */ - MCORE_INLINE void RenderArrowHead(float height, float radius, const MCore::RGBAColor& color, const AZ::Transform& worldTM) { FillArrowHead(mArrowHeadMesh, height, radius); RenderUtilMesh(mArrowHeadMesh, color, worldTM); } + MCORE_INLINE void RenderArrowHead(float height, float radius, const MCore::RGBAColor& color, const AZ::Transform& worldTM) { FillArrowHead(m_arrowHeadMesh, height, radius); RenderUtilMesh(m_arrowHeadMesh, color, worldTM); } /** * Render an arrow head. @@ -336,17 +336,17 @@ namespace MCommon */ AxisRenderingSettings(); - AZ::Transform mWorldTM; /**< The world space transformation matrix to visualize. */ - AZ::Vector3 mCameraRight; /**< The inverse of the camera's right vector used for billboarding the axis names. */ - AZ::Vector3 mCameraUp; /**< The inverse of the camera's up vector used for billboarding the axis names. */ - float mSize; /**< The size value in units is used to control the scaling of the axis. */ - bool mRenderXAxis; /**< Set to true if you want to render the x axis, false if the x axis should be skipped. */ - bool mRenderYAxis; /**< Set to true if you want to render the y axis, false if the y axis should be skipped. */ - bool mRenderZAxis; /**< Set to true if you want to render the z axis, false if the z axis should be skipped. */ - bool mRenderXAxisName; /**< Set to true if you want to render the name of the x axis. The name will only be rendered if the axis itself will be rendered as well. */ - bool mRenderYAxisName; /**< Set to true if you want to render the name of the y axis. The name will only be rendered if the axis itself will be rendered as well. */ - bool mRenderZAxisName; /**< Set to true if you want to render the name of the z axis. The name will only be rendered if the axis itself will be rendered as well. */ - bool mSelected; /**< Set to true if you want to render the axis using the selection color. */ + AZ::Transform m_worldTm; /**< The world space transformation matrix to visualize. */ + AZ::Vector3 m_cameraRight; /**< The inverse of the camera's right vector used for billboarding the axis names. */ + AZ::Vector3 m_cameraUp; /**< The inverse of the camera's up vector used for billboarding the axis names. */ + float m_size; /**< The size value in units is used to control the scaling of the axis. */ + bool m_renderXAxis; /**< Set to true if you want to render the x axis, false if the x axis should be skipped. */ + bool m_renderYAxis; /**< Set to true if you want to render the y axis, false if the y axis should be skipped. */ + bool m_renderZAxis; /**< Set to true if you want to render the z axis, false if the z axis should be skipped. */ + bool m_renderXAxisName; /**< Set to true if you want to render the name of the x axis. The name will only be rendered if the axis itself will be rendered as well. */ + bool m_renderYAxisName; /**< Set to true if you want to render the name of the y axis. The name will only be rendered if the axis itself will be rendered as well. */ + bool m_renderZAxisName; /**< Set to true if you want to render the name of the z axis. The name will only be rendered if the axis itself will be rendered as well. */ + bool m_selected; /**< Set to true if you want to render the axis using the selection color. */ }; /** @@ -372,8 +372,8 @@ namespace MCommon struct MCOMMON_API LineVertex { MCORE_MEMORYOBJECTCATEGORY(RenderUtil::LineVertex, MCore::MCORE_DEFAULT_ALIGNMENT, MEMCATEGORY_MCOMMON); - AZ::Vector3 mPosition; /**< The position of the vertex. */ - MCore::RGBAColor mColor; /**< The vertex color. */ + AZ::Vector3 m_position; /**< The position of the vertex. */ + MCore::RGBAColor m_color; /**< The vertex color. */ }; /** @@ -384,12 +384,12 @@ namespace MCommon */ MCORE_INLINE void RenderLine(const AZ::Vector3& v1, const AZ::Vector3& v2, const MCore::RGBAColor& color) { - mVertexBuffer[mNumVertices].mPosition = v1; - mVertexBuffer[mNumVertices + 1].mPosition = v2; - mVertexBuffer[mNumVertices].mColor = color; - mVertexBuffer[mNumVertices + 1].mColor = color; - mNumVertices += 2; - if (mNumVertices >= mNumMaxLineVertices) + m_vertexBuffer[m_numVertices].m_position = v1; + m_vertexBuffer[m_numVertices + 1].m_position = v2; + m_vertexBuffer[m_numVertices].m_color = color; + m_vertexBuffer[m_numVertices + 1].m_color = color; + m_numVertices += 2; + if (m_numVertices >= s_numMaxLineVertices) { RenderLines(); } @@ -416,11 +416,11 @@ namespace MCommon struct MCOMMON_API Line2D { MCORE_MEMORYOBJECTCATEGORY(RenderUtil::Line2D, MCore::MCORE_DEFAULT_ALIGNMENT, MEMCATEGORY_MCOMMON); - float mX1; /**< The x position of the first vertex. */ - float mY1; /**< The y position of the first vertex. */ - float mX2; /**< The x position of the second vertex. */ - float mY2; /**< The y position of the second vertex. */ - MCore::RGBAColor mColor; /**< The line color. */ + float m_x1; /**< The x position of the first vertex. */ + float m_y1; /**< The y position of the first vertex. */ + float m_x2; /**< The x position of the second vertex. */ + float m_y2; /**< The y position of the second vertex. */ + MCore::RGBAColor m_color; /**< The line color. */ }; /** @@ -433,13 +433,13 @@ namespace MCommon */ MCORE_INLINE void Render2DLine(float x1, float y1, float x2, float y2, const MCore::RGBAColor& color) { - m2DLines[mNum2DLines].mX1 = x1; - m2DLines[mNum2DLines].mY1 = y1; - m2DLines[mNum2DLines].mX2 = x2; - m2DLines[mNum2DLines].mY2 = y2; - m2DLines[mNum2DLines].mColor = color; - mNum2DLines++; - if (mNum2DLines >= mNumMax2DLines) + m_m2DLines[m_num2DLines].m_x1 = x1; + m_m2DLines[m_num2DLines].m_y1 = y1; + m_m2DLines[m_num2DLines].m_x2 = x2; + m_m2DLines[m_num2DLines].m_y2 = y2; + m_m2DLines[m_num2DLines].m_color = color; + m_num2DLines++; + if (m_num2DLines >= s_numMax2DLines) { Render2DLines(); } @@ -489,9 +489,9 @@ namespace MCommon */ void Allocate(uint32 numVertices, uint32 numIndices, bool hasNormals); - AZStd::vector mPositions; /**< The vertex buffer. */ - AZStd::vector mIndices; /**< The index buffer. */ - AZStd::vector mNormals; /**< The normal buffer. */ + AZStd::vector m_positions; /**< The vertex buffer. */ + AZStd::vector m_indices; /**< The index buffer. */ + AZStd::vector m_normals; /**< The normal buffer. */ }; /** @@ -500,12 +500,12 @@ namespace MCommon struct UtilMeshVertex { MCORE_MEMORYOBJECTCATEGORY(RenderUtil::UtilMeshVertex, MCore::MCORE_DEFAULT_ALIGNMENT, MEMCATEGORY_MCOMMON); - AZ::Vector3 mPosition; /**< The position of the vertex. */ - AZ::Vector3 mNormal; /**< The vertex normal. */ + AZ::Vector3 m_position; /**< The position of the vertex. */ + AZ::Vector3 m_normal; /**< The vertex normal. */ UtilMeshVertex(const AZ::Vector3& pos, const AZ::Vector3& normal) - : mPosition(pos) - , mNormal(normal) {} + : m_position(pos) + , m_normal(normal) {} }; /** @@ -530,51 +530,33 @@ namespace MCommon * To avoid recalculating them several times we do this at a central place. This function needs to be called before switching to a new mesh inside * the render loop as well as before an animation update, so before calling any of the render normals, face normals, tangents and bitangents functions. */ - MCORE_INLINE void ResetCurrentMesh() { mCurrentMesh = NULL; } + MCORE_INLINE void ResetCurrentMesh() { m_currentMesh = NULL; } //--------------------------------------------------------------------------------------------- - /*struct MCOMMON_API Triangle - { - MCORE_MEMORYOBJECTCATEGORY( RenderUtil::Triangle, MCore::MCORE_DEFAULT_ALIGNMENT, MEMCATEGORY_MCOMMON ); - - AZ::Vector3 mPosA; - AZ::Vector3 mPosB; - AZ::Vector3 mPosC; - - AZ::Vector3 mNormalA; - AZ::Vector3 mNormalB; - AZ::Vector3 mNormalC; - - uint32 mColor; - - Triangle() {} - Triangle(const AZ::Vector3& posA, const AZ::Vector3& posB, const AZ::Vector3& posC, const AZ::Vector3& normalA, const AZ::Vector3& normalB, const AZ::Vector3& normalC, uint32 color) : mPosA(posA), mPosB(posB), mPosC(posC), mNormalA(normalA), mNormalB(normalB), mNormalC(normalC), mColor(color) {} - };*/ - /** * The vertex structure to be used for rendering util meshes. */ struct TriangleVertex { MCORE_MEMORYOBJECTCATEGORY(RenderUtil::TriangleVertex, MCore::MCORE_DEFAULT_ALIGNMENT, MEMCATEGORY_MCOMMON); - AZ::Vector3 mPosition; /**< The position of the vertex. */ - AZ::Vector3 mNormal; /**< The vertex normal. */ - uint32 mColor; + AZ::Vector3 m_position; /**< The position of the vertex. */ + AZ::Vector3 m_normal; /**< The vertex normal. */ + uint32 m_color; MCORE_INLINE TriangleVertex(const AZ::Vector3& pos, const AZ::Vector3& normal, uint32 color) - : mPosition(pos) - , mNormal(normal) - , mColor(color) {} + : m_position(pos) + , m_normal(normal) + , m_color(color) {} }; MCORE_INLINE void AddTriangle(const AZ::Vector3& posA, const AZ::Vector3& posB, const AZ::Vector3& posC, const AZ::Vector3& normalA, const AZ::Vector3& normalB, const AZ::Vector3& normalC, uint32 color) { - mTriangleVertices.emplace_back(TriangleVertex(posA, normalA, color)); - mTriangleVertices.emplace_back(TriangleVertex(posB, normalB, color)); - mTriangleVertices.emplace_back(TriangleVertex(posC, normalC, color)); + m_triangleVertices.emplace_back(TriangleVertex(posA, normalA, color)); + m_triangleVertices.emplace_back(TriangleVertex(posB, normalB, color)); + m_triangleVertices.emplace_back(TriangleVertex(posC, normalC, color)); - if (mTriangleVertices.size() + 2 >= mNumMaxTriangleVertices) + if (m_triangleVertices.size() + 2 >= s_numMaxTriangleVertices) { RenderTriangles(); } @@ -604,20 +586,20 @@ namespace MCommon struct TrajectoryPathParticle { - EMotionFX::Transform mWorldTM; + EMotionFX::Transform m_worldTm; }; struct TrajectoryTracePath { - AZStd::vector mTraceParticles; - EMotionFX::ActorInstance* mActorInstance; - float mTimePassed; + AZStd::vector m_traceParticles; + EMotionFX::ActorInstance* m_actorInstance; + float m_timePassed; TrajectoryTracePath() { - mTraceParticles.reserve(250); - mTimePassed = 0.0f; - mActorInstance = NULL; + m_traceParticles.reserve(250); + m_timePassed = 0.0f; + m_actorInstance = NULL; } }; @@ -637,7 +619,7 @@ namespace MCommon /** * Render text to screen. This will only work in case the Render2DLines() function has been implemented. */ - MCORE_INLINE void RenderText(float x, float y, const char* text, const MCore::RGBAColor& color = MCore::RGBAColor(1.0f, 1.0f, 1.0f), float fontSize = 11.0f, bool centered = false) { mFont->Render(x * m_devicePixelRatio, (y * m_devicePixelRatio) + fontSize - 1, fontSize, centered, text, color); } + MCORE_INLINE void RenderText(float x, float y, const char* text, const MCore::RGBAColor& color = MCore::RGBAColor(1.0f, 1.0f, 1.0f), float fontSize = 11.0f, bool centered = false) { m_font->Render(x * m_devicePixelRatio, (y * m_devicePixelRatio) + fontSize - 1, fontSize, centered, text, color); } /** * Render text to screen. This will only work in case the Render2DLines() function has been implemented. @@ -750,19 +732,19 @@ namespace MCommon MCORE_INLINE float GetWidth() const { float ret = 0.1f; - if (mIndexCount > 0) + if (m_indexCount > 0) { - ret = (mX2 - mX1) + 0.05f; + ret = (m_x2 - m_x1) + 0.05f; } return ret; } - float mX1; - float mX2; - float mY1; - float mY2; - unsigned short mIndexCount; - const unsigned short* mIndices; + float m_x1; + float m_x2; + float m_y1; + float m_y2; + unsigned short m_indexCount; + const unsigned short* m_indices; }; class MCOMMON_API VectorFont @@ -780,39 +762,39 @@ namespace MCommon float CalculateTextWidth(const char* text); private: - uint32 mVersion; - uint32 mVcount; - uint32 mCount; - float* mVertices; - uint32 mIcount; - FontChar mCharacters[256]; - RenderUtil* mRenderUtil; + uint32 m_version; + uint32 m_vcount; + uint32 m_count; + float* m_vertices; + uint32 m_icount; + FontChar m_characters[256]; + RenderUtil* m_renderUtil; }; - EMotionFX::Mesh* mCurrentMesh; /**< A pointer to the mesh whose world space positions are in the pre-calculated positions buffer. NULL in case we haven't pre-calculated any positions yet. */ - AZStd::vector mWorldSpacePositions; /**< The buffer used to store world space positions for rendering normals, tangents and the wireframe. */ + EMotionFX::Mesh* m_currentMesh; /**< A pointer to the mesh whose world space positions are in the pre-calculated positions buffer. NULL in case we haven't pre-calculated any positions yet. */ + AZStd::vector m_worldSpacePositions; /**< The buffer used to store world space positions for rendering normals, tangents and the wireframe. */ - LineVertex* mVertexBuffer; /**< Array of line vertices. */ - uint32 mNumVertices; /**< The current number of vertices in the array. */ - static uint32 mNumMaxLineVertices; /**< The maximum capacity of the line vertex buffer. */ + LineVertex* m_vertexBuffer; /**< Array of line vertices. */ + uint32 m_numVertices; /**< The current number of vertices in the array. */ + static uint32 s_numMaxLineVertices; /**< The maximum capacity of the line vertex buffer. */ - Line2D* m2DLines; /**< Array of 2D lines. */ - uint32 mNum2DLines; /**< The current number of 2D lines in the array. */ - static uint32 mNumMax2DLines; /**< The maximum capacity of the 2D line buffer. */ - static float m_wireframeSphereSegmentCount; + Line2D* m_m2DLines; /**< Array of 2D lines. */ + uint32 m_num2DLines; /**< The current number of 2D lines in the array. */ + static uint32 s_numMax2DLines; /**< The maximum capacity of the 2D line buffer. */ + static float s_wireframeSphereSegmentCount; float m_devicePixelRatio; - VectorFont* mFont; /**< The vector font used to render text. */ + VectorFont* m_font; /**< The vector font used to render text. */ - UtilMesh* mUnitSphereMesh; /**< The preallocated and preconstructed sphere mesh used for rendering. */ - UtilMesh* mCylinderMesh; /**< The preallocated and preconstructed cylinder mesh used for rendering. */ - UtilMesh* mUnitCubeMesh; /**< The preallocated and preconstructed cube mesh used for rendering. */ - UtilMesh* mArrowHeadMesh; /**< The preallocated and preconstructed arrow head mesh used for rendering. */ - static uint32 mNumMaxMeshVertices; /**< The maximum capacity of the util mesh vertex buffer. */ - static uint32 mNumMaxMeshIndices; /**< The maximum capacity of the util mesh index buffer */ + UtilMesh* m_unitSphereMesh; /**< The preallocated and preconstructed sphere mesh used for rendering. */ + UtilMesh* m_cylinderMesh; /**< The preallocated and preconstructed cylinder mesh used for rendering. */ + UtilMesh* m_unitCubeMesh; /**< The preallocated and preconstructed cube mesh used for rendering. */ + UtilMesh* m_arrowHeadMesh; /**< The preallocated and preconstructed arrow head mesh used for rendering. */ + static uint32 s_numMaxMeshVertices; /**< The maximum capacity of the util mesh vertex buffer. */ + static uint32 s_numMaxMeshIndices; /**< The maximum capacity of the util mesh index buffer */ // helper variables for rendering triangles - AZStd::vector mTriangleVertices; - static uint32 mNumMaxTriangleVertices; /**< The maximum capacity of the triangle vertex buffer */ + AZStd::vector m_triangleVertices; + static uint32 s_numMaxTriangleVertices; /**< The maximum capacity of the triangle vertex buffer */ }; } // namespace MCommon diff --git a/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/RotateManipulator.cpp b/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/RotateManipulator.cpp index 123ef00333..3a978d448c 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/RotateManipulator.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/RotateManipulator.cpp @@ -16,10 +16,10 @@ namespace MCommon RotateManipulator::RotateManipulator(float scalingFactor, bool isVisible) : TransformationManipulator(scalingFactor, isVisible) { - mMode = ROTATE_NONE; - mRotation = AZ::Vector3::CreateZero(); - mRotationQuat = AZ::Quaternion::CreateIdentity(); - mClickPosition = AZ::Vector3::CreateZero(); + m_mode = ROTATE_NONE; + m_rotation = AZ::Vector3::CreateZero(); + m_rotationQuat = AZ::Quaternion::CreateIdentity(); + m_clickPosition = AZ::Vector3::CreateZero(); } @@ -34,35 +34,35 @@ namespace MCommon { MCORE_UNUSED(camera); - // adjust the mSize when in ortho mode - mSize = mScalingFactor; - mInnerRadius = 0.15f * mSize; - mOuterRadius = 0.2f * mSize; - mArrowBaseRadius = mInnerRadius / 70.0f; - mAABBWidth = mInnerRadius / 30.0f;// previous 70.0f - mAxisSize = mSize * 0.05f; - mTextDistance = mSize * 0.05f; - mInnerQuadSize = 0.45f * MCore::Math::Sqrt(2) * mInnerRadius; + // adjust the m_size when in ortho mode + m_size = m_scalingFactor; + m_innerRadius = 0.15f * m_size; + m_outerRadius = 0.2f * m_size; + m_arrowBaseRadius = m_innerRadius / 70.0f; + m_aabbWidth = m_innerRadius / 30.0f;// previous 70.0f + m_axisSize = m_size * 0.05f; + m_textDistance = m_size * 0.05f; + m_innerQuadSize = 0.45f * MCore::Math::Sqrt(2) * m_innerRadius; // set the bounding volumes of the axes selection - mXAxisAABB.SetMax(mPosition + AZ::Vector3(mAABBWidth, mInnerRadius, mInnerRadius)); - mXAxisAABB.SetMin(mPosition - AZ::Vector3(mAABBWidth, mInnerRadius, mInnerRadius)); - mYAxisAABB.SetMax(mPosition + AZ::Vector3(mInnerRadius, mAABBWidth, mInnerRadius)); - mYAxisAABB.SetMin(mPosition - AZ::Vector3(mInnerRadius, mAABBWidth, mInnerRadius)); - mZAxisAABB.SetMax(mPosition + AZ::Vector3(mInnerRadius, mInnerRadius, mAABBWidth)); - mZAxisAABB.SetMin(mPosition - AZ::Vector3(mInnerRadius, mInnerRadius, mAABBWidth)); - mXAxisInnerAABB.SetMax(mPosition + AZ::Vector3(mAABBWidth, mInnerQuadSize, mInnerQuadSize)); - mXAxisInnerAABB.SetMin(mPosition - AZ::Vector3(mAABBWidth, mInnerQuadSize, mInnerQuadSize)); - mYAxisInnerAABB.SetMax(mPosition + AZ::Vector3(mInnerQuadSize, mAABBWidth, mInnerQuadSize)); - mYAxisInnerAABB.SetMin(mPosition - AZ::Vector3(mInnerQuadSize, mAABBWidth, mInnerQuadSize)); - mZAxisInnerAABB.SetMax(mPosition + AZ::Vector3(mInnerQuadSize, mInnerQuadSize, mAABBWidth)); - mZAxisInnerAABB.SetMin(mPosition - AZ::Vector3(mInnerQuadSize, mInnerQuadSize, mAABBWidth)); + m_xAxisAabb.SetMax(m_position + AZ::Vector3(m_aabbWidth, m_innerRadius, m_innerRadius)); + m_xAxisAabb.SetMin(m_position - AZ::Vector3(m_aabbWidth, m_innerRadius, m_innerRadius)); + m_yAxisAabb.SetMax(m_position + AZ::Vector3(m_innerRadius, m_aabbWidth, m_innerRadius)); + m_yAxisAabb.SetMin(m_position - AZ::Vector3(m_innerRadius, m_aabbWidth, m_innerRadius)); + m_zAxisAabb.SetMax(m_position + AZ::Vector3(m_innerRadius, m_innerRadius, m_aabbWidth)); + m_zAxisAabb.SetMin(m_position - AZ::Vector3(m_innerRadius, m_innerRadius, m_aabbWidth)); + m_xAxisInnerAabb.SetMax(m_position + AZ::Vector3(m_aabbWidth, m_innerQuadSize, m_innerQuadSize)); + m_xAxisInnerAabb.SetMin(m_position - AZ::Vector3(m_aabbWidth, m_innerQuadSize, m_innerQuadSize)); + m_yAxisInnerAabb.SetMax(m_position + AZ::Vector3(m_innerQuadSize, m_aabbWidth, m_innerQuadSize)); + m_yAxisInnerAabb.SetMin(m_position - AZ::Vector3(m_innerQuadSize, m_aabbWidth, m_innerQuadSize)); + m_zAxisInnerAabb.SetMax(m_position + AZ::Vector3(m_innerQuadSize, m_innerQuadSize, m_aabbWidth)); + m_zAxisInnerAabb.SetMin(m_position - AZ::Vector3(m_innerQuadSize, m_innerQuadSize, m_aabbWidth)); // set the bounding spheres for inner and outer circle modifiers - mInnerBoundingSphere.SetCenter(mPosition); - mInnerBoundingSphere.SetRadius(mInnerRadius); - mOuterBoundingSphere.SetCenter(mPosition); - mOuterBoundingSphere.SetRadius(mOuterRadius); + m_innerBoundingSphere.SetCenter(m_position); + m_innerBoundingSphere.SetRadius(m_innerRadius); + m_outerBoundingSphere.SetCenter(m_position); + m_outerBoundingSphere.SetRadius(m_outerRadius); } @@ -82,7 +82,7 @@ namespace MCommon MCore::Ray mousePosRay = camera->Unproject(mousePosX, mousePosY); // check if mouse ray hits the outer sphere of the manipulator - if (mousePosRay.Intersects(mOuterBoundingSphere)) + if (mousePosRay.Intersects(m_outerBoundingSphere)) { return true; } @@ -109,14 +109,14 @@ namespace MCommon MCore::Ray camRay = camera->Unproject(screenWidth / 2, screenHeight / 2); AZ::Vector3 camDir = camRay.GetDirection(); - mSignX = (MCore::Math::ACos(camDir.Dot(AZ::Vector3(1.0f, 0.0f, 0.0f))) >= MCore::Math::halfPi) ? 1.0f : -1.0f; - mSignY = (MCore::Math::ACos(camDir.Dot(AZ::Vector3(0.0f, 1.0f, 0.0f))) >= MCore::Math::halfPi) ? 1.0f : -1.0f; - mSignZ = (MCore::Math::ACos(camDir.Dot(AZ::Vector3(0.0f, 0.0f, 1.0f))) >= MCore::Math::halfPi) ? 1.0f : -1.0f; + m_signX = (MCore::Math::ACos(camDir.Dot(AZ::Vector3(1.0f, 0.0f, 0.0f))) >= MCore::Math::halfPi) ? 1.0f : -1.0f; + m_signY = (MCore::Math::ACos(camDir.Dot(AZ::Vector3(0.0f, 1.0f, 0.0f))) >= MCore::Math::halfPi) ? 1.0f : -1.0f; + m_signZ = (MCore::Math::ACos(camDir.Dot(AZ::Vector3(0.0f, 0.0f, 1.0f))) >= MCore::Math::halfPi) ? 1.0f : -1.0f; // determine the axis visibility, to disable movement for invisible axes - mXAxisVisible = (MCore::InRange(MCore::Math::Abs(camDir.Dot(AZ::Vector3(1.0f, 0.0f, 0.0f))) - 1.0f, -MCore::Math::epsilon, MCore::Math::epsilon) == false); - mYAxisVisible = (MCore::InRange(MCore::Math::Abs(camDir.Dot(AZ::Vector3(0.0f, 1.0f, 0.0f))) - 1.0f, -MCore::Math::epsilon, MCore::Math::epsilon) == false); - mZAxisVisible = (MCore::InRange(MCore::Math::Abs(camDir.Dot(AZ::Vector3(0.0f, 0.0f, 1.0f))) - 1.0f, -MCore::Math::epsilon, MCore::Math::epsilon) == false); + m_xAxisVisible = (MCore::InRange(MCore::Math::Abs(camDir.Dot(AZ::Vector3(1.0f, 0.0f, 0.0f))) - 1.0f, -MCore::Math::epsilon, MCore::Math::epsilon) == false); + m_yAxisVisible = (MCore::InRange(MCore::Math::Abs(camDir.Dot(AZ::Vector3(0.0f, 1.0f, 0.0f))) - 1.0f, -MCore::Math::epsilon, MCore::Math::epsilon) == false); + m_zAxisVisible = (MCore::InRange(MCore::Math::Abs(camDir.Dot(AZ::Vector3(0.0f, 0.0f, 1.0f))) - 1.0f, -MCore::Math::epsilon, MCore::Math::epsilon) == false); // update the bounding volumes UpdateBoundingVolumes(); @@ -127,12 +127,12 @@ namespace MCommon void RotateManipulator::Render(MCommon::Camera* camera, RenderUtil* renderUtil) { // return if no render util is set - if (renderUtil == nullptr || camera == nullptr || mIsVisible == false) + if (renderUtil == nullptr || camera == nullptr || m_isVisible == false) { return; } - // set mSize variables for the gizmo + // set m_size variables for the gizmo const uint32 screenWidth = camera->GetScreenWidth(); const uint32 screenHeight = camera->GetScreenHeight(); @@ -143,14 +143,13 @@ namespace MCommon MCore::RGBAColor blueTransparent = MCore::RGBAColor(0.0, 0.0, 0.762f, 0.2f); MCore::RGBAColor greyTransparent = MCore::RGBAColor(0.5f, 0.5f, 0.5f, 0.3f); - MCore::RGBAColor xAxisColor = (mMode == ROTATE_X) ? ManipulatorColors::mSelectionColor : ManipulatorColors::mRed; - MCore::RGBAColor yAxisColor = (mMode == ROTATE_Y) ? ManipulatorColors::mSelectionColor : ManipulatorColors::mGreen; - MCore::RGBAColor zAxisColor = (mMode == ROTATE_Z) ? ManipulatorColors::mSelectionColor : ManipulatorColors::mBlue; - MCore::RGBAColor camRollAxisColor = (mMode == ROTATE_CAMROLL) ? ManipulatorColors::mSelectionColor : grey; - //MCore::RGBAColor camPitchYawColor = (mMode == ROTATE_CAMPITCHYAW) ? ManipulatorColors::mSelectionColor : grey; + MCore::RGBAColor xAxisColor = (m_mode == ROTATE_X) ? ManipulatorColors::s_selectionColor : ManipulatorColors::s_red; + MCore::RGBAColor yAxisColor = (m_mode == ROTATE_Y) ? ManipulatorColors::s_selectionColor : ManipulatorColors::s_green; + MCore::RGBAColor zAxisColor = (m_mode == ROTATE_Z) ? ManipulatorColors::s_selectionColor : ManipulatorColors::s_blue; + MCore::RGBAColor camRollAxisColor = (m_mode == ROTATE_CAMROLL) ? ManipulatorColors::s_selectionColor : grey; // render axis in the center of the rotation gizmo - renderUtil->RenderAxis(mAxisSize, mPosition, AZ::Vector3(1.0f, 0.0f, 0.0f), AZ::Vector3(0.0f, 1.0f, 0.0f), AZ::Vector3(0.0f, 0.0f, 1.0f)); + renderUtil->RenderAxis(m_axisSize, m_position, AZ::Vector3(1.0f, 0.0f, 0.0f), AZ::Vector3(0.0f, 1.0f, 0.0f), AZ::Vector3(0.0f, 0.0f, 1.0f)); // shoot rays to the plane, to get upwards pointing vector on the plane // used for the text positioning and the angle visualization for the view rotation axis @@ -159,7 +158,7 @@ namespace MCommon AZ::Vector3 camRollAxis = originRay.GetDirection(); // calculate the plane perpendicular to the view rotation axis - MCore::PlaneEq rotationPlane(originRay.GetDirection(), mPosition); + MCore::PlaneEq rotationPlane(originRay.GetDirection(), m_position); // get the intersection points of the rays and the plane AZ::Vector3 originRayIntersect, upVecRayIntersect; @@ -177,66 +176,43 @@ namespace MCommon camViewMat.InvertFull(); // set the translation part of the matrix - camViewMat.SetTranslation(mPosition); + camViewMat.SetTranslation(m_position); // render the view axis rotation manipulator const AZ::Transform camViewTransform = AZ::Transform::CreateFromMatrix3x3AndTranslation( AZ::Matrix3x3::CreateFromMatrix4x4(camViewMat), camViewMat.GetTranslation()); - renderUtil->RenderCircle(camViewTransform, mOuterRadius, 64, camRollAxisColor); - renderUtil->RenderCircle(camViewTransform, mInnerRadius, 64, grey); + renderUtil->RenderCircle(camViewTransform, m_outerRadius, 64, camRollAxisColor); + renderUtil->RenderCircle(camViewTransform, m_innerRadius, 64, grey); - if (mMode == ROTATE_CAMPITCHYAW) + if (m_mode == ROTATE_CAMPITCHYAW) { - renderUtil->RenderCircle(camViewTransform, mInnerRadius, 64, grey, 0.0f, MCore::Math::twoPi, true, greyTransparent); + renderUtil->RenderCircle(camViewTransform, m_innerRadius, 64, grey, 0.0f, MCore::Math::twoPi, true, greyTransparent); } - // handle the rotation around the camera roll axis - /* - if (mMode == ROTATE_CAMROLL) - { - // calculate angle of the click position to the reference directions - const float angleUp = Math::ACos( mClickPosition.Dot(upVector) ); - const float angleLeft = Math::ACos( mClickPosition.Dot(leftVector) ); - - // rotate the whole circle around pi, if rotation is in the negative direction - if (mRotation.Dot(mRotationAxis) < 0) - camViewMat = camViewMat * camViewMat.RotationMatrixAxisAngle( upVector, Math::pi ); - - // handle different dot product results (necessary because dot product only handles a range of [0, pi]) - if (angleLeft > Math::halfPi) - camViewMat = camViewMat * camViewMat.RotationMatrixAxisAngle( mRotationAxis, -angleUp ); - else - camViewMat = camViewMat * camViewMat.RotationMatrixAxisAngle( mRotationAxis, angleUp ); - - // render the rotated circle segment to represent the current rotation angle around the view axis - renderUtil->RenderCircle( camViewMat, mOuterRadius, 64, ManipulatorColors::mSelectionColor, 0.0f, mRotation.Length(), true, greyTransparent ); - } - */ - // calculate the signs of the rotation and the angle between the axes and the click position - const float signX = (mRotation.GetX() >= 0) ? 1.0f : -1.0f; - const float signY = (mRotation.GetY() >= 0) ? 1.0f : -1.0f; - const float signZ = (mRotation.GetZ() >= 0) ? 1.0f : -1.0f; - const float angleX = MCore::Math::ACos(mClickPosition.Dot(AZ::Vector3(1.0f, 0.0f, 0.0f))); - const float angleY = MCore::Math::ACos(mClickPosition.Dot(AZ::Vector3(0.0f, 1.0f, 0.0f))); - const float angleZ = MCore::Math::ACos(mClickPosition.Dot(AZ::Vector3(0.0f, 0.0f, 1.0f))); + const float signX = (m_rotation.GetX() >= 0) ? 1.0f : -1.0f; + const float signY = (m_rotation.GetY() >= 0) ? 1.0f : -1.0f; + const float signZ = (m_rotation.GetZ() >= 0) ? 1.0f : -1.0f; + const float angleX = MCore::Math::ACos(m_clickPosition.Dot(AZ::Vector3(1.0f, 0.0f, 0.0f))); + const float angleY = MCore::Math::ACos(m_clickPosition.Dot(AZ::Vector3(0.0f, 1.0f, 0.0f))); + const float angleZ = MCore::Math::ACos(m_clickPosition.Dot(AZ::Vector3(0.0f, 0.0f, 1.0f))); // transformation matrix for the circle for rotation around the x axis AZ::Transform rotMatrixX = MCore::GetRotationMatrixAxisAngle(AZ::Vector3(0.0f, 1.0f, 0.0f), signX * MCore::Math::halfPi); // set the translation part of the matrix - rotMatrixX.SetTranslation(mPosition); + rotMatrixX.SetTranslation(m_position); // render the circle for the rotation around the x axis - if (mMode == ROTATE_X) + if (m_mode == ROTATE_X) { - renderUtil->RenderCircle(rotMatrixX, mInnerRadius, 64, grey); + renderUtil->RenderCircle(rotMatrixX, m_innerRadius, 64, grey); } - renderUtil->RenderCircle(rotMatrixX, mInnerRadius, 64, xAxisColor, 0.0f, MCore::Math::twoPi, false, MCore::RGBAColor(), true, camRollAxis); + renderUtil->RenderCircle(rotMatrixX, m_innerRadius, 64, xAxisColor, 0.0f, MCore::Math::twoPi, false, MCore::RGBAColor(), true, camRollAxis); // draw current angle if in x rotation mode - if (mMode == ROTATE_X) + if (m_mode == ROTATE_X) { // handle different dot product results (necessary because dot product only handles a range of [0, pi]) if (angleZ > MCore::Math::halfPi) @@ -249,28 +225,28 @@ namespace MCommon } // set the translation part of the matrix - rotMatrixX.SetTranslation(mPosition); + rotMatrixX.SetTranslation(m_position); // render the rotated circle segment to represent the current rotation angle around the x axis - renderUtil->RenderCircle(rotMatrixX, mInnerRadius, 64, ManipulatorColors::mSelectionColor, 0.0f, MCore::Math::Abs(mRotation.GetX()), true, redTransparent, true, camRollAxis); + renderUtil->RenderCircle(rotMatrixX, m_innerRadius, 64, ManipulatorColors::s_selectionColor, 0.0f, MCore::Math::Abs(m_rotation.GetX()), true, redTransparent, true, camRollAxis); } // rotation matrix for rotation around the y axis AZ::Transform rotMatrixY = MCore::GetRotationMatrixAxisAngle(AZ::Vector3(1.0f, 0.0f, 0.0f), MCore::Math::halfPi); // set the translation part of the matrix - rotMatrixY.SetTranslation(mPosition); + rotMatrixY.SetTranslation(m_position); // render the circle for rotation around the y axis - if (mMode == ROTATE_Y) + if (m_mode == ROTATE_Y) { - renderUtil->RenderCircle(rotMatrixY, mInnerRadius, 64, grey); + renderUtil->RenderCircle(rotMatrixY, m_innerRadius, 64, grey); } - renderUtil->RenderCircle(rotMatrixY, mInnerRadius, 64, yAxisColor, 0.0f, MCore::Math::twoPi, false, MCore::RGBAColor(), true, camRollAxis); + renderUtil->RenderCircle(rotMatrixY, m_innerRadius, 64, yAxisColor, 0.0f, MCore::Math::twoPi, false, MCore::RGBAColor(), true, camRollAxis); // draw current angle if in y rotation mode - if (mMode == ROTATE_Y) + if (m_mode == ROTATE_Y) { // render current rotation angle depending on the dot product results calculated above if (signY > 0) @@ -293,28 +269,28 @@ namespace MCommon } // set the translation part of the matrix - rotMatrixY.SetTranslation(mPosition); + rotMatrixY.SetTranslation(m_position); // render the rotated circle segment to represent the current rotation angle around the y axis - renderUtil->RenderCircle(rotMatrixY, mInnerRadius, 64, ManipulatorColors::mSelectionColor, 0.0f, MCore::Math::Abs(mRotation.GetY()), true, greenTransparent, true, camRollAxis); + renderUtil->RenderCircle(rotMatrixY, m_innerRadius, 64, ManipulatorColors::s_selectionColor, 0.0f, MCore::Math::Abs(m_rotation.GetY()), true, greenTransparent, true, camRollAxis); } // the circle for rotation around the z axis AZ::Transform rotMatrixZ = AZ::Transform::CreateIdentity(); // set the translation part of the matrix - rotMatrixZ.SetTranslation(mPosition); + rotMatrixZ.SetTranslation(m_position); // render the circle for rotation around the z axis - if (mMode == ROTATE_Z) + if (m_mode == ROTATE_Z) { - renderUtil->RenderCircle(rotMatrixZ, mInnerRadius, 64, grey); + renderUtil->RenderCircle(rotMatrixZ, m_innerRadius, 64, grey); } - renderUtil->RenderCircle(rotMatrixZ, mInnerRadius, 64, zAxisColor, 0.0f, MCore::Math::twoPi, false, MCore::RGBAColor(), true, camRollAxis); + renderUtil->RenderCircle(rotMatrixZ, m_innerRadius, 64, zAxisColor, 0.0f, MCore::Math::twoPi, false, MCore::RGBAColor(), true, camRollAxis); // draw current angle if in z rotation mode - if (mMode == ROTATE_Z) + if (m_mode == ROTATE_Z) { // render current rotation angle depending on the dot product results calculated above if (signZ < 0.0f) @@ -337,56 +313,56 @@ namespace MCommon } // set the translation part of the matrix - rotMatrixZ.SetTranslation(mPosition); + rotMatrixZ.SetTranslation(m_position); // render the rotated circle segment to represent the current rotation angle around the z axis - renderUtil->RenderCircle(rotMatrixZ, mInnerRadius, 64, ManipulatorColors::mSelectionColor, 0.0f, MCore::Math::Abs(mRotation.GetZ()), true, blueTransparent, true, camRollAxis); + renderUtil->RenderCircle(rotMatrixZ, m_innerRadius, 64, ManipulatorColors::s_selectionColor, 0.0f, MCore::Math::Abs(m_rotation.GetZ()), true, blueTransparent, true, camRollAxis); } // break if in different projection mode and camera roll rotation mode - if (mCurrentProjectionMode != camera->GetProjectionMode() && mMode == ROTATE_CAMROLL) + if (m_currentProjectionMode != camera->GetProjectionMode() && m_mode == ROTATE_CAMROLL) { return; } // render the absolute rotation if gizmo is hit - if (mMode != ROTATE_NONE) + if (m_mode != ROTATE_NONE) { - const AZ::Vector3 currRot = MCore::AzQuaternionToEulerAngles(mCallback->GetCurrValueQuat()); - mTempString = AZStd::string::format("Abs. Rotation X: %.3f, Y: %.3f, Z: %.3f", MCore::Math::RadiansToDegrees(currRot.GetX() + MCore::Math::epsilon), MCore::Math::RadiansToDegrees(currRot.GetY() + MCore::Math::epsilon), MCore::Math::RadiansToDegrees(currRot.GetZ() + MCore::Math::epsilon)); - renderUtil->RenderText(10, 10, mTempString.c_str(), ManipulatorColors::mSelectionColor, 9.0f); + const AZ::Vector3 currRot = MCore::AzQuaternionToEulerAngles(m_callback->GetCurrValueQuat()); + m_tempString = AZStd::string::format("Abs. Rotation X: %.3f, Y: %.3f, Z: %.3f", MCore::Math::RadiansToDegrees(currRot.GetX() + MCore::Math::epsilon), MCore::Math::RadiansToDegrees(currRot.GetY() + MCore::Math::epsilon), MCore::Math::RadiansToDegrees(currRot.GetZ() + MCore::Math::epsilon)); + renderUtil->RenderText(10, 10, m_tempString.c_str(), ManipulatorColors::s_selectionColor, 9.0f); } // if the rotation has been changed draw the current direction of the rotation - if (mRotation.GetLength() > 0.0f) + if (m_rotation.GetLength() > 0.0f) { // render text with the rotation values of the axes - float radius = (mMode == ROTATE_CAMROLL) ? mOuterRadius : mInnerRadius; - mTempString = AZStd::string::format("[%.2f, %.2f, %.2f]", MCore::Math::RadiansToDegrees(mRotation.GetX()), MCore::Math::RadiansToDegrees(mRotation.GetY()), MCore::Math::RadiansToDegrees(mRotation.GetZ())); + float radius = (m_mode == ROTATE_CAMROLL) ? m_outerRadius : m_innerRadius; + m_tempString = AZStd::string::format("[%.2f, %.2f, %.2f]", MCore::Math::RadiansToDegrees(m_rotation.GetX()), MCore::Math::RadiansToDegrees(m_rotation.GetY()), MCore::Math::RadiansToDegrees(m_rotation.GetZ())); //String rotationValues = String() = AZStd::string::format("[%.2f, %.2f, %.2f]", camera->GetPosition().x, camera->GetPosition().y, camera->GetPosition().z); - AZ::Vector3 textPosition = MCore::Project(mPosition + (upVector * (mOuterRadius + mTextDistance)), camera->GetViewProjMatrix(), screenWidth, screenHeight); - renderUtil->RenderText(textPosition.GetX() - 2.9f * mTempString.size(), textPosition.GetY(), mTempString.c_str(), ManipulatorColors::mSelectionColor); + AZ::Vector3 textPosition = MCore::Project(m_position + (upVector * (m_outerRadius + m_textDistance)), camera->GetViewProjMatrix(), screenWidth, screenHeight); + renderUtil->RenderText(textPosition.GetX() - 2.9f * m_tempString.size(), textPosition.GetY(), m_tempString.c_str(), ManipulatorColors::s_selectionColor); // mark the click position with a small cube - AZ::Vector3 clickPosition = mPosition + mClickPosition * radius; + AZ::Vector3 clickPosition = m_position + m_clickPosition * radius; // calculate the tangent at the click position - MCore::RGBAColor rotDirColorNegative = (mRotation.Dot(mRotationAxis) > 0.0f) ? ManipulatorColors::mSelectionColor : grey; - MCore::RGBAColor rotDirColorPositive = (mRotation.Dot(mRotationAxis) < 0.0f) ? ManipulatorColors::mSelectionColor : grey; + MCore::RGBAColor rotDirColorNegative = (m_rotation.Dot(m_rotationAxis) > 0.0f) ? ManipulatorColors::s_selectionColor : grey; + MCore::RGBAColor rotDirColorPositive = (m_rotation.Dot(m_rotationAxis) < 0.0f) ? ManipulatorColors::s_selectionColor : grey; // render the tangent directions at the click positions - AZ::Vector3 tangent = mRotationAxis.Cross(mClickPosition).GetNormalized(); - renderUtil->RenderLine(clickPosition, clickPosition + 1.5f * mAxisSize * tangent, rotDirColorPositive); - renderUtil->RenderLine(clickPosition, clickPosition - 1.5f * mAxisSize * tangent, rotDirColorNegative); - renderUtil->RenderCylinder(2.0f * mArrowBaseRadius, 0.0f, 0.5f * mAxisSize, clickPosition + 1.5f * mAxisSize * tangent, tangent, rotDirColorPositive); - renderUtil->RenderCylinder(2.0f * mArrowBaseRadius, 0.0f, 0.5f * mAxisSize, clickPosition - 1.5f * mAxisSize * tangent, -tangent, rotDirColorNegative); + AZ::Vector3 tangent = m_rotationAxis.Cross(m_clickPosition).GetNormalized(); + renderUtil->RenderLine(clickPosition, clickPosition + 1.5f * m_axisSize * tangent, rotDirColorPositive); + renderUtil->RenderLine(clickPosition, clickPosition - 1.5f * m_axisSize * tangent, rotDirColorNegative); + renderUtil->RenderCylinder(2.0f * m_arrowBaseRadius, 0.0f, 0.5f * m_axisSize, clickPosition + 1.5f * m_axisSize * tangent, tangent, rotDirColorPositive); + renderUtil->RenderCylinder(2.0f * m_arrowBaseRadius, 0.0f, 0.5f * m_axisSize, clickPosition - 1.5f * m_axisSize * tangent, -tangent, rotDirColorNegative); } else { - if (mName.size() > 0) + if (m_name.size() > 0) { - AZ::Vector3 textPosition = MCore::Project(mPosition + (upVector * (mOuterRadius + mTextDistance)), camera->GetViewProjMatrix(), screenWidth, screenHeight); - renderUtil->RenderText(textPosition.GetX(), textPosition.GetY(), mName.c_str(), ManipulatorColors::mSelectionColor, 11.0f, true); + AZ::Vector3 textPosition = MCore::Project(m_position + (upVector * (m_outerRadius + m_textDistance)), camera->GetViewProjMatrix(), screenWidth, screenHeight); + renderUtil->RenderText(textPosition.GetX(), textPosition.GetY(), m_name.c_str(), ManipulatorColors::s_selectionColor, 11.0f, true); } } } @@ -399,7 +375,7 @@ namespace MCommon MCORE_UNUSED(middleButtonPressed); // check if camera has been set - if (camera == nullptr || mIsVisible == false || (leftButtonPressed && rightButtonPressed)) + if (camera == nullptr || m_isVisible == false || (leftButtonPressed && rightButtonPressed)) { return; } @@ -407,7 +383,7 @@ namespace MCommon // update the axis visibility flags UpdateAxisDirections(camera); - // get screen mSize + // get screen m_size uint32 screenWidth = camera->GetScreenWidth(); uint32 screenHeight = camera->GetScreenHeight(); @@ -416,15 +392,15 @@ namespace MCommon //MCore::Ray mousePrevPosRay = camera->Unproject( mousePosX-mouseMovementX, mousePosY-mouseMovementY ); MCore::Ray camRollRay = camera->Unproject(screenWidth / 2, screenHeight / 2); AZ::Vector3 camRollAxis = camRollRay.GetDirection(); - mRotationQuat = AZ::Quaternion::CreateIdentity(); + m_rotationQuat = AZ::Quaternion::CreateIdentity(); // check for the selected axis/plane - if (mSelectionLocked == false || mMode == ROTATE_NONE) + if (m_selectionLocked == false || m_mode == ROTATE_NONE) { // update old rotation of the callback - if (mCallback) + if (m_callback) { - mCallback->UpdateOldValues(); + m_callback->UpdateOldValues(); } // the intersection variables @@ -432,88 +408,88 @@ namespace MCommon // set rotation mode to rotation around the x axis, if the following intersection conditions are fulfilled // innerAABB not hit, outerAABB hit, innerBoundingSphere hit and angle between cameraRollAxis and clickPosition > pi/2 - if ((mousePosRay.Intersects(mXAxisInnerAABB) == false || - (camera->GetProjectionMode() == MCommon::Camera::PROJMODE_ORTHOGRAPHIC && mXAxisVisible)) && - mousePosRay.Intersects(mXAxisAABB, &intersectA, &intersectB) && - mousePosRay.Intersects(mInnerBoundingSphere) && - MCore::Math::ACos(camRollAxis.Dot((intersectA - mPosition).GetNormalized())) > MCore::Math::halfPi) + if ((mousePosRay.Intersects(m_xAxisInnerAabb) == false || + (camera->GetProjectionMode() == MCommon::Camera::PROJMODE_ORTHOGRAPHIC && m_xAxisVisible)) && + mousePosRay.Intersects(m_xAxisAabb, &intersectA, &intersectB) && + mousePosRay.Intersects(m_innerBoundingSphere) && + MCore::Math::ACos(camRollAxis.Dot((intersectA - m_position).GetNormalized())) > MCore::Math::halfPi) { - mMode = ROTATE_X; - mRotationAxis = AZ::Vector3(1.0f, 0.0f, 0.0f); - mClickPosition = (intersectA - mPosition).GetNormalized(); - mClickPosition.SetX(0.0f); + m_mode = ROTATE_X; + m_rotationAxis = AZ::Vector3(1.0f, 0.0f, 0.0f); + m_clickPosition = (intersectA - m_position).GetNormalized(); + m_clickPosition.SetX(0.0f); } // set rotation mode to rotation around the y axis, if the following intersection conditions are fulfilled // innerAABB not hit, outerAABB hit, innerBoundingSphere hit and angle between cameraRollAxis and clickPosition > pi/2 - else if ((mousePosRay.Intersects(mYAxisInnerAABB) == false || - (camera->GetProjectionMode() == MCommon::Camera::PROJMODE_ORTHOGRAPHIC && mYAxisVisible)) && - mousePosRay.Intersects(mYAxisAABB, &intersectA, &intersectB) && mousePosRay.Intersects(mInnerBoundingSphere) && - MCore::Math::ACos(camRollAxis.Dot((intersectA - mPosition).GetNormalized())) > MCore::Math::halfPi) + else if ((mousePosRay.Intersects(m_yAxisInnerAabb) == false || + (camera->GetProjectionMode() == MCommon::Camera::PROJMODE_ORTHOGRAPHIC && m_yAxisVisible)) && + mousePosRay.Intersects(m_yAxisAabb, &intersectA, &intersectB) && mousePosRay.Intersects(m_innerBoundingSphere) && + MCore::Math::ACos(camRollAxis.Dot((intersectA - m_position).GetNormalized())) > MCore::Math::halfPi) { - mMode = ROTATE_Y; - mRotationAxis = AZ::Vector3(0.0f, 1.0f, 0.0f); - mClickPosition = (intersectA - mPosition).GetNormalized(); - mClickPosition.SetY(0.0f); + m_mode = ROTATE_Y; + m_rotationAxis = AZ::Vector3(0.0f, 1.0f, 0.0f); + m_clickPosition = (intersectA - m_position).GetNormalized(); + m_clickPosition.SetY(0.0f); } // set rotation mode to rotation around the z axis, if the following intersection conditions are fulfilled // innerAABB not hit, outerAABB hit, innerBoundingSphere hit and angle between cameraRollAxis and clickPosition > pi/2 - else if ((mousePosRay.Intersects(mZAxisInnerAABB) == false || - (camera->GetProjectionMode() == MCommon::Camera::PROJMODE_ORTHOGRAPHIC && mZAxisVisible)) && - mousePosRay.Intersects(mZAxisAABB, &intersectA, &intersectB) && mousePosRay.Intersects(mInnerBoundingSphere) && - MCore::Math::ACos(camRollAxis.Dot((intersectA - mPosition).GetNormalized())) > MCore::Math::halfPi) + else if ((mousePosRay.Intersects(m_zAxisInnerAabb) == false || + (camera->GetProjectionMode() == MCommon::Camera::PROJMODE_ORTHOGRAPHIC && m_zAxisVisible)) && + mousePosRay.Intersects(m_zAxisAabb, &intersectA, &intersectB) && mousePosRay.Intersects(m_innerBoundingSphere) && + MCore::Math::ACos(camRollAxis.Dot((intersectA - m_position).GetNormalized())) > MCore::Math::halfPi) { - mMode = ROTATE_Z; - mRotationAxis = AZ::Vector3(0.0f, 0.0f, 1.0f); - mClickPosition = (intersectA - mPosition).GetNormalized(); - mClickPosition.SetZ(0.0f); + m_mode = ROTATE_Z; + m_rotationAxis = AZ::Vector3(0.0f, 0.0f, 1.0f); + m_clickPosition = (intersectA - m_position).GetNormalized(); + m_clickPosition.SetZ(0.0f); } // set rotation mode to rotation around the pitch and yaw axis of the camera, // if the inner sphere is hit and none of the previous conditions was fulfilled - else if (mousePosRay.Intersects(mInnerBoundingSphere, &intersectA, &intersectB)) + else if (mousePosRay.Intersects(m_innerBoundingSphere, &intersectA, &intersectB)) { - mMode = ROTATE_CAMPITCHYAW; + m_mode = ROTATE_CAMPITCHYAW; // set the rotation axis to zero, because no single axis exists in this mode - mRotationAxis = AZ::Vector3::CreateZero(); + m_rotationAxis = AZ::Vector3::CreateZero(); // project the click position onto the plane which is perpendicular to the rotation direction - MCore::PlaneEq rotationPlane(camRollAxis, mPosition); - mClickPosition = (rotationPlane.Project(intersectA - mPosition)).GetNormalized(); + MCore::PlaneEq rotationPlane(camRollAxis, m_position); + m_clickPosition = (rotationPlane.Project(intersectA - m_position)).GetNormalized(); } // set rotation mode to rotation around the roll axis of the camera, // if the outer sphere is hit and none of the previous conditions was fulfilled - else if (mousePosRay.Intersects(mOuterBoundingSphere, &intersectA, &intersectB)) + else if (mousePosRay.Intersects(m_outerBoundingSphere, &intersectA, &intersectB)) { // set rotation mode to rotate around the view axis - mMode = ROTATE_CAMROLL; + m_mode = ROTATE_CAMROLL; // set the rotation axis to the look at ray direction - mRotationAxis = camRollRay.GetDirection(); + m_rotationAxis = camRollRay.GetDirection(); // project the click position onto the plane which is perpendicular to the rotation direction - MCore::PlaneEq rotationPlane(mRotationAxis, AZ::Vector3::CreateZero()); - mClickPosition = (rotationPlane.Project(intersectA - mPosition)).GetNormalized(); + MCore::PlaneEq rotationPlane(m_rotationAxis, AZ::Vector3::CreateZero()); + m_clickPosition = (rotationPlane.Project(intersectA - m_position)).GetNormalized(); } // no bounding volume is currently hit, therefore do not rotate else { - mMode = ROTATE_NONE; + m_mode = ROTATE_NONE; } } // set selection lock and current projection mode - mSelectionLocked = leftButtonPressed; - mCurrentProjectionMode = camera->GetProjectionMode(); + m_selectionLocked = leftButtonPressed; + m_currentProjectionMode = camera->GetProjectionMode(); // reset the gizmo if no rotation mode is selected - if (mSelectionLocked == false || mMode == ROTATE_NONE) + if (m_selectionLocked == false || m_mode == ROTATE_NONE) { - mRotation = AZ::Vector3::CreateZero(); + m_rotation = AZ::Vector3::CreateZero(); return; } @@ -527,13 +503,13 @@ namespace MCommon } // set the rotation depending on the rotation mode - if (mMode == ROTATE_CAMPITCHYAW) + if (m_mode == ROTATE_CAMPITCHYAW) { // the yaw axis of the camera view MCore::Ray camYawRay = camera->Unproject(screenWidth / 2, screenHeight / 2 - 10); // calculate the plane perpendicular to the view rotation axis - MCore::PlaneEq rotationPlane(camRollAxis, mPosition); + MCore::PlaneEq rotationPlane(camRollAxis, m_position); // get the intersection points of the rays and the plane AZ::Vector3 originRayIntersect, upVecRayIntersect; @@ -548,69 +524,46 @@ namespace MCommon // calculate the projected axes, used to determine the angle between click position // and the axes. This allows weighting the angles by the movement direction. - AZ::Vector3 projectedCenter = MCore::Project(mPosition, camera->GetViewProjMatrix(), screenWidth, screenHeight); - AZ::Vector3 projectedClickPosYaw = MCore::Project(mPosition - leftVector, camera->GetViewProjMatrix(), screenWidth, screenHeight); - AZ::Vector3 projectedClickPosPitch = MCore::Project(mPosition - upVector, camera->GetViewProjMatrix(), screenWidth, screenHeight); + AZ::Vector3 projectedCenter = MCore::Project(m_position, camera->GetViewProjMatrix(), screenWidth, screenHeight); + AZ::Vector3 projectedClickPosYaw = MCore::Project(m_position - leftVector, camera->GetViewProjMatrix(), screenWidth, screenHeight); + AZ::Vector3 projectedClickPosPitch = MCore::Project(m_position - upVector, camera->GetViewProjMatrix(), screenWidth, screenHeight); AZ::Vector3 projDirClickPosYaw = (projectedClickPosYaw - projectedCenter).GetNormalized(); AZ::Vector3 projDirClickPosPitch = (projectedClickPosPitch - projectedCenter).GetNormalized(); // calculate the angle between mouse movement and projected rotation axis - float angleYaw = projDirClickPosYaw.Dot(mouseMovementV3) * mScalingFactor * movementLength * 0.00005f; - float anglePitch = projDirClickPosPitch.Dot(mouseMovementV3) * mScalingFactor * movementLength * 0.00005f; + float angleYaw = projDirClickPosYaw.Dot(mouseMovementV3) * m_scalingFactor * movementLength * 0.00005f; + float anglePitch = projDirClickPosPitch.Dot(mouseMovementV3) * m_scalingFactor * movementLength * 0.00005f; // perform rotation arround the cam yaw and pitch axis AZ::Quaternion rotation = MCore::CreateFromAxisAndAngle(upVector, -angleYaw); rotation = rotation * MCore::CreateFromAxisAndAngle(leftVector, anglePitch); // set euler angles of the rotation variable - mRotation += MCore::AzQuaternionToEulerAngles(rotation); - mRotationQuat = rotation; + m_rotation += MCore::AzQuaternionToEulerAngles(rotation); + m_rotationQuat = rotation; } else { - /* - // HINT: uncommented stuff is the exact rotation, used in maya - // generate current translation plane and calculate mouse intersections - MCore::PlaneEq movementPlane( mRotationAxis, mPosition ); - Vector3 mousePosIntersect, mousePrevPosIntersect; - mousePosRay.Intersects( movementPlane, &mousePosIntersect ); - mousePrevPosRay.Intersects( movementPlane, &mousePrevPosIntersect ); - - // normalize the intersection points, as only the angle between them is needed - mousePosIntersect = (mousePosIntersect - mPosition).Normalize(); - mousePrevPosIntersect = (mousePrevPosIntersect - mPosition).Normalize(); - - // distance of the mouse intersections is the actual movement on the plane - float angleSign = MCore::Sgn((mRotationAxis.Cross(mousePosIntersect-mousePrevPosIntersect)).Dot(mousePosIntersect)); - float angle = MCore::Math::ACos( (mousePrevPosIntersect).Dot((mousePosIntersect)) ) * angleSign; - - mRotation += mRotationAxis * angle; - mRotation = Vector3( MCore::Clamp(mRotation.x, -Math::twoPi, Math::twoPi), MCore::Clamp(mRotation.y, -Math::twoPi, Math::twoPi), MCore::Clamp(mRotation.z, -Math::twoPi, Math::twoPi) ); - mRotationQuat = Quaternion( mRotationAxis, MCore::Clamp(-angle, -Math::twoPi, Math::twoPi) ); - */ // calculate the projected center and click position to determine the rotation angle - AZ::Vector3 tangent = (mRotationAxis.Cross(mClickPosition)).GetNormalized(); - AZ::Vector3 projectedCenter = MCore::Project(mPosition, camera->GetViewProjMatrix(), screenWidth, screenHeight); - AZ::Vector3 projectedClickPos = MCore::Project(mPosition - tangent, camera->GetViewProjMatrix(), screenWidth, screenHeight); + AZ::Vector3 tangent = (m_rotationAxis.Cross(m_clickPosition)).GetNormalized(); + AZ::Vector3 projectedCenter = MCore::Project(m_position, camera->GetViewProjMatrix(), screenWidth, screenHeight); + AZ::Vector3 projectedClickPos = MCore::Project(m_position - tangent, camera->GetViewProjMatrix(), screenWidth, screenHeight); AZ::Vector3 projDirClickPos = (projectedClickPos - projectedCenter); - // calculate the angle between mouse movement and projected rotation axis - //float angle = Math::DegreesToRadians(Math::Floor(Math::RadiansToDegrees((projDirClickPos.Dot( mouseMovementV3 ) * mScalingFactor * 0.00002f) * movementLength))); float angle = MCore::Math::DegreesToRadians(MCore::Sgn(projDirClickPos.Dot(mouseMovementV3)) * 0.2f * MCore::Math::Floor(movementLength + 0.5f)); // adjust rotation - mRotation += mRotationAxis * angle; - //mRotation = Vector3( MCore::Clamp(mRotation.x, -Math::twoPi, Math::twoPi), MCore::Clamp(mRotation.y, -Math::twoPi, Math::twoPi), MCore::Clamp(mRotation.z, -Math::twoPi, Math::twoPi) ); - mRotationQuat = AZ::Quaternion::CreateFromAxisAngle(mRotationAxis, MCore::Math::FMod(-angle, MCore::Math::twoPi)); - mRotationQuat.Normalize(); + m_rotation += m_rotationAxis * angle; + m_rotationQuat = AZ::Quaternion::CreateFromAxisAngle(m_rotationAxis, MCore::Math::FMod(-angle, MCore::Math::twoPi)); + m_rotationQuat.Normalize(); } // update the callback - if (mCallback) + if (m_callback) { - const AZ::Quaternion curRot = mCallback->GetCurrValueQuat(); - const AZ::Quaternion newRot = (curRot * mRotationQuat).GetNormalized(); - mCallback->Update(newRot); + const AZ::Quaternion curRot = m_callback->GetCurrValueQuat(); + const AZ::Quaternion newRot = (curRot * m_rotationQuat).GetNormalized(); + m_callback->Update(newRot); } } } // namespace MCommon diff --git a/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/RotateManipulator.h b/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/RotateManipulator.h index 5443bad219..4a664b1526 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/RotateManipulator.h +++ b/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/RotateManipulator.h @@ -88,40 +88,40 @@ namespace MCommon void ProcessMouseInput(MCommon::Camera* camera, int32 mousePosX, int32 mousePosY, int32 mouseMovementX, int32 mouseMovementY, bool leftButtonPressed, bool middleButtonPressed, bool rightButtonPressed, uint32 keyboardKeyFlags = 0); protected: - AZ::Vector3 mRotation; - AZ::Quaternion mRotationQuat; - AZ::Vector3 mRotationAxis; - AZ::Vector3 mClickPosition; + AZ::Vector3 m_rotation; + AZ::Quaternion m_rotationQuat; + AZ::Vector3 m_rotationAxis; + AZ::Vector3 m_clickPosition; // bounding volumes for the axes - MCore::BoundingSphere mInnerBoundingSphere; - MCore::BoundingSphere mOuterBoundingSphere; - MCore::AABB mXAxisAABB; - MCore::AABB mYAxisAABB; - MCore::AABB mZAxisAABB; - MCore::AABB mXAxisInnerAABB; - MCore::AABB mYAxisInnerAABB; - MCore::AABB mZAxisInnerAABB; + MCore::BoundingSphere m_innerBoundingSphere; + MCore::BoundingSphere m_outerBoundingSphere; + MCore::AABB m_xAxisAabb; + MCore::AABB m_yAxisAabb; + MCore::AABB m_zAxisAabb; + MCore::AABB m_xAxisInnerAabb; + MCore::AABB m_yAxisInnerAabb; + MCore::AABB m_zAxisInnerAabb; // the proportions of the rotation manipulator - float mSize; - float mInnerRadius; - float mOuterRadius; - float mArrowBaseRadius; - float mAABBWidth; - float mAxisSize; - float mTextDistance; - float mInnerQuadSize; + float m_size; + float m_innerRadius; + float m_outerRadius; + float m_arrowBaseRadius; + float m_aabbWidth; + float m_axisSize; + float m_textDistance; + float m_innerQuadSize; // orientation information - float mSignX; - float mSignY; - float mSignZ; - bool mXAxisVisible; - bool mYAxisVisible; - bool mZAxisVisible; + float m_signX; + float m_signY; + float m_signZ; + bool m_xAxisVisible; + bool m_yAxisVisible; + bool m_zAxisVisible; // store the projection mode of the current render widget - MCommon::Camera::ProjectionMode mCurrentProjectionMode; + MCommon::Camera::ProjectionMode m_currentProjectionMode; }; } // namespace MCommon diff --git a/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/ScaleManipulator.cpp b/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/ScaleManipulator.cpp index 65915aec65..a1bb69110d 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/ScaleManipulator.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/ScaleManipulator.cpp @@ -16,12 +16,12 @@ namespace MCommon : TransformationManipulator(scalingFactor, isVisible) { // set the initial values - mMode = SCALE_NONE; - mSelectionLocked = false; - mCallback = nullptr; - mPosition = AZ::Vector3::CreateZero(); - mScaleDirection = AZ::Vector3::CreateZero(); - mScale = AZ::Vector3::CreateZero(); + m_mode = SCALE_NONE; + m_selectionLocked = false; + m_callback = nullptr; + m_position = AZ::Vector3::CreateZero(); + m_scaleDirection = AZ::Vector3::CreateZero(); + m_scale = AZ::Vector3::CreateZero(); } @@ -40,35 +40,35 @@ namespace MCommon UpdateAxisDirections(camera); } - mSize = mScalingFactor; - mScaledSize = AZ::Vector3(mSize, mSize, mSize) + AZ::Vector3(MCore::Max(float(mScale.GetX()), -mSize), MCore::Max(float(mScale.GetY()), -mSize), MCore::Max(float(mScale.GetZ()), -mSize)); - mDiagScale = 0.5f; - mArrowLength = mSize / 10.0f; - mBaseRadius = mSize / 15.0f; + m_size = m_scalingFactor; + m_scaledSize = AZ::Vector3(m_size, m_size, m_size) + AZ::Vector3(MCore::Max(float(m_scale.GetX()), -m_size), MCore::Max(float(m_scale.GetY()), -m_size), MCore::Max(float(m_scale.GetZ()), -m_size)); + m_diagScale = 0.5f; + m_arrowLength = m_size / 10.0f; + m_baseRadius = m_size / 15.0f; // positions for the plane selectors - mFirstPlaneSelectorPos = mScaledSize * 0.3f; - mSecPlaneSelectorPos = mScaledSize * 0.6f; + m_firstPlaneSelectorPos = m_scaledSize * 0.3f; + m_secPlaneSelectorPos = m_scaledSize * 0.6f; // set the bounding volumes of the axes selection - mXAxisAABB.SetMax(mPosition + mSignX * AZ::Vector3(mScaledSize.GetX() + mArrowLength, mBaseRadius, mBaseRadius)); - mXAxisAABB.SetMin(mPosition - mSignX * AZ::Vector3(mBaseRadius, mBaseRadius, mBaseRadius)); - mYAxisAABB.SetMax(mPosition + mSignY * AZ::Vector3(mBaseRadius, mScaledSize.GetY() + mArrowLength, mBaseRadius)); - mYAxisAABB.SetMin(mPosition - mSignY * AZ::Vector3(mBaseRadius, mBaseRadius, mBaseRadius)); - mZAxisAABB.SetMax(mPosition + mSignZ * AZ::Vector3(mBaseRadius, mBaseRadius, mScaledSize.GetZ() + mArrowLength)); - mZAxisAABB.SetMin(mPosition - mSignZ * AZ::Vector3(mBaseRadius, mBaseRadius, mBaseRadius)); + m_xAxisAabb.SetMax(m_position + m_signX * AZ::Vector3(m_scaledSize.GetX() + m_arrowLength, m_baseRadius, m_baseRadius)); + m_xAxisAabb.SetMin(m_position - m_signX * AZ::Vector3(m_baseRadius, m_baseRadius, m_baseRadius)); + m_yAxisAabb.SetMax(m_position + m_signY * AZ::Vector3(m_baseRadius, m_scaledSize.GetY() + m_arrowLength, m_baseRadius)); + m_yAxisAabb.SetMin(m_position - m_signY * AZ::Vector3(m_baseRadius, m_baseRadius, m_baseRadius)); + m_zAxisAabb.SetMax(m_position + m_signZ * AZ::Vector3(m_baseRadius, m_baseRadius, m_scaledSize.GetZ() + m_arrowLength)); + m_zAxisAabb.SetMin(m_position - m_signZ * AZ::Vector3(m_baseRadius, m_baseRadius, m_baseRadius)); // set bounding volumes for the plane selectors - mXYPlaneAABB.SetMax(mPosition + AZ::Vector3(mSecPlaneSelectorPos.GetX() * mSignX, mSecPlaneSelectorPos.GetY() * mSignY, mBaseRadius * mSignZ)); - mXYPlaneAABB.SetMin(mPosition + 0.3f * AZ::Vector3(mSecPlaneSelectorPos.GetX() * mSignX, mSecPlaneSelectorPos.GetY() * mSignY, 0) - AZ::Vector3(mBaseRadius * mSignX, mBaseRadius * mSignY, mBaseRadius * mSignZ)); - mXZPlaneAABB.SetMax(mPosition + AZ::Vector3(mSecPlaneSelectorPos.GetX() * mSignX, mBaseRadius * mSignY, mSecPlaneSelectorPos.GetZ() * mSignZ)); - mXZPlaneAABB.SetMin(mPosition + 0.3f * AZ::Vector3(mSecPlaneSelectorPos.GetX() * mSignX, 0, mSecPlaneSelectorPos.GetZ() * mSignZ) - AZ::Vector3(mBaseRadius * mSignX, mBaseRadius * mSignY, mBaseRadius * mSignZ)); - mYZPlaneAABB.SetMax(mPosition + AZ::Vector3(mBaseRadius * mSignX, mSecPlaneSelectorPos.GetY() * mSignY, mSecPlaneSelectorPos.GetZ() * mSignZ)); - mYZPlaneAABB.SetMin(mPosition + 0.3f * AZ::Vector3(0, mSecPlaneSelectorPos.GetY() * mSignY, mSecPlaneSelectorPos.GetZ() * mSignZ) - AZ::Vector3(mBaseRadius * mSignX, mBaseRadius * mSignY, mBaseRadius * mSignZ)); + m_xyPlaneAabb.SetMax(m_position + AZ::Vector3(m_secPlaneSelectorPos.GetX() * m_signX, m_secPlaneSelectorPos.GetY() * m_signY, m_baseRadius * m_signZ)); + m_xyPlaneAabb.SetMin(m_position + 0.3f * AZ::Vector3(m_secPlaneSelectorPos.GetX() * m_signX, m_secPlaneSelectorPos.GetY() * m_signY, 0) - AZ::Vector3(m_baseRadius * m_signX, m_baseRadius * m_signY, m_baseRadius * m_signZ)); + m_xzPlaneAabb.SetMax(m_position + AZ::Vector3(m_secPlaneSelectorPos.GetX() * m_signX, m_baseRadius * m_signY, m_secPlaneSelectorPos.GetZ() * m_signZ)); + m_xzPlaneAabb.SetMin(m_position + 0.3f * AZ::Vector3(m_secPlaneSelectorPos.GetX() * m_signX, 0, m_secPlaneSelectorPos.GetZ() * m_signZ) - AZ::Vector3(m_baseRadius * m_signX, m_baseRadius * m_signY, m_baseRadius * m_signZ)); + m_yzPlaneAabb.SetMax(m_position + AZ::Vector3(m_baseRadius * m_signX, m_secPlaneSelectorPos.GetY() * m_signY, m_secPlaneSelectorPos.GetZ() * m_signZ)); + m_yzPlaneAabb.SetMin(m_position + 0.3f * AZ::Vector3(0, m_secPlaneSelectorPos.GetY() * m_signY, m_secPlaneSelectorPos.GetZ() * m_signZ) - AZ::Vector3(m_baseRadius * m_signX, m_baseRadius * m_signY, m_baseRadius * m_signZ)); // set bounding volume for the box selector - mXYZBoxAABB.SetMin(mPosition - AZ::Vector3(mBaseRadius * mSignX, mBaseRadius * mSignY, mBaseRadius * mSignZ)); - mXYZBoxAABB.SetMax(mPosition + mDiagScale * AZ::Vector3(mFirstPlaneSelectorPos.GetX() * mSignX, mFirstPlaneSelectorPos.GetY() * mSignY, mFirstPlaneSelectorPos.GetZ() * mSignZ)); + m_xyzBoxAabb.SetMin(m_position - AZ::Vector3(m_baseRadius * m_signX, m_baseRadius * m_signY, m_baseRadius * m_signZ)); + m_xyzBoxAabb.SetMax(m_position + m_diagScale * AZ::Vector3(m_firstPlaneSelectorPos.GetX() * m_signX, m_firstPlaneSelectorPos.GetY() * m_signY, m_firstPlaneSelectorPos.GetZ() * m_signZ)); } @@ -89,14 +89,14 @@ namespace MCommon MCore::Ray camRay = camera->Unproject(screenWidth / 2, screenHeight / 2); AZ::Vector3 camDir = camRay.GetDirection(); - mSignX = (MCore::Math::ACos(camDir.Dot(AZ::Vector3(1.0f, 0.0f, 0.0f))) >= MCore::Math::halfPi - MCore::Math::epsilon) ? 1.0f : -1.0f; - mSignY = (MCore::Math::ACos(camDir.Dot(AZ::Vector3(0.0f, 1.0f, 0.0f))) >= MCore::Math::halfPi - MCore::Math::epsilon) ? 1.0f : -1.0f; - mSignZ = (MCore::Math::ACos(camDir.Dot(AZ::Vector3(0.0f, 0.0f, 1.0f))) >= MCore::Math::halfPi - MCore::Math::epsilon) ? 1.0f : -1.0f; + m_signX = (MCore::Math::ACos(camDir.Dot(AZ::Vector3(1.0f, 0.0f, 0.0f))) >= MCore::Math::halfPi - MCore::Math::epsilon) ? 1.0f : -1.0f; + m_signY = (MCore::Math::ACos(camDir.Dot(AZ::Vector3(0.0f, 1.0f, 0.0f))) >= MCore::Math::halfPi - MCore::Math::epsilon) ? 1.0f : -1.0f; + m_signZ = (MCore::Math::ACos(camDir.Dot(AZ::Vector3(0.0f, 0.0f, 1.0f))) >= MCore::Math::halfPi - MCore::Math::epsilon) ? 1.0f : -1.0f; // determine the axis visibility, to disable movement for invisible axes - mXAxisVisible = (MCore::InRange(MCore::Math::Abs(camDir.Dot(AZ::Vector3(1.0f, 0.0f, 0.0f))) - 1.0f, -MCore::Math::epsilon, MCore::Math::epsilon) == false); - mYAxisVisible = (MCore::InRange(MCore::Math::Abs(camDir.Dot(AZ::Vector3(0.0f, 1.0f, 0.0f))) - 1.0f, -MCore::Math::epsilon, MCore::Math::epsilon) == false); - mZAxisVisible = (MCore::InRange(MCore::Math::Abs(camDir.Dot(AZ::Vector3(0.0f, 0.0f, 1.0f))) - 1.0f, -MCore::Math::epsilon, MCore::Math::epsilon) == false); + m_xAxisVisible = (MCore::InRange(MCore::Math::Abs(camDir.Dot(AZ::Vector3(1.0f, 0.0f, 0.0f))) - 1.0f, -MCore::Math::epsilon, MCore::Math::epsilon) == false); + m_yAxisVisible = (MCore::InRange(MCore::Math::Abs(camDir.Dot(AZ::Vector3(0.0f, 1.0f, 0.0f))) - 1.0f, -MCore::Math::epsilon, MCore::Math::epsilon) == false); + m_zAxisVisible = (MCore::InRange(MCore::Math::Abs(camDir.Dot(AZ::Vector3(0.0f, 0.0f, 1.0f))) - 1.0f, -MCore::Math::epsilon, MCore::Math::epsilon) == false); } @@ -116,13 +116,13 @@ namespace MCommon MCore::Ray mouseRay = camera->Unproject(mousePosX, mousePosY); // check if one of the AABBs is hit - if (mouseRay.Intersects(mXAxisAABB) || - mouseRay.Intersects(mYAxisAABB) || - mouseRay.Intersects(mZAxisAABB) || - mouseRay.Intersects(mXYPlaneAABB) || - mouseRay.Intersects(mXZPlaneAABB) || - mouseRay.Intersects(mYZPlaneAABB) || - mouseRay.Intersects(mXYZBoxAABB)) + if (mouseRay.Intersects(m_xAxisAabb) || + mouseRay.Intersects(m_yAxisAabb) || + mouseRay.Intersects(m_zAxisAabb) || + mouseRay.Intersects(m_xyPlaneAabb) || + mouseRay.Intersects(m_xzPlaneAabb) || + mouseRay.Intersects(m_yzPlaneAabb) || + mouseRay.Intersects(m_xyzBoxAabb)) { return true; } @@ -136,12 +136,12 @@ namespace MCommon void ScaleManipulator::Render(MCommon::Camera* camera, RenderUtil* renderUtil) { // return if no render util is set - if (renderUtil == nullptr || camera == nullptr || mIsVisible == false) + if (renderUtil == nullptr || camera == nullptr || m_isVisible == false) { return; } - // set mSize variables for the gizmo + // set m_size variables for the gizmo const uint32 screenWidth = camera->GetScreenWidth(); const uint32 screenHeight = camera->GetScreenHeight(); @@ -149,131 +149,131 @@ namespace MCommon UpdateAxisDirections(camera); // set color for the axes, depending on the selection (TODO: maybe put these into the constructor.) - MCore::RGBAColor xAxisColor = (mMode == SCALE_XYZ || mMode == SCALE_X || mMode == SCALE_XY || mMode == SCALE_XZ) ? ManipulatorColors::mSelectionColor : ManipulatorColors::mRed; - MCore::RGBAColor yAxisColor = (mMode == SCALE_XYZ || mMode == SCALE_Y || mMode == SCALE_XY || mMode == SCALE_YZ) ? ManipulatorColors::mSelectionColor : ManipulatorColors::mGreen; - MCore::RGBAColor zAxisColor = (mMode == SCALE_XYZ || mMode == SCALE_Z || mMode == SCALE_XZ || mMode == SCALE_YZ) ? ManipulatorColors::mSelectionColor : ManipulatorColors::mBlue; - MCore::RGBAColor xyPlaneColorX = (mMode == SCALE_XYZ || mMode == SCALE_XY) ? ManipulatorColors::mSelectionColor : ManipulatorColors::mRed; - MCore::RGBAColor xyPlaneColorY = (mMode == SCALE_XYZ || mMode == SCALE_XY) ? ManipulatorColors::mSelectionColor : ManipulatorColors::mGreen; - MCore::RGBAColor xzPlaneColorX = (mMode == SCALE_XYZ || mMode == SCALE_XZ) ? ManipulatorColors::mSelectionColor : ManipulatorColors::mRed; - MCore::RGBAColor xzPlaneColorZ = (mMode == SCALE_XYZ || mMode == SCALE_XZ) ? ManipulatorColors::mSelectionColor : ManipulatorColors::mBlue; - MCore::RGBAColor yzPlaneColorY = (mMode == SCALE_XYZ || mMode == SCALE_YZ) ? ManipulatorColors::mSelectionColor : ManipulatorColors::mGreen; - MCore::RGBAColor yzPlaneColorZ = (mMode == SCALE_XYZ || mMode == SCALE_YZ) ? ManipulatorColors::mSelectionColor : ManipulatorColors::mBlue; + MCore::RGBAColor xAxisColor = (m_mode == SCALE_XYZ || m_mode == SCALE_X || m_mode == SCALE_XY || m_mode == SCALE_XZ) ? ManipulatorColors::s_selectionColor : ManipulatorColors::s_red; + MCore::RGBAColor yAxisColor = (m_mode == SCALE_XYZ || m_mode == SCALE_Y || m_mode == SCALE_XY || m_mode == SCALE_YZ) ? ManipulatorColors::s_selectionColor : ManipulatorColors::s_green; + MCore::RGBAColor zAxisColor = (m_mode == SCALE_XYZ || m_mode == SCALE_Z || m_mode == SCALE_XZ || m_mode == SCALE_YZ) ? ManipulatorColors::s_selectionColor : ManipulatorColors::s_blue; + MCore::RGBAColor xyPlaneColorX = (m_mode == SCALE_XYZ || m_mode == SCALE_XY) ? ManipulatorColors::s_selectionColor : ManipulatorColors::s_red; + MCore::RGBAColor xyPlaneColorY = (m_mode == SCALE_XYZ || m_mode == SCALE_XY) ? ManipulatorColors::s_selectionColor : ManipulatorColors::s_green; + MCore::RGBAColor xzPlaneColorX = (m_mode == SCALE_XYZ || m_mode == SCALE_XZ) ? ManipulatorColors::s_selectionColor : ManipulatorColors::s_red; + MCore::RGBAColor xzPlaneColorZ = (m_mode == SCALE_XYZ || m_mode == SCALE_XZ) ? ManipulatorColors::s_selectionColor : ManipulatorColors::s_blue; + MCore::RGBAColor yzPlaneColorY = (m_mode == SCALE_XYZ || m_mode == SCALE_YZ) ? ManipulatorColors::s_selectionColor : ManipulatorColors::s_green; + MCore::RGBAColor yzPlaneColorZ = (m_mode == SCALE_XYZ || m_mode == SCALE_YZ) ? ManipulatorColors::s_selectionColor : ManipulatorColors::s_blue; // the x axis with cube at the line end - AZ::Vector3 firstPlanePosX = mPosition + mSignX * AZ::Vector3(mFirstPlaneSelectorPos.GetX(), 0.0f, 0.0f); - AZ::Vector3 secPlanePosX = mPosition + mSignX * AZ::Vector3(mSecPlaneSelectorPos.GetX(), 0.0f, 0.0f); - if (mXAxisVisible) + AZ::Vector3 firstPlanePosX = m_position + m_signX * AZ::Vector3(m_firstPlaneSelectorPos.GetX(), 0.0f, 0.0f); + AZ::Vector3 secPlanePosX = m_position + m_signX * AZ::Vector3(m_secPlaneSelectorPos.GetX(), 0.0f, 0.0f); + if (m_xAxisVisible) { - renderUtil->RenderLine(mPosition, mPosition + mSignX * AZ::Vector3(mScaledSize.GetX() + 0.5f * mBaseRadius, 0.0f, 0.0f), xAxisColor); - AZ::Vector3 quadPos = MCore::Project(mPosition + mSignX * AZ::Vector3(mScaledSize.GetX() + mBaseRadius, 0, 0), camera->GetViewProjMatrix(), screenWidth, screenHeight); - renderUtil->RenderBorderedRect(static_cast(quadPos.GetX() - 2.0f), static_cast(quadPos.GetX() + 3.0f), static_cast(quadPos.GetY() - 2.0f), static_cast(quadPos.GetY() + 3.0f), ManipulatorColors::mRed, ManipulatorColors::mRed); + renderUtil->RenderLine(m_position, m_position + m_signX * AZ::Vector3(m_scaledSize.GetX() + 0.5f * m_baseRadius, 0.0f, 0.0f), xAxisColor); + AZ::Vector3 quadPos = MCore::Project(m_position + m_signX * AZ::Vector3(m_scaledSize.GetX() + m_baseRadius, 0, 0), camera->GetViewProjMatrix(), screenWidth, screenHeight); + renderUtil->RenderBorderedRect(static_cast(quadPos.GetX() - 2.0f), static_cast(quadPos.GetX() + 3.0f), static_cast(quadPos.GetY() - 2.0f), static_cast(quadPos.GetY() + 3.0f), ManipulatorColors::s_red, ManipulatorColors::s_red); // render the plane selector lines - renderUtil->RenderLine(firstPlanePosX, firstPlanePosX + mDiagScale * (AZ::Vector3(0, mFirstPlaneSelectorPos.GetY() * mSignY, 0) - AZ::Vector3(mFirstPlaneSelectorPos.GetX() * mSignX, 0, 0)), xyPlaneColorX); - renderUtil->RenderLine(firstPlanePosX, firstPlanePosX + mDiagScale * (AZ::Vector3(0, 0, mFirstPlaneSelectorPos.GetZ() * mSignZ) - AZ::Vector3(mFirstPlaneSelectorPos.GetX() * mSignX, 0, 0)), xzPlaneColorX); - renderUtil->RenderLine(secPlanePosX, secPlanePosX + mDiagScale * (AZ::Vector3(0, mSecPlaneSelectorPos.GetY() * mSignY, 0) - AZ::Vector3(mSecPlaneSelectorPos.GetX() * mSignX, 0, 0)), xyPlaneColorX); - renderUtil->RenderLine(secPlanePosX, secPlanePosX + mDiagScale * (AZ::Vector3(0, 0, mSecPlaneSelectorPos.GetZ() * mSignZ) - AZ::Vector3(mSecPlaneSelectorPos.GetX() * mSignX, 0, 0)), xzPlaneColorX); + renderUtil->RenderLine(firstPlanePosX, firstPlanePosX + m_diagScale * (AZ::Vector3(0, m_firstPlaneSelectorPos.GetY() * m_signY, 0) - AZ::Vector3(m_firstPlaneSelectorPos.GetX() * m_signX, 0, 0)), xyPlaneColorX); + renderUtil->RenderLine(firstPlanePosX, firstPlanePosX + m_diagScale * (AZ::Vector3(0, 0, m_firstPlaneSelectorPos.GetZ() * m_signZ) - AZ::Vector3(m_firstPlaneSelectorPos.GetX() * m_signX, 0, 0)), xzPlaneColorX); + renderUtil->RenderLine(secPlanePosX, secPlanePosX + m_diagScale * (AZ::Vector3(0, m_secPlaneSelectorPos.GetY() * m_signY, 0) - AZ::Vector3(m_secPlaneSelectorPos.GetX() * m_signX, 0, 0)), xyPlaneColorX); + renderUtil->RenderLine(secPlanePosX, secPlanePosX + m_diagScale * (AZ::Vector3(0, 0, m_secPlaneSelectorPos.GetZ() * m_signZ) - AZ::Vector3(m_secPlaneSelectorPos.GetX() * m_signX, 0, 0)), xzPlaneColorX); } // the y axis with cube at the line end - AZ::Vector3 firstPlanePosY = mPosition + mSignY * AZ::Vector3(0.0f, mFirstPlaneSelectorPos.GetY(), 0.0f); - AZ::Vector3 secPlanePosY = mPosition + mSignY * AZ::Vector3(0.0f, mSecPlaneSelectorPos.GetY(), 0.0f); - if (mYAxisVisible) + AZ::Vector3 firstPlanePosY = m_position + m_signY * AZ::Vector3(0.0f, m_firstPlaneSelectorPos.GetY(), 0.0f); + AZ::Vector3 secPlanePosY = m_position + m_signY * AZ::Vector3(0.0f, m_secPlaneSelectorPos.GetY(), 0.0f); + if (m_yAxisVisible) { - renderUtil->RenderLine(mPosition, mPosition + mSignY * AZ::Vector3(0.0f, mScaledSize.GetY(), 0.0f), yAxisColor); - AZ::Vector3 quadPos = MCore::Project(mPosition + mSignY * AZ::Vector3(0, mScaledSize.GetY() + 0.5f * mBaseRadius, 0), camera->GetViewProjMatrix(), screenWidth, screenHeight); - renderUtil->RenderBorderedRect(static_cast(quadPos.GetX() - 2.0f), static_cast(quadPos.GetX() + 3.0f), static_cast(quadPos.GetY() - 2.0f), static_cast(quadPos.GetY() + 3.0f), ManipulatorColors::mGreen, ManipulatorColors::mGreen); + renderUtil->RenderLine(m_position, m_position + m_signY * AZ::Vector3(0.0f, m_scaledSize.GetY(), 0.0f), yAxisColor); + AZ::Vector3 quadPos = MCore::Project(m_position + m_signY * AZ::Vector3(0, m_scaledSize.GetY() + 0.5f * m_baseRadius, 0), camera->GetViewProjMatrix(), screenWidth, screenHeight); + renderUtil->RenderBorderedRect(static_cast(quadPos.GetX() - 2.0f), static_cast(quadPos.GetX() + 3.0f), static_cast(quadPos.GetY() - 2.0f), static_cast(quadPos.GetY() + 3.0f), ManipulatorColors::s_green, ManipulatorColors::s_green); // render the plane selector lines - renderUtil->RenderLine(firstPlanePosY, firstPlanePosY + mDiagScale * (AZ::Vector3(mFirstPlaneSelectorPos.GetX() * mSignX, 0, 0) - AZ::Vector3(0, mFirstPlaneSelectorPos.GetY() * mSignY, 0)), xyPlaneColorY); - renderUtil->RenderLine(firstPlanePosY, firstPlanePosY + mDiagScale * (AZ::Vector3(0, 0, mFirstPlaneSelectorPos.GetZ() * mSignZ) - AZ::Vector3(0, mFirstPlaneSelectorPos.GetY() * mSignY, 0)), yzPlaneColorY); - renderUtil->RenderLine(secPlanePosY, secPlanePosY + mDiagScale * (AZ::Vector3(mSecPlaneSelectorPos.GetX() * mSignX, 0, 0) - AZ::Vector3(0, mSecPlaneSelectorPos.GetY() * mSignY, 0)), xyPlaneColorY); - renderUtil->RenderLine(secPlanePosY, secPlanePosY + mDiagScale * (AZ::Vector3(0, 0, mSecPlaneSelectorPos.GetZ() * mSignZ) - AZ::Vector3(0, mSecPlaneSelectorPos.GetY() * mSignY, 0)), yzPlaneColorY); + renderUtil->RenderLine(firstPlanePosY, firstPlanePosY + m_diagScale * (AZ::Vector3(m_firstPlaneSelectorPos.GetX() * m_signX, 0, 0) - AZ::Vector3(0, m_firstPlaneSelectorPos.GetY() * m_signY, 0)), xyPlaneColorY); + renderUtil->RenderLine(firstPlanePosY, firstPlanePosY + m_diagScale * (AZ::Vector3(0, 0, m_firstPlaneSelectorPos.GetZ() * m_signZ) - AZ::Vector3(0, m_firstPlaneSelectorPos.GetY() * m_signY, 0)), yzPlaneColorY); + renderUtil->RenderLine(secPlanePosY, secPlanePosY + m_diagScale * (AZ::Vector3(m_secPlaneSelectorPos.GetX() * m_signX, 0, 0) - AZ::Vector3(0, m_secPlaneSelectorPos.GetY() * m_signY, 0)), xyPlaneColorY); + renderUtil->RenderLine(secPlanePosY, secPlanePosY + m_diagScale * (AZ::Vector3(0, 0, m_secPlaneSelectorPos.GetZ() * m_signZ) - AZ::Vector3(0, m_secPlaneSelectorPos.GetY() * m_signY, 0)), yzPlaneColorY); } // the z axis with cube at the line end - AZ::Vector3 firstPlanePosZ = mPosition + mSignZ * AZ::Vector3(0.0f, 0.0f, mFirstPlaneSelectorPos.GetZ()); - AZ::Vector3 secPlanePosZ = mPosition + mSignZ * AZ::Vector3(0.0f, 0.0f, mSecPlaneSelectorPos.GetZ()); - if (mZAxisVisible) + AZ::Vector3 firstPlanePosZ = m_position + m_signZ * AZ::Vector3(0.0f, 0.0f, m_firstPlaneSelectorPos.GetZ()); + AZ::Vector3 secPlanePosZ = m_position + m_signZ * AZ::Vector3(0.0f, 0.0f, m_secPlaneSelectorPos.GetZ()); + if (m_zAxisVisible) { - renderUtil->RenderLine(mPosition, mPosition + mSignZ * AZ::Vector3(0.0f, 0.0f, mScaledSize.GetZ()), zAxisColor); - AZ::Vector3 quadPos = MCore::Project(mPosition + mSignZ * AZ::Vector3(0, 0, mScaledSize.GetZ() + 0.5f * mBaseRadius), camera->GetViewProjMatrix(), screenWidth, screenHeight); - renderUtil->RenderBorderedRect(static_cast(quadPos.GetX() - 2.0f), static_cast(quadPos.GetX() + 3.0f), static_cast(quadPos.GetY() - 2.0f), static_cast(quadPos.GetY() + 3.0f), ManipulatorColors::mBlue, ManipulatorColors::mBlue); + renderUtil->RenderLine(m_position, m_position + m_signZ * AZ::Vector3(0.0f, 0.0f, m_scaledSize.GetZ()), zAxisColor); + AZ::Vector3 quadPos = MCore::Project(m_position + m_signZ * AZ::Vector3(0, 0, m_scaledSize.GetZ() + 0.5f * m_baseRadius), camera->GetViewProjMatrix(), screenWidth, screenHeight); + renderUtil->RenderBorderedRect(static_cast(quadPos.GetX() - 2.0f), static_cast(quadPos.GetX() + 3.0f), static_cast(quadPos.GetY() - 2.0f), static_cast(quadPos.GetY() + 3.0f), ManipulatorColors::s_blue, ManipulatorColors::s_blue); // render the plane selector lines - renderUtil->RenderLine(firstPlanePosZ, firstPlanePosZ + mDiagScale * (AZ::Vector3(mFirstPlaneSelectorPos.GetX() * mSignX, 0, 0) - AZ::Vector3(0, 0, mFirstPlaneSelectorPos.GetZ() * mSignZ)), xzPlaneColorZ); - renderUtil->RenderLine(firstPlanePosZ, firstPlanePosZ + mDiagScale * (AZ::Vector3(0, mFirstPlaneSelectorPos.GetY() * mSignY, 0) - AZ::Vector3(0, 0, mFirstPlaneSelectorPos.GetZ() * mSignZ)), yzPlaneColorZ); - renderUtil->RenderLine(secPlanePosZ, secPlanePosZ + mDiagScale * (AZ::Vector3(mSecPlaneSelectorPos.GetX() * mSignX, 0, 0) - AZ::Vector3(0, 0, mSecPlaneSelectorPos.GetZ() * mSignZ)), xzPlaneColorZ); - renderUtil->RenderLine(secPlanePosZ, secPlanePosZ + mDiagScale * (AZ::Vector3(0, mSecPlaneSelectorPos.GetY() * mSignY, 0) - AZ::Vector3(0, 0, mSecPlaneSelectorPos.GetZ() * mSignZ)), yzPlaneColorZ); + renderUtil->RenderLine(firstPlanePosZ, firstPlanePosZ + m_diagScale * (AZ::Vector3(m_firstPlaneSelectorPos.GetX() * m_signX, 0, 0) - AZ::Vector3(0, 0, m_firstPlaneSelectorPos.GetZ() * m_signZ)), xzPlaneColorZ); + renderUtil->RenderLine(firstPlanePosZ, firstPlanePosZ + m_diagScale * (AZ::Vector3(0, m_firstPlaneSelectorPos.GetY() * m_signY, 0) - AZ::Vector3(0, 0, m_firstPlaneSelectorPos.GetZ() * m_signZ)), yzPlaneColorZ); + renderUtil->RenderLine(secPlanePosZ, secPlanePosZ + m_diagScale * (AZ::Vector3(m_secPlaneSelectorPos.GetX() * m_signX, 0, 0) - AZ::Vector3(0, 0, m_secPlaneSelectorPos.GetZ() * m_signZ)), xzPlaneColorZ); + renderUtil->RenderLine(secPlanePosZ, secPlanePosZ + m_diagScale * (AZ::Vector3(0, m_secPlaneSelectorPos.GetY() * m_signY, 0) - AZ::Vector3(0, 0, m_secPlaneSelectorPos.GetZ() * m_signZ)), yzPlaneColorZ); } // calculate projected positions for the axis labels and render the text - AZ::Vector3 textPosY = MCore::Project(mPosition + mSignY * AZ::Vector3(0.0, mScaledSize.GetY() + mArrowLength + mBaseRadius, -mBaseRadius), camera->GetViewProjMatrix(), screenWidth, screenHeight); - AZ::Vector3 textPosX = MCore::Project(mPosition + mSignX * AZ::Vector3(mScaledSize.GetX() + mArrowLength + mBaseRadius, -mBaseRadius, 0.0), camera->GetViewProjMatrix(), screenWidth, screenHeight); - AZ::Vector3 textPosZ = MCore::Project(mPosition + mSignZ * AZ::Vector3(0.0, mBaseRadius, mScaledSize.GetZ() + mArrowLength + mBaseRadius), camera->GetViewProjMatrix(), screenWidth, screenHeight); + AZ::Vector3 textPosY = MCore::Project(m_position + m_signY * AZ::Vector3(0.0, m_scaledSize.GetY() + m_arrowLength + m_baseRadius, -m_baseRadius), camera->GetViewProjMatrix(), screenWidth, screenHeight); + AZ::Vector3 textPosX = MCore::Project(m_position + m_signX * AZ::Vector3(m_scaledSize.GetX() + m_arrowLength + m_baseRadius, -m_baseRadius, 0.0), camera->GetViewProjMatrix(), screenWidth, screenHeight); + AZ::Vector3 textPosZ = MCore::Project(m_position + m_signZ * AZ::Vector3(0.0, m_baseRadius, m_scaledSize.GetZ() + m_arrowLength + m_baseRadius), camera->GetViewProjMatrix(), screenWidth, screenHeight); renderUtil->RenderText(textPosX.GetX(), textPosX.GetY(), "X", xAxisColor); renderUtil->RenderText(textPosY.GetX(), textPosY.GetY(), "Y", yAxisColor); renderUtil->RenderText(textPosZ.GetX(), textPosZ.GetY(), "Z", zAxisColor); // Render the triangles for plane selection - if (mMode == SCALE_XY && mXAxisVisible && mYAxisVisible) + if (m_mode == SCALE_XY && m_xAxisVisible && m_yAxisVisible) { - renderUtil->RenderTriangle(firstPlanePosX, secPlanePosX, secPlanePosY, ManipulatorColors::mSelectionColorDarker); - renderUtil->RenderTriangle(firstPlanePosX, secPlanePosY, firstPlanePosY, ManipulatorColors::mSelectionColorDarker); + renderUtil->RenderTriangle(firstPlanePosX, secPlanePosX, secPlanePosY, ManipulatorColors::s_selectionColorDarker); + renderUtil->RenderTriangle(firstPlanePosX, secPlanePosY, firstPlanePosY, ManipulatorColors::s_selectionColorDarker); } - else if (mMode == SCALE_XZ && mXAxisVisible && mZAxisVisible) + else if (m_mode == SCALE_XZ && m_xAxisVisible && m_zAxisVisible) { - renderUtil->RenderTriangle(firstPlanePosX, secPlanePosX, secPlanePosZ, ManipulatorColors::mSelectionColorDarker); - renderUtil->RenderTriangle(firstPlanePosX, secPlanePosZ, firstPlanePosZ, ManipulatorColors::mSelectionColorDarker); + renderUtil->RenderTriangle(firstPlanePosX, secPlanePosX, secPlanePosZ, ManipulatorColors::s_selectionColorDarker); + renderUtil->RenderTriangle(firstPlanePosX, secPlanePosZ, firstPlanePosZ, ManipulatorColors::s_selectionColorDarker); } - else if (mMode == SCALE_YZ && mYAxisVisible && mZAxisVisible) + else if (m_mode == SCALE_YZ && m_yAxisVisible && m_zAxisVisible) { - renderUtil->RenderTriangle(firstPlanePosZ, secPlanePosZ, secPlanePosY, ManipulatorColors::mSelectionColorDarker); - renderUtil->RenderTriangle(firstPlanePosZ, secPlanePosY, firstPlanePosY, ManipulatorColors::mSelectionColorDarker); + renderUtil->RenderTriangle(firstPlanePosZ, secPlanePosZ, secPlanePosY, ManipulatorColors::s_selectionColorDarker); + renderUtil->RenderTriangle(firstPlanePosZ, secPlanePosY, firstPlanePosY, ManipulatorColors::s_selectionColorDarker); } - else if (mMode == SCALE_XYZ) + else if (m_mode == SCALE_XYZ) { - renderUtil->RenderTriangle(firstPlanePosX, firstPlanePosY, firstPlanePosZ, ManipulatorColors::mSelectionColorDarker); - renderUtil->RenderTriangle(mPosition, firstPlanePosX, firstPlanePosZ, ManipulatorColors::mSelectionColorDarker); - renderUtil->RenderTriangle(mPosition, firstPlanePosX, firstPlanePosY, ManipulatorColors::mSelectionColorDarker); - renderUtil->RenderTriangle(mPosition, firstPlanePosY, firstPlanePosZ, ManipulatorColors::mSelectionColorDarker); + renderUtil->RenderTriangle(firstPlanePosX, firstPlanePosY, firstPlanePosZ, ManipulatorColors::s_selectionColorDarker); + renderUtil->RenderTriangle(m_position, firstPlanePosX, firstPlanePosZ, ManipulatorColors::s_selectionColorDarker); + renderUtil->RenderTriangle(m_position, firstPlanePosX, firstPlanePosY, ManipulatorColors::s_selectionColorDarker); + renderUtil->RenderTriangle(m_position, firstPlanePosY, firstPlanePosZ, ManipulatorColors::s_selectionColorDarker); } // check if callback exists - if (mCallback == nullptr) + if (m_callback == nullptr) { return; } // render the current scale factor in percent if gizmo is hit - if (mMode != SCALE_NONE) + if (m_mode != SCALE_NONE) { - const AZ::Vector3& currScale = mCallback->GetCurrValueVec(); - mTempString = AZStd::string::format("Abs. Scale X: %.3f, Y: %.3f, Z: %.3f", MCore::Max(float(currScale.GetX()), 0.0f), MCore::Max(float(currScale.GetY()), 0.0f), MCore::Max(float(currScale.GetZ()), 0.0f)); - renderUtil->RenderText(10, 10, mTempString.c_str(), ManipulatorColors::mSelectionColor, 9.0f); + const AZ::Vector3& currScale = m_callback->GetCurrValueVec(); + m_tempString = AZStd::string::format("Abs. Scale X: %.3f, Y: %.3f, Z: %.3f", MCore::Max(float(currScale.GetX()), 0.0f), MCore::Max(float(currScale.GetY()), 0.0f), MCore::Max(float(currScale.GetZ()), 0.0f)); + renderUtil->RenderText(10, 10, m_tempString.c_str(), ManipulatorColors::s_selectionColor, 9.0f); } // calculate the position offset of the relative text float yOffset = (camera->GetProjectionMode() == MCommon::Camera::PROJMODE_PERSPECTIVE) ? 80.0f : 50.0f; // text position relative scaling or name displayed below the gizmo - AZ::Vector3 textPos = MCore::Project(mPosition + (mSize * AZ::Vector3(mSignX, mSignY, mSignZ) / 3.0f), camera->GetViewProjMatrix(), camera->GetScreenWidth(), camera->GetScreenHeight()); + AZ::Vector3 textPos = MCore::Project(m_position + (m_size * AZ::Vector3(m_signX, m_signY, m_signZ) / 3.0f), camera->GetViewProjMatrix(), camera->GetScreenWidth(), camera->GetScreenHeight()); // render the relative scale when moving - if (mSelectionLocked && mMode != SCALE_NONE) + if (m_selectionLocked && m_mode != SCALE_NONE) { // calculate the scale factor - AZ::Vector3 scaleFactor = ((AZ::Vector3(mSize, mSize, mSize) + mScale) / (float)mSize); + AZ::Vector3 scaleFactor = ((AZ::Vector3(m_size, m_size, m_size) + m_scale) / (float)m_size); // render the scaling value below the gizmo - mTempString = AZStd::string::format("X: %.3f, Y: %.3f, Z: %.3f", MCore::Max(float(scaleFactor.GetX()), 0.0f), MCore::Max(float(scaleFactor.GetY()), 0.0f), MCore::Max(float(scaleFactor.GetZ()), 0.0f)); - renderUtil->RenderText(textPos.GetX(), textPos.GetY() + yOffset, mTempString.c_str(), ManipulatorColors::mSelectionColor, 9.0f, true); + m_tempString = AZStd::string::format("X: %.3f, Y: %.3f, Z: %.3f", MCore::Max(float(scaleFactor.GetX()), 0.0f), MCore::Max(float(scaleFactor.GetY()), 0.0f), MCore::Max(float(scaleFactor.GetZ()), 0.0f)); + renderUtil->RenderText(textPos.GetX(), textPos.GetY() + yOffset, m_tempString.c_str(), ManipulatorColors::s_selectionColor, 9.0f, true); } else { - if (mName.size() > 0) + if (m_name.size() > 0) { - renderUtil->RenderText(textPos.GetX(), textPos.GetY() + yOffset, mName.c_str(), ManipulatorColors::mSelectionColor, 9.0f, true); + renderUtil->RenderText(textPos.GetX(), textPos.GetY() + yOffset, m_name.c_str(), ManipulatorColors::s_selectionColor, 9.0f, true); } } } @@ -286,12 +286,12 @@ namespace MCommon MCORE_UNUSED(middleButtonPressed); // check if camera has been set - if (camera == nullptr || mIsVisible == false || (leftButtonPressed && rightButtonPressed)) + if (camera == nullptr || m_isVisible == false || (leftButtonPressed && rightButtonPressed)) { return; } - // get screen mSize + // get screen m_size const uint32 screenWidth = camera->GetScreenWidth(); const uint32 screenHeight = camera->GetScreenHeight(); @@ -303,63 +303,63 @@ namespace MCommon MCore::Ray mousePrevPosRay = camera->Unproject(mousePosX - mouseMovementX, mousePosY - mouseMovementY); // check for the selected axis/plane - if (mSelectionLocked == false || mMode == SCALE_NONE) + if (m_selectionLocked == false || m_mode == SCALE_NONE) { // update old rotation of the callback - if (mCallback) + if (m_callback) { - mCallback->UpdateOldValues(); + m_callback->UpdateOldValues(); } // handle different scale cases depending on the bounding volumes - if (mousePosRay.Intersects(mXYZBoxAABB)) + if (mousePosRay.Intersects(m_xyzBoxAabb)) { - mMode = SCALE_XYZ; - mScaleDirection = AZ::Vector3(mSignX, mSignY, mSignZ); + m_mode = SCALE_XYZ; + m_scaleDirection = AZ::Vector3(m_signX, m_signY, m_signZ); } - else if (mousePosRay.Intersects(mXYPlaneAABB) && mXAxisVisible && mYAxisVisible) + else if (mousePosRay.Intersects(m_xyPlaneAabb) && m_xAxisVisible && m_yAxisVisible) { - mMode = SCALE_XY; - mScaleDirection = AZ::Vector3(mSignX, mSignY, 0.0f); + m_mode = SCALE_XY; + m_scaleDirection = AZ::Vector3(m_signX, m_signY, 0.0f); } - else if (mousePosRay.Intersects(mXZPlaneAABB) && mXAxisVisible && mZAxisVisible) + else if (mousePosRay.Intersects(m_xzPlaneAabb) && m_xAxisVisible && m_zAxisVisible) { - mMode = SCALE_XZ; - mScaleDirection = AZ::Vector3(mSignX, 0.0f, mSignZ); + m_mode = SCALE_XZ; + m_scaleDirection = AZ::Vector3(m_signX, 0.0f, m_signZ); } - else if (mousePosRay.Intersects(mYZPlaneAABB) && mYAxisVisible && mZAxisVisible) + else if (mousePosRay.Intersects(m_yzPlaneAabb) && m_yAxisVisible && m_zAxisVisible) { - mMode = SCALE_YZ; - mScaleDirection = AZ::Vector3(0.0f, mSignY, mSignZ); + m_mode = SCALE_YZ; + m_scaleDirection = AZ::Vector3(0.0f, m_signY, m_signZ); } - else if (mousePosRay.Intersects(mXAxisAABB) && mXAxisVisible) + else if (mousePosRay.Intersects(m_xAxisAabb) && m_xAxisVisible) { - mMode = SCALE_X; - mScaleDirection = AZ::Vector3(mSignX, 0.0f, 0.0f); + m_mode = SCALE_X; + m_scaleDirection = AZ::Vector3(m_signX, 0.0f, 0.0f); } - else if (mousePosRay.Intersects(mYAxisAABB) && mYAxisVisible) + else if (mousePosRay.Intersects(m_yAxisAabb) && m_yAxisVisible) { - mMode = SCALE_Y; - mScaleDirection = AZ::Vector3(0.0f, mSignY, 0.0f); + m_mode = SCALE_Y; + m_scaleDirection = AZ::Vector3(0.0f, m_signY, 0.0f); } - else if (mousePosRay.Intersects(mZAxisAABB) && mZAxisVisible) + else if (mousePosRay.Intersects(m_zAxisAabb) && m_zAxisVisible) { - mMode = SCALE_Z; - mScaleDirection = AZ::Vector3(0.0f, 0.0f, mSignZ); + m_mode = SCALE_Z; + m_scaleDirection = AZ::Vector3(0.0f, 0.0f, m_signZ); } else { - mMode = SCALE_NONE; + m_mode = SCALE_NONE; } } // set selection lock - mSelectionLocked = leftButtonPressed; + m_selectionLocked = leftButtonPressed; // move the gizmo - if (mSelectionLocked == false || mMode == SCALE_NONE) + if (m_selectionLocked == false || m_mode == SCALE_NONE) { - mScale = AZ::Vector3::CreateZero(); + m_scale = AZ::Vector3::CreateZero(); return; } @@ -369,7 +369,7 @@ namespace MCommon // calculate the movement of the mouse on a plane located at the gizmo position // and perpendicular to the camera direction MCore::Ray camRay = camera->Unproject(screenWidth / 2, screenHeight / 2); - MCore::PlaneEq movementPlane(camRay.GetDirection(), mPosition); + MCore::PlaneEq movementPlane(camRay.GetDirection(), m_position); // calculate the intersection points of the mouse positions with the previously calculated plane AZ::Vector3 mousePosIntersect, mousePrevPosIntersect; @@ -377,17 +377,17 @@ namespace MCommon mousePrevPosRay.Intersects(movementPlane, &mousePrevPosIntersect); // project the mouse movement onto the scale axis - scaleChange = (mScaleDirection * mScaleDirection.Dot(mousePosIntersect) - mScaleDirection * mScaleDirection.Dot(mousePrevPosIntersect)); + scaleChange = (m_scaleDirection * m_scaleDirection.Dot(mousePosIntersect) - m_scaleDirection * m_scaleDirection.Dot(mousePrevPosIntersect)); // update the scale of the gizmo - scaleChange = AZ::Vector3(scaleChange.GetX() * mSignX, scaleChange.GetY() * mSignY, scaleChange.GetZ() * mSignZ); - mScale += scaleChange; + scaleChange = AZ::Vector3(scaleChange.GetX() * m_signX, scaleChange.GetY() * m_signY, scaleChange.GetZ() * m_signZ); + m_scale += scaleChange; // update the callback actor instance - if (mCallback) + if (m_callback) { - AZ::Vector3 updateScale = (AZ::Vector3(mSize, mSize, mSize) + mScale) / (float)mSize; - mCallback->Update(updateScale); + AZ::Vector3 updateScale = (AZ::Vector3(m_size, m_size, m_size) + m_scale) / (float)m_size; + m_callback->Update(updateScale); } } } // namespace MCommon diff --git a/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/ScaleManipulator.h b/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/ScaleManipulator.h index 6d2f167893..affee9622c 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/ScaleManipulator.h +++ b/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/ScaleManipulator.h @@ -90,31 +90,31 @@ namespace MCommon protected: // scale vectors - AZ::Vector3 mScaleDirection; - AZ::Vector3 mScale; + AZ::Vector3 m_scaleDirection; + AZ::Vector3 m_scale; // bounding volumes for the axes - MCore::AABB mXAxisAABB; - MCore::AABB mYAxisAABB; - MCore::AABB mZAxisAABB; - MCore::AABB mXYPlaneAABB; - MCore::AABB mXZPlaneAABB; - MCore::AABB mYZPlaneAABB; - MCore::AABB mXYZBoxAABB; + MCore::AABB m_xAxisAabb; + MCore::AABB m_yAxisAabb; + MCore::AABB m_zAxisAabb; + MCore::AABB m_xyPlaneAabb; + MCore::AABB m_xzPlaneAabb; + MCore::AABB m_yzPlaneAabb; + MCore::AABB m_xyzBoxAabb; // size properties of the scale manipulator - float mSize; - AZ::Vector3 mScaledSize; - float mDiagScale; - float mArrowLength; - float mBaseRadius; - AZ::Vector3 mFirstPlaneSelectorPos; - AZ::Vector3 mSecPlaneSelectorPos; - float mSignX; - float mSignY; - float mSignZ; - bool mXAxisVisible; - bool mYAxisVisible; - bool mZAxisVisible; + float m_size; + AZ::Vector3 m_scaledSize; + float m_diagScale; + float m_arrowLength; + float m_baseRadius; + AZ::Vector3 m_firstPlaneSelectorPos; + AZ::Vector3 m_secPlaneSelectorPos; + float m_signX; + float m_signY; + float m_signZ; + bool m_xAxisVisible; + bool m_yAxisVisible; + bool m_zAxisVisible; }; } // namespace MCommon diff --git a/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/TransformationManipulator.h b/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/TransformationManipulator.h index 502c68d522..e9f5d8f72e 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/TransformationManipulator.h +++ b/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/TransformationManipulator.h @@ -30,11 +30,11 @@ namespace MCommon */ ManipulatorCallback(EMotionFX::ActorInstance* actorInstance, const AZ::Vector3& oldValue) { - mActorInstance = actorInstance; - mOldValueVec = oldValue; - mCurrValueVec = oldValue; - mCurrValueQuat = AZ::Quaternion::CreateIdentity(); - mOldValueQuat = AZ::Quaternion::CreateIdentity(); + m_actorInstance = actorInstance; + m_oldValueVec = oldValue; + m_currValueVec = oldValue; + m_currValueQuat = AZ::Quaternion::CreateIdentity(); + m_oldValueQuat = AZ::Quaternion::CreateIdentity(); } /** @@ -42,11 +42,11 @@ namespace MCommon */ ManipulatorCallback(EMotionFX::ActorInstance* actorInstance, const AZ::Quaternion& oldValue) { - mActorInstance = actorInstance; - mOldValueQuat = oldValue; - mCurrValueQuat = oldValue; - mOldValueVec = AZ::Vector3::CreateZero(); - mCurrValueVec = AZ::Vector3::CreateZero(); + m_actorInstance = actorInstance; + m_oldValueQuat = oldValue; + m_currValueQuat = oldValue; + m_oldValueVec = AZ::Vector3::CreateZero(); + m_currValueVec = AZ::Vector3::CreateZero(); } /** @@ -57,8 +57,8 @@ namespace MCommon /** * Update the actor instance. */ - virtual void Update(const AZ::Vector3& value) { mCurrValueVec = value; } - virtual void Update(const AZ::Quaternion& value) { mCurrValueQuat = value; } + virtual void Update(const AZ::Vector3& value) { m_currValueVec = value; } + virtual void Update(const AZ::Quaternion& value) { m_currValueQuat = value; } /** * Update old transformation values of the callback @@ -69,35 +69,35 @@ namespace MCommon * Functions to get the current value. * @return the position/scale/rotation of the actor instance. */ - virtual AZ::Vector3 GetCurrValueVec() { return mCurrValueVec; } - virtual AZ::Quaternion GetCurrValueQuat() { return mCurrValueQuat; } + virtual AZ::Vector3 GetCurrValueVec() { return m_currValueVec; } + virtual AZ::Quaternion GetCurrValueQuat() { return m_currValueQuat; } /** * Return the old value. * @return the old value. */ - const AZ::Vector3& GetOldValueVec() const { return mOldValueVec; } - const AZ::Quaternion& GetOldValueQuat() const { return mOldValueQuat; } + const AZ::Vector3& GetOldValueVec() const { return m_oldValueVec; } + const AZ::Quaternion& GetOldValueQuat() const { return m_oldValueQuat; } /** * Apply transformation. */ - virtual void ApplyTransformation() { mOldValueVec = mCurrValueVec; mOldValueQuat = mCurrValueQuat; } + virtual void ApplyTransformation() { m_oldValueVec = m_currValueVec; m_oldValueQuat = m_currValueQuat; } /** * returns the actor instance, if there is one assigned to the callback. * @return The actor instance. */ - EMotionFX::ActorInstance* GetActorInstance() { return mActorInstance; } + EMotionFX::ActorInstance* GetActorInstance() { return m_actorInstance; } virtual bool GetResetFollowMode() const { return false; } protected: - AZ::Quaternion mOldValueQuat; - AZ::Quaternion mCurrValueQuat; - AZ::Vector3 mOldValueVec; - AZ::Vector3 mCurrValueVec; - EMotionFX::ActorInstance* mActorInstance; + AZ::Quaternion m_oldValueQuat; + AZ::Quaternion m_currValueQuat; + AZ::Vector3 m_oldValueVec; + AZ::Vector3 m_currValueVec; + EMotionFX::ActorInstance* m_actorInstance; }; /** @@ -121,12 +121,12 @@ namespace MCommon */ TransformationManipulator(float scalingFactor = 1.0f, bool isVisible = true) { - mScalingFactor = scalingFactor; - mIsVisible = isVisible; - mSelectionLocked = false; - mPosition = AZ::Vector3::CreateZero(); - mRenderOffset = AZ::Vector3::CreateZero(); - mCallback = nullptr; + m_scalingFactor = scalingFactor; + m_isVisible = isVisible; + m_selectionLocked = false; + m_position = AZ::Vector3::CreateZero(); + m_renderOffset = AZ::Vector3::CreateZero(); + m_callback = nullptr; } /** @@ -134,48 +134,48 @@ namespace MCommon */ virtual ~TransformationManipulator() { - delete mCallback; + delete m_callback; } /** * Function to init the position of the gizmo. */ - void Init(const AZ::Vector3& position) { mPosition = position + mRenderOffset; UpdateBoundingVolumes(); } + void Init(const AZ::Vector3& position) { m_position = position + m_renderOffset; UpdateBoundingVolumes(); } /** * Function to set the name of the gizmo. * @param name The name of the gizmo. (e.g. used to identify different parameters) */ - void SetName(const AZStd::string& name) { mName = name; } + void SetName(const AZStd::string& name) { m_name = name; } /** * Function to get the gizmo name. * @return The name of the gizmo. */ - const AZStd::string& GetName() const { return mName; } + const AZStd::string& GetName() const { return m_name; } /** * Get the selection lock state. * @return the selection lock state. */ - void SetSelectionLocked(bool selectionLocked) { mSelectionLocked = selectionLocked; } - bool GetSelectionLocked() { return mSelectionLocked; } + void SetSelectionLocked(bool selectionLocked) { m_selectionLocked = selectionLocked; } + bool GetSelectionLocked() { return m_selectionLocked; } /** * Set the visible state of the manipulator. */ - void SetIsVisible(bool isVisible = true) { mIsVisible = isVisible; } + void SetIsVisible(bool isVisible = true) { m_isVisible = isVisible; } /** * Set the scale of the gizmo. * @param scale The new scale value for the gizmo. */ - void SetScale(float scale, MCommon::Camera* camera = nullptr) { mScalingFactor = scale; UpdateBoundingVolumes(camera); } + void SetScale(float scale, MCommon::Camera* camera = nullptr) { m_scalingFactor = scale; UpdateBoundingVolumes(camera); } /** * Set mode of the gizmo. */ - void SetMode(uint32 mode) { mMode = mode; } + void SetMode(uint32 mode) { m_mode = mode; } /** * Set the render offset of the gizmo. @@ -185,7 +185,7 @@ namespace MCommon void SetRenderOffset(const AZ::Vector3& offset) { AZ::Vector3 oldPos = GetPosition(); - mRenderOffset = offset; + m_renderOffset = offset; Init(oldPos); } @@ -193,39 +193,39 @@ namespace MCommon * Get the position of the gizmo. * @return The position of the gizmo. */ - AZ::Vector3 GetPosition() const { return mPosition - mRenderOffset; } + AZ::Vector3 GetPosition() const { return m_position - m_renderOffset; } /** * Get the position offset of the gizmo. * Only affects rendering position of the gizmo, not the actual value it modifies. * @return The offset position of the gizmo. */ - const AZ::Vector3& GetRenderOffset() const { return mRenderOffset; } + const AZ::Vector3& GetRenderOffset() const { return m_renderOffset; } /** * Set the callback. * @param callback Pointer to the callback used to manipulate the actorinstance. */ - void SetCallback(ManipulatorCallback* callback) { delete mCallback; mCallback = callback; } + void SetCallback(ManipulatorCallback* callback) { delete m_callback; m_callback = callback; } /** * Returns the current callback of the manipulator. * Used to apply the transformation upon mouse release for example. * @return The manipulator callback. */ - ManipulatorCallback* GetCallback() { return mCallback; } + ManipulatorCallback* GetCallback() { return m_callback; } /** * Function to get the mode of the transformation manipulator. * @return The mode of the manipulator. */ - uint32 GetMode() { return mMode; } + uint32 GetMode() { return m_mode; } /** * Returns the visible state of the gizmo. - * @return mIsVisible The visible state of the gizmo. + * @return m_isVisible The visible state of the gizmo. */ - bool GetIsVisible() { return mIsVisible; } + bool GetIsVisible() { return m_isVisible; } /** * Function to get the type of a gizmo. Has to be set by the constructor of the inherited classes. @@ -270,14 +270,14 @@ namespace MCommon } protected: - AZ::Vector3 mPosition; - AZ::Vector3 mRenderOffset; - AZStd::string mName; - AZStd::string mTempString; - uint32 mMode; - float mScalingFactor; - ManipulatorCallback* mCallback; - bool mSelectionLocked; - bool mIsVisible; + AZ::Vector3 m_position; + AZ::Vector3 m_renderOffset; + AZStd::string m_name; + AZStd::string m_tempString; + uint32 m_mode; + float m_scalingFactor; + ManipulatorCallback* m_callback; + bool m_selectionLocked; + bool m_isVisible; }; } // namespace MCommon diff --git a/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/TranslateManipulator.cpp b/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/TranslateManipulator.cpp index e20ae5a77e..db2cccb334 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/TranslateManipulator.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/TranslateManipulator.cpp @@ -16,8 +16,8 @@ namespace MCommon : TransformationManipulator(scalingFactor, isVisible) { // set the initial values - mMode = TRANSLATE_NONE; - mCallback = nullptr; + m_mode = TRANSLATE_NONE; + m_callback = nullptr; } @@ -33,26 +33,26 @@ namespace MCommon MCORE_UNUSED(camera); // set the new proportions - mSize = mScalingFactor; - mArrowLength = mSize / 5.0f; - mBaseRadius = mSize / 20.0f; - mPlaneSelectorPos = mSize / 2; + m_size = m_scalingFactor; + m_arrowLength = m_size / 5.0f; + m_baseRadius = m_size / 20.0f; + m_planeSelectorPos = m_size / 2; // set the bounding volumes of the axes selection - mXAxisAABB.SetMax(mPosition + AZ::Vector3(mSize + mArrowLength, mBaseRadius, mBaseRadius)); - mXAxisAABB.SetMin(mPosition - AZ::Vector3(mBaseRadius, mBaseRadius, mBaseRadius)); - mYAxisAABB.SetMax(mPosition + AZ::Vector3(mBaseRadius, mSize + mArrowLength, mBaseRadius)); - mYAxisAABB.SetMin(mPosition - AZ::Vector3(mBaseRadius, mBaseRadius, mBaseRadius)); - mZAxisAABB.SetMax(mPosition + AZ::Vector3(mBaseRadius, mBaseRadius, mSize + mArrowLength)); - mZAxisAABB.SetMin(mPosition - AZ::Vector3(mBaseRadius, mBaseRadius, mBaseRadius)); + m_xAxisAabb.SetMax(m_position + AZ::Vector3(m_size + m_arrowLength, m_baseRadius, m_baseRadius)); + m_xAxisAabb.SetMin(m_position - AZ::Vector3(m_baseRadius, m_baseRadius, m_baseRadius)); + m_yAxisAabb.SetMax(m_position + AZ::Vector3(m_baseRadius, m_size + m_arrowLength, m_baseRadius)); + m_yAxisAabb.SetMin(m_position - AZ::Vector3(m_baseRadius, m_baseRadius, m_baseRadius)); + m_zAxisAabb.SetMax(m_position + AZ::Vector3(m_baseRadius, m_baseRadius, m_size + m_arrowLength)); + m_zAxisAabb.SetMin(m_position - AZ::Vector3(m_baseRadius, m_baseRadius, m_baseRadius)); // set bounding volumes for the plane selectors - mXYPlaneAABB.SetMax(mPosition + AZ::Vector3(mPlaneSelectorPos, mPlaneSelectorPos, mBaseRadius)); - mXYPlaneAABB.SetMin(mPosition + 0.3f * AZ::Vector3(mPlaneSelectorPos, mPlaneSelectorPos, 0) - AZ::Vector3(mBaseRadius, mBaseRadius, mBaseRadius)); - mXZPlaneAABB.SetMax(mPosition + AZ::Vector3(mPlaneSelectorPos, mBaseRadius, mPlaneSelectorPos)); - mXZPlaneAABB.SetMin(mPosition + 0.3f * AZ::Vector3(mPlaneSelectorPos, 0, mPlaneSelectorPos) - AZ::Vector3(mBaseRadius, mBaseRadius, mBaseRadius)); - mYZPlaneAABB.SetMax(mPosition + AZ::Vector3(mBaseRadius, mPlaneSelectorPos, mPlaneSelectorPos)); - mYZPlaneAABB.SetMin(mPosition + 0.3f * AZ::Vector3(0, mPlaneSelectorPos, mPlaneSelectorPos) - AZ::Vector3(mBaseRadius, mBaseRadius, mBaseRadius)); + m_xyPlaneAabb.SetMax(m_position + AZ::Vector3(m_planeSelectorPos, m_planeSelectorPos, m_baseRadius)); + m_xyPlaneAabb.SetMin(m_position + 0.3f * AZ::Vector3(m_planeSelectorPos, m_planeSelectorPos, 0) - AZ::Vector3(m_baseRadius, m_baseRadius, m_baseRadius)); + m_xzPlaneAabb.SetMax(m_position + AZ::Vector3(m_planeSelectorPos, m_baseRadius, m_planeSelectorPos)); + m_xzPlaneAabb.SetMin(m_position + 0.3f * AZ::Vector3(m_planeSelectorPos, 0, m_planeSelectorPos) - AZ::Vector3(m_baseRadius, m_baseRadius, m_baseRadius)); + m_yzPlaneAabb.SetMax(m_position + AZ::Vector3(m_baseRadius, m_planeSelectorPos, m_planeSelectorPos)); + m_yzPlaneAabb.SetMin(m_position + 0.3f * AZ::Vector3(0, m_planeSelectorPos, m_planeSelectorPos) - AZ::Vector3(m_baseRadius, m_baseRadius, m_baseRadius)); } @@ -74,9 +74,9 @@ namespace MCommon AZ::Vector3 camDir = camRollRay.GetDirection(); // determine the axis visibility, to disable movement for invisible axes - mXAxisVisible = (MCore::InRange(MCore::Math::Abs(camDir.Dot(AZ::Vector3(1.0f, 0.0f, 0.0f))) - 1.0f, -MCore::Math::epsilon, MCore::Math::epsilon) == false); - mYAxisVisible = (MCore::InRange(MCore::Math::Abs(camDir.Dot(AZ::Vector3(0.0f, 1.0f, 0.0f))) - 1.0f, -MCore::Math::epsilon, MCore::Math::epsilon) == false); - mZAxisVisible = (MCore::InRange(MCore::Math::Abs(camDir.Dot(AZ::Vector3(0.0f, 0.0f, 1.0f))) - 1.0f, -MCore::Math::epsilon, MCore::Math::epsilon) == false); + m_xAxisVisible = (MCore::InRange(MCore::Math::Abs(camDir.Dot(AZ::Vector3(1.0f, 0.0f, 0.0f))) - 1.0f, -MCore::Math::epsilon, MCore::Math::epsilon) == false); + m_yAxisVisible = (MCore::InRange(MCore::Math::Abs(camDir.Dot(AZ::Vector3(0.0f, 1.0f, 0.0f))) - 1.0f, -MCore::Math::epsilon, MCore::Math::epsilon) == false); + m_zAxisVisible = (MCore::InRange(MCore::Math::Abs(camDir.Dot(AZ::Vector3(0.0f, 0.0f, 1.0f))) - 1.0f, -MCore::Math::epsilon, MCore::Math::epsilon) == false); } @@ -96,8 +96,8 @@ namespace MCommon MCore::Ray mouseRay = camera->Unproject(mousePosX, mousePosY); // check if one of the AABBs is hit - if (mouseRay.Intersects(mXAxisAABB) || mouseRay.Intersects(mYAxisAABB) || mouseRay.Intersects(mZAxisAABB) || - mouseRay.Intersects(mXYPlaneAABB) || mouseRay.Intersects(mXZPlaneAABB) || mouseRay.Intersects(mYZPlaneAABB)) + if (mouseRay.Intersects(m_xAxisAabb) || mouseRay.Intersects(m_yAxisAabb) || mouseRay.Intersects(m_zAxisAabb) || + mouseRay.Intersects(m_xyPlaneAabb) || mouseRay.Intersects(m_xzPlaneAabb) || mouseRay.Intersects(m_yzPlaneAabb)) { return true; } @@ -111,7 +111,7 @@ namespace MCommon void TranslateManipulator::Render(MCommon::Camera* camera, RenderUtil* renderUtil) { // return if no render util is set - if (renderUtil == nullptr || camera == nullptr || mIsVisible == false) + if (renderUtil == nullptr || camera == nullptr || m_isVisible == false) { return; } @@ -124,106 +124,100 @@ namespace MCommon UpdateAxisVisibility(camera); // set color for the axes, depending on the selection - MCore::RGBAColor xAxisColor = (mMode == TRANSLATE_X || mMode == TRANSLATE_XY || mMode == TRANSLATE_XZ) ? ManipulatorColors::mSelectionColor : ManipulatorColors::mRed; - MCore::RGBAColor yAxisColor = (mMode == TRANSLATE_Y || mMode == TRANSLATE_XY || mMode == TRANSLATE_YZ) ? ManipulatorColors::mSelectionColor : ManipulatorColors::mGreen; - MCore::RGBAColor zAxisColor = (mMode == TRANSLATE_Z || mMode == TRANSLATE_XZ || mMode == TRANSLATE_YZ) ? ManipulatorColors::mSelectionColor : ManipulatorColors::mBlue; - MCore::RGBAColor xyPlaneColorX = (mMode == TRANSLATE_XY) ? ManipulatorColors::mSelectionColor : ManipulatorColors::mRed; - MCore::RGBAColor xyPlaneColorY = (mMode == TRANSLATE_XY) ? ManipulatorColors::mSelectionColor : ManipulatorColors::mGreen; - MCore::RGBAColor xzPlaneColorX = (mMode == TRANSLATE_XZ) ? ManipulatorColors::mSelectionColor : ManipulatorColors::mRed; - MCore::RGBAColor xzPlaneColorZ = (mMode == TRANSLATE_XZ) ? ManipulatorColors::mSelectionColor : ManipulatorColors::mBlue; - MCore::RGBAColor yzPlaneColorY = (mMode == TRANSLATE_YZ) ? ManipulatorColors::mSelectionColor : ManipulatorColors::mGreen; - MCore::RGBAColor yzPlaneColorZ = (mMode == TRANSLATE_YZ) ? ManipulatorColors::mSelectionColor : ManipulatorColors::mBlue; + MCore::RGBAColor xAxisColor = (m_mode == TRANSLATE_X || m_mode == TRANSLATE_XY || m_mode == TRANSLATE_XZ) ? ManipulatorColors::s_selectionColor : ManipulatorColors::s_red; + MCore::RGBAColor yAxisColor = (m_mode == TRANSLATE_Y || m_mode == TRANSLATE_XY || m_mode == TRANSLATE_YZ) ? ManipulatorColors::s_selectionColor : ManipulatorColors::s_green; + MCore::RGBAColor zAxisColor = (m_mode == TRANSLATE_Z || m_mode == TRANSLATE_XZ || m_mode == TRANSLATE_YZ) ? ManipulatorColors::s_selectionColor : ManipulatorColors::s_blue; + MCore::RGBAColor xyPlaneColorX = (m_mode == TRANSLATE_XY) ? ManipulatorColors::s_selectionColor : ManipulatorColors::s_red; + MCore::RGBAColor xyPlaneColorY = (m_mode == TRANSLATE_XY) ? ManipulatorColors::s_selectionColor : ManipulatorColors::s_green; + MCore::RGBAColor xzPlaneColorX = (m_mode == TRANSLATE_XZ) ? ManipulatorColors::s_selectionColor : ManipulatorColors::s_red; + MCore::RGBAColor xzPlaneColorZ = (m_mode == TRANSLATE_XZ) ? ManipulatorColors::s_selectionColor : ManipulatorColors::s_blue; + MCore::RGBAColor yzPlaneColorY = (m_mode == TRANSLATE_YZ) ? ManipulatorColors::s_selectionColor : ManipulatorColors::s_green; + MCore::RGBAColor yzPlaneColorZ = (m_mode == TRANSLATE_YZ) ? ManipulatorColors::s_selectionColor : ManipulatorColors::s_blue; - if (mXAxisVisible) + if (m_xAxisVisible) { // the x axis consisting of a line, cylinder and plane selectors - renderUtil->RenderLine(mPosition, mPosition + AZ::Vector3(mSize, 0.0, 0.0), xAxisColor); - renderUtil->RenderCylinder(mBaseRadius, 0, mArrowLength, mPosition + AZ::Vector3(mSize, 0, 0), AZ::Vector3(1, 0, 0), ManipulatorColors::mRed); - renderUtil->RenderLine(mPosition + AZ::Vector3(mPlaneSelectorPos, 0.0, 0.0), mPosition + AZ::Vector3(mPlaneSelectorPos, mPlaneSelectorPos, 0.0), xyPlaneColorX); - renderUtil->RenderLine(mPosition + AZ::Vector3(mPlaneSelectorPos, 0.0, 0.0), mPosition + AZ::Vector3(mPlaneSelectorPos, 0.0, mPlaneSelectorPos), xzPlaneColorX); + renderUtil->RenderLine(m_position, m_position + AZ::Vector3(m_size, 0.0, 0.0), xAxisColor); + renderUtil->RenderCylinder(m_baseRadius, 0, m_arrowLength, m_position + AZ::Vector3(m_size, 0, 0), AZ::Vector3(1, 0, 0), ManipulatorColors::s_red); + renderUtil->RenderLine(m_position + AZ::Vector3(m_planeSelectorPos, 0.0, 0.0), m_position + AZ::Vector3(m_planeSelectorPos, m_planeSelectorPos, 0.0), xyPlaneColorX); + renderUtil->RenderLine(m_position + AZ::Vector3(m_planeSelectorPos, 0.0, 0.0), m_position + AZ::Vector3(m_planeSelectorPos, 0.0, m_planeSelectorPos), xzPlaneColorX); // render the axis label for the x axis - AZ::Vector3 textPosX = MCore::Project(mPosition + AZ::Vector3(mSize + mArrowLength + mBaseRadius, -mBaseRadius, 0.0), camera->GetViewProjMatrix(), screenWidth, screenHeight); + AZ::Vector3 textPosX = MCore::Project(m_position + AZ::Vector3(m_size + m_arrowLength + m_baseRadius, -m_baseRadius, 0.0), camera->GetViewProjMatrix(), screenWidth, screenHeight); renderUtil->RenderText(textPosX.GetX(), textPosX.GetY(), "X", xAxisColor); } - if (mYAxisVisible) + if (m_yAxisVisible) { // the y axis consisting of a line, cylinder and plane selectors - renderUtil->RenderLine(mPosition, mPosition + AZ::Vector3(0.0, mSize, 0.0), yAxisColor); - renderUtil->RenderCylinder(mBaseRadius, 0, mArrowLength, mPosition + AZ::Vector3(0, mSize, 0), AZ::Vector3(0, 1, 0), ManipulatorColors::mGreen); - renderUtil->RenderLine(mPosition + AZ::Vector3(0.0, mPlaneSelectorPos, 0.0), mPosition + AZ::Vector3(mPlaneSelectorPos, mPlaneSelectorPos, 0.0), xyPlaneColorY); - renderUtil->RenderLine(mPosition + AZ::Vector3(0.0, mPlaneSelectorPos, 0.0), mPosition + AZ::Vector3(0.0, mPlaneSelectorPos, mPlaneSelectorPos), yzPlaneColorY); + renderUtil->RenderLine(m_position, m_position + AZ::Vector3(0.0, m_size, 0.0), yAxisColor); + renderUtil->RenderCylinder(m_baseRadius, 0, m_arrowLength, m_position + AZ::Vector3(0, m_size, 0), AZ::Vector3(0, 1, 0), ManipulatorColors::s_green); + renderUtil->RenderLine(m_position + AZ::Vector3(0.0, m_planeSelectorPos, 0.0), m_position + AZ::Vector3(m_planeSelectorPos, m_planeSelectorPos, 0.0), xyPlaneColorY); + renderUtil->RenderLine(m_position + AZ::Vector3(0.0, m_planeSelectorPos, 0.0), m_position + AZ::Vector3(0.0, m_planeSelectorPos, m_planeSelectorPos), yzPlaneColorY); // render the axis label for the y axis - AZ::Vector3 textPosY = MCore::Project(mPosition + AZ::Vector3(0.0, mSize + mArrowLength + mBaseRadius, -mBaseRadius), camera->GetViewProjMatrix(), screenWidth, screenHeight); + AZ::Vector3 textPosY = MCore::Project(m_position + AZ::Vector3(0.0, m_size + m_arrowLength + m_baseRadius, -m_baseRadius), camera->GetViewProjMatrix(), screenWidth, screenHeight); renderUtil->RenderText(textPosY.GetX(), textPosY.GetY(), "Y", yAxisColor); } - if (mZAxisVisible) + if (m_zAxisVisible) { // the z axis consisting of a line, cylinder and plane selectors - renderUtil->RenderLine(mPosition, mPosition + AZ::Vector3(0.0, 0.0, mSize), zAxisColor); - renderUtil->RenderCylinder(mBaseRadius, 0, mArrowLength, mPosition + AZ::Vector3(0, 0, mSize), AZ::Vector3(0, 0, 1), ManipulatorColors::mBlue); - renderUtil->RenderLine(mPosition + AZ::Vector3(0.0, 0.0, mPlaneSelectorPos), mPosition + AZ::Vector3(mPlaneSelectorPos, 0.0, mPlaneSelectorPos), xzPlaneColorZ); - renderUtil->RenderLine(mPosition + AZ::Vector3(0.0, 0.0, mPlaneSelectorPos), mPosition + AZ::Vector3(0.0, mPlaneSelectorPos, mPlaneSelectorPos), yzPlaneColorZ); + renderUtil->RenderLine(m_position, m_position + AZ::Vector3(0.0, 0.0, m_size), zAxisColor); + renderUtil->RenderCylinder(m_baseRadius, 0, m_arrowLength, m_position + AZ::Vector3(0, 0, m_size), AZ::Vector3(0, 0, 1), ManipulatorColors::s_blue); + renderUtil->RenderLine(m_position + AZ::Vector3(0.0, 0.0, m_planeSelectorPos), m_position + AZ::Vector3(m_planeSelectorPos, 0.0, m_planeSelectorPos), xzPlaneColorZ); + renderUtil->RenderLine(m_position + AZ::Vector3(0.0, 0.0, m_planeSelectorPos), m_position + AZ::Vector3(0.0, m_planeSelectorPos, m_planeSelectorPos), yzPlaneColorZ); // render the axis label for the z axis - AZ::Vector3 textPosZ = MCore::Project(mPosition + AZ::Vector3(0.0, mBaseRadius, mSize + mArrowLength + mBaseRadius), camera->GetViewProjMatrix(), screenWidth, screenHeight); + AZ::Vector3 textPosZ = MCore::Project(m_position + AZ::Vector3(0.0, m_baseRadius, m_size + m_arrowLength + m_baseRadius), camera->GetViewProjMatrix(), screenWidth, screenHeight); renderUtil->RenderText(textPosZ.GetX(), textPosZ.GetY(), "Z", zAxisColor); } // draw transparent quad for the plane selectors - if (mMode == TRANSLATE_XY) + if (m_mode == TRANSLATE_XY) { - renderUtil->RenderTriangle(mPosition, mPosition + AZ::Vector3(mPlaneSelectorPos, 0.0f, 0.0f), mPosition + AZ::Vector3(mPlaneSelectorPos, mPlaneSelectorPos, 0.0f), ManipulatorColors::mSelectionColorDarker); - renderUtil->RenderTriangle(mPosition, mPosition + AZ::Vector3(mPlaneSelectorPos, mPlaneSelectorPos, 0.0f), mPosition + AZ::Vector3(0.0f, mPlaneSelectorPos, 0.0f), ManipulatorColors::mSelectionColorDarker); + renderUtil->RenderTriangle(m_position, m_position + AZ::Vector3(m_planeSelectorPos, 0.0f, 0.0f), m_position + AZ::Vector3(m_planeSelectorPos, m_planeSelectorPos, 0.0f), ManipulatorColors::s_selectionColorDarker); + renderUtil->RenderTriangle(m_position, m_position + AZ::Vector3(m_planeSelectorPos, m_planeSelectorPos, 0.0f), m_position + AZ::Vector3(0.0f, m_planeSelectorPos, 0.0f), ManipulatorColors::s_selectionColorDarker); } - else if (mMode == TRANSLATE_XZ) + else if (m_mode == TRANSLATE_XZ) { - renderUtil->RenderTriangle(mPosition, mPosition + AZ::Vector3(mPlaneSelectorPos, 0.0f, 0.0f), mPosition + AZ::Vector3(mPlaneSelectorPos, 0.0f, mPlaneSelectorPos), ManipulatorColors::mSelectionColorDarker); - renderUtil->RenderTriangle(mPosition, mPosition + AZ::Vector3(mPlaneSelectorPos, 0.0f, mPlaneSelectorPos), mPosition + AZ::Vector3(0.0f, 0.0f, mPlaneSelectorPos), ManipulatorColors::mSelectionColorDarker); + renderUtil->RenderTriangle(m_position, m_position + AZ::Vector3(m_planeSelectorPos, 0.0f, 0.0f), m_position + AZ::Vector3(m_planeSelectorPos, 0.0f, m_planeSelectorPos), ManipulatorColors::s_selectionColorDarker); + renderUtil->RenderTriangle(m_position, m_position + AZ::Vector3(m_planeSelectorPos, 0.0f, m_planeSelectorPos), m_position + AZ::Vector3(0.0f, 0.0f, m_planeSelectorPos), ManipulatorColors::s_selectionColorDarker); } - else if (mMode == TRANSLATE_YZ) + else if (m_mode == TRANSLATE_YZ) { - renderUtil->RenderTriangle(mPosition + AZ::Vector3(0.0f, 0.0f, mPlaneSelectorPos), mPosition, mPosition + AZ::Vector3(0.0f, mPlaneSelectorPos, 0.0f), ManipulatorColors::mSelectionColorDarker); - renderUtil->RenderTriangle(mPosition + AZ::Vector3(0.0f, mPlaneSelectorPos, 0.0f), mPosition + AZ::Vector3(0.0f, mPlaneSelectorPos, mPlaneSelectorPos), mPosition + AZ::Vector3(0.0f, 0.0f, mPlaneSelectorPos), ManipulatorColors::mSelectionColorDarker); + renderUtil->RenderTriangle(m_position + AZ::Vector3(0.0f, 0.0f, m_planeSelectorPos), m_position, m_position + AZ::Vector3(0.0f, m_planeSelectorPos, 0.0f), ManipulatorColors::s_selectionColorDarker); + renderUtil->RenderTriangle(m_position + AZ::Vector3(0.0f, m_planeSelectorPos, 0.0f), m_position + AZ::Vector3(0.0f, m_planeSelectorPos, m_planeSelectorPos), m_position + AZ::Vector3(0.0f, 0.0f, m_planeSelectorPos), ManipulatorColors::s_selectionColorDarker); } // render the relative position when moving - if (mCallback) + if (m_callback) { // calculate the y-offset of the text position - AZ::Vector3 deltaPos = GetPosition() - mCallback->GetOldValueVec(); + AZ::Vector3 deltaPos = GetPosition() - m_callback->GetOldValueVec(); float yOffset = (camera->GetProjectionMode() == MCommon::Camera::PROJMODE_PERSPECTIVE) ? 60.0f * ((float)screenHeight / 720.0f) : 40.0f; // render the relative movement - AZ::Vector3 textPos = MCore::Project(mPosition + (AZ::Vector3(mSize, mSize, mSize) / 3.0f), camera->GetViewProjMatrix(), camera->GetScreenWidth(), camera->GetScreenHeight()); + AZ::Vector3 textPos = MCore::Project(m_position + (AZ::Vector3(m_size, m_size, m_size) / 3.0f), camera->GetViewProjMatrix(), camera->GetScreenWidth(), camera->GetScreenHeight()); // render delta position of the gizmo of the name if not dragging at the moment - if (mSelectionLocked && mMode != TRANSLATE_NONE) + if (m_selectionLocked && m_mode != TRANSLATE_NONE) { - mTempString = AZStd::string::format("X: %.3f, Y: %.3f, Z: %.3f", static_cast(deltaPos.GetX()), static_cast(deltaPos.GetY()), static_cast(deltaPos.GetZ())); - renderUtil->RenderText(textPos.GetX(), textPos.GetY() + yOffset, mTempString.c_str(), ManipulatorColors::mSelectionColor, 9.0f, true); + m_tempString = AZStd::string::format("X: %.3f, Y: %.3f, Z: %.3f", static_cast(deltaPos.GetX()), static_cast(deltaPos.GetY()), static_cast(deltaPos.GetZ())); + renderUtil->RenderText(textPos.GetX(), textPos.GetY() + yOffset, m_tempString.c_str(), ManipulatorColors::s_selectionColor, 9.0f, true); } else { - renderUtil->RenderText(textPos.GetX(), textPos.GetY() + yOffset, mName.c_str(), ManipulatorColors::mSelectionColor, 9.0f, true); + renderUtil->RenderText(textPos.GetX(), textPos.GetY() + yOffset, m_name.c_str(), ManipulatorColors::s_selectionColor, 9.0f, true); } } - // render aabbs (for debug issues. remove this) - /* renderUtil->RenderAABB( mXAxisAABB, ManipulatorColors::mSelectionColor, true ); - renderUtil->RenderAABB( mYAxisAABB, ManipulatorColors::mSelectionColor, true ); - renderUtil->RenderAABB( mZAxisAABB, ManipulatorColors::mSelectionColor, true ); - */ - // render the absolute position of the gizmo/actor instance - if (mMode != TRANSLATE_NONE) + if (m_mode != TRANSLATE_NONE) { const AZ::Vector3 offsetPos = GetPosition(); - mTempString = AZStd::string::format("Abs Pos X: %.3f, Y: %.3f, Z: %.3f", static_cast(offsetPos.GetX()), static_cast(offsetPos.GetY()), static_cast(offsetPos.GetZ())); - renderUtil->RenderText(10, 10, mTempString.c_str(), ManipulatorColors::mSelectionColor, 9.0f); + m_tempString = AZStd::string::format("Abs Pos X: %.3f, Y: %.3f, Z: %.3f", static_cast(offsetPos.GetX()), static_cast(offsetPos.GetY()), static_cast(offsetPos.GetZ())); + renderUtil->RenderText(10, 10, m_tempString.c_str(), ManipulatorColors::s_selectionColor, 9.0f); } } @@ -235,7 +229,7 @@ namespace MCommon MCORE_UNUSED(middleButtonPressed); // check if camera has been set - if (camera == nullptr || mIsVisible == false || (leftButtonPressed && rightButtonPressed)) + if (camera == nullptr || m_isVisible == false || (leftButtonPressed && rightButtonPressed)) { return; } @@ -252,64 +246,64 @@ namespace MCommon UpdateAxisVisibility(camera); // check for the selected axis/plane - if (mSelectionLocked == false || mMode == TRANSLATE_NONE) + if (m_selectionLocked == false || m_mode == TRANSLATE_NONE) { // update old values of the callback - if (mCallback) + if (m_callback) { - mCallback->UpdateOldValues(); + m_callback->UpdateOldValues(); } // handle different translation modes - if (mousePosRay.Intersects(mXYPlaneAABB) && mXAxisVisible && mYAxisVisible) + if (mousePosRay.Intersects(m_xyPlaneAabb) && m_xAxisVisible && m_yAxisVisible) { - mMovementDirection = AZ::Vector3(1.0f, 1.0f, 0.0f); - mMovementPlaneNormal = AZ::Vector3(0.0f, 0.0f, 1.0f); - mMode = TRANSLATE_XY; + m_movementDirection = AZ::Vector3(1.0f, 1.0f, 0.0f); + m_movementPlaneNormal = AZ::Vector3(0.0f, 0.0f, 1.0f); + m_mode = TRANSLATE_XY; } - else if (mousePosRay.Intersects(mXZPlaneAABB) && mXAxisVisible && mZAxisVisible) + else if (mousePosRay.Intersects(m_xzPlaneAabb) && m_xAxisVisible && m_zAxisVisible) { - mMovementDirection = AZ::Vector3(1.0f, 0.0f, 1.0f); - mMovementPlaneNormal = AZ::Vector3(0.0f, 1.0f, 0.0f); - mMode = TRANSLATE_XZ; + m_movementDirection = AZ::Vector3(1.0f, 0.0f, 1.0f); + m_movementPlaneNormal = AZ::Vector3(0.0f, 1.0f, 0.0f); + m_mode = TRANSLATE_XZ; } - else if (mousePosRay.Intersects(mYZPlaneAABB) && mYAxisVisible && mZAxisVisible) + else if (mousePosRay.Intersects(m_yzPlaneAabb) && m_yAxisVisible && m_zAxisVisible) { - mMovementDirection = AZ::Vector3(0.0f, 1.0f, 1.0f); - mMovementPlaneNormal = AZ::Vector3(1.0f, 0.0f, 0.0f); - mMode = TRANSLATE_YZ; + m_movementDirection = AZ::Vector3(0.0f, 1.0f, 1.0f); + m_movementPlaneNormal = AZ::Vector3(1.0f, 0.0f, 0.0f); + m_mode = TRANSLATE_YZ; } - else if (mousePosRay.Intersects(mXAxisAABB) && mXAxisVisible) + else if (mousePosRay.Intersects(m_xAxisAabb) && m_xAxisVisible) { - mMovementDirection = AZ::Vector3(1.0f, 0.0f, 0.0f); - mMovementPlaneNormal = AZ::Vector3(0.0f, 1.0f, 1.0f).GetNormalized(); - mMode = TRANSLATE_X; + m_movementDirection = AZ::Vector3(1.0f, 0.0f, 0.0f); + m_movementPlaneNormal = AZ::Vector3(0.0f, 1.0f, 1.0f).GetNormalized(); + m_mode = TRANSLATE_X; } - else if (mousePosRay.Intersects(mYAxisAABB) && mYAxisVisible) + else if (mousePosRay.Intersects(m_yAxisAabb) && m_yAxisVisible) { - mMovementDirection = AZ::Vector3(0.0f, 1.0f, 0.0f); - mMovementPlaneNormal = AZ::Vector3(1.0f, 0.0f, 1.0f).GetNormalized(); - mMode = TRANSLATE_Y; + m_movementDirection = AZ::Vector3(0.0f, 1.0f, 0.0f); + m_movementPlaneNormal = AZ::Vector3(1.0f, 0.0f, 1.0f).GetNormalized(); + m_mode = TRANSLATE_Y; } - else if (mousePosRay.Intersects(mZAxisAABB) && mZAxisVisible) + else if (mousePosRay.Intersects(m_zAxisAabb) && m_zAxisVisible) { - mMovementDirection = AZ::Vector3(0.0f, 0.0f, 1.0f); - mMovementPlaneNormal = AZ::Vector3(1.0f, 1.0f, 0.0f).GetNormalized(); - mMode = TRANSLATE_Z; + m_movementDirection = AZ::Vector3(0.0f, 0.0f, 1.0f); + m_movementPlaneNormal = AZ::Vector3(1.0f, 1.0f, 0.0f).GetNormalized(); + m_mode = TRANSLATE_Z; } else { - mMode = TRANSLATE_NONE; + m_mode = TRANSLATE_NONE; } } // set selection lock - mSelectionLocked = leftButtonPressed; + m_selectionLocked = leftButtonPressed; // move the gizmo - if (mSelectionLocked == false || mMode == TRANSLATE_NONE) + if (m_selectionLocked == false || m_mode == TRANSLATE_NONE) { - mMousePosRelative = AZ::Vector3::CreateZero(); + m_mousePosRelative = AZ::Vector3::CreateZero(); return; } @@ -317,22 +311,22 @@ namespace MCommon AZ::Vector3 movement = AZ::Vector3::CreateZero(); // handle plane movement - if (mMode == TRANSLATE_XY || mMode == TRANSLATE_XZ || mMode == TRANSLATE_YZ) + if (m_mode == TRANSLATE_XY || m_mode == TRANSLATE_XZ || m_mode == TRANSLATE_YZ) { // generate current translation plane and calculate mouse intersections - MCore::PlaneEq movementPlane(mMovementPlaneNormal, mPosition); + MCore::PlaneEq movementPlane(m_movementPlaneNormal, m_position); AZ::Vector3 mousePosIntersect, mousePrevPosIntersect; mousePosRay.Intersects(movementPlane, &mousePosIntersect); mousePrevPosRay.Intersects(movementPlane, &mousePrevPosIntersect); // calculate the mouse position relative to the gizmo - if (MCore::Math::IsFloatZero(MCore::SafeLength(mMousePosRelative))) + if (MCore::Math::IsFloatZero(MCore::SafeLength(m_mousePosRelative))) { - mMousePosRelative = mousePosIntersect - mPosition; + m_mousePosRelative = mousePosIntersect - m_position; } // distance of the mouse intersections is the actual movement on the plane - movement = mousePosIntersect - mMousePosRelative; + movement = mousePosIntersect - m_mousePosRelative; } // handle axis movement @@ -342,12 +336,12 @@ namespace MCommon // calculate the movement of the mouse on a plane located at the gizmo position // and perpendicular to the move direction AZ::Vector3 camDir = camera->Unproject(camera->GetScreenWidth() / 2, camera->GetScreenHeight() / 2).GetDirection(); - AZ::Vector3 thirdAxis = mMovementDirection.Cross(camDir).GetNormalized(); - mMovementPlaneNormal = thirdAxis.Cross(mMovementDirection).GetNormalized(); - thirdAxis = mMovementPlaneNormal.Cross(mMovementDirection).GetNormalized(); + AZ::Vector3 thirdAxis = m_movementDirection.Cross(camDir).GetNormalized(); + m_movementPlaneNormal = thirdAxis.Cross(m_movementDirection).GetNormalized(); + thirdAxis = m_movementPlaneNormal.Cross(m_movementDirection).GetNormalized(); - MCore::PlaneEq movementPlane(mMovementPlaneNormal, mPosition); - MCore::PlaneEq movementPlane2(thirdAxis, mPosition); + MCore::PlaneEq movementPlane(m_movementPlaneNormal, m_position); + MCore::PlaneEq movementPlane2(thirdAxis, m_position); // calculate the intersection points of the mouse positions with the previously calculated plane AZ::Vector3 mousePosIntersect, mousePosIntersect2; @@ -356,44 +350,44 @@ namespace MCommon if (mousePosIntersect.GetLength() < camera->GetFarClipDistance()) { - if (MCore::Math::IsFloatZero(MCore::SafeLength(mMousePosRelative))) + if (MCore::Math::IsFloatZero(MCore::SafeLength(m_mousePosRelative))) { - mMousePosRelative = movementPlane2.Project(mousePosIntersect) - mPosition; + m_mousePosRelative = movementPlane2.Project(mousePosIntersect) - m_position; } mousePosIntersect = movementPlane2.Project(mousePosIntersect); } else { - if (MCore::Math::IsFloatZero(MCore::SafeLength(mMousePosRelative))) + if (MCore::Math::IsFloatZero(MCore::SafeLength(m_mousePosRelative))) { - mMousePosRelative = movementPlane.Project(mousePosIntersect2) - mPosition; + m_mousePosRelative = movementPlane.Project(mousePosIntersect2) - m_position; } mousePosIntersect = movementPlane.Project(mousePosIntersect2); } // adjust the movement vector - movement = mousePosIntersect - mMousePosRelative; + movement = mousePosIntersect - m_mousePosRelative; } // update the position of the gizmo - movement = movement - mPosition; - movement = AZ::Vector3(movement.GetX() * mMovementDirection.GetX(), movement.GetY() * mMovementDirection.GetY(), movement.GetZ() * mMovementDirection.GetZ()); - mPosition += movement; + movement = movement - m_position; + movement = AZ::Vector3(movement.GetX() * m_movementDirection.GetX(), movement.GetY() * m_movementDirection.GetY(), movement.GetZ() * m_movementDirection.GetZ()); + m_position += movement; // update the callback - if (mCallback) + if (m_callback) { // reset the callback position, if the position is too far away from the camera float farClip = camera->GetFarClipDistance(); - if (mPosition.GetLength() >= farClip) + if (m_position.GetLength() >= farClip) { - mPosition = mCallback->GetOldValueVec() + mRenderOffset; + m_position = m_callback->GetOldValueVec() + m_renderOffset; } // update the callback - mCallback->Update(GetPosition()); + m_callback->Update(GetPosition()); } } } // namespace MCommon diff --git a/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/TranslateManipulator.h b/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/TranslateManipulator.h index 7bc0bacfe0..4b916f43b7 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/TranslateManipulator.h +++ b/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/TranslateManipulator.h @@ -91,24 +91,24 @@ namespace MCommon protected: // bounding volumes for the axes - MCore::AABB mXAxisAABB; - MCore::AABB mYAxisAABB; - MCore::AABB mZAxisAABB; - MCore::AABB mXYPlaneAABB; - MCore::AABB mXZPlaneAABB; - MCore::AABB mYZPlaneAABB; + MCore::AABB m_xAxisAabb; + MCore::AABB m_yAxisAabb; + MCore::AABB m_zAxisAabb; + MCore::AABB m_xyPlaneAabb; + MCore::AABB m_xzPlaneAabb; + MCore::AABB m_yzPlaneAabb; // the scaling factors for the translate manipulator - float mSize; - float mArrowLength; - float mBaseRadius; - float mPlaneSelectorPos; - AZ::Vector3 mMovementPlaneNormal; - AZ::Vector3 mMovementDirection; - AZ::Vector3 mMousePosRelative; - bool mXAxisVisible; - bool mYAxisVisible; - bool mZAxisVisible; + float m_size; + float m_arrowLength; + float m_baseRadius; + float m_planeSelectorPos; + AZ::Vector3 m_movementPlaneNormal; + AZ::Vector3 m_movementDirection; + AZ::Vector3 m_mousePosRelative; + bool m_xAxisVisible; + bool m_yAxisVisible; + bool m_zAxisVisible; }; } // namespace MCommon diff --git a/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/GBuffer.cpp b/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/GBuffer.cpp index 3e2a25fe80..297bf01638 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/GBuffer.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/GBuffer.cpp @@ -22,20 +22,20 @@ namespace RenderGL // constructor GBuffer::GBuffer() { - mFBO = 0; - mDepthBufferID = 0; - mWidth = 100; - mHeight = 100; + m_fbo = 0; + m_depthBufferId = 0; + m_width = 100; + m_height = 100; - mRenderTargetA = nullptr; - mRenderTargetB = nullptr; - mRenderTargetC = nullptr; - mRenderTargetD = nullptr; - mRenderTargetE = nullptr; + m_renderTargetA = nullptr; + m_renderTargetB = nullptr; + m_renderTargetC = nullptr; + m_renderTargetD = nullptr; + m_renderTargetE = nullptr; for (uint32 i = 0; i < NUM_COMPONENTS; ++i) { - mComponents[i] = 0; + m_components[i] = 0; } } @@ -62,48 +62,48 @@ namespace RenderGL return false; } - mWidth = width; - mHeight = height; + m_width = width; + m_height = height; // create the FBO - glGenFramebuffers(1, &mFBO); + glGenFramebuffers(1, &m_fbo); for (uint32 i = 0; i < NUM_COMPONENTS; ++i) { - glGenTextures(1, &mComponents[i]); + glGenTextures(1, &m_components[i]); } - glGenTextures(1, &mDepthBufferID); + glGenTextures(1, &m_depthBufferId); // bind the fbo - glBindFramebuffer(GL_FRAMEBUFFER, mFBO); + glBindFramebuffer(GL_FRAMEBUFFER, m_fbo); // init normals texture - glBindTexture(GL_TEXTURE_2D, mComponents[COMPONENT_SHADED]); + glBindTexture(GL_TEXTURE_2D, m_components[COMPONENT_SHADED]); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16F, width, height, 0, GL_RGBA, GL_FLOAT, nullptr); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, mComponents[COMPONENT_SHADED], 0); + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, m_components[COMPONENT_SHADED], 0); // init glow color texture - glBindTexture(GL_TEXTURE_2D, mComponents[COMPONENT_GLOW]); + glBindTexture(GL_TEXTURE_2D, m_components[COMPONENT_GLOW]); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16F, width, height, 0, GL_RGBA, GL_FLOAT, nullptr); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT1, GL_TEXTURE_2D, mComponents[COMPONENT_GLOW], 0); + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT1, GL_TEXTURE_2D, m_components[COMPONENT_GLOW], 0); // init the depth buffer - glBindTexture(GL_TEXTURE_2D, mDepthBufferID); + glBindTexture(GL_TEXTURE_2D, m_depthBufferId); glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH24_STENCIL8, width, height, 0, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, nullptr); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, mDepthBufferID, 0); - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_TEXTURE_2D, mDepthBufferID, 0); + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, m_depthBufferId, 0); + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_TEXTURE_2D, m_depthBufferId, 0); // unbind glBindTexture(GL_TEXTURE_2D, 0); @@ -131,28 +131,28 @@ namespace RenderGL // release void GBuffer::Release() { - if (mFBO) + if (m_fbo) { - glDeleteFramebuffers(1, &mFBO); + glDeleteFramebuffers(1, &m_fbo); for (uint32 i = 0; i < NUM_COMPONENTS; ++i) { - glDeleteTextures(1, &mComponents[i]); + glDeleteTextures(1, &m_components[i]); } - glDeleteTextures(1, &mDepthBufferID); + glDeleteTextures(1, &m_depthBufferId); } - delete mRenderTargetA; - delete mRenderTargetB; - delete mRenderTargetC; - delete mRenderTargetD; - delete mRenderTargetE; + delete m_renderTargetA; + delete m_renderTargetB; + delete m_renderTargetC; + delete m_renderTargetD; + delete m_renderTargetE; - mRenderTargetA = nullptr; - mRenderTargetB = nullptr; - mRenderTargetC = nullptr; - mRenderTargetD = nullptr; - mRenderTargetE = nullptr; + m_renderTargetA = nullptr; + m_renderTargetB = nullptr; + m_renderTargetC = nullptr; + m_renderTargetD = nullptr; + m_renderTargetE = nullptr; } @@ -167,39 +167,39 @@ namespace RenderGL // resize render textures bool GBuffer::ResizeTextures(uint32 screenWidth, uint32 screenHeight) { - delete mRenderTargetA; - delete mRenderTargetB; - delete mRenderTargetC; - delete mRenderTargetD; - delete mRenderTargetE; + delete m_renderTargetA; + delete m_renderTargetB; + delete m_renderTargetC; + delete m_renderTargetD; + delete m_renderTargetE; - mRenderTargetA = new RenderTexture(); - mRenderTargetB = new RenderTexture(); - mRenderTargetC = new RenderTexture(); - mRenderTargetD = new RenderTexture(); - mRenderTargetE = new RenderTexture(); + m_renderTargetA = new RenderTexture(); + m_renderTargetB = new RenderTexture(); + m_renderTargetC = new RenderTexture(); + m_renderTargetD = new RenderTexture(); + m_renderTargetE = new RenderTexture(); - if (mRenderTargetA->Init(GL_RGBA16F, screenWidth, screenHeight) == false) + if (m_renderTargetA->Init(GL_RGBA16F, screenWidth, screenHeight) == false) { return false; } - if (mRenderTargetB->Init(GL_RGBA16F, screenWidth, screenHeight) == false) + if (m_renderTargetB->Init(GL_RGBA16F, screenWidth, screenHeight) == false) { return false; } - if (mRenderTargetC->Init(GL_RGBA16F, screenWidth, screenHeight) == false) + if (m_renderTargetC->Init(GL_RGBA16F, screenWidth, screenHeight) == false) { return false; } - if (mRenderTargetD->Init(GL_RGBA16F, screenWidth / 2, screenHeight / 2) == false) + if (m_renderTargetD->Init(GL_RGBA16F, screenWidth / 2, screenHeight / 2) == false) { return false; } - if (mRenderTargetE->Init(GL_RGBA16F, screenWidth / 2, screenHeight / 2) == false) + if (m_renderTargetE->Init(GL_RGBA16F, screenWidth / 2, screenHeight / 2) == false) { return false; } @@ -213,16 +213,10 @@ namespace RenderGL { glPushAttrib(GL_VIEWPORT_BIT | GL_COLOR_BUFFER_BIT); - // get the width and height of the current used viewport - //float glDimensions[4]; - //glGetFloatv( GL_VIEWPORT, glDimensions ); - //mPrevWidth = (uint32)glDimensions[2]; - //mPrevHeight = (uint32)glDimensions[3]; - // bind the render texture and frame buffer glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, 0); - glBindFramebuffer(GL_FRAMEBUFFER, mFBO); + glBindFramebuffer(GL_FRAMEBUFFER, m_fbo); GLenum bufs[] = { GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1 }; glDrawBuffers(2, bufs); @@ -234,14 +228,14 @@ namespace RenderGL } // setup the new viewport - glViewport(0, 0, mWidth, mHeight); + glViewport(0, 0, m_width, m_height); } // clear void GBuffer::Clear(const MCore::RGBAColor& color) { - glClearColor(color.r, color.g, color.b, 1.0f); + glClearColor(color.m_r, color.m_g, color.m_b, 1.0f); glClearDepth(1.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); } @@ -252,16 +246,9 @@ namespace RenderGL { glPopAttrib(); - //GLenum bufs[] = { GL_COLOR_ATTACHMENT0 }; - //glDrawBuffers( 1, bufs); - // undbind the frame buffer glBindFramebuffer(GL_FRAMEBUFFER, 0); - // reset viewport to original dimensions - //glViewport( 0, 0, mPrevWidth, mPrevHeight ); - //GetGraphicsManager()->SetRenderTexture(nullptr); - glEnable(GL_TEXTURE_2D); glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE0, 0); @@ -278,12 +265,12 @@ namespace RenderGL //----------------------------- // render the main image //----------------------------- - glBindTexture(GL_TEXTURE_2D, mComponents[COMPONENT_SHADED]); + glBindTexture(GL_TEXTURE_2D, m_components[COMPONENT_SHADED]); // setup ortho projection glMatrixMode(GL_PROJECTION); glLoadIdentity(); - glOrtho(0, mWidth, mHeight, 0, -1, 1); + glOrtho(0, m_width, m_height, 0, -1, 1); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); @@ -298,15 +285,15 @@ namespace RenderGL glColor3f(1.0f, 1.0f, 1.0f); glTexCoord2f(1.0f, 1.0f); - glVertex2f(static_cast(mWidth), 0.0f); + glVertex2f(static_cast(m_width), 0.0f); glColor3f(1.0f, 1.0f, 1.0f); glTexCoord2f(1.0f, 0.0f); - glVertex2f(static_cast(mWidth), static_cast(mHeight)); + glVertex2f(static_cast(m_width), static_cast(m_height)); glColor3f(1.0f, 1.0f, 1.0f); glTexCoord2f(0.0f, 0.0f); - glVertex2f(0.0f, static_cast(mHeight)); + glVertex2f(0.0f, static_cast(m_height)); glColor3f(1.0f, 1.0f, 1.0f); glEnd(); @@ -320,14 +307,14 @@ namespace RenderGL // render the small images //----------------------------- uint32 xStart = 10; - uint32 yStart = mHeight - 110; + uint32 yStart = m_height - 110; for (uint32 i = 0; i < NUM_COMPONENTS; ++i) { - glBindTexture(GL_TEXTURE_2D, mComponents[i]); + glBindTexture(GL_TEXTURE_2D, m_components[i]); - const float w = static_cast(mWidth); - const float h = static_cast(mHeight); + const float w = static_cast(m_width); + const float h = static_cast(m_height); // Setup ortho projection glMatrixMode(GL_PROJECTION); diff --git a/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/GBuffer.h b/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/GBuffer.h index 40b40fea45..cce01485e0 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/GBuffer.h +++ b/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/GBuffer.h @@ -50,32 +50,30 @@ namespace RenderGL void Render(); - MCORE_INLINE uint32 GetTextureID(EComponent component) const { return mComponents[component]; } + MCORE_INLINE uint32 GetTextureID(EComponent component) const { return m_components[component]; } bool Resize(uint32 width, uint32 height); bool ResizeTextures(uint32 screenWidth, uint32 screenHeight); - MCORE_INLINE RenderTexture* GetRenderTargetA() { return mRenderTargetA; } - MCORE_INLINE RenderTexture* GetRenderTargetB() { return mRenderTargetB; } - MCORE_INLINE RenderTexture* GetRenderTargetC() { return mRenderTargetC; } - MCORE_INLINE RenderTexture* GetRenderTargetD() { return mRenderTargetD; } - MCORE_INLINE RenderTexture* GetRenderTargetE() { return mRenderTargetE; } + MCORE_INLINE RenderTexture* GetRenderTargetA() { return m_renderTargetA; } + MCORE_INLINE RenderTexture* GetRenderTargetB() { return m_renderTargetB; } + MCORE_INLINE RenderTexture* GetRenderTargetC() { return m_renderTargetC; } + MCORE_INLINE RenderTexture* GetRenderTargetD() { return m_renderTargetD; } + MCORE_INLINE RenderTexture* GetRenderTargetE() { return m_renderTargetE; } private: - uint32 mFBO; - uint32 mComponents[NUM_COMPONENTS]; - uint32 mDepthBufferID; - //uint32 mPrevWidth; - //uint32 mPrevHeight; - uint32 mWidth; - uint32 mHeight; + uint32 m_fbo; + uint32 m_components[NUM_COMPONENTS]; + uint32 m_depthBufferId; + uint32 m_width; + uint32 m_height; - RenderTexture* mRenderTargetA; /**< A temp render target. */ - RenderTexture* mRenderTargetB; /**< A temp render target. */ - RenderTexture* mRenderTargetC; /**< A temp render target. */ - RenderTexture* mRenderTargetD; /**< Render target with width and height divided by four. */ - RenderTexture* mRenderTargetE; /**< Render target with width and height divided by four. */ + RenderTexture* m_renderTargetA; /**< A temp render target. */ + RenderTexture* m_renderTargetB; /**< A temp render target. */ + RenderTexture* m_renderTargetC; /**< A temp render target. */ + RenderTexture* m_renderTargetD; /**< Render target with width and height divided by four. */ + RenderTexture* m_renderTargetE; /**< Render target with width and height divided by four. */ }; } // namespace RenderGL diff --git a/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/GLActor.cpp b/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/GLActor.cpp index f7f21629a3..15be9676c1 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/GLActor.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/GLActor.cpp @@ -23,12 +23,12 @@ namespace RenderGL // constructor GLActor::GLActor() { - mEnableGPUSkinning = true; - mActor = nullptr; - mEnableGPUSkinning = true; + m_enableGpuSkinning = true; + m_actor = nullptr; + m_enableGpuSkinning = true; - mSkyColor = MCore::RGBAColor(0.55f, 0.55f, 0.55f); - mGroundColor = MCore::RGBAColor(0.117f, 0.015f, 0.07f); + m_skyColor = MCore::RGBAColor(0.55f, 0.55f, 0.55f); + m_groundColor = MCore::RGBAColor(0.117f, 0.015f, 0.07f); } @@ -57,14 +57,14 @@ namespace RenderGL void GLActor::Cleanup() { // get rid of all index and vertex buffers - for (AZStd::vector& vertexBuffers : mVertexBuffers) + for (AZStd::vector& vertexBuffers : m_vertexBuffers) { for (VertexBuffer* vertexBuffer : vertexBuffers) { delete vertexBuffer; } } - for (AZStd::vector& indexBuffers : mIndexBuffers) + for (AZStd::vector& indexBuffers : m_indexBuffers) { for (IndexBuffer* indexBuffer : indexBuffers) { @@ -73,11 +73,11 @@ namespace RenderGL } // delete all materials - for (AZStd::vector& materialsPerLod : mMaterials) + for (AZStd::vector& materialsPerLod : m_materials) { for (MaterialPrimitives* materialPrimitives : materialsPerLod) { - delete materialPrimitives->mMaterial; + delete materialPrimitives->m_material; delete materialPrimitives; } } @@ -88,7 +88,7 @@ namespace RenderGL EMotionFX::Mesh::EMeshType GLActor::ClassifyMeshType(EMotionFX::Node* node, EMotionFX::Mesh* mesh, size_t lodLevel) { MCORE_ASSERT(node && mesh); - return mesh->ClassifyMeshType(lodLevel, mActor, node->GetNodeIndex(), !mEnableGPUSkinning, 4, 200); + return mesh->ClassifyMeshType(lodLevel, m_actor, node->GetNodeIndex(), !m_enableGpuSkinning, 4, 200); } @@ -102,35 +102,35 @@ namespace RenderGL AZ::Debug::Timer initTimer; initTimer.Stamp(); - mActor = actor; - mEnableGPUSkinning = gpuSkinning; - mTexturePath = texturePath; + m_actor = actor; + m_enableGpuSkinning = gpuSkinning; + m_texturePath = texturePath; // get the number of nodes and geometry LOD levels const size_t numGeometryLODLevels = actor->GetNumLODLevels(); const size_t numNodes = actor->GetNumNodes(); // set the pre-allocation amount for the number of materials - mMaterials.resize(numGeometryLODLevels); + m_materials.resize(numGeometryLODLevels); // resize the vertex and index buffers - for (AZStd::vector& vertexBuffers : mVertexBuffers) + for (AZStd::vector& vertexBuffers : m_vertexBuffers) { vertexBuffers.resize(numGeometryLODLevels); AZStd::fill(begin(vertexBuffers), end(vertexBuffers), nullptr); } - for (AZStd::vector& indexBuffers : mIndexBuffers) + for (AZStd::vector& indexBuffers : m_indexBuffers) { indexBuffers.resize(numGeometryLODLevels); AZStd::fill(begin(indexBuffers), end(indexBuffers), nullptr); } - for (MCore::Array2D& primitives : mPrimitives) + for (MCore::Array2D& primitives : m_primitives) { primitives.Resize(numGeometryLODLevels); } - mHomoMaterials.resize(numGeometryLODLevels); - mDynamicNodes.Resize (numGeometryLODLevels); + m_homoMaterials.resize(numGeometryLODLevels); + m_dynamicNodes.Resize (numGeometryLODLevels); EMotionFX::Skeleton* skeleton = actor->GetSkeleton(); @@ -174,27 +174,27 @@ namespace RenderGL // create and add the primitive Primitive newPrimitive; - newPrimitive.mNodeIndex = n; - newPrimitive.mNumVertices = subMesh->GetNumVertices(); - newPrimitive.mNumTriangles = subMesh->CalcNumTriangles(); // subMesh->GetNumIndices() / 3; - newPrimitive.mIndexOffset = totalNumIndices[ meshType ]; - newPrimitive.mVertexOffset = totalNumVerts[ meshType ]; - newPrimitive.mMaterialIndex = 0; // Since GL actor only uses the default material, we should only pass in 0. + newPrimitive.m_nodeIndex = n; + newPrimitive.m_numVertices = subMesh->GetNumVertices(); + newPrimitive.m_numTriangles = subMesh->CalcNumTriangles(); // subMesh->GetNumIndices() / 3; + newPrimitive.m_indexOffset = totalNumIndices[ meshType ]; + newPrimitive.m_vertexOffset = totalNumVerts[ meshType ]; + newPrimitive.m_materialIndex = 0; // Since GL actor only uses the default material, we should only pass in 0. // copy over the used bones from the submesh if (subMesh->GetNumBones() > 0) { - newPrimitive.mBoneNodeIndices = subMesh->GetBonesArray(); + newPrimitive.m_boneNodeIndices = subMesh->GetBonesArray(); } // add to primitive list - mPrimitives[meshType].Add(lodLevel, newPrimitive); + m_primitives[meshType].Add(lodLevel, newPrimitive); // add to material list - MaterialPrimitives* materialPrims = mMaterials[lodLevel][newPrimitive.mMaterialIndex]; - materialPrims->mPrimitives[meshType].emplace_back(newPrimitive); + MaterialPrimitives* materialPrims = m_materials[lodLevel][newPrimitive.m_materialIndex]; + materialPrims->m_primitives[meshType].emplace_back(newPrimitive); - totalNumIndices[meshType] += newPrimitive.mNumTriangles * 3; + totalNumIndices[meshType] += newPrimitive.m_numTriangles * 3; totalNumVerts[meshType] += subMesh->GetNumVertices(); } @@ -202,7 +202,7 @@ namespace RenderGL // add dynamic meshes to the dynamic node list if (meshType == EMotionFX::Mesh::MESHTYPE_CPU_DEFORMED) { - mDynamicNodes.Add(lodLevel, node->GetNodeIndex()); + m_dynamicNodes.Add(lodLevel, node->GetNodeIndex()); } } @@ -210,11 +210,11 @@ namespace RenderGL const size_t numDynamicBytes = sizeof(StandardVertex) * totalNumVerts[EMotionFX::Mesh::MESHTYPE_CPU_DEFORMED]; if (numDynamicBytes > 0) { - mVertexBuffers[EMotionFX::Mesh::MESHTYPE_CPU_DEFORMED][lodLevel] = new VertexBuffer(); - mIndexBuffers [EMotionFX::Mesh::MESHTYPE_CPU_DEFORMED][lodLevel] = new IndexBuffer(); + m_vertexBuffers[EMotionFX::Mesh::MESHTYPE_CPU_DEFORMED][lodLevel] = new VertexBuffer(); + m_indexBuffers [EMotionFX::Mesh::MESHTYPE_CPU_DEFORMED][lodLevel] = new IndexBuffer(); - const bool vbSuccess = mVertexBuffers[EMotionFX::Mesh::MESHTYPE_CPU_DEFORMED][lodLevel]->Init(sizeof(StandardVertex), totalNumVerts[EMotionFX::Mesh::MESHTYPE_CPU_DEFORMED], USAGE_DYNAMIC); - const bool ibSuccess = mIndexBuffers [EMotionFX::Mesh::MESHTYPE_CPU_DEFORMED][lodLevel]->Init(IndexBuffer::INDEXSIZE_32BIT, totalNumIndices[EMotionFX::Mesh::MESHTYPE_CPU_DEFORMED], USAGE_STATIC); + const bool vbSuccess = m_vertexBuffers[EMotionFX::Mesh::MESHTYPE_CPU_DEFORMED][lodLevel]->Init(sizeof(StandardVertex), totalNumVerts[EMotionFX::Mesh::MESHTYPE_CPU_DEFORMED], USAGE_DYNAMIC); + const bool ibSuccess = m_indexBuffers [EMotionFX::Mesh::MESHTYPE_CPU_DEFORMED][lodLevel]->Init(IndexBuffer::INDEXSIZE_32BIT, totalNumIndices[EMotionFX::Mesh::MESHTYPE_CPU_DEFORMED], USAGE_STATIC); // check if the vertex and index buffers are valid if (vbSuccess == false || ibSuccess == false) @@ -228,11 +228,11 @@ namespace RenderGL const size_t numStaticBytes = sizeof(StandardVertex) * totalNumVerts[EMotionFX::Mesh::MESHTYPE_STATIC]; if (numStaticBytes > 0) { - mVertexBuffers[EMotionFX::Mesh::MESHTYPE_STATIC][lodLevel] = new VertexBuffer(); - mIndexBuffers [EMotionFX::Mesh::MESHTYPE_STATIC][lodLevel] = new IndexBuffer(); + m_vertexBuffers[EMotionFX::Mesh::MESHTYPE_STATIC][lodLevel] = new VertexBuffer(); + m_indexBuffers [EMotionFX::Mesh::MESHTYPE_STATIC][lodLevel] = new IndexBuffer(); - const bool vbSuccess = mVertexBuffers[EMotionFX::Mesh::MESHTYPE_STATIC][lodLevel]->Init(sizeof(StandardVertex), totalNumVerts[EMotionFX::Mesh::MESHTYPE_STATIC], USAGE_STATIC); - const bool ibSuccess = mIndexBuffers [EMotionFX::Mesh::MESHTYPE_STATIC][lodLevel]->Init(IndexBuffer::INDEXSIZE_32BIT, totalNumIndices[EMotionFX::Mesh::MESHTYPE_STATIC], USAGE_STATIC); + const bool vbSuccess = m_vertexBuffers[EMotionFX::Mesh::MESHTYPE_STATIC][lodLevel]->Init(sizeof(StandardVertex), totalNumVerts[EMotionFX::Mesh::MESHTYPE_STATIC], USAGE_STATIC); + const bool ibSuccess = m_indexBuffers [EMotionFX::Mesh::MESHTYPE_STATIC][lodLevel]->Init(IndexBuffer::INDEXSIZE_32BIT, totalNumIndices[EMotionFX::Mesh::MESHTYPE_STATIC], USAGE_STATIC); // check if the vertex and index buffers are valid if (vbSuccess == false || ibSuccess == false) @@ -246,11 +246,11 @@ namespace RenderGL const size_t numSkinnedBytes = sizeof(SkinnedVertex) * totalNumVerts[EMotionFX::Mesh::MESHTYPE_GPU_DEFORMED]; if (numSkinnedBytes > 0) { - mVertexBuffers[EMotionFX::Mesh::MESHTYPE_GPU_DEFORMED][lodLevel] = new VertexBuffer(); - mIndexBuffers [EMotionFX::Mesh::MESHTYPE_GPU_DEFORMED][lodLevel] = new IndexBuffer(); + m_vertexBuffers[EMotionFX::Mesh::MESHTYPE_GPU_DEFORMED][lodLevel] = new VertexBuffer(); + m_indexBuffers [EMotionFX::Mesh::MESHTYPE_GPU_DEFORMED][lodLevel] = new IndexBuffer(); - const bool vbSuccess = mVertexBuffers[EMotionFX::Mesh::MESHTYPE_GPU_DEFORMED][lodLevel]->Init(sizeof(SkinnedVertex), totalNumVerts[EMotionFX::Mesh::MESHTYPE_GPU_DEFORMED], USAGE_STATIC); - const bool ibSuccess = mIndexBuffers [EMotionFX::Mesh::MESHTYPE_GPU_DEFORMED][lodLevel]->Init(IndexBuffer::INDEXSIZE_32BIT, totalNumIndices[EMotionFX::Mesh::MESHTYPE_GPU_DEFORMED], USAGE_STATIC); + const bool vbSuccess = m_vertexBuffers[EMotionFX::Mesh::MESHTYPE_GPU_DEFORMED][lodLevel]->Init(sizeof(SkinnedVertex), totalNumVerts[EMotionFX::Mesh::MESHTYPE_GPU_DEFORMED], USAGE_STATIC); + const bool ibSuccess = m_indexBuffers [EMotionFX::Mesh::MESHTYPE_GPU_DEFORMED][lodLevel]->Init(IndexBuffer::INDEXSIZE_32BIT, totalNumIndices[EMotionFX::Mesh::MESHTYPE_GPU_DEFORMED], USAGE_STATIC); // check if the vertex and index buffers are valid if (vbSuccess == false || ibSuccess == false) @@ -344,7 +344,7 @@ namespace RenderGL // fallback to standard material MCore::LogWarning("[OpenGL] Cannot initialize OpenGL material for material '%s'. Falling back to default material.", emfxMaterial->GetName()); StandardMaterial* material = new RenderGL::StandardMaterial(this); - material->Init((EMotionFX::StandardMaterial*)mActor->GetMaterial(0, 0)); + material->Init((EMotionFX::StandardMaterial*)m_actor->GetMaterial(0, 0)); return material; } } @@ -354,12 +354,12 @@ namespace RenderGL void GLActor::InitMaterials(size_t lodLevel) { // get the number of materials and iterate through them - const size_t numMaterials = mActor->GetNumMaterials(lodLevel); + const size_t numMaterials = m_actor->GetNumMaterials(lodLevel); for (size_t m = 0; m < numMaterials; ++m) { - EMotionFX::Material* emfxMaterial = mActor->GetMaterial(lodLevel, m); + EMotionFX::Material* emfxMaterial = m_actor->GetMaterial(lodLevel, m); Material* material = InitMaterial(emfxMaterial); - mMaterials[lodLevel].emplace_back( new MaterialPrimitives(material) ); + m_materials[lodLevel].emplace_back( new MaterialPrimitives(material) ); } } @@ -367,13 +367,13 @@ namespace RenderGL // render the given actor instance void GLActor::Render(EMotionFX::ActorInstance* actorInstance, uint32 renderFlags) { - if (!mActor->IsReady()) + if (!m_actor->IsReady()) { return; } // make sure our actor instance is valid and that we initialized the gl actor - assert(mActor && actorInstance); + assert(m_actor && actorInstance); // update the dynamic vertices (copy dynamic vertices from system memory into the vertex buffer) UpdateDynamicVertices(actorInstance); @@ -398,36 +398,36 @@ namespace RenderGL void GLActor::RenderMeshes(EMotionFX::ActorInstance* actorInstance, EMotionFX::Mesh::EMeshType meshType, uint32 renderFlags) { const size_t lodLevel = actorInstance->GetLODLevel(); - const size_t numMaterials = mMaterials[lodLevel].size(); + const size_t numMaterials = m_materials[lodLevel].size(); if (numMaterials == 0) { return; } - if (mVertexBuffers[meshType][lodLevel] == nullptr || mIndexBuffers[meshType][lodLevel] == nullptr) + if (m_vertexBuffers[meshType][lodLevel] == nullptr || m_indexBuffers[meshType][lodLevel] == nullptr) { return; } - if (mVertexBuffers[meshType][lodLevel]->GetBufferID() == MCORE_INVALIDINDEX32) + if (m_vertexBuffers[meshType][lodLevel]->GetBufferID() == MCORE_INVALIDINDEX32) { return; } // activate vertex and index buffers - mVertexBuffers[meshType][lodLevel]->Activate(); - mIndexBuffers[meshType][lodLevel]->Activate(); + m_vertexBuffers[meshType][lodLevel]->Activate(); + m_indexBuffers[meshType][lodLevel]->Activate(); // render all the primitives in each material - for (const MaterialPrimitives* materialPrims : mMaterials[lodLevel]) + for (const MaterialPrimitives* materialPrims : m_materials[lodLevel]) { - if (materialPrims->mPrimitives[meshType].empty()) + if (materialPrims->m_primitives[meshType].empty()) { continue; } - Material* material = materialPrims->mMaterial; + Material* material = materialPrims->m_material; if (material == nullptr) { continue; @@ -443,7 +443,7 @@ namespace RenderGL material->Activate(activationFlags); // render all primitives - for (const Primitive& primitive : materialPrims->mPrimitives[meshType]) + for (const Primitive& primitive : materialPrims->m_primitives[meshType]) { material->Render(actorInstance, &primitive); } @@ -458,19 +458,19 @@ namespace RenderGL { // get the number of dynamic nodes const size_t lodLevel = actorInstance->GetLODLevel(); - const size_t numNodes = mDynamicNodes.GetNumElements(lodLevel); + const size_t numNodes = m_dynamicNodes.GetNumElements(lodLevel); if (numNodes == 0) { return; } - if (mVertexBuffers[EMotionFX::Mesh::MESHTYPE_CPU_DEFORMED][lodLevel] == nullptr) + if (m_vertexBuffers[EMotionFX::Mesh::MESHTYPE_CPU_DEFORMED][lodLevel] == nullptr) { return; } // lock the dynamic vertex buffer - StandardVertex* dynamicVertices = (StandardVertex*)mVertexBuffers[EMotionFX::Mesh::MESHTYPE_CPU_DEFORMED][lodLevel]->Lock(LOCK_WRITEONLY); + StandardVertex* dynamicVertices = (StandardVertex*)m_vertexBuffers[EMotionFX::Mesh::MESHTYPE_CPU_DEFORMED][lodLevel]->Lock(LOCK_WRITEONLY); if (dynamicVertices == nullptr) { return; @@ -483,8 +483,8 @@ namespace RenderGL for (size_t n = 0; n < numNodes; ++n) { // get the node and its mesh - const size_t nodeIndex = mDynamicNodes.GetElement(lodLevel, n); - EMotionFX::Mesh* mesh = mActor->GetMesh(lodLevel, nodeIndex); + const size_t nodeIndex = m_dynamicNodes.GetElement(lodLevel, n); + EMotionFX::Mesh* mesh = m_actor->GetMesh(lodLevel, nodeIndex); // is the mesh valid? if (mesh == nullptr) @@ -503,10 +503,10 @@ namespace RenderGL { for (uint32 v = 0; v < numVertices; ++v) { - dynamicVertices[globalVert].mPosition = positions[v]; - dynamicVertices[globalVert].mNormal = normals[v]; - dynamicVertices[globalVert].mUV = uvsA[v]; - dynamicVertices[globalVert].mTangent = (tangents) ? tangents[v] : AZ::Vector4(0.0f, 0.0f, 1.0f, 1.0f); + dynamicVertices[globalVert].m_position = positions[v]; + dynamicVertices[globalVert].m_normal = normals[v]; + dynamicVertices[globalVert].m_uv = uvsA[v]; + dynamicVertices[globalVert].m_tangent = (tangents) ? tangents[v] : AZ::Vector4(0.0f, 0.0f, 1.0f, 1.0f); globalVert++; } } @@ -514,17 +514,17 @@ namespace RenderGL { for (uint32 v = 0; v < numVertices; ++v) { - dynamicVertices[globalVert].mPosition = positions[v]; - dynamicVertices[globalVert].mNormal = normals[v]; - dynamicVertices[globalVert].mUV = AZ::Vector2(0.0f, 0.0f); - dynamicVertices[globalVert].mTangent = (tangents) ? tangents[v] : AZ::Vector4(0.0f, 0.0f, 1.0f, 1.0f); + dynamicVertices[globalVert].m_position = positions[v]; + dynamicVertices[globalVert].m_normal = normals[v]; + dynamicVertices[globalVert].m_uv = AZ::Vector2(0.0f, 0.0f); + dynamicVertices[globalVert].m_tangent = (tangents) ? tangents[v] : AZ::Vector4(0.0f, 0.0f, 1.0f, 1.0f); globalVert++; } } } // unlock the vertex buffer - mVertexBuffers[EMotionFX::Mesh::MESHTYPE_CPU_DEFORMED][lodLevel]->Unlock(); + m_vertexBuffers[EMotionFX::Mesh::MESHTYPE_CPU_DEFORMED][lodLevel]->Unlock(); } @@ -537,23 +537,23 @@ namespace RenderGL uint32* skinnedIndices = nullptr; // lock the index buffers - if (mIndexBuffers[EMotionFX::Mesh::MESHTYPE_STATIC][lodLevel]) + if (m_indexBuffers[EMotionFX::Mesh::MESHTYPE_STATIC][lodLevel]) { - staticIndices = (uint32*)mIndexBuffers[EMotionFX::Mesh::MESHTYPE_STATIC][lodLevel]->Lock(LOCK_WRITEONLY); + staticIndices = (uint32*)m_indexBuffers[EMotionFX::Mesh::MESHTYPE_STATIC][lodLevel]->Lock(LOCK_WRITEONLY); } - if (mIndexBuffers[EMotionFX::Mesh::MESHTYPE_CPU_DEFORMED][lodLevel]) + if (m_indexBuffers[EMotionFX::Mesh::MESHTYPE_CPU_DEFORMED][lodLevel]) { - dynamicIndices = (uint32*)mIndexBuffers[EMotionFX::Mesh::MESHTYPE_CPU_DEFORMED][lodLevel]->Lock(LOCK_WRITEONLY); + dynamicIndices = (uint32*)m_indexBuffers[EMotionFX::Mesh::MESHTYPE_CPU_DEFORMED][lodLevel]->Lock(LOCK_WRITEONLY); } - if (mIndexBuffers[EMotionFX::Mesh::MESHTYPE_GPU_DEFORMED][lodLevel]) + if (m_indexBuffers[EMotionFX::Mesh::MESHTYPE_GPU_DEFORMED][lodLevel]) { - skinnedIndices = (uint32*)mIndexBuffers[EMotionFX::Mesh::MESHTYPE_GPU_DEFORMED][lodLevel]->Lock(LOCK_WRITEONLY); + skinnedIndices = (uint32*)m_indexBuffers[EMotionFX::Mesh::MESHTYPE_GPU_DEFORMED][lodLevel]->Lock(LOCK_WRITEONLY); } //if (staticIndices == nullptr || dynamicIndices == nullptr || skinnedIndices == nullptr) - if ((mIndexBuffers[EMotionFX::Mesh::MESHTYPE_STATIC][lodLevel] && staticIndices == nullptr) || - (mIndexBuffers[EMotionFX::Mesh::MESHTYPE_CPU_DEFORMED][lodLevel] && dynamicIndices == nullptr) || - (mIndexBuffers[EMotionFX::Mesh::MESHTYPE_GPU_DEFORMED][lodLevel] && skinnedIndices == nullptr)) + if ((m_indexBuffers[EMotionFX::Mesh::MESHTYPE_STATIC][lodLevel] && staticIndices == nullptr) || + (m_indexBuffers[EMotionFX::Mesh::MESHTYPE_CPU_DEFORMED][lodLevel] && dynamicIndices == nullptr) || + (m_indexBuffers[EMotionFX::Mesh::MESHTYPE_GPU_DEFORMED][lodLevel] && skinnedIndices == nullptr)) { MCore::LogWarning("[OpenGL] Cannot lock index buffers in GLActor::FillIndexBuffers."); return; @@ -567,17 +567,17 @@ namespace RenderGL uint32 staticOffset = 0; uint32 gpuSkinnedOffset = 0; - EMotionFX::Skeleton* skeleton = mActor->GetSkeleton(); + EMotionFX::Skeleton* skeleton = m_actor->GetSkeleton(); // get the number of nodes and iterate through them - const size_t numNodes = mActor->GetNumNodes(); + const size_t numNodes = m_actor->GetNumNodes(); for (size_t n = 0; n < numNodes; ++n) { // get the current node EMotionFX::Node* node = skeleton->GetNode(n); // get the mesh for the node, if there is any - EMotionFX::Mesh* mesh = mActor->GetMesh(lodLevel, n); + EMotionFX::Mesh* mesh = m_actor->GetMesh(lodLevel, n); if (mesh == nullptr) { continue; @@ -662,15 +662,15 @@ namespace RenderGL // unlock the buffers if (staticIndices) { - mIndexBuffers[EMotionFX::Mesh::MESHTYPE_STATIC][lodLevel]->Unlock(); + m_indexBuffers[EMotionFX::Mesh::MESHTYPE_STATIC][lodLevel]->Unlock(); } if (dynamicIndices) { - mIndexBuffers[EMotionFX::Mesh::MESHTYPE_CPU_DEFORMED][lodLevel]->Unlock(); + m_indexBuffers[EMotionFX::Mesh::MESHTYPE_CPU_DEFORMED][lodLevel]->Unlock(); } if (skinnedIndices) { - mIndexBuffers[EMotionFX::Mesh::MESHTYPE_GPU_DEFORMED][lodLevel]->Unlock(); + m_indexBuffers[EMotionFX::Mesh::MESHTYPE_GPU_DEFORMED][lodLevel]->Unlock(); } } @@ -678,22 +678,22 @@ namespace RenderGL // fill the static vertex buffer void GLActor::FillStaticVertexBuffers(size_t lodLevel) { - if (mVertexBuffers[EMotionFX::Mesh::MESHTYPE_STATIC][lodLevel] == nullptr) + if (m_vertexBuffers[EMotionFX::Mesh::MESHTYPE_STATIC][lodLevel] == nullptr) { return; } // get the number of nodes - const size_t numNodes = mActor->GetNumNodes(); + const size_t numNodes = m_actor->GetNumNodes(); if (numNodes == 0) { return; } - EMotionFX::Skeleton* skeleton = mActor->GetSkeleton(); + EMotionFX::Skeleton* skeleton = m_actor->GetSkeleton(); // lock the static vertex buffer - StandardVertex* staticVertices = (StandardVertex*)mVertexBuffers[EMotionFX::Mesh::MESHTYPE_STATIC][lodLevel]->Lock(LOCK_WRITEONLY); + StandardVertex* staticVertices = (StandardVertex*)m_vertexBuffers[EMotionFX::Mesh::MESHTYPE_STATIC][lodLevel]->Lock(LOCK_WRITEONLY); if (staticVertices == nullptr) { return; @@ -709,7 +709,7 @@ namespace RenderGL EMotionFX::Node* node = skeleton->GetNode(n); // get the mesh for the node, if there is any - EMotionFX::Mesh* mesh = mActor->GetMesh(lodLevel, n); + EMotionFX::Mesh* mesh = m_actor->GetMesh(lodLevel, n); if (mesh == nullptr) { continue; @@ -739,10 +739,10 @@ namespace RenderGL const uint32 numVerts = mesh->GetNumVertices(); for (uint32 v = 0; v < numVerts; ++v) { - staticVertices[globalVert].mPosition = positions[v]; - staticVertices[globalVert].mNormal = normals[v]; - staticVertices[globalVert].mUV = uvsA[v]; - staticVertices[globalVert].mTangent = (tangents) ? tangents[v] : AZ::Vector4(0.0f, 0.0f, 1.0f, 1.0f); + staticVertices[globalVert].m_position = positions[v]; + staticVertices[globalVert].m_normal = normals[v]; + staticVertices[globalVert].m_uv = uvsA[v]; + staticVertices[globalVert].m_tangent = (tangents) ? tangents[v] : AZ::Vector4(0.0f, 0.0f, 1.0f, 1.0f); globalVert++; } } @@ -751,39 +751,39 @@ namespace RenderGL const uint32 numVerts = mesh->GetNumVertices(); for (uint32 v = 0; v < numVerts; ++v) { - staticVertices[globalVert].mPosition = positions[v]; - staticVertices[globalVert].mNormal = normals[v]; - staticVertices[globalVert].mUV = AZ::Vector2(0.0f, 0.0f); - staticVertices[globalVert].mTangent = (tangents) ? tangents[v] : AZ::Vector4(0.0f, 0.0f, 1.0f, 1.0f); + staticVertices[globalVert].m_position = positions[v]; + staticVertices[globalVert].m_normal = normals[v]; + staticVertices[globalVert].m_uv = AZ::Vector2(0.0f, 0.0f); + staticVertices[globalVert].m_tangent = (tangents) ? tangents[v] : AZ::Vector4(0.0f, 0.0f, 1.0f, 1.0f); globalVert++; } } } // unlock the vertex buffer - mVertexBuffers[EMotionFX::Mesh::MESHTYPE_STATIC][lodLevel]->Unlock(); + m_vertexBuffers[EMotionFX::Mesh::MESHTYPE_STATIC][lodLevel]->Unlock(); } // fill the GPU skinned vertex buffer void GLActor::FillGPUSkinnedVertexBuffers(size_t lodLevel) { - if (mVertexBuffers[EMotionFX::Mesh::MESHTYPE_GPU_DEFORMED][lodLevel] == nullptr) + if (m_vertexBuffers[EMotionFX::Mesh::MESHTYPE_GPU_DEFORMED][lodLevel] == nullptr) { return; } // get the number of dynamic nodes - const size_t numNodes = mActor->GetNumNodes(); + const size_t numNodes = m_actor->GetNumNodes(); if (numNodes == 0) { return; } - EMotionFX::Skeleton* skeleton = mActor->GetSkeleton(); + EMotionFX::Skeleton* skeleton = m_actor->GetSkeleton(); // lock the GPU skinned vertex buffer - SkinnedVertex* skinnedVertices = (SkinnedVertex*)mVertexBuffers[EMotionFX::Mesh::MESHTYPE_GPU_DEFORMED][lodLevel]->Lock(LOCK_WRITEONLY); + SkinnedVertex* skinnedVertices = (SkinnedVertex*)m_vertexBuffers[EMotionFX::Mesh::MESHTYPE_GPU_DEFORMED][lodLevel]->Lock(LOCK_WRITEONLY); if (skinnedVertices == nullptr) { return; @@ -799,7 +799,7 @@ namespace RenderGL EMotionFX::Node* node = skeleton->GetNode(n); // get the mesh for the node, if there is any - EMotionFX::Mesh* mesh = mActor->GetMesh(lodLevel, n); + EMotionFX::Mesh* mesh = m_actor->GetMesh(lodLevel, n); if (mesh == nullptr) { continue; @@ -845,10 +845,10 @@ namespace RenderGL const uint32 orgVertex = orgVerts[meshVertexNr]; // copy position and normal - skinnedVertices[globalVert].mPosition = positions[meshVertexNr]; - skinnedVertices[globalVert].mNormal = normals[meshVertexNr]; - skinnedVertices[globalVert].mTangent = (tangents) ? tangents[meshVertexNr] : AZ::Vector4(0.0f, 0.0f, 1.0f, 1.0f); - skinnedVertices[globalVert].mUV = (uvsA == nullptr) ? AZ::Vector2(0.0f, 0.0f) : uvsA[meshVertexNr]; + skinnedVertices[globalVert].m_position = positions[meshVertexNr]; + skinnedVertices[globalVert].m_normal = normals[meshVertexNr]; + skinnedVertices[globalVert].m_tangent = (tangents) ? tangents[meshVertexNr] : AZ::Vector4(0.0f, 0.0f, 1.0f, 1.0f); + skinnedVertices[globalVert].m_uv = (uvsA == nullptr) ? AZ::Vector2(0.0f, 0.0f) : uvsA[meshVertexNr]; // get the number of influences and iterate through them const size_t numInfluences = skinningInfo->GetNumInfluences(orgVertex); @@ -857,17 +857,17 @@ namespace RenderGL { // get the influence and its weight and set the indices EMotionFX::SkinInfluence* influence = skinningInfo->GetInfluence(orgVertex, i); - skinnedVertices[globalVert].mWeights[i] = influence->GetWeight(); + skinnedVertices[globalVert].m_weights[i] = influence->GetWeight(); const size_t boneIndex = subMesh->FindBoneIndex(influence->GetNodeNr()); - skinnedVertices[globalVert].mBoneIndices[i] = static_cast(boneIndex); + skinnedVertices[globalVert].m_boneIndices[i] = static_cast(boneIndex); MCORE_ASSERT(boneIndex != InvalidIndex); } // reset remaining weights and offsets for (size_t a = i; a < 4; ++a) { - skinnedVertices[globalVert].mWeights[a] = 0.0f; - skinnedVertices[globalVert].mBoneIndices[a] = 0; + skinnedVertices[globalVert].m_weights[a] = 0.0f; + skinnedVertices[globalVert].m_boneIndices[a] = 0; } globalVert++; @@ -876,6 +876,6 @@ namespace RenderGL } // unlock the vertex buffer - mVertexBuffers[EMotionFX::Mesh::MESHTYPE_GPU_DEFORMED][lodLevel]->Unlock(); + m_vertexBuffers[EMotionFX::Mesh::MESHTYPE_GPU_DEFORMED][lodLevel]->Unlock(); } } diff --git a/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/GLExtensions.cpp b/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/GLExtensions.cpp index 83ae498682..91ee24876e 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/GLExtensions.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/GLExtensions.cpp @@ -17,7 +17,7 @@ namespace RenderGL { bool ok = true; - ok &= bool((glMapBuffer = (_glMapBuffer)context->getProcAddress(QByteArray("glMapBuffer")))); + ok &= bool((m_glMapBuffer = (_glMapBuffer)context->getProcAddress(QByteArray("glMapBuffer")))); return ok; }; diff --git a/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/GLExtensions.h b/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/GLExtensions.h index 1eea2209ec..934d73b29e 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/GLExtensions.h +++ b/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/GLExtensions.h @@ -21,7 +21,7 @@ namespace RenderGL { bool resolve(const QOpenGLContext* context); - _glMapBuffer glMapBuffer; + _glMapBuffer m_glMapBuffer; }; } // namespace RenderGL diff --git a/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/GLRenderUtil.cpp b/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/GLRenderUtil.cpp index d53a7b0f72..734b57e96b 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/GLRenderUtil.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/GLRenderUtil.cpp @@ -26,61 +26,61 @@ namespace RenderGL : RenderUtil() { // set/reset the member variables - mGraphicsManager = graphicsManager; - mLineShader = nullptr; - mMeshShader = nullptr; - mMeshVertexBuffer = nullptr; - mMeshIndexBuffer = nullptr; + m_graphicsManager = graphicsManager; + m_lineShader = nullptr; + m_meshShader = nullptr; + m_meshVertexBuffer = nullptr; + m_meshIndexBuffer = nullptr; - mTriangleVertexBuffer = nullptr; - mTriangleIndexBuffer = nullptr; + m_triangleVertexBuffer = nullptr; + m_triangleIndexBuffer = nullptr; - mCurrentLineVB = 0; + m_currentLineVb = 0; // initialize the vertex buffers and the shader used for line rendering - for (VertexBuffer*& lineVertexBuffer : mLineVertexBuffers) + for (VertexBuffer*& lineVertexBuffer : m_lineVertexBuffers) { lineVertexBuffer = new VertexBuffer(); - if (lineVertexBuffer->Init(sizeof(LineVertex), mNumMaxLineVertices, USAGE_DYNAMIC) == false) + if (lineVertexBuffer->Init(sizeof(LineVertex), s_numMaxLineVertices, USAGE_DYNAMIC) == false) { MCore::LogError("[OpenGL] Failed to create render utility line vertex buffer."); CleanUp(); } } - mLineShader = graphicsManager->LoadShader("Line_VS.glsl", "Line_PS.glsl"); + m_lineShader = graphicsManager->LoadShader("Line_VS.glsl", "Line_PS.glsl"); // initialize the vertex and the index buffers as well as the shader used for rendering util meshes - mMeshVertexBuffer = new VertexBuffer(); - mMeshIndexBuffer = new IndexBuffer(); + m_meshVertexBuffer = new VertexBuffer(); + m_meshIndexBuffer = new IndexBuffer(); - if (mMeshVertexBuffer->Init(sizeof(UtilMeshVertex), mNumMaxMeshVertices, USAGE_DYNAMIC) == false) + if (m_meshVertexBuffer->Init(sizeof(UtilMeshVertex), s_numMaxMeshVertices, USAGE_DYNAMIC) == false) { MCore::LogError("[OpenGL] Failed to create render utility mesh vertex buffer."); CleanUp(); return; } - if (mMeshIndexBuffer->Init(IndexBuffer::INDEXSIZE_32BIT, mNumMaxMeshIndices, USAGE_DYNAMIC) == false) + if (m_meshIndexBuffer->Init(IndexBuffer::INDEXSIZE_32BIT, s_numMaxMeshIndices, USAGE_DYNAMIC) == false) { MCore::LogError("[OpenGL] Failed to create render utility mesh index buffer."); CleanUp(); return; } - mMeshShader = graphicsManager->LoadShader("RenderUtil_VS.glsl", "RenderUtil_PS.glsl"); + m_meshShader = graphicsManager->LoadShader("RenderUtil_VS.glsl", "RenderUtil_PS.glsl"); // initialize the triangle rendering buffers - mTriangleVertexBuffer = new VertexBuffer(); - if (mTriangleVertexBuffer->Init(sizeof(TriangleVertex), mNumMaxTriangleVertices, USAGE_DYNAMIC) == false) + m_triangleVertexBuffer = new VertexBuffer(); + if (m_triangleVertexBuffer->Init(sizeof(TriangleVertex), s_numMaxTriangleVertices, USAGE_DYNAMIC) == false) { MCore::LogError("[OpenGL] Failed to create triangle vertex buffer."); CleanUp(); return; } - mTriangleIndexBuffer = new IndexBuffer(); - if (mTriangleIndexBuffer->Init(IndexBuffer::INDEXSIZE_32BIT, mNumMaxTriangleVertices, USAGE_STATIC) == false) + m_triangleIndexBuffer = new IndexBuffer(); + if (m_triangleIndexBuffer->Init(IndexBuffer::INDEXSIZE_32BIT, s_numMaxTriangleVertices, USAGE_STATIC) == false) { MCore::LogError("[OpenGL] Failed to create triangle index buffer."); CleanUp(); @@ -88,21 +88,21 @@ namespace RenderGL } // lock the index buffer and fill in the static indices - uint32* indices = (uint32*)mTriangleIndexBuffer->Lock(); + uint32* indices = (uint32*)m_triangleIndexBuffer->Lock(); if (indices) { - for (uint32 i = 0; i < mNumMaxTriangleVertices; ++i) + for (uint32 i = 0; i < s_numMaxTriangleVertices; ++i) { indices[i] = i; } - mTriangleIndexBuffer->Unlock(); + m_triangleIndexBuffer->Unlock(); } // texture rendering - mMaxNumTextures = 256; - mNumTextures = 0; - mTextures = new TextureEntry[mMaxNumTextures]; + m_maxNumTextures = 256; + m_numTextures = 0; + m_textures = new TextureEntry[m_maxNumTextures]; // text rendering } @@ -121,59 +121,59 @@ namespace RenderGL void GLRenderUtil::Validate() { - if (mLineShader) + if (m_lineShader) { - mLineShader->Validate(); + m_lineShader->Validate(); } - if (mMeshShader) + if (m_meshShader) { - mMeshShader->Validate(); + m_meshShader->Validate(); } } // destroy the allocated memory void GLRenderUtil::CleanUp() { - for (VertexBuffer*& lineVertexBuffer : mLineVertexBuffers) + for (VertexBuffer*& lineVertexBuffer : m_lineVertexBuffers) { delete lineVertexBuffer; lineVertexBuffer = nullptr; } - delete mMeshVertexBuffer; - delete mMeshIndexBuffer; + delete m_meshVertexBuffer; + delete m_meshIndexBuffer; - delete mTriangleVertexBuffer; - delete mTriangleIndexBuffer; + delete m_triangleVertexBuffer; + delete m_triangleIndexBuffer; - mMeshVertexBuffer = nullptr; - mMeshIndexBuffer = nullptr; + m_meshVertexBuffer = nullptr; + m_meshIndexBuffer = nullptr; - mTriangleVertexBuffer = nullptr; - mTriangleIndexBuffer = nullptr; + m_triangleVertexBuffer = nullptr; + m_triangleIndexBuffer = nullptr; - mCurrentLineVB = 0; + m_currentLineVb = 0; // get rid of the texture entries - delete[] mTextures; + delete[] m_textures; // get rid of texture entries - for (TextEntry* textEntry : mTextEntries) + for (TextEntry* textEntry : m_textEntries) { delete textEntry; } - mTextEntries.clear(); + m_textEntries.clear(); } // render texture void GLRenderUtil::RenderTexture(Texture* texture, const AZ::Vector2& pos) { - mTextures[mNumTextures].pos = pos; - mTextures[mNumTextures].texture = texture; - mNumTextures++; + m_textures[m_numTextures].m_pos = pos; + m_textures[m_numTextures].m_texture = texture; + m_numTextures++; - if (mNumTextures >= mMaxNumTextures) + if (m_numTextures >= m_maxNumTextures) { RenderTextures(); } @@ -183,7 +183,7 @@ namespace RenderGL // render textures void GLRenderUtil::RenderTextures() { - if (mNumTextures == 0) + if (m_numTextures == 0) { return; } @@ -216,41 +216,41 @@ namespace RenderGL glColor3f(1.0f, 1.0f, 1.0f); // iterate through the textures and render them - for (uint32 i = 0; i < mNumTextures; ++i) + for (uint32 i = 0; i < m_numTextures; ++i) { - TextureEntry& e = mTextures[i]; - float w = static_cast(e.texture->GetWidth()); - float h = static_cast(e.texture->GetHeight()); + TextureEntry& e = m_textures[i]; + float w = static_cast(e.m_texture->GetWidth()); + float h = static_cast(e.m_texture->GetHeight()); - glBindTexture(GL_TEXTURE_2D, e.texture->GetID()); + glBindTexture(GL_TEXTURE_2D, e.m_texture->GetID()); glBegin(GL_QUADS); glTexCoord2f(0.0f, 0.0f); - glVertex3f(e.pos.GetX(), e.pos.GetY(), -1.0f); + glVertex3f(e.m_pos.GetX(), e.m_pos.GetY(), -1.0f); glTexCoord2f(1.0f, 0.0f); - glVertex3f(e.pos.GetX() + w, e.pos.GetY(), -1.0f); + glVertex3f(e.m_pos.GetX() + w, e.m_pos.GetY(), -1.0f); glTexCoord2f(1.0f, 1.0f); - glVertex3f(e.pos.GetX() + w, e.pos.GetY() + h, -1.0f); + glVertex3f(e.m_pos.GetX() + w, e.m_pos.GetY() + h, -1.0f); glTexCoord2f(0.0f, 1.0f); - glVertex3f(e.pos.GetX(), e.pos.GetY() + h, -1.0f); + glVertex3f(e.m_pos.GetX(), e.m_pos.GetY() + h, -1.0f); glEnd(); } glPopAttrib(); - mNumTextures = 0; + m_numTextures = 0; } // overloaded render lines function void GLRenderUtil::RenderLines(LineVertex* vertices, uint32 numVertices) { - if (mLineShader == nullptr) + if (m_lineShader == nullptr) { return; } - VertexBuffer* vertexBuffer = mLineVertexBuffers[mCurrentLineVB]; + VertexBuffer* vertexBuffer = m_lineVertexBuffers[m_currentLineVb]; // copy the vertices into the OpenGL vertex buffer LineVertex* lineVertices = (LineVertex*)vertexBuffer->Lock(); @@ -265,23 +265,23 @@ namespace RenderGL glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); // setup the shader and render the lines - mLineShader->Activate(); + m_lineShader->Activate(); - mLineShader->SetAttribute("inPosition", 4, GL_FLOAT, sizeof(LineVertex), 0); - mLineShader->SetAttribute("inColor", 4, GL_FLOAT, sizeof(LineVertex), sizeof(AZ::Vector3)); - mLineShader->SetUniform("matViewProj", mGraphicsManager->GetCamera()->GetViewProjMatrix(), false); + m_lineShader->SetAttribute("inPosition", 4, GL_FLOAT, sizeof(LineVertex), 0); + m_lineShader->SetAttribute("inColor", 4, GL_FLOAT, sizeof(LineVertex), sizeof(AZ::Vector3)); + m_lineShader->SetUniform("matViewProj", m_graphicsManager->GetCamera()->GetViewProjMatrix(), false); glDrawArrays(GL_LINES, 0, numVertices); - mLineShader->Deactivate(); + m_lineShader->Deactivate(); GetGraphicsManager()->SetShader(nullptr); // if only lines are rendered, we need to unbind this shader totally // otherwise it will stay active and another context can't use it vertexBuffer->Deactivate(); - mCurrentLineVB++; - if (mCurrentLineVB >= MAX_LINE_VERTEXBUFFERS) + m_currentLineVb++; + if (m_currentLineVb >= MAX_LINE_VERTEXBUFFERS) { - mCurrentLineVB = 0; + m_currentLineVb = 0; } } @@ -311,14 +311,14 @@ namespace RenderGL glLoadIdentity(); // use the fixed function pipeline - mGraphicsManager->SetShader(nullptr); + m_graphicsManager->SetShader(nullptr); glBegin(GL_LINES); for (uint32 i = 0; i < numLines; ++i) { - glColor3f(lines[i].mColor.r, lines[i].mColor.g, lines[i].mColor.b); - glVertex3f(lines[i].mX1, lines[i].mY1, 0.0); - glVertex3f(lines[i].mX2, lines[i].mY2, 0.0); + glColor3f(lines[i].m_color.m_r, lines[i].m_color.m_g, lines[i].m_color.m_b); + glVertex3f(lines[i].m_x1, lines[i].m_y1, 0.0); + glVertex3f(lines[i].m_x2, lines[i].m_y2, 0.0); } glEnd(); @@ -350,9 +350,9 @@ namespace RenderGL glLoadIdentity(); // use the fixed function pipeline - mGraphicsManager->SetShader(nullptr); + m_graphicsManager->SetShader(nullptr); - glColor3f(fillColor.r, fillColor.g, fillColor.b); + glColor3f(fillColor.m_r, fillColor.m_g, fillColor.m_b); glBegin(GL_QUADS); glVertex3i(left, top, 0); glVertex3i(left, bottom, 0); @@ -372,65 +372,65 @@ namespace RenderGL // overloaded render util mesh function void GLRenderUtil::RenderUtilMesh(UtilMesh* mesh, const MCore::RGBAColor& color, const AZ::Transform& globalTM) { - if (mMeshShader == nullptr) + if (m_meshShader == nullptr) { return; } // lock the vertex and the index buffer - UtilMeshVertex* vertices = (UtilMeshVertex*)mMeshVertexBuffer->Lock(); - uint32* indices = (uint32*)mMeshIndexBuffer->Lock(); + UtilMeshVertex* vertices = (UtilMeshVertex*)m_meshVertexBuffer->Lock(); + uint32* indices = (uint32*)m_meshIndexBuffer->Lock(); // copy the vertices and the indices into the OpenGL buffers - MCORE_ASSERT(mesh->mPositions.size() <= mNumMaxMeshVertices); - MCore::MemCopy(indices, mesh->mIndices.data(), mesh->mIndices.size() * sizeof(uint32)); + MCORE_ASSERT(mesh->m_positions.size() <= s_numMaxMeshVertices); + MCore::MemCopy(indices, mesh->m_indices.data(), mesh->m_indices.size() * sizeof(uint32)); - if (mesh->mNormals.empty()) + if (mesh->m_normals.empty()) { - const size_t numVertices = mesh->mPositions.size(); + const size_t numVertices = mesh->m_positions.size(); for (size_t i = 0; i < numVertices; ++i) { - vertices[i].mPosition = mesh->mPositions[i]; - vertices[i].mNormal = AZ::Vector3(1.0f, 0.0f, 0.0f); + vertices[i].m_position = mesh->m_positions[i]; + vertices[i].m_normal = AZ::Vector3(1.0f, 0.0f, 0.0f); } } else { - const size_t numVertices = mesh->mPositions.size(); + const size_t numVertices = mesh->m_positions.size(); for (size_t i = 0; i < numVertices; ++i) { - vertices[i].mPosition = mesh->mPositions[i]; - vertices[i].mNormal = mesh->mNormals[i]; + vertices[i].m_position = mesh->m_positions[i]; + vertices[i].m_normal = mesh->m_normals[i]; } } // unlock and activate the vertex and the index buffer - mMeshVertexBuffer->Unlock(); - mMeshIndexBuffer->Unlock(); - mMeshVertexBuffer->Activate(); - mMeshIndexBuffer->Activate(); + m_meshVertexBuffer->Unlock(); + m_meshIndexBuffer->Unlock(); + m_meshVertexBuffer->Activate(); + m_meshIndexBuffer->Activate(); // setup shader - mMeshShader->Activate(); + m_meshShader->Activate(); - MCommon::Camera* camera = mGraphicsManager->GetCamera(); + MCommon::Camera* camera = m_graphicsManager->GetCamera(); const AZ::Matrix4x4 globalMatrix = AZ::Matrix4x4::CreateFromTransform(globalTM); - mMeshShader->SetUniform("worldViewProjectionMatrix", camera->GetViewProjMatrix() * globalMatrix); - mMeshShader->SetUniform("cameraPosition", camera->GetPosition()); - mMeshShader->SetUniform("lightDirection", MCore::GetUp(camera->GetViewMatrix().GetTranspose()).GetNormalized()); // This is GetUp() now, as lookat matrices always seem to use the z axis to point forward - mMeshShader->SetUniform("diffuseColor", color); - mMeshShader->SetUniform("specularColor", AZ::Vector3::CreateOne() * 0.3f); - mMeshShader->SetUniform("specularPower", 8.0f); + m_meshShader->SetUniform("worldViewProjectionMatrix", camera->GetViewProjMatrix() * globalMatrix); + m_meshShader->SetUniform("cameraPosition", camera->GetPosition()); + m_meshShader->SetUniform("lightDirection", MCore::GetUp(camera->GetViewMatrix().GetTranspose()).GetNormalized()); // This is GetUp() now, as lookat matrices always seem to use the z axis to point forward + m_meshShader->SetUniform("diffuseColor", color); + m_meshShader->SetUniform("specularColor", AZ::Vector3::CreateOne() * 0.3f); + m_meshShader->SetUniform("specularPower", 8.0f); // setup shader attributes and draw the mesh const uint32 stride = sizeof(UtilMeshVertex); - mMeshShader->SetAttribute("inPosition", 4, GL_FLOAT, stride, 0); - mMeshShader->SetAttribute("inNormal", 4, GL_FLOAT, stride, sizeof(AZ::Vector3)); - mMeshShader->SetUniform("worldMatrix", globalMatrix); + m_meshShader->SetAttribute("inPosition", 4, GL_FLOAT, stride, 0); + m_meshShader->SetAttribute("inNormal", 4, GL_FLOAT, stride, sizeof(AZ::Vector3)); + m_meshShader->SetUniform("worldMatrix", globalMatrix); - glDrawElements(GL_TRIANGLES, (GLsizei)mesh->mIndices.size(), GL_UNSIGNED_INT, (GLvoid*)nullptr); + glDrawElements(GL_TRIANGLES, (GLsizei)mesh->m_indices.size(), GL_UNSIGNED_INT, (GLvoid*)nullptr); - mMeshShader->Deactivate(); + m_meshShader->Deactivate(); } @@ -441,7 +441,7 @@ namespace RenderGL // load the camera view projection matrix glMatrixMode(GL_PROJECTION); - MCommon::Camera* camera = mGraphicsManager->GetCamera(); + MCommon::Camera* camera = m_graphicsManager->GetCamera(); const AZ::Matrix4x4 transposedProjMatrix = camera->GetViewProjMatrix().GetTranspose(); glLoadMatrixf((float*)&transposedProjMatrix); @@ -450,14 +450,14 @@ namespace RenderGL glLoadIdentity(); // disable the shaders - mGraphicsManager->SetShader(nullptr); + m_graphicsManager->SetShader(nullptr); // set up blending properties glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // render the triangle - glColor4f(color.r, color.g, color.b, color.a); + glColor4f(color.m_r, color.m_g, color.m_b, color.m_a); glBegin(GL_TRIANGLES); glVertex3f(v1.GetX(), v1.GetY(), v1.GetZ()); glVertex3f(v2.GetX(), v2.GetY(), v2.GetZ()); @@ -483,66 +483,66 @@ namespace RenderGL // get the number of vertices to render const uint32 numVertices = aznumeric_caster(triangleVertices.size()); - MCORE_ASSERT(numVertices <= mNumMaxTriangleVertices); + MCORE_ASSERT(numVertices <= s_numMaxTriangleVertices); // lock the vertex buffer - TriangleVertex* vertices = (TriangleVertex*)mTriangleVertexBuffer->Lock(); + TriangleVertex* vertices = (TriangleVertex*)m_triangleVertexBuffer->Lock(); if (vertices == nullptr) { return; } // TODO: Not nice yet, get the color from the first vertex and use if for all triangles - MCore::RGBAColor color((uint32)triangleVertices[0].mColor); + MCore::RGBAColor color((uint32)triangleVertices[0].m_color); // fill in the vertex buffer for (uint32 i = 0; i < numVertices; ++i) { - vertices[i].mPosition = triangleVertices[i].mPosition; - vertices[i].mNormal = triangleVertices[i].mNormal; + vertices[i].m_position = triangleVertices[i].m_position; + vertices[i].m_normal = triangleVertices[i].m_normal; } // unlock and activate the vertex buffer and index buffer - mTriangleVertexBuffer->Unlock(); - mTriangleVertexBuffer->Activate(); - mTriangleIndexBuffer->Activate(); + m_triangleVertexBuffer->Unlock(); + m_triangleVertexBuffer->Activate(); + m_triangleIndexBuffer->Activate(); // setup shader - mMeshShader->Activate(); + m_meshShader->Activate(); - MCommon::Camera* camera = mGraphicsManager->GetCamera(); + MCommon::Camera* camera = m_graphicsManager->GetCamera(); - mMeshShader->SetUniform("worldViewProjectionMatrix", camera->GetViewProjMatrix()); - mMeshShader->SetUniform("cameraPosition", camera->GetPosition()); - mMeshShader->SetUniform("lightDirection", MCore::GetUp(camera->GetViewMatrix().GetTranspose()).GetNormalized()); - mMeshShader->SetUniform("diffuseColor", color); - mMeshShader->SetUniform("specularColor", AZ::Vector3::CreateOne()); - mMeshShader->SetUniform("specularPower", 30.0f); + m_meshShader->SetUniform("worldViewProjectionMatrix", camera->GetViewProjMatrix()); + m_meshShader->SetUniform("cameraPosition", camera->GetPosition()); + m_meshShader->SetUniform("lightDirection", MCore::GetUp(camera->GetViewMatrix().GetTranspose()).GetNormalized()); + m_meshShader->SetUniform("diffuseColor", color); + m_meshShader->SetUniform("specularColor", AZ::Vector3::CreateOne()); + m_meshShader->SetUniform("specularPower", 30.0f); // setup shader attributes and draw the mesh const uint32 stride = sizeof(TriangleVertex); - mMeshShader->SetAttribute("inPosition", 4, GL_FLOAT, stride, 0); - mMeshShader->SetAttribute("inNormal", 4, GL_FLOAT, stride, sizeof(AZ::Vector3)); - mMeshShader->SetUniform("worldMatrix", AZ::Matrix4x4::CreateIdentity()); + m_meshShader->SetAttribute("inPosition", 4, GL_FLOAT, stride, 0); + m_meshShader->SetAttribute("inNormal", 4, GL_FLOAT, stride, sizeof(AZ::Vector3)); + m_meshShader->SetUniform("worldMatrix", AZ::Matrix4x4::CreateIdentity()); glDrawElements(GL_TRIANGLES, numVertices, GL_UNSIGNED_INT, (GLvoid*)nullptr); - mMeshShader->Deactivate(); + m_meshShader->Deactivate(); } void GLRenderUtil::RenderTextPeriod(uint32 x, uint32 y, const char* text, float lifeTime, const MCore::RGBAColor& color, float fontSize, bool centered) { TextEntry* textEntry = new TextEntry(); - textEntry->mX = x; - textEntry->mY = y; - textEntry->mText = text; - textEntry->mLifeTime = lifeTime; - textEntry->mColor = color; - textEntry->mFontSize = fontSize; - textEntry->mCentered = centered; + textEntry->m_x = x; + textEntry->m_y = y; + textEntry->m_text = text; + textEntry->m_lifeTime = lifeTime; + textEntry->m_color = color; + textEntry->m_fontSize = fontSize; + textEntry->m_centered = centered; - mTextEntries.emplace_back(textEntry); + m_textEntries.emplace_back(textEntry); } @@ -550,16 +550,16 @@ namespace RenderGL { static AZ::Debug::Timer timer; const float timeDelta = static_cast(timer.StampAndGetDeltaTimeInSeconds()); - for (uint32 i = 0; i < mTextEntries.size(); ) + for (uint32 i = 0; i < m_textEntries.size(); ) { - TextEntry* textEntry = mTextEntries[i]; - RenderText(static_cast(textEntry->mX), static_cast(textEntry->mY), textEntry->mText.c_str(), textEntry->mColor, textEntry->mFontSize, textEntry->mCentered); + TextEntry* textEntry = m_textEntries[i]; + RenderText(static_cast(textEntry->m_x), static_cast(textEntry->m_y), textEntry->m_text.c_str(), textEntry->m_color, textEntry->m_fontSize, textEntry->m_centered); - textEntry->mLifeTime -= timeDelta; - if (textEntry->mLifeTime < 0.0f) + textEntry->m_lifeTime -= timeDelta; + if (textEntry->m_lifeTime < 0.0f) { delete textEntry; - mTextEntries.erase(AZStd::next(begin(mTextEntries), i)); + m_textEntries.erase(AZStd::next(begin(m_textEntries), i)); } else { diff --git a/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/GLRenderUtil.h b/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/GLRenderUtil.h index 0f323ab00c..aa64581449 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/GLRenderUtil.h +++ b/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/GLRenderUtil.h @@ -73,45 +73,45 @@ namespace RenderGL void CleanUp(); #define MAX_LINE_VERTEXBUFFERS 2 - GraphicsManager* mGraphicsManager; - VertexBuffer* mLineVertexBuffers[MAX_LINE_VERTEXBUFFERS]{}; - uint16 mCurrentLineVB; - GLSLShader* mLineShader; - GLSLShader* mMeshShader; - VertexBuffer* mMeshVertexBuffer; - IndexBuffer* mMeshIndexBuffer; + GraphicsManager* m_graphicsManager; + VertexBuffer* m_lineVertexBuffers[MAX_LINE_VERTEXBUFFERS]{}; + uint16 m_currentLineVb; + GLSLShader* m_lineShader; + GLSLShader* m_meshShader; + VertexBuffer* m_meshVertexBuffer; + IndexBuffer* m_meshIndexBuffer; // vertex and index buffers for rendering triangles - VertexBuffer* mTriangleVertexBuffer; - IndexBuffer* mTriangleIndexBuffer; + VertexBuffer* m_triangleVertexBuffer; + IndexBuffer* m_triangleIndexBuffer; // texture rendering struct TextureEntry { MCORE_MEMORYOBJECTCATEGORY(GLRenderUtil::TextureEntry, MCore::MCORE_DEFAULT_ALIGNMENT, MEMCATEGORY_RENDERING); - Texture* texture; - AZ::Vector2 pos; + Texture* m_texture; + AZ::Vector2 m_pos; TextureEntry() - : pos(0.0f, 0.0f) - , texture(nullptr) {} + : m_pos(0.0f, 0.0f) + , m_texture(nullptr) {} }; struct TextEntry { MCORE_MEMORYOBJECTCATEGORY(GLRenderUtil::TextEntry, MCore::MCORE_DEFAULT_ALIGNMENT, MEMCATEGORY_RENDERING); - uint32 mX; - uint32 mY; - AZStd::string mText; - float mLifeTime; - MCore::RGBAColor mColor; - float mFontSize; - bool mCentered; + uint32 m_x; + uint32 m_y; + AZStd::string m_text; + float m_lifeTime; + MCore::RGBAColor m_color; + float m_fontSize; + bool m_centered; }; - AZStd::vector mTextEntries; - TextureEntry* mTextures; - uint32 mNumTextures; - uint32 mMaxNumTextures; + AZStd::vector m_textEntries; + TextureEntry* m_textures; + uint32 m_numTextures; + uint32 m_maxNumTextures; }; } // namespace RenderGL diff --git a/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/GLSLShader.cpp b/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/GLSLShader.cpp index b1a5c4699d..72a28a5d11 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/GLSLShader.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/GLSLShader.cpp @@ -20,39 +20,39 @@ namespace RenderGL // constructor GLSLShader::ShaderParameter::ShaderParameter(const char* name, GLint loc, bool isAttrib) { - mName = name; - mType = 0; - mSize = 0; - mLocation = loc; - mIsAttribute = isAttrib; - mTextureUnit = MCORE_INVALIDINDEX32; + m_name = name; + m_type = 0; + m_size = 0; + m_location = loc; + m_isAttribute = isAttrib; + m_textureUnit = MCORE_INVALIDINDEX32; } // constructor GLSLShader::GLSLShader() { - mProgram = 0; - mVertexShader = 0; - mPixelShader = 0; - mTextureUnit = 0; + m_program = 0; + m_vertexShader = 0; + m_pixelShader = 0; + m_textureUnit = 0; // pre-alloc data for uniforms and attributes - mUniforms.reserve(10); - mAttributes.reserve(10); - mActivatedAttribs.reserve(10); - mActivatedTextures.reserve(10); + m_uniforms.reserve(10); + m_attributes.reserve(10); + m_activatedAttribs.reserve(10); + m_activatedTextures.reserve(10); } // destructor GLSLShader::~GLSLShader() { - glDetachShader(mProgram, mVertexShader); - glDetachShader(mProgram, mPixelShader); - glDeleteShader(mVertexShader); - glDeleteShader(mPixelShader); - glDeleteShader(mProgram); + glDetachShader(m_program, m_vertexShader); + glDetachShader(m_program, m_pixelShader); + glDeleteShader(m_vertexShader); + glDeleteShader(m_pixelShader); + glDeleteShader(m_program); } @@ -66,32 +66,32 @@ namespace RenderGL // Deactivate void GLSLShader::Deactivate() { - for (const size_t index : mActivatedAttribs) + for (const size_t index : m_activatedAttribs) { - glDisableVertexAttribArray(mAttributes[index].mLocation); + glDisableVertexAttribArray(m_attributes[index].m_location); } - for (const size_t index : mActivatedTextures) + for (const size_t index : m_activatedTextures) { - assert(mUniforms[index].mType == GL_SAMPLER_2D); - glActiveTexture(GL_TEXTURE0 + mUniforms[index].mTextureUnit); + assert(m_uniforms[index].m_type == GL_SAMPLER_2D); + glActiveTexture(GL_TEXTURE0 + m_uniforms[index].m_textureUnit); glBindTexture(GL_TEXTURE_2D, 0); } - mActivatedAttribs.clear(); - mActivatedTextures.clear(); + m_activatedAttribs.clear(); + m_activatedTextures.clear(); } bool GLSLShader::Validate() { int success = 0; - glValidateProgram(mProgram); - glGetProgramiv(mProgram, GL_VALIDATE_STATUS, &success); + glValidateProgram(m_program); + glGetProgramiv(m_program, GL_VALIDATE_STATUS, &success); if (success == 0) { - MCore::LogInfo("Failed to validate program '%s'", mFileName.c_str()); - InfoLog(mProgram, &QOpenGLExtraFunctions::glGetProgramInfoLog); + MCore::LogInfo("Failed to validate program '%s'", m_fileName.c_str()); + InfoLog(m_program, &QOpenGLExtraFunctions::glGetProgramInfoLog); return false; } return true; @@ -114,14 +114,14 @@ namespace RenderGL return false; } - mFileName = filename; + m_fileName = filename; AZStd::string text; text.reserve(4096); text = "#version 120\n"; // build define string - for (const AZStd::string& define : mDefines) + for (const AZStd::string& define : m_defines) { text += AZStd::string::format("#define %s\n", define.c_str()); } @@ -171,10 +171,10 @@ namespace RenderGL AZStd::invoke(func, static_cast(this), object, logLen, &logWritten, text.data()); // if there are any defines, print that out too - if (!mDefines.empty()) + if (!m_defines.empty()) { AZStd::string dStr; - for (const AZStd::string& define : mDefines) + for (const AZStd::string& define : m_defines) { if (!dStr.empty()) { @@ -183,11 +183,11 @@ namespace RenderGL dStr.append(define); } - MCore::LogDetailedInfo("[GLSL] Compiling shader '%s', with defines %s", mFileName.c_str(), dStr.c_str()); + MCore::LogDetailedInfo("[GLSL] Compiling shader '%s', with defines %s", m_fileName.c_str(), dStr.c_str()); } else { - MCore::LogDetailedInfo("[GLSL] Compiling shader '%s'", mFileName.c_str()); + MCore::LogDetailedInfo("[GLSL] Compiling shader '%s'", m_fileName.c_str()); } MCore::LogDetailedInfo(text.c_str()); @@ -204,44 +204,44 @@ namespace RenderGL "O3", nullptr };*/ - mDefines = defines; + m_defines = defines; glUseProgram(0); // compile shaders - if (!vertexFileName.empty() && CompileShader(GL_VERTEX_SHADER, &mVertexShader, vertexFileName) == false) + if (!vertexFileName.empty() && CompileShader(GL_VERTEX_SHADER, &m_vertexShader, vertexFileName) == false) { return false; } - if (!pixelFileName.empty() && CompileShader(GL_FRAGMENT_SHADER, &mPixelShader, pixelFileName) == false) + if (!pixelFileName.empty() && CompileShader(GL_FRAGMENT_SHADER, &m_pixelShader, pixelFileName) == false) { return false; } // create program - mProgram = glCreateProgram(); + m_program = glCreateProgram(); if (!vertexFileName.empty()) { - glAttachShader(mProgram, mVertexShader); + glAttachShader(m_program, m_vertexShader); } if (!pixelFileName.empty()) { - glAttachShader(mProgram, mPixelShader); + glAttachShader(m_program, m_pixelShader); } // link - glLinkProgram(mProgram); + glLinkProgram(m_program); // check for linking errors GLint success = 0; - glGetProgramiv(mProgram, GL_LINK_STATUS, &success); + glGetProgramiv(m_program, GL_LINK_STATUS, &success); if (!success) { MCore::LogInfo("[OpenGL] Failed to link shaders '%.*s' and '%.*s' ", AZ_STRING_ARG(vertexFileName.Native()), AZ_STRING_ARG(pixelFileName.Native())); - InfoLog(mProgram, &QOpenGLExtraFunctions::glGetProgramInfoLog); + InfoLog(m_program, &QOpenGLExtraFunctions::glGetProgramInfoLog); return false; } @@ -258,35 +258,35 @@ namespace RenderGL return nullptr; } - return &mAttributes[index]; + return &m_attributes[index]; } // FindAttributeIndex size_t GLSLShader::FindAttributeIndex(const char* name) { - const auto foundAttribute = AZStd::find_if(begin(mAttributes), end(mAttributes), [name](const auto& attribute) + const auto foundAttribute = AZStd::find_if(begin(m_attributes), end(m_attributes), [name](const auto& attribute) { - return AzFramework::StringFunc::Equal(attribute.mName.c_str(), name, false /* no case */) && + return AzFramework::StringFunc::Equal(attribute.m_name.c_str(), name, false /* no case */) && // if we don't have a valid parameter location, an attribute by this name doesn't exist // we just cached the fact that it doesn't exist, instead of failing glGetAttribLocation every time - attribute.mLocation >= 0; + attribute.m_location >= 0; }); - if (foundAttribute != end(mAttributes)) + if (foundAttribute != end(m_attributes)) { - return AZStd::distance(begin(mAttributes), foundAttribute); + return AZStd::distance(begin(m_attributes), foundAttribute); } // the parameter wasn't cached, try to retrieve it - const GLint loc = glGetAttribLocation(mProgram, name); - mAttributes.emplace_back(name, loc, true); + const GLint loc = glGetAttribLocation(m_program, name); + m_attributes.emplace_back(name, loc, true); if (loc < 0) { return InvalidIndex; } - return mAttributes.size() - 1; + return m_attributes.size() - 1; } @@ -299,7 +299,7 @@ namespace RenderGL return InvalidIndex; } - return p->mLocation; + return p->m_location; } @@ -312,33 +312,33 @@ namespace RenderGL return nullptr; } - return &mUniforms[index]; + return &m_uniforms[index]; } // FindUniformIndex size_t GLSLShader::FindUniformIndex(const char* name) { - const auto foundUniform = AZStd::find_if(begin(mUniforms), end(mUniforms), [name](const auto& uniform) + const auto foundUniform = AZStd::find_if(begin(m_uniforms), end(m_uniforms), [name](const auto& uniform) { - return AzFramework::StringFunc::Equal(uniform.mName.c_str(), name, false /* no case */) && - uniform.mLocation >= 0; + return AzFramework::StringFunc::Equal(uniform.m_name.c_str(), name, false /* no case */) && + uniform.m_location >= 0; }); - if (foundUniform != end(mUniforms)) + if (foundUniform != end(m_uniforms)) { - return AZStd::distance(begin(mUniforms), foundUniform); + return AZStd::distance(begin(m_uniforms), foundUniform); } // the parameter wasn't cached, try to retrieve it - const GLint loc = glGetUniformLocation(mProgram, name); - mUniforms.emplace_back(name, loc, false); + const GLint loc = glGetUniformLocation(m_program, name); + m_uniforms.emplace_back(name, loc, false); if (loc < 0) { return InvalidIndex; } - return mUniforms.size() - 1; + return m_uniforms.size() - 1; } @@ -351,12 +351,12 @@ namespace RenderGL return; } - ShaderParameter* param = &mAttributes[index]; + ShaderParameter* param = &m_attributes[index]; - glEnableVertexAttribArray(param->mLocation); - glVertexAttribPointer(param->mLocation, dim, type, GL_FALSE, stride, (GLvoid*)offset); + glEnableVertexAttribArray(param->m_location); + glVertexAttribPointer(param->m_location, dim, type, GL_FALSE, stride, (GLvoid*)offset); - mActivatedAttribs.emplace_back(index); + m_activatedAttribs.emplace_back(index); } @@ -369,7 +369,7 @@ namespace RenderGL return; } - glUniform1f(param->mLocation, value); + glUniform1f(param->m_location, value); } @@ -382,7 +382,7 @@ namespace RenderGL return; } - glUniform1f(param->mLocation, (float)value); + glUniform1f(param->m_location, (float)value); } @@ -395,7 +395,7 @@ namespace RenderGL return; } - glUniform4fv(param->mLocation, 1, (float*)&color); + glUniform4fv(param->m_location, 1, (float*)&color); } @@ -408,7 +408,7 @@ namespace RenderGL return; } - glUniform2fv(param->mLocation, 1, (float*)&vector); + glUniform2fv(param->m_location, 1, (float*)&vector); } @@ -421,7 +421,7 @@ namespace RenderGL return; } - glUniform3fv(param->mLocation, 1, (float*)&vector); + glUniform3fv(param->m_location, 1, (float*)&vector); } @@ -434,7 +434,7 @@ namespace RenderGL return; } - glUniform4fv(param->mLocation, 1, (float*)&vector); + glUniform4fv(param->m_location, 1, (float*)&vector); } @@ -454,7 +454,7 @@ namespace RenderGL return; } - glUniformMatrix4fv(param->mLocation, 1, !transpose, (float*)&matrix); + glUniformMatrix4fv(param->m_location, 1, !transpose, (float*)&matrix); } @@ -467,7 +467,7 @@ namespace RenderGL return; } - glUniformMatrix4fv(param->mLocation, count, GL_FALSE, (float*)matrices); + glUniformMatrix4fv(param->m_location, count, GL_FALSE, (float*)matrices); } @@ -480,7 +480,7 @@ namespace RenderGL } // update the value - glUniform1fv(param->mLocation, numFloats, values); + glUniform1fv(param->m_location, numFloats, values); } @@ -493,13 +493,13 @@ namespace RenderGL return; } - mUniforms[index].mType = GL_SAMPLER_2D; // why is this being set here? + m_uniforms[index].m_type = GL_SAMPLER_2D; // why is this being set here? // if the texture doesn't have a sampler unit assigned, give it one - if (mUniforms[index].mTextureUnit == MCORE_INVALIDINDEX32) + if (m_uniforms[index].m_textureUnit == MCORE_INVALIDINDEX32) { - mUniforms[index].mTextureUnit = mTextureUnit; - mTextureUnit++; + m_uniforms[index].m_textureUnit = m_textureUnit; + m_textureUnit++; } if (texture == nullptr) @@ -507,11 +507,11 @@ namespace RenderGL texture = GetGraphicsManager()->GetTextureCache()->GetWhiteTexture(); } - glActiveTexture(GL_TEXTURE0 + mUniforms[index].mTextureUnit); + glActiveTexture(GL_TEXTURE0 + m_uniforms[index].m_textureUnit); glBindTexture(GL_TEXTURE_2D, texture->GetID()); - glUniform1i(mUniforms[index].mLocation, mUniforms[index].mTextureUnit); + glUniform1i(m_uniforms[index].m_location, m_uniforms[index].m_textureUnit); - mActivatedTextures.emplace_back(index); + m_activatedTextures.emplace_back(index); } @@ -524,13 +524,13 @@ namespace RenderGL return; } - mUniforms[index].mType = GL_SAMPLER_2D; // why is this being set here? + m_uniforms[index].m_type = GL_SAMPLER_2D; // why is this being set here? // if the texture doesn't have a sampler unit assigned, give it one - if (mUniforms[index].mTextureUnit == MCORE_INVALIDINDEX32) + if (m_uniforms[index].m_textureUnit == MCORE_INVALIDINDEX32) { - mUniforms[index].mTextureUnit = mTextureUnit; - mTextureUnit++; + m_uniforms[index].m_textureUnit = m_textureUnit; + m_textureUnit++; } if (textureID == MCORE_INVALIDINDEX32) @@ -538,11 +538,11 @@ namespace RenderGL textureID = GetGraphicsManager()->GetTextureCache()->GetWhiteTexture()->GetID(); } - glActiveTexture(GL_TEXTURE0 + mUniforms[index].mTextureUnit); + glActiveTexture(GL_TEXTURE0 + m_uniforms[index].m_textureUnit); glBindTexture(GL_TEXTURE_2D, textureID); - glUniform1i(mUniforms[index].mLocation, mUniforms[index].mTextureUnit); + glUniform1i(m_uniforms[index].m_location, m_uniforms[index].m_textureUnit); - mActivatedTextures.emplace_back(index); + m_activatedTextures.emplace_back(index); } @@ -550,7 +550,7 @@ namespace RenderGL bool GLSLShader::CheckIfIsDefined(const char* attributeName) const { // get the number of defines and iterate through them - return AZStd::any_of(begin(mDefines), end(mDefines), [attributeName](const AZStd::string& define) + return AZStd::any_of(begin(m_defines), end(m_defines), [attributeName](const AZStd::string& define) { return AzFramework::StringFunc::Equal(define.c_str(), attributeName, false /* no case */); }); diff --git a/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/GLSLShader.h b/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/GLSLShader.h index 0db7948e8f..5975470f86 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/GLSLShader.h +++ b/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/GLSLShader.h @@ -39,7 +39,7 @@ namespace RenderGL size_t FindAttributeLocation(const char* name); uint32 GetType() const override; - MCORE_INLINE unsigned int GetProgram() const { return mProgram; } + MCORE_INLINE unsigned int GetProgram() const { return m_program; } bool CheckIfIsDefined(const char* attributeName) const; bool Init(AZ::IO::PathView vertexFileName, AZ::IO::PathView pixelFileName, AZStd::vector& defines); @@ -65,12 +65,12 @@ namespace RenderGL { ShaderParameter(const char* name, GLint loc, bool isAttrib); - AZStd::string mName; - GLint mLocation; - GLenum mType; - uint32 mSize; - uint32 mTextureUnit; - bool mIsAttribute; + AZStd::string m_name; + GLint m_location; + GLenum m_type; + uint32 m_size; + uint32 m_textureUnit; + bool m_isAttribute; }; size_t FindAttributeIndex(const char* name); @@ -82,19 +82,19 @@ namespace RenderGL template void InfoLog(GLuint object, T func); - AZ::IO::Path mFileName; + AZ::IO::Path m_fileName; - AZStd::vector mActivatedAttribs; - AZStd::vector mActivatedTextures; - AZStd::vector mUniforms; - AZStd::vector mAttributes; - AZStd::vector mDefines; + AZStd::vector m_activatedAttribs; + AZStd::vector m_activatedTextures; + AZStd::vector m_uniforms; + AZStd::vector m_attributes; + AZStd::vector m_defines; - unsigned int mVertexShader; - unsigned int mPixelShader; - unsigned int mProgram; + unsigned int m_vertexShader; + unsigned int m_pixelShader; + unsigned int m_program; - uint32 mTextureUnit; + uint32 m_textureUnit; }; } diff --git a/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/GraphicsManager.cpp b/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/GraphicsManager.cpp index 4802477e08..1ccb8650aa 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/GraphicsManager.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/GraphicsManager.cpp @@ -24,7 +24,7 @@ namespace RenderGL { - size_t GraphicsManager::mNumRandomOffsets = 64; + size_t GraphicsManager::s_numRandomOffsets = 64; GraphicsManager* gGraphicsManager = nullptr; @@ -39,60 +39,60 @@ namespace RenderGL GraphicsManager::GraphicsManager() { gGraphicsManager = this; - mPostProcessing = false; + m_postProcessing = false; // render background - mUseGradientBackground = true; - mClearColor = MCore::RGBAColor(0.359f, 0.3984f, 0.4492f); - mGradientSourceColor = MCore::RGBAColor(0.4941f, 0.5686f, 0.6470f); - mGradientTargetColor = MCore::RGBAColor(0.0941f, 0.1019f, 0.1098f); + m_useGradientBackground = true; + m_clearColor = MCore::RGBAColor(0.359f, 0.3984f, 0.4492f); + m_gradientSourceColor = MCore::RGBAColor(0.4941f, 0.5686f, 0.6470f); + m_gradientTargetColor = MCore::RGBAColor(0.0941f, 0.1019f, 0.1098f); - mGBuffer = nullptr; - mHBloom = nullptr; - mVBloom = nullptr; - mHBlur = nullptr; - mVBlur = nullptr; - mDownSample = nullptr; - mDOF = nullptr; - mSSDO = nullptr; - mHSmartBlur = nullptr; - mVSmartBlur = nullptr; - mRenderTexture = nullptr; - mActiveShader = nullptr; - mCamera = nullptr; - mRenderUtil = nullptr; + m_gBuffer = nullptr; + m_hBloom = nullptr; + m_vBloom = nullptr; + m_hBlur = nullptr; + m_vBlur = nullptr; + m_downSample = nullptr; + m_dof = nullptr; + m_ssdo = nullptr; + m_hSmartBlur = nullptr; + m_vSmartBlur = nullptr; + m_renderTexture = nullptr; + m_activeShader = nullptr; + m_camera = nullptr; + m_renderUtil = nullptr; - mMainLightIntensity = 1.00f; - mMainLightAngleA = -30.0f; - mMainLightAngleB = 18.0f; - mSpecularIntensity = 1.0f; + m_mainLightIntensity = 1.00f; + m_mainLightAngleA = -30.0f; + m_mainLightAngleB = 18.0f; + m_specularIntensity = 1.0f; - mBloomEnabled = true; - mBloomRadius = 4.0f; - mBloomIntensity = 0.85f; - mBloomThreshold = 0.80f; + m_bloomEnabled = true; + m_bloomRadius = 4.0f; + m_bloomIntensity = 0.85f; + m_bloomThreshold = 0.80f; - mDOFEnabled = false; - mDOFBlurRadius = 2.0f; - mDOFFocalDistance = 500.0f; - mDOFNear = 0.001f; - mDOFFar = 1000.0f; + m_dofEnabled = false; + m_dofBlurRadius = 2.0f; + m_dofFocalDistance = 500.0f; + m_dofNear = 0.001f; + m_dofFar = 1000.0f; - mRimAngle = 60.0f; - mRimWidth = 0.65f; - mRimIntensity = 1.5f; - mRimColor = MCore::RGBAColor(1.0f, 0.70f, 0.109f); + m_rimAngle = 60.0f; + m_rimWidth = 0.65f; + m_rimIntensity = 1.5f; + m_rimColor = MCore::RGBAColor(1.0f, 0.70f, 0.109f); - mRandomVectorTexture = nullptr; - mCreateMipMaps = true; - mSkipLoadingTextures = false; + m_randomVectorTexture = nullptr; + m_createMipMaps = true; + m_skipLoadingTextures = false; // init random offsets - mRandomOffsets.resize(mNumRandomOffsets); - AZStd::vector samples = MCore::Random::RandomDirVectorsHalton(AZ::Vector3(0.0f, 1.0f, 0.0f), MCore::Math::twoPi, mNumRandomOffsets); - for (size_t i = 0; i < mNumRandomOffsets; ++i) + m_randomOffsets.resize(s_numRandomOffsets); + AZStd::vector samples = MCore::Random::RandomDirVectorsHalton(AZ::Vector3(0.0f, 1.0f, 0.0f), MCore::Math::twoPi, s_numRandomOffsets); + for (size_t i = 0; i < s_numRandomOffsets; ++i) { - mRandomOffsets[i] = samples[i] * MCore::Random::RandF(0.1f, 1.0f); + m_randomOffsets[i] = samples[i] * MCore::Random::RandF(0.1f, 1.0f); } } @@ -101,38 +101,37 @@ namespace RenderGL GraphicsManager::~GraphicsManager() { // shutdown the texture cache - mTextureCache.Release(); + m_textureCache.Release(); // delete all shaders - mShaderCache.Release(); + m_shaderCache.Release(); // get rid of the OpenGL render utility - delete mRenderUtil; + delete m_renderUtil; // release random vector texture memory - delete mRandomVectorTexture; + delete m_randomVectorTexture; // clear the string memory - mShaderPath.clear(); + m_shaderPath.clear(); } // setup sunset color style rim lighting void GraphicsManager::SetupSunsetRim() { - mRimWidth = 0.65f; - mRimIntensity = 1.5f; - mRimColor = MCore::RGBAColor(1.0f, 0.70f, 0.109f); - //mRimColor = MCore::RGBAColor(1.0f, 0.77f, 0.30f); + m_rimWidth = 0.65f; + m_rimIntensity = 1.5f; + m_rimColor = MCore::RGBAColor(1.0f, 0.70f, 0.109f); } // setup blue color style rim lighting void GraphicsManager::SetupBlueRim() { - mRimWidth = 0.65f; - mRimIntensity = 1.5f; - mRimColor = MCore::RGBAColor(81.0f / 255.0f, 160.0f / 255.0f, 1.0f); + m_rimWidth = 0.65f; + m_rimIntensity = 1.5f; + m_rimColor = MCore::RGBAColor(81.0f / 255.0f, 160.0f / 255.0f, 1.0f); } @@ -152,12 +151,12 @@ namespace RenderGL glBegin(GL_QUADS); // bottom - glColor3f(bottomColor.r, bottomColor.g, bottomColor.b); + glColor3f(bottomColor.m_r, bottomColor.m_g, bottomColor.m_b); glVertex2f(-1.0, -1.0); glVertex2f(1.0, -1.0); // top - glColor3f(topColor.r, topColor.g, topColor.b); + glColor3f(topColor.m_r, topColor.m_g, topColor.m_b); glVertex2f(1.0, 1.0); glVertex2f(-1.0, 1.0); @@ -176,13 +175,13 @@ namespace RenderGL //glPushAttrib( GL_ALL_ATTRIB_BITS ); // Activate render targets - glClearColor(mClearColor.r, mClearColor.g, mClearColor.b, 1.0f); + glClearColor(m_clearColor.m_r, m_clearColor.m_g, m_clearColor.m_b, 1.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); // render the gradient background - if (mUseGradientBackground) + if (m_useGradientBackground) { - RenderGradientBackground(mGradientSourceColor, mGradientTargetColor); + RenderGradientBackground(m_gradientSourceColor, m_gradientTargetColor); } return true; @@ -192,9 +191,9 @@ namespace RenderGL // end a frame (perform the swap) void GraphicsManager::EndRender() { - mRenderUtil->RenderTextPeriods(); - mRenderUtil->RenderTextures(); - ((MCommon::RenderUtil*)mRenderUtil)->Render2DLines(); + m_renderUtil->RenderTextPeriods(); + m_renderUtil->RenderTextures(); + ((MCommon::RenderUtil*)m_renderUtil)->Render2DLines(); } @@ -207,7 +206,7 @@ namespace RenderGL SetShaderPath(shaderPath); // texture cache - if (mTextureCache.Init() == false) + if (m_textureCache.Init() == false) { return false; } @@ -218,7 +217,7 @@ namespace RenderGL glDepthFunc(GL_LEQUAL); glEnable(GL_DEPTH_TEST); - glClearColor(mClearColor.r, mClearColor.g, mClearColor.b, 1.0f); + glClearColor(m_clearColor.m_r, m_clearColor.m_g, m_clearColor.m_b, 1.0f); glHint(GL_POINT_SMOOTH_HINT, GL_NICEST); glHint(GL_LINE_SMOOTH_HINT, GL_NICEST); @@ -228,15 +227,15 @@ namespace RenderGL glDisable(GL_BLEND); // initialize utility rendering - mRenderUtil = new GLRenderUtil(this); - mRenderUtil->Init(); + m_renderUtil = new GLRenderUtil(this); + m_renderUtil->Init(); // post processing - if (mPostProcessing) + if (m_postProcessing) { if (InitPostProcessing() == false) { - mPostProcessing = false; + m_postProcessing = false; } } @@ -275,86 +274,52 @@ namespace RenderGL ResizeTextures(screenWidth, screenHeight); // load horizontal bloom - mHBloom = LoadPostProcessShader("HBloom.glsl"); - if (mHBloom == nullptr) + m_hBloom = LoadPostProcessShader("HBloom.glsl"); + if (m_hBloom == nullptr) { MCore::LogWarning("[OpenGL] Failed to load HBloom shader, disabling post processing."); return false; } // load vertical bloom - mVBloom = LoadPostProcessShader("VBloom.glsl"); - if (mVBloom == nullptr) + m_vBloom = LoadPostProcessShader("VBloom.glsl"); + if (m_vBloom == nullptr) { MCore::LogWarning("[OpenGL] Failed to load VBloom shader, disabling post processing."); return false; } // load vertical bloom - mDownSample = LoadPostProcessShader("DownSample.glsl"); - if (mDownSample == nullptr) + m_downSample = LoadPostProcessShader("DownSample.glsl"); + if (m_downSample == nullptr) { MCore::LogWarning("[OpenGL] Failed to load DownSample shader, disabling post processing."); return false; } // load horizontal blur - mHBlur = LoadPostProcessShader("HBlur.glsl"); - if (mHBlur == nullptr) + m_hBlur = LoadPostProcessShader("HBlur.glsl"); + if (m_hBlur == nullptr) { MCore::LogWarning("[OpenGL] Failed to load HBlur shader, disabling post processing."); return false; } // load vertical blur - mVBlur = LoadPostProcessShader("VBlur.glsl"); - if (mVBlur == nullptr) + m_vBlur = LoadPostProcessShader("VBlur.glsl"); + if (m_vBlur == nullptr) { MCore::LogWarning("[OpenGL] Failed to load VBlur shader, disabling post processing."); return false; } // load DOF shader - mDOF = LoadPostProcessShader("DepthOfField.glsl"); - if (mDOF == nullptr) + m_dof = LoadPostProcessShader("DepthOfField.glsl"); + if (m_dof == nullptr) { MCore::LogWarning("[OpenGL] Failed to load DOF shader, disabling post processing."); return false; } - /* - // load screen space directional occlusion shader - mSSDO = LoadPostProcessShader("SSDO.glsl"); - if (mSSDO == nullptr) - { - MCore::LogWarning("[OpenGL] Failed to load SSDO shader, disabling post processing."); - return false; - } - - // horizontal smartblur - mHSmartBlur = LoadPostProcessShader("HSmartBlur.glsl"); - if (mHSmartBlur == nullptr) - { - MCore::LogWarning("[OpenGL] Failed to load HSmartBlur shader, disabling post processing."); - return false; - } - - // vertical smartblur - mVSmartBlur = LoadPostProcessShader("VSmartBlur.glsl"); - if (mVSmartBlur == nullptr) - { - MCore::LogWarning("[OpenGL] Failed to load VSmartBlur shader, disabling post processing."); - return false; - } - */ - /* - // create the post processing shaders - mSSAO = LoadPostProcessShader("SSAO.glsl"); - if (mSSAO == nullptr) - { - MCore::LogWarning("[OpenGL] Failed to load SSAO shader, disabling post processing."); - return false; - } - */ return true; } @@ -371,17 +336,17 @@ namespace RenderGL // try to load a texture Texture* GraphicsManager::LoadTexture(AZ::IO::PathView filename) { - return LoadTexture(filename, mCreateMipMaps); + return LoadTexture(filename, m_createMipMaps); } // LoadPostProcessShader PostProcessShader* GraphicsManager::LoadPostProcessShader(AZ::IO::PathView cFileName) { - AZ::IO::PathView filename = mShaderPath / cFileName; + AZ::IO::PathView filename = m_shaderPath / cFileName; // check if the shader is already in the cache - Shader* s = mShaderCache.FindShader(filename.Native()); + Shader* s = m_shaderCache.FindShader(filename.Native()); if (s) { return (PostProcessShader*)s; @@ -395,7 +360,7 @@ namespace RenderGL return nullptr; } - mShaderCache.AddShader(filename.Native(), shader); + m_shaderCache.AddShader(filename.Native(), shader); return shader; } @@ -411,8 +376,8 @@ namespace RenderGL // LoadShader GLSLShader* GraphicsManager::LoadShader(AZ::IO::PathView vertexFileName, AZ::IO::PathView pixelFileName, AZStd::vector& defines) { - const AZ::IO::Path vertexPath {vertexFileName.empty() ? AZ::IO::Path{} : mShaderPath / vertexFileName}; - const AZ::IO::Path pixelPath {pixelFileName.empty() ? AZ::IO::Path{} : mShaderPath / pixelFileName}; + const AZ::IO::Path vertexPath {vertexFileName.empty() ? AZ::IO::Path{} : m_shaderPath / vertexFileName}; + const AZ::IO::Path pixelPath {pixelFileName.empty() ? AZ::IO::Path{} : m_shaderPath / pixelFileName}; // construct the lookup string for the shader cache AZStd::string cacheLookupStr = vertexPath.Native() + pixelPath.Native(); @@ -422,7 +387,7 @@ namespace RenderGL } // check if the shader is already in the cache - Shader* cShader = mShaderCache.FindShader(cacheLookupStr); + Shader* cShader = m_shaderCache.FindShader(cacheLookupStr); if (cShader) { return (GLSLShader*)cShader; @@ -436,7 +401,7 @@ namespace RenderGL return nullptr; } - mShaderCache.AddShader(cacheLookupStr, shader); + m_shaderCache.AddShader(cacheLookupStr, shader); return shader; } @@ -463,7 +428,7 @@ namespace RenderGL // SetShader void GraphicsManager::SetShader(Shader* shader) { - if (mActiveShader == shader) + if (m_activeShader == shader) { return; } @@ -471,7 +436,7 @@ namespace RenderGL if (shader == nullptr) { glUseProgram(0); - mActiveShader = nullptr; + m_activeShader = nullptr; return; } @@ -481,7 +446,7 @@ namespace RenderGL glUseProgram(g->GetProgram()); } - mActiveShader = shader; + m_activeShader = shader; } @@ -529,7 +494,7 @@ namespace RenderGL } // create Texture object - mRandomVectorTexture = new Texture(textureID, width, height); + m_randomVectorTexture = new Texture(textureID, width, height); glDisable(GL_TEXTURE_2D); return true; diff --git a/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/GraphicsManager.h b/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/GraphicsManager.h index e13e643938..67ebbd9441 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/GraphicsManager.h +++ b/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/GraphicsManager.h @@ -49,91 +49,91 @@ namespace RenderGL bool BeginRender(); void EndRender(); - MCORE_INLINE MCommon::Camera* GetCamera() const { return mCamera; } - MCORE_INLINE GLRenderUtil* GetRenderUtil() { return mRenderUtil; } + MCORE_INLINE MCommon::Camera* GetCamera() const { return m_camera; } + MCORE_INLINE GLRenderUtil* GetRenderUtil() { return m_renderUtil; } const char* GetDeviceName(); const char* GetDeviceVendor(); - MCORE_INLINE RenderTexture* GetRenderTexture() { return mRenderTexture; } - MCORE_INLINE AZ::IO::PathView GetShaderPath() const { return mShaderPath; } - MCORE_INLINE TextureCache* GetTextureCache() { return &mTextureCache; } + MCORE_INLINE RenderTexture* GetRenderTexture() { return m_renderTexture; } + MCORE_INLINE AZ::IO::PathView GetShaderPath() const { return m_shaderPath; } + MCORE_INLINE TextureCache* GetTextureCache() { return &m_textureCache; } bool Init(AZ::IO::PathView shaderPath = "Shaders"); - bool GetIsPostProcessingEnabled() const { return mPostProcessing; } + bool GetIsPostProcessingEnabled() const { return m_postProcessing; } PostProcessShader* LoadPostProcessShader(AZ::IO::PathView filename); GLSLShader* LoadShader(AZ::IO::PathView vertexFileName, AZ::IO::PathView pixelFileName); GLSLShader* LoadShader(AZ::IO::PathView vertexFileName, AZ::IO::PathView pixelFileName, AZStd::vector& defines); - MCORE_INLINE void SetGBuffer(GBuffer* gBuffer) { mGBuffer = gBuffer; } - MCORE_INLINE GBuffer* GetGBuffer() { return mGBuffer; } + MCORE_INLINE void SetGBuffer(GBuffer* gBuffer) { m_gBuffer = gBuffer; } + MCORE_INLINE GBuffer* GetGBuffer() { return m_gBuffer; } Texture* LoadTexture(AZ::IO::PathView filename, bool createMipMaps); Texture* LoadTexture(AZ::IO::PathView filename); - void SetCreateMipMaps(bool createMipMaps) { mCreateMipMaps = createMipMaps; } - MCORE_INLINE bool GetCreateMipMaps() const { return mCreateMipMaps; } + void SetCreateMipMaps(bool createMipMaps) { m_createMipMaps = createMipMaps; } + MCORE_INLINE bool GetCreateMipMaps() const { return m_createMipMaps; } - void SetSkipLoadingTextures(bool skipTextures) { mSkipLoadingTextures = skipTextures; } - MCORE_INLINE bool GetSkipLoadingTextures() const { return mSkipLoadingTextures; } + void SetSkipLoadingTextures(bool skipTextures) { m_skipLoadingTextures = skipTextures; } + MCORE_INLINE bool GetSkipLoadingTextures() const { return m_skipLoadingTextures; } void Resize(uint32 width, uint32 height); - MCORE_INLINE void SetCamera(MCommon::Camera* camera) { mCamera = camera; } + MCORE_INLINE void SetCamera(MCommon::Camera* camera) { m_camera = camera; } // background rendering and colors - MCORE_INLINE void SetClearColor(const MCore::RGBAColor& color) { mClearColor = color; } - MCORE_INLINE void SetGradientSourceColor(const MCore::RGBAColor& color) { mGradientSourceColor = color; } - MCORE_INLINE void SetGradientTargetColor(const MCore::RGBAColor& color) { mGradientTargetColor = color; } - MCORE_INLINE void SetUseGradientBackground(bool enabled) { mUseGradientBackground = enabled; } - MCORE_INLINE MCore::RGBAColor GetClearColor() const { return mClearColor; } - MCORE_INLINE MCore::RGBAColor GetGradientSourceColor() const { return mGradientSourceColor; } - MCORE_INLINE MCore::RGBAColor GetGradientTargetColor() const { return mGradientTargetColor; } + MCORE_INLINE void SetClearColor(const MCore::RGBAColor& color) { m_clearColor = color; } + MCORE_INLINE void SetGradientSourceColor(const MCore::RGBAColor& color) { m_gradientSourceColor = color; } + MCORE_INLINE void SetGradientTargetColor(const MCore::RGBAColor& color) { m_gradientTargetColor = color; } + MCORE_INLINE void SetUseGradientBackground(bool enabled) { m_useGradientBackground = enabled; } + MCORE_INLINE MCore::RGBAColor GetClearColor() const { return m_clearColor; } + MCORE_INLINE MCore::RGBAColor GetGradientSourceColor() const { return m_gradientSourceColor; } + MCORE_INLINE MCore::RGBAColor GetGradientTargetColor() const { return m_gradientTargetColor; } void RenderGradientBackground(const MCore::RGBAColor& topColor, const MCore::RGBAColor& bottomColor); void SetShader(Shader* shader); - MCORE_INLINE void SetRenderTexture(RenderTexture* texture) { mRenderTexture = texture; } - MCORE_INLINE void SetShaderPath(AZ::IO::PathView shaderPath) { mShaderPath = shaderPath; } + MCORE_INLINE void SetRenderTexture(RenderTexture* texture) { m_renderTexture = texture; } + MCORE_INLINE void SetShaderPath(AZ::IO::PathView shaderPath) { m_shaderPath = shaderPath; } - MCORE_INLINE void SetBloomEnabled(bool enabled) { mBloomEnabled = enabled; } - MCORE_INLINE void SetBloomThreshold(float threshold) { mBloomThreshold = threshold; } - MCORE_INLINE void SetBloomIntensity(float intensity) { mBloomIntensity = intensity; } - MCORE_INLINE void SetBloomRadius(float radius) { mBloomRadius = radius; } - MCORE_INLINE void SetDOFEnabled(bool enabled) { mDOFEnabled = enabled; } - MCORE_INLINE void SetDOFFocalDistance(float dist) { mDOFFocalDistance = dist; } - MCORE_INLINE void SetDOFNear(float dist) { mDOFNear = dist; } - MCORE_INLINE void SetDOFFar(float dist) { mDOFFar = dist; } - MCORE_INLINE void SetDOFBlurRadius(float radius) { mDOFBlurRadius = radius; } + MCORE_INLINE void SetBloomEnabled(bool enabled) { m_bloomEnabled = enabled; } + MCORE_INLINE void SetBloomThreshold(float threshold) { m_bloomThreshold = threshold; } + MCORE_INLINE void SetBloomIntensity(float intensity) { m_bloomIntensity = intensity; } + MCORE_INLINE void SetBloomRadius(float radius) { m_bloomRadius = radius; } + MCORE_INLINE void SetDOFEnabled(bool enabled) { m_dofEnabled = enabled; } + MCORE_INLINE void SetDOFFocalDistance(float dist) { m_dofFocalDistance = dist; } + MCORE_INLINE void SetDOFNear(float dist) { m_dofNear = dist; } + MCORE_INLINE void SetDOFFar(float dist) { m_dofFar = dist; } + MCORE_INLINE void SetDOFBlurRadius(float radius) { m_dofBlurRadius = radius; } - MCORE_INLINE void SetRimColor(const MCore::RGBAColor& color) { mRimColor = color; } - MCORE_INLINE void SetRimIntensity(float intensity) { mRimIntensity = intensity; } - MCORE_INLINE void SetRimWidth(float width) { mRimWidth = width; } - MCORE_INLINE void SetRimAngle(float angleInDegrees) { mRimAngle = angleInDegrees; } + MCORE_INLINE void SetRimColor(const MCore::RGBAColor& color) { m_rimColor = color; } + MCORE_INLINE void SetRimIntensity(float intensity) { m_rimIntensity = intensity; } + MCORE_INLINE void SetRimWidth(float width) { m_rimWidth = width; } + MCORE_INLINE void SetRimAngle(float angleInDegrees) { m_rimAngle = angleInDegrees; } - MCORE_INLINE void SetMainLightIntensity(float intensity) { mMainLightIntensity = intensity; } - MCORE_INLINE void SetMainLightAngleA(float angleInDegrees) { mMainLightAngleA = angleInDegrees; } - MCORE_INLINE void SetMainLightAngleB(float angleInDegrees) { mMainLightAngleB = angleInDegrees; } - MCORE_INLINE void SetSpecularIntensity(float intensity) { mSpecularIntensity = intensity; } + MCORE_INLINE void SetMainLightIntensity(float intensity) { m_mainLightIntensity = intensity; } + MCORE_INLINE void SetMainLightAngleA(float angleInDegrees) { m_mainLightAngleA = angleInDegrees; } + MCORE_INLINE void SetMainLightAngleB(float angleInDegrees) { m_mainLightAngleB = angleInDegrees; } + MCORE_INLINE void SetSpecularIntensity(float intensity) { m_specularIntensity = intensity; } - MCORE_INLINE bool GetBloomEnabled() const { return mBloomEnabled; } - MCORE_INLINE float GetBloomThreshold() const { return mBloomThreshold; } - MCORE_INLINE float GetBloomIntensity() const { return mBloomIntensity; } - MCORE_INLINE float GetBloomRadius() const { return mBloomRadius; } - MCORE_INLINE bool GetDOFEnabled() const { return mDOFEnabled; } - MCORE_INLINE float GetDOFBlurRadius() const { return mDOFBlurRadius; } - MCORE_INLINE float GetDOFFocalDistance() const { return mDOFFocalDistance; } - MCORE_INLINE float GetDOFNear() const { return mDOFNear; } - MCORE_INLINE float GetDOFFar() const { return mDOFFar; } + MCORE_INLINE bool GetBloomEnabled() const { return m_bloomEnabled; } + MCORE_INLINE float GetBloomThreshold() const { return m_bloomThreshold; } + MCORE_INLINE float GetBloomIntensity() const { return m_bloomIntensity; } + MCORE_INLINE float GetBloomRadius() const { return m_bloomRadius; } + MCORE_INLINE bool GetDOFEnabled() const { return m_dofEnabled; } + MCORE_INLINE float GetDOFBlurRadius() const { return m_dofBlurRadius; } + MCORE_INLINE float GetDOFFocalDistance() const { return m_dofFocalDistance; } + MCORE_INLINE float GetDOFNear() const { return m_dofNear; } + MCORE_INLINE float GetDOFFar() const { return m_dofFar; } - MCORE_INLINE const MCore::RGBAColor& GetRimColor() const { return mRimColor; } - MCORE_INLINE float GetRimIntensity() const { return mRimIntensity; } - MCORE_INLINE float GetRimWidth() const { return mRimWidth; } - MCORE_INLINE float GetRimAngle() const { return mRimAngle; } + MCORE_INLINE const MCore::RGBAColor& GetRimColor() const { return m_rimColor; } + MCORE_INLINE float GetRimIntensity() const { return m_rimIntensity; } + MCORE_INLINE float GetRimWidth() const { return m_rimWidth; } + MCORE_INLINE float GetRimAngle() const { return m_rimAngle; } - MCORE_INLINE float GetMainLightIntensity() const { return mMainLightIntensity; } - MCORE_INLINE float GetMainLightAngleA() const { return mMainLightAngleA; } - MCORE_INLINE float GetMainLightAngleB() const { return mMainLightAngleB; } - MCORE_INLINE float GetSpecularIntensity() const { return mSpecularIntensity; } + MCORE_INLINE float GetMainLightIntensity() const { return m_mainLightIntensity; } + MCORE_INLINE float GetMainLightAngleA() const { return m_mainLightAngleA; } + MCORE_INLINE float GetMainLightAngleB() const { return m_mainLightAngleB; } + MCORE_INLINE float GetSpecularIntensity() const { return m_specularIntensity; } void SetupSunsetRim(); void SetupBlueRim(); @@ -143,58 +143,58 @@ namespace RenderGL bool ResizeTextures(uint32 screenWidth, uint32 screenHeight); bool CreateRandomVectorTexture(uint32 width, uint32 height); - bool mPostProcessing; - RenderTexture* mRenderTexture; // Active RT + bool m_postProcessing; + RenderTexture* m_renderTexture; // Active RT - GBuffer* mGBuffer; /**< The g-buffer. */ + GBuffer* m_gBuffer; /**< The g-buffer. */ - MCommon::Camera* mCamera; /**< The camera used for rendering. */ + MCommon::Camera* m_camera; /**< The camera used for rendering. */ - ShaderCache mShaderCache; /**< The shader manager used to load and manage vertex and pixel shaders. */ - AZ::IO::Path mShaderPath; /**< The absolute path to the directory where the shaders are located. This string will be added as prefix to each shader file the user tries to load. */ - MCore::RGBAColor mClearColor; /**< The scene background color. */ - MCore::RGBAColor mGradientSourceColor; /**< The background gradient source color. */ - MCore::RGBAColor mGradientTargetColor; /**< The background gradient target color. */ - bool mUseGradientBackground; - Shader* mActiveShader; /**< The currently used shader. */ + ShaderCache m_shaderCache; /**< The shader manager used to load and manage vertex and pixel shaders. */ + AZ::IO::Path m_shaderPath; /**< The absolute path to the directory where the shaders are located. This string will be added as prefix to each shader file the user tries to load. */ + MCore::RGBAColor m_clearColor; /**< The scene background color. */ + MCore::RGBAColor m_gradientSourceColor; /**< The background gradient source color. */ + MCore::RGBAColor m_gradientTargetColor; /**< The background gradient target color. */ + bool m_useGradientBackground; + Shader* m_activeShader; /**< The currently used shader. */ // post process shaders - PostProcessShader* mHBloom; - PostProcessShader* mVBloom; - PostProcessShader* mDownSample; - PostProcessShader* mHBlur; - PostProcessShader* mVBlur; - PostProcessShader* mDOF; - PostProcessShader* mSSDO; - PostProcessShader* mHSmartBlur; - PostProcessShader* mVSmartBlur; + PostProcessShader* m_hBloom; + PostProcessShader* m_vBloom; + PostProcessShader* m_downSample; + PostProcessShader* m_hBlur; + PostProcessShader* m_vBlur; + PostProcessShader* m_dof; + PostProcessShader* m_ssdo; + PostProcessShader* m_hSmartBlur; + PostProcessShader* m_vSmartBlur; - Texture* mRandomVectorTexture; - AZStd::vector mRandomOffsets; - static size_t mNumRandomOffsets; + Texture* m_randomVectorTexture; + AZStd::vector m_randomOffsets; + static size_t s_numRandomOffsets; - GLRenderUtil* mRenderUtil; /**< The rendering utility. */ - TextureCache mTextureCache; /**< The texture manager used to load and manage textures. */ + GLRenderUtil* m_renderUtil; /**< The rendering utility. */ + TextureCache m_textureCache; /**< The texture manager used to load and manage textures. */ - bool mBloomEnabled; - float mBloomThreshold; - float mBloomIntensity; - float mBloomRadius; - bool mDOFEnabled; - float mDOFFocalDistance; - float mDOFNear; - float mDOFFar; - float mDOFBlurRadius; - float mRimAngle; - float mRimWidth; - float mRimIntensity; - MCore::RGBAColor mRimColor; - float mMainLightIntensity; - float mMainLightAngleA; - float mMainLightAngleB; - float mSpecularIntensity; - bool mCreateMipMaps; - bool mSkipLoadingTextures; + bool m_bloomEnabled; + float m_bloomThreshold; + float m_bloomIntensity; + float m_bloomRadius; + bool m_dofEnabled; + float m_dofFocalDistance; + float m_dofNear; + float m_dofFar; + float m_dofBlurRadius; + float m_rimAngle; + float m_rimWidth; + float m_rimIntensity; + MCore::RGBAColor m_rimColor; + float m_mainLightIntensity; + float m_mainLightAngleA; + float m_mainLightAngleB; + float m_specularIntensity; + bool m_createMipMaps; + bool m_skipLoadingTextures; }; GraphicsManager* GetGraphicsManager(); diff --git a/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/IndexBuffer.cpp b/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/IndexBuffer.cpp index 279858aba7..01d1e7ef20 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/IndexBuffer.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/IndexBuffer.cpp @@ -17,23 +17,23 @@ namespace RenderGL // default constructor IndexBuffer::IndexBuffer() { - mBufferID = MCORE_INVALIDINDEX32; - mNumIndices = 0; + m_bufferId = MCORE_INVALIDINDEX32; + m_numIndices = 0; } // destructor IndexBuffer::~IndexBuffer() { - glDeleteBuffers(1, &mBufferID); + glDeleteBuffers(1, &m_bufferId); } // activate void IndexBuffer::Activate() { - assert(mBufferID != MCORE_INVALIDINDEX32); - glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, mBufferID); + assert(m_bufferId != MCORE_INVALIDINDEX32); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_bufferId); } @@ -64,8 +64,8 @@ namespace RenderGL } // generate the buffer ID and bind it - glGenBuffers(1, &mBufferID); - glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, mBufferID); + glGenBuffers(1, &m_bufferId); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_bufferId); glBufferData(GL_ELEMENT_ARRAY_BUFFER, (uint32)indexSize * numIndices, indexData, usageGL); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); /* @@ -103,7 +103,7 @@ namespace RenderGL } */ // adjust the number of indices - mNumIndices = numIndices; + m_numIndices = numIndices; return true; } @@ -112,7 +112,7 @@ namespace RenderGL // lock the buffer void* IndexBuffer::Lock(ELockMode lockMode) { - if (mNumIndices == 0) + if (m_numIndices == 0) { return nullptr; } @@ -135,8 +135,8 @@ namespace RenderGL } // lock the buffer - glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, mBufferID); - void* data = glMapBuffer(GL_ELEMENT_ARRAY_BUFFER, lockModeGL); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_bufferId); + void* data = m_glMapBuffer(GL_ELEMENT_ARRAY_BUFFER, lockModeGL); // check for failure if (data == nullptr) @@ -165,12 +165,12 @@ namespace RenderGL // unlock the buffer void IndexBuffer::Unlock() { - if (mNumIndices == 0) + if (m_numIndices == 0) { return; } - glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, mBufferID); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_bufferId); glUnmapBuffer(GL_ELEMENT_ARRAY_BUFFER); } diff --git a/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/IndexBuffer.h b/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/IndexBuffer.h index eef0ff1d7a..b09e5f394d 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/IndexBuffer.h +++ b/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/IndexBuffer.h @@ -35,8 +35,8 @@ namespace RenderGL void Activate(); - MCORE_INLINE uint32 GetBufferID() const { return mBufferID; } - MCORE_INLINE uint32 GetNumIndices() const { return mNumIndices; } + MCORE_INLINE uint32 GetBufferID() const { return m_bufferId; } + MCORE_INLINE uint32 GetNumIndices() const { return m_numIndices; } bool Init(EIndexSize indexSize, uint32 numIndices, EUsageMode usage, void* indexData = nullptr); @@ -44,8 +44,8 @@ namespace RenderGL void Unlock(); private: - uint32 mBufferID; // the buffer ID - uint32 mNumIndices; // the number of indices + uint32 m_bufferId; // the buffer ID + uint32 m_numIndices; // the number of indices // helpers bool GetIsSuccess(); diff --git a/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/Material.cpp b/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/Material.cpp index 0cdaa6d327..f79f8c3edd 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/Material.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/Material.cpp @@ -17,7 +17,7 @@ namespace RenderGL // constructor Material::Material(GLActor* actor) { - mActor = actor; + m_actor = actor; } @@ -52,7 +52,7 @@ namespace RenderGL Texture* Material::LoadTexture(const char* fileName, bool genMipMaps) { Texture* result = nullptr; - AZStd::string filename = mActor->GetTexturePath() + fileName; + AZStd::string filename = m_actor->GetTexturePath() + fileName; AZStd::string extension; AzFramework::StringFunc::Path::GetExtension(fileName, extension, false /* include dot */); diff --git a/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/Material.h b/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/Material.h index 9c0522a6da..825fa4c7b0 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/Material.h +++ b/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/Material.h @@ -24,45 +24,45 @@ namespace RenderGL { Primitive() { - mVertexOffset = 0; - mIndexOffset = 0; - mNumTriangles = 0; - mNumVertices = 0; + m_vertexOffset = 0; + m_indexOffset = 0; + m_numTriangles = 0; + m_numVertices = 0; - mNodeIndex = InvalidIndex; - mMaterialIndex = MCORE_INVALIDINDEX32; + m_nodeIndex = InvalidIndex; + m_materialIndex = MCORE_INVALIDINDEX32; } - size_t mNodeIndex; /**< The index of the node to which this primitive belongs to. */ - uint32 mVertexOffset; - uint32 mIndexOffset; /**< The starting index. */ - uint32 mNumTriangles; /**< The number of triangles in the primitive. */ - uint32 mNumVertices; /**< The number of vertices in the primitive. */ - uint32 mMaterialIndex; /**< The material index which is mapped to the primitive. */ + size_t m_nodeIndex; /**< The index of the node to which this primitive belongs to. */ + uint32 m_vertexOffset; + uint32 m_indexOffset; /**< The starting index. */ + uint32 m_numTriangles; /**< The number of triangles in the primitive. */ + uint32 m_numVertices; /**< The number of vertices in the primitive. */ + uint32 m_materialIndex; /**< The material index which is mapped to the primitive. */ - AZStd::vector mBoneNodeIndices;/**< Mapping from local bones 0-50 to nodes. */ + AZStd::vector m_boneNodeIndices;/**< Mapping from local bones 0-50 to nodes. */ }; // StandardVertex struct RENDERGL_API StandardVertex { - AZ::Vector3 mPosition; - AZ::Vector3 mNormal; - AZ::Vector4 mTangent; - AZ::Vector2 mUV; + AZ::Vector3 m_position; + AZ::Vector3 m_normal; + AZ::Vector4 m_tangent; + AZ::Vector2 m_uv; }; // SkinnedVertex struct RENDERGL_API SkinnedVertex { - AZ::Vector3 mPosition; - AZ::Vector3 mNormal; - AZ::Vector4 mTangent; - AZ::Vector2 mUV; - float mWeights[4]; - float mBoneIndices[4]; + AZ::Vector3 m_position; + AZ::Vector3 m_normal; + AZ::Vector4 m_tangent; + AZ::Vector2 m_uv; + float m_weights[4]; + float m_boneIndices[4]; }; @@ -103,7 +103,7 @@ namespace RenderGL Texture* LoadTexture(const char* fileName); const char* AttributeToString(const EAttribute attribute); - GLActor* mActor; + GLActor* m_actor; }; } diff --git a/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/PostProcessShader.cpp b/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/PostProcessShader.cpp index 84c369bcbc..a3ca0f33c4 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/PostProcessShader.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/PostProcessShader.cpp @@ -17,7 +17,7 @@ namespace RenderGL // default constructor PostProcessShader::PostProcessShader() { - mRT = nullptr; + m_rt = nullptr; } @@ -30,8 +30,8 @@ namespace RenderGL void PostProcessShader::ActivateRT(RenderTexture* target) { // Activate rt - mRT = target; - mRT->Activate(); + m_rt = target; + m_rt->Activate(); GLSLShader::Activate(); } @@ -73,8 +73,8 @@ namespace RenderGL { GLSLShader::Deactivate(); - mRT->Deactivate(); - mRT = nullptr; + m_rt->Deactivate(); + m_rt = nullptr; } @@ -89,8 +89,8 @@ namespace RenderGL // Render void PostProcessShader::Render() { - const float w = static_cast(mRT->GetWidth()); - const float h = static_cast(mRT->GetHeight()); + const float w = static_cast(m_rt->GetWidth()); + const float h = static_cast(m_rt->GetHeight()); // Setup ortho projection glMatrixMode(GL_PROJECTION); diff --git a/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/PostProcessShader.h b/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/PostProcessShader.h index 9e976d599e..644e47b9b9 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/PostProcessShader.h +++ b/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/PostProcessShader.h @@ -36,7 +36,7 @@ namespace RenderGL private: - RenderTexture* mRT; + RenderTexture* m_rt; }; } diff --git a/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/RenderTexture.cpp b/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/RenderTexture.cpp index d0285c457d..ac85fcf7d7 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/RenderTexture.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/RenderTexture.cpp @@ -19,21 +19,21 @@ namespace RenderGL // constructor RenderTexture::RenderTexture() { - mFormat = 0; - mWidth = 0; - mHeight = 0; - mFrameBuffer = 0; - mDepthBuffer = 0; - mTexture = 0; + m_format = 0; + m_width = 0; + m_height = 0; + m_frameBuffer = 0; + m_depthBuffer = 0; + m_texture = 0; } // destructor RenderTexture::~RenderTexture() { - glDeleteTextures(1, &mTexture); - glDeleteRenderbuffers(1, &mDepthBuffer); - glDeleteFramebuffers(1, &mFrameBuffer); + glDeleteTextures(1, &m_texture); + glDeleteRenderbuffers(1, &m_depthBuffer); + glDeleteFramebuffers(1, &m_frameBuffer); } @@ -47,15 +47,15 @@ namespace RenderGL // get the width and height of the current used viewport float glDimensions[4]; glGetFloatv(GL_VIEWPORT, glDimensions); - mPrevWidth = (uint32)glDimensions[2]; - mPrevHeight = (uint32)glDimensions[3]; + m_prevWidth = (uint32)glDimensions[2]; + m_prevHeight = (uint32)glDimensions[3]; // bind the render texture and frame buffer glBindTexture(GL_TEXTURE_2D, 0); - glBindFramebuffer(GL_FRAMEBUFFER, mFrameBuffer); + glBindFramebuffer(GL_FRAMEBUFFER, m_frameBuffer); // setup the new viewport - glViewport(0, 0, mWidth, mHeight); + glViewport(0, 0, m_width, m_height); GetGraphicsManager()->SetRenderTexture(this); } @@ -63,7 +63,7 @@ namespace RenderGL // clear the render texture void RenderTexture::Clear(const MCore::RGBAColor& color) { - glClearColor(color.r, color.g, color.b, color.a); + glClearColor(color.m_r, color.m_g, color.m_b, color.m_a); glClearDepth(1.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); } @@ -76,7 +76,7 @@ namespace RenderGL glBindFramebuffer(GL_FRAMEBUFFER, 0); // reset viewport to original dimensions - glViewport(0, 0, mPrevWidth, mPrevHeight); + glViewport(0, 0, m_prevWidth, m_prevHeight); GetGraphicsManager()->SetRenderTexture(nullptr); } @@ -84,10 +84,10 @@ namespace RenderGL // initialize the render texture bool RenderTexture::Init(int32 format, uint32 width, uint32 height, AZ::u32 depthBuffer) { - mFormat = format; - mWidth = width; - mHeight = height; - mDepthBuffer = depthBuffer; + m_format = format; + m_width = width; + m_height = height; + m_depthBuffer = depthBuffer; // check if the graphics hardware is capable of rendering to textures, return false if not if (hasOpenGLFeature(Framebuffers)) @@ -96,51 +96,51 @@ namespace RenderGL } // create surface IDs - glGenFramebuffers(1, &mFrameBuffer); - glGenTextures(1, &mTexture); + glGenFramebuffers(1, &m_frameBuffer); + glGenTextures(1, &m_texture); // if the depth buffer was not specified, generate it - if (mDepthBuffer == 0) + if (m_depthBuffer == 0) { - glGenRenderbuffers(1, &mDepthBuffer); + glGenRenderbuffers(1, &m_depthBuffer); } // check if initalization of the texture, the frame buffer and the depth buffer worked okay - if (mFrameBuffer == 0 || mDepthBuffer == 0 || mTexture == 0) + if (m_frameBuffer == 0 || m_depthBuffer == 0 || m_texture == 0) { - MCore::LogWarning("[OpenGL] RenderTexture failed to init (5d, %d, %d)", mFrameBuffer, mDepthBuffer, mTexture); + MCore::LogWarning("[OpenGL] RenderTexture failed to init (5d, %d, %d)", m_frameBuffer, m_depthBuffer, m_texture); return false; } // create the frame buffer object - glBindFramebuffer(GL_FRAMEBUFFER, mFrameBuffer); + glBindFramebuffer(GL_FRAMEBUFFER, m_frameBuffer); // setup channels GLenum glChannels = GL_RGBA; - if (mFormat == GL_ALPHA16F_ARB || mFormat == GL_ALPHA32F_ARB) + if (m_format == GL_ALPHA16F_ARB || m_format == GL_ALPHA32F_ARB) { glChannels = GL_ALPHA; } // create render target - glBindTexture(GL_TEXTURE_2D, mTexture); - glTexImage2D(GL_TEXTURE_2D, 0, mFormat, mWidth, mHeight, 0, glChannels, GL_FLOAT, nullptr); + glBindTexture(GL_TEXTURE_2D, m_texture); + glTexImage2D(GL_TEXTURE_2D, 0, m_format, m_width, m_height, 0, glChannels, GL_FLOAT, nullptr); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, mTexture, 0); + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, m_texture, 0); // create depth buffer if (depthBuffer == 0) { - glBindRenderbuffer(GL_RENDERBUFFER, mDepthBuffer); - glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT24, mWidth, mHeight); + glBindRenderbuffer(GL_RENDERBUFFER, m_depthBuffer); + glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT24, m_width, m_height); } - glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, mDepthBuffer); + glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, m_depthBuffer); if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) { diff --git a/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/RenderTexture.h b/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/RenderTexture.h index 51797e5c38..9839ca0a5f 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/RenderTexture.h +++ b/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/RenderTexture.h @@ -49,8 +49,8 @@ namespace RenderGL void Render(); - AZ::u32 GetDepthBuffer() const { return mDepthBuffer; } - int32 GetFormat() const { return mFormat; } + AZ::u32 GetDepthBuffer() const { return m_depthBuffer; } + int32 GetFormat() const { return m_format; } /** * Formats: GL_RGBA32F_ARB @@ -60,11 +60,11 @@ namespace RenderGL bool Init(int32 format, uint32 width, uint32 height, AZ::u32 depthBuffer = 0); private: - int32 mFormat; /*< . */ - uint32 mPrevHeight; /*< . */ - uint32 mPrevWidth; /*< . */ - AZ::u32 mFrameBuffer; - AZ::u32 mDepthBuffer; + int32 m_format; /*< . */ + uint32 m_prevHeight; /*< . */ + uint32 m_prevWidth; /*< . */ + AZ::u32 m_frameBuffer; + AZ::u32 m_depthBuffer; }; } diff --git a/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/ShaderCache.cpp b/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/ShaderCache.cpp index b02ab99505..4d25017831 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/ShaderCache.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/ShaderCache.cpp @@ -15,7 +15,7 @@ namespace RenderGL // constructor ShaderCache::ShaderCache() { - mEntries.reserve(128); + m_entries.reserve(128); } @@ -30,41 +30,41 @@ namespace RenderGL void ShaderCache::Release() { // delete all shaders - for (Entry& entry : mEntries) + for (Entry& entry : m_entries) { - entry.mName.clear(); - delete entry.mShader; + entry.m_name.clear(); + delete entry.m_shader; } // clear all entries - mEntries.clear(); + m_entries.clear(); } // add the shader to the cache (assume there are no duplicate names) void ShaderCache::AddShader(AZStd::string_view filename, Shader* shader) { - mEntries.emplace_back(Entry{filename, shader}); + m_entries.emplace_back(Entry{filename, shader}); } // try to locate a shader based on its name Shader* ShaderCache::FindShader(AZStd::string_view filename) const { - const auto foundShader = AZStd::find_if(begin(mEntries), end(mEntries), [filename](const Entry& entry) + const auto foundShader = AZStd::find_if(begin(m_entries), end(m_entries), [filename](const Entry& entry) { - return AzFramework::StringFunc::Equal(entry.mName, filename, false /* no case */); + return AzFramework::StringFunc::Equal(entry.m_name, filename, false /* no case */); }); - return foundShader != end(mEntries) ? foundShader->mShader : nullptr; + return foundShader != end(m_entries) ? foundShader->m_shader : nullptr; } // check if we have a given shader in the cache bool ShaderCache::CheckIfHasShader(Shader* shader) const { - return AZStd::any_of(begin(mEntries), end(mEntries), [shader](const Entry& entry) + return AZStd::any_of(begin(m_entries), end(m_entries), [shader](const Entry& entry) { - return entry.mShader == shader; + return entry.m_shader == shader; }); } } // namespace RenderGL diff --git a/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/StandardMaterial.cpp b/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/StandardMaterial.cpp index 18281f286b..c2537e4948 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/StandardMaterial.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/StandardMaterial.cpp @@ -20,13 +20,13 @@ namespace RenderGL StandardMaterial::StandardMaterial(GLActor* actor) : Material(actor) { - mMaterial = nullptr; - mActiveShader = nullptr; - mAttributesUpdated = true; + m_material = nullptr; + m_activeShader = nullptr; + m_attributesUpdated = true; - mDiffuseMap = GetGraphicsManager()->GetTextureCache()->GetWhiteTexture(); - mSpecularMap = GetGraphicsManager()->GetTextureCache()->GetWhiteTexture(); - mNormalMap = GetGraphicsManager()->GetTextureCache()->GetDefaultNormalTexture(); + m_diffuseMap = GetGraphicsManager()->GetTextureCache()->GetWhiteTexture(); + m_specularMap = GetGraphicsManager()->GetTextureCache()->GetWhiteTexture(); + m_normalMap = GetGraphicsManager()->GetTextureCache()->GetDefaultNormalTexture(); SetAttribute(LIGHTING, true); SetAttribute(SKINNING, false); @@ -48,7 +48,7 @@ namespace RenderGL UpdateShader(); // check if the shader is valid and return in case it's not - if (mActiveShader == nullptr) + if (m_activeShader == nullptr) { return; } @@ -58,103 +58,99 @@ namespace RenderGL if (flags & GLOBAL) { - mActiveShader->Activate(); + m_activeShader->Activate(); // vertex attributes - uint32 stride = mAttributes[SKINNING] ? sizeof(SkinnedVertex) : sizeof(StandardVertex); + uint32 stride = m_attributes[SKINNING] ? sizeof(SkinnedVertex) : sizeof(StandardVertex); static char* structStart = reinterpret_cast(reinterpret_cast(static_cast(0))); - static size_t offsetOfNormal = static_cast((reinterpret_cast(&static_cast(0)->mNormal)) - structStart); - static size_t offsetOfTangent = static_cast((reinterpret_cast(&static_cast(0)->mTangent)) - structStart); - static size_t offsetOfUV = static_cast((reinterpret_cast(&static_cast(0)->mUV)) - structStart); - static size_t offsetOfWeights = static_cast((reinterpret_cast(&static_cast(0)->mWeights)) - structStart); - static size_t offsetOfBoneIndices = static_cast((reinterpret_cast(&static_cast(0)->mBoneIndices)) - structStart); + static size_t offsetOfNormal = static_cast((reinterpret_cast(&static_cast(0)->m_normal)) - structStart); + static size_t offsetOfTangent = static_cast((reinterpret_cast(&static_cast(0)->m_tangent)) - structStart); + static size_t offsetOfUV = static_cast((reinterpret_cast(&static_cast(0)->m_uv)) - structStart); + static size_t offsetOfWeights = static_cast((reinterpret_cast(&static_cast(0)->m_weights)) - structStart); + static size_t offsetOfBoneIndices = static_cast((reinterpret_cast(&static_cast(0)->m_boneIndices)) - structStart); - mActiveShader->SetAttribute("inPosition", 4, GL_FLOAT, stride, 0); - mActiveShader->SetAttribute("inNormal", 4, GL_FLOAT, stride, offsetOfNormal); - mActiveShader->SetAttribute("inTangent", 4, GL_FLOAT, stride, offsetOfTangent); - mActiveShader->SetAttribute("inUV", 2, GL_FLOAT, stride, offsetOfUV); + m_activeShader->SetAttribute("inPosition", 4, GL_FLOAT, stride, 0); + m_activeShader->SetAttribute("inNormal", 4, GL_FLOAT, stride, offsetOfNormal); + m_activeShader->SetAttribute("inTangent", 4, GL_FLOAT, stride, offsetOfTangent); + m_activeShader->SetAttribute("inUV", 2, GL_FLOAT, stride, offsetOfUV); // vertex weights & indices - if (mAttributes[SKINNING]) + if (m_attributes[SKINNING]) { - mActiveShader->SetAttribute("inWeights", 4, GL_FLOAT, stride, offsetOfWeights); - mActiveShader->SetAttribute("inIndices", 4, GL_FLOAT, stride, offsetOfBoneIndices); + m_activeShader->SetAttribute("inWeights", 4, GL_FLOAT, stride, offsetOfWeights); + m_activeShader->SetAttribute("inIndices", 4, GL_FLOAT, stride, offsetOfBoneIndices); } // set the view projection matrix MCommon::Camera* camera = GetGraphicsManager()->GetCamera(); - mActiveShader->SetUniform("matViewProj", camera->GetViewProjMatrix()); - mActiveShader->SetUniform("matView", camera->GetViewMatrix()); + m_activeShader->SetUniform("matViewProj", camera->GetViewProjMatrix()); + m_activeShader->SetUniform("matView", camera->GetViewMatrix()); - // lights - // if (mAttributes[LIGHTING]) { AZ::Vector3 mainLightDir(0.0f, -1.0f, 0.0f); mainLightDir = AZ::Matrix3x3::CreateRotationX(MCore::Math::DegreesToRadians(gfx->GetMainLightAngleB())) * AZ::Matrix3x3::CreateRotationZ(MCore::Math::DegreesToRadians(gfx->GetMainLightAngleA())) * mainLightDir; mainLightDir.Normalize(); - mActiveShader->SetUniform("mainLightDir", mainLightDir); - mActiveShader->SetUniform("skyColor", mActor->GetSkyColor() * gfx->GetMainLightIntensity()); - mActiveShader->SetUniform("groundColor", mActor->GetGroundColor()); - mActiveShader->SetUniform("eyePoint", camera->GetPosition()); + m_activeShader->SetUniform("mainLightDir", mainLightDir); + m_activeShader->SetUniform("skyColor", m_actor->GetSkyColor() * gfx->GetMainLightIntensity()); + m_activeShader->SetUniform("groundColor", m_actor->GetGroundColor()); + m_activeShader->SetUniform("eyePoint", camera->GetPosition()); AZ::Vector3 rimLightDir = MCore::GetUp(camera->GetViewMatrix()); rimLightDir = AZ::Matrix3x3::CreateRotationZ(MCore::Math::DegreesToRadians(gfx->GetRimAngle())) * rimLightDir; rimLightDir.Normalize(); - mActiveShader->SetUniform("rimLightDir", rimLightDir); + m_activeShader->SetUniform("rimLightDir", rimLightDir); - mActiveShader->SetUniform("rimLightFactor", gfx->GetRimIntensity()); - mActiveShader->SetUniform("rimWidth", gfx->GetRimWidth()); - mActiveShader->SetUniform("rimLightColor", gfx->GetRimColor()); + m_activeShader->SetUniform("rimLightFactor", gfx->GetRimIntensity()); + m_activeShader->SetUniform("rimWidth", gfx->GetRimWidth()); + m_activeShader->SetUniform("rimLightColor", gfx->GetRimColor()); } } // Local settings if (flags & LOCAL) { - EMotionFX::StandardMaterial* stdMaterial = (mMaterial->GetType() == EMotionFX::StandardMaterial::TYPE_ID) ? static_cast(mMaterial) : nullptr; + EMotionFX::StandardMaterial* stdMaterial = (m_material->GetType() == EMotionFX::StandardMaterial::TYPE_ID) ? static_cast(m_material) : nullptr; - if (mDiffuseMap == nullptr || mDiffuseMap == gfx->GetTextureCache()->GetWhiteTexture() && stdMaterial) + if (m_diffuseMap == nullptr || m_diffuseMap == gfx->GetTextureCache()->GetWhiteTexture() && stdMaterial) { - mActiveShader->SetUniform("diffuseColor", stdMaterial->GetDiffuse()); + m_activeShader->SetUniform("diffuseColor", stdMaterial->GetDiffuse()); } else { - mActiveShader->SetUniform("diffuseColor", MCore::RGBAColor(1.0f, 1.0f, 1.0f, 1.0f)); + m_activeShader->SetUniform("diffuseColor", MCore::RGBAColor(1.0f, 1.0f, 1.0f, 1.0f)); } - //if (mAttributes[LIGHTING]) { if (stdMaterial) { MCore::RGBAColor specularColor = stdMaterial->GetSpecular() * (stdMaterial->GetShineStrength() * gfx->GetMainLightIntensity() * gfx->GetSpecularIntensity()); - mActiveShader->SetUniform("specularPower", stdMaterial->GetShine()); - mActiveShader->SetUniform("lightSpecular", specularColor); + m_activeShader->SetUniform("specularPower", stdMaterial->GetShine()); + m_activeShader->SetUniform("lightSpecular", specularColor); } else { MCore::RGBAColor specularColor = MCore::RGBAColor(1.0f, 1.0f, 1.0f) * (1.0f * gfx->GetMainLightIntensity() * gfx->GetSpecularIntensity()); - mActiveShader->SetUniform("specularPower", 25.0f); - mActiveShader->SetUniform("lightSpecular", specularColor); + m_activeShader->SetUniform("specularPower", 25.0f); + m_activeShader->SetUniform("lightSpecular", specularColor); } - mActiveShader->SetUniform("normalMap", mNormalMap); + m_activeShader->SetUniform("normalMap", m_normalMap); } - //if (mAttributes[TEXTURING]) { - mActiveShader->SetUniform("diffuseMap", mDiffuseMap); - mActiveShader->SetUniform("specularMap", mSpecularMap); + m_activeShader->SetUniform("diffuseMap", m_diffuseMap); + m_activeShader->SetUniform("specularMap", m_specularMap); } } // update the advanced rendering settings - mActiveShader->SetUniform("glowThreshold", gfx->GetBloomThreshold()); - mActiveShader->SetUniform("focalPlaneDepth", gfx->GetDOFFocalDistance()); - mActiveShader->SetUniform("nearPlaneDepth", gfx->GetDOFNear()); - mActiveShader->SetUniform("farPlaneDepth", gfx->GetDOFFar()); - mActiveShader->SetUniform("blurCutoff", 1.0f); + m_activeShader->SetUniform("glowThreshold", gfx->GetBloomThreshold()); + m_activeShader->SetUniform("focalPlaneDepth", gfx->GetDOFFocalDistance()); + m_activeShader->SetUniform("nearPlaneDepth", gfx->GetDOFNear()); + m_activeShader->SetUniform("farPlaneDepth", gfx->GetDOFFar()); + m_activeShader->SetUniform("blurCutoff", 1.0f); } @@ -162,13 +158,13 @@ namespace RenderGL void StandardMaterial::Deactivate() { // check if the shader is valid and return in case it's not - if (mActiveShader == nullptr) + if (m_activeShader == nullptr) { return; } // deactivate the active shader - mActiveShader->Deactivate(); + m_activeShader->Deactivate(); } @@ -176,7 +172,7 @@ namespace RenderGL bool StandardMaterial::Init(EMotionFX::Material* material) { initializeOpenGLFunctions(); - mMaterial = material; + m_material = material; if (material->GetType() == EMotionFX::StandardMaterial::TYPE_ID) { @@ -191,34 +187,34 @@ namespace RenderGL { case EMotionFX::StandardMaterialLayer::LAYERTYPE_DIFFUSE: { - mDiffuseMap = LoadTexture(layer->GetFileName()); - if (mDiffuseMap == nullptr) + m_diffuseMap = LoadTexture(layer->GetFileName()); + if (m_diffuseMap == nullptr) { - mDiffuseMap = GetGraphicsManager()->GetTextureCache()->GetWhiteTexture(); + m_diffuseMap = GetGraphicsManager()->GetTextureCache()->GetWhiteTexture(); } } break; case EMotionFX::StandardMaterialLayer::LAYERTYPE_SHINESTRENGTH: { - mSpecularMap = LoadTexture(layer->GetFileName()); - if (mSpecularMap == nullptr) + m_specularMap = LoadTexture(layer->GetFileName()); + if (m_specularMap == nullptr) { - mSpecularMap = GetGraphicsManager()->GetTextureCache()->GetWhiteTexture(); + m_specularMap = GetGraphicsManager()->GetTextureCache()->GetWhiteTexture(); } } break; case EMotionFX::StandardMaterialLayer::LAYERTYPE_BUMP: { - mNormalMap = LoadTexture(layer->GetFileName()); - if (mNormalMap == nullptr) + m_normalMap = LoadTexture(layer->GetFileName()); + if (m_normalMap == nullptr) { - mNormalMap = GetGraphicsManager()->GetTextureCache()->GetDefaultNormalTexture(); + m_normalMap = GetGraphicsManager()->GetTextureCache()->GetDefaultNormalTexture(); } } break; case EMotionFX::StandardMaterialLayer::LAYERTYPE_NORMALMAP: { - mNormalMap = LoadTexture(layer->GetFileName()); - if (mNormalMap == nullptr) + m_normalMap = LoadTexture(layer->GetFileName()); + if (m_normalMap == nullptr) { - mNormalMap = GetGraphicsManager()->GetTextureCache()->GetDefaultNormalTexture(); + m_normalMap = GetGraphicsManager()->GetTextureCache()->GetDefaultNormalTexture(); } } break; } @@ -232,10 +228,10 @@ namespace RenderGL // void StandardMaterial::SetAttribute(EAttribute attribute, bool enabled) { - if (mAttributes[attribute] != enabled) + if (m_attributes[attribute] != enabled) { - mAttributes[attribute] = enabled; - mAttributesUpdated = true; + m_attributes[attribute] = enabled; + m_attributesUpdated = true; } } @@ -244,7 +240,7 @@ namespace RenderGL void StandardMaterial::Render(EMotionFX::ActorInstance* actorInstance, const Primitive* primitive) { // check if the shader is valid and return in case it's not - if (mActiveShader == nullptr) + if (m_activeShader == nullptr) { return; } @@ -257,20 +253,20 @@ namespace RenderGL const EMotionFX::TransformData* transformData = actorInstance->GetTransformData(); - if (mAttributes[SKINNING]) + if (m_attributes[SKINNING]) { const AZ::Matrix3x4* skinningMatrices = transformData->GetSkinningMatrices(); // multiple each transform by its inverse bind pose - const size_t numBones = primitive->mBoneNodeIndices.size(); + const size_t numBones = primitive->m_boneNodeIndices.size(); for (size_t i = 0; i < numBones; ++i) { - const size_t nodeNr = primitive->mBoneNodeIndices[i]; + const size_t nodeNr = primitive->m_boneNodeIndices[i]; const AZ::Matrix3x4& skinTransform = skinningMatrices[nodeNr]; - mBoneMatrices[i] = AZ::Matrix4x4::CreateFromMatrix3x4(skinTransform); + m_boneMatrices[i] = AZ::Matrix4x4::CreateFromMatrix3x4(skinTransform); } - mActiveShader->SetUniform("matBones", mBoneMatrices, aznumeric_caster(numBones)); + m_activeShader->SetUniform("matBones", m_boneMatrices, aznumeric_caster(numBones)); } const MCommon::Camera* camera = GetGraphicsManager()->GetCamera(); @@ -280,13 +276,13 @@ namespace RenderGL const AZ::Matrix4x4 worldViewProj = camera->GetViewProjMatrix() * world; const AZ::Matrix4x4 worldIT = world.GetInverseFull().GetTranspose(); - mActiveShader->SetUniform("matWorld", world); - mActiveShader->SetUniform("matWorldIT", worldIT); - mActiveShader->SetUniform("matWorldView", worldView); - mActiveShader->SetUniform("matWorldViewProj", worldViewProj); + m_activeShader->SetUniform("matWorld", world); + m_activeShader->SetUniform("matWorldIT", worldIT); + m_activeShader->SetUniform("matWorldView", worldView); + m_activeShader->SetUniform("matWorldViewProj", worldViewProj); // render the primitive - glDrawElementsBaseVertex(GL_TRIANGLES, primitive->mNumTriangles * 3, GL_UNSIGNED_INT, (GLvoid*)(primitive->mIndexOffset * sizeof(uint32)), primitive->mVertexOffset); + glDrawElementsBaseVertex(GL_TRIANGLES, primitive->m_numTriangles * 3, GL_UNSIGNED_INT, (GLvoid*)(primitive->m_indexOffset * sizeof(uint32)), primitive->m_vertexOffset); } @@ -294,16 +290,16 @@ namespace RenderGL void StandardMaterial::UpdateShader() { // check if any attibutes have changed and skip directly if not - if (mAttributesUpdated == false) + if (m_attributesUpdated == false) { return; } // reset the active shader - mActiveShader = nullptr; + m_activeShader = nullptr; // get the number of shaders and iterate through them - for (GLSLShader* shader : mShaders) + for (GLSLShader* shader : m_shaders) { if (shader == nullptr) { @@ -314,7 +310,7 @@ namespace RenderGL bool match = true; for (uint32 n = 0; n < NUM_ATTRIBUTES; ++n) { - if (mAttributes[n]) + if (m_attributes[n]) { if (shader->CheckIfIsDefined(AttributeToString((EAttribute)n)) == false) { @@ -335,13 +331,13 @@ namespace RenderGL // in case we have found a matching shader update the active shader if (match) { - mActiveShader = shader; + m_activeShader = shader; break; } } // if we didn't find a matching shader, compile it new - if (mActiveShader == nullptr) + if (m_activeShader == nullptr) { // if this function gets called at runtime something is wrong, go bug hunting! @@ -349,17 +345,17 @@ namespace RenderGL AZStd::vector defines; for (uint32 n = 0; n < NUM_ATTRIBUTES; ++n) { - if (mAttributes[n]) + if (m_attributes[n]) { defines.emplace_back(AttributeToString((EAttribute)n)); } } // compile shader and add it to the list of shaders - mActiveShader = GetGraphicsManager()->LoadShader("StandardMaterial_VS.glsl", "StandardMaterial_PS.glsl", defines); - mShaders.emplace_back(mActiveShader); + m_activeShader = GetGraphicsManager()->LoadShader("StandardMaterial_VS.glsl", "StandardMaterial_PS.glsl", defines); + m_shaders.emplace_back(m_activeShader); } - mAttributesUpdated = false; + m_attributesUpdated = false; } } diff --git a/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/StandardMaterial.h b/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/StandardMaterial.h index d9eb23b50a..528269765c 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/StandardMaterial.h +++ b/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/StandardMaterial.h @@ -41,17 +41,17 @@ namespace RenderGL protected: void UpdateShader(); - bool mAttributes[NUM_ATTRIBUTES]; - bool mAttributesUpdated; + bool m_attributes[NUM_ATTRIBUTES]; + bool m_attributesUpdated; - GLSLShader* mActiveShader; - AZStd::vector mShaders; - AZ::Matrix4x4 mBoneMatrices[200]; - EMotionFX::Material* mMaterial; + GLSLShader* m_activeShader; + AZStd::vector m_shaders; + AZ::Matrix4x4 m_boneMatrices[200]; + EMotionFX::Material* m_material; - Texture* mDiffuseMap; - Texture* mSpecularMap; - Texture* mNormalMap; + Texture* m_diffuseMap; + Texture* m_specularMap; + Texture* m_normalMap; }; } // namespace RenderGL diff --git a/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/TextureCache.cpp b/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/TextureCache.cpp index dfdce36284..b2e0f46b53 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/TextureCache.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/TextureCache.cpp @@ -18,9 +18,9 @@ namespace RenderGL Texture::Texture() { initializeOpenGLFunctions(); - mTexture = 0; - mWidth = 0; - mHeight = 0; + m_texture = 0; + m_width = 0; + m_height = 0; } @@ -28,26 +28,26 @@ namespace RenderGL Texture::Texture(GLuint texID, uint32 width, uint32 height) { initializeOpenGLFunctions(); - mTexture = texID; - mWidth = width; - mHeight = height; + m_texture = texID; + m_width = width; + m_height = height; } // destructor Texture::~Texture() { - glDeleteTextures(1, &mTexture); + glDeleteTextures(1, &m_texture); } // constructor TextureCache::TextureCache() { - mWhiteTexture = nullptr; - mDefaultNormalTexture = nullptr; + m_whiteTexture = nullptr; + m_defaultNormalTexture = nullptr; - mEntries.reserve(128); + m_entries.reserve(128); } @@ -73,27 +73,27 @@ namespace RenderGL void TextureCache::Release() { // delete all textures - for (Entry& entry : mEntries) + for (Entry& entry : m_entries) { - delete entry.mTexture; + delete entry.m_texture; } // clear all entries - mEntries.clear(); + m_entries.clear(); // delete the white texture - delete mWhiteTexture; - mWhiteTexture = nullptr; + delete m_whiteTexture; + m_whiteTexture = nullptr; - delete mDefaultNormalTexture; - mDefaultNormalTexture = nullptr; + delete m_defaultNormalTexture; + m_defaultNormalTexture = nullptr; } // add the texture to the cache (assume there are no duplicate names) void TextureCache::AddTexture(const char* filename, Texture* texture) { - mEntries.emplace_back(Entry{filename, texture}); + m_entries.emplace_back(Entry{filename, texture}); } @@ -101,11 +101,11 @@ namespace RenderGL Texture* TextureCache::FindTexture(const char* filename) const { // get the number of entries and iterate through them - const auto foundEntry = AZStd::find_if(begin(mEntries), end(mEntries), [filename](const Entry& entry) + const auto foundEntry = AZStd::find_if(begin(m_entries), end(m_entries), [filename](const Entry& entry) { - return AzFramework::StringFunc::Equal(entry.mName.c_str(), filename, false /* no case */); + return AzFramework::StringFunc::Equal(entry.m_name.c_str(), filename, false /* no case */); }); - return foundEntry != end(mEntries) ? foundEntry->mTexture : nullptr; + return foundEntry != end(m_entries) ? foundEntry->m_texture : nullptr; } @@ -113,9 +113,9 @@ namespace RenderGL bool TextureCache::CheckIfHasTexture(Texture* texture) const { // get the number of entries and iterate through them - return AZStd::any_of(begin(mEntries), end(mEntries), [texture](const Entry& entry) + return AZStd::any_of(begin(m_entries), end(m_entries), [texture](const Entry& entry) { - return entry.mTexture == texture; + return entry.m_texture == texture; }); } @@ -123,15 +123,15 @@ namespace RenderGL // remove an item from the cache void TextureCache::RemoveTexture(Texture* texture) { - const auto foundEntry = AZStd::find_if(begin(mEntries), end(mEntries), [texture](const Entry& entry) + const auto foundEntry = AZStd::find_if(begin(m_entries), end(m_entries), [texture](const Entry& entry) { - return entry.mTexture == texture; + return entry.m_texture == texture; }); - if (foundEntry != end(mEntries)) + if (foundEntry != end(m_entries)) { - delete foundEntry->mTexture; - mEntries.erase(foundEntry); + delete foundEntry->m_texture; + m_entries.erase(foundEntry); } } @@ -156,7 +156,7 @@ namespace RenderGL glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, imageBuffer); glBindTexture(GL_TEXTURE_2D, 0); - mWhiteTexture = new Texture(textureID, width, height); + m_whiteTexture = new Texture(textureID, width, height); return true; } @@ -182,7 +182,7 @@ namespace RenderGL glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, imageBuffer); glBindTexture(GL_TEXTURE_2D, 0); - mDefaultNormalTexture = new Texture(textureID, width, height); + m_defaultNormalTexture = new Texture(textureID, width, height); return true; } } // namespace RenderGL diff --git a/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/TextureCache.h b/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/TextureCache.h index 43d0f1a635..4350cd67c7 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/TextureCache.h +++ b/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/TextureCache.h @@ -28,14 +28,14 @@ namespace RenderGL Texture(AZ::u32 texID, uint32 width, uint32 height); ~Texture(); - MCORE_INLINE uint32 GetHeight() const { return mHeight; } - MCORE_INLINE AZ::u32 GetID() const { return mTexture; } - MCORE_INLINE uint32 GetWidth() const { return mWidth; } + MCORE_INLINE uint32 GetHeight() const { return m_height; } + MCORE_INLINE AZ::u32 GetID() const { return m_texture; } + MCORE_INLINE uint32 GetWidth() const { return m_width; } protected: - AZ::u32 mTexture; - uint32 mWidth; - uint32 mHeight; + AZ::u32 m_texture; + uint32 m_width; + uint32 m_height; }; @@ -56,8 +56,8 @@ namespace RenderGL void AddTexture(const char* filename, Texture* texture); Texture* FindTexture(const char* filename) const; - MCORE_INLINE Texture* GetWhiteTexture() { return mWhiteTexture; } - MCORE_INLINE Texture* GetDefaultNormalTexture() { return mDefaultNormalTexture; } + MCORE_INLINE Texture* GetWhiteTexture() { return m_whiteTexture; } + MCORE_INLINE Texture* GetDefaultNormalTexture() { return m_defaultNormalTexture; } bool CheckIfHasTexture(Texture* texture) const; bool Init(); void RemoveTexture(Texture* texture); @@ -68,13 +68,13 @@ namespace RenderGL struct Entry { - AZStd::string mName; // the search key (unique for each texture) - Texture* mTexture; + AZStd::string m_name; // the search key (unique for each texture) + Texture* m_texture; }; - AZStd::vector mEntries; - Texture* mWhiteTexture; - Texture* mDefaultNormalTexture; + AZStd::vector m_entries; + Texture* m_whiteTexture; + Texture* m_defaultNormalTexture; }; } diff --git a/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/VertexBuffer.cpp b/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/VertexBuffer.cpp index ef062bca0b..8c1587a00e 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/VertexBuffer.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/VertexBuffer.cpp @@ -17,15 +17,15 @@ namespace RenderGL // constructor VertexBuffer::VertexBuffer() { - mBufferID = MCORE_INVALIDINDEX32; - mNumVertices = 0; + m_bufferId = MCORE_INVALIDINDEX32; + m_numVertices = 0; } // destructor VertexBuffer::~VertexBuffer() { - glDeleteBuffers(1, &mBufferID); + glDeleteBuffers(1, &m_bufferId); glBindBuffer(GL_ARRAY_BUFFER, 0); } @@ -33,8 +33,8 @@ namespace RenderGL // activate void VertexBuffer::Activate() { - MCORE_ASSERT(mBufferID != MCORE_INVALIDINDEX32); - glBindBuffer(GL_ARRAY_BUFFER, mBufferID); + MCORE_ASSERT(m_bufferId != MCORE_INVALIDINDEX32); + glBindBuffer(GL_ARRAY_BUFFER, m_bufferId); } @@ -71,13 +71,13 @@ namespace RenderGL } // generate the buffer and bind it - glGenBuffers(1, &mBufferID); - glBindBuffer(GL_ARRAY_BUFFER, mBufferID); + glGenBuffers(1, &m_bufferId); + glBindBuffer(GL_ARRAY_BUFFER, m_bufferId); glBufferData(GL_ARRAY_BUFFER, numBytesPerVertex * numVertices, vertexData, usageGL); glBindBuffer(GL_ARRAY_BUFFER, 0); // adjust the number of vertices - mNumVertices = numVertices; + m_numVertices = numVertices; return true; } @@ -85,7 +85,7 @@ namespace RenderGL // lock the buffer void* VertexBuffer::Lock(ELockMode lockMode) { - if (mNumVertices == 0) + if (m_numVertices == 0) { return nullptr; } @@ -107,8 +107,8 @@ namespace RenderGL lockModeGL = GL_WRITE_ONLY; } - glBindBuffer(GL_ARRAY_BUFFER, mBufferID); - void* data = glMapBuffer(GL_ARRAY_BUFFER, lockModeGL); + glBindBuffer(GL_ARRAY_BUFFER, m_bufferId); + void* data = m_glMapBuffer(GL_ARRAY_BUFFER, lockModeGL); // is the data valid? if (data == nullptr) @@ -138,12 +138,12 @@ namespace RenderGL // unlock the buffer void VertexBuffer::Unlock() { - if (mNumVertices == 0) + if (m_numVertices == 0) { return; } - glBindBuffer(GL_ARRAY_BUFFER, mBufferID); + glBindBuffer(GL_ARRAY_BUFFER, m_bufferId); glUnmapBuffer(GL_ARRAY_BUFFER); glBindBuffer(GL_ARRAY_BUFFER, 0); } diff --git a/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/VertexBuffer.h b/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/VertexBuffer.h index 1579a89226..c76cf5137a 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/VertexBuffer.h +++ b/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/VertexBuffer.h @@ -50,8 +50,8 @@ namespace RenderGL void Activate(); void Deactivate(); - MCORE_INLINE uint32 GetBufferID() const { return mBufferID; } - MCORE_INLINE uint32 GetNumVertices() const { return mNumVertices; } + MCORE_INLINE uint32 GetBufferID() const { return m_bufferId; } + MCORE_INLINE uint32 GetNumVertices() const { return m_numVertices; } bool Init(uint32 numBytesPerVertex, uint32 numVertices, EUsageMode usage, void* vertexData = nullptr); @@ -59,8 +59,8 @@ namespace RenderGL void Unlock(); private: - uint32 mBufferID; // the buffer ID - uint32 mNumVertices; // the number of vertices + uint32 m_bufferId; // the buffer ID + uint32 m_numVertices; // the number of vertices bool GetIsSuccess(); bool GetHasError(); diff --git a/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/glactor.h b/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/glactor.h index 0b87477114..36158306a1 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/glactor.h +++ b/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/glactor.h @@ -47,29 +47,29 @@ namespace RenderGL bool Init(EMotionFX::Actor* actor, const char* texturePath, bool gpuSkinning = true, bool removeGPUSkinnedMeshes = true); - MCORE_INLINE EMotionFX::Actor* GetActor() { return mActor; } - MCORE_INLINE const AZStd::string& GetTexturePath() const { return mTexturePath; } + MCORE_INLINE EMotionFX::Actor* GetActor() { return m_actor; } + MCORE_INLINE const AZStd::string& GetTexturePath() const { return m_texturePath; } void Render(EMotionFX::ActorInstance* actorInstance, uint32 renderFlags = RENDER_LIGHTING | RENDER_TEXTURING); - const MCore::RGBAColor& GetSkyColor() const { return mSkyColor; } - const MCore::RGBAColor& GetGroundColor() const { return mGroundColor; } - void SetGroundColor(const MCore::RGBAColor& color) { mGroundColor = color; } - void SetSkyColor(const MCore::RGBAColor& color) { mSkyColor = color; } + const MCore::RGBAColor& GetSkyColor() const { return m_skyColor; } + const MCore::RGBAColor& GetGroundColor() const { return m_groundColor; } + void SetGroundColor(const MCore::RGBAColor& color) { m_groundColor = color; } + void SetSkyColor(const MCore::RGBAColor& color) { m_skyColor = color; } private: struct RENDERGL_API MaterialPrimitives { - Material* mMaterial; - AZStd::vector mPrimitives[3]; + Material* m_material; + AZStd::vector m_primitives[3]; - MaterialPrimitives() { mMaterial = nullptr; mPrimitives[0].reserve(64); mPrimitives[1].reserve(64); mPrimitives[2].reserve(64); } - MaterialPrimitives(Material* mat) { mMaterial = mat; mPrimitives[0].reserve(64); mPrimitives[1].reserve(64); mPrimitives[2].reserve(64); } + MaterialPrimitives() { m_material = nullptr; m_primitives[0].reserve(64); m_primitives[1].reserve(64); m_primitives[2].reserve(64); } + MaterialPrimitives(Material* mat) { m_material = mat; m_primitives[0].reserve(64); m_primitives[1].reserve(64); m_primitives[2].reserve(64); } }; - AZStd::string mTexturePath; - EMotionFX::Actor* mActor; - bool mEnableGPUSkinning; + AZStd::string m_texturePath; + EMotionFX::Actor* m_actor; + bool m_enableGpuSkinning; void Cleanup(); @@ -85,14 +85,14 @@ namespace RenderGL EMotionFX::Mesh::EMeshType ClassifyMeshType(EMotionFX::Node* node, EMotionFX::Mesh* mesh, size_t lodLevel); - AZStd::vector< AZStd::vector > mMaterials; - MCore::Array2D mDynamicNodes; - MCore::Array2D mPrimitives[3]; - AZStd::vector mHomoMaterials; - AZStd::vector mVertexBuffers[3]; - AZStd::vector mIndexBuffers[3]; - MCore::RGBAColor mGroundColor; - MCore::RGBAColor mSkyColor; + AZStd::vector< AZStd::vector > m_materials; + MCore::Array2D m_dynamicNodes; + MCore::Array2D m_primitives[3]; + AZStd::vector m_homoMaterials; + AZStd::vector m_vertexBuffers[3]; + AZStd::vector m_indexBuffers[3]; + MCore::RGBAColor m_groundColor; + MCore::RGBAColor m_skyColor; GLActor(); ~GLActor(); diff --git a/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/shadercache.h b/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/shadercache.h index 08bf9dfa58..d33cfcfd7d 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/shadercache.h +++ b/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/shadercache.h @@ -37,12 +37,12 @@ namespace RenderGL // a cache entry struct Entry { - AZStd::string mName; // the search key (unique for each shader) - Shader* mShader; + AZStd::string m_name; // the search key (unique for each shader) + Shader* m_shader; }; // - AZStd::vector mEntries; // the shader cache entries + AZStd::vector m_entries; // the shader cache entries }; } // namespace RenderGL diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/Actor.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/Actor.cpp index 6f1293e1a3..df039b7186 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/Actor.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/Actor.cpp @@ -57,14 +57,14 @@ namespace EMotionFX Actor::NodeLODInfo::NodeLODInfo() { - mMesh = nullptr; - mStack = nullptr; + m_mesh = nullptr; + m_stack = nullptr; } Actor::NodeLODInfo::~NodeLODInfo() { - MCore::Destroy(mMesh); - MCore::Destroy(mStack); + MCore::Destroy(m_mesh); + MCore::Destroy(m_stack); } //---------------------------------------------------- @@ -73,33 +73,33 @@ namespace EMotionFX { SetName(name); - mSkeleton = Skeleton::Create(); + m_skeleton = Skeleton::Create(); - mMotionExtractionNode = InvalidIndex; - mRetargetRootNode = InvalidIndex; - mThreadIndex = 0; - mCustomData = nullptr; - mID = aznumeric_caster(MCore::GetIDGenerator().GenerateID()); - mUnitType = GetEMotionFX().GetUnitType(); - mFileUnitType = mUnitType; + m_motionExtractionNode = InvalidIndex; + m_retargetRootNode = InvalidIndex; + m_threadIndex = 0; + m_customData = nullptr; + m_id = aznumeric_caster(MCore::GetIDGenerator().GenerateID()); + m_unitType = GetEMotionFX().GetUnitType(); + m_fileUnitType = m_unitType; m_staticAabb = AZ::Aabb::CreateNull(); - mUsedForVisualization = false; - mDirtyFlag = false; + m_usedForVisualization = false; + m_dirtyFlag = false; m_physicsSetup = AZStd::make_shared(); m_simulatedObjectSetup = AZStd::make_shared(this); m_optimizeSkeleton = false; #if defined(EMFX_DEVELOPMENT_BUILD) - mIsOwnedByRuntime = false; + m_isOwnedByRuntime = false; #endif // EMFX_DEVELOPMENT_BUILD // make sure we have at least allocated the first LOD of materials and facial setups - mMaterials.reserve(4); // reserve space for 4 lods - mMorphSetups.reserve(4); // - mMaterials.emplace_back(); - mMorphSetups.emplace_back(nullptr); + m_materials.reserve(4); // reserve space for 4 lods + m_morphSetups.reserve(4); // + m_materials.emplace_back(); + m_morphSetups.emplace_back(nullptr); GetEventManager().OnCreateActor(this); ActorNotificationBus::Broadcast(&ActorNotificationBus::Events::OnActorCreated, this); @@ -110,15 +110,15 @@ namespace EMotionFX ActorNotificationBus::Broadcast(&ActorNotificationBus::Events::OnActorDestroyed, this); GetEventManager().OnDeleteActor(this); - mNodeMirrorInfos.clear(); + m_nodeMirrorInfos.clear(); RemoveAllMaterials(); RemoveAllMorphSetups(); RemoveAllNodeGroups(); - mInvBindPoseTransforms.clear(); + m_invBindPoseTransforms.clear(); - MCore::Destroy(mSkeleton); + MCore::Destroy(m_skeleton); } // creates a clone of the actor (a copy). @@ -130,41 +130,41 @@ namespace EMotionFX result->SetFileName(GetFileName()); // copy the actor attributes - result->mMotionExtractionNode = mMotionExtractionNode; - result->mUnitType = mUnitType; - result->mFileUnitType = mFileUnitType; + result->m_motionExtractionNode = m_motionExtractionNode; + result->m_unitType = m_unitType; + result->m_fileUnitType = m_fileUnitType; result->m_staticAabb = m_staticAabb; - result->mRetargetRootNode = mRetargetRootNode; - result->mInvBindPoseTransforms = mInvBindPoseTransforms; + result->m_retargetRootNode = m_retargetRootNode; + result->m_invBindPoseTransforms = m_invBindPoseTransforms; result->m_optimizeSkeleton = m_optimizeSkeleton; result->m_skinToSkeletonIndexMap = m_skinToSkeletonIndexMap; result->RecursiveAddDependencies(this); // clone all nodes groups - for (uint32 i = 0; i < mNodeGroups.GetLength(); ++i) + for (uint32 i = 0; i < m_nodeGroups.GetLength(); ++i) { - result->AddNodeGroup(aznew NodeGroup(*mNodeGroups[i])); + result->AddNodeGroup(aznew NodeGroup(*m_nodeGroups[i])); } // clone the materials - result->mMaterials.resize(mMaterials.size()); - for (size_t i = 0; i < mMaterials.size(); ++i) + result->m_materials.resize(m_materials.size()); + for (size_t i = 0; i < m_materials.size(); ++i) { // get the number of materials in the current LOD - result->mMaterials[i].reserve(mMaterials[i].size()); - for (const Material* material : mMaterials[i]) + result->m_materials[i].reserve(m_materials[i].size()); + for (const Material* material : m_materials[i]) { result->AddMaterial(i, material->Clone()); } } // clone the skeleton - MCore::Destroy(result->mSkeleton); - result->mSkeleton = mSkeleton->Clone(); + MCore::Destroy(result->m_skeleton); + result->m_skeleton = m_skeleton->Clone(); // clone lod data - const size_t numNodes = mSkeleton->GetNumNodes(); + const size_t numNodes = m_skeleton->GetNumNodes(); const size_t numLodLevels = m_meshLodData.m_lodLevels.size(); MeshLODData& resultMeshLodData = result->m_meshLodData; @@ -172,26 +172,26 @@ namespace EMotionFX result->SetNumLODLevels(static_cast(numLodLevels)); for (size_t lodLevel = 0; lodLevel < numLodLevels; ++lodLevel) { - const AZStd::vector& nodeInfos = m_meshLodData.m_lodLevels[lodLevel].mNodeInfos; - AZStd::vector& resultNodeInfos = resultMeshLodData.m_lodLevels[lodLevel].mNodeInfos; + const AZStd::vector& nodeInfos = m_meshLodData.m_lodLevels[lodLevel].m_nodeInfos; + AZStd::vector& resultNodeInfos = resultMeshLodData.m_lodLevels[lodLevel].m_nodeInfos; resultNodeInfos.resize(numNodes); for (size_t n = 0; n < numNodes; ++n) { NodeLODInfo& resultNodeInfo = resultNodeInfos[n]; const NodeLODInfo& sourceNodeInfo = nodeInfos[n]; - resultNodeInfo.mMesh = (sourceNodeInfo.mMesh) ? sourceNodeInfo.mMesh->Clone() : nullptr; - resultNodeInfo.mStack = (sourceNodeInfo.mStack) ? sourceNodeInfo.mStack->Clone(resultNodeInfo.mMesh) : nullptr; + resultNodeInfo.m_mesh = (sourceNodeInfo.m_mesh) ? sourceNodeInfo.m_mesh->Clone() : nullptr; + resultNodeInfo.m_stack = (sourceNodeInfo.m_stack) ? sourceNodeInfo.m_stack->Clone(resultNodeInfo.m_mesh) : nullptr; } } // clone the morph setups - result->mMorphSetups.resize(mMorphSetups.size()); - for (size_t i = 0; i < mMorphSetups.size(); ++i) + result->m_morphSetups.resize(m_morphSetups.size()); + for (size_t i = 0; i < m_morphSetups.size(); ++i) { - if (mMorphSetups[i]) + if (m_morphSetups[i]) { - result->SetMorphSetup(i, mMorphSetups[i]->Clone()); + result->SetMorphSetup(i, m_morphSetups[i]->Clone()); } else { @@ -200,12 +200,12 @@ namespace EMotionFX } // make sure the number of root nodes is still the same - MCORE_ASSERT(result->GetSkeleton()->GetNumRootNodes() == mSkeleton->GetNumRootNodes()); + MCORE_ASSERT(result->GetSkeleton()->GetNumRootNodes() == m_skeleton->GetNumRootNodes()); // copy the transform data result->CopyTransformsFrom(this); - result->mNodeMirrorInfos = mNodeMirrorInfos; + result->m_nodeMirrorInfos = m_nodeMirrorInfos; result->m_physicsSetup = m_physicsSetup; result->SetSimulatedObjectSetup(m_simulatedObjectSetup->Clone(result.get())); @@ -222,37 +222,37 @@ namespace EMotionFX // init node mirror info void Actor::AllocateNodeMirrorInfos() { - const size_t numNodes = mSkeleton->GetNumNodes(); - mNodeMirrorInfos.resize(numNodes); + const size_t numNodes = m_skeleton->GetNumNodes(); + m_nodeMirrorInfos.resize(numNodes); // init the data for (size_t i = 0; i < numNodes; ++i) { - mNodeMirrorInfos[i].mSourceNode = static_cast(i); - mNodeMirrorInfos[i].mAxis = MCORE_INVALIDINDEX8; - mNodeMirrorInfos[i].mFlags = 0; + m_nodeMirrorInfos[i].m_sourceNode = static_cast(i); + m_nodeMirrorInfos[i].m_axis = MCORE_INVALIDINDEX8; + m_nodeMirrorInfos[i].m_flags = 0; } } // remove the node mirror info void Actor::RemoveNodeMirrorInfos() { - mNodeMirrorInfos.clear(); - mNodeMirrorInfos.shrink_to_fit(); + m_nodeMirrorInfos.clear(); + m_nodeMirrorInfos.shrink_to_fit(); } // check if we have our axes detected bool Actor::GetHasMirrorAxesDetected() const { - if (mNodeMirrorInfos.empty()) + if (m_nodeMirrorInfos.empty()) { return false; } - return AZStd::all_of(begin(mNodeMirrorInfos), end(mNodeMirrorInfos), [](const NodeMirrorInfo& nodeMirrorInfo) + return AZStd::all_of(begin(m_nodeMirrorInfos), end(m_nodeMirrorInfos), [](const NodeMirrorInfo& nodeMirrorInfo) { - return nodeMirrorInfo.mAxis != MCORE_INVALIDINDEX8; + return nodeMirrorInfo.m_axis != MCORE_INVALIDINDEX8; }); } @@ -261,7 +261,7 @@ namespace EMotionFX void Actor::RemoveAllMaterials() { // for all LODs - for (AZStd::vector& materials : mMaterials) + for (AZStd::vector& materials : m_materials) { // delete all materials for (Material* material : materials) @@ -270,7 +270,7 @@ namespace EMotionFX } } - mMaterials.clear(); + m_materials.clear(); } @@ -281,8 +281,8 @@ namespace EMotionFX lodLevels.emplace_back(); LODLevel& newLOD = lodLevels.back(); - const size_t numNodes = mSkeleton->GetNumNodes(); - newLOD.mNodeInfos.resize(numNodes); + const size_t numNodes = m_skeleton->GetNumNodes(); + newLOD.m_nodeInfos.resize(numNodes); const size_t numLODs = lodLevels.size(); const size_t lodIndex = numLODs - 1; @@ -290,25 +290,25 @@ namespace EMotionFX // get the number of nodes, iterate through them, create a new LOD level and copy over the meshes from the last LOD level for (size_t i = 0; i < numNodes; ++i) { - NodeLODInfo& newLODInfo = lodLevels[lodIndex].mNodeInfos[static_cast(i)]; + NodeLODInfo& newLODInfo = lodLevels[lodIndex].m_nodeInfos[static_cast(i)]; if (copyFromLastLODLevel && lodIndex > 0) { - const NodeLODInfo& prevLODInfo = lodLevels[lodIndex - 1].mNodeInfos[static_cast(i)]; - newLODInfo.mMesh = (prevLODInfo.mMesh) ? prevLODInfo.mMesh->Clone() : nullptr; - newLODInfo.mStack = (prevLODInfo.mStack) ? prevLODInfo.mStack->Clone(newLODInfo.mMesh) : nullptr; + const NodeLODInfo& prevLODInfo = lodLevels[lodIndex - 1].m_nodeInfos[static_cast(i)]; + newLODInfo.m_mesh = (prevLODInfo.m_mesh) ? prevLODInfo.m_mesh->Clone() : nullptr; + newLODInfo.m_stack = (prevLODInfo.m_stack) ? prevLODInfo.m_stack->Clone(newLODInfo.m_mesh) : nullptr; } else { - newLODInfo.mMesh = nullptr; - newLODInfo.mStack = nullptr; + newLODInfo.m_mesh = nullptr; + newLODInfo.m_stack = nullptr; } } // create a new material array for the new LOD level - mMaterials.resize(lodLevels.size()); + m_materials.resize(lodLevels.size()); // create an empty morph setup for the new LOD level - mMorphSetups.emplace_back(nullptr); + m_morphSetups.emplace_back(nullptr); // copy data from the previous LOD level if wanted if (copyFromLastLODLevel && numLODs > 0) @@ -325,22 +325,22 @@ namespace EMotionFX lodLevels.emplace(lodLevels.begin()+insertAt); LODLevel& newLOD = lodLevels[insertAt]; const size_t lodIndex = insertAt; - const size_t numNodes = mSkeleton->GetNumNodes(); - newLOD.mNodeInfos.resize(numNodes); + const size_t numNodes = m_skeleton->GetNumNodes(); + newLOD.m_nodeInfos.resize(numNodes); // get the number of nodes, iterate through them, create a new LOD level and copy over the meshes from the last LOD level for (size_t i = 0; i < numNodes; ++i) { - NodeLODInfo& lodInfo = lodLevels[lodIndex].mNodeInfos[i]; - lodInfo.mMesh = nullptr; - lodInfo.mStack = nullptr; + NodeLODInfo& lodInfo = lodLevels[lodIndex].m_nodeInfos[i]; + lodInfo.m_mesh = nullptr; + lodInfo.m_stack = nullptr; } // create a new material array for the new LOD level - mMaterials.emplace(AZStd::next(begin(mMaterials), insertAt)); + m_materials.emplace(AZStd::next(begin(m_materials), insertAt)); // create an empty morph setup for the new LOD level - mMorphSetups.emplace(AZStd::next(begin(mMorphSetups), insertAt), nullptr); + m_morphSetups.emplace(AZStd::next(begin(m_morphSetups), insertAt), nullptr); } // replace existing LOD level with the current actor @@ -352,10 +352,10 @@ namespace EMotionFX const LODLevel& sourceLOD = copyLodLevels[copyLODLevel]; LODLevel& targetLOD = lodLevels[replaceLODLevel]; - const size_t numNodes = mSkeleton->GetNumNodes(); + const size_t numNodes = m_skeleton->GetNumNodes(); for (size_t i = 0; i < numNodes; ++i) { - Node* node = mSkeleton->GetNode(i); + Node* node = m_skeleton->GetNode(i); Node* copyNode = copyActor->GetSkeleton()->FindNodeByID(node->GetID()); if (copyNode == nullptr) @@ -363,28 +363,28 @@ namespace EMotionFX MCore::LogWarning("Actor::CopyLODLevel() - Failed to find node '%s' in the actor we want to copy from.", node->GetName()); } - const NodeLODInfo& sourceNodeInfo = sourceLOD.mNodeInfos[ copyNode->GetNodeIndex() ]; - NodeLODInfo& targetNodeInfo = targetLOD.mNodeInfos[i]; + const NodeLODInfo& sourceNodeInfo = sourceLOD.m_nodeInfos[ copyNode->GetNodeIndex() ]; + NodeLODInfo& targetNodeInfo = targetLOD.m_nodeInfos[i]; // first get rid of existing data - MCore::Destroy(targetNodeInfo.mMesh); - targetNodeInfo.mMesh = nullptr; - MCore::Destroy(targetNodeInfo.mStack); - targetNodeInfo.mStack = nullptr; + MCore::Destroy(targetNodeInfo.m_mesh); + targetNodeInfo.m_mesh = nullptr; + MCore::Destroy(targetNodeInfo.m_stack); + targetNodeInfo.m_stack = nullptr; // if the node exists in both models if (copyNode) { // copy over the mesh and collision mesh - if (sourceNodeInfo.mMesh) + if (sourceNodeInfo.m_mesh) { - targetNodeInfo.mMesh = sourceNodeInfo.mMesh->Clone(); + targetNodeInfo.m_mesh = sourceNodeInfo.m_mesh->Clone(); } // handle the stacks - if (sourceNodeInfo.mStack) + if (sourceNodeInfo.m_stack) { - targetNodeInfo.mStack = sourceNodeInfo.mStack->Clone(targetNodeInfo.mMesh); + targetNodeInfo.m_stack = sourceNodeInfo.m_stack->Clone(targetNodeInfo.m_mesh); } // copy the skeletal LOD flag @@ -397,30 +397,30 @@ namespace EMotionFX // copy the materials const size_t numMaterials = copyActor->GetNumMaterials(copyLODLevel); - for (Material* i : mMaterials[replaceLODLevel]) + for (Material* i : m_materials[replaceLODLevel]) { i->Destroy(); } - mMaterials[replaceLODLevel].clear(); - mMaterials[replaceLODLevel].reserve(numMaterials); + m_materials[replaceLODLevel].clear(); + m_materials[replaceLODLevel].reserve(numMaterials); for (size_t i = 0; i < numMaterials; ++i) { AddMaterial(replaceLODLevel, copyActor->GetMaterial(copyLODLevel, i)->Clone()); } // copy the morph setup - if (mMorphSetups[replaceLODLevel]) + if (m_morphSetups[replaceLODLevel]) { - mMorphSetups[replaceLODLevel]->Destroy(); + m_morphSetups[replaceLODLevel]->Destroy(); } if (copyActor->GetMorphSetup(copyLODLevel)) { - mMorphSetups[replaceLODLevel] = copyActor->GetMorphSetup(copyLODLevel)->Clone(); + m_morphSetups[replaceLODLevel] = copyActor->GetMorphSetup(copyLODLevel)->Clone(); } else { - mMorphSetups[replaceLODLevel] = nullptr; + m_morphSetups[replaceLODLevel] = nullptr; } } @@ -430,30 +430,30 @@ namespace EMotionFX m_meshLodData.m_lodLevels.resize(numLODs); // reserve space for the materials - mMaterials.resize(numLODs); + m_materials.resize(numLODs); if (adjustMorphSetup) { - mMorphSetups.resize(numLODs); - AZStd::fill(begin(mMorphSetups), AZStd::next(begin(mMorphSetups), numLODs), nullptr); + m_morphSetups.resize(numLODs); + AZStd::fill(begin(m_morphSetups), AZStd::next(begin(m_morphSetups), numLODs), nullptr); } } // removes all node meshes and stacks void Actor::RemoveAllNodeMeshes() { - const size_t numNodes = mSkeleton->GetNumNodes(); + const size_t numNodes = m_skeleton->GetNumNodes(); AZStd::vector& lodLevels = m_meshLodData.m_lodLevels; for (LODLevel& lodLevel : lodLevels) { for (size_t i = 0; i < numNodes; ++i) { - NodeLODInfo& info = lodLevel.mNodeInfos[i]; - MCore::Destroy(info.mMesh); - info.mMesh = nullptr; - MCore::Destroy(info.mStack); - info.mStack = nullptr; + NodeLODInfo& info = lodLevel.m_nodeInfos[i]; + MCore::Destroy(info.m_mesh); + info.m_mesh = nullptr; + MCore::Destroy(info.m_stack); + info.m_stack = nullptr; } } } @@ -465,7 +465,7 @@ namespace EMotionFX uint32 totalVerts = 0; uint32 totalIndices = 0; - const size_t numNodes = mSkeleton->GetNumNodes(); + const size_t numNodes = m_skeleton->GetNumNodes(); for (size_t i = 0; i < numNodes; ++i) { Mesh* mesh = GetMesh(lodLevel, i); @@ -503,7 +503,7 @@ namespace EMotionFX uint32 totalIndices = 0; // for all nodes - const size_t numNodes = mSkeleton->GetNumNodes(); + const size_t numNodes = m_skeleton->GetNumNodes(); for (size_t i = 0; i < numNodes; ++i) { Mesh* mesh = GetMesh(lodLevel, i); @@ -547,7 +547,7 @@ namespace EMotionFX uint32 totalIndices = 0; // for all nodes - const size_t numNodes = mSkeleton->GetNumNodes(); + const size_t numNodes = m_skeleton->GetNumNodes(); for (size_t i = 0; i < numNodes; ++i) { Mesh* mesh = GetMesh(lodLevel, i); @@ -588,7 +588,7 @@ namespace EMotionFX { size_t maxInfluences = 0; - const size_t numNodes = mSkeleton->GetNumNodes(); + const size_t numNodes = m_skeleton->GetNumNodes(); for (size_t i = 0; i < numNodes; ++i) { Mesh* mesh = GetMesh(lodLevel, i); @@ -608,7 +608,7 @@ namespace EMotionFX void Actor::VerifySkinning(AZStd::vector& conflictNodeFlags, size_t skeletalLODLevel, size_t geometryLODLevel) { // get the number of nodes - const size_t numNodes = mSkeleton->GetNumNodes(); + const size_t numNodes = m_skeleton->GetNumNodes(); // check if the conflict node flag array's size is set to the number of nodes inside the actor if (conflictNodeFlags.size() != numNodes) @@ -623,7 +623,7 @@ namespace EMotionFX for (size_t n = 0; n < numNodes; ++n) { // get the current node and the pointer to the mesh for the given lod level - Node* node = mSkeleton->GetNode(n); + Node* node = m_skeleton->GetNode(n); Mesh* mesh = GetMesh(geometryLODLevel, n); // skip nodes without meshes @@ -696,7 +696,7 @@ namespace EMotionFX bool Actor::CheckIfHasMeshes(size_t lodLevel) const { // check if any of the nodes has a mesh - const size_t numNodes = mSkeleton->GetNumNodes(); + const size_t numNodes = m_skeleton->GetNumNodes(); for (size_t i = 0; i < numNodes; ++i) { if (GetMesh(lodLevel, i)) @@ -712,7 +712,7 @@ namespace EMotionFX bool Actor::CheckIfHasSkinnedMeshes(size_t lodLevel) const { - const size_t numNodes = mSkeleton->GetNumNodes(); + const size_t numNodes = m_skeleton->GetNumNodes(); for (size_t i = 0; i < numNodes; ++i) { const Mesh* mesh = GetMesh(lodLevel, i); @@ -749,7 +749,7 @@ namespace EMotionFX const size_t numLODs = GetNumLODLevels(); // for all LODs, get rid of all the morph setups for each geometry LOD - for (MorphSetup* morphSetup : mMorphSetups) + for (MorphSetup* morphSetup : m_morphSetups) { if (morphSetup) { @@ -763,7 +763,7 @@ namespace EMotionFX if (deleteMeshDeformers) { // for all nodes - const size_t numNodes = mSkeleton->GetNumNodes(); + const size_t numNodes = m_skeleton->GetNumNodes(); for (size_t i = 0; i < numNodes; ++i) { // process all LOD levels @@ -818,7 +818,7 @@ namespace EMotionFX bool Actor::CheckIfIsMaterialUsed(size_t lodLevel, size_t index) const { // iterate through all nodes of the actor and check its meshes - const size_t numNodes = mSkeleton->GetNumNodes(); + const size_t numNodes = m_skeleton->GetNumNodes(); for (size_t i = 0; i < numNodes; ++i) { // if the mesh is in LOD range check if it uses the material @@ -836,11 +836,11 @@ namespace EMotionFX // remove the given material and reassign all material numbers of the submeshes void Actor::RemoveMaterial(size_t lodLevel, size_t index) { - MCORE_ASSERT(lodLevel < mMaterials.size()); + MCORE_ASSERT(lodLevel < m_materials.size()); // first of all remove the given material - mMaterials[lodLevel][index]->Destroy(); - mMaterials[lodLevel].erase(AZStd::next(begin(mMaterials[lodLevel]), index)); + m_materials[lodLevel][index]->Destroy(); + m_materials[lodLevel].erase(AZStd::next(begin(m_materials[lodLevel]), index)); } @@ -854,11 +854,11 @@ namespace EMotionFX size_t maxNumChilds = 0; // traverse through all root nodes - const size_t numRootNodes = mSkeleton->GetNumRootNodes(); + const size_t numRootNodes = m_skeleton->GetNumRootNodes(); for (size_t i = 0; i < numRootNodes; ++i) { // get the given root node from the actor - Node* rootNode = mSkeleton->GetNode(mSkeleton->GetRootNodeIndex(i)); + Node* rootNode = m_skeleton->GetNode(m_skeleton->GetRootNodeIndex(i)); // get the number of child nodes recursively const size_t numChildNodes = rootNode->GetNumChildNodesRecursive(); @@ -890,7 +890,7 @@ namespace EMotionFX outBoneList->clear(); // for all nodes - const size_t numNodes = mSkeleton->GetNumNodes(); + const size_t numNodes = m_skeleton->GetNumNodes(); for (size_t n = 0; n < numNodes; ++n) { Mesh* mesh = GetMesh(lodLevel, n); @@ -938,22 +938,22 @@ namespace EMotionFX for (size_t i = 0; i < numDependencies; ++i) { // add it to the actor instance - mDependencies.emplace_back(*actor->GetDependency(i)); + m_dependencies.emplace_back(*actor->GetDependency(i)); // recursive into the actor we are dependent on - RecursiveAddDependencies(actor->GetDependency(i)->mActor); + RecursiveAddDependencies(actor->GetDependency(i)->m_actor); } } // remove all node groups void Actor::RemoveAllNodeGroups() { - const uint32 numGroups = mNodeGroups.GetLength(); + const uint32 numGroups = m_nodeGroups.GetLength(); for (uint32 i = 0; i < numGroups; ++i) { - delete mNodeGroups[i]; + delete m_nodeGroups[i]; } - mNodeGroups.Clear(); + m_nodeGroups.Clear(); } @@ -966,11 +966,11 @@ namespace EMotionFX AZStd::string nameB; // search through all nodes to find the best match - const size_t numNodes = mSkeleton->GetNumNodes(); + const size_t numNodes = m_skeleton->GetNumNodes(); for (size_t n = 0; n < numNodes; ++n) { // get the node name - const char* name = mSkeleton->GetNode(n)->GetName(); + const char* name = m_skeleton->GetNode(n)->GetName(); // check if a substring appears inside this node's name if (strstr(name, subStringB)) @@ -1023,28 +1023,28 @@ namespace EMotionFX bool Actor::MapNodeMotionSource(const char* sourceNodeName, const char* destNodeName) { // find the source node index - const size_t sourceNodeIndex = mSkeleton->FindNodeByNameNoCase(sourceNodeName)->GetNodeIndex(); + const size_t sourceNodeIndex = m_skeleton->FindNodeByNameNoCase(sourceNodeName)->GetNodeIndex(); if (sourceNodeIndex == InvalidIndex) { return false; } // find the dest node index - const size_t destNodeIndex = mSkeleton->FindNodeByNameNoCase(destNodeName)->GetNodeIndex(); + const size_t destNodeIndex = m_skeleton->FindNodeByNameNoCase(destNodeName)->GetNodeIndex(); if (destNodeIndex == InvalidIndex) { return false; } // allocate the data if we haven't already - if (mNodeMirrorInfos.empty()) + if (m_nodeMirrorInfos.empty()) { AllocateNodeMirrorInfos(); } // apply the mapping - mNodeMirrorInfos[ destNodeIndex ].mSourceNode = static_cast(sourceNodeIndex); - mNodeMirrorInfos[ sourceNodeIndex ].mSourceNode = static_cast(destNodeIndex); + m_nodeMirrorInfos[ destNodeIndex ].m_sourceNode = static_cast(sourceNodeIndex); + m_nodeMirrorInfos[ sourceNodeIndex ].m_sourceNode = static_cast(destNodeIndex); // we succeeded, because both source and dest have been found return true; @@ -1055,14 +1055,14 @@ namespace EMotionFX bool Actor::MapNodeMotionSource(uint16 sourceNodeIndex, uint16 targetNodeIndex) { // allocate the data if we haven't already - if (mNodeMirrorInfos.empty()) + if (m_nodeMirrorInfos.empty()) { AllocateNodeMirrorInfos(); } // apply the mapping - mNodeMirrorInfos[ targetNodeIndex ].mSourceNode = static_cast(sourceNodeIndex); - mNodeMirrorInfos[ sourceNodeIndex ].mSourceNode = static_cast(targetNodeIndex); + m_nodeMirrorInfos[ targetNodeIndex ].m_sourceNode = static_cast(sourceNodeIndex); + m_nodeMirrorInfos[ sourceNodeIndex ].m_sourceNode = static_cast(targetNodeIndex); // we succeeded, because both source and dest have been found return true; @@ -1075,10 +1075,10 @@ namespace EMotionFX void Actor::MatchNodeMotionSources(const char* subStringA, const char* subStringB) { // try to map all nodes - const size_t numNodes = mSkeleton->GetNumNodes(); + const size_t numNodes = m_skeleton->GetNumNodes(); for (size_t i = 0; i < numNodes; ++i) { - Node* node = mSkeleton->GetNode(i); + Node* node = m_skeleton->GetNode(i); // find the best match const uint16 bestIndex = FindBestMatchForNode(node->GetName(), subStringA, subStringB); @@ -1086,8 +1086,8 @@ namespace EMotionFX // if a best match has been found if (bestIndex != MCORE_INVALIDINDEX16) { - MCore::LogDetailedInfo("%s <---> %s", node->GetName(), mSkeleton->GetNode(bestIndex)->GetName()); - MapNodeMotionSource(node->GetName(), mSkeleton->GetNode(bestIndex)->GetName()); + MCore::LogDetailedInfo("%s <---> %s", node->GetName(), m_skeleton->GetNode(bestIndex)->GetName()); + MapNodeMotionSource(node->GetName(), m_skeleton->GetNode(bestIndex)->GetName()); } } } @@ -1096,14 +1096,14 @@ namespace EMotionFX // set the name of the actor void Actor::SetName(const char* name) { - mName = name; + m_name = name; } // set the filename of the actor void Actor::SetFileName(const char* filename) { - mFileName = filename; + m_fileName = filename; } @@ -1114,13 +1114,13 @@ namespace EMotionFX do { - curNodeIndex = mSkeleton->GetNode(curNodeIndex)->GetParentIndex(); + curNodeIndex = m_skeleton->GetNode(curNodeIndex)->GetParentIndex(); if (curNodeIndex == InvalidIndex) { return curNodeIndex; } - if (mSkeleton->GetNode(curNodeIndex)->GetSkeletalLODStatus(skeletalLOD)) + if (m_skeleton->GetNode(curNodeIndex)->GetSkeletalLODStatus(skeletalLOD)) { return curNodeIndex; } @@ -1140,10 +1140,10 @@ namespace EMotionFX for (size_t geomLod = 0; geomLod < numGeomLODs; ++geomLod) { // for all nodes - const size_t numNodes = mSkeleton->GetNumNodes(); + const size_t numNodes = m_skeleton->GetNumNodes(); for (size_t n = 0; n < numNodes; ++n) { - Node* node = mSkeleton->GetNode(n); + Node* node = m_skeleton->GetNode(n); // check if this node has a mesh, if not we can skip it Mesh* mesh = GetMesh(static_cast(geomLod), n); @@ -1182,7 +1182,7 @@ namespace EMotionFX { // if the bone is disabled SkinInfluence* influence = layer->GetInfluence(orgVertex, i); - if (mSkeleton->GetNode(influence->GetNodeNr())->GetSkeletalLODStatus(static_cast(geomLod)) == false) + if (m_skeleton->GetNode(influence->GetNodeNr())->GetSkeletalLODStatus(static_cast(geomLod)) == false) { // find the first parent bone that is enabled in this LOD const size_t newNodeIndex = FindFirstActiveParentBone(geomLod, influence->GetNodeNr()); @@ -1227,7 +1227,7 @@ namespace EMotionFX outPath.reserve(32); // start at the end effector - Node* currentNode = mSkeleton->GetNode(endNodeIndex); + Node* currentNode = m_skeleton->GetNode(endNodeIndex); while (currentNode) { // add the current node to the update list @@ -1252,16 +1252,16 @@ namespace EMotionFX void Actor::SetMotionExtractionNodeIndex(size_t nodeIndex) { - mMotionExtractionNode = nodeIndex; + m_motionExtractionNode = nodeIndex; ActorNotificationBus::Broadcast(&ActorNotificationBus::Events::OnMotionExtractionNodeChanged, this, GetMotionExtractionNode()); } Node* Actor::GetMotionExtractionNode() const { - if (mMotionExtractionNode != InvalidIndex && - mMotionExtractionNode < mSkeleton->GetNumNodes()) + if (m_motionExtractionNode != InvalidIndex && + m_motionExtractionNode < m_skeleton->GetNumNodes()) { - return mSkeleton->GetNode(mMotionExtractionNode); + return m_skeleton->GetNode(m_motionExtractionNode); } return nullptr; @@ -1270,10 +1270,10 @@ namespace EMotionFX void Actor::ReinitializeMeshDeformers() { const size_t numLODLevels = GetNumLODLevels(); - const size_t numNodes = mSkeleton->GetNumNodes(); + const size_t numNodes = m_skeleton->GetNumNodes(); for (size_t i = 0; i < numNodes; ++i) { - Node* node = mSkeleton->GetNode(i); + Node* node = m_skeleton->GetNode(i); // iterate through all LOD levels for (size_t lodLevel = 0; lodLevel < numLODLevels; ++lodLevel) @@ -1291,18 +1291,18 @@ namespace EMotionFX // post init void Actor::PostCreateInit(bool makeGeomLodsCompatibleWithSkeletalLODs, bool convertUnitType) { - if (mThreadIndex == MCORE_INVALIDINDEX32) + if (m_threadIndex == MCORE_INVALIDINDEX32) { - mThreadIndex = 0; + m_threadIndex = 0; } // calculate the inverse bind pose matrices const Pose* bindPose = GetBindPose(); - const size_t numNodes = mSkeleton->GetNumNodes(); - mInvBindPoseTransforms.resize(numNodes); + const size_t numNodes = m_skeleton->GetNumNodes(); + m_invBindPoseTransforms.resize(numNodes); for (size_t i = 0; i < numNodes; ++i) { - mInvBindPoseTransforms[i] = bindPose->GetModelSpaceTransform(i).Inversed(); + m_invBindPoseTransforms[i] = bindPose->GetModelSpaceTransform(i).Inversed(); } // make sure the skinning info doesn't use any disabled bones @@ -1315,12 +1315,12 @@ namespace EMotionFX ReinitializeMeshDeformers(); // make sure our world space bind pose is updated too - if (mMorphSetups.size() > 0 && mMorphSetups[0]) + if (m_morphSetups.size() > 0 && m_morphSetups[0]) { - mSkeleton->GetBindPose()->ResizeNumMorphs(mMorphSetups[0]->GetNumMorphTargets()); + m_skeleton->GetBindPose()->ResizeNumMorphs(m_morphSetups[0]->GetNumMorphTargets()); } - mSkeleton->GetBindPose()->ForceUpdateFullModelSpacePose(); - mSkeleton->GetBindPose()->ZeroMorphWeights(); + m_skeleton->GetBindPose()->ForceUpdateFullModelSpacePose(); + m_skeleton->GetBindPose()->ZeroMorphWeights(); if (!GetHasMirrorInfo()) { @@ -1446,10 +1446,10 @@ namespace EMotionFX { // Optional, not all actors have morph targets. const size_t numLODLevels = m_meshAsset->GetLodAssets().size(); - mMorphSetups.resize(numLODLevels); + m_morphSetups.resize(numLODLevels); for (size_t i = 0; i < numLODLevels; ++i) { - mMorphSetups[i] = nullptr; + m_morphSetups[i] = nullptr; } } @@ -1466,7 +1466,7 @@ namespace EMotionFX // update the static AABB (very heavy as it has to create an actor instance, update mesh deformers, calculate the mesh based bounds etc) void Actor::UpdateStaticAabb() { - ActorInstance* actorInstance = ActorInstance::Create(this, nullptr, mThreadIndex); + ActorInstance* actorInstance = ActorInstance::Create(this, nullptr, m_threadIndex); actorInstance->UpdateMeshDeformers(0.0f); actorInstance->UpdateStaticBasedAabbDimensions(); actorInstance->GetStaticBasedAabb(&m_staticAabb); @@ -1480,7 +1480,7 @@ namespace EMotionFX outPoints.clear(); const size_t geomLODLevel = 0; - const size_t numNodes = mSkeleton->GetNumNodes(); + const size_t numNodes = m_skeleton->GetNumNodes(); for (size_t nodeIndex = 0; nodeIndex < numNodes; nodeIndex++) { @@ -1548,17 +1548,17 @@ namespace EMotionFX Pose pose; pose.LinkToActor(this); - const size_t numNodes = mNodeMirrorInfos.size(); + const size_t numNodes = m_nodeMirrorInfos.size(); for (size_t i = 0; i < numNodes; ++i) { - const uint16 motionSource = (GetHasMirrorInfo()) ? GetNodeMirrorInfo(i).mSourceNode : static_cast(i); + const uint16 motionSource = (GetHasMirrorInfo()) ? GetNodeMirrorInfo(i).m_sourceNode : static_cast(i); // displace the local transform a bit, and calculate its mirrored model space position pose.InitFromBindPose(this); Transform localTransform = pose.GetLocalSpaceTransform(motionSource); Transform orgDelta = Transform::CreateIdentity(); - orgDelta.mPosition.Set(1.1f, 2.2f, 3.3f); - orgDelta.mRotation = MCore::AzEulerAnglesToAzQuat(0.1f, 0.2f, 0.3f); + orgDelta.m_position.Set(1.1f, 2.2f, 3.3f); + orgDelta.m_rotation = MCore::AzEulerAnglesToAzQuat(0.1f, 0.2f, 0.3f); Transform delta = orgDelta; delta.Multiply(localTransform); pose.SetLocalSpaceTransform(motionSource, delta); @@ -1584,12 +1584,11 @@ namespace EMotionFX const Transform& modelSpaceResult = pose.GetModelSpaceTransform(i); // check if we have a matching distance in model space - const float dist = MCore::SafeLength(modelSpaceResult.mPosition - endModelSpaceTransform.mPosition); + const float dist = MCore::SafeLength(modelSpaceResult.m_position - endModelSpaceTransform.m_position); if (dist <= MCore::Math::epsilon) { - //MCore::LogInfo("%s = %f (axis=%d)", mNodes[i]->GetName(), dist, a); - mNodeMirrorInfos[i].mAxis = a; - mNodeMirrorInfos[i].mFlags = 0; + m_nodeMirrorInfos[i].m_axis = a; + m_nodeMirrorInfos[i].m_flags = 0; found = true; break; } @@ -1637,12 +1636,11 @@ namespace EMotionFX const Transform& modelSpaceResult = pose.GetModelSpaceTransform(i); // check if we have a matching distance in world space - const float dist = MCore::SafeLength(modelSpaceResult.mPosition - endModelSpaceTransform.mPosition); + const float dist = MCore::SafeLength(modelSpaceResult.m_position - endModelSpaceTransform.m_position); if (dist <= MCore::Math::epsilon) { - //MCore::LogInfo("*** %s = %f (axis=%d) (flip=%d)", mNodes[i]->GetName(), dist, a, f); - mNodeMirrorInfos[i].mAxis = a; - mNodeMirrorInfos[i].mFlags = flags; + m_nodeMirrorInfos[i].m_axis = a; + m_nodeMirrorInfos[i].m_flags = flags; found = true; break; } @@ -1665,9 +1663,8 @@ namespace EMotionFX if (found == false) { - mNodeMirrorInfos[i].mAxis = bestAxis; - mNodeMirrorInfos[i].mFlags = bestFlags; - //MCore::LogInfo("best for %s = %f (axis=%d) (flags=%d)", mNodes[i]->GetName(), minDist, bestAxis, bestFlags); + m_nodeMirrorInfos[i].m_axis = bestAxis; + m_nodeMirrorInfos[i].m_flags = bestFlags; } } } @@ -1676,21 +1673,21 @@ namespace EMotionFX // get the array of node mirror infos const AZStd::vector& Actor::GetNodeMirrorInfos() const { - return mNodeMirrorInfos; + return m_nodeMirrorInfos; } // get the array of node mirror infos AZStd::vector& Actor::GetNodeMirrorInfos() { - return mNodeMirrorInfos; + return m_nodeMirrorInfos; } // set the node mirror infos directly void Actor::SetNodeMirrorInfos(const AZStd::vector& mirrorInfos) { - mNodeMirrorInfos = mirrorInfos; + m_nodeMirrorInfos = mirrorInfos; } @@ -1700,11 +1697,9 @@ namespace EMotionFX Pose pose; pose.InitFromBindPose(this); - const uint16 numNodes = static_cast(mSkeleton->GetNumNodes()); + const uint16 numNodes = static_cast(m_skeleton->GetNumNodes()); for (uint16 i = 0; i < numNodes; ++i) { - //Node* node = mNodes[i]; - // find the best match const uint16 bestIndex = FindBestMirrorMatchForNode(i, pose); @@ -1721,7 +1716,7 @@ namespace EMotionFX // find the best matching node index uint16 Actor::FindBestMirrorMatchForNode(uint16 nodeIndex, Pose& pose) const { - if (mSkeleton->GetNode(nodeIndex)->GetIsRootNode()) + if (m_skeleton->GetNode(nodeIndex)->GetIsRootNode()) { return MCORE_INVALIDINDEX16; } @@ -1734,7 +1729,7 @@ namespace EMotionFX uint16 result = MCORE_INVALIDINDEX16; // find nodes that have the mirrored transform - const size_t numNodes = mSkeleton->GetNumNodes(); + const size_t numNodes = m_skeleton->GetNumNodes(); for (size_t i = 0; i < numNodes; ++i) { const Transform& curNodeTransform = pose.GetModelSpaceTransform(i); @@ -1743,12 +1738,12 @@ namespace EMotionFX // only check the translation for now #ifndef EMFX_SCALE_DISABLED if (MCore::Compare::CheckIfIsClose( - curNodeTransform.mPosition, - mirroredTransform.mPosition, MCore::Math::epsilon) && - MCore::Compare::CheckIfIsClose(MCore::SafeLength(curNodeTransform.mScale), - MCore::SafeLength(mirroredTransform.mScale), MCore::Math::epsilon)) + curNodeTransform.m_position, + mirroredTransform.m_position, MCore::Math::epsilon) && + MCore::Compare::CheckIfIsClose(MCore::SafeLength(curNodeTransform.m_scale), + MCore::SafeLength(mirroredTransform.m_scale), MCore::Math::epsilon)) #else - if (MCore::Compare::CheckIfIsClose(curNodeTransform.mPosition, mirroredTransform.mPosition, MCore::Math::epsilon)) + if (MCore::Compare::CheckIfIsClose(curNodeTransform.m_position, mirroredTransform.m_position, MCore::Math::epsilon)) #endif { numMatches++; @@ -1759,8 +1754,8 @@ namespace EMotionFX if (numMatches == 1) { - const size_t hierarchyDepth = mSkeleton->CalcHierarchyDepthForNode(nodeIndex); - const size_t matchingHierarchyDepth = mSkeleton->CalcHierarchyDepthForNode(result); + const size_t hierarchyDepth = m_skeleton->CalcHierarchyDepthForNode(nodeIndex); + const size_t matchingHierarchyDepth = m_skeleton->CalcHierarchyDepthForNode(result); if (hierarchyDepth != matchingHierarchyDepth) { return MCORE_INVALIDINDEX16; @@ -1776,7 +1771,7 @@ namespace EMotionFX // resize the transform arrays to the current number of nodes void Actor::ResizeTransformData() { - Pose& bindPose = *mSkeleton->GetBindPose(); + Pose& bindPose = *m_skeleton->GetBindPose(); bindPose.LinkToActor(this, Pose::FLAG_LOCALTRANSFORMREADY, false); const size_t numMorphs = bindPose.GetNumMorphWeights(); @@ -1785,55 +1780,55 @@ namespace EMotionFX bindPose.SetMorphWeight(i, 0.0f); } - mInvBindPoseTransforms.resize(mSkeleton->GetNumNodes()); + m_invBindPoseTransforms.resize(m_skeleton->GetNumNodes()); } // release any transform data void Actor::ReleaseTransformData() { - mSkeleton->GetBindPose()->Clear(); - mInvBindPoseTransforms.clear(); + m_skeleton->GetBindPose()->Clear(); + m_invBindPoseTransforms.clear(); } // copy transforms from another actor void Actor::CopyTransformsFrom(const Actor* other) { - MCORE_ASSERT(other->GetNumNodes() == mSkeleton->GetNumNodes()); + MCORE_ASSERT(other->GetNumNodes() == m_skeleton->GetNumNodes()); ResizeTransformData(); - mInvBindPoseTransforms = other->mInvBindPoseTransforms; - *mSkeleton->GetBindPose() = *other->GetSkeleton()->GetBindPose(); + m_invBindPoseTransforms = other->m_invBindPoseTransforms; + *m_skeleton->GetBindPose() = *other->GetSkeleton()->GetBindPose(); } void Actor::SetNumNodes(size_t numNodes) { - mSkeleton->SetNumNodes(numNodes); + m_skeleton->SetNumNodes(numNodes); AZStd::vector& lodLevels = m_meshLodData.m_lodLevels; for (LODLevel& lodLevel : lodLevels) { - lodLevel.mNodeInfos.resize(numNodes); + lodLevel.m_nodeInfos.resize(numNodes); } - Pose* bindPose = mSkeleton->GetBindPose(); + Pose* bindPose = m_skeleton->GetBindPose(); bindPose->LinkToActor(this, Pose::FLAG_LOCALTRANSFORMREADY, false); } void Actor::AddNode(Node* node) { - mSkeleton->AddNode(node); - mSkeleton->GetBindPose()->LinkToActor(this, Pose::FLAG_LOCALTRANSFORMREADY, false); + m_skeleton->AddNode(node); + m_skeleton->GetBindPose()->LinkToActor(this, Pose::FLAG_LOCALTRANSFORMREADY, false); // initialize the LOD data AZStd::vector& lodLevels = m_meshLodData.m_lodLevels; for (LODLevel& lodLevel : lodLevels) { - lodLevel.mNodeInfos.emplace_back(); + lodLevel.m_nodeInfos.emplace_back(); } - mSkeleton->GetBindPose()->LinkToActor(this, Pose::FLAG_LOCALTRANSFORMREADY, false); - mSkeleton->GetBindPose()->SetLocalSpaceTransform(mSkeleton->GetNumNodes() - 1, Transform::CreateIdentity()); + m_skeleton->GetBindPose()->LinkToActor(this, Pose::FLAG_LOCALTRANSFORMREADY, false); + m_skeleton->GetBindPose()->SetLocalSpaceTransform(m_skeleton->GetNumNodes() - 1, Transform::CreateIdentity()); } Node* Actor::AddNode(size_t nodeIndex, const char* name, size_t parentIndex) @@ -1855,37 +1850,37 @@ namespace EMotionFX void Actor::RemoveNode(size_t nr, bool delMem) { - mSkeleton->RemoveNode(nr, delMem); + m_skeleton->RemoveNode(nr, delMem); AZStd::vector& lodLevels = m_meshLodData.m_lodLevels; for (LODLevel& lodLevel : lodLevels) { - lodLevel.mNodeInfos.erase(AZStd::next(begin(lodLevel.mNodeInfos), nr)); + lodLevel.m_nodeInfos.erase(AZStd::next(begin(lodLevel.m_nodeInfos), nr)); } } void Actor::DeleteAllNodes() { - mSkeleton->RemoveAllNodes(); + m_skeleton->RemoveAllNodes(); AZStd::vector& lodLevels = m_meshLodData.m_lodLevels; for (LODLevel& lodLevel : lodLevels) { - lodLevel.mNodeInfos.clear(); + lodLevel.m_nodeInfos.clear(); } } void Actor::ReserveMaterials(size_t lodLevel, size_t numMaterials) { - mMaterials[lodLevel].reserve(numMaterials); + m_materials[lodLevel].reserve(numMaterials); } // get a material Material* Actor::GetMaterial(size_t lodLevel, size_t nr) const { - MCORE_ASSERT(lodLevel < mMaterials.size()); - MCORE_ASSERT(nr < mMaterials[lodLevel].size()); - return mMaterials[lodLevel][nr]; + MCORE_ASSERT(lodLevel < m_materials.size()); + MCORE_ASSERT(nr < m_materials[lodLevel].size()); + return m_materials[lodLevel][nr]; } @@ -1893,27 +1888,27 @@ namespace EMotionFX size_t Actor::FindMaterialIndexByName(size_t lodLevel, const char* name) const { // search through all materials - const auto foundMaterial = AZStd::find_if(mMaterials[lodLevel].begin(), mMaterials[lodLevel].end(), [name](const Material* material) + const auto foundMaterial = AZStd::find_if(m_materials[lodLevel].begin(), m_materials[lodLevel].end(), [name](const Material* material) { return material->GetNameString() == name; }); - return foundMaterial != mMaterials[lodLevel].end() ? AZStd::distance(mMaterials[lodLevel].begin(), foundMaterial) : InvalidIndex; + return foundMaterial != m_materials[lodLevel].end() ? AZStd::distance(m_materials[lodLevel].begin(), foundMaterial) : InvalidIndex; } // set a material void Actor::SetMaterial(size_t lodLevel, size_t nr, Material* mat) { - mMaterials[lodLevel][nr] = mat; + m_materials[lodLevel][nr] = mat; } void Actor::AddMaterial(size_t lodLevel, Material* mat) { - mMaterials[lodLevel].emplace_back(mat); + m_materials[lodLevel].emplace_back(mat); } size_t Actor::GetNumMaterials(size_t lodLevel) const { - return mMaterials[lodLevel].size(); + return m_materials[lodLevel].size(); } size_t Actor::GetNumLODLevels() const @@ -1924,67 +1919,67 @@ namespace EMotionFX void* Actor::GetCustomData() const { - return mCustomData; + return m_customData; } void Actor::SetCustomData(void* dataPointer) { - mCustomData = dataPointer; + m_customData = dataPointer; } const char* Actor::GetName() const { - return mName.c_str(); + return m_name.c_str(); } const AZStd::string& Actor::GetNameString() const { - return mName; + return m_name; } const char* Actor::GetFileName() const { - return mFileName.c_str(); + return m_fileName.c_str(); } const AZStd::string& Actor::GetFileNameString() const { - return mFileName; + return m_fileName; } void Actor::AddDependency(const Dependency& dependency) { - mDependencies.emplace_back(dependency); + m_dependencies.emplace_back(dependency); } void Actor::SetMorphSetup(size_t lodLevel, MorphSetup* setup) { - mMorphSetups[lodLevel] = setup; + m_morphSetups[lodLevel] = setup; } uint32 Actor::GetNumNodeGroups() const { - return mNodeGroups.GetLength(); + return m_nodeGroups.GetLength(); } NodeGroup* Actor::GetNodeGroup(uint32 index) const { - return mNodeGroups[index]; + return m_nodeGroups[index]; } void Actor::AddNodeGroup(NodeGroup* newGroup) { - mNodeGroups.Add(newGroup); + m_nodeGroups.Add(newGroup); } @@ -1992,16 +1987,16 @@ namespace EMotionFX { if (delFromMem) { - delete mNodeGroups[index]; + delete m_nodeGroups[index]; } - mNodeGroups.Remove(index); + m_nodeGroups.Remove(index); } void Actor::RemoveNodeGroup(NodeGroup* group, bool delFromMem) { - mNodeGroups.RemoveByValue(group); + m_nodeGroups.RemoveByValue(group); if (delFromMem) { delete group; @@ -2012,10 +2007,10 @@ namespace EMotionFX // find a group index by its name uint32 Actor::FindNodeGroupIndexByName(const char* groupName) const { - const uint32 numGroups = mNodeGroups.GetLength(); + const uint32 numGroups = m_nodeGroups.GetLength(); for (uint32 i = 0; i < numGroups; ++i) { - if (mNodeGroups[i]->GetNameString() == groupName) + if (m_nodeGroups[i]->GetNameString() == groupName) { return i; } @@ -2028,10 +2023,10 @@ namespace EMotionFX // find a group index by its name, but not case sensitive uint32 Actor::FindNodeGroupIndexByNameNoCase(const char* groupName) const { - const uint32 numGroups = mNodeGroups.GetLength(); + const uint32 numGroups = m_nodeGroups.GetLength(); for (uint32 i = 0; i < numGroups; ++i) { - if (AzFramework::StringFunc::Equal(mNodeGroups[i]->GetNameString().c_str(), groupName, false /* no case */)) + if (AzFramework::StringFunc::Equal(m_nodeGroups[i]->GetNameString().c_str(), groupName, false /* no case */)) { return i; } @@ -2044,12 +2039,12 @@ namespace EMotionFX // find a group by its name NodeGroup* Actor::FindNodeGroupByName(const char* groupName) const { - const uint32 numGroups = mNodeGroups.GetLength(); + const uint32 numGroups = m_nodeGroups.GetLength(); for (uint32 i = 0; i < numGroups; ++i) { - if (mNodeGroups[i]->GetNameString() == groupName) + if (m_nodeGroups[i]->GetNameString() == groupName) { - return mNodeGroups[i]; + return m_nodeGroups[i]; } } return nullptr; @@ -2059,12 +2054,12 @@ namespace EMotionFX // find a group by its name, but without case sensitivity NodeGroup* Actor::FindNodeGroupByNameNoCase(const char* groupName) const { - const uint32 numGroups = mNodeGroups.GetLength(); + const uint32 numGroups = m_nodeGroups.GetLength(); for (uint32 i = 0; i < numGroups; ++i) { - if (AzFramework::StringFunc::Equal(mNodeGroups[i]->GetNameString().c_str(), groupName, false /* no case */)) + if (AzFramework::StringFunc::Equal(m_nodeGroups[i]->GetNameString().c_str(), groupName, false /* no case */)) { - return mNodeGroups[i]; + return m_nodeGroups[i]; } } return nullptr; @@ -2073,31 +2068,31 @@ namespace EMotionFX void Actor::SetDirtyFlag(bool dirty) { - mDirtyFlag = dirty; + m_dirtyFlag = dirty; } bool Actor::GetDirtyFlag() const { - return mDirtyFlag; + return m_dirtyFlag; } void Actor::SetIsUsedForVisualization(bool flag) { - mUsedForVisualization = flag; + m_usedForVisualization = flag; } bool Actor::GetIsUsedForVisualization() const { - return mUsedForVisualization; + return m_usedForVisualization; } void Actor::SetIsOwnedByRuntime(bool isOwnedByRuntime) { #if defined(EMFX_DEVELOPMENT_BUILD) - mIsOwnedByRuntime = isOwnedByRuntime; + m_isOwnedByRuntime = isOwnedByRuntime; #else AZ_UNUSED(isOwnedByRuntime); #endif @@ -2107,7 +2102,7 @@ namespace EMotionFX bool Actor::GetIsOwnedByRuntime() const { #if defined(EMFX_DEVELOPMENT_BUILD) - return mIsOwnedByRuntime; + return m_isOwnedByRuntime; #else return true; #endif @@ -2128,20 +2123,20 @@ namespace EMotionFX Mesh* Actor::GetMesh(size_t lodLevel, size_t nodeIndex) const { const AZStd::vector& lodLevels = m_meshLodData.m_lodLevels; - return lodLevels[lodLevel].mNodeInfos[nodeIndex].mMesh; + return lodLevels[lodLevel].m_nodeInfos[nodeIndex].m_mesh; } MeshDeformerStack* Actor::GetMeshDeformerStack(size_t lodLevel, size_t nodeIndex) const { const AZStd::vector& lodLevels = m_meshLodData.m_lodLevels; - return lodLevels[lodLevel].mNodeInfos[nodeIndex].mStack; + return lodLevels[lodLevel].m_nodeInfos[nodeIndex].m_stack; } // set the mesh for a given node in a given LOD void Actor::SetMesh(size_t lodLevel, size_t nodeIndex, Mesh* mesh) { AZStd::vector& lodLevels = m_meshLodData.m_lodLevels; - lodLevels[lodLevel].mNodeInfos[nodeIndex].mMesh = mesh; + lodLevels[lodLevel].m_nodeInfos[nodeIndex].m_mesh = mesh; } @@ -2149,7 +2144,7 @@ namespace EMotionFX void Actor::SetMeshDeformerStack(size_t lodLevel, size_t nodeIndex, MeshDeformerStack* stack) { AZStd::vector& lodLevels = m_meshLodData.m_lodLevels; - lodLevels[lodLevel].mNodeInfos[nodeIndex].mStack = stack; + lodLevels[lodLevel].m_nodeInfos[nodeIndex].m_stack = stack; } // check if the mesh has a skinning deformer (either linear or dual quat) @@ -2178,43 +2173,43 @@ namespace EMotionFX AZStd::vector& lodLevels = m_meshLodData.m_lodLevels; LODLevel& lod = lodLevels[lodLevel]; - NodeLODInfo& nodeInfo = lod.mNodeInfos[nodeIndex]; + NodeLODInfo& nodeInfo = lod.m_nodeInfos[nodeIndex]; - if (destroyMesh && nodeInfo.mMesh) + if (destroyMesh && nodeInfo.m_mesh) { - MCore::Destroy(nodeInfo.mMesh); + MCore::Destroy(nodeInfo.m_mesh); } - if (destroyMesh && nodeInfo.mStack) + if (destroyMesh && nodeInfo.m_stack) { - MCore::Destroy(nodeInfo.mStack); + MCore::Destroy(nodeInfo.m_stack); } - nodeInfo.mMesh = nullptr; - nodeInfo.mStack = nullptr; + nodeInfo.m_mesh = nullptr; + nodeInfo.m_stack = nullptr; } void Actor::SetUnitType(MCore::Distance::EUnitType unitType) { - mUnitType = unitType; + m_unitType = unitType; } MCore::Distance::EUnitType Actor::GetUnitType() const { - return mUnitType; + return m_unitType; } void Actor::SetFileUnitType(MCore::Distance::EUnitType unitType) { - mFileUnitType = unitType; + m_fileUnitType = unitType; } MCore::Distance::EUnitType Actor::GetFileUnitType() const { - return mFileUnitType; + return m_fileUnitType; } @@ -2233,7 +2228,7 @@ namespace EMotionFX for (size_t i = 0; i < numNodes; ++i) { Transform transform = bindPose->GetLocalSpaceTransform(i); - transform.mPosition *= scaleFactor; + transform.m_position *= scaleFactor; bindPose->SetLocalSpaceTransform(i, transform); } bindPose->ForceUpdateFullModelSpacePose(); @@ -2241,7 +2236,7 @@ namespace EMotionFX // calculate the inverse bind pose matrices for (size_t i = 0; i < numNodes; ++i) { - mInvBindPoseTransforms[i] = bindPose->GetModelSpaceTransform(i).Inversed(); + m_invBindPoseTransforms[i] = bindPose->GetModelSpaceTransform(i).Inversed(); } // update static aabb @@ -2283,32 +2278,32 @@ namespace EMotionFX // scale everything to the given unit type void Actor::ScaleToUnitType(MCore::Distance::EUnitType targetUnitType) { - if (mUnitType == targetUnitType) + if (m_unitType == targetUnitType) { return; } // calculate the scale factor and scale - const float scaleFactor = static_cast(MCore::Distance::GetConversionFactor(mUnitType, targetUnitType)); + const float scaleFactor = static_cast(MCore::Distance::GetConversionFactor(m_unitType, targetUnitType)); Scale(scaleFactor); // update the unit type - mUnitType = targetUnitType; + m_unitType = targetUnitType; } // Try to figure out which axis points "up" for the motion extraction node. Actor::EAxis Actor::FindBestMatchingMotionExtractionAxis() const { - MCORE_ASSERT(mMotionExtractionNode != InvalidIndex); - if (mMotionExtractionNode == InvalidIndex) + MCORE_ASSERT(m_motionExtractionNode != InvalidIndex); + if (m_motionExtractionNode == InvalidIndex) { return AXIS_Y; } // Get the local space rotation matrix of the motion extraction node. - const Transform& localTransform = GetBindPose()->GetLocalSpaceTransform(mMotionExtractionNode); - const AZ::Matrix3x3 rotationMatrix = AZ::Matrix3x3::CreateFromQuaternion(localTransform.mRotation); + const Transform& localTransform = GetBindPose()->GetLocalSpaceTransform(m_motionExtractionNode); + const AZ::Matrix3x3 rotationMatrix = AZ::Matrix3x3::CreateFromQuaternion(localTransform.m_rotation); // Calculate angles between the up axis and each of the rotation's basis vectors. const AZ::Vector3 globalUpAxis(0.0f, 0.0f, 1.0f); @@ -2338,13 +2333,13 @@ namespace EMotionFX void Actor::SetRetargetRootNodeIndex(size_t nodeIndex) { - mRetargetRootNode = nodeIndex; + m_retargetRootNode = nodeIndex; } void Actor::SetRetargetRootNode(Node* node) { - mRetargetRootNode = node ? node->GetNodeIndex() : InvalidIndex; + m_retargetRootNode = node ? node->GetNodeIndex() : InvalidIndex; } void Actor::InsertJointAndParents(size_t jointIndex, AZStd::unordered_set& includedJointIndices) @@ -2356,7 +2351,7 @@ namespace EMotionFX } // Add the parent. - const size_t parentIndex = mSkeleton->GetNode(jointIndex)->GetParentIndex(); + const size_t parentIndex = m_skeleton->GetNode(jointIndex)->GetParentIndex(); if (parentIndex != InvalidIndex) { InsertJointAndParents(parentIndex, includedJointIndices); @@ -2381,7 +2376,7 @@ namespace EMotionFX continue; } - const size_t numJoints = mSkeleton->GetNumNodes(); + const size_t numJoints = m_skeleton->GetNumNodes(); for (size_t jointIndex = 0; jointIndex < numJoints; ++jointIndex) { const Mesh* mesh = GetMesh(lod, jointIndex); @@ -2412,7 +2407,7 @@ namespace EMotionFX for (const AZStd::string& jointName : alwaysIncludeJoints) { size_t jointIndex = InvalidIndex; - if (!mSkeleton->FindNodeAndIndexByName(jointName, jointIndex)) + if (!m_skeleton->FindNodeAndIndexByName(jointName, jointIndex)) { if (!jointName.empty()) { @@ -2427,22 +2422,22 @@ namespace EMotionFX // Disable all joints first. for (size_t jointIndex = 0; jointIndex < numJoints; ++jointIndex) { - mSkeleton->GetNode(jointIndex)->SetSkeletalLODStatus(lod, false); + m_skeleton->GetNode(jointIndex)->SetSkeletalLODStatus(lod, false); } // Enable all our included joints in this skeletal LOD. AZ_TracePrintf("EMotionFX", "[LOD %d] Enabled joints = %zd\n", lod, includedJointIndices.size()); for (size_t jointIndex : includedJointIndices) { - mSkeleton->GetNode(jointIndex)->SetSkeletalLODStatus(lod, true); + m_skeleton->GetNode(jointIndex)->SetSkeletalLODStatus(lod, true); } } else // When we have an empty include list, enable everything. { - AZ_TracePrintf("EMotionFX", "[LOD %d] Enabled joints = %zd\n", lod, mSkeleton->GetNumNodes()); - for (size_t i = 0; i < mSkeleton->GetNumNodes(); ++i) + AZ_TracePrintf("EMotionFX", "[LOD %d] Enabled joints = %zd\n", lod, m_skeleton->GetNumNodes()); + for (size_t i = 0; i < m_skeleton->GetNumNodes(); ++i) { - mSkeleton->GetNode(i)->SetSkeletalLODStatus(lod, true); + m_skeleton->GetNode(i)->SetSkeletalLODStatus(lod, true); } } } // for each LOD @@ -2455,10 +2450,10 @@ namespace EMotionFX for (size_t lod = 0; lod < numLODs; ++lod) { AZ_TracePrintf("EMotionFX", "[LOD %d]:", lod); - const size_t numJoints = mSkeleton->GetNumNodes(); + const size_t numJoints = m_skeleton->GetNumNodes(); for (size_t jointIndex = 0; jointIndex < numJoints; ++jointIndex) { - const Node* joint = mSkeleton->GetNode(jointIndex); + const Node* joint = m_skeleton->GetNode(jointIndex); if (joint->GetSkeletalLODStatus(lod)) { AZ_TracePrintf("EMotionFX", "\t%s (index=%zu)", joint->GetName(), jointIndex); @@ -2485,7 +2480,7 @@ namespace EMotionFX // 3) In actor skeleton, remove every node that hasn't been marked. // 4) Meanwhile, build a map that represent the child-parent relationship. // 5) After the node index changed, we use the map in 4) to restore the child-parent relationship. - size_t numNodes = mSkeleton->GetNumNodes(); + size_t numNodes = m_skeleton->GetNumNodes(); AZStd::vector flags; AZStd::unordered_map childParentMap; flags.resize(numNodes); @@ -2494,7 +2489,7 @@ namespace EMotionFX // Search the hit detection config to find and keep all the hit detection nodes. for (const Physics::CharacterColliderNodeConfiguration& nodeConfig : m_physicsSetup->GetHitDetectionConfig().m_nodes) { - Node* node = mSkeleton->FindNodeByName(nodeConfig.m_name); + Node* node = m_skeleton->FindNodeByName(nodeConfig.m_name); if (node && nodesToKeep.find(node) == nodesToKeep.end()) { nodesToKeep.emplace(node); @@ -2511,7 +2506,7 @@ namespace EMotionFX // Search the actor skeleton to find all the critical nodes. for (size_t i = 0; i < numNodes; ++i) { - Node* node = mSkeleton->GetNode(i); + Node* node = m_skeleton->GetNode(i); if (node->GetIsCritical() && nodesToKeep.find(node) == nodesToKeep.end()) { nodesToKeep.emplace(node); @@ -2543,26 +2538,26 @@ namespace EMotionFX { if (!flags[nodeIndex]) { - mSkeleton->RemoveNode(nodeIndex); + m_skeleton->RemoveNode(nodeIndex); } } // Update the node index. - mSkeleton->UpdateNodeIndexValues(); + m_skeleton->UpdateNodeIndexValues(); // After the node index changed, the parent index become invalid. First, clear all information about children because // it's not valid anymore. - for (size_t nodeIndex = 0; nodeIndex < mSkeleton->GetNumNodes(); ++nodeIndex) + for (size_t nodeIndex = 0; nodeIndex < m_skeleton->GetNumNodes(); ++nodeIndex) { - Node* node = mSkeleton->GetNode(nodeIndex); + Node* node = m_skeleton->GetNode(nodeIndex); node->RemoveAllChildNodes(); } // Then build the child-parent relationship using the prebuild map. for (auto& pair : childParentMap) { - Node* child = mSkeleton->FindNodeByName(pair.first); - Node* parent = mSkeleton->FindNodeByName(pair.second); + Node* child = m_skeleton->FindNodeByName(pair.first); + Node* parent = m_skeleton->FindNodeByName(pair.second); child->SetParentIndex(parent->GetNodeIndex()); parent->AddChild(child->GetNodeIndex()); } @@ -2596,8 +2591,8 @@ namespace EMotionFX } // In case neither of the mesh joints are present in the actor, just use the root node as fallback. - AZ_Assert(mSkeleton->GetNode(0), "Actor needs to have at least a single joint."); - return mSkeleton->GetNode(0); + AZ_Assert(m_skeleton->GetNode(0), "Actor needs to have at least a single joint."); + return m_skeleton->GetNode(0); } void Actor::ConstructMeshes() @@ -2610,18 +2605,18 @@ namespace EMotionFX lodLevels.clear(); SetNumLODLevels(numLODLevels, /*adjustMorphSetup=*/false); - const size_t numNodes = mSkeleton->GetNumNodes(); + const size_t numNodes = m_skeleton->GetNumNodes(); // Remove all the materials and add them back based on the meshAsset. Eventually we will remove all the material from Actor and // GLActor. RemoveAllMaterials(); - mMaterials.resize(numLODLevels); + m_materials.resize(numLODLevels); for (size_t lodLevel = 0; lodLevel < numLODLevels; ++lodLevel) { const AZ::Data::Asset& lodAsset = lodAssets[lodLevel]; - lodLevels[lodLevel].mNodeInfos.resize(numNodes); + lodLevels[lodLevel].m_nodeInfos.resize(numNodes); // Create a single mesh for the actor. Mesh* mesh = Mesh::CreateFromModelLod(lodAsset, m_skinToSkeletonIndexMap); @@ -2635,13 +2630,13 @@ namespace EMotionFX } const size_t jointIndex = meshJoint->GetNodeIndex(); - NodeLODInfo& jointInfo = lodLevels[lodLevel].mNodeInfos[jointIndex]; + NodeLODInfo& jointInfo = lodLevels[lodLevel].m_nodeInfos[jointIndex]; - jointInfo.mMesh = mesh; + jointInfo.m_mesh = mesh; - if (!jointInfo.mStack) + if (!jointInfo.m_stack) { - jointInfo.mStack = MeshDeformerStack::Create(mesh); + jointInfo.m_stack = MeshDeformerStack::Create(mesh); } // Add the skinning deformers @@ -2665,14 +2660,14 @@ namespace EMotionFX if (dualQuatSkinning) { DualQuatSkinDeformer* skinDeformer = DualQuatSkinDeformer::Create(mesh); - jointInfo.mStack->AddDeformer(skinDeformer); + jointInfo.m_stack->AddDeformer(skinDeformer); skinDeformer->ReserveLocalBones(numLocalJoints); skinDeformer->Reinitialize(this, meshJoint, static_cast(lodLevel)); } else { SoftSkinDeformer* skinDeformer = GetSoftSkinManager().CreateDeformer(mesh); - jointInfo.mStack->AddDeformer(skinDeformer); + jointInfo.m_stack->AddDeformer(skinDeformer); skinDeformer->ReserveLocalBones(numLocalJoints); // pre-alloc data to prevent reallocs skinDeformer->Reinitialize(this, meshJoint, static_cast(lodLevel)); } @@ -2685,7 +2680,7 @@ namespace EMotionFX Node* Actor::FindJointByMeshName(const AZStd::string_view meshName) const { - Node* joint = mSkeleton->FindNodeByName(meshName.data()); + Node* joint = m_skeleton->FindNodeByName(meshName.data()); if (!joint) { // When mesh merging in the model builder is enabled, the name of the mesh is the concatenated version @@ -2695,7 +2690,7 @@ namespace EMotionFX AZ::StringFunc::Tokenize(meshName, tokens, '+'); for (const AZStd::string& token : tokens) { - joint = mSkeleton->FindNodeByName(token); + joint = m_skeleton->FindNodeByName(token); if (joint) { break; @@ -2714,7 +2709,7 @@ namespace EMotionFX AZStd::unordered_map result; for (const auto& pair : skinMetaAsset->GetJointNameToIndexMap()) { - const Node* node = mSkeleton->FindNodeByName(pair.first.c_str()); + const Node* node = m_skeleton->FindNodeByName(pair.first.c_str()); if (!node) { AZ_Assert(node, "Cannot find joint named %s in the skeleton while it is used by the skin.", pair.first.c_str()); @@ -2734,14 +2729,14 @@ namespace EMotionFX const AZStd::array_view>& lodAssets = m_meshAsset->GetLodAssets(); const size_t numLODLevels = lodAssets.size(); - AZ_Assert(mMorphSetups.size() == numLODLevels, "There needs to be a morph setup for every single LOD level."); + AZ_Assert(m_morphSetups.size() == numLODLevels, "There needs to be a morph setup for every single LOD level."); for (size_t lodLevel = 0; lodLevel < numLODLevels; ++lodLevel) { const AZ::Data::Asset& lodAsset = lodAssets[lodLevel]; const AZStd::array_view& sourceMeshes = lodAsset->GetMeshes(); - MorphSetup* morphSetup = mMorphSetups[static_cast(lodLevel)]; + MorphSetup* morphSetup = m_morphSetups[static_cast(lodLevel)]; if (!morphSetup) { continue; @@ -2756,21 +2751,21 @@ namespace EMotionFX } const size_t jointIndex = meshJoint->GetNodeIndex(); - NodeLODInfo& jointInfo = lodLevels[lodLevel].mNodeInfos[jointIndex]; - Mesh* mesh = jointInfo.mMesh; + NodeLODInfo& jointInfo = lodLevels[lodLevel].m_nodeInfos[jointIndex]; + Mesh* mesh = jointInfo.m_mesh; - if (!jointInfo.mStack) + if (!jointInfo.m_stack) { - jointInfo.mStack = MeshDeformerStack::Create(mesh); + jointInfo.m_stack = MeshDeformerStack::Create(mesh); } // Add the morph deformer to the mesh deformer stack (in case there is none yet). - MorphMeshDeformer* morphTargetDeformer = (MorphMeshDeformer*)jointInfo.mStack->FindDeformerByType(MorphMeshDeformer::TYPE_ID); + MorphMeshDeformer* morphTargetDeformer = (MorphMeshDeformer*)jointInfo.m_stack->FindDeformerByType(MorphMeshDeformer::TYPE_ID); if (!morphTargetDeformer) { morphTargetDeformer = MorphMeshDeformer::Create(mesh); // Add insert the deformer at the first position to make sure we apply morph targets before skinning. - jointInfo.mStack->InsertDeformer(/*deformerPosition=*/0, morphTargetDeformer); + jointInfo.m_stack->InsertDeformer(/*deformerPosition=*/0, morphTargetDeformer); } // The lod has shared buffers that combine the data from each submesh. In case any of the submeshes has a @@ -2809,8 +2804,8 @@ namespace EMotionFX MorphTargetStandard::DeformData* deformData = aznew MorphTargetStandard::DeformData(jointIndex, numDeformedVertices); // Set the compression/quantization range for the positions. - deformData->mMinValue = metaData.m_minPositionDelta; - deformData->mMaxValue = metaData.m_maxPositionDelta; + deformData->m_minValue = metaData.m_minPositionDelta; + deformData->m_maxValue = metaData.m_maxPositionDelta; for (AZ::u32 deformVtx = 0; deformVtx < numDeformedVertices; ++deformVtx) { @@ -2822,24 +2817,24 @@ namespace EMotionFX AZ::RPI::CompressedMorphTargetDelta unpackedCompressedDelta = AZ::RPI::UnpackMorphTargetDelta(packedCompressedDelta); // Set the EMotionFX deform data from the CmopressedMorphTargetDelta - deformData->mDeltas[deformVtx].mVertexNr = unpackedCompressedDelta.m_morphedVertexIndex; + deformData->m_deltas[deformVtx].m_vertexNr = unpackedCompressedDelta.m_morphedVertexIndex; - deformData->mDeltas[deformVtx].mPosition = MCore::Compressed16BitVector3( + deformData->m_deltas[deformVtx].m_position = MCore::Compressed16BitVector3( unpackedCompressedDelta.m_positionX, unpackedCompressedDelta.m_positionY, unpackedCompressedDelta.m_positionZ); - deformData->mDeltas[deformVtx].mNormal = MCore::Compressed8BitVector3( + deformData->m_deltas[deformVtx].m_normal = MCore::Compressed8BitVector3( unpackedCompressedDelta.m_normalX, unpackedCompressedDelta.m_normalY, unpackedCompressedDelta.m_normalZ); - deformData->mDeltas[deformVtx].mTangent = MCore::Compressed8BitVector3( + deformData->m_deltas[deformVtx].m_tangent = MCore::Compressed8BitVector3( unpackedCompressedDelta.m_tangentX, unpackedCompressedDelta.m_tangentY, unpackedCompressedDelta.m_tangentZ); - deformData->mDeltas[deformVtx].mBitangent = MCore::Compressed8BitVector3( + deformData->m_deltas[deformVtx].m_bitangent = MCore::Compressed8BitVector3( unpackedCompressedDelta.m_bitangentX, unpackedCompressedDelta.m_bitangentY, unpackedCompressedDelta.m_bitangentZ); diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/Actor.h b/Gems/EMotionFX/Code/EMotionFX/Source/Actor.h index efcfa52413..5c4a15e2d8 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/Actor.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/Actor.h @@ -68,8 +68,8 @@ namespace EMotionFX */ struct EMFX_API Dependency { - Actor* mActor; /**< The actor where the instance is dependent on. */ - AnimGraph* mAnimGraph; /**< The anim graph we depend on. */ + Actor* m_actor; /**< The actor where the instance is dependent on. */ + AnimGraph* m_animGraph; /**< The anim graph we depend on. */ }; // @@ -90,9 +90,9 @@ namespace EMotionFX // per node mirror info struct EMFX_API NodeMirrorInfo { - uint16 mSourceNode; // from which node to extract the motion - uint8 mAxis; // X=0, Y=1, Z=2 - uint8 mFlags; // bitfield with MIRRORFLAG_ prefix + uint16 m_sourceNode; // from which node to extract the motion + uint8 m_axis; // X=0, Y=1, Z=2 + uint8 m_flags; // bitfield with MIRRORFLAG_ prefix }; enum class LoadRequirement : bool @@ -114,13 +114,13 @@ namespace EMotionFX * Get the unique identification number for the actor. * @return The unique identification number. */ - MCORE_INLINE uint32 GetID() const { return mID; } + MCORE_INLINE uint32 GetID() const { return m_id; } /** * Set the unique identification number for the actor instance. * @param[in] id The unique identification number. */ - MCORE_INLINE void SetID(uint32 id) { mID = id; } + MCORE_INLINE void SetID(uint32 id) { m_id = id; } /** * Add a node to this actor. @@ -218,7 +218,7 @@ namespace EMotionFX * Get the motion extraction node index. * @result The motion extraction node index, or MCORE_INVALIDINDEX32 when it has not been set. */ - MCORE_INLINE size_t GetMotionExtractionNodeIndex() const { return mMotionExtractionNode; } + MCORE_INLINE size_t GetMotionExtractionNodeIndex() const { return m_motionExtractionNode; } //--------------------------------------------------------------------- @@ -522,15 +522,15 @@ namespace EMotionFX * Get the number of dependencies. * @result The number of dependencies that this actor has on other actors. */ - MCORE_INLINE size_t GetNumDependencies() const { return mDependencies.size(); } + MCORE_INLINE size_t GetNumDependencies() const { return m_dependencies.size(); } /** * Get a given dependency. * @param nr The dependency number, which must be in range of [0..GetNumDependencies()-1]. * @result A pointer to the dependency. */ - MCORE_INLINE Dependency* GetDependency(size_t nr) { return &mDependencies[nr]; } - MCORE_INLINE const Dependency* GetDependency(size_t nr) const { return &mDependencies[nr]; } + MCORE_INLINE Dependency* GetDependency(size_t nr) { return &m_dependencies[nr]; } + MCORE_INLINE const Dependency* GetDependency(size_t nr) const { return &m_dependencies[nr]; } /** * Recursively add dependencies that this actor has on other actors. @@ -546,7 +546,7 @@ namespace EMotionFX * @result A smart pointer object to the morph setup. Use the MCore::Pointer::GetPointer() to get the actual pointer. * That GetPointer() method will return nullptr when there is no morph setup for the given LOD level. */ - MCORE_INLINE MorphSetup* GetMorphSetup(size_t geomLODLevel) const { return mMorphSetups[geomLODLevel]; } + MCORE_INLINE MorphSetup* GetMorphSetup(size_t geomLODLevel) const { return m_morphSetups[geomLODLevel]; } /** * Remove all morph setups. Morph setups contain all morph targtets. @@ -649,16 +649,16 @@ namespace EMotionFX * @param nodeIndex The node index to get the info for. * @result A reference to the mirror info. */ - MCORE_INLINE NodeMirrorInfo& GetNodeMirrorInfo(size_t nodeIndex) { return mNodeMirrorInfos[nodeIndex]; } + MCORE_INLINE NodeMirrorInfo& GetNodeMirrorInfo(size_t nodeIndex) { return m_nodeMirrorInfos[nodeIndex]; } /** * Get the mirror info for a given node. * @param nodeIndex The node index to get the info for. * @result A reference to the mirror info. */ - MCORE_INLINE const NodeMirrorInfo& GetNodeMirrorInfo(size_t nodeIndex) const { return mNodeMirrorInfos[nodeIndex]; } + MCORE_INLINE const NodeMirrorInfo& GetNodeMirrorInfo(size_t nodeIndex) const { return m_nodeMirrorInfos[nodeIndex]; } - MCORE_INLINE bool GetHasMirrorInfo() const { return (mNodeMirrorInfos.size() != 0); } + MCORE_INLINE bool GetHasMirrorInfo() const { return (m_nodeMirrorInfos.size() != 0); } //--------------------------------------------------------------- @@ -754,16 +754,16 @@ namespace EMotionFX void SetNodeMirrorInfos(const AZStd::vector& mirrorInfos); bool GetHasMirrorAxesDetected() const; - MCORE_INLINE const AZStd::vector& GetInverseBindPoseTransforms() const { return mInvBindPoseTransforms; } - MCORE_INLINE Pose* GetBindPose() { return mSkeleton->GetBindPose(); } - MCORE_INLINE const Pose* GetBindPose() const { return mSkeleton->GetBindPose(); } + MCORE_INLINE const AZStd::vector& GetInverseBindPoseTransforms() const { return m_invBindPoseTransforms; } + MCORE_INLINE Pose* GetBindPose() { return m_skeleton->GetBindPose(); } + MCORE_INLINE const Pose* GetBindPose() const { return m_skeleton->GetBindPose(); } /** * Get the inverse bind pose (in world space) transform of a given joint. * @param jointIndex The joint number, which must be in range of [0..GetNumNodes()-1]. * @result The inverse of the bind pose transform. */ - MCORE_INLINE const Transform& GetInverseBindPoseTransform(size_t nodeIndex) const { return mInvBindPoseTransforms[nodeIndex]; } + MCORE_INLINE const Transform& GetInverseBindPoseTransform(size_t nodeIndex) const { return m_invBindPoseTransforms[nodeIndex]; } void ReleaseTransformData(); void ResizeTransformData(); @@ -773,8 +773,8 @@ namespace EMotionFX void SetStaticAabb(const AZ::Aabb& aabb); void UpdateStaticAabb(); // VERY heavy operation, you shouldn't call this ever (internally creates an actor instance, updates mesh deformers, calcs a mesh based aabb, destroys the actor instance again) - void SetThreadIndex(uint32 index) { mThreadIndex = index; } - uint32 GetThreadIndex() const { return mThreadIndex; } + void SetThreadIndex(uint32 index) { m_threadIndex = index; } + uint32 GetThreadIndex() const { return m_threadIndex; } Mesh* GetMesh(size_t lodLevel, size_t nodeIndex) const; MeshDeformerStack* GetMeshDeformerStack(size_t lodLevel, size_t nodeIndex) const; @@ -787,8 +787,8 @@ namespace EMotionFX */ void FindMostInfluencedMeshPoints(const Node* node, AZStd::vector& outPoints) const; - MCORE_INLINE Skeleton* GetSkeleton() const { return mSkeleton; } - MCORE_INLINE size_t GetNumNodes() const { return mSkeleton->GetNumNodes(); } + MCORE_INLINE Skeleton* GetSkeleton() const { return m_skeleton; } + MCORE_INLINE size_t GetNumNodes() const { return m_skeleton->GetNumNodes(); } void SetMesh(size_t lodLevel, size_t nodeIndex, Mesh* mesh); void SetMeshDeformerStack(size_t lodLevel, size_t nodeIndex, MeshDeformerStack* stack); @@ -808,8 +808,8 @@ namespace EMotionFX EAxis FindBestMatchingMotionExtractionAxis() const; - MCORE_INLINE size_t GetRetargetRootNodeIndex() const { return mRetargetRootNode; } - MCORE_INLINE Node* GetRetargetRootNode() const { return (mRetargetRootNode != InvalidIndex) ? mSkeleton->GetNode(mRetargetRootNode) : nullptr; } + MCORE_INLINE size_t GetRetargetRootNodeIndex() const { return m_retargetRootNode; } + MCORE_INLINE Node* GetRetargetRootNode() const { return (m_retargetRootNode != InvalidIndex) ? m_skeleton->GetNode(m_retargetRootNode) : nullptr; } void SetRetargetRootNodeIndex(size_t nodeIndex); void SetRetargetRootNode(Node* node); @@ -857,8 +857,8 @@ namespace EMotionFX // data per node, per lod struct EMFX_API NodeLODInfo { - Mesh* mMesh; - MeshDeformerStack* mStack; + Mesh* m_mesh; + MeshDeformerStack* m_stack; NodeLODInfo(); NodeLODInfo(const NodeLODInfo&) = delete; @@ -868,10 +868,10 @@ namespace EMotionFX { return; } - mMesh = rhs.mMesh; - mStack = rhs.mStack; - rhs.mMesh = nullptr; - rhs.mStack = nullptr; + m_mesh = rhs.m_mesh; + m_stack = rhs.m_stack; + rhs.m_mesh = nullptr; + rhs.m_stack = nullptr; } NodeLODInfo& operator=(const NodeLODInfo&) = delete; NodeLODInfo& operator=(NodeLODInfo&& rhs) @@ -880,10 +880,10 @@ namespace EMotionFX { return *this; } - mMesh = rhs.mMesh; - mStack = rhs.mStack; - rhs.mMesh = nullptr; - rhs.mStack = nullptr; + m_mesh = rhs.m_mesh; + m_stack = rhs.m_stack; + rhs.m_mesh = nullptr; + rhs.m_stack = nullptr; return *this; } ~NodeLODInfo(); @@ -892,7 +892,7 @@ namespace EMotionFX // a lod level struct EMFX_API LODLevel { - AZStd::vector mNodeInfos; + AZStd::vector m_nodeInfos; }; struct MeshLODData @@ -918,31 +918,31 @@ namespace EMotionFX Node* FindMeshJoint(const AZ::Data::Asset& lodModelAsset) const; - Skeleton* mSkeleton; /**< The skeleton, containing the nodes and bind pose. */ - AZStd::vector mDependencies; /**< The dependencies on other actors (shared meshes and transforms). */ - AZStd::string mName; /**< The name of the actor. */ - AZStd::string mFileName; /**< The filename of the actor. */ - AZStd::vector mNodeMirrorInfos; /**< The array of node mirror info. */ - AZStd::vector< AZStd::vector< Material* > > mMaterials; /**< A collection of materials (for each lod). */ - AZStd::vector< MorphSetup* > mMorphSetups; /**< A morph setup for each geometry LOD. */ - MCore::SmallArray mNodeGroups; /**< The set of node groups. */ + Skeleton* m_skeleton; /**< The skeleton, containing the nodes and bind pose. */ + AZStd::vector m_dependencies; /**< The dependencies on other actors (shared meshes and transforms). */ + AZStd::string m_name; /**< The name of the actor. */ + AZStd::string m_fileName; /**< The filename of the actor. */ + AZStd::vector m_nodeMirrorInfos; /**< The array of node mirror info. */ + AZStd::vector< AZStd::vector< Material* > > m_materials; /**< A collection of materials (for each lod). */ + AZStd::vector< MorphSetup* > m_morphSetups; /**< A morph setup for each geometry LOD. */ + MCore::SmallArray m_nodeGroups; /**< The set of node groups. */ AZStd::shared_ptr m_physicsSetup; /**< Hit detection, ragdoll and cloth colliders, joint limits and rigid bodies. */ AZStd::shared_ptr m_simulatedObjectSetup; /**< Setup for simulated objects */ - MCore::Distance::EUnitType mUnitType; /**< The unit type used on export. */ - MCore::Distance::EUnitType mFileUnitType; /**< The unit type used on export. */ - AZStd::vector mInvBindPoseTransforms; /**< The inverse world space bind pose transforms. */ - void* mCustomData; /**< Some custom data, for example a pointer to your own game character class which is linked to this actor. */ - size_t mMotionExtractionNode; /**< The motion extraction node. This is the node from which to transfer a filtered part of the motion onto the actor instance. Can also be MCORE_INVALIDINDEX32 when motion extraction is disabled. */ - size_t mRetargetRootNode; /**< The retarget root node, which controls the height displacement of the character. This is most likely the hip or pelvis node. */ - uint32 mID; /**< The unique identification number for the actor. */ - uint32 mThreadIndex; /**< The thread number we are running on, which is a value starting at 0, up to the number of threads in the job system. */ + MCore::Distance::EUnitType m_unitType; /**< The unit type used on export. */ + MCore::Distance::EUnitType m_fileUnitType; /**< The unit type used on export. */ + AZStd::vector m_invBindPoseTransforms; /**< The inverse world space bind pose transforms. */ + void* m_customData; /**< Some custom data, for example a pointer to your own game character class which is linked to this actor. */ + size_t m_motionExtractionNode; /**< The motion extraction node. This is the node from which to transfer a filtered part of the motion onto the actor instance. Can also be MCORE_INVALIDINDEX32 when motion extraction is disabled. */ + size_t m_retargetRootNode; /**< The retarget root node, which controls the height displacement of the character. This is most likely the hip or pelvis node. */ + uint32 m_id; /**< The unique identification number for the actor. */ + uint32 m_threadIndex; /**< The thread number we are running on, which is a value starting at 0, up to the number of threads in the job system. */ AZ::Aabb m_staticAabb; /**< The static AABB. */ - bool mDirtyFlag; /**< The dirty flag which indicates whether the user has made changes to the actor since the last file save operation. */ - bool mUsedForVisualization; /**< Indicates if the actor is used for visualization specific things and is not used as a normal in-game actor. */ + bool m_dirtyFlag; /**< The dirty flag which indicates whether the user has made changes to the actor since the last file save operation. */ + bool m_usedForVisualization; /**< Indicates if the actor is used for visualization specific things and is not used as a normal in-game actor. */ bool m_optimizeSkeleton; /**< Indicates if we should perform/ */ bool m_isReady = false; /**< If actor as well as its dependent files are fully loaded and initialized.*/ #if defined(EMFX_DEVELOPMENT_BUILD) - bool mIsOwnedByRuntime; /**< Set if the actor is used/owned by the engine runtime. */ + bool m_isOwnedByRuntime; /**< Set if the actor is used/owned by the engine runtime. */ #endif // EMFX_DEVELOPMENT_BUILD }; } // namespace EMotionFX diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/ActorInstance.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/ActorInstance.cpp index f394dc4f5f..6097784e2f 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/ActorInstance.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/ActorInstance.cpp @@ -45,27 +45,27 @@ namespace EMotionFX { MCORE_ASSERT(actor); - mEnabledNodes.reserve(actor->GetNumNodes()); + m_enabledNodes.reserve(actor->GetNumNodes()); // set the actor and create the motion system - mBoolFlags = 0; - mActor = actor; - mLODLevel = 0; + m_boolFlags = 0; + m_actor = actor; + m_lodLevel = 0; m_requestedLODLevel = 0; - mNumAttachmentRefs = 0; - mThreadIndex = threadIndex; - mAttachedTo = nullptr; - mSelfAttachment = nullptr; - mCustomData = nullptr; - mID = aznumeric_caster(MCore::GetIDGenerator().GenerateID()); - mVisualizeScale = 1.0f; - mMotionSamplingRate = 0.0f; - mMotionSamplingTimer = 0.0f; + m_numAttachmentRefs = 0; + m_threadIndex = threadIndex; + m_attachedTo = nullptr; + m_selfAttachment = nullptr; + m_customData = nullptr; + m_id = aznumeric_caster(MCore::GetIDGenerator().GenerateID()); + m_visualizeScale = 1.0f; + m_motionSamplingRate = 0.0f; + m_motionSamplingTimer = 0.0f; - mTrajectoryDelta.IdentityWithZeroScale(); + m_trajectoryDelta.IdentityWithZeroScale(); m_staticAabb = AZ::Aabb::CreateNull(); - mAnimGraphInstance = nullptr; + m_animGraphInstance = nullptr; // set the boolean defaults SetFlag(BOOL_ISVISIBLE, true); @@ -84,16 +84,16 @@ namespace EMotionFX EnableAllNodes(); // apply actor node group default states (disable groups of nodes that are disabled on default) - const uint32 numGroups = mActor->GetNumNodeGroups(); + const uint32 numGroups = m_actor->GetNumNodeGroups(); for (uint32 i = 0; i < numGroups; ++i) { - if (mActor->GetNodeGroup(i)->GetIsEnabledOnDefault() == false) // if this group is disabled on default + if (m_actor->GetNodeGroup(i)->GetIsEnabledOnDefault() == false) // if this group is disabled on default { - mActor->GetNodeGroup(i)->DisableNodes(this); // disable all nodes inside this group + m_actor->GetNodeGroup(i)->DisableNodes(this); // disable all nodes inside this group } } // disable nodes that are disabled in LOD 0 - Skeleton* skeleton = mActor->GetSkeleton(); + Skeleton* skeleton = m_actor->GetSkeleton(); const size_t numNodes = skeleton->GetNumNodes(); for (size_t n = 0; n < numNodes; ++n) { @@ -104,27 +104,27 @@ namespace EMotionFX } // setup auto bounds update (it is enabled on default) - mBoundsUpdateFrequency = 0.0f; - mBoundsUpdatePassedTime = 0.0f; - mBoundsUpdateType = BOUNDS_STATIC_BASED; - mBoundsUpdateItemFreq = 1; + m_boundsUpdateFrequency = 0.0f; + m_boundsUpdatePassedTime = 0.0f; + m_boundsUpdateType = BOUNDS_STATIC_BASED; + m_boundsUpdateItemFreq = 1; // initialize the actor local and global transform - mParentWorldTransform.Identity(); - mLocalTransform.Identity(); - mWorldTransform.Identity(); - mWorldTransformInv.Identity(); + m_parentWorldTransform.Identity(); + m_localTransform.Identity(); + m_worldTransform.Identity(); + m_worldTransformInv.Identity(); // init the morph setup instance - mMorphSetup = MorphSetupInstance::Create(); - mMorphSetup->Init(actor->GetMorphSetup(0)); + m_morphSetup = MorphSetupInstance::Create(); + m_morphSetup->Init(actor->GetMorphSetup(0)); // initialize the transformation data of this instance - mTransformData = TransformData::Create(); - mTransformData->InitForActorInstance(this); + m_transformData = TransformData::Create(); + m_transformData->InitForActorInstance(this); // create the motion system - mMotionSystem = MotionLayerSystem::Create(this); + m_motionSystem = MotionLayerSystem::Create(this); // update the global and local matrices UpdateTransformations(0.0f); @@ -133,7 +133,7 @@ namespace EMotionFX UpdateDependencies(); // update the static based AABB dimensions - m_staticAabb = mActor->GetStaticAabb(); + m_staticAabb = m_actor->GetStaticAabb(); if (!m_staticAabb.IsValid()) { UpdateMeshDeformers(0.0f, true); // TODO: not really thread safe because of shared meshes, although it probably will output correctly @@ -141,7 +141,7 @@ namespace EMotionFX } // update the bounds - UpdateBounds(/*lodLevel=*/0, mBoundsUpdateType); + UpdateBounds(/*lodLevel=*/0, m_boundsUpdateType); // register it GetActorManager().RegisterActorInstance(this); @@ -156,24 +156,24 @@ namespace EMotionFX ActorInstanceNotificationBus::Broadcast(&ActorInstanceNotificationBus::Events::OnActorInstanceDestroyed, this); // get rid of the motion system - if (mMotionSystem) + if (m_motionSystem) { - mMotionSystem->Destroy(); + m_motionSystem->Destroy(); } - if (mAnimGraphInstance) + if (m_animGraphInstance) { - mAnimGraphInstance->Destroy(); + m_animGraphInstance->Destroy(); } GetDebugDraw().UnregisterActorInstance(this); // delete all attachments // actor instances that are attached will be detached, and not deleted from memory - const size_t numAttachments = mAttachments.size(); + const size_t numAttachments = m_attachments.size(); for (size_t i = 0; i < numAttachments; ++i) { - ActorInstance* attachmentActorInstance = mAttachments[i]->GetAttachmentActorInstance(); + ActorInstance* attachmentActorInstance = m_attachments[i]->GetAttachmentActorInstance(); if (attachmentActorInstance) { attachmentActorInstance->SetAttachedTo(nullptr); @@ -181,24 +181,24 @@ namespace EMotionFX attachmentActorInstance->DecreaseNumAttachmentRefs(); GetActorManager().UpdateActorInstanceStatus(attachmentActorInstance); } - mAttachments[i]->Destroy(); + m_attachments[i]->Destroy(); } - mAttachments.clear(); + m_attachments.clear(); - if (mMorphSetup) + if (m_morphSetup) { - mMorphSetup->Destroy(); + m_morphSetup->Destroy(); } - if (mTransformData) + if (m_transformData) { - mTransformData->Destroy(); + m_transformData->Destroy(); } // remove the attachment from the actor instance where it is attached to if (GetIsAttachment()) { - mAttachedTo->RemoveAttachment(this /*, false*/); + m_attachedTo->RemoveAttachment(this /*, false*/); } // automatically unregister the actor instance @@ -223,23 +223,23 @@ namespace EMotionFX if (recorder.GetIsInPlayMode() && recorder.GetHasRecorded(this)) { // output the anim graph instance, this doesn't overwrite transforms, just some things internally - if (recorder.GetRecordSettings().mRecordAnimGraphStates && mAnimGraphInstance) + if (recorder.GetRecordSettings().m_recordAnimGraphStates && m_animGraphInstance) { - mAnimGraphInstance->Update(0.0f); - mAnimGraphInstance->Output(nullptr); + m_animGraphInstance->Update(0.0f); + m_animGraphInstance->Output(nullptr); } // apply the main transformation recorder.SampleAndApplyMainTransform(recorder.GetCurrentPlayTime(), this); // apply the node transforms - if (recorder.GetRecordSettings().mRecordTransforms) + if (recorder.GetRecordSettings().m_recordTransforms) { recorder.SampleAndApplyTransforms(recorder.GetCurrentPlayTime(), this); } // sample the morph targets - if (recorder.GetRecordSettings().mRecordMorphs) + if (recorder.GetRecordSettings().m_recordMorphs) { recorder.SampleAndApplyMorphs(recorder.GetCurrentPlayTime(), this); } @@ -252,11 +252,11 @@ namespace EMotionFX // update the bounds when needed if (GetBoundsUpdateEnabled()) { - mBoundsUpdatePassedTime += timePassedInSeconds; - if (mBoundsUpdatePassedTime >= mBoundsUpdateFrequency) + m_boundsUpdatePassedTime += timePassedInSeconds; + if (m_boundsUpdatePassedTime >= m_boundsUpdateFrequency) { - UpdateBounds(mLODLevel, mBoundsUpdateType, mBoundsUpdateItemFreq); - mBoundsUpdatePassedTime = 0.0f; + UpdateBounds(m_lodLevel, m_boundsUpdateType, m_boundsUpdateItemFreq); + m_boundsUpdatePassedTime = 0.0f; } } @@ -270,13 +270,13 @@ namespace EMotionFX if (!attachment || !attachment->GetIsInfluencedByMultipleJoints()) { // update the motion system, which performs all blending, and updates all local transforms (excluding the local matrices) - if (mAnimGraphInstance) + if (m_animGraphInstance) { - mAnimGraphInstance->Update(timePassedInSeconds); + m_animGraphInstance->Update(timePassedInSeconds); UpdateWorldTransform(); if (updateJointTransforms && sampleMotions) { - mAnimGraphInstance->Output(mTransformData->GetCurrentPose()); + m_animGraphInstance->Output(m_transformData->GetCurrentPose()); if (m_ragdollInstance) { @@ -284,9 +284,9 @@ namespace EMotionFX } } } - else if (mMotionSystem) + else if (m_motionSystem) { - mMotionSystem->Update(timePassedInSeconds, (updateJointTransforms && sampleMotions)); + m_motionSystem->Update(timePassedInSeconds, (updateJointTransforms && sampleMotions)); } else { @@ -296,15 +296,15 @@ namespace EMotionFX // when the actor instance isn't visible, we don't want to do more things if (!updateJointTransforms) { - if (GetBoundsUpdateEnabled() && mBoundsUpdateType == BOUNDS_STATIC_BASED) + if (GetBoundsUpdateEnabled() && m_boundsUpdateType == BOUNDS_STATIC_BASED) { - UpdateBounds(mLODLevel, mBoundsUpdateType); + UpdateBounds(m_lodLevel, m_boundsUpdateType); } return; } - mTransformData->GetCurrentPose()->ApplyMorphWeightsToActorInstance(); + m_transformData->GetCurrentPose()->ApplyMorphWeightsToActorInstance(); ApplyMorphSetup(); UpdateSkinningMatrices(); @@ -312,20 +312,20 @@ namespace EMotionFX } else // we are a skin attachment { - mLocalTransform.Identity(); - if (mAnimGraphInstance) + m_localTransform.Identity(); + if (m_animGraphInstance) { - mAnimGraphInstance->Update(timePassedInSeconds); + m_animGraphInstance->Update(timePassedInSeconds); UpdateWorldTransform(); if (updateJointTransforms && sampleMotions) { - mAnimGraphInstance->Output(mTransformData->GetCurrentPose()); + m_animGraphInstance->Output(m_transformData->GetCurrentPose()); } } - else if (mMotionSystem) + else if (m_motionSystem) { - mMotionSystem->Update(timePassedInSeconds, (updateJointTransforms && sampleMotions)); + m_motionSystem->Update(timePassedInSeconds, (updateJointTransforms && sampleMotions)); } else { @@ -335,15 +335,15 @@ namespace EMotionFX // when the actor instance isn't visible, we don't want to do more things if (!updateJointTransforms) { - if (GetBoundsUpdateEnabled() && mBoundsUpdateType == BOUNDS_STATIC_BASED) + if (GetBoundsUpdateEnabled() && m_boundsUpdateType == BOUNDS_STATIC_BASED) { - UpdateBounds(mLODLevel, mBoundsUpdateType); + UpdateBounds(m_lodLevel, m_boundsUpdateType); } return; } - mSelfAttachment->UpdateJointTransforms(*mTransformData->GetCurrentPose()); - mTransformData->GetCurrentPose()->ApplyMorphWeightsToActorInstance(); + m_selfAttachment->UpdateJointTransforms(*m_transformData->GetCurrentPose()); + m_transformData->GetCurrentPose()->ApplyMorphWeightsToActorInstance(); ApplyMorphSetup(); UpdateSkinningMatrices(); UpdateAttachments(); @@ -352,11 +352,11 @@ namespace EMotionFX // update the bounds when needed if (GetBoundsUpdateEnabled()) { - mBoundsUpdatePassedTime += timePassedInSeconds; - if (mBoundsUpdatePassedTime >= mBoundsUpdateFrequency) + m_boundsUpdatePassedTime += timePassedInSeconds; + if (m_boundsUpdatePassedTime >= m_boundsUpdateFrequency) { - UpdateBounds(mLODLevel, mBoundsUpdateType, mBoundsUpdateItemFreq); - mBoundsUpdatePassedTime = 0.0f; + UpdateBounds(m_lodLevel, m_boundsUpdateType, m_boundsUpdateItemFreq); + m_boundsUpdatePassedTime = 0.0f; } } } @@ -364,22 +364,22 @@ namespace EMotionFX // update the world transformation void ActorInstance::UpdateWorldTransform() { - mWorldTransform = mLocalTransform; - mWorldTransform.Multiply(mParentWorldTransform); - mWorldTransformInv = mWorldTransform.Inversed(); + m_worldTransform = m_localTransform; + m_worldTransform.Multiply(m_parentWorldTransform); + m_worldTransformInv = m_worldTransform.Inversed(); } // updates the skinning matrices of all nodes void ActorInstance::UpdateSkinningMatrices() { - AZ::Matrix3x4* skinningMatrices = mTransformData->GetSkinningMatrices(); - const Pose* pose = mTransformData->GetCurrentPose(); + AZ::Matrix3x4* skinningMatrices = m_transformData->GetSkinningMatrices(); + const Pose* pose = m_transformData->GetCurrentPose(); const size_t numNodes = GetNumEnabledNodes(); for (size_t i = 0; i < numNodes; ++i) { const size_t nodeNumber = GetEnabledNode(i); - Transform skinningTransform = mActor->GetInverseBindPoseTransform(nodeNumber); + Transform skinningTransform = m_actor->GetInverseBindPoseTransform(nodeNumber); skinningTransform.Multiply(pose->GetModelSpaceTransform(nodeNumber)); skinningMatrices[nodeNumber] = AZ::Matrix3x4::CreateFromTransform(skinningTransform.ToAZTransform()); } @@ -391,11 +391,11 @@ namespace EMotionFX timePassedInSeconds *= GetEMotionFX().GetGlobalSimulationSpeed(); // Update the mesh deformers. - const Skeleton* skeleton = mActor->GetSkeleton(); - for (uint16 nodeNr : mEnabledNodes) + const Skeleton* skeleton = m_actor->GetSkeleton(); + for (uint16 nodeNr : m_enabledNodes) { Node* node = skeleton->GetNode(nodeNr); - MeshDeformerStack* stack = mActor->GetMeshDeformerStack(mLODLevel, nodeNr); + MeshDeformerStack* stack = m_actor->GetMeshDeformerStack(m_lodLevel, nodeNr); if (stack) { stack->Update(this, node, timePassedInSeconds, processDisabledDeformers); @@ -409,11 +409,11 @@ namespace EMotionFX timePassedInSeconds *= GetEMotionFX().GetGlobalSimulationSpeed(); // Update the mesh morph deformers. - const Skeleton* skeleton = mActor->GetSkeleton(); - for (uint16 nodeNr : mEnabledNodes) + const Skeleton* skeleton = m_actor->GetSkeleton(); + for (uint16 nodeNr : m_enabledNodes) { Node* node = skeleton->GetNode(nodeNr); - MeshDeformerStack* stack = mActor->GetMeshDeformerStack(mLODLevel, nodeNr); + MeshDeformerStack* stack = m_actor->GetMeshDeformerStack(m_lodLevel, nodeNr); if (stack) { stack->UpdateByModifierType(this, node, timePassedInSeconds, MorphMeshDeformer::TYPE_ID, true, processDisabledDeformers); @@ -440,7 +440,7 @@ namespace EMotionFX GetActorManager().GetScheduler()->RecursiveRemoveActorInstance(root); // add the attachment - mAttachments.emplace_back(attachment); + m_attachments.emplace_back(attachment); ActorInstance* attachmentActorInstance = attachment->GetAttachmentActorInstance(); if (attachmentActorInstance) { @@ -460,12 +460,12 @@ namespace EMotionFX size_t ActorInstance::FindAttachmentNr(ActorInstance* actorInstance) { // for all attachments - const auto foundAttachment = AZStd::find_if(mAttachments.begin(), mAttachments.end(), [actorInstance](const Attachment* attachment) + const auto foundAttachment = AZStd::find_if(m_attachments.begin(), m_attachments.end(), [actorInstance](const Attachment* attachment) { return attachment->GetAttachmentActorInstance() == actorInstance; }); - return foundAttachment != mAttachments.end() ? AZStd::distance(mAttachments.begin(), foundAttachment) : InvalidIndex; + return foundAttachment != m_attachments.end() ? AZStd::distance(m_attachments.begin(), foundAttachment) : InvalidIndex; } // remove an attachment by actor instance pointer @@ -486,14 +486,14 @@ namespace EMotionFX // remove an attachment void ActorInstance::RemoveAttachment(size_t nr, bool delFromMem) { - MCORE_ASSERT(nr < mAttachments.size()); + MCORE_ASSERT(nr < m_attachments.size()); // first remove the current attachment tree from the scheduler ActorInstance* root = FindAttachmentRoot(); GetActorManager().GetScheduler()->RecursiveRemoveActorInstance(root); // get the attachment - Attachment* attachment = mAttachments[nr]; + Attachment* attachment = m_attachments[nr]; // its not an attachment anymore ActorInstance* attachmentInstance = attachment->GetAttachmentActorInstance(); @@ -516,7 +516,7 @@ namespace EMotionFX } // remove it from the attachment list - mAttachments.erase(AZStd::next(begin(mAttachments), nr)); + m_attachments.erase(AZStd::next(begin(m_attachments), nr)); // and re-add the root to the scheduler GetActorManager().GetScheduler()->RecursiveInsertActorInstance(root, 0); @@ -532,9 +532,9 @@ namespace EMotionFX void ActorInstance::RemoveAllAttachments(bool delFromMem) { // keep removing the last attachment until there are none left - while (mAttachments.size()) + while (m_attachments.size()) { - RemoveAttachment(mAttachments.size() - 1, delFromMem); + RemoveAttachment(m_attachments.size() - 1, delFromMem); } } @@ -542,26 +542,26 @@ namespace EMotionFX void ActorInstance::UpdateDependencies() { // get rid of existing dependencies - mDependencies.clear(); + m_dependencies.clear(); // add the main dependency Actor::Dependency mainDependency; - mainDependency.mActor = mActor; - mainDependency.mAnimGraph = (mAnimGraphInstance) ? mAnimGraphInstance->GetAnimGraph() : nullptr; - mDependencies.emplace_back(mainDependency); + mainDependency.m_actor = m_actor; + mainDependency.m_animGraph = (m_animGraphInstance) ? m_animGraphInstance->GetAnimGraph() : nullptr; + m_dependencies.emplace_back(mainDependency); // add all dependencies stored inside the actor - const size_t numDependencies = mActor->GetNumDependencies(); + const size_t numDependencies = m_actor->GetNumDependencies(); for (size_t i = 0; i < numDependencies; ++i) { - mDependencies.emplace_back(*mActor->GetDependency(i)); + m_dependencies.emplace_back(*m_actor->GetDependency(i)); } } // set the attachment matrices void ActorInstance::UpdateAttachments() { - for (Attachment* attachment : mAttachments) + for (Attachment* attachment : m_attachments) { attachment->Update(); } @@ -572,9 +572,9 @@ namespace EMotionFX // attachment root ActorInstance* ActorInstance::FindAttachmentRoot() const { - if (mAttachedTo) + if (m_attachedTo) { - return mAttachedTo->FindAttachmentRoot(); + return m_attachedTo->FindAttachmentRoot(); } return const_cast(this); @@ -636,8 +636,8 @@ namespace EMotionFX { *outResult = AZ::Aabb::CreateNull(); - const Pose* pose = mTransformData->GetCurrentPose(); - const Skeleton* skeleton = mActor->GetSkeleton(); + const Pose* pose = m_transformData->GetCurrentPose(); + const Skeleton* skeleton = m_actor->GetSkeleton(); // for all nodes, encapsulate the world space positions const size_t numNodes = GetNumEnabledNodes(); @@ -646,7 +646,7 @@ namespace EMotionFX const uint16 nodeNr = GetEnabledNode(i); if (skeleton->GetNode(nodeNr)->GetIncludeInBoundsCalc()) { - outResult->AddPoint(pose->GetWorldSpaceTransform(nodeNr).mPosition); + outResult->AddPoint(pose->GetWorldSpaceTransform(nodeNr).m_position); } } } @@ -656,8 +656,8 @@ namespace EMotionFX { *outResult = AZ::Aabb::CreateNull(); - const Pose* pose = mTransformData->GetCurrentPose(); - const Skeleton* skeleton = mActor->GetSkeleton(); + const Pose* pose = m_transformData->GetCurrentPose(); + const Skeleton* skeleton = m_actor->GetSkeleton(); // for all nodes, encapsulate the world space positions const size_t numNodes = GetNumEnabledNodes(); @@ -667,7 +667,7 @@ namespace EMotionFX Node* node = skeleton->GetNode(nodeNr); // skip nodes without meshes - Mesh* mesh = mActor->GetMesh(geomLODLevel, nodeNr); + Mesh* mesh = m_actor->GetMesh(geomLODLevel, nodeNr); if (mesh == nullptr) { continue; @@ -692,9 +692,9 @@ namespace EMotionFX void ActorInstance::SetupAutoBoundsUpdate(float updateFrequencyInSeconds, EBoundsType boundsType, uint32 itemFrequency) { MCORE_ASSERT(itemFrequency > 0); // zero would cause an infinite loop - mBoundsUpdateFrequency = updateFrequencyInSeconds; - mBoundsUpdateType = boundsType; - mBoundsUpdateItemFreq = itemFrequency; + m_boundsUpdateFrequency = updateFrequencyInSeconds; + m_boundsUpdateType = boundsType; + m_boundsUpdateItemFreq = itemFrequency; SetBoundsUpdateEnabled(true); } @@ -709,7 +709,7 @@ namespace EMotionFX } // if there is no morph setup, we have nothing to do - MorphSetup* morphSetup = mActor->GetMorphSetup(mLODLevel); + MorphSetup* morphSetup = m_actor->GetMorphSetup(m_lodLevel); if (morphSetup == nullptr) { return; @@ -745,8 +745,8 @@ namespace EMotionFX // check intersection with a ray, but don't get the intersection point or closest intersecting node Node* ActorInstance::IntersectsCollisionMesh(size_t lodLevel, const MCore::Ray& ray) const { - const Skeleton* skeleton = mActor->GetSkeleton(); - const Pose* pose = mTransformData->GetCurrentPose(); + const Skeleton* skeleton = m_actor->GetSkeleton(); + const Pose* pose = m_transformData->GetCurrentPose(); // for all nodes const size_t numNodes = GetNumEnabledNodes(); @@ -755,7 +755,7 @@ namespace EMotionFX const uint16 nodeNr = GetEnabledNode(i); // check if there is a mesh for this node - Mesh* mesh = mActor->GetMesh(lodLevel, nodeNr); + Mesh* mesh = m_actor->GetMesh(lodLevel, nodeNr); if (mesh == nullptr) { continue; @@ -789,8 +789,8 @@ namespace EMotionFX uint32 closestIndices[3]; uint32 triIndices[3]; - const Skeleton* skeleton = mActor->GetSkeleton(); - const Pose* pose = mTransformData->GetCurrentPose(); + const Skeleton* skeleton = m_actor->GetSkeleton(); + const Pose* pose = m_transformData->GetCurrentPose(); // check all nodes const size_t numNodes = GetNumEnabledNodes(); @@ -798,7 +798,7 @@ namespace EMotionFX { const uint16 nodeNr = GetEnabledNode(i); Node* curNode = skeleton->GetNode(nodeNr); - Mesh* mesh = mActor->GetMesh(lodLevel, nodeNr); + Mesh* mesh = m_actor->GetMesh(lodLevel, nodeNr); if (mesh == nullptr) { continue; @@ -861,7 +861,7 @@ namespace EMotionFX // calculate the interpolated normal if (outNormal || outUV) { - Mesh* mesh = mActor->GetMesh(lodLevel, closestNode->GetNodeIndex()); + Mesh* mesh = m_actor->GetMesh(lodLevel, closestNode->GetNodeIndex()); // calculate the normal at the intersection point if (outNormal) @@ -894,8 +894,8 @@ namespace EMotionFX // check intersection with a ray, but don't get the intersection point or closest intersecting node Node* ActorInstance::IntersectsMesh(size_t lodLevel, const MCore::Ray& ray) const { - const Pose* pose = mTransformData->GetCurrentPose(); - const Skeleton* skeleton = mActor->GetSkeleton(); + const Pose* pose = m_transformData->GetCurrentPose(); + const Skeleton* skeleton = m_actor->GetSkeleton(); // for all nodes const size_t numNodes = GetNumEnabledNodes(); @@ -905,7 +905,7 @@ namespace EMotionFX Node* node = skeleton->GetNode(nodeNr); // check if there is a mesh for this node - Mesh* mesh = mActor->GetMesh(lodLevel, nodeNr); + Mesh* mesh = m_actor->GetMesh(lodLevel, nodeNr); if (mesh == nullptr) { continue; @@ -953,8 +953,8 @@ namespace EMotionFX uint32 closestIndices[3]; uint32 triIndices[3]; - const Pose* pose = mTransformData->GetCurrentPose(); - const Skeleton* skeleton = mActor->GetSkeleton(); + const Pose* pose = m_transformData->GetCurrentPose(); + const Skeleton* skeleton = m_actor->GetSkeleton(); // check all nodes const size_t numNodes = GetNumEnabledNodes(); @@ -962,7 +962,7 @@ namespace EMotionFX { const uint16 nodeNr = GetEnabledNode(i); Node* curNode = skeleton->GetNode(nodeNr); - Mesh* mesh = mActor->GetMesh(lodLevel, nodeNr); + Mesh* mesh = m_actor->GetMesh(lodLevel, nodeNr); if (mesh == nullptr) { continue; @@ -1020,7 +1020,7 @@ namespace EMotionFX // calculate the interpolated normal if (outNormal || outUV) { - Mesh* mesh = mActor->GetMesh(lodLevel, closestNode->GetNodeIndex()); + Mesh* mesh = m_actor->GetMesh(lodLevel, closestNode->GetNodeIndex()); // calculate the normal at the intersection point if (outNormal) @@ -1058,12 +1058,12 @@ namespace EMotionFX void ActorInstance::EnableNode(uint16 nodeIndex) { // if this node already is at an enabled state, do nothing - if (AZStd::find(begin(mEnabledNodes), end(mEnabledNodes), nodeIndex) != end(mEnabledNodes)) + if (AZStd::find(begin(m_enabledNodes), end(m_enabledNodes), nodeIndex) != end(m_enabledNodes)) { return; } - Skeleton* skeleton = mActor->GetSkeleton(); + Skeleton* skeleton = m_actor->GetSkeleton(); // find the location where to insert (as the flattened hierarchy needs to be preserved in the array) bool found = false; @@ -1074,16 +1074,16 @@ namespace EMotionFX size_t parentIndex = skeleton->GetNode(curNode)->GetParentIndex(); if (parentIndex != InvalidIndex) { - const auto parentArrayIter = AZStd::find(begin(mEnabledNodes), end(mEnabledNodes), static_cast(parentIndex)); - if (parentArrayIter != end(mEnabledNodes)) + const auto parentArrayIter = AZStd::find(begin(m_enabledNodes), end(m_enabledNodes), static_cast(parentIndex)); + if (parentArrayIter != end(m_enabledNodes)) { - if (parentArrayIter + 1 == end(mEnabledNodes)) + if (parentArrayIter + 1 == end(m_enabledNodes)) { - mEnabledNodes.emplace_back(nodeIndex); + m_enabledNodes.emplace_back(nodeIndex); } else { - mEnabledNodes.emplace(parentArrayIter + 1, nodeIndex); + m_enabledNodes.emplace(parentArrayIter + 1, nodeIndex); } found = true; } @@ -1094,7 +1094,7 @@ namespace EMotionFX } else // if we're dealing with a root node, insert it in the front of the array { - mEnabledNodes.emplace(AZStd::next(begin(mEnabledNodes), 0), nodeIndex); + m_enabledNodes.emplace(AZStd::next(begin(m_enabledNodes), 0), nodeIndex); found = true; } } while (found == false); @@ -1104,24 +1104,24 @@ namespace EMotionFX void ActorInstance::DisableNode(uint16 nodeIndex) { // try to remove the node from the array - const auto it = AZStd::find(begin(mEnabledNodes), end(mEnabledNodes), nodeIndex); - if (it != end(mEnabledNodes)) + const auto it = AZStd::find(begin(m_enabledNodes), end(m_enabledNodes), nodeIndex); + if (it != end(m_enabledNodes)) { - mEnabledNodes.erase(it); + m_enabledNodes.erase(it); } } // enable all nodes void ActorInstance::EnableAllNodes() { - mEnabledNodes.resize(mActor->GetNumNodes()); - std::iota(mEnabledNodes.begin(), mEnabledNodes.end(), 0); + m_enabledNodes.resize(m_actor->GetNumNodes()); + std::iota(m_enabledNodes.begin(), m_enabledNodes.end(), 0); } // disable all nodes void ActorInstance::DisableAllNodes() { - mEnabledNodes.clear(); + m_enabledNodes.clear(); } // change the skeletal LOD level @@ -1131,12 +1131,12 @@ namespace EMotionFX const size_t newLevel = MCore::Clamp(level, 0, 63); // if the lod level is the same as it currently is, do nothing - if (newLevel == mLODLevel) + if (newLevel == m_lodLevel) { return; } - Skeleton* skeleton = mActor->GetSkeleton(); + Skeleton* skeleton = m_actor->GetSkeleton(); // change the state of all nodes that need state changes const size_t numNodes = GetNumNodes(); @@ -1145,7 +1145,7 @@ namespace EMotionFX Node* node = skeleton->GetNode(i); // check the curent and the new enabled state - const bool curEnabled = node->GetSkeletalLODStatus(mLODLevel); + const bool curEnabled = node->GetSkeletalLODStatus(m_lodLevel); const bool newEnabled = node->GetSkeletalLODStatus(newLevel); // if the state changed, enable or disable it @@ -1171,13 +1171,13 @@ namespace EMotionFX void ActorInstance::UpdateLODLevel() { // Switch LOD level in case a change was requested. - if (mLODLevel != m_requestedLODLevel) + if (m_lodLevel != m_requestedLODLevel) { - // Enable and disable all nodes accordingly (do not call this after setting the new mLODLevel) + // Enable and disable all nodes accordingly (do not call this after setting the new m_lodLevel) SetSkeletalLODLevelNodeFlags(m_requestedLODLevel); // Make sure the LOD level is valid and update it. - mLODLevel = MCore::Clamp(m_requestedLODLevel, 0, mActor->GetNumLODLevels() - 1); + m_lodLevel = MCore::Clamp(m_requestedLODLevel, 0, m_actor->GetNumLODLevels() - 1); } } @@ -1185,14 +1185,14 @@ namespace EMotionFX void ActorInstance::UpdateSkeletalLODFlags() { // change the state of all nodes that need state changes - Skeleton* skeleton = mActor->GetSkeleton(); + Skeleton* skeleton = m_actor->GetSkeleton(); const size_t numNodes = skeleton->GetNumNodes(); for (size_t i = 0; i < numNodes; ++i) { Node* node = skeleton->GetNode(i); // if the new LOD says that this node should be enabled, enable it - if (node->GetSkeletalLODStatus(mLODLevel)) + if (node->GetSkeletalLODStatus(m_lodLevel)) { EnableNode(static_cast(i)); } @@ -1208,7 +1208,7 @@ namespace EMotionFX { uint32 numDisabledNodes = 0; - const Skeleton* skeleton = mActor->GetSkeleton(); + const Skeleton* skeleton = m_actor->GetSkeleton(); // get the number of nodes and iterate through them const size_t numNodes = GetNumNodes(); @@ -1259,23 +1259,23 @@ namespace EMotionFX // change the current motion system void ActorInstance::SetMotionSystem(MotionSystem* newSystem, bool delCurrentFromMem) { - if (delCurrentFromMem && mMotionSystem) + if (delCurrentFromMem && m_motionSystem) { - mMotionSystem->Destroy(); + m_motionSystem->Destroy(); } - mMotionSystem = newSystem; + m_motionSystem = newSystem; } // check if this actor instance is a skin attachment bool ActorInstance::GetIsSkinAttachment() const { - if (mSelfAttachment == nullptr) + if (m_selfAttachment == nullptr) { return false; } - return mSelfAttachment->GetIsInfluencedByMultipleJoints(); + return m_selfAttachment->GetIsInfluencedByMultipleJoints(); } // draw a skeleton using lines, calling the drawline callbacks in the event handlers @@ -1294,14 +1294,14 @@ namespace EMotionFX Transform trajectoryTransform = inOutMotionExtractionNodeTransform; // Make sure the z axis is really pointing up and project it onto the ground plane. - const AZ::Vector3 forwardAxis = MCore::CalcForwardAxis(trajectoryTransform.mRotation); + const AZ::Vector3 forwardAxis = MCore::CalcForwardAxis(trajectoryTransform.m_rotation); if (forwardAxis.GetZ() > 0.0f) // Pick the closest, so if we point more upwards already, we take 1.0, otherwise take -1.0. Sometimes Y would point up, sometimes down. { - MCore::RotateFromTo(trajectoryTransform.mRotation, forwardAxis, AZ::Vector3(0.0f, 0.0f, 1.0f)); + MCore::RotateFromTo(trajectoryTransform.m_rotation, forwardAxis, AZ::Vector3(0.0f, 0.0f, 1.0f)); } else { - MCore::RotateFromTo(trajectoryTransform.mRotation, forwardAxis, AZ::Vector3(0.0f, 0.0f, -1.0f)); + MCore::RotateFromTo(trajectoryTransform.m_rotation, forwardAxis, AZ::Vector3(0.0f, 0.0f, -1.0f)); } trajectoryTransform.ApplyMotionExtractionFlags(motionExtractionFlags); @@ -1311,15 +1311,15 @@ namespace EMotionFX bindTransformProjected.ApplyMotionExtractionFlags(motionExtractionFlags); // Remove the projected rotation and translation from the transform to prevent the double transform. - inOutMotionExtractionNodeTransform.mRotation = (bindTransformProjected.mRotation.GetConjugate() * trajectoryTransform.mRotation).GetConjugate() * inOutMotionExtractionNodeTransform.mRotation; - inOutMotionExtractionNodeTransform.mPosition = inOutMotionExtractionNodeTransform.mPosition - (trajectoryTransform.mPosition - bindTransformProjected.mPosition); - inOutMotionExtractionNodeTransform.mRotation.Normalize(); + inOutMotionExtractionNodeTransform.m_rotation = (bindTransformProjected.m_rotation.GetConjugate() * trajectoryTransform.m_rotation).GetConjugate() * inOutMotionExtractionNodeTransform.m_rotation; + inOutMotionExtractionNodeTransform.m_position = inOutMotionExtractionNodeTransform.m_position - (trajectoryTransform.m_position - bindTransformProjected.m_position); + inOutMotionExtractionNodeTransform.m_rotation.Normalize(); } void ActorInstance::MotionExtractionCompensate(Transform& inOutMotionExtractionNodeTransform, EMotionExtractionFlags motionExtractionFlags) const { - MCORE_ASSERT(mActor->GetMotionExtractionNodeIndex() != InvalidIndex); - Transform bindPoseTransform = mTransformData->GetBindPose()->GetLocalSpaceTransform(mActor->GetMotionExtractionNodeIndex()); + MCORE_ASSERT(m_actor->GetMotionExtractionNodeIndex() != InvalidIndex); + Transform bindPoseTransform = m_transformData->GetBindPose()->GetLocalSpaceTransform(m_actor->GetMotionExtractionNodeIndex()); MotionExtractionCompensate(inOutMotionExtractionNodeTransform, bindPoseTransform, motionExtractionFlags); } @@ -1327,13 +1327,13 @@ namespace EMotionFX // Remove the trajectory transform from the motion extraction node to prevent double transformation. void ActorInstance::MotionExtractionCompensate(EMotionExtractionFlags motionExtractionFlags) { - const size_t motionExtractIndex = mActor->GetMotionExtractionNodeIndex(); + const size_t motionExtractIndex = m_actor->GetMotionExtractionNodeIndex(); if (motionExtractIndex == InvalidIndex) { return; } - Pose* currentPose = mTransformData->GetCurrentPose(); + Pose* currentPose = m_transformData->GetCurrentPose(); Transform transform = currentPose->GetLocalSpaceTransform(motionExtractIndex); MotionExtractionCompensate(transform, motionExtractionFlags); @@ -1344,13 +1344,13 @@ namespace EMotionFX { Transform curTransform = inOutTransform; #ifndef EMFX_SCALE_DISABLED - curTransform.mPosition += trajectoryDelta.mPosition * curTransform.mScale; + curTransform.m_position += trajectoryDelta.m_position * curTransform.m_scale; #else - curTransform.mPosition += trajectoryDelta.mPosition; + curTransform.m_position += trajectoryDelta.m_position; #endif - curTransform.mRotation *= trajectoryDelta.mRotation; - curTransform.mRotation.Normalize(); + curTransform.m_rotation *= trajectoryDelta.m_rotation; + curTransform.m_rotation.Normalize(); inOutTransform = curTransform; } @@ -1358,18 +1358,18 @@ namespace EMotionFX // Apply the motion extraction delta transform to the actor instance. void ActorInstance::ApplyMotionExtractionDelta(const Transform& trajectoryDelta) { - if (mActor->GetMotionExtractionNodeIndex() == InvalidIndex) + if (m_actor->GetMotionExtractionNodeIndex() == InvalidIndex) { return; } - ApplyMotionExtractionDelta(mLocalTransform, trajectoryDelta); + ApplyMotionExtractionDelta(m_localTransform, trajectoryDelta); } // apply the currently set motion extraction delta transform to the actor instance void ActorInstance::ApplyMotionExtractionDelta() { - ApplyMotionExtractionDelta(mTrajectoryDelta); + ApplyMotionExtractionDelta(m_trajectoryDelta); } void ActorInstance::SetMotionExtractionEnabled(bool enabled) @@ -1379,7 +1379,7 @@ namespace EMotionFX bool ActorInstance::GetMotionExtractionEnabled() const { - return (mBoolFlags & BOOL_MOTIONEXTRACTION) != 0; + return (m_boolFlags & BOOL_MOTIONEXTRACTION) != 0; } // update the static based aabb dimensions @@ -1393,7 +1393,7 @@ namespace EMotionFX UpdateMeshDeformers(0.0f); // calculate the aabb of this - if (mActor->CheckIfHasMeshes(0)) + if (m_actor->CheckIfHasMeshes(0)) { CalcMeshBasedAabb(0, &m_staticAabb); } @@ -1402,7 +1402,7 @@ namespace EMotionFX CalcNodeBasedAabb(&m_staticAabb); } - mLocalTransform = orgTransform; + m_localTransform = orgTransform; } // calculate the moved static based aabb @@ -1410,52 +1410,52 @@ namespace EMotionFX { if (GetIsSkinAttachment()) { - mSelfAttachment->GetAttachToActorInstance()->CalcStaticBasedAabb(outResult); + m_selfAttachment->GetAttachToActorInstance()->CalcStaticBasedAabb(outResult); return; } *outResult = m_staticAabb; EMFX_SCALECODE( - outResult->SetMin(m_staticAabb.GetMin() * mWorldTransform.mScale); - outResult->SetMax(m_staticAabb.GetMax() * mWorldTransform.mScale);) - outResult->Translate(mWorldTransform.mPosition); + outResult->SetMin(m_staticAabb.GetMin() * m_worldTransform.m_scale); + outResult->SetMax(m_staticAabb.GetMax() * m_worldTransform.m_scale);) + outResult->Translate(m_worldTransform.m_position); } // adjust the anim graph instance void ActorInstance::SetAnimGraphInstance(AnimGraphInstance* instance) { - mAnimGraphInstance = instance; + m_animGraphInstance = instance; UpdateDependencies(); } Actor* ActorInstance::GetActor() const { - return mActor; + return m_actor; } void ActorInstance::SetID(uint32 id) { - mID = id; + m_id = id; } MotionSystem* ActorInstance::GetMotionSystem() const { - return mMotionSystem; + return m_motionSystem; } size_t ActorInstance::GetLODLevel() const { - return mLODLevel; + return m_lodLevel; } void ActorInstance::SetCustomData(void* customData) { - mCustomData = customData; + m_customData = customData; } void* ActorInstance::GetCustomData() const { - return mCustomData; + return m_customData; } AZ::Entity* ActorInstance::GetEntity() const @@ -1475,48 +1475,48 @@ namespace EMotionFX bool ActorInstance::GetBoundsUpdateEnabled() const { - return (mBoolFlags & BOOL_BOUNDSUPDATEENABLED); + return (m_boolFlags & BOOL_BOUNDSUPDATEENABLED); } float ActorInstance::GetBoundsUpdateFrequency() const { - return mBoundsUpdateFrequency; + return m_boundsUpdateFrequency; } float ActorInstance::GetBoundsUpdatePassedTime() const { - return mBoundsUpdatePassedTime; + return m_boundsUpdatePassedTime; } ActorInstance::EBoundsType ActorInstance::GetBoundsUpdateType() const { - return mBoundsUpdateType; + return m_boundsUpdateType; } uint32 ActorInstance::GetBoundsUpdateItemFrequency() const { - return mBoundsUpdateItemFreq; + return m_boundsUpdateItemFreq; } void ActorInstance::SetBoundsUpdateFrequency(float seconds) { - mBoundsUpdateFrequency = seconds; + m_boundsUpdateFrequency = seconds; } void ActorInstance::SetBoundsUpdatePassedTime(float seconds) { - mBoundsUpdatePassedTime = seconds; + m_boundsUpdatePassedTime = seconds; } void ActorInstance::SetBoundsUpdateType(EBoundsType bType) { - mBoundsUpdateType = bType; + m_boundsUpdateType = bType; } void ActorInstance::SetBoundsUpdateItemFrequency(uint32 freq) { MCORE_ASSERT(freq >= 1); - mBoundsUpdateItemFreq = freq; + m_boundsUpdateItemFreq = freq; } void ActorInstance::SetBoundsUpdateEnabled(bool enable) @@ -1551,52 +1551,52 @@ namespace EMotionFX size_t ActorInstance::GetNumAttachments() const { - return mAttachments.size(); + return m_attachments.size(); } Attachment* ActorInstance::GetAttachment(size_t nr) const { - return mAttachments[nr]; + return m_attachments[nr]; } bool ActorInstance::GetIsAttachment() const { - return (mAttachedTo != nullptr); + return (m_attachedTo != nullptr); } ActorInstance* ActorInstance::GetAttachedTo() const { - return mAttachedTo; + return m_attachedTo; } Attachment* ActorInstance::GetSelfAttachment() const { - return mSelfAttachment; + return m_selfAttachment; } size_t ActorInstance::GetNumDependencies() const { - return mDependencies.size(); + return m_dependencies.size(); } Actor::Dependency* ActorInstance::GetDependency(size_t nr) { - return &mDependencies[nr]; + return &m_dependencies[nr]; } MorphSetupInstance* ActorInstance::GetMorphSetupInstance() const { - return mMorphSetup; + return m_morphSetup; } void ActorInstance::SetParentWorldSpaceTransform(const Transform& transform) { - mParentWorldTransform = transform; + m_parentWorldTransform = transform; } const Transform& ActorInstance::GetParentWorldSpaceTransform() const { - return mParentWorldTransform; + return m_parentWorldTransform; } void ActorInstance::SetRender(bool enabled) @@ -1606,7 +1606,7 @@ namespace EMotionFX bool ActorInstance::GetRender() const { - return (mBoolFlags & BOOL_RENDER) != 0; + return (m_boolFlags & BOOL_RENDER) != 0; } void ActorInstance::SetIsUsedForVisualization(bool enabled) @@ -1616,7 +1616,7 @@ namespace EMotionFX bool ActorInstance::GetIsUsedForVisualization() const { - return (mBoolFlags & BOOL_USEDFORVISUALIZATION) != 0; + return (m_boolFlags & BOOL_USEDFORVISUALIZATION) != 0; } void ActorInstance::SetIsOwnedByRuntime(bool isOwnedByRuntime) @@ -1631,7 +1631,7 @@ namespace EMotionFX bool ActorInstance::GetIsOwnedByRuntime() const { #if defined(EMFX_DEVELOPMENT_BUILD) - return (mBoolFlags & BOOL_OWNEDBYRUNTIME) != 0; + return (m_boolFlags & BOOL_OWNEDBYRUNTIME) != 0; #else return true; #endif @@ -1639,22 +1639,22 @@ namespace EMotionFX uint32 ActorInstance::GetThreadIndex() const { - return mThreadIndex; + return m_threadIndex; } void ActorInstance::SetThreadIndex(uint32 index) { - mThreadIndex = index; + m_threadIndex = index; } void ActorInstance::SetTrajectoryDeltaTransform(const Transform& transform) { - mTrajectoryDelta = transform; + m_trajectoryDelta = transform; } const Transform& ActorInstance::GetTrajectoryDeltaTransform() const { - return mTrajectoryDelta; + return m_trajectoryDelta; } AnimGraphPose* ActorInstance::RequestPose(uint32 threadIndex) @@ -1669,70 +1669,70 @@ namespace EMotionFX void ActorInstance::SetMotionSamplingTimer(float timeInSeconds) { - mMotionSamplingTimer = timeInSeconds; + m_motionSamplingTimer = timeInSeconds; } void ActorInstance::SetMotionSamplingRate(float updateRateInSeconds) { - mMotionSamplingRate = updateRateInSeconds; + m_motionSamplingRate = updateRateInSeconds; } float ActorInstance::GetMotionSamplingTimer() const { - return mMotionSamplingTimer; + return m_motionSamplingTimer; } float ActorInstance::GetMotionSamplingRate() const { - return mMotionSamplingRate; + return m_motionSamplingRate; } void ActorInstance::IncreaseNumAttachmentRefs(uint8 numToIncreaseWith) { - mNumAttachmentRefs += numToIncreaseWith; - MCORE_ASSERT(mNumAttachmentRefs == 0 || mNumAttachmentRefs == 1); + m_numAttachmentRefs += numToIncreaseWith; + MCORE_ASSERT(m_numAttachmentRefs == 0 || m_numAttachmentRefs == 1); } void ActorInstance::DecreaseNumAttachmentRefs(uint8 numToDecreaseWith) { - mNumAttachmentRefs -= numToDecreaseWith; - MCORE_ASSERT(mNumAttachmentRefs == 0 || mNumAttachmentRefs == 1); + m_numAttachmentRefs -= numToDecreaseWith; + MCORE_ASSERT(m_numAttachmentRefs == 0 || m_numAttachmentRefs == 1); } uint8 ActorInstance::GetNumAttachmentRefs() const { - return mNumAttachmentRefs; + return m_numAttachmentRefs; } void ActorInstance::SetAttachedTo(ActorInstance* actorInstance) { - mAttachedTo = actorInstance; + m_attachedTo = actorInstance; } void ActorInstance::SetSelfAttachment(Attachment* selfAttachment) { - mSelfAttachment = selfAttachment; + m_selfAttachment = selfAttachment; } void ActorInstance::EnableFlag(uint8 flag) { - mBoolFlags |= flag; + m_boolFlags |= flag; } void ActorInstance::DisableFlag(uint8 flag) { - mBoolFlags &= ~flag; + m_boolFlags &= ~flag; } void ActorInstance::SetFlag(uint8 flag, bool enabled) { if (enabled) { - mBoolFlags |= flag; + m_boolFlags |= flag; } else { - mBoolFlags &= ~flag; + m_boolFlags &= ~flag; } } @@ -1741,7 +1741,7 @@ namespace EMotionFX SetIsVisible(isVisible); // recurse to all child attachments - for (Attachment* attachment : mAttachments) + for (Attachment* attachment : m_attachments) { attachment->GetAttachmentActorInstance()->RecursiveSetIsVisible(isVisible); } @@ -1750,9 +1750,9 @@ namespace EMotionFX void ActorInstance::RecursiveSetIsVisibleTowardsRoot(bool isVisible) { SetIsVisible(isVisible); - if (mSelfAttachment) + if (m_selfAttachment) { - mSelfAttachment->GetAttachToActorInstance()->RecursiveSetIsVisibleTowardsRoot(isVisible); + m_selfAttachment->GetAttachToActorInstance()->RecursiveSetIsVisibleTowardsRoot(isVisible); } } @@ -1764,7 +1764,7 @@ namespace EMotionFX // update the normal scale factor based on the bounds void ActorInstance::UpdateVisualizeScale() { - mVisualizeScale = 0.0f; + m_visualizeScale = 0.0f; UpdateMeshDeformers(0.0f); AZ::Aabb box = AZ::Aabb::CreateNull(); @@ -1773,29 +1773,29 @@ namespace EMotionFX if (box.IsValid()) { const float boxRadius = AZ::Vector3(box.GetMax() - box.GetMin()).GetLength() * 0.5f; - mVisualizeScale = MCore::Max(mVisualizeScale, boxRadius); + m_visualizeScale = MCore::Max(m_visualizeScale, boxRadius); } CalcMeshBasedAabb(0, &box); if (box.IsValid()) { const float boxRadius = AZ::Vector3(box.GetMax() - box.GetMin()).GetLength() * 0.5f; - mVisualizeScale = MCore::Max(mVisualizeScale, boxRadius); + m_visualizeScale = MCore::Max(m_visualizeScale, boxRadius); } - mVisualizeScale *= 0.01f; + m_visualizeScale *= 0.01f; } // get the normal scale factor float ActorInstance::GetVisualizeScale() const { - return mVisualizeScale; + return m_visualizeScale; } // manually set the visualize scale factor void ActorInstance::SetVisualizeScale(float factor) { - mVisualizeScale = factor; + m_visualizeScale = factor; } // Recursively check if we have a given attachment in the hierarchy going downwards. diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/ActorInstance.h b/Gems/EMotionFX/Code/EMotionFX/Source/ActorInstance.h index 05a8136326..7ca134c0db 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/ActorInstance.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/ActorInstance.h @@ -75,7 +75,7 @@ namespace EMotionFX * Get the unique identification number for the actor instance. * @return The unique identification number. */ - MCORE_INLINE uint32 GetID() const { return mID; } + MCORE_INLINE uint32 GetID() const { return m_id; } /** * Set the unique identification number for the actor instance. @@ -104,7 +104,7 @@ namespace EMotionFX * This can return nullptr, in which case the motion system as returned by GetMotionSystem() will be used. * @result The anim graph instance. */ - MCORE_INLINE AnimGraphInstance* GetAnimGraphInstance() const { return mAnimGraphInstance; } + MCORE_INLINE AnimGraphInstance* GetAnimGraphInstance() const { return m_animGraphInstance; } /** * Set the anim graph instance. @@ -119,7 +119,7 @@ namespace EMotionFX * So if you wish to get or set any transformations, you can do it with the object returned by this method. * @result A pointer to the transformation data object. */ - MCORE_INLINE TransformData* GetTransformData() const { return mTransformData; } + MCORE_INLINE TransformData* GetTransformData() const { return m_transformData; } /** * Enable or disable this actor instance. @@ -136,7 +136,7 @@ namespace EMotionFX * Disabled actor instances are not updated and processed. * @result Returns true when enabled, or false when disabled. */ - MCORE_INLINE bool GetIsEnabled() const { return (mBoolFlags & BOOL_ENABLED) != 0; } + MCORE_INLINE bool GetIsEnabled() const { return (m_boolFlags & BOOL_ENABLED) != 0; } /** * Check the visibility flag. @@ -144,7 +144,7 @@ namespace EMotionFX * This is used internally by the schedulers, so that heavy calculations can be skipped on invisible characters. * @result Returns true when the actor instance is marked as visible, otherwise false is returned. */ - MCORE_INLINE bool GetIsVisible() const { return (mBoolFlags & BOOL_ISVISIBLE) != 0; } + MCORE_INLINE bool GetIsVisible() const { return (m_boolFlags & BOOL_ISVISIBLE) != 0; } /** * Change the visibility state. @@ -489,14 +489,14 @@ namespace EMotionFX * This is relative to its parent (if it is attached ot something). Otherwise it is in world space. * @param position The position/translation to use. */ - MCORE_INLINE void SetLocalSpacePosition(const AZ::Vector3& position) { mLocalTransform.mPosition = position; } + MCORE_INLINE void SetLocalSpacePosition(const AZ::Vector3& position) { m_localTransform.m_position = position; } /** * Set the local rotation of this actor instance. * This is relative to its parent (if it is attached ot something). Otherwise it is in world space. * @param rotation The rotation to use. */ - MCORE_INLINE void SetLocalSpaceRotation(const AZ::Quaternion& rotation) { mLocalTransform.mRotation = rotation; } + MCORE_INLINE void SetLocalSpaceRotation(const AZ::Quaternion& rotation) { m_localTransform.m_rotation = rotation; } EMFX_SCALECODE ( @@ -505,14 +505,14 @@ namespace EMotionFX * This is relative to its parent (if it is attached ot something). Otherwise it is in world space. * @param scale The scale to use. */ - MCORE_INLINE void SetLocalSpaceScale(const AZ::Vector3& scale) { mLocalTransform.mScale = scale; } + MCORE_INLINE void SetLocalSpaceScale(const AZ::Vector3& scale) { m_localTransform.m_scale = scale; } /** * Get the local space scale. * This is relative to its parent (if it is attached ot something). Otherwise it is in world space. * @result The local space scale factor for each axis. */ - MCORE_INLINE const AZ::Vector3& GetLocalSpaceScale() const { return mLocalTransform.mScale; } + MCORE_INLINE const AZ::Vector3& GetLocalSpaceScale() const { return m_localTransform.m_scale; } ) /** @@ -520,20 +520,20 @@ namespace EMotionFX * This is relative to its parent (if it is attached ot something). Otherwise it is in world space. * @result The local space position. */ - MCORE_INLINE const AZ::Vector3& GetLocalSpacePosition() const { return mLocalTransform.mPosition; } + MCORE_INLINE const AZ::Vector3& GetLocalSpacePosition() const { return m_localTransform.m_position; } /** * Get the local space rotation of this actor instance. * This is relative to its parent (if it is attached ot something). Otherwise it is in world space. * @result The local space rotation. */ - MCORE_INLINE const AZ::Quaternion& GetLocalSpaceRotation() const { return mLocalTransform.mRotation; } + MCORE_INLINE const AZ::Quaternion& GetLocalSpaceRotation() const { return m_localTransform.m_rotation; } - MCORE_INLINE void SetLocalSpaceTransform(const Transform& transform) { mLocalTransform = transform; } + MCORE_INLINE void SetLocalSpaceTransform(const Transform& transform) { m_localTransform = transform; } - MCORE_INLINE const Transform& GetLocalSpaceTransform() const { return mLocalTransform; } - MCORE_INLINE const Transform& GetWorldSpaceTransform() const { return mWorldTransform; } - MCORE_INLINE const Transform& GetWorldSpaceTransformInversed() const { return mWorldTransformInv; } + MCORE_INLINE const Transform& GetLocalSpaceTransform() const { return m_localTransform; } + MCORE_INLINE const Transform& GetWorldSpaceTransform() const { return m_worldTransform; } + MCORE_INLINE const Transform& GetWorldSpaceTransformInversed() const { return m_worldTransformInv; } //------------------------------------------------------------------------------------------- @@ -788,20 +788,20 @@ namespace EMotionFX * Get direct access to the array of enabled nodes. * @result A read only reference to the array of enabled nodes. The values inside of this array are the node numbers of the enabled nodes. */ - MCORE_INLINE const AZStd::vector& GetEnabledNodes() const { return mEnabledNodes; } + MCORE_INLINE const AZStd::vector& GetEnabledNodes() const { return m_enabledNodes; } /** * Get the number of enabled nodes inside this actor instance. * @result The number of nodes that have been enabled and are being updated. */ - MCORE_INLINE size_t GetNumEnabledNodes() const { return mEnabledNodes.size(); } + MCORE_INLINE size_t GetNumEnabledNodes() const { return m_enabledNodes.size(); } /** * Get the node number of a given enabled node. * @param index An index in the array of enabled nodes. This must be in range of [0..GetNumEnabledNodes()-1]. * @result The node number, which relates to Actor::GetNode( returnValue ). */ - MCORE_INLINE uint16 GetEnabledNode(size_t index) const { return mEnabledNodes[index]; } + MCORE_INLINE uint16 GetEnabledNode(size_t index) const { return m_enabledNodes[index]; } /** * Enable all nodes inside the actor instance. @@ -856,51 +856,51 @@ namespace EMotionFX float GetMotionSamplingTimer() const; float GetMotionSamplingRate() const; - MCORE_INLINE size_t GetNumNodes() const { return mActor->GetSkeleton()->GetNumNodes(); } + MCORE_INLINE size_t GetNumNodes() const { return m_actor->GetSkeleton()->GetNumNodes(); } void UpdateVisualizeScale(); // not automatically called on creation for performance reasons (this method relatively is slow as it updates all meshes) float GetVisualizeScale() const; void SetVisualizeScale(float factor); private: - TransformData* mTransformData; /**< The transformation data for this instance. */ + TransformData* m_transformData; /**< The transformation data for this instance. */ AZ::Aabb m_aabb; /**< The axis aligned bounding box. */ AZ::Aabb m_staticAabb; /**< A static pre-calculated bounding box, which we can move along with the position of the actor instance, and use for visibility checks. */ - Transform mLocalTransform = Transform::CreateIdentity(); - Transform mWorldTransform = Transform::CreateIdentity(); - Transform mWorldTransformInv = Transform::CreateIdentity(); - Transform mParentWorldTransform = Transform::CreateIdentity(); - Transform mTrajectoryDelta = Transform::CreateIdentityWithZeroScale(); + Transform m_localTransform = Transform::CreateIdentity(); + Transform m_worldTransform = Transform::CreateIdentity(); + Transform m_worldTransformInv = Transform::CreateIdentity(); + Transform m_parentWorldTransform = Transform::CreateIdentity(); + Transform m_trajectoryDelta = Transform::CreateIdentityWithZeroScale(); - AZStd::vector mAttachments; /**< The attachments linked to this actor instance. */ - AZStd::vector mDependencies; /**< The actor dependencies, which specify which Actor objects this instance is dependent on. */ - MorphSetupInstance* mMorphSetup; /**< The morph setup instance. */ - AZStd::vector mEnabledNodes; /**< The list of nodes that are enabled. */ + AZStd::vector m_attachments; /**< The attachments linked to this actor instance. */ + AZStd::vector m_dependencies; /**< The actor dependencies, which specify which Actor objects this instance is dependent on. */ + MorphSetupInstance* m_morphSetup; /**< The morph setup instance. */ + AZStd::vector m_enabledNodes; /**< The list of nodes that are enabled. */ - Actor* mActor; /**< A pointer to the parent actor where this is an instance from. */ - ActorInstance* mAttachedTo; /**< Specifies the actor where this actor is attached to, or nullptr when it is no attachment. */ - Attachment* mSelfAttachment; /**< The attachment it is itself inside the mAttachedTo actor instance, or nullptr when this isn't an attachment. */ - MotionSystem* mMotionSystem; /**< The motion system, that handles all motion playback and blending etc. */ - AnimGraphInstance* mAnimGraphInstance; /**< A pointer to the anim graph instance, which can be nullptr when there is no anim graph instance. */ + Actor* m_actor; /**< A pointer to the parent actor where this is an instance from. */ + ActorInstance* m_attachedTo; /**< Specifies the actor where this actor is attached to, or nullptr when it is no attachment. */ + Attachment* m_selfAttachment; /**< The attachment it is itself inside the m_attachedTo actor instance, or nullptr when this isn't an attachment. */ + MotionSystem* m_motionSystem; /**< The motion system, that handles all motion playback and blending etc. */ + AnimGraphInstance* m_animGraphInstance; /**< A pointer to the anim graph instance, which can be nullptr when there is no anim graph instance. */ AZStd::unique_ptr m_ragdollInstance; - MCore::Mutex mLock; /**< The multi-thread lock. */ - void* mCustomData; /**< A pointer to custom data for this actor. This could be a pointer to your engine or game object for example. */ + MCore::Mutex m_lock; /**< The multi-thread lock. */ + void* m_customData; /**< A pointer to custom data for this actor. This could be a pointer to your engine or game object for example. */ AZ::Entity* m_entity; /**< The entity to which the actor instance belongs to. */ - float mBoundsUpdateFrequency; /**< The bounds update frequency. Which is a time value in seconds. */ - float mBoundsUpdatePassedTime;/**< The time passed since the last bounds update. */ - float mMotionSamplingRate; /**< The motion sampling rate in seconds, where 0.1 would mean to update 10 times per second. A value of 0 or lower means to update every frame. */ - float mMotionSamplingTimer; /**< The time passed since the last time we sampled motions/anim graphs. */ - float mVisualizeScale; /**< Some visualization scale factor when rendering for example normals, to be at a nice size, relative to the character. */ - size_t mLODLevel; /**< The current LOD level, where 0 is the highest detail. */ + float m_boundsUpdateFrequency; /**< The bounds update frequency. Which is a time value in seconds. */ + float m_boundsUpdatePassedTime;/**< The time passed since the last bounds update. */ + float m_motionSamplingRate; /**< The motion sampling rate in seconds, where 0.1 would mean to update 10 times per second. A value of 0 or lower means to update every frame. */ + float m_motionSamplingTimer; /**< The time passed since the last time we sampled motions/anim graphs. */ + float m_visualizeScale; /**< Some visualization scale factor when rendering for example normals, to be at a nice size, relative to the character. */ + size_t m_lodLevel; /**< The current LOD level, where 0 is the highest detail. */ size_t m_requestedLODLevel; /**< Requested LOD level. The actual LOD level will be updated as soon as all transforms for the requested LOD level are ready. */ - uint32 mBoundsUpdateItemFreq; /**< The bounds update item counter step size. A value of 1 means every vertex/node, a value of 2 means every second vertex/node, etc. */ - uint32 mID; /**< The unique identification number for the actor instance. */ - uint32 mThreadIndex; /**< The thread index. This specifies the thread number this actor instance is being processed in. */ - EBoundsType mBoundsUpdateType; /**< The bounds update type (node based, mesh based or collision mesh based). */ + uint32 m_boundsUpdateItemFreq; /**< The bounds update item counter step size. A value of 1 means every vertex/node, a value of 2 means every second vertex/node, etc. */ + uint32 m_id; /**< The unique identification number for the actor instance. */ + uint32 m_threadIndex; /**< The thread index. This specifies the thread number this actor instance is being processed in. */ + EBoundsType m_boundsUpdateType; /**< The bounds update type (node based, mesh based or collision mesh based). */ float m_boundsExpandBy = 0.25f; /**< Expand bounding box by normalized percentage. (Default: 25% greater than the calculated bounding box) */ - uint8 mNumAttachmentRefs; /**< Specifies how many actor instances use this actor instance as attachment. */ - uint8 mBoolFlags; /**< Boolean flags. */ + uint8 m_numAttachmentRefs; /**< Specifies how many actor instances use this actor instance as attachment. */ + uint8 m_boolFlags; /**< Boolean flags. */ /** * Boolean masks, as replacement for having several bools as members. diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/ActorManager.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/ActorManager.cpp index b96a4b4962..681efb6039 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/ActorManager.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/ActorManager.cpp @@ -25,15 +25,15 @@ namespace EMotionFX ActorManager::ActorManager() : BaseObject() { - mScheduler = nullptr; + m_scheduler = nullptr; // setup the default scheduler SetScheduler(MultiThreadScheduler::Create()); // reserve memory m_actors.reserve(512); - mActorInstances.reserve(1024); - mRootActorInstances.reserve(1024); + m_actorInstances.reserve(1024); + m_rootActorInstances.reserve(1024); } @@ -41,7 +41,7 @@ namespace EMotionFX ActorManager::~ActorManager() { // delete the scheduler - mScheduler->Destroy(); + m_scheduler->Destroy(); } @@ -57,8 +57,8 @@ namespace EMotionFX // destroy all actor instances while (GetNumActorInstances() > 0) { - MCORE_ASSERT(mActorInstances[0]->GetReferenceCount() == 1); - mActorInstances[0]->Destroy(); + MCORE_ASSERT(m_actorInstances[0]->GetReferenceCount() == 1); + m_actorInstances[0]->Destroy(); } UnregisterAllActorInstances(); @@ -75,11 +75,11 @@ namespace EMotionFX void ActorManager::UnregisterAllActorInstances() { LockActorInstances(); - mActorInstances.clear(); - mRootActorInstances.clear(); - if (mScheduler) + m_actorInstances.clear(); + m_rootActorInstances.clear(); + if (m_scheduler) { - mScheduler->Clear(); + m_scheduler->Clear(); } UnlockActorInstances(); } @@ -91,19 +91,19 @@ namespace EMotionFX LockActorInstances(); // delete the existing scheduler, if wanted - if (delExisting && mScheduler) + if (delExisting && m_scheduler) { - mScheduler->Destroy(); + m_scheduler->Destroy(); } // update the scheduler pointer - mScheduler = scheduler; + m_scheduler = scheduler; // adjust all visibility flags to false for all actor instances - const size_t numActorInstances = mActorInstances.size(); + const size_t numActorInstances = m_actorInstances.size(); for (size_t i = 0; i < numActorInstances; ++i) { - mActorInstances[i]->SetIsVisible(false); + m_actorInstances[i]->SetIsVisible(false); } UnlockActorInstances(); @@ -135,7 +135,7 @@ namespace EMotionFX { LockActorInstances(); - mActorInstances.emplace_back(actorInstance); + m_actorInstances.emplace_back(actorInstance); UpdateActorInstanceStatus(actorInstance, false); UnlockActorInstances(); @@ -209,7 +209,7 @@ namespace EMotionFX LockActorInstances(); // get the number of actor instances and iterate through them - const bool foundActor = AZStd::find(begin(mActorInstances), end(mActorInstances), actorInstance) != end(mActorInstances); + const bool foundActor = AZStd::find(begin(m_actorInstances), end(m_actorInstances), actorInstance) != end(m_actorInstances); UnlockActorInstances(); return foundActor; } @@ -218,19 +218,19 @@ namespace EMotionFX // find the given actor instance inside the actor manager and return its index size_t ActorManager::FindActorInstanceIndex(ActorInstance* actorInstance) const { - const auto foundActorInstance = AZStd::find(begin(mActorInstances), end(mActorInstances), actorInstance); - return foundActorInstance != end(mActorInstances) ? AZStd::distance(begin(mActorInstances), foundActorInstance) : InvalidIndex; + const auto foundActorInstance = AZStd::find(begin(m_actorInstances), end(m_actorInstances), actorInstance); + return foundActorInstance != end(m_actorInstances) ? AZStd::distance(begin(m_actorInstances), foundActorInstance) : InvalidIndex; } // find the actor instance by the identification number ActorInstance* ActorManager::FindActorInstanceByID(uint32 id) const { - const auto foundActorInstance = AZStd::find_if(begin(mActorInstances), end(mActorInstances), [id](const ActorInstance* actorInstance) + const auto foundActorInstance = AZStd::find_if(begin(m_actorInstances), end(m_actorInstances), [id](const ActorInstance* actorInstance) { return actorInstance->GetID() == id; }); - return foundActorInstance != end(mActorInstances) ? *foundActorInstance : nullptr; + return foundActorInstance != end(m_actorInstances) ? *foundActorInstance : nullptr; } @@ -259,7 +259,7 @@ namespace EMotionFX // unregister a given actor instance void ActorManager::UnregisterActorInstance(size_t nr) { - UnregisterActorInstance(mActorInstances[nr]); + UnregisterActorInstance(m_actorInstances[nr]); } @@ -284,7 +284,7 @@ namespace EMotionFX // execute the schedule // this makes all the callback OnUpdate calls etc - mScheduler->Execute(timePassedInSeconds); + m_scheduler->Execute(timePassedInSeconds); UnlockActorInstances(); UnlockActors(); @@ -318,19 +318,19 @@ namespace EMotionFX if (actorInstance->GetAttachedTo() == nullptr) { // make sure it's in the root list - if (AZStd::find(begin(mRootActorInstances), end(mRootActorInstances), actorInstance) == end(mRootActorInstances)) + if (AZStd::find(begin(m_rootActorInstances), end(m_rootActorInstances), actorInstance) == end(m_rootActorInstances)) { - mRootActorInstances.emplace_back(actorInstance); + m_rootActorInstances.emplace_back(actorInstance); } } else // no root actor instance { // remove it from the root list - if (const auto it = AZStd::find(begin(mRootActorInstances), end(mRootActorInstances), actorInstance); it != end(mRootActorInstances)) + if (const auto it = AZStd::find(begin(m_rootActorInstances), end(m_rootActorInstances), actorInstance); it != end(m_rootActorInstances)) { - mRootActorInstances.erase(it); + m_rootActorInstances.erase(it); } - mScheduler->RecursiveRemoveActorInstance(actorInstance); + m_scheduler->RecursiveRemoveActorInstance(actorInstance); } if (lock) @@ -346,19 +346,19 @@ namespace EMotionFX LockActorInstances(); // remove the actor instance from the list - if (const auto it = AZStd::find(begin(mActorInstances), end(mActorInstances), instance); it != end(mActorInstances)) + if (const auto it = AZStd::find(begin(m_actorInstances), end(m_actorInstances), instance); it != end(m_actorInstances)) { - mActorInstances.erase(it); + m_actorInstances.erase(it); } // remove it from the list of roots, if it is in there - if (const auto it = AZStd::find(begin(mRootActorInstances), end(mRootActorInstances), instance); it != end(mRootActorInstances)) + if (const auto it = AZStd::find(begin(m_rootActorInstances), end(m_rootActorInstances), instance); it != end(m_rootActorInstances)) { - mRootActorInstances.erase(it); + m_rootActorInstances.erase(it); } // remove it from the schedule - mScheduler->RemoveActorInstance(instance); + m_scheduler->RemoveActorInstance(instance); UnlockActorInstances(); } @@ -366,25 +366,25 @@ namespace EMotionFX void ActorManager::LockActorInstances() { - mActorInstanceLock.Lock(); + m_actorInstanceLock.Lock(); } void ActorManager::UnlockActorInstances() { - mActorInstanceLock.Unlock(); + m_actorInstanceLock.Unlock(); } void ActorManager::LockActors() { - mActorLock.Lock(); + m_actorLock.Lock(); } void ActorManager::UnlockActors() { - mActorLock.Unlock(); + m_actorLock.Unlock(); } @@ -396,12 +396,12 @@ namespace EMotionFX const AZStd::vector& ActorManager::GetActorInstanceArray() const { - return mActorInstances; + return m_actorInstances; } ActorUpdateScheduler* ActorManager::GetScheduler() const { - return mScheduler; + return m_scheduler; } } // namespace EMotionFX diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/ActorManager.h b/Gems/EMotionFX/Code/EMotionFX/Source/ActorManager.h index a7f12111ce..ff78250141 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/ActorManager.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/ActorManager.h @@ -124,14 +124,14 @@ namespace EMotionFX * Get the number of actor instances that currently are registered. * @result The number of registered actor instances. */ - MCORE_INLINE size_t GetNumActorInstances() const { return mActorInstances.size(); } + MCORE_INLINE size_t GetNumActorInstances() const { return m_actorInstances.size(); } /** * Get a given registered actor instance. * @param nr The actor instance number, which must be in range of [0..GetNumActorInstances()-1]. * @result A pointer to the actor instance. */ - MCORE_INLINE ActorInstance* GetActorInstance(size_t nr) const { return mActorInstances[nr]; } + MCORE_INLINE ActorInstance* GetActorInstance(size_t nr) const { return m_actorInstances[nr]; } /** * Get the array of actor instances. @@ -201,7 +201,7 @@ namespace EMotionFX * horse is the root attachment instance. * @result Returns the number of root actor instances. */ - MCORE_INLINE size_t GetNumRootActorInstances() const { return mRootActorInstances.size(); } + MCORE_INLINE size_t GetNumRootActorInstances() const { return m_rootActorInstances.size(); } /** * Get a given root actor instance. @@ -211,7 +211,7 @@ namespace EMotionFX * @param nr The root actor instance number, which must be in range of [0..GetNumRootActorInstances()-1]. * @result A pointer to the actor instance that is a root. */ - MCORE_INLINE ActorInstance* GetRootActorInstance(size_t nr) const { return mRootActorInstances[nr]; } + MCORE_INLINE ActorInstance* GetRootActorInstance(size_t nr) const { return m_rootActorInstances[nr]; } /** * Get the currently used actor update scheduler. @@ -255,12 +255,12 @@ namespace EMotionFX void UnlockActors(); private: - AZStd::vector mActorInstances; /**< The registered actor instances. */ + AZStd::vector m_actorInstances; /**< The registered actor instances. */ AZStd::vector> m_actors; /**< The registered actors. */ - AZStd::vector mRootActorInstances; /**< Root actor instances (roots of all attachment chains). */ - ActorUpdateScheduler* mScheduler; /**< The update scheduler to use. */ - MCore::MutexRecursive mActorLock; /**< The multithread lock for touching the actors array. */ - MCore::MutexRecursive mActorInstanceLock; /**< The multithread lock for touching the actor instances array. */ + AZStd::vector m_rootActorInstances; /**< Root actor instances (roots of all attachment chains). */ + ActorUpdateScheduler* m_scheduler; /**< The update scheduler to use. */ + MCore::MutexRecursive m_actorLock; /**< The multithread lock for touching the actors array. */ + MCore::MutexRecursive m_actorInstanceLock; /**< The multithread lock for touching the actor instances array. */ /** * The constructor, which initializes using the multi processor scheduler. diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/ActorUpdateScheduler.h b/Gems/EMotionFX/Code/EMotionFX/Source/ActorUpdateScheduler.h index 18fd7ff233..9ca73e423f 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/ActorUpdateScheduler.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/ActorUpdateScheduler.h @@ -80,14 +80,14 @@ namespace EMotionFX */ virtual size_t RemoveActorInstance(ActorInstance* actorInstance, size_t startStep = 0) = 0; - size_t GetNumUpdatedActorInstances() const { return mNumUpdated.GetValue(); } - size_t GetNumVisibleActorInstances() const { return mNumVisible.GetValue(); } - size_t GetNumSampledActorInstances() const { return mNumSampled.GetValue(); } + size_t GetNumUpdatedActorInstances() const { return m_numUpdated.GetValue(); } + size_t GetNumVisibleActorInstances() const { return m_numVisible.GetValue(); } + size_t GetNumSampledActorInstances() const { return m_numSampled.GetValue(); } protected: - MCore::AtomicSizeT mNumUpdated; - MCore::AtomicSizeT mNumVisible; - MCore::AtomicSizeT mNumSampled; + MCore::AtomicSizeT m_numUpdated; + MCore::AtomicSizeT m_numVisible; + MCore::AtomicSizeT m_numSampled; /** * The constructor. diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraph.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraph.cpp index 38fb6380e9..a9cfbc4379 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraph.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraph.cpp @@ -35,21 +35,21 @@ namespace EMotionFX AZ_CLASS_ALLOCATOR_IMPL(AnimGraph, AnimGraphAllocator, 0) AnimGraph::AnimGraph() - : mGameControllerSettings(aznew AnimGraphGameControllerSettings()) + : m_gameControllerSettings(aznew AnimGraphGameControllerSettings()) { - mID = aznumeric_caster(MCore::GetIDGenerator().GenerateID()); - mDirtyFlag = false; - mAutoUnregister = true; - mRetarget = false; - mRootStateMachine = nullptr; + m_id = aznumeric_caster(MCore::GetIDGenerator().GenerateID()); + m_dirtyFlag = false; + m_autoUnregister = true; + m_retarget = false; + m_rootStateMachine = nullptr; #if defined(EMFX_DEVELOPMENT_BUILD) - mIsOwnedByRuntime = false; + m_isOwnedByRuntime = false; m_isOwnedByAsset = false; #endif // EMFX_DEVELOPMENT_BUILD // reserve some memory - mNodes.reserve(1024); + m_nodes.reserve(1024); // automatically register the anim graph GetAnimGraphManager().AddAnimGraph(this); @@ -65,35 +65,35 @@ namespace EMotionFX RemoveAllNodeGroups(); - if (mRootStateMachine) + if (m_rootStateMachine) { - delete mRootStateMachine; + delete m_rootStateMachine; } // automatically unregister the anim graph - if (mAutoUnregister) + if (m_autoUnregister) { GetAnimGraphManager().RemoveAnimGraph(this, false); } - delete mGameControllerSettings; + delete m_gameControllerSettings; } void AnimGraph::RecursiveReinit() { - if (!mRootStateMachine) + if (!m_rootStateMachine) { return; } - mRootStateMachine->RecursiveReinit(); + m_rootStateMachine->RecursiveReinit(); } bool AnimGraph::InitAfterLoading() { - if (!mRootStateMachine) + if (!m_rootStateMachine) { return false; } @@ -106,7 +106,7 @@ namespace EMotionFX m_valueParameterIndexByName.emplace(m_valueParameters[i]->GetName(), i); } - return mRootStateMachine->InitAfterLoading(this); + return m_rootStateMachine->InitAfterLoading(this); } void AnimGraph::RecursiveInvalidateUniqueDatas() @@ -307,25 +307,25 @@ namespace EMotionFX // recursively find a given node AnimGraphNode* AnimGraph::RecursiveFindNodeByName(const char* nodeName) const { - return mRootStateMachine->RecursiveFindNodeByName(nodeName); + return m_rootStateMachine->RecursiveFindNodeByName(nodeName); } bool AnimGraph::IsNodeNameUnique(const AZStd::string& newNameCandidate, const AnimGraphNode* forNode) const { - return mRootStateMachine->RecursiveIsNodeNameUnique(newNameCandidate, forNode); + return m_rootStateMachine->RecursiveIsNodeNameUnique(newNameCandidate, forNode); } AnimGraphNode* AnimGraph::RecursiveFindNodeById(AnimGraphNodeId nodeId) const { - return mRootStateMachine->RecursiveFindNodeById(nodeId); + return m_rootStateMachine->RecursiveFindNodeById(nodeId); } AnimGraphStateTransition* AnimGraph::RecursiveFindTransitionById(AnimGraphConnectionId transitionId) const { - for (AnimGraphObject* object : mObjects) + for (AnimGraphObject* object : m_objects) { if (azrtti_typeid(object) == azrtti_typeid()) { @@ -365,7 +365,7 @@ namespace EMotionFX size_t AnimGraph::RecursiveCalcNumNodes() const { - return mRootStateMachine->RecursiveCalcNumNodes(); + return m_rootStateMachine->RecursiveCalcNumNodes(); } @@ -382,7 +382,7 @@ namespace EMotionFX void AnimGraph::RecursiveCalcStatistics(Statistics& outStatistics) const { - RecursiveCalcStatistics(outStatistics, mRootStateMachine); + RecursiveCalcStatistics(outStatistics, m_rootStateMachine); } @@ -425,35 +425,35 @@ namespace EMotionFX // recursively calculate the number of node connections size_t AnimGraph::RecursiveCalcNumNodeConnections() const { - return mRootStateMachine->RecursiveCalcNumNodeConnections(); + return m_rootStateMachine->RecursiveCalcNumNodeConnections(); } // adjust the dirty flag void AnimGraph::SetDirtyFlag(bool dirty) { - mDirtyFlag = dirty; + m_dirtyFlag = dirty; } // adjust the auto unregistering from the anim graph manager on delete void AnimGraph::SetAutoUnregister(bool enabled) { - mAutoUnregister = enabled; + m_autoUnregister = enabled; } // do we auto unregister from the anim graph manager on delete? bool AnimGraph::GetAutoUnregister() const { - return mAutoUnregister; + return m_autoUnregister; } void AnimGraph::SetIsOwnedByRuntime(bool isOwnedByRuntime) { #if defined(EMFX_DEVELOPMENT_BUILD) - mIsOwnedByRuntime = isOwnedByRuntime; + m_isOwnedByRuntime = isOwnedByRuntime; #else AZ_UNUSED(isOwnedByRuntime); #endif @@ -463,7 +463,7 @@ namespace EMotionFX bool AnimGraph::GetIsOwnedByRuntime() const { #if defined(EMFX_DEVELOPMENT_BUILD) - return mIsOwnedByRuntime; + return m_isOwnedByRuntime; #else return true; #endif @@ -494,14 +494,14 @@ namespace EMotionFX // get a pointer to the given node group AnimGraphNodeGroup* AnimGraph::GetNodeGroup(size_t index) const { - return mNodeGroups[index]; + return m_nodeGroups[index]; } // find the node group by name AnimGraphNodeGroup* AnimGraph::FindNodeGroupByName(const char* groupName) const { - for (AnimGraphNodeGroup* nodeGroup : mNodeGroups) + for (AnimGraphNodeGroup* nodeGroup : m_nodeGroups) { // Compare the node names and return a pointer in case they are equal. if (nodeGroup->GetNameString() == groupName) @@ -517,18 +517,18 @@ namespace EMotionFX // find the node group index by name size_t AnimGraph::FindNodeGroupIndexByName(const char* groupName) const { - const auto foundNodeGroup = AZStd::find_if(begin(mNodeGroups), end(mNodeGroups), [groupName](const AnimGraphNodeGroup* nodeGroup) + const auto foundNodeGroup = AZStd::find_if(begin(m_nodeGroups), end(m_nodeGroups), [groupName](const AnimGraphNodeGroup* nodeGroup) { return nodeGroup->GetNameString() == groupName; }); - return foundNodeGroup != end(mNodeGroups) ? AZStd::distance(begin(mNodeGroups), foundNodeGroup) : InvalidIndex; + return foundNodeGroup != end(m_nodeGroups) ? AZStd::distance(begin(m_nodeGroups), foundNodeGroup) : InvalidIndex; } // add the given node group to the anim graph void AnimGraph::AddNodeGroup(AnimGraphNodeGroup* nodeGroup) { - mNodeGroups.push_back(nodeGroup); + m_nodeGroups.push_back(nodeGroup); } @@ -538,11 +538,11 @@ namespace EMotionFX // destroy the object if (delFromMem) { - delete mNodeGroups[index]; + delete m_nodeGroups[index]; } // remove the node group from the array - mNodeGroups.erase(mNodeGroups.begin() + index); + m_nodeGroups.erase(m_nodeGroups.begin() + index); } @@ -552,28 +552,28 @@ namespace EMotionFX // destroy the node groups if (delFromMem) { - for (AnimGraphNodeGroup* nodeGroup : mNodeGroups) + for (AnimGraphNodeGroup* nodeGroup : m_nodeGroups) { delete nodeGroup; } } // remove all node groups - mNodeGroups.clear(); + m_nodeGroups.clear(); } // get the number of node groups size_t AnimGraph::GetNumNodeGroups() const { - return mNodeGroups.size(); + return m_nodeGroups.size(); } // find the node group in which the given anim graph node is in and return a pointer to it AnimGraphNodeGroup* AnimGraph::FindNodeGroupForNode(AnimGraphNode* animGraphNode) const { - for (AnimGraphNodeGroup* nodeGroup : mNodeGroups) + for (AnimGraphNodeGroup* nodeGroup : m_nodeGroups) { // check if the given node is part of the currently iterated node group if (nodeGroup->Contains(animGraphNode->GetId())) @@ -618,24 +618,24 @@ namespace EMotionFX void AnimGraph::RecursiveCollectNodesOfType(const AZ::TypeId& nodeType, AZStd::vector* outNodes) const { - mRootStateMachine->RecursiveCollectNodesOfType(nodeType, outNodes); + m_rootStateMachine->RecursiveCollectNodesOfType(nodeType, outNodes); } void AnimGraph::RecursiveCollectTransitionConditionsOfType(const AZ::TypeId& conditionType, AZStd::vector* outConditions) const { - mRootStateMachine->RecursiveCollectTransitionConditionsOfType(conditionType, outConditions); + m_rootStateMachine->RecursiveCollectTransitionConditionsOfType(conditionType, outConditions); } void AnimGraph::RecursiveCollectObjectsOfType(const AZ::TypeId& objectType, AZStd::vector& outObjects) { - mRootStateMachine->RecursiveCollectObjectsOfType(objectType, outObjects); + m_rootStateMachine->RecursiveCollectObjectsOfType(objectType, outObjects); } void AnimGraph::RecursiveCollectObjectsAffectedBy(AnimGraph* animGraph, AZStd::vector& outObjects) { - mRootStateMachine->RecursiveCollectObjectsAffectedBy(animGraph, outObjects); + m_rootStateMachine->RecursiveCollectObjectsAffectedBy(animGraph, outObjects); } GroupParameter* AnimGraph::FindGroupParameterByName(const AZStd::string& groupName) const @@ -684,7 +684,7 @@ namespace EMotionFX // delete all unique datas for a given object void AnimGraph::RemoveAllObjectData(AnimGraphObject* object, bool delFromMem) { - MCore::LockGuard lock(mLock); + MCore::LockGuard lock(m_lock); for (AnimGraphInstance* animGraphInstance : m_animGraphInstances) { @@ -696,11 +696,11 @@ namespace EMotionFX // set the root state machine void AnimGraph::SetRootStateMachine(AnimGraphStateMachine* stateMachine) { - mRootStateMachine = stateMachine; - if (mRootStateMachine) + m_rootStateMachine = stateMachine; + if (m_rootStateMachine) { // make sure the name is always the same for the root state machine - mRootStateMachine->SetName("Root"); + m_rootStateMachine->SetName("Root"); } } @@ -708,18 +708,18 @@ namespace EMotionFX // add an object void AnimGraph::AddObject(AnimGraphObject* object) { - MCore::LockGuard lock(mLock); + MCore::LockGuard lock(m_lock); // assign the index and add it to the objects array - object->SetObjectIndex(mObjects.size()); - mObjects.push_back(object); + object->SetObjectIndex(m_objects.size()); + m_objects.push_back(object); // if it's a node, add it to the nodes array as well if (azrtti_istypeof(object)) { AnimGraphNode* node = static_cast(object); - node->SetNodeIndex(mNodes.size()); - mNodes.emplace_back(node); + node->SetNodeIndex(m_nodes.size()); + m_nodes.emplace_back(node); } // create a unique data for this added object in the animgraph instances as well @@ -733,7 +733,7 @@ namespace EMotionFX // remove an object void AnimGraph::RemoveObject(AnimGraphObject* object) { - MCore::LockGuard lock(mLock); + MCore::LockGuard lock(m_lock); const size_t objectIndex = object->GetObjectIndex(); @@ -741,16 +741,16 @@ namespace EMotionFX object->RemoveInternalAttributesForAllInstances(); // decrease the indices of all objects that have an index after this node - const size_t numObjects = mObjects.size(); + const size_t numObjects = m_objects.size(); for (size_t i = objectIndex + 1; i < numObjects; ++i) { - AnimGraphObject* curObject = mObjects[i]; + AnimGraphObject* curObject = m_objects[i]; MCORE_ASSERT(i == curObject->GetObjectIndex()); curObject->SetObjectIndex(i - 1); } // remove the object from the array - mObjects.erase(mObjects.begin() + objectIndex); + m_objects.erase(m_objects.begin() + objectIndex); // remove it from the nodes array if it is a node if (azrtti_istypeof(object)) @@ -758,16 +758,16 @@ namespace EMotionFX AnimGraphNode* node = static_cast(object); const size_t nodeIndex = node->GetNodeIndex(); - const size_t numNodes = mNodes.size(); + const size_t numNodes = m_nodes.size(); for (size_t i = nodeIndex + 1; i < numNodes; ++i) { - AnimGraphNode* curNode = mNodes[i]; + AnimGraphNode* curNode = m_nodes[i]; MCORE_ASSERT(i == curNode->GetNodeIndex()); curNode->SetNodeIndex(i - 1); } // remove the object from the array - mNodes.erase(AZStd::next(begin(mNodes), nodeIndex)); + m_nodes.erase(AZStd::next(begin(m_nodes), nodeIndex)); } } @@ -775,21 +775,21 @@ namespace EMotionFX // reserve space for a given amount of objects void AnimGraph::ReserveNumObjects(size_t numObjects) { - mObjects.reserve(numObjects); + m_objects.reserve(numObjects); } // reserve space for a given amount of nodes void AnimGraph::ReserveNumNodes(size_t numNodes) { - mNodes.reserve(numNodes); + m_nodes.reserve(numNodes); } // Calculate number of motion nodes in the graph size_t AnimGraph::CalcNumMotionNodes() const { - return AZStd::accumulate(begin(mNodes), end(mNodes), size_t{0}, [](size_t total, const AnimGraphNode* node) + return AZStd::accumulate(begin(m_nodes), end(m_nodes), size_t{0}, [](size_t total, const AnimGraphNode* node) { return total + azrtti_istypeof(node); }); @@ -806,7 +806,7 @@ namespace EMotionFX // register an animgraph instance void AnimGraph::AddAnimGraphInstance(AnimGraphInstance* animGraphInstance) { - MCore::LockGuard lock(mLock); + MCore::LockGuard lock(m_lock); m_animGraphInstances.emplace_back(animGraphInstance); } @@ -814,7 +814,7 @@ namespace EMotionFX // remove an animgraph instance void AnimGraph::RemoveAnimGraphInstance(AnimGraphInstance* animGraphInstance) { - MCore::LockGuard lock(mLock); + MCore::LockGuard lock(m_lock); m_animGraphInstances.erase(AZStd::remove(m_animGraphInstances.begin(), m_animGraphInstances.end(), animGraphInstance)); } @@ -822,7 +822,7 @@ namespace EMotionFX // decrease internal attribute indices by one, for values higher than the given parameter void AnimGraph::DecreaseInternalAttributeIndices(size_t decreaseEverythingHigherThan) { - for (AnimGraphObject* object : mObjects) + for (AnimGraphObject* object : m_objects) { object->DecreaseInternalAttributeIndices(decreaseEverythingHigherThan); } @@ -831,72 +831,72 @@ namespace EMotionFX const char* AnimGraph::GetFileName() const { - return mFileName.c_str(); + return m_fileName.c_str(); } const AZStd::string& AnimGraph::GetFileNameString() const { - return mFileName; + return m_fileName; } void AnimGraph::SetFileName(const char* fileName) { - mFileName = fileName; + m_fileName = fileName; } AnimGraphStateMachine* AnimGraph::GetRootStateMachine() const { - return mRootStateMachine; + return m_rootStateMachine; } uint32 AnimGraph::GetID() const { - return mID; + return m_id; } void AnimGraph::SetID(uint32 id) { - mID = id; + m_id = id; } bool AnimGraph::GetDirtyFlag() const { - return mDirtyFlag; + return m_dirtyFlag; } AnimGraphGameControllerSettings& AnimGraph::GetGameControllerSettings() { - return *mGameControllerSettings; + return *m_gameControllerSettings; } bool AnimGraph::GetRetargetingEnabled() const { - return mRetarget; + return m_retarget; } void AnimGraph::SetRetargetingEnabled(bool enabled) { - mRetarget = enabled; + m_retarget = enabled; } void AnimGraph::Lock() { - mLock.Lock(); + m_lock.Lock(); } void AnimGraph::Unlock() { - mLock.Unlock(); + m_lock.Unlock(); } @@ -904,7 +904,7 @@ namespace EMotionFX { for (AnimGraphInstance* animGraphInstance : m_animGraphInstances) { - animGraphInstance->SetRetargetingEnabled(mRetarget); + animGraphInstance->SetRetargetingEnabled(m_retarget); } } @@ -920,10 +920,10 @@ namespace EMotionFX serializeContext->Class() ->Version(1) ->Field("rootGroupParameter", &AnimGraph::m_rootParameter) - ->Field("rootStateMachine", &AnimGraph::mRootStateMachine) - ->Field("nodeGroups", &AnimGraph::mNodeGroups) - ->Field("gameControllerSettings", &AnimGraph::mGameControllerSettings) - ->Field("retarget", &AnimGraph::mRetarget) + ->Field("rootStateMachine", &AnimGraph::m_rootStateMachine) + ->Field("nodeGroups", &AnimGraph::m_nodeGroups) + ->Field("gameControllerSettings", &AnimGraph::m_gameControllerSettings) + ->Field("retarget", &AnimGraph::m_retarget) ; @@ -937,7 +937,7 @@ namespace EMotionFX ->ClassElement(AZ::Edit::ClassElements::EditorData, "") ->Attribute(AZ::Edit::Attributes::AutoExpand, "") ->Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly) - ->DataElement(AZ::Edit::UIHandlers::Default, &AnimGraph::mRetarget, "Retarget", "") + ->DataElement(AZ::Edit::UIHandlers::Default, &AnimGraph::m_retarget, "Retarget", "") ->Attribute(AZ::Edit::Attributes::ChangeNotify, &AnimGraph::OnRetargetingEnabledChanged) ; } @@ -1016,7 +1016,7 @@ namespace EMotionFX void AnimGraph::RemoveInvalidConnections(bool logWarnings) { // Iterate over all nodes - for (AnimGraphNode* node : mNodes) + for (AnimGraphNode* node : m_nodes) { for (size_t c = 0; c < node->GetNumConnections();) { diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraph.h b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraph.h index a356b031aa..2a498f9f81 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraph.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraph.h @@ -377,12 +377,12 @@ namespace EMotionFX void AddObject(AnimGraphObject* object); // registers the object in the array and modifies the object's object index value void RemoveObject(AnimGraphObject* object); // doesn't actually remove it from memory, just removes it from the list - size_t GetNumObjects() const { return mObjects.size(); } - AnimGraphObject* GetObject(size_t index) const { return mObjects[index]; } + size_t GetNumObjects() const { return m_objects.size(); } + AnimGraphObject* GetObject(size_t index) const { return m_objects[index]; } void ReserveNumObjects(size_t numObjects); - size_t GetNumNodes() const { return mNodes.size(); } - AnimGraphNode* GetNode(size_t index) const { return mNodes[index]; } + size_t GetNumNodes() const { return m_nodes.size(); } + AnimGraphNode* GetNode(size_t index) const { return m_nodes[index]; } void ReserveNumNodes(size_t numNodes); size_t CalcNumMotionNodes() const; @@ -415,21 +415,21 @@ namespace EMotionFX GroupParameter m_rootParameter; /**< root group parameter. */ ValueParameterVector m_valueParameters; /**< Cached version of all parameters with values. */ AZStd::unordered_map m_valueParameterIndexByName; /**< Cached version of parameter index by name to accelerate lookups. */ - AZStd::vector mNodeGroups; - AZStd::vector mObjects; - AZStd::vector mNodes; + AZStd::vector m_nodeGroups; + AZStd::vector m_objects; + AZStd::vector m_nodes; AZStd::vector m_animGraphInstances; - AZStd::string mFileName; - AnimGraphStateMachine* mRootStateMachine; - AnimGraphGameControllerSettings* mGameControllerSettings; - MCore::Mutex mLock; - uint32 mID; /**< The unique identification number for this anim graph. */ - bool mAutoUnregister; /**< Specifies whether we will automatically unregister this anim graph set from this anim graph manager or not, when deleting this object. */ - bool mRetarget; /**< Is retargeting enabled on default? */ - bool mDirtyFlag; /**< The dirty flag which indicates whether the user has made changes to this anim graph since the last file save operation. */ + AZStd::string m_fileName; + AnimGraphStateMachine* m_rootStateMachine; + AnimGraphGameControllerSettings* m_gameControllerSettings; + MCore::Mutex m_lock; + uint32 m_id; /**< The unique identification number for this anim graph. */ + bool m_autoUnregister; /**< Specifies whether we will automatically unregister this anim graph set from this anim graph manager or not, when deleting this object. */ + bool m_retarget; /**< Is retargeting enabled on default? */ + bool m_dirtyFlag; /**< The dirty flag which indicates whether the user has made changes to this anim graph since the last file save operation. */ #if defined(EMFX_DEVELOPMENT_BUILD) - bool mIsOwnedByRuntime; /**< Set if the anim graph is used/owned by the engine runtime. */ + bool m_isOwnedByRuntime; /**< Set if the anim graph is used/owned by the engine runtime. */ bool m_isOwnedByAsset; /**< Set if the anim graph is used/owned by an asset. */ #endif // EMFX_DEVELOPMENT_BUILD }; diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphAttributeTypes.h b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphAttributeTypes.h index e0f6712145..beb3cd7446 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphAttributeTypes.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphAttributeTypes.h @@ -49,12 +49,12 @@ namespace EMotionFX static AttributePose* Create(); static AttributePose* Create(AnimGraphPose* pose); - void SetValue(AnimGraphPose* value) { mValue = value; } - AnimGraphPose* GetValue() const { return mValue; } - AnimGraphPose* GetValue() { return mValue; } + void SetValue(AnimGraphPose* value) { m_value = value; } + AnimGraphPose* GetValue() const { return m_value; } + AnimGraphPose* GetValue() { return m_value; } // overloaded from the attribute base class - MCore::Attribute* Clone() const override { return Create(mValue); } + MCore::Attribute* Clone() const override { return Create(m_value); } const char* GetTypeString() const override { return "Pose"; } bool InitFrom(const MCore::Attribute* other) override { @@ -63,7 +63,7 @@ namespace EMotionFX return false; } const AttributePose* pose = static_cast(other); - mValue = pose->GetValue(); + m_value = pose->GetValue(); return true; } bool InitFromString(const AZStd::string& valueString) override { MCORE_UNUSED(valueString); return false; } // unsupported @@ -72,12 +72,12 @@ namespace EMotionFX AZ::u32 GetDefaultInterfaceType() const override { return MCore::ATTRIBUTE_INTERFACETYPE_DEFAULT; } private: - AnimGraphPose* mValue; + AnimGraphPose* m_value; AttributePose() - : MCore::Attribute(TYPE_ID) { mValue = nullptr; } + : MCore::Attribute(TYPE_ID) { m_value = nullptr; } AttributePose(AnimGraphPose* pose) - : MCore::Attribute(TYPE_ID) { mValue = pose; } + : MCore::Attribute(TYPE_ID) { m_value = pose; } ~AttributePose() {} }; @@ -97,12 +97,12 @@ namespace EMotionFX static AttributeMotionInstance* Create(); static AttributeMotionInstance* Create(MotionInstance* motionInstance); - void SetValue(MotionInstance* value) { mValue = value; } - MotionInstance* GetValue() const { return mValue; } - MotionInstance* GetValue() { return mValue; } + void SetValue(MotionInstance* value) { m_value = value; } + MotionInstance* GetValue() const { return m_value; } + MotionInstance* GetValue() { return m_value; } // overloaded from the attribute base class - MCore::Attribute* Clone() const override { return Create(mValue); } + MCore::Attribute* Clone() const override { return Create(m_value); } const char* GetTypeString() const override { return "MotionInstance"; } bool InitFrom(const MCore::Attribute* other) override { @@ -111,7 +111,7 @@ namespace EMotionFX return false; } const AttributeMotionInstance* pose = static_cast(other); - mValue = pose->GetValue(); + m_value = pose->GetValue(); return true; } bool InitFromString(const AZStd::string& valueString) override { MCORE_UNUSED(valueString); return false; } // unsupported @@ -120,12 +120,12 @@ namespace EMotionFX AZ::u32 GetDefaultInterfaceType() const override { return MCore::ATTRIBUTE_INTERFACETYPE_DEFAULT; } private: - MotionInstance* mValue; + MotionInstance* m_value; AttributeMotionInstance() - : MCore::Attribute(TYPE_ID) { mValue = nullptr; } + : MCore::Attribute(TYPE_ID) { m_value = nullptr; } AttributeMotionInstance(MotionInstance* motionInstance) - : MCore::Attribute(TYPE_ID) { mValue = motionInstance; } + : MCore::Attribute(TYPE_ID) { m_value = motionInstance; } ~AttributeMotionInstance() {} }; diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphBindPoseNode.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphBindPoseNode.cpp index 1845336df9..e84ffac23a 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphBindPoseNode.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphBindPoseNode.cpp @@ -72,7 +72,7 @@ namespace EMotionFX // visualize it if (GetEMotionFX().GetIsInEditorMode() && GetCanVisualize(animGraphInstance)) { - animGraphInstance->GetActorInstance()->DrawSkeleton(outputPose->GetPose(), mVisualizeColor); + animGraphInstance->GetActorInstance()->DrawSkeleton(outputPose->GetPose(), m_visualizeColor); } } diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphEntryNode.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphEntryNode.cpp index 45fc010a16..d581263e55 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphEntryNode.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphEntryNode.cpp @@ -111,7 +111,7 @@ namespace EMotionFX if (outputPose && GetEMotionFX().GetIsInEditorMode() && GetCanVisualize(animGraphInstance)) { - animGraphInstance->GetActorInstance()->DrawSkeleton(outputPose->GetPose(), mVisualizeColor); + animGraphInstance->GetActorInstance()->DrawSkeleton(outputPose->GetPose(), m_visualizeColor); } } diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphEventBuffer.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphEventBuffer.cpp index 0403e277b6..7bea215a71 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphEventBuffer.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphEventBuffer.cpp @@ -24,7 +24,7 @@ namespace EMotionFX { for (EventInfo& event : m_events) { - event.mEmitter = emitterNode; + event.m_emitter = emitterNode; } } @@ -32,9 +32,9 @@ namespace EMotionFX { for (EventInfo& curEvent : m_events) { - AnimGraphNodeData* emitterUniqueData = curEvent.mEmitter->FindOrCreateUniqueNodeData(animGraphInstance); - curEvent.mGlobalWeight = emitterUniqueData->GetGlobalWeight(); - curEvent.mLocalWeight = emitterUniqueData->GetLocalWeight(); + AnimGraphNodeData* emitterUniqueData = curEvent.m_emitter->FindOrCreateUniqueNodeData(animGraphInstance); + curEvent.m_globalWeight = emitterUniqueData->GetGlobalWeight(); + curEvent.m_localWeight = emitterUniqueData->GetLocalWeight(); } } @@ -45,7 +45,7 @@ namespace EMotionFX { AZStd::string eventDataString; - for (const EventDataPtr& eventData : event.mEvent->GetEventDatas()) + for (const EventDataPtr& eventData : event.m_event->GetEventDatas()) { if (eventData) { @@ -57,11 +57,11 @@ namespace EMotionFX } MCore::LogInfo("Event: (time=%f) (eventData=%s) (emitter=%s) (locWeight=%.4f globWeight=%.4f)", - event.mTimeValue, + event.m_timeValue, eventDataString.size() ? eventDataString.c_str() : "", - event.mEmitter->GetName(), - event.mLocalWeight, - event.mGlobalWeight); + event.m_emitter->GetName(), + event.m_localWeight, + event.m_globalWeight); } } diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphExitNode.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphExitNode.cpp index 14684603c4..f4af1df28f 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphExitNode.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphExitNode.cpp @@ -30,7 +30,7 @@ namespace EMotionFX void AnimGraphExitNode::UniqueData::Update() { - AnimGraphExitNode* exitNode = azdynamic_cast(mObject); + AnimGraphExitNode* exitNode = azdynamic_cast(m_object); AZ_Assert(exitNode, "Unique data linked to incorrect node type."); if (m_previousNode && exitNode->FindChildNodeIndex(m_previousNode) == InvalidIndex32) @@ -129,7 +129,7 @@ namespace EMotionFX // visualize it if (GetEMotionFX().GetIsInEditorMode() && GetCanVisualize(animGraphInstance)) { - actorInstance->DrawSkeleton(outputPose->GetPose(), mVisualizeColor); + actorInstance->DrawSkeleton(outputPose->GetPose(), m_visualizeColor); } return; @@ -157,7 +157,7 @@ namespace EMotionFX // visualize it if (GetEMotionFX().GetIsInEditorMode() && GetCanVisualize(animGraphInstance)) { - actorInstance->DrawSkeleton(outputPose->GetPose(), mVisualizeColor); + actorInstance->DrawSkeleton(outputPose->GetPose(), m_visualizeColor); } } @@ -207,7 +207,7 @@ namespace EMotionFX void AnimGraphExitNode::RecursiveResetFlags(AnimGraphInstance* animGraphInstance, uint32 flagsToDisable) { UniqueData* uniqueData = static_cast(animGraphInstance->FindOrCreateUniqueObjectData(this)); - animGraphInstance->DisableObjectFlags(mObjectIndex, flagsToDisable); + animGraphInstance->DisableObjectFlags(m_objectIndex, flagsToDisable); // forward it to the node we came from if (uniqueData->m_previousNode && uniqueData->m_previousNode != this) diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphGameControllerSettings.h b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphGameControllerSettings.h index d36a448be4..c4e123c0c5 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphGameControllerSettings.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphGameControllerSettings.h @@ -96,24 +96,24 @@ namespace EMotionFX /** * Check if the parameter with the given name is being controlled by the gamepad. - * This assumes that the mString member from the ButtonInfo contains the parameter name. - * @param[in] stringName The name to compare against the mString member of the button infos. + * This assumes that the m_string member from the ButtonInfo contains the parameter name. + * @param[in] stringName The name to compare against the m_string member of the button infos. * @result True in case a button info with the given string name doesn't have BUTTONMODE_NONE assigned, false in the other case. */ bool CheckIfIsParameterButtonControlled(const char* stringName); /** * Check if any of the button infos that are linked to the given string name is enabled. - * This assumes that the mString member from the ButtonInfo contains the parameter name. - * @param[in] stringName The name to compare against the mString member of the button infos. + * This assumes that the m_string member from the ButtonInfo contains the parameter name. + * @param[in] stringName The name to compare against the m_string member of the button infos. * @result True in case any of the button infos with the given string name is enabled. */ bool CheckIfIsButtonEnabled(const char* stringName); /** * Set all button infos that are linked to the given string name to the enabled flag. - * This assumes that the mString member from the ButtonInfo contains the parameter name. - * @param[in] stringName The name to compare against the mString member of the button infos. + * This assumes that the m_string member from the ButtonInfo contains the parameter name. + * @param[in] stringName The name to compare against the m_string member of the button infos. * @param[in] isEnabled True in case the button infos shall be enabled, false if they shall become disabled. */ void SetButtonEnabled(const char* stringName, bool isEnabled); diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphHubNode.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphHubNode.cpp index 7463b384f3..061593ecdc 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphHubNode.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphHubNode.cpp @@ -119,7 +119,7 @@ namespace EMotionFX // Visualize the output pose. if (GetEMotionFX().GetIsInEditorMode() && GetCanVisualize(animGraphInstance)) { - animGraphInstance->GetActorInstance()->DrawSkeleton(outputPose->GetPose(), mVisualizeColor); + animGraphInstance->GetActorInstance()->DrawSkeleton(outputPose->GetPose(), m_visualizeColor); } } diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphInstance.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphInstance.cpp index 9ed0a0e527..d0c77721d1 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphInstance.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphInstance.cpp @@ -37,24 +37,24 @@ namespace EMotionFX animGraph->AddAnimGraphInstance(this); animGraph->Lock(); - mAnimGraph = animGraph; - mActorInstance = actorInstance; + m_animGraph = animGraph; + m_actorInstance = actorInstance; m_parentAnimGraphInstance = nullptr; - mMotionSet = motionSet; - mAutoUnregister = true; - mEnableVisualization = true; - mRetarget = animGraph->GetRetargetingEnabled(); - mVisualizeScale = 1.0f; + m_motionSet = motionSet; + m_autoUnregister = true; + m_enableVisualization = true; + m_retarget = animGraph->GetRetargetingEnabled(); + m_visualizeScale = 1.0f; m_autoReleaseAllPoses = true; m_autoReleaseAllRefDatas= true; #if defined(EMFX_DEVELOPMENT_BUILD) - mIsOwnedByRuntime = false; + m_isOwnedByRuntime = false; #endif // EMFX_DEVELOPMENT_BUILD if (initSettings) { - mInitSettings = *initSettings; + m_initSettings = *initSettings; } m_eventHandlersByEventType.resize(EVENT_TYPE_ANIM_GRAPH_INSTANCE_LAST_EVENT - EVENT_TYPE_ANIM_GRAPH_INSTANCE_FIRST_EVENT + 1); @@ -71,7 +71,7 @@ namespace EMotionFX // create the parameter value objects CreateParameterValues(); - mAnimGraph->Unlock(); + m_animGraph->Unlock(); GetEventManager().OnCreateAnimGraphInstance(this); } @@ -92,7 +92,7 @@ namespace EMotionFX GetEventManager().OnDeleteAnimGraphInstance(this); // automatically unregister the anim graph instance - if (mAutoUnregister) + if (m_autoUnregister) { GetAnimGraphManager().RemoveAnimGraphInstance(this, false); } @@ -127,7 +127,7 @@ namespace EMotionFX m_leaderGraphs.clear(); // unregister from the animgraph - mAnimGraph->RemoveAnimGraphInstance(this); + m_animGraph->RemoveAnimGraphInstance(this); } @@ -143,7 +143,7 @@ namespace EMotionFX { if (delFromMem) { - for (MCore::Attribute* paramValue : mParamValues) + for (MCore::Attribute* paramValue : m_paramValues) { if (paramValue) { @@ -152,14 +152,14 @@ namespace EMotionFX } } - mParamValues.clear(); + m_paramValues.clear(); } // remove all internal attributes void AnimGraphInstance::RemoveAllInternalAttributes() { - MCore::LockGuard lock(mMutex); + MCore::LockGuard lock(m_mutex); for (MCore::Attribute* internalAttribute : m_internalAttributes) { @@ -173,7 +173,7 @@ namespace EMotionFX size_t AnimGraphInstance::AddInternalAttribute(MCore::Attribute* attribute) { - MCore::LockGuard lock(mMutex); + MCore::LockGuard lock(m_mutex); m_internalAttributes.emplace_back(attribute); return m_internalAttributes.size() - 1; @@ -194,14 +194,14 @@ namespace EMotionFX void AnimGraphInstance::ReserveInternalAttributes(size_t totalNumInternalAttributes) { - MCore::LockGuard lock(mMutex); + MCore::LockGuard lock(m_mutex); m_internalAttributes.reserve(totalNumInternalAttributes); } void AnimGraphInstance::RemoveInternalAttribute(size_t index, bool delFromMem) { - MCore::LockGuard lock(mMutex); + MCore::LockGuard lock(m_mutex); if (delFromMem) { MCore::Attribute* internalAttribute = m_internalAttributes[index]; @@ -219,7 +219,7 @@ namespace EMotionFX void AnimGraphInstance::Output(Pose* outputPose) { // reset max used - const uint32 threadIndex = mActorInstance->GetThreadIndex(); + const uint32 threadIndex = m_actorInstance->GetThreadIndex(); AnimGraphPosePool& posePool = GetEMotionFX().GetThreadData(threadIndex)->GetPosePool(); posePool.ResetMaxUsedPoses(); @@ -250,10 +250,10 @@ namespace EMotionFX } // Gather active state. Must be done in output function. - if (mSnapshot && mSnapshot->IsNetworkAuthoritative()) + if (m_snapshot && m_snapshot->IsNetworkAuthoritative()) { - mSnapshot->CollectActiveNodes(*this); - mSnapshot->CollectMotionNodePlaytimes(*this); + m_snapshot->CollectActiveNodes(*this); + m_snapshot->CollectMotionNodePlaytimes(*this); } } @@ -264,14 +264,14 @@ namespace EMotionFX { RemoveAllParameters(true); - const ValueParameterVector& valueParameters = mAnimGraph->RecursivelyGetValueParameters(); - mParamValues.resize(valueParameters.size()); + const ValueParameterVector& valueParameters = m_animGraph->RecursivelyGetValueParameters(); + m_paramValues.resize(valueParameters.size()); // init the values - const size_t numParams = mParamValues.size(); + const size_t numParams = m_paramValues.size(); for (size_t i = 0; i < numParams; ++i) { - mParamValues[i] = valueParameters[i]->ConstructDefaultValueAsAttribute(); + m_paramValues[i] = valueParameters[i]->ConstructDefaultValueAsAttribute(); } } @@ -280,22 +280,22 @@ namespace EMotionFX void AnimGraphInstance::AddMissingParameterValues() { // check how many parameters we need to add - const ValueParameterVector& valueParameters = mAnimGraph->RecursivelyGetValueParameters(); - const ptrdiff_t numToAdd = aznumeric_cast(valueParameters.size()) - mParamValues.size(); + const ValueParameterVector& valueParameters = m_animGraph->RecursivelyGetValueParameters(); + const ptrdiff_t numToAdd = aznumeric_cast(valueParameters.size()) - m_paramValues.size(); if (numToAdd <= 0) { return; } // make sure we have the right space pre-allocated - mParamValues.reserve(valueParameters.size()); + m_paramValues.reserve(valueParameters.size()); // add the remaining parameters - const size_t startIndex = mParamValues.size(); + const size_t startIndex = m_paramValues.size(); for (ptrdiff_t i = 0; i < numToAdd; ++i) { const size_t index = startIndex + i; - mParamValues.emplace_back(valueParameters[index]->ConstructDefaultValueAsAttribute()); + m_paramValues.emplace_back(valueParameters[index]->ConstructDefaultValueAsAttribute()); } } @@ -305,31 +305,31 @@ namespace EMotionFX { if (delFromMem) { - if (mParamValues[index]) + if (m_paramValues[index]) { - delete mParamValues[index]; + delete m_paramValues[index]; } } - mParamValues.erase(AZStd::next(begin(mParamValues), index)); + m_paramValues.erase(AZStd::next(begin(m_paramValues), index)); } // reinitialize the parameter void AnimGraphInstance::ReInitParameterValue(size_t index) { - if (mParamValues[index]) + if (m_paramValues[index]) { - delete mParamValues[index]; + delete m_paramValues[index]; } - mParamValues[index] = mAnimGraph->FindValueParameter(index)->ConstructDefaultValueAsAttribute(); + m_paramValues[index] = m_animGraph->FindValueParameter(index)->ConstructDefaultValueAsAttribute(); } void AnimGraphInstance::ReInitParameterValues() { - const size_t parameterValueCount = mParamValues.size(); + const size_t parameterValueCount = m_paramValues.size(); for (size_t i = 0; i < parameterValueCount; ++i) { ReInitParameterValue(i); @@ -341,7 +341,7 @@ namespace EMotionFX bool AnimGraphInstance::SwitchToState(const char* stateName) { // now try to find the state - AnimGraphNode* state = mAnimGraph->RecursiveFindNodeByName(stateName); + AnimGraphNode* state = m_animGraph->RecursiveFindNodeByName(stateName); if (state == nullptr) { return false; @@ -382,7 +382,7 @@ namespace EMotionFX bool AnimGraphInstance::TransitionToState(const char* stateName) { // now try to find the state - AnimGraphNode* state = mAnimGraph->RecursiveFindNodeByName(stateName); + AnimGraphNode* state = m_animGraph->RecursiveFindNodeByName(stateName); if (state == nullptr) { return false; @@ -486,28 +486,28 @@ namespace EMotionFX // find the parameter value for a parameter with a given name MCore::Attribute* AnimGraphInstance::FindParameter(const AZStd::string& name) const { - const AZ::Outcome paramIndex = mAnimGraph->FindValueParameterIndexByName(name); + const AZ::Outcome paramIndex = m_animGraph->FindValueParameterIndexByName(name); if (!paramIndex.IsSuccess()) { return nullptr; } - return mParamValues[paramIndex.GetValue()]; + return m_paramValues[paramIndex.GetValue()]; } // add the last anim graph parameter to this instance void AnimGraphInstance::AddParameterValue() { - mParamValues.emplace_back(nullptr); - ReInitParameterValue(mParamValues.size() - 1); + m_paramValues.emplace_back(nullptr); + ReInitParameterValue(m_paramValues.size() - 1); } // add the parameter of the animgraph, at a given index void AnimGraphInstance::InsertParameterValue(size_t index) { - mParamValues.emplace(AZStd::next(begin(mParamValues), index), nullptr); + m_paramValues.emplace(AZStd::next(begin(m_paramValues), index), nullptr); ReInitParameterValue(index); } @@ -515,7 +515,7 @@ namespace EMotionFX // move the parameter from old index to new index void AnimGraphInstance::MoveParameterValue(size_t oldIndex, size_t newIndex) { - MCore::Attribute* oldAttribute = mParamValues[oldIndex]; + MCore::Attribute* oldAttribute = m_paramValues[oldIndex]; // if old index is greater than new index, move elements between oldIndex and newIndex to the right of new index // otherwise, move to the left of new index @@ -524,18 +524,18 @@ namespace EMotionFX for (size_t paramIndex = oldIndex; paramIndex > newIndex; paramIndex--) { const size_t prevIndex = paramIndex - 1; - mParamValues[paramIndex] = mParamValues[prevIndex]; + m_paramValues[paramIndex] = m_paramValues[prevIndex]; } - mParamValues[newIndex] = oldAttribute; + m_paramValues[newIndex] = oldAttribute; } else { for (size_t paramIndex = oldIndex; paramIndex < newIndex; paramIndex++) { const size_t nexIndex = paramIndex + 1; - mParamValues[paramIndex] = mParamValues[nexIndex]; + m_paramValues[paramIndex] = m_paramValues[nexIndex]; } - mParamValues[newIndex] = oldAttribute; + m_paramValues[newIndex] = oldAttribute; } } @@ -566,7 +566,7 @@ namespace EMotionFX void AnimGraphInstance::SetMotionSet(MotionSet* motionSet) { // update the local motion set pointer - mMotionSet = motionSet; + m_motionSet = motionSet; // get the number of state machines, iterate through them and recursively call the callback GetRootNode()->RecursiveOnChangeMotionSet(this, motionSet); @@ -576,20 +576,20 @@ namespace EMotionFX // adjust the auto unregistering from the anim graph manager on delete void AnimGraphInstance::SetAutoUnregisterEnabled(bool enabled) { - mAutoUnregister = enabled; + m_autoUnregister = enabled; } // do we auto unregister from the anim graph manager on delete? bool AnimGraphInstance::GetAutoUnregisterEnabled() const { - return mAutoUnregister; + return m_autoUnregister; } void AnimGraphInstance::SetIsOwnedByRuntime(bool isOwnedByRuntime) { #if defined(EMFX_DEVELOPMENT_BUILD) - mIsOwnedByRuntime = isOwnedByRuntime; + m_isOwnedByRuntime = isOwnedByRuntime; #else AZ_UNUSED(isOwnedByRuntime); #endif @@ -599,7 +599,7 @@ namespace EMotionFX bool AnimGraphInstance::GetIsOwnedByRuntime() const { #if defined(EMFX_DEVELOPMENT_BUILD) - return mIsOwnedByRuntime; + return m_isOwnedByRuntime; #else return true; #endif @@ -610,7 +610,7 @@ namespace EMotionFX ActorInstance* AnimGraphInstance::FindActorInstanceFromParentDepth(size_t parentDepth) const { // start with the actor instance this anim graph instance is working on - ActorInstance* curInstance = mActorInstance; + ActorInstance* curInstance = m_actorInstance; if (parentDepth == 0) { return curInstance; @@ -654,7 +654,7 @@ namespace EMotionFX void AnimGraphInstance::AddUniqueObjectData() { m_uniqueDatas.emplace_back(nullptr); - mObjectFlags.emplace_back(0); + m_objectFlags.emplace_back(0); } // remove the given unique data object @@ -672,7 +672,7 @@ namespace EMotionFX } m_uniqueDatas.erase(m_uniqueDatas.begin() + index); - mObjectFlags.erase(AZStd::next(begin(mObjectFlags), index)); + m_objectFlags.erase(AZStd::next(begin(m_objectFlags), index)); } @@ -680,7 +680,7 @@ namespace EMotionFX { AnimGraphObjectData* data = m_uniqueDatas[index]; m_uniqueDatas.erase(m_uniqueDatas.begin() + index); - mObjectFlags.erase(AZStd::next(begin(mObjectFlags), index)); + m_objectFlags.erase(AZStd::next(begin(m_objectFlags), index)); if (delFromMem && data) { data->Destroy(); @@ -703,7 +703,7 @@ namespace EMotionFX } m_uniqueDatas.clear(); - mObjectFlags.clear(); + m_objectFlags.clear(); } @@ -807,13 +807,13 @@ namespace EMotionFX // init the hashmap void AnimGraphInstance::InitUniqueDatas() { - const size_t numObjects = mAnimGraph->GetNumObjects(); + const size_t numObjects = m_animGraph->GetNumObjects(); m_uniqueDatas.resize(numObjects); - mObjectFlags.resize(numObjects); + m_objectFlags.resize(numObjects); for (size_t i = 0; i < numObjects; ++i) { m_uniqueDatas[i] = nullptr; - mObjectFlags[i] = 0; + m_objectFlags[i] = 0; } } @@ -821,7 +821,7 @@ namespace EMotionFX // get the root node AnimGraphNode* AnimGraphInstance::GetRootNode() const { - return mAnimGraph->GetRootStateMachine(); + return m_animGraph->GetRootStateMachine(); } @@ -832,22 +832,22 @@ namespace EMotionFX Transform trajectoryDelta; // get the motion extraction node, and if it hasn't been set, we can already quit - Node* motionExtractNode = mActorInstance->GetActor()->GetMotionExtractionNode(); + Node* motionExtractNode = m_actorInstance->GetActor()->GetMotionExtractionNode(); if (motionExtractNode == nullptr) { trajectoryDelta.IdentityWithZeroScale(); - mActorInstance->SetTrajectoryDeltaTransform(trajectoryDelta); + m_actorInstance->SetTrajectoryDeltaTransform(trajectoryDelta); return; } // get the root node's trajectory delta - AnimGraphRefCountedData* rootData = mAnimGraph->GetRootStateMachine()->FindOrCreateUniqueNodeData(this)->GetRefCountedData(); + AnimGraphRefCountedData* rootData = m_animGraph->GetRootStateMachine()->FindOrCreateUniqueNodeData(this)->GetRefCountedData(); trajectoryDelta = rootData->GetTrajectoryDelta(); - trajectoryDelta.mRotation.Normalize(); + trajectoryDelta.m_rotation.Normalize(); // update the actor instance with the delta movement already - mActorInstance->SetTrajectoryDeltaTransform(trajectoryDelta); - mActorInstance->ApplyMotionExtractionDelta(); + m_actorInstance->SetTrajectoryDeltaTransform(trajectoryDelta); + m_actorInstance->ApplyMotionExtractionDelta(); } @@ -855,9 +855,9 @@ namespace EMotionFX void AnimGraphInstance::Update(float timePassedInSeconds) { // pass 0: (Optional, networking only) When this instance is shared between network, restore the instance using an animgraph snapshot. - if (mSnapshot) + if (m_snapshot) { - mSnapshot->Restore(*this); + m_snapshot->Restore(*this); } // pass 1: update (bottom up), update motion timers etc @@ -876,7 +876,7 @@ namespace EMotionFX } // reset all node pose ref counts - const uint32 threadIndex = mActorInstance->GetThreadIndex(); + const uint32 threadIndex = m_actorInstance->GetThreadIndex(); ResetPoseRefCountsForAllNodes(); ResetRefDataRefCountsForAllNodes(); GetEMotionFX().GetThreadData(threadIndex)->GetRefCountedDataPool().ResetMaxUsedItems(); @@ -901,7 +901,7 @@ namespace EMotionFX ApplyMotionExtraction(); // store a copy of the root's event buffer - mEventBuffer = rootNodeUniqueData->GetRefCountedData()->GetEventBuffer(); + m_eventBuffer = rootNodeUniqueData->GetRefCountedData()->GetEventBuffer(); // trigger the events inside the root node's buffer OutputEvents(); @@ -923,14 +923,14 @@ namespace EMotionFX // recursively reset flags void AnimGraphInstance::RecursiveResetFlags(uint32 flagsToDisable) { - mAnimGraph->GetRootStateMachine()->RecursiveResetFlags(this, flagsToDisable); + m_animGraph->GetRootStateMachine()->RecursiveResetFlags(this, flagsToDisable); } // reset all node flags void AnimGraphInstance::ResetFlagsForAllObjects(uint32 flagsToDisable) { - for (uint32& objectFlag : mObjectFlags) + for (uint32& objectFlag : m_objectFlags) { objectFlag &= ~flagsToDisable; } @@ -940,10 +940,10 @@ namespace EMotionFX // reset all node pose ref counts void AnimGraphInstance::ResetPoseRefCountsForAllNodes() { - const size_t numNodes = mAnimGraph->GetNumNodes(); + const size_t numNodes = m_animGraph->GetNumNodes(); for (size_t i = 0; i < numNodes; ++i) { - mAnimGraph->GetNode(i)->ResetPoseRefCount(this); + m_animGraph->GetNode(i)->ResetPoseRefCount(this); } } @@ -951,10 +951,10 @@ namespace EMotionFX // reset all node pose ref counts void AnimGraphInstance::ResetRefDataRefCountsForAllNodes() { - const size_t numNodes = mAnimGraph->GetNumNodes(); + const size_t numNodes = m_animGraph->GetNumNodes(); for (size_t i = 0; i < numNodes; ++i) { - mAnimGraph->GetNode(i)->ResetRefDataRefCount(this); + m_animGraph->GetNode(i)->ResetRefDataRefCount(this); } } @@ -962,7 +962,7 @@ namespace EMotionFX // reset all node flags void AnimGraphInstance::ResetFlagsForAllObjects() { - MCore::MemSet(mObjectFlags.data(), 0, sizeof(uint32) * mObjectFlags.size()); + MCore::MemSet(m_objectFlags.data(), 0, sizeof(uint32) * m_objectFlags.size()); for (AnimGraphInstance* childInstance : m_childAnimGraphInstances) { @@ -974,11 +974,11 @@ namespace EMotionFX // reset flags for all nodes void AnimGraphInstance::ResetFlagsForAllNodes(uint32 flagsToDisable) { - const size_t numNodes = mAnimGraph->GetNumNodes(); + const size_t numNodes = m_animGraph->GetNumNodes(); for (size_t i = 0; i < numNodes; ++i) { - AnimGraphNode* node = mAnimGraph->GetNode(i); - mObjectFlags[node->GetObjectIndex()] &= ~flagsToDisable; + AnimGraphNode* node = m_animGraph->GetNode(i); + m_objectFlags[node->GetObjectIndex()] &= ~flagsToDisable; if (GetEMotionFX().GetIsInEditorMode()) { @@ -1009,14 +1009,14 @@ namespace EMotionFX void AnimGraphInstance::CollectActiveAnimGraphNodes(AZStd::vector* outNodes, const AZ::TypeId& nodeType) { outNodes->clear(); - mAnimGraph->GetRootStateMachine()->RecursiveCollectActiveNodes(this, outNodes, nodeType); + m_animGraph->GetRootStateMachine()->RecursiveCollectActiveNodes(this, outNodes, nodeType); } void AnimGraphInstance::CollectActiveNetTimeSyncNodes(AZStd::vector* outNodes) { outNodes->clear(); - mAnimGraph->GetRootStateMachine()->RecursiveCollectActiveNetTimeSyncNodes(this, outNodes); + m_animGraph->GetRootStateMachine()->RecursiveCollectActiveNetTimeSyncNodes(this, outNodes); } AnimGraphObjectData* AnimGraphInstance::FindOrCreateUniqueObjectData(const AnimGraphObject* object) @@ -1052,65 +1052,65 @@ namespace EMotionFX // find the parameter index AZ::Outcome AnimGraphInstance::FindParameterIndex(const AZStd::string& name) const { - return mAnimGraph->FindValueParameterIndexByName(name); + return m_animGraph->FindValueParameterIndexByName(name); } // init all internal attributes void AnimGraphInstance::InitInternalAttributes() { - const size_t numNodes = mAnimGraph->GetNumNodes(); + const size_t numNodes = m_animGraph->GetNumNodes(); for (size_t i = 0; i < numNodes; ++i) { - mAnimGraph->GetNode(i)->InitInternalAttributes(this); + m_animGraph->GetNode(i)->InitInternalAttributes(this); } } void AnimGraphInstance::SetVisualizeScale(float scale) { - mVisualizeScale = scale; + m_visualizeScale = scale; } float AnimGraphInstance::GetVisualizeScale() const { - return mVisualizeScale; + return m_visualizeScale; } void AnimGraphInstance::SetVisualizationEnabled(bool enabled) { - mEnableVisualization = enabled; + m_enableVisualization = enabled; } bool AnimGraphInstance::GetVisualizationEnabled() const { - return mEnableVisualization; + return m_enableVisualization; } bool AnimGraphInstance::GetRetargetingEnabled() const { - return mRetarget; + return m_retarget; } void AnimGraphInstance::SetRetargetingEnabled(bool enabled) { - mRetarget = enabled; + m_retarget = enabled; } const AnimGraphInstance::InitSettings& AnimGraphInstance::GetInitSettings() const { - return mInitSettings; + return m_initSettings; } const AnimGraphEventBuffer& AnimGraphInstance::GetEventBuffer() const { - return mEventBuffer; + return m_eventBuffer; } @@ -1172,72 +1172,72 @@ namespace EMotionFX void AnimGraphInstance::CreateSnapshot(bool authoritative) { - if (mSnapshot) + if (m_snapshot) { AZ_Error("EMotionFX", false, "Snapshot already created for this animgraph instance."); return; } - mSnapshot = AZStd::make_shared(*this, authoritative); + m_snapshot = AZStd::make_shared(*this, authoritative); } void AnimGraphInstance::SetSnapshotSerializer(AZStd::shared_ptr serializer) { - if (!mSnapshot) + if (!m_snapshot) { AZ_Error("EMotionFX", false, "Snapshot should be created first."); return; } - mSnapshot->SetSnapshotSerializer(serializer); + m_snapshot->SetSnapshotSerializer(serializer); } void AnimGraphInstance::SetSnapshotChunkSerializer(AZStd::shared_ptr serializer) { - if (!mSnapshot) + if (!m_snapshot) { AZ_Error("EMotionFX", false, "Snapshot should be created first."); return; } - mSnapshot->SetSnapshotChunkSerializer(serializer); + m_snapshot->SetSnapshotChunkSerializer(serializer); } void AnimGraphInstance::OnNetworkConnected() { - if (!mSnapshot) + if (!m_snapshot) { AZ_Error("EMotionFX", false, "Snapshot should be created first."); return; } - mSnapshot->OnNetworkConnected(*this); + m_snapshot->OnNetworkConnected(*this); } void AnimGraphInstance::OnNetworkParamUpdate(const AttributeContainer& parameters) { - if (!mSnapshot) + if (!m_snapshot) { AZ_Error("EMotionFX", false, "Snapshot should be created first."); return; } - mSnapshot->SetParameters(parameters); + m_snapshot->SetParameters(parameters); } void AnimGraphInstance::OnNetworkActiveNodesUpdate(const AZStd::vector& activeNodes) { - if (!mSnapshot) + if (!m_snapshot) { AZ_Error("EMotionFX", false, "Snapshot should be created first."); return; } - mSnapshot->SetActiveNodes(activeNodes); + m_snapshot->SetActiveNodes(activeNodes); } void AnimGraphInstance::OnNetworkMotionNodePlaytimesUpdate(const MotionNodePlaytimeContainer& motionNodePlaytimes) { - if (!mSnapshot) + if (!m_snapshot) { AZ_Error("EMotionFX", false, "Snapshot should be created first."); return; } - mSnapshot->SetMotionNodePlaytimes(motionNodePlaytimes); + m_snapshot->SetMotionNodePlaytimes(motionNodePlaytimes); } void AnimGraphInstance::SetAutoReleaseRefDatas(bool automaticallyFreeRefDatas) @@ -1252,13 +1252,13 @@ namespace EMotionFX void AnimGraphInstance::ReleaseRefDatas() { - const uint32 threadIndex = mActorInstance->GetThreadIndex(); + const uint32 threadIndex = m_actorInstance->GetThreadIndex(); AnimGraphRefCountedDataPool& refDataPool = GetEMotionFX().GetThreadData(threadIndex)->GetRefCountedDataPool(); - const size_t numNodes = mAnimGraph->GetNumNodes(); + const size_t numNodes = m_animGraph->GetNumNodes(); for (size_t i = 0; i < numNodes; ++i) { - const AnimGraphNode* node = mAnimGraph->GetNode(i); + const AnimGraphNode* node = m_animGraph->GetNode(i); AnimGraphNodeData* nodeData = static_cast(m_uniqueDatas[node->GetObjectIndex()]); if (nodeData) { diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphInstance.h b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphInstance.h index 9366fcff86..81bae83515 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphInstance.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphInstance.h @@ -64,11 +64,11 @@ namespace EMotionFX struct EMFX_API InitSettings { - bool mPreInitMotionInstances; + bool m_preInitMotionInstances; InitSettings() { - mPreInitMotionInstances = false; + m_preInitMotionInstances = false; } }; @@ -79,9 +79,9 @@ namespace EMotionFX void Start(); void Stop(); - MCORE_INLINE ActorInstance* GetActorInstance() const { return mActorInstance; } - MCORE_INLINE AnimGraph* GetAnimGraph() const { return mAnimGraph; } - MCORE_INLINE MotionSet* GetMotionSet() const { return mMotionSet; } + MCORE_INLINE ActorInstance* GetActorInstance() const { return m_actorInstance; } + MCORE_INLINE AnimGraph* GetAnimGraph() const { return m_animGraph; } + MCORE_INLINE MotionSet* GetMotionSet() const { return m_motionSet; } void SetParentAnimGraphInstance(AnimGraphInstance* parentAnimGraphInstance); MCORE_INLINE AnimGraphInstance* GetParentAnimGraphInstance() const { return m_parentAnimGraphInstance; } @@ -118,7 +118,7 @@ namespace EMotionFX template MCORE_INLINE T* GetParameterValueChecked(size_t index) const { - MCore::Attribute* baseAttrib = mParamValues[index]; + MCore::Attribute* baseAttrib = m_paramValues[index]; if (baseAttrib->GetType() == T::TYPE_ID) { return static_cast(baseAttrib); @@ -126,7 +126,7 @@ namespace EMotionFX return nullptr; } - MCORE_INLINE MCore::Attribute* GetParameterValue(size_t index) const { return mParamValues[index]; } + MCORE_INLINE MCore::Attribute* GetParameterValue(size_t index) const { return m_paramValues[index]; } MCore::Attribute* FindParameter(const AZStd::string& name) const; AZ::Outcome FindParameterIndex(const AZStd::string& name) const; @@ -237,39 +237,39 @@ namespace EMotionFX void CollectActiveAnimGraphNodes(AZStd::vector* outNodes, const AZ::TypeId& nodeType = AZ::TypeId::CreateNull()); // MCORE_INVALIDINDEX32 means all node types void CollectActiveNetTimeSyncNodes(AZStd::vector* outNodes); - MCORE_INLINE uint32 GetObjectFlags(size_t objectIndex) const { return mObjectFlags[objectIndex]; } - MCORE_INLINE void SetObjectFlags(size_t objectIndex, uint32 flags) { mObjectFlags[objectIndex] = flags; } - MCORE_INLINE void EnableObjectFlags(size_t objectIndex, uint32 flagsToEnable) { mObjectFlags[objectIndex] |= flagsToEnable; } - MCORE_INLINE void DisableObjectFlags(size_t objectIndex, uint32 flagsToDisable) { mObjectFlags[objectIndex] &= ~flagsToDisable; } + MCORE_INLINE uint32 GetObjectFlags(size_t objectIndex) const { return m_objectFlags[objectIndex]; } + MCORE_INLINE void SetObjectFlags(size_t objectIndex, uint32 flags) { m_objectFlags[objectIndex] = flags; } + MCORE_INLINE void EnableObjectFlags(size_t objectIndex, uint32 flagsToEnable) { m_objectFlags[objectIndex] |= flagsToEnable; } + MCORE_INLINE void DisableObjectFlags(size_t objectIndex, uint32 flagsToDisable) { m_objectFlags[objectIndex] &= ~flagsToDisable; } MCORE_INLINE void SetObjectFlags(size_t objectIndex, uint32 flags, bool enabled) { if (enabled) { - mObjectFlags[objectIndex] |= flags; + m_objectFlags[objectIndex] |= flags; } else { - mObjectFlags[objectIndex] &= ~flags; + m_objectFlags[objectIndex] &= ~flags; } } - MCORE_INLINE bool GetIsObjectFlagEnabled(size_t objectIndex, uint32 flag) const { return (mObjectFlags[objectIndex] & flag) != 0; } + MCORE_INLINE bool GetIsObjectFlagEnabled(size_t objectIndex, uint32 flag) const { return (m_objectFlags[objectIndex] & flag) != 0; } - MCORE_INLINE bool GetIsOutputReady(size_t objectIndex) const { return (mObjectFlags[objectIndex] & OBJECTFLAGS_OUTPUT_READY) != 0; } + MCORE_INLINE bool GetIsOutputReady(size_t objectIndex) const { return (m_objectFlags[objectIndex] & OBJECTFLAGS_OUTPUT_READY) != 0; } MCORE_INLINE void SetIsOutputReady(size_t objectIndex, bool isReady) { SetObjectFlags(objectIndex, OBJECTFLAGS_OUTPUT_READY, isReady); } - MCORE_INLINE bool GetIsSynced(size_t objectIndex) const { return (mObjectFlags[objectIndex] & OBJECTFLAGS_SYNCED) != 0; } + MCORE_INLINE bool GetIsSynced(size_t objectIndex) const { return (m_objectFlags[objectIndex] & OBJECTFLAGS_SYNCED) != 0; } MCORE_INLINE void SetIsSynced(size_t objectIndex, bool isSynced) { SetObjectFlags(objectIndex, OBJECTFLAGS_SYNCED, isSynced); } - MCORE_INLINE bool GetIsResynced(size_t objectIndex) const { return (mObjectFlags[objectIndex] & OBJECTFLAGS_RESYNC) != 0; } + MCORE_INLINE bool GetIsResynced(size_t objectIndex) const { return (m_objectFlags[objectIndex] & OBJECTFLAGS_RESYNC) != 0; } MCORE_INLINE void SetIsResynced(size_t objectIndex, bool isResynced) { SetObjectFlags(objectIndex, OBJECTFLAGS_RESYNC, isResynced); } - MCORE_INLINE bool GetIsUpdateReady(size_t objectIndex) const { return (mObjectFlags[objectIndex] & OBJECTFLAGS_UPDATE_READY) != 0; } + MCORE_INLINE bool GetIsUpdateReady(size_t objectIndex) const { return (m_objectFlags[objectIndex] & OBJECTFLAGS_UPDATE_READY) != 0; } MCORE_INLINE void SetIsUpdateReady(size_t objectIndex, bool isReady) { SetObjectFlags(objectIndex, OBJECTFLAGS_UPDATE_READY, isReady); } - MCORE_INLINE bool GetIsTopDownUpdateReady(size_t objectIndex) const { return (mObjectFlags[objectIndex] & OBJECTFLAGS_TOPDOWNUPDATE_READY) != 0; } + MCORE_INLINE bool GetIsTopDownUpdateReady(size_t objectIndex) const { return (m_objectFlags[objectIndex] & OBJECTFLAGS_TOPDOWNUPDATE_READY) != 0; } MCORE_INLINE void SetIsTopDownUpdateReady(size_t objectIndex, bool isReady) { SetObjectFlags(objectIndex, OBJECTFLAGS_TOPDOWNUPDATE_READY, isReady); } - MCORE_INLINE bool GetIsPostUpdateReady(size_t objectIndex) const { return (mObjectFlags[objectIndex] & OBJECTFLAGS_POSTUPDATE_READY) != 0; } + MCORE_INLINE bool GetIsPostUpdateReady(size_t objectIndex) const { return (m_objectFlags[objectIndex] & OBJECTFLAGS_POSTUPDATE_READY) != 0; } MCORE_INLINE void SetIsPostUpdateReady(size_t objectIndex, bool isReady) { SetObjectFlags(objectIndex, OBJECTFLAGS_POSTUPDATE_READY, isReady); } const InitSettings& GetInitSettings() const; @@ -283,9 +283,9 @@ namespace EMotionFX void CreateSnapshot(bool authoritative); void SetSnapshotSerializer(AZStd::shared_ptr serializer); void SetSnapshotChunkSerializer(AZStd::shared_ptr serializer); - const AZStd::shared_ptr GetSnapshot() const { return mSnapshot; } + const AZStd::shared_ptr GetSnapshot() const { return m_snapshot; } bool IsNetworkEnabled() const { return GetSnapshot(); } - MCore::LcgRandom& GetLcgRandom() { return mLcgRandom; } + MCore::LcgRandom& GetLcgRandom() { return m_lcgRandom; } void OnNetworkConnected(); void OnNetworkParamUpdate(const AttributeContainer& parameters); @@ -298,24 +298,24 @@ namespace EMotionFX void ReleasePoses(); private: - AnimGraph* mAnimGraph; - ActorInstance* mActorInstance; + AnimGraph* m_animGraph; + ActorInstance* m_actorInstance; AnimGraphInstance* m_parentAnimGraphInstance; // If this anim graph instance is in a reference node, it will have a parent anim graph instance. AZStd::vector m_childAnimGraphInstances; // If this anim graph instance contains reference nodes, the anim graph instances will be listed here. - AZStd::vector mParamValues; // a value for each AnimGraph parameter (the control parameters) + AZStd::vector m_paramValues; // a value for each AnimGraph parameter (the control parameters) AZStd::vector m_uniqueDatas; // unique object data - AZStd::vector mObjectFlags; // the object flags + AZStd::vector m_objectFlags; // the object flags using EventHandlerVector = AZStd::vector; AZStd::vector m_eventHandlersByEventType; /**< The event handler to use to process events organized by EventTypes. */ AZStd::vector m_internalAttributes; - MotionSet* mMotionSet; // the used motion set - MCore::Mutex mMutex; - InitSettings mInitSettings; - AnimGraphEventBuffer mEventBuffer; /**< The event buffer of the last update. */ - float mVisualizeScale; - bool mAutoUnregister; /**< Specifies whether we will automatically unregister this anim graph instance set from the anim graph manager or not, when deleting this object. */ - bool mEnableVisualization; - bool mRetarget; /**< Is retargeting enabled? */ + MotionSet* m_motionSet; // the used motion set + MCore::Mutex m_mutex; + InitSettings m_initSettings; + AnimGraphEventBuffer m_eventBuffer; /**< The event buffer of the last update. */ + float m_visualizeScale; + bool m_autoUnregister; /**< Specifies whether we will automatically unregister this anim graph instance set from the anim graph manager or not, when deleting this object. */ + bool m_enableVisualization; + bool m_retarget; /**< Is retargeting enabled? */ bool m_autoReleaseAllPoses; bool m_autoReleaseAllRefDatas; @@ -324,11 +324,11 @@ namespace EMotionFX AZStd::vector m_leaderGraphs; // Network related members - AZStd::shared_ptr mSnapshot; - MCore::LcgRandom mLcgRandom; + AZStd::shared_ptr m_snapshot; + MCore::LcgRandom m_lcgRandom; #if defined(EMFX_DEVELOPMENT_BUILD) - bool mIsOwnedByRuntime; + bool m_isOwnedByRuntime; #endif // EMFX_DEVELOPMENT_BUILD AnimGraphInstance(AnimGraph* animGraph, ActorInstance* actorInstance, MotionSet* motionSet, const InitSettings* initSettings = nullptr); diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphManager.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphManager.cpp index fc74d747c6..069bb4b57a 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphManager.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphManager.cpp @@ -28,16 +28,16 @@ namespace EMotionFX AnimGraphManager::AnimGraphManager() : BaseObject() - , mBlendSpaceManager(nullptr) + , m_blendSpaceManager(nullptr) { } AnimGraphManager::~AnimGraphManager() { - if (mBlendSpaceManager) + if (m_blendSpaceManager) { - mBlendSpaceManager->Destroy(); + m_blendSpaceManager->Destroy(); } // delete the anim graph instances and anim graphs //RemoveAllAnimGraphInstances(true); @@ -53,10 +53,10 @@ namespace EMotionFX void AnimGraphManager::Init() { - mAnimGraphInstances.reserve(1024); - mAnimGraphs.reserve(128); + m_animGraphInstances.reserve(1024); + m_animGraphs.reserve(128); - mBlendSpaceManager = aznew BlendSpaceManager(); + m_blendSpaceManager = aznew BlendSpaceManager(); // register custom attribute types MCore::GetAttributeFactory().RegisterAttribute(aznew AttributePose()); @@ -66,51 +66,51 @@ namespace EMotionFX void AnimGraphManager::RemoveAllAnimGraphs(bool delFromMemory) { - MCore::LockGuardRecursive lock(mAnimGraphLock); + MCore::LockGuardRecursive lock(m_animGraphLock); - while (!mAnimGraphs.empty()) + while (!m_animGraphs.empty()) { - RemoveAnimGraph(mAnimGraphs.size() - 1, delFromMemory); + RemoveAnimGraph(m_animGraphs.size() - 1, delFromMemory); } } void AnimGraphManager::RemoveAllAnimGraphInstances(bool delFromMemory) { - MCore::LockGuardRecursive lock(mAnimGraphInstanceLock); + MCore::LockGuardRecursive lock(m_animGraphInstanceLock); - while (!mAnimGraphInstances.empty()) + while (!m_animGraphInstances.empty()) { - RemoveAnimGraphInstance(mAnimGraphInstances.size() - 1, delFromMemory); + RemoveAnimGraphInstance(m_animGraphInstances.size() - 1, delFromMemory); } } void AnimGraphManager::AddAnimGraph(AnimGraph* setup) { - MCore::LockGuardRecursive lock(mAnimGraphLock); - mAnimGraphs.push_back(setup); + MCore::LockGuardRecursive lock(m_animGraphLock); + m_animGraphs.push_back(setup); } // Remove a given anim graph by index. void AnimGraphManager::RemoveAnimGraph(size_t index, bool delFromMemory) { - MCore::LockGuardRecursive lock(mAnimGraphLock); + MCore::LockGuardRecursive lock(m_animGraphLock); - AnimGraph* animGraph = mAnimGraphs[index]; - const int animGraphInstanceCount = static_cast(mAnimGraphInstances.size()); + AnimGraph* animGraph = m_animGraphs[index]; + const int animGraphInstanceCount = static_cast(m_animGraphInstances.size()); for (int i = animGraphInstanceCount - 1; i >= 0; --i) { - if (mAnimGraphInstances[i]->GetAnimGraph() == animGraph) + if (m_animGraphInstances[i]->GetAnimGraph() == animGraph) { - RemoveAnimGraphInstance(mAnimGraphInstances[i]); + RemoveAnimGraphInstance(m_animGraphInstances[i]); } } // Need to remove it from the list of anim graphs first since deleting it can cause assets to get unloaded and // this function to be called recursively (making the index to shift) - mAnimGraphs.erase(mAnimGraphs.begin() + index); + m_animGraphs.erase(m_animGraphs.begin() + index); if (delFromMemory) { @@ -125,7 +125,7 @@ namespace EMotionFX // Remove a given anim graph by pointer. bool AnimGraphManager::RemoveAnimGraph(AnimGraph* animGraph, bool delFromMemory) { - MCore::LockGuardRecursive lock(mAnimGraphLock); + MCore::LockGuardRecursive lock(m_animGraphLock); // find the index of the anim graph and return false in case the pointer is not valid const size_t animGraphIndex = FindAnimGraphIndex(animGraph); @@ -141,18 +141,18 @@ namespace EMotionFX void AnimGraphManager::AddAnimGraphInstance(AnimGraphInstance* animGraphInstance) { - MCore::LockGuardRecursive lock(mAnimGraphInstanceLock); - mAnimGraphInstances.push_back(animGraphInstance); + MCore::LockGuardRecursive lock(m_animGraphInstanceLock); + m_animGraphInstances.push_back(animGraphInstance); } void AnimGraphManager::RemoveAnimGraphInstance(size_t index, bool delFromMemory) { - MCore::LockGuardRecursive lock(mAnimGraphInstanceLock); + MCore::LockGuardRecursive lock(m_animGraphInstanceLock); if (delFromMemory) { - AnimGraphInstance* animGraphInstance = mAnimGraphInstances[index]; + AnimGraphInstance* animGraphInstance = m_animGraphInstances[index]; animGraphInstance->RemoveAllObjectData(true); // Remove all links to the anim graph instance that will get removed. @@ -172,14 +172,14 @@ namespace EMotionFX animGraphInstance->Destroy(); } - mAnimGraphInstances.erase(mAnimGraphInstances.begin() + index); + m_animGraphInstances.erase(m_animGraphInstances.begin() + index); } // remove a given anim graph instance by pointer bool AnimGraphManager::RemoveAnimGraphInstance(AnimGraphInstance* animGraphInstance, bool delFromMemory) { - MCore::LockGuardRecursive lock(mAnimGraphInstanceLock); + MCore::LockGuardRecursive lock(m_animGraphInstanceLock); // find the index of the anim graph instance and return false in case the pointer is not valid const size_t instanceIndex = FindAnimGraphInstanceIndex(animGraphInstance); @@ -196,20 +196,20 @@ namespace EMotionFX void AnimGraphManager::RemoveAnimGraphInstances(AnimGraph* animGraph, bool delFromMemory) { - MCore::LockGuardRecursive lock(mAnimGraphInstanceLock); + MCore::LockGuardRecursive lock(m_animGraphInstanceLock); - if (mAnimGraphInstances.empty()) + if (m_animGraphInstances.empty()) { return; } // Remove anim graph instances back to front in case they are linked to the given anim graph. - const size_t numInstances = mAnimGraphInstances.size(); + const size_t numInstances = m_animGraphInstances.size(); for (size_t i = 0; i < numInstances; ++i) { const size_t reverseIndex = numInstances - 1 - i; - AnimGraphInstance* instance = mAnimGraphInstances[reverseIndex]; + AnimGraphInstance* instance = m_animGraphInstances[reverseIndex]; if (instance->GetAnimGraph() == animGraph) { RemoveAnimGraphInstance(reverseIndex, delFromMemory); @@ -220,30 +220,30 @@ namespace EMotionFX size_t AnimGraphManager::FindAnimGraphIndex(AnimGraph* animGraph) const { - MCore::LockGuardRecursive lock(mAnimGraphLock); + MCore::LockGuardRecursive lock(m_animGraphLock); - auto iterator = AZStd::find(mAnimGraphs.begin(), mAnimGraphs.end(), animGraph); - if (iterator == mAnimGraphs.end()) + auto iterator = AZStd::find(m_animGraphs.begin(), m_animGraphs.end(), animGraph); + if (iterator == m_animGraphs.end()) { return InvalidIndex; } - const size_t index = iterator - mAnimGraphs.begin(); + const size_t index = iterator - m_animGraphs.begin(); return index; } size_t AnimGraphManager::FindAnimGraphInstanceIndex(AnimGraphInstance* animGraphInstance) const { - MCore::LockGuardRecursive lock(mAnimGraphInstanceLock); + MCore::LockGuardRecursive lock(m_animGraphInstanceLock); - auto iterator = AZStd::find(mAnimGraphInstances.begin(), mAnimGraphInstances.end(), animGraphInstance); - if (iterator == mAnimGraphInstances.end()) + auto iterator = AZStd::find(m_animGraphInstances.begin(), m_animGraphInstances.end(), animGraphInstance); + if (iterator == m_animGraphInstances.end()) { return InvalidIndex; } - const size_t index = iterator - mAnimGraphInstances.begin(); + const size_t index = iterator - m_animGraphInstances.begin(); return index; } @@ -251,9 +251,9 @@ namespace EMotionFX // find a anim graph with a given filename AnimGraph* AnimGraphManager::FindAnimGraphByFileName(const char* filename, bool isTool) const { - MCore::LockGuardRecursive lock(mAnimGraphLock); + MCore::LockGuardRecursive lock(m_animGraphLock); - for (EMotionFX::AnimGraph* animGraph : mAnimGraphs) + for (EMotionFX::AnimGraph* animGraph : m_animGraphs) { if (animGraph->GetIsOwnedByRuntime() == isTool) { @@ -273,9 +273,9 @@ namespace EMotionFX // Find anim graph with a given id. AnimGraph* AnimGraphManager::FindAnimGraphByID(uint32 animGraphID) const { - MCore::LockGuardRecursive lock(mAnimGraphLock); + MCore::LockGuardRecursive lock(m_animGraphLock); - for (EMotionFX::AnimGraph* animGraph : mAnimGraphs) + for (EMotionFX::AnimGraph* animGraph : m_animGraphs) { if (animGraph->GetID() == animGraphID) { @@ -290,11 +290,11 @@ namespace EMotionFX // Find the first available anim graph AnimGraph* AnimGraphManager::GetFirstAnimGraph() const { - MCore::LockGuardRecursive lock(mAnimGraphLock); + MCore::LockGuardRecursive lock(m_animGraphLock); - if (mAnimGraphs.size() > 0) + if (m_animGraphs.size() > 0) { - return mAnimGraphs[0]; + return m_animGraphs[0]; } return nullptr; } @@ -302,10 +302,10 @@ namespace EMotionFX void AnimGraphManager::SetAnimGraphVisualizationEnabled(bool enabled) { - MCore::LockGuardRecursive lock(mAnimGraphInstanceLock); + MCore::LockGuardRecursive lock(m_animGraphInstanceLock); // Enable or disable anim graph visualization for all anim graph instances.. - for (AnimGraphInstance* animGraphInstance : mAnimGraphInstances) + for (AnimGraphInstance* animGraphInstance : m_animGraphInstances) { animGraphInstance->SetVisualizationEnabled(enabled); } @@ -314,7 +314,7 @@ namespace EMotionFX void AnimGraphManager::RecursiveCollectObjectsAffectedBy(AnimGraph* animGraph, AZStd::vector& affectedObjects) { - for (EMotionFX::AnimGraph* potentiallyAffected : mAnimGraphs) + for (EMotionFX::AnimGraph* potentiallyAffected : m_animGraphs) { if (potentiallyAffected != animGraph) // exclude the passed one since that will always be affected { @@ -326,7 +326,7 @@ namespace EMotionFX void AnimGraphManager::InvalidateInstanceUniqueDataUsingMotionSet(EMotionFX::MotionSet* motionSet) { // Update unique datas for all anim graph instances that use the given motion set. - for (EMotionFX::AnimGraphInstance* animGraphInstance : mAnimGraphInstances) + for (EMotionFX::AnimGraphInstance* animGraphInstance : m_animGraphInstances) { if (animGraphInstance->GetMotionSet() == motionSet) { diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphManager.h b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphManager.h index 55ee6599fd..acff1779bb 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphManager.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphManager.h @@ -40,7 +40,7 @@ namespace EMotionFX void Init(); - MCORE_INLINE BlendSpaceManager* GetBlendSpaceManager() const { return mBlendSpaceManager; } + MCORE_INLINE BlendSpaceManager* GetBlendSpaceManager() const { return m_blendSpaceManager; } // anim graph helper functions void AddAnimGraph(AnimGraph* setup); @@ -48,8 +48,8 @@ namespace EMotionFX bool RemoveAnimGraph(AnimGraph* animGraph, bool delFromMemory = true); void RemoveAllAnimGraphs(bool delFromMemory = true); - MCORE_INLINE size_t GetNumAnimGraphs() const { MCore::LockGuardRecursive lock(mAnimGraphLock); return mAnimGraphs.size(); } - MCORE_INLINE AnimGraph* GetAnimGraph(size_t index) const { MCore::LockGuardRecursive lock(mAnimGraphLock); return mAnimGraphs[index]; } + MCORE_INLINE size_t GetNumAnimGraphs() const { MCore::LockGuardRecursive lock(m_animGraphLock); return m_animGraphs.size(); } + MCORE_INLINE AnimGraph* GetAnimGraph(size_t index) const { MCore::LockGuardRecursive lock(m_animGraphLock); return m_animGraphs[index]; } AnimGraph* GetFirstAnimGraph() const; size_t FindAnimGraphIndex(AnimGraph* animGraph) const; @@ -64,8 +64,8 @@ namespace EMotionFX void RemoveAllAnimGraphInstances(bool delFromMemory = true); void InvalidateInstanceUniqueDataUsingMotionSet(EMotionFX::MotionSet* motionSet); - size_t GetNumAnimGraphInstances() const { MCore::LockGuardRecursive lock(mAnimGraphInstanceLock); return mAnimGraphInstances.size(); } - AnimGraphInstance* GetAnimGraphInstance(size_t index) const { MCore::LockGuardRecursive lock(mAnimGraphInstanceLock); return mAnimGraphInstances[index]; } + size_t GetNumAnimGraphInstances() const { MCore::LockGuardRecursive lock(m_animGraphInstanceLock); return m_animGraphInstances.size(); } + AnimGraphInstance* GetAnimGraphInstance(size_t index) const { MCore::LockGuardRecursive lock(m_animGraphInstanceLock); return m_animGraphInstances[index]; } size_t FindAnimGraphInstanceIndex(AnimGraphInstance* animGraphInstance) const; @@ -74,11 +74,11 @@ namespace EMotionFX void RecursiveCollectObjectsAffectedBy(AnimGraph* animGraph, AZStd::vector& affectedObjects); private: - AZStd::vector mAnimGraphs; - AZStd::vector mAnimGraphInstances; - BlendSpaceManager* mBlendSpaceManager; - mutable MCore::MutexRecursive mAnimGraphLock; - mutable MCore::MutexRecursive mAnimGraphInstanceLock; + AZStd::vector m_animGraphs; + AZStd::vector m_animGraphInstances; + BlendSpaceManager* m_blendSpaceManager; + mutable MCore::MutexRecursive m_animGraphLock; + mutable MCore::MutexRecursive m_animGraphInstanceLock; // constructor and destructor AnimGraphManager(); diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphMotionCondition.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphMotionCondition.cpp index 9303ea96c5..02865b044c 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphMotionCondition.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphMotionCondition.cpp @@ -67,7 +67,7 @@ namespace EMotionFX return; } - AnimGraphNode* node = mAnimGraph->RecursiveFindNodeById(m_motionNodeId); + AnimGraphNode* node = m_animGraph->RecursiveFindNodeById(m_motionNodeId); m_motionNode = azdynamic_cast(node); } @@ -145,9 +145,9 @@ namespace EMotionFX } // Update the unique data. - if (uniqueData->mMotionInstance != motionInstance) + if (uniqueData->m_motionInstance != motionInstance) { - uniqueData->mMotionInstance = motionInstance; + uniqueData->m_motionInstance = motionInstance; } // Process the condition depending on the function used. @@ -162,7 +162,7 @@ namespace EMotionFX for (size_t i = 0; i < numEvents; ++i) { const EMotionFX::EventInfo& eventInfo = eventBuffer.GetEvent(i); - const EventDataSet& eventDatas = eventInfo.mEvent->GetEventDatas(); + const EventDataSet& eventDatas = eventInfo.m_event->GetEventDatas(); size_t matches = 0; for (const EventDataPtr& checkAgainstData : m_eventDatas) @@ -314,7 +314,7 @@ namespace EMotionFX void AnimGraphMotionCondition::SetMotionNodeId(AnimGraphNodeId motionNodeId) { m_motionNodeId = motionNodeId; - if (mAnimGraph) + if (m_animGraph) { Reinit(); } @@ -403,7 +403,7 @@ namespace EMotionFX AnimGraphMotionCondition::UniqueData::UniqueData(AnimGraphObject* object, AnimGraphInstance* animGraphInstance, MotionInstance* motionInstance) : AnimGraphObjectData(object, animGraphInstance) { - mMotionInstance = motionInstance; + m_motionInstance = motionInstance; } diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphMotionCondition.h b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphMotionCondition.h index 3a4e1f9bc7..14e5221aec 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphMotionCondition.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphMotionCondition.h @@ -60,7 +60,7 @@ namespace EMotionFX ~UniqueData() = default; public: - MotionInstance* mMotionInstance = nullptr; + MotionInstance* m_motionInstance = nullptr; }; AnimGraphMotionCondition(); diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphMotionNode.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphMotionNode.cpp index ea3784b11c..6bcc69360b 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphMotionNode.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphMotionNode.cpp @@ -99,7 +99,7 @@ namespace EMotionFX bool AnimGraphMotionNode::GetIsInPlace(AnimGraphInstance* animGraphInstance) const { - EMotionFX::BlendTreeConnection* inPlaceConnection = GetInputPort(INPUTPORT_INPLACE).mConnection; + EMotionFX::BlendTreeConnection* inPlaceConnection = GetInputPort(INPUTPORT_INPLACE).m_connection; if (inPlaceConnection) { return GetInputNumberAsBool(animGraphInstance, INPUTPORT_INPLACE); @@ -110,7 +110,7 @@ namespace EMotionFX void AnimGraphMotionNode::PostUpdate(AnimGraphInstance* animGraphInstance, float timePassedInSeconds) { - if (mDisabled) + if (m_disabled) { UniqueData* uniqueData = static_cast(FindOrCreateUniqueNodeData(animGraphInstance)); RequestRefDatas(animGraphInstance); @@ -121,8 +121,8 @@ namespace EMotionFX } // update the input nodes - EMotionFX::BlendTreeConnection* playSpeedConnection = GetInputPort(INPUTPORT_PLAYSPEED).mConnection; - if (playSpeedConnection && mDisabled == false) + EMotionFX::BlendTreeConnection* playSpeedConnection = GetInputPort(INPUTPORT_PLAYSPEED).m_connection; + if (playSpeedConnection && m_disabled == false) { playSpeedConnection->GetSourceNode()->PerformPostUpdate(animGraphInstance, timePassedInSeconds); } @@ -135,8 +135,8 @@ namespace EMotionFX data->ZeroTrajectoryDelta(); // trigger the motion update - MotionInstance* motionInstance = uniqueData->mMotionInstance; - if (motionInstance && !animGraphInstance->GetIsResynced(mObjectIndex)) + MotionInstance* motionInstance = uniqueData->m_motionInstance; + if (motionInstance && !animGraphInstance->GetIsResynced(m_objectIndex)) { // update the time values and extract events into the event buffer motionInstance->SetWeight(uniqueData->GetLocalWeight()); @@ -176,9 +176,9 @@ namespace EMotionFX if (numMotions > 1) { // check if we reached the end of the motion, if so, pick a new one - if (uniqueData->mMotionInstance) + if (uniqueData->m_motionInstance) { - if (uniqueData->mMotionInstance->GetHasLooped() && m_nextMotionAfterLoop) + if (uniqueData->m_motionInstance->GetHasLooped() && m_nextMotionAfterLoop) { PickNewActiveMotion(animGraphInstance, uniqueData); } @@ -188,9 +188,9 @@ namespace EMotionFX // rewind when the weight reaches 0 when we want to if (!m_loop) { - if (uniqueData->mMotionInstance && uniqueData->GetLocalWeight() < MCore::Math::epsilon && m_rewindOnZeroWeight) + if (uniqueData->m_motionInstance && uniqueData->GetLocalWeight() < MCore::Math::epsilon && m_rewindOnZeroWeight) { - uniqueData->mMotionInstance->SetCurrentTime(0.0f); + uniqueData->m_motionInstance->SetCurrentTime(0.0f); uniqueData->SetCurrentPlayTime(0.0f); uniqueData->SetPreSyncTime(0.0f); } @@ -200,7 +200,7 @@ namespace EMotionFX HierarchicalSyncAllInputNodes(animGraphInstance, uniqueData); // top down update all incoming connections - for (BlendTreeConnection* connection : mConnections) + for (BlendTreeConnection* connection : m_connections) { connection->GetSourceNode()->PerformTopDownUpdate(animGraphInstance, timePassedInSeconds); } @@ -211,25 +211,25 @@ namespace EMotionFX void AnimGraphMotionNode::Update(AnimGraphInstance* animGraphInstance, float timePassedInSeconds) { // update the input nodes - EMotionFX::BlendTreeConnection* playSpeedConnection = GetInputPort(INPUTPORT_PLAYSPEED).mConnection; - if (playSpeedConnection && mDisabled == false) + EMotionFX::BlendTreeConnection* playSpeedConnection = GetInputPort(INPUTPORT_PLAYSPEED).m_connection; + if (playSpeedConnection && m_disabled == false) { UpdateIncomingNode(animGraphInstance, playSpeedConnection->GetSourceNode(), timePassedInSeconds); } - if (!mDisabled) + if (!m_disabled) { UpdateIncomingNode(animGraphInstance, GetInputNode(INPUTPORT_INPLACE), timePassedInSeconds); } // update the motion instance (current time etc) UniqueData* uniqueData = static_cast(FindOrCreateUniqueNodeData(animGraphInstance)); - MotionInstance* motionInstance = uniqueData->mMotionInstance; - if (motionInstance == nullptr || mDisabled) + MotionInstance* motionInstance = uniqueData->m_motionInstance; + if (motionInstance == nullptr || m_disabled) { if (GetEMotionFX().GetIsInEditorMode()) { - if (mDisabled == false) + if (m_disabled == false) { if (motionInstance == nullptr) { @@ -256,17 +256,17 @@ namespace EMotionFX uniqueData->SetPreSyncTime(motionInstance->GetCurrentTime()); // Make sure we use the correct play properties. - motionInstance->SetPlayMode(m_playInfo.mPlayMode); - motionInstance->SetRetargetingEnabled(m_playInfo.mRetarget && animGraphInstance->GetRetargetingEnabled()); - motionInstance->SetMotionEventsEnabled(m_playInfo.mEnableMotionEvents); - motionInstance->SetMirrorMotion(m_playInfo.mMirrorMotion); - motionInstance->SetEventWeightThreshold(m_playInfo.mEventWeightThreshold); - motionInstance->SetMaxLoops(m_playInfo.mNumLoops); - motionInstance->SetMotionExtractionEnabled(m_playInfo.mMotionExtractionEnabled); + motionInstance->SetPlayMode(m_playInfo.m_playMode); + motionInstance->SetRetargetingEnabled(m_playInfo.m_retarget && animGraphInstance->GetRetargetingEnabled()); + motionInstance->SetMotionEventsEnabled(m_playInfo.m_enableMotionEvents); + motionInstance->SetMirrorMotion(m_playInfo.m_mirrorMotion); + motionInstance->SetEventWeightThreshold(m_playInfo.m_eventWeightThreshold); + motionInstance->SetMaxLoops(m_playInfo.m_numLoops); + motionInstance->SetMotionExtractionEnabled(m_playInfo.m_motionExtractionEnabled); motionInstance->SetIsInPlace(GetIsInPlace(animGraphInstance)); - motionInstance->SetFreezeAtLastFrame(m_playInfo.mFreezeAtLastFrame); + motionInstance->SetFreezeAtLastFrame(m_playInfo.m_freezeAtLastFrame); - if (!animGraphInstance->GetIsObjectFlagEnabled(mObjectIndex, AnimGraphInstance::OBJECTFLAGS_SYNCED) || animGraphInstance->GetIsObjectFlagEnabled(mObjectIndex, AnimGraphInstance::OBJECTFLAGS_IS_SYNCLEADER)) + if (!animGraphInstance->GetIsObjectFlagEnabled(m_objectIndex, AnimGraphInstance::OBJECTFLAGS_SYNCED) || animGraphInstance->GetIsObjectFlagEnabled(m_objectIndex, AnimGraphInstance::OBJECTFLAGS_IS_SYNCLEADER)) { // See where we would end up when we would forward in time. const MotionInstance::PlayStateOut newPlayState = motionInstance->CalcPlayStateAfterUpdate(timePassedInSeconds); @@ -296,15 +296,15 @@ namespace EMotionFX void AnimGraphMotionNode::UpdatePlayBackInfo(AnimGraphInstance* animGraphInstance) { - m_playInfo.mPlayMode = (m_reverse) ? PLAYMODE_BACKWARD : PLAYMODE_FORWARD; - m_playInfo.mNumLoops = (m_loop) ? EMFX_LOOPFOREVER : 1; - m_playInfo.mFreezeAtLastFrame = true; - m_playInfo.mEnableMotionEvents = m_emitEvents; - m_playInfo.mMirrorMotion = m_mirrorMotion; - m_playInfo.mPlaySpeed = ExtractCustomPlaySpeed(animGraphInstance); - m_playInfo.mMotionExtractionEnabled = m_motionExtraction; - m_playInfo.mRetarget = m_retarget; - m_playInfo.mInPlace = GetIsInPlace(animGraphInstance); + m_playInfo.m_playMode = (m_reverse) ? PLAYMODE_BACKWARD : PLAYMODE_FORWARD; + m_playInfo.m_numLoops = (m_loop) ? EMFX_LOOPFOREVER : 1; + m_playInfo.m_freezeAtLastFrame = true; + m_playInfo.m_enableMotionEvents = m_emitEvents; + m_playInfo.m_mirrorMotion = m_mirrorMotion; + m_playInfo.m_playSpeed = ExtractCustomPlaySpeed(animGraphInstance); + m_playInfo.m_motionExtractionEnabled = m_motionExtraction; + m_playInfo.m_retarget = m_retarget; + m_playInfo.m_inPlace = GetIsInPlace(animGraphInstance); } @@ -326,12 +326,12 @@ namespace EMotionFX uniqueData->Clear(); // remove the motion instance if it already exists - if (uniqueData->mMotionInstance && uniqueData->mReload) + if (uniqueData->m_motionInstance && uniqueData->m_reload) { - GetMotionInstancePool().Free(uniqueData->mMotionInstance); - uniqueData->mMotionInstance = nullptr; - uniqueData->mMotionSetID = MCORE_INVALIDINDEX32; - uniqueData->mReload = false; + GetMotionInstancePool().Free(uniqueData->m_motionInstance); + uniqueData->m_motionInstance = nullptr; + uniqueData->m_motionSetId = MCORE_INVALIDINDEX32; + uniqueData->m_reload = false; } // get the motion set @@ -346,9 +346,9 @@ namespace EMotionFX } // get the motion from the motion set, load it on demand and make sure the motion loaded successfully - if (uniqueData->mActiveMotionIndex != MCORE_INVALIDINDEX32) + if (uniqueData->m_activeMotionIndex != MCORE_INVALIDINDEX32) { - motion = motionSet->RecursiveFindMotionById(GetMotionId(uniqueData->mActiveMotionIndex)); + motion = motionSet->RecursiveFindMotionById(GetMotionId(uniqueData->m_activeMotionIndex)); } if (!motion) @@ -360,12 +360,12 @@ namespace EMotionFX return nullptr; } - uniqueData->mMotionSetID = motionSet->GetID(); + uniqueData->m_motionSetId = motionSet->GetID(); // create the motion instance MotionInstance* motionInstance = GetMotionInstancePool().RequestNew(motion, actorInstance); motionInstance->InitFromPlayBackInfo(playInfo, true); - motionInstance->SetRetargetingEnabled(animGraphInstance->GetRetargetingEnabled() && playInfo.mRetarget); + motionInstance->SetRetargetingEnabled(animGraphInstance->GetRetargetingEnabled() && playInfo.m_retarget); uniqueData->SetSyncTrack(motionInstance->GetMotion()->GetEventTable()->GetSyncTrack()); uniqueData->SetIsMirrorMotion(motionInstance->GetMirrorMotion()); @@ -377,7 +377,7 @@ namespace EMotionFX motionInstance->SetWeight(1.0f, 0.0f); // update play info - uniqueData->mMotionInstance = motionInstance; + uniqueData->m_motionInstance = motionInstance; uniqueData->SetDuration(motionInstance->GetDuration()); const float curPlayTime = motionInstance->GetCurrentTime(); uniqueData->SetCurrentPlayTime(curPlayTime); @@ -395,7 +395,7 @@ namespace EMotionFX void AnimGraphMotionNode::Output(AnimGraphInstance* animGraphInstance) { // if this motion is disabled, output the bind pose - if (mDisabled) + if (m_disabled) { // request poses to use from the pool, so that all output pose ports have a valid pose to output to we reuse them using a pool system to save memory RequestPoses(animGraphInstance); @@ -406,7 +406,7 @@ namespace EMotionFX } // output the playspeed node - EMotionFX::BlendTreeConnection* playSpeedConnection = GetInputPort(INPUTPORT_PLAYSPEED).mConnection; + EMotionFX::BlendTreeConnection* playSpeedConnection = GetInputPort(INPUTPORT_PLAYSPEED).m_connection; if (playSpeedConnection) { OutputIncomingNode(animGraphInstance, playSpeedConnection->GetSourceNode()); @@ -416,14 +416,14 @@ namespace EMotionFX ActorInstance* actorInstance = animGraphInstance->GetActorInstance(); MotionInstance* motionInstance = nullptr; UniqueData* uniqueData = static_cast(FindOrCreateUniqueNodeData(animGraphInstance)); - if (uniqueData->mReload) + if (uniqueData->m_reload) { motionInstance = CreateMotionInstance(actorInstance, uniqueData); - uniqueData->mReload = false; + uniqueData->m_reload = false; } else { - motionInstance = uniqueData->mMotionInstance; + motionInstance = uniqueData->m_motionInstance; } // update the motion instance output port @@ -448,7 +448,7 @@ namespace EMotionFX SetHasError(uniqueData, false); } - EMotionFX::BlendTreeConnection* inPlaceConnection = GetInputPort(INPUTPORT_INPLACE).mConnection; + EMotionFX::BlendTreeConnection* inPlaceConnection = GetInputPort(INPUTPORT_INPLACE).m_connection; if (inPlaceConnection) { OutputIncomingNode(animGraphInstance, inPlaceConnection->GetSourceNode()); @@ -477,7 +477,7 @@ namespace EMotionFX // visualize it if (GetEMotionFX().GetIsInEditorMode() && GetCanVisualize(animGraphInstance)) { - actorInstance->DrawSkeleton(outputPose->GetPose(), mVisualizeColor); + actorInstance->DrawSkeleton(outputPose->GetPose(), m_visualizeColor); } } @@ -486,7 +486,7 @@ namespace EMotionFX MotionInstance* AnimGraphMotionNode::FindMotionInstance(AnimGraphInstance* animGraphInstance) const { UniqueData* uniqueData = static_cast(animGraphInstance->FindOrCreateUniqueObjectData(this)); - return uniqueData->mMotionInstance; + return uniqueData->m_motionInstance; } @@ -495,9 +495,9 @@ namespace EMotionFX { UniqueData* uniqueData = static_cast(animGraphInstance->FindOrCreateUniqueObjectData(this)); uniqueData->SetCurrentPlayTime(timeInSeconds); - if (uniqueData->mMotionInstance) + if (uniqueData->m_motionInstance) { - uniqueData->mMotionInstance->SetCurrentTime(timeInSeconds); + uniqueData->m_motionInstance->SetCurrentTime(timeInSeconds); } } @@ -510,26 +510,26 @@ namespace EMotionFX AnimGraphMotionNode::UniqueData::~UniqueData() { - GetMotionInstancePool().Free(mMotionInstance); + GetMotionInstancePool().Free(m_motionInstance); } void AnimGraphMotionNode::UniqueData::Reset() { // stop and delete the motion instance - if (mMotionInstance) + if (m_motionInstance) { - mMotionInstance->Stop(0.0f); - GetMotionInstancePool().Free(mMotionInstance); + m_motionInstance->Stop(0.0f); + GetMotionInstancePool().Free(m_motionInstance); } // reset the unique data - mMotionSetID = MCORE_INVALIDINDEX32; - mMotionInstance = nullptr; - mReload = true; - mPlaySpeed = 1.0f; - mCurrentTime = 0.0f; - mDuration = 0.0f; - mActiveMotionIndex = MCORE_INVALIDINDEX32; + m_motionSetId = MCORE_INVALIDINDEX32; + m_motionInstance = nullptr; + m_reload = true; + m_playSpeed = 1.0f; + m_currentTime = 0.0f; + m_duration = 0.0f; + m_activeMotionIndex = MCORE_INVALIDINDEX32; SetSyncTrack(nullptr); Invalidate(); @@ -537,13 +537,13 @@ namespace EMotionFX void AnimGraphMotionNode::UniqueData::Update() { - AnimGraphMotionNode* motionNode = azdynamic_cast(mObject); + AnimGraphMotionNode* motionNode = azdynamic_cast(m_object); AZ_Assert(motionNode, "Unique data linked to incorrect node type."); AnimGraphInstance* animGraphInstance = GetAnimGraphInstance(); motionNode->PickNewActiveMotion(animGraphInstance, this); - if (!mMotionInstance) + if (!m_motionInstance) { motionNode->CreateMotionInstance(animGraphInstance->GetActorInstance(), this); } @@ -560,9 +560,9 @@ namespace EMotionFX motionNode->UpdatePlayBackInfo(animGraphInstance); // update play info - if (mMotionInstance) + if (m_motionInstance) { - MotionInstance* motionInstance = mMotionInstance; + MotionInstance* motionInstance = m_motionInstance; const float currentTime = motionInstance->GetCurrentTime(); SetDuration(motionInstance->GetDuration()); SetCurrentPlayTime(currentTime); @@ -575,7 +575,7 @@ namespace EMotionFX // this function will get called to rewind motion nodes as well as states etc. to reset several settings when a state gets exited void AnimGraphMotionNode::Rewind(AnimGraphInstance* animGraphInstance) { - UniqueData* uniqueData = static_cast(animGraphInstance->GetUniqueObjectData(mObjectIndex)); + UniqueData* uniqueData = static_cast(animGraphInstance->GetUniqueObjectData(m_objectIndex)); // rewind is not necessary if unique data is not created yet if (!uniqueData) @@ -584,7 +584,7 @@ namespace EMotionFX } // find the motion instance for the given anim graph and return directly in case it is invalid - MotionInstance* motionInstance = uniqueData->mMotionInstance; + MotionInstance* motionInstance = uniqueData->m_motionInstance; if (motionInstance == nullptr) { return; @@ -605,7 +605,7 @@ namespace EMotionFX // get the speed from the connection if there is one connected, if not use the node's playspeed float AnimGraphMotionNode::ExtractCustomPlaySpeed(AnimGraphInstance* animGraphInstance) const { - EMotionFX::BlendTreeConnection* playSpeedConnection = GetInputPort(INPUTPORT_PLAYSPEED).mConnection; + EMotionFX::BlendTreeConnection* playSpeedConnection = GetInputPort(INPUTPORT_PLAYSPEED).m_connection; // if there is a node connected to the speed input port, read that value and use it as internal speed float customSpeed; @@ -638,23 +638,23 @@ namespace EMotionFX const size_t numMotions = m_motionRandomSelectionCumulativeWeights.size(); if (numMotions == 1) { - uniqueData->mActiveMotionIndex = 0; + uniqueData->m_activeMotionIndex = 0; } else if (numMotions > 1) { - uniqueData->mReload = true; + uniqueData->m_reload = true; switch (m_indexMode) { // pick a random one, but make sure its not the same as the last one we played case INDEXMODE_RANDOMIZE_NOREPEAT: { - if (uniqueData->mActiveMotionIndex == MCORE_INVALIDINDEX32) + if (uniqueData->m_activeMotionIndex == MCORE_INVALIDINDEX32) { SelectAnyRandomMotionIndex(animGraphInstance, uniqueData); return; } - AZ::u32 curIndex = uniqueData->mActiveMotionIndex; + AZ::u32 curIndex = uniqueData->m_activeMotionIndex; // Make sure we're in a valid range. if (curIndex >= numMotions) @@ -677,17 +677,17 @@ namespace EMotionFX } const int index = FindCumulativeProbabilityIndex(remappedRandomValue); AZ_Assert(index >= 0, "Unable to find random value in motion random weights"); - uniqueData->mActiveMotionIndex = index; + uniqueData->m_activeMotionIndex = index; } break; // pick the next motion from the list case INDEXMODE_SEQUENTIAL: { - uniqueData->mActiveMotionIndex++; - if (uniqueData->mActiveMotionIndex >= numMotions) + uniqueData->m_activeMotionIndex++; + if (uniqueData->m_activeMotionIndex >= numMotions) { - uniqueData->mActiveMotionIndex = 0; + uniqueData->m_activeMotionIndex = 0; } } break; @@ -702,7 +702,7 @@ namespace EMotionFX } else { - uniqueData->mActiveMotionIndex = MCORE_INVALIDINDEX32; + uniqueData->m_activeMotionIndex = MCORE_INVALIDINDEX32; } } @@ -712,7 +712,7 @@ namespace EMotionFX const float randomValue = animGraphInstance->GetLcgRandom().GetRandomFloat() * m_motionRandomSelectionCumulativeWeights.back().second; const int index = FindCumulativeProbabilityIndex(randomValue); AZ_Assert(index >= 0, "Error: unable to find random value among motion random weights"); - uniqueData->mActiveMotionIndex = index; + uniqueData->m_activeMotionIndex = index; } int AnimGraphMotionNode::FindCumulativeProbabilityIndex(float randomValue) const @@ -777,19 +777,19 @@ namespace EMotionFX void AnimGraphMotionNode::ReloadAndInvalidateUniqueDatas() { - if (!mAnimGraph) + if (!m_animGraph) { return; } - const size_t numAnimGraphInstances = mAnimGraph->GetNumAnimGraphInstances(); + const size_t numAnimGraphInstances = m_animGraph->GetNumAnimGraphInstances(); for (size_t i = 0; i < numAnimGraphInstances; ++i) { - AnimGraphInstance* animGraphInstance = mAnimGraph->GetAnimGraphInstance(i); - UniqueData* uniqueData = static_cast(animGraphInstance->GetUniqueObjectData(mObjectIndex)); + AnimGraphInstance* animGraphInstance = m_animGraph->GetAnimGraphInstance(i); + UniqueData* uniqueData = static_cast(animGraphInstance->GetUniqueObjectData(m_objectIndex)); if (uniqueData) { - uniqueData->mReload = true; + uniqueData->m_reload = true; uniqueData->Invalidate(); } } @@ -803,10 +803,10 @@ namespace EMotionFX void AnimGraphMotionNode::RecursiveOnChangeMotionSet(AnimGraphInstance* animGraphInstance, MotionSet* newMotionSet) { AnimGraphNode::RecursiveOnChangeMotionSet(animGraphInstance, newMotionSet); - UniqueData* uniqueData = static_cast(animGraphInstance->GetUniqueObjectData(mObjectIndex)); + UniqueData* uniqueData = static_cast(animGraphInstance->GetUniqueObjectData(m_objectIndex)); if (uniqueData) { - uniqueData->mReload = true; + uniqueData->m_reload = true; uniqueData->Invalidate(); } } diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphMotionNode.h b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphMotionNode.h index ab6e4bef62..a07bbc625c 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphMotionNode.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphMotionNode.h @@ -72,10 +72,10 @@ namespace EMotionFX void Update() override; public: - uint32 mMotionSetID = InvalidIndex32; - uint32 mActiveMotionIndex = InvalidIndex32; - MotionInstance* mMotionInstance = nullptr; - bool mReload = false; + uint32 m_motionSetId = InvalidIndex32; + uint32 m_activeMotionIndex = InvalidIndex32; + MotionInstance* m_motionInstance = nullptr; + bool m_reload = false; }; AnimGraphMotionNode(); diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphNode.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphNode.cpp index 67c3f276cc..be5499627d 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphNode.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphNode.cpp @@ -50,17 +50,17 @@ namespace EMotionFX AnimGraphNode::AnimGraphNode() : AnimGraphObject(nullptr) , m_id(AnimGraphNodeId::Create()) - , mNodeIndex(InvalidIndex) - , mDisabled(false) - , mParentNode(nullptr) - , mCustomData(nullptr) - , mVisEnabled(false) - , mIsCollapsed(false) - , mPosX(0) - , mPosY(0) + , m_nodeIndex(InvalidIndex) + , m_disabled(false) + , m_parentNode(nullptr) + , m_customData(nullptr) + , m_visEnabled(false) + , m_isCollapsed(false) + , m_posX(0) + , m_posY(0) { const AZ::u32 col = MCore::GenerateColor(); - mVisualizeColor = AZ::Color( + m_visualizeColor = AZ::Color( MCore::ExtractRed(col)/255.0f, MCore::ExtractGreen(col)/255.0f, MCore::ExtractBlue(col)/255.0f, @@ -81,21 +81,21 @@ namespace EMotionFX RemoveAllConnections(); RemoveAllChildNodes(); - if (mAnimGraph) + if (m_animGraph) { - mAnimGraph->RemoveObject(this); + m_animGraph->RemoveObject(this); } } void AnimGraphNode::RecursiveReinit() { - for (BlendTreeConnection* connection : mConnections) + for (BlendTreeConnection* connection : m_connections) { connection->Reinit(); } - for (AnimGraphNode* childNode : mChildNodes) + for (AnimGraphNode* childNode : m_childNodes) { childNode->RecursiveReinit(); } @@ -113,13 +113,13 @@ namespace EMotionFX } // Initialize connections. - for (BlendTreeConnection* connection : mConnections) + for (BlendTreeConnection* connection : m_connections) { connection->InitAfterLoading(animGraph); } // Initialize child nodes. - for (AnimGraphNode* childNode : mChildNodes) + for (AnimGraphNode* childNode : m_childNodes) { // Sync the child node's parent. childNode->SetParentNode(this); @@ -140,7 +140,7 @@ namespace EMotionFX { for (AnimGraphTriggerAction* action : m_actionSetup.GetActions()) { - action->InitAfterLoading(mAnimGraph); + action->InitAfterLoading(m_animGraph); } } @@ -148,35 +148,27 @@ namespace EMotionFX // copy base settings to the other node void AnimGraphNode::CopyBaseNodeTo(AnimGraphNode* node) const { - //CopyBaseObjectTo( node ); - - // now copy the node related things - // the parent - //if (mParentNode) - //node->mParentNode = node->GetAnimGraph()->RecursiveFindNodeByID( mParentNode->GetID() ); - - // copy the easy values node->m_name = m_name; node->m_id = m_id; - node->mNodeInfo = mNodeInfo; - node->mCustomData = mCustomData; - node->mDisabled = mDisabled; - node->mPosX = mPosX; - node->mPosY = mPosY; - node->mVisualizeColor = mVisualizeColor; - node->mVisEnabled = mVisEnabled; - node->mIsCollapsed = mIsCollapsed; + node->m_nodeInfo = m_nodeInfo; + node->m_customData = m_customData; + node->m_disabled = m_disabled; + node->m_posX = m_posX; + node->m_posY = m_posY; + node->m_visualizeColor = m_visualizeColor; + node->m_visEnabled = m_visEnabled; + node->m_isCollapsed = m_isCollapsed; } void AnimGraphNode::RemoveAllConnections() { - for (BlendTreeConnection* connection : mConnections) + for (BlendTreeConnection* connection : m_connections) { delete connection; } - mConnections.clear(); + m_connections.clear(); } @@ -184,12 +176,12 @@ namespace EMotionFX BlendTreeConnection* AnimGraphNode::AddConnection(AnimGraphNode* sourceNode, uint16 sourcePort, uint16 targetPort) { // make sure the source and target ports are in range - if (targetPort < mInputPorts.size() && sourcePort < sourceNode->mOutputPorts.size()) + if (targetPort < m_inputPorts.size() && sourcePort < sourceNode->m_outputPorts.size()) { BlendTreeConnection* connection = aznew BlendTreeConnection(sourceNode, sourcePort, targetPort); - mConnections.push_back(connection); - mInputPorts[targetPort].mConnection = connection; - sourceNode->mOutputPorts[sourcePort].mConnection = connection; + m_connections.push_back(connection); + m_inputPorts[targetPort].m_connection = connection; + sourceNode->m_outputPorts[sourcePort].m_connection = connection; return connection; } return nullptr; @@ -199,7 +191,7 @@ namespace EMotionFX BlendTreeConnection* AnimGraphNode::AddUnitializedConnection(AnimGraphNode* sourceNode, uint16 sourcePort, uint16 targetPort) { BlendTreeConnection* connection = aznew BlendTreeConnection(sourceNode, sourcePort, targetPort); - mConnections.push_back(connection); + m_connections.push_back(connection); return connection; } @@ -207,7 +199,7 @@ namespace EMotionFX // validate the connections bool AnimGraphNode::ValidateConnections() const { - for (const BlendTreeConnection* connection : mConnections) + for (const BlendTreeConnection* connection : m_connections) { if (!connection->GetIsValid()) { @@ -222,7 +214,7 @@ namespace EMotionFX // check if the given input port is connected bool AnimGraphNode::CheckIfIsInputPortConnected(uint16 inputPort) const { - for (const BlendTreeConnection* connection : mConnections) + for (const BlendTreeConnection* connection : m_connections) { if (connection->GetTargetPort() == inputPort) { @@ -240,16 +232,16 @@ namespace EMotionFX { if (delFromMem) { - for (AnimGraphNode* childNode : mChildNodes) + for (AnimGraphNode* childNode : m_childNodes) { delete childNode; } } - mChildNodes.clear(); + m_childNodes.clear(); // trigger that we removed nodes - GetEventManager().OnRemovedChildNode(mAnimGraph, this); + GetEventManager().OnRemovedChildNode(m_animGraph, this); // TODO: remove the nodes from the node groups of the anim graph as well here } @@ -259,23 +251,23 @@ namespace EMotionFX void AnimGraphNode::RemoveChildNode(size_t index, bool delFromMem) { // remove the node from its node group - AnimGraphNodeGroup* nodeGroup = mAnimGraph->FindNodeGroupForNode(mChildNodes[index]); + AnimGraphNodeGroup* nodeGroup = m_animGraph->FindNodeGroupForNode(m_childNodes[index]); if (nodeGroup) { - nodeGroup->RemoveNodeById(mChildNodes[index]->GetId()); + nodeGroup->RemoveNodeById(m_childNodes[index]->GetId()); } // delete the node from memory if (delFromMem) { - delete mChildNodes[index]; + delete m_childNodes[index]; } // delete the node from the child array - mChildNodes.erase(mChildNodes.begin() + index); + m_childNodes.erase(m_childNodes.begin() + index); // trigger callbacks - GetEventManager().OnRemovedChildNode(mAnimGraph, this); + GetEventManager().OnRemovedChildNode(m_animGraph, this); } @@ -283,11 +275,11 @@ namespace EMotionFX void AnimGraphNode::RemoveChildNodeByPointer(AnimGraphNode* node, bool delFromMem) { // find the index of the given node in the child node array and remove it in case the index is valid - const auto iterator = AZStd::find(mChildNodes.begin(), mChildNodes.end(), node); + const auto iterator = AZStd::find(m_childNodes.begin(), m_childNodes.end(), node); - if (iterator != mChildNodes.end()) + if (iterator != m_childNodes.end()) { - const size_t index = AZStd::distance(mChildNodes.begin(), iterator); + const size_t index = AZStd::distance(m_childNodes.begin(), iterator); RemoveChildNode(index, delFromMem); } } @@ -300,7 +292,7 @@ namespace EMotionFX return const_cast(this); } - for (const AnimGraphNode* childNode : mChildNodes) + for (const AnimGraphNode* childNode : m_childNodes) { AnimGraphNode* result = childNode->RecursiveFindNodeByName(nodeName); if (result) @@ -320,7 +312,7 @@ namespace EMotionFX return false; } - for (const AnimGraphNode* childNode : mChildNodes) + for (const AnimGraphNode* childNode : m_childNodes) { if (!childNode->RecursiveIsNodeNameUnique(newNameCandidate, forNode)) { @@ -339,7 +331,7 @@ namespace EMotionFX return const_cast(this); } - for (const AnimGraphNode* childNode : mChildNodes) + for (const AnimGraphNode* childNode : m_childNodes) { AnimGraphNode* result = childNode->RecursiveFindNodeById(nodeId); if (result) @@ -355,7 +347,7 @@ namespace EMotionFX // find a child node by name AnimGraphNode* AnimGraphNode::FindChildNode(const char* name) const { - for (AnimGraphNode* childNode : mChildNodes) + for (AnimGraphNode* childNode : m_childNodes) { // compare the node name with the parameter and return a pointer to the node in case they are equal if (AzFramework::StringFunc::Equal(childNode->GetName(), name, true /* case sensitive */)) @@ -371,7 +363,7 @@ namespace EMotionFX AnimGraphNode* AnimGraphNode::FindChildNodeById(AnimGraphNodeId childId) const { - for (AnimGraphNode* childNode : mChildNodes) + for (AnimGraphNode* childNode : m_childNodes) { if (childNode->GetId() == childId) { @@ -386,35 +378,35 @@ namespace EMotionFX // find a child node index by name size_t AnimGraphNode::FindChildNodeIndex(const char* name) const { - const auto foundChildNode = AZStd::find_if(begin(mChildNodes), end(mChildNodes), [name](const AnimGraphNode* childNode) + const auto foundChildNode = AZStd::find_if(begin(m_childNodes), end(m_childNodes), [name](const AnimGraphNode* childNode) { return childNode->GetNameString() == name; }); - return foundChildNode != end(mChildNodes) ? AZStd::distance(begin(mChildNodes), foundChildNode) : InvalidIndex; + return foundChildNode != end(m_childNodes) ? AZStd::distance(begin(m_childNodes), foundChildNode) : InvalidIndex; } // find a child node index size_t AnimGraphNode::FindChildNodeIndex(AnimGraphNode* node) const { - const auto foundChildNode = AZStd::find(mChildNodes.begin(), mChildNodes.end(), node); - return foundChildNode != end(mChildNodes) ? AZStd::distance(begin(mChildNodes), foundChildNode) : InvalidIndex; + const auto foundChildNode = AZStd::find(m_childNodes.begin(), m_childNodes.end(), node); + return foundChildNode != end(m_childNodes) ? AZStd::distance(begin(m_childNodes), foundChildNode) : InvalidIndex; } AnimGraphNode* AnimGraphNode::FindFirstChildNodeOfType(const AZ::TypeId& nodeType) const { - const auto foundChild = AZStd::find_if(begin(mChildNodes), end(mChildNodes), [nodeType](const AnimGraphNode* childNode) + const auto foundChild = AZStd::find_if(begin(m_childNodes), end(m_childNodes), [nodeType](const AnimGraphNode* childNode) { return azrtti_typeid(childNode) == nodeType; }); - return foundChild != end(mChildNodes) ? *foundChild : nullptr; + return foundChild != end(m_childNodes) ? *foundChild : nullptr; } bool AnimGraphNode::HasChildNodeOfType(const AZ::TypeId& nodeType) const { - return AZStd::any_of(begin(mChildNodes), end(mChildNodes), [nodeType](const AnimGraphNode* childNode) + return AZStd::any_of(begin(m_childNodes), end(m_childNodes), [nodeType](const AnimGraphNode* childNode) { return azrtti_typeid(childNode) == nodeType; }); @@ -424,7 +416,7 @@ namespace EMotionFX // does this node has a specific incoming connection? bool AnimGraphNode::GetHasConnection(AnimGraphNode* sourceNode, uint16 sourcePort, uint16 targetPort) const { - return AZStd::any_of(begin(mConnections), end(mConnections), [sourceNode, sourcePort, targetPort](const BlendTreeConnection* connection) + return AZStd::any_of(begin(m_connections), end(m_connections), [sourceNode, sourcePort, targetPort](const BlendTreeConnection* connection) { return connection->GetSourceNode() == sourceNode && connection->GetSourcePort() == sourcePort && connection->GetTargetPort() == targetPort; }); @@ -433,16 +425,16 @@ namespace EMotionFX // remove a given connection void AnimGraphNode::RemoveConnection(BlendTreeConnection* connection, bool delFromMem) { - mInputPorts[connection->GetTargetPort()].mConnection = nullptr; + m_inputPorts[connection->GetTargetPort()].m_connection = nullptr; AnimGraphNode* sourceNode = connection->GetSourceNode(); if (sourceNode) { - sourceNode->mOutputPorts[connection->GetSourcePort()].mConnection = nullptr; + sourceNode->m_outputPorts[connection->GetSourcePort()].m_connection = nullptr; } // Remove object by value. - mConnections.erase(AZStd::remove(mConnections.begin(), mConnections.end(), connection), mConnections.end()); + m_connections.erase(AZStd::remove(m_connections.begin(), m_connections.end(), connection), m_connections.end()); if (delFromMem) { delete connection; @@ -454,7 +446,7 @@ namespace EMotionFX void AnimGraphNode::RemoveConnection(AnimGraphNode* sourceNode, uint16 sourcePort, uint16 targetPort) { // for all input connections - for (BlendTreeConnection* connection : mConnections) + for (BlendTreeConnection* connection : m_connections) { if (connection->GetSourceNode() == sourceNode && connection->GetSourcePort() == sourcePort && connection->GetTargetPort() == targetPort) { @@ -467,25 +459,25 @@ namespace EMotionFX bool AnimGraphNode::RemoveConnectionById(AnimGraphConnectionId connectionId, bool delFromMem) { - const size_t numConnections = mConnections.size(); + const size_t numConnections = m_connections.size(); for (size_t i = 0; i < numConnections; ++i) { - if (mConnections[i]->GetId() == connectionId) + if (m_connections[i]->GetId() == connectionId) { - mInputPorts[mConnections[i]->GetTargetPort()].mConnection = nullptr; + m_inputPorts[m_connections[i]->GetTargetPort()].m_connection = nullptr; - AnimGraphNode* sourceNode = mConnections[i]->GetSourceNode(); + AnimGraphNode* sourceNode = m_connections[i]->GetSourceNode(); if (sourceNode) { - sourceNode->mOutputPorts[mConnections[i]->GetSourcePort()].mConnection = nullptr; + sourceNode->m_outputPorts[m_connections[i]->GetSourcePort()].m_connection = nullptr; } if (delFromMem) { - delete mConnections[i]; + delete m_connections[i]; } - mConnections.erase(mConnections.begin() + i); + m_connections.erase(m_connections.begin() + i); } } @@ -496,7 +488,7 @@ namespace EMotionFX // find a given connection BlendTreeConnection* AnimGraphNode::FindConnection(const AnimGraphNode* sourceNode, uint16 sourcePort, uint16 targetPort) const { - for (BlendTreeConnection* connection : mConnections) + for (BlendTreeConnection* connection : m_connections) { if (connection->GetSourceNode() == sourceNode && connection->GetSourcePort() == sourcePort && connection->GetTargetPort() == targetPort) { @@ -512,44 +504,44 @@ namespace EMotionFX // initialize the input ports void AnimGraphNode::InitInputPorts(size_t numPorts) { - mInputPorts.resize(numPorts); + m_inputPorts.resize(numPorts); } // initialize the output ports void AnimGraphNode::InitOutputPorts(size_t numPorts) { - mOutputPorts.resize(numPorts); + m_outputPorts.resize(numPorts); } // find a given output port number size_t AnimGraphNode::FindOutputPortIndex(const AZStd::string& name) const { - const auto foundPort = AZStd::find_if(begin(mOutputPorts), end(mOutputPorts), [&name](const Port& port) + const auto foundPort = AZStd::find_if(begin(m_outputPorts), end(m_outputPorts), [&name](const Port& port) { return port.GetNameString() == name; }); - return foundPort != end(mOutputPorts) ? AZStd::distance(begin(mOutputPorts), foundPort) : InvalidIndex; + return foundPort != end(m_outputPorts) ? AZStd::distance(begin(m_outputPorts), foundPort) : InvalidIndex; } // find a given input port number size_t AnimGraphNode::FindInputPortIndex(const AZStd::string& name) const { - const auto foundPort = AZStd::find_if(begin(mInputPorts), end(mInputPorts), [&name](const Port& port) + const auto foundPort = AZStd::find_if(begin(m_inputPorts), end(m_inputPorts), [&name](const Port& port) { return port.GetNameString() == name; }); - return foundPort != end(mInputPorts) ? AZStd::distance(begin(mInputPorts), foundPort) : InvalidIndex; + return foundPort != end(m_inputPorts) ? AZStd::distance(begin(m_inputPorts), foundPort) : InvalidIndex; } // add an output port and return its index size_t AnimGraphNode::AddOutputPort() { - const size_t currentSize = mOutputPorts.size(); - mOutputPorts.emplace_back(); + const size_t currentSize = m_outputPorts.size(); + m_outputPorts.emplace_back(); return currentSize; } @@ -557,8 +549,8 @@ namespace EMotionFX // add an input port, and return its index size_t AnimGraphNode::AddInputPort() { - const size_t currentSize = mInputPorts.size(); - mInputPorts.emplace_back(); + const size_t currentSize = m_inputPorts.size(); + m_inputPorts.emplace_back(); return static_cast(currentSize); } @@ -566,16 +558,16 @@ namespace EMotionFX // setup a port name void AnimGraphNode::SetInputPortName(size_t portIndex, const char* name) { - MCORE_ASSERT(portIndex < mInputPorts.size()); - mInputPorts[portIndex].mNameID = MCore::GetStringIdPool().GenerateIdForString(name); + MCORE_ASSERT(portIndex < m_inputPorts.size()); + m_inputPorts[portIndex].m_nameId = MCore::GetStringIdPool().GenerateIdForString(name); } // setup a port name void AnimGraphNode::SetOutputPortName(size_t portIndex, const char* name) { - MCORE_ASSERT(portIndex < mOutputPorts.size()); - mOutputPorts[portIndex].mNameID = MCore::GetStringIdPool().GenerateIdForString(name); + MCORE_ASSERT(portIndex < m_outputPorts.size()); + m_outputPorts[portIndex].m_nameId = MCore::GetStringIdPool().GenerateIdForString(name); } @@ -583,7 +575,7 @@ namespace EMotionFX size_t AnimGraphNode::RecursiveCalcNumNodes() const { size_t result = 0; - for (const AnimGraphNode* childNode : mChildNodes) + for (const AnimGraphNode* childNode : m_childNodes) { childNode->RecursiveCountChildNodes(result); } @@ -598,7 +590,7 @@ namespace EMotionFX // increase the counter numNodes++; - for (const AnimGraphNode* childNode : mChildNodes) + for (const AnimGraphNode* childNode : m_childNodes) { childNode->RecursiveCountChildNodes(numNodes); } @@ -620,7 +612,7 @@ namespace EMotionFX // add the connections to our counter numConnections += GetNumConnections(); - for (const AnimGraphNode* childNode : mChildNodes) + for (const AnimGraphNode* childNode : m_childNodes) { childNode->RecursiveCountNodeConnections(numConnections); } @@ -634,13 +626,13 @@ namespace EMotionFX const size_t duplicatePort = FindOutputPortByID(portID); if (duplicatePort != InvalidIndex) { - MCore::LogError("EMotionFX::AnimGraphNode::SetOutputPortAsPose() - There is already a port with the same ID (portID=%d existingPort='%s' newPort='%s' node='%s')", portID, mOutputPorts[duplicatePort].GetName(), name, RTTI_GetTypeName()); + MCore::LogError("EMotionFX::AnimGraphNode::SetOutputPortAsPose() - There is already a port with the same ID (portID=%d existingPort='%s' newPort='%s' node='%s')", portID, m_outputPorts[duplicatePort].GetName(), name, RTTI_GetTypeName()); } SetOutputPortName(outputPortNr, name); - mOutputPorts[outputPortNr].Clear(); - mOutputPorts[outputPortNr].mCompatibleTypes[0] = AttributePose::TYPE_ID; // setup the compatible types of this port - mOutputPorts[outputPortNr].mPortID = portID; + m_outputPorts[outputPortNr].Clear(); + m_outputPorts[outputPortNr].m_compatibleTypes[0] = AttributePose::TYPE_ID; // setup the compatible types of this port + m_outputPorts[outputPortNr].m_portId = portID; } @@ -651,13 +643,13 @@ namespace EMotionFX const size_t duplicatePort = FindOutputPortByID(portID); if (duplicatePort != InvalidIndex) { - MCore::LogError("EMotionFX::AnimGraphNode::SetOutputPortAsMotionInstance() - There is already a port with the same ID (portID=%d existingPort='%s' newPort='%s' node='%s')", portID, mOutputPorts[duplicatePort].GetName(), name, RTTI_GetTypeName()); + MCore::LogError("EMotionFX::AnimGraphNode::SetOutputPortAsMotionInstance() - There is already a port with the same ID (portID=%d existingPort='%s' newPort='%s' node='%s')", portID, m_outputPorts[duplicatePort].GetName(), name, RTTI_GetTypeName()); } SetOutputPortName(outputPortNr, name); - mOutputPorts[outputPortNr].Clear(); - mOutputPorts[outputPortNr].mCompatibleTypes[0] = AttributeMotionInstance::TYPE_ID; // setup the compatible types of this port - mOutputPorts[outputPortNr].mPortID = portID; + m_outputPorts[outputPortNr].Clear(); + m_outputPorts[outputPortNr].m_compatibleTypes[0] = AttributeMotionInstance::TYPE_ID; // setup the compatible types of this port + m_outputPorts[outputPortNr].m_portId = portID; } @@ -668,13 +660,13 @@ namespace EMotionFX const size_t duplicatePort = FindOutputPortByID(portID); if (duplicatePort != InvalidIndex) { - MCore::LogError("EMotionFX::AnimGraphNode::SetOutputPort() - There is already a port with the same ID (portID=%d existingPort='%s' newPort='%s' name='%s')", portID, mOutputPorts[duplicatePort].GetName(), name, RTTI_GetTypeName()); + MCore::LogError("EMotionFX::AnimGraphNode::SetOutputPort() - There is already a port with the same ID (portID=%d existingPort='%s' newPort='%s' name='%s')", portID, m_outputPorts[duplicatePort].GetName(), name, RTTI_GetTypeName()); } SetOutputPortName(outputPortNr, name); - mOutputPorts[outputPortNr].Clear(); - mOutputPorts[outputPortNr].mCompatibleTypes[0] = attributeTypeID; - mOutputPorts[outputPortNr].mPortID = portID; + m_outputPorts[outputPortNr].Clear(); + m_outputPorts[outputPortNr].m_compatibleTypes[0] = attributeTypeID; + m_outputPorts[outputPortNr].m_portId = portID; } void AnimGraphNode::SetupInputPortAsVector3(const char* name, size_t inputPortNr, uint32 portID) @@ -698,13 +690,13 @@ namespace EMotionFX const size_t duplicatePort = FindInputPortByID(portID); if (duplicatePort != InvalidIndex) { - MCore::LogError("EMotionFX::AnimGraphNode::SetInputPortAsNumber() - There is already a port with the same ID (portID=%d existingPort='%s' newPort='%s' node='%s')", portID, MCore::GetStringIdPool().GetName(mInputPorts[duplicatePort].mNameID).c_str(), name, RTTI_GetTypeName()); + MCore::LogError("EMotionFX::AnimGraphNode::SetInputPortAsNumber() - There is already a port with the same ID (portID=%d existingPort='%s' newPort='%s' node='%s')", portID, MCore::GetStringIdPool().GetName(m_inputPorts[duplicatePort].m_nameId).c_str(), name, RTTI_GetTypeName()); } SetInputPortName(inputPortNr, name); - mInputPorts[inputPortNr].Clear(); - mInputPorts[inputPortNr].mPortID = portID; - mInputPorts[inputPortNr].SetCompatibleTypes(attributeTypeIDs); + m_inputPorts[inputPortNr].Clear(); + m_inputPorts[inputPortNr].m_portId = portID; + m_inputPorts[inputPortNr].SetCompatibleTypes(attributeTypeIDs); } // setup an input port as a number (float/int/bool) @@ -714,15 +706,13 @@ namespace EMotionFX const size_t duplicatePort = FindInputPortByID(portID); if (duplicatePort != InvalidIndex) { - MCore::LogError("EMotionFX::AnimGraphNode::SetInputPortAsNumber() - There is already a port with the same ID (portID=%d existingPort='%s' newPort='%s' node='%s')", portID, mInputPorts[duplicatePort].GetName(), name, RTTI_GetTypeName()); + MCore::LogError("EMotionFX::AnimGraphNode::SetInputPortAsNumber() - There is already a port with the same ID (portID=%d existingPort='%s' newPort='%s' node='%s')", portID, m_inputPorts[duplicatePort].GetName(), name, RTTI_GetTypeName()); } SetInputPortName(inputPortNr, name); - mInputPorts[inputPortNr].Clear(); - mInputPorts[inputPortNr].mCompatibleTypes[0] = MCore::AttributeFloat::TYPE_ID; - //mInputPorts[inputPortNr].mCompatibleTypes[1] = MCore::AttributeInt32::TYPE_ID; - //mInputPorts[inputPortNr].mCompatibleTypes[2] = MCore::AttributeBool::TYPE_ID;; - mInputPorts[inputPortNr].mPortID = portID; + m_inputPorts[inputPortNr].Clear(); + m_inputPorts[inputPortNr].m_compatibleTypes[0] = MCore::AttributeFloat::TYPE_ID; + m_inputPorts[inputPortNr].m_portId = portID; } void AnimGraphNode::SetupInputPortAsBool(const char* name, size_t inputPortNr, uint32 portID) @@ -731,15 +721,15 @@ namespace EMotionFX const size_t duplicatePort = FindInputPortByID(portID); if (duplicatePort != InvalidIndex) { - MCore::LogError("EMotionFX::AnimGraphNode::SetInputPortAsBool() - There is already a port with the same ID (portID=%d existingPort='%s' newPort='%s' node='%s')", portID, mInputPorts[duplicatePort].GetName(), name, RTTI_GetTypeName()); + MCore::LogError("EMotionFX::AnimGraphNode::SetInputPortAsBool() - There is already a port with the same ID (portID=%d existingPort='%s' newPort='%s' node='%s')", portID, m_inputPorts[duplicatePort].GetName(), name, RTTI_GetTypeName()); } SetInputPortName(inputPortNr, name); - mInputPorts[inputPortNr].Clear(); - mInputPorts[inputPortNr].mCompatibleTypes[0] = MCore::AttributeBool::TYPE_ID; - mInputPorts[inputPortNr].mCompatibleTypes[1] = MCore::AttributeFloat::TYPE_ID;; - mInputPorts[inputPortNr].mCompatibleTypes[2] = MCore::AttributeInt32::TYPE_ID; - mInputPorts[inputPortNr].mPortID = portID; + m_inputPorts[inputPortNr].Clear(); + m_inputPorts[inputPortNr].m_compatibleTypes[0] = MCore::AttributeBool::TYPE_ID; + m_inputPorts[inputPortNr].m_compatibleTypes[1] = MCore::AttributeFloat::TYPE_ID;; + m_inputPorts[inputPortNr].m_compatibleTypes[2] = MCore::AttributeInt32::TYPE_ID; + m_inputPorts[inputPortNr].m_portId = portID; } // setup a given input port in a generic way @@ -749,16 +739,13 @@ namespace EMotionFX const size_t duplicatePort = FindInputPortByID(portID); if (duplicatePort != InvalidIndex) { - MCore::LogError("EMotionFX::AnimGraphNode::SetInputPort() - There is already a port with the same ID (portID=%d existingPort='%s' newPort='%s' node='%s')", portID, mInputPorts[duplicatePort].GetName(), name, RTTI_GetTypeName()); + MCore::LogError("EMotionFX::AnimGraphNode::SetInputPort() - There is already a port with the same ID (portID=%d existingPort='%s' newPort='%s' node='%s')", portID, m_inputPorts[duplicatePort].GetName(), name, RTTI_GetTypeName()); } SetInputPortName(inputPortNr, name); - mInputPorts[inputPortNr].Clear(); - mInputPorts[inputPortNr].mCompatibleTypes[0] = attributeTypeID; - mInputPorts[inputPortNr].mPortID = portID; - - // make sure we were able to create the attribute - //MCORE_ASSERT( mInputPorts[inputPortNr].mValue ); + m_inputPorts[inputPortNr].Clear(); + m_inputPorts[inputPortNr].m_compatibleTypes[0] = attributeTypeID; + m_inputPorts[inputPortNr].m_portId = portID; } @@ -766,7 +753,7 @@ namespace EMotionFX { ResetUniqueData(animGraphInstance); - for (AnimGraphNode* childNode : mChildNodes) + for (AnimGraphNode* childNode : m_childNodes) { childNode->RecursiveResetUniqueDatas(animGraphInstance); } @@ -788,7 +775,7 @@ namespace EMotionFX { InvalidateUniqueData(animGraphInstance); - for (AnimGraphNode* childNode : mChildNodes) + for (AnimGraphNode* childNode : m_childNodes) { childNode->RecursiveInvalidateUniqueDatas(animGraphInstance); } @@ -800,7 +787,7 @@ namespace EMotionFX MCORE_UNUSED(animGraphInstance); // get the connection that is plugged into the port - BlendTreeConnection* connection = mInputPorts[inputPort].mConnection; + BlendTreeConnection* connection = m_inputPorts[inputPort].m_connection; MCORE_ASSERT(connection); // make sure there is a connection plugged in, otherwise we can't read the value // get the value from the output port of the source node @@ -812,17 +799,17 @@ namespace EMotionFX void AnimGraphNode::RecursiveResetFlags(AnimGraphInstance* animGraphInstance, uint32 flagsToReset) { // reset the flag in this node - animGraphInstance->DisableObjectFlags(mObjectIndex, flagsToReset); + animGraphInstance->DisableObjectFlags(m_objectIndex, flagsToReset); if (GetEMotionFX().GetIsInEditorMode()) { // reset all connections - for (BlendTreeConnection* connection : mConnections) + for (BlendTreeConnection* connection : m_connections) { connection->SetIsVisited(false); } } - for (AnimGraphNode* childNode : mChildNodes) + for (AnimGraphNode* childNode : m_childNodes) { childNode->RecursiveResetFlags(animGraphInstance, flagsToReset); } @@ -996,7 +983,7 @@ namespace EMotionFX const size_t numChildNodes = GetNumChildNodes(); for (size_t i = 0; i < numChildNodes; ++i) { - mChildNodes[i]->RecursiveOnChangeMotionSet(animGraphInstance, newMotionSet); + m_childNodes[i]->RecursiveOnChangeMotionSet(animGraphInstance, newMotionSet); } } @@ -1158,19 +1145,19 @@ namespace EMotionFX bool AnimGraphNode::RecursiveIsParentNode(const AnimGraphNode* node) const { // if we're dealing with a root node we can directly return failure - if (!mParentNode) + if (!m_parentNode) { return false; } // check if the parent is the node and return success in that case - if (mParentNode == node) + if (m_parentNode == node) { return true; } // check if the parent's parent is the node we're searching for - return mParentNode->RecursiveIsParentNode(node); + return m_parentNode->RecursiveIsParentNode(node); } @@ -1183,7 +1170,7 @@ namespace EMotionFX return true; } - return AZStd::any_of(begin(mChildNodes), end(mChildNodes), [node](const AnimGraphNode* childNode) + return AZStd::any_of(begin(m_childNodes), end(m_childNodes), [node](const AnimGraphNode* childNode) { return childNode->RecursiveIsChildNode(node); }); @@ -1204,17 +1191,17 @@ namespace EMotionFX SyncVisualObject(); // in case the parent node is valid check the error status of the parent by checking all children recursively and set that value - if (mParentNode) + if (m_parentNode) { - AnimGraphObjectData* parentUniqueData = mParentNode->FindOrCreateUniqueNodeData(uniqueData->GetAnimGraphInstance()); + AnimGraphObjectData* parentUniqueData = m_parentNode->FindOrCreateUniqueNodeData(uniqueData->GetAnimGraphInstance()); if (hasError) { - mParentNode->SetHasError(parentUniqueData, true); + m_parentNode->SetHasError(parentUniqueData, true); } - else if (!mParentNode->HierarchicalHasError(parentUniqueData, true)) + else if (!m_parentNode->HierarchicalHasError(parentUniqueData, true)) { // In case we are clearing this error, we need to check if this node siblings have errors to clear the parent. - mParentNode->SetHasError(parentUniqueData, false); + m_parentNode->SetHasError(parentUniqueData, false); } } } @@ -1226,7 +1213,7 @@ namespace EMotionFX return true; } - for (const AnimGraphNode* childNode : mChildNodes) + for (const AnimGraphNode* childNode : m_childNodes) { AnimGraphObjectData* childUniqueData = childNode->FindOrCreateUniqueNodeData(uniqueData->GetAnimGraphInstance()); if (childUniqueData->GetHasError()) @@ -1243,7 +1230,7 @@ namespace EMotionFX // collect child nodes of the given type void AnimGraphNode::CollectChildNodesOfType(const AZ::TypeId& nodeType, AZStd::vector* outNodes) const { - for (AnimGraphNode* childNode : mChildNodes) + for (AnimGraphNode* childNode : m_childNodes) { // check the current node type and add it to the output array in case they are the same if (azrtti_typeid(childNode) == nodeType) @@ -1255,7 +1242,7 @@ namespace EMotionFX void AnimGraphNode::CollectChildNodesOfType(const AZ::TypeId& nodeType, AZStd::vector& outNodes) const { - for (AnimGraphNode* childNode : mChildNodes) + for (AnimGraphNode* childNode : m_childNodes) { if (azrtti_typeid(childNode) == nodeType) { @@ -1272,7 +1259,7 @@ namespace EMotionFX outNodes->emplace_back(const_cast(this)); } - for (const AnimGraphNode* childNode : mChildNodes) + for (const AnimGraphNode* childNode : m_childNodes) { childNode->RecursiveCollectNodesOfType(nodeType, outNodes); } @@ -1306,7 +1293,7 @@ namespace EMotionFX } } - for (const AnimGraphNode* childNode : mChildNodes) + for (const AnimGraphNode* childNode : m_childNodes) { childNode->RecursiveCollectTransitionConditionsOfType(conditionType, outConditions); } @@ -1320,7 +1307,7 @@ namespace EMotionFX outObjects.emplace_back(const_cast(this)); } - for (const AnimGraphNode* childNode : mChildNodes) + for (const AnimGraphNode* childNode : m_childNodes) { childNode->RecursiveCollectObjectsOfType(objectType, outObjects); } @@ -1328,7 +1315,7 @@ namespace EMotionFX void AnimGraphNode::RecursiveCollectObjectsAffectedBy(AnimGraph* animGraph, AZStd::vector& outObjects) const { - for (const AnimGraphNode* childNode : mChildNodes) + for (const AnimGraphNode* childNode : m_childNodes) { childNode->RecursiveCollectObjectsAffectedBy(animGraph, outObjects); } @@ -1379,44 +1366,44 @@ namespace EMotionFX // find the input port, based on the port name AnimGraphNode::Port* AnimGraphNode::FindInputPortByName(const AZStd::string& portName) { - const auto foundPort = AZStd::find_if(begin(mInputPorts), end(mInputPorts), [&portName](const Port& port) + const auto foundPort = AZStd::find_if(begin(m_inputPorts), end(m_inputPorts), [&portName](const Port& port) { return port.GetNameString() == portName; }); - return foundPort != end(mInputPorts) ? foundPort : nullptr; + return foundPort != end(m_inputPorts) ? foundPort : nullptr; } // find the output port, based on the port name AnimGraphNode::Port* AnimGraphNode::FindOutputPortByName(const AZStd::string& portName) { - const auto foundPort = AZStd::find_if(begin(mOutputPorts), end(mOutputPorts), [&portName](const Port& port) + const auto foundPort = AZStd::find_if(begin(m_outputPorts), end(m_outputPorts), [&portName](const Port& port) { return port.GetNameString() == portName; }); - return foundPort != end(mOutputPorts) ? foundPort : nullptr; + return foundPort != end(m_outputPorts) ? foundPort : nullptr; } // find the input port index, based on the port id size_t AnimGraphNode::FindInputPortByID(uint32 portID) const { - const auto foundPort = AZStd::find_if(begin(mInputPorts), end(mInputPorts), [portID](const Port& port) + const auto foundPort = AZStd::find_if(begin(m_inputPorts), end(m_inputPorts), [portID](const Port& port) { - return port.mPortID == portID; + return port.m_portId == portID; }); - return foundPort != end(mInputPorts) ? AZStd::distance(begin(mInputPorts), foundPort) : InvalidIndex; + return foundPort != end(m_inputPorts) ? AZStd::distance(begin(m_inputPorts), foundPort) : InvalidIndex; } // find the output port index, based on the port id size_t AnimGraphNode::FindOutputPortByID(uint32 portID) const { - const auto foundPort = AZStd::find_if(begin(mOutputPorts), end(mOutputPorts), [portID](const Port& port) + const auto foundPort = AZStd::find_if(begin(m_outputPorts), end(m_outputPorts), [portID](const Port& port) { - return port.mPortID == portID; + return port.m_portId == portID; }); - return foundPort != end(mOutputPorts) ? AZStd::distance(begin(mOutputPorts), foundPort) : InvalidIndex; + return foundPort != end(m_outputPorts) ? AZStd::distance(begin(m_outputPorts), foundPort) : InvalidIndex; } @@ -1434,12 +1421,12 @@ namespace EMotionFX outConnections.clear(); // if we don't have a parent node we cannot proceed - if (!mParentNode) + if (!m_parentNode) { return; } - for (AnimGraphNode* childNode : mParentNode->GetChildNodes()) + for (AnimGraphNode* childNode : m_parentNode->GetChildNodes()) { // Skip this child if the child is this node if (childNode == this) @@ -1463,12 +1450,12 @@ namespace EMotionFX { outConnections.clear(); - if (!mParentNode) + if (!m_parentNode) { return; } - for (AnimGraphNode* childNode : mParentNode->GetChildNodes()) + for (AnimGraphNode* childNode : m_parentNode->GetChildNodes()) { // Skip this child if the child is this node if (childNode == this) @@ -1509,7 +1496,7 @@ namespace EMotionFX BlendTreeConnection* AnimGraphNode::FindConnectionById(AnimGraphConnectionId connectionId) const { - for (BlendTreeConnection* connection : mConnections) + for (BlendTreeConnection* connection : m_connections) { if (connection->GetId() == connectionId) { @@ -1523,15 +1510,15 @@ namespace EMotionFX bool AnimGraphNode::HasConnectionAtInputPort(AZ::u32 inputPortNr) const { - const Port& inputPort = mInputPorts[inputPortNr]; - return inputPort.mConnection != nullptr; + const Port& inputPort = m_inputPorts[inputPortNr]; + return inputPort.m_connection != nullptr; } // callback that gets called before a node gets removed void AnimGraphNode::OnRemoveNode(AnimGraph* animGraph, AnimGraphNode* nodeToRemove) { - for (AnimGraphNode* childNode : mChildNodes) + for (AnimGraphNode* childNode : m_childNodes) { childNode->OnRemoveNode(animGraph, nodeToRemove); } @@ -1543,7 +1530,7 @@ namespace EMotionFX { outObjects.emplace_back(const_cast(this)); - for (const AnimGraphNode* childNode : mChildNodes) + for (const AnimGraphNode* childNode : m_childNodes) { childNode->RecursiveCollectObjects(outObjects); } @@ -1553,15 +1540,12 @@ namespace EMotionFX // topdown update void AnimGraphNode::TopDownUpdate(AnimGraphInstance* animGraphInstance, float timePassedInSeconds) { - //if (mDisabled) - //return; - // get the unique data AnimGraphNodeData* uniqueData = FindOrCreateUniqueNodeData(animGraphInstance); HierarchicalSyncAllInputNodes(animGraphInstance, uniqueData); // top down update all incoming connections - for (BlendTreeConnection* connection : mConnections) + for (BlendTreeConnection* connection : m_connections) { connection->GetSourceNode()->PerformTopDownUpdate(animGraphInstance, timePassedInSeconds); } @@ -1583,10 +1567,10 @@ namespace EMotionFX // iterate over all incoming connections bool syncTrackFound = false; size_t connectionIndex = InvalidIndex; - const size_t numConnections = mConnections.size(); + const size_t numConnections = m_connections.size(); for (size_t i = 0; i < numConnections; ++i) { - const BlendTreeConnection* connection = mConnections[i]; + const BlendTreeConnection* connection = m_connections[i]; AnimGraphNode* sourceNode = connection->GetSourceNode(); // update the node @@ -1602,13 +1586,13 @@ namespace EMotionFX if (connectionIndex != InvalidIndex) { - uniqueData->Init(animGraphInstance, mConnections[connectionIndex]->GetSourceNode()); + uniqueData->Init(animGraphInstance, m_connections[connectionIndex]->GetSourceNode()); } // set the current sync track to the first input connection - if (!syncTrackFound && numConnections > 0 && mConnections[0]->GetSourceNode()->GetHasOutputPose()) // just pick the first connection's sync track + if (!syncTrackFound && numConnections > 0 && m_connections[0]->GetSourceNode()->GetHasOutputPose()) // just pick the first connection's sync track { - uniqueData->Init(animGraphInstance, mConnections[0]->GetSourceNode()); + uniqueData->Init(animGraphInstance, m_connections[0]->GetSourceNode()); } } @@ -1616,7 +1600,7 @@ namespace EMotionFX // output all incoming nodes void AnimGraphNode::OutputAllIncomingNodes(AnimGraphInstance* animGraphInstance) { - for (const BlendTreeConnection* connection : mConnections) + for (const BlendTreeConnection* connection : m_connections) { OutputIncomingNode(animGraphInstance, connection->GetSourceNode()); } @@ -1637,7 +1621,7 @@ namespace EMotionFX // update all incoming nodes void AnimGraphNode::UpdateAllIncomingNodes(AnimGraphInstance* animGraphInstance, float timePassedInSeconds) { - for (const BlendTreeConnection* connection : mConnections) + for (const BlendTreeConnection* connection : m_connections) { AnimGraphNode* sourceNode = connection->GetSourceNode(); sourceNode->PerformUpdate(animGraphInstance, timePassedInSeconds); @@ -1650,7 +1634,7 @@ namespace EMotionFX { if (GetEMotionFX().GetIsInEditorMode()) { - for (BlendTreeConnection* connection : mConnections) + for (BlendTreeConnection* connection : m_connections) { if (connection->GetSourceNode() == sourceNode) { @@ -1675,7 +1659,7 @@ namespace EMotionFX // mark any connection originating from this node as visited if (GetEMotionFX().GetIsInEditorMode()) { - for (BlendTreeConnection* connection : mConnections) + for (BlendTreeConnection* connection : m_connections) { if (connection->GetSourceNode() == nodeToOutput) { @@ -1692,10 +1676,10 @@ namespace EMotionFX bool poseFound = false; size_t connectionIndex = InvalidIndex; AZ::u16 minTargetPortIndex = MCORE_INVALIDINDEX16; - const size_t numConnections = mConnections.size(); + const size_t numConnections = m_connections.size(); for (size_t i = 0; i < numConnections; ++i) { - const BlendTreeConnection* connection = mConnections[i]; + const BlendTreeConnection* connection = m_connections[i]; AnimGraphNode* sourceNode = connection->GetSourceNode(); // update the node @@ -1709,7 +1693,7 @@ namespace EMotionFX // Find the first connection that plugs into a port that can take a pose. const AZ::u16 targetPortIndex = connection->GetTargetPort(); - if (mInputPorts[targetPortIndex].mCompatibleTypes[0] == AttributePose::TYPE_ID) + if (m_inputPorts[targetPortIndex].m_compatibleTypes[0] == AttributePose::TYPE_ID) { poseFound = true; if (targetPortIndex < minTargetPortIndex) @@ -1726,7 +1710,7 @@ namespace EMotionFX AnimGraphNodeData* uniqueData = FindOrCreateUniqueNodeData(animGraphInstance); if (poseFound && connectionIndex != InvalidIndex) { - const BlendTreeConnection* connection = mConnections[connectionIndex]; + const BlendTreeConnection* connection = m_connections[connectionIndex]; AnimGraphNode* sourceNode = connection->GetSourceNode(); AnimGraphRefCountedData* data = uniqueData->GetRefCountedData(); @@ -1740,10 +1724,10 @@ namespace EMotionFX } } else - if (poseFound == false && numConnections > 0 && mConnections[0]->GetSourceNode()->GetHasOutputPose()) + if (poseFound == false && numConnections > 0 && m_connections[0]->GetSourceNode()->GetHasOutputPose()) { AnimGraphRefCountedData* data = uniqueData->GetRefCountedData(); - AnimGraphNode* sourceNode = mConnections[0]->GetSourceNode(); + AnimGraphNode* sourceNode = m_connections[0]->GetSourceNode(); AnimGraphRefCountedData* sourceData = sourceNode->FindOrCreateUniqueNodeData(animGraphInstance)->GetRefCountedData(); data->SetEventBuffer(sourceData->GetEventBuffer()); data->SetTrajectoryDelta(sourceData->GetTrajectoryDelta()); @@ -1764,10 +1748,10 @@ namespace EMotionFX void AnimGraphNode::RecursiveSetUniqueDataFlag(AnimGraphInstance* animGraphInstance, uint32 flag, bool enabled) { // set the flag - animGraphInstance->SetObjectFlags(mObjectIndex, flag, enabled); + animGraphInstance->SetObjectFlags(m_objectIndex, flag, enabled); // recurse downwards - for (BlendTreeConnection* connection : mConnections) + for (BlendTreeConnection* connection : m_connections) { connection->GetSourceNode()->RecursiveSetUniqueDataFlag(animGraphInstance, flag, enabled); } @@ -1918,7 +1902,7 @@ namespace EMotionFX void AnimGraphNode::HierarchicalSyncAllInputNodes(AnimGraphInstance* animGraphInstance, AnimGraphNodeData* uniqueDataOfThisNode) { // for all connections - for (const BlendTreeConnection* connection : mConnections) + for (const BlendTreeConnection* connection : m_connections) { AnimGraphNode* inputNode = connection->GetSourceNode(); HierarchicalSyncInputNode(animGraphInstance, inputNode, uniqueDataOfThisNode); @@ -1931,14 +1915,14 @@ namespace EMotionFX // check and add this node if (azrtti_typeid(this) == nodeType || nodeType.IsNull()) { - if (animGraphInstance->GetIsOutputReady(mObjectIndex)) // if we processed this node + if (animGraphInstance->GetIsOutputReady(m_objectIndex)) // if we processed this node { outNodes->emplace_back(const_cast(this)); } } // process all child nodes (but only active ones) - for (const AnimGraphNode* childNode : mChildNodes) + for (const AnimGraphNode* childNode : m_childNodes) { if (animGraphInstance->GetIsOutputReady(childNode->GetObjectIndex())) { @@ -1953,14 +1937,14 @@ namespace EMotionFX // Check and add this node if (GetNeedsNetTimeSync()) { - if (animGraphInstance->GetIsOutputReady(mObjectIndex)) // if we processed this node + if (animGraphInstance->GetIsOutputReady(m_objectIndex)) // if we processed this node { outNodes->emplace_back(const_cast(this)); } } // Process all child nodes (but only active ones) - for (const AnimGraphNode* childNode : mChildNodes) + for (const AnimGraphNode* childNode : m_childNodes) { if (animGraphInstance->GetIsOutputReady(childNode->GetObjectIndex())) { @@ -1972,7 +1956,7 @@ namespace EMotionFX bool AnimGraphNode::RecursiveDetectCycles(AZStd::unordered_set& nodes) const { - for (const AnimGraphNode* childNode : mChildNodes) + for (const AnimGraphNode* childNode : m_childNodes) { if (nodes.find(childNode) != nodes.end()) { @@ -2008,10 +1992,10 @@ namespace EMotionFX const uint32 threadIndex = animGraphInstance->GetActorInstance()->GetThreadIndex(); AnimGraphPosePool& posePool = GetEMotionFX().GetThreadData(threadIndex)->GetPosePool(); - const size_t numOutputs = mOutputPorts.size(); + const size_t numOutputs = m_outputPorts.size(); for (size_t i = 0; i < numOutputs; ++i) { - if (mOutputPorts[i].mCompatibleTypes[0] == AttributePose::TYPE_ID) + if (m_outputPorts[i].m_compatibleTypes[0] == AttributePose::TYPE_ID) { MCore::Attribute* attribute = GetOutputAttribute(animGraphInstance, i); MCORE_ASSERT(attribute->GetType() == AttributePose::TYPE_ID); @@ -2036,10 +2020,10 @@ namespace EMotionFX AnimGraphPosePool& posePool = GetEMotionFX().GetThreadData(threadIndex)->GetPosePool(); - const size_t numOutputs = mOutputPorts.size(); + const size_t numOutputs = m_outputPorts.size(); for (size_t i = 0; i < numOutputs; ++i) { - if (mOutputPorts[i].mCompatibleTypes[0] == AttributePose::TYPE_ID) + if (m_outputPorts[i].m_compatibleTypes[0] == AttributePose::TYPE_ID) { MCore::Attribute* attribute = GetOutputAttribute(animGraphInstance, i); MCORE_ASSERT(attribute->GetType() == AttributePose::TYPE_ID); @@ -2055,9 +2039,9 @@ namespace EMotionFX // free all poses from all incoming nodes void AnimGraphNode::FreeIncomingPoses(AnimGraphInstance* animGraphInstance) { - for (const Port& inputPort : mInputPorts) + for (const Port& inputPort : m_inputPorts) { - const BlendTreeConnection* connection = inputPort.mConnection; + const BlendTreeConnection* connection = inputPort.m_connection; if (connection) { AnimGraphNode* sourceNode = connection->GetSourceNode(); @@ -2070,9 +2054,9 @@ namespace EMotionFX // free all poses from all incoming nodes void AnimGraphNode::FreeIncomingRefDatas(AnimGraphInstance* animGraphInstance) { - for (const Port& port : mInputPorts) + for (const Port& port : m_inputPorts) { - const BlendTreeConnection* connection = port.mConnection; + const BlendTreeConnection* connection = port.m_connection; if (connection) { AnimGraphNode* sourceNode = connection->GetSourceNode(); @@ -2125,13 +2109,13 @@ namespace EMotionFX void AnimGraphNode::PerformTopDownUpdate(AnimGraphInstance* animGraphInstance, float timePassedInSeconds) { // check if we already did update - if (animGraphInstance->GetIsTopDownUpdateReady(mObjectIndex)) + if (animGraphInstance->GetIsTopDownUpdateReady(m_objectIndex)) { return; } // mark as done - animGraphInstance->EnableObjectFlags(mObjectIndex, AnimGraphInstance::OBJECTFLAGS_TOPDOWNUPDATE_READY); + animGraphInstance->EnableObjectFlags(m_objectIndex, AnimGraphInstance::OBJECTFLAGS_TOPDOWNUPDATE_READY); TopDownUpdate(animGraphInstance, timePassedInSeconds); } @@ -2141,13 +2125,13 @@ namespace EMotionFX void AnimGraphNode::PerformPostUpdate(AnimGraphInstance* animGraphInstance, float timePassedInSeconds) { // check if we already did update - if (animGraphInstance->GetIsPostUpdateReady(mObjectIndex)) + if (animGraphInstance->GetIsPostUpdateReady(m_objectIndex)) { return; } // mark as done - animGraphInstance->EnableObjectFlags(mObjectIndex, AnimGraphInstance::OBJECTFLAGS_POSTUPDATE_READY); + animGraphInstance->EnableObjectFlags(m_objectIndex, AnimGraphInstance::OBJECTFLAGS_POSTUPDATE_READY); // perform the actual post update PostUpdate(animGraphInstance, timePassedInSeconds); @@ -2161,13 +2145,13 @@ namespace EMotionFX void AnimGraphNode::PerformUpdate(AnimGraphInstance* animGraphInstance, float timePassedInSeconds) { // check if we already did update - if (animGraphInstance->GetIsUpdateReady(mObjectIndex)) + if (animGraphInstance->GetIsUpdateReady(m_objectIndex)) { return; } // mark as done - animGraphInstance->EnableObjectFlags(mObjectIndex, AnimGraphInstance::OBJECTFLAGS_UPDATE_READY); + animGraphInstance->EnableObjectFlags(m_objectIndex, AnimGraphInstance::OBJECTFLAGS_UPDATE_READY); // increase ref count for incoming nodes IncreaseInputRefCounts(animGraphInstance); @@ -2182,13 +2166,13 @@ namespace EMotionFX void AnimGraphNode::PerformOutput(AnimGraphInstance* animGraphInstance) { // check if we already did output - if (animGraphInstance->GetIsOutputReady(mObjectIndex)) + if (animGraphInstance->GetIsOutputReady(m_objectIndex)) { return; } // mark as done - animGraphInstance->EnableObjectFlags(mObjectIndex, AnimGraphInstance::OBJECTFLAGS_OUTPUT_READY); + animGraphInstance->EnableObjectFlags(m_objectIndex, AnimGraphInstance::OBJECTFLAGS_OUTPUT_READY); // perform the output Output(animGraphInstance); @@ -2202,9 +2186,9 @@ namespace EMotionFX // increase input ref counts void AnimGraphNode::IncreaseInputRefDataRefCounts(AnimGraphInstance* animGraphInstance) { - for (const Port& port : mInputPorts) + for (const Port& port : m_inputPorts) { - const BlendTreeConnection* connection = port.mConnection; + const BlendTreeConnection* connection = port.m_connection; if (connection) { AnimGraphNode* sourceNode = connection->GetSourceNode(); @@ -2217,9 +2201,9 @@ namespace EMotionFX // increase input ref counts void AnimGraphNode::IncreaseInputRefCounts(AnimGraphInstance* animGraphInstance) { - for (const Port& port : mInputPorts) + for (const Port& port : m_inputPorts) { - const BlendTreeConnection* connection = port.mConnection; + const BlendTreeConnection* connection = port.m_connection; if (connection) { AnimGraphNode* sourceNode = connection->GetSourceNode(); @@ -2232,7 +2216,7 @@ namespace EMotionFX void AnimGraphNode::RelinkPortConnections() { // After deserializing, nodes hold an array of incoming connections. Each node port caches a pointer to its connection object which we need to link. - for (BlendTreeConnection* connection : mConnections) + for (BlendTreeConnection* connection : m_connections) { AnimGraphNode* sourceNode = connection->GetSourceNode(); const AZ::u16 targetPortNr = connection->GetTargetPort(); @@ -2240,9 +2224,9 @@ namespace EMotionFX if (sourceNode) { - if (sourcePortNr < sourceNode->mOutputPorts.size()) + if (sourcePortNr < sourceNode->m_outputPorts.size()) { - sourceNode->GetOutputPort(sourcePortNr).mConnection = connection; + sourceNode->GetOutputPort(sourcePortNr).m_connection = connection; } else { @@ -2250,9 +2234,9 @@ namespace EMotionFX } } - if (targetPortNr < mInputPorts.size()) + if (targetPortNr < m_inputPorts.size()) { - mInputPorts[targetPortNr].mConnection = connection; + m_inputPorts[targetPortNr].m_connection = connection; } else { @@ -2265,7 +2249,7 @@ namespace EMotionFX // do we have a child of a given type? bool AnimGraphNode::CheckIfHasChildOfType(const AZ::TypeId& nodeType) const { - for (const AnimGraphNode* childNode : mChildNodes) + for (const AnimGraphNode* childNode : m_childNodes) { if (azrtti_typeid(childNode) == nodeType) { @@ -2280,7 +2264,7 @@ namespace EMotionFX // check if we can visualize bool AnimGraphNode::GetCanVisualize(AnimGraphInstance* animGraphInstance) const { - return (mVisEnabled && animGraphInstance->GetVisualizationEnabled() && EMotionFX::GetRecorder().GetIsInPlayMode() == false); + return (m_visEnabled && animGraphInstance->GetVisualizationEnabled() && EMotionFX::GetRecorder().GetIsInPlayMode() == false); } @@ -2288,20 +2272,20 @@ namespace EMotionFX void AnimGraphNode::RemoveInternalAttributesForAllInstances() { // for all output ports - for (Port& port : mOutputPorts) + for (Port& port : m_outputPorts) { - const size_t internalAttributeIndex = port.mAttributeIndex; + const size_t internalAttributeIndex = port.m_attributeIndex; if (internalAttributeIndex != InvalidIndex) { - const size_t numInstances = mAnimGraph->GetNumAnimGraphInstances(); + const size_t numInstances = m_animGraph->GetNumAnimGraphInstances(); for (size_t i = 0; i < numInstances; ++i) { - AnimGraphInstance* animGraphInstance = mAnimGraph->GetAnimGraphInstance(i); + AnimGraphInstance* animGraphInstance = m_animGraph->GetAnimGraphInstance(i); animGraphInstance->RemoveInternalAttribute(internalAttributeIndex); } - mAnimGraph->DecreaseInternalAttributeIndices(internalAttributeIndex); - port.mAttributeIndex = InvalidIndex; + m_animGraph->DecreaseInternalAttributeIndices(internalAttributeIndex); + port.m_attributeIndex = InvalidIndex; } } } @@ -2310,11 +2294,11 @@ namespace EMotionFX // decrease values higher than a given param value void AnimGraphNode::DecreaseInternalAttributeIndices(size_t decreaseEverythingHigherThan) { - for (Port& port : mOutputPorts) + for (Port& port : m_outputPorts) { - if (port.mAttributeIndex > decreaseEverythingHigherThan && port.mAttributeIndex != InvalidIndex) + if (port.m_attributeIndex > decreaseEverythingHigherThan && port.m_attributeIndex != InvalidIndex) { - port.mAttributeIndex--; + port.m_attributeIndex--; } } } @@ -2324,31 +2308,31 @@ namespace EMotionFX void AnimGraphNode::InitInternalAttributes(AnimGraphInstance* animGraphInstance) { // for all output ports of this node - for (Port& port : mOutputPorts) + for (Port& port : m_outputPorts) { - MCore::Attribute* newAttribute = MCore::GetAttributeFactory().CreateAttributeByType(port.mCompatibleTypes[0]); // assume compatibility type 0 to be the attribute type ID - port.mAttributeIndex = animGraphInstance->AddInternalAttribute(newAttribute); + MCore::Attribute* newAttribute = MCore::GetAttributeFactory().CreateAttributeByType(port.m_compatibleTypes[0]); // assume compatibility type 0 to be the attribute type ID + port.m_attributeIndex = animGraphInstance->AddInternalAttribute(newAttribute); } } void* AnimGraphNode::GetCustomData() const { - return mCustomData; + return m_customData; } void AnimGraphNode::SetCustomData(void* dataPointer) { - mCustomData = dataPointer; + m_customData = dataPointer; } void AnimGraphNode::SetNodeInfo(const AZStd::string& info) { - if (mNodeInfo != info) + if (m_nodeInfo != info) { - mNodeInfo = info; + m_nodeInfo = info; SyncVisualObject(); } @@ -2357,88 +2341,88 @@ namespace EMotionFX const AZStd::string& AnimGraphNode::GetNodeInfo() const { - return mNodeInfo; + return m_nodeInfo; } bool AnimGraphNode::GetIsEnabled() const { - return (mDisabled == false); + return (m_disabled == false); } void AnimGraphNode::SetIsEnabled(bool enabled) { - mDisabled = !enabled; + m_disabled = !enabled; } bool AnimGraphNode::GetIsCollapsed() const { - return mIsCollapsed; + return m_isCollapsed; } void AnimGraphNode::SetIsCollapsed(bool collapsed) { - mIsCollapsed = collapsed; + m_isCollapsed = collapsed; } void AnimGraphNode::SetVisualizeColor(const AZ::Color& color) { - mVisualizeColor = color; + m_visualizeColor = color; SyncVisualObject(); } const AZ::Color& AnimGraphNode::GetVisualizeColor() const { - return mVisualizeColor; + return m_visualizeColor; } void AnimGraphNode::SetVisualPos(int32 x, int32 y) { - mPosX = x; - mPosY = y; + m_posX = x; + m_posY = y; } int32 AnimGraphNode::GetVisualPosX() const { - return mPosX; + return m_posX; } int32 AnimGraphNode::GetVisualPosY() const { - return mPosY; + return m_posY; } bool AnimGraphNode::GetIsVisualizationEnabled() const { - return mVisEnabled; + return m_visEnabled; } void AnimGraphNode::SetVisualization(bool enabled) { - mVisEnabled = enabled; + m_visEnabled = enabled; } void AnimGraphNode::AddChildNode(AnimGraphNode* node) { - mChildNodes.push_back(node); + m_childNodes.push_back(node); node->SetParentNode(this); } void AnimGraphNode::ReserveChildNodes(size_t numChildNodes) { - mChildNodes.reserve(numChildNodes); + m_childNodes.reserve(numChildNodes); } @@ -2461,7 +2445,7 @@ namespace EMotionFX void AnimGraphNode::ResetPoseRefCount(AnimGraphInstance* animGraphInstance) { - AnimGraphNodeData* uniqueData = reinterpret_cast(animGraphInstance->GetUniqueObjectData(mObjectIndex)); + AnimGraphNodeData* uniqueData = reinterpret_cast(animGraphInstance->GetUniqueObjectData(m_objectIndex)); if (uniqueData) { uniqueData->SetPoseRefCount(0); @@ -2470,7 +2454,7 @@ namespace EMotionFX void AnimGraphNode::ResetRefDataRefCount(AnimGraphInstance* animGraphInstance) { - AnimGraphNodeData* uniqueData = reinterpret_cast(animGraphInstance->GetUniqueObjectData(mObjectIndex)); + AnimGraphNodeData* uniqueData = reinterpret_cast(animGraphInstance->GetUniqueObjectData(m_objectIndex)); if (uniqueData) { uniqueData->SetRefDataRefCount(0); @@ -2527,14 +2511,14 @@ namespace EMotionFX ->PersistentId([](const void* instance) -> AZ::u64 { return static_cast(instance)->GetId(); }) ->Field("id", &AnimGraphNode::m_id) ->Field("name", &AnimGraphNode::m_name) - ->Field("posX", &AnimGraphNode::mPosX) - ->Field("posY", &AnimGraphNode::mPosY) - ->Field("visualizeColor", &AnimGraphNode::mVisualizeColor) - ->Field("isDisabled", &AnimGraphNode::mDisabled) - ->Field("isCollapsed", &AnimGraphNode::mIsCollapsed) - ->Field("isVisEnabled", &AnimGraphNode::mVisEnabled) - ->Field("childNodes", &AnimGraphNode::mChildNodes) - ->Field("connections", &AnimGraphNode::mConnections) + ->Field("posX", &AnimGraphNode::m_posX) + ->Field("posY", &AnimGraphNode::m_posY) + ->Field("visualizeColor", &AnimGraphNode::m_visualizeColor) + ->Field("isDisabled", &AnimGraphNode::m_disabled) + ->Field("isCollapsed", &AnimGraphNode::m_isCollapsed) + ->Field("isVisEnabled", &AnimGraphNode::m_visEnabled) + ->Field("childNodes", &AnimGraphNode::m_childNodes) + ->Field("connections", &AnimGraphNode::m_connections) ->Field("actionSetup", &AnimGraphNode::m_actionSetup); ; diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphNode.h b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphNode.h index 31d85b6f48..b515621c5b 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphNode.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphNode.h @@ -56,55 +56,55 @@ namespace EMotionFX AZ_RTTI(AnimGraphNode::Port, "{F66CF090-468F-419A-9518-97988304FEB6}") AZ_CLASS_ALLOCATOR_DECL - BlendTreeConnection* mConnection; // the connection plugged in this port - uint32 mCompatibleTypes[4]; // four possible compatible types - uint32 mPortID; // the unique port ID (unique inside the node input or output port lists) - uint32 mNameID; // the name of the port (using the StringIdPool) - size_t mAttributeIndex; // the index into the animgraph instance global attributes array + BlendTreeConnection* m_connection; // the connection plugged in this port + uint32 m_compatibleTypes[4]; // four possible compatible types + uint32 m_portId; // the unique port ID (unique inside the node input or output port lists) + uint32 m_nameId; // the name of the port (using the StringIdPool) + size_t m_attributeIndex; // the index into the animgraph instance global attributes array - MCORE_INLINE const char* GetName() const { return MCore::GetStringIdPool().GetName(mNameID).c_str(); } - MCORE_INLINE const AZStd::string& GetNameString() const { return MCore::GetStringIdPool().GetName(mNameID); } + MCORE_INLINE const char* GetName() const { return MCore::GetStringIdPool().GetName(m_nameId).c_str(); } + MCORE_INLINE const AZStd::string& GetNameString() const { return MCore::GetStringIdPool().GetName(m_nameId); } - // copy settings from another port (always makes the mConnection and mValue nullptr though) + // copy settings from another port (always makes the m_connection and m_value nullptr though) void InitFrom(const Port& other) { for (uint32 i = 0; i < 4; ++i) { - mCompatibleTypes[i] = other.mCompatibleTypes[i]; + m_compatibleTypes[i] = other.m_compatibleTypes[i]; } - mPortID = other.mPortID; - mNameID = other.mNameID; - mConnection = nullptr; - mAttributeIndex = other.mAttributeIndex; + m_portId = other.m_portId; + m_nameId = other.m_nameId; + m_connection = nullptr; + m_attributeIndex = other.m_attributeIndex; } void SetCompatibleTypes(const AZStd::vector& compatibleTypes) { for (uint32 i = 0; i < 4 && i < compatibleTypes.size(); ++i) { - mCompatibleTypes[i] = compatibleTypes[i]; + m_compatibleTypes[i] = compatibleTypes[i]; } } // get the attribute value MCORE_INLINE MCore::Attribute* GetAttribute(AnimGraphInstance* animGraphInstance) const { - return animGraphInstance->GetInternalAttribute(mAttributeIndex); + return animGraphInstance->GetInternalAttribute(m_attributeIndex); } // port connection compatibility check bool CheckIfIsCompatibleWith(const Port& otherPort) const { // check the data types - for (uint32 compatibleType : mCompatibleTypes) + for (uint32 compatibleType : m_compatibleTypes) { // If there aren't any more compatibility types and we haven't found a compatible one so far, return false if (compatibleType == 0) { return false; } - for (uint32 otherCompatibleTypeIndex : otherPort.mCompatibleTypes) + for (uint32 otherCompatibleTypeIndex : otherPort.m_compatibleTypes) { if (otherCompatibleTypeIndex == compatibleType) { @@ -126,10 +126,10 @@ namespace EMotionFX // clear compatibility types void ClearCompatibleTypes() { - mCompatibleTypes[0] = 0; - mCompatibleTypes[1] = 0; - mCompatibleTypes[2] = 0; - mCompatibleTypes[3] = 0; + m_compatibleTypes[0] = 0; + m_compatibleTypes[1] = 0; + m_compatibleTypes[2] = 0; + m_compatibleTypes[3] = 0; } void Clear() @@ -138,10 +138,10 @@ namespace EMotionFX } Port() - : mConnection(nullptr) - , mPortID(MCORE_INVALIDINDEX32) - , mNameID(MCORE_INVALIDINDEX32) - , mAttributeIndex(InvalidIndex) { ClearCompatibleTypes(); } + : m_connection(nullptr) + , m_portId(MCORE_INVALIDINDEX32) + , m_nameId(MCORE_INVALIDINDEX32) + , m_attributeIndex(InvalidIndex) { ClearCompatibleTypes(); } virtual ~Port() { } }; @@ -448,7 +448,7 @@ namespace EMotionFX MCORE_INLINE AnimGraphNode* GetInputNode(size_t portNr) { - const BlendTreeConnection* con = mInputPorts[portNr].mConnection; + const BlendTreeConnection* con = m_inputPorts[portNr].m_connection; if (con == nullptr) { return nullptr; @@ -458,7 +458,7 @@ namespace EMotionFX MCORE_INLINE MCore::Attribute* GetInputAttribute(AnimGraphInstance* animGraphInstance, size_t portNr) const { - const BlendTreeConnection* con = mInputPorts[portNr].mConnection; + const BlendTreeConnection* con = m_inputPorts[portNr].m_connection; if (con == nullptr) { return nullptr; @@ -648,114 +648,114 @@ namespace EMotionFX return static_cast(attrib); } - MCORE_INLINE MCore::Attribute* GetOutputAttribute(AnimGraphInstance* animGraphInstance, size_t outputPortIndex) const { return mOutputPorts[outputPortIndex].GetAttribute(animGraphInstance); } + MCORE_INLINE MCore::Attribute* GetOutputAttribute(AnimGraphInstance* animGraphInstance, size_t outputPortIndex) const { return m_outputPorts[outputPortIndex].GetAttribute(animGraphInstance); } MCORE_INLINE MCore::AttributeFloat* GetOutputNumber(AnimGraphInstance* animGraphInstance, size_t outputPortIndex) const { - if (mOutputPorts[outputPortIndex].GetAttribute(animGraphInstance) == nullptr) + if (m_outputPorts[outputPortIndex].GetAttribute(animGraphInstance) == nullptr) { return nullptr; } - MCORE_ASSERT(mOutputPorts[outputPortIndex].mCompatibleTypes[0] == MCore::AttributeFloat::TYPE_ID); - return static_cast(mOutputPorts[outputPortIndex].GetAttribute(animGraphInstance)); + MCORE_ASSERT(m_outputPorts[outputPortIndex].m_compatibleTypes[0] == MCore::AttributeFloat::TYPE_ID); + return static_cast(m_outputPorts[outputPortIndex].GetAttribute(animGraphInstance)); } MCORE_INLINE MCore::AttributeFloat* GetOutputFloat(AnimGraphInstance* animGraphInstance, size_t outputPortIndex) const { - if (mOutputPorts[outputPortIndex].GetAttribute(animGraphInstance) == nullptr) + if (m_outputPorts[outputPortIndex].GetAttribute(animGraphInstance) == nullptr) { return nullptr; } - MCORE_ASSERT(mOutputPorts[outputPortIndex].mCompatibleTypes[0] == MCore::AttributeFloat::TYPE_ID); - return static_cast(mOutputPorts[outputPortIndex].GetAttribute(animGraphInstance)); + MCORE_ASSERT(m_outputPorts[outputPortIndex].m_compatibleTypes[0] == MCore::AttributeFloat::TYPE_ID); + return static_cast(m_outputPorts[outputPortIndex].GetAttribute(animGraphInstance)); } MCORE_INLINE MCore::AttributeInt32* GetOutputInt32(AnimGraphInstance* animGraphInstance, size_t outputPortIndex) const { - if (mOutputPorts[outputPortIndex].GetAttribute(animGraphInstance) == nullptr) + if (m_outputPorts[outputPortIndex].GetAttribute(animGraphInstance) == nullptr) { return nullptr; } - MCORE_ASSERT(mOutputPorts[outputPortIndex].mCompatibleTypes[0] == MCore::AttributeInt32::TYPE_ID); - return static_cast(mOutputPorts[outputPortIndex].GetAttribute(animGraphInstance)); + MCORE_ASSERT(m_outputPorts[outputPortIndex].m_compatibleTypes[0] == MCore::AttributeInt32::TYPE_ID); + return static_cast(m_outputPorts[outputPortIndex].GetAttribute(animGraphInstance)); } MCORE_INLINE MCore::AttributeString* GetOutputString(AnimGraphInstance* animGraphInstance, size_t outputPortIndex) const { - if (mOutputPorts[outputPortIndex].GetAttribute(animGraphInstance) == nullptr) + if (m_outputPorts[outputPortIndex].GetAttribute(animGraphInstance) == nullptr) { return nullptr; } - MCORE_ASSERT(mOutputPorts[outputPortIndex].mCompatibleTypes[0] == MCore::AttributeString::TYPE_ID); - return static_cast(mOutputPorts[outputPortIndex].GetAttribute(animGraphInstance)); + MCORE_ASSERT(m_outputPorts[outputPortIndex].m_compatibleTypes[0] == MCore::AttributeString::TYPE_ID); + return static_cast(m_outputPorts[outputPortIndex].GetAttribute(animGraphInstance)); } MCORE_INLINE MCore::AttributeBool* GetOutputBool(AnimGraphInstance* animGraphInstance, size_t outputPortIndex) const { - if (mOutputPorts[outputPortIndex].GetAttribute(animGraphInstance) == nullptr) + if (m_outputPorts[outputPortIndex].GetAttribute(animGraphInstance) == nullptr) { return nullptr; } - MCORE_ASSERT(mOutputPorts[outputPortIndex].mCompatibleTypes[0] == MCore::AttributeBool::TYPE_ID); - return static_cast(mOutputPorts[outputPortIndex].GetAttribute(animGraphInstance)); + MCORE_ASSERT(m_outputPorts[outputPortIndex].m_compatibleTypes[0] == MCore::AttributeBool::TYPE_ID); + return static_cast(m_outputPorts[outputPortIndex].GetAttribute(animGraphInstance)); } MCORE_INLINE MCore::AttributeVector2* GetOutputVector2(AnimGraphInstance* animGraphInstance, size_t outputPortIndex) const { - if (mOutputPorts[outputPortIndex].GetAttribute(animGraphInstance) == nullptr) + if (m_outputPorts[outputPortIndex].GetAttribute(animGraphInstance) == nullptr) { return nullptr; } - MCORE_ASSERT(mOutputPorts[outputPortIndex].mCompatibleTypes[0] == MCore::AttributeVector2::TYPE_ID); - return static_cast(mOutputPorts[outputPortIndex].GetAttribute(animGraphInstance)); + MCORE_ASSERT(m_outputPorts[outputPortIndex].m_compatibleTypes[0] == MCore::AttributeVector2::TYPE_ID); + return static_cast(m_outputPorts[outputPortIndex].GetAttribute(animGraphInstance)); } MCORE_INLINE MCore::AttributeVector3* GetOutputVector3(AnimGraphInstance* animGraphInstance, size_t outputPortIndex) const { - if (mOutputPorts[outputPortIndex].GetAttribute(animGraphInstance) == nullptr) + if (m_outputPorts[outputPortIndex].GetAttribute(animGraphInstance) == nullptr) { return nullptr; } - MCORE_ASSERT(mOutputPorts[outputPortIndex].mCompatibleTypes[0] == MCore::AttributeVector3::TYPE_ID); - return static_cast(mOutputPorts[outputPortIndex].GetAttribute(animGraphInstance)); + MCORE_ASSERT(m_outputPorts[outputPortIndex].m_compatibleTypes[0] == MCore::AttributeVector3::TYPE_ID); + return static_cast(m_outputPorts[outputPortIndex].GetAttribute(animGraphInstance)); } MCORE_INLINE MCore::AttributeVector4* GetOutputVector4(AnimGraphInstance* animGraphInstance, size_t outputPortIndex) const { - if (mOutputPorts[outputPortIndex].GetAttribute(animGraphInstance) == nullptr) + if (m_outputPorts[outputPortIndex].GetAttribute(animGraphInstance) == nullptr) { return nullptr; } - MCORE_ASSERT(mOutputPorts[outputPortIndex].mCompatibleTypes[0] == MCore::AttributeVector4::TYPE_ID); - return static_cast(mOutputPorts[outputPortIndex].GetAttribute(animGraphInstance)); + MCORE_ASSERT(m_outputPorts[outputPortIndex].m_compatibleTypes[0] == MCore::AttributeVector4::TYPE_ID); + return static_cast(m_outputPorts[outputPortIndex].GetAttribute(animGraphInstance)); } MCORE_INLINE MCore::AttributeQuaternion* GetOutputQuaternion(AnimGraphInstance* animGraphInstance, size_t outputPortIndex) const { - if (mOutputPorts[outputPortIndex].GetAttribute(animGraphInstance) == nullptr) + if (m_outputPorts[outputPortIndex].GetAttribute(animGraphInstance) == nullptr) { return nullptr; } - MCORE_ASSERT(mOutputPorts[outputPortIndex].mCompatibleTypes[0] == MCore::AttributeQuaternion::TYPE_ID); - return static_cast(mOutputPorts[outputPortIndex].GetAttribute(animGraphInstance)); + MCORE_ASSERT(m_outputPorts[outputPortIndex].m_compatibleTypes[0] == MCore::AttributeQuaternion::TYPE_ID); + return static_cast(m_outputPorts[outputPortIndex].GetAttribute(animGraphInstance)); } MCORE_INLINE MCore::AttributeColor* GetOutputColor(AnimGraphInstance* animGraphInstance, size_t outputPortIndex) const { - if (mOutputPorts[outputPortIndex].GetAttribute(animGraphInstance) == nullptr) + if (m_outputPorts[outputPortIndex].GetAttribute(animGraphInstance) == nullptr) { return nullptr; } - MCORE_ASSERT(mOutputPorts[outputPortIndex].mCompatibleTypes[0] == MCore::AttributeColor::TYPE_ID); - return static_cast(mOutputPorts[outputPortIndex].GetAttribute(animGraphInstance)); + MCORE_ASSERT(m_outputPorts[outputPortIndex].m_compatibleTypes[0] == MCore::AttributeColor::TYPE_ID); + return static_cast(m_outputPorts[outputPortIndex].GetAttribute(animGraphInstance)); } MCORE_INLINE AttributePose* GetOutputPose(AnimGraphInstance* animGraphInstance, size_t outputPortIndex) const { - if (mOutputPorts[outputPortIndex].GetAttribute(animGraphInstance) == nullptr) + if (m_outputPorts[outputPortIndex].GetAttribute(animGraphInstance) == nullptr) { return nullptr; } - MCORE_ASSERT(mOutputPorts[outputPortIndex].mCompatibleTypes[0] == AttributePose::TYPE_ID); - return static_cast(mOutputPorts[outputPortIndex].GetAttribute(animGraphInstance)); + MCORE_ASSERT(m_outputPorts[outputPortIndex].m_compatibleTypes[0] == AttributePose::TYPE_ID); + return static_cast(m_outputPorts[outputPortIndex].GetAttribute(animGraphInstance)); } MCORE_INLINE AttributeMotionInstance* GetOutputMotionInstance(AnimGraphInstance* animGraphInstance, size_t outputPortIndex) const { - if (mOutputPorts[outputPortIndex].GetAttribute(animGraphInstance) == nullptr) + if (m_outputPorts[outputPortIndex].GetAttribute(animGraphInstance) == nullptr) { return nullptr; } - MCORE_ASSERT(mOutputPorts[outputPortIndex].mCompatibleTypes[0] == AttributeMotionInstance::TYPE_ID); - return static_cast(mOutputPorts[outputPortIndex].GetAttribute(animGraphInstance)); + MCORE_ASSERT(m_outputPorts[outputPortIndex].m_compatibleTypes[0] == AttributeMotionInstance::TYPE_ID); + return static_cast(m_outputPorts[outputPortIndex].GetAttribute(animGraphInstance)); } void SetupInputPortAsNumber(const char* name, size_t inputPortNr, uint32 portID); @@ -797,10 +797,10 @@ namespace EMotionFX virtual void RecursiveResetFlags(AnimGraphInstance* animGraphInstance, uint32 flagsToReset = 0xffffffff); - const AZStd::vector& GetInputPorts() const { return mInputPorts; } - const AZStd::vector& GetOutputPorts() const { return mOutputPorts; } - void SetInputPorts(const AZStd::vector& inputPorts) { mInputPorts = inputPorts; } - void SetOutputPorts(const AZStd::vector& outputPorts) { mOutputPorts = outputPorts; } + const AZStd::vector& GetInputPorts() const { return m_inputPorts; } + const AZStd::vector& GetOutputPorts() const { return m_outputPorts; } + void SetInputPorts(const AZStd::vector& inputPorts) { m_inputPorts = inputPorts; } + void SetOutputPorts(const AZStd::vector& outputPorts) { m_outputPorts = outputPorts; } void InitInputPorts(size_t numPorts); void InitOutputPorts(size_t numPorts); void SetInputPortName(size_t portIndex, const char* name); @@ -810,19 +810,19 @@ namespace EMotionFX size_t AddOutputPort(); size_t AddInputPort(); virtual bool GetIsStateTransitionNode() const { return false; } - MCORE_INLINE MCore::Attribute* GetOutputValue(AnimGraphInstance* animGraphInstance, size_t portIndex) const { return animGraphInstance->GetInternalAttribute(mOutputPorts[portIndex].mAttributeIndex); } - MCORE_INLINE Port& GetInputPort(size_t index) { return mInputPorts[index]; } - MCORE_INLINE Port& GetOutputPort(size_t index) { return mOutputPorts[index]; } - MCORE_INLINE const Port& GetInputPort(size_t index) const { return mInputPorts[index]; } - MCORE_INLINE const Port& GetOutputPort(size_t index) const { return mOutputPorts[index]; } + MCORE_INLINE MCore::Attribute* GetOutputValue(AnimGraphInstance* animGraphInstance, size_t portIndex) const { return animGraphInstance->GetInternalAttribute(m_outputPorts[portIndex].m_attributeIndex); } + MCORE_INLINE Port& GetInputPort(size_t index) { return m_inputPorts[index]; } + MCORE_INLINE Port& GetOutputPort(size_t index) { return m_outputPorts[index]; } + MCORE_INLINE const Port& GetInputPort(size_t index) const { return m_inputPorts[index]; } + MCORE_INLINE const Port& GetOutputPort(size_t index) const { return m_outputPorts[index]; } void RelinkPortConnections(); - MCORE_INLINE size_t GetNumConnections() const { return mConnections.size(); } - MCORE_INLINE BlendTreeConnection* GetConnection(size_t index) const { return mConnections[index]; } - const AZStd::vector& GetConnections() const { return mConnections; } + MCORE_INLINE size_t GetNumConnections() const { return m_connections.size(); } + MCORE_INLINE BlendTreeConnection* GetConnection(size_t index) const { return m_connections[index]; } + const AZStd::vector& GetConnections() const { return m_connections; } - AZ_FORCE_INLINE AnimGraphNode* GetParentNode() const { return mParentNode; } - AZ_FORCE_INLINE void SetParentNode(AnimGraphNode* node) { mParentNode = node; } + AZ_FORCE_INLINE AnimGraphNode* GetParentNode() const { return m_parentNode; } + AZ_FORCE_INLINE void SetParentNode(AnimGraphNode* node) { m_parentNode = node; } /** * Check if the given node is the parent or the parent of the parent etc. of the node. @@ -880,9 +880,9 @@ namespace EMotionFX void CopyBaseNodeTo(AnimGraphNode* node) const; - MCORE_INLINE size_t GetNumChildNodes() const { return mChildNodes.size(); } - MCORE_INLINE AnimGraphNode* GetChildNode(size_t index) const { return mChildNodes[index]; } - const AZStd::vector& GetChildNodes() const { return mChildNodes; } + MCORE_INLINE size_t GetNumChildNodes() const { return m_childNodes.size(); } + MCORE_INLINE AnimGraphNode* GetChildNode(size_t index) const { return m_childNodes[index]; } + const AZStd::vector& GetChildNodes() const { return m_childNodes; } void SetNodeInfo(const AZStd::string& info); const AZStd::string& GetNodeInfo() const; @@ -924,8 +924,8 @@ namespace EMotionFX bool GetCanVisualize(AnimGraphInstance* animGraphInstance) const; - MCORE_INLINE size_t GetNodeIndex() const { return mNodeIndex; } - MCORE_INLINE void SetNodeIndex(size_t index) { mNodeIndex = index; } + MCORE_INLINE size_t GetNodeIndex() const { return m_nodeIndex; } + MCORE_INLINE void SetNodeIndex(size_t index) { m_nodeIndex = index; } void ResetPoseRefCount(AnimGraphInstance* animGraphInstance); MCORE_INLINE void IncreasePoseRefCount(AnimGraphInstance* animGraphInstance) { FindOrCreateUniqueNodeData(animGraphInstance)->IncreasePoseRefCount(); } @@ -944,23 +944,23 @@ namespace EMotionFX static void Reflect(AZ::ReflectContext* context); protected: - size_t mNodeIndex; + size_t m_nodeIndex; AZ::u64 m_id; - AZStd::vector mConnections; - AZStd::vector mInputPorts; - AZStd::vector mOutputPorts; - AZStd::vector mChildNodes; + AZStd::vector m_connections; + AZStd::vector m_inputPorts; + AZStd::vector m_outputPorts; + AZStd::vector m_childNodes; TriggerActionSetup m_actionSetup; - AnimGraphNode* mParentNode; - void* mCustomData; - AZ::Color mVisualizeColor; + AnimGraphNode* m_parentNode; + void* m_customData; + AZ::Color m_visualizeColor; AZStd::string m_name; - AZStd::string mNodeInfo; - int32 mPosX; - int32 mPosY; - bool mDisabled; - bool mVisEnabled; - bool mIsCollapsed; + AZStd::string m_nodeInfo; + int32 m_posX; + int32 m_posY; + bool m_disabled; + bool m_visEnabled; + bool m_isCollapsed; virtual void Output(AnimGraphInstance* animGraphInstance); virtual void TopDownUpdate(AnimGraphInstance* animGraphInstance, float timePassedInSeconds); diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphNodeData.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphNodeData.cpp index a787dd25a2..b329928c39 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphNodeData.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphNodeData.cpp @@ -20,19 +20,19 @@ namespace EMotionFX // constructor AnimGraphNodeData::AnimGraphNodeData(AnimGraphNode* node, AnimGraphInstance* animGraphInstance) : AnimGraphObjectData(reinterpret_cast(node), animGraphInstance) - , mDuration(0.0f) - , mCurrentTime(0.0f) - , mPlaySpeed(1.0f) - , mPreSyncTime(0.0f) - , mGlobalWeight(1.0f) - , mLocalWeight(1.0f) - , mSyncIndex(InvalidIndex) - , mPoseRefCount(0) - , mRefDataRefCount(0) - , mInheritFlags(0) + , m_duration(0.0f) + , m_currentTime(0.0f) + , m_playSpeed(1.0f) + , m_preSyncTime(0.0f) + , m_globalWeight(1.0f) + , m_localWeight(1.0f) + , m_syncIndex(InvalidIndex) + , m_poseRefCount(0) + , m_refDataRefCount(0) + , m_inheritFlags(0) , m_isMirrorMotion(false) - , mRefCountedData(nullptr) - , mSyncTrack(nullptr) + , m_refCountedData(nullptr) + , m_syncTrack(nullptr) { } @@ -47,16 +47,16 @@ namespace EMotionFX // reset the sync related data void AnimGraphNodeData::Clear() { - mDuration = 0.0f; - mCurrentTime = 0.0f; - mPreSyncTime = 0.0f; - mPlaySpeed = 1.0f; - mGlobalWeight = 1.0f; - mLocalWeight = 1.0f; - mInheritFlags = 0; + m_duration = 0.0f; + m_currentTime = 0.0f; + m_preSyncTime = 0.0f; + m_playSpeed = 1.0f; + m_globalWeight = 1.0f; + m_localWeight = 1.0f; + m_inheritFlags = 0; m_isMirrorMotion = false; - mSyncIndex = InvalidIndex; - mSyncTrack = nullptr; + m_syncIndex = InvalidIndex; + m_syncTrack = nullptr; } @@ -70,15 +70,15 @@ namespace EMotionFX // init from existing node data void AnimGraphNodeData::Init(AnimGraphNodeData* nodeData) { - mDuration = nodeData->mDuration; - mCurrentTime = nodeData->mCurrentTime; - mPreSyncTime = nodeData->mPreSyncTime; - mPlaySpeed = nodeData->mPlaySpeed; - mSyncIndex = nodeData->mSyncIndex; - mGlobalWeight = nodeData->mGlobalWeight; - mInheritFlags = nodeData->mInheritFlags; + m_duration = nodeData->m_duration; + m_currentTime = nodeData->m_currentTime; + m_preSyncTime = nodeData->m_preSyncTime; + m_playSpeed = nodeData->m_playSpeed; + m_syncIndex = nodeData->m_syncIndex; + m_globalWeight = nodeData->m_globalWeight; + m_inheritFlags = nodeData->m_inheritFlags; m_isMirrorMotion = nodeData->m_isMirrorMotion; - mSyncTrack = nodeData->mSyncTrack; + m_syncTrack = nodeData->m_syncTrack; } diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphNodeData.h b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphNodeData.h index 68d49ca511..1ad82b1d55 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphNodeData.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphNodeData.h @@ -51,70 +51,70 @@ namespace EMotionFX void Init(AnimGraphInstance* animGraphInstance, AnimGraphNode* node); void Init(AnimGraphNodeData* nodeData); - MCORE_INLINE AnimGraphNode* GetNode() const { return reinterpret_cast(mObject); } - MCORE_INLINE void SetNode(AnimGraphNode* node) { mObject = reinterpret_cast(node); } + MCORE_INLINE AnimGraphNode* GetNode() const { return reinterpret_cast(m_object); } + MCORE_INLINE void SetNode(AnimGraphNode* node) { m_object = reinterpret_cast(node); } - MCORE_INLINE void SetSyncIndex(size_t syncIndex) { mSyncIndex = syncIndex; } - MCORE_INLINE size_t GetSyncIndex() const { return mSyncIndex; } + MCORE_INLINE void SetSyncIndex(size_t syncIndex) { m_syncIndex = syncIndex; } + MCORE_INLINE size_t GetSyncIndex() const { return m_syncIndex; } - MCORE_INLINE void SetCurrentPlayTime(float absoluteTime) { mCurrentTime = absoluteTime; } - MCORE_INLINE float GetCurrentPlayTime() const { return mCurrentTime; } + MCORE_INLINE void SetCurrentPlayTime(float absoluteTime) { m_currentTime = absoluteTime; } + MCORE_INLINE float GetCurrentPlayTime() const { return m_currentTime; } - MCORE_INLINE void SetPlaySpeed(float speed) { mPlaySpeed = speed; } - MCORE_INLINE float GetPlaySpeed() const { return mPlaySpeed; } + MCORE_INLINE void SetPlaySpeed(float speed) { m_playSpeed = speed; } + MCORE_INLINE float GetPlaySpeed() const { return m_playSpeed; } - MCORE_INLINE void SetDuration(float durationInSeconds) { mDuration = durationInSeconds; } - MCORE_INLINE float GetDuration() const { return mDuration; } + MCORE_INLINE void SetDuration(float durationInSeconds) { m_duration = durationInSeconds; } + MCORE_INLINE float GetDuration() const { return m_duration; } - MCORE_INLINE void SetPreSyncTime(float timeInSeconds) { mPreSyncTime = timeInSeconds; } - MCORE_INLINE float GetPreSyncTime() const { return mPreSyncTime; } + MCORE_INLINE void SetPreSyncTime(float timeInSeconds) { m_preSyncTime = timeInSeconds; } + MCORE_INLINE float GetPreSyncTime() const { return m_preSyncTime; } - MCORE_INLINE void SetGlobalWeight(float weight) { mGlobalWeight = weight; } - MCORE_INLINE float GetGlobalWeight() const { return mGlobalWeight; } + MCORE_INLINE void SetGlobalWeight(float weight) { m_globalWeight = weight; } + MCORE_INLINE float GetGlobalWeight() const { return m_globalWeight; } - MCORE_INLINE void SetLocalWeight(float weight) { mLocalWeight = weight; } - MCORE_INLINE float GetLocalWeight() const { return mLocalWeight; } + MCORE_INLINE void SetLocalWeight(float weight) { m_localWeight = weight; } + MCORE_INLINE float GetLocalWeight() const { return m_localWeight; } - MCORE_INLINE uint8 GetInheritFlags() const { return mInheritFlags; } + MCORE_INLINE uint8 GetInheritFlags() const { return m_inheritFlags; } - MCORE_INLINE bool GetIsBackwardPlaying() const { return (mInheritFlags & INHERITFLAGS_BACKWARD) != 0; } - MCORE_INLINE void SetBackwardFlag() { mInheritFlags |= INHERITFLAGS_BACKWARD; } - MCORE_INLINE void ClearInheritFlags() { mInheritFlags = 0; } + MCORE_INLINE bool GetIsBackwardPlaying() const { return (m_inheritFlags & INHERITFLAGS_BACKWARD) != 0; } + MCORE_INLINE void SetBackwardFlag() { m_inheritFlags |= INHERITFLAGS_BACKWARD; } + MCORE_INLINE void ClearInheritFlags() { m_inheritFlags = 0; } - MCORE_INLINE uint8 GetPoseRefCount() const { return mPoseRefCount; } - MCORE_INLINE void IncreasePoseRefCount() { mPoseRefCount++; } - MCORE_INLINE void DecreasePoseRefCount() { mPoseRefCount--; } - MCORE_INLINE void SetPoseRefCount(uint8 refCount) { mPoseRefCount = refCount; } + MCORE_INLINE uint8 GetPoseRefCount() const { return m_poseRefCount; } + MCORE_INLINE void IncreasePoseRefCount() { m_poseRefCount++; } + MCORE_INLINE void DecreasePoseRefCount() { m_poseRefCount--; } + MCORE_INLINE void SetPoseRefCount(uint8 refCount) { m_poseRefCount = refCount; } - MCORE_INLINE uint8 GetRefDataRefCount() const { return mRefDataRefCount; } - MCORE_INLINE void IncreaseRefDataRefCount() { mRefDataRefCount++; } - MCORE_INLINE void DecreaseRefDataRefCount() { mRefDataRefCount--; } - MCORE_INLINE void SetRefDataRefCount(uint8 refCount) { mRefDataRefCount = refCount; } + MCORE_INLINE uint8 GetRefDataRefCount() const { return m_refDataRefCount; } + MCORE_INLINE void IncreaseRefDataRefCount() { m_refDataRefCount++; } + MCORE_INLINE void DecreaseRefDataRefCount() { m_refDataRefCount--; } + MCORE_INLINE void SetRefDataRefCount(uint8 refCount) { m_refDataRefCount = refCount; } - MCORE_INLINE void SetRefCountedData(AnimGraphRefCountedData* data) { mRefCountedData = data; } - MCORE_INLINE AnimGraphRefCountedData* GetRefCountedData() const { return mRefCountedData; } + MCORE_INLINE void SetRefCountedData(AnimGraphRefCountedData* data) { m_refCountedData = data; } + MCORE_INLINE AnimGraphRefCountedData* GetRefCountedData() const { return m_refCountedData; } - MCORE_INLINE const AnimGraphSyncTrack* GetSyncTrack() const { return mSyncTrack; } - MCORE_INLINE AnimGraphSyncTrack* GetSyncTrack() { return mSyncTrack; } - MCORE_INLINE void SetSyncTrack(AnimGraphSyncTrack* syncTrack) { mSyncTrack = syncTrack; } + MCORE_INLINE const AnimGraphSyncTrack* GetSyncTrack() const { return m_syncTrack; } + MCORE_INLINE AnimGraphSyncTrack* GetSyncTrack() { return m_syncTrack; } + MCORE_INLINE void SetSyncTrack(AnimGraphSyncTrack* syncTrack) { m_syncTrack = syncTrack; } bool GetIsMirrorMotion() const { return m_isMirrorMotion; } void SetIsMirrorMotion(bool newValue) { m_isMirrorMotion = newValue; } protected: - float mDuration; - float mCurrentTime; - float mPlaySpeed; - float mPreSyncTime; - float mGlobalWeight; - float mLocalWeight; - size_t mSyncIndex; /**< The last used sync track index. */ - uint8 mPoseRefCount; - uint8 mRefDataRefCount; - uint8 mInheritFlags; + float m_duration; + float m_currentTime; + float m_playSpeed; + float m_preSyncTime; + float m_globalWeight; + float m_localWeight; + size_t m_syncIndex; /**< The last used sync track index. */ + uint8 m_poseRefCount; + uint8 m_refDataRefCount; + uint8 m_inheritFlags; bool m_isMirrorMotion; - AnimGraphRefCountedData* mRefCountedData; - AnimGraphSyncTrack* mSyncTrack; + AnimGraphRefCountedData* m_refCountedData; + AnimGraphSyncTrack* m_syncTrack; void Delete() override; }; diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphNodeGroup.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphNodeGroup.cpp index a14401d3c8..f2958cdde4 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphNodeGroup.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphNodeGroup.cpp @@ -17,8 +17,8 @@ namespace EMotionFX AZ_CLASS_ALLOCATOR_IMPL(AnimGraphNodeGroup, AnimGraphAllocator, 0) AnimGraphNodeGroup::AnimGraphNodeGroup() - : mColor(AZ::Color::CreateU32(255, 255, 255, 255)) - , mIsVisible(true) + : m_color(AZ::Color::CreateU32(255, 255, 255, 255)) + , m_isVisible(true) { } @@ -26,7 +26,7 @@ namespace EMotionFX AnimGraphNodeGroup::AnimGraphNodeGroup(const char* groupName) { SetName(groupName); - mIsVisible = true; + m_isVisible = true; } @@ -34,7 +34,7 @@ namespace EMotionFX { SetName(groupName); SetNumNodes(numNodes); - mIsVisible = true; + m_isVisible = true; } @@ -46,7 +46,7 @@ namespace EMotionFX void AnimGraphNodeGroup::RemoveAllNodes() { - mNodeIds.clear(); + m_nodeIds.clear(); } @@ -55,11 +55,11 @@ namespace EMotionFX { if (groupName) { - mName = groupName; + m_name = groupName; } else { - mName.clear(); + m_name.clear(); } } @@ -67,63 +67,63 @@ namespace EMotionFX // get the name of the group as character buffer const char* AnimGraphNodeGroup::GetName() const { - return mName.c_str(); + return m_name.c_str(); } // get the name of the string as mcore string object const AZStd::string& AnimGraphNodeGroup::GetNameString() const { - return mName; + return m_name; } // set the color of the group void AnimGraphNodeGroup::SetColor(const AZ::u32& color) { - mColor = color; + m_color = color; } // get the color of the group AZ::u32 AnimGraphNodeGroup::GetColor() const { - return mColor; + return m_color; } // set the visibility flag void AnimGraphNodeGroup::SetIsVisible(bool isVisible) { - mIsVisible = isVisible; + m_isVisible = isVisible; } // set the number of nodes void AnimGraphNodeGroup::SetNumNodes(size_t numNodes) { - mNodeIds.resize(numNodes); + m_nodeIds.resize(numNodes); } // get the number of nodes size_t AnimGraphNodeGroup::GetNumNodes() const { - return mNodeIds.size(); + return m_nodeIds.size(); } // set a given node to a given node number void AnimGraphNodeGroup::SetNode(size_t index, AnimGraphNodeId nodeId) { - mNodeIds[index] = nodeId; + m_nodeIds[index] = nodeId; } // get the node number of a given index AnimGraphNodeId AnimGraphNodeGroup::GetNode(size_t index) const { - return mNodeIds[index]; + return m_nodeIds[index]; } @@ -133,7 +133,7 @@ namespace EMotionFX // add the node in case it is not in yet if (Contains(nodeId) == false) { - mNodeIds.push_back(nodeId); + m_nodeIds.push_back(nodeId); } } @@ -142,14 +142,14 @@ namespace EMotionFX void AnimGraphNodeGroup::RemoveNodeById(AnimGraphNodeId nodeId) { const AZ::u64 convertedId = nodeId; - mNodeIds.erase(AZStd::remove(mNodeIds.begin(), mNodeIds.end(), convertedId), mNodeIds.end()); + m_nodeIds.erase(AZStd::remove(m_nodeIds.begin(), m_nodeIds.end(), convertedId), m_nodeIds.end()); } // remove a given array element from the list of nodes void AnimGraphNodeGroup::RemoveNodeByGroupIndex(size_t index) { - mNodeIds.erase(mNodeIds.begin() + index); + m_nodeIds.erase(m_nodeIds.begin() + index); } @@ -157,23 +157,23 @@ namespace EMotionFX bool AnimGraphNodeGroup::Contains(AnimGraphNodeId nodeId) const { const AZ::u64 convertedId = nodeId; - return AZStd::find(mNodeIds.begin(), mNodeIds.end(), convertedId) != mNodeIds.end(); + return AZStd::find(m_nodeIds.begin(), m_nodeIds.end(), convertedId) != m_nodeIds.end(); } // init from another group void AnimGraphNodeGroup::InitFrom(const AnimGraphNodeGroup& other) { - mNodeIds = other.mNodeIds; - mColor = other.mColor; - mName = other.mName; - mIsVisible = other.mIsVisible; + m_nodeIds = other.m_nodeIds; + m_color = other.m_color; + m_name = other.m_name; + m_isVisible = other.m_isVisible; } bool AnimGraphNodeGroup::GetIsVisible() const { - return mIsVisible; + return m_isVisible; } @@ -187,9 +187,9 @@ namespace EMotionFX serializeContext->Class() ->Version(1) - ->Field("nodes", &AnimGraphNodeGroup::mNodeIds) - ->Field("name", &AnimGraphNodeGroup::mName) - ->Field("color", &AnimGraphNodeGroup::mColor) - ->Field("isVisible", &AnimGraphNodeGroup::mIsVisible); + ->Field("nodes", &AnimGraphNodeGroup::m_nodeIds) + ->Field("name", &AnimGraphNodeGroup::m_name) + ->Field("color", &AnimGraphNodeGroup::m_color) + ->Field("isVisible", &AnimGraphNodeGroup::m_isVisible); } } // namespace EMotionFX diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphNodeGroup.h b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphNodeGroup.h index 611cfd6824..7e1fc909e5 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphNodeGroup.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphNodeGroup.h @@ -165,9 +165,9 @@ namespace EMotionFX static void Reflect(AZ::ReflectContext* context); protected: - AZStd::vector mNodeIds; /**< The node ids that are inside this group. */ - AZStd::string mName; /**< The unique identification number for the node group name. */ - AZ::u32 mColor; /**< The color the nodes of the group will be filled with. */ - bool mIsVisible; + AZStd::vector m_nodeIds; /**< The node ids that are inside this group. */ + AZStd::string m_name; /**< The unique identification number for the node group name. */ + AZ::u32 m_color; /**< The color the nodes of the group will be filled with. */ + bool m_isVisible; }; } // namespace EMotionFX diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphObject.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphObject.cpp index 7b4afbd38a..6bee03f0ae 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphObject.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphObject.cpp @@ -27,8 +27,8 @@ namespace EMotionFX AZ_CLASS_ALLOCATOR_IMPL(AnimGraphObject, AnimGraphAllocator, 0) AnimGraphObject::AnimGraphObject() - : mAnimGraph(nullptr) - , mObjectIndex(MCORE_INVALIDINDEX32) + : m_animGraph(nullptr) + , m_objectIndex(MCORE_INVALIDINDEX32) { } @@ -36,7 +36,7 @@ namespace EMotionFX AnimGraphObject::AnimGraphObject(AnimGraph* animGraph) : AnimGraphObject() { - mAnimGraph = animGraph; + m_animGraph = animGraph; } @@ -124,17 +124,17 @@ namespace EMotionFX void AnimGraphObject::InvalidateUniqueDatas() { AnimGraphObject* object = this; - const size_t numAnimGraphInstances = mAnimGraph->GetNumAnimGraphInstances(); + const size_t numAnimGraphInstances = m_animGraph->GetNumAnimGraphInstances(); for (size_t i = 0; i < numAnimGraphInstances; ++i) { - AnimGraphInstance* animGraphInstance = mAnimGraph->GetAnimGraphInstance(i); + AnimGraphInstance* animGraphInstance = m_animGraph->GetAnimGraphInstance(i); object->InvalidateUniqueData(animGraphInstance); } } void AnimGraphObject::InvalidateUniqueData(AnimGraphInstance* animGraphInstance) { - AnimGraphObjectData* uniqueData = animGraphInstance->GetUniqueObjectData(mObjectIndex); + AnimGraphObjectData* uniqueData = animGraphInstance->GetUniqueObjectData(m_objectIndex); if (uniqueData) { uniqueData->Invalidate(); @@ -143,7 +143,7 @@ namespace EMotionFX void AnimGraphObject::ResetUniqueData(AnimGraphInstance* animGraphInstance) { - AnimGraphObjectData* uniqueData = animGraphInstance->GetUniqueObjectData(mObjectIndex); + AnimGraphObjectData* uniqueData = animGraphInstance->GetUniqueObjectData(m_objectIndex); if (uniqueData) { uniqueData->Reset(); @@ -153,10 +153,10 @@ namespace EMotionFX void AnimGraphObject::ResetUniqueDatas() { AnimGraphObject* object = this; - const size_t numAnimGraphInstances = mAnimGraph->GetNumAnimGraphInstances(); + const size_t numAnimGraphInstances = m_animGraph->GetNumAnimGraphInstances(); for (size_t i = 0; i < numAnimGraphInstances; ++i) { - AnimGraphInstance* animGraphInstance = mAnimGraph->GetAnimGraphInstance(i); + AnimGraphInstance* animGraphInstance = m_animGraph->GetAnimGraphInstance(i); object->ResetUniqueData(animGraphInstance); } } @@ -165,7 +165,7 @@ namespace EMotionFX void AnimGraphObject::Update(AnimGraphInstance* animGraphInstance, float timePassedInSeconds) { MCORE_UNUSED(timePassedInSeconds); - animGraphInstance->EnableObjectFlags(mObjectIndex, AnimGraphInstance::OBJECTFLAGS_UPDATE_READY); + animGraphInstance->EnableObjectFlags(m_objectIndex, AnimGraphInstance::OBJECTFLAGS_UPDATE_READY); } void AnimGraphObject::Reinit() @@ -230,15 +230,15 @@ namespace EMotionFX // does the init for all anim graph instances in the parent animgraph void AnimGraphObject::InitInternalAttributesForAllInstances() { - if (mAnimGraph == nullptr) + if (m_animGraph == nullptr) { return; } - const size_t numInstances = mAnimGraph->GetNumAnimGraphInstances(); + const size_t numInstances = m_animGraph->GetNumAnimGraphInstances(); for (size_t i = 0; i < numInstances; ++i) { - InitInternalAttributes(mAnimGraph->GetAnimGraphInstance(i)); + InitInternalAttributes(m_animGraph->GetAnimGraphInstance(i)); } } diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphObject.h b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphObject.h index 32905d66a7..ebc92964b0 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphObject.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphObject.h @@ -144,11 +144,11 @@ namespace EMotionFX virtual void RecursiveOnChangeMotionSet(AnimGraphInstance* animGraphInstance, MotionSet* newMotionSet) { MCORE_UNUSED(animGraphInstance); MCORE_UNUSED(newMotionSet); } virtual void OnActorMotionExtractionNodeChanged() {} - MCORE_INLINE size_t GetObjectIndex() const { return mObjectIndex; } - MCORE_INLINE void SetObjectIndex(size_t index) { mObjectIndex = index; } + MCORE_INLINE size_t GetObjectIndex() const { return m_objectIndex; } + MCORE_INLINE void SetObjectIndex(size_t index) { m_objectIndex = index; } - MCORE_INLINE AnimGraph* GetAnimGraph() const { return mAnimGraph; } - MCORE_INLINE void SetAnimGraph(AnimGraph* animGraph) { mAnimGraph = animGraph; } + MCORE_INLINE AnimGraph* GetAnimGraph() const { return m_animGraph; } + MCORE_INLINE void SetAnimGraph(AnimGraph* animGraph) { m_animGraph = animGraph; } size_t SaveUniqueData(AnimGraphInstance* animGraphInstance, uint8* outputBuffer) const; // save and return number of bytes written, when outputBuffer is nullptr only return num bytes it would write size_t LoadUniqueData(AnimGraphInstance* animGraphInstance, const uint8* dataBuffer); // load and return number of bytes read, when dataBuffer is nullptr, 0 should be returned @@ -166,8 +166,8 @@ namespace EMotionFX static void Reflect(AZ::ReflectContext* context); protected: - AnimGraph* mAnimGraph; - size_t mObjectIndex; + AnimGraph* m_animGraph; + size_t m_objectIndex; }; } // namespace EMotionFX diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphObjectData.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphObjectData.cpp index 3434294747..9c3a7022d1 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphObjectData.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphObjectData.cpp @@ -20,9 +20,9 @@ namespace EMotionFX AnimGraphObjectData::AnimGraphObjectData(AnimGraphObject* object, AnimGraphInstance* animGraphInstance) : BaseObject() { - mObject = object; - mAnimGraphInstance = animGraphInstance; - mObjectFlags = 0; + m_object = object; + m_animGraphInstance = animGraphInstance; + m_objectFlags = 0; } AnimGraphObjectData::~AnimGraphObjectData() diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphObjectData.h b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphObjectData.h index e9cb1ea809..25f28282bd 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphObjectData.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphObjectData.h @@ -70,8 +70,8 @@ public: \ AnimGraphObjectData(AnimGraphObject* object, AnimGraphInstance* animGraphInstance); virtual ~AnimGraphObjectData(); - MCORE_INLINE AnimGraphObject* GetObject() const { return mObject; } - void SetObject(AnimGraphObject* object) { mObject = object; } + MCORE_INLINE AnimGraphObject* GetObject() const { return m_object; } + void SetObject(AnimGraphObject* object) { m_object = object; } // save and return number of bytes written, when outputBuffer is nullptr only return num bytes it would write virtual uint32 Save(uint8* outputBuffer) const; @@ -91,33 +91,33 @@ public: \ bool IsInvalidated() const { return m_invalidated; } void Validate() { m_invalidated = false; } - MCORE_INLINE uint8 GetObjectFlags() const { return mObjectFlags; } - MCORE_INLINE void SetObjectFlags(uint8 flags) { mObjectFlags = flags; } - MCORE_INLINE void EnableObjectFlags(uint8 flagsToEnable) { mObjectFlags |= flagsToEnable; } - MCORE_INLINE void DisableObjectFlags(uint8 flagsToDisable) { mObjectFlags &= ~flagsToDisable; } + MCORE_INLINE uint8 GetObjectFlags() const { return m_objectFlags; } + MCORE_INLINE void SetObjectFlags(uint8 flags) { m_objectFlags = flags; } + MCORE_INLINE void EnableObjectFlags(uint8 flagsToEnable) { m_objectFlags |= flagsToEnable; } + MCORE_INLINE void DisableObjectFlags(uint8 flagsToDisable) { m_objectFlags &= ~flagsToDisable; } MCORE_INLINE void SetObjectFlags(uint8 flags, bool enabled) { if (enabled) { - mObjectFlags |= flags; + m_objectFlags |= flags; } else { - mObjectFlags &= ~flags; + m_objectFlags &= ~flags; } } - MCORE_INLINE bool GetIsObjectFlagEnabled(uint8 flag) const { return (mObjectFlags & flag) != 0; } + MCORE_INLINE bool GetIsObjectFlagEnabled(uint8 flag) const { return (m_objectFlags & flag) != 0; } - MCORE_INLINE bool GetHasError() const { return (mObjectFlags & FLAGS_HAS_ERROR); } + MCORE_INLINE bool GetHasError() const { return (m_objectFlags & FLAGS_HAS_ERROR); } MCORE_INLINE void SetHasError(bool hasError) { SetObjectFlags(FLAGS_HAS_ERROR, hasError); } - AnimGraphInstance* GetAnimGraphInstance() { return mAnimGraphInstance; } - const AnimGraphInstance* GetAnimGraphInstance() const { return mAnimGraphInstance; } + AnimGraphInstance* GetAnimGraphInstance() { return m_animGraphInstance; } + const AnimGraphInstance* GetAnimGraphInstance() const { return m_animGraphInstance; } protected: - AnimGraphObject* mObject; /**< Pointer to the object where this data belongs to. */ - AnimGraphInstance* mAnimGraphInstance; /**< The animgraph instance where this unique data belongs to. */ - uint8 mObjectFlags; + AnimGraphObject* m_object; /**< Pointer to the object where this data belongs to. */ + AnimGraphInstance* m_animGraphInstance; /**< The animgraph instance where this unique data belongs to. */ + uint8 m_objectFlags; bool m_invalidated = true; }; diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphParameterAction.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphParameterAction.cpp index c1a35b9399..ec3eb91056 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphParameterAction.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphParameterAction.cpp @@ -46,10 +46,10 @@ namespace EMotionFX void AnimGraphParameterAction::Reinit() { // Find the parameter index for the given parameter name, to prevent string based lookups every frame - m_parameterIndex = mAnimGraph->FindValueParameterIndexByName(m_parameterName); + m_parameterIndex = m_animGraph->FindValueParameterIndexByName(m_parameterName); if (m_parameterIndex.IsSuccess()) { - m_valueParameter = mAnimGraph->FindValueParameter(m_parameterIndex.GetValue()); + m_valueParameter = m_animGraph->FindValueParameter(m_parameterIndex.GetValue()); } else { @@ -123,7 +123,7 @@ namespace EMotionFX void AnimGraphParameterAction::SetParameterName(const AZStd::string& parameterName) { m_parameterName = parameterName; - if (mAnimGraph) + if (m_animGraph) { Reinit(); } @@ -142,7 +142,7 @@ namespace EMotionFX if (m_parameterIndex.IsSuccess()) { // get access to the parameter info and return the type of its default value - const ValueParameter* valueParameter = mAnimGraph->FindValueParameter(m_parameterIndex.GetValue()); + const ValueParameter* valueParameter = m_animGraph->FindValueParameter(m_parameterIndex.GetValue()); return azrtti_typeid(valueParameter); } else @@ -186,7 +186,7 @@ namespace EMotionFX { AZ_UNUSED(beforeChange); AZ_UNUSED(afterChange); - m_parameterIndex = mAnimGraph->FindValueParameterIndexByName(m_parameterName); + m_parameterIndex = m_animGraph->FindValueParameterIndexByName(m_parameterName); } void AnimGraphParameterAction::ParameterRemoved(const AZStd::string& oldParameterName) @@ -198,7 +198,7 @@ namespace EMotionFX } else { - m_parameterIndex = mAnimGraph->FindValueParameterIndexByName(m_parameterName); + m_parameterIndex = m_animGraph->FindValueParameterIndexByName(m_parameterName); } } diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphParameterCondition.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphParameterCondition.cpp index 052175eb92..c79a24690c 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphParameterCondition.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphParameterCondition.cpp @@ -78,7 +78,7 @@ namespace EMotionFX void AnimGraphParameterCondition::Reinit() { // Find the parameter index for the given parameter name, to prevent string based lookups every frame - m_parameterIndex = mAnimGraph->FindValueParameterIndexByName(m_parameterName); + m_parameterIndex = m_animGraph->FindValueParameterIndexByName(m_parameterName); SetFunction(m_function); } @@ -114,7 +114,7 @@ namespace EMotionFX void AnimGraphParameterCondition::SetParameterName(const AZStd::string& parameterName) { m_parameterName = parameterName; - if (mAnimGraph) + if (m_animGraph) { Reinit(); } @@ -131,7 +131,7 @@ namespace EMotionFX if (m_parameterIndex.IsSuccess()) { // get access to the parameter info and return the type of its default value - const ValueParameter* valueParameter = mAnimGraph->FindValueParameter(m_parameterIndex.GetValue()); + const ValueParameter* valueParameter = m_animGraph->FindValueParameter(m_parameterIndex.GetValue()); return azrtti_typeid(valueParameter); } return AZ::TypeId::CreateNull(); @@ -144,7 +144,7 @@ namespace EMotionFX return false; } - const ValueParameter* valueParameter = mAnimGraph->FindValueParameter(m_parameterIndex.GetValue()); + const ValueParameter* valueParameter = m_animGraph->FindValueParameter(m_parameterIndex.GetValue()); if (!valueParameter) { return false; @@ -500,7 +500,7 @@ namespace EMotionFX if (!newParameterMask.empty()) { m_parameterName = *newParameterMask.begin(); - m_parameterIndex = mAnimGraph->FindValueParameterIndexByName(m_parameterName); + m_parameterIndex = m_animGraph->FindValueParameterIndexByName(m_parameterName); } } @@ -514,7 +514,7 @@ namespace EMotionFX { AZ_UNUSED(newParameterName); // Just recompute the index in the case the new parameter was inserted before ours - m_parameterIndex = mAnimGraph->FindValueParameterIndexByName(m_parameterName); + m_parameterIndex = m_animGraph->FindValueParameterIndexByName(m_parameterName); } void AnimGraphParameterCondition::ParameterRenamed(const AZStd::string& oldParameterName, const AZStd::string& newParameterName) @@ -530,7 +530,7 @@ namespace EMotionFX AZ_UNUSED(beforeChange); AZ_UNUSED(afterChange); // Just recompute the index - m_parameterIndex = mAnimGraph->FindValueParameterIndexByName(m_parameterName); + m_parameterIndex = m_animGraph->FindValueParameterIndexByName(m_parameterName); } void AnimGraphParameterCondition::ParameterRemoved(const AZStd::string& oldParameterName) @@ -542,7 +542,7 @@ namespace EMotionFX } else { - m_parameterIndex = mAnimGraph->FindValueParameterIndexByName(m_parameterName); + m_parameterIndex = m_animGraph->FindValueParameterIndexByName(m_parameterName); } } diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphPlayTimeCondition.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphPlayTimeCondition.cpp index 1a80a5a09b..125491dc21 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphPlayTimeCondition.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphPlayTimeCondition.cpp @@ -56,7 +56,7 @@ namespace EMotionFX return; } - m_node = mAnimGraph->RecursiveFindNodeById(m_nodeId); + m_node = m_animGraph->RecursiveFindNodeById(m_nodeId); } @@ -181,7 +181,7 @@ namespace EMotionFX void AnimGraphPlayTimeCondition::SetNodeId(AnimGraphNodeId nodeId) { m_nodeId = nodeId; - if (mAnimGraph) + if (m_animGraph) { Reinit(); } diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphPose.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphPose.cpp index 7918d73c3c..595f434c1c 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphPose.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphPose.cpp @@ -18,16 +18,15 @@ namespace EMotionFX // constructor AnimGraphPose::AnimGraphPose() { - mFlags = 0; + m_flags = 0; } // copy constructor AnimGraphPose::AnimGraphPose(const AnimGraphPose& other) { - mFlags = 0; - mPose.InitFromPose(&other.mPose); - //mFlags = other.mFlags; + m_flags = 0; + m_pose.InitFromPose(&other.m_pose); } @@ -40,8 +39,7 @@ namespace EMotionFX // = operator AnimGraphPose& AnimGraphPose::operator=(const AnimGraphPose& other) { - mPose.InitFromPose(&other.mPose); - //mFlags = other.mFlags; + m_pose.InitFromPose(&other.m_pose); return *this; } @@ -50,7 +48,7 @@ namespace EMotionFX void AnimGraphPose::LinkToActorInstance(const ActorInstance* actorInstance) { // resize the transformation buffer, which contains the local space transformations - mPose.LinkToActorInstance(actorInstance); + m_pose.LinkToActorInstance(actorInstance); } @@ -61,7 +59,7 @@ namespace EMotionFX LinkToActorInstance(actorInstance); // fill the local pose with the bind pose - mPose.InitFromBindPose(actorInstance); + m_pose.InitFromBindPose(actorInstance); } } // namespace EMotionFX diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphPose.h b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphPose.h index a2b21aec6a..b46faddf7f 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphPose.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphPose.h @@ -39,29 +39,29 @@ namespace EMotionFX void LinkToActorInstance(const ActorInstance* actorInstance); void InitFromBindPose(const ActorInstance* actorInstance); - MCORE_INLINE size_t GetNumNodes() const { return mPose.GetNumTransforms(); } - MCORE_INLINE const Pose& GetPose() const { return mPose; } - MCORE_INLINE Pose& GetPose() { return mPose; } - MCORE_INLINE void SetPose(const Pose& pose) { mPose = pose; } - MCORE_INLINE const ActorInstance* GetActorInstance() const { return mPose.GetActorInstance(); } + MCORE_INLINE size_t GetNumNodes() const { return m_pose.GetNumTransforms(); } + MCORE_INLINE const Pose& GetPose() const { return m_pose; } + MCORE_INLINE Pose& GetPose() { return m_pose; } + MCORE_INLINE void SetPose(const Pose& pose) { m_pose = pose; } + MCORE_INLINE const ActorInstance* GetActorInstance() const { return m_pose.GetActorInstance(); } - MCORE_INLINE bool GetIsInUse() const { return (mFlags & FLAG_INUSE); } + MCORE_INLINE bool GetIsInUse() const { return (m_flags & FLAG_INUSE); } MCORE_INLINE void SetIsInUse(bool inUse) { if (inUse) { - mFlags |= FLAG_INUSE; + m_flags |= FLAG_INUSE; } else { - mFlags &= ~FLAG_INUSE; + m_flags &= ~FLAG_INUSE; } } AnimGraphPose& operator=(const AnimGraphPose& other); private: - Pose mPose; /**< The pose, containing the node transformation. */ - uint8 mFlags; /**< The flags. */ + Pose m_pose; /**< The pose, containing the node transformation. */ + uint8 m_flags; /**< The flags. */ }; } // namespace EMotionFX diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphPosePool.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphPosePool.cpp index f7f3a6c0bf..4d9d2ca999 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphPosePool.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphPosePool.cpp @@ -16,10 +16,10 @@ namespace EMotionFX // constructor AnimGraphPosePool::AnimGraphPosePool() { - mPoses.reserve(12); - mFreePoses.reserve(12); + m_poses.reserve(12); + m_freePoses.reserve(12); Resize(8); - mMaxUsed = 0; + m_maxUsed = 0; } @@ -27,21 +27,21 @@ namespace EMotionFX AnimGraphPosePool::~AnimGraphPosePool() { // delete all poses - for (AnimGraphPose* pose : mPoses) + for (AnimGraphPose* pose : m_poses) { delete pose; } - mPoses.clear(); + m_poses.clear(); // clear the free array - mFreePoses.clear(); + m_freePoses.clear(); } // resize the number of poses in the pool void AnimGraphPosePool::Resize(size_t numPoses) { - const size_t numOldPoses = mPoses.size(); + const size_t numOldPoses = m_poses.size(); // if we will remove poses if (numPoses < numOldPoses) @@ -50,10 +50,10 @@ namespace EMotionFX const size_t numToRemove = numOldPoses - numPoses; for (size_t i = 0; i < numToRemove; ++i) { - AnimGraphPose* pose = mPoses.back(); - MCORE_ASSERT(AZStd::find(begin(mFreePoses), end(mFreePoses), pose) == end(mFreePoses)); // make sure the pose is not already in use + AnimGraphPose* pose = m_poses.back(); + MCORE_ASSERT(AZStd::find(begin(m_freePoses), end(m_freePoses), pose) == end(m_freePoses)); // make sure the pose is not already in use delete pose; - mPoses.erase(mFreePoses.end() - 1); + m_poses.erase(m_freePoses.end() - 1); } } else // we want to add new poses @@ -62,8 +62,8 @@ namespace EMotionFX for (size_t i = 0; i < numToAdd; ++i) { AnimGraphPose* newPose = new AnimGraphPose(); - mPoses.emplace_back(newPose); - mFreePoses.emplace_back(newPose); + m_poses.emplace_back(newPose); + m_freePoses.emplace_back(newPose); } } } @@ -73,22 +73,22 @@ namespace EMotionFX AnimGraphPose* AnimGraphPosePool::RequestPose(const ActorInstance* actorInstance) { // if we have no free poses left, allocate a new one - if (mFreePoses.empty()) + if (m_freePoses.empty()) { AnimGraphPose* newPose = new AnimGraphPose(); newPose->LinkToActorInstance(actorInstance); - mPoses.emplace_back(newPose); - mMaxUsed = AZStd::max(mMaxUsed, GetNumUsedPoses()); + m_poses.emplace_back(newPose); + m_maxUsed = AZStd::max(m_maxUsed, GetNumUsedPoses()); newPose->SetIsInUse(true); return newPose; } // request the last free pose - AnimGraphPose* pose = mFreePoses[mFreePoses.size() - 1]; + AnimGraphPose* pose = m_freePoses[m_freePoses.size() - 1]; //if (pose->GetActorInstance() != actorInstance) pose->LinkToActorInstance(actorInstance); - mFreePoses.pop_back(); // remove it from the list of free poses - mMaxUsed = AZStd::max(mMaxUsed, GetNumUsedPoses()); + m_freePoses.pop_back(); // remove it from the list of free poses + m_maxUsed = AZStd::max(m_maxUsed, GetNumUsedPoses()); pose->SetIsInUse(true); return pose; } @@ -97,8 +97,7 @@ namespace EMotionFX // free the pose again void AnimGraphPosePool::FreePose(AnimGraphPose* pose) { - //MCORE_ASSERT( mPoses.Contains(pose) ); - mFreePoses.emplace_back(pose); + m_freePoses.emplace_back(pose); pose->SetIsInUse(false); } @@ -106,7 +105,7 @@ namespace EMotionFX // free all poses void AnimGraphPosePool::FreeAllPoses() { - for (AnimGraphPose* curPose : mPoses) + for (AnimGraphPose* curPose : m_poses) { if (curPose->GetIsInUse()) { diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphPosePool.h b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphPosePool.h index 8148d88926..a7244e2dc2 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphPosePool.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphPosePool.h @@ -41,15 +41,15 @@ namespace EMotionFX void FreeAllPoses(); - MCORE_INLINE size_t GetNumFreePoses() const { return mFreePoses.size(); } - MCORE_INLINE size_t GetNumPoses() const { return mPoses.size(); } - MCORE_INLINE size_t GetNumUsedPoses() const { return mPoses.size() - mFreePoses.size(); } - MCORE_INLINE size_t GetNumMaxUsedPoses() const { return mMaxUsed; } - MCORE_INLINE void ResetMaxUsedPoses() { mMaxUsed = 0; } + MCORE_INLINE size_t GetNumFreePoses() const { return m_freePoses.size(); } + MCORE_INLINE size_t GetNumPoses() const { return m_poses.size(); } + MCORE_INLINE size_t GetNumUsedPoses() const { return m_poses.size() - m_freePoses.size(); } + MCORE_INLINE size_t GetNumMaxUsedPoses() const { return m_maxUsed; } + MCORE_INLINE void ResetMaxUsedPoses() { m_maxUsed = 0; } private: - AZStd::vector mPoses; - AZStd::vector mFreePoses; - size_t mMaxUsed; + AZStd::vector m_poses; + AZStd::vector m_freePoses; + size_t m_maxUsed; }; } // namespace EMotionFX diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphRefCountedData.h b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphRefCountedData.h index f3d04eeacb..2d4c1624ba 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphRefCountedData.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphRefCountedData.h @@ -29,24 +29,24 @@ namespace EMotionFX MCORE_INLINE AnimGraphRefCountedData() = default; MCORE_INLINE ~AnimGraphRefCountedData() = default; - MCORE_INLINE AnimGraphEventBuffer& GetEventBuffer() { return mEventBuffer; } - MCORE_INLINE const AnimGraphEventBuffer& GetEventBuffer() const { return mEventBuffer; } - MCORE_INLINE void SetEventBuffer(const AnimGraphEventBuffer& buf) { mEventBuffer = buf; } - MCORE_INLINE void ClearEventBuffer() { mEventBuffer.Clear(); } + MCORE_INLINE AnimGraphEventBuffer& GetEventBuffer() { return m_eventBuffer; } + MCORE_INLINE const AnimGraphEventBuffer& GetEventBuffer() const { return m_eventBuffer; } + MCORE_INLINE void SetEventBuffer(const AnimGraphEventBuffer& buf) { m_eventBuffer = buf; } + MCORE_INLINE void ClearEventBuffer() { m_eventBuffer.Clear(); } - MCORE_INLINE Transform& GetTrajectoryDelta() { return mTrajectoryDelta; } - MCORE_INLINE const Transform& GetTrajectoryDelta() const { return mTrajectoryDelta; } - MCORE_INLINE void SetTrajectoryDelta(const Transform& transform) { mTrajectoryDelta = transform; } + MCORE_INLINE Transform& GetTrajectoryDelta() { return m_trajectoryDelta; } + MCORE_INLINE const Transform& GetTrajectoryDelta() const { return m_trajectoryDelta; } + MCORE_INLINE void SetTrajectoryDelta(const Transform& transform) { m_trajectoryDelta = transform; } - MCORE_INLINE Transform& GetTrajectoryDeltaMirrored() { return mTrajectoryDeltaMirrored; } - MCORE_INLINE const Transform& GetTrajectoryDeltaMirrored() const { return mTrajectoryDeltaMirrored; } - MCORE_INLINE void SetTrajectoryDeltaMirrored(const Transform& tform) { mTrajectoryDeltaMirrored = tform; } + MCORE_INLINE Transform& GetTrajectoryDeltaMirrored() { return m_trajectoryDeltaMirrored; } + MCORE_INLINE const Transform& GetTrajectoryDeltaMirrored() const { return m_trajectoryDeltaMirrored; } + MCORE_INLINE void SetTrajectoryDeltaMirrored(const Transform& tform) { m_trajectoryDeltaMirrored = tform; } - MCORE_INLINE void ZeroTrajectoryDelta() { mTrajectoryDelta.IdentityWithZeroScale(); mTrajectoryDeltaMirrored.IdentityWithZeroScale(); } + MCORE_INLINE void ZeroTrajectoryDelta() { m_trajectoryDelta.IdentityWithZeroScale(); m_trajectoryDeltaMirrored.IdentityWithZeroScale(); } private: - AnimGraphEventBuffer mEventBuffer; - Transform mTrajectoryDelta = Transform::CreateIdentityWithZeroScale(); - Transform mTrajectoryDeltaMirrored = Transform::CreateIdentityWithZeroScale(); + AnimGraphEventBuffer m_eventBuffer; + Transform m_trajectoryDelta = Transform::CreateIdentityWithZeroScale(); + Transform m_trajectoryDeltaMirrored = Transform::CreateIdentityWithZeroScale(); }; } // namespace EMotionFX diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphRefCountedDataPool.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphRefCountedDataPool.cpp index 1a04f18375..4fdcaea7f6 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphRefCountedDataPool.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphRefCountedDataPool.cpp @@ -17,10 +17,10 @@ namespace EMotionFX // constructor AnimGraphRefCountedDataPool::AnimGraphRefCountedDataPool() { - mItems.reserve(32); - mFreeItems.reserve(32); + m_items.reserve(32); + m_freeItems.reserve(32); Resize(16); - mMaxUsed = 0; + m_maxUsed = 0; } @@ -28,21 +28,21 @@ namespace EMotionFX AnimGraphRefCountedDataPool::~AnimGraphRefCountedDataPool() { // delete all items - for (AnimGraphRefCountedData*& item : mItems) + for (AnimGraphRefCountedData*& item : m_items) { delete item; } - mItems.clear(); + m_items.clear(); // clear the free array - mFreeItems.clear(); + m_freeItems.clear(); } // resize the number of items in the pool void AnimGraphRefCountedDataPool::Resize(size_t numItems) { - const size_t numOldItems = mItems.size(); + const size_t numOldItems = m_items.size(); // if we will remove Items if (numItems < numOldItems) @@ -51,10 +51,10 @@ namespace EMotionFX const size_t numToRemove = numOldItems - numItems; for (size_t i = 0; i < numToRemove; ++i) { - AnimGraphRefCountedData* item = mItems.back(); - MCORE_ASSERT(AZStd::find(begin(mFreeItems), end(mFreeItems), item) != end(mFreeItems)); // make sure the Item is not already in use + AnimGraphRefCountedData* item = m_items.back(); + MCORE_ASSERT(AZStd::find(begin(m_freeItems), end(m_freeItems), item) != end(m_freeItems)); // make sure the Item is not already in use delete item; - mItems.erase(mItems.end() - 1); + m_items.erase(m_items.end() - 1); } } else // we want to add new Items @@ -63,8 +63,8 @@ namespace EMotionFX for (size_t i = 0; i < numToAdd; ++i) { AnimGraphRefCountedData* newItem = new AnimGraphRefCountedData(); - mItems.emplace_back(newItem); - mFreeItems.emplace_back(newItem); + m_items.emplace_back(newItem); + m_freeItems.emplace_back(newItem); } } } @@ -74,18 +74,18 @@ namespace EMotionFX AnimGraphRefCountedData* AnimGraphRefCountedDataPool::RequestNew() { // if we have no free items left, allocate a new one - if (mFreeItems.empty()) + if (m_freeItems.empty()) { AnimGraphRefCountedData* newItem = new AnimGraphRefCountedData(); - mItems.emplace_back(newItem); - mMaxUsed = AZStd::max(mMaxUsed, GetNumUsedItems()); + m_items.emplace_back(newItem); + m_maxUsed = AZStd::max(m_maxUsed, GetNumUsedItems()); return newItem; } // request the last free item - AnimGraphRefCountedData* item = mFreeItems[mFreeItems.size() - 1]; - mFreeItems.pop_back(); // remove it from the list of free Items - mMaxUsed = AZStd::max(mMaxUsed, GetNumUsedItems()); + AnimGraphRefCountedData* item = m_freeItems[m_freeItems.size() - 1]; + m_freeItems.pop_back(); // remove it from the list of free Items + m_maxUsed = AZStd::max(m_maxUsed, GetNumUsedItems()); return item; } @@ -93,7 +93,7 @@ namespace EMotionFX // free the item again void AnimGraphRefCountedDataPool::Free(AnimGraphRefCountedData* item) { - MCORE_ASSERT(AZStd::find(begin(mItems), end(mItems), item) != end(mItems)); - mFreeItems.emplace_back(item); + MCORE_ASSERT(AZStd::find(begin(m_items), end(m_items), item) != end(m_items)); + m_freeItems.emplace_back(item); } } // namespace EMotionFX diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphRefCountedDataPool.h b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphRefCountedDataPool.h index d05ea5b5a1..3a7c38ed00 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphRefCountedDataPool.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphRefCountedDataPool.h @@ -34,15 +34,15 @@ namespace EMotionFX AnimGraphRefCountedData* RequestNew(); void Free(AnimGraphRefCountedData* item); - MCORE_INLINE size_t GetNumFreeItems() const { return mFreeItems.size(); } - MCORE_INLINE size_t GetNumItems() const { return mItems.size(); } - MCORE_INLINE size_t GetNumUsedItems() const { return mItems.size() - mFreeItems.size(); } - MCORE_INLINE size_t GetNumMaxUsedItems() const { return mMaxUsed; } - MCORE_INLINE void ResetMaxUsedItems() { mMaxUsed = 0; } + MCORE_INLINE size_t GetNumFreeItems() const { return m_freeItems.size(); } + MCORE_INLINE size_t GetNumItems() const { return m_items.size(); } + MCORE_INLINE size_t GetNumUsedItems() const { return m_items.size() - m_freeItems.size(); } + MCORE_INLINE size_t GetNumMaxUsedItems() const { return m_maxUsed; } + MCORE_INLINE void ResetMaxUsedItems() { m_maxUsed = 0; } private: - AZStd::vector mItems; - AZStd::vector mFreeItems; - size_t mMaxUsed; + AZStd::vector m_items; + AZStd::vector m_freeItems; + size_t m_maxUsed; }; } // namespace EMotionFX diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphReferenceNode.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphReferenceNode.cpp index a1f9af2935..605810c5cc 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphReferenceNode.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphReferenceNode.cpp @@ -68,7 +68,7 @@ namespace EMotionFX void AnimGraphReferenceNode::UniqueData::Update() { - AnimGraphReferenceNode* referenceNode = azdynamic_cast(mObject); + AnimGraphReferenceNode* referenceNode = azdynamic_cast(m_object); AZ_Assert(referenceNode, "Unique data linked to incorrect node type."); MotionSet* motionSet = referenceNode->GetMotionSet(); @@ -116,10 +116,10 @@ namespace EMotionFX { // This node listens to changes in AnimGraph and MotionSet assets. We need to remove this node before disconnecting the asset bus to avoid the disconnect // removing the MotionSet which can in turn access this node that is being deleted. - if (mAnimGraph) + if (m_animGraph) { - mAnimGraph->RemoveObject(this); - mAnimGraph = nullptr; + m_animGraph->RemoveObject(this); + m_animGraph = nullptr; } AZ::Data::AssetBus::MultiHandler::BusDisconnect(); } @@ -296,9 +296,9 @@ namespace EMotionFX } // Update the values for attributes that are fed through a connection - AZ_Assert(mInputPorts.size() == m_parameterIndexByPortIndex.size(), "Expected m_parameterIndexByPortIndex and numInputPorts to be in sync"); + AZ_Assert(m_inputPorts.size() == m_parameterIndexByPortIndex.size(), "Expected m_parameterIndexByPortIndex and numInputPorts to be in sync"); - const uint32 numInputPorts = static_cast(mInputPorts.size()); + const uint32 numInputPorts = static_cast(m_inputPorts.size()); for (uint32 i = 0; i < numInputPorts; ++i) { MCore::Attribute* attribute = GetInputAttribute(animGraphInstance, i); // returns the attribute of the upstream side of the connection @@ -437,7 +437,7 @@ namespace EMotionFX AnimGraph* referencedAnimGraph = GetReferencedAnimGraph(); if (referencedAnimGraph) { - UniqueData* uniqueData = static_cast(animGraphInstance->GetUniqueObjectData(mObjectIndex)); + UniqueData* uniqueData = static_cast(animGraphInstance->GetUniqueObjectData(m_objectIndex)); if (uniqueData && uniqueData->m_referencedAnimGraphInstance) { uniqueData->m_referencedAnimGraphInstance->RecursiveInvalidateUniqueDatas(); @@ -531,10 +531,10 @@ namespace EMotionFX // Use an anim graph instance to recursively go through the parents. If we hit a parent that is referenceAnimGraph, // that means that the child we are about to add is a parent, therefore a cycle - const size_t numAnimGraphInstances = mAnimGraph->GetNumAnimGraphInstances(); + const size_t numAnimGraphInstances = m_animGraph->GetNumAnimGraphInstances(); if (numAnimGraphInstances > 0) { - AnimGraphInstance* animGraphInstance = mAnimGraph->GetAnimGraphInstance(0); + AnimGraphInstance* animGraphInstance = m_animGraph->GetAnimGraphInstance(0); do { if (animGraphInstance->GetAnimGraph() == referenceAnimGraph) @@ -627,11 +627,11 @@ namespace EMotionFX { // Inform the unique datas as well as other systems about the changed anim graph asset, destroy and nullptr the reference // anim graph instances so that we don't try to update an anim graph instance or while the asset already got destructed. - const size_t numAnimGraphInstances = mAnimGraph->GetNumAnimGraphInstances(); + const size_t numAnimGraphInstances = m_animGraph->GetNumAnimGraphInstances(); for (size_t i = 0; i < numAnimGraphInstances; ++i) { - AnimGraphInstance* animGraphInstance = mAnimGraph->GetAnimGraphInstance(i); - UniqueData* uniqueData = static_cast(animGraphInstance->GetUniqueObjectData(mObjectIndex)); + AnimGraphInstance* animGraphInstance = m_animGraph->GetAnimGraphInstance(i); + UniqueData* uniqueData = static_cast(animGraphInstance->GetUniqueObjectData(m_objectIndex)); if (uniqueData) { uniqueData->OnReferenceAnimGraphAssetChanged(); @@ -667,11 +667,11 @@ namespace EMotionFX void AnimGraphReferenceNode::OnMaskedParametersChanged() { - const size_t numAnimGraphInstances = mAnimGraph->GetNumAnimGraphInstances(); + const size_t numAnimGraphInstances = m_animGraph->GetNumAnimGraphInstances(); for (size_t i = 0; i < numAnimGraphInstances; ++i) { - AnimGraphInstance* animGraphInstance = mAnimGraph->GetAnimGraphInstance(i); - UniqueData* uniqueData = static_cast(animGraphInstance->GetUniqueObjectData(mObjectIndex)); + AnimGraphInstance* animGraphInstance = m_animGraph->GetAnimGraphInstance(i); + UniqueData* uniqueData = static_cast(animGraphInstance->GetUniqueObjectData(m_objectIndex)); if (uniqueData) { uniqueData->m_parameterMappingCacheDirty = true; @@ -834,10 +834,10 @@ namespace EMotionFX { MotionSet* motionSet = GetMotionSet(); - const size_t numAnimGraphInstances = mAnimGraph->GetNumAnimGraphInstances(); + const size_t numAnimGraphInstances = m_animGraph->GetNumAnimGraphInstances(); for (size_t i = 0; i < numAnimGraphInstances; ++i) { - AnimGraphInstance* animGraphInstance = mAnimGraph->GetAnimGraphInstance(i); + AnimGraphInstance* animGraphInstance = m_animGraph->GetAnimGraphInstance(i); UniqueData* uniqueData = static_cast(FindOrCreateUniqueNodeData(animGraphInstance)); if (uniqueData->m_referencedAnimGraphInstance) @@ -886,7 +886,7 @@ namespace EMotionFX // exclude those parameters for (const AnimGraphNode::Port& port : GetInputPorts()) { - if (port.mConnection) + if (port.m_connection) { parameterNames.emplace_back(port.GetNameString()); } @@ -979,7 +979,7 @@ namespace EMotionFX AZ_Assert(!GetNumConnections(), "Unexpected connections"); - const ValueParameterVector& valueParameters = mAnimGraph->RecursivelyGetValueParameters(); + const ValueParameterVector& valueParameters = m_animGraph->RecursivelyGetValueParameters(); const ValueParameterVector& referencedValueParameters = referencedAnimGraph->RecursivelyGetValueParameters(); // For each parameter in referencedValueParameters, if it is not in valueParameters or is not compatible, add it @@ -1014,10 +1014,10 @@ namespace EMotionFX m_reinitMaskedParameters = false; } - bool portChanged = !mInputPorts.empty(); + bool portChanged = !m_inputPorts.empty(); // Remove all input ports - mInputPorts.clear(); + m_inputPorts.clear(); m_parameterIndexByPortIndex.clear(); // Get the ValueParameters from the AnimGraph @@ -1054,16 +1054,16 @@ namespace EMotionFX }), m_maskedParameterNames.end() ); - mConnections.erase( - AZStd::remove_if(mConnections.begin(), mConnections.end(), [&removedPortIndexes](const BlendTreeConnection* connection) + m_connections.erase( + AZStd::remove_if(m_connections.begin(), m_connections.end(), [&removedPortIndexes](const BlendTreeConnection* connection) { return removedPortIndexes.find(connection->GetTargetPort()) != removedPortIndexes.end(); }), - mConnections.end() + m_connections.end() ); // Shift the port indexes of the remaining connections - for (BlendTreeConnection* connection : mConnections) + for (BlendTreeConnection* connection : m_connections) { AZ::u16 originalTargetPort = connection->GetTargetPort(); AZ::u16 targetPort = originalTargetPort; @@ -1115,17 +1115,17 @@ namespace EMotionFX // Update the input ports. Don't call RelinkPortConnections, // because ReinitInputPorts cannot guarantee that the connected // nodes have been initialized - for (BlendTreeConnection* connection : mConnections) + for (BlendTreeConnection* connection : m_connections) { const AZ::u16 targetPortNr = connection->GetTargetPort(); - if (targetPortNr < mInputPorts.size()) + if (targetPortNr < m_inputPorts.size()) { - mInputPorts[targetPortNr].mConnection = connection; + m_inputPorts[targetPortNr].m_connection = connection; } else { - AZ_Error("EMotionFX", false, "Can't make connection to input port %i of '%s', max port count is %i.", targetPortNr, GetName(), mInputPorts.size()); + AZ_Error("EMotionFX", false, "Can't make connection to input port %i of '%s', max port count is %i.", targetPortNr, GetName(), m_inputPorts.size()); } } AnimGraphNotificationBus::Broadcast(&AnimGraphNotificationBus::Events::OnSyncVisualObject, this); diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphSnapshot.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphSnapshot.cpp index 089f5a7df8..b0a7134043 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphSnapshot.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphSnapshot.cpp @@ -159,7 +159,7 @@ namespace EMotionFX if (AZStd::find(activeStates.begin(), activeStates.end(), node) == activeStates.end()) { stateMachine->EndAllActiveTransitions(&instance); - uniqueData->mCurrentState = node; + uniqueData->m_currentState = node; } } } diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphStateCondition.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphStateCondition.cpp index 341f045918..4a81cf585b 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphStateCondition.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphStateCondition.cpp @@ -63,7 +63,7 @@ namespace EMotionFX return; } - m_state = mAnimGraph->RecursiveFindNodeById(m_stateId); + m_state = m_animGraph->RecursiveFindNodeById(m_stateId); } @@ -100,7 +100,7 @@ namespace EMotionFX { // in case a event got triggered constantly fire true until the condition gets reset const UniqueData* uniqueData = static_cast(animGraphInstance->FindOrCreateUniqueObjectData(this)); - if (uniqueData->mTriggered) + if (uniqueData->m_triggered) { return true; } @@ -149,7 +149,7 @@ namespace EMotionFX // reached the specified play time if (m_state) { - const float currentLocalTime = m_state->GetCurrentPlayTime(uniqueData->mAnimGraphInstance); + const float currentLocalTime = m_state->GetCurrentPlayTime(uniqueData->m_animGraphInstance); // the has reached play time condition is not part of the event handler, so we have to manually handle it here if (AZ::IsClose(currentLocalTime, m_playTime, AZ::Constants::FloatEpsilon) || currentLocalTime >= m_playTime) { @@ -170,7 +170,7 @@ namespace EMotionFX { // find the unique data and reset it UniqueData* uniqueData = static_cast(animGraphInstance->FindOrCreateUniqueObjectData(this)); - uniqueData->mTriggered = false; + uniqueData->m_triggered = false; } // construct and output the information summary string for this object @@ -221,10 +221,10 @@ namespace EMotionFX // constructor AnimGraphStateCondition::UniqueData::UniqueData(AnimGraphObject* object, AnimGraphInstance* animGraphInstance) : AnimGraphObjectData(object, animGraphInstance) - , mAnimGraphInstance(animGraphInstance) + , m_animGraphInstance(animGraphInstance) { - mEventHandler = nullptr; - mTriggered = false; + m_eventHandler = nullptr; + m_triggered = false; CreateEventHandler(); } @@ -240,22 +240,22 @@ namespace EMotionFX { DeleteEventHandler(); - if (mAnimGraphInstance) + if (m_animGraphInstance) { - mEventHandler = aznew AnimGraphStateCondition::EventHandler(static_cast(mObject), this); - mAnimGraphInstance->AddEventHandler(mEventHandler); + m_eventHandler = aznew AnimGraphStateCondition::EventHandler(static_cast(m_object), this); + m_animGraphInstance->AddEventHandler(m_eventHandler); } } void AnimGraphStateCondition::UniqueData::DeleteEventHandler() { - if (mEventHandler) + if (m_eventHandler) { - mAnimGraphInstance->RemoveEventHandler(mEventHandler); + m_animGraphInstance->RemoveEventHandler(m_eventHandler); - delete mEventHandler; - mEventHandler = nullptr; + delete m_eventHandler; + m_eventHandler = nullptr; } } @@ -279,8 +279,8 @@ namespace EMotionFX AnimGraphStateCondition::EventHandler::EventHandler(AnimGraphStateCondition* condition, UniqueData* uniqueData) : EMotionFX::AnimGraphInstanceEventHandler() { - mCondition = condition; - mUniqueData = uniqueData; + m_condition = condition; + m_uniqueData = uniqueData; } @@ -292,7 +292,7 @@ namespace EMotionFX bool AnimGraphStateCondition::EventHandler::IsTargetState(const AnimGraphNode* state) const { - const AnimGraphNode* conditionState = mCondition->GetState(); + const AnimGraphNode* conditionState = m_condition->GetState(); if (conditionState) { const AZStd::string& stateName = conditionState->GetNameString(); @@ -311,10 +311,10 @@ namespace EMotionFX return; } - const TestFunction testFunction = mCondition->GetTestFunction(); + const TestFunction testFunction = m_condition->GetTestFunction(); if (testFunction == targetFunction && IsTargetState(state)) { - mUniqueData->mTriggered = true; + m_uniqueData->m_triggered = true; } } @@ -355,7 +355,7 @@ namespace EMotionFX void AnimGraphStateCondition::SetStateId(AnimGraphNodeId stateId) { m_stateId = stateId; - if (mAnimGraph) + if (m_animGraph) { Reinit(); } diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphStateCondition.h b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphStateCondition.h index bc4ca4bf75..1c772e8fbe 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphStateCondition.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphStateCondition.h @@ -63,9 +63,9 @@ namespace EMotionFX // The anim graph instance pointer shouldn't change. If it were to // change, we'd need to remove an existing event handler and create // a new one in the new anim graph instance. - AnimGraphInstance* const mAnimGraphInstance; - AnimGraphStateCondition::EventHandler* mEventHandler; - bool mTriggered; + AnimGraphInstance* const m_animGraphInstance; + AnimGraphStateCondition::EventHandler* m_eventHandler; + bool m_triggered; }; AnimGraphStateCondition(); @@ -125,8 +125,8 @@ namespace EMotionFX bool IsTargetState(const AnimGraphNode* state) const; void OnStateChange(AnimGraphInstance* animGraphInstance, AnimGraphNode* state, TestFunction targetFunction); - AnimGraphStateCondition* mCondition; - UniqueData* mUniqueData; + AnimGraphStateCondition* m_condition; + UniqueData* m_uniqueData; }; AZ::Crc32 GetTestFunctionVisibility() const; diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphStateMachine.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphStateMachine.cpp index 3ad6ae8b8b..9b4c2d07ac 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphStateMachine.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphStateMachine.cpp @@ -35,8 +35,8 @@ namespace EMotionFX AnimGraphStateMachine::AnimGraphStateMachine() : AnimGraphNode() - , mEntryState(nullptr) - , mEntryStateNodeNr(InvalidIndex) + , m_entryState(nullptr) + , m_entryStateNodeNr(InvalidIndex) , m_entryStateId(AnimGraphNodeId::InvalidId) , m_alwaysStartInEntryState(true) { @@ -55,7 +55,7 @@ namespace EMotionFX // Re-initialize all child nodes and connections AnimGraphNode::RecursiveReinit(); - for (AnimGraphStateTransition* transition : mTransitions) + for (AnimGraphStateTransition* transition : m_transitions) { transition->RecursiveReinit(); } @@ -68,7 +68,7 @@ namespace EMotionFX return false; } - for (AnimGraphStateTransition* transition : mTransitions) + for (AnimGraphStateTransition* transition : m_transitions) { transition->InitAfterLoading(animGraph); } @@ -82,12 +82,12 @@ namespace EMotionFX void AnimGraphStateMachine::RemoveAllTransitions() { - for (AnimGraphStateTransition* transition : mTransitions) + for (AnimGraphStateTransition* transition : m_transitions) { delete transition; } - mTransitions.clear(); + m_transitions.clear(); } void AnimGraphStateMachine::Output(AnimGraphInstance* animGraphInstance) @@ -95,7 +95,7 @@ namespace EMotionFX ActorInstance* actorInstance = animGraphInstance->GetActorInstance(); AnimGraphPose* outputPose = nullptr; - if (mDisabled) + if (m_disabled) { // Output bind pose in case state machine is disabled. RequestPoses(animGraphInstance); @@ -114,13 +114,13 @@ namespace EMotionFX const AZStd::vector& activeStates = uniqueData->GetActiveStates(); // Single active state, no active transition. - if (!isTransitioning && uniqueData->mCurrentState) + if (!isTransitioning && uniqueData->m_currentState) { - uniqueData->mCurrentState->PerformOutput(animGraphInstance); + uniqueData->m_currentState->PerformOutput(animGraphInstance); RequestPoses(animGraphInstance); outputPose = GetOutputPose(animGraphInstance, OUTPUTPORT_POSE)->GetValue(); - *outputPose = *uniqueData->mCurrentState->GetMainOutputPose(animGraphInstance); + *outputPose = *uniqueData->m_currentState->GetMainOutputPose(animGraphInstance); } // One or more transitions active. else if (isTransitioning) @@ -184,7 +184,7 @@ namespace EMotionFX if (outputPose && GetEMotionFX().GetIsInEditorMode() && GetCanVisualize(animGraphInstance)) { - actorInstance->DrawSkeleton(outputPose->GetPose(), mVisualizeColor); + actorInstance->DrawSkeleton(outputPose->GetPose(), m_visualizeColor); } } @@ -205,7 +205,7 @@ namespace EMotionFX const bool isTransitioning = IsTransitioning(animGraphInstance); AnimGraphStateTransition* latestActiveTransition = GetLatestActiveTransition(uniqueData); - for (AnimGraphStateTransition* curTransition : mTransitions) + for (AnimGraphStateTransition* curTransition : m_transitions) { if (curTransition->GetIsDisabled()) { @@ -321,7 +321,7 @@ namespace EMotionFX } const bool isTransitioning = IsTransitioning(animGraphInstance); - for (const AnimGraphStateTransition* transition : mTransitions) + for (const AnimGraphStateTransition* transition : m_transitions) { // get the current transition and skip it directly if in case it is disabled if (transition->GetIsDisabled()) @@ -369,7 +369,7 @@ namespace EMotionFX // Update the source node for the transition instance in case we're dealing with a wildcard transition. if (transition->GetIsWildcardTransition()) { - sourceNode = uniqueData->mCurrentState; + sourceNode = uniqueData->m_currentState; transition->SetSourceNode(animGraphInstance, sourceNode); } @@ -431,7 +431,7 @@ namespace EMotionFX // Reset the conditions of the transition that has just ended. transition->ResetConditions(animGraphInstance); - targetState->OnStateEnter(animGraphInstance, uniqueData->mCurrentState, transition); + targetState->OnStateEnter(animGraphInstance, uniqueData->m_currentState, transition); eventManager.OnStateEnter(animGraphInstance, targetState); // Ending latest active transition. @@ -439,11 +439,11 @@ namespace EMotionFX { // Emit end state events and adjust the previous and the active states in case the latest active transition is ending. // In other cases we're not leaving the current state yet as it is still active as a source state from another active transition. - uniqueData->mCurrentState->OnStateEnd(animGraphInstance, targetState, transition); - eventManager.OnStateEnd(animGraphInstance, uniqueData->mCurrentState); + uniqueData->m_currentState->OnStateEnd(animGraphInstance, targetState, transition); + eventManager.OnStateEnd(animGraphInstance, uniqueData->m_currentState); - uniqueData->mPreviousState = uniqueData->mCurrentState; - uniqueData->mCurrentState = targetState; + uniqueData->m_previousState = uniqueData->m_currentState; + uniqueData->m_currentState = targetState; } // Ending any interrupted transition on the transition stack that ended transitioning. else if (transition->GetIsDone(animGraphInstance)) @@ -479,14 +479,14 @@ namespace EMotionFX UniqueData* uniqueData = static_cast(FindOrCreateUniqueNodeData(animGraphInstance)); // Defer switch to entry state. - if (uniqueData->mSwitchToEntryState) + if (uniqueData->m_switchToEntryState) { AnimGraphNode* entryState = GetEntryState(); if (entryState) { SwitchToState(animGraphInstance, entryState); } - uniqueData->mSwitchToEntryState = false; + uniqueData->m_switchToEntryState = false; } // Update all currently active transitions. @@ -507,8 +507,8 @@ namespace EMotionFX } // Update the conditions and trigger the right transition based on the conditions and priority levels etc. - UpdateConditions(animGraphInstance, uniqueData->mCurrentState, timePassedInSeconds); - CheckConditions(uniqueData->mCurrentState, animGraphInstance, uniqueData, /*calledFromWithinUpdate*/ true); + UpdateConditions(animGraphInstance, uniqueData->m_currentState, timePassedInSeconds); + CheckConditions(uniqueData->m_currentState, animGraphInstance, uniqueData, /*calledFromWithinUpdate*/ true); #ifdef ENABLE_SINGLEFRAME_MULTISTATETRANSITIONING // Check if our latest active transition is already done, end it and check for further transition candidates. @@ -519,8 +519,8 @@ namespace EMotionFX // End all transitions on the stack back to front EndAllActiveTransitions(animGraphInstance, uniqueData); - UpdateConditions(animGraphInstance, uniqueData->mCurrentState, 0.0f); - CheckConditions(uniqueData->mCurrentState, animGraphInstance, uniqueData, /*calledFromWithinUpdate=*/true); + UpdateConditions(animGraphInstance, uniqueData->m_currentState, 0.0f); + CheckConditions(uniqueData->m_currentState, animGraphInstance, uniqueData, /*calledFromWithinUpdate=*/true); if (numPasses >= s_maxNumPasses) { @@ -545,9 +545,9 @@ namespace EMotionFX UpdateExitStateReachedFlag(animGraphInstance, uniqueData); // Perform play speed synchronization when transitioning. - if (uniqueData->mCurrentState) + if (uniqueData->m_currentState) { - uniqueData->Init(animGraphInstance, uniqueData->mCurrentState); + uniqueData->Init(animGraphInstance, uniqueData->m_currentState); if (IsTransitioning(uniqueData)) { @@ -612,12 +612,12 @@ namespace EMotionFX { if (azrtti_typeid(activeState) == azrtti_typeid()) { - uniqueData->mReachedExitState = true; + uniqueData->m_reachedExitState = true; return; } } - uniqueData->mReachedExitState = false; + uniqueData->m_reachedExitState = false; } void AnimGraphStateMachine::PostUpdate(AnimGraphInstance* animGraphInstance, float timePassedInSeconds) @@ -644,7 +644,7 @@ namespace EMotionFX if (!IsTransitioning(uniqueData)) { - AnimGraphNode* activeState = uniqueData->mCurrentState; + AnimGraphNode* activeState = uniqueData->m_currentState; if (activeState) { // Single active state, no active transition. @@ -728,28 +728,28 @@ namespace EMotionFX } // tell the current node to which node we're exiting - if (uniqueData->mCurrentState) + if (uniqueData->m_currentState) { - uniqueData->mCurrentState->OnStateExit(animGraphInstance, targetState, nullptr); - uniqueData->mCurrentState->OnStateEnd(animGraphInstance, targetState, nullptr); + uniqueData->m_currentState->OnStateExit(animGraphInstance, targetState, nullptr); + uniqueData->m_currentState->OnStateEnd(animGraphInstance, targetState, nullptr); } // tell the new current node from which node we're coming if (targetState) { - targetState->OnStateEntering(animGraphInstance, uniqueData->mCurrentState, nullptr); - targetState->OnStateEnter(animGraphInstance, uniqueData->mCurrentState, nullptr); + targetState->OnStateEntering(animGraphInstance, uniqueData->m_currentState, nullptr); + targetState->OnStateEnter(animGraphInstance, uniqueData->m_currentState, nullptr); } // Inform the event manager. EventManager& eventManager = GetEventManager(); - eventManager.OnStateExit(animGraphInstance, uniqueData->mCurrentState); + eventManager.OnStateExit(animGraphInstance, uniqueData->m_currentState); eventManager.OnStateEntering(animGraphInstance, targetState); - eventManager.OnStateEnd(animGraphInstance, uniqueData->mCurrentState); + eventManager.OnStateEnd(animGraphInstance, uniqueData->m_currentState); eventManager.OnStateEnter(animGraphInstance, targetState); - uniqueData->mPreviousState = uniqueData->mCurrentState; - uniqueData->mCurrentState = targetState; + uniqueData->m_previousState = uniqueData->m_currentState; + uniqueData->m_currentState = targetState; uniqueData->m_activeTransitions.clear(); } @@ -814,7 +814,7 @@ namespace EMotionFX void AnimGraphStateMachine::AddTransition(AnimGraphStateTransition* transition) { - mTransitions.push_back(transition); + m_transitions.push_back(transition); } AnimGraphStateTransition* AnimGraphStateMachine::FindTransition(AnimGraphInstance* animGraphInstance, AnimGraphNode* currentState, AnimGraphNode* targetState) const @@ -843,7 +843,7 @@ namespace EMotionFX AnimGraphStateTransition* prioritizedTransition = nullptr; // first check if there is a ready transition that points directly to the target state - for (AnimGraphStateTransition* transition : mTransitions) + for (AnimGraphStateTransition* transition : m_transitions) { // get the current transition and skip it directly if in case it is disabled if (transition->GetIsDisabled()) @@ -875,7 +875,7 @@ namespace EMotionFX /////////////////////////////////////////////////////////////////////// // in case there is no direct and no indirect transition ready, check for wildcard transitions // there is a maximum number of one for wild card transitions, so we don't need to check the priority values here - for (AnimGraphStateTransition* transition : mTransitions) + for (AnimGraphStateTransition* transition : m_transitions) { // get the current transition and skip it directly if in case it is disabled if (transition->GetIsDisabled()) @@ -896,10 +896,10 @@ namespace EMotionFX AZ::Outcome AnimGraphStateMachine::FindTransitionIndexById(AnimGraphConnectionId transitionId) const { - const size_t numTransitions = mTransitions.size(); + const size_t numTransitions = m_transitions.size(); for (size_t i = 0; i < numTransitions; ++i) { - if (mTransitions[i]->GetId() == transitionId) + if (m_transitions[i]->GetId() == transitionId) { return AZ::Success(i); } @@ -910,10 +910,10 @@ namespace EMotionFX AZ::Outcome AnimGraphStateMachine::FindTransitionIndex(const AnimGraphStateTransition* transition) const { - const auto& iterator = AZStd::find(mTransitions.begin(), mTransitions.end(), transition); - if (iterator != mTransitions.end()) + const auto& iterator = AZStd::find(m_transitions.begin(), m_transitions.end(), transition); + if (iterator != m_transitions.end()) { - const size_t index = iterator - mTransitions.begin(); + const size_t index = iterator - m_transitions.begin(); return AZ::Success(index); } @@ -925,7 +925,7 @@ namespace EMotionFX const AZ::Outcome transitionIndex = FindTransitionIndexById(transitionId); if (transitionIndex.IsSuccess()) { - return mTransitions[transitionIndex.GetValue()]; + return m_transitions[transitionIndex.GetValue()]; } return nullptr; @@ -933,7 +933,7 @@ namespace EMotionFX bool AnimGraphStateMachine::CheckIfHasWildcardTransition(AnimGraphNode* state) const { - for (const AnimGraphStateTransition* transition : mTransitions) + for (const AnimGraphStateTransition* transition : m_transitions) { // check if the given transition is a wildcard transition and if the target node is the given one if (transition->GetTargetNode() == state && transition->GetIsWildcardTransition()) @@ -949,10 +949,10 @@ namespace EMotionFX { if (delFromMem) { - delete mTransitions[transitionIndex]; + delete m_transitions[transitionIndex]; } - mTransitions.erase(mTransitions.begin() + transitionIndex); + m_transitions.erase(m_transitions.begin() + transitionIndex); } AnimGraphNode* AnimGraphStateMachine::GetEntryState() @@ -960,38 +960,38 @@ namespace EMotionFX const AnimGraphNodeId entryStateId = GetEntryStateId(); if (entryStateId.IsValid()) { - if (!mEntryState || (mEntryState && mEntryState->GetId() != entryStateId)) + if (!m_entryState || (m_entryState && m_entryState->GetId() != entryStateId)) { // Sync the entry state based on the id. - mEntryState = FindChildNodeById(entryStateId); + m_entryState = FindChildNodeById(entryStateId); } } else { // Legacy file format way. - if (!mEntryState) + if (!m_entryState) { - if (mEntryStateNodeNr != InvalidIndex && mEntryStateNodeNr < GetNumChildNodes()) + if (m_entryStateNodeNr != InvalidIndex && m_entryStateNodeNr < GetNumChildNodes()) { - mEntryState = GetChildNode(mEntryStateNodeNr); + m_entryState = GetChildNode(m_entryStateNodeNr); } } // End: Legacy file format way. // TODO: Enable this line when deprecating the leagacy file format. - //mEntryState = nullptr; + // m_entryState = nullptr; } - return mEntryState; + return m_entryState; } void AnimGraphStateMachine::SetEntryState(AnimGraphNode* entryState) { - mEntryState = entryState; + m_entryState = entryState; - if (mEntryState) + if (m_entryState) { - m_entryStateId = mEntryState->GetId(); + m_entryStateId = m_entryState->GetId(); } else { @@ -999,25 +999,25 @@ namespace EMotionFX } // Used for the legacy file format. Get rid of this along with the old file format. - mEntryStateNodeNr = FindChildNodeIndex(mEntryState); + m_entryStateNodeNr = FindChildNodeIndex(m_entryState); } AnimGraphNode* AnimGraphStateMachine::GetCurrentState(AnimGraphInstance* animGraphInstance) { UniqueData* uniqueData = static_cast(animGraphInstance->FindOrCreateUniqueNodeData(this)); - return uniqueData->mCurrentState; + return uniqueData->m_currentState; } bool AnimGraphStateMachine::GetExitStateReached(AnimGraphInstance* animGraphInstance) const { // get the unique data for this state machine in a given anim graph instance UniqueData* uniqueData = static_cast(animGraphInstance->FindOrCreateUniqueNodeData(this)); - return uniqueData->mReachedExitState; + return uniqueData->m_reachedExitState; } void AnimGraphStateMachine::RecursiveOnChangeMotionSet(AnimGraphInstance* animGraphInstance, MotionSet* newMotionSet) { - for (AnimGraphStateTransition* transition : mTransitions) + for (AnimGraphStateTransition* transition : m_transitions) { transition->OnChangeMotionSet(animGraphInstance, newMotionSet); } @@ -1029,18 +1029,18 @@ namespace EMotionFX void AnimGraphStateMachine::OnRemoveNode(AnimGraph* animGraph, AnimGraphNode* nodeToRemove) { // is the node to remove the entry state? - if (mEntryState == nodeToRemove) + if (m_entryState == nodeToRemove) { SetEntryState(nullptr); } - for (AnimGraphStateTransition* transition : mTransitions) + for (AnimGraphStateTransition* transition : m_transitions) { transition->OnRemoveNode(animGraph, nodeToRemove); } bool childNodeRemoved = false; - for (AnimGraphNode* childNode : mChildNodes) + for (AnimGraphNode* childNode : m_childNodes) { if (childNode == nodeToRemove) { @@ -1060,7 +1060,7 @@ namespace EMotionFX { ResetUniqueData(animGraphInstance); - for (AnimGraphNode* childNode : mChildNodes) + for (AnimGraphNode* childNode : m_childNodes) { childNode->RecursiveResetUniqueDatas(animGraphInstance); } @@ -1070,7 +1070,7 @@ namespace EMotionFX { AnimGraphNode::RecursiveInvalidateUniqueDatas(animGraphInstance); - for (AnimGraphStateTransition* transition : mTransitions) + for (AnimGraphStateTransition* transition : m_transitions) { transition->RecursiveInvalidateUniqueDatas(animGraphInstance); } @@ -1081,25 +1081,25 @@ namespace EMotionFX void AnimGraphStateMachine::UniqueData::Reset() { m_activeTransitions.clear(); - mCurrentState = nullptr; - mPreviousState = nullptr; - mReachedExitState = false; - mSwitchToEntryState = true; + m_currentState = nullptr; + m_previousState = nullptr; + m_reachedExitState = false; + m_switchToEntryState = true; } void AnimGraphStateMachine::UniqueData::Update() { - AnimGraphStateMachine* stateMachine = azdynamic_cast(mObject); + AnimGraphStateMachine* stateMachine = azdynamic_cast(m_object); AZ_Assert(stateMachine, "Unique data linked to incorrect node type."); // check if any of the active states are invalid and reset them if they are - if (mCurrentState && stateMachine->FindChildNodeIndex(mCurrentState) == InvalidIndex) + if (m_currentState && stateMachine->FindChildNodeIndex(m_currentState) == InvalidIndex) { - mCurrentState = nullptr; + m_currentState = nullptr; } - if (mPreviousState && stateMachine->FindChildNodeIndex(mPreviousState) == InvalidIndex) + if (m_previousState && stateMachine->FindChildNodeIndex(m_previousState) == InvalidIndex) { - mPreviousState = nullptr; + m_previousState = nullptr; } // Check if the currently active transitions are valid and remove them from the transition stack if not. @@ -1125,9 +1125,9 @@ namespace EMotionFX { m_activeStates.clear(); - if (mCurrentState) + if (m_currentState) { - m_activeStates.emplace_back(mCurrentState); + m_activeStates.emplace_back(m_currentState); } // Add target state for all active transitions to the active states. @@ -1158,40 +1158,40 @@ namespace EMotionFX // rewind the state machine if (m_alwaysStartInEntryState && entryState) { - if (uniqueData->mCurrentState) + if (uniqueData->m_currentState) { - uniqueData->mCurrentState->OnStateExit(animGraphInstance, entryState, nullptr); - uniqueData->mCurrentState->OnStateEnd(animGraphInstance, entryState, nullptr); + uniqueData->m_currentState->OnStateExit(animGraphInstance, entryState, nullptr); + uniqueData->m_currentState->OnStateEnd(animGraphInstance, entryState, nullptr); - GetEventManager().OnStateExit(animGraphInstance, uniqueData->mCurrentState); - GetEventManager().OnStateEnd(animGraphInstance, uniqueData->mCurrentState); + GetEventManager().OnStateExit(animGraphInstance, uniqueData->m_currentState); + GetEventManager().OnStateEnd(animGraphInstance, uniqueData->m_currentState); } // rewind the entry state and reset conditions of all outgoing transitions entryState->Rewind(animGraphInstance); ResetOutgoingTransitionConditions(animGraphInstance, entryState); - mEntryState->OnStateEntering(animGraphInstance, uniqueData->mCurrentState, nullptr); - mEntryState->OnStateEnter(animGraphInstance, uniqueData->mCurrentState, nullptr); + m_entryState->OnStateEntering(animGraphInstance, uniqueData->m_currentState, nullptr); + m_entryState->OnStateEnter(animGraphInstance, uniqueData->m_currentState, nullptr); GetEventManager().OnStateEntering(animGraphInstance, entryState); GetEventManager().OnStateEnter(animGraphInstance, entryState); // reset the the unique data of the state machine and overwrite the current state as that is not nullptr but the entry state uniqueData->Reset(); - uniqueData->mCurrentState = entryState; + uniqueData->m_currentState = entryState; } } void AnimGraphStateMachine::RecursiveResetFlags(AnimGraphInstance* animGraphInstance, uint32 flagsToDisable) { // clear the output for all child nodes, just to make sure - for (const AnimGraphNode* childNode : mChildNodes) + for (const AnimGraphNode* childNode : m_childNodes) { animGraphInstance->DisableObjectFlags(childNode->GetObjectIndex(), flagsToDisable); } // Reset flags for this state machine. - animGraphInstance->DisableObjectFlags(mObjectIndex, flagsToDisable); + animGraphInstance->DisableObjectFlags(m_objectIndex, flagsToDisable); // Reset flags recursively for all active states within this state machine. const AZStd::vector& activeStates = GetActiveStates(animGraphInstance); @@ -1209,7 +1209,7 @@ namespace EMotionFX void AnimGraphStateMachine::ResetOutgoingTransitionConditions(AnimGraphInstance* animGraphInstance, AnimGraphNode* state) { - for (AnimGraphStateTransition* transition : mTransitions) + for (AnimGraphStateTransition* transition : m_transitions) { // get the transition, check if it is a possible outgoing connection for our given state and reset it in this case if (transition->GetIsWildcardTransition() || @@ -1223,7 +1223,7 @@ namespace EMotionFX uint32 AnimGraphStateMachine::CalcNumIncomingTransitions(AnimGraphNode* state) const { uint32 result = 0; - for (const AnimGraphStateTransition* transition : mTransitions) + for (const AnimGraphStateTransition* transition : m_transitions) { if (transition->GetTargetNode() == state) { @@ -1236,7 +1236,7 @@ namespace EMotionFX uint32 AnimGraphStateMachine::CalcNumWildcardTransitions(AnimGraphNode* state) const { uint32 result = 0; - for (const AnimGraphStateTransition* transition : mTransitions) + for (const AnimGraphStateTransition* transition : m_transitions) { if (transition->GetIsWildcardTransition() && transition->GetTargetNode() == state) { @@ -1265,7 +1265,7 @@ namespace EMotionFX uint32 AnimGraphStateMachine::CalcNumOutgoingTransitions(AnimGraphNode* state) const { uint32 result = 0; - for (const AnimGraphStateTransition* transition : mTransitions) + for (const AnimGraphStateTransition* transition : m_transitions) { if (!transition->GetIsWildcardTransition() && transition->GetSourceNode() == state) { @@ -1277,7 +1277,7 @@ namespace EMotionFX void AnimGraphStateMachine::RecursiveCollectObjects(AZStd::vector& outObjects) const { - for (const AnimGraphStateTransition* transition : mTransitions) + for (const AnimGraphStateTransition* transition : m_transitions) { transition->RecursiveCollectObjects(outObjects); // this will automatically add all transition conditions as well } @@ -1348,7 +1348,7 @@ namespace EMotionFX if (!IsTransitioning(uniqueData)) { - AnimGraphNode* activeState = uniqueData->mCurrentState; + AnimGraphNode* activeState = uniqueData->m_currentState; if (activeState) { // Single active state, no active transition. @@ -1374,7 +1374,7 @@ namespace EMotionFX if (syncMode != SYNCMODE_DISABLED) { - if (animGraphInstance->GetIsObjectFlagEnabled(mObjectIndex, AnimGraphInstance::OBJECTFLAGS_SYNCED) == false) + if (animGraphInstance->GetIsObjectFlagEnabled(m_objectIndex, AnimGraphInstance::OBJECTFLAGS_SYNCED) == false) { sourceNode->RecursiveSetUniqueDataFlag(animGraphInstance, AnimGraphInstance::OBJECTFLAGS_SYNCED, true); animGraphInstance->SetObjectFlags(sourceNode->GetObjectIndex(), AnimGraphInstance::OBJECTFLAGS_IS_SYNCLEADER, true); @@ -1420,9 +1420,9 @@ namespace EMotionFX { Reset(); - AnimGraphStateMachine* stateMachine = azdynamic_cast(mObject); + AnimGraphStateMachine* stateMachine = azdynamic_cast(m_object); AZ_Assert(stateMachine, "Unique data linked to incorrect node type."); - mCurrentState = stateMachine->GetEntryState(); + m_currentState = stateMachine->GetEntryState(); } uint32 AnimGraphStateMachine::UniqueData::Save(uint8* outputBuffer) const @@ -1438,8 +1438,8 @@ namespace EMotionFX resultSize += chunkSize; SaveVectorOfObjects(m_activeTransitions, &destBuffer, resultSize); - SaveChunk((uint8*)&mCurrentState, sizeof(AnimGraphNode*), &destBuffer, resultSize); - SaveChunk((uint8*)&mPreviousState, sizeof(AnimGraphNode*), &destBuffer, resultSize); + SaveChunk((uint8*)&m_currentState, sizeof(AnimGraphNode*), &destBuffer, resultSize); + SaveChunk((uint8*)&m_previousState, sizeof(AnimGraphNode*), &destBuffer, resultSize); return resultSize; } @@ -1454,8 +1454,8 @@ namespace EMotionFX resultSize += chunkSize; LoadVectorOfObjects(m_activeTransitions, &sourceBuffer, resultSize); - LoadChunk((uint8*)&mCurrentState, sizeof(AnimGraphNode*), &sourceBuffer, resultSize); - LoadChunk((uint8*)&mPreviousState, sizeof(AnimGraphNode*), &sourceBuffer, resultSize); + LoadChunk((uint8*)&m_currentState, sizeof(AnimGraphNode*), &sourceBuffer, resultSize); + LoadChunk((uint8*)&m_previousState, sizeof(AnimGraphNode*), &sourceBuffer, resultSize); return resultSize; } @@ -1463,7 +1463,7 @@ namespace EMotionFX void AnimGraphStateMachine::RecursiveSetUniqueDataFlag(AnimGraphInstance* animGraphInstance, uint32 flag, bool enabled) { // Set flag for this state machine. - animGraphInstance->SetObjectFlags(mObjectIndex, flag, enabled); + animGraphInstance->SetObjectFlags(m_objectIndex, flag, enabled); // Set flag recursively for all active states within this state machine. const AZStd::vector& activeStates = GetActiveStates(animGraphInstance); @@ -1478,7 +1478,7 @@ namespace EMotionFX // check and add this node if (azrtti_typeid(this) == nodeType || nodeType.IsNull()) { - if (animGraphInstance->GetIsOutputReady(mObjectIndex)) // if we processed this node + if (animGraphInstance->GetIsOutputReady(m_objectIndex)) // if we processed this node { outNodes->emplace_back(const_cast(this)); } @@ -1503,7 +1503,7 @@ namespace EMotionFX void AnimGraphStateMachine::ReserveTransitions(size_t numTransitions) { - mTransitions.reserve(numTransitions); + m_transitions.reserve(numTransitions); } void AnimGraphStateMachine::SetEntryStateId(AnimGraphNodeId entryStateId) @@ -1555,7 +1555,7 @@ namespace EMotionFX serializeContext->Class() ->Version(1) ->Field("entryStateId", &AnimGraphStateMachine::m_entryStateId) - ->Field("transitions", &AnimGraphStateMachine::mTransitions) + ->Field("transitions", &AnimGraphStateMachine::m_transitions) ->Field("alwaysStartInEntryState", &AnimGraphStateMachine::m_alwaysStartInEntryState); AZ::EditContext* editContext = serializeContext->GetEditContext(); diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphStateMachine.h b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphStateMachine.h index 1f8d1eb591..1a00a82744 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphStateMachine.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphStateMachine.h @@ -56,11 +56,11 @@ namespace EMotionFX public: AZStd::vector m_activeTransitions; /**< Stack of active transitions. */ - AnimGraphNode* mCurrentState; /**< The current state. */ - AnimGraphNode* mPreviousState; /**< The previously used state, so the one used before the current one, the one from which we transitioned into the current one. */ - bool mReachedExitState; /**< True in case the state machine's current state is an exit state, false it not. */ + AnimGraphNode* m_currentState; /**< The current state. */ + AnimGraphNode* m_previousState; /**< The previously used state, so the one used before the current one, the one from which we transitioned into the current one. */ + bool m_reachedExitState; /**< True in case the state machine's current state is an exit state, false it not. */ AnimGraphRefCountedData m_prevData; - bool mSwitchToEntryState; + bool m_switchToEntryState; private: AZStd::vector m_activeStates; // TODO: See function comment. @@ -112,14 +112,14 @@ namespace EMotionFX * Get the number of transitions inside this state machine. This includes all kinds of transitions, so also wildcard transitions. * @result The number of transitions inside the state machine. */ - size_t GetNumTransitions() const { return mTransitions.size(); } + size_t GetNumTransitions() const { return m_transitions.size(); } /** * Get a pointer to the state machine transition of the given index. * @param[in] index The index of the transition to return. * @result A pointer to the state machine transition at the given index. */ - AnimGraphStateTransition* GetTransition(size_t index) const { return mTransitions[index]; } + AnimGraphStateTransition* GetTransition(size_t index) const { return m_transitions[index]; } /** * Remove the state machine transition at the given index. @@ -265,9 +265,9 @@ namespace EMotionFX void EndAllActiveTransitions(AnimGraphInstance* animGraphInstance); private: - AZStd::vector mTransitions; /**< The higher the index, the older the active transtion, the more time passed since it got started. Index = 0 is the most recent transition and the one with the highest global influence.*/ - AnimGraphNode* mEntryState; /**< A pointer to the initial state, so the state where the machine starts. */ - size_t mEntryStateNodeNr; /**< Used only in the legacy file format. Remove after the legacy file format will be removed. */ + AZStd::vector m_transitions; /**< The higher the index, the older the active transtion, the more time passed since it got started. Index = 0 is the most recent transition and the one with the highest global influence.*/ + AnimGraphNode* m_entryState; /**< A pointer to the initial state, so the state where the machine starts. */ + size_t m_entryStateNodeNr; /**< Used only in the legacy file format. Remove after the legacy file format will be removed. */ AZ::u64 m_entryStateId; /**< The node id of the entry state. */ bool m_alwaysStartInEntryState; diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphStateTransition.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphStateTransition.cpp index 747188ead2..e90491b696 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphStateTransition.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphStateTransition.cpp @@ -180,9 +180,9 @@ namespace EMotionFX float duration ) : AnimGraphObject() - , mConditions(AZStd::move(conditions)) - , mSourceNode(source) - , mTargetNode(target) + , m_conditions(AZStd::move(conditions)) + , m_sourceNode(source) + , m_targetNode(target) , m_sourceNodeId(source ? source->GetId() : ObjectId::InvalidId) , m_targetNodeId(target ? target->GetId() : ObjectId::InvalidId) , m_transitionTime(duration) @@ -192,31 +192,31 @@ namespace EMotionFX AnimGraphStateTransition::~AnimGraphStateTransition() { RemoveAllConditions(true); - if (mAnimGraph) + if (m_animGraph) { - mAnimGraph->RemoveObject(this); + m_animGraph->RemoveObject(this); } } void AnimGraphStateTransition::Reinit() { - if (!mAnimGraph) + if (!m_animGraph) { - mSourceNode = nullptr; - mTargetNode = nullptr; + m_sourceNode = nullptr; + m_targetNode = nullptr; return; } // Re-link the source node. if (GetSourceNodeId().IsValid()) { - mSourceNode = mAnimGraph->RecursiveFindNodeById(GetSourceNodeId()); + m_sourceNode = m_animGraph->RecursiveFindNodeById(GetSourceNodeId()); } // Re-link the target node. if (GetTargetNodeId().IsValid()) { - mTargetNode = mAnimGraph->RecursiveFindNodeById(GetTargetNodeId()); + m_targetNode = m_animGraph->RecursiveFindNodeById(GetTargetNodeId()); } AnimGraphObject::Reinit(); @@ -226,7 +226,7 @@ namespace EMotionFX { Reinit(); - for (AnimGraphTransitionCondition* condition : mConditions) + for (AnimGraphTransitionCondition* condition : m_conditions) { condition->Reinit(); } @@ -243,7 +243,7 @@ namespace EMotionFX InitInternalAttributesForAllInstances(); - for (AnimGraphTransitionCondition* condition : mConditions) + for (AnimGraphTransitionCondition* condition : m_conditions) { condition->SetTransition(this); condition->InitAfterLoading(animGraph); @@ -265,7 +265,7 @@ namespace EMotionFX UniqueData* uniqueData = static_cast(animGraphInstance->FindOrCreateUniqueObjectData(this)); // calculate the blend weight, based on the type of smoothing - const float weight = uniqueData->mBlendWeight; + const float weight = uniqueData->m_blendWeight; // blend the two poses *outputPose = from; @@ -282,37 +282,37 @@ namespace EMotionFX { const float blendTime = GetBlendTime(animGraphInstance); - uniqueData->mTotalSeconds += timePassedInSeconds; - if (uniqueData->mTotalSeconds >= blendTime) + uniqueData->m_totalSeconds += timePassedInSeconds; + if (uniqueData->m_totalSeconds >= blendTime) { - uniqueData->mTotalSeconds = blendTime; - uniqueData->mIsDone = true; + uniqueData->m_totalSeconds = blendTime; + uniqueData->m_isDone = true; } else { - uniqueData->mIsDone = false; + uniqueData->m_isDone = false; } // calculate the blend weight if (blendTime > MCore::Math::epsilon) { - uniqueData->mBlendProgress = uniqueData->mTotalSeconds / blendTime; + uniqueData->m_blendProgress = uniqueData->m_totalSeconds / blendTime; } else { - uniqueData->mBlendProgress = 1.0f; + uniqueData->m_blendProgress = 1.0f; } - uniqueData->mBlendWeight = CalculateWeight(uniqueData->mBlendProgress); + uniqueData->m_blendWeight = CalculateWeight(uniqueData->m_blendProgress); } } void AnimGraphStateTransition::ExtractMotion(AnimGraphInstance* animGraphInstance, AnimGraphRefCountedData* sourceData, Transform* outTransform, Transform* outTransformMirrored) const { UniqueData* uniqueData = static_cast(animGraphInstance->FindOrCreateUniqueObjectData(this)); - const float weight = uniqueData->mBlendWeight; + const float weight = uniqueData->m_blendWeight; - AnimGraphRefCountedData* targetData = mTargetNode->FindOrCreateUniqueNodeData(animGraphInstance)->GetRefCountedData(); + AnimGraphRefCountedData* targetData = m_targetNode->FindOrCreateUniqueNodeData(animGraphInstance)->GetRefCountedData(); CalculateMotionExtractionDelta(m_extractionMode, sourceData, targetData, weight, true, *outTransform, *outTransformMirrored); } @@ -321,12 +321,12 @@ namespace EMotionFX // get the unique data UniqueData* uniqueData = static_cast(animGraphInstance->FindOrCreateUniqueObjectData(this)); - uniqueData->mBlendWeight = 0.0f; - uniqueData->mIsDone = false; - uniqueData->mTotalSeconds = 0.0f; - uniqueData->mBlendProgress = 0.0f; + uniqueData->m_blendWeight = 0.0f; + uniqueData->m_isDone = false; + uniqueData->m_totalSeconds = 0.0f; + uniqueData->m_blendProgress = 0.0f; - mTargetNode->SetSyncIndex(animGraphInstance, MCORE_INVALIDINDEX32); + m_targetNode->SetSyncIndex(animGraphInstance, MCORE_INVALIDINDEX32); // Trigger action for (AnimGraphTriggerAction* action : m_actionSetup.GetActions()) @@ -343,23 +343,23 @@ namespace EMotionFX { // get the unique data and return the is done flag UniqueData* uniqueData = static_cast(animGraphInstance->FindOrCreateUniqueObjectData(this)); - return uniqueData->mIsDone; + return uniqueData->m_isDone; } float AnimGraphStateTransition::GetBlendWeight(AnimGraphInstance* animGraphInstance) const { // get the unique data and return the is done flag UniqueData* uniqueData = static_cast(animGraphInstance->FindOrCreateUniqueObjectData(this)); - return uniqueData->mBlendWeight; + return uniqueData->m_blendWeight; } void AnimGraphStateTransition::OnEndTransition(AnimGraphInstance* animGraphInstance) { // get the unique data UniqueData* uniqueData = static_cast(animGraphInstance->FindOrCreateUniqueObjectData(this)); - uniqueData->mBlendWeight = 1.0f; - uniqueData->mBlendProgress = 1.0f; - uniqueData->mIsDone = true; + uniqueData->m_blendWeight = 1.0f; + uniqueData->m_blendProgress = 1.0f; + uniqueData->m_isDone = true; // Trigger action for (AnimGraphTriggerAction* action : m_actionSetup.GetActions()) @@ -374,28 +374,28 @@ namespace EMotionFX void AnimGraphStateTransition::AddCondition(AnimGraphTransitionCondition* condition) { condition->SetTransition(this); - mConditions.push_back(condition); + m_conditions.push_back(condition); } void AnimGraphStateTransition::InsertCondition(AnimGraphTransitionCondition* condition, size_t index) { condition->SetTransition(this); - mConditions.insert(mConditions.begin() + index, condition); + m_conditions.insert(m_conditions.begin() + index, condition); } void AnimGraphStateTransition::ReserveConditions(size_t numConditions) { - mConditions.reserve(numConditions); + m_conditions.reserve(numConditions); } void AnimGraphStateTransition::RemoveCondition(size_t index, bool delFromMem) { if (delFromMem) { - delete mConditions[index]; + delete m_conditions[index]; } - mConditions.erase(mConditions.begin() + index); + m_conditions.erase(m_conditions.begin() + index); } void AnimGraphStateTransition::RemoveAllConditions(bool delFromMem) @@ -403,19 +403,19 @@ namespace EMotionFX // delete them all from memory if (delFromMem) { - for (AnimGraphTransitionCondition* condition : mConditions) + for (AnimGraphTransitionCondition* condition : m_conditions) { delete condition; } } - mConditions.clear(); + m_conditions.clear(); } // check if all conditions are tested positive bool AnimGraphStateTransition::CheckIfIsReady(AnimGraphInstance* animGraphInstance) const { - if (mConditions.empty()) + if (m_conditions.empty()) { return false; } @@ -423,7 +423,7 @@ namespace EMotionFX if (!GetEMotionFX().GetIsInEditorMode()) { // If we are not in editor mode, we can early out for the first failed condition - for (AnimGraphTransitionCondition* condition : mConditions) + for (AnimGraphTransitionCondition* condition : m_conditions) { const bool testResult = condition->TestCondition(animGraphInstance); @@ -440,7 +440,7 @@ namespace EMotionFX // If we are in editor mode, we need to execute all the conditions so the UI can reflect properly which ones // passed and which ones didn't bool isReady = true; - for (AnimGraphTransitionCondition* condition : mConditions) + for (AnimGraphTransitionCondition* condition : m_conditions) { const bool testResult = condition->TestCondition(animGraphInstance); @@ -455,27 +455,27 @@ namespace EMotionFX void AnimGraphStateTransition::SetIsWildcardTransition(bool isWildcardTransition) { - mIsWildcardTransition = isWildcardTransition; + m_isWildcardTransition = isWildcardTransition; } void AnimGraphStateTransition::SetSourceNode(AnimGraphInstance* animGraphInstance, AnimGraphNode* sourceNode) { UniqueData* uniqueData = static_cast(animGraphInstance->FindOrCreateUniqueObjectData(this)); - uniqueData->mSourceNode = sourceNode; + uniqueData->m_sourceNode = sourceNode; } // get the source node of the transition AnimGraphNode* AnimGraphStateTransition::GetSourceNode(AnimGraphInstance* animGraphInstance) const { // return the normal source node in case we are not dealing with a wildcard transition - if (mIsWildcardTransition == false) + if (m_isWildcardTransition == false) { - return mSourceNode; + return m_sourceNode; } // wildcard transition special case handling UniqueData* uniqueData = static_cast(animGraphInstance->FindOrCreateUniqueObjectData(this)); - return uniqueData->mSourceNode; + return uniqueData->m_sourceNode; } void AnimGraphStateTransition::SetBlendTime(float blendTime) @@ -488,8 +488,8 @@ namespace EMotionFX MCORE_UNUSED(animGraphInstance); // Use a blend time of zero in case this transition is connected to aan entry or exit state. - if ((mSourceNode && (azrtti_typeid(mSourceNode) == azrtti_typeid() || azrtti_typeid(mSourceNode) == azrtti_typeid())) || - (mTargetNode && (azrtti_typeid(mTargetNode) == azrtti_typeid() || azrtti_typeid(mTargetNode) == azrtti_typeid()))) + if ((m_sourceNode && (azrtti_typeid(m_sourceNode) == azrtti_typeid() || azrtti_typeid(m_sourceNode) == azrtti_typeid())) || + (m_targetNode && (azrtti_typeid(m_targetNode) == azrtti_typeid() || azrtti_typeid(m_targetNode) == azrtti_typeid()))) { return 0.0f; } @@ -500,7 +500,7 @@ namespace EMotionFX // callback that gets called before a node gets removed void AnimGraphStateTransition::OnRemoveNode(AnimGraph* animGraph, AnimGraphNode* nodeToRemove) { - for (AnimGraphTransitionCondition* condition : mConditions) + for (AnimGraphTransitionCondition* condition : m_conditions) { condition->OnRemoveNode(animGraph, nodeToRemove); } @@ -508,7 +508,7 @@ namespace EMotionFX void AnimGraphStateTransition::ResetConditions(AnimGraphInstance* animGraphInstance) { - for (AnimGraphTransitionCondition* condition : mConditions) + for (AnimGraphTransitionCondition* condition : m_conditions) { condition->Reset(animGraphInstance); } @@ -596,7 +596,7 @@ namespace EMotionFX { if (m_canBeInterruptedByOthers && transition != this && - (GetIsWildcardTransition() || transition->GetIsWildcardTransition() || transition->GetSourceNode() == mSourceNode)) + (GetIsWildcardTransition() || transition->GetIsWildcardTransition() || transition->GetSourceNode() == m_sourceNode)) { // Allow all in case the transition candidate list is empty, otherwise only allow transitions from the possible interruption candidate list. if (m_canBeInterruptedByTransitionIds.empty() || @@ -665,7 +665,7 @@ namespace EMotionFX // add all sub objects void AnimGraphStateTransition::RecursiveCollectObjects(AZStd::vector& outObjects) const { - for (const AnimGraphTransitionCondition* condition : mConditions) + for (const AnimGraphTransitionCondition* condition : m_conditions) { condition->RecursiveCollectObjects(outObjects); } @@ -706,7 +706,7 @@ namespace EMotionFX { AnimGraphObject::InvalidateUniqueData(animGraphInstance); - for (AnimGraphTransitionCondition* condition : mConditions) + for (AnimGraphTransitionCondition* condition : m_conditions) { condition->InvalidateUniqueData(animGraphInstance); } @@ -761,11 +761,11 @@ namespace EMotionFX void AnimGraphStateTransition::SetSourceNode(AnimGraphNode* node) { - mSourceNode = node; + m_sourceNode = node; - if (mSourceNode) + if (m_sourceNode) { - m_sourceNodeId = mSourceNode->GetId(); + m_sourceNodeId = m_sourceNode->GetId(); } else { @@ -775,17 +775,17 @@ namespace EMotionFX AnimGraphNode* AnimGraphStateTransition::GetSourceNode() const { - AZ_Assert(!mSourceNode || (mSourceNode && mSourceNode->GetId() == GetSourceNodeId()), "Source node not in sync with node id."); - return mSourceNode; + AZ_Assert(!m_sourceNode || (m_sourceNode && m_sourceNode->GetId() == GetSourceNodeId()), "Source node not in sync with node id."); + return m_sourceNode; } void AnimGraphStateTransition::SetTargetNode(AnimGraphNode* node) { - mTargetNode = node; + m_targetNode = node; - if (mTargetNode) + if (m_targetNode) { - m_targetNodeId = mTargetNode->GetId(); + m_targetNodeId = m_targetNode->GetId(); } else { @@ -795,36 +795,36 @@ namespace EMotionFX AnimGraphNode* AnimGraphStateTransition::GetTargetNode() const { - AZ_Assert(mTargetNode && mTargetNode->GetId() == GetTargetNodeId(), "Target node not in sync with node id."); - return mTargetNode; + AZ_Assert(m_targetNode && m_targetNode->GetId() == GetTargetNodeId(), "Target node not in sync with node id."); + return m_targetNode; } void AnimGraphStateTransition::SetVisualOffsets(int32 startX, int32 startY, int32 endX, int32 endY) { - mStartOffsetX = startX; - mStartOffsetY = startY; - mEndOffsetX = endX; - mEndOffsetY = endY; + m_startOffsetX = startX; + m_startOffsetY = startY; + m_endOffsetX = endX; + m_endOffsetY = endY; } int32 AnimGraphStateTransition::GetVisualStartOffsetX() const { - return mStartOffsetX; + return m_startOffsetX; } int32 AnimGraphStateTransition::GetVisualStartOffsetY() const { - return mStartOffsetY; + return m_startOffsetY; } int32 AnimGraphStateTransition::GetVisualEndOffsetX() const { - return mEndOffsetX; + return m_endOffsetX; } int32 AnimGraphStateTransition::GetVisualEndOffsetY() const { - return mEndOffsetY; + return m_endOffsetY; } bool AnimGraphStateTransition::CanWildcardTransitionFrom(AnimGraphNode* sourceNode) const @@ -837,7 +837,7 @@ namespace EMotionFX if (sourceNode) { - if (m_allowTransitionsFrom.Contains(mAnimGraph, sourceNode->GetId())) + if (m_allowTransitionsFrom.Contains(m_animGraph, sourceNode->GetId())) { // In case the given source node is part of the filter (either as individual state or part of a node group), return success. return true; @@ -849,23 +849,23 @@ namespace EMotionFX AZ::Outcome AnimGraphStateTransition::FindConditionIndex(AnimGraphTransitionCondition* condition) const { - const auto iterator = AZStd::find(mConditions.begin(), mConditions.end(), condition); - if (iterator == mConditions.end()) + const auto iterator = AZStd::find(m_conditions.begin(), m_conditions.end(), condition); + if (iterator == m_conditions.end()) { return AZ::Failure(); } - return AZ::Success(static_cast(AZStd::distance(mConditions.begin(), iterator))); + return AZ::Success(static_cast(AZStd::distance(m_conditions.begin(), iterator))); } AnimGraphStateMachine* AnimGraphStateTransition::GetStateMachine() const { - if (!mTargetNode) + if (!m_targetNode) { return nullptr; } - return azdynamic_cast(mTargetNode->GetParentNode()); + return azdynamic_cast(m_targetNode->GetParentNode()); } AZ::Crc32 AnimGraphStateTransition::GetEaseInOutSmoothnessVisibility() const @@ -881,8 +881,8 @@ namespace EMotionFX AZ::Crc32 AnimGraphStateTransition::GetVisibilityHideWhenExitOrEntry() const { // Hide when the transition is connected to an entry or an exit state. - if ((mSourceNode && (azrtti_typeid(mSourceNode) == azrtti_typeid() || azrtti_typeid(mSourceNode) == azrtti_typeid())) || - (mTargetNode && (azrtti_typeid(mTargetNode) == azrtti_typeid() || azrtti_typeid(mTargetNode) == azrtti_typeid()))) + if ((m_sourceNode && (azrtti_typeid(m_sourceNode) == azrtti_typeid() || azrtti_typeid(m_sourceNode) == azrtti_typeid())) || + (m_targetNode && (azrtti_typeid(m_targetNode) == azrtti_typeid() || azrtti_typeid(m_targetNode) == azrtti_typeid()))) { return AZ::Edit::PropertyVisibility::Hide; } @@ -1008,7 +1008,7 @@ namespace EMotionFX ->Field("id", &AnimGraphStateTransition::m_id) ->Field("sourceNodeId", &AnimGraphStateTransition::m_sourceNodeId) ->Field("targetNodeId", &AnimGraphStateTransition::m_targetNodeId) - ->Field("isWildcard", &AnimGraphStateTransition::mIsWildcardTransition) + ->Field("isWildcard", &AnimGraphStateTransition::m_isWildcardTransition) ->Field("isDisabled", &AnimGraphStateTransition::m_isDisabled) ->Field("priority", &AnimGraphStateTransition::m_priority) ->Field("canBeInterruptedByOthers", &AnimGraphStateTransition::m_canBeInterruptedByOthers) @@ -1025,11 +1025,11 @@ namespace EMotionFX ->Field("interpolationType", &AnimGraphStateTransition::m_interpolationType) ->Field("easeInSmoothness", &AnimGraphStateTransition::m_easeInSmoothness) ->Field("easeOutSmoothness", &AnimGraphStateTransition::m_easeOutSmoothness) - ->Field("startOffsetX", &AnimGraphStateTransition::mStartOffsetX) - ->Field("startOffsetY", &AnimGraphStateTransition::mStartOffsetY) - ->Field("endOffsetX", &AnimGraphStateTransition::mEndOffsetX) - ->Field("endOffsetY", &AnimGraphStateTransition::mEndOffsetY) - ->Field("conditions", &AnimGraphStateTransition::mConditions) + ->Field("startOffsetX", &AnimGraphStateTransition::m_startOffsetX) + ->Field("startOffsetY", &AnimGraphStateTransition::m_startOffsetY) + ->Field("endOffsetX", &AnimGraphStateTransition::m_endOffsetX) + ->Field("endOffsetY", &AnimGraphStateTransition::m_endOffsetY) + ->Field("conditions", &AnimGraphStateTransition::m_conditions) ->Field("actionSetup", &AnimGraphStateTransition::m_actionSetup) ->Field("extractionMode", &AnimGraphStateTransition::m_extractionMode) ; diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphStateTransition.h b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphStateTransition.h index c9347111bb..9da239b13b 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphStateTransition.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphStateTransition.h @@ -63,11 +63,11 @@ namespace EMotionFX ~UniqueData() = default; public: - AnimGraphNode* mSourceNode = nullptr; - float mBlendWeight = 0.0f; - float mBlendProgress = 0.0f; - float mTotalSeconds = 0.0f; - bool mIsDone = false; + AnimGraphNode* m_sourceNode = nullptr; + float m_blendWeight = 0.0f; + float m_blendProgress = 0.0f; + float m_totalSeconds = 0.0f; + bool m_isDone = false; }; class StateFilterLocal final @@ -218,14 +218,14 @@ namespace EMotionFX * to the destination state. It is basically a transition from all nodes to the destination node of the wildcard transition. A wildcard transition does not have a fixed source node. * @result True in case the transition is a wildcard transition, false if not. */ - bool GetIsWildcardTransition() const { return mIsWildcardTransition; } + bool GetIsWildcardTransition() const { return m_isWildcardTransition; } bool CanWildcardTransitionFrom(AnimGraphNode* sourceNode) const; AnimGraphStateMachine* GetStateMachine() const; - MCORE_INLINE size_t GetNumConditions() const { return mConditions.size(); } - MCORE_INLINE AnimGraphTransitionCondition* GetCondition(size_t index) const { return mConditions[index]; } + MCORE_INLINE size_t GetNumConditions() const { return m_conditions.size(); } + MCORE_INLINE AnimGraphTransitionCondition* GetCondition(size_t index) const { return m_conditions[index]; } AZ::Outcome FindConditionIndex(AnimGraphTransitionCondition* condition) const; void AddCondition(AnimGraphTransitionCondition* condition); @@ -262,12 +262,12 @@ namespace EMotionFX AZ::Crc32 GetVisibilityCanBeInterruptedBy() const; AZ::Crc32 GetVisibilityMaxInterruptionBlendWeight() const; - AZStd::vector mConditions{}; + AZStd::vector m_conditions{}; StateFilterLocal m_allowTransitionsFrom; TriggerActionSetup m_actionSetup; - AnimGraphNode* mSourceNode = nullptr; - AnimGraphNode* mTargetNode = nullptr; + AnimGraphNode* m_sourceNode = nullptr; + AnimGraphNode* m_targetNode = nullptr; AZ::u64 m_sourceNodeId = AnimGraphNodeId::InvalidId; AZ::u64 m_targetNodeId = AnimGraphNodeId::InvalidId; AZ::u64 m_id = AnimGraphConnectionId::Create(); /**< The unique identification number. */ @@ -275,16 +275,16 @@ namespace EMotionFX float m_transitionTime = 0.3f; float m_easeInSmoothness = 0.0f; float m_easeOutSmoothness = 1.0f; - AZ::s32 mStartOffsetX = 0; - AZ::s32 mStartOffsetY = 0; - AZ::s32 mEndOffsetX = 0; - AZ::s32 mEndOffsetY = 0; + AZ::s32 m_startOffsetX = 0; + AZ::s32 m_startOffsetY = 0; + AZ::s32 m_endOffsetX = 0; + AZ::s32 m_endOffsetY = 0; AZ::u32 m_priority = 0; AnimGraphObject::ESyncMode m_syncMode = AnimGraphObject::SYNCMODE_DISABLED; AnimGraphObject::EEventMode m_eventMode = AnimGraphObject::EVENTMODE_BOTHNODES; AnimGraphObject::EExtractionMode m_extractionMode = AnimGraphObject::EXTRACTIONMODE_BLEND; EInterpolationType m_interpolationType = INTERPOLATIONFUNCTION_LINEAR; - bool mIsWildcardTransition = false; /**< Flag which indicates if the state transition is a wildcard transition or not. */ + bool m_isWildcardTransition = false; /**< Flag which indicates if the state transition is a wildcard transition or not. */ bool m_isDisabled = false; bool m_canBeInterruptedByOthers = false; AZStd::vector m_canBeInterruptedByTransitionIds{}; diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphSyncTrack.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphSyncTrack.cpp index c6ccf038dd..3c77beaa60 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphSyncTrack.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphSyncTrack.cpp @@ -364,7 +364,7 @@ namespace EMotionFX float AnimGraphSyncTrack::GetDuration() const { - return mMotion->GetMotionData()->GetDuration(); + return m_motion->GetMotionData()->GetDuration(); } diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphTagCondition.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphTagCondition.cpp index 6b2d0084d7..e6f6e9b9bd 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphTagCondition.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphTagCondition.cpp @@ -54,7 +54,7 @@ namespace EMotionFX for (size_t i = 0; i < numTags; ++i) { // Search for the parameter with the name of the tag and save the index. - const AZ::Outcome parameterIndex = mAnimGraph->FindValueParameterIndexByName(m_tags[i]); + const AZ::Outcome parameterIndex = m_animGraph->FindValueParameterIndexByName(m_tags[i]); if (parameterIndex.IsSuccess()) { // Cache the parameter index to avoid string lookups at runtime. diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphTimeCondition.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphTimeCondition.cpp index a339d5752b..3da55ced3e 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphTimeCondition.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphTimeCondition.cpp @@ -73,7 +73,7 @@ namespace EMotionFX UniqueData* uniqueData = static_cast(animGraphInstance->FindOrCreateUniqueObjectData(this)); // increase the elapsed time of the condition - uniqueData->mElapsedTime += timePassedInSeconds; + uniqueData->m_elapsedTime += timePassedInSeconds; } @@ -84,7 +84,7 @@ namespace EMotionFX UniqueData* uniqueData = static_cast(animGraphInstance->FindOrCreateUniqueObjectData(this)); // reset the elapsed time - uniqueData->mElapsedTime = 0.0f; + uniqueData->m_elapsedTime = 0.0f; // use randomized count downs? if (m_useRandomization) @@ -93,17 +93,17 @@ namespace EMotionFX if (animGraphInstance->IsNetworkEnabled()) { // using a seeded random in order to generate predictable result in network. - uniqueData->mCountDownTime = MCore::Random::RandF(m_minRandomTime, m_maxRandomTime, animGraphInstance->GetLcgRandom()); + uniqueData->m_countDownTime = MCore::Random::RandF(m_minRandomTime, m_maxRandomTime, animGraphInstance->GetLcgRandom()); } else { - uniqueData->mCountDownTime = MCore::Random::RandF(m_minRandomTime, m_maxRandomTime); + uniqueData->m_countDownTime = MCore::Random::RandF(m_minRandomTime, m_maxRandomTime); } } else { // get the fixed count down value from the attribute - uniqueData->mCountDownTime = m_countDownTime; + uniqueData->m_countDownTime = m_countDownTime; } } @@ -115,7 +115,7 @@ namespace EMotionFX UniqueData* uniqueData = static_cast(animGraphInstance->FindOrCreateUniqueObjectData(this)); // in case the elapsed time is bigger than the count down time, we can trigger the condition - if (uniqueData->mElapsedTime + 0.0001f >= uniqueData->mCountDownTime) // The 0.0001f is to counter floating point inaccuracies. The AZ float epsilon is too small. + if (uniqueData->m_elapsedTime + 0.0001f >= uniqueData->m_countDownTime) // The 0.0001f is to counter floating point inaccuracies. The AZ float epsilon is too small. { return true; } @@ -162,8 +162,8 @@ namespace EMotionFX AnimGraphTimeCondition::UniqueData::UniqueData(AnimGraphObject* object, AnimGraphInstance* animGraphInstance) : AnimGraphObjectData(object, animGraphInstance) { - mElapsedTime = 0.0f; - mCountDownTime = 0.0f; + m_elapsedTime = 0.0f; + m_countDownTime = 0.0f; } diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphTimeCondition.h b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphTimeCondition.h index 96de4f2d36..47d17a4d10 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphTimeCondition.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphTimeCondition.h @@ -42,8 +42,8 @@ namespace EMotionFX ~UniqueData() override; public: - float mElapsedTime; /**< The elapsed time in seconds for the given anim graph instance. */ - float mCountDownTime; /**< The count down time in seconds for the given anim graph instance. */ + float m_elapsedTime; /**< The elapsed time in seconds for the given anim graph instance. */ + float m_countDownTime; /**< The count down time in seconds for the given anim graph instance. */ }; AnimGraphTimeCondition(); diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphTransitionCondition.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphTransitionCondition.cpp index dd297177f3..d7b626f4cf 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphTransitionCondition.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphTransitionCondition.cpp @@ -24,9 +24,9 @@ namespace EMotionFX AnimGraphTransitionCondition::~AnimGraphTransitionCondition() { - if (mAnimGraph) + if (m_animGraph) { - mAnimGraph->RemoveObject(this); + m_animGraph->RemoveObject(this); } } diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphTriggerAction.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphTriggerAction.cpp index 05b4c6c5b5..ffb8898ce0 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphTriggerAction.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphTriggerAction.cpp @@ -30,9 +30,9 @@ namespace EMotionFX AnimGraphTriggerAction::~AnimGraphTriggerAction() { - if (mAnimGraph) + if (m_animGraph) { - mAnimGraph->RemoveObject(this); + m_animGraph->RemoveObject(this); } } diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphVector2Condition.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphVector2Condition.cpp index ac1e283c19..987f74417e 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphVector2Condition.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/AnimGraphVector2Condition.cpp @@ -57,7 +57,7 @@ namespace EMotionFX SetOperation(m_operation); // Find the parameter index for the given parameter name, to prevent string based lookups every frame - m_parameterIndex = mAnimGraph->FindValueParameterIndexByName(m_parameterName); + m_parameterIndex = m_animGraph->FindValueParameterIndexByName(m_parameterName); } @@ -89,7 +89,7 @@ namespace EMotionFX if (m_parameterIndex.IsSuccess()) { // get access to the parameter info and return the type of its default value - const ValueParameter* valueParameter = mAnimGraph->FindValueParameter(m_parameterIndex.GetValue()); + const ValueParameter* valueParameter = m_animGraph->FindValueParameter(m_parameterIndex.GetValue()); return azrtti_typeid(valueParameter); } else @@ -348,7 +348,7 @@ namespace EMotionFX { AZ_UNUSED(beforeChange); AZ_UNUSED(afterChange); - m_parameterIndex = mAnimGraph->FindValueParameterIndexByName(m_parameterName); + m_parameterIndex = m_animGraph->FindValueParameterIndexByName(m_parameterName); } void AnimGraphVector2Condition::ParameterRemoved(const AZStd::string& oldParameterName) @@ -360,7 +360,7 @@ namespace EMotionFX } else { - m_parameterIndex = mAnimGraph->FindValueParameterIndexByName(m_parameterName); + m_parameterIndex = m_animGraph->FindValueParameterIndexByName(m_parameterName); } } diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/BlendSpace1DNode.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/BlendSpace1DNode.cpp index ee4b6d0dab..0e823075a4 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/BlendSpace1DNode.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/BlendSpace1DNode.cpp @@ -81,7 +81,7 @@ namespace EMotionFX void BlendSpace1DNode::UniqueData::Update() { - BlendSpace1DNode* blendSpaceNode = azdynamic_cast(mObject); + BlendSpace1DNode* blendSpaceNode = azdynamic_cast(m_object); AZ_Assert(blendSpaceNode, "Unique data linked to incorrect node type."); blendSpaceNode->UpdateMotionInfos(this); @@ -172,7 +172,7 @@ namespace EMotionFX } // If the node is disabled, simply output a bind pose. - if (mDisabled) + if (m_disabled) { SetBindPoseAtOutput(animGraphInstance); return; @@ -246,7 +246,7 @@ namespace EMotionFX if (GetEMotionFX().GetIsInEditorMode() && GetCanVisualize(animGraphInstance)) { - animGraphInstance->GetActorInstance()->DrawSkeleton(outputPose->GetPose(), mVisualizeColor); + animGraphInstance->GetActorInstance()->DrawSkeleton(outputPose->GetPose(), m_visualizeColor); } } @@ -262,7 +262,7 @@ namespace EMotionFX DoTopDownUpdate(animGraphInstance, m_syncMode, uniqueData->m_leaderMotionIdx, uniqueData->m_motionInfos, uniqueData->m_allMotionsHaveSyncTracks); - EMotionFX::BlendTreeConnection* paramConnection = GetInputPort(INPUTPORT_VALUE).mConnection; + EMotionFX::BlendTreeConnection* paramConnection = GetInputPort(INPUTPORT_VALUE).m_connection; if (paramConnection) { AnimGraphNode* paramSrcNode = paramConnection->GetSourceNode(); @@ -276,9 +276,9 @@ namespace EMotionFX void BlendSpace1DNode::Update(AnimGraphInstance* animGraphInstance, float timePassedInSeconds) { - if (!mDisabled) + if (!m_disabled) { - EMotionFX::BlendTreeConnection* paramConnection = GetInputPort(INPUTPORT_VALUE).mConnection; + EMotionFX::BlendTreeConnection* paramConnection = GetInputPort(INPUTPORT_VALUE).m_connection; if (paramConnection) { UpdateIncomingNode(animGraphInstance, paramConnection->GetSourceNode(), timePassedInSeconds); @@ -291,7 +291,7 @@ namespace EMotionFX AZ_Assert(uniqueData, "UniqueData not found for BlendSpace1DNode"); uniqueData->Clear(); - if (mDisabled) + if (m_disabled) { return; } @@ -331,7 +331,7 @@ namespace EMotionFX UniqueData* uniqueData = static_cast(FindOrCreateUniqueNodeData(animGraphInstance)); - if (mDisabled) + if (m_disabled) { RequestRefDatas(animGraphInstance); AnimGraphRefCountedData* data = uniqueData->GetRefCountedData(); @@ -340,7 +340,7 @@ namespace EMotionFX return; } - EMotionFX::BlendTreeConnection* paramConnection = GetInputPort(INPUTPORT_VALUE).mConnection; + EMotionFX::BlendTreeConnection* paramConnection = GetInputPort(INPUTPORT_VALUE).m_connection; if (paramConnection) { paramConnection->GetSourceNode()->PerformPostUpdate(animGraphInstance, timePassedInSeconds); @@ -410,7 +410,7 @@ namespace EMotionFX MotionInstance* motionInstance = motionInstancePool.RequestNew(motion, actorInstance); motionInstance->InitFromPlayBackInfo(playInfo, true); - motionInstance->SetRetargetingEnabled(animGraphInstance->GetRetargetingEnabled() && playInfo.mRetarget); + motionInstance->SetRetargetingEnabled(animGraphInstance->GetRetargetingEnabled() && playInfo.m_retarget); motionInstance->UnPause(); motionInstance->SetIsActive(true); motionInstance->SetWeight(1.0f, 0.0f); @@ -434,7 +434,7 @@ namespace EMotionFX bool BlendSpace1DNode::GetIsInPlace(AnimGraphInstance* animGraphInstance) const { - EMotionFX::BlendTreeConnection* inPlaceConnection = GetInputPort(INPUTPORT_INPLACE).mConnection; + EMotionFX::BlendTreeConnection* inPlaceConnection = GetInputPort(INPUTPORT_INPLACE).m_connection; if (inPlaceConnection) { return GetInputNumberAsBool(animGraphInstance, INPUTPORT_INPLACE); @@ -584,7 +584,7 @@ namespace EMotionFX void BlendSpace1DNode::SetMotions(const AZStd::vector& motions) { m_motions = motions; - if (mAnimGraph) + if (m_animGraph) { Reinit(); } @@ -638,7 +638,7 @@ namespace EMotionFX } else { - EMotionFX::BlendTreeConnection* paramConnection = GetInputPort(INPUTPORT_VALUE).mConnection; + EMotionFX::BlendTreeConnection* paramConnection = GetInputPort(INPUTPORT_VALUE).m_connection; if (GetEMotionFX().GetIsInEditorMode()) { @@ -754,7 +754,7 @@ namespace EMotionFX void BlendSpace1DNode::SetCalculationMethod(ECalculationMethod calculationMethod) { m_calculationMethod = calculationMethod; - if (mAnimGraph) + if (m_animGraph) { Reinit(); } @@ -770,7 +770,7 @@ namespace EMotionFX void BlendSpace1DNode::SetSyncLeaderMotionId(const AZStd::string& syncLeaderMotionId) { m_syncLeaderMotionId = syncLeaderMotionId; - if (mAnimGraph) + if (m_animGraph) { Reinit(); } @@ -786,7 +786,7 @@ namespace EMotionFX void BlendSpace1DNode::SetEvaluatorType(const AZ::TypeId& evaluatorType) { m_evaluatorType = evaluatorType; - if (mAnimGraph) + if (m_animGraph) { Reinit(); } diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/BlendSpace2DNode.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/BlendSpace2DNode.cpp index c1f1035f00..b34a860b71 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/BlendSpace2DNode.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/BlendSpace2DNode.cpp @@ -160,7 +160,7 @@ namespace EMotionFX void BlendSpace2DNode::UniqueData::Update() { - BlendSpace2DNode* blendSpaceNode = azdynamic_cast(mObject); + BlendSpace2DNode* blendSpaceNode = azdynamic_cast(m_object); AZ_Assert(blendSpaceNode, "Unique data linked to incorrect node type."); blendSpaceNode->UpdateMotionInfos(this); @@ -273,7 +273,7 @@ namespace EMotionFX bool BlendSpace2DNode::GetIsInPlace(AnimGraphInstance* animGraphInstance) const { - EMotionFX::BlendTreeConnection* inPlaceConnection = GetInputPort(INPUTPORT_INPLACE).mConnection; + EMotionFX::BlendTreeConnection* inPlaceConnection = GetInputPort(INPUTPORT_INPLACE).m_connection; if (inPlaceConnection) { return GetInputNumberAsBool(animGraphInstance, INPUTPORT_INPLACE); @@ -301,7 +301,7 @@ namespace EMotionFX } // If the node is disabled, simply output a bind pose. - if (mDisabled) + if (m_disabled) { SetBindPoseAtOutput(animGraphInstance); return; @@ -378,7 +378,7 @@ namespace EMotionFX if (GetEMotionFX().GetIsInEditorMode() && GetCanVisualize(animGraphInstance)) { - animGraphInstance->GetActorInstance()->DrawSkeleton(outputPose->GetPose(), mVisualizeColor); + animGraphInstance->GetActorInstance()->DrawSkeleton(outputPose->GetPose(), m_visualizeColor); } } @@ -389,7 +389,7 @@ namespace EMotionFX return; } - if (mDisabled) + if (m_disabled) { return; } @@ -401,7 +401,7 @@ namespace EMotionFX for (int i = 0; i < 2; ++i) { const uint32 portIdx = (i == 0) ? INPUTPORT_XVALUE : INPUTPORT_YVALUE; - EMotionFX::BlendTreeConnection* paramConnection = GetInputPort(portIdx).mConnection; + EMotionFX::BlendTreeConnection* paramConnection = GetInputPort(portIdx).m_connection; if (paramConnection) { AnimGraphNode* paramSrcNode = paramConnection->GetSourceNode(); @@ -420,15 +420,15 @@ namespace EMotionFX return; } - if (!mDisabled) + if (!m_disabled) { - EMotionFX::BlendTreeConnection* param1Connection = GetInputPort(INPUTPORT_XVALUE).mConnection; + EMotionFX::BlendTreeConnection* param1Connection = GetInputPort(INPUTPORT_XVALUE).m_connection; if (param1Connection) { UpdateIncomingNode(animGraphInstance, param1Connection->GetSourceNode(), timePassedInSeconds); } - EMotionFX::BlendTreeConnection* param2Connection = GetInputPort(INPUTPORT_YVALUE).mConnection; + EMotionFX::BlendTreeConnection* param2Connection = GetInputPort(INPUTPORT_YVALUE).m_connection; if (param2Connection) { UpdateIncomingNode(animGraphInstance, param2Connection->GetSourceNode(), timePassedInSeconds); @@ -441,7 +441,7 @@ namespace EMotionFX AZ_Assert(uniqueData, "Unique data not found for blend space 2D node '%s'.", GetName()); uniqueData->Clear(); - if (mDisabled) + if (m_disabled) { return; } @@ -481,7 +481,7 @@ namespace EMotionFX UniqueData* uniqueData = static_cast(FindOrCreateUniqueNodeData(animGraphInstance)); - if (mDisabled) + if (m_disabled) { RequestRefDatas(animGraphInstance); AnimGraphRefCountedData* data = uniqueData->GetRefCountedData(); @@ -490,12 +490,12 @@ namespace EMotionFX return; } - EMotionFX::BlendTreeConnection* param1Connection = GetInputPort(INPUTPORT_XVALUE).mConnection; + EMotionFX::BlendTreeConnection* param1Connection = GetInputPort(INPUTPORT_XVALUE).m_connection; if (param1Connection) { param1Connection->GetSourceNode()->PerformPostUpdate(animGraphInstance, timePassedInSeconds); } - EMotionFX::BlendTreeConnection* param2Connection = GetInputPort(INPUTPORT_YVALUE).mConnection; + EMotionFX::BlendTreeConnection* param2Connection = GetInputPort(INPUTPORT_YVALUE).m_connection; if (param2Connection) { param2Connection->GetSourceNode()->PerformPostUpdate(animGraphInstance, timePassedInSeconds); @@ -565,7 +565,7 @@ namespace EMotionFX MotionInstance* motionInstance = motionInstancePool.RequestNew(motion, actorInstance); motionInstance->InitFromPlayBackInfo(playInfo, true); - motionInstance->SetRetargetingEnabled(animGraphInstance->GetRetargetingEnabled() && playInfo.mRetarget); + motionInstance->SetRetargetingEnabled(animGraphInstance->GetRetargetingEnabled() && playInfo.m_retarget); motionInstance->UnPause(); motionInstance->SetIsActive(true); motionInstance->SetWeight(1.0f, 0.0f); @@ -693,7 +693,7 @@ namespace EMotionFX void BlendSpace2DNode::SetMotions(const AZStd::vector& motions) { m_motions = motions; - if (mAnimGraph) + if (m_animGraph) { Reinit(); } @@ -709,7 +709,7 @@ namespace EMotionFX void BlendSpace2DNode::SetSyncLeaderMotionId(const AZStd::string& syncLeaderMotionId) { m_syncLeaderMotionId = syncLeaderMotionId; - if (mAnimGraph) + if (m_animGraph) { Reinit(); } @@ -725,7 +725,7 @@ namespace EMotionFX void BlendSpace2DNode::SetEvaluatorTypeX(const AZ::TypeId& evaluatorType) { m_evaluatorTypeX = evaluatorType; - if (mAnimGraph) + if (m_animGraph) { Reinit(); } @@ -747,7 +747,7 @@ namespace EMotionFX void BlendSpace2DNode::SetCalculationMethodX(ECalculationMethod calculationMethod) { m_calculationMethodX = calculationMethod; - if (mAnimGraph) + if (m_animGraph) { Reinit(); } @@ -763,7 +763,7 @@ namespace EMotionFX void BlendSpace2DNode::SetEvaluatorTypeY(const AZ::TypeId& evaluatorType) { m_evaluatorTypeY = evaluatorType; - if (mAnimGraph) + if (m_animGraph) { Reinit(); } @@ -785,7 +785,7 @@ namespace EMotionFX void BlendSpace2DNode::SetCalculationMethodY(ECalculationMethod calculationMethod) { m_calculationMethodY = calculationMethod; - if (mAnimGraph) + if (m_animGraph) { Reinit(); } @@ -1041,8 +1041,8 @@ namespace EMotionFX { AZ::Vector2 samplePoint; - EMotionFX::BlendTreeConnection* inputConnectionX = GetInputPort(INPUTPORT_XVALUE).mConnection; - EMotionFX::BlendTreeConnection* inputConnectionY = GetInputPort(INPUTPORT_YVALUE).mConnection; + EMotionFX::BlendTreeConnection* inputConnectionX = GetInputPort(INPUTPORT_XVALUE).m_connection; + EMotionFX::BlendTreeConnection* inputConnectionY = GetInputPort(INPUTPORT_YVALUE).m_connection; if (GetEMotionFX().GetIsInEditorMode()) { diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/BlendSpaceNode.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/BlendSpaceNode.cpp index 953bb530e7..2c3960ca5e 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/BlendSpaceNode.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/BlendSpaceNode.cpp @@ -233,7 +233,7 @@ namespace EMotionFX MotionInstance* motionInstance = motionInfo.m_motionInstance; motionInstance->SetFreezeAtLastFrame(!motionInstance->GetIsPlayingForever()); motionInstance->SetPlaySpeed(motionInfo.m_playSpeed); - motionInstance->SetRetargetingEnabled(m_retarget && mAnimGraph->GetRetargetingEnabled()); + motionInstance->SetRetargetingEnabled(m_retarget && m_animGraph->GetRetargetingEnabled()); motionInfo.m_preSyncTime = motionInstance->GetCurrentTime(); // If syncing is enabled, we are going to update the current play time (m_currentTime) of all motions later based @@ -361,8 +361,8 @@ namespace EMotionFX trajectoryDeltaAMirrored.Add(instanceDelta, blendInfo.m_weight); motionInstance->SetMirrorMotion(isMirrored); // restore current mirrored flag } - trajectoryDelta.mRotation.Normalize(); - trajectoryDeltaAMirrored.mRotation.Normalize(); + trajectoryDelta.m_rotation.Normalize(); + trajectoryDeltaAMirrored.m_rotation.Normalize(); } data->SetTrajectoryDelta(trajectoryDelta); diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/BlendSpaceNode.h b/Gems/EMotionFX/Code/EMotionFX/Source/BlendSpaceNode.h index 893962d65d..b2acd240ee 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/BlendSpaceNode.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/BlendSpaceNode.h @@ -102,8 +102,8 @@ namespace EMotionFX virtual const AZStd::vector& GetMotions() const = 0; //! The node is in interactive mode when the user is interactively changing the current point. - void SetInteractiveMode(bool enable) { mInteractiveMode = enable; } - bool IsInInteractiveMode() const { return mInteractiveMode; } + void SetInteractiveMode(bool enable) { m_interactiveMode = enable; } + bool IsInInteractiveMode() const { return m_interactiveMode; } static void Reflect(AZ::ReflectContext* context); @@ -166,7 +166,7 @@ namespace EMotionFX static const char* s_eventModeNone; protected: - bool mInteractiveMode = false;// true when the user is changing the current point by dragging in GUI + bool m_interactiveMode = false;// true when the user is changing the current point by dragging in GUI bool m_retarget = true; bool m_inPlace = false; }; diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/BlendSpaceParamEvaluator.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/BlendSpaceParamEvaluator.cpp index 48f343cfc3..fb3f9e398a 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/BlendSpaceParamEvaluator.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/BlendSpaceParamEvaluator.cpp @@ -100,14 +100,14 @@ namespace EMotionFX Transform transform; motion->CalcNodeTransform(&motionInstance, &transform, actor, node, 0, retargeting); - AZ::Vector3 position(transform.mPosition); + AZ::Vector3 position(transform.m_position); float distance = 0.0f; float time = sampleTimeStep; for (uint32 i = 1; i < numSamples; ++i, time += sampleTimeStep) { motion->CalcNodeTransform(&motionInstance, &transform, actor, node, time, retargeting); - distance += (transform.mPosition - position).GetLength(); - position = transform.mPosition; + distance += (transform.m_position - position).GetLength(); + position = transform.m_position; } return distance / duration; @@ -142,16 +142,16 @@ namespace EMotionFX Transform transform; motion->CalcNodeTransform(&motionInstance, &transform, actor, node, 0, retargeting); - AZ::Quaternion rotation(transform.mRotation); + AZ::Quaternion rotation(transform.m_rotation); float totalAngle = 0.0f; float time = sampleTimeStep; for (uint32 i = 1; i < numSamples; ++i, time += sampleTimeStep) { motion->CalcNodeTransform(&motionInstance, &transform, actor, node, time, retargeting); - AZ::Quaternion deltaRotation = transform.mRotation * rotation.GetConjugate(); + AZ::Quaternion deltaRotation = transform.m_rotation * rotation.GetConjugate(); const float angle = -MCore::GetEulerZ(deltaRotation);// negating because we prefer the convention of clockwise being +ve totalAngle += angle; - rotation = transform.mRotation; + rotation = transform.m_rotation; } return totalAngle / duration; @@ -185,7 +185,7 @@ namespace EMotionFX Transform endTransform; motion->CalcNodeTransform(&motionInstance, &endTransform, actor, node, duration, retargeting); - AZ::Vector3 diffVec(endTransform.mPosition - startTransform.mPosition); + AZ::Vector3 diffVec(endTransform.m_position - startTransform.m_position); return ::atan2f(diffVec.GetX(), diffVec.GetY()); } @@ -218,19 +218,19 @@ namespace EMotionFX Transform transform; motion->CalcNodeTransform(&motionInstance, &transform, actor, node, 0, retargeting); - AZ::Vector3 position(transform.mPosition); + AZ::Vector3 position(transform.m_position); float slopeSum = 0.0f; float time = sampleTimeStep; uint32 count = 0; // number of samples added to slopeSum for (uint32 i = 1; i < numSamples; ++i, time += sampleTimeStep) { motion->CalcNodeTransform(&motionInstance, &transform, actor, node, time, retargeting); - AZ::Vector3 diffVec(transform.mPosition - position); + AZ::Vector3 diffVec(transform.m_position - position); float horizontalDistance = AZ::Vector2(diffVec.GetX(), diffVec.GetY()).GetLength(); if (horizontalDistance > 0) { slopeSum += atan2f(diffVec.GetZ(), horizontalDistance); - position = transform.mPosition; + position = transform.m_position; count++; } } @@ -268,16 +268,16 @@ namespace EMotionFX Transform transform; motion->CalcNodeTransform(&motionInstance, &transform, actor, node, 0, retargeting); - AZ::Quaternion rotation(transform.mRotation); + AZ::Quaternion rotation(transform.m_rotation); float totalTurnAngle = 0.0f; float time = sampleTimeStep; for (uint32 i = 1; i < numSamples; ++i, time += sampleTimeStep) { motion->CalcNodeTransform(&motionInstance, &transform, actor, node, time, retargeting); - AZ::Quaternion deltaRotation = transform.mRotation * rotation.GetConjugate(); + AZ::Quaternion deltaRotation = transform.m_rotation * rotation.GetConjugate(); const float angle = -MCore::GetEulerZ(deltaRotation);// negating because we prefer the convention of clockwise being +ve totalTurnAngle += angle; - rotation = transform.mRotation; + rotation = transform.m_rotation; } return totalTurnAngle; @@ -311,7 +311,7 @@ namespace EMotionFX Transform endTransform; motion->CalcNodeTransform(&motionInstance, &endTransform, actor, node, duration, retargeting); - return (endTransform.mPosition - startTransform.mPosition).GetLength(); + return (endTransform.m_position - startTransform.m_position).GetLength(); } const char* BlendSpaceTravelDistanceParamEvaluator::GetName() const @@ -345,15 +345,15 @@ namespace EMotionFX Transform transform; motion->CalcNodeTransform(&motionInstance, &transform, actor, node, 0, retargeting); - AZ::Vector3 position(transform.mPosition); + AZ::Vector3 position(transform.m_position); float distance = 0.0f; float time = sampleTimeStep; for (uint32 i = 1; i < numSamples; ++i, time += sampleTimeStep) { motion->CalcNodeTransform(&motionInstance, &transform, actor, node, time, retargeting); - AZ::Vector3 moveVec(transform.mPosition - position); + AZ::Vector3 moveVec(transform.m_position - position); distance += moveVec.Dot(xAxis); - position = transform.mPosition; + position = transform.m_position; } return distance / duration; @@ -390,15 +390,15 @@ namespace EMotionFX Transform transform; motion->CalcNodeTransform(&motionInstance, &transform, actor, node, 0, retargeting); - AZ::Vector3 position(transform.mPosition); + AZ::Vector3 position(transform.m_position); float distance = 0.0f; float time = sampleTimeStep; for (uint32 i = 1; i < numSamples; ++i, time += sampleTimeStep) { motion->CalcNodeTransform(&motionInstance, &transform, actor, node, time, retargeting); - AZ::Vector3 moveVec(transform.mPosition - position); + AZ::Vector3 moveVec(transform.m_position - position); distance += moveVec.Dot(yAxis); - position = transform.mPosition; + position = transform.m_position; } return distance / duration; diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTree.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTree.cpp index 809a5d1c31..f742696275 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTree.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTree.cpp @@ -30,7 +30,7 @@ namespace EMotionFX : AnimGraphNode() , m_finalNodeId(AnimGraphNodeId::InvalidId) , m_finalNode(nullptr) - , mVirtualFinalNode(nullptr) + , m_virtualFinalNode(nullptr) { // setup output ports InitOutputPorts(1); @@ -88,7 +88,7 @@ namespace EMotionFX // Relink input and output ports for all nodes in the blend tree with their corresponding connections. // This has to be done after all child nodes called InitAfterLoading() and RegisterPorts(). We're depending on the node load order here // and a given node might be connected to one that has not been loaded yet and thus the ports have not been created yet. - for (AnimGraphNode* childNode : mChildNodes) + for (AnimGraphNode* childNode : m_childNodes) { childNode->RelinkPortConnections(); } @@ -102,9 +102,9 @@ namespace EMotionFX AnimGraphNode* BlendTree::GetRealFinalNode() const { // if there is a virtual final node, use that one - if (mVirtualFinalNode) + if (m_virtualFinalNode) { - return mVirtualFinalNode; + return m_virtualFinalNode; } // otherwise get the real final node @@ -126,7 +126,7 @@ namespace EMotionFX AnimGraphPose* outputPose; // if this node is disabled, output the bind pose - if (mDisabled) + if (m_disabled) { RequestPoses(animGraphInstance); outputPose = GetOutputPose(animGraphInstance, OUTPUTPORT_POSE)->GetValue(); @@ -156,7 +156,7 @@ namespace EMotionFX // visualize it if (GetEMotionFX().GetIsInEditorMode() && GetCanVisualize(animGraphInstance)) { - animGraphInstance->GetActorInstance()->DrawSkeleton(outputPose->GetPose(), mVisualizeColor); + animGraphInstance->GetActorInstance()->DrawSkeleton(outputPose->GetPose(), m_visualizeColor); } } @@ -165,7 +165,7 @@ namespace EMotionFX void BlendTree::PostUpdate(AnimGraphInstance* animGraphInstance, float timePassedInSeconds) { // if this node is disabled, exit - if (mDisabled) + if (m_disabled) { RequestRefDatas(animGraphInstance); AnimGraphNodeData* uniqueData = FindOrCreateUniqueNodeData(animGraphInstance); @@ -213,7 +213,7 @@ namespace EMotionFX void BlendTree::Update(AnimGraphInstance* animGraphInstance, float timePassedInSeconds) { // if this node is disabled, output the bind pose - if (mDisabled) + if (m_disabled) { AnimGraphNodeData* uniqueData = FindOrCreateUniqueNodeData(animGraphInstance); uniqueData->Clear(); @@ -243,7 +243,7 @@ namespace EMotionFX // rewind the nodes in the tree void BlendTree::Rewind(AnimGraphInstance* animGraphInstance) { - for (AnimGraphNode* childNode : mChildNodes) + for (AnimGraphNode* childNode : m_childNodes) { childNode->Rewind(animGraphInstance); } @@ -276,7 +276,7 @@ namespace EMotionFX void BlendTree::RecursiveSetUniqueDataFlag(AnimGraphInstance* animGraphInstance, uint32 flag, bool enabled) { // set flag for this node - animGraphInstance->SetObjectFlags(mObjectIndex, flag, enabled); + animGraphInstance->SetObjectFlags(m_objectIndex, flag, enabled); // get the final node AnimGraphNode* finalNode = GetRealFinalNode(); @@ -310,7 +310,7 @@ namespace EMotionFX void BlendTree::SetVirtualFinalNode(AnimGraphNode* node) { - mVirtualFinalNode = node; + m_virtualFinalNode = node; AnimGraphNotificationBus::Broadcast(&AnimGraphNotificationBus::Events::OnVirtualFinalNodeSet, this); } @@ -319,7 +319,7 @@ namespace EMotionFX void BlendTree::SetFinalNodeId(const AnimGraphNodeId finalNodeId) { m_finalNodeId = finalNodeId; - if (mAnimGraph) + if (m_animGraph) { Reinit(); } @@ -342,7 +342,7 @@ namespace EMotionFX AZStd::unordered_set visitedNodes; AZStd::unordered_set > cycleConnections; - for (AnimGraphNode* childNode : mChildNodes) + for (AnimGraphNode* childNode : m_childNodes) { visitedNodes.clear(); visitedNodes.emplace(childNode); diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTree.h b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTree.h index cfe844fdb9..4ba4ba1f00 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTree.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTree.h @@ -64,7 +64,7 @@ namespace EMotionFX bool GetHasOutputPose() const override { return true; } void SetVirtualFinalNode(AnimGraphNode* node); - MCORE_INLINE AnimGraphNode* GetVirtualFinalNode() const { return mVirtualFinalNode; } + MCORE_INLINE AnimGraphNode* GetVirtualFinalNode() const { return m_virtualFinalNode; } void SetFinalNodeId(const AnimGraphNodeId finalNodeId); AZ_FORCE_INLINE AnimGraphNodeId GetFinalNodeId() const { return m_finalNodeId; } @@ -100,7 +100,7 @@ namespace EMotionFX private: AZ::u64 m_finalNodeId; /**< Id of the final node that gets serialized. The final node represents the output of the blend tree. */ BlendTreeFinalNode* m_finalNode; /**< The cached final node pointer based on the final node id. */ - AnimGraphNode* mVirtualFinalNode; /**< The virtual final node, which is the node who's output is used as final output. A value of nullptr means it will use the real mFinalNode. */ + AnimGraphNode* m_virtualFinalNode; /**< The virtual final node, which is the node who's output is used as final output. A value of nullptr means it will use the real m_finalNode. */ /** * Helper function that recursively (through incoming connections) detect cycles. The function performs a DFS to find back edges (connections to itself or to one of its ancestors). diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeAccumTransformNode.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeAccumTransformNode.cpp index ffbf38c48a..c8f53a4b6f 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeAccumTransformNode.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeAccumTransformNode.cpp @@ -28,28 +28,28 @@ namespace EMotionFX BlendTreeAccumTransformNode::UniqueData::UniqueData(AnimGraphNode* node, AnimGraphInstance* animGraphInstance) : AnimGraphNodeData(node, animGraphInstance) { - mAdditiveTransform.Identity(); - EMFX_SCALECODE(mAdditiveTransform.mScale.CreateZero();) + m_additiveTransform.Identity(); + EMFX_SCALECODE(m_additiveTransform.m_scale.CreateZero();) SetHasError(true); } void BlendTreeAccumTransformNode::UniqueData::Update() { - BlendTreeAccumTransformNode* accumTransformNode = azdynamic_cast(mObject); + BlendTreeAccumTransformNode* accumTransformNode = azdynamic_cast(m_object); AZ_Assert(accumTransformNode, "Unique data linked to incorrect node type."); - const ActorInstance* actorInstance = mAnimGraphInstance->GetActorInstance(); + const ActorInstance* actorInstance = m_animGraphInstance->GetActorInstance(); const Actor* actor = actorInstance->GetActor(); const Skeleton* skeleton = actor->GetSkeleton(); const Node* node = skeleton->FindNodeByName(accumTransformNode->GetTargetNodeName().c_str()); if (node) { - mNodeIndex = node->GetNodeIndex(); + m_nodeIndex = node->GetNodeIndex(); SetHasError(false); } else { - mNodeIndex = InvalidIndex; + m_nodeIndex = InvalidIndex; SetHasError(true); } } @@ -137,7 +137,7 @@ namespace EMotionFX // make sure we have at least an input pose, otherwise output the bind pose - if (GetInputPort(INPUTPORT_POSE).mConnection == nullptr) + if (GetInputPort(INPUTPORT_POSE).m_connection == nullptr) { RequestPoses(animGraphInstance); outputPose = GetOutputPose(animGraphInstance, OUTPUTPORT_RESULT)->GetValue(); @@ -154,12 +154,12 @@ namespace EMotionFX // get the local transform from our node Transform inputTransform; - outputPose->GetPose().GetLocalSpaceTransform(uniqueData->mNodeIndex, &inputTransform); + outputPose->GetPose().GetLocalSpaceTransform(uniqueData->m_nodeIndex, &inputTransform); Transform outputTransform = inputTransform; // process the rotation - if (GetInputPort(INPUTPORT_ROTATE_AMOUNT).mConnection) + if (GetInputPort(INPUTPORT_ROTATE_AMOUNT).m_connection) { OutputIncomingNode(animGraphInstance, GetInputNode(INPUTPORT_ROTATE_AMOUNT)); @@ -188,15 +188,15 @@ namespace EMotionFX } const AZ::Quaternion targetRot = MCore::CreateFromAxisAndAngle(axis, MCore::Math::DegreesToRadians(360.0f * (inputAmount - 0.5f) * invertFactor)); - AZ::Quaternion deltaRot = MCore::LinearInterpolate(AZ::Quaternion::CreateIdentity(), targetRot, uniqueData->mDeltaTime * factor); + AZ::Quaternion deltaRot = MCore::LinearInterpolate(AZ::Quaternion::CreateIdentity(), targetRot, uniqueData->m_deltaTime * factor); deltaRot.Normalize(); - uniqueData->mAdditiveTransform.mRotation = uniqueData->mAdditiveTransform.mRotation * deltaRot; - outputTransform.mRotation = (inputTransform.mRotation * uniqueData->mAdditiveTransform.mRotation); - outputTransform.mRotation.Normalize(); + uniqueData->m_additiveTransform.m_rotation = uniqueData->m_additiveTransform.m_rotation * deltaRot; + outputTransform.m_rotation = (inputTransform.m_rotation * uniqueData->m_additiveTransform.m_rotation); + outputTransform.m_rotation.Normalize(); } // process the translation - if (GetInputPort(INPUTPORT_TRANSLATE_AMOUNT).mConnection) + if (GetInputPort(INPUTPORT_TRANSLATE_AMOUNT).m_connection) { OutputIncomingNode(animGraphInstance, GetInputNode(INPUTPORT_TRANSLATE_AMOUNT)); @@ -225,15 +225,15 @@ namespace EMotionFX } axis *= (inputAmount - 0.5f) * invertFactor; - uniqueData->mAdditiveTransform.mPosition += MCore::LinearInterpolate(AZ::Vector3::CreateZero(), axis, uniqueData->mDeltaTime * factor); - outputTransform.mPosition = inputTransform.mPosition + uniqueData->mAdditiveTransform.mPosition; + uniqueData->m_additiveTransform.m_position += MCore::LinearInterpolate(AZ::Vector3::CreateZero(), axis, uniqueData->m_deltaTime * factor); + outputTransform.m_position = inputTransform.m_position + uniqueData->m_additiveTransform.m_position; } // process the scale EMFX_SCALECODE ( - if (GetInputPort(INPUTPORT_SCALE_AMOUNT).mConnection) + if (GetInputPort(INPUTPORT_SCALE_AMOUNT).m_connection) { OutputIncomingNode(animGraphInstance, GetInputNode(INPUTPORT_SCALE_AMOUNT)); @@ -265,18 +265,18 @@ namespace EMotionFX } axis *= (inputAmount - 0.5f) * invertFactor; - uniqueData->mAdditiveTransform.mScale += MCore::LinearInterpolate(AZ::Vector3::CreateZero(), axis, uniqueData->mDeltaTime * factor); - outputTransform.mScale = inputTransform.mScale + uniqueData->mAdditiveTransform.mScale; + uniqueData->m_additiveTransform.m_scale += MCore::LinearInterpolate(AZ::Vector3::CreateZero(), axis, uniqueData->m_deltaTime * factor); + outputTransform.m_scale = inputTransform.m_scale + uniqueData->m_additiveTransform.m_scale; } ) // update the transformation of the node - outputPose->GetPose().SetLocalSpaceTransform(uniqueData->mNodeIndex, outputTransform); + outputPose->GetPose().SetLocalSpaceTransform(uniqueData->m_nodeIndex, outputTransform); // visualize it if (GetEMotionFX().GetIsInEditorMode() && GetCanVisualize(animGraphInstance)) { - animGraphInstance->GetActorInstance()->DrawSkeleton(outputPose->GetPose(), mVisualizeColor); + animGraphInstance->GetActorInstance()->DrawSkeleton(outputPose->GetPose(), m_visualizeColor); } } @@ -288,21 +288,21 @@ namespace EMotionFX // store the passed time UniqueData* uniqueData = static_cast(FindOrCreateUniqueNodeData(animGraphInstance)); - uniqueData->mDeltaTime = timePassedInSeconds; + uniqueData->m_deltaTime = timePassedInSeconds; } void BlendTreeAccumTransformNode::OnAxisChanged() { - if (!mAnimGraph) + if (!m_animGraph) { return; } - const size_t numInstances = mAnimGraph->GetNumAnimGraphInstances(); + const size_t numInstances = m_animGraph->GetNumAnimGraphInstances(); for (size_t i = 0; i < numInstances; ++i) { - AnimGraphInstance* animGraphInstance = mAnimGraph->GetAnimGraphInstance(i); + AnimGraphInstance* animGraphInstance = m_animGraph->GetAnimGraphInstance(i); UniqueData* uniqueData = static_cast(animGraphInstance->FindOrCreateUniqueNodeData(this)); if (!uniqueData) @@ -310,8 +310,8 @@ namespace EMotionFX continue; } - uniqueData->mAdditiveTransform.Identity(); - EMFX_SCALECODE(uniqueData->mAdditiveTransform.mScale.CreateZero();) + uniqueData->m_additiveTransform.Identity(); + EMFX_SCALECODE(uniqueData->m_additiveTransform.m_scale.CreateZero();) InvalidateUniqueData(animGraphInstance); } diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeAccumTransformNode.h b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeAccumTransformNode.h index d8ca76aaa8..8f8fc21a6e 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeAccumTransformNode.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeAccumTransformNode.h @@ -83,9 +83,9 @@ namespace EMotionFX void Update() override; public: - Transform mAdditiveTransform = Transform::CreateIdentity(); - size_t mNodeIndex = InvalidIndex; - float mDeltaTime = 0.0f; + Transform m_additiveTransform = Transform::CreateIdentity(); + size_t m_nodeIndex = InvalidIndex; + float m_deltaTime = 0.0f; }; BlendTreeAccumTransformNode(); diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeBlend2AdditiveNode.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeBlend2AdditiveNode.cpp index f16d2f6943..1f3f41bb15 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeBlend2AdditiveNode.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeBlend2AdditiveNode.cpp @@ -45,7 +45,7 @@ namespace EMotionFX void BlendTreeBlend2AdditiveNode::Update(AnimGraphInstance* animGraphInstance, float timePassedInSeconds) { - if (mDisabled) + if (m_disabled) { AnimGraphNodeData* uniqueData = FindOrCreateUniqueNodeData(animGraphInstance); uniqueData->Clear(); @@ -91,7 +91,7 @@ namespace EMotionFX void BlendTreeBlend2AdditiveNode::Output(AnimGraphInstance* animGraphInstance) { // If we disabled this blend node, simply output a bind pose. - if (mDisabled) + if (m_disabled) { RequestPoses(animGraphInstance); AnimGraphPose* outputPose = GetOutputPose(animGraphInstance, OUTPUTPORT_POSE)->GetValue(); @@ -109,7 +109,7 @@ namespace EMotionFX OutputIncomingNode(animGraphInstance, weightNode); } - const size_t numNodes = uniqueData->mMask.size(); + const size_t numNodes = uniqueData->m_mask.size(); if (numNodes == 0) { OutputNoFeathering(animGraphInstance); @@ -122,7 +122,7 @@ namespace EMotionFX if (GetEMotionFX().GetIsInEditorMode() && GetCanVisualize(animGraphInstance)) { AnimGraphPose* outPose = GetOutputPose(animGraphInstance, OUTPUTPORT_POSE)->GetValue(); - animGraphInstance->GetActorInstance()->DrawSkeleton(outPose->GetPose(), mVisualizeColor); + animGraphInstance->GetActorInstance()->DrawSkeleton(outPose->GetPose(), m_visualizeColor); } } @@ -207,14 +207,14 @@ namespace EMotionFX Pose& outputLocalPose = outputPose->GetPose(); // If we use a mask, overwrite those nodes. - const size_t numNodes = uniqueData->mMask.size(); + const size_t numNodes = uniqueData->m_mask.size(); if (numNodes > 0) { Transform transform; for (size_t n = 0; n < numNodes; ++n) { - const float finalWeight = blendWeight;// * uniqueData->mWeights[n]; - const size_t nodeIndex = uniqueData->mMask[n]; + const float finalWeight = blendWeight;// * uniqueData->m_weights[n]; + const size_t nodeIndex = uniqueData->m_mask[n]; transform = outputLocalPose.GetLocalSpaceTransform(nodeIndex); transform.ApplyAdditive(additivePose.GetLocalSpaceTransform(nodeIndex), finalWeight); outputLocalPose.SetLocalSpaceTransform(nodeIndex, transform); @@ -241,7 +241,7 @@ namespace EMotionFX Transform delta = Transform::CreateIdentityWithZeroScale(); Transform deltaMirrored = Transform::CreateIdentityWithZeroScale(); - const bool hasMotionExtractionNodeInMask = (uniqueData->mMask.size() == 0) || (uniqueData->mMask.size() > 0 && AZStd::find(uniqueData->mMask.begin(), uniqueData->mMask.end(), actor->GetMotionExtractionNodeIndex()) != uniqueData->mMask.end()); + const bool hasMotionExtractionNodeInMask = (uniqueData->m_mask.size() == 0) || (uniqueData->m_mask.size() > 0 && AZStd::find(uniqueData->m_mask.begin(), uniqueData->m_mask.end(), actor->GetMotionExtractionNodeIndex()) != uniqueData->m_mask.end()); if (!hasMotionExtractionNodeInMask || !nodeBData || m_extractionMode == EXTRACTIONMODE_SOURCEONLY) { delta = nodeAData->GetTrajectoryDelta(); @@ -278,13 +278,13 @@ namespace EMotionFX void BlendTreeBlend2AdditiveNode::TopDownUpdate(AnimGraphInstance* animGraphInstance, float timePassedInSeconds) { - if (mDisabled) + if (m_disabled) { return; } UniqueData* uniqueData = static_cast(animGraphInstance->FindOrCreateUniqueObjectData(this)); - const BlendTreeConnection* con = GetInputPort(INPUTPORT_WEIGHT).mConnection; + const BlendTreeConnection* con = GetInputPort(INPUTPORT_WEIGHT).m_connection; if (con) { AnimGraphNodeData* sourceNodeUniqueData = con->GetSourceNode()->FindOrCreateUniqueNodeData(animGraphInstance); @@ -318,7 +318,7 @@ namespace EMotionFX // If we want to sync the motions. if (m_syncMode != SYNCMODE_DISABLED) { - const bool resync = (uniqueData->mSyncTrackNode != nodeA); + const bool resync = (uniqueData->m_syncTrackNode != nodeA); if (resync) { nodeA->RecursiveSetUniqueDataFlag(animGraphInstance, AnimGraphInstance::OBJECTFLAGS_RESYNC, true); @@ -327,7 +327,7 @@ namespace EMotionFX nodeB->RecursiveSetUniqueDataFlag(animGraphInstance, AnimGraphInstance::OBJECTFLAGS_RESYNC, true); } - uniqueData->mSyncTrackNode = nodeA; + uniqueData->m_syncTrackNode = nodeA; } // Sync the leader to this node. @@ -336,13 +336,13 @@ namespace EMotionFX // Sync the motion's to the leader. for (uint32 i = 0; i < 2; ++i) { - BlendTreeConnection* connection = mInputPorts[INPUTPORT_POSE_A + i].mConnection; + BlendTreeConnection* connection = m_inputPorts[INPUTPORT_POSE_A + i].m_connection; if (!connection) { continue; } - if (animGraphInstance->GetIsObjectFlagEnabled(mObjectIndex, AnimGraphInstance::OBJECTFLAGS_SYNCED) == false) + if (animGraphInstance->GetIsObjectFlagEnabled(m_objectIndex, AnimGraphInstance::OBJECTFLAGS_SYNCED) == false) { connection->GetSourceNode()->RecursiveSetUniqueDataFlag(animGraphInstance, AnimGraphInstance::OBJECTFLAGS_SYNCED, true); } @@ -389,7 +389,7 @@ namespace EMotionFX // post sync update void BlendTreeBlend2AdditiveNode::PostUpdate(AnimGraphInstance* animGraphInstance, float timePassedInSeconds) { - if (mDisabled) + if (m_disabled) { RequestRefDatas(animGraphInstance); UniqueData* uniqueData = static_cast(FindOrCreateUniqueNodeData(animGraphInstance)); @@ -399,7 +399,7 @@ namespace EMotionFX return; } - const BlendTreeConnection* con = GetInputPort(INPUTPORT_WEIGHT).mConnection; + const BlendTreeConnection* con = GetInputPort(INPUTPORT_WEIGHT).m_connection; if (con) { con->GetSourceNode()->PerformPostUpdate(animGraphInstance, timePassedInSeconds); diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeBlend2LegacyNode.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeBlend2LegacyNode.cpp index 78fbd91dd1..8e52ea6bef 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeBlend2LegacyNode.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeBlend2LegacyNode.cpp @@ -46,7 +46,7 @@ namespace EMotionFX void BlendTreeBlend2LegacyNode::Update(AnimGraphInstance* animGraphInstance, float timePassedInSeconds) { - if (mDisabled) + if (m_disabled) { AnimGraphNodeData* uniqueData = FindOrCreateUniqueNodeData(animGraphInstance); uniqueData->Clear(); @@ -95,7 +95,7 @@ namespace EMotionFX void BlendTreeBlend2LegacyNode::Output(AnimGraphInstance* animGraphInstance) { - if (mDisabled) + if (m_disabled) { RequestPoses(animGraphInstance); AnimGraphPose* outputPose = GetOutputPose(animGraphInstance, OUTPUTPORT_POSE)->GetValue(); @@ -112,7 +112,7 @@ namespace EMotionFX OutputIncomingNode(animGraphInstance, weightNode); } - const size_t numNodes = uniqueData->mMask.size(); + const size_t numNodes = uniqueData->m_mask.size(); if (numNodes == 0) { OutputNoFeathering(animGraphInstance); @@ -125,7 +125,7 @@ namespace EMotionFX if (GetEMotionFX().GetIsInEditorMode() && GetCanVisualize(animGraphInstance)) { AnimGraphPose* outputPose = GetOutputPose(animGraphInstance, OUTPUTPORT_POSE)->GetValue(); - animGraphInstance->GetActorInstance()->DrawSkeleton(outputPose->GetPose(), mVisualizeColor); + animGraphInstance->GetActorInstance()->DrawSkeleton(outputPose->GetPose(), m_visualizeColor); } } @@ -227,7 +227,7 @@ namespace EMotionFX *outputPose = *nodeA->GetMainOutputPose(animGraphInstance); Pose& outputLocalPose = outputPose->GetPose(); - const size_t numNodes = uniqueData->mMask.size(); + const size_t numNodes = uniqueData->m_mask.size(); if (numNodes > 0) { Transform transform = Transform::CreateIdentity(); @@ -236,8 +236,8 @@ namespace EMotionFX { for (size_t n = 0; n < numNodes; ++n) { - const float finalWeight = blendWeight /* * uniqueData->mWeights[n]*/; - const size_t nodeIndex = uniqueData->mMask[n]; + const float finalWeight = blendWeight /* * uniqueData->m_weights[n]*/; + const size_t nodeIndex = uniqueData->m_mask[n]; transform = outputLocalPose.GetLocalSpaceTransform(nodeIndex); transform.Blend(localMaskPose.GetLocalSpaceTransform(nodeIndex), finalWeight); outputLocalPose.SetLocalSpaceTransform(nodeIndex, transform); @@ -249,8 +249,8 @@ namespace EMotionFX const Pose* bindPose = actorInstance->GetTransformData()->GetBindPose(); for (size_t n = 0; n < numNodes; ++n) { - const float finalWeight = blendWeight /* * uniqueData->mWeights[n]*/; - const size_t nodeIndex = uniqueData->mMask[n]; + const float finalWeight = blendWeight /* * uniqueData->m_weights[n]*/; + const size_t nodeIndex = uniqueData->m_mask[n]; transform = outputLocalPose.GetLocalSpaceTransform(nodeIndex); transform.BlendAdditive(localMaskPose.GetLocalSpaceTransform(nodeIndex), bindPose->GetLocalSpaceTransform(nodeIndex), finalWeight); outputLocalPose.SetLocalSpaceTransform(nodeIndex, transform); @@ -272,7 +272,7 @@ namespace EMotionFX Transform delta = Transform::CreateIdentityWithZeroScale(); Transform deltaMirrored = Transform::CreateIdentityWithZeroScale(); - const bool hasMotionExtractionNodeInMask = (uniqueData->mMask.size() == 0) || (uniqueData->mMask.size() > 0 && AZStd::find(uniqueData->mMask.begin(), uniqueData->mMask.end(), actor->GetMotionExtractionNodeIndex()) != uniqueData->mMask.end()); + const bool hasMotionExtractionNodeInMask = (uniqueData->m_mask.size() == 0) || (uniqueData->m_mask.size() > 0 && AZStd::find(uniqueData->m_mask.begin(), uniqueData->m_mask.end(), actor->GetMotionExtractionNodeIndex()) != uniqueData->m_mask.end()); if (!m_additiveBlending) { CalculateMotionExtractionDelta(m_extractionMode, nodeAData, nodeBData, weight, hasMotionExtractionNodeInMask, delta, deltaMirrored); @@ -291,13 +291,13 @@ namespace EMotionFX void BlendTreeBlend2LegacyNode::TopDownUpdate(AnimGraphInstance* animGraphInstance, float timePassedInSeconds) { - if (mDisabled) + if (m_disabled) { return; } UniqueData* uniqueData = static_cast(animGraphInstance->FindOrCreateUniqueObjectData(this)); - const BlendTreeConnection* con = GetInputPort(INPUTPORT_WEIGHT).mConnection; + const BlendTreeConnection* con = GetInputPort(INPUTPORT_WEIGHT).m_connection; if (con) { AnimGraphNodeData* sourceNodeUniqueData = con->GetSourceNode()->FindOrCreateUniqueNodeData(animGraphInstance); @@ -322,7 +322,7 @@ namespace EMotionFX if (m_syncMode != SYNCMODE_DISABLED) { - const bool resync = (uniqueData->mSyncTrackNode != nodeA); + const bool resync = (uniqueData->m_syncTrackNode != nodeA); if (resync) { nodeA->RecursiveSetUniqueDataFlag(animGraphInstance, AnimGraphInstance::OBJECTFLAGS_RESYNC, true); @@ -331,20 +331,20 @@ namespace EMotionFX nodeB->RecursiveSetUniqueDataFlag(animGraphInstance, AnimGraphInstance::OBJECTFLAGS_RESYNC, true); } - uniqueData->mSyncTrackNode = nodeA; + uniqueData->m_syncTrackNode = nodeA; } nodeA->AutoSync(animGraphInstance, this, 0.0f, SYNCMODE_TRACKBASED, false); for (uint32 i = 0; i < 2; ++i) { - BlendTreeConnection* connection = mInputPorts[INPUTPORT_POSE_A + i].mConnection; + BlendTreeConnection* connection = m_inputPorts[INPUTPORT_POSE_A + i].m_connection; if (!connection) { continue; } - if (animGraphInstance->GetIsObjectFlagEnabled(mObjectIndex, AnimGraphInstance::OBJECTFLAGS_SYNCED) == false) + if (animGraphInstance->GetIsObjectFlagEnabled(m_objectIndex, AnimGraphInstance::OBJECTFLAGS_SYNCED) == false) { connection->GetSourceNode()->RecursiveSetUniqueDataFlag(animGraphInstance, AnimGraphInstance::OBJECTFLAGS_SYNCED, true); } @@ -412,7 +412,7 @@ namespace EMotionFX void BlendTreeBlend2LegacyNode::PostUpdate(AnimGraphInstance* animGraphInstance, float timePassedInSeconds) { - if (mDisabled) + if (m_disabled) { RequestRefDatas(animGraphInstance); UniqueData* uniqueData = static_cast(FindOrCreateUniqueNodeData(animGraphInstance)); @@ -422,7 +422,7 @@ namespace EMotionFX return; } - const BlendTreeConnection* con = GetInputPort(INPUTPORT_WEIGHT).mConnection; + const BlendTreeConnection* con = GetInputPort(INPUTPORT_WEIGHT).m_connection; if (con) { con->GetSourceNode()->PerformPostUpdate(animGraphInstance, timePassedInSeconds); diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeBlend2Node.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeBlend2Node.cpp index dfa7be26f8..06223d4b14 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeBlend2Node.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeBlend2Node.cpp @@ -45,7 +45,7 @@ namespace EMotionFX void BlendTreeBlend2Node::Update(AnimGraphInstance* animGraphInstance, float timePassedInSeconds) { - if (mDisabled) + if (m_disabled) { AnimGraphNodeData* uniqueData = FindOrCreateUniqueNodeData(animGraphInstance); uniqueData->Clear(); @@ -91,7 +91,7 @@ namespace EMotionFX void BlendTreeBlend2Node::Output(AnimGraphInstance* animGraphInstance) { - if (mDisabled) + if (m_disabled) { RequestPoses(animGraphInstance); AnimGraphPose* outputPose = GetOutputPose(animGraphInstance, OUTPUTPORT_POSE)->GetValue(); @@ -108,7 +108,7 @@ namespace EMotionFX OutputIncomingNode(animGraphInstance, weightNode); } - const size_t numNodes = uniqueData->mMask.size(); + const size_t numNodes = uniqueData->m_mask.size(); if (numNodes == 0) { OutputNoFeathering(animGraphInstance); @@ -121,7 +121,7 @@ namespace EMotionFX if (GetEMotionFX().GetIsInEditorMode() && GetCanVisualize(animGraphInstance)) { AnimGraphPose* outputPose = GetOutputPose(animGraphInstance, OUTPUTPORT_POSE)->GetValue(); - animGraphInstance->GetActorInstance()->DrawSkeleton(outputPose->GetPose(), mVisualizeColor); + animGraphInstance->GetActorInstance()->DrawSkeleton(outputPose->GetPose(), m_visualizeColor); } } @@ -210,14 +210,14 @@ namespace EMotionFX *outputPose = *nodeA->GetMainOutputPose(animGraphInstance); Pose& outputLocalPose = outputPose->GetPose(); - const size_t numNodes = uniqueData->mMask.size(); + const size_t numNodes = uniqueData->m_mask.size(); if (numNodes > 0) { Transform transform; for (size_t n = 0; n < numNodes; ++n) { - const float finalWeight = blendWeight /* * uniqueData->mWeights[n]*/; - const size_t nodeIndex = uniqueData->mMask[n]; + const float finalWeight = blendWeight /* * uniqueData->m_weights[n]*/; + const size_t nodeIndex = uniqueData->m_mask[n]; transform = outputLocalPose.GetLocalSpaceTransform(nodeIndex); transform.Blend(localMaskPose.GetLocalSpaceTransform(nodeIndex), finalWeight); outputLocalPose.SetLocalSpaceTransform(nodeIndex, transform); @@ -244,7 +244,7 @@ namespace EMotionFX Transform delta = Transform::CreateIdentityWithZeroScale(); Transform deltaMirrored = Transform::CreateIdentityWithZeroScale(); - const bool hasMotionExtractionNodeInMask = (uniqueData->mMask.size() == 0) || (uniqueData->mMask.size() > 0 && AZStd::find(uniqueData->mMask.begin(), uniqueData->mMask.end(), actor->GetMotionExtractionNodeIndex()) != uniqueData->mMask.end()); + const bool hasMotionExtractionNodeInMask = (uniqueData->m_mask.size() == 0) || (uniqueData->m_mask.size() > 0 && AZStd::find(uniqueData->m_mask.begin(), uniqueData->m_mask.end(), actor->GetMotionExtractionNodeIndex()) != uniqueData->m_mask.end()); CalculateMotionExtractionDelta(m_extractionMode, nodeAData, nodeBData, weight, hasMotionExtractionNodeInMask, delta, deltaMirrored); data->SetTrajectoryDelta(delta); @@ -254,13 +254,13 @@ namespace EMotionFX void BlendTreeBlend2Node::TopDownUpdate(AnimGraphInstance* animGraphInstance, float timePassedInSeconds) { - if (mDisabled) + if (m_disabled) { return; } UniqueData* uniqueData = static_cast(animGraphInstance->FindOrCreateUniqueObjectData(this)); - const BlendTreeConnection* con = GetInputPort(INPUTPORT_WEIGHT).mConnection; + const BlendTreeConnection* con = GetInputPort(INPUTPORT_WEIGHT).m_connection; if (con) { AnimGraphNodeData* sourceNodeUniqueData = con->GetSourceNode()->FindOrCreateUniqueNodeData(animGraphInstance); @@ -287,7 +287,7 @@ namespace EMotionFX if (m_syncMode != SYNCMODE_DISABLED) { - const bool resync = (uniqueData->mSyncTrackNode != nodeA); + const bool resync = (uniqueData->m_syncTrackNode != nodeA); if (resync) { nodeA->RecursiveSetUniqueDataFlag(animGraphInstance, AnimGraphInstance::OBJECTFLAGS_RESYNC, true); @@ -296,20 +296,20 @@ namespace EMotionFX nodeB->RecursiveSetUniqueDataFlag(animGraphInstance, AnimGraphInstance::OBJECTFLAGS_RESYNC, true); } - uniqueData->mSyncTrackNode = nodeA; + uniqueData->m_syncTrackNode = nodeA; } nodeA->AutoSync(animGraphInstance, this, 0.0f, SYNCMODE_TRACKBASED, false); for (uint32 i = 0; i < 2; ++i) { - BlendTreeConnection* connection = mInputPorts[INPUTPORT_POSE_A + i].mConnection; + BlendTreeConnection* connection = m_inputPorts[INPUTPORT_POSE_A + i].m_connection; if (!connection) { continue; } - if (animGraphInstance->GetIsObjectFlagEnabled(mObjectIndex, AnimGraphInstance::OBJECTFLAGS_SYNCED) == false) + if (animGraphInstance->GetIsObjectFlagEnabled(m_objectIndex, AnimGraphInstance::OBJECTFLAGS_SYNCED) == false) { connection->GetSourceNode()->RecursiveSetUniqueDataFlag(animGraphInstance, AnimGraphInstance::OBJECTFLAGS_SYNCED, true); } @@ -360,7 +360,7 @@ namespace EMotionFX void BlendTreeBlend2Node::PostUpdate(AnimGraphInstance* animGraphInstance, float timePassedInSeconds) { - if (mDisabled) + if (m_disabled) { RequestRefDatas(animGraphInstance); UniqueData* uniqueData = static_cast(FindOrCreateUniqueNodeData(animGraphInstance)); @@ -370,7 +370,7 @@ namespace EMotionFX return; } - const BlendTreeConnection* con = GetInputPort(INPUTPORT_WEIGHT).mConnection; + const BlendTreeConnection* con = GetInputPort(INPUTPORT_WEIGHT).m_connection; if (con) { con->GetSourceNode()->PerformPostUpdate(animGraphInstance, timePassedInSeconds); diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeBlend2NodeBase.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeBlend2NodeBase.cpp index 2876605b0a..fd399085a0 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeBlend2NodeBase.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeBlend2NodeBase.cpp @@ -21,23 +21,23 @@ namespace EMotionFX BlendTreeBlend2NodeBase::UniqueData::UniqueData(AnimGraphNode* node, AnimGraphInstance* animGraphInstance) : AnimGraphNodeData(node, animGraphInstance) - , mSyncTrackNode(nullptr) + , m_syncTrackNode(nullptr) { } void BlendTreeBlend2NodeBase::UniqueData::Update() { - BlendTreeBlend2NodeBase* blend2Node = azdynamic_cast(mObject); + BlendTreeBlend2NodeBase* blend2Node = azdynamic_cast(m_object); AZ_Assert(blend2Node, "Unique data linked to incorrect node type."); - mMask.clear(); + m_mask.clear(); - Actor* actor = mAnimGraphInstance->GetActorInstance()->GetActor(); + Actor* actor = m_animGraphInstance->GetActorInstance()->GetActor(); const AZStd::vector& weightedNodeMask = blend2Node->GetWeightedNodeMask(); if (!weightedNodeMask.empty()) { const size_t numNodes = weightedNodeMask.size(); - mMask.reserve(numNodes); + m_mask.reserve(numNodes); // Try to find the node indices by name for all masked nodes. const Skeleton* skeleton = actor->GetSkeleton(); @@ -46,7 +46,7 @@ namespace EMotionFX Node* node = skeleton->FindNodeByName(weightedNode.first.c_str()); if (node) { - mMask.emplace_back(node->GetNodeIndex()); + m_mask.emplace_back(node->GetNodeIndex()); } } } @@ -100,8 +100,8 @@ namespace EMotionFX void BlendTreeBlend2NodeBase::FindBlendNodes(AnimGraphInstance* animGraphInstance, AnimGraphNode** outBlendNodeA, AnimGraphNode** outBlendNodeB, float* outWeight, bool isAdditive, bool optimizeByWeight) { - BlendTreeConnection* connectionA = mInputPorts[INPUTPORT_POSE_A].mConnection; - BlendTreeConnection* connectionB = mInputPorts[INPUTPORT_POSE_B].mConnection; + BlendTreeConnection* connectionA = m_inputPorts[INPUTPORT_POSE_A].m_connection; + BlendTreeConnection* connectionB = m_inputPorts[INPUTPORT_POSE_B].m_connection; if (!connectionA && !connectionB) { *outBlendNodeA = nullptr; @@ -112,11 +112,11 @@ namespace EMotionFX if (connectionA && connectionB) { - *outWeight = (mInputPorts[INPUTPORT_WEIGHT].mConnection) ? GetInputNumberAsFloat(animGraphInstance, INPUTPORT_WEIGHT) : 0.0f; + *outWeight = (m_inputPorts[INPUTPORT_WEIGHT].m_connection) ? GetInputNumberAsFloat(animGraphInstance, INPUTPORT_WEIGHT) : 0.0f; *outWeight = MCore::Clamp(*outWeight, 0.0f, 1.0f); UniqueData* uniqueData = static_cast(animGraphInstance->FindOrCreateUniqueObjectData(this)); - if (!uniqueData->mMask.empty()) + if (!uniqueData->m_mask.empty()) { *outBlendNodeA = connectionA->GetSourceNode(); *outBlendNodeB = connectionB->GetSourceNode(); diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeBlend2NodeBase.h b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeBlend2NodeBase.h index 217e2a2e23..9a9b51b5d1 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeBlend2NodeBase.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeBlend2NodeBase.h @@ -54,8 +54,8 @@ namespace EMotionFX void Update() override; public: - AZStd::vector mMask; - AnimGraphNode* mSyncTrackNode; + AZStd::vector m_mask; + AnimGraphNode* m_syncTrackNode; }; BlendTreeBlend2NodeBase(); diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeBlendNNode.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeBlendNNode.cpp index 147e5c0aa9..7720822655 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeBlendNNode.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeBlendNNode.cpp @@ -31,7 +31,7 @@ namespace EMotionFX void BlendTreeBlendNNode::UniqueData::Update() { - BlendTreeBlendNNode* blendNNode = azdynamic_cast(mObject); + BlendTreeBlendNNode* blendNNode = azdynamic_cast(m_object); AZ_Assert(blendNNode, "Unique data linked to incorrect node type."); blendNNode->UpdateParamWeightRanges(); @@ -136,11 +136,11 @@ namespace EMotionFX { float weightRange = 0.0f; const float defaultWeightStep = 1.0f; - for (const AnimGraphNode::Port& port : mInputPorts) + for (const AnimGraphNode::Port& port : m_inputPorts) { - if (port.mConnection && port.mPortID != PORTID_INPUT_WEIGHT) + if (port.m_connection && port.m_portId != PORTID_INPUT_WEIGHT) { - m_paramWeights.emplace_back(port.mPortID, weightRange); + m_paramWeights.emplace_back(port.m_portId, weightRange); weightRange += defaultWeightStep; } } @@ -172,9 +172,9 @@ namespace EMotionFX } float weight = m_paramWeights.front().m_weightRange; - if (!mDisabled) + if (!m_disabled) { - if (mInputPorts[INPUTPORT_WEIGHT].mConnection) + if (m_inputPorts[INPUTPORT_WEIGHT].m_connection) { weight = GetInputNumberAsFloat(animGraphInstance, INPUTPORT_WEIGHT); } @@ -191,8 +191,8 @@ namespace EMotionFX *outWeight = 0.0f; // Calculate the blend weight and get the nodes - *outNodeA = GetInputPort(INPUTPORT_POSE_0 + poseIndexA).mConnection->GetSourceNode(); - *outNodeB = GetInputPort(INPUTPORT_POSE_0 + poseIndexB).mConnection->GetSourceNode(); + *outNodeA = GetInputPort(INPUTPORT_POSE_0 + poseIndexA).m_connection->GetSourceNode(); + *outNodeB = GetInputPort(INPUTPORT_POSE_0 + poseIndexB).m_connection->GetSourceNode(); *outIndexA = poseIndexA; *outIndexB = poseIndexB; @@ -227,8 +227,8 @@ namespace EMotionFX // Search complete: the input weight is between m_paramWeights[i] and m_paramWeights[i - 1] // Calculate the blend weight and get the nodes and then return - *outNodeA = GetInputPort(INPUTPORT_POSE_0 + poseIndexA).mConnection->GetSourceNode(); - *outNodeB = GetInputPort(INPUTPORT_POSE_0 + poseIndexB).mConnection->GetSourceNode(); + *outNodeA = GetInputPort(INPUTPORT_POSE_0 + poseIndexA).m_connection->GetSourceNode(); + *outNodeB = GetInputPort(INPUTPORT_POSE_0 + poseIndexB).m_connection->GetSourceNode(); *outIndexA = poseIndexA; *outIndexB = poseIndexB; @@ -242,8 +242,8 @@ namespace EMotionFX *outWeight = 0.0f; // Calculate the blend weight and get the nodes - *outNodeA = GetInputPort(INPUTPORT_POSE_0 + poseIndexA).mConnection->GetSourceNode(); - *outNodeB = GetInputPort(INPUTPORT_POSE_0 + poseIndexB).mConnection->GetSourceNode(); + *outNodeA = GetInputPort(INPUTPORT_POSE_0 + poseIndexA).m_connection->GetSourceNode(); + *outNodeB = GetInputPort(INPUTPORT_POSE_0 + poseIndexB).m_connection->GetSourceNode(); *outIndexA = poseIndexA; *outIndexB = poseIndexB; } @@ -259,7 +259,7 @@ namespace EMotionFX // check if we need to resync, this indicates the two motions we blend between changed bool resync = false; - if (uniqueData->mIndexA != poseIndexA || uniqueData->mIndexB != poseIndexB) + if (uniqueData->m_indexA != poseIndexA || uniqueData->m_indexB != poseIndexB) { resync = true; nodeA->RecursiveSetUniqueDataFlag(animGraphInstance, AnimGraphInstance::OBJECTFLAGS_RESYNC, true); @@ -272,14 +272,14 @@ namespace EMotionFX for (uint32 i = 0; i < 10; ++i) { // check if this port is used - BlendTreeConnection* connection = mInputPorts[i].mConnection; + BlendTreeConnection* connection = m_inputPorts[i].m_connection; if (connection == nullptr) { continue; } // mark this node recursively as synced - if (animGraphInstance->GetIsObjectFlagEnabled(mObjectIndex, AnimGraphInstance::OBJECTFLAGS_SYNCED) == false) + if (animGraphInstance->GetIsObjectFlagEnabled(m_objectIndex, AnimGraphInstance::OBJECTFLAGS_SYNCED) == false) { connection->GetSourceNode()->RecursiveSetUniqueDataFlag(animGraphInstance, AnimGraphInstance::OBJECTFLAGS_SYNCED, true); } @@ -307,8 +307,8 @@ namespace EMotionFX } } - uniqueData->mIndexA = poseIndexA; - uniqueData->mIndexB = poseIndexB; + uniqueData->m_indexA = poseIndexA; + uniqueData->m_indexB = poseIndexB; } // perform the calculations / actions @@ -320,7 +320,7 @@ namespace EMotionFX AnimGraphPose* outputPose; // if there are no connections, there is nothing to do - if (mDisabled || !HasRequiredInputs()) + if (m_disabled || !HasRequiredInputs()) { RequestPoses(animGraphInstance); outputPose = GetOutputPose(animGraphInstance, OUTPUTPORT_POSE)->GetValue(); @@ -331,13 +331,13 @@ namespace EMotionFX // visualize it if (GetEMotionFX().GetIsInEditorMode() && GetCanVisualize(animGraphInstance)) { - actorInstance->DrawSkeleton(outputPose->GetPose(), mVisualizeColor); + actorInstance->DrawSkeleton(outputPose->GetPose(), m_visualizeColor); } return; } // output the input weight node - BlendTreeConnection* connection = mInputPorts[INPUTPORT_WEIGHT].mConnection; + BlendTreeConnection* connection = m_inputPorts[INPUTPORT_WEIGHT].m_connection; if (connection) { OutputIncomingNode(animGraphInstance, connection->GetSourceNode()); @@ -361,7 +361,7 @@ namespace EMotionFX // visualize it if (GetEMotionFX().GetIsInEditorMode() && GetCanVisualize(animGraphInstance)) { - actorInstance->DrawSkeleton(outputPose->GetPose(), mVisualizeColor); + actorInstance->DrawSkeleton(outputPose->GetPose(), m_visualizeColor); } return; } @@ -377,7 +377,7 @@ namespace EMotionFX *outputPose = *poseA; if (GetEMotionFX().GetIsInEditorMode() && GetCanVisualize(animGraphInstance)) { - actorInstance->DrawSkeleton(outputPose->GetPose(), mVisualizeColor); + actorInstance->DrawSkeleton(outputPose->GetPose(), m_visualizeColor); } return; } @@ -394,7 +394,7 @@ namespace EMotionFX // visualize it if (GetEMotionFX().GetIsInEditorMode() && GetCanVisualize(animGraphInstance)) { - actorInstance->DrawSkeleton(outputPose->GetPose(), mVisualizeColor); + actorInstance->DrawSkeleton(outputPose->GetPose(), m_visualizeColor); } return; } @@ -408,31 +408,31 @@ namespace EMotionFX // visualize it if (GetEMotionFX().GetIsInEditorMode() && GetCanVisualize(animGraphInstance)) { - actorInstance->DrawSkeleton(outputPose->GetPose(), mVisualizeColor); + actorInstance->DrawSkeleton(outputPose->GetPose(), m_visualizeColor); } } bool BlendTreeBlendNNode::HasRequiredInputs() const { - if (mConnections.empty()) + if (m_connections.empty()) { return false; } // If we have only one input connection and it is our weight input, that means we have no input poses. - return !(mConnections.size() == 1 && mInputPorts[INPUTPORT_WEIGHT].mConnection); + return !(m_connections.size() == 1 && m_inputPorts[INPUTPORT_WEIGHT].m_connection); } void BlendTreeBlendNNode::Update(AnimGraphInstance* animGraphInstance, float timePassedInSeconds) { - if (mDisabled || !HasRequiredInputs()) + if (m_disabled || !HasRequiredInputs()) { UniqueData* uniqueData = static_cast(FindOrCreateUniqueNodeData(animGraphInstance)); uniqueData->Clear(); return; } - const BlendTreeConnection* weightConnection = mInputPorts[INPUTPORT_WEIGHT].mConnection; + const BlendTreeConnection* weightConnection = m_inputPorts[INPUTPORT_WEIGHT].m_connection; if (weightConnection) { UpdateIncomingNode(animGraphInstance, weightConnection->GetSourceNode(), timePassedInSeconds); @@ -475,14 +475,14 @@ namespace EMotionFX void BlendTreeBlendNNode::TopDownUpdate(AnimGraphInstance* animGraphInstance, float timePassedInSeconds) { // if the node is disabled - if (mDisabled || !HasRequiredInputs()) + if (m_disabled || !HasRequiredInputs()) { return; } // top down update the weight input UniqueData* uniqueData = static_cast(FindOrCreateUniqueNodeData(animGraphInstance)); - const BlendTreeConnection* con = GetInputPort(INPUTPORT_WEIGHT).mConnection; + const BlendTreeConnection* con = GetInputPort(INPUTPORT_WEIGHT).m_connection; if (con) { con->GetSourceNode()->FindOrCreateUniqueNodeData(animGraphInstance)->SetGlobalWeight(uniqueData->GetGlobalWeight()); @@ -565,7 +565,7 @@ namespace EMotionFX void BlendTreeBlendNNode::PostUpdate(AnimGraphInstance* animGraphInstance, float timePassedInSeconds) { // if we don't have enough inputs or are disabled, we don't need to update anything - if (mDisabled || !HasRequiredInputs()) + if (m_disabled || !HasRequiredInputs()) { // request the reference counted data inside the unique data RequestRefDatas(animGraphInstance); @@ -577,7 +577,7 @@ namespace EMotionFX } // get the input weight - BlendTreeConnection* connection = mInputPorts[INPUTPORT_WEIGHT].mConnection; + BlendTreeConnection* connection = m_inputPorts[INPUTPORT_WEIGHT].m_connection; if (connection) { connection->GetSourceNode()->PerformPostUpdate(animGraphInstance, timePassedInSeconds); @@ -732,21 +732,21 @@ namespace EMotionFX float* lastNonDefaultValue = nullptr; for (const AnimGraphNode::Port& port : inputPorts) { - if (port.mConnection && port.mPortID != PORTID_INPUT_WEIGHT) + if (port.m_connection && port.m_portId != PORTID_INPUT_WEIGHT) { const float defaultRangeValue = m_paramWeights.empty() ? 0.0f : m_paramWeights.back().GetWeightRange(); - auto portToWeightRangeIterator = portToWeightRangeTable.find(port.mPortID); + auto portToWeightRangeIterator = portToWeightRangeTable.find(port.m_portId); if (portToWeightRangeIterator == portToWeightRangeTable.end()) { // New connection just plugged - m_paramWeights.emplace_back(port.mPortID, defaultRangeValue); + m_paramWeights.emplace_back(port.m_portId, defaultRangeValue); defaultElementsCount++; } else { // Existing connection, using existing weight range - m_paramWeights.emplace_back(port.mPortID, portToWeightRangeIterator->second); + m_paramWeights.emplace_back(port.m_portId, portToWeightRangeIterator->second); // We want to fill the previous default values with uniformly distributed // Weight ranges, if possible: diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeBlendNNode.h b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeBlendNNode.h index 22b78db313..72d6ad120c 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeBlendNNode.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeBlendNNode.h @@ -94,8 +94,8 @@ namespace EMotionFX void Update() override; public: - uint32 mIndexA = InvalidIndex32; - uint32 mIndexB = InvalidIndex32; + uint32 m_indexA = InvalidIndex32; + uint32 m_indexB = InvalidIndex32; }; BlendTreeBlendNNode(); diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeBoolLogicNode.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeBoolLogicNode.cpp index 70cd7092f8..fc85790518 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeBoolLogicNode.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeBoolLogicNode.cpp @@ -33,7 +33,7 @@ namespace EMotionFX SetupOutputPort("Float", OUTPUTPORT_VALUE, MCore::AttributeFloat::TYPE_ID, PORTID_OUTPUT_VALUE); SetupOutputPort("Bool", OUTPUTPORT_BOOL, MCore::AttributeFloat::TYPE_ID, PORTID_OUTPUT_BOOL); - if (mAnimGraph) + if (m_animGraph) { Reinit(); } @@ -121,7 +121,7 @@ namespace EMotionFX void BlendTreeBoolLogicNode::Update(AnimGraphInstance* animGraphInstance, float timePassedInSeconds) { // if there are no incoming connections, there is nothing to do - if (mConnections.empty()) + if (m_connections.empty()) { return; } @@ -131,7 +131,7 @@ namespace EMotionFX // if both x and y inputs have connections bool x, y; - if (mConnections.size() == 2) + if (m_connections.size() == 2) { OutputIncomingNode(animGraphInstance, GetInputNode(INPUTPORT_X)); OutputIncomingNode(animGraphInstance, GetInputNode(INPUTPORT_Y)); @@ -142,7 +142,7 @@ namespace EMotionFX else // only x or y is connected { // if only x has something plugged in - if (mConnections[0]->GetTargetPort() == INPUTPORT_X) + if (m_connections[0]->GetTargetPort() == INPUTPORT_X) { OutputIncomingNode(animGraphInstance, GetInputNode(INPUTPORT_X)); x = GetInputNumberAsBool(animGraphInstance, INPUTPORT_X); @@ -150,7 +150,7 @@ namespace EMotionFX } else // only y has an input { - MCORE_ASSERT(mConnections[0]->GetTargetPort() == INPUTPORT_Y); + MCORE_ASSERT(m_connections[0]->GetTargetPort() == INPUTPORT_Y); OutputIncomingNode(animGraphInstance, GetInputNode(INPUTPORT_Y)); x = m_defaultValue; y = GetInputNumberAsBool(animGraphInstance, INPUTPORT_Y); @@ -174,7 +174,7 @@ namespace EMotionFX void BlendTreeBoolLogicNode::SetFunction(EFunction func) { m_functionEnum = func; - if (mAnimGraph) + if (m_animGraph) { Reinit(); } diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeConnection.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeConnection.cpp index 7bbbd5ade8..084396f201 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeConnection.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeConnection.cpp @@ -20,9 +20,9 @@ namespace EMotionFX : m_animGraph(nullptr) , m_sourceNode(nullptr) , m_id(AnimGraphConnectionId::Create()) - , mSourcePort(MCORE_INVALIDINDEX16) - , mTargetPort(MCORE_INVALIDINDEX16) - , mVisited(false) + , m_sourcePort(MCORE_INVALIDINDEX16) + , m_targetPort(MCORE_INVALIDINDEX16) + , m_visited(false) { } @@ -34,8 +34,8 @@ namespace EMotionFX m_animGraph = sourceNode->GetAnimGraph(); } - mSourcePort = sourcePort; - mTargetPort = targetPort; + m_sourcePort = sourcePort; + m_targetPort = targetPort; SetSourceNode(sourceNode); } @@ -80,7 +80,7 @@ namespace EMotionFX bool BlendTreeConnection::GetIsValid() const { // make sure the node and input numbers are valid - if (!m_sourceNode || mSourcePort == MCORE_INVALIDINDEX16 || mTargetPort == MCORE_INVALIDINDEX16) + if (!m_sourceNode || m_sourcePort == MCORE_INVALIDINDEX16 || m_targetPort == MCORE_INVALIDINDEX16) { return false; } @@ -101,7 +101,7 @@ namespace EMotionFX ->Version(2) ->Field("id", &BlendTreeConnection::m_id) ->Field("sourceNodeId", &BlendTreeConnection::m_sourceNodeId) - ->Field("sourcePortNr", &BlendTreeConnection::mSourcePort) - ->Field("targetPortNr", &BlendTreeConnection::mTargetPort); + ->Field("sourcePortNr", &BlendTreeConnection::m_sourcePort) + ->Field("targetPortNr", &BlendTreeConnection::m_targetPort); } } // namespace EMotionFX diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeConnection.h b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeConnection.h index 437cf6de51..7750b7b998 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeConnection.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeConnection.h @@ -41,17 +41,17 @@ namespace EMotionFX AZ_FORCE_INLINE AnimGraphNode* GetSourceNode() const { return m_sourceNode; } AZ_FORCE_INLINE AnimGraphNodeId GetSourceNodeId() const { return m_sourceNodeId; } - MCORE_INLINE AZ::u16 GetSourcePort() const { return mSourcePort; } - MCORE_INLINE AZ::u16 GetTargetPort() const { return mTargetPort; } + MCORE_INLINE AZ::u16 GetSourcePort() const { return m_sourcePort; } + MCORE_INLINE AZ::u16 GetTargetPort() const { return m_targetPort; } - MCORE_INLINE void SetSourcePort(AZ::u16 sourcePort) { mSourcePort = sourcePort; } - MCORE_INLINE void SetTargetPort(AZ::u16 targetPort) { mTargetPort = targetPort; } + MCORE_INLINE void SetSourcePort(AZ::u16 sourcePort) { m_sourcePort = sourcePort; } + MCORE_INLINE void SetTargetPort(AZ::u16 targetPort) { m_targetPort = targetPort; } AnimGraphConnectionId GetId() const { return m_id; } void SetId(AnimGraphConnectionId id) { m_id = id; } - MCORE_INLINE void SetIsVisited(bool visited) { mVisited = visited; } - MCORE_INLINE bool GetIsVisited() const { return mVisited; } + MCORE_INLINE void SetIsVisited(bool visited) { m_visited = visited; } + MCORE_INLINE bool GetIsVisited() const { return m_visited; } AnimGraph* GetAnimGraph() const { return m_animGraph; } @@ -62,8 +62,8 @@ namespace EMotionFX AnimGraphNode* m_sourceNode; /**< The source node from which the incoming connection comes. */ AZ::u64 m_sourceNodeId; AZ::u64 m_id; - AZ::u16 mSourcePort; /**< The source port number, so the output port number of the node where the connection comes from. */ - AZ::u16 mTargetPort; /**< The target port number, which is the input port number of the target node. */ - bool mVisited; /**< True when during updates this connection was used. */ + AZ::u16 m_sourcePort; /**< The source port number, so the output port number of the node where the connection comes from. */ + AZ::u16 m_targetPort; /**< The target port number, which is the input port number of the target node. */ + bool m_visited; /**< True when during updates this connection was used. */ }; } // namespace EMotionFX diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeDirectionToWeightNode.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeDirectionToWeightNode.cpp index c87cc32e67..8167addf44 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeDirectionToWeightNode.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeDirectionToWeightNode.cpp @@ -73,8 +73,8 @@ namespace EMotionFX UpdateAllIncomingNodes(animGraphInstance, timePassedInSeconds); // if there are less than two incoming connections, there is nothing to do - const size_t numConnections = mConnections.size(); - if (numConnections < 2 || mDisabled) + const size_t numConnections = m_connections.size(); + if (numConnections < 2 || m_disabled) { GetOutputFloat(animGraphInstance, OUTPUTPORT_WEIGHT)->SetValue(0.0f); return; diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeFinalNode.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeFinalNode.cpp index c69a778f7e..85418a81b8 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeFinalNode.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeFinalNode.cpp @@ -71,7 +71,7 @@ namespace EMotionFX AnimGraphPose* outputPose; // if there is no input, just output a bind pose - if (mConnections.empty()) + if (m_connections.empty()) { RequestPoses(animGraphInstance); outputPose = GetOutputPose(animGraphInstance, OUTPUTPORT_RESULT)->GetValue(); @@ -80,7 +80,7 @@ namespace EMotionFX } // output the source node - AnimGraphNode* sourceNode = mConnections[0]->GetSourceNode(); + AnimGraphNode* sourceNode = m_connections[0]->GetSourceNode(); OutputIncomingNode(animGraphInstance, sourceNode); RequestPoses(animGraphInstance); @@ -93,7 +93,7 @@ namespace EMotionFX void BlendTreeFinalNode::Update(AnimGraphInstance* animGraphInstance, float timePassedInSeconds) { // if there are no connections, output nothing - if (mConnections.empty()) + if (m_connections.empty()) { AnimGraphNodeData* uniqueData = FindOrCreateUniqueNodeData(animGraphInstance); uniqueData->Clear(); @@ -101,7 +101,7 @@ namespace EMotionFX } // update the source node - AnimGraphNode* sourceNode = mConnections[0]->GetSourceNode(); + AnimGraphNode* sourceNode = m_connections[0]->GetSourceNode(); UpdateIncomingNode(animGraphInstance, sourceNode, timePassedInSeconds); // update the sync track diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeFloatConditionNode.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeFloatConditionNode.cpp index 41c688f36a..b93659661d 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeFloatConditionNode.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeFloatConditionNode.cpp @@ -36,7 +36,7 @@ namespace EMotionFX SetupOutputPort("Bool", OUTPUTPORT_BOOL, MCore::AttributeFloat::TYPE_ID, PORTID_OUTPUT_BOOL); // false on default - if (mAnimGraph) + if (m_animGraph) { Reinit(); } @@ -119,7 +119,7 @@ namespace EMotionFX UpdateAllIncomingNodes(animGraphInstance, timePassedInSeconds); // if there are no incoming connections, there is nothing to do - const size_t numConnections = mConnections.size(); + const size_t numConnections = m_connections.size(); if (numConnections == 0) { return; @@ -138,7 +138,7 @@ namespace EMotionFX else // only x or y is connected { // if only x has something plugged in - if (mConnections[0]->GetTargetPort() == INPUTPORT_X) + if (m_connections[0]->GetTargetPort() == INPUTPORT_X) { OutputIncomingNode(animGraphInstance, GetInputNode(INPUTPORT_X)); x = GetInputNumberAsFloat(animGraphInstance, INPUTPORT_X); @@ -146,7 +146,7 @@ namespace EMotionFX } else // only y has an input { - MCORE_ASSERT(mConnections[0]->GetTargetPort() == INPUTPORT_Y); + MCORE_ASSERT(m_connections[0]->GetTargetPort() == INPUTPORT_Y); x = m_defaultValue; OutputIncomingNode(animGraphInstance, GetInputNode(INPUTPORT_Y)); y = GetInputNumberAsFloat(animGraphInstance, INPUTPORT_Y); @@ -198,7 +198,7 @@ namespace EMotionFX void BlendTreeFloatConditionNode::SetFunction(EFunction func) { m_functionEnum = func; - if (mAnimGraph) + if (m_animGraph) { Reinit(); } diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeFloatMath1Node.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeFloatMath1Node.cpp index 55924d8fd0..c70a1b69a6 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeFloatMath1Node.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeFloatMath1Node.cpp @@ -29,7 +29,7 @@ namespace EMotionFX InitOutputPorts(1); SetupOutputPort("Result", OUTPUTPORT_RESULT, MCore::AttributeFloat::TYPE_ID, PORTID_OUTPUT_RESULT); - if (mAnimGraph) + if (m_animGraph) { Reinit(); } @@ -192,12 +192,12 @@ namespace EMotionFX UpdateAllIncomingNodes(animGraphInstance, timePassedInSeconds); // If there are no incoming connections, there is nothing to do. - if (mConnections.empty()) + if (m_connections.empty()) { return; } // Pass the input value as output in case we are disabled and have connected inputs. - else if (mDisabled) + else if (m_disabled) { OutputIncomingNode(animGraphInstance, GetInputNode(INPUTPORT_X)); GetOutputFloat(animGraphInstance, OUTPUTPORT_RESULT)->SetValue(GetInputNumberAsFloat(animGraphInstance, INPUTPORT_X)); @@ -219,7 +219,7 @@ namespace EMotionFX void BlendTreeFloatMath1Node::SetMathFunction(EMathFunction func) { m_mathFunction = func; - if (mAnimGraph) + if (m_animGraph) { Reinit(); } diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeFloatMath2Node.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeFloatMath2Node.cpp index 30a056ee34..de63373bd0 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeFloatMath2Node.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeFloatMath2Node.cpp @@ -32,7 +32,7 @@ namespace EMotionFX InitOutputPorts(1); SetupOutputPort("Result", OUTPUTPORT_RESULT, MCore::AttributeFloat::TYPE_ID, PORTID_OUTPUT_RESULT); - if (mAnimGraph) + if (m_animGraph) { Reinit(); } @@ -131,14 +131,14 @@ namespace EMotionFX UpdateAllIncomingNodes(animGraphInstance, timePassedInSeconds); // if there are no incoming connections, there is nothing to do - if (mConnections.empty()) + if (m_connections.empty()) { return; } // if both x and y inputs have connections float x, y; - if (mConnections.size() == 2) + if (m_connections.size() == 2) { OutputIncomingNode(animGraphInstance, GetInputNode(INPUTPORT_X)); OutputIncomingNode(animGraphInstance, GetInputNode(INPUTPORT_Y)); @@ -149,7 +149,7 @@ namespace EMotionFX else // only x or y is connected { // if only x has something plugged in - if (mConnections[0]->GetTargetPort() == INPUTPORT_X) + if (m_connections[0]->GetTargetPort() == INPUTPORT_X) { OutputIncomingNode(animGraphInstance, GetInputNode(INPUTPORT_X)); x = GetInputNumberAsFloat(animGraphInstance, INPUTPORT_X); @@ -157,7 +157,7 @@ namespace EMotionFX } else // only y has an input { - MCORE_ASSERT(mConnections[0]->GetTargetPort() == INPUTPORT_Y); + MCORE_ASSERT(m_connections[0]->GetTargetPort() == INPUTPORT_Y); x = m_defaultValue; OutputIncomingNode(animGraphInstance, GetInputNode(INPUTPORT_Y)); y = GetInputNumberAsFloat(animGraphInstance, INPUTPORT_Y); @@ -178,7 +178,7 @@ namespace EMotionFX void BlendTreeFloatMath2Node::SetMathFunction(EMathFunction func) { m_mathFunction = func; - if (mAnimGraph) + if (m_animGraph) { Reinit(); } diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeFloatSwitchNode.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeFloatSwitchNode.cpp index 048cc48478..46fced6883 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeFloatSwitchNode.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeFloatSwitchNode.cpp @@ -81,7 +81,7 @@ namespace EMotionFX UpdateAllIncomingNodes(animGraphInstance, timePassedInSeconds); // if the decision port has no incomming connection, there is nothing we can do - if (mInputPorts[INPUTPORT_DECISION].mConnection == nullptr) + if (m_inputPorts[INPUTPORT_DECISION].m_connection == nullptr) { return; } @@ -91,7 +91,7 @@ namespace EMotionFX const int32 decisionValue = MCore::Clamp(GetInputNumberAsInt32(animGraphInstance, INPUTPORT_DECISION), 0, 4); // max 5 cases // return the value for that port - if (mInputPorts[INPUTPORT_0 + decisionValue].mConnection) + if (m_inputPorts[INPUTPORT_0 + decisionValue].m_connection) { //OutputIncomingNode( animGraphInstance, GetInputNode(INPUTPORT_0 + decisionValue) ); GetOutputFloat(animGraphInstance, OUTPUTPORT_RESULT)->SetValue(GetInputNumberAsFloat(animGraphInstance, INPUTPORT_0 + decisionValue)); diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeFootIKNode.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeFootIKNode.cpp index 97d7d4baa0..d81b090300 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeFootIKNode.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeFootIKNode.cpp @@ -31,16 +31,16 @@ namespace EMotionFX void BlendTreeFootIKNode::UniqueData::Update() { - BlendTreeFootIKNode* footIKNode = azdynamic_cast(mObject); + BlendTreeFootIKNode* footIKNode = azdynamic_cast(m_object); AZ_Assert(footIKNode, "Unique data linked to incorrect node type."); - const ActorInstance* actorInstance = mAnimGraphInstance->GetActorInstance(); + const ActorInstance* actorInstance = m_animGraphInstance->GetActorInstance(); const Actor* actor = actorInstance->GetActor(); const Skeleton* skeleton = actor->GetSkeleton(); SetHasError(false); // Initialize the legs. - if (!footIKNode->InitLegs(mAnimGraphInstance, this)) + if (!footIKNode->InitLegs(m_animGraphInstance, this)) { SetHasError(true); } @@ -49,7 +49,7 @@ namespace EMotionFX const AZStd::string& hipJointName = footIKNode->GetHipJointName(); if ((hipJointName.empty() || !skeleton->FindNodeAndIndexByName(hipJointName, m_hipJointIndex)) && !GetEMotionFX().GetEnableServerOptimization()) { - footIKNode = azdynamic_cast(mObject); + footIKNode = azdynamic_cast(m_object); AZ_Error("EMotionFX", false, "Anim graph footplant IK node '%s' cannot find hip joint named '%s'", footIKNode->GetName(), hipJointName.c_str()); SetHasError(true); } @@ -102,7 +102,7 @@ namespace EMotionFX float BlendTreeFootIKNode::GetActorInstanceScale(const ActorInstance* actorInstance) const { #ifndef EMFX_SCALE_DISABLED - return actorInstance->GetWorldSpaceTransform().mScale.GetZ(); + return actorInstance->GetWorldSpaceTransform().m_scale.GetZ(); #else return 1.0f; #endif @@ -185,7 +185,7 @@ namespace EMotionFX AZ_Error("EMotionFX", false, "Anim graph footplant IK node '%s' cannot find foot joint named '%s'.", GetName(), footJointName.c_str()); return false; } - leg.m_footHeight = actorInstance->GetTransformData()->GetBindPose()->GetModelSpaceTransform(leg.m_jointIndices[LegJointId::Foot]).mPosition.GetZ(); + leg.m_footHeight = actorInstance->GetTransformData()->GetBindPose()->GetModelSpaceTransform(leg.m_jointIndices[LegJointId::Foot]).m_position.GetZ(); // Now grab the parent, assuming this is the knee. Node* knee = footJoint->GetParentNode(); @@ -214,7 +214,7 @@ namespace EMotionFX } leg.m_jointIndices[LegJointId::Toe] = toeJoint->GetNodeIndex(); - leg.m_toeHeight = actorInstance->GetTransformData()->GetBindPose()->GetModelSpaceTransform(leg.m_jointIndices[LegJointId::Toe]).mPosition.GetZ(); + leg.m_toeHeight = actorInstance->GetTransformData()->GetBindPose()->GetModelSpaceTransform(leg.m_jointIndices[LegJointId::Toe]).m_position.GetZ(); leg.m_weight = 0.0f; leg.m_targetWeight = 0.0f; leg.DisableFlag(LegFlags::FootDown); @@ -274,12 +274,12 @@ namespace EMotionFX AZ_Assert(jointIndex != InvalidIndex, "Expecting the joint index to be valid."); const float rayLength = GetRaycastLength(animGraphInstance); - const AZ::Vector3 upVector = animGraphInstance->GetActorInstance()->GetWorldSpaceTransform().mRotation + const AZ::Vector3 upVector = animGraphInstance->GetActorInstance()->GetWorldSpaceTransform().m_rotation .TransformVector(AZ::Vector3(0.0f, 0.0f, 1.0f)); - const AZ::Vector3 jointPositionModelSpace = inputPose.GetModelSpaceTransform(jointIndex).mPosition; - const AZ::Vector3 hipPositionModelSpace = inputPose.GetModelSpaceTransform(uniqueData->m_hipJointIndex).mPosition; - const AZ::Vector3 jointPositionWorldSpace = inputPose.GetWorldSpaceTransform(jointIndex).mPosition; - const AZ::Vector3 hipPositionWorldSpace = inputPose.GetWorldSpaceTransform(uniqueData->m_hipJointIndex).mPosition; + const AZ::Vector3 jointPositionModelSpace = inputPose.GetModelSpaceTransform(jointIndex).m_position; + const AZ::Vector3 hipPositionModelSpace = inputPose.GetModelSpaceTransform(uniqueData->m_hipJointIndex).m_position; + const AZ::Vector3 jointPositionWorldSpace = inputPose.GetWorldSpaceTransform(jointIndex).m_position; + const AZ::Vector3 hipPositionWorldSpace = inputPose.GetWorldSpaceTransform(uniqueData->m_hipJointIndex).m_position; const float hipHeightDiff = hipPositionModelSpace.GetZ() - jointPositionModelSpace.GetZ(); outRayStart = jointPositionWorldSpace + upVector * hipHeightDiff; outRayEnd = jointPositionWorldSpace - upVector * rayLength; @@ -327,7 +327,7 @@ namespace EMotionFX if (rayResult.m_intersected) { ActorInstance* actorInstance = animGraphInstance->GetActorInstance(); - raycastResult.m_position = rayResult.m_position + actorInstance->GetWorldSpaceTransform().mRotation + raycastResult.m_position = rayResult.m_position + actorInstance->GetWorldSpaceTransform().m_rotation .TransformVector(AZ::Vector3(0.0f, 0.0f, heightOffset)); raycastResult.m_normal = rayResult.m_normal; raycastResult.m_intersected = true; @@ -406,7 +406,7 @@ namespace EMotionFX { const Leg& leg = solveParams.m_uniqueData->m_legs[legId]; - AZ::Quaternion result = solveParams.m_outputPose->GetWorldSpaceTransform(leg.m_jointIndices[LegJointId::Foot]).mRotation; + AZ::Quaternion result = solveParams.m_outputPose->GetWorldSpaceTransform(leg.m_jointIndices[LegJointId::Foot]).m_rotation; const bool footDown = leg.IsFlagEnabled(LegFlags::FootDown); const bool toeDown = leg.IsFlagEnabled(LegFlags::ToeDown); const float weight = leg.m_weight * solveParams.m_weight; @@ -419,7 +419,7 @@ namespace EMotionFX float distToToeTarget = 0.01f; if (solveParams.m_intersections[legId].m_toeResult.m_intersected) { - distToToeTarget = (solveParams.m_outputPose->GetWorldSpaceTransform(footIndex).mPosition - solveParams.m_intersections[legId].m_toeResult.m_position).GetLength(); + distToToeTarget = (solveParams.m_outputPose->GetWorldSpaceTransform(footIndex).m_position - solveParams.m_intersections[legId].m_toeResult.m_position).GetLength(); } bool bothPlanted = false; @@ -428,8 +428,8 @@ namespace EMotionFX bothPlanted = true; // Get the current vector from the foot to the toe. - const AZ::Vector3 footPos = solveParams.m_outputPose->GetWorldSpaceTransform(footIndex).mPosition; - const AZ::Vector3 oldToePos = solveParams.m_outputPose->GetWorldSpaceTransform(toeIndex).mPosition; + const AZ::Vector3 footPos = solveParams.m_outputPose->GetWorldSpaceTransform(footIndex).m_position; + const AZ::Vector3 oldToePos = solveParams.m_outputPose->GetWorldSpaceTransform(toeIndex).m_position; const AZ::Vector3 oldToToe = (oldToePos - footPos).GetNormalizedSafe(); // Get the new vector from the foot to the toe. @@ -439,20 +439,20 @@ namespace EMotionFX // Apply a delta rotation to the foot. Transform newTransform = solveParams.m_outputPose->GetWorldSpaceTransform(footIndex); const AZ::Quaternion deltaRot = AZ::Quaternion::CreateShortestArc(oldToToe, newToToe); - result = deltaRot * newTransform.mRotation; + result = deltaRot * newTransform.m_rotation; } else if (footDown) { // Get the current vector from the foot to the toe. - const AZ::Vector3 footPos = solveParams.m_outputPose->GetWorldSpaceTransform(footIndex).mPosition; - const AZ::Vector3 oldToePos = solveParams.m_outputPose->GetWorldSpaceTransform(toeIndex).mPosition; + const AZ::Vector3 footPos = solveParams.m_outputPose->GetWorldSpaceTransform(footIndex).m_position; + const AZ::Vector3 oldToePos = solveParams.m_outputPose->GetWorldSpaceTransform(toeIndex).m_position; const AZ::Vector3 oldToToe = (oldToePos - footPos).GetNormalizedSafe(); // Get the new vector from the foot to the toe. const IntersectionResults& intersections = solveParams.m_intersections[legId]; const float footToeHeightDiff = leg.m_footHeight - leg.m_toeHeight; const AZ::Plane plane = AZ::Plane::CreateFromNormalAndPoint(intersections.m_footResult.m_normal, intersections.m_footResult.m_position); - const AZ::Vector3 offset = solveParams.m_actorInstance->GetWorldSpaceTransform().mRotation + const AZ::Vector3 offset = solveParams.m_actorInstance->GetWorldSpaceTransform().m_rotation .TransformVector((footToeHeightDiff * intersections.m_footResult.m_normal)); AZ::Vector3 newToePos = plane.GetProjected(oldToToe); newToePos = intersections.m_footResult.m_position + newToePos.GetNormalizedSafe() * leg.m_footLength; @@ -462,7 +462,7 @@ namespace EMotionFX // Apply a delta rotation to the foot. Transform newTransform = solveParams.m_outputPose->GetWorldSpaceTransform(footIndex); const AZ::Quaternion deltaRot = AZ::Quaternion::CreateShortestArc(oldToToe, newToToe); - result = deltaRot * newTransform.mRotation; + result = deltaRot * newTransform.m_rotation; } // Visualize some debug things in the viewport. @@ -548,8 +548,8 @@ namespace EMotionFX { const float actorInstanceScale = GetActorInstanceScale(solveParams.m_actorInstance); const float surfaceOffset = s_surfaceThreshold * actorInstanceScale; - footDown = solveParams.m_intersections[legId].m_footResult.m_intersected ? IsBelowSurface(inputGlobalTransforms[LegJointId::Foot].mPosition, footTargetPosition, solveParams.m_intersections[legId].m_footResult.m_normal, surfaceOffset) : false; - toeDown = solveParams.m_intersections[legId].m_toeResult.m_intersected ? IsBelowSurface(inputGlobalTransforms[LegJointId::Toe].mPosition, toeTargetPosition, solveParams.m_intersections[legId].m_toeResult.m_normal, surfaceOffset) : false; + footDown = solveParams.m_intersections[legId].m_footResult.m_intersected ? IsBelowSurface(inputGlobalTransforms[LegJointId::Foot].m_position, footTargetPosition, solveParams.m_intersections[legId].m_footResult.m_normal, surfaceOffset) : false; + toeDown = solveParams.m_intersections[legId].m_toeResult.m_intersected ? IsBelowSurface(inputGlobalTransforms[LegJointId::Toe].m_position, toeTargetPosition, solveParams.m_intersections[legId].m_toeResult.m_normal, surfaceOffset) : false; } else { @@ -607,8 +607,8 @@ namespace EMotionFX } // Limit the target position in height. - const AZ::Vector3 vecToTarget = solveParams.m_actorInstance->GetWorldSpaceTransformInversed().mRotation - .TransformVector(footTargetPosition - inputGlobalTransforms[LegJointId::Foot].mPosition); + const AZ::Vector3 vecToTarget = solveParams.m_actorInstance->GetWorldSpaceTransformInversed().m_rotation + .TransformVector(footTargetPosition - inputGlobalTransforms[LegJointId::Foot].m_position); const float feetDifference = vecToTarget.GetZ(); const float maxFootAdjustment = GetMaxFootAdjustment(solveParams.m_animGraphInstance); if (feetDifference > maxFootAdjustment) @@ -617,11 +617,11 @@ namespace EMotionFX } // Calculate the pole vector. - const AZ::Vector3 toFoot = (inputGlobalTransforms[LegJointId::Foot].mPosition - inputGlobalTransforms[LegJointId::UpperLeg].mPosition).GetNormalizedSafe(); - AZ::Vector3 toKnee = (inputGlobalTransforms[LegJointId::Knee].mPosition - inputGlobalTransforms[LegJointId::UpperLeg].mPosition).GetNormalizedSafe(); + const AZ::Vector3 toFoot = (inputGlobalTransforms[LegJointId::Foot].m_position - inputGlobalTransforms[LegJointId::UpperLeg].m_position).GetNormalizedSafe(); + AZ::Vector3 toKnee = (inputGlobalTransforms[LegJointId::Knee].m_position - inputGlobalTransforms[LegJointId::UpperLeg].m_position).GetNormalizedSafe(); if (AZ::IsClose(toFoot.Dot(toKnee), 1.0f, 0.001f)) { - toKnee += solveParams.m_actorInstance->GetWorldSpaceTransform().mRotation.TransformVector(AZ::Vector3(0.0f, 0.01f, 0.0f)); + toKnee += solveParams.m_actorInstance->GetWorldSpaceTransform().m_rotation.TransformVector(AZ::Vector3(0.0f, 0.01f, 0.0f)); toKnee.NormalizeSafe(); } const AZ::Vector3 planeNormal = toFoot.Cross(toKnee); @@ -629,27 +629,27 @@ namespace EMotionFX // Solve the two joint IK problem by calculating the new position of the knee. AZ::Vector3 kneePos; - Solve2LinkIK(inputGlobalTransforms[LegJointId::UpperLeg].mPosition, inputGlobalTransforms[LegJointId::Knee].mPosition, inputGlobalTransforms[LegJointId::Foot].mPosition, footTargetPosition, finalPoleVector, &kneePos); + Solve2LinkIK(inputGlobalTransforms[LegJointId::UpperLeg].m_position, inputGlobalTransforms[LegJointId::Knee].m_position, inputGlobalTransforms[LegJointId::Foot].m_position, footTargetPosition, finalPoleVector, &kneePos); // Update the upper leg. - AZ::Vector3 oldForward = (inputGlobalTransforms[LegJointId::Knee].mPosition - inputGlobalTransforms[LegJointId::UpperLeg].mPosition).GetNormalizedSafe(); - AZ::Vector3 newForward = (kneePos - inputGlobalTransforms[LegJointId::UpperLeg].mPosition).GetNormalizedSafe(); + AZ::Vector3 oldForward = (inputGlobalTransforms[LegJointId::Knee].m_position - inputGlobalTransforms[LegJointId::UpperLeg].m_position).GetNormalizedSafe(); + AZ::Vector3 newForward = (kneePos - inputGlobalTransforms[LegJointId::UpperLeg].m_position).GetNormalizedSafe(); Transform newTransform = inputGlobalTransforms[LegJointId::UpperLeg]; - MCore::RotateFromTo(newTransform.mRotation, oldForward, newForward); + MCore::RotateFromTo(newTransform.m_rotation, oldForward, newForward); solveParams.m_outputPose->SetWorldSpaceTransform(upperLegIndex, newTransform); // Update the knee. - const AZ::Vector3 footPos = solveParams.m_outputPose->GetWorldSpaceTransform(leg.m_jointIndices[LegJointId::Foot]).mPosition; + const AZ::Vector3 footPos = solveParams.m_outputPose->GetWorldSpaceTransform(leg.m_jointIndices[LegJointId::Foot]).m_position; oldForward = (footPos - kneePos).GetNormalized(); newForward = (footTargetPosition - kneePos).GetNormalizedSafe(); newTransform = solveParams.m_outputPose->GetWorldSpaceTransform(leg.m_jointIndices[LegJointId::Knee]); - MCore::RotateFromTo(newTransform.mRotation, oldForward, newForward); - newTransform.mPosition = kneePos; + MCore::RotateFromTo(newTransform.m_rotation, oldForward, newForward); + newTransform.m_position = kneePos; solveParams.m_outputPose->SetWorldSpaceTransform(kneeIndex, newTransform); if (leg.IsFlagEnabled(LegFlags::FirstUpdate)) { - leg.m_currentFootRot = inputGlobalTransforms[LegJointId::Foot].mRotation; + leg.m_currentFootRot = inputGlobalTransforms[LegJointId::Foot].m_rotation; leg.DisableFlag(LegFlags::FirstUpdate); } @@ -679,7 +679,7 @@ namespace EMotionFX blendT = 1.0f; } leg.m_currentFootRot = leg.m_currentFootRot.NLerp(footRotation, blendT); - footTransform.mRotation = leg.m_currentFootRot; + footTransform.m_rotation = leg.m_currentFootRot; solveParams.m_outputPose->SetWorldSpaceTransform(footIndex, footTransform); // Draw debug lines. @@ -689,8 +689,8 @@ namespace EMotionFX drawData->Lock(); if (!solveParams.m_forceIKDisabled && leg.IsFlagEnabled(LegFlags::IkEnabled) && solveParams.m_intersections[legId].m_footResult.m_intersected) { - drawData->DrawLine(inputGlobalTransforms[LegJointId::UpperLeg].mPosition, kneePos, mVisualizeColor); - drawData->DrawLine(kneePos, footTargetPosition, mVisualizeColor); + drawData->DrawLine(inputGlobalTransforms[LegJointId::UpperLeg].m_position, kneePos, m_visualizeColor); + drawData->DrawLine(kneePos, footTargetPosition, m_visualizeColor); } drawData->Unlock(); } @@ -719,11 +719,11 @@ namespace EMotionFX leg.m_legLength = 0.0f; for (size_t legNodeIndex = 1; legNodeIndex < 3; ++legNodeIndex) { - leg.m_legLength += (inputPose.GetModelSpaceTransform(leg.m_jointIndices[legNodeIndex]).mPosition - inputPose.GetModelSpaceTransform(leg.m_jointIndices[legNodeIndex - 1]).mPosition).GetLength(); + leg.m_legLength += (inputPose.GetModelSpaceTransform(leg.m_jointIndices[legNodeIndex]).m_position - inputPose.GetModelSpaceTransform(leg.m_jointIndices[legNodeIndex - 1]).m_position).GetLength(); } // Calculate the foot length. - leg.m_footLength = (inputPose.GetModelSpaceTransform(leg.m_jointIndices[LegJointId::Toe]).mPosition - inputPose.GetModelSpaceTransform(leg.m_jointIndices[LegJointId::Foot]).mPosition).GetLength(); + leg.m_footLength = (inputPose.GetModelSpaceTransform(leg.m_jointIndices[LegJointId::Toe]).m_position - inputPose.GetModelSpaceTransform(leg.m_jointIndices[LegJointId::Foot]).m_position).GetLength(); } // Adjust the hip by moving it downwards when we can't reach a given target. @@ -739,8 +739,8 @@ namespace EMotionFX // If the target foot position is below the ground plane in model space, so if we actually have to lower the hips. ActorInstance* actorInstance = animGraphInstance->GetActorInstance(); - const AZ::Vector3 upVector = actorInstance->GetWorldSpaceTransform().mRotation.TransformVector(AZ::Vector3(0.0f, 0.0f, 1.0f)); - const AZ::Vector3 leftFootBindPoseModelSpace = actorInstance->GetTransformData()->GetBindPose()->GetModelSpaceTransform(leftLeg.m_jointIndices[LegJointId::Foot]).mPosition; + const AZ::Vector3 upVector = actorInstance->GetWorldSpaceTransform().m_rotation.TransformVector(AZ::Vector3(0.0f, 0.0f, 1.0f)); + const AZ::Vector3 leftFootBindPoseModelSpace = actorInstance->GetTransformData()->GetBindPose()->GetModelSpaceTransform(leftLeg.m_jointIndices[LegJointId::Foot]).m_position; const AZ::Vector3 leftFootBindWorldPos = actorInstance->GetWorldSpaceTransform().TransformPoint(leftFootBindPoseModelSpace); const AZ::Plane leftSurfacePlane = AZ::Plane::CreateFromNormalAndPoint(upVector, leftFootBindWorldPos); float leftCorrection = leftSurfacePlane.GetPointDist(intersectionResults[LegId::Left].m_footResult.m_position); @@ -750,7 +750,7 @@ namespace EMotionFX } // Do the same for the right leg. - const AZ::Vector3 rightFootBindPoseModelSpace = actorInstance->GetTransformData()->GetBindPose()->GetModelSpaceTransform(rightLeg.m_jointIndices[LegJointId::Foot]).mPosition; + const AZ::Vector3 rightFootBindPoseModelSpace = actorInstance->GetTransformData()->GetBindPose()->GetModelSpaceTransform(rightLeg.m_jointIndices[LegJointId::Foot]).m_position; const AZ::Vector3 rightFootBindWorldPos = actorInstance->GetWorldSpaceTransform().TransformPoint(rightFootBindPoseModelSpace); const AZ::Plane rightSurfacePlane = AZ::Plane::CreateFromNormalAndPoint(upVector, rightFootBindWorldPos); float rightCorrection = rightSurfacePlane.GetPointDist(intersectionResults[LegId::Right].m_footResult.m_position); @@ -768,7 +768,7 @@ namespace EMotionFX // Debug render some line to show the displacement. if (GetEMotionFX().GetIsInEditorMode() && GetCanVisualize(animGraphInstance)) { - const AZ::Vector3 hipPos = inputPose.GetWorldSpaceTransform(uniqueData->m_hipJointIndex).mPosition; + const AZ::Vector3 hipPos = inputPose.GetWorldSpaceTransform(uniqueData->m_hipJointIndex).m_position; DebugDraw::ActorInstanceData* drawData = GetDebugDraw().GetActorInstanceData(animGraphInstance->GetActorInstance()); drawData->Lock(); drawData->DrawLine(hipPos, hipPos + AZ::Vector3(0.0f, 0.0f, correction), AZ::Color(1.0f, 0.0f, 1.0f, 1.0f)); @@ -786,7 +786,7 @@ namespace EMotionFX } const float interpolatedCorrection = AZ::Lerp(uniqueData->m_curHipCorrection, correction, t); uniqueData->m_curHipCorrection = interpolatedCorrection; - hipTransform.mPosition += animGraphInstance->GetActorInstance()->GetWorldSpaceTransform().mRotation + hipTransform.m_position += animGraphInstance->GetActorInstance()->GetWorldSpaceTransform().m_rotation .TransformVector(AZ::Vector3(0.0f, 0.0f, interpolatedCorrection)); outputPose.SetWorldSpaceTransform(uniqueData->m_hipJointIndex, hipTransform); inputPose = outputPose; // As we adjusted our hip, the input pose to the IK leg solve has been modified, so update it. @@ -829,7 +829,7 @@ namespace EMotionFX AnimGraphPose* outputPose; // If nothing is connected to the input pose, output a bind pose. - if (!GetInputPort(INPUTPORT_POSE).mConnection) + if (!GetInputPort(INPUTPORT_POSE).m_connection) { RequestPoses(animGraphInstance); outputPose = GetOutputPose(animGraphInstance, OUTPUTPORT_POSE)->GetValue(); @@ -840,7 +840,7 @@ namespace EMotionFX // Get the weight from the input port. float weight = 1.0f; - if (GetInputPort(INPUTPORT_WEIGHT).mConnection) + if (GetInputPort(INPUTPORT_WEIGHT).m_connection) { OutputIncomingNode(animGraphInstance, GetInputNode(INPUTPORT_WEIGHT)); weight = GetInputNumberAsFloat(animGraphInstance, INPUTPORT_WEIGHT); @@ -848,7 +848,7 @@ namespace EMotionFX } // If the weight is near zero or if this node is disabled or if the node is enable for server optimization, we can skip all calculations and just output the input pose. - if (weight < MCore::Math::epsilon || mDisabled || GetEMotionFX().GetEnableServerOptimization()) + if (weight < MCore::Math::epsilon || m_disabled || GetEMotionFX().GetEnableServerOptimization()) { OutputIncomingNode(animGraphInstance, GetInputNode(INPUTPORT_POSE)); const AnimGraphPose* inputPose = GetInputPose(animGraphInstance, INPUTPORT_POSE)->GetValue(); @@ -928,7 +928,7 @@ namespace EMotionFX for (size_t i = 0; i < numEvents; ++i) { const EventInfo& eventInfo = eventBuffer.GetEvent(i); - const MotionEvent* motionEvent = eventInfo.mEvent; + const MotionEvent* motionEvent = eventInfo.m_event; const EventDataSet& eventDataSet = motionEvent->GetEventDatas(); for (const EventDataPtr& eventData : eventDataSet) { diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeGetTransformNode.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeGetTransformNode.cpp index fd04a43251..b836188757 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeGetTransformNode.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeGetTransformNode.cpp @@ -33,7 +33,7 @@ namespace EMotionFX void BlendTreeGetTransformNode::UniqueData::Update() { - BlendTreeGetTransformNode* transformNode = azdynamic_cast(mObject); + BlendTreeGetTransformNode* transformNode = azdynamic_cast(m_object); AZ_Assert(transformNode, "Unique data linked to incorrect node type."); m_nodeIndex = InvalidIndex; @@ -41,7 +41,7 @@ namespace EMotionFX const int actorInstanceParentDepth = transformNode->GetActorInstanceParentDepth(); // lookup the actor instance to get the node from - const ActorInstance* alignInstance = mAnimGraphInstance->FindActorInstanceFromParentDepth(actorInstanceParentDepth); + const ActorInstance* alignInstance = m_animGraphInstance->FindActorInstanceFromParentDepth(actorInstanceParentDepth); if (alignInstance) { const Node* alignNode = alignInstance->GetActor()->GetSkeleton()->FindNodeByName(nodeName); @@ -110,7 +110,7 @@ namespace EMotionFX } // make sure we have at least an input pose, otherwise output the bind pose - if (GetInputPort(INPUTPORT_POSE).mConnection) + if (GetInputPort(INPUTPORT_POSE).m_connection) { OutputIncomingNode(animGraphInstance, GetInputNode(INPUTPORT_POSE)); inputPose = GetInputPose(animGraphInstance, INPUTPORT_POSE)->GetValue(); @@ -162,11 +162,11 @@ namespace EMotionFX inputTransform.Identity(); } - GetOutputVector3(animGraphInstance, OUTPUTPORT_TRANSLATION)->SetValue(inputTransform.mPosition); - GetOutputQuaternion(animGraphInstance, OUTPUTPORT_ROTATION)->SetValue(inputTransform.mRotation); + GetOutputVector3(animGraphInstance, OUTPUTPORT_TRANSLATION)->SetValue(inputTransform.m_position); + GetOutputQuaternion(animGraphInstance, OUTPUTPORT_ROTATION)->SetValue(inputTransform.m_rotation); #ifndef EMFX_SCALE_DISABLED - GetOutputVector3(animGraphInstance, OUTPUTPORT_SCALE)->SetValue(inputTransform.mScale); + GetOutputVector3(animGraphInstance, OUTPUTPORT_SCALE)->SetValue(inputTransform.m_scale); #else GetOutputVector3(animGraphInstance, OUTPUTPORT_SCALE)->SetValue(AZ::Vector3::CreateOne()); #endif diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeLookAtNode.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeLookAtNode.cpp index f904f35ba4..84eeca094d 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeLookAtNode.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeLookAtNode.cpp @@ -34,13 +34,13 @@ namespace EMotionFX void BlendTreeLookAtNode::UniqueData::Update() { - BlendTreeLookAtNode* lookAtNode = azdynamic_cast(mObject); + BlendTreeLookAtNode* lookAtNode = azdynamic_cast(m_object); AZ_Assert(lookAtNode, "Unique data linked to incorrect node type."); - const ActorInstance* actorInstance = mAnimGraphInstance->GetActorInstance(); + const ActorInstance* actorInstance = m_animGraphInstance->GetActorInstance(); const Actor* actor = actorInstance->GetActor(); - mNodeIndex = InvalidIndex; + m_nodeIndex = InvalidIndex; SetHasError(true); const AZStd::string& targetJointName = lookAtNode->GetTargetNodeName(); @@ -49,7 +49,7 @@ namespace EMotionFX const Node* targetNode = actor->GetSkeleton()->FindNodeByName(targetJointName); if (targetNode) { - mNodeIndex = targetNode->GetNodeIndex(); + m_nodeIndex = targetNode->GetNodeIndex(); SetHasError(false); } } @@ -112,7 +112,7 @@ namespace EMotionFX AnimGraphPose* outputPose; // make sure we have at least an input pose, otherwise output the bind pose - if (GetInputPort(INPUTPORT_POSE).mConnection == nullptr) + if (GetInputPort(INPUTPORT_POSE).m_connection == nullptr) { RequestPoses(animGraphInstance); outputPose = GetOutputPose(animGraphInstance, OUTPUTPORT_POSE)->GetValue(); @@ -123,7 +123,7 @@ namespace EMotionFX // get the weight float weight = 1.0f; - if (GetInputPort(INPUTPORT_WEIGHT).mConnection) + if (GetInputPort(INPUTPORT_WEIGHT).m_connection) { OutputIncomingNode(animGraphInstance, GetInputNode(INPUTPORT_WEIGHT)); weight = GetInputNumberAsFloat(animGraphInstance, INPUTPORT_WEIGHT); @@ -131,7 +131,7 @@ namespace EMotionFX } // if the weight is near zero, we can skip all calculations and act like a pass-trough node - if (weight < MCore::Math::epsilon || mDisabled) + if (weight < MCore::Math::epsilon || m_disabled) { OutputIncomingNode(animGraphInstance, GetInputNode(INPUTPORT_POSE)); RequestPoses(animGraphInstance); @@ -139,7 +139,7 @@ namespace EMotionFX const AnimGraphPose* inputPose = GetInputPose(animGraphInstance, INPUTPORT_POSE)->GetValue(); *outputPose = *inputPose; UniqueData* uniqueData = static_cast(FindOrCreateUniqueNodeData(animGraphInstance)); - uniqueData->mFirstUpdate = true; + uniqueData->m_firstUpdate = true; return; } @@ -177,7 +177,7 @@ namespace EMotionFX ActorInstance* actorInstance = animGraphInstance->GetActorInstance(); // get a shortcut to the local transform object - const size_t nodeIndex = uniqueData->mNodeIndex; + const size_t nodeIndex = uniqueData->m_nodeIndex; Pose& outTransformPose = outputPose->GetPose(); Transform globalTransform = outTransformPose.GetWorldSpaceTransform(nodeIndex); @@ -185,7 +185,7 @@ namespace EMotionFX Skeleton* skeleton = actorInstance->GetActor()->GetSkeleton(); // Prevent invalid float values inside the LookAt matrix construction when both position and goal are the same - const AZ::Vector3 diff = globalTransform.mPosition - goal; + const AZ::Vector3 diff = globalTransform.m_position - goal; if (diff.GetLengthSq() < AZ::Constants::FloatEpsilon) { goal += AZ::Vector3(0.0f, 0.000001f, 0.0f); @@ -194,7 +194,7 @@ namespace EMotionFX // calculate the lookat transform // TODO: a quaternion lookat function would be nicer, so that there are no matrix operations involved AZ::Matrix4x4 lookAt; - MCore::LookAt(lookAt, globalTransform.mPosition, goal, AZ::Vector3(0.0f, 0.0f, 1.0f)); + MCore::LookAt(lookAt, globalTransform.m_position, goal, AZ::Vector3(0.0f, 0.0f, 1.0f)); AZ::Quaternion destRotation = AZ::Quaternion::CreateFromMatrix4x4(lookAt.GetTranspose()); // apply the post rotation @@ -208,8 +208,8 @@ namespace EMotionFX AZ::Quaternion bindRotationLocal; if (parentIndex != InvalidIndex) { - parentRotationGlobal = inputPose->GetPose().GetWorldSpaceTransform(parentIndex).mRotation; - bindRotationLocal = actorInstance->GetTransformData()->GetBindPose()->GetLocalSpaceTransform(parentIndex).mRotation; + parentRotationGlobal = inputPose->GetPose().GetWorldSpaceTransform(parentIndex).m_rotation; + bindRotationLocal = actorInstance->GetTransformData()->GetBindPose()->GetLocalSpaceTransform(parentIndex).m_rotation; } else { @@ -228,47 +228,47 @@ namespace EMotionFX constraint.SetMinTwistAngle(0.0f); constraint.SetMaxTwistAngle(0.0f); constraint.SetTwistAxis(m_twistAxis); - constraint.GetTransform().mRotation = (deltaRotLocal * m_constraintRotation.GetConjugate()); + constraint.GetTransform().m_rotation = (deltaRotLocal * m_constraintRotation.GetConjugate()); constraint.Execute(); if (GetEMotionFX().GetIsInEditorMode() && GetCanVisualize(animGraphInstance)) { AZ::Transform offset = AZ::Transform::CreateFromQuaternion(m_postRotation.GetInverseFull() * bindRotationLocal * m_constraintRotation * parentRotationGlobal); - offset.SetTranslation(globalTransform.mPosition); + offset.SetTranslation(globalTransform.m_position); constraint.DebugDraw(actorInstance, offset, GetVisualizeColor(), 0.5f); } // convert back into world space - destRotation = (bindRotationLocal * (constraint.GetTransform().mRotation * m_constraintRotation)) * parentRotationGlobal; + destRotation = (bindRotationLocal * (constraint.GetTransform().m_rotation * m_constraintRotation)) * parentRotationGlobal; } // init the rotation quaternion to the initial rotation - if (uniqueData->mFirstUpdate) + if (uniqueData->m_firstUpdate) { - uniqueData->mRotationQuat = destRotation; - uniqueData->mFirstUpdate = false; + uniqueData->m_rotationQuat = destRotation; + uniqueData->m_firstUpdate = false; } // interpolate between the current rotation and the destination rotation if (m_smoothing) { - const float speed = m_followSpeed * uniqueData->mTimeDelta * 10.0f; + const float speed = m_followSpeed * uniqueData->m_timeDelta * 10.0f; if (speed < 1.0f) { - uniqueData->mRotationQuat = uniqueData->mRotationQuat.Slerp(destRotation, speed); + uniqueData->m_rotationQuat = uniqueData->m_rotationQuat.Slerp(destRotation, speed); } else { - uniqueData->mRotationQuat = destRotation; + uniqueData->m_rotationQuat = destRotation; } } else { - uniqueData->mRotationQuat = destRotation; + uniqueData->m_rotationQuat = destRotation; } - uniqueData->mRotationQuat.Normalize(); - globalTransform.mRotation = uniqueData->mRotationQuat; + uniqueData->m_rotationQuat.Normalize(); + globalTransform.m_rotation = uniqueData->m_rotationQuat; // only blend when needed if (weight < 0.999f) @@ -294,11 +294,11 @@ namespace EMotionFX DebugDraw& debugDraw = GetDebugDraw(); DebugDraw::ActorInstanceData* drawData = debugDraw.GetActorInstanceData(animGraphInstance->GetActorInstance()); drawData->Lock(); - drawData->DrawLine(goal - AZ::Vector3(s, 0, 0), goal + AZ::Vector3(s, 0, 0), mVisualizeColor); - drawData->DrawLine(goal - AZ::Vector3(0, s, 0), goal + AZ::Vector3(0, s, 0), mVisualizeColor); - drawData->DrawLine(goal - AZ::Vector3(0, 0, s), goal + AZ::Vector3(0, 0, s), mVisualizeColor); - drawData->DrawLine(globalTransform.mPosition, goal, mVisualizeColor); - drawData->DrawLine(globalTransform.mPosition, globalTransform.mPosition + MCore::CalcUpAxis(globalTransform.mRotation) * s * 50.0f, AZ::Color(0.0f, 0.0f, 1.0f, 1.0f)); + drawData->DrawLine(goal - AZ::Vector3(s, 0, 0), goal + AZ::Vector3(s, 0, 0), m_visualizeColor); + drawData->DrawLine(goal - AZ::Vector3(0, s, 0), goal + AZ::Vector3(0, s, 0), m_visualizeColor); + drawData->DrawLine(goal - AZ::Vector3(0, 0, s), goal + AZ::Vector3(0, 0, s), m_visualizeColor); + drawData->DrawLine(globalTransform.m_position, goal, m_visualizeColor); + drawData->DrawLine(globalTransform.m_position, globalTransform.m_position + MCore::CalcUpAxis(globalTransform.m_rotation) * s * 50.0f, AZ::Color(0.0f, 0.0f, 1.0f, 1.0f)); drawData->Unlock(); } } @@ -335,7 +335,7 @@ namespace EMotionFX uniqueData->Clear(); } - uniqueData->mTimeDelta = timePassedInSeconds; + uniqueData->m_timeDelta = timePassedInSeconds; } AZ::Crc32 BlendTreeLookAtNode::GetLimitWidgetsVisibility() const diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeLookAtNode.h b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeLookAtNode.h index 4da3855dd1..098ce5ca08 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeLookAtNode.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeLookAtNode.h @@ -63,10 +63,10 @@ namespace EMotionFX void Update() override; public: - AZ::Quaternion mRotationQuat = AZ::Quaternion::CreateIdentity(); - float mTimeDelta = 0.0f; - size_t mNodeIndex = InvalidIndex; - bool mFirstUpdate = true; + AZ::Quaternion m_rotationQuat = AZ::Quaternion::CreateIdentity(); + float m_timeDelta = 0.0f; + size_t m_nodeIndex = InvalidIndex; + bool m_firstUpdate = true; }; BlendTreeLookAtNode(); diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeMaskLegacyNode.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeMaskLegacyNode.cpp index 88da8346d0..ca409fe6d7 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeMaskLegacyNode.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeMaskLegacyNode.cpp @@ -21,7 +21,7 @@ namespace EMotionFX { - size_t BlendTreeMaskLegacyNode::m_numMasks = 4; + size_t BlendTreeMaskLegacyNode::s_numMasks = 4; AZ_CLASS_ALLOCATOR_IMPL(BlendTreeMaskLegacyNode, AnimGraphAllocator, 0) AZ_CLASS_ALLOCATOR_IMPL(BlendTreeMaskLegacyNode::UniqueData, AnimGraphObjectUniqueDataAllocator, 0) @@ -33,17 +33,17 @@ namespace EMotionFX void BlendTreeMaskLegacyNode::UniqueData::Update() { - BlendTreeMaskLegacyNode* maskNode = azdynamic_cast(mObject); + BlendTreeMaskLegacyNode* maskNode = azdynamic_cast(m_object); AZ_Assert(maskNode, "Unique data linked to incorrect node type."); - Actor* actor = mAnimGraphInstance->GetActorInstance()->GetActor(); + Actor* actor = m_animGraphInstance->GetActorInstance()->GetActor(); const size_t numMasks = BlendTreeMaskLegacyNode::GetNumMasks(); - mMasks.resize(numMasks); - AnimGraphPropertyUtils::ReinitJointIndices(actor, maskNode->GetMask0(), mMasks[0]); - AnimGraphPropertyUtils::ReinitJointIndices(actor, maskNode->GetMask1(), mMasks[1]); - AnimGraphPropertyUtils::ReinitJointIndices(actor, maskNode->GetMask2(), mMasks[2]); - AnimGraphPropertyUtils::ReinitJointIndices(actor, maskNode->GetMask3(), mMasks[3]); + m_masks.resize(numMasks); + AnimGraphPropertyUtils::ReinitJointIndices(actor, maskNode->GetMask0(), m_masks[0]); + AnimGraphPropertyUtils::ReinitJointIndices(actor, maskNode->GetMask1(), m_masks[1]); + AnimGraphPropertyUtils::ReinitJointIndices(actor, maskNode->GetMask2(), m_masks[2]); + AnimGraphPropertyUtils::ReinitJointIndices(actor, maskNode->GetMask3(), m_masks[3]); } BlendTreeMaskLegacyNode::BlendTreeMaskLegacyNode() @@ -54,7 +54,7 @@ namespace EMotionFX , m_outputEvents3(true) { // setup the input ports - InitInputPorts(m_numMasks); + InitInputPorts(s_numMasks); SetupInputPort("Pose 0", INPUTPORT_POSE_0, AttributePose::TYPE_ID, PORTID_INPUT_POSE_0); SetupInputPort("Pose 1", INPUTPORT_POSE_1, AttributePose::TYPE_ID, PORTID_INPUT_POSE_1); SetupInputPort("Pose 2", INPUTPORT_POSE_2, AttributePose::TYPE_ID, PORTID_INPUT_POSE_2); @@ -104,10 +104,10 @@ namespace EMotionFX UniqueData* uniqueData = static_cast(FindOrCreateUniqueNodeData(animGraphInstance)); // for all input ports - for (size_t i = 0; i < m_numMasks; ++i) + for (size_t i = 0; i < s_numMasks; ++i) { // if there is no connection plugged in - if (mInputPorts[INPUTPORT_POSE_0 + i].mConnection == nullptr) + if (m_inputPorts[INPUTPORT_POSE_0 + i].m_connection == nullptr) { continue; } @@ -121,10 +121,10 @@ namespace EMotionFX outputPose = GetOutputPose(animGraphInstance, OUTPUTPORT_RESULT)->GetValue(); outputPose->InitFromBindPose(animGraphInstance->GetActorInstance()); - for (size_t i = 0; i < m_numMasks; ++i) + for (size_t i = 0; i < s_numMasks; ++i) { // if there is no connection plugged in - if (mInputPorts[INPUTPORT_POSE_0 + i].mConnection == nullptr) + if (m_inputPorts[INPUTPORT_POSE_0 + i].m_connection == nullptr) { continue; } @@ -135,11 +135,11 @@ namespace EMotionFX const Pose& localPose = pose->GetPose(); // get the number of nodes inside the mask and default them to all nodes in the local pose in case there aren't any selected - const size_t numNodes = uniqueData->mMasks[i].size(); + const size_t numNodes = uniqueData->m_masks[i].size(); if (numNodes > 0) { // for all nodes in the mask, output their transforms - for (size_t nodeIndex : uniqueData->mMasks[i]) + for (size_t nodeIndex : uniqueData->m_masks[i]) { outputLocalPose.SetLocalSpaceTransform(nodeIndex, localPose.GetLocalSpaceTransform(nodeIndex)); } @@ -153,7 +153,7 @@ namespace EMotionFX // visualize it if (GetEMotionFX().GetIsInEditorMode() && GetCanVisualize(animGraphInstance)) { - animGraphInstance->GetActorInstance()->DrawSkeleton(outputPose->GetPose(), mVisualizeColor); + animGraphInstance->GetActorInstance()->DrawSkeleton(outputPose->GetPose(), m_visualizeColor); } } @@ -182,7 +182,7 @@ namespace EMotionFX void BlendTreeMaskLegacyNode::PostUpdate(AnimGraphInstance* animGraphInstance, float timePassedInSeconds) { // post update all incoming nodes - for (size_t i = 0; i < m_numMasks; ++i) + for (size_t i = 0; i < s_numMasks; ++i) { // if the port has no input, skip it AnimGraphNode* inputNode = GetInputNode(INPUTPORT_POSE_0 + i); @@ -202,7 +202,7 @@ namespace EMotionFX data->ClearEventBuffer(); data->ZeroTrajectoryDelta(); - for (size_t i = 0; i < m_numMasks; ++i) + for (size_t i = 0; i < s_numMasks; ++i) { // if the port has no input, skip it AnimGraphNode* inputNode = GetInputNode(INPUTPORT_POSE_0 + i); @@ -212,11 +212,11 @@ namespace EMotionFX } // get the number of nodes inside the mask and default them to all nodes in the local pose in case there aren't any selected - const size_t numNodes = uniqueData->mMasks[i].size(); + const size_t numNodes = uniqueData->m_masks[i].size(); if (numNodes > 0) { // for all nodes in the mask, output their transforms - for (size_t nodeIndex : uniqueData->mMasks[i]) + for (size_t nodeIndex : uniqueData->m_masks[i]) { if (nodeIndex == animGraphInstance->GetActorInstance()->GetActor()->GetMotionExtractionNodeIndex()) { diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeMaskLegacyNode.h b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeMaskLegacyNode.h index 0cddd9610a..2abc5dc5cf 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeMaskLegacyNode.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeMaskLegacyNode.h @@ -53,7 +53,7 @@ namespace EMotionFX void Update() override; public: - AZStd::vector< AZStd::vector > mMasks; + AZStd::vector< AZStd::vector > m_masks; }; BlendTreeMaskLegacyNode(); @@ -77,7 +77,7 @@ namespace EMotionFX void SetMask2(const AZStd::vector& mask2); void SetMask3(const AZStd::vector& mask3); - static size_t GetNumMasks() { return m_numMasks; } + static size_t GetNumMasks() { return s_numMasks; } const AZStd::vector& GetMask0() const { return m_mask0; } const AZStd::vector& GetMask1() const { return m_mask1; } const AZStd::vector& GetMask2() const { return m_mask2; } @@ -109,6 +109,6 @@ namespace EMotionFX bool m_outputEvents2; bool m_outputEvents3; - static size_t m_numMasks; + static size_t s_numMasks; }; } // namespace EMotionFX diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeMaskNode.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeMaskNode.cpp index d43ac3b033..039d11d881 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeMaskNode.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeMaskNode.cpp @@ -30,16 +30,16 @@ namespace EMotionFX void BlendTreeMaskNode::UniqueData::Update() { - BlendTreeMaskNode* maskNode = azdynamic_cast(mObject); + BlendTreeMaskNode* maskNode = azdynamic_cast(m_object); AZ_Assert(maskNode, "Unique data linked to incorrect node type."); - const Actor* actor = mAnimGraphInstance->GetActorInstance()->GetActor(); + const Actor* actor = m_animGraphInstance->GetActorInstance()->GetActor(); const size_t numMaskInstances = maskNode->GetNumUsedMasks(); m_maskInstances.resize(numMaskInstances); size_t maskInstanceIndex = 0; m_motionExtractionInputPortNr.reset(); - const size_t motionExtractionJointIndex = mAnimGraphInstance->GetActorInstance()->GetActor()->GetMotionExtractionNodeIndex(); + const size_t motionExtractionJointIndex = m_animGraphInstance->GetActorInstance()->GetActor()->GetMotionExtractionNodeIndex(); const AZStd::vector& masks = maskNode->GetMasks(); const size_t numMasks = masks.size(); @@ -129,16 +129,16 @@ namespace EMotionFX void BlendTreeMaskNode::OnMotionExtractionNodeChanged(Actor* actor, [[maybe_unused]] Node* newMotionExtractionNode) { - if (!mAnimGraph) + if (!m_animGraph) { return; } bool needsReinit = false; - const size_t numAnimGraphInstances = mAnimGraph->GetNumAnimGraphInstances(); + const size_t numAnimGraphInstances = m_animGraph->GetNumAnimGraphInstances(); for (size_t i = 0; i < numAnimGraphInstances; ++i) { - AnimGraphInstance* animGraphInstance = mAnimGraph->GetAnimGraphInstance(i); + AnimGraphInstance* animGraphInstance = m_animGraph->GetAnimGraphInstance(i); if (actor == animGraphInstance->GetActorInstance()->GetActor()) { needsReinit = true; @@ -192,7 +192,7 @@ namespace EMotionFX if (GetEMotionFX().GetIsInEditorMode() && GetCanVisualize(animGraphInstance)) { - animGraphInstance->GetActorInstance()->DrawSkeleton(outputAnimGraphPose->GetPose(), mVisualizeColor); + animGraphInstance->GetActorInstance()->DrawSkeleton(outputAnimGraphPose->GetPose(), m_visualizeColor); } } diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeMirrorPoseNode.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeMirrorPoseNode.cpp index 04199c18ca..f1e738d56d 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeMirrorPoseNode.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeMirrorPoseNode.cpp @@ -79,7 +79,7 @@ namespace EMotionFX { // check the enabled state bool isEnabled = true; - if (mInputPorts[INPUTPORT_ENABLED].mConnection) + if (m_inputPorts[INPUTPORT_ENABLED].m_connection) { isEnabled = GetInputNumberAsBool(animGraphInstance, INPUTPORT_ENABLED); } @@ -107,7 +107,7 @@ namespace EMotionFX uniqueData->Init(animGraphInstance, sourceNode); // apply mirroring to the sync track - if (GetIsMirroringEnabled(animGraphInstance) && !mDisabled) + if (GetIsMirroringEnabled(animGraphInstance) && !m_disabled) { EMotionFX::AnimGraphNodeData* sourceNodeData = sourceNode->FindOrCreateUniqueNodeData(animGraphInstance); uniqueData->SetSyncTrack(sourceNodeData->GetSyncTrack()); @@ -119,7 +119,7 @@ namespace EMotionFX // perform the calculations / actions void BlendTreeMirrorPoseNode::Output(AnimGraphInstance* animGraphInstance) { - if (mInputPorts[INPUTPORT_POSE].mConnection == nullptr) + if (m_inputPorts[INPUTPORT_POSE].m_connection == nullptr) { // get the output pose RequestPoses(animGraphInstance); @@ -129,7 +129,7 @@ namespace EMotionFX } // if we're disabled just forward the input pose - if (mDisabled) + if (m_disabled) { OutputIncomingNode(animGraphInstance, GetInputNode(INPUTPORT_POSE)); const AnimGraphPose* inputPose = GetInputPose(animGraphInstance, INPUTPORT_POSE)->GetValue(); @@ -173,11 +173,11 @@ namespace EMotionFX // build the mirror plane normal, based on the mirror axis for this node AZ::Vector3 mirrorPlaneNormal(0.0f, 0.0f, 0.0f); - mirrorPlaneNormal.SetElement(mirrorInfo.mAxis, 1.0f); + mirrorPlaneNormal.SetElement(mirrorInfo.m_axis, 1.0f); // apply the mirrored delta to the bind pose of the current node outputTransform = bindPose->GetLocalSpaceTransform(nodeIndex); - outputTransform.ApplyDeltaMirrored(bindPose->GetLocalSpaceTransform(mirrorInfo.mSourceNode), inPose.GetLocalSpaceTransform(mirrorInfo.mSourceNode), mirrorPlaneNormal, mirrorInfo.mFlags); + outputTransform.ApplyDeltaMirrored(bindPose->GetLocalSpaceTransform(mirrorInfo.m_sourceNode), inPose.GetLocalSpaceTransform(mirrorInfo.m_sourceNode), mirrorPlaneNormal, mirrorInfo.m_flags); // update the pose with the new transform outPose.SetLocalSpaceTransform(nodeIndex, outputTransform); @@ -187,7 +187,7 @@ namespace EMotionFX // visualize it if (GetEMotionFX().GetIsInEditorMode() && GetCanVisualize(animGraphInstance)) { - animGraphInstance->GetActorInstance()->DrawSkeleton(outputPose->GetPose(), mVisualizeColor); + animGraphInstance->GetActorInstance()->DrawSkeleton(outputPose->GetPose(), m_visualizeColor); } } @@ -196,7 +196,7 @@ namespace EMotionFX void BlendTreeMirrorPoseNode::PostUpdate(AnimGraphInstance* animGraphInstance, float timePassedInSeconds) { // check if we have three incoming connections, if not, we can't really continue - if (mConnections.size() == 0 || mInputPorts[INPUTPORT_POSE].mConnection == nullptr) + if (m_connections.size() == 0 || m_inputPorts[INPUTPORT_POSE].m_connection == nullptr) { RequestRefDatas(animGraphInstance); AnimGraphNodeData* uniqueData = FindOrCreateUniqueNodeData(animGraphInstance); @@ -216,7 +216,7 @@ namespace EMotionFX AnimGraphRefCountedData* sourceData = inputNode->FindOrCreateUniqueNodeData(animGraphInstance)->GetRefCountedData(); data->SetEventBuffer(sourceData->GetEventBuffer()); - if (GetIsMirroringEnabled(animGraphInstance) && mDisabled == false) + if (GetIsMirroringEnabled(animGraphInstance) && m_disabled == false) { data->SetTrajectoryDelta(sourceData->GetTrajectoryDeltaMirrored()); data->SetTrajectoryDeltaMirrored(sourceData->GetTrajectoryDelta()); diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeMorphTargetNode.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeMorphTargetNode.cpp index ad88909e29..69e93971fd 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeMorphTargetNode.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeMorphTargetNode.cpp @@ -27,11 +27,11 @@ namespace EMotionFX void BlendTreeMorphTargetNode::UniqueData::Update() { - BlendTreeMorphTargetNode* morphTargetNode = azdynamic_cast(mObject); + BlendTreeMorphTargetNode* morphTargetNode = azdynamic_cast(m_object); AZ_Assert(morphTargetNode, "Unique data linked to incorrect node type."); // Force update the morph target indices. - morphTargetNode->UpdateMorphIndices(mAnimGraphInstance->GetActorInstance(), this, true); + morphTargetNode->UpdateMorphIndices(m_animGraphInstance->GetActorInstance(), this, true); } BlendTreeMorphTargetNode::BlendTreeMorphTargetNode() @@ -146,7 +146,7 @@ namespace EMotionFX // If there is no input pose init the uutput pose to the bind pose. AnimGraphPose* outputPose; - if (!mInputPorts[INPUTPORT_POSE].mConnection) + if (!m_inputPorts[INPUTPORT_POSE].m_connection) { RequestPoses(animGraphInstance); outputPose = GetOutputPose(animGraphInstance, OUTPUTPORT_POSE)->GetValue(); @@ -162,10 +162,10 @@ namespace EMotionFX } // Try to modify the morph target weight with the value we specified as input. - if (!mDisabled && uniqueData->m_morphTargetIndex != InvalidIndex) + if (!m_disabled && uniqueData->m_morphTargetIndex != InvalidIndex) { // If we have an input to the weight port, read that value use that value to overwrite the pose value with. - if (mInputPorts[INPUTPORT_WEIGHT].mConnection) + if (m_inputPorts[INPUTPORT_WEIGHT].m_connection) { OutputIncomingNode(animGraphInstance, GetInputNode(INPUTPORT_WEIGHT)); const float morphWeight = GetInputNumberAsFloat(animGraphInstance, INPUTPORT_WEIGHT); @@ -178,7 +178,7 @@ namespace EMotionFX // Debug visualize the output pose. if (GetEMotionFX().GetIsInEditorMode() && GetCanVisualize(animGraphInstance)) { - actorInstance->DrawSkeleton(outputPose->GetPose(), mVisualizeColor); + actorInstance->DrawSkeleton(outputPose->GetPose(), m_visualizeColor); } } diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeMotionFrameNode.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeMotionFrameNode.cpp index 73494c6ab3..3822d5a2e1 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeMotionFrameNode.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeMotionFrameNode.cpp @@ -82,7 +82,7 @@ namespace EMotionFX AnimGraphPose* outputPose; // get the motion instance object - BlendTreeConnection* motionConnection = mInputPorts[INPUTPORT_MOTION].mConnection; + BlendTreeConnection* motionConnection = m_inputPorts[INPUTPORT_MOTION].m_connection; if (motionConnection == nullptr) { RequestPoses(animGraphInstance); @@ -92,7 +92,7 @@ namespace EMotionFX // visualize it if (GetEMotionFX().GetIsInEditorMode() && GetCanVisualize(animGraphInstance)) { - actorInstance->DrawSkeleton(outputPose->GetPose(), mVisualizeColor); + actorInstance->DrawSkeleton(outputPose->GetPose(), m_visualizeColor); } return; } @@ -109,14 +109,14 @@ namespace EMotionFX // visualize it if (GetEMotionFX().GetIsInEditorMode() && GetCanVisualize(animGraphInstance)) { - actorInstance->DrawSkeleton(outputPose->GetPose(), mVisualizeColor); + actorInstance->DrawSkeleton(outputPose->GetPose(), m_visualizeColor); } return; } // get the time value float timeValue = 0.0f; - BlendTreeConnection* timeConnection = mInputPorts[INPUTPORT_TIME].mConnection; + BlendTreeConnection* timeConnection = m_inputPorts[INPUTPORT_TIME].m_connection; if (!timeConnection) // get it from the parameter value if there is no connection { timeValue = m_normalizedTimeValue; @@ -149,7 +149,7 @@ namespace EMotionFX // visualize it if (GetEMotionFX().GetIsInEditorMode() && GetCanVisualize(animGraphInstance)) { - actorInstance->DrawSkeleton(outputPose->GetPose(), mVisualizeColor); + actorInstance->DrawSkeleton(outputPose->GetPose(), m_visualizeColor); } } @@ -158,7 +158,7 @@ namespace EMotionFX void BlendTreeMotionFrameNode::PostUpdate(AnimGraphInstance* animGraphInstance, float timePassedInSeconds) { // clear the event buffer - if (mDisabled) + if (m_disabled) { RequestRefDatas(animGraphInstance); AnimGraphNodeData* uniqueData = FindOrCreateUniqueNodeData(animGraphInstance); @@ -169,14 +169,14 @@ namespace EMotionFX } // update the time input - BlendTreeConnection* timeConnection = mInputPorts[INPUTPORT_TIME].mConnection; + BlendTreeConnection* timeConnection = m_inputPorts[INPUTPORT_TIME].m_connection; if (timeConnection) { timeConnection->GetSourceNode()->PerformPostUpdate(animGraphInstance, timePassedInSeconds); } // update the input motion - BlendTreeConnection* motionConnection = mInputPorts[INPUTPORT_MOTION].mConnection; + BlendTreeConnection* motionConnection = m_inputPorts[INPUTPORT_MOTION].m_connection; if (motionConnection) { motionConnection->GetSourceNode()->PerformPostUpdate(animGraphInstance, timePassedInSeconds); @@ -195,7 +195,7 @@ namespace EMotionFX MotionInstance* motionInstance = motionNode->FindMotionInstance(animGraphInstance); if (triggerEvents && motionInstance) { - motionInstance->ExtractEventsNonLoop(uniqueData->mOldTime, uniqueData->mNewTime, &uniqueData->GetRefCountedData()->GetEventBuffer()); + motionInstance->ExtractEventsNonLoop(uniqueData->m_oldTime, uniqueData->m_newTime, &uniqueData->GetRefCountedData()->GetEventBuffer()); data->GetEventBuffer().UpdateEmitters(this); } } @@ -214,14 +214,14 @@ namespace EMotionFX void BlendTreeMotionFrameNode::Update(AnimGraphInstance* animGraphInstance, float timePassedInSeconds) { // update the time input - BlendTreeConnection* timeConnection = mInputPorts[INPUTPORT_TIME].mConnection; + BlendTreeConnection* timeConnection = m_inputPorts[INPUTPORT_TIME].m_connection; if (timeConnection) { UpdateIncomingNode(animGraphInstance, timeConnection->GetSourceNode(), timePassedInSeconds); } // update the input motion - BlendTreeConnection* motionConnection = mInputPorts[INPUTPORT_MOTION].mConnection; + BlendTreeConnection* motionConnection = m_inputPorts[INPUTPORT_MOTION].m_connection; if (motionConnection) { UpdateIncomingNode(animGraphInstance, motionConnection->GetSourceNode(), timePassedInSeconds); @@ -246,14 +246,14 @@ namespace EMotionFX { if (m_emitEventsFromStart) { - uniqueData->mNewTime = 0.0f; - uniqueData->mOldTime = 0.0f; + uniqueData->m_newTime = 0.0f; + uniqueData->m_oldTime = 0.0f; } else { const float newTimeValue = uniqueData->GetDuration() * timeValue; - uniqueData->mNewTime = newTimeValue; - uniqueData->mOldTime = newTimeValue; + uniqueData->m_newTime = newTimeValue; + uniqueData->m_oldTime = newTimeValue; } uniqueData->m_rewindRequested = false; } @@ -264,8 +264,8 @@ namespace EMotionFX uniqueData->Init(animGraphInstance, motionNode); uniqueData->SetCurrentPlayTime(uniqueData->GetDuration() * timeValue); - uniqueData->mOldTime = uniqueData->mNewTime; - uniqueData->mNewTime = uniqueData->GetDuration() * timeValue; + uniqueData->m_oldTime = uniqueData->m_newTime; + uniqueData->m_newTime = uniqueData->GetDuration() * timeValue; } else { diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeMotionFrameNode.h b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeMotionFrameNode.h index 6268012828..184a0bbc98 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeMotionFrameNode.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeMotionFrameNode.h @@ -55,14 +55,14 @@ namespace EMotionFX void Reset() override { - mOldTime = 0.0f; - mNewTime = 0.0f; + m_oldTime = 0.0f; + m_newTime = 0.0f; m_rewindRequested = false; } public: - float mOldTime; - float mNewTime; + float m_oldTime; + float m_newTime; bool m_rewindRequested; }; diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeParameterNode.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeParameterNode.cpp index 8197cae9d0..ae24769584 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeParameterNode.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeParameterNode.cpp @@ -37,14 +37,14 @@ namespace EMotionFX void BlendTreeParameterNode::Reinit() { // Sort the parameter name mask in the way the parameters are stored in the anim graph. - SortParameterNames(mAnimGraph, m_parameterNames); + SortParameterNames(m_animGraph, m_parameterNames); // Iterate through the parameter name mask and find the corresponding cached value parameter indices. // This expects the parameter names to be sorted in the way the parameters are stored in the anim graph. m_parameterIndices.clear(); for (const AZStd::string& parameterName : m_parameterNames) { - const AZ::Outcome parameterIndex = mAnimGraph->FindValueParameterIndexByName(parameterName); + const AZ::Outcome parameterIndex = m_animGraph->FindValueParameterIndexByName(parameterName); // during removal of parameters, we could end up with a parameter that was removed until the node gets the mask updated if (parameterIndex.IsSuccess()) { @@ -57,7 +57,7 @@ namespace EMotionFX if (m_parameterIndices.empty()) { // Parameter mask is empty, add ports for all parameters. - const ValueParameterVector& valueParameters = mAnimGraph->RecursivelyGetValueParameters(); + const ValueParameterVector& valueParameters = m_animGraph->RecursivelyGetValueParameters(); const uint32 valueParameterCount = static_cast(valueParameters.size()); InitOutputPorts(valueParameterCount); @@ -66,12 +66,12 @@ namespace EMotionFX const ValueParameter* parameter = valueParameters[i]; SetOutputPortName(static_cast(i), parameter->GetName().c_str()); - mOutputPorts[i].mPortID = i; - mOutputPorts[i].ClearCompatibleTypes(); - mOutputPorts[i].mCompatibleTypes[0] = parameter->GetType(); + m_outputPorts[i].m_portId = i; + m_outputPorts[i].ClearCompatibleTypes(); + m_outputPorts[i].m_compatibleTypes[0] = parameter->GetType(); if (GetTypeSupportsFloat(parameter->GetType())) { - mOutputPorts[i].mCompatibleTypes[1] = MCore::AttributeFloat::TYPE_ID; + m_outputPorts[i].m_compatibleTypes[1] = MCore::AttributeFloat::TYPE_ID; } } } @@ -83,15 +83,15 @@ namespace EMotionFX for (size_t i = 0; i < parameterCount; ++i) { - const ValueParameter* parameter = mAnimGraph->FindValueParameter(m_parameterIndices[i]); + const ValueParameter* parameter = m_animGraph->FindValueParameter(m_parameterIndices[i]); SetOutputPortName(static_cast(i), parameter->GetName().c_str()); - mOutputPorts[i].mPortID = static_cast(i); - mOutputPorts[i].ClearCompatibleTypes(); - mOutputPorts[i].mCompatibleTypes[0] = parameter->GetType(); + m_outputPorts[i].m_portId = static_cast(i); + m_outputPorts[i].ClearCompatibleTypes(); + m_outputPorts[i].m_compatibleTypes[0] = parameter->GetType(); if (GetTypeSupportsFloat(parameter->GetType())) { - mOutputPorts[i].mCompatibleTypes[1] = MCore::AttributeFloat::TYPE_ID; + m_outputPorts[i].m_compatibleTypes[1] = MCore::AttributeFloat::TYPE_ID; } } } @@ -139,7 +139,7 @@ namespace EMotionFX if (m_parameterIndices.empty()) { // output all anim graph instance parameter values into the output ports - const uint32 numParameters = static_cast(mOutputPorts.size()); + const uint32 numParameters = static_cast(m_outputPorts.size()); for (uint32 i = 0; i < numParameters; ++i) { GetOutputValue(animGraphInstance, i)->InitFrom(animGraphInstance->GetParameterValue(i)); @@ -235,7 +235,7 @@ namespace EMotionFX void BlendTreeParameterNode::SetParameters(const AZStd::vector& parameterNames) { m_parameterNames = parameterNames; - if (mAnimGraph) + if (m_animGraph) { Reinit(); } @@ -299,7 +299,7 @@ namespace EMotionFX void BlendTreeParameterNode::RemoveParameterByName(const AZStd::string& parameterName) { m_parameterNames.erase(AZStd::remove(m_parameterNames.begin(), m_parameterNames.end(), parameterName), m_parameterNames.end()); - if (mAnimGraph) + if (m_animGraph) { Reinit(); } @@ -376,7 +376,7 @@ namespace EMotionFX // Add all connected parameters for (const AnimGraphNode::Port& port : GetOutputPorts()) { - if (port.mConnection) + if (port.m_connection) { parameterNames.emplace_back(port.GetNameString()); } @@ -435,10 +435,10 @@ namespace EMotionFX // Rename the actual output ports in all cases // (also when the parameter mask is empty and showing all parameters). - const size_t numOutputPorts = mOutputPorts.size(); + const size_t numOutputPorts = m_outputPorts.size(); for (size_t i = 0; i < numOutputPorts; ++i) { - AnimGraphNode::Port& outputPort = mOutputPorts[i]; + AnimGraphNode::Port& outputPort = m_outputPorts[i]; if (outputPort.GetNameString() == oldParameterName) { SetOutputPortName(static_cast(i), newParameterName.c_str()); diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreePoseSubtractNode.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreePoseSubtractNode.cpp index c70dee1de0..be40cb6749 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreePoseSubtractNode.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreePoseSubtractNode.cpp @@ -78,7 +78,7 @@ namespace EMotionFX AnimGraphNode* subtractNode = GetInputNode(INPUTPORT_POSE_B); // If we are disabled and we have an input node, or if we are no disabled but have no subtract input. - if ((mDisabled && inputNode) || (!mDisabled && inputNode && !subtractNode)) + if ((m_disabled && inputNode) || (!m_disabled && inputNode && !subtractNode)) { OutputIncomingNode(animGraphInstance, inputNode); RequestPoses(animGraphInstance); @@ -86,7 +86,7 @@ namespace EMotionFX *outputPose = *inputNode->GetMainOutputPose(animGraphInstance); return; } - else if (mDisabled || !inputNode) // If we are disabled or have no inputs. + else if (m_disabled || !inputNode) // If we are disabled or have no inputs. { RequestPoses(animGraphInstance); AnimGraphPose* outputPose = GetOutputPose(animGraphInstance, OUTPUTPORT_POSE)->GetValue(); @@ -116,7 +116,7 @@ namespace EMotionFX if (GetEMotionFX().GetIsInEditorMode() && GetCanVisualize(animGraphInstance)) { AnimGraphPose* visualOutputPose = GetOutputPose(animGraphInstance, OUTPUTPORT_POSE)->GetValue(); - animGraphInstance->GetActorInstance()->DrawSkeleton(visualOutputPose->GetPose(), mVisualizeColor); + animGraphInstance->GetActorInstance()->DrawSkeleton(visualOutputPose->GetPose(), m_visualizeColor); } } @@ -127,14 +127,14 @@ namespace EMotionFX AnimGraphNode* subtractNode = GetInputNode(INPUTPORT_POSE_B); // If we are disabled and we have an input node, or if we are no disabled but have no subtract input. - if ((mDisabled && inputNode) || (!mDisabled && inputNode && !subtractNode)) + if ((m_disabled && inputNode) || (!m_disabled && inputNode && !subtractNode)) { UpdateIncomingNode(animGraphInstance, inputNode, timePassedInSeconds); AnimGraphNodeData* uniqueData = FindOrCreateUniqueNodeData(animGraphInstance); uniqueData->Init(animGraphInstance, inputNode); return; } - else if (mDisabled || (!inputNode && !subtractNode)) // If we are disabled or have no inputs. + else if (m_disabled || (!inputNode && !subtractNode)) // If we are disabled or have no inputs. { AnimGraphNodeData* uniqueData = FindOrCreateUniqueNodeData(animGraphInstance); uniqueData->Clear(); @@ -166,7 +166,7 @@ namespace EMotionFX data->ZeroTrajectoryDelta(); // We are disabled and have no input pose, so output no delta. - if (mDisabled || !nodeA) + if (m_disabled || !nodeA) { return; } @@ -191,7 +191,7 @@ namespace EMotionFX AnimGraphNode* inputNode = GetInputNode(INPUTPORT_POSE_A); AnimGraphNode* subtractNode = GetInputNode(INPUTPORT_POSE_B); - if (mDisabled) + if (m_disabled) { if (inputNode) { @@ -211,7 +211,7 @@ namespace EMotionFX { // Sync the input node to this node. inputNode->AutoSync(animGraphInstance, this, 0.0f, SYNCMODE_TRACKBASED, false); - if (animGraphInstance->GetIsObjectFlagEnabled(mObjectIndex, AnimGraphInstance::OBJECTFLAGS_SYNCED) == false) + if (animGraphInstance->GetIsObjectFlagEnabled(m_objectIndex, AnimGraphInstance::OBJECTFLAGS_SYNCED) == false) { inputNode->RecursiveSetUniqueDataFlag(animGraphInstance, AnimGraphInstance::OBJECTFLAGS_SYNCED, true); } @@ -255,7 +255,7 @@ namespace EMotionFX // We are disabled but had an input pose, just forward that in this case. // Do the same if we are not disabled but have no second pose. - if ((mDisabled && inputNode) || (!mDisabled && inputNode && !subtractNode)) + if ((m_disabled && inputNode) || (!m_disabled && inputNode && !subtractNode)) { inputNode->PerformPostUpdate(animGraphInstance, timePassedInSeconds); RequestRefDatas(animGraphInstance); @@ -267,7 +267,7 @@ namespace EMotionFX data->SetTrajectoryDeltaMirrored(inputData->GetTrajectoryDelta()); return; } - else if (mDisabled || !inputNode) // If we are disabled or have no inputs. + else if (m_disabled || !inputNode) // If we are disabled or have no inputs. { RequestRefDatas(animGraphInstance); AnimGraphNodeData* uniqueData = FindOrCreateUniqueNodeData(animGraphInstance); diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreePoseSwitchNode.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreePoseSwitchNode.cpp index 0eb1f3d06a..78fe49894d 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreePoseSwitchNode.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreePoseSwitchNode.cpp @@ -85,7 +85,7 @@ namespace EMotionFX AnimGraphPose* outputPose; // if the decision port has no incomming connection, there is nothing we can do - if (mInputPorts[INPUTPORT_DECISIONVALUE].mConnection == nullptr) + if (m_inputPorts[INPUTPORT_DECISIONVALUE].m_connection == nullptr) { RequestPoses(animGraphInstance); outputPose = GetOutputPose(animGraphInstance, OUTPUTPORT_POSE)->GetValue(); @@ -98,7 +98,7 @@ namespace EMotionFX const int32 decisionValue = MCore::Clamp(GetInputNumberAsInt32(animGraphInstance, INPUTPORT_DECISIONVALUE), 0, 9); // max 10 cases // check if there is an incoming connection from this port - if (mInputPorts[INPUTPORT_POSE_0 + decisionValue].mConnection == nullptr) + if (m_inputPorts[INPUTPORT_POSE_0 + decisionValue].m_connection == nullptr) { RequestPoses(animGraphInstance); outputPose = GetOutputPose(animGraphInstance, OUTPUTPORT_POSE)->GetValue(); @@ -107,7 +107,7 @@ namespace EMotionFX // visualize it if (GetEMotionFX().GetIsInEditorMode() && GetCanVisualize(animGraphInstance)) { - animGraphInstance->GetActorInstance()->DrawSkeleton(outputPose->GetPose(), mVisualizeColor); + animGraphInstance->GetActorInstance()->DrawSkeleton(outputPose->GetPose(), m_visualizeColor); } return; } @@ -124,7 +124,7 @@ namespace EMotionFX // visualize it if (GetEMotionFX().GetIsInEditorMode() && GetCanVisualize(animGraphInstance)) { - animGraphInstance->GetActorInstance()->DrawSkeleton(outputPose->GetPose(), mVisualizeColor); + animGraphInstance->GetActorInstance()->DrawSkeleton(outputPose->GetPose(), m_visualizeColor); } } @@ -133,7 +133,7 @@ namespace EMotionFX void BlendTreePoseSwitchNode::Update(AnimGraphInstance* animGraphInstance, float timePassedInSeconds) { // if the decision port has no incomming connection, there is nothing we can do - if (mInputPorts[INPUTPORT_DECISIONVALUE].mConnection == nullptr) + if (m_inputPorts[INPUTPORT_DECISIONVALUE].m_connection == nullptr) { UniqueData* uniqueData = static_cast(FindOrCreateUniqueNodeData(animGraphInstance)); uniqueData->Clear(); @@ -141,13 +141,13 @@ namespace EMotionFX } // update the node that plugs into the decision value port - UpdateIncomingNode(animGraphInstance, mInputPorts[INPUTPORT_DECISIONVALUE].mConnection->GetSourceNode(), timePassedInSeconds); + UpdateIncomingNode(animGraphInstance, m_inputPorts[INPUTPORT_DECISIONVALUE].m_connection->GetSourceNode(), timePassedInSeconds); // get the index we choose const int32 decisionValue = MCore::Clamp(GetInputNumberAsInt32(animGraphInstance, INPUTPORT_DECISIONVALUE), 0, 9); // max 10 cases // check if there is an incoming connection from this port - if (mInputPorts[INPUTPORT_POSE_0 + decisionValue].mConnection == nullptr) + if (m_inputPorts[INPUTPORT_POSE_0 + decisionValue].m_connection == nullptr) { UniqueData* uniqueData = static_cast(FindOrCreateUniqueNodeData(animGraphInstance)); uniqueData->Clear(); @@ -155,14 +155,14 @@ namespace EMotionFX } // pass through the motion extraction of the selected node - AnimGraphNode* sourceNode = mInputPorts[INPUTPORT_POSE_0 + decisionValue].mConnection->GetSourceNode(); + AnimGraphNode* sourceNode = m_inputPorts[INPUTPORT_POSE_0 + decisionValue].m_connection->GetSourceNode(); // if our decision value changed since last time, specify that we want to resync // this basically means that the motion extraction delta will be zero for one frame UniqueData* uniqueData = static_cast(FindOrCreateUniqueNodeData(animGraphInstance)); - if (uniqueData->mDecisionIndex != decisionValue) + if (uniqueData->m_decisionIndex != decisionValue) { - uniqueData->mDecisionIndex = decisionValue; + uniqueData->m_decisionIndex = decisionValue; //sourceNode->RecursiveSetUniqueDataFlag(animGraphInstance, AnimGraphObjectData::FLAGS_RESYNC, true); } @@ -176,7 +176,7 @@ namespace EMotionFX void BlendTreePoseSwitchNode::PostUpdate(AnimGraphInstance* animGraphInstance, float timePassedInSeconds) { // if the decision port has no incomming connection, there is nothing we can do - if (mInputPorts[INPUTPORT_DECISIONVALUE].mConnection == nullptr) + if (m_inputPorts[INPUTPORT_DECISIONVALUE].m_connection == nullptr) { RequestRefDatas(animGraphInstance); UniqueData* uniqueData = static_cast(FindOrCreateUniqueNodeData(animGraphInstance)); @@ -187,13 +187,13 @@ namespace EMotionFX } // update the node that plugs into the decision value port - mInputPorts[INPUTPORT_DECISIONVALUE].mConnection->GetSourceNode()->PerformPostUpdate(animGraphInstance, timePassedInSeconds); + m_inputPorts[INPUTPORT_DECISIONVALUE].m_connection->GetSourceNode()->PerformPostUpdate(animGraphInstance, timePassedInSeconds); // get the index we choose const int32 decisionValue = MCore::Clamp(GetInputNumberAsInt32(animGraphInstance, INPUTPORT_DECISIONVALUE), 0, 9); // max 10 cases // check if there is an incoming connection from this port - if (mInputPorts[INPUTPORT_POSE_0 + decisionValue].mConnection == nullptr) + if (m_inputPorts[INPUTPORT_POSE_0 + decisionValue].m_connection == nullptr) { RequestRefDatas(animGraphInstance); UniqueData* uniqueData = static_cast(FindOrCreateUniqueNodeData(animGraphInstance)); @@ -204,7 +204,7 @@ namespace EMotionFX } // pass through the motion extraction of the selected node - AnimGraphNode* sourceNode = mInputPorts[INPUTPORT_POSE_0 + decisionValue].mConnection->GetSourceNode(); + AnimGraphNode* sourceNode = m_inputPorts[INPUTPORT_POSE_0 + decisionValue].m_connection->GetSourceNode(); sourceNode->PerformPostUpdate(animGraphInstance, timePassedInSeconds); // output the events of the source node we picked @@ -223,7 +223,7 @@ namespace EMotionFX void BlendTreePoseSwitchNode::TopDownUpdate(AnimGraphInstance* animGraphInstance, float timePassedInSeconds) { // if the decision port has no incomming connection, there is nothing we can do - if (mInputPorts[INPUTPORT_DECISIONVALUE].mConnection == nullptr) + if (m_inputPorts[INPUTPORT_DECISIONVALUE].m_connection == nullptr) { return; } @@ -232,7 +232,7 @@ namespace EMotionFX const int32 decisionValue = MCore::Clamp(GetInputNumberAsInt32(animGraphInstance, INPUTPORT_DECISIONVALUE), 0, 9); // max 10 cases // check if there is an incoming connection from this port - if (mInputPorts[INPUTPORT_POSE_0 + decisionValue].mConnection == nullptr) + if (m_inputPorts[INPUTPORT_POSE_0 + decisionValue].m_connection == nullptr) { return; } @@ -242,7 +242,7 @@ namespace EMotionFX HierarchicalSyncAllInputNodes(animGraphInstance, uniqueData); // top down update all incoming connections - for (BlendTreeConnection* connection : mConnections) + for (BlendTreeConnection* connection : m_connections) { connection->GetSourceNode()->PerformTopDownUpdate(animGraphInstance, timePassedInSeconds); } diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreePoseSwitchNode.h b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreePoseSwitchNode.h index 1b8c958c27..9e24eff232 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreePoseSwitchNode.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreePoseSwitchNode.h @@ -67,7 +67,7 @@ namespace EMotionFX : AnimGraphNodeData(node, animGraphInstance) {} public: - int32 mDecisionIndex = -1; + int32 m_decisionIndex = -1; }; BlendTreePoseSwitchNode(); diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeRagdollNode.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeRagdollNode.cpp index f62d569a16..1d3c623215 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeRagdollNode.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeRagdollNode.cpp @@ -30,10 +30,10 @@ namespace EMotionFX void BlendTreeRagdollNode::UniqueData::Update() { - BlendTreeRagdollNode* ragdollNode = azdynamic_cast(mObject); + BlendTreeRagdollNode* ragdollNode = azdynamic_cast(m_object); AZ_Assert(ragdollNode, "Unique data linked to incorrect node type."); - const Actor* actor = mAnimGraphInstance->GetActorInstance()->GetActor(); + const Actor* actor = m_animGraphInstance->GetActorInstance()->GetActor(); const Skeleton* skeleton = actor->GetSkeleton(); const size_t jointCount = skeleton->GetNumNodes(); @@ -54,7 +54,7 @@ namespace EMotionFX } // Check if we selected the ragdoll root node to be added to the simulation. - const ActorInstance* actorInstance = mAnimGraphInstance->GetActorInstance(); + const ActorInstance* actorInstance = m_animGraphInstance->GetActorInstance(); const RagdollInstance* ragdollInstance = actorInstance->GetRagdollInstance(); m_isRagdollRootNodeSimulated = false; if (ragdollInstance) @@ -126,7 +126,7 @@ namespace EMotionFX RequestRefDatas(animGraphInstance); AnimGraphRefCountedData* data = uniqueData->GetRefCountedData(); - if (mDisabled) + if (m_disabled) { data->ClearEventBuffer(); data->ZeroTrajectoryDelta(); @@ -170,13 +170,13 @@ namespace EMotionFX if (ragdollInstance && motionExtractionNode) { // Move the trajectory node based on the ragdoll's movement. - trajectoryDelta.mPosition = ragdollInstance->GetTrajectoryDeltaPos(); + trajectoryDelta.m_position = ragdollInstance->GetTrajectoryDeltaPos(); // Do the same for rotation, but extract and apply z rotation only to the trajectory node. - trajectoryDelta.mRotation = ragdollInstance->GetTrajectoryDeltaRot(); - trajectoryDelta.mRotation.SetX(0.0f); - trajectoryDelta.mRotation.SetY(0.0f); - trajectoryDelta.mRotation.Normalize(); + trajectoryDelta.m_rotation = ragdollInstance->GetTrajectoryDeltaRot(); + trajectoryDelta.m_rotation.SetX(0.0f); + trajectoryDelta.m_rotation.SetY(0.0f); + trajectoryDelta.m_rotation.Normalize(); } data->SetTrajectoryDelta(trajectoryDelta); @@ -207,7 +207,7 @@ namespace EMotionFX } // As we already forwarded the target pose at this point, we can just return in case the node is disabled. - if (mDisabled) + if (m_disabled) { return; } @@ -215,7 +215,7 @@ namespace EMotionFX Pose& outputPose = animGraphOutputPose->GetPose(); if (GetCanVisualize(animGraphInstance)) { - actorInstance->DrawSkeleton(outputPose, mVisualizeColor); + actorInstance->DrawSkeleton(outputPose, m_visualizeColor); } if (HasConnectionAtInputPort(INPUTPORT_ACTIVATE)) @@ -264,7 +264,7 @@ namespace EMotionFX Transform newGlobalTransform( currentRagdollRootNodeState.m_position, currentRagdollRootNodeState.m_orientation, - outputPose.GetWorldSpaceTransform(jointIndex).mScale); + outputPose.GetWorldSpaceTransform(jointIndex).m_scale); #else Transform newGlobalTransform( currentRagdollRootNodeState.m_position, @@ -298,7 +298,7 @@ namespace EMotionFX Transform newGlobalTransform = Transform( currentRagdollNodeState.m_position, currentRagdollNodeState.m_orientation, - outputPose.GetWorldSpaceTransform(jointIndex).mScale); + outputPose.GetWorldSpaceTransform(jointIndex).m_scale); #else Transform newGlobalTransform = Transform( currentRagdollNodeState.m_position, @@ -315,12 +315,12 @@ namespace EMotionFX Transform globalTransform = Transform( currentRagdollNodeState.m_position, currentRagdollNodeState.m_orientation, - outputPose.GetWorldSpaceTransform(jointIndex).mScale); + outputPose.GetWorldSpaceTransform(jointIndex).m_scale); Transform parentGlobalTransform = Transform( currentParentRagdollNodeState.m_position, currentParentRagdollNodeState.m_orientation, - outputPose.GetWorldSpaceTransform(ragdollParentJoint->GetNodeIndex()).mScale); + outputPose.GetWorldSpaceTransform(ragdollParentJoint->GetNodeIndex()).m_scale); #else Transform globalTransform = Transform( currentRagdollNodeState.m_position, @@ -343,15 +343,15 @@ namespace EMotionFX // Set the target pose for the selected and thus simulated joints in the anim graph node has a target pose connected to its input port. // Set the local space transform for powered ragdoll nodes. const Transform& localTransform = targetPose->GetLocalSpaceTransform(jointIndex); - targetRagdollNodeState.m_position = localTransform.mPosition; - targetRagdollNodeState.m_orientation = localTransform.mRotation; + targetRagdollNodeState.m_position = localTransform.m_position; + targetRagdollNodeState.m_orientation = localTransform.m_rotation; } else { // We do not have a target pose connected to the input port, just forward what is currently in the output pose (bind pose). const Transform& localTransform = outputPose.GetLocalSpaceTransform(jointIndex); - targetRagdollNodeState.m_position = localTransform.mPosition; - targetRagdollNodeState.m_orientation = localTransform.mRotation; + targetRagdollNodeState.m_position = localTransform.m_position; + targetRagdollNodeState.m_orientation = localTransform.m_rotation; } } else diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeRagdollStrengthModifierNode.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeRagdollStrengthModifierNode.cpp index dbf6009c9a..ef5767eef8 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeRagdollStrengthModifierNode.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeRagdollStrengthModifierNode.cpp @@ -27,11 +27,11 @@ namespace EMotionFX void BlendTreeRagdollStrenghModifierNode::UniqueData::Update() { - BlendTreeRagdollStrenghModifierNode* ragdollModifierNode = azdynamic_cast(mObject); + BlendTreeRagdollStrenghModifierNode* ragdollModifierNode = azdynamic_cast(m_object); AZ_Assert(ragdollModifierNode, "Unique data linked to incorrect node type."); const AZStd::vector& modifiedJointNames = ragdollModifierNode->GetModifiedJointNames(); - const Actor* actor = mAnimGraphInstance->GetActorInstance()->GetActor(); + const Actor* actor = m_animGraphInstance->GetActorInstance()->GetActor(); AnimGraphPropertyUtils::ReinitJointIndices(actor, modifiedJointNames, m_modifiedJointIndices); } @@ -87,7 +87,7 @@ namespace EMotionFX } // As we already forwarded the input pose at this point, we can just return in case the node is disabled. - if (mDisabled) + if (m_disabled) { return; } @@ -95,7 +95,7 @@ namespace EMotionFX Pose& outputPose = animGraphOutputPose->GetPose(); if (GetCanVisualize(animGraphInstance)) { - actorInstance->DrawSkeleton(outputPose, mVisualizeColor); + actorInstance->DrawSkeleton(outputPose, m_visualizeColor); } UniqueData* uniqueData = static_cast(FindOrCreateUniqueNodeData(animGraphInstance)); diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeRangeRemapperNode.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeRangeRemapperNode.cpp index 1672bd6177..9215db80a1 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeRangeRemapperNode.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeRangeRemapperNode.cpp @@ -72,8 +72,8 @@ namespace EMotionFX UpdateAllIncomingNodes(animGraphInstance, timePassedInSeconds); // if there are no incoming connections, there is nothing to do - const size_t numConnections = mConnections.size(); - if (numConnections == 0 || mDisabled) + const size_t numConnections = m_connections.size(); + if (numConnections == 0 || m_disabled) { if (numConnections > 0) // pass the input value as output in case we are disabled { @@ -89,7 +89,7 @@ namespace EMotionFX float x = GetInputNumberAsFloat(animGraphInstance, INPUTPORT_X); // output the original input, so without remapping, if this node is disabled - if (mDisabled) + if (m_disabled) { GetOutputFloat(animGraphInstance, OUTPUTPORT_RESULT)->SetValue(x); return; diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeRaycastNode.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeRaycastNode.cpp index e9563cfb6f..2d11abc4ff 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeRaycastNode.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeRaycastNode.cpp @@ -30,7 +30,7 @@ namespace EMotionFX SetupOutputPort("Normal", OUTPUTPORT_NORMAL, MCore::AttributeVector3::TYPE_ID, PORTID_OUTPUT_NORMAL); SetupOutputPort("Intersected", OUTPUTPORT_INTERSECTED, MCore::AttributeFloat::TYPE_ID, PORTID_OUTPUT_INTERSECTED); - if (mAnimGraph) + if (m_animGraph) { Reinit(); } diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeRotationLimitNode.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeRotationLimitNode.cpp index d4eaf9fcf1..cf8ebd2a46 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeRotationLimitNode.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeRotationLimitNode.cpp @@ -155,13 +155,13 @@ namespace EMotionFX void BlendTreeRotationLimitNode::ExecuteMathLogic(EMotionFX::AnimGraphInstance * animGraphInstance) { // If there are no incoming connections, there is nothing to do - if (mConnections.empty()) + if (m_connections.empty()) { return; } m_constraintTransformRotationAngles.SetTwistAxis(m_twistAxis); - m_constraintTransformRotationAngles.GetTransform().mRotation = GetInputQuaternion(animGraphInstance, INPUTPORT_ROTATION)->GetValue(); + m_constraintTransformRotationAngles.GetTransform().m_rotation = GetInputQuaternion(animGraphInstance, INPUTPORT_ROTATION)->GetValue(); m_constraintTransformRotationAngles.SetMaxRotationAngles(AZ::Vector2(GetRotationLimitY().m_max, GetRotationLimitX().m_max)); m_constraintTransformRotationAngles.SetMinRotationAngles(AZ::Vector2(GetRotationLimitY().m_min, GetRotationLimitX().m_min)); @@ -169,7 +169,7 @@ namespace EMotionFX m_constraintTransformRotationAngles.SetMaxTwistAngle(GetRotationLimitZ().m_max); m_constraintTransformRotationAngles.Execute(); - GetOutputQuaternion(animGraphInstance, OUTPUTPORT_RESULT_QUATERNION)->SetValue(m_constraintTransformRotationAngles.GetTransform().mRotation); + GetOutputQuaternion(animGraphInstance, OUTPUTPORT_RESULT_QUATERNION)->SetValue(m_constraintTransformRotationAngles.GetTransform().m_rotation); } void BlendTreeRotationLimitNode::Reflect(AZ::ReflectContext* context) diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeRotationMath2Node.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeRotationMath2Node.cpp index 1f15333561..effe6c8477 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeRotationMath2Node.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeRotationMath2Node.cpp @@ -33,7 +33,7 @@ namespace EMotionFX InitOutputPorts(1); SetupOutputPort("Rotation", INPUTPORT_X, MCore::AttributeQuaternion::TYPE_ID, PORTID_OUTPUT_QUATERNION); - if (mAnimGraph) + if (m_animGraph) { Reinit(); } @@ -99,7 +99,7 @@ namespace EMotionFX void BlendTreeRotationMath2Node::ExecuteMathLogic(EMotionFX::AnimGraphInstance * animGraphInstance) { // If there are no incoming connections, there is nothing to do - if (mConnections.empty()) + if (m_connections.empty()) { return; } @@ -107,7 +107,7 @@ namespace EMotionFX // If both x and y inputs have connections AZ::Quaternion x = m_defaultValue; AZ::Quaternion y = x; - if (mConnections.size() == 2) + if (m_connections.size() == 2) { x = GetInputQuaternion(animGraphInstance, INPUTPORT_X)->GetValue(); @@ -116,13 +116,13 @@ namespace EMotionFX else // Only x or y is connected { // If only x has something plugged in - if (mConnections[0]->GetTargetPort() == INPUTPORT_X) + if (m_connections[0]->GetTargetPort() == INPUTPORT_X) { x = GetInputQuaternion(animGraphInstance, INPUTPORT_X)->GetValue(); } else // Only y has an input { - MCORE_ASSERT(mConnections[0]->GetTargetPort() == INPUTPORT_Y); + MCORE_ASSERT(m_connections[0]->GetTargetPort() == INPUTPORT_Y); y = GetInputQuaternion(animGraphInstance, INPUTPORT_Y)->GetValue(); } } @@ -138,7 +138,7 @@ namespace EMotionFX void BlendTreeRotationMath2Node::SetMathFunction(EMathFunction func) { m_mathFunction = func; - if (mAnimGraph) + if (m_animGraph) { Reinit(); } diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeSetTransformNode.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeSetTransformNode.cpp index 0817b95614..87bd31d942 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeSetTransformNode.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeSetTransformNode.cpp @@ -32,10 +32,10 @@ namespace EMotionFX void BlendTreeSetTransformNode::UniqueData::Update() { - BlendTreeSetTransformNode* transformNode = azdynamic_cast(mObject); + BlendTreeSetTransformNode* transformNode = azdynamic_cast(m_object); AZ_Assert(transformNode, "Unique data linked to incorrect node type."); - ActorInstance* actorInstance = mAnimGraphInstance->GetActorInstance(); + ActorInstance* actorInstance = m_animGraphInstance->GetActorInstance(); Actor* actor = actorInstance->GetActor(); m_nodeIndex = InvalidIndex; @@ -112,7 +112,7 @@ namespace EMotionFX OutputAllIncomingNodes(animGraphInstance); // make sure we have at least an input pose, otherwise output the bind pose - if (GetInputPort(INPUTPORT_POSE).mConnection) + if (GetInputPort(INPUTPORT_POSE).m_connection) { const AnimGraphPose* inputPose = GetInputPose(animGraphInstance, INPUTPORT_POSE)->GetValue(); RequestPoses(animGraphInstance); @@ -154,14 +154,14 @@ namespace EMotionFX AZ::Vector3 translation; if (TryGetInputVector3(animGraphInstance, INPUTPORT_TRANSLATION, translation)) { - outputTransform.mPosition = translation; + outputTransform.m_position = translation; } // process the rotation - if (GetInputPort(INPUTPORT_ROTATION).mConnection) + if (GetInputPort(INPUTPORT_ROTATION).m_connection) { const AZ::Quaternion& rotation = GetInputQuaternion(animGraphInstance, INPUTPORT_ROTATION)->GetValue(); - outputTransform.mRotation = rotation; + outputTransform.m_rotation = rotation; } // process the scale @@ -170,7 +170,7 @@ namespace EMotionFX AZ::Vector3 scale; if (TryGetInputVector3(animGraphInstance, INPUTPORT_SCALE, scale)) { - outputTransform.mScale = scale; + outputTransform.m_scale = scale; } ) @@ -197,7 +197,7 @@ namespace EMotionFX // visualize it if (GetEMotionFX().GetIsInEditorMode() && GetCanVisualize(animGraphInstance)) { - animGraphInstance->GetActorInstance()->DrawSkeleton(outputPose->GetPose(), mVisualizeColor); + animGraphInstance->GetActorInstance()->DrawSkeleton(outputPose->GetPose(), m_visualizeColor); } } diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeSimulatedObjectNode.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeSimulatedObjectNode.cpp index d54ef4ffd4..4c2f2c8f31 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeSimulatedObjectNode.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeSimulatedObjectNode.cpp @@ -38,7 +38,7 @@ namespace EMotionFX void BlendTreeSimulatedObjectNode::UniqueData::Update() { - BlendTreeSimulatedObjectNode* simulatedObjectNode = azdynamic_cast(mObject); + BlendTreeSimulatedObjectNode* simulatedObjectNode = azdynamic_cast(m_object); AZ_Assert(simulatedObjectNode, "Unique data linked to incorrect node type."); const bool solverInitResult = simulatedObjectNode->InitSolvers(GetAnimGraphInstance(), this); @@ -68,7 +68,7 @@ namespace EMotionFX void BlendTreeSimulatedObjectNode::Reinit() { - if (!mAnimGraph) + if (!m_animGraph) { return; } @@ -212,7 +212,7 @@ namespace EMotionFX AnimGraphPose* outputPose; // If nothing is connected to the input pose, output a bind pose. - if (!GetInputPort(INPUTPORT_POSE).mConnection) + if (!GetInputPort(INPUTPORT_POSE).m_connection) { RequestPoses(animGraphInstance); outputPose = GetOutputPose(animGraphInstance, OUTPUTPORT_POSE)->GetValue(); @@ -223,14 +223,14 @@ namespace EMotionFX // Check whether we are active or not. bool isActive = true; - if (GetInputPort(INPUTPORT_ACTIVE).mConnection) + if (GetInputPort(INPUTPORT_ACTIVE).m_connection) { OutputIncomingNode(animGraphInstance, GetInputNode(INPUTPORT_ACTIVE)); isActive = GetInputNumberAsBool(animGraphInstance, INPUTPORT_ACTIVE); } // If we're not active or if this node is disabled or it is optimized for server, we can skip all calculations and just output the input pose. - if (!isActive || mDisabled || GetEMotionFX().GetEnableServerOptimization()) + if (!isActive || m_disabled || GetEMotionFX().GetEnableServerOptimization()) { OutputIncomingNode(animGraphInstance, GetInputNode(INPUTPORT_POSE)); const AnimGraphPose* inputPose = GetInputPose(animGraphInstance, INPUTPORT_POSE)->GetValue(); @@ -291,7 +291,7 @@ namespace EMotionFX { for (const Simulation* sim : uniqueData->m_simulations) { - sim->m_solver.DebugRender(outputPose->GetPose(), m_collisionDetection, true, mVisualizeColor); + sim->m_solver.DebugRender(outputPose->GetPose(), m_collisionDetection, true, m_visualizeColor); } } } @@ -308,15 +308,15 @@ namespace EMotionFX void BlendTreeSimulatedObjectNode::AdjustParticles(const SpringSolver::ParticleAdjustFunction& func) { - if (!mAnimGraph) + if (!m_animGraph) { return; } - const size_t numInstances = mAnimGraph->GetNumAnimGraphInstances(); + const size_t numInstances = m_animGraph->GetNumAnimGraphInstances(); for (size_t i = 0; i < numInstances; ++i) { - AnimGraphInstance* animGraphInstance = mAnimGraph->GetAnimGraphInstance(i); + AnimGraphInstance* animGraphInstance = m_animGraph->GetAnimGraphInstance(i); UniqueData* uniqueData = static_cast(animGraphInstance->FindOrCreateUniqueNodeData(this)); if (!uniqueData) { @@ -332,15 +332,15 @@ namespace EMotionFX void BlendTreeSimulatedObjectNode::OnPropertyChanged(const PropertyChangeFunction& func) { - if (!mAnimGraph) + if (!m_animGraph) { return; } - const size_t numInstances = mAnimGraph->GetNumAnimGraphInstances(); + const size_t numInstances = m_animGraph->GetNumAnimGraphInstances(); for (size_t i = 0; i < numInstances; ++i) { - AnimGraphInstance* animGraphInstance = mAnimGraph->GetAnimGraphInstance(i); + AnimGraphInstance* animGraphInstance = m_animGraph->GetAnimGraphInstance(i); UniqueData* uniqueData = static_cast(animGraphInstance->FindOrCreateUniqueNodeData(this)); if (!uniqueData) { diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeSmoothingNode.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeSmoothingNode.cpp index b835cbc12b..77703ea467 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeSmoothingNode.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeSmoothingNode.cpp @@ -27,12 +27,12 @@ namespace EMotionFX void BlendTreeSmoothingNode::UniqueData::Update() { - BlendTreeSmoothingNode* smoothingNode = azdynamic_cast(mObject); + BlendTreeSmoothingNode* smoothingNode = azdynamic_cast(m_object); AZ_Assert(smoothingNode, "Unique data linked to incorrect node type."); if (!smoothingNode->GetInputNode(BlendTreeSmoothingNode::INPUTPORT_DEST)) { - mCurrentValue = 0.0f; + m_currentValue = 0.0f; } } @@ -91,7 +91,7 @@ namespace EMotionFX UniqueData* uniqueData = static_cast(FindOrCreateUniqueNodeData(animGraphInstance)); // if there are no incoming connections, there is nothing to do - if (mConnections.size() == 0) + if (m_connections.size() == 0) { GetOutputFloat(animGraphInstance, OUTPUTPORT_RESULT)->SetValue(0.0f); return; @@ -100,29 +100,29 @@ namespace EMotionFX // if we are disabled, output the dest value directly //OutputIncomingNode( animGraphInstance, GetInputNode(INPUTPORT_DEST) ); const float destValue = GetInputNumberAsFloat(animGraphInstance, INPUTPORT_DEST); - if (mDisabled) + if (m_disabled) { GetOutputFloat(animGraphInstance, OUTPUTPORT_RESULT)->SetValue(destValue); return; } // perform interpolation - const float sourceValue = uniqueData->mCurrentValue; - const float interpolationSpeed = m_interpolationSpeed * uniqueData->mFrameDeltaTime * 10.0f; + const float sourceValue = uniqueData->m_currentValue; + const float interpolationSpeed = m_interpolationSpeed * uniqueData->m_frameDeltaTime * 10.0f; const float interpolationResult = (interpolationSpeed < 0.99999f) ? MCore::LinearInterpolate(sourceValue, destValue, interpolationSpeed) : destValue; // If the interpolation result is close to the dest value within the tolerance, snap to the destination value. if (AZ::IsClose((interpolationResult - destValue), 0.0f, m_snapTolerance)) { - uniqueData->mCurrentValue = destValue; + uniqueData->m_currentValue = destValue; } else { // pass the interpolated result to the output port and the current value of the unique data - uniqueData->mCurrentValue = interpolationResult; + uniqueData->m_currentValue = interpolationResult; } GetOutputFloat(animGraphInstance, OUTPUTPORT_RESULT)->SetValue(interpolationResult); - uniqueData->mFrameDeltaTime = timePassedInSeconds; + uniqueData->m_frameDeltaTime = timePassedInSeconds; } @@ -135,13 +135,13 @@ namespace EMotionFX // check if the current value needs to be reset to the input or the start value when rewinding the node if (m_useStartValue) { - uniqueData->mCurrentValue = m_startValue; + uniqueData->m_currentValue = m_startValue; } else { // set the current value to the current input value UpdateAllIncomingNodes(animGraphInstance, 0.0f); - uniqueData->mCurrentValue = GetInputNumberAsFloat(animGraphInstance, INPUTPORT_DEST); + uniqueData->m_currentValue = GetInputNumberAsFloat(animGraphInstance, INPUTPORT_DEST); } } diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeSmoothingNode.h b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeSmoothingNode.h index ef16fd397f..e0c65f9fe0 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeSmoothingNode.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeSmoothingNode.h @@ -48,8 +48,8 @@ namespace EMotionFX void Update() override; public: - float mFrameDeltaTime = 0.0f; - float mCurrentValue = 0.0f; + float m_frameDeltaTime = 0.0f; + float m_currentValue = 0.0f; }; BlendTreeSmoothingNode(); diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeTransformNode.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeTransformNode.cpp index 07f3256a35..4b6a42b785 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeTransformNode.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeTransformNode.cpp @@ -33,15 +33,15 @@ namespace EMotionFX void BlendTreeTransformNode::UniqueData::Update() { - BlendTreeTransformNode* transformNode = azdynamic_cast(mObject); + BlendTreeTransformNode* transformNode = azdynamic_cast(m_object); AZ_Assert(transformNode, "Unique data linked to incorrect node type."); - const ActorInstance* actorInstance = mAnimGraphInstance->GetActorInstance(); + const ActorInstance* actorInstance = m_animGraphInstance->GetActorInstance(); const Actor* actor = actorInstance->GetActor(); const AZStd::string& targetJointName = transformNode->GetTargetJointName(); - mNodeIndex = InvalidIndex; + m_nodeIndex = InvalidIndex; SetHasError(true); if (!targetJointName.empty()) @@ -49,7 +49,7 @@ namespace EMotionFX const Node* joint = actor->GetSkeleton()->FindNodeByName(targetJointName); if (joint) { - mNodeIndex = joint->GetNodeIndex(); + m_nodeIndex = joint->GetNodeIndex(); SetHasError(false); } } @@ -132,7 +132,7 @@ namespace EMotionFX } // make sure we have at least an input pose, otherwise output the bind pose - if (GetInputPort(INPUTPORT_POSE).mConnection == nullptr) + if (GetInputPort(INPUTPORT_POSE).m_connection == nullptr) { RequestPoses(animGraphInstance); outputPose = GetOutputPose(animGraphInstance, OUTPUTPORT_RESULT)->GetValue(); @@ -148,48 +148,48 @@ namespace EMotionFX } // get the local transform from our node - Transform inputTransform = outputPose->GetPose().GetLocalSpaceTransform(uniqueData->mNodeIndex); + Transform inputTransform = outputPose->GetPose().GetLocalSpaceTransform(uniqueData->m_nodeIndex); Transform outputTransform = inputTransform; // process the rotation - if (GetInputPort(INPUTPORT_ROTATE_AMOUNT).mConnection) + if (GetInputPort(INPUTPORT_ROTATE_AMOUNT).m_connection) { OutputIncomingNode(animGraphInstance, GetInputNode(INPUTPORT_ROTATE_AMOUNT)); const float rotateFactor = MCore::Clamp(GetInputNumberAsFloat(animGraphInstance, INPUTPORT_ROTATE_AMOUNT), 0.0f, 1.0f); const AZ::Vector3 newAngles = MCore::LinearInterpolate(m_minRotation, m_maxRotation, rotateFactor); - outputTransform.mRotation = inputTransform.mRotation * MCore::AzEulerAnglesToAzQuat(MCore::Math::DegreesToRadians(newAngles.GetX()), + outputTransform.m_rotation = inputTransform.m_rotation * MCore::AzEulerAnglesToAzQuat(MCore::Math::DegreesToRadians(newAngles.GetX()), MCore::Math::DegreesToRadians(newAngles.GetY()), MCore::Math::DegreesToRadians(newAngles.GetZ())); } // process the translation - if (GetInputPort(INPUTPORT_TRANSLATE_AMOUNT).mConnection) + if (GetInputPort(INPUTPORT_TRANSLATE_AMOUNT).m_connection) { OutputIncomingNode(animGraphInstance, GetInputNode(INPUTPORT_TRANSLATE_AMOUNT)); const float factor = MCore::Clamp(GetInputNumberAsFloat(animGraphInstance, INPUTPORT_TRANSLATE_AMOUNT), 0.0f, 1.0f); const AZ::Vector3 newValue = MCore::LinearInterpolate(m_minTranslation, m_maxTranslation, factor); - outputTransform.mPosition = inputTransform.mPosition + newValue; + outputTransform.m_position = inputTransform.m_position + newValue; } // process the scale EMFX_SCALECODE ( - if (GetInputPort(INPUTPORT_SCALE_AMOUNT).mConnection) + if (GetInputPort(INPUTPORT_SCALE_AMOUNT).m_connection) { OutputIncomingNode(animGraphInstance, GetInputNode(INPUTPORT_SCALE_AMOUNT)); const float factor = MCore::Clamp(GetInputNumberAsFloat(animGraphInstance, INPUTPORT_SCALE_AMOUNT), 0.0f, 1.0f); const AZ::Vector3 newValue = MCore::LinearInterpolate(m_minScale, m_maxScale, factor); - outputTransform.mScale = inputTransform.mScale + newValue; + outputTransform.m_scale = inputTransform.m_scale + newValue; } ) // update the transformation of the node - outputPose->GetPose().SetLocalSpaceTransform(uniqueData->mNodeIndex, outputTransform); + outputPose->GetPose().SetLocalSpaceTransform(uniqueData->m_nodeIndex, outputTransform); // visualize it if (GetEMotionFX().GetIsInEditorMode() && GetCanVisualize(animGraphInstance)) { - animGraphInstance->GetActorInstance()->DrawSkeleton(outputPose->GetPose(), mVisualizeColor); + animGraphInstance->GetActorInstance()->DrawSkeleton(outputPose->GetPose(), m_visualizeColor); } } diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeTransformNode.h b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeTransformNode.h index 1d337fa6a1..b632041f77 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeTransformNode.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeTransformNode.h @@ -70,7 +70,7 @@ namespace EMotionFX void Update() override; public: - size_t mNodeIndex = InvalidIndex; + size_t m_nodeIndex = InvalidIndex; }; BlendTreeTransformNode(); diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeTwoLinkIKNode.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeTwoLinkIKNode.cpp index 1054cef095..9a91a59390 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeTwoLinkIKNode.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeTwoLinkIKNode.cpp @@ -31,20 +31,20 @@ namespace EMotionFX void BlendTreeTwoLinkIKNode::UniqueData::Update() { - BlendTreeTwoLinkIKNode* twoLinkIKNode = azdynamic_cast(mObject); + BlendTreeTwoLinkIKNode* twoLinkIKNode = azdynamic_cast(m_object); AZ_Assert(twoLinkIKNode, "Unique data linked to incorrect node type."); - const ActorInstance* actorInstance = mAnimGraphInstance->GetActorInstance(); + const ActorInstance* actorInstance = m_animGraphInstance->GetActorInstance(); const Actor* actor = actorInstance->GetActor(); const Skeleton* skeleton = actor->GetSkeleton(); // don't update the next time again - mNodeIndexA = InvalidIndex; - mNodeIndexB = InvalidIndex; - mNodeIndexC = InvalidIndex; - mAlignNodeIndex = InvalidIndex; - mBendDirNodeIndex = InvalidIndex; - mEndEffectorNodeIndex = InvalidIndex; + m_nodeIndexA = InvalidIndex; + m_nodeIndexB = InvalidIndex; + m_nodeIndexC = InvalidIndex; + m_alignNodeIndex = InvalidIndex; + m_bendDirNodeIndex = InvalidIndex; + m_endEffectorNodeIndex = InvalidIndex; SetHasError(true); // Find the end joint. @@ -58,18 +58,18 @@ namespace EMotionFX { return; } - mNodeIndexC = jointC->GetNodeIndex(); + m_nodeIndexC = jointC->GetNodeIndex(); // Get the second joint. - mNodeIndexB = jointC->GetParentIndex(); - if (mNodeIndexB == InvalidIndex) + m_nodeIndexB = jointC->GetParentIndex(); + if (m_nodeIndexB == InvalidIndex) { return; } // Get the third joint. - mNodeIndexA = skeleton->GetNode(mNodeIndexB)->GetParentIndex(); - if (mNodeIndexA == InvalidIndex) + m_nodeIndexA = skeleton->GetNode(m_nodeIndexB)->GetParentIndex(); + if (m_nodeIndexA == InvalidIndex) { return; } @@ -79,7 +79,7 @@ namespace EMotionFX const Node* endEffectorJoint = skeleton->FindNodeByName(endEffectorJointName); if (endEffectorJoint) { - mEndEffectorNodeIndex = endEffectorJoint->GetNodeIndex(); + m_endEffectorNodeIndex = endEffectorJoint->GetNodeIndex(); } // Find the bend direction joint. @@ -87,12 +87,12 @@ namespace EMotionFX const Node* bendDirJoint = skeleton->FindNodeByName(bendDirJointName); if (bendDirJoint) { - mBendDirNodeIndex = bendDirJoint->GetNodeIndex(); + m_bendDirNodeIndex = bendDirJoint->GetNodeIndex(); } // lookup the actor instance to get the alignment node from const NodeAlignmentData& alignToJointData = twoLinkIKNode->GetAlignToJointData(); - const ActorInstance* alignInstance = mAnimGraphInstance->FindActorInstanceFromParentDepth(alignToJointData.second); + const ActorInstance* alignInstance = m_animGraphInstance->FindActorInstanceFromParentDepth(alignToJointData.second); if (alignInstance) { if (!alignToJointData.first.empty()) @@ -100,7 +100,7 @@ namespace EMotionFX const Node* alignJoint = alignInstance->GetActor()->GetSkeleton()->FindNodeByName(alignToJointData.first.c_str()); if (alignJoint) { - mAlignNodeIndex = alignJoint->GetNodeIndex(); + m_alignNodeIndex = alignJoint->GetNodeIndex(); } } } @@ -210,7 +210,7 @@ namespace EMotionFX AnimGraphPose* outputPose; // make sure we have at least an input pose, otherwise output the bind pose - if (GetInputPort(INPUTPORT_POSE).mConnection == nullptr) + if (GetInputPort(INPUTPORT_POSE).m_connection == nullptr) { RequestPoses(animGraphInstance); outputPose = GetOutputPose(animGraphInstance, OUTPUTPORT_POSE)->GetValue(); @@ -221,7 +221,7 @@ namespace EMotionFX // get the weight float weight = 1.0f; - if (GetInputPort(INPUTPORT_WEIGHT).mConnection) + if (GetInputPort(INPUTPORT_WEIGHT).m_connection) { OutputIncomingNode(animGraphInstance, GetInputNode(INPUTPORT_WEIGHT)); weight = GetInputNumberAsFloat(animGraphInstance, INPUTPORT_WEIGHT); @@ -229,7 +229,7 @@ namespace EMotionFX } // if the IK weight is near zero, we can skip all calculations and act like a pass-trough node - if (weight < MCore::Math::epsilon || mDisabled) + if (weight < MCore::Math::epsilon || m_disabled) { OutputIncomingNode(animGraphInstance, GetInputNode(INPUTPORT_POSE)); const AnimGraphPose* inputPose = GetInputPose(animGraphInstance, INPUTPORT_POSE)->GetValue(); @@ -260,12 +260,12 @@ namespace EMotionFX } // get the node indices - const size_t nodeIndexA = uniqueData->mNodeIndexA; - const size_t nodeIndexB = uniqueData->mNodeIndexB; - const size_t nodeIndexC = uniqueData->mNodeIndexC; - const size_t bendDirIndex = uniqueData->mBendDirNodeIndex; - size_t alignNodeIndex = uniqueData->mAlignNodeIndex; - size_t endEffectorNodeIndex = uniqueData->mEndEffectorNodeIndex; + const size_t nodeIndexA = uniqueData->m_nodeIndexA; + const size_t nodeIndexB = uniqueData->m_nodeIndexB; + const size_t nodeIndexC = uniqueData->m_nodeIndexC; + const size_t bendDirIndex = uniqueData->m_bendDirNodeIndex; + size_t alignNodeIndex = uniqueData->m_alignNodeIndex; + size_t endEffectorNodeIndex = uniqueData->m_endEffectorNodeIndex; // use the end node as end effector node if no goal node has been specified if (endEffectorNodeIndex == InvalidIndex) @@ -303,13 +303,13 @@ namespace EMotionFX { alignNodeTransform = alignInstance->GetTransformData()->GetCurrentPose()->GetWorldSpaceTransform(alignNodeIndex); } - const AZ::Vector3& offset = alignNodeTransform.mPosition; + const AZ::Vector3& offset = alignNodeTransform.m_position; goal += offset; if (GetEMotionFX().GetIsInEditorMode()) { // check if the offset goal pos values comes from a param node - const BlendTreeConnection* posConnection = GetInputPort(INPUTPORT_GOALPOS).mConnection; + const BlendTreeConnection* posConnection = GetInputPort(INPUTPORT_GOALPOS).m_connection; if (posConnection) { if (azrtti_typeid(posConnection->GetSourceNode()) == azrtti_typeid()) @@ -327,7 +327,7 @@ namespace EMotionFX } else if (GetEMotionFX().GetIsInEditorMode()) { - const BlendTreeConnection* posConnection = GetInputPort(INPUTPORT_GOALPOS).mConnection; + const BlendTreeConnection* posConnection = GetInputPort(INPUTPORT_GOALPOS).m_connection; if (posConnection) { if (azrtti_typeid(posConnection->GetSourceNode()) == azrtti_typeid()) @@ -352,11 +352,11 @@ namespace EMotionFX { if (bendDirIndex != InvalidIndex) { - bendDir = outTransformPose.GetWorldSpaceTransform(bendDirIndex).mPosition - globalTransformA.mPosition; + bendDir = outTransformPose.GetWorldSpaceTransform(bendDirIndex).m_position - globalTransformA.m_position; } else { - bendDir = globalTransformB.mPosition - globalTransformA.mPosition; + bendDir = globalTransformB.m_position - globalTransformA.m_position; } } else @@ -371,7 +371,7 @@ namespace EMotionFX // if we want a relative bend dir, rotate it with the actor (only do this if we don't extract the bend dir) if (m_relativeBendDir && !m_extractBendDir) { - bendDir = actorInstance->GetWorldSpaceTransform().mRotation.TransformVector(bendDir); + bendDir = actorInstance->GetWorldSpaceTransform().m_rotation.TransformVector(bendDir); bendDir = MCore::SafeNormalize(bendDir); } else @@ -393,7 +393,7 @@ namespace EMotionFX { newRotation = inputGoalRot->GetValue(); // use our new rotation directly } - globalTransformC.mRotation = newRotation; + globalTransformC.m_rotation = newRotation; outTransformPose.SetWorldSpaceTransform(nodeIndexC, globalTransformC); } else // align to another node @@ -401,11 +401,11 @@ namespace EMotionFX if (inputGoalRot) { OutputIncomingNode(animGraphInstance, GetInputNode(INPUTPORT_GOALROT)); - globalTransformC.mRotation = GetInputQuaternion(animGraphInstance, INPUTPORT_GOALROT)->GetValue() * alignNodeTransform.mRotation; + globalTransformC.m_rotation = GetInputQuaternion(animGraphInstance, INPUTPORT_GOALROT)->GetValue() * alignNodeTransform.m_rotation; } else { - globalTransformC.mRotation = alignNodeTransform.mRotation; + globalTransformC.m_rotation = alignNodeTransform.m_rotation; } outTransformPose.SetWorldSpaceTransform(nodeIndexC, globalTransformC); @@ -413,15 +413,15 @@ namespace EMotionFX } // adjust the goal and get the end effector position - AZ::Vector3 endEffectorNodePos = outTransformPose.GetWorldSpaceTransform(endEffectorNodeIndex).mPosition; - const AZ::Vector3 posCToEndEffector = endEffectorNodePos - globalTransformC.mPosition; + AZ::Vector3 endEffectorNodePos = outTransformPose.GetWorldSpaceTransform(endEffectorNodeIndex).m_position; + const AZ::Vector3 posCToEndEffector = endEffectorNodePos - globalTransformC.m_position; if (m_rotationEnabled) { goal -= posCToEndEffector; } // store the desired rotation - AZ::Quaternion newNodeRotationC = globalTransformC.mRotation; + AZ::Quaternion newNodeRotationC = globalTransformC.m_rotation; // draw debug lines if (GetEMotionFX().GetIsInEditorMode() && GetCanVisualize(animGraphInstance)) @@ -441,15 +441,15 @@ namespace EMotionFX DebugDraw& debugDraw = GetDebugDraw(); DebugDraw::ActorInstanceData* drawData = debugDraw.GetActorInstanceData(animGraphInstance->GetActorInstance()); drawData->Lock(); - drawData->DrawLine(realGoal - AZ::Vector3(s, 0, 0), realGoal + AZ::Vector3(s, 0, 0), mVisualizeColor); - drawData->DrawLine(realGoal - AZ::Vector3(0, s, 0), realGoal + AZ::Vector3(0, s, 0), mVisualizeColor); - drawData->DrawLine(realGoal - AZ::Vector3(0, 0, s), realGoal + AZ::Vector3(0, 0, s), mVisualizeColor); + drawData->DrawLine(realGoal - AZ::Vector3(s, 0, 0), realGoal + AZ::Vector3(s, 0, 0), m_visualizeColor); + drawData->DrawLine(realGoal - AZ::Vector3(0, s, 0), realGoal + AZ::Vector3(0, s, 0), m_visualizeColor); + drawData->DrawLine(realGoal - AZ::Vector3(0, 0, s), realGoal + AZ::Vector3(0, 0, s), m_visualizeColor); const AZ::Color color(0.0f, 1.0f, 1.0f, 1.0f); - drawData->DrawLine(globalTransformA.mPosition, globalTransformA.mPosition + bendDir * s * 2.5f, color); - drawData->DrawLine(globalTransformA.mPosition - AZ::Vector3(s, 0, 0), globalTransformA.mPosition + AZ::Vector3(s, 0, 0), color); - drawData->DrawLine(globalTransformA.mPosition - AZ::Vector3(0, s, 0), globalTransformA.mPosition + AZ::Vector3(0, s, 0), color); - drawData->DrawLine(globalTransformA.mPosition - AZ::Vector3(0, 0, s), globalTransformA.mPosition + AZ::Vector3(0, 0, s), color); + drawData->DrawLine(globalTransformA.m_position, globalTransformA.m_position + bendDir * s * 2.5f, color); + drawData->DrawLine(globalTransformA.m_position - AZ::Vector3(s, 0, 0), globalTransformA.m_position + AZ::Vector3(s, 0, 0), color); + drawData->DrawLine(globalTransformA.m_position - AZ::Vector3(0, s, 0), globalTransformA.m_position + AZ::Vector3(0, s, 0), color); + drawData->DrawLine(globalTransformA.m_position - AZ::Vector3(0, 0, s), globalTransformA.m_position + AZ::Vector3(0, 0, s), color); drawData->Unlock(); } @@ -457,19 +457,19 @@ namespace EMotionFX AZ::Vector3 midPos; if (m_rotationEnabled) { - Solve2LinkIK(globalTransformA.mPosition, globalTransformB.mPosition, globalTransformC.mPosition, goal, bendDir, &midPos); + Solve2LinkIK(globalTransformA.m_position, globalTransformB.m_position, globalTransformC.m_position, goal, bendDir, &midPos); } else { - Solve2LinkIK(globalTransformA.mPosition, globalTransformB.mPosition, endEffectorNodePos, goal, bendDir, &midPos); + Solve2LinkIK(globalTransformA.m_position, globalTransformB.m_position, endEffectorNodePos, goal, bendDir, &midPos); } // -------------------------------------- // calculate the new node transforms // -------------------------------------- // calculate the differences between the current forward vector and the new one after IK - AZ::Vector3 oldForward = globalTransformB.mPosition - globalTransformA.mPosition; - AZ::Vector3 newForward = midPos - globalTransformA.mPosition; + AZ::Vector3 oldForward = globalTransformB.m_position - globalTransformA.m_position; + AZ::Vector3 newForward = midPos - globalTransformA.m_position; oldForward = MCore::SafeNormalize(oldForward); newForward = MCore::SafeNormalize(newForward); @@ -478,7 +478,7 @@ namespace EMotionFX float deltaAngle = MCore::Math::ACos(MCore::Clamp(dotProduct, -1.0f, 1.0f)); AZ::Vector3 axis = oldForward.Cross(newForward); AZ::Quaternion deltaRot = MCore::CreateFromAxisAndAngle(axis, deltaAngle); - globalTransformA.mRotation = deltaRot * globalTransformA.mRotation; + globalTransformA.m_rotation = deltaRot * globalTransformA.m_rotation; outTransformPose.SetWorldSpaceTransform(nodeIndexA, globalTransformA); // globalTransformA = outTransformPose.GetGlobalTransformIncludingActorInstanceTransform(nodeIndexA); @@ -486,21 +486,21 @@ namespace EMotionFX globalTransformC = outTransformPose.GetWorldSpaceTransform(nodeIndexC); // get the new current node positions - midPos = globalTransformB.mPosition; - endEffectorNodePos = outTransformPose.GetWorldSpaceTransform(endEffectorNodeIndex).mPosition; + midPos = globalTransformB.m_position; + endEffectorNodePos = outTransformPose.GetWorldSpaceTransform(endEffectorNodeIndex).m_position; // second node if (m_rotationEnabled) { - oldForward = globalTransformC.mPosition - globalTransformB.mPosition; + oldForward = globalTransformC.m_position - globalTransformB.m_position; } else { - oldForward = endEffectorNodePos - globalTransformB.mPosition; + oldForward = endEffectorNodePos - globalTransformB.m_position; } oldForward = MCore::SafeNormalize(oldForward); - newForward = goal - globalTransformB.mPosition; + newForward = goal - globalTransformB.m_position; newForward = MCore::SafeNormalize(newForward); // calculate the delta rotation @@ -516,15 +516,15 @@ namespace EMotionFX deltaRot = AZ::Quaternion::CreateIdentity(); } - globalTransformB.mRotation = deltaRot * globalTransformB.mRotation; - globalTransformB.mPosition = midPos; + globalTransformB.m_rotation = deltaRot * globalTransformB.m_rotation; + globalTransformB.m_position = midPos; outTransformPose.SetWorldSpaceTransform(nodeIndexB, globalTransformB); // update the rotation of node C if (m_rotationEnabled) { globalTransformC = outTransformPose.GetWorldSpaceTransform(nodeIndexC); - globalTransformC.mRotation = newNodeRotationC; + globalTransformC.m_rotation = newNodeRotationC; outTransformPose.SetWorldSpaceTransform(nodeIndexC, globalTransformC); } @@ -556,8 +556,8 @@ namespace EMotionFX DebugDraw& debugDraw = GetDebugDraw(); DebugDraw::ActorInstanceData* drawData = debugDraw.GetActorInstanceData(animGraphInstance->GetActorInstance()); drawData->Lock(); - drawData->DrawLine(outTransformPose.GetWorldSpaceTransform(nodeIndexA).mPosition, outTransformPose.GetWorldSpaceTransform(nodeIndexB).mPosition, mVisualizeColor); - drawData->DrawLine(outTransformPose.GetWorldSpaceTransform(nodeIndexB).mPosition, outTransformPose.GetWorldSpaceTransform(nodeIndexC).mPosition, mVisualizeColor); + drawData->DrawLine(outTransformPose.GetWorldSpaceTransform(nodeIndexA).m_position, outTransformPose.GetWorldSpaceTransform(nodeIndexB).m_position, m_visualizeColor); + drawData->DrawLine(outTransformPose.GetWorldSpaceTransform(nodeIndexB).m_position, outTransformPose.GetWorldSpaceTransform(nodeIndexC).m_position, m_visualizeColor); drawData->Unlock(); } } diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeTwoLinkIKNode.h b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeTwoLinkIKNode.h index 807eb4044e..e39cd7258e 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeTwoLinkIKNode.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeTwoLinkIKNode.h @@ -60,12 +60,12 @@ namespace EMotionFX void Update() override; public: - size_t mNodeIndexA = InvalidIndex; - size_t mNodeIndexB = InvalidIndex; - size_t mNodeIndexC = InvalidIndex; - size_t mEndEffectorNodeIndex = InvalidIndex; - size_t mAlignNodeIndex = InvalidIndex; - size_t mBendDirNodeIndex = InvalidIndex; + size_t m_nodeIndexA = InvalidIndex; + size_t m_nodeIndexB = InvalidIndex; + size_t m_nodeIndexC = InvalidIndex; + size_t m_endEffectorNodeIndex = InvalidIndex; + size_t m_alignNodeIndex = InvalidIndex; + size_t m_bendDirNodeIndex = InvalidIndex; }; BlendTreeTwoLinkIKNode(); diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeVector3Math1Node.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeVector3Math1Node.cpp index 94ab0ecac0..a70e6a3c61 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeVector3Math1Node.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeVector3Math1Node.cpp @@ -30,7 +30,7 @@ namespace EMotionFX SetupOutputPort("Vector3", OUTPUTPORT_RESULT_VECTOR3, MCore::AttributeVector3::TYPE_ID, PORTID_OUTPUT_VECTOR3); SetupOutputPort("Float", OUTPUTPORT_RESULT_FLOAT, MCore::AttributeFloat::TYPE_ID, PORTID_OUTPUT_FLOAT); - if (mAnimGraph) + if (m_animGraph) { Reinit(); } @@ -153,7 +153,7 @@ namespace EMotionFX void BlendTreeVector3Math1Node::SetMathFunction(EMathFunction func) { m_mathFunction = func; - if (mAnimGraph) + if (m_animGraph) { Reinit(); } diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeVector3Math2Node.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeVector3Math2Node.cpp index cf00b8bc2c..d305ad6dd7 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeVector3Math2Node.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeVector3Math2Node.cpp @@ -33,7 +33,7 @@ namespace EMotionFX SetupOutputPort("Vector3", OUTPUTPORT_RESULT_VECTOR3, MCore::AttributeVector3::TYPE_ID, PORTID_OUTPUT_VECTOR3); SetupOutputPort("Float", OUTPUTPORT_RESULT_FLOAT, MCore::AttributeFloat::TYPE_ID, PORTID_OUTPUT_FLOAT); - if (mAnimGraph) + if (m_animGraph) { Reinit(); } @@ -118,7 +118,7 @@ namespace EMotionFX UpdateAllIncomingNodes(animGraphInstance, timePassedInSeconds); // if there are no incoming connections, there is nothing to do - if (mConnections.empty()) + if (m_connections.empty()) { return; } @@ -147,7 +147,7 @@ namespace EMotionFX void BlendTreeVector3Math2Node::SetMathFunction(EMathFunction func) { m_mathFunction = func; - if (mAnimGraph) + if (m_animGraph) { Reinit(); } diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeVector4DecomposeNode.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeVector4DecomposeNode.cpp index 0694cad02d..7cea0bbce1 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeVector4DecomposeNode.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/BlendTreeVector4DecomposeNode.cpp @@ -72,7 +72,7 @@ namespace EMotionFX void BlendTreeVector4DecomposeNode::UpdateOutputPortValues(AnimGraphInstance* animGraphInstance) { // If there are no incoming connections, there is nothing to do. - if (mConnections.size() == 0) + if (m_connections.size() == 0) { return; } diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/CompressedKeyFrames.h b/Gems/EMotionFX/Code/EMotionFX/Source/CompressedKeyFrames.h index 1acd492587..6919f22188 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/CompressedKeyFrames.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/CompressedKeyFrames.h @@ -24,22 +24,22 @@ namespace EMotionFX //-------------------------------------------------------------------------------------- // compress a quaternion template<> - MCORE_INLINE void KeyFrame::SetValue(const AZ::Quaternion& value) { mValue.FromQuaternion(value); } + MCORE_INLINE void KeyFrame::SetValue(const AZ::Quaternion& value) { m_value.FromQuaternion(value); } // decompress into a quaternion template<> - MCORE_INLINE AZ::Quaternion KeyFrame::GetValue() const { return mValue.ToQuaternion(); } + MCORE_INLINE AZ::Quaternion KeyFrame::GetValue() const { return m_value.ToQuaternion(); } // decompress into a quaternion (without return value) template<> - MCORE_INLINE void KeyFrame::GetValue(AZ::Quaternion* outValue) { mValue.UnCompress(outValue); } + MCORE_INLINE void KeyFrame::GetValue(AZ::Quaternion* outValue) { m_value.UnCompress(outValue); } // direct access to compressed values template<> - MCORE_INLINE void KeyFrame::SetStorageTypeValue(const MCore::Compressed8BitQuaternion& value) { mValue = value; } + MCORE_INLINE void KeyFrame::SetStorageTypeValue(const MCore::Compressed8BitQuaternion& value) { m_value = value; } template<> - MCORE_INLINE const MCore::Compressed8BitQuaternion& KeyFrame::GetStorageTypeValue() const { return mValue; } + MCORE_INLINE const MCore::Compressed8BitQuaternion& KeyFrame::GetStorageTypeValue() const { return m_value; } //-------------------------------------------------------------------------------------- @@ -49,22 +49,22 @@ namespace EMotionFX //-------------------------------------------------------------------------------------- // compress a quaternion template<> - MCORE_INLINE void KeyFrame::SetValue(const AZ::Quaternion& value) { mValue.FromQuaternion(value); } + MCORE_INLINE void KeyFrame::SetValue(const AZ::Quaternion& value) { m_value.FromQuaternion(value); } // decompress into a quaternion template<> - MCORE_INLINE AZ::Quaternion KeyFrame::GetValue() const { return mValue.ToQuaternion(); } + MCORE_INLINE AZ::Quaternion KeyFrame::GetValue() const { return m_value.ToQuaternion(); } // decompress into a quaternion template<> - MCORE_INLINE void KeyFrame::GetValue(AZ::Quaternion* outValue) { return mValue.UnCompress(outValue); } + MCORE_INLINE void KeyFrame::GetValue(AZ::Quaternion* outValue) { return m_value.UnCompress(outValue); } // direct access to compressed values template<> - MCORE_INLINE void KeyFrame::SetStorageTypeValue(const MCore::Compressed16BitQuaternion& value) { mValue = value; } + MCORE_INLINE void KeyFrame::SetStorageTypeValue(const MCore::Compressed16BitQuaternion& value) { m_value = value; } template<> - MCORE_INLINE const MCore::Compressed16BitQuaternion& KeyFrame::GetStorageTypeValue() const { return mValue; } + MCORE_INLINE const MCore::Compressed16BitQuaternion& KeyFrame::GetStorageTypeValue() const { return m_value; } //-------------------------------------------------------------------------------------- @@ -74,22 +74,22 @@ namespace EMotionFX //-------------------------------------------------------------------------------------- // compress a float template<> - MCORE_INLINE void KeyFrame::SetValue(const float& value) { mValue.FromFloat(value, 0.0f, 1.0f); } + MCORE_INLINE void KeyFrame::SetValue(const float& value) { m_value.FromFloat(value, 0.0f, 1.0f); } // decompress into a float template<> - MCORE_INLINE float KeyFrame::GetValue() const { return mValue.ToFloat(0.0f, 1.0f); } + MCORE_INLINE float KeyFrame::GetValue() const { return m_value.ToFloat(0.0f, 1.0f); } // decompress into a float template<> - MCORE_INLINE void KeyFrame::GetValue(float* outValue) { mValue.UnCompress(outValue, 0.0f, 1.0f); } + MCORE_INLINE void KeyFrame::GetValue(float* outValue) { m_value.UnCompress(outValue, 0.0f, 1.0f); } // direct access to compressed values template<> - MCORE_INLINE void KeyFrame::SetStorageTypeValue(const MCore::Compressed8BitFloat& value) { mValue = value; } + MCORE_INLINE void KeyFrame::SetStorageTypeValue(const MCore::Compressed8BitFloat& value) { m_value = value; } template<> - MCORE_INLINE const MCore::Compressed8BitFloat& KeyFrame::GetStorageTypeValue() const { return mValue; } + MCORE_INLINE const MCore::Compressed8BitFloat& KeyFrame::GetStorageTypeValue() const { return m_value; } //-------------------------------------------------------------------------------------- @@ -99,21 +99,21 @@ namespace EMotionFX //-------------------------------------------------------------------------------------- // compress a float template<> - MCORE_INLINE void KeyFrame::SetValue(const float& value) { mValue.FromFloat(value, 0.0f, 1.0f); } + MCORE_INLINE void KeyFrame::SetValue(const float& value) { m_value.FromFloat(value, 0.0f, 1.0f); } // decompress into a float template<> - MCORE_INLINE float KeyFrame::GetValue() const { return mValue.ToFloat(0.0f, 1.0f); } + MCORE_INLINE float KeyFrame::GetValue() const { return m_value.ToFloat(0.0f, 1.0f); } // decompress into a float template<> - MCORE_INLINE void KeyFrame::GetValue(float* outValue) { return mValue.UnCompress(outValue, 0.0f, 1.0f); } + MCORE_INLINE void KeyFrame::GetValue(float* outValue) { return m_value.UnCompress(outValue, 0.0f, 1.0f); } // direct access to compressed values template<> - MCORE_INLINE void KeyFrame::SetStorageTypeValue(const MCore::Compressed16BitFloat& value) { mValue = value; } + MCORE_INLINE void KeyFrame::SetStorageTypeValue(const MCore::Compressed16BitFloat& value) { m_value = value; } template<> - MCORE_INLINE const MCore::Compressed16BitFloat& KeyFrame::GetStorageTypeValue() const { return mValue; } + MCORE_INLINE const MCore::Compressed16BitFloat& KeyFrame::GetStorageTypeValue() const { return m_value; } } // namespace EMotionFX diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/ConstraintTransform.h b/Gems/EMotionFX/Code/EMotionFX/Source/ConstraintTransform.h index 46547eec5d..5316ae3319 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/ConstraintTransform.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/ConstraintTransform.h @@ -27,15 +27,15 @@ namespace EMotionFX AZ_RTTI(ConstraintTransform, "{8C821457-C3C2-4DAD-B552-A7318B420A9C}", Constraint) AZ_CLASS_ALLOCATOR(ConstraintTransform, EMotionFX::Integration::EMotionFXAllocator, 0) - ConstraintTransform() : Constraint() { mTransform.Identity(); } + ConstraintTransform() : Constraint() { m_transform.Identity(); } ~ConstraintTransform() override { } - void SetTransform(const Transform& transform) { mTransform = transform; } - MCORE_INLINE const Transform& GetTransform() const { return mTransform; } - MCORE_INLINE Transform& GetTransform() { return mTransform; } + void SetTransform(const Transform& transform) { m_transform = transform; } + MCORE_INLINE const Transform& GetTransform() const { return m_transform; } + MCORE_INLINE Transform& GetTransform() { return m_transform; } protected: - Transform mTransform = Transform::CreateIdentity(); + Transform m_transform = Transform::CreateIdentity(); }; diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/ConstraintTransformRotationAngles.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/ConstraintTransformRotationAngles.cpp index bc571e7cd0..6b23e050ca 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/ConstraintTransformRotationAngles.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/ConstraintTransformRotationAngles.cpp @@ -24,11 +24,11 @@ namespace EMotionFX const float angleY = 0.382683f; // 45 degrees const float twistAngle = 0.0f; // 0 degrees - mMinRotationAngles.Set(-angleX, -angleY); - mMaxRotationAngles.Set(angleX, angleY); - mMinTwist = twistAngle; - mMaxTwist = twistAngle; - mTwistAxis = AXIS_Y; + m_minRotationAngles.Set(-angleX, -angleY); + m_maxRotationAngles.Set(angleX, angleY); + m_minTwist = twistAngle; + m_maxTwist = twistAngle; + m_twistAxis = AXIS_Y; } uint32 ConstraintTransformRotationAngles::GetType() const @@ -45,74 +45,74 @@ namespace EMotionFX { const float angleX = MCore::Math::Sin(MCore::Math::DegreesToRadians(minSwingDegrees.GetX()) * 0.5f); const float angleY = MCore::Math::Sin(MCore::Math::DegreesToRadians(minSwingDegrees.GetY()) * 0.5f); - mMinRotationAngles.Set(angleX, angleY); + m_minRotationAngles.Set(angleX, angleY); } void ConstraintTransformRotationAngles::SetMaxRotationAngles(const AZ::Vector2& maxSwingDegrees) { const float angleX = MCore::Math::Sin(MCore::Math::DegreesToRadians(maxSwingDegrees.GetX()) * 0.5f); const float angleY = MCore::Math::Sin(MCore::Math::DegreesToRadians(maxSwingDegrees.GetY()) * 0.5f); - mMaxRotationAngles.Set(angleX, angleY); + m_maxRotationAngles.Set(angleX, angleY); } void ConstraintTransformRotationAngles::SetMinTwistAngle(float minTwistDegrees) { - mMinTwist = MCore::Math::Sin(MCore::Math::DegreesToRadians(minTwistDegrees) * 0.5f); + m_minTwist = MCore::Math::Sin(MCore::Math::DegreesToRadians(minTwistDegrees) * 0.5f); } void ConstraintTransformRotationAngles::SetMaxTwistAngle(float maxTwistDegrees) { - mMaxTwist = MCore::Math::Sin(MCore::Math::DegreesToRadians(maxTwistDegrees) * 0.5f); + m_maxTwist = MCore::Math::Sin(MCore::Math::DegreesToRadians(maxTwistDegrees) * 0.5f); } void ConstraintTransformRotationAngles::SetTwistAxis(ConstraintTransformRotationAngles::EAxis axis) { - mTwistAxis = axis; + m_twistAxis = axis; } AZ::Vector2 ConstraintTransformRotationAngles::GetMinRotationAnglesDegrees() const { - return AZ::Vector2(MCore::Math::RadiansToDegrees(MCore::Math::ASin(mMinRotationAngles.GetX()) * 2.0f), - MCore::Math::RadiansToDegrees(MCore::Math::ASin(mMinRotationAngles.GetY()) * 2.0f)); + return AZ::Vector2(MCore::Math::RadiansToDegrees(MCore::Math::ASin(m_minRotationAngles.GetX()) * 2.0f), + MCore::Math::RadiansToDegrees(MCore::Math::ASin(m_minRotationAngles.GetY()) * 2.0f)); } AZ::Vector2 ConstraintTransformRotationAngles::GetMaxRotationAnglesDegrees() const { - return AZ::Vector2(MCore::Math::RadiansToDegrees(MCore::Math::ASin(mMaxRotationAngles.GetX()) * 2.0f), - MCore::Math::RadiansToDegrees(MCore::Math::ASin(mMaxRotationAngles.GetY()) * 2.0f)); + return AZ::Vector2(MCore::Math::RadiansToDegrees(MCore::Math::ASin(m_maxRotationAngles.GetX()) * 2.0f), + MCore::Math::RadiansToDegrees(MCore::Math::ASin(m_maxRotationAngles.GetY()) * 2.0f)); } AZ::Vector2 ConstraintTransformRotationAngles::GetMinRotationAnglesRadians() const { - return AZ::Vector2(MCore::Math::ASin(mMinRotationAngles.GetX()) * 2.0f, - MCore::Math::ASin(mMinRotationAngles.GetY()) * 2.0f); + return AZ::Vector2(MCore::Math::ASin(m_minRotationAngles.GetX()) * 2.0f, + MCore::Math::ASin(m_minRotationAngles.GetY()) * 2.0f); } AZ::Vector2 ConstraintTransformRotationAngles::GetMaxRotationAnglesRadians() const { - return AZ::Vector2(MCore::Math::ASin(mMaxRotationAngles.GetX()) * 2.0f, - MCore::Math::ASin(mMaxRotationAngles.GetY()) * 2.0f); + return AZ::Vector2(MCore::Math::ASin(m_maxRotationAngles.GetX()) * 2.0f, + MCore::Math::ASin(m_maxRotationAngles.GetY()) * 2.0f); } float ConstraintTransformRotationAngles::GetMinTwistAngle() const { - return MCore::Math::RadiansToDegrees(MCore::Math::ASin(mMinTwist) * 2.0f); + return MCore::Math::RadiansToDegrees(MCore::Math::ASin(m_minTwist) * 2.0f); } float ConstraintTransformRotationAngles::GetMaxTwistAngle() const { - return MCore::Math::RadiansToDegrees(MCore::Math::ASin(mMaxTwist) * 2.0f); + return MCore::Math::RadiansToDegrees(MCore::Math::ASin(m_maxTwist) * 2.0f); } ConstraintTransformRotationAngles::EAxis ConstraintTransformRotationAngles::GetTwistAxis() const { - return mTwistAxis; + return m_twistAxis; } // The main execution function, which performs the actual constraint. void ConstraintTransformRotationAngles::Execute() { - AZ::Quaternion q = mTransform.mRotation; + AZ::Quaternion q = m_transform.m_rotation; // Always keep w positive. if (q.GetW() < 0.0f) @@ -123,7 +123,7 @@ namespace EMotionFX // Get the axes indices for swing uint32 swingX; uint32 swingY; - switch (mTwistAxis) + switch (m_twistAxis) { // Twist is the X-axis. case AXIS_X: @@ -151,15 +151,15 @@ namespace EMotionFX // Calculate the twist quaternion, based on over which axis we assume there is twist. AZ::Quaternion twist; - const float twistAngle = q.GetElement(mTwistAxis); + const float twistAngle = q.GetElement(m_twistAxis); const float s = twistAngle * twistAngle + q.GetW() * q.GetW(); if (!MCore::Math::IsFloatZero(s)) { const float r = MCore::Math::InvSqrt(s); twist.SetElement(swingX, 0.0f); twist.SetElement(swingY, 0.0f); - twist.SetElement(mTwistAxis, MCore::Clamp(twistAngle * r, mMinTwist, mMaxTwist)); - twist.SetW(MCore::Math::Sqrt(MCore::Max(0.0f, 1.0f - twist.GetElement(mTwistAxis) * twist.GetElement(mTwistAxis)))); + twist.SetElement(m_twistAxis, MCore::Clamp(twistAngle * r, m_minTwist, m_maxTwist)); + twist.SetW(MCore::Math::Sqrt(MCore::Max(0.0f, 1.0f - twist.GetElement(m_twistAxis) * twist.GetElement(m_twistAxis)))); } else { @@ -168,13 +168,13 @@ namespace EMotionFX // Remove the twist from the input rotation so that we are left with a swing and then limit the swing. AZ::Quaternion swing = q * twist.GetConjugate(); - swing.SetElement(swingX, MCore::Clamp(static_cast(swing.GetElement(swingX)), mMinRotationAngles.GetX(), mMaxRotationAngles.GetX())); - swing.SetElement(swingY, MCore::Clamp(static_cast(swing.GetElement(swingY)), mMinRotationAngles.GetY(), mMaxRotationAngles.GetY())); - swing.SetElement(mTwistAxis, 0.0f); + swing.SetElement(swingX, MCore::Clamp(static_cast(swing.GetElement(swingX)), m_minRotationAngles.GetX(), m_maxRotationAngles.GetX())); + swing.SetElement(swingY, MCore::Clamp(static_cast(swing.GetElement(swingY)), m_minRotationAngles.GetY(), m_maxRotationAngles.GetY())); + swing.SetElement(m_twistAxis, 0.0f); swing.SetW(MCore::Math::Sqrt(MCore::Max(0.0f, 1.0f - swing.GetElement(swingX) * swing.GetElement(swingX) - swing.GetElement(swingY) * swing.GetElement(swingY)))); // Combine the limited swing and twist again into a final rotation. - mTransform.mRotation = swing * twist; + m_transform.m_rotation = swing * twist; } AZ::Vector3 ConstraintTransformRotationAngles::GetSphericalPos(float x, float y) const diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/ConstraintTransformRotationAngles.h b/Gems/EMotionFX/Code/EMotionFX/Source/ConstraintTransformRotationAngles.h index 3af63c382e..65e141e6e2 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/ConstraintTransformRotationAngles.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/ConstraintTransformRotationAngles.h @@ -74,11 +74,11 @@ namespace EMotionFX static void Reflect(AZ::ReflectContext* context); protected: - AZ::Vector2 mMinRotationAngles; ///< The minimum rotation angles, actually the precalculated sin(halfAngleRadians). - AZ::Vector2 mMaxRotationAngles; ///< The maximum rotation angles, actually the precalculated sin(halfAngleRadians). - float mMinTwist; ///< The minimum twist angle, actually the precalculated sin(halfAngleRadians). - float mMaxTwist; ///< The maximum twist angle, actually the precalculated sin(halfAngleRadians). - EAxis mTwistAxis; ///< The twist axis index, which has to be either 0, 1 or 2 (default=AXIS_X, which equals 0). + AZ::Vector2 m_minRotationAngles; ///< The minimum rotation angles, actually the precalculated sin(halfAngleRadians). + AZ::Vector2 m_maxRotationAngles; ///< The maximum rotation angles, actually the precalculated sin(halfAngleRadians). + float m_minTwist; ///< The minimum twist angle, actually the precalculated sin(halfAngleRadians). + float m_maxTwist; ///< The maximum twist angle, actually the precalculated sin(halfAngleRadians). + EAxis m_twistAxis; ///< The twist axis index, which has to be either 0, 1 or 2 (default=AXIS_X, which equals 0). void DrawSphericalLine(ActorInstance* actorInstance, const AZ::Vector2& start, const AZ::Vector2& end, uint32 numSteps, const AZ::Color& color, float radius, const AZ::Transform& offset) const; AZ::Vector3 GetSphericalPos(float x, float y) const; diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/DebugDraw.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/DebugDraw.cpp index 8f1346f543..0fd06000de 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/DebugDraw.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/DebugDraw.cpp @@ -117,8 +117,8 @@ namespace EMotionFX const size_t parentIndex = skeleton->GetNode(nodeIndex)->GetParentIndex(); if (parentIndex != InvalidIndex) { - const AZ::Vector3& startPos = pose.GetWorldSpaceTransform(nodeIndex).mPosition; - const AZ::Vector3& endPos = pose.GetWorldSpaceTransform(parentIndex).mPosition; + const AZ::Vector3& startPos = pose.GetWorldSpaceTransform(nodeIndex).m_position; + const AZ::Vector3& endPos = pose.GetWorldSpaceTransform(parentIndex).m_position; DrawLine(offset + startPos, offset + endPos, color); } } diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/DualQuatSkinDeformer.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/DualQuatSkinDeformer.cpp index c107ae88f7..2d5d8e2a46 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/DualQuatSkinDeformer.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/DualQuatSkinDeformer.cpp @@ -38,7 +38,7 @@ namespace EMotionFX const size_t numBones = m_bones.size(); for (size_t i = 0; i < numBones; ++i) { - if (m_bones[i].mNodeNr == nodeIndex) + if (m_bones[i].m_nodeNr == nodeIndex) { return AZ::Success(i); } @@ -79,14 +79,14 @@ namespace EMotionFX { const Actor* actor = actorInstance->GetActor(); const Pose* pose = actorInstance->GetTransformData()->GetCurrentPose(); - const uint32 numVertices = mMesh->GetNumVertices(); + const uint32 numVertices = m_mesh->GetNumVertices(); // pre-calculate the skinning matrices for (BoneInfo& boneInfo : m_bones) { - const size_t nodeIndex = boneInfo.mNodeNr; + const size_t nodeIndex = boneInfo.m_nodeNr; const Transform skinTransform = actor->GetInverseBindPoseTransform(nodeIndex) * pose->GetModelSpaceTransform(nodeIndex); - boneInfo.mDualQuat.FromRotationTranslation(skinTransform.mRotation, skinTransform.mPosition); + boneInfo.m_dualQuat.FromRotationTranslation(skinTransform.m_rotation, skinTransform.m_position); } AZ::JobCompletion jobCompletion; @@ -102,7 +102,7 @@ namespace EMotionFX AZ::JobContext* jobContext = nullptr; AZ::Job* job = AZ::CreateJobFunction([this, startVertex, endVertex]() { - SkinRange(mMesh, startVertex, endVertex, m_bones); + SkinRange(m_mesh, startVertex, endVertex, m_bones); }, /*isAutoDelete=*/true, jobContext); job->SetDependent(&jobCompletion); @@ -145,7 +145,7 @@ namespace EMotionFX if (numInfluences > 0) { // get the pivot quat, used for the dot product check - const MCore::DualQuaternion& pivotQuat = boneInfos[ layer->GetInfluence(orgVertex, 0)->GetBoneNr() ].mDualQuat; + const MCore::DualQuaternion& pivotQuat = boneInfos[ layer->GetInfluence(orgVertex, 0)->GetBoneNr() ].m_dualQuat; // our skinning dual quaternion MCore::DualQuaternion skinQuat(AZ::Quaternion(0, 0, 0, 0), AZ::Quaternion(0, 0, 0, 0)); @@ -156,8 +156,8 @@ namespace EMotionFX weight = influence->GetWeight(); // check if we need to invert the dual quat - MCore::DualQuaternion influenceQuat = boneInfos[ influence->GetBoneNr() ].mDualQuat; - if (influenceQuat.mReal.Dot(pivotQuat.mReal) < 0.0f) + MCore::DualQuaternion influenceQuat = boneInfos[ influence->GetBoneNr() ].m_dualQuat; + if (influenceQuat.m_real.Dot(pivotQuat.m_real) < 0.0f) { influenceQuat *= -1.0f; } @@ -202,7 +202,7 @@ namespace EMotionFX if (numInfluences > 0) { // get the pivot quat, used for the dot product check - const MCore::DualQuaternion& pivotQuat = boneInfos[ layer->GetInfluence(orgVertex, 0)->GetBoneNr() ].mDualQuat; + const MCore::DualQuaternion& pivotQuat = boneInfos[ layer->GetInfluence(orgVertex, 0)->GetBoneNr() ].m_dualQuat; // our skinning dual quaternion MCore::DualQuaternion skinQuat(AZ::Quaternion(0, 0, 0, 0), AZ::Quaternion(0, 0, 0, 0)); @@ -213,8 +213,8 @@ namespace EMotionFX weight = influence->GetWeight(); // check if we need to invert the dual quat - MCore::DualQuaternion influenceQuat = boneInfos[ influence->GetBoneNr() ].mDualQuat; - if (influenceQuat.mReal.Dot(pivotQuat.mReal) < 0.0f) + MCore::DualQuaternion influenceQuat = boneInfos[ influence->GetBoneNr() ].m_dualQuat; + if (influenceQuat.m_real.Dot(pivotQuat.m_real) < 0.0f) { influenceQuat *= -1.0f; } @@ -255,7 +255,7 @@ namespace EMotionFX if (numInfluences > 0) { // get the pivot quat, used for the dot product check - const MCore::DualQuaternion& pivotQuat = boneInfos[ layer->GetInfluence(orgVertex, 0)->GetBoneNr() ].mDualQuat; + const MCore::DualQuaternion& pivotQuat = boneInfos[ layer->GetInfluence(orgVertex, 0)->GetBoneNr() ].m_dualQuat; // our skinning dual quaternion MCore::DualQuaternion skinQuat(AZ::Quaternion(0, 0, 0, 0), AZ::Quaternion(0, 0, 0, 0)); @@ -266,8 +266,8 @@ namespace EMotionFX weight = influence->GetWeight(); // check if we need to invert the dual quat - MCore::DualQuaternion influenceQuat = boneInfos[ influence->GetBoneNr() ].mDualQuat; - if (influenceQuat.mReal.Dot(pivotQuat.mReal) < 0.0f) + MCore::DualQuaternion influenceQuat = boneInfos[ influence->GetBoneNr() ].m_dualQuat; + if (influenceQuat.m_real.Dot(pivotQuat.m_real) < 0.0f) { influenceQuat *= -1.0f; } @@ -304,16 +304,16 @@ namespace EMotionFX m_bones.clear(); // if there is no mesh - if (mMesh == nullptr) + if (m_mesh == nullptr) { return; } - SkinningInfoVertexAttributeLayer* skinningLayer = (SkinningInfoVertexAttributeLayer*)mMesh->FindSharedVertexAttributeLayer(SkinningInfoVertexAttributeLayer::TYPE_ID); + SkinningInfoVertexAttributeLayer* skinningLayer = (SkinningInfoVertexAttributeLayer*)m_mesh->FindSharedVertexAttributeLayer(SkinningInfoVertexAttributeLayer::TYPE_ID); MCORE_ASSERT(skinningLayer); // find out what bones this mesh uses - const uint32 numOrgVerts = mMesh->GetNumOrgVertices(); + const uint32 numOrgVerts = m_mesh->GetNumOrgVertices(); for (uint32 i = 0; i < numOrgVerts; i++) { // now we have located the skinning information for this vertex, we can see if our bones array @@ -333,8 +333,8 @@ namespace EMotionFX { // add the bone to the array of bones in this deformer BoneInfo lastBone; - lastBone.mNodeNr = influence->GetNodeNr(); - lastBone.mDualQuat.Identity(); + lastBone.m_nodeNr = influence->GetNodeNr(); + lastBone.m_dualQuat.Identity(); m_bones.emplace_back(lastBone); influence->SetBoneNr(static_cast(m_bones.size() - 1)); } diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/DualQuatSkinDeformer.h b/Gems/EMotionFX/Code/EMotionFX/Source/DualQuatSkinDeformer.h index 154885ea7d..434f2920ee 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/DualQuatSkinDeformer.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/DualQuatSkinDeformer.h @@ -104,7 +104,7 @@ namespace EMotionFX * @param index The local bone number, which must be in range of [0..GetNumLocalBones()-1]. * @result The node number, which is in range of [0..Actor::GetNumNodes()-1], depending on the actor where this deformer works on. */ - MCORE_INLINE size_t GetLocalBone(size_t index) const { return m_bones[index].mNodeNr; } + MCORE_INLINE size_t GetLocalBone(size_t index) const { return m_bones[index].m_nodeNr; } /** * Pre-allocate space for a given number of local bones. @@ -119,11 +119,11 @@ namespace EMotionFX */ struct EMFX_API BoneInfo { - size_t mNodeNr; /**< The node number. */ - MCore::DualQuaternion mDualQuat; /**< The dual quat of the pre-calculated matrix that contains the "globalMatrix * inverse(bindPoseMatrix)". */ + size_t m_nodeNr; /**< The node number. */ + MCore::DualQuaternion m_dualQuat; /**< The dual quat of the pre-calculated matrix that contains the "globalMatrix * inverse(bindPoseMatrix)". */ MCORE_INLINE BoneInfo() - : mNodeNr(InvalidIndex) {} + : m_nodeNr(InvalidIndex) {} }; AZStd::vector m_bones; /**< The array of bone information used for pre-calculation. */ @@ -153,7 +153,7 @@ namespace EMotionFX /** * Find the entry number that uses a specified node number. * @param nodeIndex The node number to search for. - * @result The index inside the mBones member array, which uses the given node. + * @result The index inside the m_bones member array, which uses the given node. */ AZ::Outcome FindLocalBoneIndex(size_t nodeIndex) const; }; diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/EMotionFXManager.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/EMotionFXManager.cpp index d58b4286b9..82b06c8171 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/EMotionFXManager.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/EMotionFXManager.cpp @@ -62,7 +62,7 @@ namespace EMotionFX } // set the unit type - gEMFX.Get()->SetUnitType(finalSettings.mUnitType); + gEMFX.Get()->SetUnitType(finalSettings.m_unitType); // create and set the objects gEMFX.Get()->SetImporter (Importer::Create()); @@ -111,20 +111,20 @@ namespace EMotionFX AZStd::string lowVersionString; BuildLowVersionString(lowVersionString); - mVersionString = AZStd::string::format("EMotion FX v%d.%s RC4", EMFX_HIGHVERSION, lowVersionString.c_str()); - mCompilationDate = MCORE_DATE; - mHighVersion = EMFX_HIGHVERSION; - mLowVersion = EMFX_LOWVERSION; - mImporter = nullptr; - mActorManager = nullptr; - mMotionManager = nullptr; - mEventManager = nullptr; - mSoftSkinManager = nullptr; - mRecorder = nullptr; - mMotionInstancePool = nullptr; - mDebugDraw = nullptr; - mUnitType = MCore::Distance::UNITTYPE_METERS; - mGlobalSimulationSpeed = 1.0f; + m_versionString = AZStd::string::format("EMotion FX v%d.%s RC4", EMFX_HIGHVERSION, lowVersionString.c_str()); + m_compilationDate = MCORE_DATE; + m_highVersion = EMFX_HIGHVERSION; + m_lowVersion = EMFX_LOWVERSION; + m_importer = nullptr; + m_actorManager = nullptr; + m_motionManager = nullptr; + m_eventManager = nullptr; + m_softSkinManager = nullptr; + m_recorder = nullptr; + m_motionInstancePool = nullptr; + m_debugDraw = nullptr; + m_unitType = MCore::Distance::UNITTYPE_METERS; + m_globalSimulationSpeed = 1.0f; m_isInEditorMode = false; m_isInServerMode = false; @@ -143,41 +143,40 @@ namespace EMotionFX { // the motion manager has to get destructed before the anim graph manager as the motion manager kills all motion instances // from the motion nodes when destructing the motions itself - //mRigManager->Destroy(); - mMotionManager->Destroy(); - mMotionManager = nullptr; + m_motionManager->Destroy(); + m_motionManager = nullptr; - mAnimGraphManager->Destroy(); - mAnimGraphManager = nullptr; + m_animGraphManager->Destroy(); + m_animGraphManager = nullptr; - mImporter->Destroy(); - mImporter = nullptr; + m_importer->Destroy(); + m_importer = nullptr; - mActorManager->Destroy(); - mActorManager = nullptr; + m_actorManager->Destroy(); + m_actorManager = nullptr; - mMotionInstancePool->Destroy(); - mMotionInstancePool = nullptr; + m_motionInstancePool->Destroy(); + m_motionInstancePool = nullptr; - mSoftSkinManager->Destroy(); - mSoftSkinManager = nullptr; + m_softSkinManager->Destroy(); + m_softSkinManager = nullptr; - mRecorder->Destroy(); - mRecorder = nullptr; + m_recorder->Destroy(); + m_recorder = nullptr; - delete mDebugDraw; - mDebugDraw = nullptr; + delete m_debugDraw; + m_debugDraw = nullptr; - mEventManager->Destroy(); - mEventManager = nullptr; + m_eventManager->Destroy(); + m_eventManager = nullptr; // delete the thread datas - for (uint32 i = 0; i < mThreadDatas.size(); ++i) + for (uint32 i = 0; i < m_threadDatas.size(); ++i) { - mThreadDatas[i]->Destroy(); + m_threadDatas[i]->Destroy(); } - mThreadDatas.clear(); + m_threadDatas.clear(); } @@ -193,16 +192,16 @@ namespace EMotionFX { AZ_PROFILE_SCOPE(AZ::Debug::ProfileCategory::Animation, "EMotionFXManager::Update"); - mDebugDraw->Clear(); - mRecorder->UpdatePlayMode(timePassedInSeconds); - mActorManager->UpdateActorInstances(timePassedInSeconds); - mEventManager->OnSimulatePhysics(timePassedInSeconds); - mRecorder->Update(timePassedInSeconds); + m_debugDraw->Clear(); + m_recorder->UpdatePlayMode(timePassedInSeconds); + m_actorManager->UpdateActorInstances(timePassedInSeconds); + m_eventManager->OnSimulatePhysics(timePassedInSeconds); + m_recorder->Update(timePassedInSeconds); // sample and apply all anim graphs we recorded - if (mRecorder->GetIsInPlayMode() && mRecorder->GetRecordSettings().mRecordAnimGraphStates) + if (m_recorder->GetIsInPlayMode() && m_recorder->GetRecordSettings().m_recordAnimGraphStates) { - mRecorder->SampleAndApplyAnimGraphs(mRecorder->GetCurrentPlayTime()); + m_recorder->SampleAndApplyAnimGraphs(m_recorder->GetCurrentPlayTime()); } } @@ -217,9 +216,9 @@ namespace EMotionFX MCore::LogInfo("-----------------------------------------------"); MCore::LogInfo("EMotion FX - Information"); MCore::LogInfo("-----------------------------------------------"); - MCore::LogInfo("Version: v%d.%s", mHighVersion, lowVersionString.c_str()); - MCore::LogInfo("Version string: %s", mVersionString.c_str()); - MCore::LogInfo("Compilation date: %s", mCompilationDate.c_str()); + MCore::LogInfo("Version: v%d.%s", m_highVersion, lowVersionString.c_str()); + MCore::LogInfo("Version string: %s", m_versionString.c_str()); + MCore::LogInfo("Compilation date: %s", m_compilationDate.c_str()); #ifdef MCORE_OPENMP_ENABLED MCore::LogInfo("OpenMP enabled: Yes"); @@ -234,88 +233,88 @@ namespace EMotionFX // get the version string const char* EMotionFXManager::GetVersionString() const { - return mVersionString.c_str(); + return m_versionString.c_str(); } // get the compilation date string const char* EMotionFXManager::GetCompilationDate() const { - return mCompilationDate.c_str(); + return m_compilationDate.c_str(); } // get the high version uint32 EMotionFXManager::GetHighVersion() const { - return mHighVersion; + return m_highVersion; } // get the low version uint32 EMotionFXManager::GetLowVersion() const { - return mLowVersion; + return m_lowVersion; } // set the importer void EMotionFXManager::SetImporter(Importer* importer) { - mImporter = importer; + m_importer = importer; } // set the actor manager void EMotionFXManager::SetActorManager(ActorManager* manager) { - mActorManager = manager; + m_actorManager = manager; } // set the motion manager void EMotionFXManager::SetMotionManager(MotionManager* manager) { - mMotionManager = manager; + m_motionManager = manager; } // set the event manager void EMotionFXManager::SetEventManager(EventManager* manager) { - mEventManager = manager; + m_eventManager = manager; } // set the softskin manager void EMotionFXManager::SetSoftSkinManager(SoftSkinManager* manager) { - mSoftSkinManager = manager; + m_softSkinManager = manager; } // set the anim graph manager void EMotionFXManager::SetAnimGraphManager(AnimGraphManager* manager) { - mAnimGraphManager = manager; + m_animGraphManager = manager; } // set the recorder void EMotionFXManager::SetRecorder(Recorder* recorder) { - mRecorder = recorder; + m_recorder = recorder; } void EMotionFXManager::SetDebugDraw(DebugDraw* draw) { - mDebugDraw = draw; + m_debugDraw = draw; } // set the motion instance pool void EMotionFXManager::SetMotionInstancePool(MotionInstancePool* pool) { - mMotionInstancePool = pool; + m_motionInstancePool = pool; pool->Init(); } @@ -323,19 +322,19 @@ namespace EMotionFX // set the path of the media root directory void EMotionFXManager::SetMediaRootFolder(const char* path) { - mMediaRootFolder = path; + m_mediaRootFolder = path; // Make sure the media root folder has an ending slash. - if (mMediaRootFolder.empty() == false) + if (m_mediaRootFolder.empty() == false) { - const char lastChar = AzFramework::StringFunc::LastCharacter(mMediaRootFolder.c_str()); + const char lastChar = AzFramework::StringFunc::LastCharacter(m_mediaRootFolder.c_str()); if (lastChar != AZ_CORRECT_FILESYSTEM_SEPARATOR && lastChar != AZ_WRONG_FILESYSTEM_SEPARATOR) { - AzFramework::StringFunc::Path::AppendSeparator(mMediaRootFolder); + AzFramework::StringFunc::Path::AppendSeparator(m_mediaRootFolder); } } - EBUS_EVENT(AzFramework::ApplicationRequests::Bus, NormalizePathKeepCase, mMediaRootFolder); + EBUS_EVENT(AzFramework::ApplicationRequests::Bus, NormalizePathKeepCase, m_mediaRootFolder); } @@ -345,20 +344,20 @@ namespace EMotionFX const char* assetSourcePath = AZ::IO::FileIOBase::GetInstance()->GetAlias("@devassets@"); if (assetSourcePath) { - mAssetSourceFolder = assetSourcePath; + m_assetSourceFolder = assetSourcePath; // Add an ending slash in case there is none yet. // TODO: Remove this and adopt EMotionFX code to work with folder paths without slash at the end like Open 3D Engine does. - if (mAssetSourceFolder.empty() == false) + if (m_assetSourceFolder.empty() == false) { - const char lastChar = AzFramework::StringFunc::LastCharacter(mAssetSourceFolder.c_str()); + const char lastChar = AzFramework::StringFunc::LastCharacter(m_assetSourceFolder.c_str()); if (lastChar != AZ_CORRECT_FILESYSTEM_SEPARATOR && lastChar != AZ_WRONG_FILESYSTEM_SEPARATOR) { - AzFramework::StringFunc::Path::AppendSeparator(mAssetSourceFolder); + AzFramework::StringFunc::Path::AppendSeparator(m_assetSourceFolder); } } - EBUS_EVENT(AzFramework::ApplicationRequests::Bus, NormalizePathKeepCase, mAssetSourceFolder); + EBUS_EVENT(AzFramework::ApplicationRequests::Bus, NormalizePathKeepCase, m_assetSourceFolder); } else { @@ -370,20 +369,20 @@ namespace EMotionFX const char* assetCachePath = AZ::IO::FileIOBase::GetInstance()->GetAlias("@assets@"); if (assetCachePath) { - mAssetCacheFolder = assetCachePath; + m_assetCacheFolder = assetCachePath; // Add an ending slash in case there is none yet. // TODO: Remove this and adopt EMotionFX code to work with folder paths without slash at the end like Open 3D Engine does. - if (mAssetCacheFolder.empty() == false) + if (m_assetCacheFolder.empty() == false) { - const char lastChar = AzFramework::StringFunc::LastCharacter(mAssetCacheFolder.c_str()); + const char lastChar = AzFramework::StringFunc::LastCharacter(m_assetCacheFolder.c_str()); if (lastChar != AZ_CORRECT_FILESYSTEM_SEPARATOR && lastChar != AZ_WRONG_FILESYSTEM_SEPARATOR) { - AzFramework::StringFunc::Path::AppendSeparator(mAssetCacheFolder); + AzFramework::StringFunc::Path::AppendSeparator(m_assetCacheFolder); } } - EBUS_EVENT(AzFramework::ApplicationRequests::Bus, NormalizePathKeepCase, mAssetCacheFolder); + EBUS_EVENT(AzFramework::ApplicationRequests::Bus, NormalizePathKeepCase, m_assetCacheFolder); } else { @@ -396,7 +395,7 @@ namespace EMotionFX { outAbsoluteFilename = relativeFilename; EBUS_EVENT(AzFramework::ApplicationRequests::Bus, NormalizePathKeepCase, outAbsoluteFilename); - AzFramework::StringFunc::Replace(outAbsoluteFilename, EMFX_MEDIAROOTFOLDER_STRING, mMediaRootFolder.c_str(), true); + AzFramework::StringFunc::Replace(outAbsoluteFilename, EMFX_MEDIAROOTFOLDER_STRING, m_mediaRootFolder.c_str(), true); } @@ -456,14 +455,14 @@ namespace EMotionFX // get the global speed factor float EMotionFXManager::GetGlobalSimulationSpeed() const { - return mGlobalSimulationSpeed; + return m_globalSimulationSpeed; } // set the global speed factor void EMotionFXManager::SetGlobalSimulationSpeed(float speedFactor) { - mGlobalSimulationSpeed = MCore::Max(0.0f, speedFactor); + m_globalSimulationSpeed = MCore::Max(0.0f, speedFactor); } @@ -476,23 +475,23 @@ namespace EMotionFX numThreads = 1; } - if (mThreadDatas.size() == numThreads) + if (m_threadDatas.size() == numThreads) { return; } // get rid of old data - for (uint32 i = 0; i < mThreadDatas.size(); ++i) + for (uint32 i = 0; i < m_threadDatas.size(); ++i) { - mThreadDatas[i]->Destroy(); + m_threadDatas[i]->Destroy(); } - mThreadDatas.clear(); // force calling constructors again to reset everything - mThreadDatas.resize(numThreads); + m_threadDatas.clear(); // force calling constructors again to reset everything + m_threadDatas.resize(numThreads); for (uint32 i = 0; i < numThreads; ++i) { - mThreadDatas[i] = ThreadData::Create(i); + m_threadDatas[i] = ThreadData::Create(i); } } @@ -501,21 +500,21 @@ namespace EMotionFX void EMotionFXManager::ShrinkPools() { Allocators::ShrinkPools(); - mMotionInstancePool->Shrink(); + m_motionInstancePool->Shrink(); } // get the unit type MCore::Distance::EUnitType EMotionFXManager::GetUnitType() const { - return mUnitType; + return m_unitType; } // set the unit type void EMotionFXManager::SetUnitType(MCore::Distance::EUnitType unitType) { - mUnitType = unitType; + m_unitType = unitType; } diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/EMotionFXManager.h b/Gems/EMotionFX/Code/EMotionFX/Source/EMotionFXManager.h index 45bf59c94c..d5c5247de6 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/EMotionFXManager.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/EMotionFXManager.h @@ -124,28 +124,28 @@ namespace EMotionFX * This can also be accessed with the GetImporter() macro. * @result A pointer to the importer. */ - MCORE_INLINE Importer* GetImporter() const { return mImporter; } + MCORE_INLINE Importer* GetImporter() const { return m_importer; } /** * Get the actor manager. * This can also be accessed with the GetActorManager() macro. * @result A pointer to the actor manager. */ - MCORE_INLINE ActorManager* GetActorManager() const { return mActorManager; } + MCORE_INLINE ActorManager* GetActorManager() const { return m_actorManager; } /** * Get the motion manager. * This can also be accessed with the GetMotionManager() macro. * @result A pointer to the motion manager. */ - MCORE_INLINE MotionManager* GetMotionManager() const { return mMotionManager; } + MCORE_INLINE MotionManager* GetMotionManager() const { return m_motionManager; } /** * Get the event manager. * This can also be accessed with the GetEventManager() macro. * @result A pointer to the event manager. */ - MCORE_INLINE EventManager* GetEventManager() const { return mEventManager; } + MCORE_INLINE EventManager* GetEventManager() const { return m_eventManager; } /** * Get the soft-skin manager. @@ -155,41 +155,34 @@ namespace EMotionFX * This can also be accessed with the GetSoftSkinManager() macro. * @result A pointer to the soft-skinning manager. */ - MCORE_INLINE SoftSkinManager* GetSoftSkinManager() const { return mSoftSkinManager; } + MCORE_INLINE SoftSkinManager* GetSoftSkinManager() const { return m_softSkinManager; } /** * Get the motion instance pool. * This can also be accessed with the GetMotionInstancePool() macro. * @result A pointer to the motion instance pool. */ - MCORE_INLINE MotionInstancePool* GetMotionInstancePool() const { return mMotionInstancePool; } + MCORE_INLINE MotionInstancePool* GetMotionInstancePool() const { return m_motionInstancePool; } /** * Get the animgraph manager; * This can also be accessed with the GetAnimGraphManager() macro. * @result A pointer to the animgraph manager. */ - MCORE_INLINE AnimGraphManager* GetAnimGraphManager() const { return mAnimGraphManager; } - - /** - * Get the rig manager; - * This can also be accessed with the GetRigManager() macro. - * @result A pointer to the animgraph manager. - */ - // MCORE_INLINE RigManager* GetRigManager() const { return mRigManager; } + MCORE_INLINE AnimGraphManager* GetAnimGraphManager() const { return m_animGraphManager; } /** * Get the recorder. * This can also be accessed with the EMFX_RECODRER macro. * @result A pointer to the recorder. */ - MCORE_INLINE Recorder* GetRecorder() const { return mRecorder; } + MCORE_INLINE Recorder* GetRecorder() const { return m_recorder; } /** * Get the debug drawing class. * @result A pointer to the wavelet cache. */ - MCORE_INLINE DebugDraw* GetDebugDraw() const { return mDebugDraw; } + MCORE_INLINE DebugDraw* GetDebugDraw() const { return m_debugDraw; } /** * Set the path of the media root directory. @@ -243,38 +236,38 @@ namespace EMotionFX * Get the path of the media root folder. * @result The path of the media root directory. */ - MCORE_INLINE const char* GetMediaRootFolder() const { return mMediaRootFolder.c_str(); } + MCORE_INLINE const char* GetMediaRootFolder() const { return m_mediaRootFolder.c_str(); } /** * Get the path of the media root folder as a string object. * @result The path of the media root directory. */ - MCORE_INLINE const AZStd::string& GetMediaRootFolderString() const { return mMediaRootFolder; } + MCORE_INLINE const AZStd::string& GetMediaRootFolderString() const { return m_mediaRootFolder; } /** * Get the asset source folder path. * @result The path of the asset source folder. */ - MCORE_INLINE const AZStd::string& GetAssetSourceFolder() const { return mAssetSourceFolder; } + MCORE_INLINE const AZStd::string& GetAssetSourceFolder() const { return m_assetSourceFolder; } /** * Get the asset cache folder path. * @result The path of the asset cache folder. */ - MCORE_INLINE const AZStd::string& GetAssetCacheFolder() const { return mAssetCacheFolder; } + MCORE_INLINE const AZStd::string& GetAssetCacheFolder() const { return m_assetCacheFolder; } /** * Get the unique per thread data for a given thread by index. * @param threadIndex The thread index, which must be between [0..GetNumThreads()-1]. * @return The unique thread data for this thread. */ - MCORE_INLINE ThreadData* GetThreadData(uint32 threadIndex) const { MCORE_ASSERT(threadIndex < mThreadDatas.size()); return mThreadDatas[threadIndex]; } + MCORE_INLINE ThreadData* GetThreadData(uint32 threadIndex) const { MCORE_ASSERT(threadIndex < m_threadDatas.size()); return m_threadDatas[threadIndex]; } /** * Get the number of threads that are internally created. * @return The number of threads that we have internally created. */ - MCORE_INLINE size_t GetNumThreads() const { return mThreadDatas.size(); } + MCORE_INLINE size_t GetNumThreads() const { return m_threadDatas.size(); } /** * Shrink the memory pools, to reduce memory usage. @@ -338,25 +331,25 @@ namespace EMotionFX bool GetEnableServerOptimization() const { return m_isInServerMode && m_enableServerOptimization; } private: - AZStd::string mVersionString; /**< The version string. */ - AZStd::string mCompilationDate; /**< The compilation date string. */ - AZStd::string mMediaRootFolder; /**< The path of the media root directory. */ - AZStd::string mAssetSourceFolder; /**< The absolute path of the asset source folder. */ - AZStd::string mAssetCacheFolder; /**< The absolute path of the asset cache folder. */ - uint32 mHighVersion; /**< The higher version, which would be 3 in case of v3.01. */ - uint32 mLowVersion; /**< The low version, which would be 100 in case of v3.10 or 10 in case of v3.01. */ - Importer* mImporter; /**< The importer that can load actors and motions. */ - ActorManager* mActorManager; /**< The actor manager. */ - MotionManager* mMotionManager; /**< The motion manager. */ - EventManager* mEventManager; /**< The motion event manager. */ - SoftSkinManager* mSoftSkinManager; /**< The softskin manager. */ - AnimGraphManager* mAnimGraphManager; /**< The animgraph manager. */ - Recorder* mRecorder; /**< The recorder. */ - MotionInstancePool* mMotionInstancePool; /**< The motion instance pool. */ - DebugDraw* mDebugDraw; /**< The debug drawing system. */ - AZStd::vector mThreadDatas; /**< The per thread data. */ - MCore::Distance::EUnitType mUnitType; /**< The unit type, on default it is MCore::Distance::UNITTYPE_METERS. */ - float mGlobalSimulationSpeed; /**< The global simulation speed, default is 1.0. */ + AZStd::string m_versionString; /**< The version string. */ + AZStd::string m_compilationDate; /**< The compilation date string. */ + AZStd::string m_mediaRootFolder; /**< The path of the media root directory. */ + AZStd::string m_assetSourceFolder; /**< The absolute path of the asset source folder. */ + AZStd::string m_assetCacheFolder; /**< The absolute path of the asset cache folder. */ + uint32 m_highVersion; /**< The higher version, which would be 3 in case of v3.01. */ + uint32 m_lowVersion; /**< The low version, which would be 100 in case of v3.10 or 10 in case of v3.01. */ + Importer* m_importer; /**< The importer that can load actors and motions. */ + ActorManager* m_actorManager; /**< The actor manager. */ + MotionManager* m_motionManager; /**< The motion manager. */ + EventManager* m_eventManager; /**< The motion event manager. */ + SoftSkinManager* m_softSkinManager; /**< The softskin manager. */ + AnimGraphManager* m_animGraphManager; /**< The animgraph manager. */ + Recorder* m_recorder; /**< The recorder. */ + MotionInstancePool* m_motionInstancePool; /**< The motion instance pool. */ + DebugDraw* m_debugDraw; /**< The debug drawing system. */ + AZStd::vector m_threadDatas; /**< The per thread data. */ + MCore::Distance::EUnitType m_unitType; /**< The unit type, on default it is MCore::Distance::UNITTYPE_METERS. */ + float m_globalSimulationSpeed; /**< The global simulation speed, default is 1.0. */ bool m_isInEditorMode; /**< True when the runtime requires to support an editor. Optimizations can be made if there is no need for editor support. */ bool m_isInServerMode; /**< True when emotionfx is running on server. */ bool m_enableServerOptimization; /**< True when optimization can be made when emotionfx is running in server mode. */ @@ -454,11 +447,11 @@ namespace EMotionFX */ struct EMFX_API InitSettings { - MCore::Distance::EUnitType mUnitType; /**< The unit type to use. This specifies the size of one unit. On default this is a meter. */ + MCore::Distance::EUnitType m_unitType; /**< The unit type to use. This specifies the size of one unit. On default this is a meter. */ InitSettings() { - mUnitType = MCore::Distance::UNITTYPE_METERS; + m_unitType = MCore::Distance::UNITTYPE_METERS; } }; diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/EventHandler.h b/Gems/EMotionFX/Code/EMotionFX/Source/EventHandler.h index c0b7696205..9c8b0ecbfb 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/EventHandler.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/EventHandler.h @@ -121,7 +121,7 @@ namespace EMotionFX { MCORE_UNUSED(eventInfo); // find the event index in the array - // const uint32 eventIndex = GetEventManager().FindEventTypeIndex( eventInfo.mEventTypeID ); + // const uint32 eventIndex = GetEventManager().FindEventTypeIndex( eventInfo.m_eventTypeID ); // get the name of the event // const char* eventName = (eventIndex != MCORE_INVALIDINDEX32) ? GetEventManager().GetEventTypeString( eventIndex ) : ""; @@ -273,7 +273,7 @@ namespace EMotionFX /** * This event gets triggered once the given motion instance gets added to the motion queue. - * This happens when you set the PlayBackInfo::mPlayNow member to false. In that case the MotionSystem::PlayMotion() method (OnPlayMotion) + * This happens when you set the PlayBackInfo::m_playNow member to false. In that case the MotionSystem::PlayMotion() method (OnPlayMotion) * will not directly start playing the motion (OnStartMotionInstance), but will add it to the motion queue instead. * The motion queue will then start playing the motion instance once it should. * @param motionInstance The motion instance that gets added to the motion queue. @@ -316,7 +316,7 @@ namespace EMotionFX /** * Perform a ray intersection test and return the intersection info. - * The first event handler registered that sets the IntersectionInfo::mIsValid to true will be outputting to the outIntersectInfo parameter. + * The first event handler registered that sets the IntersectionInfo::m_isValid to true will be outputting to the outIntersectInfo parameter. * @param start The start point, in world space. * @param end The end point, in world space. * @param outIntersectInfo The resulting intersection info. @@ -395,8 +395,8 @@ namespace EMotionFX */ virtual const AZStd::vector GetHandledEventTypes() const = 0; - void SetMotionInstance(MotionInstance* motionInstance) { mMotionInstance = motionInstance; } - MCORE_INLINE MotionInstance* GetMotionInstance() { return mMotionInstance; } + void SetMotionInstance(MotionInstance* motionInstance) { m_motionInstance = motionInstance; } + MCORE_INLINE MotionInstance* GetMotionInstance() { return m_motionInstance; } /** * The method that processes an event. @@ -495,7 +495,7 @@ namespace EMotionFX /** * This event gets triggered once the given motion instance gets added to the motion queue. - * This happens when you set the PlayBackInfo::mPlayNow member to false. In that case the MotionSystem::PlayMotion() method (OnPlayMotion) + * This happens when you set the PlayBackInfo::m_playNow member to false. In that case the MotionSystem::PlayMotion() method (OnPlayMotion) * will not directly start playing the motion (OnStartMotionInstance), but will add it to the motion queue instead. * The motion queue will then start playing the motion instance once it should. * @param info The playback information used to play this motion instance. @@ -503,6 +503,6 @@ namespace EMotionFX virtual void OnQueueMotionInstance(PlayBackInfo* info) { MCORE_UNUSED(info); } protected: - MotionInstance* mMotionInstance = nullptr; + MotionInstance* m_motionInstance = nullptr; }; } // namespace EMotionFX diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/EventInfo.h b/Gems/EMotionFX/Code/EMotionFX/Source/EventInfo.h index 1633d4fae7..6b97974fd3 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/EventInfo.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/EventInfo.h @@ -37,13 +37,13 @@ namespace EMotionFX END }; - float mTimeValue; /**< The time value of the event, in seconds. */ - ActorInstance* mActorInstance; /**< The actor instance that triggered this event. */ - const MotionInstance* mMotionInstance; /**< The motion instance which triggered this event, can be nullptr. */ - AnimGraphNode* mEmitter; /**< The animgraph node which originally did emit this event. This parameter can be nullptr. */ - const MotionEvent* mEvent; /**< The event itself. */ - float mGlobalWeight; /**< The global weight of the event. */ - float mLocalWeight; /**< The local weight of the event. */ + float m_timeValue; /**< The time value of the event, in seconds. */ + ActorInstance* m_actorInstance; /**< The actor instance that triggered this event. */ + const MotionInstance* m_motionInstance; /**< The motion instance which triggered this event, can be nullptr. */ + AnimGraphNode* m_emitter; /**< The animgraph node which originally did emit this event. This parameter can be nullptr. */ + const MotionEvent* m_event; /**< The event itself. */ + float m_globalWeight; /**< The global weight of the event. */ + float m_localWeight; /**< The local weight of the event. */ EventState m_eventState; /**< Is this the start of a ranged event? Ticked events will always have this set to true. */ bool IsEventStart() const @@ -58,13 +58,13 @@ namespace EMotionFX MotionEvent* event = nullptr, EventState eventState = START ) - : mTimeValue(timeValue) - , mActorInstance(actorInstance) - , mMotionInstance(motionInstance) - , mEmitter(nullptr) - , mEvent(event) - , mGlobalWeight(1.0f) - , mLocalWeight(1.0f) + : m_timeValue(timeValue) + , m_actorInstance(actorInstance) + , m_motionInstance(motionInstance) + , m_emitter(nullptr) + , m_event(event) + , m_globalWeight(1.0f) + , m_localWeight(1.0f) , m_eventState(eventState) { } diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/EventManager.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/EventManager.cpp index e3b4c351ef..b39fcbab99 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/EventManager.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/EventManager.cpp @@ -53,21 +53,21 @@ namespace EMotionFX // lock the event manager void EventManager::Lock() { - mLock.Lock(); + m_lock.Lock(); } // unlock the event manager void EventManager::Unlock() { - mLock.Unlock(); + m_lock.Unlock(); } // register event handler to the manager void EventManager::AddEventHandler(EventHandler* eventHandler) { - MCore::LockGuardRecursive lock(mLock); + MCore::LockGuardRecursive lock(m_lock); AZ_Assert(eventHandler, "Expected non-null event handler"); for (const EventTypes eventType : eventHandler->GetHandledEventTypes()) @@ -82,7 +82,7 @@ namespace EMotionFX // unregister event handler from the manager void EventManager::RemoveEventHandler(EventHandler* eventHandler) { - MCore::LockGuardRecursive lock(mLock); + MCore::LockGuardRecursive lock(m_lock); for (const EventTypes eventType : eventHandler->GetHandledEventTypes()) { @@ -101,9 +101,9 @@ namespace EMotionFX } // trigger the event handlers inside the motion instance - if (eventInfo.mMotionInstance) + if (eventInfo.m_motionInstance) { - eventInfo.mMotionInstance->OnEvent(eventInfo); + eventInfo.m_motionInstance->OnEvent(eventInfo); } // Call event handlers @@ -570,7 +570,7 @@ namespace EMotionFX for (EventHandler* eventHandler : eventHandlers) { const bool result = eventHandler->OnRayIntersectionTest(start, end, outIntersectInfo); - if (outIntersectInfo->mIsValid) + if (outIntersectInfo->m_isValid) { return result; } diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/EventManager.h b/Gems/EMotionFX/Code/EMotionFX/Source/EventManager.h index cf47eff346..356ffe05ae 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/EventManager.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/EventManager.h @@ -40,31 +40,31 @@ namespace EMotionFX */ struct EMFX_API IntersectionInfo { - AZ::Vector3 mPosition; - AZ::Vector3 mNormal; - AZ::Vector2 mUV; - float mBaryCentricU; - float mBaryCentricV; - ActorInstance* mActorInstance; - ActorInstance* mIgnoreActorInstance; - Node* mNode; - Mesh* mMesh; - uint32 mStartIndex; - bool mIsValid; + AZ::Vector3 m_position; + AZ::Vector3 m_normal; + AZ::Vector2 m_uv; + float m_baryCentricU; + float m_baryCentricV; + ActorInstance* m_actorInstance; + ActorInstance* m_ignoreActorInstance; + Node* m_node; + Mesh* m_mesh; + uint32 m_startIndex; + bool m_isValid; IntersectionInfo() { - mPosition = AZ::Vector3::CreateZero(); - mNormal.Set(0.0f, 1.0f, 0.0f); - mUV = AZ::Vector2::CreateZero(); - mBaryCentricU = 0.0f; - mBaryCentricV = 0.0f; - mActorInstance = nullptr; - mStartIndex = 0; - mIgnoreActorInstance = nullptr; - mNode = nullptr; - mMesh = nullptr; - mIsValid = false; + m_position = AZ::Vector3::CreateZero(); + m_normal.Set(0.0f, 1.0f, 0.0f); + m_uv = AZ::Vector2::CreateZero(); + m_baryCentricU = 0.0f; + m_baryCentricV = 0.0f; + m_actorInstance = nullptr; + m_startIndex = 0; + m_ignoreActorInstance = nullptr; + m_node = nullptr; + m_mesh = nullptr; + m_isValid = false; } }; @@ -263,7 +263,7 @@ namespace EMotionFX /** * This event gets triggered once the given motion instance gets added to the motion queue. - * This happens when you set the PlayBackInfo::mPlayNow member to false. In that case the MotionSystem::PlayMotion() method (OnPlayMotion) + * This happens when you set the PlayBackInfo::m_playNow member to false. In that case the MotionSystem::PlayMotion() method (OnPlayMotion) * will not directly start playing the motion (OnStartMotionInstance), but will add it to the motion queue instead. * The motion queue will then start playing the motion instance once it should. * @param motionInstance The motion instance that gets added to the motion queue. @@ -292,7 +292,7 @@ namespace EMotionFX /** * Perform a ray intersection test and return the intersection info. - * The first event handler registered that sets the IntersectionInfo::mIsValid to true will be outputting to the outIntersectInfo parameter. + * The first event handler registered that sets the IntersectionInfo::m_isValid to true will be outputting to the outIntersectInfo parameter. * @param start The start point, in world space. * @param end The end point, in world space. * @param outIntersectInfo The resulting intersection info. @@ -347,14 +347,14 @@ namespace EMotionFX */ struct EMFX_API RegisteredEventType { - AZStd::string mEventType; /**< The string that describes the event, this is what artists type in 3DSMax/Maya. */ - uint32 mEventID; /**< The unique ID for this event. */ + AZStd::string m_eventType; /**< The string that describes the event, this is what artists type in 3DSMax/Maya. */ + uint32 m_eventId; /**< The unique ID for this event. */ }; using EventHandlerVector = AZStd::vector; AZStd::vector m_eventHandlersByEventType; /**< The event handler to use to process events organized by EventTypes. */ - MCore::MutexRecursive mLock; + MCore::MutexRecursive m_lock; AZStd::mutex m_eventDataLock; AZStd::vector > m_allEventData; diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/Importer/ActorFileFormat.h b/Gems/EMotionFX/Code/EMotionFX/Source/Importer/ActorFileFormat.h index 402c70c8a1..e4df8d0cc8 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/Importer/ActorFileFormat.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/Importer/ActorFileFormat.h @@ -38,23 +38,23 @@ namespace EMotionFX // (aligned) struct Actor_Header { - uint8 mFourcc[4]; // must be "ACTR" - uint8 mHiVersion; // high version (2 in case of v2.34) - uint8 mLoVersion; // low version (34 in case of v2.34) - uint8 mEndianType; // the endian in which the data is saved [0=little, 1=big] + uint8 m_fourcc[4]; // must be "ACTR" + uint8 m_hiVersion; // high version (2 in case of v2.34) + uint8 m_loVersion; // low version (34 in case of v2.34) + uint8 m_endianType; // the endian in which the data is saved [0=little, 1=big] }; // (not aligned) struct Actor_Info { - uint32 mNumLODs; // the number of level of details - uint32 mTrajectoryNodeIndex; // the node number of the trajectory node used for motion extraction (NOTE: unused as there is no more trajectory node) - uint32 mMotionExtractionNodeIndex;// the node number of the trajectory node used for motion extraction - float mRetargetRootOffset; - uint8 mUnitType; // maps to EMotionFX::EUnitType - uint8 mExporterHighVersion; - uint8 mExporterLowVersion; + uint32 m_numLoDs; // the number of level of details + uint32 m_trajectoryNodeIndex; // the node number of the trajectory node used for motion extraction (NOTE: unused as there is no more trajectory node) + uint32 m_motionExtractionNodeIndex;// the node number of the trajectory node used for motion extraction + float m_retargetRootOffset; + uint8 m_unitType; // maps to EMotionFX::EUnitType + uint8 m_exporterHighVersion; + uint8 m_exporterLowVersion; // followed by: // string : source application (e.g. "3ds Max 2011", "Maya 2011") @@ -67,12 +67,12 @@ namespace EMotionFX // (not aligned) struct Actor_Info2 { - uint32 mNumLODs; // the number of level of details - uint32 mMotionExtractionNodeIndex;// the node number of the trajectory node used for motion extraction - uint32 mRetargetRootNodeIndex; // the retargeting root node index, most likely pointing to the hip or pelvis or MCORE_INVALIDINDEX32 when not set - uint8 mUnitType; // maps to EMotionFX::EUnitType - uint8 mExporterHighVersion; - uint8 mExporterLowVersion; + uint32 m_numLoDs; // the number of level of details + uint32 m_motionExtractionNodeIndex;// the node number of the trajectory node used for motion extraction + uint32 m_retargetRootNodeIndex; // the retargeting root node index, most likely pointing to the hip or pelvis or MCORE_INVALIDINDEX32 when not set + uint8 m_unitType; // maps to EMotionFX::EUnitType + uint8 m_exporterHighVersion; + uint8 m_exporterLowVersion; // followed by: // string : source application (e.g. "3ds Max 2011", "Maya 2011") @@ -85,13 +85,13 @@ namespace EMotionFX // (aligned) struct Actor_Info3 { - uint32 mNumLODs; // the number of level of details - uint32 mMotionExtractionNodeIndex;// the node number of the trajectory node used for motion extraction - uint32 mRetargetRootNodeIndex; // the retargeting root node index, most likely pointing to the hip or pelvis or MCORE_INVALIDINDEX32 when not set - uint8 mUnitType; // maps to EMotionFX::EUnitType - uint8 mExporterHighVersion; - uint8 mExporterLowVersion; - uint8 mOptimizeSkeleton; + uint32 m_numLoDs; // the number of level of details + uint32 m_motionExtractionNodeIndex;// the node number of the trajectory node used for motion extraction + uint32 m_retargetRootNodeIndex; // the retargeting root node index, most likely pointing to the hip or pelvis or MCORE_INVALIDINDEX32 when not set + uint8 m_unitType; // maps to EMotionFX::EUnitType + uint8 m_exporterHighVersion; + uint8 m_exporterLowVersion; + uint8 m_optimizeSkeleton; // followed by: // string : source application (e.g. "3ds Max 2011", "Maya 2011") @@ -110,13 +110,13 @@ namespace EMotionFX // (not aligned) struct Actor_Node2 { - FileQuaternion mLocalQuat; // the local rotation (before hierarchy) - FileVector3 mLocalPos; // the local translation (before hierarchy) - FileVector3 mLocalScale;// the local scale (before hierarchy) - uint32 mSkeletalLODs;// each bit representing if the node is active or not, in the give LOD (bit number) - uint32 mParentIndex;// parent node number, or 0xFFFFFFFF in case of a root node - uint32 mNumChilds; // the number of child nodes - uint8 mNodeFlags; // #1 bit boolean specifies whether we have to include this node in the bounds calculation or not + FileQuaternion m_localQuat; // the local rotation (before hierarchy) + FileVector3 m_localPos; // the local translation (before hierarchy) + FileVector3 m_localScale;// the local scale (before hierarchy) + uint32 m_skeletalLoDs;// each bit representing if the node is active or not, in the give LOD (bit number) + uint32 m_parentIndex;// parent node number, or 0xFFFFFFFF in case of a root node + uint32 m_numChilds; // the number of child nodes + uint8 m_nodeFlags; // #1 bit boolean specifies whether we have to include this node in the bounds calculation or not // followed by: // string : node name (the unique name of the node) @@ -126,8 +126,8 @@ namespace EMotionFX // (aligned) struct Actor_UV { - float mU; - float mV; + float m_u; + float m_v; }; //------------------------------------------------------- @@ -136,14 +136,14 @@ namespace EMotionFX // (aligned) struct Actor_Limit { - FileVector3 mTranslationMin;// the minimum translation values - FileVector3 mTranslationMax;// the maximum translation value. - FileVector3 mRotationMin; // the minimum rotation values - FileVector3 mRotationMax; // the maximum rotation values - FileVector3 mScaleMin; // the minimum scale values - FileVector3 mScaleMax; // the maximum scale values - uint8 mLimitFlags[9]; // the limit type activation flags - uint32 mNodeNumber; // the node number where this info belongs to + FileVector3 m_translationMin;// the minimum translation values + FileVector3 m_translationMax;// the maximum translation value. + FileVector3 m_rotationMin; // the minimum rotation values + FileVector3 m_rotationMax; // the maximum rotation values + FileVector3 m_scaleMin; // the minimum scale values + FileVector3 m_scaleMax; // the maximum scale values + uint8 m_limitFlags[9]; // the limit type activation flags + uint32 m_nodeNumber; // the node number where this info belongs to }; @@ -151,15 +151,15 @@ namespace EMotionFX // (aligned) struct Actor_MorphTarget { - float mRangeMin; // the slider min - float mRangeMax; // the slider max - uint32 mLOD; // the level of detail to which this expression part belongs to - uint32 mNumTransformations;// the number of transformations to follow - uint32 mPhonemeSets; // the number of phoneme sets to follow + float m_rangeMin; // the slider min + float m_rangeMax; // the slider max + uint32 m_lod; // the level of detail to which this expression part belongs to + uint32 m_numTransformations;// the number of transformations to follow + uint32 m_phonemeSets; // the number of phoneme sets to follow // followed by: // string : morph target name - // Actor_MorphTargetTransform[ mNumTransformations ] + // Actor_MorphTargetTransform[ m_numTransformations ] }; @@ -167,11 +167,11 @@ namespace EMotionFX // (aligned) struct Actor_MorphTargets { - uint32 mNumMorphTargets; // the number of morph targets to follow - uint32 mLOD; // the LOD level the morph targets are for + uint32 m_numMorphTargets; // the number of morph targets to follow + uint32 m_lod; // the LOD level the morph targets are for // followed by: - // Actor_MorphTarget[ mNumMorphTargets ] + // Actor_MorphTarget[ m_numMorphTargets ] }; @@ -179,11 +179,11 @@ namespace EMotionFX // (aligned) struct Actor_MorphTargetTransform { - uint32 mNodeIndex; // the node name where the transform belongs to - FileQuaternion mRotation; // the node rotation - FileQuaternion mScaleRotation; // the node delta scale rotation - FileVector3 mPosition; // the node delta position - FileVector3 mScale; // the node delta scale + uint32 m_nodeIndex; // the node name where the transform belongs to + FileQuaternion m_rotation; // the node rotation + FileQuaternion m_scaleRotation; // the node delta scale rotation + FileVector3 m_position; // the node delta position + FileVector3 m_scale; // the node delta scale }; @@ -191,30 +191,30 @@ namespace EMotionFX // (not aligned) struct Actor_NodeGroup { - uint16 mNumNodes; - uint8 mDisabledOnDefault; // 0 = no, 1 = yes + uint16 m_numNodes; + uint8 m_disabledOnDefault; // 0 = no, 1 = yes // followed by: // string : name - // uint16 [mNumNodes] + // uint16 [m_numNodes] }; // (aligned) struct Actor_Nodes2 { - uint32 mNumNodes; - uint32 mNumRootNodes; - // followed by Actor_Node4[mNumNodes] or Actor_NODE5[mNumNodes] (for v2) + uint32 m_numNodes; + uint32 m_numRootNodes; + // followed by Actor_Node4[m_numNodes] or Actor_NODE5[m_numNodes] (for v2) }; // node motion sources used for the motion mirroring feature // (aligned) struct Actor_NodeMotionSources2 { - uint32 mNumNodes; - // followed by uint16[mNumNodes] // an index per node, which indicates the index of the node to extract the motion data from in case mirroring for a given motion is enabled. This array can be nullptr in case no mirroring data has been setup. - // followed by uint8[mNumNodes] // axis identifier (0=X, 1=Y, 2=Z) - // followed by uint8[mNumNodes] // flags identifier (see Actor::MirrorFlags) + uint32 m_numNodes; + // followed by uint16[m_numNodes] // an index per node, which indicates the index of the node to extract the motion data from in case mirroring for a given motion is enabled. This array can be nullptr in case no mirroring data has been setup. + // followed by uint8[m_numNodes] // axis identifier (0=X, 1=Y, 2=Z) + // followed by uint8[m_numNodes] // flags identifier (see Actor::MirrorFlags) }; @@ -222,8 +222,8 @@ namespace EMotionFX // (aligned) struct Actor_AttachmentNodes { - uint32 mNumNodes; - // followed by uint16[mNumNodes] // an index per attachment node + uint32 m_numNodes; + // followed by uint16[m_numNodes] // an index per attachment node }; } // namespace FileFormat } // namespace EMotionFX diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/Importer/ChunkProcessors.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/Importer/ChunkProcessors.cpp index 604dfb8bb9..7d800f8928 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/Importer/ChunkProcessors.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/Importer/ChunkProcessors.cpp @@ -244,12 +244,12 @@ namespace EMotionFX // constructor SharedHelperData::SharedHelperData() { - mFileHighVersion = 1; - mFileLowVersion = 0; + m_fileHighVersion = 1; + m_fileLowVersion = 0; // allocate the string buffer used for reading in variable sized strings - mStringStorageSize = 256; - mStringStorage = (char*)MCore::Allocate(mStringStorageSize, EMFX_MEMCATEGORY_IMPORTER); + m_stringStorageSize = 256; + m_stringStorage = (char*)MCore::Allocate(m_stringStorageSize, EMFX_MEMCATEGORY_IMPORTER); } @@ -271,13 +271,13 @@ namespace EMotionFX void SharedHelperData::Reset() { // free the string buffer - if (mStringStorage) + if (m_stringStorage) { - MCore::Free(mStringStorage); + MCore::Free(m_stringStorage); } - mStringStorage = nullptr; - mStringStorageSize = 0; + m_stringStorage = nullptr; + m_stringStorageSize = 0; } const char* SharedHelperData::ReadString(MCore::Stream* file, AZStd::vector* sharedData, MCore::Endian::EEndianType endianType) @@ -295,23 +295,17 @@ namespace EMotionFX MCore::Endian::ConvertUnsignedInt32(&numCharacters, endianType); // if we need to enlarge the buffer - if (helperData->mStringStorageSize < numCharacters + 1) + if (helperData->m_stringStorageSize < numCharacters + 1) { - helperData->mStringStorageSize = numCharacters + 1; - helperData->mStringStorage = (char*)MCore::Realloc(helperData->mStringStorage, helperData->mStringStorageSize, EMFX_MEMCATEGORY_IMPORTER); + helperData->m_stringStorageSize = numCharacters + 1; + helperData->m_stringStorage = (char*)MCore::Realloc(helperData->m_stringStorage, helperData->m_stringStorageSize, EMFX_MEMCATEGORY_IMPORTER); } // receive the actual string - file->Read(helperData->mStringStorage, numCharacters * sizeof(uint8)); - helperData->mStringStorage[numCharacters] = '\0'; + file->Read(helperData->m_stringStorage, numCharacters * sizeof(uint8)); + helperData->m_stringStorage[numCharacters] = '\0'; - //if (helperData->mIsUnicodeFile) - //helperData->mConvertString = helperData->mStringStorage; - //else - // helperData->mConvertString = helperData->mStringStorage; - - //result = helperData->mStringStorage; - return helperData->mStringStorage; + return helperData->m_stringStorage; } //----------------------------------------------------------------------------- @@ -320,9 +314,9 @@ namespace EMotionFX ChunkProcessor::ChunkProcessor(uint32 chunkID, uint32 version) : BaseObject() { - mChunkID = chunkID; - mVersion = version; - mLoggingActive = false; + m_chunkId = chunkID; + m_version = version; + m_loggingActive = false; } @@ -334,34 +328,34 @@ namespace EMotionFX uint32 ChunkProcessor::GetChunkID() const { - return mChunkID; + return m_chunkId; } uint32 ChunkProcessor::GetVersion() const { - return mVersion; + return m_version; } void ChunkProcessor::SetLogging(bool loggingActive) { - mLoggingActive = loggingActive; + m_loggingActive = loggingActive; } bool ChunkProcessor::GetLogging() const { - return mLoggingActive; + return m_loggingActive; } //================================================================================================= bool ChunkProcessorActorNodes2::Process(MCore::File* file, Importer::ImportParameters& importParams) { - const MCore::Endian::EEndianType endianType = importParams.mEndianType; - Actor* actor = importParams.mActor; - Importer::ActorSettings* actorSettings = importParams.mActorSettings; + const MCore::Endian::EEndianType endianType = importParams.m_endianType; + Actor* actor = importParams.m_actor; + Importer::ActorSettings* actorSettings = importParams.m_actorSettings; MCORE_ASSERT(actor); Skeleton* skeleton = actor->GetSkeleton(); @@ -370,44 +364,44 @@ namespace EMotionFX file->Read(&nodesHeader, sizeof(FileFormat::Actor_Nodes2)); // convert endian - MCore::Endian::ConvertUnsignedInt32(&nodesHeader.mNumNodes, endianType); - MCore::Endian::ConvertUnsignedInt32(&nodesHeader.mNumRootNodes, endianType); + MCore::Endian::ConvertUnsignedInt32(&nodesHeader.m_numNodes, endianType); + MCore::Endian::ConvertUnsignedInt32(&nodesHeader.m_numRootNodes, endianType); // pre-allocate space for the nodes - actor->SetNumNodes(nodesHeader.mNumNodes); + actor->SetNumNodes(nodesHeader.m_numNodes); // pre-allocate space for the root nodes - skeleton->ReserveRootNodes(nodesHeader.mNumRootNodes); + skeleton->ReserveRootNodes(nodesHeader.m_numRootNodes); if (GetLogging()) { - MCore::LogDetailedInfo("- Nodes: %d (%d root nodes)", nodesHeader.mNumNodes, nodesHeader.mNumRootNodes); + MCore::LogDetailedInfo("- Nodes: %d (%d root nodes)", nodesHeader.m_numNodes, nodesHeader.m_numRootNodes); } // add the transform actor->ResizeTransformData(); // read all nodes - for (uint32 n = 0; n < nodesHeader.mNumNodes; ++n) + for (uint32 n = 0; n < nodesHeader.m_numNodes; ++n) { // read the node header FileFormat::Actor_Node2 nodeChunk; file->Read(&nodeChunk, sizeof(FileFormat::Actor_Node2)); // read the node name - const char* nodeName = SharedHelperData::ReadString(file, importParams.mSharedData, endianType); + const char* nodeName = SharedHelperData::ReadString(file, importParams.m_sharedData, endianType); // convert endian - MCore::Endian::ConvertUnsignedInt32(&nodeChunk.mParentIndex, endianType); - MCore::Endian::ConvertUnsignedInt32(&nodeChunk.mSkeletalLODs, endianType); - MCore::Endian::ConvertUnsignedInt32(&nodeChunk.mNumChilds, endianType); + MCore::Endian::ConvertUnsignedInt32(&nodeChunk.m_parentIndex, endianType); + MCore::Endian::ConvertUnsignedInt32(&nodeChunk.m_skeletalLoDs, endianType); + MCore::Endian::ConvertUnsignedInt32(&nodeChunk.m_numChilds, endianType); // show the name of the node, the parent and the number of children if (GetLogging()) { MCore::LogDetailedInfo(" + Node name = '%s'", nodeName); - MCore::LogDetailedInfo(" - Parent = '%s'", (nodeChunk.mParentIndex != MCORE_INVALIDINDEX32) ? skeleton->GetNode(nodeChunk.mParentIndex)->GetName() : ""); - MCore::LogDetailedInfo(" - NumChild Nodes = %d", nodeChunk.mNumChilds); + MCore::LogDetailedInfo(" - Parent = '%s'", (nodeChunk.m_parentIndex != MCORE_INVALIDINDEX32) ? skeleton->GetNode(nodeChunk.m_parentIndex)->GetName() : ""); + MCore::LogDetailedInfo(" - NumChild Nodes = %d", nodeChunk.m_numChilds); } // create the new node @@ -418,15 +412,15 @@ namespace EMotionFX node->SetNodeIndex(nodeIndex); // pre-allocate space for the number of child nodes - node->PreAllocNumChildNodes(nodeChunk.mNumChilds); + node->PreAllocNumChildNodes(nodeChunk.m_numChilds); // add it to the actor skeleton->SetNode(n, node); // create Core objects from the data - AZ::Vector3 pos(nodeChunk.mLocalPos.mX, nodeChunk.mLocalPos.mY, nodeChunk.mLocalPos.mZ); - AZ::Vector3 scale(nodeChunk.mLocalScale.mX, nodeChunk.mLocalScale.mY, nodeChunk.mLocalScale.mZ); - AZ::Quaternion rot(nodeChunk.mLocalQuat.mX, nodeChunk.mLocalQuat.mY, nodeChunk.mLocalQuat.mZ, nodeChunk.mLocalQuat.mW); + AZ::Vector3 pos(nodeChunk.m_localPos.m_x, nodeChunk.m_localPos.m_y, nodeChunk.m_localPos.m_z); + AZ::Vector3 scale(nodeChunk.m_localScale.m_x, nodeChunk.m_localScale.m_y, nodeChunk.m_localScale.m_z); + AZ::Quaternion rot(nodeChunk.m_localQuat.m_x, nodeChunk.m_localQuat.m_y, nodeChunk.m_localQuat.m_z, nodeChunk.m_localQuat.m_w); // convert endian and coordinate system ConvertVector3(&pos, endianType); @@ -435,41 +429,41 @@ namespace EMotionFX // set the local transform Transform bindTransform; - bindTransform.mPosition = pos; - bindTransform.mRotation = rot.GetNormalized(); + bindTransform.m_position = pos; + bindTransform.m_rotation = rot.GetNormalized(); EMFX_SCALECODE ( - bindTransform.mScale = scale; + bindTransform.m_scale = scale; ) actor->GetBindPose()->SetLocalSpaceTransform(nodeIndex, bindTransform); // set the skeletal LOD levels - if (actorSettings->mLoadSkeletalLODs) + if (actorSettings->m_loadSkeletalLoDs) { - node->SetSkeletalLODLevelBits(nodeChunk.mSkeletalLODs); + node->SetSkeletalLODLevelBits(nodeChunk.m_skeletalLoDs); } // set if this node has to be taken into the bounding volume calculation - const bool includeInBoundsCalc = (nodeChunk.mNodeFlags & Node::ENodeFlags::FLAG_INCLUDEINBOUNDSCALC); // first bit + const bool includeInBoundsCalc = (nodeChunk.m_nodeFlags & Node::ENodeFlags::FLAG_INCLUDEINBOUNDSCALC); // first bit node->SetIncludeInBoundsCalc(includeInBoundsCalc); // Set if this node is critical and cannot be optimized out. - const bool isCritical = (nodeChunk.mNodeFlags & Node::ENodeFlags::FLAG_CRITICAL); // third bit + const bool isCritical = (nodeChunk.m_nodeFlags & Node::ENodeFlags::FLAG_CRITICAL); // third bit node->SetIsCritical(isCritical); // set the parent, and add this node as child inside the parent - if (nodeChunk.mParentIndex != MCORE_INVALIDINDEX32) // if this node has a parent and the parent node is valid + if (nodeChunk.m_parentIndex != MCORE_INVALIDINDEX32) // if this node has a parent and the parent node is valid { - if (nodeChunk.mParentIndex < n) + if (nodeChunk.m_parentIndex < n) { - node->SetParentIndex(nodeChunk.mParentIndex); - Node* parentNode = skeleton->GetNode(nodeChunk.mParentIndex); + node->SetParentIndex(nodeChunk.m_parentIndex); + Node* parentNode = skeleton->GetNode(nodeChunk.m_parentIndex); parentNode->AddChild(nodeIndex); } else { - MCore::LogError("Cannot assign parent node index (%d) for node '%s' as the parent node is not yet loaded. Making '%s' a root node.", nodeChunk.mParentIndex, node->GetName(), node->GetName()); + MCore::LogError("Cannot assign parent node index (%d) for node '%s' as the parent node is not yet loaded. Making '%s' a root node.", nodeChunk.m_parentIndex, node->GetName(), node->GetName()); skeleton->AddRootNode(nodeIndex); } } @@ -505,42 +499,42 @@ namespace EMotionFX // read all submotions in one chunk bool ChunkProcessorMotionSubMotions::Process(MCore::File* file, Importer::ImportParameters& importParams) { - const MCore::Endian::EEndianType endianType = importParams.mEndianType; - Motion* motion = importParams.mMotion; + const MCore::Endian::EEndianType endianType = importParams.m_endianType; + Motion* motion = importParams.m_motion; AZ_Assert(motion, "Expected a valid motion object."); // read the header FileFormat::Motion_SubMotions subMotionsHeader; file->Read(&subMotionsHeader, sizeof(FileFormat::Motion_SubMotions)); - MCore::Endian::ConvertUnsignedInt32(&subMotionsHeader.mNumSubMotions, endianType); + MCore::Endian::ConvertUnsignedInt32(&subMotionsHeader.m_numSubMotions, endianType); // Create a uniform motion data. NonUniformMotionData* motionData = aznew NonUniformMotionData(); motion->SetMotionData(motionData); - motionData->Resize(subMotionsHeader.mNumSubMotions, motionData->GetNumMorphs(), motionData->GetNumFloats()); + motionData->Resize(subMotionsHeader.m_numSubMotions, motionData->GetNumMorphs(), motionData->GetNumFloats()); // for all submotions - for (uint32 s = 0; s < subMotionsHeader.mNumSubMotions; ++s) + for (uint32 s = 0; s < subMotionsHeader.m_numSubMotions; ++s) { FileFormat::Motion_SkeletalSubMotion fileSubMotion; file->Read(&fileSubMotion, sizeof(FileFormat::Motion_SkeletalSubMotion)); // convert endian - MCore::Endian::ConvertUnsignedInt32(&fileSubMotion.mNumPosKeys, endianType); - MCore::Endian::ConvertUnsignedInt32(&fileSubMotion.mNumRotKeys, endianType); - MCore::Endian::ConvertUnsignedInt32(&fileSubMotion.mNumScaleKeys, endianType); + MCore::Endian::ConvertUnsignedInt32(&fileSubMotion.m_numPosKeys, endianType); + MCore::Endian::ConvertUnsignedInt32(&fileSubMotion.m_numRotKeys, endianType); + MCore::Endian::ConvertUnsignedInt32(&fileSubMotion.m_numScaleKeys, endianType); // read the motion part name - const char* motionJointName = SharedHelperData::ReadString(file, importParams.mSharedData, endianType); + const char* motionJointName = SharedHelperData::ReadString(file, importParams.m_sharedData, endianType); // convert into Core objects - AZ::Vector3 posePos(fileSubMotion.mPosePos.mX, fileSubMotion.mPosePos.mY, fileSubMotion.mPosePos.mZ); - AZ::Vector3 poseScale(fileSubMotion.mPoseScale.mX, fileSubMotion.mPoseScale.mY, fileSubMotion.mPoseScale.mZ); - MCore::Compressed16BitQuaternion poseRot(fileSubMotion.mPoseRot.mX, fileSubMotion.mPoseRot.mY, fileSubMotion.mPoseRot.mZ, fileSubMotion.mPoseRot.mW); + AZ::Vector3 posePos(fileSubMotion.m_posePos.m_x, fileSubMotion.m_posePos.m_y, fileSubMotion.m_posePos.m_z); + AZ::Vector3 poseScale(fileSubMotion.m_poseScale.m_x, fileSubMotion.m_poseScale.m_y, fileSubMotion.m_poseScale.m_z); + MCore::Compressed16BitQuaternion poseRot(fileSubMotion.m_poseRot.m_x, fileSubMotion.m_poseRot.m_y, fileSubMotion.m_poseRot.m_z, fileSubMotion.m_poseRot.m_w); - AZ::Vector3 bindPosePos(fileSubMotion.mBindPosePos.mX, fileSubMotion.mBindPosePos.mY, fileSubMotion.mBindPosePos.mZ); - AZ::Vector3 bindPoseScale(fileSubMotion.mBindPoseScale.mX, fileSubMotion.mBindPoseScale.mY, fileSubMotion.mBindPoseScale.mZ); - MCore::Compressed16BitQuaternion bindPoseRot(fileSubMotion.mBindPoseRot.mX, fileSubMotion.mBindPoseRot.mY, fileSubMotion.mBindPoseRot.mZ, fileSubMotion.mBindPoseRot.mW); + AZ::Vector3 bindPosePos(fileSubMotion.m_bindPosePos.m_x, fileSubMotion.m_bindPosePos.m_y, fileSubMotion.m_bindPosePos.m_z); + AZ::Vector3 bindPoseScale(fileSubMotion.m_bindPoseScale.m_x, fileSubMotion.m_bindPoseScale.m_y, fileSubMotion.m_bindPoseScale.m_z); + MCore::Compressed16BitQuaternion bindPoseRot(fileSubMotion.m_bindPoseRot.m_x, fileSubMotion.m_bindPoseRot.m_y, fileSubMotion.m_bindPoseRot.m_z, fileSubMotion.m_bindPoseRot.m_w); // convert endian and coordinate system ConvertVector3(&posePos, endianType); @@ -582,9 +576,9 @@ namespace EMotionFX static_cast(bindPoseScale.GetX()), static_cast(bindPoseScale.GetY()), static_cast(bindPoseScale.GetZ())); - MCore::LogDetailedInfo(" + Num Pos Keys: %d", fileSubMotion.mNumPosKeys); - MCore::LogDetailedInfo(" + Num Rot Keys: %d", fileSubMotion.mNumRotKeys); - MCore::LogDetailedInfo(" + Num Scale Keys: %d", fileSubMotion.mNumScaleKeys); + MCore::LogDetailedInfo(" + Num Pos Keys: %d", fileSubMotion.m_numPosKeys); + MCore::LogDetailedInfo(" + Num Rot Keys: %d", fileSubMotion.m_numRotKeys); + MCore::LogDetailedInfo(" + Num Scale Keys: %d", fileSubMotion.m_numScaleKeys); } motionData->SetJointName(s, motionJointName); @@ -600,62 +594,62 @@ namespace EMotionFX // now read the animation data uint32 i; - if (fileSubMotion.mNumPosKeys > 0) + if (fileSubMotion.m_numPosKeys > 0) { - motionData->AllocateJointPositionSamples(s, fileSubMotion.mNumPosKeys); - for (i = 0; i < fileSubMotion.mNumPosKeys; ++i) + motionData->AllocateJointPositionSamples(s, fileSubMotion.m_numPosKeys); + for (i = 0; i < fileSubMotion.m_numPosKeys; ++i) { FileFormat::Motion_Vector3Key key; file->Read(&key, sizeof(FileFormat::Motion_Vector3Key)); - MCore::Endian::ConvertFloat(&key.mTime, endianType); - AZ::Vector3 pos(key.mValue.mX, key.mValue.mY, key.mValue.mZ); + MCore::Endian::ConvertFloat(&key.m_time, endianType); + AZ::Vector3 pos(key.m_value.m_x, key.m_value.m_y, key.m_value.m_z); ConvertVector3(&pos, endianType); - motionData->SetJointPositionSample(s, i, {key.mTime, pos}); + motionData->SetJointPositionSample(s, i, {key.m_time, pos}); } } // now the rotation keys - if (fileSubMotion.mNumRotKeys > 0) + if (fileSubMotion.m_numRotKeys > 0) { - motionData->AllocateJointRotationSamples(s, fileSubMotion.mNumRotKeys); - for (i = 0; i < fileSubMotion.mNumRotKeys; ++i) + motionData->AllocateJointRotationSamples(s, fileSubMotion.m_numRotKeys); + for (i = 0; i < fileSubMotion.m_numRotKeys; ++i) { FileFormat::Motion_16BitQuaternionKey key; file->Read(&key, sizeof(FileFormat::Motion_16BitQuaternionKey)); - MCore::Endian::ConvertFloat(&key.mTime, endianType); - MCore::Compressed16BitQuaternion rot(key.mValue.mX, key.mValue.mY, key.mValue.mZ, key.mValue.mW); + MCore::Endian::ConvertFloat(&key.m_time, endianType); + MCore::Compressed16BitQuaternion rot(key.m_value.m_x, key.m_value.m_y, key.m_value.m_z, key.m_value.m_w); Convert16BitQuaternion(&rot, endianType); - motionData->SetJointRotationSample(s, i, {key.mTime, rot.ToQuaternion().GetNormalized()}); + motionData->SetJointRotationSample(s, i, {key.m_time, rot.ToQuaternion().GetNormalized()}); } } #ifndef EMFX_SCALE_DISABLED // and the scale keys - if (fileSubMotion.mNumScaleKeys > 0) + if (fileSubMotion.m_numScaleKeys > 0) { - motionData->AllocateJointScaleSamples(s, fileSubMotion.mNumScaleKeys); - for (i = 0; i < fileSubMotion.mNumScaleKeys; ++i) + motionData->AllocateJointScaleSamples(s, fileSubMotion.m_numScaleKeys); + for (i = 0; i < fileSubMotion.m_numScaleKeys; ++i) { FileFormat::Motion_Vector3Key key; file->Read(&key, sizeof(FileFormat::Motion_Vector3Key)); - MCore::Endian::ConvertFloat(&key.mTime, endianType); - AZ::Vector3 scale(key.mValue.mX, key.mValue.mY, key.mValue.mZ); + MCore::Endian::ConvertFloat(&key.m_time, endianType); + AZ::Vector3 scale(key.m_value.m_x, key.m_value.m_y, key.m_value.m_z); ConvertScale(&scale, endianType); - motionData->SetJointScaleSample(s, i, {key.mTime, scale}); + motionData->SetJointScaleSample(s, i, {key.m_time, scale}); } } #else // no scaling // and the scale keys - if (fileSubMotion.mNumScaleKeys > 0) + if (fileSubMotion.m_numScaleKeys > 0) { - for (i = 0; i < fileSubMotion.mNumScaleKeys; ++i) + for (i = 0; i < fileSubMotion.m_numScaleKeys; ++i) { FileFormat::Motion_Vector3Key key; file->Read(&key, sizeof(FileFormat::Motion_Vector3Key)); @@ -673,8 +667,8 @@ namespace EMotionFX bool ChunkProcessorMotionInfo::Process(MCore::File* file, Importer::ImportParameters& importParams) { - const MCore::Endian::EEndianType endianType = importParams.mEndianType; - Motion* motion = importParams.mMotion; + const MCore::Endian::EEndianType endianType = importParams.m_endianType; + Motion* motion = importParams.m_motion; MCORE_ASSERT(motion); @@ -683,8 +677,8 @@ namespace EMotionFX file->Read(&fileInformation, sizeof(FileFormat::Motion_Info)); // convert endian - MCore::Endian::ConvertUnsignedInt32(&fileInformation.mMotionExtractionMask, endianType); - MCore::Endian::ConvertUnsignedInt32(&fileInformation.mMotionExtractionNodeIndex, endianType); + MCore::Endian::ConvertUnsignedInt32(&fileInformation.m_motionExtractionMask, endianType); + MCore::Endian::ConvertUnsignedInt32(&fileInformation.m_motionExtractionNodeIndex, endianType); if (GetLogging()) { @@ -693,15 +687,15 @@ namespace EMotionFX if (GetLogging()) { - MCore::LogDetailedInfo(" + Unit Type = %d", fileInformation.mUnitType); + MCore::LogDetailedInfo(" + Unit Type = %d", fileInformation.m_unitType); } - motion->SetUnitType(static_cast(fileInformation.mUnitType)); + motion->SetUnitType(static_cast(fileInformation.m_unitType)); motion->SetFileUnitType(motion->GetUnitType()); // Try to remain backward compatible by still capturing height when this was enabled in the old mask system. - if (fileInformation.mMotionExtractionMask & (1 << 2)) // The 1<<2 was the mask used for position Z in the old motion extraction mask settings + if (fileInformation.m_motionExtractionMask & (1 << 2)) // The 1<<2 was the mask used for position Z in the old motion extraction mask settings { motion->SetMotionExtractionFlags(MOTIONEXTRACT_CAPTURE_Z); } @@ -713,8 +707,8 @@ namespace EMotionFX bool ChunkProcessorMotionInfo2::Process(MCore::File* file, Importer::ImportParameters& importParams) { - const MCore::Endian::EEndianType endianType = importParams.mEndianType; - Motion* motion = importParams.mMotion; + const MCore::Endian::EEndianType endianType = importParams.m_endianType; + Motion* motion = importParams.m_motion; MCORE_ASSERT(motion); // read the chunk @@ -722,8 +716,8 @@ namespace EMotionFX file->Read(&fileInformation, sizeof(FileFormat::Motion_Info2)); // convert endian - MCore::Endian::ConvertUnsignedInt32(&fileInformation.mMotionExtractionFlags, endianType); - MCore::Endian::ConvertUnsignedInt32(&fileInformation.mMotionExtractionNodeIndex, endianType); + MCore::Endian::ConvertUnsignedInt32(&fileInformation.m_motionExtractionFlags, endianType); + MCore::Endian::ConvertUnsignedInt32(&fileInformation.m_motionExtractionNodeIndex, endianType); if (GetLogging()) { @@ -732,13 +726,13 @@ namespace EMotionFX if (GetLogging()) { - MCore::LogDetailedInfo(" + Unit Type = %d", fileInformation.mUnitType); - MCore::LogDetailedInfo(" + Motion Extraction Flags = 0x%x [capZ=%d]", fileInformation.mMotionExtractionFlags, (fileInformation.mMotionExtractionFlags & EMotionFX::MOTIONEXTRACT_CAPTURE_Z) ? 1 : 0); + MCore::LogDetailedInfo(" + Unit Type = %d", fileInformation.m_unitType); + MCore::LogDetailedInfo(" + Motion Extraction Flags = 0x%x [capZ=%d]", fileInformation.m_motionExtractionFlags, (fileInformation.m_motionExtractionFlags & EMotionFX::MOTIONEXTRACT_CAPTURE_Z) ? 1 : 0); } - motion->SetUnitType(static_cast(fileInformation.mUnitType)); + motion->SetUnitType(static_cast(fileInformation.m_unitType)); motion->SetFileUnitType(motion->GetUnitType()); - motion->SetMotionExtractionFlags(static_cast(fileInformation.mMotionExtractionFlags)); + motion->SetMotionExtractionFlags(static_cast(fileInformation.m_motionExtractionFlags)); return true; } @@ -747,8 +741,8 @@ namespace EMotionFX bool ChunkProcessorMotionInfo3::Process(MCore::File* file, Importer::ImportParameters& importParams) { - const MCore::Endian::EEndianType endianType = importParams.mEndianType; - Motion* motion = importParams.mMotion; + const MCore::Endian::EEndianType endianType = importParams.m_endianType; + Motion* motion = importParams.m_motion; MCORE_ASSERT(motion); // read the chunk @@ -756,8 +750,8 @@ namespace EMotionFX file->Read(&fileInformation, sizeof(FileFormat::Motion_Info3)); // convert endian - MCore::Endian::ConvertUnsignedInt32(&fileInformation.mMotionExtractionFlags, endianType); - MCore::Endian::ConvertUnsignedInt32(&fileInformation.mMotionExtractionNodeIndex, endianType); + MCore::Endian::ConvertUnsignedInt32(&fileInformation.m_motionExtractionFlags, endianType); + MCore::Endian::ConvertUnsignedInt32(&fileInformation.m_motionExtractionNodeIndex, endianType); if (GetLogging()) { @@ -766,15 +760,15 @@ namespace EMotionFX if (GetLogging()) { - MCore::LogDetailedInfo(" + Unit Type = %d", fileInformation.mUnitType); - MCore::LogDetailedInfo(" + Is Additive Motion = %d", fileInformation.mIsAdditive); - MCore::LogDetailedInfo(" + Motion Extraction Flags = 0x%x [capZ=%d]", fileInformation.mMotionExtractionFlags, (fileInformation.mMotionExtractionFlags & EMotionFX::MOTIONEXTRACT_CAPTURE_Z) ? 1 : 0); + MCore::LogDetailedInfo(" + Unit Type = %d", fileInformation.m_unitType); + MCore::LogDetailedInfo(" + Is Additive Motion = %d", fileInformation.m_isAdditive); + MCore::LogDetailedInfo(" + Motion Extraction Flags = 0x%x [capZ=%d]", fileInformation.m_motionExtractionFlags, (fileInformation.m_motionExtractionFlags & EMotionFX::MOTIONEXTRACT_CAPTURE_Z) ? 1 : 0); } - motion->SetUnitType(static_cast(fileInformation.mUnitType)); - importParams.m_additiveMotion = (fileInformation.mIsAdditive == 0 ? false : true); + motion->SetUnitType(static_cast(fileInformation.m_unitType)); + importParams.m_additiveMotion = (fileInformation.m_isAdditive == 0 ? false : true); motion->SetFileUnitType(motion->GetUnitType()); - motion->SetMotionExtractionFlags(static_cast(fileInformation.mMotionExtractionFlags)); + motion->SetMotionExtractionFlags(static_cast(fileInformation.m_motionExtractionFlags)); return true; } @@ -783,8 +777,8 @@ namespace EMotionFX bool ChunkProcessorActorPhysicsSetup::Process(MCore::File* file, Importer::ImportParameters& importParams) { - const MCore::Endian::EEndianType endianType = importParams.mEndianType; - Actor* actor = importParams.mActor; + const MCore::Endian::EEndianType endianType = importParams.m_endianType; + Actor* actor = importParams.m_actor; AZ::u32 bufferSize; file->Read(&bufferSize, sizeof(AZ::u32)); @@ -807,7 +801,7 @@ namespace EMotionFX if (resultPhysicsSetup) { - if (importParams.mActorSettings->mOptimizeForServer) + if (importParams.m_actorSettings->m_optimizeForServer) { resultPhysicsSetup->OptimizeForServer(); } @@ -821,8 +815,8 @@ namespace EMotionFX bool ChunkProcessorActorSimulatedObjectSetup::Process(MCore::File* file, Importer::ImportParameters& importParams) { - const MCore::Endian::EEndianType endianType = importParams.mEndianType; - Actor* actor = importParams.mActor; + const MCore::Endian::EEndianType endianType = importParams.m_endianType; + Actor* actor = importParams.m_actor; AZ::u32 bufferSize; file->Read(&bufferSize, sizeof(AZ::u32)); @@ -854,13 +848,13 @@ namespace EMotionFX bool ChunkProcessorMeshAsset::Process(MCore::File* file, Importer::ImportParameters& importParams) { - const MCore::Endian::EEndianType endianType = importParams.mEndianType; - Actor* actor = importParams.mActor; + const MCore::Endian::EEndianType endianType = importParams.m_endianType; + Actor* actor = importParams.m_actor; AZ_Assert(actor, "Actor needs to be valid."); EMotionFX::FileFormat::Actor_MeshAsset meshAssetChunk; file->Read(&meshAssetChunk, sizeof(FileFormat::Actor_MeshAsset)); - const char* meshAssetIdString = SharedHelperData::ReadString(file, importParams.mSharedData, endianType); + const char* meshAssetIdString = SharedHelperData::ReadString(file, importParams.m_sharedData, endianType); const AZ::Data::AssetId meshAssetId = AZ::Data::AssetId::CreateString(meshAssetIdString); if (meshAssetId.IsValid()) { @@ -880,8 +874,8 @@ namespace EMotionFX bool ChunkProcessorMotionEventTrackTable::Process(MCore::File* file, Importer::ImportParameters& importParams) { - const MCore::Endian::EEndianType endianType = importParams.mEndianType; - Motion* motion = importParams.mMotion; + const MCore::Endian::EEndianType endianType = importParams.m_endianType; + Motion* motion = importParams.m_motion; MCORE_ASSERT(motion); @@ -890,53 +884,53 @@ namespace EMotionFX file->Read(&fileEventTable, sizeof(FileFormat::FileMotionEventTable)); // convert endian - MCore::Endian::ConvertUnsignedInt32(&fileEventTable.mNumTracks, endianType); + MCore::Endian::ConvertUnsignedInt32(&fileEventTable.m_numTracks, endianType); if (GetLogging()) { MCore::LogDetailedInfo("- Motion Event Table:"); - MCore::LogDetailedInfo(" + Num Tracks = %d", fileEventTable.mNumTracks); + MCore::LogDetailedInfo(" + Num Tracks = %d", fileEventTable.m_numTracks); } // get the motion event table the reserve the event tracks MotionEventTable* motionEventTable = motion->GetEventTable(); - motionEventTable->ReserveNumTracks(fileEventTable.mNumTracks); + motionEventTable->ReserveNumTracks(fileEventTable.m_numTracks); // read all tracks AZStd::string trackName; AZStd::vector typeStrings; AZStd::vector paramStrings; AZStd::vector mirrorTypeStrings; - for (uint32 t = 0; t < fileEventTable.mNumTracks; ++t) + for (uint32 t = 0; t < fileEventTable.m_numTracks; ++t) { // read the motion event table header FileFormat::FileMotionEventTrack fileTrack; file->Read(&fileTrack, sizeof(FileFormat::FileMotionEventTrack)); // read the track name - trackName = SharedHelperData::ReadString(file, importParams.mSharedData, endianType); + trackName = SharedHelperData::ReadString(file, importParams.m_sharedData, endianType); // convert endian - MCore::Endian::ConvertUnsignedInt32(&fileTrack.mNumEvents, endianType); - MCore::Endian::ConvertUnsignedInt32(&fileTrack.mNumTypeStrings, endianType); - MCore::Endian::ConvertUnsignedInt32(&fileTrack.mNumParamStrings, endianType); - MCore::Endian::ConvertUnsignedInt32(&fileTrack.mNumMirrorTypeStrings, endianType); + MCore::Endian::ConvertUnsignedInt32(&fileTrack.m_numEvents, endianType); + MCore::Endian::ConvertUnsignedInt32(&fileTrack.m_numTypeStrings, endianType); + MCore::Endian::ConvertUnsignedInt32(&fileTrack.m_numParamStrings, endianType); + MCore::Endian::ConvertUnsignedInt32(&fileTrack.m_numMirrorTypeStrings, endianType); if (GetLogging()) { MCore::LogDetailedInfo("- Motion Event Track:"); MCore::LogDetailedInfo(" + Name = %s", trackName.c_str()); - MCore::LogDetailedInfo(" + Num events = %d", fileTrack.mNumEvents); - MCore::LogDetailedInfo(" + Num types = %d", fileTrack.mNumTypeStrings); - MCore::LogDetailedInfo(" + Num params = %d", fileTrack.mNumParamStrings); - MCore::LogDetailedInfo(" + Num mirror = %d", fileTrack.mNumMirrorTypeStrings); - MCore::LogDetailedInfo(" + Enabled = %d", fileTrack.mIsEnabled); + MCore::LogDetailedInfo(" + Num events = %d", fileTrack.m_numEvents); + MCore::LogDetailedInfo(" + Num types = %d", fileTrack.m_numTypeStrings); + MCore::LogDetailedInfo(" + Num params = %d", fileTrack.m_numParamStrings); + MCore::LogDetailedInfo(" + Num mirror = %d", fileTrack.m_numMirrorTypeStrings); + MCore::LogDetailedInfo(" + Enabled = %d", fileTrack.m_isEnabled); } // the even type and parameter strings - typeStrings.resize(fileTrack.mNumTypeStrings); - paramStrings.resize(fileTrack.mNumParamStrings); - mirrorTypeStrings.resize(fileTrack.mNumMirrorTypeStrings); + typeStrings.resize(fileTrack.m_numTypeStrings); + paramStrings.resize(fileTrack.m_numParamStrings); + mirrorTypeStrings.resize(fileTrack.m_numMirrorTypeStrings); // read all type strings if (GetLogging()) @@ -944,9 +938,9 @@ namespace EMotionFX MCore::LogDetailedInfo(" + Event types:"); } uint32 i; - for (i = 0; i < fileTrack.mNumTypeStrings; ++i) + for (i = 0; i < fileTrack.m_numTypeStrings; ++i) { - typeStrings[i] = SharedHelperData::ReadString(file, importParams.mSharedData, endianType); + typeStrings[i] = SharedHelperData::ReadString(file, importParams.m_sharedData, endianType); if (GetLogging()) { MCore::LogDetailedInfo(" [%d] = '%s'", i, typeStrings[i].c_str()); @@ -958,9 +952,9 @@ namespace EMotionFX { MCore::LogDetailedInfo(" + Parameters:"); } - for (i = 0; i < fileTrack.mNumParamStrings; ++i) + for (i = 0; i < fileTrack.m_numParamStrings; ++i) { - paramStrings[i] = SharedHelperData::ReadString(file, importParams.mSharedData, endianType); + paramStrings[i] = SharedHelperData::ReadString(file, importParams.m_sharedData, endianType); if (GetLogging()) { MCore::LogDetailedInfo(" [%d] = '%s'", i, paramStrings[i].c_str()); @@ -971,9 +965,9 @@ namespace EMotionFX { MCore::LogDetailedInfo(" + Mirror Type Strings:"); } - for (i = 0; i < fileTrack.mNumMirrorTypeStrings; ++i) + for (i = 0; i < fileTrack.m_numMirrorTypeStrings; ++i) { - mirrorTypeStrings[i] = SharedHelperData::ReadString(file, importParams.mSharedData, endianType); + mirrorTypeStrings[i] = SharedHelperData::ReadString(file, importParams.m_sharedData, endianType); if (GetLogging()) { MCore::LogDetailedInfo(" [%d] = '%s'", i, mirrorTypeStrings[i].c_str()); @@ -982,8 +976,8 @@ namespace EMotionFX // create the default event track MotionEventTrack* track = MotionEventTrack::Create(trackName.c_str(), motion); - track->SetIsEnabled(fileTrack.mIsEnabled != 0); - track->ReserveNumEvents(fileTrack.mNumEvents); + track->SetIsEnabled(fileTrack.m_isEnabled != 0); + track->ReserveNumEvents(fileTrack.m_numEvents); motionEventTable->AddTrack(track); // read all motion events @@ -991,35 +985,35 @@ namespace EMotionFX { MCore::LogDetailedInfo(" + Motion Events:"); } - for (i = 0; i < fileTrack.mNumEvents; ++i) + for (i = 0; i < fileTrack.m_numEvents; ++i) { // read the event header FileFormat::FileMotionEvent fileEvent; file->Read(&fileEvent, sizeof(FileFormat::FileMotionEvent)); // convert endian - MCore::Endian::ConvertUnsignedInt32(&fileEvent.mEventTypeIndex, endianType); - MCore::Endian::ConvertUnsignedInt16(&fileEvent.mParamIndex, endianType); - MCore::Endian::ConvertUnsignedInt32(&fileEvent.mMirrorTypeIndex, endianType); - MCore::Endian::ConvertFloat(&fileEvent.mStartTime, endianType); - MCore::Endian::ConvertFloat(&fileEvent.mEndTime, endianType); + MCore::Endian::ConvertUnsignedInt32(&fileEvent.m_eventTypeIndex, endianType); + MCore::Endian::ConvertUnsignedInt16(&fileEvent.m_paramIndex, endianType); + MCore::Endian::ConvertUnsignedInt32(&fileEvent.m_mirrorTypeIndex, endianType); + MCore::Endian::ConvertFloat(&fileEvent.m_startTime, endianType); + MCore::Endian::ConvertFloat(&fileEvent.m_endTime, endianType); // print motion event information if (GetLogging()) { - MCore::LogDetailedInfo(" [%d] StartTime = %f - EndTime = %f - Type = '%s' - Param = '%s' - Mirror = '%s'", i, fileEvent.mStartTime, fileEvent.mEndTime, typeStrings[fileEvent.mEventTypeIndex].c_str(), paramStrings[fileEvent.mParamIndex].c_str(), mirrorTypeStrings[fileEvent.mMirrorTypeIndex].c_str()); + MCore::LogDetailedInfo(" [%d] StartTime = %f - EndTime = %f - Type = '%s' - Param = '%s' - Mirror = '%s'", i, fileEvent.m_startTime, fileEvent.m_endTime, typeStrings[fileEvent.m_eventTypeIndex].c_str(), paramStrings[fileEvent.m_paramIndex].c_str(), mirrorTypeStrings[fileEvent.m_mirrorTypeIndex].c_str()); } - const AZStd::string eventTypeName = fileEvent.mEventTypeIndex != MCORE_INVALIDINDEX32 ? - typeStrings[fileEvent.mEventTypeIndex] : ""; - const AZStd::string mirrorTypeName = fileEvent.mMirrorTypeIndex != MCORE_INVALIDINDEX32 ? - mirrorTypeStrings[fileEvent.mMirrorTypeIndex] : ""; - const AZStd::string params = paramStrings[fileEvent.mParamIndex]; + const AZStd::string eventTypeName = fileEvent.m_eventTypeIndex != MCORE_INVALIDINDEX32 ? + typeStrings[fileEvent.m_eventTypeIndex] : ""; + const AZStd::string mirrorTypeName = fileEvent.m_mirrorTypeIndex != MCORE_INVALIDINDEX32 ? + mirrorTypeStrings[fileEvent.m_mirrorTypeIndex] : ""; + const AZStd::string params = paramStrings[fileEvent.m_paramIndex]; // add the event track->AddEvent( - fileEvent.mStartTime, - fileEvent.mEndTime, + fileEvent.m_startTime, + fileEvent.m_endTime, GetEventManager().FindOrCreateEventData(eventTypeName, params, mirrorTypeName) ); } @@ -1032,7 +1026,7 @@ namespace EMotionFX bool ChunkProcessorMotionEventTrackTable2::Process(MCore::File* file, Importer::ImportParameters& importParams) { - Motion* motion = importParams.mMotion; + Motion* motion = importParams.m_motion; MCORE_ASSERT(motion); @@ -1071,7 +1065,7 @@ namespace EMotionFX bool ChunkProcessorMotionEventTrackTable3::Process(MCore::File* file, Importer::ImportParameters& importParams) { - Motion* motion = importParams.mMotion; + Motion* motion = importParams.m_motion; MCORE_ASSERT(motion); FileFormat::FileMotionEventTableSerialized fileEventTable; @@ -1122,8 +1116,8 @@ namespace EMotionFX bool ChunkProcessorActorInfo::Process(MCore::File* file, Importer::ImportParameters& importParams) { - const MCore::Endian::EEndianType endianType = importParams.mEndianType; - Actor* actor = importParams.mActor; + const MCore::Endian::EEndianType endianType = importParams.m_endianType; + Actor* actor = importParams.m_actor; MCORE_ASSERT(actor); @@ -1132,10 +1126,10 @@ namespace EMotionFX file->Read(&fileInformation, sizeof(FileFormat::Actor_Info)); // convert endian - MCore::Endian::ConvertUnsignedInt32(&fileInformation.mMotionExtractionNodeIndex, endianType); - MCore::Endian::ConvertUnsignedInt32(&fileInformation.mTrajectoryNodeIndex, endianType); - MCore::Endian::ConvertUnsignedInt32(&fileInformation.mNumLODs, endianType); - MCore::Endian::ConvertFloat(&fileInformation.mRetargetRootOffset, endianType); + MCore::Endian::ConvertUnsignedInt32(&fileInformation.m_motionExtractionNodeIndex, endianType); + MCore::Endian::ConvertUnsignedInt32(&fileInformation.m_trajectoryNodeIndex, endianType); + MCore::Endian::ConvertUnsignedInt32(&fileInformation.m_numLoDs, endianType); + MCore::Endian::ConvertFloat(&fileInformation.m_retargetRootOffset, endianType); if (GetLogging()) { @@ -1143,11 +1137,11 @@ namespace EMotionFX } // read the source application, original filename and the compilation date of the exporter string - SharedHelperData::ReadString(file, importParams.mSharedData, endianType); - SharedHelperData::ReadString(file, importParams.mSharedData, endianType); - SharedHelperData::ReadString(file, importParams.mSharedData, endianType); + SharedHelperData::ReadString(file, importParams.m_sharedData, endianType); + SharedHelperData::ReadString(file, importParams.m_sharedData, endianType); + SharedHelperData::ReadString(file, importParams.m_sharedData, endianType); - const char* name = SharedHelperData::ReadString(file, importParams.mSharedData, endianType); + const char* name = SharedHelperData::ReadString(file, importParams.m_sharedData, endianType); actor->SetName(name); if (GetLogging()) { @@ -1157,20 +1151,19 @@ namespace EMotionFX // print motion event information if (GetLogging()) { - MCore::LogDetailedInfo(" + Exporter version = v%d.%d", fileInformation.mExporterHighVersion, fileInformation.mExporterLowVersion); - MCore::LogDetailedInfo(" + Num LODs = %d", fileInformation.mNumLODs); - MCore::LogDetailedInfo(" + Motion Extraction node = %d", fileInformation.mMotionExtractionNodeIndex); - MCore::LogDetailedInfo(" + Retarget root offset = %f", fileInformation.mRetargetRootOffset); - MCore::LogDetailedInfo(" + UnitType = %d", fileInformation.mUnitType); + MCore::LogDetailedInfo(" + Exporter version = v%d.%d", fileInformation.m_exporterHighVersion, fileInformation.m_exporterLowVersion); + MCore::LogDetailedInfo(" + Num LODs = %d", fileInformation.m_numLoDs); + MCore::LogDetailedInfo(" + Motion Extraction node = %d", fileInformation.m_motionExtractionNodeIndex); + MCore::LogDetailedInfo(" + Retarget root offset = %f", fileInformation.m_retargetRootOffset); + MCore::LogDetailedInfo(" + UnitType = %d", fileInformation.m_unitType); } - actor->SetMotionExtractionNodeIndex(fileInformation.mMotionExtractionNodeIndex); - if (fileInformation.mMotionExtractionNodeIndex != MCORE_INVALIDINDEX32) + actor->SetMotionExtractionNodeIndex(fileInformation.m_motionExtractionNodeIndex); + if (fileInformation.m_motionExtractionNodeIndex != MCORE_INVALIDINDEX32) { - actor->SetMotionExtractionNodeIndex(fileInformation.mMotionExtractionNodeIndex); + actor->SetMotionExtractionNodeIndex(fileInformation.m_motionExtractionNodeIndex); } - // actor->SetRetargetOffset( fileInformation.mRetargetRootOffset ); - actor->SetUnitType(static_cast(fileInformation.mUnitType)); + actor->SetUnitType(static_cast(fileInformation.m_unitType)); actor->SetFileUnitType(actor->GetUnitType()); return true; @@ -1180,17 +1173,17 @@ namespace EMotionFX bool ChunkProcessorActorInfo2::Process(MCore::File* file, Importer::ImportParameters& importParams) { - const MCore::Endian::EEndianType endianType = importParams.mEndianType; - Actor* actor = importParams.mActor; + const MCore::Endian::EEndianType endianType = importParams.m_endianType; + Actor* actor = importParams.m_actor; // read the chunk FileFormat::Actor_Info2 fileInformation; file->Read(&fileInformation, sizeof(FileFormat::Actor_Info2)); // convert endian - MCore::Endian::ConvertUnsignedInt32(&fileInformation.mMotionExtractionNodeIndex, endianType); - MCore::Endian::ConvertUnsignedInt32(&fileInformation.mRetargetRootNodeIndex, endianType); - MCore::Endian::ConvertUnsignedInt32(&fileInformation.mNumLODs, endianType); + MCore::Endian::ConvertUnsignedInt32(&fileInformation.m_motionExtractionNodeIndex, endianType); + MCore::Endian::ConvertUnsignedInt32(&fileInformation.m_retargetRootNodeIndex, endianType); + MCore::Endian::ConvertUnsignedInt32(&fileInformation.m_numLoDs, endianType); if (GetLogging()) { @@ -1198,32 +1191,32 @@ namespace EMotionFX } // read the source application, original filename and the compilation date of the exporter string - SharedHelperData::ReadString(file, importParams.mSharedData, endianType); - SharedHelperData::ReadString(file, importParams.mSharedData, endianType); - SharedHelperData::ReadString(file, importParams.mSharedData, endianType); + SharedHelperData::ReadString(file, importParams.m_sharedData, endianType); + SharedHelperData::ReadString(file, importParams.m_sharedData, endianType); + SharedHelperData::ReadString(file, importParams.m_sharedData, endianType); - const char* name = SharedHelperData::ReadString(file, importParams.mSharedData, endianType); + const char* name = SharedHelperData::ReadString(file, importParams.m_sharedData, endianType); actor->SetName(name); if (GetLogging()) { MCore::LogDetailedInfo(" + Actor name = '%s'", name); - MCore::LogDetailedInfo(" + Exporter version = v%d.%d", fileInformation.mExporterHighVersion, fileInformation.mExporterLowVersion); - MCore::LogDetailedInfo(" + Num LODs = %d", fileInformation.mNumLODs); - MCore::LogDetailedInfo(" + Motion Extraction node = %d", fileInformation.mMotionExtractionNodeIndex); - MCore::LogDetailedInfo(" + Retarget root node = %d", fileInformation.mRetargetRootNodeIndex); - MCore::LogDetailedInfo(" + UnitType = %d", fileInformation.mUnitType); + MCore::LogDetailedInfo(" + Exporter version = v%d.%d", fileInformation.m_exporterHighVersion, fileInformation.m_exporterLowVersion); + MCore::LogDetailedInfo(" + Num LODs = %d", fileInformation.m_numLoDs); + MCore::LogDetailedInfo(" + Motion Extraction node = %d", fileInformation.m_motionExtractionNodeIndex); + MCore::LogDetailedInfo(" + Retarget root node = %d", fileInformation.m_retargetRootNodeIndex); + MCore::LogDetailedInfo(" + UnitType = %d", fileInformation.m_unitType); } - if (fileInformation.mMotionExtractionNodeIndex != MCORE_INVALIDINDEX32) + if (fileInformation.m_motionExtractionNodeIndex != MCORE_INVALIDINDEX32) { - actor->SetMotionExtractionNodeIndex(fileInformation.mMotionExtractionNodeIndex); + actor->SetMotionExtractionNodeIndex(fileInformation.m_motionExtractionNodeIndex); } - if (fileInformation.mRetargetRootNodeIndex != MCORE_INVALIDINDEX32) + if (fileInformation.m_retargetRootNodeIndex != MCORE_INVALIDINDEX32) { - actor->SetRetargetRootNodeIndex(fileInformation.mRetargetRootNodeIndex); + actor->SetRetargetRootNodeIndex(fileInformation.m_retargetRootNodeIndex); } - actor->SetUnitType(static_cast(fileInformation.mUnitType)); + actor->SetUnitType(static_cast(fileInformation.m_unitType)); actor->SetFileUnitType(actor->GetUnitType()); return true; @@ -1233,17 +1226,17 @@ namespace EMotionFX bool ChunkProcessorActorInfo3::Process(MCore::File* file, Importer::ImportParameters& importParams) { - const MCore::Endian::EEndianType endianType = importParams.mEndianType; - Actor* actor = importParams.mActor; + const MCore::Endian::EEndianType endianType = importParams.m_endianType; + Actor* actor = importParams.m_actor; // read the chunk FileFormat::Actor_Info3 fileInformation; file->Read(&fileInformation, sizeof(FileFormat::Actor_Info3)); // convert endian - MCore::Endian::ConvertUnsignedInt32(&fileInformation.mMotionExtractionNodeIndex, endianType); - MCore::Endian::ConvertUnsignedInt32(&fileInformation.mRetargetRootNodeIndex, endianType); - MCore::Endian::ConvertUnsignedInt32(&fileInformation.mNumLODs, endianType); + MCore::Endian::ConvertUnsignedInt32(&fileInformation.m_motionExtractionNodeIndex, endianType); + MCore::Endian::ConvertUnsignedInt32(&fileInformation.m_retargetRootNodeIndex, endianType); + MCore::Endian::ConvertUnsignedInt32(&fileInformation.m_numLoDs, endianType); if (GetLogging()) { @@ -1251,34 +1244,34 @@ namespace EMotionFX } // read the source application, original filename and the compilation date of the exporter string - SharedHelperData::ReadString(file, importParams.mSharedData, endianType); - SharedHelperData::ReadString(file, importParams.mSharedData, endianType); - SharedHelperData::ReadString(file, importParams.mSharedData, endianType); + SharedHelperData::ReadString(file, importParams.m_sharedData, endianType); + SharedHelperData::ReadString(file, importParams.m_sharedData, endianType); + SharedHelperData::ReadString(file, importParams.m_sharedData, endianType); - const char* name = SharedHelperData::ReadString(file, importParams.mSharedData, endianType); + const char* name = SharedHelperData::ReadString(file, importParams.m_sharedData, endianType); actor->SetName(name); if (GetLogging()) { MCore::LogDetailedInfo(" + Actor name = '%s'", name); - MCore::LogDetailedInfo(" + Exporter version = v%d.%d", fileInformation.mExporterHighVersion, fileInformation.mExporterLowVersion); - MCore::LogDetailedInfo(" + Num LODs = %d", fileInformation.mNumLODs); - MCore::LogDetailedInfo(" + Motion Extraction node = %d", fileInformation.mMotionExtractionNodeIndex); - MCore::LogDetailedInfo(" + Retarget root node = %d", fileInformation.mRetargetRootNodeIndex); - MCore::LogDetailedInfo(" + UnitType = %d", fileInformation.mUnitType); + MCore::LogDetailedInfo(" + Exporter version = v%d.%d", fileInformation.m_exporterHighVersion, fileInformation.m_exporterLowVersion); + MCore::LogDetailedInfo(" + Num LODs = %d", fileInformation.m_numLoDs); + MCore::LogDetailedInfo(" + Motion Extraction node = %d", fileInformation.m_motionExtractionNodeIndex); + MCore::LogDetailedInfo(" + Retarget root node = %d", fileInformation.m_retargetRootNodeIndex); + MCore::LogDetailedInfo(" + UnitType = %d", fileInformation.m_unitType); } - if (fileInformation.mMotionExtractionNodeIndex != MCORE_INVALIDINDEX32) + if (fileInformation.m_motionExtractionNodeIndex != MCORE_INVALIDINDEX32) { - actor->SetMotionExtractionNodeIndex(fileInformation.mMotionExtractionNodeIndex); + actor->SetMotionExtractionNodeIndex(fileInformation.m_motionExtractionNodeIndex); } - if (fileInformation.mRetargetRootNodeIndex != MCORE_INVALIDINDEX32) + if (fileInformation.m_retargetRootNodeIndex != MCORE_INVALIDINDEX32) { - actor->SetRetargetRootNodeIndex(fileInformation.mRetargetRootNodeIndex); + actor->SetRetargetRootNodeIndex(fileInformation.m_retargetRootNodeIndex); } - actor->SetUnitType(static_cast(fileInformation.mUnitType)); + actor->SetUnitType(static_cast(fileInformation.m_unitType)); actor->SetFileUnitType(actor->GetUnitType()); - actor->SetOptimizeSkeleton(fileInformation.mOptimizeSkeleton == 0? false : true); + actor->SetOptimizeSkeleton(fileInformation.m_optimizeSkeleton == 0? false : true); return true; } @@ -1288,8 +1281,8 @@ namespace EMotionFX // morph targets bool ChunkProcessorActorProgMorphTarget::Process(MCore::File* file, Importer::ImportParameters& importParams) { - const MCore::Endian::EEndianType endianType = importParams.mEndianType; - Actor* actor = importParams.mActor; + const MCore::Endian::EEndianType endianType = importParams.m_endianType; + Actor* actor = importParams.m_actor; MCORE_ASSERT(actor); Skeleton* skeleton = actor->GetSkeleton(); @@ -1299,27 +1292,27 @@ namespace EMotionFX file->Read(&morphTargetChunk, sizeof(FileFormat::Actor_MorphTarget)); // convert endian - MCore::Endian::ConvertFloat(&morphTargetChunk.mRangeMin, endianType); - MCore::Endian::ConvertFloat(&morphTargetChunk.mRangeMax, endianType); - MCore::Endian::ConvertUnsignedInt32(&morphTargetChunk.mLOD, endianType); - MCore::Endian::ConvertUnsignedInt32(&morphTargetChunk.mNumTransformations, endianType); - MCore::Endian::ConvertUnsignedInt32(&morphTargetChunk.mPhonemeSets, endianType); + MCore::Endian::ConvertFloat(&morphTargetChunk.m_rangeMin, endianType); + MCore::Endian::ConvertFloat(&morphTargetChunk.m_rangeMax, endianType); + MCore::Endian::ConvertUnsignedInt32(&morphTargetChunk.m_lod, endianType); + MCore::Endian::ConvertUnsignedInt32(&morphTargetChunk.m_numTransformations, endianType); + MCore::Endian::ConvertUnsignedInt32(&morphTargetChunk.m_phonemeSets, endianType); // get the expression name - const char* morphTargetName = SharedHelperData::ReadString(file, importParams.mSharedData, endianType); + const char* morphTargetName = SharedHelperData::ReadString(file, importParams.m_sharedData, endianType); // get the level of detail of the expression part - const uint32 morphTargetLOD = morphTargetChunk.mLOD; + const uint32 morphTargetLOD = morphTargetChunk.m_lod; if (GetLogging()) { MCore::LogDetailedInfo(" - Morph Target:"); MCore::LogDetailedInfo(" + Name = '%s'", morphTargetName); - MCore::LogDetailedInfo(" + LOD Level = %d", morphTargetChunk.mLOD); - MCore::LogDetailedInfo(" + RangeMin = %f", morphTargetChunk.mRangeMin); - MCore::LogDetailedInfo(" + RangeMax = %f", morphTargetChunk.mRangeMax); - MCore::LogDetailedInfo(" + NumTransformations = %d", morphTargetChunk.mNumTransformations); - MCore::LogDetailedInfo(" + PhonemeSets: %s", MorphTarget::GetPhonemeSetString((MorphTarget::EPhonemeSet)morphTargetChunk.mPhonemeSets).c_str()); + MCore::LogDetailedInfo(" + LOD Level = %d", morphTargetChunk.m_lod); + MCore::LogDetailedInfo(" + RangeMin = %f", morphTargetChunk.m_rangeMin); + MCore::LogDetailedInfo(" + RangeMax = %f", morphTargetChunk.m_rangeMax); + MCore::LogDetailedInfo(" + NumTransformations = %d", morphTargetChunk.m_numTransformations); + MCore::LogDetailedInfo(" + PhonemeSets: %s", MorphTarget::GetPhonemeSetString((MorphTarget::EPhonemeSet)morphTargetChunk.m_phonemeSets).c_str()); } // check if the morph setup has already been created, if not create it @@ -1336,59 +1329,59 @@ namespace EMotionFX MorphTargetStandard* morphTarget = MorphTargetStandard::Create(morphTargetName); // set the slider range - morphTarget->SetRangeMin(morphTargetChunk.mRangeMin); - morphTarget->SetRangeMax(morphTargetChunk.mRangeMax); + morphTarget->SetRangeMin(morphTargetChunk.m_rangeMin); + morphTarget->SetRangeMax(morphTargetChunk.m_rangeMax); // set the phoneme sets - morphTarget->SetPhonemeSets((MorphTarget::EPhonemeSet)morphTargetChunk.mPhonemeSets); + morphTarget->SetPhonemeSets((MorphTarget::EPhonemeSet)morphTargetChunk.m_phonemeSets); // add the morph target actor->GetMorphSetup(morphTargetLOD)->AddMorphTarget(morphTarget); // read the facial transformations - for (uint32 i = 0; i < morphTargetChunk.mNumTransformations; ++i) + for (uint32 i = 0; i < morphTargetChunk.m_numTransformations; ++i) { // read the facial transformation from disk FileFormat::Actor_MorphTargetTransform transformChunk; file->Read(&transformChunk, sizeof(FileFormat::Actor_MorphTargetTransform)); // create Core objects from the data - AZ::Vector3 pos(transformChunk.mPosition.mX, transformChunk.mPosition.mY, transformChunk.mPosition.mZ); - AZ::Vector3 scale(transformChunk.mScale.mX, transformChunk.mScale.mY, transformChunk.mScale.mZ); - AZ::Quaternion rot(transformChunk.mRotation.mX, transformChunk.mRotation.mY, transformChunk.mRotation.mZ, transformChunk.mRotation.mW); - AZ::Quaternion scaleRot(transformChunk.mScaleRotation.mX, transformChunk.mScaleRotation.mY, transformChunk.mScaleRotation.mZ, transformChunk.mScaleRotation.mW); + AZ::Vector3 pos(transformChunk.m_position.m_x, transformChunk.m_position.m_y, transformChunk.m_position.m_z); + AZ::Vector3 scale(transformChunk.m_scale.m_x, transformChunk.m_scale.m_y, transformChunk.m_scale.m_z); + AZ::Quaternion rot(transformChunk.m_rotation.m_x, transformChunk.m_rotation.m_y, transformChunk.m_rotation.m_z, transformChunk.m_rotation.m_w); + AZ::Quaternion scaleRot(transformChunk.m_scaleRotation.m_x, transformChunk.m_scaleRotation.m_y, transformChunk.m_scaleRotation.m_z, transformChunk.m_scaleRotation.m_w); // convert endian and coordinate system ConvertVector3(&pos, endianType); ConvertScale(&scale, endianType); ConvertQuaternion(&rot, endianType); ConvertQuaternion(&scaleRot, endianType); - MCore::Endian::ConvertUnsignedInt32(&transformChunk.mNodeIndex, endianType); + MCore::Endian::ConvertUnsignedInt32(&transformChunk.m_nodeIndex, endianType); // create our transformation MorphTargetStandard::Transformation transform; - transform.mPosition = pos; - transform.mScale = scale; - transform.mRotation = rot; - transform.mScaleRotation = scaleRot; - transform.mNodeIndex = transformChunk.mNodeIndex; + transform.m_position = pos; + transform.m_scale = scale; + transform.m_rotation = rot; + transform.m_scaleRotation = scaleRot; + transform.m_nodeIndex = transformChunk.m_nodeIndex; if (GetLogging()) { - MCore::LogDetailedInfo(" - Transform #%d: Node='%s' (index=%d)", i, skeleton->GetNode(transform.mNodeIndex)->GetName(), transform.mNodeIndex); + MCore::LogDetailedInfo(" - Transform #%d: Node='%s' (index=%d)", i, skeleton->GetNode(transform.m_nodeIndex)->GetName(), transform.m_nodeIndex); MCore::LogDetailedInfo(" + Pos: %f, %f, %f", - static_cast(transform.mPosition.GetX()), - static_cast(transform.mPosition.GetY()), - static_cast(transform.mPosition.GetZ())); + static_cast(transform.m_position.GetX()), + static_cast(transform.m_position.GetY()), + static_cast(transform.m_position.GetZ())); MCore::LogDetailedInfo(" + Rotation: %f, %f, %f %f", - static_cast(transform.mRotation.GetX()), - static_cast(transform.mRotation.GetY()), - static_cast(transform.mRotation.GetZ()), - static_cast(transform.mRotation.GetW())); + static_cast(transform.m_rotation.GetX()), + static_cast(transform.m_rotation.GetY()), + static_cast(transform.m_rotation.GetZ()), + static_cast(transform.m_rotation.GetW())); MCore::LogDetailedInfo(" + Scale: %f, %f, %f", - static_cast(transform.mScale.GetX()), - static_cast(transform.mScale.GetY()), - static_cast(transform.mScale.GetZ())); + static_cast(transform.m_scale.GetX()), + static_cast(transform.m_scale.GetY()), + static_cast(transform.m_scale.GetZ())); MCore::LogDetailedInfo(" + ScaleRot: %f, %f, %f %f", static_cast(scaleRot.GetX()), static_cast(scaleRot.GetY()), @@ -1408,8 +1401,8 @@ namespace EMotionFX // the node groups chunk bool ChunkProcessorActorNodeGroups::Process(MCore::File* file, Importer::ImportParameters& importParams) { - const MCore::Endian::EEndianType endianType = importParams.mEndianType; - Actor* actor = importParams.mActor; + const MCore::Endian::EEndianType endianType = importParams.m_endianType; + Actor* actor = importParams.m_actor; MCORE_ASSERT(actor); @@ -1429,25 +1422,25 @@ namespace EMotionFX // read the group header FileFormat::Actor_NodeGroup fileGroup; file->Read(&fileGroup, sizeof(FileFormat::Actor_NodeGroup)); - MCore::Endian::ConvertUnsignedInt16(&fileGroup.mNumNodes, endianType); + MCore::Endian::ConvertUnsignedInt16(&fileGroup.m_numNodes, endianType); // read the group name - const char* groupName = SharedHelperData::ReadString(file, importParams.mSharedData, endianType); + const char* groupName = SharedHelperData::ReadString(file, importParams.m_sharedData, endianType); // log some info if (GetLogging()) { MCore::LogDetailedInfo(" + Group '%s'", groupName); - MCore::LogDetailedInfo(" - Num nodes: %d", fileGroup.mNumNodes); - MCore::LogDetailedInfo(" - Disabled on default: %s", fileGroup.mDisabledOnDefault ? "Yes" : "No"); + MCore::LogDetailedInfo(" - Num nodes: %d", fileGroup.m_numNodes); + MCore::LogDetailedInfo(" - Disabled on default: %s", fileGroup.m_disabledOnDefault ? "Yes" : "No"); } // create the new group inside the actor - NodeGroup* newGroup = aznew NodeGroup(groupName, fileGroup.mNumNodes, fileGroup.mDisabledOnDefault ? false : true); + NodeGroup* newGroup = aznew NodeGroup(groupName, fileGroup.m_numNodes, fileGroup.m_disabledOnDefault ? false : true); // read the node numbers uint16 nodeIndex; - for (uint16 n = 0; n < fileGroup.mNumNodes; ++n) + for (uint16 n = 0; n < fileGroup.m_numNodes; ++n) { file->Read(&nodeIndex, sizeof(uint16)); MCore::Endian::ConvertUnsignedInt16(&nodeIndex, endianType); @@ -1465,8 +1458,8 @@ namespace EMotionFX // all submotions in one chunk bool ChunkProcessorMotionMorphSubMotions::Process(MCore::File* file, Importer::ImportParameters& importParams) { - const MCore::Endian::EEndianType endianType = importParams.mEndianType; - Motion* motion = importParams.mMotion; + const MCore::Endian::EEndianType endianType = importParams.m_endianType; + Motion* motion = importParams.m_motion; AZ_Assert(motion, "Expecting a valid motion pointer."); // cast to morph motion @@ -1478,54 +1471,54 @@ namespace EMotionFX file->Read(&subMotionsHeader, sizeof(FileFormat::Motion_MorphSubMotions)); // convert endian - MCore::Endian::ConvertUnsignedInt32(&subMotionsHeader.mNumSubMotions, endianType); + MCore::Endian::ConvertUnsignedInt32(&subMotionsHeader.m_numSubMotions, endianType); // pre-allocate the number of submotions motionData->SetAdditive(importParams.m_additiveMotion); - motionData->Resize(motionData->GetNumJoints(), subMotionsHeader.mNumSubMotions, motionData->GetNumFloats()); + motionData->Resize(motionData->GetNumJoints(), subMotionsHeader.m_numSubMotions, motionData->GetNumFloats()); // for all submotions - for (uint32 s = 0; s < subMotionsHeader.mNumSubMotions; ++s) + for (uint32 s = 0; s < subMotionsHeader.m_numSubMotions; ++s) { // get the morph motion part FileFormat::Motion_MorphSubMotion morphSubMotionChunk; file->Read(&morphSubMotionChunk, sizeof(FileFormat::Motion_MorphSubMotion)); // convert endian - MCore::Endian::ConvertUnsignedInt32(&morphSubMotionChunk.mNumKeys, endianType); - MCore::Endian::ConvertUnsignedInt32(&morphSubMotionChunk.mPhonemeSet, endianType); - MCore::Endian::ConvertFloat(&morphSubMotionChunk.mPoseWeight, endianType); - MCore::Endian::ConvertFloat(&morphSubMotionChunk.mMinWeight, endianType); - MCore::Endian::ConvertFloat(&morphSubMotionChunk.mMaxWeight, endianType); + MCore::Endian::ConvertUnsignedInt32(&morphSubMotionChunk.m_numKeys, endianType); + MCore::Endian::ConvertUnsignedInt32(&morphSubMotionChunk.m_phonemeSet, endianType); + MCore::Endian::ConvertFloat(&morphSubMotionChunk.m_poseWeight, endianType); + MCore::Endian::ConvertFloat(&morphSubMotionChunk.m_minWeight, endianType); + MCore::Endian::ConvertFloat(&morphSubMotionChunk.m_maxWeight, endianType); // read the name of the submotion - const char* name = SharedHelperData::ReadString(file, importParams.mSharedData, endianType); + const char* name = SharedHelperData::ReadString(file, importParams.m_sharedData, endianType); motionData->SetMorphName(s, name); - motionData->AllocateMorphSamples(s, morphSubMotionChunk.mNumKeys); - motionData->SetMorphStaticValue(s, morphSubMotionChunk.mPoseWeight); + motionData->AllocateMorphSamples(s, morphSubMotionChunk.m_numKeys); + motionData->SetMorphStaticValue(s, morphSubMotionChunk.m_poseWeight); if (GetLogging()) { MCore::LogDetailedInfo(" - Morph Submotion: %s", name); - MCore::LogDetailedInfo(" + NrKeys = %d", morphSubMotionChunk.mNumKeys); - MCore::LogDetailedInfo(" + Pose Weight = %f", morphSubMotionChunk.mPoseWeight); - MCore::LogDetailedInfo(" + Minimum Weight = %f", morphSubMotionChunk.mMinWeight); - MCore::LogDetailedInfo(" + Maximum Weight = %f", morphSubMotionChunk.mMaxWeight); - MCore::LogDetailedInfo(" + PhonemeSet = %s", MorphTarget::GetPhonemeSetString((MorphTarget::EPhonemeSet)morphSubMotionChunk.mPhonemeSet).c_str()); + MCore::LogDetailedInfo(" + NrKeys = %d", morphSubMotionChunk.m_numKeys); + MCore::LogDetailedInfo(" + Pose Weight = %f", morphSubMotionChunk.m_poseWeight); + MCore::LogDetailedInfo(" + Minimum Weight = %f", morphSubMotionChunk.m_minWeight); + MCore::LogDetailedInfo(" + Maximum Weight = %f", morphSubMotionChunk.m_maxWeight); + MCore::LogDetailedInfo(" + PhonemeSet = %s", MorphTarget::GetPhonemeSetString((MorphTarget::EPhonemeSet)morphSubMotionChunk.m_phonemeSet).c_str()); } // add keyframes - for (uint32 i = 0; i < morphSubMotionChunk.mNumKeys; ++i) + for (uint32 i = 0; i < morphSubMotionChunk.m_numKeys; ++i) { FileFormat::Motion_UnsignedShortKey keyframeChunk; file->Read(&keyframeChunk, sizeof(FileFormat::Motion_UnsignedShortKey)); - MCore::Endian::ConvertFloat(&keyframeChunk.mTime, endianType); - MCore::Endian::ConvertUnsignedInt16(&keyframeChunk.mValue, endianType); + MCore::Endian::ConvertFloat(&keyframeChunk.m_time, endianType); + MCore::Endian::ConvertUnsignedInt16(&keyframeChunk.m_value, endianType); - const float value = keyframeChunk.mValue / static_cast(std::numeric_limits::max()); - motionData->SetMorphSample(s, i, {keyframeChunk.mTime, value}); + const float value = keyframeChunk.m_value / static_cast(std::numeric_limits::max()); + motionData->SetMorphSample(s, i, {keyframeChunk.m_time, value}); } } // for all submotions @@ -1539,8 +1532,8 @@ namespace EMotionFX // morph targets bool ChunkProcessorActorProgMorphTargets::Process(MCore::File* file, Importer::ImportParameters& importParams) { - const MCore::Endian::EEndianType endianType = importParams.mEndianType; - Actor* actor = importParams.mActor; + const MCore::Endian::EEndianType endianType = importParams.m_endianType; + Actor* actor = importParams.m_actor; MCORE_ASSERT(actor); Skeleton* skeleton = actor->GetSkeleton(); @@ -1550,122 +1543,122 @@ namespace EMotionFX file->Read(&morphTargetsHeader, sizeof(FileFormat::Actor_MorphTargets)); // convert endian - MCore::Endian::ConvertUnsignedInt32(&morphTargetsHeader.mNumMorphTargets, endianType); - MCore::Endian::ConvertUnsignedInt32(&morphTargetsHeader.mLOD, endianType); + MCore::Endian::ConvertUnsignedInt32(&morphTargetsHeader.m_numMorphTargets, endianType); + MCore::Endian::ConvertUnsignedInt32(&morphTargetsHeader.m_lod, endianType); if (GetLogging()) { - MCore::LogDetailedInfo("- Morph targets: %d (LOD=%d)", morphTargetsHeader.mNumMorphTargets, morphTargetsHeader.mLOD); + MCore::LogDetailedInfo("- Morph targets: %d (LOD=%d)", morphTargetsHeader.m_numMorphTargets, morphTargetsHeader.m_lod); } // check if the morph setup has already been created, if not create it - if (actor->GetMorphSetup(morphTargetsHeader.mLOD) == nullptr) + if (actor->GetMorphSetup(morphTargetsHeader.m_lod) == nullptr) { // create the morph setup MorphSetup* morphSetup = MorphSetup::Create(); // set the morph setup - actor->SetMorphSetup(morphTargetsHeader.mLOD, morphSetup); + actor->SetMorphSetup(morphTargetsHeader.m_lod, morphSetup); } // pre-allocate the morph targets - MorphSetup* setup = actor->GetMorphSetup(morphTargetsHeader.mLOD); - setup->ReserveMorphTargets(morphTargetsHeader.mNumMorphTargets); + MorphSetup* setup = actor->GetMorphSetup(morphTargetsHeader.m_lod); + setup->ReserveMorphTargets(morphTargetsHeader.m_numMorphTargets); // read in all morph targets - for (uint32 mt = 0; mt < morphTargetsHeader.mNumMorphTargets; ++mt) + for (uint32 mt = 0; mt < morphTargetsHeader.m_numMorphTargets; ++mt) { // read the expression part from disk FileFormat::Actor_MorphTarget morphTargetChunk; file->Read(&morphTargetChunk, sizeof(FileFormat::Actor_MorphTarget)); // convert endian - MCore::Endian::ConvertFloat(&morphTargetChunk.mRangeMin, endianType); - MCore::Endian::ConvertFloat(&morphTargetChunk.mRangeMax, endianType); - MCore::Endian::ConvertUnsignedInt32(&morphTargetChunk.mLOD, endianType); - MCore::Endian::ConvertUnsignedInt32(&morphTargetChunk.mNumTransformations, endianType); - MCore::Endian::ConvertUnsignedInt32(&morphTargetChunk.mPhonemeSets, endianType); + MCore::Endian::ConvertFloat(&morphTargetChunk.m_rangeMin, endianType); + MCore::Endian::ConvertFloat(&morphTargetChunk.m_rangeMax, endianType); + MCore::Endian::ConvertUnsignedInt32(&morphTargetChunk.m_lod, endianType); + MCore::Endian::ConvertUnsignedInt32(&morphTargetChunk.m_numTransformations, endianType); + MCore::Endian::ConvertUnsignedInt32(&morphTargetChunk.m_phonemeSets, endianType); // make sure they match - MCORE_ASSERT(morphTargetChunk.mLOD == morphTargetsHeader.mLOD); + MCORE_ASSERT(morphTargetChunk.m_lod == morphTargetsHeader.m_lod); // get the expression name - const char* morphTargetName = SharedHelperData::ReadString(file, importParams.mSharedData, endianType); + const char* morphTargetName = SharedHelperData::ReadString(file, importParams.m_sharedData, endianType); // get the level of detail of the expression part - const uint32 morphTargetLOD = morphTargetChunk.mLOD; + const uint32 morphTargetLOD = morphTargetChunk.m_lod; if (GetLogging()) { MCore::LogDetailedInfo(" + Morph Target:"); MCore::LogDetailedInfo(" - Name = '%s'", morphTargetName); - MCore::LogDetailedInfo(" - LOD Level = %d", morphTargetChunk.mLOD); - MCore::LogDetailedInfo(" - RangeMin = %f", morphTargetChunk.mRangeMin); - MCore::LogDetailedInfo(" - RangeMax = %f", morphTargetChunk.mRangeMax); - MCore::LogDetailedInfo(" - NumTransformations = %d", morphTargetChunk.mNumTransformations); - MCore::LogDetailedInfo(" - PhonemeSets: %s", MorphTarget::GetPhonemeSetString((MorphTarget::EPhonemeSet)morphTargetChunk.mPhonemeSets).c_str()); + MCore::LogDetailedInfo(" - LOD Level = %d", morphTargetChunk.m_lod); + MCore::LogDetailedInfo(" - RangeMin = %f", morphTargetChunk.m_rangeMin); + MCore::LogDetailedInfo(" - RangeMax = %f", morphTargetChunk.m_rangeMax); + MCore::LogDetailedInfo(" - NumTransformations = %d", morphTargetChunk.m_numTransformations); + MCore::LogDetailedInfo(" - PhonemeSets: %s", MorphTarget::GetPhonemeSetString((MorphTarget::EPhonemeSet)morphTargetChunk.m_phonemeSets).c_str()); } // create the morph target MorphTargetStandard* morphTarget = MorphTargetStandard::Create(morphTargetName); // set the slider range - morphTarget->SetRangeMin(morphTargetChunk.mRangeMin); - morphTarget->SetRangeMax(morphTargetChunk.mRangeMax); + morphTarget->SetRangeMin(morphTargetChunk.m_rangeMin); + morphTarget->SetRangeMax(morphTargetChunk.m_rangeMax); // set the phoneme sets - morphTarget->SetPhonemeSets((MorphTarget::EPhonemeSet)morphTargetChunk.mPhonemeSets); + morphTarget->SetPhonemeSets((MorphTarget::EPhonemeSet)morphTargetChunk.m_phonemeSets); // add the morph target setup->AddMorphTarget(morphTarget); // the same for the transformations - morphTarget->ReserveTransformations(morphTargetChunk.mNumTransformations); + morphTarget->ReserveTransformations(morphTargetChunk.m_numTransformations); // read the facial transformations - for (uint32 i = 0; i < morphTargetChunk.mNumTransformations; ++i) + for (uint32 i = 0; i < morphTargetChunk.m_numTransformations; ++i) { // read the facial transformation from disk FileFormat::Actor_MorphTargetTransform transformChunk; file->Read(&transformChunk, sizeof(FileFormat::Actor_MorphTargetTransform)); // create Core objects from the data - AZ::Vector3 pos(transformChunk.mPosition.mX, transformChunk.mPosition.mY, transformChunk.mPosition.mZ); - AZ::Vector3 scale(transformChunk.mScale.mX, transformChunk.mScale.mY, transformChunk.mScale.mZ); - AZ::Quaternion rot(transformChunk.mRotation.mX, transformChunk.mRotation.mY, transformChunk.mRotation.mZ, transformChunk.mRotation.mW); - AZ::Quaternion scaleRot(transformChunk.mScaleRotation.mX, transformChunk.mScaleRotation.mY, transformChunk.mScaleRotation.mZ, transformChunk.mScaleRotation.mW); + AZ::Vector3 pos(transformChunk.m_position.m_x, transformChunk.m_position.m_y, transformChunk.m_position.m_z); + AZ::Vector3 scale(transformChunk.m_scale.m_x, transformChunk.m_scale.m_y, transformChunk.m_scale.m_z); + AZ::Quaternion rot(transformChunk.m_rotation.m_x, transformChunk.m_rotation.m_y, transformChunk.m_rotation.m_z, transformChunk.m_rotation.m_w); + AZ::Quaternion scaleRot(transformChunk.m_scaleRotation.m_x, transformChunk.m_scaleRotation.m_y, transformChunk.m_scaleRotation.m_z, transformChunk.m_scaleRotation.m_w); // convert endian and coordinate system ConvertVector3(&pos, endianType); ConvertScale(&scale, endianType); ConvertQuaternion(&rot, endianType); ConvertQuaternion(&scaleRot, endianType); - MCore::Endian::ConvertUnsignedInt32(&transformChunk.mNodeIndex, endianType); + MCore::Endian::ConvertUnsignedInt32(&transformChunk.m_nodeIndex, endianType); // create our transformation MorphTargetStandard::Transformation transform; - transform.mPosition = pos; - transform.mScale = scale; - transform.mRotation = rot; - transform.mScaleRotation = scaleRot; - transform.mNodeIndex = transformChunk.mNodeIndex; + transform.m_position = pos; + transform.m_scale = scale; + transform.m_rotation = rot; + transform.m_scaleRotation = scaleRot; + transform.m_nodeIndex = transformChunk.m_nodeIndex; if (GetLogging()) { - MCore::LogDetailedInfo(" + Transform #%d: Node='%s' (index=%d)", i, skeleton->GetNode(transform.mNodeIndex)->GetName(), transform.mNodeIndex); + MCore::LogDetailedInfo(" + Transform #%d: Node='%s' (index=%d)", i, skeleton->GetNode(transform.m_nodeIndex)->GetName(), transform.m_nodeIndex); MCore::LogDetailedInfo(" - Pos: %f, %f, %f", - static_cast(transform.mPosition.GetX()), - static_cast(transform.mPosition.GetY()), - static_cast(transform.mPosition.GetZ())); + static_cast(transform.m_position.GetX()), + static_cast(transform.m_position.GetY()), + static_cast(transform.m_position.GetZ())); MCore::LogDetailedInfo(" - Rotation: %f, %f, %f %f", - static_cast(transform.mRotation.GetX()), - static_cast(transform.mRotation.GetY()), - static_cast(transform.mRotation.GetZ()), - static_cast(transform.mRotation.GetW())); + static_cast(transform.m_rotation.GetX()), + static_cast(transform.m_rotation.GetY()), + static_cast(transform.m_rotation.GetZ()), + static_cast(transform.m_rotation.GetW())); MCore::LogDetailedInfo(" - Scale: %f, %f, %f", - static_cast(transform.mScale.GetX()), - static_cast(transform.mScale.GetY()), - static_cast(transform.mScale.GetZ())); + static_cast(transform.m_scale.GetX()), + static_cast(transform.m_scale.GetY()), + static_cast(transform.m_scale.GetZ())); MCore::LogDetailedInfo(" - ScaleRot: %f, %f, %f %f", static_cast(scaleRot.GetX()), static_cast(scaleRot.GetY()), @@ -1686,8 +1679,8 @@ namespace EMotionFX // morph targets bool ChunkProcessorActorProgMorphTargets2::Process(MCore::File* file, Importer::ImportParameters& importParams) { - const MCore::Endian::EEndianType endianType = importParams.mEndianType; - Actor* actor = importParams.mActor; + const MCore::Endian::EEndianType endianType = importParams.m_endianType; + Actor* actor = importParams.m_actor; MCORE_ASSERT(actor); Skeleton* skeleton = actor->GetSkeleton(); @@ -1697,122 +1690,122 @@ namespace EMotionFX file->Read(&morphTargetsHeader, sizeof(FileFormat::Actor_MorphTargets)); // convert endian - MCore::Endian::ConvertUnsignedInt32(&morphTargetsHeader.mNumMorphTargets, endianType); - MCore::Endian::ConvertUnsignedInt32(&morphTargetsHeader.mLOD, endianType); + MCore::Endian::ConvertUnsignedInt32(&morphTargetsHeader.m_numMorphTargets, endianType); + MCore::Endian::ConvertUnsignedInt32(&morphTargetsHeader.m_lod, endianType); if (GetLogging()) { - MCore::LogDetailedInfo("- Morph targets: %d (LOD=%d)", morphTargetsHeader.mNumMorphTargets, morphTargetsHeader.mLOD); + MCore::LogDetailedInfo("- Morph targets: %d (LOD=%d)", morphTargetsHeader.m_numMorphTargets, morphTargetsHeader.m_lod); } // check if the morph setup has already been created, if not create it - if (actor->GetMorphSetup(morphTargetsHeader.mLOD) == nullptr) + if (actor->GetMorphSetup(morphTargetsHeader.m_lod) == nullptr) { // create the morph setup MorphSetup* morphSetup = MorphSetup::Create(); // set the morph setup - actor->SetMorphSetup(morphTargetsHeader.mLOD, morphSetup); + actor->SetMorphSetup(morphTargetsHeader.m_lod, morphSetup); } // pre-allocate the morph targets - MorphSetup* setup = actor->GetMorphSetup(morphTargetsHeader.mLOD); - setup->ReserveMorphTargets(morphTargetsHeader.mNumMorphTargets); + MorphSetup* setup = actor->GetMorphSetup(morphTargetsHeader.m_lod); + setup->ReserveMorphTargets(morphTargetsHeader.m_numMorphTargets); // read in all morph targets - for (uint32 mt = 0; mt < morphTargetsHeader.mNumMorphTargets; ++mt) + for (uint32 mt = 0; mt < morphTargetsHeader.m_numMorphTargets; ++mt) { // read the expression part from disk FileFormat::Actor_MorphTarget morphTargetChunk; file->Read(&morphTargetChunk, sizeof(FileFormat::Actor_MorphTarget)); // convert endian - MCore::Endian::ConvertFloat(&morphTargetChunk.mRangeMin, endianType); - MCore::Endian::ConvertFloat(&morphTargetChunk.mRangeMax, endianType); - MCore::Endian::ConvertUnsignedInt32(&morphTargetChunk.mLOD, endianType); - MCore::Endian::ConvertUnsignedInt32(&morphTargetChunk.mNumTransformations, endianType); - MCore::Endian::ConvertUnsignedInt32(&morphTargetChunk.mPhonemeSets, endianType); + MCore::Endian::ConvertFloat(&morphTargetChunk.m_rangeMin, endianType); + MCore::Endian::ConvertFloat(&morphTargetChunk.m_rangeMax, endianType); + MCore::Endian::ConvertUnsignedInt32(&morphTargetChunk.m_lod, endianType); + MCore::Endian::ConvertUnsignedInt32(&morphTargetChunk.m_numTransformations, endianType); + MCore::Endian::ConvertUnsignedInt32(&morphTargetChunk.m_phonemeSets, endianType); // make sure they match - MCORE_ASSERT(morphTargetChunk.mLOD == morphTargetsHeader.mLOD); + MCORE_ASSERT(morphTargetChunk.m_lod == morphTargetsHeader.m_lod); // get the expression name - const char* morphTargetName = SharedHelperData::ReadString(file, importParams.mSharedData, endianType); + const char* morphTargetName = SharedHelperData::ReadString(file, importParams.m_sharedData, endianType); // get the level of detail of the expression part - const uint32 morphTargetLOD = morphTargetChunk.mLOD; + const uint32 morphTargetLOD = morphTargetChunk.m_lod; if (GetLogging()) { MCore::LogDetailedInfo(" + Morph Target:"); MCore::LogDetailedInfo(" - Name = '%s'", morphTargetName); - MCore::LogDetailedInfo(" - LOD Level = %d", morphTargetChunk.mLOD); - MCore::LogDetailedInfo(" - RangeMin = %f", morphTargetChunk.mRangeMin); - MCore::LogDetailedInfo(" - RangeMax = %f", morphTargetChunk.mRangeMax); - MCore::LogDetailedInfo(" - NumTransformations = %d", morphTargetChunk.mNumTransformations); - MCore::LogDetailedInfo(" - PhonemeSets: %s", MorphTarget::GetPhonemeSetString((MorphTarget::EPhonemeSet)morphTargetChunk.mPhonemeSets).c_str()); + MCore::LogDetailedInfo(" - LOD Level = %d", morphTargetChunk.m_lod); + MCore::LogDetailedInfo(" - RangeMin = %f", morphTargetChunk.m_rangeMin); + MCore::LogDetailedInfo(" - RangeMax = %f", morphTargetChunk.m_rangeMax); + MCore::LogDetailedInfo(" - NumTransformations = %d", morphTargetChunk.m_numTransformations); + MCore::LogDetailedInfo(" - PhonemeSets: %s", MorphTarget::GetPhonemeSetString((MorphTarget::EPhonemeSet)morphTargetChunk.m_phonemeSets).c_str()); } // create the morph target MorphTargetStandard* morphTarget = MorphTargetStandard::Create(morphTargetName); // set the slider range - morphTarget->SetRangeMin(morphTargetChunk.mRangeMin); - morphTarget->SetRangeMax(morphTargetChunk.mRangeMax); + morphTarget->SetRangeMin(morphTargetChunk.m_rangeMin); + morphTarget->SetRangeMax(morphTargetChunk.m_rangeMax); // set the phoneme sets - morphTarget->SetPhonemeSets((MorphTarget::EPhonemeSet)morphTargetChunk.mPhonemeSets); + morphTarget->SetPhonemeSets((MorphTarget::EPhonemeSet)morphTargetChunk.m_phonemeSets); // add the morph target setup->AddMorphTarget(morphTarget); // the same for the transformations - morphTarget->ReserveTransformations(morphTargetChunk.mNumTransformations); + morphTarget->ReserveTransformations(morphTargetChunk.m_numTransformations); // read the facial transformations - for (uint32 i = 0; i < morphTargetChunk.mNumTransformations; ++i) + for (uint32 i = 0; i < morphTargetChunk.m_numTransformations; ++i) { // read the facial transformation from disk FileFormat::Actor_MorphTargetTransform transformChunk; file->Read(&transformChunk, sizeof(FileFormat::Actor_MorphTargetTransform)); // create Core objects from the data - AZ::Vector3 pos(transformChunk.mPosition.mX, transformChunk.mPosition.mY, transformChunk.mPosition.mZ); - AZ::Vector3 scale(transformChunk.mScale.mX, transformChunk.mScale.mY, transformChunk.mScale.mZ); - AZ::Quaternion rot(transformChunk.mRotation.mX, transformChunk.mRotation.mY, transformChunk.mRotation.mZ, transformChunk.mRotation.mW); - AZ::Quaternion scaleRot(transformChunk.mScaleRotation.mX, transformChunk.mScaleRotation.mY, transformChunk.mScaleRotation.mZ, transformChunk.mScaleRotation.mW); + AZ::Vector3 pos(transformChunk.m_position.m_x, transformChunk.m_position.m_y, transformChunk.m_position.m_z); + AZ::Vector3 scale(transformChunk.m_scale.m_x, transformChunk.m_scale.m_y, transformChunk.m_scale.m_z); + AZ::Quaternion rot(transformChunk.m_rotation.m_x, transformChunk.m_rotation.m_y, transformChunk.m_rotation.m_z, transformChunk.m_rotation.m_w); + AZ::Quaternion scaleRot(transformChunk.m_scaleRotation.m_x, transformChunk.m_scaleRotation.m_y, transformChunk.m_scaleRotation.m_z, transformChunk.m_scaleRotation.m_w); // convert endian and coordinate system ConvertVector3(&pos, endianType); ConvertScale(&scale, endianType); ConvertQuaternion(&rot, endianType); ConvertQuaternion(&scaleRot, endianType); - MCore::Endian::ConvertUnsignedInt32(&transformChunk.mNodeIndex, endianType); + MCore::Endian::ConvertUnsignedInt32(&transformChunk.m_nodeIndex, endianType); // create our transformation MorphTargetStandard::Transformation transform; - transform.mPosition = pos; - transform.mScale = scale; - transform.mRotation = rot; - transform.mScaleRotation = scaleRot; - transform.mNodeIndex = transformChunk.mNodeIndex; + transform.m_position = pos; + transform.m_scale = scale; + transform.m_rotation = rot; + transform.m_scaleRotation = scaleRot; + transform.m_nodeIndex = transformChunk.m_nodeIndex; if (GetLogging()) { - MCore::LogDetailedInfo(" + Transform #%d: Node='%s' (index=%d)", i, skeleton->GetNode(transform.mNodeIndex)->GetName(), transform.mNodeIndex); + MCore::LogDetailedInfo(" + Transform #%d: Node='%s' (index=%d)", i, skeleton->GetNode(transform.m_nodeIndex)->GetName(), transform.m_nodeIndex); MCore::LogDetailedInfo(" - Pos: %f, %f, %f", - static_cast(transform.mPosition.GetX()), - static_cast(transform.mPosition.GetY()), - static_cast(transform.mPosition.GetZ())); + static_cast(transform.m_position.GetX()), + static_cast(transform.m_position.GetY()), + static_cast(transform.m_position.GetZ())); MCore::LogDetailedInfo(" - Rotation: %f, %f, %f %f", - static_cast(transform.mRotation.GetX()), - static_cast(transform.mRotation.GetY()), - static_cast(transform.mRotation.GetZ()), - static_cast(transform.mRotation.GetW())); + static_cast(transform.m_rotation.GetX()), + static_cast(transform.m_rotation.GetY()), + static_cast(transform.m_rotation.GetZ()), + static_cast(transform.m_rotation.GetW())); MCore::LogDetailedInfo(" - Scale: %f, %f, %f", - static_cast(transform.mScale.GetX()), - static_cast(transform.mScale.GetY()), - static_cast(transform.mScale.GetZ())); + static_cast(transform.m_scale.GetX()), + static_cast(transform.m_scale.GetY()), + static_cast(transform.m_scale.GetZ())); MCore::LogDetailedInfo(" - ScaleRot: %f, %f, %f %f", static_cast(scaleRot.GetX()), static_cast(scaleRot.GetY()), @@ -1834,8 +1827,8 @@ namespace EMotionFX // the node motion sources chunk bool ChunkProcessorActorNodeMotionSources::Process(MCore::File* file, Importer::ImportParameters& importParams) { - const MCore::Endian::EEndianType endianType = importParams.mEndianType; - Actor* actor = importParams.mActor; + const MCore::Endian::EEndianType endianType = importParams.m_endianType; + Actor* actor = importParams.m_actor; uint32 i; MCORE_ASSERT(actor); @@ -1846,8 +1839,8 @@ namespace EMotionFX file->Read(&nodeMotionSourcesChunk, sizeof(FileFormat::Actor_NodeMotionSources2)); // convert endian - MCore::Endian::ConvertUnsignedInt32(&nodeMotionSourcesChunk.mNumNodes, endianType); - const uint32 numNodes = nodeMotionSourcesChunk.mNumNodes; + MCore::Endian::ConvertUnsignedInt32(&nodeMotionSourcesChunk.m_numNodes, endianType); + const uint32 numNodes = nodeMotionSourcesChunk.m_numNodes; if (numNodes == 0) { return true; @@ -1864,7 +1857,7 @@ namespace EMotionFX uint16 sourceNode; file->Read(&sourceNode, sizeof(uint16)); MCore::Endian::ConvertUnsignedInt16(&sourceNode, endianType); - actor->GetNodeMirrorInfo(i).mSourceNode = sourceNode; + actor->GetNodeMirrorInfo(i).m_sourceNode = sourceNode; } // read all axes @@ -1872,7 +1865,7 @@ namespace EMotionFX { uint8 axis; file->Read(&axis, sizeof(uint8)); - actor->GetNodeMirrorInfo(i).mAxis = axis; + actor->GetNodeMirrorInfo(i).m_axis = axis; } // read all flags @@ -1880,7 +1873,7 @@ namespace EMotionFX { uint8 flags; file->Read(&flags, sizeof(uint8)); - actor->GetNodeMirrorInfo(i).mFlags = flags; + actor->GetNodeMirrorInfo(i).m_flags = flags; } // log details @@ -1889,9 +1882,9 @@ namespace EMotionFX MCore::LogDetailedInfo("- Node Motion Sources (%i):", numNodes); for (i = 0; i < numNodes; ++i) { - if (actor->GetNodeMirrorInfo(i).mSourceNode != MCORE_INVALIDINDEX16) + if (actor->GetNodeMirrorInfo(i).m_sourceNode != MCORE_INVALIDINDEX16) { - MCore::LogDetailedInfo(" + '%s' (%i) -> '%s' (%i) [axis=%d] [flags=%d]", skeleton->GetNode(i)->GetName(), i, skeleton->GetNode(actor->GetNodeMirrorInfo(i).mSourceNode)->GetName(), actor->GetNodeMirrorInfo(i).mSourceNode, actor->GetNodeMirrorInfo(i).mAxis, actor->GetNodeMirrorInfo(i).mFlags); + MCore::LogDetailedInfo(" + '%s' (%i) -> '%s' (%i) [axis=%d] [flags=%d]", skeleton->GetNode(i)->GetName(), i, skeleton->GetNode(actor->GetNodeMirrorInfo(i).m_sourceNode)->GetName(), actor->GetNodeMirrorInfo(i).m_sourceNode, actor->GetNodeMirrorInfo(i).m_axis, actor->GetNodeMirrorInfo(i).m_flags); } } } @@ -1904,8 +1897,8 @@ namespace EMotionFX bool ChunkProcessorActorAttachmentNodes::Process(MCore::File* file, Importer::ImportParameters& importParams) { - const MCore::Endian::EEndianType endianType = importParams.mEndianType; - Actor* actor = importParams.mActor; + const MCore::Endian::EEndianType endianType = importParams.m_endianType; + Actor* actor = importParams.m_actor; MCORE_ASSERT(actor); Skeleton* skeleton = actor->GetSkeleton(); @@ -1915,8 +1908,8 @@ namespace EMotionFX file->Read(&attachmentNodesChunk, sizeof(FileFormat::Actor_AttachmentNodes)); // convert endian - MCore::Endian::ConvertUnsignedInt32(&attachmentNodesChunk.mNumNodes, endianType); - const uint32 numAttachmentNodes = attachmentNodesChunk.mNumNodes; + MCore::Endian::ConvertUnsignedInt32(&attachmentNodesChunk.m_numNodes, endianType); + const uint32 numAttachmentNodes = attachmentNodesChunk.m_numNodes; // read all node attachment nodes for (uint32 i = 0; i < numAttachmentNodes; ++i) @@ -1963,35 +1956,35 @@ namespace EMotionFX // node map bool ChunkProcessorNodeMap::Process(MCore::File* file, Importer::ImportParameters& importParams) { - const MCore::Endian::EEndianType endianType = importParams.mEndianType; + const MCore::Endian::EEndianType endianType = importParams.m_endianType; // read the header FileFormat::NodeMapChunk nodeMapChunk; file->Read(&nodeMapChunk, sizeof(FileFormat::NodeMapChunk)); // convert endian - MCore::Endian::ConvertUnsignedInt32(&nodeMapChunk.mNumEntries, endianType); + MCore::Endian::ConvertUnsignedInt32(&nodeMapChunk.m_numEntries, endianType); // load the source actor filename string, but discard it - SharedHelperData::ReadString(file, importParams.mSharedData, endianType); + SharedHelperData::ReadString(file, importParams.m_sharedData, endianType); // log some info if (GetLogging()) { MCore::LogDetailedInfo("- Node Map:"); - MCore::LogDetailedInfo(" + Num entries = %d", nodeMapChunk.mNumEntries); + MCore::LogDetailedInfo(" + Num entries = %d", nodeMapChunk.m_numEntries); } // for all entries - const uint32 numEntries = nodeMapChunk.mNumEntries; - importParams.mNodeMap->Reserve(numEntries); + const uint32 numEntries = nodeMapChunk.m_numEntries; + importParams.m_nodeMap->Reserve(numEntries); AZStd::string firstName; AZStd::string secondName; for (uint32 i = 0; i < numEntries; ++i) { // read both names - firstName = SharedHelperData::ReadString(file, importParams.mSharedData, endianType); - secondName = SharedHelperData::ReadString(file, importParams.mSharedData, endianType); + firstName = SharedHelperData::ReadString(file, importParams.m_sharedData, endianType); + secondName = SharedHelperData::ReadString(file, importParams.m_sharedData, endianType); if (GetLogging()) { @@ -1999,9 +1992,9 @@ namespace EMotionFX } // create the entry - if (importParams.mNodeMapSettings->mLoadNodes) + if (importParams.m_nodeMapSettings->m_loadNodes) { - importParams.mNodeMap->AddEntry(firstName.c_str(), secondName.c_str()); + importParams.m_nodeMap->AddEntry(firstName.c_str(), secondName.c_str()); } } @@ -2019,12 +2012,12 @@ namespace EMotionFX { return false; } - MCore::Endian::ConvertUnsignedInt32(&dataHeader.m_sizeInBytes, importParams.mEndianType); - MCore::Endian::ConvertUnsignedInt32(&dataHeader.m_dataVersion, importParams.mEndianType); + MCore::Endian::ConvertUnsignedInt32(&dataHeader.m_sizeInBytes, importParams.m_endianType); + MCore::Endian::ConvertUnsignedInt32(&dataHeader.m_dataVersion, importParams.m_endianType); // Read the strings. - const AZStd::string uuidString = SharedHelperData::ReadString(file, importParams.mSharedData, importParams.mEndianType); - const AZStd::string className = SharedHelperData::ReadString(file, importParams.mSharedData, importParams.mEndianType); + const AZStd::string uuidString = SharedHelperData::ReadString(file, importParams.m_sharedData, importParams.m_endianType); + const AZStd::string className = SharedHelperData::ReadString(file, importParams.m_sharedData, importParams.m_endianType); // Create the motion data of this type. const AZ::Uuid uuid = AZ::Uuid::CreateString(uuidString.c_str(), uuidString.size()); @@ -2035,25 +2028,25 @@ namespace EMotionFX { AZ_Assert(false, "Unsupported motion data type '%s' using uuid '%s'", className.c_str(), uuidString.c_str()); motionData = aznew UniformMotionData(); // Create an empty dummy motion data, so we don't break things. - importParams.mMotion->SetMotionData(motionData); + importParams.m_motion->SetMotionData(motionData); file->Forward(dataHeader.m_sizeInBytes); return false; } // Read the data. MotionData::ReadSettings readSettings; - readSettings.m_sourceEndianType = importParams.mEndianType; + readSettings.m_sourceEndianType = importParams.m_endianType; readSettings.m_logDetails = GetLogging(); readSettings.m_version = dataHeader.m_dataVersion; if (!motionData->Read(file, readSettings)) { AZ_Error("EMotionFX", false, "Failed to load motion data of type '%s'", className.c_str()); motionData = aznew UniformMotionData(); // Create an empty dummy motion data, so we don't break things. - importParams.mMotion->SetMotionData(motionData); + importParams.m_motion->SetMotionData(motionData); return false; } - importParams.mMotion->SetMotionData(motionData); + importParams.m_motion->SetMotionData(motionData); return true; } diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/Importer/ChunkProcessors.h b/Gems/EMotionFX/Code/EMotionFX/Source/Importer/ChunkProcessors.h index 66a2193b71..4dc6d11acb 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/Importer/ChunkProcessors.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/Importer/ChunkProcessors.h @@ -97,11 +97,11 @@ namespace EMotionFX static const char* ReadString(MCore::Stream* file, AZStd::vector* sharedData, MCore::Endian::EEndianType endianType); public: - uint32 mFileHighVersion; /**< The high file version. For example 3 in case of v3.10. */ - uint32 mFileLowVersion; /**< The low file version. For example 10 in case of v3.10. */ - uint32 mStringStorageSize; /**< The size of the string buffer. */ - bool mIsUnicodeFile; /**< True in case strings in the file are saved using unicode character set, false in case they are saved using multi-byte. */ - char* mStringStorage; /**< The shared string buffer. */ + uint32 m_fileHighVersion; /**< The high file version. For example 3 in case of v3.10. */ + uint32 m_fileLowVersion; /**< The low file version. For example 10 in case of v3.10. */ + uint32 m_stringStorageSize; /**< The size of the string buffer. */ + bool m_isUnicodeFile; /**< True in case strings in the file are saved using unicode character set, false in case they are saved using multi-byte. */ + char* m_stringStorage; /**< The shared string buffer. */ protected: /** * The constructor. @@ -213,12 +213,12 @@ namespace EMotionFX // rmalize and make sure their w components are positive for (uint32 i = 0; i < count; ++i) { - if (value[i].mW < 0) + if (value[i].m_w < 0) { - value[i].mX = -value[i].mX; - value[i].mY = -value[i].mY; - value[i].mZ = -value[i].mZ; - value[i].mW = -value[i].mW; + value[i].m_x = -value[i].m_x; + value[i].m_y = -value[i].m_y; + value[i].m_z = -value[i].m_z; + value[i].m_w = -value[i].m_w; } } } @@ -238,9 +238,9 @@ namespace EMotionFX } protected: - uint32 mChunkID; /**< The id of the chunk processor. */ - uint32 mVersion; /**< The version number of the chunk processor, to provide backward compatibility. */ - bool mLoggingActive; /**< When set to true the processor chunk will log events, otherwise no logging will be performed. */ + uint32 m_chunkId; /**< The id of the chunk processor. */ + uint32 m_version; /**< The version number of the chunk processor, to provide backward compatibility. */ + bool m_loggingActive; /**< When set to true the processor chunk will log events, otherwise no logging will be performed. */ /** * The constructor. diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/Importer/Importer.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/Importer/Importer.cpp index e2cc633012..762fd29dcb 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/Importer/Importer.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/Importer/Importer.cpp @@ -51,8 +51,8 @@ namespace EMotionFX RegisterStandardChunks(); // init some default values - mLoggingActive = true; - mLogDetails = false; + m_loggingActive = true; + m_logDetails = false; } @@ -60,7 +60,7 @@ namespace EMotionFX Importer::~Importer() { // remove all chunk processors - for (ChunkProcessor* chunkProcessor : mChunkProcessors) + for (ChunkProcessor* chunkProcessor : m_chunkProcessors) { chunkProcessor->Destroy(); } @@ -88,13 +88,13 @@ namespace EMotionFX } // check the FOURCC - if (header.mFourcc[0] != 'A' || header.mFourcc[1] != 'C' || header.mFourcc[2] != 'T' || header.mFourcc[3] != 'R') + if (header.m_fourcc[0] != 'A' || header.m_fourcc[1] != 'C' || header.m_fourcc[2] != 'T' || header.m_fourcc[3] != 'R') { return false; } // read the chunks - switch (header.mEndianType) + switch (header.m_endianType) { case 0: *outEndianType = MCore::Endian::ENDIAN_LITTLE; @@ -103,7 +103,7 @@ namespace EMotionFX *outEndianType = MCore::Endian::ENDIAN_BIG; break; default: - MCore::LogError("Unsupported endian type used! (endian type = %d)", header.mEndianType); + MCore::LogError("Unsupported endian type used! (endian type = %d)", header.m_endianType); return false; } @@ -127,13 +127,13 @@ namespace EMotionFX } // check the FOURCC - if ((header.mFourcc[0] != 'M' || header.mFourcc[1] != 'O' || header.mFourcc[2] != 'T' || header.mFourcc[3] != ' ')) + if ((header.m_fourcc[0] != 'M' || header.m_fourcc[1] != 'O' || header.m_fourcc[2] != 'T' || header.m_fourcc[3] != ' ')) { return false; } // read the chunks - switch (header.mEndianType) + switch (header.m_endianType) { case 0: *outEndianType = MCore::Endian::ENDIAN_LITTLE; @@ -142,7 +142,7 @@ namespace EMotionFX *outEndianType = MCore::Endian::ENDIAN_BIG; break; default: - MCore::LogError("Unsupported endian type used! (endian type = %d)", header.mEndianType); + MCore::LogError("Unsupported endian type used! (endian type = %d)", header.m_endianType); return false; } @@ -164,13 +164,13 @@ namespace EMotionFX } // check the FOURCC - if (header.mFourCC[0] != 'N' || header.mFourCC[1] != 'O' || header.mFourCC[2] != 'M' || header.mFourCC[3] != 'P') + if (header.m_fourCc[0] != 'N' || header.m_fourCc[1] != 'O' || header.m_fourCc[2] != 'M' || header.m_fourCc[3] != 'P') { return false; } // read the chunks - switch (header.mEndianType) + switch (header.m_endianType) { case 0: *outEndianType = MCore::Endian::ENDIAN_LITTLE; @@ -179,7 +179,7 @@ namespace EMotionFX *outEndianType = MCore::Endian::ENDIAN_BIG; break; default: - MCore::LogError("Unsupported endian type used! (endian type = %d)", header.mEndianType); + MCore::LogError("Unsupported endian type used! (endian type = %d)", header.m_endianType); return false; } @@ -305,7 +305,7 @@ namespace EMotionFX actorSettings = *settings; } - if (actorSettings.mOptimizeForServer) + if (actorSettings.m_optimizeForServer) { actorSettings.OptimizeForServer(); } @@ -319,17 +319,17 @@ namespace EMotionFX if (actor) { - actor->SetThreadIndex(actorSettings.mThreadIndex); + actor->SetThreadIndex(actorSettings.m_threadIndex); // set the scale mode // actor->SetScaleMode( scaleMode ); // init the import parameters ImportParameters params; - params.mSharedData = &sharedData; - params.mEndianType = endianType; - params.mActorSettings = &actorSettings; - params.mActor = actor.get(); + params.m_sharedData = &sharedData; + params.m_endianType = endianType; + params.m_actorSettings = &actorSettings; + params.m_actor = actor.get(); // process all chunks while (ProcessChunk(f, params)) @@ -339,13 +339,13 @@ namespace EMotionFX actor->SetFileName(filename); // Generate an optimized version of skeleton for server. - if (actorSettings.mOptimizeForServer && actor->GetOptimizeSkeleton()) + if (actorSettings.m_optimizeForServer && actor->GetOptimizeSkeleton()) { actor->GenerateOptimizedSkeleton(); } // post create init - actor->PostCreateInit(actorSettings.mMakeGeomLODsCompatibleWithSkeletalLODs, actorSettings.mUnitTypeConvert); + actor->PostCreateInit(actorSettings.m_makeGeomLoDsCompatibleWithSkeletalLoDs, actorSettings.m_unitTypeConvert); } // close the file and return a pointer to the actor we loaded @@ -367,7 +367,7 @@ namespace EMotionFX EBUS_EVENT(AzFramework::ApplicationRequests::Bus, NormalizePathKeepCase, filename); // check if we want to load the motion even if a motion with the given filename is already inside the motion manager - if (settings == nullptr || (settings && settings->mForceLoading == false)) + if (settings == nullptr || (settings && settings->m_forceLoading == false)) { // search the motion inside the motion manager and return it if it already got loaded Motion* motion = GetMotionManager().FindMotionByFileName(filename.c_str()); @@ -481,10 +481,10 @@ namespace EMotionFX // init the import parameters ImportParameters params; - params.mSharedData = &sharedData; - params.mEndianType = endianType; - params.mMotionSettings = &motionSettings; - params.mMotion = motion; + params.m_sharedData = &sharedData; + params.m_endianType = endianType; + params.m_motionSettings = &motionSettings; + params.m_motion = motion; // read the chunks while (ProcessChunk(f, params)) @@ -495,7 +495,7 @@ namespace EMotionFX motion->GetEventTable()->AutoCreateSyncTrack(motion); // scale to the EMotion FX unit type - if (motionSettings.mUnitTypeConvert) + if (motionSettings.m_unitTypeConvert) { motion->ScaleToUnitType(GetEMotionFX().GetUnitType()); } @@ -671,7 +671,7 @@ namespace EMotionFX // load the file header FileFormat::NodeMap_Header fileHeader; f->Read(&fileHeader, sizeof(FileFormat::NodeMap_Header)); - if (fileHeader.mFourCC[0] != 'N' || fileHeader.mFourCC[1] != 'O' || fileHeader.mFourCC[2] != 'M' || fileHeader.mFourCC[3] != 'P') + if (fileHeader.m_fourCc[0] != 'N' || fileHeader.m_fourCc[1] != 'O' || fileHeader.m_fourCc[2] != 'M' || fileHeader.m_fourCc[3] != 'P') { MCore::LogError("The node map file is not a valid node map file."); f->Close(); @@ -679,17 +679,17 @@ namespace EMotionFX } // get the endian type - MCore::Endian::EEndianType endianType = (MCore::Endian::EEndianType)fileHeader.mEndianType; + MCore::Endian::EEndianType endianType = (MCore::Endian::EEndianType)fileHeader.m_endianType; // create the node map NodeMap* nodeMap = NodeMap::Create(); // init the import parameters ImportParameters params; - params.mSharedData = &sharedData; - params.mEndianType = endianType; - params.mNodeMap = nodeMap; - params.mNodeMapSettings = &nodeMapSettings; + params.m_sharedData = &sharedData; + params.m_endianType = endianType; + params.m_nodeMap = nodeMap; + params.m_nodeMapSettings = &nodeMapSettings; // process all chunks while (ProcessChunk(f, params)) @@ -713,7 +713,7 @@ namespace EMotionFX void Importer::RegisterChunkProcessor(ChunkProcessor* processorToRegister) { MCORE_ASSERT(processorToRegister); - mChunkProcessors.emplace_back(processorToRegister); + m_chunkProcessors.emplace_back(processorToRegister); } @@ -739,31 +739,31 @@ namespace EMotionFX void Importer::SetLoggingEnabled(bool enabled) { - mLoggingActive = enabled; + m_loggingActive = enabled; } bool Importer::GetLogging() const { - return mLoggingActive; + return m_loggingActive; } void Importer::SetLogDetails(bool detailLoggingActive) { - mLogDetails = detailLoggingActive; + m_logDetails = detailLoggingActive; // set the processors logging flag - for (ChunkProcessor* processor : mChunkProcessors) + for (ChunkProcessor* processor : m_chunkProcessors) { - processor->SetLogging(mLoggingActive && detailLoggingActive); // only enable if logging is also enabled + processor->SetLogging(m_loggingActive && detailLoggingActive); // only enable if logging is also enabled } } bool Importer::GetLogDetails() const { - return mLogDetails; + return m_logDetails; } @@ -790,11 +790,11 @@ namespace EMotionFX ChunkProcessor* Importer::FindChunk(uint32 chunkID, uint32 version) const { // for all chunk processors - const auto foundProcessor = AZStd::find_if(begin(mChunkProcessors), end(mChunkProcessors), [chunkID, version](const ChunkProcessor* processor) + const auto foundProcessor = AZStd::find_if(begin(m_chunkProcessors), end(m_chunkProcessors), [chunkID, version](const ChunkProcessor* processor) { return processor->GetChunkID() == chunkID && processor->GetVersion() == version; }); - return foundProcessor != end(mChunkProcessors) ? *foundProcessor : nullptr; + return foundProcessor != end(m_chunkProcessors) ? *foundProcessor : nullptr; } @@ -802,7 +802,7 @@ namespace EMotionFX void Importer::RegisterStandardChunks() { // reserve space for 75 chunk processors - mChunkProcessors.reserve(75); + m_chunkProcessors.reserve(75); // shared processors RegisterChunkProcessor(aznew ChunkProcessorMotionEventTrackTable()); @@ -853,40 +853,40 @@ namespace EMotionFX return false; // failed reading chunk } // convert endian - const MCore::Endian::EEndianType endianType = importParams.mEndianType; - MCore::Endian::ConvertUnsignedInt32(&chunk.mChunkID, endianType); - MCore::Endian::ConvertUnsignedInt32(&chunk.mSizeInBytes, endianType); - MCore::Endian::ConvertUnsignedInt32(&chunk.mVersion, endianType); + const MCore::Endian::EEndianType endianType = importParams.m_endianType; + MCore::Endian::ConvertUnsignedInt32(&chunk.m_chunkId, endianType); + MCore::Endian::ConvertUnsignedInt32(&chunk.m_sizeInBytes, endianType); + MCore::Endian::ConvertUnsignedInt32(&chunk.m_version, endianType); // try to find the chunk processor which can process this chunk - ChunkProcessor* processor = FindChunk(chunk.mChunkID, chunk.mVersion); + ChunkProcessor* processor = FindChunk(chunk.m_chunkId, chunk.m_version); // if we cannot find the chunk, skip the chunk if (processor == nullptr) { if (GetLogging()) { - MCore::LogError("Importer::ProcessChunk() - Unknown chunk (ID=%d Size=%d bytes Version=%d), skipping...", chunk.mChunkID, chunk.mSizeInBytes, chunk.mVersion); + MCore::LogError("Importer::ProcessChunk() - Unknown chunk (ID=%d Size=%d bytes Version=%d), skipping...", chunk.m_chunkId, chunk.m_sizeInBytes, chunk.m_version); } - file->Forward(chunk.mSizeInBytes); + file->Forward(chunk.m_sizeInBytes); return true; } // get some shortcuts - Importer::ActorSettings* actorSettings = importParams.mActorSettings; - Importer::MotionSettings* skelMotionSettings = importParams.mMotionSettings; + Importer::ActorSettings* actorSettings = importParams.m_actorSettings; + Importer::MotionSettings* skelMotionSettings = importParams.m_motionSettings; // check if we still want to skip the chunk or not bool mustSkip = false; // check if we specified to ignore this chunk - if (actorSettings && AZStd::find(begin(actorSettings->mChunkIDsToIgnore), end(actorSettings->mChunkIDsToIgnore), chunk.mChunkID) != end(actorSettings->mChunkIDsToIgnore)) + if (actorSettings && AZStd::find(begin(actorSettings->m_chunkIDsToIgnore), end(actorSettings->m_chunkIDsToIgnore), chunk.m_chunkId) != end(actorSettings->m_chunkIDsToIgnore)) { mustSkip = true; } - if (skelMotionSettings && AZStd::find(begin(skelMotionSettings->mChunkIDsToIgnore), end(skelMotionSettings->mChunkIDsToIgnore), chunk.mChunkID) != end(skelMotionSettings->mChunkIDsToIgnore)) + if (skelMotionSettings && AZStd::find(begin(skelMotionSettings->m_chunkIDsToIgnore), end(skelMotionSettings->m_chunkIDsToIgnore), chunk.m_chunkId) != end(skelMotionSettings->m_chunkIDsToIgnore)) { mustSkip = true; } @@ -897,10 +897,10 @@ namespace EMotionFX // if we're loading an actor if (actorSettings) { - if ((actorSettings->mLoadLimits == false && chunk.mChunkID == FileFormat::ACTOR_CHUNK_LIMIT) || - (actorSettings->mLoadMorphTargets == false && chunk.mChunkID == FileFormat::ACTOR_CHUNK_STDPROGMORPHTARGET) || - (actorSettings->mLoadMorphTargets == false && chunk.mChunkID == FileFormat::ACTOR_CHUNK_STDPMORPHTARGETS) || - (actorSettings->mLoadSimulatedObjects == false && chunk.mChunkID == FileFormat::ACTOR_CHUNK_SIMULATEDOBJECTSETUP)) + if ((actorSettings->m_loadLimits == false && chunk.m_chunkId == FileFormat::ACTOR_CHUNK_LIMIT) || + (actorSettings->m_loadMorphTargets == false && chunk.m_chunkId == FileFormat::ACTOR_CHUNK_STDPROGMORPHTARGET) || + (actorSettings->m_loadMorphTargets == false && chunk.m_chunkId == FileFormat::ACTOR_CHUNK_STDPMORPHTARGETS) || + (actorSettings->m_loadSimulatedObjects == false && chunk.m_chunkId == FileFormat::ACTOR_CHUNK_SIMULATEDOBJECTSETUP)) { mustSkip = true; } @@ -909,7 +909,7 @@ namespace EMotionFX // if we're loading a motion if (skelMotionSettings) { - if (skelMotionSettings->mLoadMotionEvents == false && chunk.mChunkID == FileFormat::MOTION_CHUNK_MOTIONEVENTTABLE) + if (skelMotionSettings->m_loadMotionEvents == false && chunk.m_chunkId == FileFormat::MOTION_CHUNK_MOTIONEVENTTABLE) { mustSkip = true; } @@ -919,7 +919,7 @@ namespace EMotionFX // if we want to skip this chunk if (mustSkip) { - file->Forward(chunk.mSizeInBytes); + file->Forward(chunk.m_sizeInBytes); return true; } @@ -932,28 +932,28 @@ namespace EMotionFX void Importer::ValidateActorSettings(ActorSettings* settings) { // After atom: Make sure we are not loading the tangents and bitangents - if (AZStd::find(begin(settings->mLayerIDsToIgnore), end(settings->mLayerIDsToIgnore), Mesh::ATTRIB_TANGENTS) == end(settings->mLayerIDsToIgnore)) + if (AZStd::find(begin(settings->m_layerIDsToIgnore), end(settings->m_layerIDsToIgnore), Mesh::ATTRIB_TANGENTS) == end(settings->m_layerIDsToIgnore)) { - settings->mLayerIDsToIgnore.emplace_back(Mesh::ATTRIB_TANGENTS); + settings->m_layerIDsToIgnore.emplace_back(Mesh::ATTRIB_TANGENTS); } - if (AZStd::find(begin(settings->mLayerIDsToIgnore), end(settings->mLayerIDsToIgnore), Mesh::ATTRIB_BITANGENTS) == end(settings->mLayerIDsToIgnore)) + if (AZStd::find(begin(settings->m_layerIDsToIgnore), end(settings->m_layerIDsToIgnore), Mesh::ATTRIB_BITANGENTS) == end(settings->m_layerIDsToIgnore)) { - settings->mLayerIDsToIgnore.emplace_back(Mesh::ATTRIB_BITANGENTS); + settings->m_layerIDsToIgnore.emplace_back(Mesh::ATTRIB_BITANGENTS); } // make sure we load at least the position and normals and org vertex numbers - if(const auto it = AZStd::find(begin(settings->mLayerIDsToIgnore), end(settings->mLayerIDsToIgnore), Mesh::ATTRIB_ORGVTXNUMBERS); it != end(settings->mLayerIDsToIgnore)) + if(const auto it = AZStd::find(begin(settings->m_layerIDsToIgnore), end(settings->m_layerIDsToIgnore), Mesh::ATTRIB_ORGVTXNUMBERS); it != end(settings->m_layerIDsToIgnore)) { - settings->mLayerIDsToIgnore.erase(it); + settings->m_layerIDsToIgnore.erase(it); } - if(const auto it = AZStd::find(begin(settings->mLayerIDsToIgnore), end(settings->mLayerIDsToIgnore), Mesh::ATTRIB_NORMALS); it != end(settings->mLayerIDsToIgnore)) + if(const auto it = AZStd::find(begin(settings->m_layerIDsToIgnore), end(settings->m_layerIDsToIgnore), Mesh::ATTRIB_NORMALS); it != end(settings->m_layerIDsToIgnore)) { - settings->mLayerIDsToIgnore.erase(it); + settings->m_layerIDsToIgnore.erase(it); } - if(const auto it = AZStd::find(begin(settings->mLayerIDsToIgnore), end(settings->mLayerIDsToIgnore), Mesh::ATTRIB_POSITIONS); it != end(settings->mLayerIDsToIgnore)) + if(const auto it = AZStd::find(begin(settings->m_layerIDsToIgnore), end(settings->m_layerIDsToIgnore), Mesh::ATTRIB_POSITIONS); it != end(settings->m_layerIDsToIgnore)) { - settings->mLayerIDsToIgnore.erase(it); + settings->m_layerIDsToIgnore.erase(it); } } @@ -1095,7 +1095,7 @@ namespace EMotionFX file.Close(); return false; } - outInfo->mEndianType = endianType; + outInfo->m_endianType = endianType; // as we seeked to the end of the header and we know the second chunk always is the time stamp, we can read this now FileFormat::FileChunk fileChunk; @@ -1104,8 +1104,8 @@ namespace EMotionFX file.Read(&timeChunk, sizeof(FileFormat::FileTime)); // convert endian - MCore::Endian::ConvertUnsignedInt32(&fileChunk.mChunkID, endianType); - MCore::Endian::ConvertUnsignedInt16(&timeChunk.mYear, endianType); + MCore::Endian::ConvertUnsignedInt32(&fileChunk.m_chunkId, endianType); + MCore::Endian::ConvertUnsignedInt16(&timeChunk.m_year, endianType); return true; } @@ -1128,7 +1128,7 @@ namespace EMotionFX file.Close(); return false; } - outInfo->mEndianType = endianType; + outInfo->m_endianType = endianType; // as we seeked to the end of the header and we know the second chunk always is the time stamp, we can read this now FileFormat::FileChunk fileChunk; @@ -1137,8 +1137,8 @@ namespace EMotionFX file.Read(&timeChunk, sizeof(FileFormat::FileTime)); // convert endian - MCore::Endian::ConvertUnsignedInt32(&fileChunk.mChunkID, endianType); - MCore::Endian::ConvertUnsignedInt16(&timeChunk.mYear, endianType); + MCore::Endian::ConvertUnsignedInt32(&fileChunk.m_chunkId, endianType); + MCore::Endian::ConvertUnsignedInt16(&timeChunk.m_year, endianType); return true; } diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/Importer/Importer.h b/Gems/EMotionFX/Code/EMotionFX/Source/Importer/Importer.h index a708e7f017..1a9fdf3654 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/Importer/Importer.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/Importer/Importer.h @@ -73,26 +73,26 @@ namespace EMotionFX */ struct EMFX_API ActorSettings { - bool mLoadLimits = true; /**< Set to false if you wish to disable loading of joint limits. */ - bool mLoadSkeletalLODs = true; /**< Set to false if you wish to disable loading of skeletal LOD levels. */ - bool mLoadMorphTargets = true; /**< Set to false if you wish to disable loading any morph targets. */ - bool mDualQuatSkinning = false; /**< Set to true if you wish to enable software skinning using dual quaternions. */ - bool mMakeGeomLODsCompatibleWithSkeletalLODs = false; /**< Set to true if you wish to disable the process that makes sure no skinning influences are mapped to disabled bones. Default is false. */ - bool mUnitTypeConvert = true; /**< Set to false to disable automatic unit type conversion (between cm, meters, etc). On default this is enabled. */ - bool mLoadSimulatedObjects = true; /**< Set to false if you wish to disable loading of simulated objects. */ - bool mOptimizeForServer = false; /**< Set to true if you witsh to optimize this actor to be used on server. */ - uint32 mThreadIndex = 0; - AZStd::vector mChunkIDsToIgnore; /**< Add chunk ID's to this array. Chunks with these ID's will not be processed. */ - AZStd::vector mLayerIDsToIgnore; /**< Add vertex attribute layer ID's to ignore. */ + bool m_loadLimits = true; /**< Set to false if you wish to disable loading of joint limits. */ + bool m_loadSkeletalLoDs = true; /**< Set to false if you wish to disable loading of skeletal LOD levels. */ + bool m_loadMorphTargets = true; /**< Set to false if you wish to disable loading any morph targets. */ + bool m_dualQuatSkinning = false; /**< Set to true if you wish to enable software skinning using dual quaternions. */ + bool m_makeGeomLoDsCompatibleWithSkeletalLoDs = false; /**< Set to true if you wish to disable the process that makes sure no skinning influences are mapped to disabled bones. Default is false. */ + bool m_unitTypeConvert = true; /**< Set to false to disable automatic unit type conversion (between cm, meters, etc). On default this is enabled. */ + bool m_loadSimulatedObjects = true; /**< Set to false if you wish to disable loading of simulated objects. */ + bool m_optimizeForServer = false; /**< Set to true if you witsh to optimize this actor to be used on server. */ + uint32 m_threadIndex = 0; + AZStd::vector m_chunkIDsToIgnore; /**< Add chunk ID's to this array. Chunks with these ID's will not be processed. */ + AZStd::vector m_layerIDsToIgnore; /**< Add vertex attribute layer ID's to ignore. */ /** * If the actor need to be optimized for server, will overwrite a few other actor settings. */ void OptimizeForServer() { - mLoadSkeletalLODs = false; - mLoadMorphTargets = false; - mLoadSimulatedObjects = false; + m_loadSkeletalLoDs = false; + m_loadMorphTargets = false; + m_loadSimulatedObjects = false; } }; @@ -102,10 +102,10 @@ namespace EMotionFX */ struct EMFX_API MotionSettings { - bool mForceLoading = false; /**< Set to true in case you want to load the motion even if a motion with the given filename is already inside the motion manager. */ - bool mLoadMotionEvents = true; /**< Set to false if you wish to disable loading of motion events. */ - bool mUnitTypeConvert = true; /**< Set to false to disable automatic unit type conversion (between cm, meters, etc). On default this is enabled. */ - AZStd::vector mChunkIDsToIgnore; /**< Add the ID's of the chunks you wish to ignore. */ + bool m_forceLoading = false; /**< Set to true in case you want to load the motion even if a motion with the given filename is already inside the motion manager. */ + bool m_loadMotionEvents = true; /**< Set to false if you wish to disable loading of motion events. */ + bool m_unitTypeConvert = true; /**< Set to false to disable automatic unit type conversion (between cm, meters, etc). On default this is enabled. */ + AZStd::vector m_chunkIDsToIgnore; /**< Add the ID's of the chunks you wish to ignore. */ }; /** @@ -123,21 +123,21 @@ namespace EMotionFX */ struct EMFX_API NodeMapSettings { - bool mAutoLoadSourceActor = true; /**< Should we automatically try to load the source actor? (default=true) */ - bool mLoadNodes = true; /**< Add nodes to the map? (default=true) */ + bool m_autoLoadSourceActor = true; /**< Should we automatically try to load the source actor? (default=true) */ + bool m_loadNodes = true; /**< Add nodes to the map? (default=true) */ }; struct EMFX_API ImportParameters { - Actor* mActor = nullptr; - Motion* mMotion = nullptr; - Importer::ActorSettings* mActorSettings = nullptr; - Importer::MotionSettings* mMotionSettings = nullptr; - AZStd::vector* mSharedData = nullptr; - MCore::Endian::EEndianType mEndianType = MCore::Endian::ENDIAN_LITTLE; + Actor* m_actor = nullptr; + Motion* m_motion = nullptr; + Importer::ActorSettings* m_actorSettings = nullptr; + Importer::MotionSettings* m_motionSettings = nullptr; + AZStd::vector* m_sharedData = nullptr; + MCore::Endian::EEndianType m_endianType = MCore::Endian::ENDIAN_LITTLE; - NodeMap* mNodeMap = nullptr; - Importer::NodeMapSettings* mNodeMapSettings = nullptr; + NodeMap* m_nodeMap = nullptr; + Importer::NodeMapSettings* m_nodeMapSettings = nullptr; bool m_isOwnedByRuntime = false; bool m_additiveMotion = false; }; @@ -159,7 +159,7 @@ namespace EMotionFX struct FileInfo { - MCore::Endian::EEndianType mEndianType; + MCore::Endian::EEndianType m_endianType; }; //------------------------------------------------------------------------------------------------- @@ -355,9 +355,9 @@ namespace EMotionFX private: - AZStd::vector mChunkProcessors; /**< The registered chunk processors. */ - bool mLoggingActive; /**< Contains if the importer should perform logging or not or not. */ - bool mLogDetails; /**< Contains if the importer should perform detail-logging or not. */ + AZStd::vector m_chunkProcessors; /**< The registered chunk processors. */ + bool m_loggingActive; /**< Contains if the importer should perform logging or not or not. */ + bool m_logDetails; /**< Contains if the importer should perform detail-logging or not. */ /** * The constructor. diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/Importer/MotionFileFormat.h b/Gems/EMotionFX/Code/EMotionFX/Source/Importer/MotionFileFormat.h index f947b8abf6..40dac39f98 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/Importer/MotionFileFormat.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/Importer/MotionFileFormat.h @@ -33,10 +33,10 @@ namespace EMotionFX // (not aligned) struct Motion_Header { - uint8 mFourcc[4]; // must be "MOT " or "MOTW" - uint8 mHiVersion; // high version (2 in case of v2.34) - uint8 mLoVersion; // low version (34 in case of v2.34) - uint8 mEndianType; // the endian in which the data is saved [0=little, 1=big] + uint8 m_fourcc[4]; // must be "MOT " or "MOTW" + uint8 m_hiVersion; // high version (2 in case of v2.34) + uint8 m_loVersion; // low version (34 in case of v2.34) + uint8 m_endianType; // the endian in which the data is saved [0=little, 1=big] }; struct Motion_MotionData @@ -53,49 +53,49 @@ namespace EMotionFX // (not aligned) struct Motion_Info { - uint32 mMotionExtractionMask; // motion extraction mask - uint32 mMotionExtractionNodeIndex; // motion extraction node index - uint8 mUnitType; // maps to EMotionFX::EUnitType + uint32 m_motionExtractionMask; // motion extraction mask + uint32 m_motionExtractionNodeIndex; // motion extraction node index + uint8 m_unitType; // maps to EMotionFX::EUnitType }; // information chunk // (not aligned) struct Motion_Info2 { - uint32 mMotionExtractionFlags; // motion extraction flags - uint32 mMotionExtractionNodeIndex; // motion extraction node index - uint8 mUnitType; // maps to EMotionFX::EUnitType + uint32 m_motionExtractionFlags; // motion extraction flags + uint32 m_motionExtractionNodeIndex; // motion extraction node index + uint8 m_unitType; // maps to EMotionFX::EUnitType }; // information chunk // (not aligned) struct Motion_Info3 { - uint32 mMotionExtractionFlags; // motion extraction flags - uint32 mMotionExtractionNodeIndex; // motion extraction node index - uint8 mUnitType; // maps to EMotionFX::EUnitType - uint8 mIsAdditive; // if the motion is an additive motion [0=false, 1=true] + uint32 m_motionExtractionFlags; // motion extraction flags + uint32 m_motionExtractionNodeIndex; // motion extraction node index + uint8 m_unitType; // maps to EMotionFX::EUnitType + uint8 m_isAdditive; // if the motion is an additive motion [0=false, 1=true] }; // skeletal submotion // (aligned) struct Motion_SkeletalSubMotion { - File16BitQuaternion mPoseRot; // initial pose rotation - File16BitQuaternion mBindPoseRot; // bind pose rotation - FileVector3 mPosePos; // initial pose position - FileVector3 mPoseScale; // initial pose scale - FileVector3 mBindPosePos; // bind pose position - FileVector3 mBindPoseScale; // bind pose scale - uint32 mNumPosKeys; // number of position keyframes to follow - uint32 mNumRotKeys; // number of rotation keyframes to follow - uint32 mNumScaleKeys; // number of scale keyframes to follow + File16BitQuaternion m_poseRot; // initial pose rotation + File16BitQuaternion m_bindPoseRot; // bind pose rotation + FileVector3 m_posePos; // initial pose position + FileVector3 m_poseScale; // initial pose scale + FileVector3 m_bindPosePos; // bind pose position + FileVector3 m_bindPoseScale; // bind pose scale + uint32 m_numPosKeys; // number of position keyframes to follow + uint32 m_numRotKeys; // number of rotation keyframes to follow + uint32 m_numScaleKeys; // number of scale keyframes to follow // followed by: // string : motion part name - // Motion_Vector3Key[ mNumPosKeys ] - // Motion_16BitQuaternionKey[ mNumRotKeys ] - // Motion_Vector3Key[ mNumScaleKeys ] + // Motion_Vector3Key[ m_numPosKeys ] + // Motion_16BitQuaternionKey[ m_numRotKeys ] + // Motion_Vector3Key[ m_numScaleKeys ] }; @@ -103,8 +103,8 @@ namespace EMotionFX // (aligned) struct Motion_Vector3Key { - FileVector3 mValue; // the value - float mTime; // the time in seconds + FileVector3 m_value; // the value + float m_time; // the time in seconds }; @@ -112,8 +112,8 @@ namespace EMotionFX // (aligned) struct Motion_QuaternionKey { - FileQuaternion mValue; // the value - float mTime; // the time in seconds + FileQuaternion m_value; // the value + float m_time; // the time in seconds }; @@ -121,8 +121,8 @@ namespace EMotionFX // (aligned) struct Motion_16BitQuaternionKey { - File16BitQuaternion mValue; // the value - float mTime; // the time in seconds + File16BitQuaternion m_value; // the value + float m_time; // the time in seconds }; @@ -130,25 +130,25 @@ namespace EMotionFX // (aligned) struct Motion_SubMotions { - uint32 mNumSubMotions;// the number of skeletal motions + uint32 m_numSubMotions;// the number of skeletal motions // followed by: - // Motion_SkeletalSubMotion[ mNumSubMotions ] + // Motion_SkeletalSubMotion[ m_numSubMotions ] }; // morph sub motion // (aligned) struct Motion_MorphSubMotion { - float mPoseWeight;// pose weight to use in case no animation data is present - float mMinWeight; // minimum allowed weight value (used for unpacking the keyframe weights) - float mMaxWeight; // maximum allowed weight value (used for unpacking the keyframe weights) - uint32 mPhonemeSet;// the phoneme set of the submotion, 0 if this is a normal morph target submotion - uint32 mNumKeys; // number of keyframes to follow + float m_poseWeight;// pose weight to use in case no animation data is present + float m_minWeight; // minimum allowed weight value (used for unpacking the keyframe weights) + float m_maxWeight; // maximum allowed weight value (used for unpacking the keyframe weights) + uint32 m_phonemeSet;// the phoneme set of the submotion, 0 if this is a normal morph target submotion + uint32 m_numKeys; // number of keyframes to follow // followed by: // string : name (the name of this motion part) - // Motion_UnsignedShortKey[mNumKeys] + // Motion_UnsignedShortKey[m_numKeys] }; @@ -156,17 +156,17 @@ namespace EMotionFX // (not aligned) struct Motion_UnsignedShortKey { - float mTime; // the time in seconds - uint16 mValue; // the value + float m_time; // the time in seconds + uint16 m_value; // the value }; // (aligned) struct Motion_MorphSubMotions { - uint32 mNumSubMotions; + uint32 m_numSubMotions; // followed by: - // Motion_MorphSubMotion[ mNumSubMotions ] + // Motion_MorphSubMotion[ m_numSubMotions ] }; @@ -174,11 +174,11 @@ namespace EMotionFX // (not aligned) struct FileMotionEvent { - float mStartTime; - float mEndTime; - uint32 mEventTypeIndex;// index into the event type string table - uint32 mMirrorTypeIndex;// index into the event type string table - uint16 mParamIndex; // index into the parameter string table + float m_startTime; + float m_endTime; + uint32 m_eventTypeIndex;// index into the event type string table + uint32 m_mirrorTypeIndex;// index into the event type string table + uint16 m_paramIndex; // index into the parameter string table }; @@ -186,18 +186,18 @@ namespace EMotionFX // (not aligned) struct FileMotionEventTrack { - uint32 mNumEvents; - uint32 mNumTypeStrings; - uint32 mNumParamStrings; - uint32 mNumMirrorTypeStrings; - uint8 mIsEnabled; + uint32 m_numEvents; + uint32 m_numTypeStrings; + uint32 m_numParamStrings; + uint32 m_numMirrorTypeStrings; + uint8 m_isEnabled; // followed by: // String track name - // [mNumTypeStrings] string objects - // [mNumParamStrings] string objects - // [mNumMirrorTypeStrings] string objects - // FileMotionEvent[mNumEvents] + // [m_numTypeStrings] string objects + // [m_numParamStrings] string objects + // [m_numMirrorTypeStrings] string objects + // FileMotionEvent[m_numEvents] }; @@ -205,10 +205,10 @@ namespace EMotionFX // (aligned) struct FileMotionEventTable { - uint32 mNumTracks; + uint32 m_numTracks; // followed by: - // FileMotionEventTrack[mNumTracks] + // FileMotionEventTrack[m_numTracks] }; struct FileMotionEventTableSerialized diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/Importer/NodeMapFileFormat.h b/Gems/EMotionFX/Code/EMotionFX/Source/Importer/NodeMapFileFormat.h index b68b283510..bd563aa0dd 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/Importer/NodeMapFileFormat.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/Importer/NodeMapFileFormat.h @@ -25,20 +25,20 @@ namespace EMotionFX struct NodeMap_Header { - uint8 mFourCC[4]; // must be "MOS " - uint8 mHiVersion; // high version (2 in case of v2.34) - uint8 mLoVersion; // low version (34 in case of v2.34) - uint8 mEndianType; // the endian in which the data is saved [0=little, 1=big] + uint8 m_fourCc[4]; // must be "MOS " + uint8 m_hiVersion; // high version (2 in case of v2.34) + uint8 m_loVersion; // low version (34 in case of v2.34) + uint8 m_endianType; // the endian in which the data is saved [0=little, 1=big] }; struct NodeMapChunk { - uint32 mNumEntries;// the number of mapping entries + uint32 m_numEntries;// the number of mapping entries // followed by: // String sourceActorFileName - // for all mNumEntries + // for all m_numEntries // String firstNodeName; // String secondNodeName; }; diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/Importer/SharedFileFormatStructs.h b/Gems/EMotionFX/Code/EMotionFX/Source/Importer/SharedFileFormatStructs.h index 082bcbf0ef..b5828b98c8 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/Importer/SharedFileFormatStructs.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/Importer/SharedFileFormatStructs.h @@ -23,75 +23,75 @@ namespace EMotionFX struct FileChunk { - uint32 mChunkID; // the chunk ID - uint32 mSizeInBytes; // the size in bytes of this chunk (excluding this chunk struct) - uint32 mVersion; // the version of the chunk + uint32 m_chunkId; // the chunk ID + uint32 m_sizeInBytes; // the size in bytes of this chunk (excluding this chunk struct) + uint32 m_version; // the version of the chunk }; // color [0..1] range struct FileColor { - float mR; // red - float mG; // green - float mB; // blue - float mA; // alpha + float m_r; // red + float m_g; // green + float m_b; // blue + float m_a; // alpha }; struct FileVector2 { - float mX; - float mY; + float m_x; + float m_y; }; struct FileVector3 { - float mX; // x+ = to the right - float mY; // y+ = forward - float mZ; // z+ = up + float m_x; // x+ = to the right + float m_y; // y+ = forward + float m_z; // z+ = up }; // a compressed 3D vector struct File16BitVector3 { - uint16 mX; // x+ = to the right - uint16 mY; // y+ = forward - uint16 mZ; // z+ = up + uint16 m_x; // x+ = to the right + uint16 m_y; // y+ = forward + uint16 m_z; // z+ = up }; // a compressed 3D vector struct File8BitVector3 { - uint8 mX; // x+ = to the right - uint8 mY; // y+ = forward - uint8 mZ; // z+ = up + uint8 m_x; // x+ = to the right + uint8 m_y; // y+ = forward + uint8 m_z; // z+ = up }; struct FileQuaternion { - float mX; - float mY; - float mZ; - float mW; + float m_x; + float m_y; + float m_z; + float m_w; }; // the 16 bit component quaternion struct File16BitQuaternion { - int16 mX; - int16 mY; - int16 mZ; - int16 mW; + int16 m_x; + int16 m_y; + int16 m_z; + int16 m_w; }; // a time stamp chunk struct FileTime { - uint16 mYear; - int8 mMonth; - int8 mDay; - int8 mHours; - int8 mMinutes; - int8 mSeconds; + uint16 m_year; + int8 m_month; + int8 m_day; + int8 m_hours; + int8 m_minutes; + int8 m_seconds; }; } // namespace FileFormat } // namespace EMotionFX diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/KeyFrame.h b/Gems/EMotionFX/Code/EMotionFX/Source/KeyFrame.h index 35435823d4..7312d94c69 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/KeyFrame.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/KeyFrame.h @@ -103,8 +103,8 @@ namespace EMotionFX MCORE_INLINE void SetStorageTypeValue(const StorageType& value); protected: - StorageType mValue; /**< The key value. */ - float mTime; /**< Time in seconds. */ + StorageType m_value; /**< The key value. */ + float m_time; /**< Time in seconds. */ }; // include inline code diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/KeyFrame.inl b/Gems/EMotionFX/Code/EMotionFX/Source/KeyFrame.inl index 47df42f07f..5aaf871977 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/KeyFrame.inl +++ b/Gems/EMotionFX/Code/EMotionFX/Source/KeyFrame.inl @@ -9,7 +9,7 @@ // default constructor template KeyFrame::KeyFrame() - : mTime(0) + : m_time(0) { } @@ -17,7 +17,7 @@ KeyFrame::KeyFrame() // extended constructor template KeyFrame::KeyFrame(float time, const ReturnType& value) - : mTime(time) + : m_time(time) { SetValue(value); } @@ -41,55 +41,55 @@ void KeyFrame::Reflect(AZ::ReflectContext* context) serializeContext->Class>() ->Version(1) - ->Field("time", &KeyFrame::mTime) - ->Field("value", &KeyFrame::mValue) + ->Field("time", &KeyFrame::m_time) + ->Field("value", &KeyFrame::m_value) ; } template MCORE_INLINE float KeyFrame::GetTime() const { - return mTime; + return m_time; } template MCORE_INLINE ReturnType KeyFrame::GetValue() const { - return mValue; + return m_value; } template MCORE_INLINE void KeyFrame::GetValue(ReturnType* outValue) { - *outValue = mValue; + *outValue = m_value; } template MCORE_INLINE const StorageType& KeyFrame::GetStorageTypeValue() const { - return mValue; + return m_value; } template MCORE_INLINE void KeyFrame::SetTime(float time) { - mTime = time; + m_time = time; } template MCORE_INLINE void KeyFrame::SetValue(const ReturnType& value) { - mValue = value; + m_value = value; } template MCORE_INLINE void KeyFrame::SetStorageTypeValue(const StorageType& value) { - mValue = value; + m_value = value; } diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/KeyTrackLinearDynamic.h b/Gems/EMotionFX/Code/EMotionFX/Source/KeyTrackLinearDynamic.h index 5f8f7b49d0..c94886a5f3 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/KeyTrackLinearDynamic.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/KeyTrackLinearDynamic.h @@ -257,7 +257,7 @@ namespace EMotionFX MCORE_INLINE void SetStorageTypeKey(size_t keyNr, float time, const StorageType& value); protected: - AZStd::vector> mKeys; /**< The collection of keys which form the track. */ + AZStd::vector> m_keys; /**< The collection of keys which form the track. */ }; diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/KeyTrackLinearDynamic.inl b/Gems/EMotionFX/Code/EMotionFX/Source/KeyTrackLinearDynamic.inl index 806a45b69a..34598f0ae1 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/KeyTrackLinearDynamic.inl +++ b/Gems/EMotionFX/Code/EMotionFX/Source/KeyTrackLinearDynamic.inl @@ -25,7 +25,7 @@ void KeyTrackLinearDynamic::Reflect(AZ::ReflectContext* serializeContext->Class>() ->Version(1) - ->Field("keyValues", &KeyTrackLinearDynamic::mKeys) + ->Field("keyValues", &KeyTrackLinearDynamic::m_keys) ; } @@ -33,7 +33,7 @@ void KeyTrackLinearDynamic::Reflect(AZ::ReflectContext* template void KeyTrackLinearDynamic::ClearKeys() { - mKeys.clear(); + m_keys.clear(); } @@ -42,18 +42,18 @@ template void KeyTrackLinearDynamic::Init() { // check all key time values, so we are sure the first key start at time 0 - if (mKeys.empty()) + if (m_keys.empty()) { return; } // get the time value of the first key, which is our minimum time - const float minTime = mKeys[0].GetTime(); + const float minTime = m_keys[0].GetTime(); // if it's not equal to zero, we have to correct it (and all other keys as well) if (minTime > 0.0f) { - for (KeyFrame& key : mKeys) + for (KeyFrame& key : m_keys) { key.SetTime(key.GetTime() - minTime); } @@ -64,22 +64,22 @@ void KeyTrackLinearDynamic::Init() template MCORE_INLINE KeyFrame* KeyTrackLinearDynamic::GetKey(size_t nr) { - MCORE_ASSERT(nr < mKeys.size()); - return &mKeys[nr]; + MCORE_ASSERT(nr < m_keys.size()); + return &m_keys[nr]; } template MCORE_INLINE KeyFrame* KeyTrackLinearDynamic::GetFirstKey() { - return !mKeys.empty() ? &mKeys[0] : nullptr; + return !m_keys.empty() ? &m_keys[0] : nullptr; } template MCORE_INLINE KeyFrame* KeyTrackLinearDynamic::GetLastKey() { - return !mKeys.empty() ? &mKeys.back() : nullptr; + return !m_keys.empty() ? &m_keys.back() : nullptr; } @@ -87,22 +87,22 @@ MCORE_INLINE KeyFrame* KeyTrackLinearDynamic MCORE_INLINE const KeyFrame* KeyTrackLinearDynamic::GetKey(size_t nr) const { - MCORE_ASSERT(nr < mKeys.size()); - return &mKeys[nr]; + MCORE_ASSERT(nr < m_keys.size()); + return &m_keys[nr]; } template MCORE_INLINE const KeyFrame* KeyTrackLinearDynamic::GetFirstKey() const { - return !mKeys.empty() ? &mKeys[0] : nullptr; + return !m_keys.empty() ? &m_keys[0] : nullptr; } template MCORE_INLINE const KeyFrame* KeyTrackLinearDynamic::GetLastKey() const { - return !mKeys.empty() ? &mKeys.back() : nullptr; + return !m_keys.empty() ? &m_keys.back() : nullptr; } @@ -125,7 +125,7 @@ MCORE_INLINE float KeyTrackLinearDynamic::GetLastTime() template MCORE_INLINE size_t KeyTrackLinearDynamic::GetNumKeys() const { - return mKeys.size(); + return m_keys.size(); } @@ -133,21 +133,21 @@ template MCORE_INLINE void KeyTrackLinearDynamic::AddKey(float time, const ReturnType& value, bool smartPreAlloc) { #ifdef MCORE_DEBUG - if (!mKeys.empty()) + if (!m_keys.empty()) { - MCORE_ASSERT(time >= mKeys.back().GetTime()); + MCORE_ASSERT(time >= m_keys.back().GetTime()); } #endif // if we need to prealloc - if (mKeys.capacity() == mKeys.size() && smartPreAlloc == true) + if (m_keys.capacity() == m_keys.size() && smartPreAlloc == true) { - const size_t numToReserve = mKeys.size() / 4; - mKeys.reserve(mKeys.capacity() + numToReserve); + const size_t numToReserve = m_keys.size() / 4; + m_keys.reserve(m_keys.capacity() + numToReserve); } // not the first key, so add on the end - mKeys.emplace_back(KeyFrame(time, value)); + m_keys.emplace_back(KeyFrame(time, value)); } @@ -155,7 +155,7 @@ MCORE_INLINE void KeyTrackLinearDynamic::AddKey(float t template MCORE_INLINE size_t KeyTrackLinearDynamic::FindKeyNumber(float curTime) const { - return KeyFrameFinder::FindKey(curTime, &mKeys.front(), static_cast(mKeys.size())); + return KeyFrameFinder::FindKey(curTime, &m_keys.front(), static_cast(m_keys.size())); } @@ -164,10 +164,10 @@ template MCORE_INLINE KeyFrame* KeyTrackLinearDynamic::FindKey(float curTime) const { // find the key number - const size_t keyNumber = KeyFrameFinder::FindKey(curTime, &mKeys.front(), mKeys.size()); + const size_t keyNumber = KeyFrameFinder::FindKey(curTime, &m_keys.front(), m_keys.size()); // if no key was found - return (keyNumber != InvalidIndex) ? &mKeys[keyNumber] : nullptr; + return (keyNumber != InvalidIndex) ? &m_keys[keyNumber] : nullptr; } @@ -176,7 +176,7 @@ template ReturnType KeyTrackLinearDynamic::GetValueAtTime(float currentTime, size_t* cachedKey, uint8* outWasCacheHit, bool interpolate) const { MCORE_ASSERT(currentTime >= 0.0); - MCORE_ASSERT(!mKeys.empty()); + MCORE_ASSERT(!m_keys.empty()); // make a local copy of the cached key value size_t localCachedKey = (cachedKey) ? *cachedKey : InvalidIndex; @@ -193,7 +193,7 @@ ReturnType KeyTrackLinearDynamic::GetValueAtTime(float *outWasCacheHit = 0; } - keyNumber = KeyFrameFinder::FindKey(currentTime, &mKeys.front(), mKeys.size()); + keyNumber = KeyFrameFinder::FindKey(currentTime, &m_keys.front(), m_keys.size()); if (cachedKey) { @@ -203,11 +203,11 @@ ReturnType KeyTrackLinearDynamic::GetValueAtTime(float else { // make sure we dont go out of bounds when checking - if (localCachedKey >= mKeys.size() - 2) + if (localCachedKey >= m_keys.size() - 2) { - if (mKeys.size() > 2) + if (m_keys.size() > 2) { - localCachedKey = mKeys.size() - 3; + localCachedKey = m_keys.size() - 3; } else { @@ -216,7 +216,7 @@ ReturnType KeyTrackLinearDynamic::GetValueAtTime(float } // check if the cached key is still valid (cache hit) - if ((mKeys[localCachedKey].GetTime() <= currentTime) && (mKeys[localCachedKey + 1].GetTime() >= currentTime)) + if ((m_keys[localCachedKey].GetTime() <= currentTime) && (m_keys[localCachedKey + 1].GetTime() >= currentTime)) { keyNumber = localCachedKey; if (outWasCacheHit) @@ -226,7 +226,7 @@ ReturnType KeyTrackLinearDynamic::GetValueAtTime(float } else { - if (localCachedKey < mKeys.size() - 2 && (mKeys[localCachedKey + 1].GetTime() <= currentTime) && (mKeys[localCachedKey + 2].GetTime() >= currentTime)) + if (localCachedKey < m_keys.size() - 2 && (m_keys[localCachedKey + 1].GetTime() <= currentTime) && (m_keys[localCachedKey + 2].GetTime() >= currentTime)) { if (outWasCacheHit) { @@ -242,7 +242,7 @@ ReturnType KeyTrackLinearDynamic::GetValueAtTime(float *outWasCacheHit = 0; } - keyNumber = KeyFrameFinder::FindKey(currentTime, &mKeys.front(), mKeys.size()); + keyNumber = KeyFrameFinder::FindKey(currentTime, &m_keys.front(), m_keys.size()); if (cachedKey) { @@ -256,20 +256,20 @@ ReturnType KeyTrackLinearDynamic::GetValueAtTime(float if (keyNumber == InvalidIndex) { // if there are no keys at all, simply return an empty object - if (mKeys.size() == 0) + if (m_keys.size() == 0) { // return an empty object return ReturnType(); } // return the last key - return mKeys.back().GetValue(); + return m_keys.back().GetValue(); } // check if we didn't reach the end of the track - if ((keyNumber + 1) > (mKeys.size() - 1)) + if ((keyNumber + 1) > (m_keys.size() - 1)) { - return mKeys.back().GetValue(); + return m_keys.back().GetValue(); } // perform interpolation @@ -279,7 +279,7 @@ ReturnType KeyTrackLinearDynamic::GetValueAtTime(float } else { - return mKeys[keyNumber].GetValue(); + return m_keys[keyNumber].GetValue(); } } @@ -289,8 +289,8 @@ template MCORE_INLINE ReturnType KeyTrackLinearDynamic::Interpolate(size_t startKey, float currentTime) const { // get the keys to interpolate between - const KeyFrame& firstKey = mKeys[startKey]; - const KeyFrame& nextKey = mKeys[startKey + 1]; + const KeyFrame& firstKey = m_keys[startKey]; + const KeyFrame& nextKey = m_keys[startKey + 1]; // calculate the time value in range of [0..1] const float t = (currentTime - firstKey.GetTime()) / (nextKey.GetTime() - firstKey.GetTime()); @@ -305,8 +305,8 @@ template <> MCORE_INLINE AZ::Quaternion KeyTrackLinearDynamic::Interpolate(size_t startKey, float currentTime) const { // get the keys to interpolate between - const KeyFrame& firstKey = mKeys[startKey]; - const KeyFrame& nextKey = mKeys[startKey + 1]; + const KeyFrame& firstKey = m_keys[startKey]; + const KeyFrame& nextKey = m_keys[startKey + 1]; // calculate the time value in range of [0..1] const float t = (currentTime - firstKey.GetTime()) / (nextKey.GetTime() - firstKey.GetTime()); @@ -320,8 +320,8 @@ template <> MCORE_INLINE AZ::Quaternion KeyTrackLinearDynamic::Interpolate(size_t startKey, float currentTime) const { // get the keys to interpolate between - const KeyFrame& firstKey = mKeys[startKey]; - const KeyFrame& nextKey = mKeys[startKey + 1]; + const KeyFrame& firstKey = m_keys[startKey]; + const KeyFrame& nextKey = m_keys[startKey + 1]; // calculate the time value in range of [0..1] const float t = (currentTime - firstKey.GetTime()) / (nextKey.GetTime() - firstKey.GetTime()); @@ -338,17 +338,17 @@ void KeyTrackLinearDynamic::AddKeySorted(float time, co // if we need to prealloc if (smartPreAlloc) { - if (mKeys.capacity() == mKeys.size()) + if (m_keys.capacity() == m_keys.size()) { - const size_t numToReserve = mKeys.size() / 4; - mKeys.reserve(mKeys.capacity() + numToReserve); + const size_t numToReserve = m_keys.size() / 4; + m_keys.reserve(m_keys.capacity() + numToReserve); } } // if there are no keys yet, add it - if (mKeys.empty()) + if (m_keys.empty()) { - mKeys.emplace_back(KeyFrame(time, value)); + m_keys.emplace_back(KeyFrame(time, value)); return; } @@ -356,29 +356,29 @@ void KeyTrackLinearDynamic::AddKeySorted(float time, co const float keyTime = time; // if we must add it at the end - if (keyTime >= mKeys.back().GetTime()) + if (keyTime >= m_keys.back().GetTime()) { - mKeys.emplace_back(KeyFrame(time, value)); + m_keys.emplace_back(KeyFrame(time, value)); return; } // if we have to add it in the front - if (keyTime < mKeys.front().GetTime()) + if (keyTime < m_keys.front().GetTime()) { - mKeys.insert(mKeys.begin(), KeyFrame(time, value)); + m_keys.insert(m_keys.begin(), KeyFrame(time, value)); return; } // quickly find the location to insert, and insert it - const size_t place = KeyFrameFinder::FindKey(keyTime, &mKeys.front(), mKeys.size()); - mKeys.insert(mKeys.begin() + place + 1, KeyFrame(time, value)); + const size_t place = KeyFrameFinder::FindKey(keyTime, &m_keys.front(), m_keys.size()); + m_keys.insert(m_keys.begin() + place + 1, KeyFrame(time, value)); } template MCORE_INLINE void KeyTrackLinearDynamic::RemoveKey(size_t keyNr) { - mKeys.erase(AZStd::next(mKeys.begin(), keyNr)); + m_keys.erase(AZStd::next(m_keys.begin(), keyNr)); } @@ -387,7 +387,7 @@ void KeyTrackLinearDynamic::MakeLoopable(float fadeTime { MCORE_ASSERT(fadeTime > 0); - if (mKeys.empty()) + if (m_keys.empty()) { return; } @@ -407,14 +407,14 @@ size_t KeyTrackLinearDynamic::Optimize(float maxError) { // if there aren't at least two keys, return, because we never remove the first and last key frames // and we'd need at least two keyframes to interpolate between - if (mKeys.size() <= 2) + if (m_keys.size() <= 2) { return 0; } // create a temparory copy of the keytrack data we're going to optimize KeyTrackLinearDynamic keyTrackCopy; - keyTrackCopy.mKeys = mKeys; + keyTrackCopy.m_keys = m_keys; keyTrackCopy.Init(); // while we want to continue optimizing @@ -423,7 +423,7 @@ size_t KeyTrackLinearDynamic::Optimize(float maxError) do { // get the time of the current keyframe (starting from the second towards the last one) - const float time = mKeys[i].GetTime(); + const float time = m_keys[i].GetTime(); // remove the keyframe and reinit the keytrack (and interpolator's tangents etc) keyTrackCopy.RemoveKey(i); @@ -445,13 +445,12 @@ size_t KeyTrackLinearDynamic::Optimize(float maxError) } else // if the "visual" difference is too high and we do not want ot remove the key, copy over the original keys again to restore it { - keyTrackCopy.mKeys = mKeys; // copy the keyframe array + keyTrackCopy.m_keys = m_keys; // copy the keyframe array keyTrackCopy.Init(); // reinit the keytrack i++; // go to the next keyframe, and try ot remove that one } - } while (i < mKeys.size() - 1); // while we haven't reached the last keyframe (minus one) + } while (i < m_keys.size() - 1); // while we haven't reached the last keyframe (minus one) - //mKeys.shrink_to_fit(); return numRemoved; } @@ -461,7 +460,7 @@ template void KeyTrackLinearDynamic::SetNumKeys(size_t numKeys) { // resize the array of keys - mKeys.resize(numKeys); + m_keys.resize(numKeys); } @@ -470,8 +469,8 @@ template MCORE_INLINE void KeyTrackLinearDynamic::SetKey(size_t keyNr, float time, const ReturnType& value) { // adjust the value and time of the key - mKeys[keyNr].SetValue(value); - mKeys[keyNr].SetTime(time); + m_keys[keyNr].SetValue(value); + m_keys[keyNr].SetTime(time); } @@ -480,8 +479,8 @@ template MCORE_INLINE void KeyTrackLinearDynamic::SetStorageTypeKey(size_t keyNr, float time, const StorageType& value) { // adjust the value and time of the key - mKeys[keyNr].SetStorageTypeValue(value); - mKeys[keyNr].SetTime(time); + m_keys[keyNr].SetStorageTypeValue(value); + m_keys[keyNr].SetTime(time); } @@ -489,7 +488,7 @@ MCORE_INLINE void KeyTrackLinearDynamic::SetStorageType template MCORE_INLINE bool KeyTrackLinearDynamic::CheckIfIsAnimated(const ReturnType& initialPose, float maxError) const { - return !mKeys.empty() && AZStd::any_of(begin(mKeys), end(mKeys), [&initialPose, maxError](const auto& key) + return !m_keys.empty() && AZStd::any_of(begin(m_keys), end(m_keys), [&initialPose, maxError](const auto& key) { return !MCore::Compare::CheckIfIsClose(initialPose, key.GetValue(), maxError); }); @@ -501,7 +500,7 @@ MCORE_INLINE bool KeyTrackLinearDynamic::CheckIfIsAnima template MCORE_INLINE void KeyTrackLinearDynamic::Reserve(size_t numKeys) { - mKeys.reserve(numKeys); + m_keys.reserve(numKeys); } @@ -517,5 +516,5 @@ size_t KeyTrackLinearDynamic::CalcMemoryUsage([[maybe_u template void KeyTrackLinearDynamic::Shrink() { - mKeys.shrink_to_fit(); + m_keys.shrink_to_fit(); } diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/LayerPass.h b/Gems/EMotionFX/Code/EMotionFX/Source/LayerPass.h index f4aef98b7e..ce0cb5607e 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/LayerPass.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/LayerPass.h @@ -41,14 +41,14 @@ namespace EMotionFX protected: - MotionLayerSystem* mMotionSystem; /**< The motion system where this layer pass works on. */ + MotionLayerSystem* m_motionSystem; /**< The motion system where this layer pass works on. */ /** * The constructor. * @param motionLayerSystem The motion layer system where this pass will be added to. */ LayerPass(MotionLayerSystem* motionLayerSystem) - : BaseObject() { mMotionSystem = motionLayerSystem; } + : BaseObject() { m_motionSystem = motionLayerSystem; } /** * The destructor. diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/Material.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/Material.cpp index c7157ba7c3..2602f3f281 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/Material.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/Material.cpp @@ -40,21 +40,21 @@ namespace EMotionFX void Material::SetName(const char* name) { // calculate the ID - mNameID = MCore::GetStringIdPool().GenerateIdForString(name); + m_nameId = MCore::GetStringIdPool().GenerateIdForString(name); } // return the material name const char* Material::GetName() const { - return MCore::GetStringIdPool().GetName(mNameID).c_str(); + return MCore::GetStringIdPool().GetName(m_nameId).c_str(); } // return the material name as a string const AZStd::string& Material::GetNameString() const { - return MCore::GetStringIdPool().GetName(mNameID); + return MCore::GetStringIdPool().GetName(m_nameId); } diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/Material.h b/Gems/EMotionFX/Code/EMotionFX/Source/Material.h index 98c40e8b50..a462f9e25a 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/Material.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/Material.h @@ -78,7 +78,7 @@ namespace EMotionFX void SetName(const char* name); protected: - uint32 mNameID; /**< The material id representing the name. */ + uint32 m_nameId; /**< The material id representing the name. */ /** * The constructor. diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/Mesh.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/Mesh.cpp index 450a546c27..9845ec1939 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/Mesh.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/Mesh.cpp @@ -29,25 +29,25 @@ namespace EMotionFX Mesh::Mesh() : BaseObject() { - mNumVertices = 0; - mNumIndices = 0; - mNumOrgVerts = 0; - mNumPolygons = 0; - mIndices = nullptr; - mPolyVertexCounts = nullptr; - mIsCollisionMesh = false; + m_numVertices = 0; + m_numIndices = 0; + m_numOrgVerts = 0; + m_numPolygons = 0; + m_indices = nullptr; + m_polyVertexCounts = nullptr; + m_isCollisionMesh = false; } // allocation constructor Mesh::Mesh(uint32 numVerts, uint32 numIndices, uint32 numPolygons, uint32 numOrgVerts, bool isCollisionMesh) { - mNumVertices = 0; - mNumIndices = 0; - mNumPolygons = 0; - mNumOrgVerts = 0; - mIndices = nullptr; - mPolyVertexCounts = nullptr; - mIsCollisionMesh = isCollisionMesh; + m_numVertices = 0; + m_numIndices = 0; + m_numPolygons = 0; + m_numOrgVerts = 0; + m_indices = nullptr; + m_polyVertexCounts = nullptr; + m_isCollisionMesh = isCollisionMesh; // allocate the mesh data Allocate(numVerts, numIndices, numPolygons, numOrgVerts); @@ -73,22 +73,22 @@ namespace EMotionFX // Local 2D and 4D packed vector structs as we don't have packed representations in AzCore and don't plan to add these. struct Vector2 { - float x; - float y; + float m_x; + float m_y; }; struct Vector4 { - float x; - float y; - float z; - float w; + float m_x; + float m_y; + float m_z; + float m_w; }; // Needed for converting the packed vectors from the Atom buffers that normally load directly into GPU into AzCore versions used by EMFX. AZ::Vector2 ConvertVector(const Vector2& input) { - return AZ::Vector2(input.x, input.y); + return AZ::Vector2(input.m_x, input.m_y); } AZ::Vector3 ConvertVector(const AZ::PackedVector3f& input) @@ -98,7 +98,7 @@ namespace EMotionFX AZ::Vector4 ConvertVector(const Vector4& input) { - return AZ::Vector4(input.x, input.y, input.z, input.w); + return AZ::Vector4(input.m_x, input.m_y, input.m_z, input.m_w); } // Convert Atom buffer storing elements of type SourceType to an EMFX vertex attribute layer storing elements of type TargetType. @@ -192,10 +192,10 @@ namespace EMotionFX AZ_ErrorOnce("EMotionFX", indexBufferViewDescriptor.m_elementSize == 4, "Index buffer must stored as 4 bytes."); const size_t indexBufferCountsInBytes = indexBufferViewDescriptor.m_elementCount * indexBufferViewDescriptor.m_elementSize; const size_t indexBufferOffsetInBytes = indexBufferViewDescriptor.m_elementOffset * indexBufferViewDescriptor.m_elementSize; - memcpy(mesh->mIndices, indexBuffer.begin() + indexBufferOffsetInBytes, indexBufferCountsInBytes); + memcpy(mesh->m_indices, indexBuffer.begin() + indexBufferOffsetInBytes, indexBufferCountsInBytes); // Set the polygon buffer - AZStd::fill(mesh->mPolyVertexCounts, mesh->mPolyVertexCounts + mesh->mNumPolygons, 3); + AZStd::fill(mesh->m_polyVertexCounts, mesh->m_polyVertexCounts + mesh->m_numPolygons, 3); // Skinning data from atom are stored in two separate buffer layer. AZ::u8 maxSkinInfluences = 255; // Later we will calculate this value from skinning data. @@ -359,22 +359,22 @@ namespace EMotionFX // allocate the indices if (numIndices > 0 && numPolygons > 0) { - mIndices = (uint32*)MCore::AlignedAllocate(sizeof(uint32) * numIndices, 32, EMFX_MEMCATEGORY_GEOMETRY_MESHES, Mesh::MEMORYBLOCK_ID); - mPolyVertexCounts = (uint8*)MCore::AlignedAllocate(sizeof(uint8) * numPolygons, 16, EMFX_MEMCATEGORY_GEOMETRY_MESHES, Mesh::MEMORYBLOCK_ID); + m_indices = (uint32*)MCore::AlignedAllocate(sizeof(uint32) * numIndices, 32, EMFX_MEMCATEGORY_GEOMETRY_MESHES, Mesh::MEMORYBLOCK_ID); + m_polyVertexCounts = (uint8*)MCore::AlignedAllocate(sizeof(uint8) * numPolygons, 16, EMFX_MEMCATEGORY_GEOMETRY_MESHES, Mesh::MEMORYBLOCK_ID); } // set number values - mNumVertices = numVerts; - mNumPolygons = numPolygons; - mNumIndices = numIndices; - mNumOrgVerts = numOrgVerts; + m_numVertices = numVerts; + m_numPolygons = numPolygons; + m_numIndices = numIndices; + m_numOrgVerts = numOrgVerts; } // copy all original data over the output data void Mesh::ResetToOriginalData() { - for (VertexAttributeLayer* vertexAttribute : mVertexAttributes) + for (VertexAttributeLayer* vertexAttribute : m_vertexAttributes) { vertexAttribute->ResetToOriginalData(); } @@ -391,29 +391,29 @@ namespace EMotionFX RemoveAllVertexAttributeLayers(); // get rid of all sub meshes - for (SubMesh* subMesh : mSubMeshes) + for (SubMesh* subMesh : m_subMeshes) { subMesh->Destroy(); } - mSubMeshes.clear(); + m_subMeshes.clear(); - if (mIndices) + if (m_indices) { - MCore::AlignedFree(mIndices); + MCore::AlignedFree(m_indices); } - if (mPolyVertexCounts) + if (m_polyVertexCounts) { - MCore::AlignedFree(mPolyVertexCounts); + MCore::AlignedFree(m_polyVertexCounts); } // re-init members - mIndices = nullptr; - mPolyVertexCounts = nullptr; - mNumIndices = 0; - mNumVertices = 0; - mNumOrgVerts = 0; - mNumPolygons = 0; + m_indices = nullptr; + m_polyVertexCounts = nullptr; + m_numIndices = 0; + m_numVertices = 0; + m_numOrgVerts = 0; + m_numPolygons = 0; } @@ -503,14 +503,14 @@ namespace EMotionFX for (size_t i = numTangentLayers; i <= uvSet; ++i) { // add a new tangent layer - AddVertexAttributeLayer(VertexAttributeLayerAbstractData::Create(mNumVertices, Mesh::ATTRIB_TANGENTS, sizeof(AZ::Vector4), true)); + AddVertexAttributeLayer(VertexAttributeLayerAbstractData::Create(m_numVertices, Mesh::ATTRIB_TANGENTS, sizeof(AZ::Vector4), true)); tangents = static_cast(FindVertexData(Mesh::ATTRIB_TANGENTS, i)); orgTangents = static_cast(FindOriginalVertexData(Mesh::ATTRIB_TANGENTS, i)); // Add the bitangents layer. if (storeBitangents) { - AddVertexAttributeLayer(VertexAttributeLayerAbstractData::Create(mNumVertices, Mesh::ATTRIB_BITANGENTS, sizeof(AZ::PackedVector3f), true)); + AddVertexAttributeLayer(VertexAttributeLayerAbstractData::Create(m_numVertices, Mesh::ATTRIB_BITANGENTS, sizeof(AZ::PackedVector3f), true)); bitangents = static_cast(FindVertexData(Mesh::ATTRIB_BITANGENTS, i)); orgBitangents = static_cast(FindOriginalVertexData(Mesh::ATTRIB_BITANGENTS, i)); } @@ -518,7 +518,7 @@ namespace EMotionFX // default all tangents for the newly created layer AZ::Vector4 defaultTangent(1.0f, 0.0f, 0.0f, 0.0f); AZ::Vector3 defaultBitangent(0.0f, 0.0f, 1.0f); - for (uint32 vtx = 0; vtx < mNumVertices; ++vtx) + for (uint32 vtx = 0; vtx < m_numVertices; ++vtx) { tangents[vtx] = defaultTangent; orgTangents[vtx] = defaultTangent; @@ -545,7 +545,7 @@ namespace EMotionFX AZ::Vector3 curBitangent; // calculate for every vertex the tangent and bitangent - for (uint32 i = 0; i < mNumVertices; ++i) + for (uint32 i = 0; i < m_numVertices; ++i) { orgTangents[i] = AZ::Vector4::CreateZero(); tangents[i] = AZ::Vector4::CreateZero(); @@ -601,7 +601,7 @@ namespace EMotionFX } // calculate the per vertex tangents now, fixing up orthogonality and handling mirroring of the bitangent - for (uint32 i = 0; i < mNumVertices; ++i) + for (uint32 i = 0; i < m_numVertices; ++i) { // get the normal AZ::Vector3 normal(normals[i]); @@ -800,8 +800,8 @@ namespace EMotionFX // remove a given submesh void Mesh::RemoveSubMesh(size_t nr, bool delFromMem) { - SubMesh* subMesh = mSubMeshes[nr]; - mSubMeshes.erase(AZStd::next(begin(mSubMeshes), nr)); + SubMesh* subMesh = m_subMeshes[nr]; + m_subMeshes.erase(AZStd::next(begin(m_subMeshes), nr)); if (delFromMem) { subMesh->Destroy(); @@ -812,7 +812,7 @@ namespace EMotionFX // insert a given submesh void Mesh::InsertSubMesh(size_t insertIndex, SubMesh* subMesh) { - mSubMeshes.emplace(AZStd::next(begin(mSubMeshes), insertIndex), subMesh); + m_subMeshes.emplace(AZStd::next(begin(m_subMeshes), insertIndex), subMesh); } @@ -822,7 +822,7 @@ namespace EMotionFX size_t numLayers = 0; // check the types of all vertex attribute layers - for (auto* vertexAttribute : mVertexAttributes) + for (auto* vertexAttribute : m_vertexAttributes) { if (vertexAttribute->GetType() == type) { @@ -844,31 +844,31 @@ namespace EMotionFX VertexAttributeLayer* Mesh::GetSharedVertexAttributeLayer(size_t layerNr) { - MCORE_ASSERT(layerNr < mSharedVertexAttributes.size()); - return mSharedVertexAttributes[layerNr]; + MCORE_ASSERT(layerNr < m_sharedVertexAttributes.size()); + return m_sharedVertexAttributes[layerNr]; } void Mesh::AddSharedVertexAttributeLayer(VertexAttributeLayer* layer) { - MCORE_ASSERT(AZStd::find(begin(mSharedVertexAttributes), end(mSharedVertexAttributes), layer) == end(mSharedVertexAttributes)); - mSharedVertexAttributes.emplace_back(layer); + MCORE_ASSERT(AZStd::find(begin(m_sharedVertexAttributes), end(m_sharedVertexAttributes), layer) == end(m_sharedVertexAttributes)); + m_sharedVertexAttributes.emplace_back(layer); } size_t Mesh::GetNumSharedVertexAttributeLayers() const { - return mSharedVertexAttributes.size(); + return m_sharedVertexAttributes.size(); } size_t Mesh::FindSharedVertexAttributeLayerNumber(uint32 layerTypeID, size_t occurrence) const { - const auto foundLayer = AZStd::find_if(begin(mSharedVertexAttributes), end(mSharedVertexAttributes), [layerTypeID, occurrence](const VertexAttributeLayer* layer) mutable + const auto foundLayer = AZStd::find_if(begin(m_sharedVertexAttributes), end(m_sharedVertexAttributes), [layerTypeID, occurrence](const VertexAttributeLayer* layer) mutable { return layer->GetType() == layerTypeID && occurrence-- == 0; }); - return foundLayer != end(mSharedVertexAttributes) ? AZStd::distance(begin(mSharedVertexAttributes), foundLayer) : InvalidIndex; + return foundLayer != end(m_sharedVertexAttributes) ? AZStd::distance(begin(m_sharedVertexAttributes), foundLayer) : InvalidIndex; } @@ -881,7 +881,7 @@ namespace EMotionFX return nullptr; } - return mSharedVertexAttributes[layerNr]; + return m_sharedVertexAttributes[layerNr]; } @@ -889,10 +889,10 @@ namespace EMotionFX // delete all shared attribute layers void Mesh::RemoveAllSharedVertexAttributeLayers() { - while (mSharedVertexAttributes.size()) + while (m_sharedVertexAttributes.size()) { - mSharedVertexAttributes.back()->Destroy(); - mSharedVertexAttributes.pop_back(); + m_sharedVertexAttributes.back()->Destroy(); + m_sharedVertexAttributes.pop_back(); } } @@ -900,51 +900,51 @@ namespace EMotionFX // remove a layer by its index void Mesh::RemoveSharedVertexAttributeLayer(size_t layerNr) { - MCORE_ASSERT(layerNr < mSharedVertexAttributes.size()); - mSharedVertexAttributes[layerNr]->Destroy(); - mSharedVertexAttributes.erase(AZStd::next(begin(mSharedVertexAttributes), layerNr)); + MCORE_ASSERT(layerNr < m_sharedVertexAttributes.size()); + m_sharedVertexAttributes[layerNr]->Destroy(); + m_sharedVertexAttributes.erase(AZStd::next(begin(m_sharedVertexAttributes), layerNr)); } size_t Mesh::GetNumVertexAttributeLayers() const { - return mVertexAttributes.size(); + return m_vertexAttributes.size(); } VertexAttributeLayer* Mesh::GetVertexAttributeLayer(size_t layerNr) { - MCORE_ASSERT(layerNr < mVertexAttributes.size()); - return mVertexAttributes[layerNr]; + MCORE_ASSERT(layerNr < m_vertexAttributes.size()); + return m_vertexAttributes[layerNr]; } void Mesh::AddVertexAttributeLayer(VertexAttributeLayer* layer) { - MCORE_ASSERT(AZStd::find(begin(mVertexAttributes), end(mVertexAttributes), layer) == end(mVertexAttributes)); - mVertexAttributes.emplace_back(layer); + MCORE_ASSERT(AZStd::find(begin(m_vertexAttributes), end(m_vertexAttributes), layer) == end(m_vertexAttributes)); + m_vertexAttributes.emplace_back(layer); } // find the layer number size_t Mesh::FindVertexAttributeLayerNumber(uint32 layerTypeID, size_t occurrence) const { - const auto foundLayer = AZStd::find_if(begin(mVertexAttributes), end(mVertexAttributes), [layerTypeID, occurrence](const VertexAttributeLayer* layer) mutable + const auto foundLayer = AZStd::find_if(begin(m_vertexAttributes), end(m_vertexAttributes), [layerTypeID, occurrence](const VertexAttributeLayer* layer) mutable { return layer->GetType() == layerTypeID && occurrence-- == 0; }); - return foundLayer != end(mVertexAttributes) ? AZStd::distance(begin(mVertexAttributes), foundLayer) : InvalidIndex; + return foundLayer != end(m_vertexAttributes) ? AZStd::distance(begin(m_vertexAttributes), foundLayer) : InvalidIndex; } // find the layer number size_t Mesh::FindVertexAttributeLayerNumberByName(uint32 layerTypeID, const char* name) const { - const auto foundLayer = AZStd::find_if(begin(mVertexAttributes), end(mVertexAttributes), [layerTypeID, name](const VertexAttributeLayer* layer) + const auto foundLayer = AZStd::find_if(begin(m_vertexAttributes), end(m_vertexAttributes), [layerTypeID, name](const VertexAttributeLayer* layer) { return layer->GetType() == layerTypeID && layer->GetNameString() == name; }); - return foundLayer != end(mVertexAttributes) ? AZStd::distance(begin(mVertexAttributes), foundLayer) : InvalidIndex; + return foundLayer != end(m_vertexAttributes) ? AZStd::distance(begin(m_vertexAttributes), foundLayer) : InvalidIndex; } @@ -958,7 +958,7 @@ namespace EMotionFX return nullptr; } - return mVertexAttributes[layerNr]; + return m_vertexAttributes[layerNr]; } @@ -971,25 +971,25 @@ namespace EMotionFX return nullptr; } - return mVertexAttributes[layerNr]; + return m_vertexAttributes[layerNr]; } void Mesh::RemoveAllVertexAttributeLayers() { - while (mVertexAttributes.size()) + while (m_vertexAttributes.size()) { - mVertexAttributes.back()->Destroy(); - mVertexAttributes.pop_back(); + m_vertexAttributes.back()->Destroy(); + m_vertexAttributes.pop_back(); } } void Mesh::RemoveVertexAttributeLayer(size_t layerNr) { - MCORE_ASSERT(layerNr < mVertexAttributes.size()); - mVertexAttributes[layerNr]->Destroy(); - mVertexAttributes.erase(AZStd::next(begin(mVertexAttributes), layerNr)); + MCORE_ASSERT(layerNr < m_vertexAttributes.size()); + m_vertexAttributes[layerNr]->Destroy(); + m_vertexAttributes.erase(AZStd::next(begin(m_vertexAttributes), layerNr)); } @@ -998,34 +998,34 @@ namespace EMotionFX Mesh* Mesh::Clone() { // allocate a mesh of the same dimensions - Mesh* clone = aznew Mesh(mNumVertices, mNumIndices, mNumPolygons, mNumOrgVerts, mIsCollisionMesh); + Mesh* clone = aznew Mesh(m_numVertices, m_numIndices, m_numPolygons, m_numOrgVerts, m_isCollisionMesh); // copy the mesh data - MCore::MemCopy(clone->mIndices, mIndices, sizeof(uint32) * mNumIndices); - MCore::MemCopy(clone->mPolyVertexCounts, mPolyVertexCounts, sizeof(uint8) * mNumPolygons); + MCore::MemCopy(clone->m_indices, m_indices, sizeof(uint32) * m_numIndices); + MCore::MemCopy(clone->m_polyVertexCounts, m_polyVertexCounts, sizeof(uint8) * m_numPolygons); // copy the submesh data - const size_t numSubMeshes = mSubMeshes.size(); - clone->mSubMeshes.resize(numSubMeshes); + const size_t numSubMeshes = m_subMeshes.size(); + clone->m_subMeshes.resize(numSubMeshes); for (size_t i = 0; i < numSubMeshes; ++i) { - clone->mSubMeshes[i] = mSubMeshes[i]->Clone(clone); + clone->m_subMeshes[i] = m_subMeshes[i]->Clone(clone); } // clone the shared vertex attributes - const size_t numSharedAttributes = mSharedVertexAttributes.size(); - clone->mSharedVertexAttributes.resize(numSharedAttributes); + const size_t numSharedAttributes = m_sharedVertexAttributes.size(); + clone->m_sharedVertexAttributes.resize(numSharedAttributes); for (size_t i = 0; i < numSharedAttributes; ++i) { - clone->mSharedVertexAttributes[i] = mSharedVertexAttributes[i]->Clone(); + clone->m_sharedVertexAttributes[i] = m_sharedVertexAttributes[i]->Clone(); } // clone the non-shared vertex attributes - const size_t numAttributes = mVertexAttributes.size(); - clone->mVertexAttributes.resize(numAttributes); + const size_t numAttributes = m_vertexAttributes.size(); + clone->m_vertexAttributes.resize(numAttributes); for (size_t i = 0; i < numAttributes; ++i) { - clone->mVertexAttributes[i] = mVertexAttributes[i]->Clone(); + clone->m_vertexAttributes[i] = m_vertexAttributes[i]->Clone(); } // return the resulting cloned mesh @@ -1036,8 +1036,8 @@ namespace EMotionFX // swap the data for two vertices void Mesh::SwapVertex(uint32 vertexA, uint32 vertexB) { - MCORE_ASSERT(vertexA < mNumVertices); - MCORE_ASSERT(vertexB < mNumVertices); + MCORE_ASSERT(vertexA < m_numVertices); + MCORE_ASSERT(vertexB < m_numVertices); // if we try to swap itself then there is nothing to do if (vertexA == vertexB) @@ -1046,10 +1046,10 @@ namespace EMotionFX } // swap all vertex attribute layers - const size_t numLayers = mVertexAttributes.size(); + const size_t numLayers = m_vertexAttributes.size(); for (size_t i = 0; i < numLayers; ++i) { - mVertexAttributes[i]->SwapAttributes(vertexA, vertexB); + m_vertexAttributes[i]->SwapAttributes(vertexA, vertexB); } } @@ -1057,8 +1057,8 @@ namespace EMotionFX void Mesh::RemoveVertices(uint32 startVertexNr, uint32 endVertexNr, bool changeIndexBuffer, bool removeEmptySubMeshes) { // perform some checks on the input data - MCORE_ASSERT(endVertexNr < mNumVertices); - MCORE_ASSERT(startVertexNr < mNumVertices); + MCORE_ASSERT(endVertexNr < m_numVertices); + MCORE_ASSERT(startVertexNr < m_numVertices); // make sure the start vertex is before the end vertex in release mode, to prevent weirdness if (startVertexNr > endVertexNr) @@ -1074,7 +1074,7 @@ namespace EMotionFX const uint32 numVertsToRemove = (endVertexNr - startVertexNr) + 1; // +1 because we remove the end vertex as well // remove the num verices counter - mNumVertices -= numVertsToRemove; + m_numVertices -= numVertsToRemove; // remove the attributes from the vertex attribute layers const size_t numLayers = GetNumVertexAttributeLayers(); @@ -1091,9 +1091,9 @@ namespace EMotionFX for (uint32 w = 0; w < numVertsToRemove; ++w) { // adjust all submesh start index offsets changed - for (size_t s = 0; s < mSubMeshes.size();) + for (size_t s = 0; s < m_subMeshes.size();) { - SubMesh* subMesh = mSubMeshes[s]; + SubMesh* subMesh = m_subMeshes[s]; // if we remove a vertex from this submesh if (subMesh->GetStartVertex() <= v && subMesh->GetStartVertex() + subMesh->GetNumVertices() > v) @@ -1111,7 +1111,7 @@ namespace EMotionFX // remove the submesh if it's empty if (subMesh->GetNumVertices() == 0 && removeEmptySubMeshes) { - mSubMeshes.erase(AZStd::next(begin(mSubMeshes), s)); + m_subMeshes.erase(AZStd::next(begin(m_subMeshes), s)); } else { @@ -1128,11 +1128,11 @@ namespace EMotionFX //------------------------------------ if (changeIndexBuffer) { - for (uint32 i = 0; i < mNumIndices; ++i) + for (uint32 i = 0; i < m_numIndices; ++i) { - if (mIndices[i] > startVertexNr) + if (m_indices[i] > startVertexNr) { - mIndices[i] -= numVertsToRemove; + m_indices[i] -= numVertsToRemove; } } } @@ -1145,9 +1145,9 @@ namespace EMotionFX size_t numRemoved = 0; // for all the submeshes - for (size_t i = 0; i < mSubMeshes.size();) + for (size_t i = 0; i < m_subMeshes.size();) { - SubMesh* subMesh = mSubMeshes[i]; + SubMesh* subMesh = m_subMeshes[i]; // get some stats about the submesh bool mustRemove; @@ -1167,7 +1167,7 @@ namespace EMotionFX // remove or skip if (mustRemove) { - mSubMeshes.erase(AZStd::next(begin(mSubMeshes), i)); + m_subMeshes.erase(AZStd::next(begin(m_subMeshes), i)); numRemoved++; } else @@ -1542,19 +1542,19 @@ namespace EMotionFX bool result = true; // check if the indices are valid and return false in case they aren't - if (mIndices == nullptr) + if (m_indices == nullptr) { return false; } // use our 32-bit index buffer as new 16-bit index array directly - uint16* indices = (uint16*)mIndices; + uint16* indices = (uint16*)m_indices; // iterate over all indices and convert the values - for (uint32 i = 0; i < mNumIndices; ++i) + for (uint32 i = 0; i < m_numIndices; ++i) { // create a temporary copy of our 32-bit vertex index - const uint32 oldVertexIndex = mIndices[i]; + const uint32 oldVertexIndex = m_indices[i]; // check if our index is in range of an unsigned short if (oldVertexIndex < 65536) @@ -1570,7 +1570,7 @@ namespace EMotionFX } // realloc the memory to the new index buffer size using 16-bit values and return the result - mIndices = (uint32*)MCore::AlignedRealloc(mIndices, sizeof(uint16) * mNumIndices, 32, EMFX_MEMCATEGORY_GEOMETRY_MESHES, Mesh::MEMORYBLOCK_ID); + m_indices = (uint32*)MCore::AlignedRealloc(m_indices, sizeof(uint16) * m_numIndices, 32, EMFX_MEMCATEGORY_GEOMETRY_MESHES, Mesh::MEMORYBLOCK_ID); return result; } @@ -1610,19 +1610,19 @@ namespace EMotionFX void Mesh::ExtractOriginalVertexPositions(AZStd::vector& outPoints) const { // allocate space - outPoints.resize(mNumOrgVerts); + outPoints.resize(m_numOrgVerts); // get the mesh data const AZ::Vector3* positions = (AZ::Vector3*)FindOriginalVertexData(ATTRIB_POSITIONS); const uint32* orgVerts = (uint32*) FindVertexData(ATTRIB_ORGVTXNUMBERS); // init all org vertices - for (uint32 v = 0; v < mNumOrgVerts; ++v) + for (uint32 v = 0; v < m_numOrgVerts; ++v) { outPoints[v] = positions[0]; // init them, as there are some unused original vertices sometimes } // output the points - for (uint32 i = 0; i < mNumVertices; ++i) + for (uint32 i = 0; i < m_numVertices; ++i) { outPoints[ orgVerts[i] ] = positions[i]; } @@ -1640,8 +1640,8 @@ namespace EMotionFX if (useDuplicates == false) { // the smoothed normals array - AZStd::vector smoothNormals(mNumOrgVerts); - for (uint32 i = 0; i < mNumOrgVerts; ++i) + AZStd::vector smoothNormals(m_numOrgVerts); + for (uint32 i = 0; i < m_numOrgVerts; ++i) { smoothNormals[i] = AZ::Vector3::CreateZero(); } @@ -1681,39 +1681,20 @@ namespace EMotionFX polyStartIndex += numPolyVerts; } - /* - for (uint32 f=0; fScale(scaleFactor); } - for (VertexAttributeLayer* layer : mSharedVertexAttributes) + for (VertexAttributeLayer* layer : m_sharedVertexAttributes) { layer->Scale(scaleFactor); } @@ -1847,7 +1808,7 @@ namespace EMotionFX AZ::Vector3* positions = (AZ::Vector3*)FindVertexData(ATTRIB_POSITIONS); AZ::Vector3* orgPositions = (AZ::Vector3*)FindOriginalVertexData(ATTRIB_POSITIONS); - const uint32 numVerts = mNumVertices; + const uint32 numVerts = m_numVertices; for (uint32 i = 0; i < numVerts; ++i) { positions[i] = positions[i] * scaleFactor; @@ -1859,65 +1820,65 @@ namespace EMotionFX // find by name size_t Mesh::FindVertexAttributeLayerIndexByName(const char* name) const { - const auto foundLayer = AZStd::find_if(begin(mVertexAttributes), end(mVertexAttributes), [name](const VertexAttributeLayer* layer) + const auto foundLayer = AZStd::find_if(begin(m_vertexAttributes), end(m_vertexAttributes), [name](const VertexAttributeLayer* layer) { return layer->GetNameString() == name; }); - return foundLayer != end(mVertexAttributes) ? AZStd::distance(begin(mVertexAttributes), foundLayer) : InvalidIndex; + return foundLayer != end(m_vertexAttributes) ? AZStd::distance(begin(m_vertexAttributes), foundLayer) : InvalidIndex; } // find by name as string size_t Mesh::FindVertexAttributeLayerIndexByNameString(const AZStd::string& name) const { - const auto foundLayer = AZStd::find_if(begin(mVertexAttributes), end(mVertexAttributes), [name](const VertexAttributeLayer* layer) + const auto foundLayer = AZStd::find_if(begin(m_vertexAttributes), end(m_vertexAttributes), [name](const VertexAttributeLayer* layer) { return layer->GetNameString() == name; }); - return foundLayer != end(mVertexAttributes) ? AZStd::distance(begin(mVertexAttributes), foundLayer) : InvalidIndex; + return foundLayer != end(m_vertexAttributes) ? AZStd::distance(begin(m_vertexAttributes), foundLayer) : InvalidIndex; } // find by name ID size_t Mesh::FindVertexAttributeLayerIndexByNameID(uint32 nameID) const { - const auto foundLayer = AZStd::find_if(begin(mVertexAttributes), end(mVertexAttributes), [nameID](const VertexAttributeLayer* layer) + const auto foundLayer = AZStd::find_if(begin(m_vertexAttributes), end(m_vertexAttributes), [nameID](const VertexAttributeLayer* layer) { return layer->GetNameID() == nameID; }); - return foundLayer != end(mVertexAttributes) ? AZStd::distance(begin(mVertexAttributes), foundLayer) : InvalidIndex; + return foundLayer != end(m_vertexAttributes) ? AZStd::distance(begin(m_vertexAttributes), foundLayer) : InvalidIndex; } // find by name size_t Mesh::FindSharedVertexAttributeLayerIndexByName(const char* name) const { - const auto foundLayer = AZStd::find_if(begin(mSharedVertexAttributes), end(mSharedVertexAttributes), [name](const VertexAttributeLayer* layer) + const auto foundLayer = AZStd::find_if(begin(m_sharedVertexAttributes), end(m_sharedVertexAttributes), [name](const VertexAttributeLayer* layer) { return layer->GetNameString() == name; }); - return foundLayer != end(mSharedVertexAttributes) ? AZStd::distance(begin(mSharedVertexAttributes), foundLayer) : InvalidIndex; + return foundLayer != end(m_sharedVertexAttributes) ? AZStd::distance(begin(m_sharedVertexAttributes), foundLayer) : InvalidIndex; } // find by name as string size_t Mesh::FindSharedVertexAttributeLayerIndexByNameString(const AZStd::string& name) const { - const auto foundLayer = AZStd::find_if(begin(mSharedVertexAttributes), end(mSharedVertexAttributes), [name](const VertexAttributeLayer* layer) + const auto foundLayer = AZStd::find_if(begin(m_sharedVertexAttributes), end(m_sharedVertexAttributes), [name](const VertexAttributeLayer* layer) { return layer->GetNameString() == name; }); - return foundLayer != end(mSharedVertexAttributes) ? AZStd::distance(begin(mSharedVertexAttributes), foundLayer) : InvalidIndex; + return foundLayer != end(m_sharedVertexAttributes) ? AZStd::distance(begin(m_sharedVertexAttributes), foundLayer) : InvalidIndex; } // find by name ID size_t Mesh::FindSharedVertexAttributeLayerIndexByNameID(uint32 nameID) const { - const auto foundLayer = AZStd::find_if(begin(mSharedVertexAttributes), end(mSharedVertexAttributes), [nameID](const VertexAttributeLayer* layer) + const auto foundLayer = AZStd::find_if(begin(m_sharedVertexAttributes), end(m_sharedVertexAttributes), [nameID](const VertexAttributeLayer* layer) { return layer->GetNameID() == nameID; }); - return foundLayer != end(mSharedVertexAttributes) ? AZStd::distance(begin(mSharedVertexAttributes), foundLayer) : InvalidIndex; + return foundLayer != end(m_sharedVertexAttributes) ? AZStd::distance(begin(m_sharedVertexAttributes), foundLayer) : InvalidIndex; } } // namespace EMotionFX diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/Mesh.h b/Gems/EMotionFX/Code/EMotionFX/Source/Mesh.h index b38a1445f6..c2d776bcdb 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/Mesh.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/Mesh.h @@ -249,7 +249,7 @@ namespace EMotionFX * @param nr The submesh number, which must be in range of [0..GetNumSubMeshes()-1]. * @param subMesh The submesh to use. */ - MCORE_INLINE void SetSubMesh(size_t nr, SubMesh* subMesh) { mSubMeshes[nr] = subMesh; } + MCORE_INLINE void SetSubMesh(size_t nr, SubMesh* subMesh) { m_subMeshes[nr] = subMesh; } /** * Set the number of submeshes. @@ -257,7 +257,7 @@ namespace EMotionFX * Do not forget to use SetSubMesh() to initialize all submeshes! * @param numSubMeshes The number of submeshes to use. */ - MCORE_INLINE void SetNumSubMeshes(size_t numSubMeshes) { mSubMeshes.resize(numSubMeshes); } + MCORE_INLINE void SetNumSubMeshes(size_t numSubMeshes) { m_subMeshes.resize(numSubMeshes); } /** * Remove a given submesh from this mesh. @@ -648,31 +648,31 @@ namespace EMotionFX void Scale(float scaleFactor); - MCORE_INLINE bool GetIsCollisionMesh() const { return mIsCollisionMesh; } - void SetIsCollisionMesh(bool isCollisionMesh) { mIsCollisionMesh = isCollisionMesh; } + MCORE_INLINE bool GetIsCollisionMesh() const { return m_isCollisionMesh; } + void SetIsCollisionMesh(bool isCollisionMesh) { m_isCollisionMesh = isCollisionMesh; } protected: - AZStd::vector mSubMeshes; /**< The collection of sub meshes. */ - uint32* mIndices; /**< The array of indices, which define the faces. */ - uint8* mPolyVertexCounts; /**< The number of vertices for each polygon, where the length of this array equals the number of polygons. */ - uint32 mNumPolygons; /**< The number of polygons in this mesh. */ - uint32 mNumOrgVerts; /**< The number of original vertices. */ - uint32 mNumVertices; /**< Number of vertices. */ - uint32 mNumIndices; /**< Number of indices. */ - bool mIsCollisionMesh; /**< Is this mesh a collision mesh? */ + AZStd::vector m_subMeshes; /**< The collection of sub meshes. */ + uint32* m_indices; /**< The array of indices, which define the faces. */ + uint8* m_polyVertexCounts; /**< The number of vertices for each polygon, where the length of this array equals the number of polygons. */ + uint32 m_numPolygons; /**< The number of polygons in this mesh. */ + uint32 m_numOrgVerts; /**< The number of original vertices. */ + uint32 m_numVertices; /**< Number of vertices. */ + uint32 m_numIndices; /**< Number of indices. */ + bool m_isCollisionMesh; /**< Is this mesh a collision mesh? */ /** * The array of shared vertex attribute layers. * The number of attributes in each shared layer will be equal to the value returned by Mesh::GetNumOrgVertices(). */ - AZStd::vector< VertexAttributeLayer* > mSharedVertexAttributes; + AZStd::vector< VertexAttributeLayer* > m_sharedVertexAttributes; /** * The array of non-shared vertex attribute layers. * The number of attributes in each shared layer will be equal to the value returned by Mesh::GetNumVertices(). */ - AZStd::vector< VertexAttributeLayer* > mVertexAttributes; + AZStd::vector< VertexAttributeLayer* > m_vertexAttributes; /** * Default constructor. diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/Mesh.inl b/Gems/EMotionFX/Code/EMotionFX/Source/Mesh.inl index 6a29a3de69..1794303b76 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/Mesh.inl +++ b/Gems/EMotionFX/Code/EMotionFX/Source/Mesh.inl @@ -8,65 +8,54 @@ MCORE_INLINE uint32 Mesh::GetNumVertices() const { - return mNumVertices; + return m_numVertices; } MCORE_INLINE uint32 Mesh::GetNumIndices() const { - return mNumIndices; + return m_numIndices; } MCORE_INLINE uint32 Mesh::GetNumPolygons() const { - return mNumPolygons; + return m_numPolygons; } MCORE_INLINE size_t Mesh::GetNumSubMeshes() const { - return mSubMeshes.size(); + return m_subMeshes.size(); } MCORE_INLINE SubMesh* Mesh::GetSubMesh(size_t nr) const { - MCORE_ASSERT(nr < mSubMeshes.size()); - return mSubMeshes[nr]; + MCORE_ASSERT(nr < m_subMeshes.size()); + return m_subMeshes[nr]; } MCORE_INLINE void Mesh::AddSubMesh(SubMesh* subMesh) { - mSubMeshes.emplace_back(subMesh); + m_subMeshes.emplace_back(subMesh); } MCORE_INLINE uint32* Mesh::GetIndices() const { - return mIndices; + return m_indices; } MCORE_INLINE uint8* Mesh::GetPolygonVertexCounts() const { - return mPolyVertexCounts; + return m_polyVertexCounts; } -/* -MCORE_INLINE void Mesh::SetFace(const uint32 faceNr, const uint32 a, const uint32 b, const uint32 c) -{ - MCORE_ASSERT(faceNr < mNumIndices * 3); - - uint32 startIndex = faceNr * 3; - mIndices[startIndex++] = a; - mIndices[startIndex++] = b; - mIndices[startIndex] = c; -} -*/ MCORE_INLINE uint32 Mesh::GetNumOrgVertices() const { - return mNumOrgVerts; + return m_numOrgVerts; } diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/MeshDeformer.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/MeshDeformer.cpp index b269fdecdd..93a716571d 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/MeshDeformer.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/MeshDeformer.cpp @@ -19,8 +19,8 @@ namespace EMotionFX MeshDeformer::MeshDeformer(Mesh* mesh) : BaseObject() { - mMesh = mesh; - mIsEnabled = true; + m_mesh = mesh; + m_isEnabled = true; } @@ -33,14 +33,14 @@ namespace EMotionFX // check if the deformer is enabled bool MeshDeformer::GetIsEnabled() const { - return mIsEnabled; + return m_isEnabled; } // enable or disable it void MeshDeformer::SetIsEnabled(bool enabled) { - mIsEnabled = enabled; + m_isEnabled = enabled; } diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/MeshDeformer.h b/Gems/EMotionFX/Code/EMotionFX/Source/MeshDeformer.h index e1caeaf5a9..dcb95fcd82 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/MeshDeformer.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/MeshDeformer.h @@ -86,8 +86,8 @@ namespace EMotionFX void SetIsEnabled(bool enabled); protected: - Mesh* mMesh; /**< Pointer to the mesh to which the deformer belongs to.*/ - bool mIsEnabled; /**< When set to true, this mesh deformer will be processed, otherwise it will be skipped during update. */ + Mesh* m_mesh; /**< Pointer to the mesh to which the deformer belongs to.*/ + bool m_isEnabled; /**< When set to true, this mesh deformer will be processed, otherwise it will be skipped during update. */ /** * Default constructor. diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/MeshDeformerStack.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/MeshDeformerStack.cpp index ee204cf298..bf7fd657ec 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/MeshDeformerStack.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/MeshDeformerStack.cpp @@ -21,22 +21,22 @@ namespace EMotionFX MeshDeformerStack::MeshDeformerStack(Mesh* mesh) : BaseObject() { - mMesh = mesh; + m_mesh = mesh; } // destructor MeshDeformerStack::~MeshDeformerStack() { - for (MeshDeformer* deformer : mDeformers) + for (MeshDeformer* deformer : m_deformers) { deformer->Destroy(); } - mDeformers.clear(); + m_deformers.clear(); // reset - mMesh = nullptr; + m_mesh = nullptr; } @@ -50,7 +50,7 @@ namespace EMotionFX // returns the mesh Mesh* MeshDeformerStack::GetMesh() const { - return mMesh; + return m_mesh; } @@ -60,7 +60,7 @@ namespace EMotionFX bool firstEnabled = true; // iterate through the deformers and update them - for (MeshDeformer* deformer : mDeformers) + for (MeshDeformer* deformer : m_deformers) { // if the deformer is enabled if (deformer->GetIsEnabled() || forceUpdateDisabledDeformers) @@ -71,7 +71,7 @@ namespace EMotionFX firstEnabled = false; // reset all output vertex data to the original vertex data - mMesh->ResetToOriginalData(); + m_mesh->ResetToOriginalData(); } // update the mesh deformer @@ -84,7 +84,7 @@ namespace EMotionFX void MeshDeformerStack::UpdateByModifierType(ActorInstance* actorInstance, Node* node, float timeDelta, uint32 typeID, bool resetMesh, bool forceUpdateDisabledDeformers) { bool resetDone = false; - for (MeshDeformer* deformer : mDeformers) + for (MeshDeformer* deformer : m_deformers) { // if the deformer of the correct type and is enabled if (deformer->GetType() == typeID && (deformer->GetIsEnabled() || forceUpdateDisabledDeformers)) @@ -93,7 +93,7 @@ namespace EMotionFX if (resetMesh && !resetDone) { // reset all output vertex data to the original vertex data - mMesh->ResetToOriginalData(); + m_mesh->ResetToOriginalData(); resetDone = true; } @@ -108,12 +108,12 @@ namespace EMotionFX void MeshDeformerStack::ReinitializeDeformers(Actor* actor, Node* node, size_t lodLevel) { // if we have deformers in the stack - const size_t numDeformers = mDeformers.size(); + const size_t numDeformers = m_deformers.size(); // iterate through the deformers and reinitialize them for (size_t i = 0; i < numDeformers; ++i) { - mDeformers[i]->Reinitialize(actor, node, lodLevel); + m_deformers[i]->Reinitialize(actor, node, lodLevel); } } @@ -121,23 +121,23 @@ namespace EMotionFX void MeshDeformerStack::AddDeformer(MeshDeformer* meshDeformer) { // add the object into the stack - mDeformers.emplace_back(meshDeformer); + m_deformers.emplace_back(meshDeformer); } void MeshDeformerStack::InsertDeformer(size_t pos, MeshDeformer* meshDeformer) { // add the object into the stack - mDeformers.emplace(AZStd::next(begin(mDeformers), pos), meshDeformer); + m_deformers.emplace(AZStd::next(begin(m_deformers), pos), meshDeformer); } bool MeshDeformerStack::RemoveDeformer(MeshDeformer* meshDeformer) { // delete the object - if (const auto it = AZStd::find(begin(mDeformers), end(mDeformers), meshDeformer); it != end(mDeformers)) + if (const auto it = AZStd::find(begin(m_deformers), end(m_deformers), meshDeformer); it != end(m_deformers)) { - mDeformers.erase(it); + m_deformers.erase(it); return true; } return false; @@ -150,7 +150,7 @@ namespace EMotionFX MeshDeformerStack* newStack = aznew MeshDeformerStack(mesh); // clone all deformers - for (const MeshDeformer* deformer : mDeformers) + for (const MeshDeformer* deformer : m_deformers) { newStack->AddDeformer(deformer->Clone(mesh)); } @@ -162,14 +162,14 @@ namespace EMotionFX size_t MeshDeformerStack::GetNumDeformers() const { - return mDeformers.size(); + return m_deformers.size(); } MeshDeformer* MeshDeformerStack::GetDeformer(size_t nr) const { - MCORE_ASSERT(nr < mDeformers.size()); - return mDeformers[nr]; + MCORE_ASSERT(nr < m_deformers.size()); + return m_deformers[nr]; } @@ -177,9 +177,9 @@ namespace EMotionFX size_t MeshDeformerStack::RemoveAllDeformersByType(uint32 deformerTypeID) { size_t numRemoved = 0; - for (size_t a = 0; a < mDeformers.size(); ) + for (size_t a = 0; a < m_deformers.size(); ) { - MeshDeformer* deformer = mDeformers[a]; + MeshDeformer* deformer = m_deformers[a]; if (deformer->GetType() == deformerTypeID) { RemoveDeformer(deformer); @@ -199,7 +199,7 @@ namespace EMotionFX // remove all the deformers void MeshDeformerStack::RemoveAllDeformers() { - for (MeshDeformer* deformer : mDeformers) + for (MeshDeformer* deformer : m_deformers) { // retrieve the current deformer // remove the deformer @@ -213,7 +213,7 @@ namespace EMotionFX size_t MeshDeformerStack::EnableAllDeformersByType(uint32 deformerTypeID, bool enabled) { size_t numChanged = 0; - for (MeshDeformer* deformer : mDeformers) + for (MeshDeformer* deformer : m_deformers) { if (deformer->GetType() == deformerTypeID) { @@ -229,7 +229,7 @@ namespace EMotionFX // check if the stack contains a deformer of a specified type bool MeshDeformerStack::CheckIfHasDeformerOfType(uint32 deformerTypeID) const { - return AZStd::any_of(begin(mDeformers), end(mDeformers), [deformerTypeID](const MeshDeformer* deformer) + return AZStd::any_of(begin(m_deformers), end(m_deformers), [deformerTypeID](const MeshDeformer* deformer) { return deformer->GetType() == deformerTypeID; }); @@ -239,10 +239,10 @@ namespace EMotionFX // find a deformer by type ID MeshDeformer* MeshDeformerStack::FindDeformerByType(uint32 deformerTypeID, size_t occurrence) const { - const auto foundDeformer = AZStd::find_if(begin(mDeformers), end(mDeformers), [deformerTypeID, iter = occurrence](const MeshDeformer* deformer) mutable + const auto foundDeformer = AZStd::find_if(begin(m_deformers), end(m_deformers), [deformerTypeID, iter = occurrence](const MeshDeformer* deformer) mutable { return deformer->GetType() == deformerTypeID && iter-- == 0; }); - return foundDeformer != end(mDeformers) ? *foundDeformer : nullptr; + return foundDeformer != end(m_deformers) ? *foundDeformer : nullptr; } } // namespace EMotionFX diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/MeshDeformerStack.h b/Gems/EMotionFX/Code/EMotionFX/Source/MeshDeformerStack.h index ae63a1e495..885bc06cab 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/MeshDeformerStack.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/MeshDeformerStack.h @@ -159,8 +159,8 @@ namespace EMotionFX MeshDeformer* FindDeformerByType(uint32 deformerTypeID, size_t occurrence = 0) const; private: - AZStd::vector mDeformers; /**< The stack of deformers. */ - Mesh* mMesh; /**< Pointer to the mesh to which the modifier stack belongs to.*/ + AZStd::vector m_deformers; /**< The stack of deformers. */ + Mesh* m_mesh; /**< Pointer to the mesh to which the modifier stack belongs to.*/ /** * Constructor. diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/MorphMeshDeformer.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/MorphMeshDeformer.cpp index e3fd1552b0..8dd0c15d84 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/MorphMeshDeformer.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/MorphMeshDeformer.cpp @@ -63,13 +63,13 @@ namespace EMotionFX MorphMeshDeformer* result = aznew MorphMeshDeformer(mesh); // copy the deform passes - result->mDeformPasses.resize(mDeformPasses.size()); - for (size_t i = 0; i < mDeformPasses.size(); ++i) + result->m_deformPasses.resize(m_deformPasses.size()); + for (size_t i = 0; i < m_deformPasses.size(); ++i) { - DeformPass& pass = result->mDeformPasses[i]; - pass.mDeformDataNr = mDeformPasses[i].mDeformDataNr; - pass.mMorphTarget = mDeformPasses[i].mMorphTarget; - pass.mLastNearZero = false; + DeformPass& pass = result->m_deformPasses[i]; + pass.m_deformDataNr = m_deformPasses[i].m_deformDataNr; + pass.m_morphTarget = m_deformPasses[i].m_morphTarget; + pass.m_lastNearZero = false; } // return the result @@ -88,23 +88,23 @@ namespace EMotionFX const size_t lodLevel = actorInstance->GetLODLevel(); // apply all deform passes - for (DeformPass& deformPass : mDeformPasses) + for (DeformPass& deformPass : m_deformPasses) { // find the morph target - MorphTargetStandard* morphTarget = (MorphTargetStandard*)actor->GetMorphSetup(lodLevel)->FindMorphTargetByID(deformPass.mMorphTarget->GetID()); + MorphTargetStandard* morphTarget = (MorphTargetStandard*)actor->GetMorphSetup(lodLevel)->FindMorphTargetByID(deformPass.m_morphTarget->GetID()); if (morphTarget == nullptr) { continue; } // get the deform data and number of vertices to deform - MorphTargetStandard::DeformData* deformData = morphTarget->GetDeformData(deformPass.mDeformDataNr); - const uint32 numDeformVerts = deformData->mNumVerts; + MorphTargetStandard::DeformData* deformData = morphTarget->GetDeformData(deformPass.m_deformDataNr); + const uint32 numDeformVerts = deformData->m_numVerts; // this mesh deformer can't work on this mesh, because the deformdata number of vertices is bigger than the // number of vertices inside this mesh! // and that would make it crash, which isn't what we want - if (numDeformVerts > mMesh->GetNumVertices()) + if (numDeformVerts > m_mesh->GetNumVertices()) { continue; } @@ -120,7 +120,7 @@ namespace EMotionFX const bool nearZero = (MCore::Math::Abs(weight) < 0.0001f); // we are near zero, and the previous frame as well, so we can return - if (nearZero && deformPass.mLastNearZero) + if (nearZero && deformPass.m_lastNearZero) { continue; } @@ -128,36 +128,36 @@ namespace EMotionFX // update the flag if (nearZero) { - deformPass.mLastNearZero = true; + deformPass.m_lastNearZero = true; } else { - deformPass.mLastNearZero = false; // we moved away from zero influence + deformPass.m_lastNearZero = false; // we moved away from zero influence } // output data - AZ::Vector3* positions = static_cast(mMesh->FindVertexData(Mesh::ATTRIB_POSITIONS)); - AZ::Vector3* normals = static_cast(mMesh->FindVertexData(Mesh::ATTRIB_NORMALS)); - AZ::Vector4* tangents = static_cast(mMesh->FindVertexData(Mesh::ATTRIB_TANGENTS)); - AZ::Vector3* bitangents = static_cast(mMesh->FindVertexData(Mesh::ATTRIB_BITANGENTS)); + AZ::Vector3* positions = static_cast(m_mesh->FindVertexData(Mesh::ATTRIB_POSITIONS)); + AZ::Vector3* normals = static_cast(m_mesh->FindVertexData(Mesh::ATTRIB_NORMALS)); + AZ::Vector4* tangents = static_cast(m_mesh->FindVertexData(Mesh::ATTRIB_TANGENTS)); + AZ::Vector3* bitangents = static_cast(m_mesh->FindVertexData(Mesh::ATTRIB_BITANGENTS)); // input data - const MorphTargetStandard::DeformData::VertexDelta* deltas = deformData->mDeltas; - const float minValue = deformData->mMinValue; - const float maxValue = deformData->mMaxValue; + const MorphTargetStandard::DeformData::VertexDelta* deltas = deformData->m_deltas; + const float minValue = deformData->m_minValue; + const float maxValue = deformData->m_maxValue; if (tangents && bitangents) { // process all vertices that we need to deform for (uint32 v = 0; v < numDeformVerts; ++v) { - uint32 vtxNr = deltas[v].mVertexNr; + uint32 vtxNr = deltas[v].m_vertexNr; - positions [vtxNr] = positions[vtxNr] + deltas[v].mPosition.ToVector3(minValue, maxValue) * weight; - normals [vtxNr] = normals[vtxNr] + deltas[v].mNormal.ToVector3(-2.0f, 2.0f) * weight; - bitangents[vtxNr] = bitangents[vtxNr] + deltas[v].mBitangent.ToVector3(-2.0f, 2.0f) * weight; + positions [vtxNr] = positions[vtxNr] + deltas[v].m_position.ToVector3(minValue, maxValue) * weight; + normals [vtxNr] = normals[vtxNr] + deltas[v].m_normal.ToVector3(-2.0f, 2.0f) * weight; + bitangents[vtxNr] = bitangents[vtxNr] + deltas[v].m_bitangent.ToVector3(-2.0f, 2.0f) * weight; - const AZ::Vector3 tangentDirVector = deltas[v].mTangent.ToVector3(-2.0f, 2.0f); + const AZ::Vector3 tangentDirVector = deltas[v].m_tangent.ToVector3(-2.0f, 2.0f); tangents[vtxNr] += AZ::Vector4(tangentDirVector.GetX()*weight, tangentDirVector.GetY()*weight, tangentDirVector.GetZ()*weight, 0.0f); } } @@ -165,12 +165,12 @@ namespace EMotionFX { for (uint32 v = 0; v < numDeformVerts; ++v) { - uint32 vtxNr = deltas[v].mVertexNr; + uint32 vtxNr = deltas[v].m_vertexNr; - positions[vtxNr] = positions[vtxNr] + deltas[v].mPosition.ToVector3(minValue, maxValue) * weight; - normals [vtxNr] = normals[vtxNr] + deltas[v].mNormal.ToVector3(-2.0f, 2.0f) * weight; + positions[vtxNr] = positions[vtxNr] + deltas[v].m_position.ToVector3(minValue, maxValue) * weight; + normals [vtxNr] = normals[vtxNr] + deltas[v].m_normal.ToVector3(-2.0f, 2.0f) * weight; - const AZ::Vector3 tangentDirVector = deltas[v].mTangent.ToVector3(-2.0f, 2.0f); + const AZ::Vector3 tangentDirVector = deltas[v].m_tangent.ToVector3(-2.0f, 2.0f); tangents[vtxNr] += AZ::Vector4(tangentDirVector.GetX()*weight, tangentDirVector.GetY()*weight, tangentDirVector.GetZ()*weight, 0.0f); } } @@ -179,10 +179,10 @@ namespace EMotionFX // process all vertices that we need to deform for (uint32 v = 0; v < numDeformVerts; ++v) { - uint32 vtxNr = deltas[v].mVertexNr; + uint32 vtxNr = deltas[v].m_vertexNr; - positions[vtxNr] = positions[vtxNr] + deltas[v].mPosition.ToVector3(minValue, maxValue) * weight; - normals[vtxNr] = normals[vtxNr] + deltas[v].mNormal.ToVector3(-2.0f, 2.0f) * weight; + positions[vtxNr] = positions[vtxNr] + deltas[v].m_position.ToVector3(minValue, maxValue) * weight; + normals[vtxNr] = normals[vtxNr] + deltas[v].m_normal.ToVector3(-2.0f, 2.0f) * weight; } } } @@ -193,7 +193,7 @@ namespace EMotionFX void MorphMeshDeformer::Reinitialize(Actor* actor, Node* node, size_t lodLevel) { // clear the deform passes, but don't free the currently allocated/reserved memory - mDeformPasses.clear(); + m_deformPasses.clear(); // get the morph setup MorphSetup* morphSetup = actor->GetMorphSetup(lodLevel); @@ -211,13 +211,13 @@ namespace EMotionFX { // get the deform data and only add it to our deformer in case it belongs to our mesh MorphTargetStandard::DeformData* deformData = morphTarget->GetDeformData(j); - if (deformData->mNodeIndex == node->GetNodeIndex()) + if (deformData->m_nodeIndex == node->GetNodeIndex()) { // add an empty deform pass and fill it afterwards - mDeformPasses.emplace_back(); - const size_t deformPassIndex = mDeformPasses.size() - 1; - mDeformPasses[deformPassIndex].mDeformDataNr = j; - mDeformPasses[deformPassIndex].mMorphTarget = morphTarget; + m_deformPasses.emplace_back(); + const size_t deformPassIndex = m_deformPasses.size() - 1; + m_deformPasses[deformPassIndex].m_deformDataNr = j; + m_deformPasses[deformPassIndex].m_morphTarget = morphTarget; } } } @@ -226,18 +226,18 @@ namespace EMotionFX void MorphMeshDeformer::AddDeformPass(const DeformPass& deformPass) { - mDeformPasses.emplace_back(deformPass); + m_deformPasses.emplace_back(deformPass); } size_t MorphMeshDeformer::GetNumDeformPasses() const { - return mDeformPasses.size(); + return m_deformPasses.size(); } void MorphMeshDeformer::ReserveDeformPasses(size_t numPasses) { - mDeformPasses.reserve(numPasses); + m_deformPasses.reserve(numPasses); } } // namespace EMotionFX diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/MorphMeshDeformer.h b/Gems/EMotionFX/Code/EMotionFX/Source/MorphMeshDeformer.h index 882d4bdfeb..fb4b2efa5c 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/MorphMeshDeformer.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/MorphMeshDeformer.h @@ -54,18 +54,18 @@ namespace EMotionFX */ struct EMFX_API DeformPass { - MorphTargetStandard* mMorphTarget; /**< The morph target working on the mesh. */ - size_t mDeformDataNr; /**< An index inside the deform datas of the standard morph target. */ - bool mLastNearZero; /**< Was the last frame's weight near zero? */ + MorphTargetStandard* m_morphTarget; /**< The morph target working on the mesh. */ + size_t m_deformDataNr; /**< An index inside the deform datas of the standard morph target. */ + bool m_lastNearZero; /**< Was the last frame's weight near zero? */ /** * Constructor. * Automatically initializes on defaults. */ DeformPass() - : mMorphTarget(nullptr) - , mDeformDataNr(InvalidIndex) - , mLastNearZero(false) {} + : m_morphTarget(nullptr) + , m_deformDataNr(InvalidIndex) + , m_lastNearZero(false) {} }; /** @@ -132,7 +132,7 @@ namespace EMotionFX void ReserveDeformPasses(size_t numPasses); private: - AZStd::vector mDeformPasses; /**< The deform passes. Each pass basically represents a morph target. */ + AZStd::vector m_deformPasses; /**< The deform passes. Each pass basically represents a morph target. */ /** * Default constructor. diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/MorphSetup.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/MorphSetup.cpp index d4a70dd070..9836325ff2 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/MorphSetup.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/MorphSetup.cpp @@ -35,7 +35,7 @@ namespace EMotionFX // add a morph target void MorphSetup::AddMorphTarget(MorphTarget* morphTarget) { - mMorphTargets.emplace_back(morphTarget); + m_morphTargets.emplace_back(morphTarget); } @@ -44,20 +44,20 @@ namespace EMotionFX { if (delFromMem) { - mMorphTargets[nr]->Destroy(); + m_morphTargets[nr]->Destroy(); } - mMorphTargets.erase(AZStd::next(begin(mMorphTargets), nr)); + m_morphTargets.erase(AZStd::next(begin(m_morphTargets), nr)); } // remove a morph target void MorphSetup::RemoveMorphTarget(MorphTarget* morphTarget, bool delFromMem) { - const auto* foundMorphTarget = AZStd::find(begin(mMorphTargets), end(mMorphTargets), morphTarget); - if (foundMorphTarget != end(mMorphTargets)) + const auto* foundMorphTarget = AZStd::find(begin(m_morphTargets), end(m_morphTargets), morphTarget); + if (foundMorphTarget != end(m_morphTargets)) { - mMorphTargets.erase(foundMorphTarget); + m_morphTargets.erase(foundMorphTarget); } if (delFromMem) @@ -70,76 +70,76 @@ namespace EMotionFX // remove all morph targets void MorphSetup::RemoveAllMorphTargets() { - for (MorphTarget*& morphTarget : mMorphTargets) + for (MorphTarget*& morphTarget : m_morphTargets) { morphTarget->Destroy(); } - mMorphTargets.clear(); + m_morphTargets.clear(); } // get a morph target by ID MorphTarget* MorphSetup::FindMorphTargetByID(uint32 id) const { - const auto foundMorphTarget = AZStd::find_if(begin(mMorphTargets), end(mMorphTargets), [id](const MorphTarget* morphTarget) + const auto foundMorphTarget = AZStd::find_if(begin(m_morphTargets), end(m_morphTargets), [id](const MorphTarget* morphTarget) { return morphTarget->GetID() == id; }); - return foundMorphTarget != end(mMorphTargets) ? *foundMorphTarget : nullptr; + return foundMorphTarget != end(m_morphTargets) ? *foundMorphTarget : nullptr; } // get a morph target number by ID size_t MorphSetup::FindMorphTargetNumberByID(uint32 id) const { - const auto foundMorphTarget = AZStd::find_if(begin(mMorphTargets), end(mMorphTargets), [id](const MorphTarget* morphTarget) + const auto foundMorphTarget = AZStd::find_if(begin(m_morphTargets), end(m_morphTargets), [id](const MorphTarget* morphTarget) { return morphTarget->GetID() == id; }); - return foundMorphTarget != end(mMorphTargets) ? AZStd::distance(begin(mMorphTargets), foundMorphTarget) : InvalidIndex; + return foundMorphTarget != end(m_morphTargets) ? AZStd::distance(begin(m_morphTargets), foundMorphTarget) : InvalidIndex; } size_t MorphSetup::FindMorphTargetIndexByName(const char* name) const { - const auto foundMorphTarget = AZStd::find_if(begin(mMorphTargets), end(mMorphTargets), [name](const MorphTarget* morphTarget) + const auto foundMorphTarget = AZStd::find_if(begin(m_morphTargets), end(m_morphTargets), [name](const MorphTarget* morphTarget) { return morphTarget->GetNameString() == name; }); - return foundMorphTarget != end(mMorphTargets) ? AZStd::distance(begin(mMorphTargets), foundMorphTarget) : InvalidIndex; + return foundMorphTarget != end(m_morphTargets) ? AZStd::distance(begin(m_morphTargets), foundMorphTarget) : InvalidIndex; } size_t MorphSetup::FindMorphTargetIndexByNameNoCase(const char* name) const { - const auto foundMorphTarget = AZStd::find_if(begin(mMorphTargets), end(mMorphTargets), [name](const MorphTarget* morphTarget) + const auto foundMorphTarget = AZStd::find_if(begin(m_morphTargets), end(m_morphTargets), [name](const MorphTarget* morphTarget) { return AzFramework::StringFunc::Equal(morphTarget->GetNameString().c_str(), name, false /* no case */); }); - return foundMorphTarget != end(mMorphTargets) ? AZStd::distance(begin(mMorphTargets), foundMorphTarget) : InvalidIndex; + return foundMorphTarget != end(m_morphTargets) ? AZStd::distance(begin(m_morphTargets), foundMorphTarget) : InvalidIndex; } // find a morph target by name (case sensitive) MorphTarget* MorphSetup::FindMorphTargetByName(const char* name) const { - const auto foundMorphTarget = AZStd::find_if(begin(mMorphTargets), end(mMorphTargets), [name](const MorphTarget* morphTarget) + const auto foundMorphTarget = AZStd::find_if(begin(m_morphTargets), end(m_morphTargets), [name](const MorphTarget* morphTarget) { return morphTarget->GetNameString() == name; }); - return foundMorphTarget != end(mMorphTargets) ? *foundMorphTarget : nullptr; + return foundMorphTarget != end(m_morphTargets) ? *foundMorphTarget : nullptr; } // find a morph target by name (not case sensitive) MorphTarget* MorphSetup::FindMorphTargetByNameNoCase(const char* name) const { - const auto foundMorphTarget = AZStd::find_if(begin(mMorphTargets), end(mMorphTargets), [name](const MorphTarget* morphTarget) + const auto foundMorphTarget = AZStd::find_if(begin(m_morphTargets), end(m_morphTargets), [name](const MorphTarget* morphTarget) { return AzFramework::StringFunc::Equal(morphTarget->GetNameString().c_str(), name, false /* no case */); }); - return foundMorphTarget != end(mMorphTargets) ? *foundMorphTarget : nullptr; + return foundMorphTarget != end(m_morphTargets) ? *foundMorphTarget : nullptr; } @@ -150,7 +150,7 @@ namespace EMotionFX MorphSetup* clone = MorphSetup::Create(); // clone all morph targets - for (const MorphTarget* morphTarget : mMorphTargets) + for (const MorphTarget* morphTarget : m_morphTargets) { clone->AddMorphTarget(morphTarget->Clone()); } @@ -162,7 +162,7 @@ namespace EMotionFX void MorphSetup::ReserveMorphTargets(size_t numMorphTargets) { - mMorphTargets.reserve(numMorphTargets); + m_morphTargets.reserve(numMorphTargets); } @@ -176,7 +176,7 @@ namespace EMotionFX } // scale the morph targets - for (MorphTarget* morphTarget : mMorphTargets) + for (MorphTarget* morphTarget : m_morphTargets) { morphTarget->Scale(scaleFactor); } diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/MorphSetup.h b/Gems/EMotionFX/Code/EMotionFX/Source/MorphSetup.h index 23a5789e03..12014dba8e 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/MorphSetup.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/MorphSetup.h @@ -40,14 +40,14 @@ namespace EMotionFX * Get the number of morph targets inside this morph setup. * @result The number of morph targets. */ - MCORE_INLINE size_t GetNumMorphTargets() const { return mMorphTargets.size(); } + MCORE_INLINE size_t GetNumMorphTargets() const { return m_morphTargets.size(); } /** * Get a given morph target. * @param nr The morph target number, must be in range of [0..GetNumMorphTargets()-1]. * @result A pointer to the morph target. */ - MCORE_INLINE MorphTarget* GetMorphTarget(size_t nr) const { return mMorphTargets[nr]; } + MCORE_INLINE MorphTarget* GetMorphTarget(size_t nr) const { return m_morphTargets[nr]; } /** * Add a morph target to this morph setup. @@ -137,7 +137,7 @@ namespace EMotionFX protected: - AZStd::vector mMorphTargets; /**< The collection of morph targets. */ + AZStd::vector m_morphTargets; /**< The collection of morph targets. */ /** * The constructor. diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/MorphSetupInstance.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/MorphSetupInstance.cpp index df4aaa0e7c..5b6e85d653 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/MorphSetupInstance.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/MorphSetupInstance.cpp @@ -62,12 +62,12 @@ namespace EMotionFX // allocate the number of morph targets const size_t numMorphTargets = morphSetup->GetNumMorphTargets(); - mMorphTargets.resize(numMorphTargets); + m_morphTargets.resize(numMorphTargets); // update the ID values for (uint32 i = 0; i < numMorphTargets; ++i) { - mMorphTargets[i].SetID(morphSetup->GetMorphTarget(i)->GetID()); + m_morphTargets[i].SetID(morphSetup->GetMorphTarget(i)->GetID()); } } @@ -76,11 +76,11 @@ namespace EMotionFX size_t MorphSetupInstance::FindMorphTargetIndexByID(uint32 id) const { // try to locate the morph target with the given ID - const auto foundElement = AZStd::find_if(mMorphTargets.begin(), mMorphTargets.end(), [id](const MorphTarget& morphTarget) + const auto foundElement = AZStd::find_if(m_morphTargets.begin(), m_morphTargets.end(), [id](const MorphTarget& morphTarget) { return morphTarget.GetID() == id; }); - return foundElement != mMorphTargets.end() ? AZStd::distance(mMorphTargets.begin(), foundElement) : InvalidIndex; + return foundElement != m_morphTargets.end() ? AZStd::distance(m_morphTargets.begin(), foundElement) : InvalidIndex; } @@ -89,7 +89,7 @@ namespace EMotionFX const size_t index = FindMorphTargetIndexByID(id); if (index != InvalidIndex) { - return &mMorphTargets[index]; + return &m_morphTargets[index]; } else { diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/MorphSetupInstance.h b/Gems/EMotionFX/Code/EMotionFX/Source/MorphSetupInstance.h index e93ed7cf6d..d0c71f1f84 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/MorphSetupInstance.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/MorphSetupInstance.h @@ -41,9 +41,9 @@ namespace EMotionFX * The constructor. */ MorphTarget() - : mID(MCORE_INVALIDINDEX32) - , mWeight(0.0f) - , mIsInManualMode(false) {} + : m_id(MCORE_INVALIDINDEX32) + , m_weight(0.0f) + , m_isInManualMode(false) {} /** * The destructor. @@ -55,13 +55,13 @@ namespace EMotionFX * This ID links the MorphTarget class with this local morph target class. * @result The ID of this morph target. */ - MCORE_INLINE uint32 GetID() const { return mID; } + MCORE_INLINE uint32 GetID() const { return m_id; } /** * Get the weight value of the morph target. * @result The weight value. */ - float GetWeight() const { return mWeight; } + float GetWeight() const { return m_weight; } /** * Check if we are in manual mode or not. @@ -69,20 +69,20 @@ namespace EMotionFX * then the motion system will overwrite the weight values. * @result Returns true when we are in manual mode, otherwise false is returned. */ - bool GetIsInManualMode() const { return mIsInManualMode; } + bool GetIsInManualMode() const { return m_isInManualMode; } /** * Set the ID of this morph target. * This ID links the MorphTarget class with this local morph target class. * @param id The ID to use. */ - void SetID(uint32 id) { mID = id; } + void SetID(uint32 id) { m_id = id; } /** * Set the weight value of the morph target. * @param weight The weight value. */ - void SetWeight(float weight) { mWeight = weight; } + void SetWeight(float weight) { m_weight = weight; } /** * Enable or disable manual mode. @@ -90,12 +90,12 @@ namespace EMotionFX * then the motion system will overwrite the weight values. * @param enabled Set to true if you wish to enable manual mode on this morph target. Otherwise set to false. */ - void SetManualMode(bool enabled) { mIsInManualMode = enabled; } + void SetManualMode(bool enabled) { m_isInManualMode = enabled; } private: - uint32 mID; /**< The ID, which is based on the weight. */ - float mWeight; /**< The weight for this morph target. */ - bool mIsInManualMode; /**< The flag if we are in manual weight update mode or not. */ + uint32 m_id; /**< The ID, which is based on the weight. */ + float m_weight; /**< The weight for this morph target. */ + bool m_isInManualMode; /**< The flag if we are in manual weight update mode or not. */ }; @@ -123,16 +123,16 @@ namespace EMotionFX * This should always be equal to the number of morph targets in the highest detail. * @result The number of morph targets. */ - MCORE_INLINE size_t GetNumMorphTargets() const { return mMorphTargets.size(); } + MCORE_INLINE size_t GetNumMorphTargets() const { return m_morphTargets.size(); } /** * Get a specific morph target. * @param nr The morph target number, which must be in range of [0..GetNumMorphTargets()-1]. * @result A pointer to the morph target inside this class. */ - MCORE_INLINE MorphTarget* GetMorphTarget(size_t nr) { return &mMorphTargets[nr]; } + MCORE_INLINE MorphTarget* GetMorphTarget(size_t nr) { return &m_morphTargets[nr]; } - MCORE_INLINE const MorphTarget* GetMorphTarget(size_t nr) const { return &mMorphTargets[nr]; } + MCORE_INLINE const MorphTarget* GetMorphTarget(size_t nr) const { return &m_morphTargets[nr]; } /** * Find a given morph target number by its ID. @@ -149,7 +149,7 @@ namespace EMotionFX MorphTarget* FindMorphTargetByID(uint32 id); private: - AZStd::vector mMorphTargets; /**< The unique morph target information. */ + AZStd::vector m_morphTargets; /**< The unique morph target information. */ /** * The default constructor. diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/MorphTarget.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/MorphTarget.cpp index 9ccafbb5f3..f2ff9eef5d 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/MorphTarget.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/MorphTarget.cpp @@ -23,9 +23,9 @@ namespace EMotionFX MorphTarget::MorphTarget(const char* name) : BaseObject() { - mRangeMin = 0.0f; - mRangeMax = 1.0f; - mPhonemeSets = PHONEMESET_NONE; + m_rangeMin = 0.0f; + m_rangeMax = 1.0f; + m_phonemeSets = PHONEMESET_NONE; // set the name SetName(name); @@ -177,10 +177,10 @@ namespace EMotionFX // calculate the weight in range of 0..1 float MorphTarget::CalcNormalizedWeight(float rangedWeight) const { - const float range = mRangeMax - mRangeMin; + const float range = m_rangeMax - m_rangeMin; if (MCore::Math::Abs(range) > 0.0f) { - return (rangedWeight - mRangeMin) / range; + return (rangedWeight - m_rangeMin) / range; } else { @@ -201,11 +201,11 @@ namespace EMotionFX { if (enabled) { - mPhonemeSets = (EPhonemeSet)((uint32)mPhonemeSets | (uint32)set); + m_phonemeSets = (EPhonemeSet)((uint32)m_phonemeSets | (uint32)set); } else { - mPhonemeSets = (EPhonemeSet)((uint32)mPhonemeSets & (uint32) ~set); + m_phonemeSets = (EPhonemeSet)((uint32)m_phonemeSets & (uint32) ~set); } } @@ -213,87 +213,87 @@ namespace EMotionFX // copy the base class members to the target class void MorphTarget::CopyBaseClassMemberValues(MorphTarget* target) const { - target->mNameID = mNameID; - target->mRangeMin = mRangeMin; - target->mRangeMax = mRangeMax; - target->mPhonemeSets = mPhonemeSets; + target->m_nameId = m_nameId; + target->m_rangeMin = m_rangeMin; + target->m_rangeMax = m_rangeMax; + target->m_phonemeSets = m_phonemeSets; } const char* MorphTarget::GetName() const { - return MCore::GetStringIdPool().GetName(mNameID).c_str(); + return MCore::GetStringIdPool().GetName(m_nameId).c_str(); } const AZStd::string& MorphTarget::GetNameString() const { - return MCore::GetStringIdPool().GetName(mNameID); + return MCore::GetStringIdPool().GetName(m_nameId); } void MorphTarget::SetRangeMin(float rangeMin) { - mRangeMin = rangeMin; + m_rangeMin = rangeMin; } void MorphTarget::SetRangeMax(float rangeMax) { - mRangeMax = rangeMax; + m_rangeMax = rangeMax; } float MorphTarget::GetRangeMin() const { - return mRangeMin; + return m_rangeMin; } float MorphTarget::GetRangeMax() const { - return mRangeMax; + return m_rangeMax; } void MorphTarget::SetName(const char* name) { - mNameID = MCore::GetStringIdPool().GenerateIdForString(name); + m_nameId = MCore::GetStringIdPool().GenerateIdForString(name); } void MorphTarget::SetPhonemeSets(EPhonemeSet phonemeSets) { - mPhonemeSets = phonemeSets; + m_phonemeSets = phonemeSets; } MorphTarget::EPhonemeSet MorphTarget::GetPhonemeSets() const { - return mPhonemeSets; + return m_phonemeSets; } bool MorphTarget::GetIsPhonemeSetEnabled(EPhonemeSet set) const { - return (mPhonemeSets & set) != 0; + return (m_phonemeSets & set) != 0; } float MorphTarget::CalcRangedWeight(float weight) const { - return mRangeMin + (weight * (mRangeMax - mRangeMin)); + return m_rangeMin + (weight * (m_rangeMax - m_rangeMin)); } float MorphTarget::CalcZeroInfluenceWeight() const { - return MCore::Math::Abs(mRangeMin) / MCore::Math::Abs(mRangeMax - mRangeMin); + return MCore::Math::Abs(m_rangeMin) / MCore::Math::Abs(m_rangeMax - m_rangeMin); } bool MorphTarget::GetIsPhoneme() const { - return (mPhonemeSets != PHONEMESET_NONE); + return (m_phonemeSets != PHONEMESET_NONE); } } // namespace EMotionFX diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/MorphTarget.h b/Gems/EMotionFX/Code/EMotionFX/Source/MorphTarget.h index 35e2f620ae..0cd85222d0 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/MorphTarget.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/MorphTarget.h @@ -77,7 +77,7 @@ namespace EMotionFX * name compares to simple integer compares. * @result The unique ID of the morph target. */ - MCORE_INLINE uint32 GetID() const { return mNameID; } + MCORE_INLINE uint32 GetID() const { return m_nameId; } /** * Get the unique name of the morph target. @@ -276,10 +276,10 @@ namespace EMotionFX virtual void Scale(float scaleFactor) = 0; protected: - uint32 mNameID; /**< The unique ID of the morph target, calculated from the name. */ - float mRangeMin; /**< The minimum range of the weight. */ - float mRangeMax; /**< The maximum range of the weight. */ - EPhonemeSet mPhonemeSets; /**< The phoneme sets in case this morph target is used as a phoneme. */ + uint32 m_nameId; /**< The unique ID of the morph target, calculated from the name. */ + float m_rangeMin; /**< The minimum range of the weight. */ + float m_rangeMax; /**< The maximum range of the weight. */ + EPhonemeSet m_phonemeSets; /**< The phoneme sets in case this morph target is used as a phoneme. */ /** * The constructor. diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/MorphTargetStandard.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/MorphTargetStandard.cpp index c86815be80..ccb849a0d3 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/MorphTargetStandard.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/MorphTargetStandard.cpp @@ -65,22 +65,12 @@ namespace EMotionFX if (captureTransforms) { - // get a bone list, if we also captured meshes, because in that case we want - // to disable capturing transforms for the bones since the deforms already have been captured - // by the mesh capture - //Array boneList; - //if (mCaptureMeshDeforms) - //pose->ExtractBoneList(0, &boneList); - Skeleton* targetSkeleton = targetPose->GetSkeleton(); Skeleton* neutralSkeleton = neutralPose->GetSkeleton(); const Pose& neutralBindPose = *neutralPose->GetBindPose(); const Pose& targetBindPose = *targetPose->GetBindPose(); - // Transform* neutralData = neutralPose->GetBindPoseLocalTransforms(); - // Transform* targetData = targetPose->GetBindPoseLocalTransforms(); - // check for transformation changes const size_t numPoseNodes = targetSkeleton->GetNumNodes(); for (size_t i = 0; i < numPoseNodes; ++i) @@ -99,25 +89,18 @@ namespace EMotionFX const size_t neutralNodeIndex = neutralNode->GetNodeIndex(); const size_t targetNodeIndex = targetSkeleton->GetNode(i)->GetNodeIndex(); - // skip bones in the bone list - //if (mCaptureMeshDeforms) - //if (boneList.Contains( nodeA )) - //continue; - const Transform& neutralTransform = neutralBindPose.GetLocalSpaceTransform(neutralNodeIndex); const Transform& targetTransform = targetBindPose.GetLocalSpaceTransform(targetNodeIndex); - AZ::Vector3 neutralPos = neutralTransform.mPosition; - AZ::Vector3 targetPos = targetTransform.mPosition; - AZ::Quaternion neutralRot = neutralTransform.mRotation; - AZ::Quaternion targetRot = targetTransform.mRotation; + AZ::Vector3 neutralPos = neutralTransform.m_position; + AZ::Vector3 targetPos = targetTransform.m_position; + AZ::Quaternion neutralRot = neutralTransform.m_rotation; + AZ::Quaternion targetRot = targetTransform.m_rotation; EMFX_SCALECODE ( - AZ::Vector3 neutralScale = neutralTransform.mScale; - AZ::Vector3 targetScale = targetTransform.mScale; - //AZ::Quaternion neutralScaleRot = neutralTransform.mScaleRotation; - //AZ::Quaternion targetScaleRot = targetTransform.mScaleRotation; + AZ::Vector3 neutralScale = neutralTransform.m_scale; + AZ::Vector3 targetScale = targetTransform.m_scale; ) // check if the position changed @@ -137,9 +120,6 @@ namespace EMotionFX changed = (MCore::Compare::CheckIfIsClose(neutralScale, targetScale, MCore::Math::epsilon) == false); } - // check if the scale rotation changed - // if (changed == false) - // changed = (MCore::Compare::CheckIfIsClose(neutralScaleRot, targetScaleRot, MCore::Math::epsilon) == false); ) // if this node changed transformation @@ -147,23 +127,20 @@ namespace EMotionFX { // create a transform object form the node in the pose Transformation transform; - transform.mPosition = targetPos - neutralPos; - transform.mRotation = targetRot; + transform.m_position = targetPos - neutralPos; + transform.m_rotation = targetRot; EMFX_SCALECODE ( - //transform.mScaleRotation= targetScaleRot; - transform.mScale = targetScale - neutralScale; + transform.m_scale = targetScale - neutralScale; ) - transform.mNodeIndex = neutralNodeIndex; + transform.m_nodeIndex = neutralNodeIndex; // add the new transform AddTransformation(transform); } } - - //LogInfo("Num transforms = %d", mTransforms.GetLength()); } } @@ -173,24 +150,24 @@ namespace EMotionFX void MorphTargetStandard::ApplyTransformation(ActorInstance* actorInstance, size_t nodeIndex, AZ::Vector3& position, AZ::Quaternion& rotation, AZ::Vector3& scale, float weight) { // calculate the normalized weight (in range of 0..1) - const float newWeight = MCore::Clamp(weight, mRangeMin, mRangeMax); // make sure its within the range + const float newWeight = MCore::Clamp(weight, m_rangeMin, m_rangeMax); // make sure its within the range const float normalizedWeight = CalcNormalizedWeight(newWeight); // convert in range of 0..1 // calculate the new transformations for all nodes of this morph target - for (const Transformation& transform : mTransforms) + for (const Transformation& transform : m_transforms) { // if this is the node that gets modified by this transform - if (transform.mNodeIndex != nodeIndex) + if (transform.m_nodeIndex != nodeIndex) { continue; } - position += transform.mPosition * newWeight; - scale += transform.mScale * newWeight; + position += transform.m_position * newWeight; + scale += transform.m_scale * newWeight; // rotate additively - const AZ::Quaternion& orgRot = actorInstance->GetTransformData()->GetBindPose()->GetLocalSpaceTransform(nodeIndex).mRotation; - const AZ::Quaternion rot = orgRot.NLerp(transform.mRotation, normalizedWeight); + const AZ::Quaternion& orgRot = actorInstance->GetTransformData()->GetBindPose()->GetLocalSpaceTransform(nodeIndex).m_rotation; + const AZ::Quaternion rot = orgRot.NLerp(transform.m_rotation, normalizedWeight); rotation = rotation * (orgRot.GetInverseFull() * rot); rotation.Normalize(); @@ -204,14 +181,14 @@ namespace EMotionFX bool MorphTargetStandard::Influences(size_t nodeIndex) const { return - AZStd::any_of(begin(mDeformDatas), end(mDeformDatas), [nodeIndex](const DeformData* deformData) + AZStd::any_of(begin(m_deformDatas), end(m_deformDatas), [nodeIndex](const DeformData* deformData) { - return deformData->mNodeIndex == nodeIndex; + return deformData->m_nodeIndex == nodeIndex; }) || - AZStd::any_of(begin(mTransforms), end(mTransforms), [nodeIndex](const Transformation& transform) + AZStd::any_of(begin(m_transforms), end(m_transforms), [nodeIndex](const Transformation& transform) { - return transform.mNodeIndex == nodeIndex; + return transform.m_nodeIndex == nodeIndex; }); } @@ -220,45 +197,34 @@ namespace EMotionFX void MorphTargetStandard::Apply(ActorInstance* actorInstance, float weight) { // calculate the normalized weight (in range of 0..1) - const float newWeight = MCore::Clamp(weight, mRangeMin, mRangeMax); // make sure its within the range + const float newWeight = MCore::Clamp(weight, m_rangeMin, m_rangeMax); // make sure its within the range const float normalizedWeight = CalcNormalizedWeight(newWeight); // convert in range of 0..1 TransformData* transformData = actorInstance->GetTransformData(); Transform newTransform; // calculate the new transformations for all nodes of this morph target - for (const Transformation& transform : mTransforms) + for (const Transformation& transform : m_transforms) { // try to find the node - const size_t nodeIndex = transform.mNodeIndex; + const size_t nodeIndex = transform.m_nodeIndex; // init the transform data newTransform = transformData->GetCurrentPose()->GetLocalSpaceTransform(nodeIndex); // calc new position and scale (delta based targetTransform) - newTransform.mPosition += transform.mPosition * newWeight; + newTransform.m_position += transform.m_position * newWeight; EMFX_SCALECODE ( - newTransform.mScale += transform.mScale * newWeight; - // newTransform.mScaleRotation.Identity(); + newTransform.m_scale += transform.m_scale * newWeight; ) // rotate additively - const AZ::Quaternion& orgRot = transformData->GetBindPose()->GetLocalSpaceTransform(nodeIndex).mRotation; - const AZ::Quaternion rot = orgRot.NLerp(transform.mRotation, normalizedWeight); - newTransform.mRotation = newTransform.mRotation * (orgRot.GetInverseFull() * rot); - newTransform.mRotation.Normalize(); - /* - // scale rotate additively - orgRot = actorInstance->GetTransformData()->GetOrgScaleRot( nodeIndex ); - a = orgRot; - b = mTransforms[i].mScaleRotation; - rot = a.Lerp(b, normalizedWeight); - rot.Normalize(); - newTransform.mScaleRotation = newTransform.mScaleRotation * (orgRot.Inversed() * rot); - newTransform.mScaleRotation.Normalize(); - */ + const AZ::Quaternion& orgRot = transformData->GetBindPose()->GetLocalSpaceTransform(nodeIndex).m_rotation; + const AZ::Quaternion rot = orgRot.NLerp(transform.m_rotation, normalizedWeight); + newTransform.m_rotation = newTransform.m_rotation * (orgRot.GetInverseFull() * rot); + newTransform.m_rotation.Normalize(); // set the new transformation transformData->GetCurrentPose()->SetLocalSpaceTransform(nodeIndex, newTransform); } @@ -266,33 +232,33 @@ namespace EMotionFX size_t MorphTargetStandard::GetNumDeformDatas() const { - return mDeformDatas.size(); + return m_deformDatas.size(); } MorphTargetStandard::DeformData* MorphTargetStandard::GetDeformData(size_t nr) const { - return mDeformDatas[nr]; + return m_deformDatas[nr]; } void MorphTargetStandard::AddDeformData(DeformData* data) { - mDeformDatas.emplace_back(data); + m_deformDatas.emplace_back(data); } void MorphTargetStandard::AddTransformation(const Transformation& transform) { - mTransforms.emplace_back(transform); + m_transforms.emplace_back(transform); } // get the number of transformations in this morph target size_t MorphTargetStandard::GetNumTransformations() const { - return mTransforms.size(); + return m_transforms.size(); } MorphTargetStandard::Transformation& MorphTargetStandard::GetTransformation(size_t nr) { - return mTransforms[nr]; + return m_transforms[nr]; } @@ -305,13 +271,13 @@ namespace EMotionFX // now copy over the standard morph target related values // first start with the transforms - clone->mTransforms = mTransforms; + clone->m_transforms = m_transforms; // now clone the deform datas - clone->mDeformDatas.resize(mDeformDatas.size()); - for (uint32 i = 0; i < mDeformDatas.size(); ++i) + clone->m_deformDatas.resize(m_deformDatas.size()); + for (uint32 i = 0; i < m_deformDatas.size(); ++i) { - clone->mDeformDatas[i] = mDeformDatas[i]->Clone(); + clone->m_deformDatas[i] = m_deformDatas[i]->Clone(); } // return the clone @@ -327,18 +293,18 @@ namespace EMotionFX // constructor MorphTargetStandard::DeformData::DeformData(size_t nodeIndex, uint32 numVerts) { - mNodeIndex = nodeIndex; - mNumVerts = numVerts; - mDeltas = (VertexDelta*)MCore::Allocate(numVerts * sizeof(VertexDelta), EMFX_MEMCATEGORY_GEOMETRY_PMORPHTARGETS, MorphTargetStandard::MEMORYBLOCK_ID); - mMinValue = -10.0f; - mMaxValue = +10.0f; + m_nodeIndex = nodeIndex; + m_numVerts = numVerts; + m_deltas = (VertexDelta*)MCore::Allocate(numVerts * sizeof(VertexDelta), EMFX_MEMCATEGORY_GEOMETRY_PMORPHTARGETS, MorphTargetStandard::MEMORYBLOCK_ID); + m_minValue = -10.0f; + m_maxValue = +10.0f; } // destructor MorphTargetStandard::DeformData::~DeformData() { - MCore::Free(mDeltas); + MCore::Free(m_deltas); } @@ -352,62 +318,62 @@ namespace EMotionFX // clone a morph target MorphTargetStandard::DeformData* MorphTargetStandard::DeformData::Clone() { - MorphTargetStandard::DeformData* clone = aznew MorphTargetStandard::DeformData(mNodeIndex, mNumVerts); + MorphTargetStandard::DeformData* clone = aznew MorphTargetStandard::DeformData(m_nodeIndex, m_numVerts); // copy the data - clone->mMinValue = mMinValue; - clone->mMaxValue = mMaxValue; - MCore::MemCopy((uint8*)clone->mDeltas, (uint8*)mDeltas, mNumVerts * sizeof(VertexDelta)); + clone->m_minValue = m_minValue; + clone->m_maxValue = m_maxValue; + MCore::MemCopy((uint8*)clone->m_deltas, (uint8*)m_deltas, m_numVerts * sizeof(VertexDelta)); return clone; } void MorphTargetStandard::RemoveAllDeformDatas() { - for (DeformData* deformData : mDeformDatas) + for (DeformData* deformData : m_deformDatas) { deformData->Destroy(); } - mDeformDatas.clear(); + m_deformDatas.clear(); } void MorphTargetStandard::RemoveAllDeformDatasFor(Node* joint) { - mDeformDatas.erase( - AZStd::remove_if(mDeformDatas.begin(), mDeformDatas.end(), + m_deformDatas.erase( + AZStd::remove_if(m_deformDatas.begin(), m_deformDatas.end(), [=](const DeformData* deformData) { - return deformData->mNodeIndex == joint->GetNodeIndex(); + return deformData->m_nodeIndex == joint->GetNodeIndex(); }), - mDeformDatas.end()); + m_deformDatas.end()); } // pre-alloc memory for the deform datas void MorphTargetStandard::ReserveDeformDatas(size_t numDeformDatas) { - mDeformDatas.reserve(numDeformDatas); + m_deformDatas.reserve(numDeformDatas); } // pre-allocate memory for the transformations void MorphTargetStandard::ReserveTransformations(size_t numTransforms) { - mTransforms.reserve(numTransforms); + m_transforms.reserve(numTransforms); } void MorphTargetStandard::RemoveDeformData(size_t index, bool delFromMem) { if (delFromMem) { - delete mDeformDatas[index]; + delete m_deformDatas[index]; } - mDeformDatas.erase(mDeformDatas.begin() + index); + m_deformDatas.erase(m_deformDatas.begin() + index); } void MorphTargetStandard::RemoveTransformation(size_t index) { - mTransforms.erase(AZStd::next(begin(mTransforms), index)); + m_transforms.erase(AZStd::next(begin(m_transforms), index)); } @@ -421,18 +387,18 @@ namespace EMotionFX } // scale the transformations - for (Transformation& transform : mTransforms) + for (Transformation& transform : m_transforms) { - transform.mPosition *= scaleFactor; + transform.m_position *= scaleFactor; } // scale the deform datas (packed per vertex morph deltas) - for (DeformData* deformData : mDeformDatas) + for (DeformData* deformData : m_deformDatas) { - DeformData::VertexDelta* deltas = deformData->mDeltas; + DeformData::VertexDelta* deltas = deformData->m_deltas; - float newMinValue = deformData->mMinValue * scaleFactor; - float newMaxValue = deformData->mMaxValue * scaleFactor; + float newMinValue = deformData->m_minValue * scaleFactor; + float newMaxValue = deformData->m_maxValue * scaleFactor; // make sure the values won't be too small if (newMaxValue - newMinValue < 1.0f) @@ -450,21 +416,21 @@ namespace EMotionFX // iterate over the deltas (per vertex values) - const uint32 numVerts = deformData->mNumVerts; + const uint32 numVerts = deformData->m_numVerts; for (uint32 v = 0; v < numVerts; ++v) { // decompress - AZ::Vector3 decompressed = deltas[v].mPosition.ToVector3(deformData->mMinValue, deformData->mMaxValue); + AZ::Vector3 decompressed = deltas[v].m_position.ToVector3(deformData->m_minValue, deformData->m_maxValue); // scale decompressed *= scaleFactor; // compress again - deltas[v].mPosition.FromVector3(decompressed, newMinValue, newMaxValue); + deltas[v].m_position.FromVector3(decompressed, newMinValue, newMaxValue); } - deformData->mMinValue = newMinValue; - deformData->mMaxValue = newMaxValue; + deformData->m_minValue = newMinValue; + deformData->m_maxValue = newMaxValue; } } } // namespace EMotionFX diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/MorphTargetStandard.h b/Gems/EMotionFX/Code/EMotionFX/Source/MorphTargetStandard.h index 2ea1c43906..c4187fd638 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/MorphTargetStandard.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/MorphTargetStandard.h @@ -59,11 +59,11 @@ namespace EMotionFX */ struct EMFX_API VertexDelta { - MCore::Compressed16BitVector3 mPosition; /**< The position delta. */ - MCore::Compressed8BitVector3 mNormal; /**< The normal delta. */ - MCore::Compressed8BitVector3 mTangent; /**< The first tangent layer delta. */ - MCore::Compressed8BitVector3 mBitangent; /**< The first bitangent layer delta. */ - uint32 mVertexNr; /**< The vertex number inside the mesh to apply this to. */ + MCore::Compressed16BitVector3 m_position; /**< The position delta. */ + MCore::Compressed8BitVector3 m_normal; /**< The normal delta. */ + MCore::Compressed8BitVector3 m_tangent; /**< The first tangent layer delta. */ + MCore::Compressed8BitVector3 m_bitangent; /**< The first bitangent layer delta. */ + uint32 m_vertexNr; /**< The vertex number inside the mesh to apply this to. */ }; static DeformData* Create(size_t nodeIndex, uint32 numVerts); @@ -72,11 +72,11 @@ namespace EMotionFX DeformData* Clone(); public: - VertexDelta* mDeltas; /**< The delta values. */ - uint32 mNumVerts; /**< The number of vertices in the mDeltas and mVertexNumbers arrays. */ - size_t mNodeIndex; /**< The node which this data works on. */ - float mMinValue; /**< The compression/decompression minimum value for the delta positions. */ - float mMaxValue; /**< The compression/decompression maximum value for the delta positions. */ + VertexDelta* m_deltas; /**< The delta values. */ + uint32 m_numVerts; /**< The number of vertices in the m_deltas and m_vertexNumbers arrays. */ + size_t m_nodeIndex; /**< The node which this data works on. */ + float m_minValue; /**< The compression/decompression minimum value for the delta positions. */ + float m_maxValue; /**< The compression/decompression maximum value for the delta positions. */ /** * The constructor. @@ -100,11 +100,11 @@ namespace EMotionFX */ struct EMFX_API MCORE_ALIGN_PRE(16) Transformation { - AZ::Quaternion mRotation; /**< The rotation as absolute value. So not a delta value, but a target (absolute) rotation. */ - AZ::Quaternion mScaleRotation; /**< The scale rotation, as absolute value. */ - AZ::Vector3 mPosition; /**< The position as a delta, so the difference between the original and target position. */ - AZ::Vector3 mScale; /**< The scale as a delta, so the difference between the original and target scale. */ - size_t mNodeIndex; /**< The node number to apply this on. */ + AZ::Quaternion m_rotation; /**< The rotation as absolute value. So not a delta value, but a target (absolute) rotation. */ + AZ::Quaternion m_scaleRotation; /**< The scale rotation, as absolute value. */ + AZ::Vector3 m_position; /**< The position as a delta, so the difference between the original and target position. */ + AZ::Vector3 m_scale; /**< The scale as a delta, so the difference between the original and target scale. */ + size_t m_nodeIndex; /**< The node number to apply this on. */ } MCORE_ALIGN_POST(16); @@ -260,8 +260,8 @@ namespace EMotionFX void Scale(float scaleFactor) override; private: - AZStd::vector mTransforms; /**< The relative transformations for the given nodes, in local space. The rotation however is absolute. */ - AZStd::vector mDeformDatas; /**< The deformation data objects. */ + AZStd::vector m_transforms; /**< The relative transformations for the given nodes, in local space. The rotation however is absolute. */ + AZStd::vector m_deformDatas; /**< The deformation data objects. */ /** * The constructor. diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/Motion.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/Motion.cpp index 382a640e65..9ad55b1c40 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/Motion.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/Motion.cpp @@ -30,11 +30,11 @@ namespace EMotionFX Motion::Motion(const char* name) : BaseObject() { - mID = aznumeric_caster(MCore::GetIDGenerator().GenerateID()); + m_id = aznumeric_caster(MCore::GetIDGenerator().GenerateID()); m_eventTable = AZStd::make_unique(); - mUnitType = GetEMotionFX().GetUnitType(); - mFileUnitType = mUnitType; - mExtractionFlags = static_cast(0); + m_unitType = GetEMotionFX().GetUnitType(); + m_fileUnitType = m_unitType; + m_extractionFlags = static_cast(0); if (name) { @@ -42,7 +42,7 @@ namespace EMotionFX } #if defined(EMFX_DEVELOPMENT_BUILD) - mIsOwnedByRuntime = false; + m_isOwnedByRuntime = false; #endif // EMFX_DEVELOPMENT_BUILD // automatically register the motion @@ -55,7 +55,7 @@ namespace EMotionFX GetEventManager().OnDeleteMotion(this); // automatically unregister the motion - if (mAutoUnregister) + if (m_autoUnregister) { GetMotionManager().RemoveMotion(this, false); } @@ -68,42 +68,42 @@ namespace EMotionFX void Motion::SetName(const char* name) { // calculate the ID - mNameID = MCore::GetStringIdPool().GenerateIdForString(name); + m_nameId = MCore::GetStringIdPool().GenerateIdForString(name); } // set the filename of the motion void Motion::SetFileName(const char* filename) { - mFileName = filename; + m_fileName = filename; } // adjust the dirty flag void Motion::SetDirtyFlag(bool dirty) { - mDirtyFlag = dirty; + m_dirtyFlag = dirty; } // adjust the auto unregistering from the motion manager on delete void Motion::SetAutoUnregister(bool enabled) { - mAutoUnregister = enabled; + m_autoUnregister = enabled; } // do we auto unregister from the motion manager on delete? bool Motion::GetAutoUnregister() const { - return mAutoUnregister; + return m_autoUnregister; } void Motion::SetIsOwnedByRuntime(bool isOwnedByRuntime) { #if defined(EMFX_DEVELOPMENT_BUILD) - mIsOwnedByRuntime = isOwnedByRuntime; + m_isOwnedByRuntime = isOwnedByRuntime; #else AZ_UNUSED(isOwnedByRuntime); #endif @@ -113,7 +113,7 @@ namespace EMotionFX bool Motion::GetIsOwnedByRuntime() const { #if defined(EMFX_DEVELOPMENT_BUILD) - return mIsOwnedByRuntime; + return m_isOwnedByRuntime; #else return true; #endif @@ -122,25 +122,25 @@ namespace EMotionFX const char* Motion::GetName() const { - return MCore::GetStringIdPool().GetName(mNameID).c_str(); + return MCore::GetStringIdPool().GetName(m_nameId).c_str(); } const AZStd::string& Motion::GetNameString() const { - return MCore::GetStringIdPool().GetName(mNameID); + return MCore::GetStringIdPool().GetName(m_nameId); } void Motion::SetMotionFPS(float motionFPS) { - mMotionFPS = motionFPS; + m_motionFps = motionFPS; } float Motion::GetMotionFPS() const { - return mMotionFPS; + return m_motionFps; } @@ -163,31 +163,31 @@ namespace EMotionFX bool Motion::GetDirtyFlag() const { - return mDirtyFlag; + return m_dirtyFlag; } void Motion::SetMotionExtractionFlags(EMotionExtractionFlags flags) { - mExtractionFlags = flags; + m_extractionFlags = flags; } EMotionExtractionFlags Motion::GetMotionExtractionFlags() const { - return mExtractionFlags; + return m_extractionFlags; } void Motion::SetCustomData(void* dataPointer) { - mCustomData = dataPointer; + m_customData = dataPointer; } void* Motion::GetCustomData() const { - return mCustomData; + return m_customData; } @@ -203,48 +203,48 @@ namespace EMotionFX void Motion::SetID(uint32 id) { - mID = id; + m_id = id; } const char* Motion::GetFileName() const { - return mFileName.c_str(); + return m_fileName.c_str(); } const AZStd::string& Motion::GetFileNameString() const { - return mFileName; + return m_fileName; } uint32 Motion::GetID() const { - return mID; + return m_id; } void Motion::SetUnitType(MCore::Distance::EUnitType unitType) { - mUnitType = unitType; + m_unitType = unitType; } MCore::Distance::EUnitType Motion::GetUnitType() const { - return mUnitType; + return m_unitType; } void Motion::SetFileUnitType(MCore::Distance::EUnitType unitType) { - mFileUnitType = unitType; + m_fileUnitType = unitType; } MCore::Distance::EUnitType Motion::GetFileUnitType() const { - return mFileUnitType; + return m_fileUnitType; } void Motion::Scale(float scaleFactor) @@ -257,17 +257,17 @@ namespace EMotionFX // scale everything to the given unit type void Motion::ScaleToUnitType(MCore::Distance::EUnitType targetUnitType) { - if (mUnitType == targetUnitType) + if (m_unitType == targetUnitType) { return; } // calculate the scale factor and scale - const float scaleFactor = static_cast(MCore::Distance::GetConversionFactor(mUnitType, targetUnitType)); + const float scaleFactor = static_cast(MCore::Distance::GetConversionFactor(m_unitType, targetUnitType)); Scale(scaleFactor); // update the unit type - mUnitType = targetUnitType; + m_unitType = targetUnitType; } void Motion::UpdateDuration() diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/Motion.h b/Gems/EMotionFX/Code/EMotionFX/Source/Motion.h index eae1037ab3..e6ec99835b 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/Motion.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/Motion.h @@ -251,21 +251,21 @@ namespace EMotionFX protected: MotionData* m_motionData = nullptr; /**< The motion data, which can in theory be any data representation/compression. */ - AZStd::string mFileName; /**< The filename of the motion. */ + AZStd::string m_fileName; /**< The filename of the motion. */ PlayBackInfo m_defaultPlayBackInfo; /**< The default/fallback motion playback info which will be used when no playback info is passed to the Play() function. */ AZStd::unique_ptr m_eventTable; /**< The event table, which contains all events, and will make sure events get executed. */ - MCore::Distance::EUnitType mUnitType; /**< The type of units used. */ - MCore::Distance::EUnitType mFileUnitType; /**< The type of units used, inside the file that got loaded. */ - void* mCustomData = nullptr; /**< A pointer to custom user data that is linked with this motion object. */ - float mMotionFPS = 30.0f; /**< The number of keyframes per second. */ - uint32 mNameID = MCORE_INVALIDINDEX32; /**< The ID represention the name or description of this motion. */ - uint32 mID = MCORE_INVALIDINDEX32; /**< The unique identification number for the motion. */ - EMotionExtractionFlags mExtractionFlags; /**< The motion extraction flags, which define behavior of the motion extraction system when applied to this motion. */ - bool mDirtyFlag = false; /**< The dirty flag which indicates whether the user has made changes to the motion since the last file save operation. */ - bool mAutoUnregister = true; /**< Automatically unregister the motion from the motion manager when this motion gets deleted? Default is true. */ + MCore::Distance::EUnitType m_unitType; /**< The type of units used. */ + MCore::Distance::EUnitType m_fileUnitType; /**< The type of units used, inside the file that got loaded. */ + void* m_customData = nullptr; /**< A pointer to custom user data that is linked with this motion object. */ + float m_motionFps = 30.0f; /**< The number of keyframes per second. */ + uint32 m_nameId = MCORE_INVALIDINDEX32; /**< The ID represention the name or description of this motion. */ + uint32 m_id = MCORE_INVALIDINDEX32; /**< The unique identification number for the motion. */ + EMotionExtractionFlags m_extractionFlags; /**< The motion extraction flags, which define behavior of the motion extraction system when applied to this motion. */ + bool m_dirtyFlag = false; /**< The dirty flag which indicates whether the user has made changes to the motion since the last file save operation. */ + bool m_autoUnregister = true; /**< Automatically unregister the motion from the motion manager when this motion gets deleted? Default is true. */ #if defined(EMFX_DEVELOPMENT_BUILD) - bool mIsOwnedByRuntime; + bool m_isOwnedByRuntime; #endif // EMFX_DEVELOPMENT_BUILD }; } // namespace EMotionFX diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/MotionData/MotionData.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/MotionData/MotionData.cpp index 7421495c60..e3391ed44f 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/MotionData/MotionData.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/MotionData/MotionData.cpp @@ -218,18 +218,18 @@ namespace EMotionFX AZ::Vector3 MotionData::GetJointStaticPosition(size_t jointDataIndex) const { - return m_staticJointData[jointDataIndex].m_staticTransform.mPosition; + return m_staticJointData[jointDataIndex].m_staticTransform.m_position; } AZ::Quaternion MotionData::GetJointStaticRotation(size_t jointDataIndex) const { - return m_staticJointData[jointDataIndex].m_staticTransform.mRotation; + return m_staticJointData[jointDataIndex].m_staticTransform.m_rotation; } #ifndef EMFX_SCALE_DISABLED AZ::Vector3 MotionData::GetJointStaticScale(size_t jointDataIndex) const { - return m_staticJointData[jointDataIndex].m_staticTransform.mScale; + return m_staticJointData[jointDataIndex].m_staticTransform.m_scale; } #endif @@ -240,18 +240,18 @@ namespace EMotionFX AZ::Vector3 MotionData::GetJointBindPosePosition(size_t jointDataIndex) const { - return m_staticJointData[jointDataIndex].m_bindTransform.mPosition; + return m_staticJointData[jointDataIndex].m_bindTransform.m_position; } AZ::Quaternion MotionData::GetJointBindPoseRotation(size_t jointDataIndex) const { - return m_staticJointData[jointDataIndex].m_bindTransform.mRotation; + return m_staticJointData[jointDataIndex].m_bindTransform.m_rotation; } #ifndef EMFX_SCALE_DISABLED AZ::Vector3 MotionData::GetJointBindPoseScale(size_t jointDataIndex) const { - return m_staticJointData[jointDataIndex].m_bindTransform.mScale; + return m_staticJointData[jointDataIndex].m_bindTransform.m_scale; } #endif @@ -322,18 +322,18 @@ namespace EMotionFX void MotionData::SetJointStaticPosition(size_t jointDataIndex, const AZ::Vector3& position) { - m_staticJointData[jointDataIndex].m_staticTransform.mPosition = position; + m_staticJointData[jointDataIndex].m_staticTransform.m_position = position; } void MotionData::SetJointStaticRotation(size_t jointDataIndex, const AZ::Quaternion& rotation) { - m_staticJointData[jointDataIndex].m_staticTransform.mRotation = rotation; + m_staticJointData[jointDataIndex].m_staticTransform.m_rotation = rotation; } #ifndef EMFX_SCALE_DISABLED void MotionData::SetJointStaticScale(size_t jointDataIndex, const AZ::Vector3& scale) { - m_staticJointData[jointDataIndex].m_staticTransform.mScale = scale; + m_staticJointData[jointDataIndex].m_staticTransform.m_scale = scale; } #endif @@ -344,18 +344,18 @@ namespace EMotionFX void MotionData::SetJointBindPosePosition(size_t jointDataIndex, const AZ::Vector3& position) { - m_staticJointData[jointDataIndex].m_bindTransform.mPosition = position; + m_staticJointData[jointDataIndex].m_bindTransform.m_position = position; } void MotionData::SetJointBindPoseRotation(size_t jointDataIndex, const AZ::Quaternion& rotation) { - m_staticJointData[jointDataIndex].m_bindTransform.mRotation = rotation; + m_staticJointData[jointDataIndex].m_bindTransform.m_rotation = rotation; } #ifndef EMFX_SCALE_DISABLED void MotionData::SetJointBindPoseScale(size_t jointDataIndex, const AZ::Vector3& scale) { - m_staticJointData[jointDataIndex].m_bindTransform.mScale = scale; + m_staticJointData[jointDataIndex].m_bindTransform.m_scale = scale; } #endif @@ -474,11 +474,11 @@ namespace EMotionFX const size_t retargetRootDataIndex = jointLinks[actor->GetRetargetRootNodeIndex()]; if (retargetRootDataIndex != InvalidIndex) { - const float subMotionHeight = m_staticJointData[retargetRootDataIndex].m_bindTransform.mPosition.GetZ(); + const float subMotionHeight = m_staticJointData[retargetRootDataIndex].m_bindTransform.m_position.GetZ(); if (AZ::GetAbs(subMotionHeight) >= AZ::Constants::FloatEpsilon) { - const float heightFactor = bindPose->GetLocalSpaceTransform(retargetRootIndex).mPosition.GetZ() / subMotionHeight; - inOutTransform.mPosition *= heightFactor; + const float heightFactor = bindPose->GetLocalSpaceTransform(retargetRootIndex).m_position.GetZ() / subMotionHeight; + inOutTransform.m_position *= heightFactor; needsDisplacement = false; } } @@ -491,14 +491,14 @@ namespace EMotionFX const Transform& motionBindPose = m_staticJointData[jointDataIndex].m_bindTransform; if (needsDisplacement) { - const AZ::Vector3 displacement = bindPoseTransform.mPosition - motionBindPose.mPosition; - inOutTransform.mPosition += displacement; + const AZ::Vector3 displacement = bindPoseTransform.m_position - motionBindPose.m_position; + inOutTransform.m_position += displacement; } EMFX_SCALECODE ( - const AZ::Vector3 scaleOffset = bindPoseTransform.mScale - motionBindPose.mScale; - inOutTransform.mScale += scaleOffset; + const AZ::Vector3 scaleOffset = bindPoseTransform.m_scale - motionBindPose.m_scale; + inOutTransform.m_scale += scaleOffset; ) } } @@ -566,8 +566,8 @@ namespace EMotionFX // Scale the static data for (StaticJointData& jointData : m_staticJointData) { - jointData.m_staticTransform.mPosition *= scaleFactor; - jointData.m_bindTransform.mPosition *= scaleFactor; + jointData.m_staticTransform.m_position *= scaleFactor; + jointData.m_bindTransform.m_position *= scaleFactor; } // Scale all data stored by the inherited class. diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/MotionData/NonUniformMotionData.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/MotionData/NonUniformMotionData.cpp index 619a962d7e..6ced6152e1 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/MotionData/NonUniformMotionData.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/MotionData/NonUniformMotionData.cpp @@ -92,10 +92,10 @@ namespace EMotionFX if (jointDataIndex != InvalidIndex && !inPlace) { const JointData& jointData = m_jointData[jointDataIndex]; - result.mPosition = (!jointData.m_positionTrack.m_times.empty()) ? CalculateInterpolatedValue(jointData.m_positionTrack, settings.m_sampleTime) : m_staticJointData[jointDataIndex].m_staticTransform.mPosition; - result.mRotation = (!jointData.m_rotationTrack.m_times.empty()) ? CalculateInterpolatedValue(jointData.m_rotationTrack, settings.m_sampleTime) : m_staticJointData[jointDataIndex].m_staticTransform.mRotation; + result.m_position = (!jointData.m_positionTrack.m_times.empty()) ? CalculateInterpolatedValue(jointData.m_positionTrack, settings.m_sampleTime) : m_staticJointData[jointDataIndex].m_staticTransform.m_position; + result.m_rotation = (!jointData.m_rotationTrack.m_times.empty()) ? CalculateInterpolatedValue(jointData.m_rotationTrack, settings.m_sampleTime) : m_staticJointData[jointDataIndex].m_staticTransform.m_rotation; #ifndef EMFX_SCALE_DISABLED - result.mScale = (!jointData.m_scaleTrack.m_times.empty()) ? CalculateInterpolatedValue(jointData.m_scaleTrack, settings.m_sampleTime) : m_staticJointData[jointDataIndex].m_staticTransform.mScale; + result.m_scale = (!jointData.m_scaleTrack.m_times.empty()) ? CalculateInterpolatedValue(jointData.m_scaleTrack, settings.m_sampleTime) : m_staticJointData[jointDataIndex].m_staticTransform.m_scale; #endif } else @@ -123,9 +123,9 @@ namespace EMotionFX const Actor::NodeMirrorInfo& mirrorInfo = actor->GetNodeMirrorInfo(jointSkeletonIndex); Transform mirrored = bindPose->GetLocalSpaceTransform(jointSkeletonIndex); AZ::Vector3 mirrorAxis = AZ::Vector3::CreateZero(); - mirrorAxis.SetElement(mirrorInfo.mAxis, 1.0f); - const AZ::u16 motionSource = actor->GetNodeMirrorInfo(jointSkeletonIndex).mSourceNode; - mirrored.ApplyDeltaMirrored(bindPose->GetLocalSpaceTransform(motionSource), result, mirrorAxis, mirrorInfo.mFlags); + mirrorAxis.SetElement(mirrorInfo.m_axis, 1.0f); + const AZ::u16 motionSource = actor->GetNodeMirrorInfo(jointSkeletonIndex).m_sourceNode; + mirrored.ApplyDeltaMirrored(bindPose->GetLocalSpaceTransform(motionSource), result, mirrorAxis, mirrorInfo.m_flags); result = mirrored; } @@ -153,10 +153,10 @@ namespace EMotionFX if (jointDataIndex != InvalidIndex && !inPlace) { const JointData& jointData = m_jointData[jointDataIndex]; - result.mPosition = (!jointData.m_positionTrack.m_times.empty()) ? CalculateInterpolatedValue(jointData.m_positionTrack, settings.m_sampleTime) : m_staticJointData[jointDataIndex].m_staticTransform.mPosition; - result.mRotation = (!jointData.m_rotationTrack.m_times.empty()) ? CalculateInterpolatedValue(jointData.m_rotationTrack, settings.m_sampleTime) : m_staticJointData[jointDataIndex].m_staticTransform.mRotation; + result.m_position = (!jointData.m_positionTrack.m_times.empty()) ? CalculateInterpolatedValue(jointData.m_positionTrack, settings.m_sampleTime) : m_staticJointData[jointDataIndex].m_staticTransform.m_position; + result.m_rotation = (!jointData.m_rotationTrack.m_times.empty()) ? CalculateInterpolatedValue(jointData.m_rotationTrack, settings.m_sampleTime) : m_staticJointData[jointDataIndex].m_staticTransform.m_rotation; #ifndef EMFX_SCALE_DISABLED - result.mScale = (!jointData.m_scaleTrack.m_times.empty()) ? CalculateInterpolatedValue(jointData.m_scaleTrack, settings.m_sampleTime) : m_staticJointData[jointDataIndex].m_staticTransform.mScale; + result.m_scale = (!jointData.m_scaleTrack.m_times.empty()) ? CalculateInterpolatedValue(jointData.m_scaleTrack, settings.m_sampleTime) : m_staticJointData[jointDataIndex].m_staticTransform.m_scale; #endif } else @@ -1018,11 +1018,11 @@ namespace EMotionFX maxScaleError = 0.00001f; } - ReduceTrackSamples(jointData.m_positionTrack, m_staticJointData[i].m_staticTransform.mPosition, maxPosError); - ReduceTrackSamples(jointData.m_rotationTrack, m_staticJointData[i].m_staticTransform.mRotation, maxRotError); + ReduceTrackSamples(jointData.m_positionTrack, m_staticJointData[i].m_staticTransform.m_position, maxPosError); + ReduceTrackSamples(jointData.m_rotationTrack, m_staticJointData[i].m_staticTransform.m_rotation, maxRotError); EMFX_SCALECODE ( - ReduceTrackSamples(jointData.m_scaleTrack, m_staticJointData[i].m_staticTransform.mScale, maxScaleError); + ReduceTrackSamples(jointData.m_scaleTrack, m_staticJointData[i].m_staticTransform.m_scale, maxScaleError); ) } @@ -1143,11 +1143,11 @@ namespace EMotionFX { const float keyTime = s * sampleSpacing; const Transform transform = motionData->SampleJointTransform(keyTime, i); - SetJointPositionSample(i, s, {keyTime, transform.mPosition}); - SetJointRotationSample(i, s, {keyTime, transform.mRotation}); + SetJointPositionSample(i, s, {keyTime, transform.m_position}); + SetJointRotationSample(i, s, {keyTime, transform.m_rotation}); EMFX_SCALECODE ( - SetJointScaleSample(i, s, {keyTime, transform.mScale}); + SetJointScaleSample(i, s, {keyTime, transform.m_scale}); ) } } @@ -1191,18 +1191,18 @@ namespace EMotionFX AZ::Vector3 NonUniformMotionData::SampleJointPosition(float sampleTime, size_t jointDataIndex) const { - return !m_jointData[jointDataIndex].m_positionTrack.m_times.empty() ? CalculateInterpolatedValue(m_jointData[jointDataIndex].m_positionTrack, sampleTime) : m_staticJointData[jointDataIndex].m_staticTransform.mPosition; + return !m_jointData[jointDataIndex].m_positionTrack.m_times.empty() ? CalculateInterpolatedValue(m_jointData[jointDataIndex].m_positionTrack, sampleTime) : m_staticJointData[jointDataIndex].m_staticTransform.m_position; } AZ::Quaternion NonUniformMotionData::SampleJointRotation(float sampleTime, size_t jointDataIndex) const { - return !m_jointData[jointDataIndex].m_rotationTrack.m_times.empty() ? CalculateInterpolatedValue(m_jointData[jointDataIndex].m_rotationTrack, sampleTime) : m_staticJointData[jointDataIndex].m_staticTransform.mRotation; + return !m_jointData[jointDataIndex].m_rotationTrack.m_times.empty() ? CalculateInterpolatedValue(m_jointData[jointDataIndex].m_rotationTrack, sampleTime) : m_staticJointData[jointDataIndex].m_staticTransform.m_rotation; } #ifndef EMFX_SCALE_DISABLED AZ::Vector3 NonUniformMotionData::SampleJointScale(float sampleTime, size_t jointDataIndex) const { - return !m_jointData[jointDataIndex].m_scaleTrack.m_times.empty() ? CalculateInterpolatedValue(m_jointData[jointDataIndex].m_scaleTrack, sampleTime) : m_staticJointData[jointDataIndex].m_staticTransform.mScale; + return !m_jointData[jointDataIndex].m_scaleTrack.m_times.empty() ? CalculateInterpolatedValue(m_jointData[jointDataIndex].m_scaleTrack, sampleTime) : m_staticJointData[jointDataIndex].m_staticTransform.m_scale; } #endif @@ -1210,10 +1210,10 @@ namespace EMotionFX { return Transform ( - !m_jointData[jointDataIndex].m_positionTrack.m_times.empty() ? CalculateInterpolatedValue(m_jointData[jointDataIndex].m_positionTrack, sampleTime) : m_staticJointData[jointDataIndex].m_staticTransform.mPosition, - !m_jointData[jointDataIndex].m_rotationTrack.m_times.empty() ? CalculateInterpolatedValue(m_jointData[jointDataIndex].m_rotationTrack, sampleTime) : m_staticJointData[jointDataIndex].m_staticTransform.mRotation + !m_jointData[jointDataIndex].m_positionTrack.m_times.empty() ? CalculateInterpolatedValue(m_jointData[jointDataIndex].m_positionTrack, sampleTime) : m_staticJointData[jointDataIndex].m_staticTransform.m_position, + !m_jointData[jointDataIndex].m_rotationTrack.m_times.empty() ? CalculateInterpolatedValue(m_jointData[jointDataIndex].m_rotationTrack, sampleTime) : m_staticJointData[jointDataIndex].m_staticTransform.m_rotation #ifndef EMFX_SCALE_DISABLED - ,!m_jointData[jointDataIndex].m_scaleTrack.m_times.empty() ? CalculateInterpolatedValue(m_jointData[jointDataIndex].m_scaleTrack, sampleTime) : m_staticJointData[jointDataIndex].m_staticTransform.mScale + ,!m_jointData[jointDataIndex].m_scaleTrack.m_times.empty() ? CalculateInterpolatedValue(m_jointData[jointDataIndex].m_scaleTrack, sampleTime) : m_staticJointData[jointDataIndex].m_staticTransform.m_scale #endif ); } @@ -1225,11 +1225,11 @@ namespace EMotionFX for (size_t i = 0; i < m_jointData.size(); ++i) { JointData& jointData = tempJointData[i]; - ReduceTrackSamples(jointData.m_positionTrack, m_staticJointData[i].m_staticTransform.mPosition, 0.0001f); - ReduceTrackSamples(jointData.m_rotationTrack, m_staticJointData[i].m_staticTransform.mRotation, 0.0001f); + ReduceTrackSamples(jointData.m_positionTrack, m_staticJointData[i].m_staticTransform.m_position, 0.0001f); + ReduceTrackSamples(jointData.m_rotationTrack, m_staticJointData[i].m_staticTransform.m_rotation, 0.0001f); EMFX_SCALECODE ( - ReduceTrackSamples(jointData.m_scaleTrack, m_staticJointData[i].m_staticTransform.mScale, 0.0001f); + ReduceTrackSamples(jointData.m_scaleTrack, m_staticJointData[i].m_staticTransform.m_scale, 0.0001f); if (jointData.m_scaleTrack.m_times.empty()) { ClearJointScaleSamples(i); @@ -1376,15 +1376,15 @@ namespace EMotionFX if (saveSettings.m_logDetails) { - const AZ::Quaternion uncompressedPoseRot = MCore::Compressed16BitQuaternion(jointInfo.m_staticRot.mX, jointInfo.m_staticRot.mY, jointInfo.m_staticRot.mZ, jointInfo.m_staticRot.mW).ToQuaternion().GetNormalized(); - const AZ::Quaternion uncompressedBindPoseRot = MCore::Compressed16BitQuaternion(jointInfo.m_bindPoseRot.mX, jointInfo.m_bindPoseRot.mY, jointInfo.m_bindPoseRot.mZ, jointInfo.m_bindPoseRot.mW).ToQuaternion().GetNormalized(); + const AZ::Quaternion uncompressedPoseRot = MCore::Compressed16BitQuaternion(jointInfo.m_staticRot.m_x, jointInfo.m_staticRot.m_y, jointInfo.m_staticRot.m_z, jointInfo.m_staticRot.m_w).ToQuaternion().GetNormalized(); + const AZ::Quaternion uncompressedBindPoseRot = MCore::Compressed16BitQuaternion(jointInfo.m_bindPoseRot.m_x, jointInfo.m_bindPoseRot.m_y, jointInfo.m_bindPoseRot.m_z, jointInfo.m_bindPoseRot.m_w).ToQuaternion().GetNormalized(); MCore::LogDetailedInfo("- Motion Joint: %s", motionData->GetJointName(jointDataIndex).c_str()); - MCore::LogDetailedInfo(" + Pose Translation: x=%f y=%f z=%f", jointInfo.m_staticPos.mX, jointInfo.m_staticPos.mY, jointInfo.m_staticPos.mZ); + MCore::LogDetailedInfo(" + Pose Translation: x=%f y=%f z=%f", jointInfo.m_staticPos.m_x, jointInfo.m_staticPos.m_y, jointInfo.m_staticPos.m_z); MCore::LogDetailedInfo(" + Pose Rotation: x=%f y=%f z=%f w=%f", static_cast(uncompressedPoseRot.GetX()), static_cast(uncompressedPoseRot.GetY()), static_cast(uncompressedPoseRot.GetZ()), static_cast(uncompressedPoseRot.GetW())); - MCore::LogDetailedInfo(" + Pose Scale: x=%f y=%f z=%f", jointInfo.m_staticScale.mX, jointInfo.m_staticScale.mY, jointInfo.m_staticScale.mZ); - MCore::LogDetailedInfo(" + Bind Pose Translation: x=%f y=%f z=%f", jointInfo.m_bindPosePos.mX, jointInfo.m_bindPosePos.mY, jointInfo.m_bindPosePos.mZ); + MCore::LogDetailedInfo(" + Pose Scale: x=%f y=%f z=%f", jointInfo.m_staticScale.m_x, jointInfo.m_staticScale.m_y, jointInfo.m_staticScale.m_z); + MCore::LogDetailedInfo(" + Bind Pose Translation: x=%f y=%f z=%f", jointInfo.m_bindPosePos.m_x, jointInfo.m_bindPosePos.m_y, jointInfo.m_bindPosePos.m_z); MCore::LogDetailedInfo(" + Bind Pose Rotation: x=%f y=%f z=%f w=%f", static_cast(uncompressedBindPoseRot.GetX()), static_cast(uncompressedBindPoseRot.GetY()), static_cast(uncompressedBindPoseRot.GetZ()), static_cast(uncompressedBindPoseRot.GetW())); - MCore::LogDetailedInfo(" + Bind Pose Scale: x=%f y=%f z=%f", jointInfo.m_bindPoseScale.mX, jointInfo.m_bindPoseScale.mY, jointInfo.m_bindPoseScale.mZ); + MCore::LogDetailedInfo(" + Bind Pose Scale: x=%f y=%f z=%f", jointInfo.m_bindPoseScale.m_x, jointInfo.m_bindPoseScale.m_y, jointInfo.m_bindPoseScale.m_z); MCore::LogDetailedInfo(" + Num Position Keys: %d", jointInfo.m_numPosKeys); MCore::LogDetailedInfo(" + Num Rotation Keys: %d", jointInfo.m_numRotKeys); MCore::LogDetailedInfo(" + Num Scale Keys: %d", jointInfo.m_numScaleKeys); @@ -1697,12 +1697,12 @@ namespace EMotionFX return false; } - AZ::Vector3 staticPos(jointInfo.m_staticPos.mX, jointInfo.m_staticPos.mY, jointInfo.m_staticPos.mZ); - AZ::Vector3 staticScale(jointInfo.m_staticScale.mX, jointInfo.m_staticScale.mY, jointInfo.m_staticScale.mZ); - MCore::Compressed16BitQuaternion staticRot(jointInfo.m_staticRot.mX, jointInfo.m_staticRot.mY, jointInfo.m_staticRot.mZ, jointInfo.m_staticRot.mW); - AZ::Vector3 bindPosePos(jointInfo.m_bindPosePos.mX, jointInfo.m_bindPosePos.mY, jointInfo.m_bindPosePos.mZ); - AZ::Vector3 bindPoseScale(jointInfo.m_bindPoseScale.mX, jointInfo.m_bindPoseScale.mY, jointInfo.m_bindPoseScale.mZ); - MCore::Compressed16BitQuaternion bindPoseRot(jointInfo.m_bindPoseRot.mX, jointInfo.m_bindPoseRot.mY, jointInfo.m_bindPoseRot.mZ, jointInfo.m_bindPoseRot.mW); + AZ::Vector3 staticPos(jointInfo.m_staticPos.m_x, jointInfo.m_staticPos.m_y, jointInfo.m_staticPos.m_z); + AZ::Vector3 staticScale(jointInfo.m_staticScale.m_x, jointInfo.m_staticScale.m_y, jointInfo.m_staticScale.m_z); + MCore::Compressed16BitQuaternion staticRot(jointInfo.m_staticRot.m_x, jointInfo.m_staticRot.m_y, jointInfo.m_staticRot.m_z, jointInfo.m_staticRot.m_w); + AZ::Vector3 bindPosePos(jointInfo.m_bindPosePos.m_x, jointInfo.m_bindPosePos.m_y, jointInfo.m_bindPosePos.m_z); + AZ::Vector3 bindPoseScale(jointInfo.m_bindPoseScale.m_x, jointInfo.m_bindPoseScale.m_y, jointInfo.m_bindPoseScale.m_z); + MCore::Compressed16BitQuaternion bindPoseRot(jointInfo.m_bindPoseRot.m_x, jointInfo.m_bindPoseRot.m_y, jointInfo.m_bindPoseRot.m_z, jointInfo.m_bindPoseRot.m_w); MCore::Endian::ConvertVector3(&staticPos, sourceEndianType); MCore::Endian::Convert16BitQuaternion(&staticRot, sourceEndianType); MCore::Endian::ConvertVector3(&staticScale, sourceEndianType); @@ -1747,8 +1747,8 @@ namespace EMotionFX return false; } MCore::Endian::ConvertFloat(&keyInfo.m_time, sourceEndianType); - MCore::Endian::ConvertFloat(&keyInfo.m_value.mX, sourceEndianType, /*numFloats=*/3); - motionData->SetJointPositionSample(i, s, {keyInfo.m_time, AZ::Vector3(keyInfo.m_value.mX, keyInfo.m_value.mY, keyInfo.m_value.mZ)}); + MCore::Endian::ConvertFloat(&keyInfo.m_value.m_x, sourceEndianType, /*numFloats=*/3); + motionData->SetJointPositionSample(i, s, {keyInfo.m_time, AZ::Vector3(keyInfo.m_value.m_x, keyInfo.m_value.m_y, keyInfo.m_value.m_z)}); } } @@ -1764,7 +1764,7 @@ namespace EMotionFX return false; } MCore::Endian::ConvertFloat(&keyInfo.m_time, sourceEndianType); - MCore::Compressed16BitQuaternion compressedQuat(keyInfo.m_value.mX, keyInfo.m_value.mY, keyInfo.m_value.mZ, keyInfo.m_value.mW); + MCore::Compressed16BitQuaternion compressedQuat(keyInfo.m_value.m_x, keyInfo.m_value.m_y, keyInfo.m_value.m_z, keyInfo.m_value.m_w); MCore::Endian::Convert16BitQuaternion(&compressedQuat, sourceEndianType); motionData->SetJointRotationSample(i, s, {keyInfo.m_time, compressedQuat.ToQuaternion().GetNormalized()}); } @@ -1784,8 +1784,8 @@ namespace EMotionFX return false; } MCore::Endian::ConvertFloat(&keyInfo.m_time, sourceEndianType); - MCore::Endian::ConvertFloat(&keyInfo.m_value.mX, sourceEndianType, /*numFloats=*/3); - motionData->SetJointScaleSample(i, s, {keyInfo.m_time, AZ::Vector3(keyInfo.m_value.mX, keyInfo.m_value.mY, keyInfo.m_value.mZ)}); + MCore::Endian::ConvertFloat(&keyInfo.m_value.m_x, sourceEndianType, /*numFloats=*/3); + motionData->SetJointScaleSample(i, s, {keyInfo.m_time, AZ::Vector3(keyInfo.m_value.m_x, keyInfo.m_value.m_y, keyInfo.m_value.m_z)}); } } ) diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/MotionData/UniformMotionData.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/MotionData/UniformMotionData.cpp index 44ed629756..c4451ff902 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/MotionData/UniformMotionData.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/MotionData/UniformMotionData.cpp @@ -88,11 +88,11 @@ namespace EMotionFX { const float keyTime = s * sampleSpacing; const Transform transform = motionData->SampleJointTransform(keyTime, i); - if (posAnimated) m_jointData[i].m_positions[s] = transform.mPosition; - if (rotAnimated) m_jointData[i].m_rotations[s] = transform.mRotation.GetNormalized(); + if (posAnimated) m_jointData[i].m_positions[s] = transform.m_position; + if (rotAnimated) m_jointData[i].m_rotations[s] = transform.m_rotation.GetNormalized(); EMFX_SCALECODE ( - if (scaleAnimated) m_jointData[i].m_scales[s] = transform.mScale; + if (scaleAnimated) m_jointData[i].m_scales[s] = transform.m_scale; ) } } @@ -156,10 +156,10 @@ namespace EMotionFX { const StaticJointData& staticJointData = m_staticJointData[transformDataIndex]; const JointData& jointData = m_jointData[transformDataIndex]; - result.mPosition = !jointData.m_positions.empty() ? jointData.m_positions[indexA].Lerp(jointData.m_positions[indexB], t) : staticJointData.m_staticTransform.mPosition; - result.mRotation = !jointData.m_rotations.empty() ? jointData.m_rotations[indexA].ToQuaternion().NLerp(jointData.m_rotations[indexB].ToQuaternion(), t) : staticJointData.m_staticTransform.mRotation; + result.m_position = !jointData.m_positions.empty() ? jointData.m_positions[indexA].Lerp(jointData.m_positions[indexB], t) : staticJointData.m_staticTransform.m_position; + result.m_rotation = !jointData.m_rotations.empty() ? jointData.m_rotations[indexA].ToQuaternion().NLerp(jointData.m_rotations[indexB].ToQuaternion(), t) : staticJointData.m_staticTransform.m_rotation; #ifndef EMFX_SCALE_DISABLED - result.mScale = !jointData.m_scales.empty() ? jointData.m_scales[indexA].Lerp(jointData.m_scales[indexB], t) : staticJointData.m_staticTransform.mScale; + result.m_scale = !jointData.m_scales.empty() ? jointData.m_scales[indexA].Lerp(jointData.m_scales[indexB], t) : staticJointData.m_staticTransform.m_scale; #endif } else @@ -187,9 +187,9 @@ namespace EMotionFX const Actor::NodeMirrorInfo& mirrorInfo = actor->GetNodeMirrorInfo(jointSkeletonIndex); Transform mirrored = bindPose->GetLocalSpaceTransform(jointSkeletonIndex); AZ::Vector3 mirrorAxis = AZ::Vector3::CreateZero(); - mirrorAxis.SetElement(mirrorInfo.mAxis, 1.0f); - const AZ::u16 motionSource = actor->GetNodeMirrorInfo(jointSkeletonIndex).mSourceNode; - mirrored.ApplyDeltaMirrored(bindPose->GetLocalSpaceTransform(motionSource), result, mirrorAxis, mirrorInfo.mFlags); + mirrorAxis.SetElement(mirrorInfo.m_axis, 1.0f); + const AZ::u16 motionSource = actor->GetNodeMirrorInfo(jointSkeletonIndex).m_sourceNode; + mirrored.ApplyDeltaMirrored(bindPose->GetLocalSpaceTransform(motionSource), result, mirrorAxis, mirrorInfo.m_flags); result = mirrored; } @@ -225,11 +225,11 @@ namespace EMotionFX { const StaticJointData& staticJointData = m_staticJointData[jointDataIndex]; const JointData& jointData = m_jointData[jointDataIndex]; - result.mPosition = !jointData.m_positions.empty() ? jointData.m_positions[indexA].Lerp(jointData.m_positions[indexB], t) : staticJointData.m_staticTransform.mPosition; - result.mRotation = !jointData.m_rotations.empty() ? jointData.m_rotations[indexA].ToQuaternion().NLerp(jointData.m_rotations[indexB].ToQuaternion(), t) : staticJointData.m_staticTransform.mRotation; + result.m_position = !jointData.m_positions.empty() ? jointData.m_positions[indexA].Lerp(jointData.m_positions[indexB], t) : staticJointData.m_staticTransform.m_position; + result.m_rotation = !jointData.m_rotations.empty() ? jointData.m_rotations[indexA].ToQuaternion().NLerp(jointData.m_rotations[indexB].ToQuaternion(), t) : staticJointData.m_staticTransform.m_rotation; #ifndef EMFX_SCALE_DISABLED - result.mScale = !jointData.m_scales.empty() ? jointData.m_scales[indexA].Lerp(jointData.m_scales[indexB], t) : staticJointData.m_staticTransform.mScale; + result.m_scale = !jointData.m_scales.empty() ? jointData.m_scales[indexA].Lerp(jointData.m_scales[indexB], t) : staticJointData.m_staticTransform.m_scale; #endif } else @@ -663,7 +663,7 @@ namespace EMotionFX CalculateInterpolationIndicesUniform(sampleTime, m_sampleSpacing, m_duration, m_numSamples, indexA, indexB, t); const AZStd::vector& values = m_jointData[jointDataIndex].m_positions; - return !values.empty() ? values[indexA].Lerp(values[indexB], t) : m_staticJointData[jointDataIndex].m_staticTransform.mPosition; + return !values.empty() ? values[indexA].Lerp(values[indexB], t) : m_staticJointData[jointDataIndex].m_staticTransform.m_position; } AZ::Quaternion UniformMotionData::SampleJointRotation(float sampleTime, size_t jointDataIndex) const @@ -674,7 +674,7 @@ namespace EMotionFX CalculateInterpolationIndicesUniform(sampleTime, m_sampleSpacing, m_duration, m_numSamples, indexA, indexB, t); const AZStd::vector& values = m_jointData[jointDataIndex].m_rotations; - return !values.empty() ? values[indexA].ToQuaternion().NLerp(values[indexB].ToQuaternion(), t) : m_staticJointData[jointDataIndex].m_staticTransform.mRotation; + return !values.empty() ? values[indexA].ToQuaternion().NLerp(values[indexB].ToQuaternion(), t) : m_staticJointData[jointDataIndex].m_staticTransform.m_rotation; } #ifndef EMFX_SCALE_DISABLED @@ -686,7 +686,7 @@ namespace EMotionFX CalculateInterpolationIndicesUniform(sampleTime, m_sampleSpacing, m_duration, m_numSamples, indexA, indexB, t); const AZStd::vector& values = m_jointData[jointDataIndex].m_scales; - return !values.empty() ? values[indexA].Lerp(values[indexB], t) : m_staticJointData[jointDataIndex].m_staticTransform.mScale; + return !values.empty() ? values[indexA].Lerp(values[indexB], t) : m_staticJointData[jointDataIndex].m_staticTransform.m_scale; } #endif @@ -706,11 +706,11 @@ namespace EMotionFX return Transform ( - !posValues.empty() ? posValues[indexA].Lerp(posValues[indexB], t) : staticData.m_staticTransform.mScale, - !rotValues.empty() ? rotValues[indexA].ToQuaternion().NLerp(rotValues[indexB].ToQuaternion(), t) : staticData.m_staticTransform.mRotation + !posValues.empty() ? posValues[indexA].Lerp(posValues[indexB], t) : staticData.m_staticTransform.m_scale, + !rotValues.empty() ? rotValues[indexA].ToQuaternion().NLerp(rotValues[indexB].ToQuaternion(), t) : staticData.m_staticTransform.m_rotation #ifndef EMFX_SCALE_DISABLED - ,!scaleValues.empty() ? scaleValues[indexA].Lerp(scaleValues[indexB], t) : staticData.m_staticTransform.mScale + ,!scaleValues.empty() ? scaleValues[indexA].Lerp(scaleValues[indexB], t) : staticData.m_staticTransform.m_scale #endif ); } @@ -808,16 +808,16 @@ namespace EMotionFX if (saveSettings.m_logDetails) { // Create an uncompressed version of the quaternions, for logging. - const AZ::Quaternion uncompressedPoseRot = MCore::Compressed16BitQuaternion(jointChunk.m_staticRot.mX, jointChunk.m_staticRot.mY, jointChunk.m_staticRot.mZ, jointChunk.m_staticRot.mW).ToQuaternion().GetNormalized(); - const AZ::Quaternion uncompressedBindPoseRot = MCore::Compressed16BitQuaternion(jointChunk.m_bindPoseRot.mX, jointChunk.m_bindPoseRot.mY, jointChunk.m_bindPoseRot.mZ, jointChunk.m_bindPoseRot.mW).ToQuaternion().GetNormalized(); + const AZ::Quaternion uncompressedPoseRot = MCore::Compressed16BitQuaternion(jointChunk.m_staticRot.m_x, jointChunk.m_staticRot.m_y, jointChunk.m_staticRot.m_z, jointChunk.m_staticRot.m_w).ToQuaternion().GetNormalized(); + const AZ::Quaternion uncompressedBindPoseRot = MCore::Compressed16BitQuaternion(jointChunk.m_bindPoseRot.m_x, jointChunk.m_bindPoseRot.m_y, jointChunk.m_bindPoseRot.m_z, jointChunk.m_bindPoseRot.m_w).ToQuaternion().GetNormalized(); MCore::LogDetailedInfo("- Motion Joint: %s", motionData->GetJointName(jointDataIndex).c_str()); - MCore::LogDetailedInfo(" + Static Translation: x=%f y=%f z=%f", jointChunk.m_staticPos.mX, jointChunk.m_staticPos.mY, jointChunk.m_staticPos.mZ); + MCore::LogDetailedInfo(" + Static Translation: x=%f y=%f z=%f", jointChunk.m_staticPos.m_x, jointChunk.m_staticPos.m_y, jointChunk.m_staticPos.m_z); MCore::LogDetailedInfo(" + Static Rotation: x=%f y=%f z=%f w=%f", static_cast(uncompressedPoseRot.GetX()), static_cast(uncompressedPoseRot.GetY()), static_cast(uncompressedPoseRot.GetZ()), static_cast(uncompressedPoseRot.GetW())); - MCore::LogDetailedInfo(" + Static Scale: x=%f y=%f z=%f", jointChunk.m_staticScale.mX, jointChunk.m_staticScale.mY, jointChunk.m_staticScale.mZ); - MCore::LogDetailedInfo(" + Bind Pose Translation: x=%f y=%f z=%f", jointChunk.m_bindPosePos.mX, jointChunk.m_bindPosePos.mY, jointChunk.m_bindPosePos.mZ); + MCore::LogDetailedInfo(" + Static Scale: x=%f y=%f z=%f", jointChunk.m_staticScale.m_x, jointChunk.m_staticScale.m_y, jointChunk.m_staticScale.m_z); + MCore::LogDetailedInfo(" + Bind Pose Translation: x=%f y=%f z=%f", jointChunk.m_bindPosePos.m_x, jointChunk.m_bindPosePos.m_y, jointChunk.m_bindPosePos.m_z); MCore::LogDetailedInfo(" + Bind Pose Rotation: x=%f y=%f z=%f w=%f", static_cast(uncompressedBindPoseRot.GetX()), static_cast(uncompressedBindPoseRot.GetY()), static_cast(uncompressedBindPoseRot.GetZ()), static_cast(uncompressedBindPoseRot.GetW())); - MCore::LogDetailedInfo(" + Bind Pose Scale: x=%f y=%f z=%f", jointChunk.m_bindPoseScale.mX, jointChunk.m_bindPoseScale.mY, jointChunk.m_bindPoseScale.mZ); + MCore::LogDetailedInfo(" + Bind Pose Scale: x=%f y=%f z=%f", jointChunk.m_bindPoseScale.m_x, jointChunk.m_bindPoseScale.m_y, jointChunk.m_bindPoseScale.m_z); MCore::LogDetailedInfo(" + Position Animated: %s", (flags & File_UniformMotionData_Flags::IsPositionAnimated) ? "Yes" : "No"); MCore::LogDetailedInfo(" + Rotation Animated: %s", (flags & File_UniformMotionData_Flags::IsRotationAnimated) ? "Yes" : "No"); MCore::LogDetailedInfo(" + Scale Animated: %s", (flags & File_UniformMotionData_Flags::IsScaleAnimated) ? "Yes" : "No"); @@ -1122,12 +1122,12 @@ namespace EMotionFX } // Convert endian. - AZ::Vector3 staticPos(jointInfo.m_staticPos.mX, jointInfo.m_staticPos.mY, jointInfo.m_staticPos.mZ); - AZ::Vector3 staticScale(jointInfo.m_staticScale.mX, jointInfo.m_staticScale.mY, jointInfo.m_staticScale.mZ); - MCore::Compressed16BitQuaternion staticRot(jointInfo.m_staticRot.mX, jointInfo.m_staticRot.mY, jointInfo.m_staticRot.mZ, jointInfo.m_staticRot.mW); - AZ::Vector3 bindPosePos(jointInfo.m_bindPosePos.mX, jointInfo.m_bindPosePos.mY, jointInfo.m_bindPosePos.mZ); - AZ::Vector3 bindPoseScale(jointInfo.m_bindPoseScale.mX, jointInfo.m_bindPoseScale.mY, jointInfo.m_bindPoseScale.mZ); - MCore::Compressed16BitQuaternion bindPoseRot(jointInfo.m_bindPoseRot.mX, jointInfo.m_bindPoseRot.mY, jointInfo.m_bindPoseRot.mZ, jointInfo.m_bindPoseRot.mW); + AZ::Vector3 staticPos(jointInfo.m_staticPos.m_x, jointInfo.m_staticPos.m_y, jointInfo.m_staticPos.m_z); + AZ::Vector3 staticScale(jointInfo.m_staticScale.m_x, jointInfo.m_staticScale.m_y, jointInfo.m_staticScale.m_z); + MCore::Compressed16BitQuaternion staticRot(jointInfo.m_staticRot.m_x, jointInfo.m_staticRot.m_y, jointInfo.m_staticRot.m_z, jointInfo.m_staticRot.m_w); + AZ::Vector3 bindPosePos(jointInfo.m_bindPosePos.m_x, jointInfo.m_bindPosePos.m_y, jointInfo.m_bindPosePos.m_z); + AZ::Vector3 bindPoseScale(jointInfo.m_bindPoseScale.m_x, jointInfo.m_bindPoseScale.m_y, jointInfo.m_bindPoseScale.m_z); + MCore::Compressed16BitQuaternion bindPoseRot(jointInfo.m_bindPoseRot.m_x, jointInfo.m_bindPoseRot.m_y, jointInfo.m_bindPoseRot.m_z, jointInfo.m_bindPoseRot.m_w); MCore::Endian::ConvertVector3(&staticPos, sourceEndianType); MCore::Endian::Convert16BitQuaternion(&staticRot, sourceEndianType); MCore::Endian::ConvertVector3(&staticScale, sourceEndianType); @@ -1171,8 +1171,8 @@ namespace EMotionFX { return false; } - MCore::Endian::ConvertFloat(&fileVector.mX, sourceEndianType, /*numFloats=*/3); - motionData->SetJointPositionSample(i, s, AZ::Vector3(fileVector.mX, fileVector.mY, fileVector.mZ)); + MCore::Endian::ConvertFloat(&fileVector.m_x, sourceEndianType, /*numFloats=*/3); + motionData->SetJointPositionSample(i, s, AZ::Vector3(fileVector.m_x, fileVector.m_y, fileVector.m_z)); } } @@ -1188,7 +1188,7 @@ namespace EMotionFX { return false; } - MCore::Compressed16BitQuaternion compressedQuat(fileQuat.mX, fileQuat.mY, fileQuat.mZ, fileQuat.mW); + MCore::Compressed16BitQuaternion compressedQuat(fileQuat.m_x, fileQuat.m_y, fileQuat.m_z, fileQuat.m_w); MCore::Endian::Convert16BitQuaternion(&compressedQuat, sourceEndianType); motionData->SetJointRotationSample(i, s, compressedQuat.ToQuaternion().GetNormalized()); } @@ -1211,8 +1211,8 @@ namespace EMotionFX } EMFX_SCALECODE ( - MCore::Endian::ConvertFloat(&fileVector.mX, sourceEndianType, /*numFloats=*/3); - motionData->SetJointScaleSample(i, s, AZ::Vector3(fileVector.mX, fileVector.mY, fileVector.mZ)); + MCore::Endian::ConvertFloat(&fileVector.m_x, sourceEndianType, /*numFloats=*/3); + motionData->SetJointScaleSample(i, s, AZ::Vector3(fileVector.m_x, fileVector.m_y, fileVector.m_z)); ) } } diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/MotionEventTrack.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/MotionEventTrack.cpp index d288fa8b82..02b8c179b4 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/MotionEventTrack.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/MotionEventTrack.cpp @@ -25,12 +25,12 @@ namespace EMotionFX AZ_CLASS_ALLOCATOR_IMPL(MotionEventTrack, MotionEventAllocator, 0) MotionEventTrack::MotionEventTrack(Motion* motion) - : mMotion(motion) + : m_motion(motion) { } MotionEventTrack::MotionEventTrack(const char* name, Motion* motion) - : mMotion(motion) + : m_motion(motion) , m_name(name) { } @@ -47,7 +47,7 @@ namespace EMotionFX return *this; } m_events = other.m_events; - mMotion = other.mMotion; + m_motion = other.m_motion; m_name = other.m_name; return *this; } @@ -63,8 +63,8 @@ namespace EMotionFX serializeContext->Class() ->Version(2, VersionConverter) ->Field("name", &MotionEventTrack::m_name) - ->Field("enabled", &MotionEventTrack::mEnabled) - ->Field("deletable", &MotionEventTrack::mDeletable) + ->Field("enabled", &MotionEventTrack::m_enabled) + ->Field("deletable", &MotionEventTrack::m_deletable) ->Field("events", &MotionEventTrack::m_events) ; @@ -392,7 +392,7 @@ namespace EMotionFX { targetTrack->m_name = m_name; targetTrack->m_events = m_events; - targetTrack->mEnabled = mEnabled; + targetTrack->m_enabled = m_enabled; } // reserve memory for a given amount of events @@ -403,35 +403,35 @@ namespace EMotionFX void MotionEventTrack::SetIsEnabled(bool enabled) { - mEnabled = enabled; + m_enabled = enabled; } bool MotionEventTrack::GetIsEnabled() const { - return mEnabled; + return m_enabled; } bool MotionEventTrack::GetIsDeletable() const { - return mDeletable; + return m_deletable; } void MotionEventTrack::SetIsDeletable(bool isDeletable) { - mDeletable = isDeletable; + m_deletable = isDeletable; } Motion* MotionEventTrack::GetMotion() const { - return mMotion; + return m_motion; } void MotionEventTrack::SetMotion(Motion* newMotion) { - mMotion = newMotion; + m_motion = newMotion; } } // namespace EMotionFX diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/MotionEventTrack.h b/Gems/EMotionFX/Code/EMotionFX/Source/MotionEventTrack.h index 63f5abd0dd..fdf2e2bed7 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/MotionEventTrack.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/MotionEventTrack.h @@ -182,11 +182,11 @@ namespace EMotionFX AZStd::string m_name; /// The motion where this track belongs to. - Motion* mMotion; + Motion* m_motion; /// Is this track enabled? - bool mEnabled = true; - bool mDeletable = true; + bool m_enabled = true; + bool m_deletable = true; private: void ProcessEventsImpl(float startTime, float endTime, ActorInstance* actorInstance, const MotionInstance* motionInstance, const AZStd::function& processFunc); diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/MotionInstance.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/MotionInstance.cpp index 3cefe9e513..696430271a 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/MotionInstance.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/MotionInstance.cpp @@ -74,30 +74,30 @@ namespace EMotionFX void MotionInstance::InitFromPlayBackInfo(const PlayBackInfo& info, bool resetCurrentPlaytime) { - SetFadeTime (info.mBlendOutTime); - SetMixMode (info.mMix); - SetMaxLoops (info.mNumLoops); - SetBlendMode (info.mBlendMode); - SetPlaySpeed (info.mPlaySpeed); - SetWeight (info.mTargetWeight, info.mBlendInTime); - SetPriorityLevel (info.mPriorityLevel); - SetPlayMode (info.mPlayMode); - SetRetargetingEnabled (info.mRetarget); - SetMotionExtractionEnabled(info.mMotionExtractionEnabled); - SetFreezeAtLastFrame (info.mFreezeAtLastFrame); - SetMotionEventsEnabled (info.mEnableMotionEvents); - SetMaxPlayTime (info.mMaxPlayTime); - SetEventWeightThreshold (info.mEventWeightThreshold); - SetBlendOutBeforeEnded (info.mBlendOutBeforeEnded); - SetCanOverwrite (info.mCanOverwrite); - SetDeleteOnZeroWeight (info.mDeleteOnZeroWeight); - SetMirrorMotion (info.mMirrorMotion); - SetFreezeAtTime (info.mFreezeAtTime); - SetIsInPlace (info.mInPlace); + SetFadeTime (info.m_blendOutTime); + SetMixMode (info.m_mix); + SetMaxLoops (info.m_numLoops); + SetBlendMode (info.m_blendMode); + SetPlaySpeed (info.m_playSpeed); + SetWeight (info.m_targetWeight, info.m_blendInTime); + SetPriorityLevel (info.m_priorityLevel); + SetPlayMode (info.m_playMode); + SetRetargetingEnabled (info.m_retarget); + SetMotionExtractionEnabled(info.m_motionExtractionEnabled); + SetFreezeAtLastFrame (info.m_freezeAtLastFrame); + SetMotionEventsEnabled (info.m_enableMotionEvents); + SetMaxPlayTime (info.m_maxPlayTime); + SetEventWeightThreshold (info.m_eventWeightThreshold); + SetBlendOutBeforeEnded (info.m_blendOutBeforeEnded); + SetCanOverwrite (info.m_canOverwrite); + SetDeleteOnZeroWeight (info.m_deleteOnZeroWeight); + SetMirrorMotion (info.m_mirrorMotion); + SetFreezeAtTime (info.m_freezeAtTime); + SetIsInPlace (info.m_inPlace); if (resetCurrentPlaytime) { - m_currentTime = (info.mPlayMode == PLAYMODE_BACKWARD) ? GetDuration() : 0.0f; + m_currentTime = (info.m_playMode == PLAYMODE_BACKWARD) ? GetDuration() : 0.0f; m_lastCurTime = m_currentTime; m_timeDiffToEnd = GetDuration(); } @@ -363,14 +363,14 @@ namespace EMotionFX const float currentTimePreUpdate = m_currentTime; UpdateTime(timePassed); - // If UpdateTime() did not advance mCurrentTime we can skip over ProcessEvents(). + // If UpdateTime() did not advance m_currentTime we can skip over ProcessEvents(). if (!AZ::IsClose(m_lastCurTime, m_currentTime, AZ::Constants::FloatEpsilon)) { // if we are blending towards the destination motion or layer. - // Do this after UpdateTime(timePassed) and use (mCurrentTime - mLastCurTime) + // Do this after UpdateTime(timePassed) and use (m_currentTime - m_lastCurTime) // as the elapsed time. This will function for Updates that use SetCurrentTime(time, false) // like Simple Motion component does with Track View. This will also work for motions that - // have mPlaySpeed that is not 1.0f. + // have m_playSpeed that is not 1.0f. if (GetIsBlending()) { const float duration = GetDuration(); @@ -854,9 +854,9 @@ namespace EMotionFX m_motion->CalcNodeTransform(this, &oldNodeTransform, actor, rootNode, oldTime, GetRetargetingEnabled()); // calculate the relative transforms - outTransform->mPosition = curNodeTransform.mPosition - oldNodeTransform.mPosition; - outTransform->mRotation = curNodeTransform.mRotation * oldNodeTransform.mRotation.GetConjugate(); - outTransform->mRotation.Normalize(); + outTransform->m_position = curNodeTransform.m_position - oldNodeTransform.m_position; + outTransform->m_rotation = curNodeTransform.m_rotation * oldNodeTransform.m_rotation.GetConjugate(); + outTransform->m_rotation.Normalize(); } // extract the motion delta transform @@ -916,8 +916,8 @@ namespace EMotionFX } // add the relative transform to the final values - trajectoryDelta.mPosition += relativeTrajectoryTransform.mPosition; - trajectoryDelta.mRotation = relativeTrajectoryTransform.mRotation * trajectoryDelta.mRotation; + trajectoryDelta.m_position += relativeTrajectoryTransform.m_position; + trajectoryDelta.m_rotation = relativeTrajectoryTransform.m_rotation * trajectoryDelta.m_rotation; } // calculate the relative movement @@ -925,8 +925,8 @@ namespace EMotionFX CalcRelativeTransform(motionExtractNode, curTimeValue, oldTimeValue, &relativeTrajectoryTransform); // add the relative transform to the final values - trajectoryDelta.mPosition += relativeTrajectoryTransform.mPosition; - trajectoryDelta.mRotation = relativeTrajectoryTransform.mRotation * trajectoryDelta.mRotation; + trajectoryDelta.m_position += relativeTrajectoryTransform.m_position; + trajectoryDelta.m_rotation = relativeTrajectoryTransform.m_rotation * trajectoryDelta.m_rotation; } // if not paused @@ -941,8 +941,8 @@ namespace EMotionFX // Calculate the difference between the first frame of the motion and the bind pose transform. TransformData* transformData = m_actorInstance->GetTransformData(); const Pose* bindPose = transformData->GetBindPose(); - AZ::Quaternion permBindPoseRotDiff = firstFrameTransform.mRotation * bindPose->GetLocalSpaceTransform(motionExtractionNodeIndex).mRotation.GetConjugate(); - AZ::Vector3 permBindPosePosDiff = bindPose->GetLocalSpaceTransform(motionExtractionNodeIndex).mPosition - firstFrameTransform.mPosition; + AZ::Quaternion permBindPoseRotDiff = firstFrameTransform.m_rotation * bindPose->GetLocalSpaceTransform(motionExtractionNodeIndex).m_rotation.GetConjugate(); + AZ::Vector3 permBindPosePosDiff = bindPose->GetLocalSpaceTransform(motionExtractionNodeIndex).m_position - firstFrameTransform.m_position; permBindPoseRotDiff.SetX(0.0f); permBindPoseRotDiff.SetY(0.0f); permBindPoseRotDiff.Normalize(); @@ -964,22 +964,22 @@ namespace EMotionFX // Capture rotation around the up axis only. trajectoryDelta.ApplyMotionExtractionFlags(m_motion->GetMotionExtractionFlags()); - AZ::Quaternion removeRot = currentFrameTransform.mRotation * firstFrameTransform.mRotation.GetConjugate(); + AZ::Quaternion removeRot = currentFrameTransform.m_rotation * firstFrameTransform.m_rotation.GetConjugate(); removeRot.SetX(0.0f); removeRot.SetY(0.0f); removeRot.Normalize(); - AZ::Quaternion rotation = removeRot.GetConjugate() * trajectoryDelta.mRotation * permBindPoseRotDiff.GetConjugate(); + AZ::Quaternion rotation = removeRot.GetConjugate() * trajectoryDelta.m_rotation * permBindPoseRotDiff.GetConjugate(); rotation.SetX(0.0f); rotation.SetY(0.0f); rotation.Normalize(); - AZ::Vector3 rotatedPos = rotation.TransformVector(trajectoryDelta.mPosition - bindPosePosDiff); + AZ::Vector3 rotatedPos = rotation.TransformVector(trajectoryDelta.m_position - bindPosePosDiff); // Calculate the real trajectory delta, taking into account the actor instance rotation. - outTrajectoryDelta.mPosition = m_actorInstance->GetLocalSpaceTransform().mRotation.TransformVector(rotatedPos); - outTrajectoryDelta.mRotation = trajectoryDelta.mRotation * bindPoseRotDiff; - outTrajectoryDelta.mRotation.Normalize(); + outTrajectoryDelta.m_position = m_actorInstance->GetLocalSpaceTransform().m_rotation.TransformVector(rotatedPos); + outTrajectoryDelta.m_rotation = trajectoryDelta.m_rotation * bindPoseRotDiff; + outTrajectoryDelta.m_rotation.Normalize(); if (m_boolFlags & MotionInstance::BOOL_ISFIRSTREPOSUPDATE) { diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/MotionInstance.h b/Gems/EMotionFX/Code/EMotionFX/Source/MotionInstance.h index 59bd08d248..f41cf29c79 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/MotionInstance.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/MotionInstance.h @@ -120,7 +120,7 @@ namespace EMotionFX * Get the blend in time. * This is the time passed to the SetWeight(...) method where when the target weight is bigger than the current. * So only blend ins are counted and not blending out towards for example a weight of 0. - * When you never call SetWeight(...) yourself, this means that this will contain the value specificied to PlayBackInfo::mBlendInTime + * When you never call SetWeight(...) yourself, this means that this will contain the value specificied to PlayBackInfo::m_blendInTime * at the time of MotionSystem::PlayMotion(...). * @result The blend-in time, in seconds. */ @@ -803,7 +803,7 @@ namespace EMotionFX /** * This event gets triggered once the given motion instance gets added to the motion queue. - * This happens when you set the PlayBackInfo::mPlayNow member to false. In that case the MotionSystem::PlayMotion() method (OnPlayMotion) + * This happens when you set the PlayBackInfo::m_playNow member to false. In that case the MotionSystem::PlayMotion() method (OnPlayMotion) * will not directly start playing the motion (OnStartMotionInstance), but will add it to the motion queue instead. * The motion queue will then start playing the motion instance once it should. * @param info The playback information used to play this motion instance. @@ -885,17 +885,17 @@ namespace EMotionFX AZStd::vector m_eventHandlersByEventType; /**< The event handler to use to process events organized by EventTypes. */ float m_currentTime = 0.0f; /**< The current playtime. */ float m_timeDiffToEnd = 0.0f; /**< The time it takes until we reach the loop point in the motion. This also takes the playback direction into account (backward or forward play). */ - float m_freezeAtTime = -1.0f; /**< Freeze at a given time offset in seconds. The current play time would continue running though, and a blend out would be triggered, unlike the mFreezeAtLastFrame. Set to negative value to disable. Default=-1.*/ + float m_freezeAtTime = -1.0f; /**< Freeze at a given time offset in seconds. The current play time would continue running though, and a blend out would be triggered, unlike the m_freezeAtLastFrame. Set to negative value to disable. Default=-1.*/ float m_playSpeed = 1.0f; /**< The playspeed (1.0=normal speed). */ float m_lastCurTime = 0.0f; /**< The last current time, so the current time in the previous update. */ float m_totalPlayTime = 0.0f; /**< The current total play time that this motion is already playing. */ - float m_maxPlayTime = 0.0f; /**< The maximum play time of the motion. If the mTotalPlayTime is higher than this, the motion will be stopped, unless the max play time is zero or negative. */ + float m_maxPlayTime = 0.0f; /**< The maximum play time of the motion. If the m_totalPlayTime is higher than this, the motion will be stopped, unless the max play time is zero or negative. */ float m_eventWeightThreshold = 0.0f; /**< If the weight of the motion instance is below this value, the events won't get processed (default = 0.0f). */ float m_weight = 0.0f; /**< The current weight value, in range of [0..1]. */ float m_weightDelta = 0.0f; /**< The precalculated weight delta value, used during blending between weights. */ float m_targetWeight = 1.0f; /**< The target weight of the layer, when activating the motion. */ float m_blendInTime = 0.0f; /**< The blend in time. */ - float m_fadeTime = 0.3f; /**< Fadeout speed, when playing the animation once. So when it is done playing once, it will fade out in 'mFadeTime' seconds. */ + float m_fadeTime = 0.3f; /**< Fadeout speed, when playing the animation once. So when it is done playing once, it will fade out in 'm_fadeTime' seconds. */ AZ::u32 m_curLoops = 0; /**< Number of loops it currently has made (so the number of times the motion played already). */ AZ::u32 m_maxLoops = EMFX_LOOPFOREVER; /**< The maximum number of loops, before it has to stop. */ AZ::u32 m_lastLoops = 0; /**< The current number of loops in the previous update. */ diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/MotionInstancePool.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/MotionInstancePool.cpp index a10a4722eb..3a9d7b94b9 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/MotionInstancePool.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/MotionInstancePool.cpp @@ -20,9 +20,9 @@ namespace EMotionFX // constructor MotionInstancePool::SubPool::SubPool() - : mData(nullptr) - , mNumInstances(0) - , mNumInUse(0) + : m_data(nullptr) + , m_numInstances(0) + , m_numInUse(0) { } @@ -30,8 +30,8 @@ namespace EMotionFX // destructor MotionInstancePool::SubPool::~SubPool() { - MCore::Free(mData); - mData = nullptr; + MCore::Free(m_data); + m_data = nullptr; } @@ -42,36 +42,36 @@ namespace EMotionFX // constructor MotionInstancePool::Pool::Pool() { - mPoolType = POOLTYPE_DYNAMIC; - mData = nullptr; - mNumInstances = 0; - mNumUsedInstances = 0; - mSubPoolSize = 0; + m_poolType = POOLTYPE_DYNAMIC; + m_data = nullptr; + m_numInstances = 0; + m_numUsedInstances = 0; + m_subPoolSize = 0; } // destructor MotionInstancePool::Pool::~Pool() { - if (mPoolType == POOLTYPE_STATIC) + if (m_poolType == POOLTYPE_STATIC) { - MCore::Free(mData); - mData = nullptr; - mFreeList.clear(); + MCore::Free(m_data); + m_data = nullptr; + m_freeList.clear(); } else - if (mPoolType == POOLTYPE_DYNAMIC) + if (m_poolType == POOLTYPE_DYNAMIC) { - MCORE_ASSERT(mData == nullptr); + MCORE_ASSERT(m_data == nullptr); // delete all subpools - for (SubPool* subPool : mSubPools) + for (SubPool* subPool : m_subPools) { delete subPool; } - mSubPools.clear(); + m_subPools.clear(); - mFreeList.clear(); + m_freeList.clear(); } else { @@ -89,19 +89,19 @@ namespace EMotionFX MotionInstancePool::MotionInstancePool() : BaseObject() { - mPool = nullptr; + m_pool = nullptr; } // destructor MotionInstancePool::~MotionInstancePool() { - if (mPool->mNumUsedInstances > 0) + if (m_pool->m_numUsedInstances > 0) { - MCore::LogError("EMotionFX::~MotionInstancePool() - There are still %d unfreed motion instances, please use the Free function in the MotionInstancePool to free them, just like you would delete the object.", mPool->mNumUsedInstances); + MCore::LogError("EMotionFX::~MotionInstancePool() - There are still %d unfreed motion instances, please use the Free function in the MotionInstancePool to free them, just like you would delete the object.", m_pool->m_numUsedInstances); } - delete mPool; + delete m_pool; } @@ -115,7 +115,7 @@ namespace EMotionFX // init the motion instance pool void MotionInstancePool::Init(size_t numInitialInstances, EPoolType poolType, size_t subPoolSize) { - if (mPool) + if (m_pool) { MCore::LogError("EMotionFX::MotionInstancePool::Init() - We have already initialized the pool, ignoring new init call."); return; @@ -130,40 +130,40 @@ namespace EMotionFX } // create the subpool - mPool = new Pool(); - mPool->mNumInstances = numInitialInstances; - mPool->mPoolType = poolType; - mPool->mSubPoolSize = subPoolSize; + m_pool = new Pool(); + m_pool->m_numInstances = numInitialInstances; + m_pool->m_poolType = poolType; + m_pool->m_subPoolSize = subPoolSize; // if we have a static pool if (poolType == POOLTYPE_STATIC) { - mPool->mData = (uint8*)MCore::Allocate(numInitialInstances * sizeof(MotionInstance), EMFX_MEMCATEGORY_MOTIONINSTANCEPOOL);// alloc space - mPool->mFreeList.resize_no_construct(numInitialInstances); + m_pool->m_data = (uint8*)MCore::Allocate(numInitialInstances * sizeof(MotionInstance), EMFX_MEMCATEGORY_MOTIONINSTANCEPOOL);// alloc space + m_pool->m_freeList.resize_no_construct(numInitialInstances); for (size_t i = 0; i < numInitialInstances; ++i) { - void* memLocation = (void*)(mPool->mData + i * sizeof(MotionInstance)); - mPool->mFreeList[i].mAddress = memLocation; - mPool->mFreeList[i].mSubPool = nullptr; + void* memLocation = (void*)(m_pool->m_data + i * sizeof(MotionInstance)); + m_pool->m_freeList[i].m_address = memLocation; + m_pool->m_freeList[i].m_subPool = nullptr; } } else // if we have a dynamic pool if (poolType == POOLTYPE_DYNAMIC) { - mPool->mSubPools.reserve(32); + m_pool->m_subPools.reserve(32); SubPool* subPool = new SubPool(); - subPool->mData = (uint8*)MCore::Allocate(numInitialInstances * sizeof(MotionInstance), EMFX_MEMCATEGORY_MOTIONINSTANCEPOOL);// alloc space - subPool->mNumInstances = numInitialInstances; + subPool->m_data = (uint8*)MCore::Allocate(numInitialInstances * sizeof(MotionInstance), EMFX_MEMCATEGORY_MOTIONINSTANCEPOOL);// alloc space + subPool->m_numInstances = numInitialInstances; - mPool->mFreeList.resize_no_construct(numInitialInstances); + m_pool->m_freeList.resize_no_construct(numInitialInstances); for (size_t i = 0; i < numInitialInstances; ++i) { - mPool->mFreeList[i].mAddress = (void*)(subPool->mData + i * sizeof(MotionInstance)); - mPool->mFreeList[i].mSubPool = subPool; + m_pool->m_freeList[i].m_address = (void*)(subPool->m_data + i * sizeof(MotionInstance)); + m_pool->m_freeList[i].m_subPool = subPool; } - mPool->mSubPools.emplace_back(subPool); + m_pool->m_subPools.emplace_back(subPool); } else { @@ -176,69 +176,68 @@ namespace EMotionFX MotionInstance* MotionInstancePool::RequestNewWithoutLock(Motion* motion, ActorInstance* actorInstance) { // check if we already initialized - if (mPool == nullptr) + if (m_pool == nullptr) { MCore::LogWarning("EMotionFX::MotionInstancePool::RequestNew() - We have not yet initialized the pool, initializing it to a dynamic pool"); Init(); } // if there is are free items left - if (mPool->mFreeList.size() > 0) + if (m_pool->m_freeList.size() > 0) { - const MemLocation& location = mPool->mFreeList.back(); - MotionInstance* result = MotionInstance::Create(location.mAddress, motion, actorInstance); + const MemLocation& location = m_pool->m_freeList.back(); + MotionInstance* result = MotionInstance::Create(location.m_address, motion, actorInstance); - if (location.mSubPool) + if (location.m_subPool) { - location.mSubPool->mNumInUse++; + location.m_subPool->m_numInUse++; } - result->SetSubPool(location.mSubPool); + result->SetSubPool(location.m_subPool); - mPool->mFreeList.pop_back(); // remove it from the free list - mPool->mNumUsedInstances++; + m_pool->m_freeList.pop_back(); // remove it from the free list + m_pool->m_numUsedInstances++; return result; } // we have no more free attributes left - if (mPool->mPoolType == POOLTYPE_DYNAMIC) // we're dynamic, so we can just create new ones + if (m_pool->m_poolType == POOLTYPE_DYNAMIC) // we're dynamic, so we can just create new ones { - const size_t numInstances = mPool->mSubPoolSize; - mPool->mNumInstances += numInstances; + const size_t numInstances = m_pool->m_subPoolSize; + m_pool->m_numInstances += numInstances; SubPool* subPool = new SubPool(); - subPool->mData = (uint8*)MCore::Allocate(numInstances * sizeof(MotionInstance), EMFX_MEMCATEGORY_MOTIONINSTANCEPOOL);// alloc space - subPool->mNumInstances = numInstances; + subPool->m_data = (uint8*)MCore::Allocate(numInstances * sizeof(MotionInstance), EMFX_MEMCATEGORY_MOTIONINSTANCEPOOL);// alloc space + subPool->m_numInstances = numInstances; - const size_t startIndex = mPool->mFreeList.size(); - //mPool->mFreeList.Reserve( numInstances * 2 ); - if (mPool->mFreeList.capacity() < mPool->mNumInstances) + const size_t startIndex = m_pool->m_freeList.size(); + if (m_pool->m_freeList.capacity() < m_pool->m_numInstances) { - mPool->mFreeList.reserve(mPool->mNumInstances + mPool->mFreeList.capacity() / 2); + m_pool->m_freeList.reserve(m_pool->m_numInstances + m_pool->m_freeList.capacity() / 2); } - mPool->mFreeList.resize_no_construct(startIndex + numInstances); + m_pool->m_freeList.resize_no_construct(startIndex + numInstances); for (size_t i = 0; i < numInstances; ++i) { - void* memAddress = (void*)(subPool->mData + i * sizeof(MotionInstance)); - mPool->mFreeList[i + startIndex].mAddress = memAddress; - mPool->mFreeList[i + startIndex].mSubPool = subPool; + void* memAddress = (void*)(subPool->m_data + i * sizeof(MotionInstance)); + m_pool->m_freeList[i + startIndex].m_address = memAddress; + m_pool->m_freeList[i + startIndex].m_subPool = subPool; } - mPool->mSubPools.emplace_back(subPool); + m_pool->m_subPools.emplace_back(subPool); - const MemLocation& location = mPool->mFreeList.back(); - MotionInstance* result = MotionInstance::Create(location.mAddress, motion, actorInstance); - if (location.mSubPool) + const MemLocation& location = m_pool->m_freeList.back(); + MotionInstance* result = MotionInstance::Create(location.m_address, motion, actorInstance); + if (location.m_subPool) { - location.mSubPool->mNumInUse++; + location.m_subPool->m_numInUse++; } - result->SetSubPool(location.mSubPool); - mPool->mFreeList.pop_back(); // remove it from the free list - mPool->mNumUsedInstances++; + result->SetSubPool(location.m_subPool); + m_pool->m_freeList.pop_back(); // remove it from the free list + m_pool->m_numUsedInstances++; return result; } else // we are static and ran out of free attributes - if (mPool->mPoolType == POOLTYPE_STATIC) + if (m_pool->m_poolType == POOLTYPE_STATIC) { MCore::LogError("EMotionFX::MotionInstancePool::RequestNew() - There are no free motion instance in the static pool. Please increase the size of the pool or make it dynamic when calling Init."); MCORE_ASSERT(false); // we ran out of free motion instances @@ -260,7 +259,7 @@ namespace EMotionFX return; } - if (mPool == nullptr) + if (m_pool == nullptr) { MCore::LogWarning("EMotionFX::MotionInstancePool::Free() - The pool has not yet been initialized, please call Init first."); MCORE_ASSERT(false); @@ -270,13 +269,13 @@ namespace EMotionFX // add it back to the free list if (motionInstance->GetSubPool()) { - motionInstance->GetSubPool()->mNumInUse--; + motionInstance->GetSubPool()->m_numInUse--; } - mPool->mFreeList.emplace_back(); - mPool->mFreeList.back().mAddress = motionInstance; - mPool->mFreeList.back().mSubPool = motionInstance->GetSubPool(); - mPool->mNumUsedInstances--; + m_pool->m_freeList.emplace_back(); + m_pool->m_freeList.back().m_address = motionInstance; + m_pool->m_freeList.back().m_subPool = motionInstance->GetSubPool(); + m_pool->m_numUsedInstances--; motionInstance->DecreaseReferenceCount(); motionInstance->~MotionInstance(); // call the destructor @@ -289,27 +288,27 @@ namespace EMotionFX Lock(); MCore::LogInfo("EMotionFX::MotionInstancePool::LogMemoryStats() - Logging motion instance pool info"); - const size_t numFree = mPool->mFreeList.size(); - size_t numUsed = mPool->mNumUsedInstances; + const size_t numFree = m_pool->m_freeList.size(); + size_t numUsed = m_pool->m_numUsedInstances; size_t memUsage = 0; size_t usedMemUsage = 0; size_t totalMemUsage = 0; size_t totalUsedInstancesMemUsage = 0; - if (mPool->mPoolType == POOLTYPE_STATIC) + if (m_pool->m_poolType == POOLTYPE_STATIC) { - if (mPool->mNumInstances > 0) + if (m_pool->m_numInstances > 0) { - memUsage = mPool->mNumInstances * sizeof(MotionInstance); + memUsage = m_pool->m_numInstances * sizeof(MotionInstance); usedMemUsage = numUsed * sizeof(MotionInstance); } } else - if (mPool->mPoolType == POOLTYPE_DYNAMIC) + if (m_pool->m_poolType == POOLTYPE_DYNAMIC) { - if (mPool->mNumInstances > 0) + if (m_pool->m_numInstances > 0) { - memUsage = mPool->mNumInstances * sizeof(MotionInstance); + memUsage = m_pool->m_numInstances * sizeof(MotionInstance); usedMemUsage = numUsed * sizeof(MotionInstance); } } @@ -317,17 +316,17 @@ namespace EMotionFX totalUsedInstancesMemUsage += usedMemUsage; totalMemUsage += memUsage; totalMemUsage += sizeof(Pool); - totalMemUsage += mPool->mFreeList.capacity() * sizeof(decltype(mPool->mFreeList)::value_type); + totalMemUsage += m_pool->m_freeList.capacity() * sizeof(decltype(m_pool->m_freeList)::value_type); MCore::LogInfo("Pool:"); - if (mPool->mPoolType == POOLTYPE_DYNAMIC) + if (m_pool->m_poolType == POOLTYPE_DYNAMIC) { - MCore::LogInfo(" - Num SubPools: %d", mPool->mSubPools.size()); + MCore::LogInfo(" - Num SubPools: %d", m_pool->m_subPools.size()); } - MCore::LogInfo(" - Num Instances: %d", mPool->mNumInstances); + MCore::LogInfo(" - Num Instances: %d", m_pool->m_numInstances); MCore::LogInfo(" - Num Free: %d", numFree); MCore::LogInfo(" - Num Used: %d", numUsed); - MCore::LogInfo(" - PoolType: %s", (mPool->mPoolType == POOLTYPE_STATIC) ? "Static" : "Dynamic"); + MCore::LogInfo(" - PoolType: %s", (m_pool->m_poolType == POOLTYPE_STATIC) ? "Static" : "Dynamic"); MCore::LogInfo(" - Total Instances Mem: %d bytes (%d k)", memUsage, memUsage / 1000); MCore::LogInfo(" - Used Instances Mem: %d (%d k)", totalUsedInstancesMemUsage, totalUsedInstancesMemUsage / 1000); MCore::LogInfo(" - Total Mem Usage: %d (%d k)", totalMemUsage, totalMemUsage / 1000); @@ -358,14 +357,14 @@ namespace EMotionFX // wait with execution until we can set the lock void MotionInstancePool::Lock() { - mLock.Lock(); + m_lock.Lock(); } // release the lock again void MotionInstancePool::Unlock() { - mLock.Unlock(); + m_lock.Unlock(); } @@ -374,26 +373,26 @@ namespace EMotionFX { Lock(); - for (size_t i = 0; i < mPool->mSubPools.size(); ) + for (size_t i = 0; i < m_pool->m_subPools.size(); ) { - SubPool* subPool = mPool->mSubPools[i]; - if (subPool->mNumInUse == 0) + SubPool* subPool = m_pool->m_subPools[i]; + if (subPool->m_numInUse == 0) { // remove all free allocations - for (size_t a = 0; a < mPool->mFreeList.size(); ) + for (size_t a = 0; a < m_pool->m_freeList.size(); ) { - if (mPool->mFreeList[a].mSubPool == subPool) + if (m_pool->m_freeList[a].m_subPool == subPool) { - mPool->mFreeList.erase(AZStd::next(begin(mPool->mFreeList), a)); + m_pool->m_freeList.erase(AZStd::next(begin(m_pool->m_freeList), a)); } else { ++a; } } - mPool->mNumInstances -= subPool->mNumInstances; + m_pool->m_numInstances -= subPool->m_numInstances; - mPool->mSubPools.erase(AZStd::next(begin(mPool->mSubPools), i)); + m_pool->m_subPools.erase(AZStd::next(begin(m_pool->m_subPools), i)); delete subPool; } else @@ -402,11 +401,10 @@ namespace EMotionFX } } - mPool->mSubPools.shrink_to_fit(); - //mPool->mFreeList.Shrink(); - if ((mPool->mFreeList.capacity() - mPool->mFreeList.size()) > 4096) + m_pool->m_subPools.shrink_to_fit(); + if ((m_pool->m_freeList.capacity() - m_pool->m_freeList.size()) > 4096) { - mPool->mFreeList.reserve(mPool->mFreeList.size() + 4096); + m_pool->m_freeList.reserve(m_pool->m_freeList.size() + 4096); } Unlock(); diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/MotionInstancePool.h b/Gems/EMotionFX/Code/EMotionFX/Source/MotionInstancePool.h index e257640e33..54837a1113 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/MotionInstancePool.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/MotionInstancePool.h @@ -68,15 +68,15 @@ namespace EMotionFX SubPool(); ~SubPool(); - uint8* mData; - size_t mNumInstances; - size_t mNumInUse; + uint8* m_data; + size_t m_numInstances; + size_t m_numInUse; }; struct EMFX_API MemLocation { - void* mAddress; - SubPool* mSubPool; + void* m_address; + SubPool* m_subPool; }; class EMFX_API Pool @@ -87,17 +87,17 @@ namespace EMotionFX Pool(); ~Pool(); - uint8* mData; - size_t mNumInstances; - size_t mNumUsedInstances; - size_t mSubPoolSize; - AZStd::vector mFreeList; - AZStd::vector mSubPools; - EPoolType mPoolType; + uint8* m_data; + size_t m_numInstances; + size_t m_numUsedInstances; + size_t m_subPoolSize; + AZStd::vector m_freeList; + AZStd::vector m_subPools; + EPoolType m_poolType; }; - Pool* mPool; - MCore::Mutex mLock; + Pool* m_pool; + MCore::Mutex m_lock; MotionInstancePool(); ~MotionInstancePool(); diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/MotionLayerSystem.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/MotionLayerSystem.cpp index b613ecc147..dddfd1eba8 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/MotionLayerSystem.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/MotionLayerSystem.cpp @@ -24,7 +24,7 @@ namespace EMotionFX : MotionSystem(actorInstance) { // set the motion based actor repositioning layer pass - mRepositioningPass = RepositioningLayerPass::Create(this); + m_repositioningPass = RepositioningLayerPass::Create(this); } @@ -34,7 +34,7 @@ namespace EMotionFX RemoveAllLayerPasses(); // get rid of the repositioning layer pass - mRepositioningPass->Destroy(); + m_repositioningPass->Destroy(); } @@ -49,7 +49,7 @@ namespace EMotionFX void MotionLayerSystem::RemoveAllLayerPasses(bool delFromMem) { // delete all layer passes - for (LayerPass* layerPass : mLayerPasses) + for (LayerPass* layerPass : m_layerPasses) { if (delFromMem) { @@ -57,7 +57,7 @@ namespace EMotionFX } } - mLayerPasses.clear(); + m_layerPasses.clear(); } @@ -65,23 +65,23 @@ namespace EMotionFX void MotionLayerSystem::StartMotion(MotionInstance* motion, PlayBackInfo* info) { // check if we have any motions playing already - const size_t numMotionInstances = mMotionInstances.size(); + const size_t numMotionInstances = m_motionInstances.size(); if (numMotionInstances > 0) { // find the right location in the motion instance array to insert this motion instance size_t insertPos = FindInsertPos(motion->GetPriorityLevel()); if (insertPos != InvalidIndex) { - mMotionInstances.emplace(AZStd::next(begin(mMotionInstances), insertPos), motion); + m_motionInstances.emplace(AZStd::next(begin(m_motionInstances), insertPos), motion); } else { - mMotionInstances.emplace_back(motion); + m_motionInstances.emplace_back(motion); } } else // no motions are playing, so just add it { - mMotionInstances.emplace_back(motion); + m_motionInstances.emplace_back(motion); } // trigger an event @@ -92,18 +92,18 @@ namespace EMotionFX motion->SetIsActive(true); // start the blend - motion->SetWeight(info->mTargetWeight, info->mBlendInTime); + motion->SetWeight(info->m_targetWeight, info->m_blendInTime); } // find the location where to insert a new motion with a given priority size_t MotionLayerSystem::FindInsertPos(size_t priorityLevel) const { - const auto* foundInsertPosition = AZStd::lower_bound(begin(mMotionInstances), end(mMotionInstances), priorityLevel, [](const MotionInstance* motionInstance, size_t level) + const auto* foundInsertPosition = AZStd::lower_bound(begin(m_motionInstances), end(m_motionInstances), priorityLevel, [](const MotionInstance* motionInstance, size_t level) { return motionInstance->GetPriorityLevel() < level; }); - return foundInsertPosition != end(mMotionInstances) ? AZStd::distance(begin(mMotionInstances), foundInsertPosition) : InvalidIndex; + return foundInsertPosition != end(m_motionInstances) ? AZStd::distance(begin(m_motionInstances), foundInsertPosition) : InvalidIndex; } @@ -117,22 +117,22 @@ namespace EMotionFX UpdateMotionTree(); // update the motion queue - mMotionQueue->Update(); + m_motionQueue->Update(); // process all layer passes - for (LayerPass* layerPass : mLayerPasses) + for (LayerPass* layerPass : m_layerPasses) { layerPass->Process(); } // process the repositioning as last - if (mRepositioningPass) + if (m_repositioningPass) { - mRepositioningPass->Process(); + m_repositioningPass->Process(); } // update the global transform now that we have an updated local transform of the actor instance itself (modified by motion extraction for example) - mActorInstance->UpdateWorldTransform(); + m_actorInstance->UpdateWorldTransform(); // if we need to update the node transforms because the character is visible if (updateNodes) @@ -145,9 +145,9 @@ namespace EMotionFX // update the motion tree void MotionLayerSystem::UpdateMotionTree() { - for (size_t i = 0; i < mMotionInstances.size(); ++i) + for (size_t i = 0; i < m_motionInstances.size(); ++i) { - MotionInstance* source = mMotionInstances[i]; + MotionInstance* source = m_motionInstances[i]; // if we aren't stopping this motion yet if (!source->GetIsStopping()) @@ -227,10 +227,10 @@ namespace EMotionFX if (source->GetCanOverwrite()) { // remove all motions that got overwritten by the current one - const size_t numToRemove = mMotionInstances.size() - (i + 1); + const size_t numToRemove = m_motionInstances.size() - (i + 1); for (size_t a = 0; a < numToRemove; ++a) { - RemoveMotionInstance(mMotionInstances[i + 1]); + RemoveMotionInstance(m_motionInstances[i + 1]); } } } @@ -245,7 +245,7 @@ namespace EMotionFX size_t numRemoved = 0; // start from the bottom up - for (auto iter = rbegin(mMotionInstances); iter != rend(mMotionInstances); ++iter) + for (auto iter = rbegin(m_motionInstances); iter != rend(m_motionInstances); ++iter) { MotionInstance* curInstance = *iter; @@ -267,11 +267,11 @@ namespace EMotionFX MotionInstance* MotionLayerSystem::FindFirstNonMixingMotionInstance() const { // if there aren't any motion instances, return nullptr - const auto foundMotionInstance = AZStd::find_if(begin(mMotionInstances), end(mMotionInstances), [](const MotionInstance* motionInstance) + const auto foundMotionInstance = AZStd::find_if(begin(m_motionInstances), end(m_motionInstances), [](const MotionInstance* motionInstance) { return !motionInstance->GetIsMixing(); }); - return foundMotionInstance != end(mMotionInstances) ? *foundMotionInstance : nullptr; + return foundMotionInstance != end(m_motionInstances) ? *foundMotionInstance : nullptr; } @@ -279,25 +279,25 @@ namespace EMotionFX void MotionLayerSystem::UpdateNodes() { // get the two pose buffers we need - const uint32 threadIndex = mActorInstance->GetThreadIndex(); + const uint32 threadIndex = m_actorInstance->GetThreadIndex(); AnimGraphPosePool& posePool = GetEMotionFX().GetThreadData(threadIndex)->GetPosePool(); - AnimGraphPose* tempAnimGraphPose = posePool.RequestPose(mActorInstance); + AnimGraphPose* tempAnimGraphPose = posePool.RequestPose(m_actorInstance); - const bool motionExtractionEnabled = mActorInstance->GetMotionExtractionEnabled(); + const bool motionExtractionEnabled = m_actorInstance->GetMotionExtractionEnabled(); Pose* tempActorPose = &tempAnimGraphPose->GetPose(); - const size_t numMotionInstances = mMotionInstances.size(); + const size_t numMotionInstances = m_motionInstances.size(); if (numMotionInstances > 0) { if (numMotionInstances > 1) { - TransformData* transformData = mActorInstance->GetTransformData(); + TransformData* transformData = m_actorInstance->GetTransformData(); Pose* finalPose = transformData->GetCurrentPose(); - finalPose->InitFromBindPose(mActorInstance); + finalPose->InitFromBindPose(m_actorInstance); // blend the layers - for (auto iter = rbegin(mMotionInstances); iter != rend(mMotionInstances); ++iter) + for (auto iter = rbegin(m_motionInstances); iter != rend(m_motionInstances); ++iter) { // skip inactive motion instances MotionInstance* instance = *iter; // the motion to be blended @@ -322,12 +322,12 @@ namespace EMotionFX else // there is just one motion playing { // skip inactive motion instances - MotionInstance* instance = mMotionInstances[0]; // the motion to be blended + MotionInstance* instance = m_motionInstances[0]; // the motion to be blended if (instance->GetIsActive() && instance->GetWeight() >= 0.9999f) { - TransformData* transformData = mActorInstance->GetTransformData(); + TransformData* transformData = m_actorInstance->GetTransformData(); Pose* finalPose = transformData->GetCurrentPose(); - finalPose->InitFromBindPose(mActorInstance); + finalPose->InitFromBindPose(m_actorInstance); instance->GetMotion()->Update(finalPose, finalPose, instance); // output the results of the single motion @@ -340,15 +340,15 @@ namespace EMotionFX else if (instance->GetIsActive() && instance->GetWeight() < 0.0001f) // almost not active { - TransformData* transformData = mActorInstance->GetTransformData(); - transformData->GetCurrentPose()->InitFromBindPose(mActorInstance); + TransformData* transformData = m_actorInstance->GetTransformData(); + transformData->GetCurrentPose()->InitFromBindPose(m_actorInstance); } else // semi active { - TransformData* transformData = mActorInstance->GetTransformData(); + TransformData* transformData = m_actorInstance->GetTransformData(); Pose* finalPose = transformData->GetCurrentPose(); - finalPose->InitFromBindPose(mActorInstance); + finalPose->InitFromBindPose(m_actorInstance); instance->GetMotion()->Update(finalPose, tempActorPose, instance); // output the results of the single motion // compensate for motion extraction @@ -365,8 +365,8 @@ namespace EMotionFX else // no motion playing { // update all node transforms - TransformData* transformData = mActorInstance->GetTransformData(); - transformData->GetCurrentPose()->InitFromBindPose(mActorInstance); + TransformData* transformData = m_actorInstance->GetTransformData(); + transformData->GetCurrentPose()->InitFromBindPose(m_actorInstance); } // free the poses back to the pool @@ -377,14 +377,14 @@ namespace EMotionFX // add a new pass void MotionLayerSystem::AddLayerPass(LayerPass* newPass) { - mLayerPasses.emplace_back(newPass); + m_layerPasses.emplace_back(newPass); } // get the number of layer passes size_t MotionLayerSystem::GetNumLayerPasses() const { - return mLayerPasses.size(); + return m_layerPasses.size(); } @@ -393,19 +393,19 @@ namespace EMotionFX { if (delFromMem) { - mLayerPasses[nr]->Destroy(); + m_layerPasses[nr]->Destroy(); } - mLayerPasses.erase(AZStd::next(begin(mLayerPasses), nr)); + m_layerPasses.erase(AZStd::next(begin(m_layerPasses), nr)); } // remove a given pass void MotionLayerSystem::RemoveLayerPass(LayerPass* pass, bool delFromMem) { - if (const auto it = AZStd::find(begin(mLayerPasses), end(mLayerPasses), pass); it != end(mLayerPasses)) + if (const auto it = AZStd::find(begin(m_layerPasses), end(m_layerPasses), pass); it != end(m_layerPasses)) { - mLayerPasses.erase(it); + m_layerPasses.erase(it); } if (delFromMem) @@ -418,7 +418,7 @@ namespace EMotionFX // insert a layer pass at a given position void MotionLayerSystem::InsertLayerPass(size_t insertPos, LayerPass* pass) { - mLayerPasses.emplace(AZStd::next(begin(mLayerPasses), insertPos), pass); + m_layerPasses.emplace(AZStd::next(begin(m_layerPasses), insertPos), pass); } @@ -439,17 +439,17 @@ namespace EMotionFX // remove the repositioning pass void MotionLayerSystem::RemoveRepositioningLayerPass() { - if (mRepositioningPass) + if (m_repositioningPass) { - mRepositioningPass->Destroy(); + m_repositioningPass->Destroy(); } - mRepositioningPass = nullptr; + m_repositioningPass = nullptr; } LayerPass* MotionLayerSystem::GetLayerPass(size_t index) const { - return mLayerPasses[index]; + return m_layerPasses[index]; } } // namespace EMotionFX diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/MotionLayerSystem.h b/Gems/EMotionFX/Code/EMotionFX/Source/MotionLayerSystem.h index be14780341..81119977dd 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/MotionLayerSystem.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/MotionLayerSystem.h @@ -179,8 +179,8 @@ namespace EMotionFX private: - AZStd::vector mLayerPasses; /**< The layer passes. */ - RepositioningLayerPass* mRepositioningPass; /**< The motion based actor repositioning layer pass. */ + AZStd::vector m_layerPasses; /**< The layer passes. */ + RepositioningLayerPass* m_repositioningPass; /**< The motion based actor repositioning layer pass. */ /** * Constructor. diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/MotionManager.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/MotionManager.cpp index 8472e46796..5ed15fe896 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/MotionManager.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/MotionManager.cpp @@ -43,7 +43,7 @@ namespace EMotionFX : BaseObject() { // reserve space for 400 motions - mMotions.reserve(400); + m_motions.reserve(400); m_motionDataFactory = aznew MotionDataFactory(); } @@ -66,28 +66,28 @@ namespace EMotionFX if (delFromMemory) { // destroy all motion sets, they will internally call RemoveMotionSetWithoutLock(this) in their destructor - while (mMotionSets.size() > 0) + while (m_motionSets.size() > 0) { - delete mMotionSets[0]; + delete m_motionSets[0]; } // destroy all motions, they will internally call RemoveMotionWithoutLock(this) in their destructor - while (mMotions.size() > 0) + while (m_motions.size() > 0) { - mMotions[0]->Destroy(); + m_motions[0]->Destroy(); } } else { // wait with execution until we can set the lock - mSetLock.Lock(); - mMotionSets.clear(); - mSetLock.Unlock(); + m_setLock.Lock(); + m_motionSets.clear(); + m_setLock.Unlock(); // clear the arrays without destroying the memory of the entries - mLock.Lock(); - mMotions.clear(); - mLock.Unlock(); + m_lock.Lock(); + m_motions.clear(); + m_lock.Unlock(); } } @@ -95,81 +95,81 @@ namespace EMotionFX // find the motion and return a pointer, nullptr if the motion is not in Motion* MotionManager::FindMotionByName(const char* motionName, bool isTool) const { - const auto foundMotion = AZStd::find_if(begin(mMotions), end(mMotions), [motionName, isTool](const auto& motion) + const auto foundMotion = AZStd::find_if(begin(m_motions), end(m_motions), [motionName, isTool](const auto& motion) { return motion->GetIsOwnedByRuntime() != isTool && motion->GetNameString() == motionName; }); - return foundMotion != end(mMotions) ? *foundMotion : nullptr; + return foundMotion != end(m_motions) ? *foundMotion : nullptr; } // find the motion and return a pointer, nullptr if the motion is not in Motion* MotionManager::FindMotionByFileName(const char* fileName, bool isTool) const { - const auto foundMotion = AZStd::find_if(begin(mMotions), end(mMotions), [fileName, isTool](const auto& motion) + const auto foundMotion = AZStd::find_if(begin(m_motions), end(m_motions), [fileName, isTool](const auto& motion) { return motion->GetIsOwnedByRuntime() != isTool && AzFramework::StringFunc::Equal(motion->GetFileNameString().c_str(), fileName, false /* no case */); }); - return foundMotion != end(mMotions) ? *foundMotion : nullptr; + return foundMotion != end(m_motions) ? *foundMotion : nullptr; } // find the motion set by filename and return a pointer, nullptr if the motion set is not in yet MotionSet* MotionManager::FindMotionSetByFileName(const char* fileName, bool isTool) const { - const auto foundMotionSet = AZStd::find_if(begin(mMotionSets), end(mMotionSets), [fileName, isTool](const auto& motionSet) + const auto foundMotionSet = AZStd::find_if(begin(m_motionSets), end(m_motionSets), [fileName, isTool](const auto& motionSet) { return motionSet->GetIsOwnedByRuntime() != isTool && AzFramework::StringFunc::Equal(motionSet->GetFilename(), fileName); }); - return foundMotionSet != end(mMotionSets) ? *foundMotionSet : nullptr; + return foundMotionSet != end(m_motionSets) ? *foundMotionSet : nullptr; } // find the motion set and return a pointer, nullptr if the motion set has not been found MotionSet* MotionManager::FindMotionSetByName(const char* name, bool isOwnedByRuntime) const { - const auto foundMotionSet = AZStd::find_if(begin(mMotionSets), end(mMotionSets), [name, isOwnedByRuntime](const auto& motionSet) + const auto foundMotionSet = AZStd::find_if(begin(m_motionSets), end(m_motionSets), [name, isOwnedByRuntime](const auto& motionSet) { return motionSet->GetIsOwnedByRuntime() == isOwnedByRuntime && AzFramework::StringFunc::Equal(motionSet->GetName(), name); }); - return foundMotionSet != end(mMotionSets) ? *foundMotionSet : nullptr; + return foundMotionSet != end(m_motionSets) ? *foundMotionSet : nullptr; } // find the motion index for the given motion size_t MotionManager::FindMotionIndexByName(const char* motionName, bool isTool) const { - const auto foundMotion = AZStd::find_if(begin(mMotions), end(mMotions), [motionName, isTool](const auto& motion) + const auto foundMotion = AZStd::find_if(begin(m_motions), end(m_motions), [motionName, isTool](const auto& motion) { return motion->GetIsOwnedByRuntime() != isTool && motion->GetNameString() == motionName; }); - return foundMotion != end(mMotions) ? AZStd::distance(begin(mMotions), foundMotion) : InvalidIndex; + return foundMotion != end(m_motions) ? AZStd::distance(begin(m_motions), foundMotion) : InvalidIndex; } // find the motion set index for the given motion size_t MotionManager::FindMotionSetIndexByName(const char* name, bool isTool) const { - const auto foundMotionSet = AZStd::find_if(begin(mMotionSets), end(mMotionSets), [name, isTool](const MotionSet* motionSet) + const auto foundMotionSet = AZStd::find_if(begin(m_motionSets), end(m_motionSets), [name, isTool](const MotionSet* motionSet) { return motionSet->GetIsOwnedByRuntime() != isTool && AzFramework::StringFunc::Equal(motionSet->GetName(), name); }); - return foundMotionSet != end(mMotionSets) ? AZStd::distance(begin(mMotionSets), foundMotionSet) : InvalidIndex; + return foundMotionSet != end(m_motionSets) ? AZStd::distance(begin(m_motionSets), foundMotionSet) : InvalidIndex; } // find the motion index for the given motion size_t MotionManager::FindMotionIndexByID(uint32 id) const { - const auto foundMotion = AZStd::find_if(begin(mMotions), end(mMotions), [id](const Motion* motion) + const auto foundMotion = AZStd::find_if(begin(m_motions), end(m_motions), [id](const Motion* motion) { return motion->GetID() == id; }); - return foundMotion != end(mMotions) ? AZStd::distance(begin(mMotions), foundMotion) : InvalidIndex; + return foundMotion != end(m_motions) ? AZStd::distance(begin(m_motions), foundMotion) : InvalidIndex; // get the number of motions and iterate through them } @@ -177,55 +177,55 @@ namespace EMotionFX // find the motion set index size_t MotionManager::FindMotionSetIndexByID(uint32 id) const { - const auto foundMotionSet = AZStd::find_if(begin(mMotionSets), end(mMotionSets), [id](const MotionSet* motionSet) + const auto foundMotionSet = AZStd::find_if(begin(m_motionSets), end(m_motionSets), [id](const MotionSet* motionSet) { return motionSet->GetID() == id; }); - return foundMotionSet != end(mMotionSets) ? AZStd::distance(begin(mMotionSets), foundMotionSet) : InvalidIndex; + return foundMotionSet != end(m_motionSets) ? AZStd::distance(begin(m_motionSets), foundMotionSet) : InvalidIndex; } // find the motion and return a pointer, nullptr if the motion is not in Motion* MotionManager::FindMotionByID(uint32 id) const { - const auto foundMotion = AZStd::find_if(begin(mMotions), end(mMotions), [id](const Motion* motion) + const auto foundMotion = AZStd::find_if(begin(m_motions), end(m_motions), [id](const Motion* motion) { return motion->GetID() == id; }); - return foundMotion != end(mMotions) ? *foundMotion : nullptr; + return foundMotion != end(m_motions) ? *foundMotion : nullptr; } // find the motion set with the given and return it, nullptr if the motion set won't be found MotionSet* MotionManager::FindMotionSetByID(uint32 id) const { - const auto foundMotionSet = AZStd::find_if(begin(mMotionSets), end(mMotionSets), [id](const MotionSet* motionSet) + const auto foundMotionSet = AZStd::find_if(begin(m_motionSets), end(m_motionSets), [id](const MotionSet* motionSet) { return motionSet->GetID() == id; }); - return foundMotionSet != end(mMotionSets) ? *foundMotionSet : nullptr; + return foundMotionSet != end(m_motionSets) ? *foundMotionSet : nullptr; } // find the motion set index and return it size_t MotionManager::FindMotionSetIndex(MotionSet* motionSet) const { - const auto foundMotionSet = AZStd::find_if(begin(mMotionSets), end(mMotionSets), [motionSet](const MotionSet* ms) + const auto foundMotionSet = AZStd::find_if(begin(m_motionSets), end(m_motionSets), [motionSet](const MotionSet* ms) { return ms == motionSet; }); - return foundMotionSet != end(mMotionSets) ? AZStd::distance(begin(mMotionSets), foundMotionSet) : InvalidIndex; + return foundMotionSet != end(m_motionSets) ? AZStd::distance(begin(m_motionSets), foundMotionSet) : InvalidIndex; } // find the motion index for the given motion size_t MotionManager::FindMotionIndex(Motion* motion) const { - const auto foundMotion = AZStd::find_if(begin(mMotions), end(mMotions), [motion](const Motion* m) + const auto foundMotion = AZStd::find_if(begin(m_motions), end(m_motions), [motion](const Motion* m) { return m == motion; }); - return foundMotion != end(mMotions) ? AZStd::distance(begin(mMotions), foundMotion) : InvalidIndex; + return foundMotion != end(m_motions) ? AZStd::distance(begin(m_motions), foundMotion) : InvalidIndex; } @@ -233,16 +233,16 @@ namespace EMotionFX void MotionManager::AddMotion(Motion* motion) { // wait with execution until we can set the lock - mLock.Lock(); - mMotions.emplace_back(motion); - mLock.Unlock(); + m_lock.Lock(); + m_motions.emplace_back(motion); + m_lock.Unlock(); } // find the motion based on the name and remove it bool MotionManager::RemoveMotionByName(const char* motionName, bool delFromMemory, bool isTool) { - MCore::LockGuard lock(mLock); + MCore::LockGuard lock(m_lock); return RemoveMotionWithoutLock(FindMotionIndexByName(motionName, isTool), delFromMemory); } @@ -250,7 +250,7 @@ namespace EMotionFX // find the motion set based on the name and remove it bool MotionManager::RemoveMotionSetByName(const char* motionName, bool delFromMemory, bool isTool) { - MCore::LockGuard lock(mSetLock); + MCore::LockGuard lock(m_setLock); return RemoveMotionSetWithoutLock(FindMotionSetIndexByName(motionName, isTool), delFromMemory); } @@ -258,7 +258,7 @@ namespace EMotionFX // find the motion based on the id and remove it bool MotionManager::RemoveMotionByID(uint32 id, bool delFromMemory) { - MCore::LockGuard lock(mLock); + MCore::LockGuard lock(m_lock); return RemoveMotionWithoutLock(FindMotionIndexByID(id), delFromMemory); } @@ -266,7 +266,7 @@ namespace EMotionFX // find the motion set based on the id and remove it bool MotionManager::RemoveMotionSetByID(uint32 id, bool delFromMemory) { - MCore::LockGuard lock(mSetLock); + MCore::LockGuard lock(m_setLock); return RemoveMotionSetWithoutLock(FindMotionSetIndexByID(id), delFromMemory); } @@ -274,18 +274,18 @@ namespace EMotionFX // find the index by filename size_t MotionManager::FindMotionIndexByFileName(const char* fileName, bool isTool) const { - const auto foundMotion = AZStd::find_if(begin(mMotions), end(mMotions), [fileName, isTool](const Motion* motion) + const auto foundMotion = AZStd::find_if(begin(m_motions), end(m_motions), [fileName, isTool](const Motion* motion) { return motion->GetIsOwnedByRuntime() != isTool && motion->GetFileNameString() == fileName; }); - return foundMotion != end(mMotions) ? AZStd::distance(begin(mMotions), foundMotion) : InvalidIndex; + return foundMotion != end(m_motions) ? AZStd::distance(begin(m_motions), foundMotion) : InvalidIndex; } // remove the motion by a given filename bool MotionManager::RemoveMotionByFileName(const char* fileName, bool delFromMemory, bool isTool) { - MCore::LockGuard lock(mLock); + MCore::LockGuard lock(m_lock); return RemoveMotionWithoutLock(FindMotionIndexByFileName(fileName, isTool), delFromMemory); } @@ -314,7 +314,7 @@ namespace EMotionFX if (azrtti_istypeof(node)) { AnimGraphMotionNode::UniqueData* motionNodeData = static_cast(uniqueData); - const MotionInstance* motionInstance = motionNodeData->mMotionInstance; + const MotionInstance* motionInstance = motionNodeData->m_motionInstance; if (motionInstance && motionInstance->GetMotion() == motion) { motionNodeData->Reset(); @@ -340,7 +340,7 @@ namespace EMotionFX return false; } - Motion* motion = mMotions[index]; + Motion* motion = m_motions[index]; // stop all motion instances of the motion to delete const size_t numActorInstances = GetActorManager().GetNumActorInstances(); @@ -370,7 +370,7 @@ namespace EMotionFX } // Reset all motion entries in the motion sets of the current motion. - for (const MotionSet* motionSet : mMotionSets) + for (const MotionSet* motionSet : m_motionSets) { const EMotionFX::MotionSet::MotionEntries& motionEntries = motionSet->GetMotionEntries(); for (const auto& item : motionEntries) @@ -398,11 +398,11 @@ namespace EMotionFX // which unregisters the motion from the motion manager motion->SetAutoUnregister(false); motion->Destroy(); - mMotions.erase(AZStd::next(begin(mMotions), index)); // only remove the motion from the motion manager without destroying its memory + m_motions.erase(AZStd::next(begin(m_motions), index)); // only remove the motion from the motion manager without destroying its memory } else { - mMotions.erase(AZStd::next(begin(mMotions), index)); // only remove the motion from the motion manager without destroying its memory + m_motions.erase(AZStd::next(begin(m_motions), index)); // only remove the motion from the motion manager without destroying its memory } return true; @@ -412,8 +412,8 @@ namespace EMotionFX // add a new motion set void MotionManager::AddMotionSet(MotionSet* motionSet) { - MCore::LockGuard lock(mLock); - mMotionSets.emplace_back(motionSet); + MCore::LockGuard lock(m_lock); + m_motionSets.emplace_back(motionSet); } @@ -425,7 +425,7 @@ namespace EMotionFX return false; } - MotionSet* motionSet = mMotionSets[index]; + MotionSet* motionSet = m_motionSets[index]; // remove from the parent MotionSet* parentSet = motionSet->GetParentSet(); @@ -451,7 +451,7 @@ namespace EMotionFX delete motionSet; } - mMotionSets.erase(AZStd::next(begin(mMotionSets), index)); + m_motionSets.erase(AZStd::next(begin(m_motionSets), index)); return true; } @@ -460,7 +460,7 @@ namespace EMotionFX // remove the motion from the motion manager bool MotionManager::RemoveMotion(Motion* motion, bool delFromMemory) { - MCore::LockGuard lock(mLock); + MCore::LockGuard lock(m_lock); return RemoveMotionWithoutLock(FindMotionIndex(motion), delFromMemory); } @@ -468,7 +468,7 @@ namespace EMotionFX // remove the motion set from the motion manager bool MotionManager::RemoveMotionSet(MotionSet* motionSet, bool delFromMemory) { - MCore::LockGuard lock(mSetLock); + MCore::LockGuard lock(m_setLock); return RemoveMotionSetWithoutLock(FindMotionSetIndex(motionSet), delFromMemory); } @@ -479,7 +479,7 @@ namespace EMotionFX size_t result = 0; // get the number of motion sets and iterate through them - for (const MotionSet* motionSet : mMotionSets) + for (const MotionSet* motionSet : m_motionSets) { // sum up the root motion sets if (motionSet->GetParentSet() == nullptr) @@ -495,25 +495,25 @@ namespace EMotionFX // find the given root motion set MotionSet* MotionManager::FindRootMotionSet(size_t index) { - auto foundRootMotionSet = AZStd::find_if(begin(mMotionSets), end(mMotionSets), [iter = index](const MotionSet* motionSet) mutable + auto foundRootMotionSet = AZStd::find_if(begin(m_motionSets), end(m_motionSets), [iter = index](const MotionSet* motionSet) mutable { return motionSet->GetParentSet() == nullptr && iter-- == 0; }); - return foundRootMotionSet != end(mMotionSets) ? *foundRootMotionSet : nullptr; + return foundRootMotionSet != end(m_motionSets) ? *foundRootMotionSet : nullptr; } // wait with execution until we can set the lock void MotionManager::Lock() { - mLock.Lock(); + m_lock.Lock(); } // release the lock again void MotionManager::Unlock() { - mLock.Unlock(); + m_lock.Unlock(); } MotionDataFactory& MotionManager::GetMotionDataFactory() diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/MotionManager.h b/Gems/EMotionFX/Code/EMotionFX/Source/MotionManager.h index 2aad2f72d9..24c8c784f3 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/MotionManager.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/MotionManager.h @@ -44,13 +44,13 @@ namespace EMotionFX * @param[in] index The index of the motion. The index must be in range [0, GetNumMotions()-1]. * @return A pointer to the given motion set. */ - MCORE_INLINE Motion* GetMotion(size_t index) const { return mMotions[index]; } + MCORE_INLINE Motion* GetMotion(size_t index) const { return m_motions[index]; } /** * Get the number of motions in the motion manager. * @return The number of registered motions. */ - MCORE_INLINE size_t GetNumMotions() const { return mMotions.size(); } + MCORE_INLINE size_t GetNumMotions() const { return m_motions.size(); } /** * Remove the motion with the given name from the motion manager. @@ -154,13 +154,13 @@ namespace EMotionFX * @param[in] index The index of the motion set. The index must be in range [0, GetNumMotionSets()-1]. * @return A pointer to the given motion set. */ - MCORE_INLINE MotionSet* GetMotionSet(size_t index) const { return mMotionSets[index]; } + MCORE_INLINE MotionSet* GetMotionSet(size_t index) const { return m_motionSets[index]; } /** * Get the number of motion sets in the motion manager. * @return The number of registered motion sets. */ - MCORE_INLINE size_t GetNumMotionSets() const { return mMotionSets.size(); } + MCORE_INLINE size_t GetNumMotionSets() const { return m_motionSets.size(); } /** * Calculate the number of root motion sets. @@ -233,10 +233,10 @@ namespace EMotionFX const MotionDataFactory& GetMotionDataFactory() const; private: - AZStd::vector mMotions; /**< The array of motions. */ - AZStd::vector mMotionSets; /**< The array of motion sets. */ - MCore::Mutex mLock; /**< Motion lock. */ - MCore::Mutex mSetLock; /**< The motion set multithread lock. */ + AZStd::vector m_motions; /**< The array of motions. */ + AZStd::vector m_motionSets; /**< The array of motion sets. */ + MCore::Mutex m_lock; /**< Motion lock. */ + MCore::Mutex m_setLock; /**< The motion set multithread lock. */ MotionDataFactory* m_motionDataFactory = nullptr; /**< The motion data factory. */ //void RecursiveResetMotionNodes(AnimGraphNode* animGraphNode, Motion* motion); diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/MotionQueue.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/MotionQueue.cpp index 10b52b1f8b..e523572689 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/MotionQueue.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/MotionQueue.cpp @@ -26,8 +26,8 @@ namespace EMotionFX { MCORE_ASSERT(actorInstance && motionSystem); - mActorInstance = actorInstance; - mMotionSystem = motionSystem; + m_actorInstance = actorInstance; + m_motionSystem = motionSystem; } @@ -48,12 +48,12 @@ namespace EMotionFX // remove a given entry from the queue void MotionQueue::RemoveEntry(size_t nr) { - if (mMotionSystem->RemoveMotionInstance(mEntries[nr].mMotion) == false) + if (m_motionSystem->RemoveMotionInstance(m_entries[nr].m_motion) == false) { - GetMotionInstancePool().Free(mEntries[nr].mMotion); + GetMotionInstancePool().Free(m_entries[nr].m_motion); } - mEntries.erase(AZStd::next(begin(mEntries), nr)); + m_entries.erase(AZStd::next(begin(m_entries), nr)); } @@ -70,7 +70,7 @@ namespace EMotionFX } // if there is only one entry in the queue, we can start playing it immediately - if (mMotionSystem->GetIsPlaying() == false) + if (m_motionSystem->GetIsPlaying() == false) { // get the entry from the queue to play next MotionQueue::QueueEntry queueEntry = GetFirstEntry(); @@ -79,7 +79,7 @@ namespace EMotionFX RemoveFirstEntry(); // start the motion on the queue - mMotionSystem->StartMotion(queueEntry.mMotion, &queueEntry.mPlayInfo); + m_motionSystem->StartMotion(queueEntry.m_motion, &queueEntry.m_playInfo); // get out of this method, nothing more to do :) return; @@ -109,7 +109,7 @@ namespace EMotionFX RemoveFirstEntry(); // start the motion - mMotionSystem->StartMotion(queueEntry.mMotion, &queueEntry.mPlayInfo); + m_motionSystem->StartMotion(queueEntry.m_motion, &queueEntry.m_playInfo); } @@ -117,7 +117,7 @@ namespace EMotionFX bool MotionQueue::ShouldPlayNextMotion() { // find the first non mixing motion - MotionInstance* motionInst = mMotionSystem->FindFirstNonMixingMotionInstance(); + MotionInstance* motionInst = m_motionSystem->FindFirstNonMixingMotionInstance(); // if there isn't a non mixing motion if (motionInst == nullptr) @@ -126,7 +126,7 @@ namespace EMotionFX } // the total amount of blending time - const float timeToRemoveFromMaxTime = GetFirstEntry().mPlayInfo.mBlendInTime + motionInst->GetFadeTime(); + const float timeToRemoveFromMaxTime = GetFirstEntry().m_playInfo.m_blendInTime + motionInst->GetFadeTime(); // if the motion has ended or is stopping, then we should start the next motion if (motionInst->GetIsStopping() || motionInst->GetHasEnded()) @@ -167,7 +167,7 @@ namespace EMotionFX void MotionQueue::ClearAllEntries() { - while (mEntries.size()) + while (m_entries.size()) { RemoveEntry(0); } @@ -176,31 +176,31 @@ namespace EMotionFX void MotionQueue::AddEntry(const MotionQueue::QueueEntry& motion) { - mEntries.emplace_back(motion); + m_entries.emplace_back(motion); } size_t MotionQueue::GetNumEntries() const { - return mEntries.size(); + return m_entries.size(); } MotionQueue::QueueEntry& MotionQueue::GetFirstEntry() { - MCORE_ASSERT(mEntries.size() > 0); - return mEntries[0]; + MCORE_ASSERT(m_entries.size() > 0); + return m_entries[0]; } void MotionQueue::RemoveFirstEntry() { - mEntries.erase(mEntries.begin()); + m_entries.erase(m_entries.begin()); } MotionQueue::QueueEntry& MotionQueue::GetEntry(size_t nr) { - return mEntries[nr]; + return m_entries[nr]; } } // namespace EMotionFX diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/MotionQueue.h b/Gems/EMotionFX/Code/EMotionFX/Source/MotionQueue.h index aa30ccab46..8584d43be2 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/MotionQueue.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/MotionQueue.h @@ -43,17 +43,17 @@ namespace EMotionFX class QueueEntry { public: - MotionInstance* mMotion; /**< The motion instance we want to play. */ - PlayBackInfo mPlayInfo; /**< The motion playback settings. */ + MotionInstance* m_motion; /**< The motion instance we want to play. */ + PlayBackInfo m_playInfo; /**< The motion playback settings. */ /// The default constructor QueueEntry() - : mMotion(nullptr) {} + : m_motion(nullptr) {} /// The extended constructor. QueueEntry(MotionInstance* motion, class PlayBackInfo* info) - : mMotion(motion) - , mPlayInfo(*info) {} + : m_motion(motion) + , m_playInfo(*info) {} }; /** @@ -133,9 +133,9 @@ namespace EMotionFX void PlayNextMotion(); private: - AZStd::vector mEntries; /**< The motion queue entries. */ - MotionSystem* mMotionSystem; /**< Motion system access pointer. */ - ActorInstance* mActorInstance; /**< The actor instance where this queue works on. */ + AZStd::vector m_entries; /**< The motion queue entries. */ + MotionSystem* m_motionSystem; /**< Motion system access pointer. */ + ActorInstance* m_actorInstance; /**< The actor instance where this queue works on. */ /** * Constructor. diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/MotionSystem.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/MotionSystem.cpp index 7619187d23..a6ddb776c2 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/MotionSystem.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/MotionSystem.cpp @@ -29,11 +29,11 @@ namespace EMotionFX { MCORE_ASSERT(actorInstance); - mActorInstance = actorInstance; - mMotionQueue = nullptr; + m_actorInstance = actorInstance; + m_motionQueue = nullptr; // create the motion queue - mMotionQueue = MotionQueue::Create(actorInstance, this); + m_motionQueue = MotionQueue::Create(actorInstance, this); GetEventManager().OnCreateMotionSystem(this); } @@ -45,17 +45,16 @@ namespace EMotionFX GetEventManager().OnDeleteMotionSystem(this); // delete the motion infos - while (!mMotionInstances.empty()) + while (!m_motionInstances.empty()) { - //delete mMotionInstances.GetLast(); - GetMotionInstancePool().Free(mMotionInstances.back()); - mMotionInstances.pop_back(); + GetMotionInstancePool().Free(m_motionInstances.back()); + m_motionInstances.pop_back(); } // get rid of the motion queue - if (mMotionQueue) + if (m_motionQueue) { - mMotionQueue->Destroy(); + m_motionQueue->Destroy(); } } @@ -75,33 +74,21 @@ namespace EMotionFX info = &tempInfo; } - /* - // if we want to play a motion which will loop forever (so never ends) and we want to put it on the queue - if (info->mNumLoops==FOREVER && info->mPlayNow==false) - { - // if there is already a motion on the queue, this means the queue would end up in some kind of deadlock - // because it has to wait until the current motion is finished with playing, before it would start this motion - // and since that will never happen, the queue won't be processed anymore... - // so we may simply not allow this to happen. - if (mMotionQueue->GetNumEntries() > 0) - throw Exception("Cannot schedule this LOOPING motion to be played later, because there are already motions queued. If we would put this motion on the queue, all motions added later on to the queue will never be processed because this motion is a looping (so never ending) one.", MCORE_HERE); - }*/ - // trigger the OnPlayMotion event GetEventManager().OnPlayMotion(motion, info); // make sure we always mix when using additive blending - if (info->mBlendMode == BLENDMODE_ADDITIVE && info->mMix == false) + if (info->m_blendMode == BLENDMODE_ADDITIVE && info->m_mix == false) { MCORE_ASSERT(false); // this shouldn't happen actually, please make sure you always mix additive motions - info->mMix = true; + info->m_mix = true; } // create the motion instance and add the motion info the this actor MotionInstance* motionInst = CreateMotionInstance(motion, info); // if we want to play it immediately (so if we do NOT want to schedule it for later on) - if (info->mPlayNow) + if (info->m_playNow) { // start the motion for real StartMotion(motionInst, info); @@ -109,7 +96,7 @@ namespace EMotionFX else { // schedule the motion, by adding it to the back of the motion queue - mMotionQueue->AddEntry(MotionQueue::QueueEntry(motionInst, info)); + m_motionQueue->AddEntry(MotionQueue::QueueEntry(motionInst, info)); motionInst->Pause(); motionInst->SetIsActive(false); GetEventManager().OnQueueMotionInstance(motionInst, info); @@ -124,7 +111,7 @@ namespace EMotionFX MotionInstance* MotionSystem::CreateMotionInstance(Motion* motion, PlayBackInfo* info) { // create the motion instance - MotionInstance* motionInst = GetMotionInstancePool().RequestNew(motion, mActorInstance); + MotionInstance* motionInst = GetMotionInstancePool().RequestNew(motion, m_actorInstance); // initialize the motion instance from the playback info settings motionInst->InitFromPlayBackInfo(*info); @@ -138,9 +125,9 @@ namespace EMotionFX { // remove the motion instance from the actor const bool isSuccess = [this, instance] { - if(const auto it = AZStd::find(begin(mMotionInstances), end(mMotionInstances), instance); it != end(mMotionInstances)) + if(const auto it = AZStd::find(begin(m_motionInstances), end(m_motionInstances), instance); it != end(m_motionInstances)) { - mMotionInstances.erase(it); + m_motionInstances.erase(it); return true; } return false; @@ -163,7 +150,7 @@ namespace EMotionFX MCORE_UNUSED(updateNodes); // update the motion queue - mMotionQueue->Update(); + m_motionQueue->Update(); // update the motions UpdateMotionInstances(timePassed); @@ -173,7 +160,7 @@ namespace EMotionFX // stop all the motions that are currently playing void MotionSystem::StopAllMotions() { - for (MotionInstance* motionInstance : mMotionInstances) + for (MotionInstance* motionInstance : m_motionInstances) { motionInstance->Stop(); } @@ -183,7 +170,7 @@ namespace EMotionFX // stop all motion instances of a given motion void MotionSystem::StopAllMotions(Motion* motion) { - for (MotionInstance* motionInstance : mMotionInstances) + for (MotionInstance* motionInstance : m_motionInstances) { if (motionInstance->GetMotion()->GetID() == motion->GetID()) { @@ -196,14 +183,14 @@ namespace EMotionFX // remove the given motion void MotionSystem::RemoveMotion(size_t nr, bool deleteMem) { - MCORE_ASSERT(nr < mMotionInstances.size()); + MCORE_ASSERT(nr < m_motionInstances.size()); if (deleteMem) { - GetEMotionFX().GetMotionInstancePool()->Free(mMotionInstances[nr]); + GetEMotionFX().GetMotionInstancePool()->Free(m_motionInstances[nr]); } - mMotionInstances.erase(AZStd::next(begin(mMotionInstances), nr)); + m_motionInstances.erase(AZStd::next(begin(m_motionInstances), nr)); } @@ -212,15 +199,15 @@ namespace EMotionFX { MCORE_ASSERT(motion); - const auto it = AZStd::find(begin(mMotionInstances), end(mMotionInstances), motion); - MCORE_ASSERT(it != end(mMotionInstances)); + const auto it = AZStd::find(begin(m_motionInstances), end(m_motionInstances), motion); + MCORE_ASSERT(it != end(m_motionInstances)); - if (it == end(mMotionInstances)) + if (it == end(m_motionInstances)) { return; } - RemoveMotion(AZStd::distance(begin(mMotionInstances), it), delMem); + RemoveMotion(AZStd::distance(begin(m_motionInstances), it), delMem); } @@ -228,7 +215,7 @@ namespace EMotionFX void MotionSystem::UpdateMotionInstances(float timePassed) { // update all the motion infos - for (MotionInstance* motionInstance : mMotionInstances) + for (MotionInstance* motionInstance : m_motionInstances) { motionInstance->Update(timePassed); } @@ -238,7 +225,7 @@ namespace EMotionFX // check if the given motion instance still exists within the actor, so if it hasn't been deleted from memory yet bool MotionSystem::CheckIfIsValidMotionInstance(MotionInstance* instance) const { - return instance && AZStd::any_of(begin(mMotionInstances), end(mMotionInstances), [instance](const MotionInstance* motionInstance) + return instance && AZStd::any_of(begin(m_motionInstances), end(m_motionInstances), [instance](const MotionInstance* motionInstance) { return motionInstance->GetID() == instance->GetID(); }); @@ -248,7 +235,7 @@ namespace EMotionFX // check if there is a motion instance playing, which is an instance of a specified motion bool MotionSystem::CheckIfIsPlayingMotion(Motion* motion, bool ignorePausedMotions) const { - return motion && AZStd::any_of(begin(mMotionInstances), end(mMotionInstances), [motion, ignorePausedMotions](const MotionInstance* motionInstance) + return motion && AZStd::any_of(begin(m_motionInstances), end(m_motionInstances), [motion, ignorePausedMotions](const MotionInstance* motionInstance) { return !(ignorePausedMotions && motionInstance->GetIsPaused()) && motionInstance->GetMotion()->GetID() == motion->GetID(); @@ -259,27 +246,27 @@ namespace EMotionFX // return given motion instance MotionInstance* MotionSystem::GetMotionInstance(size_t nr) const { - MCORE_ASSERT(nr < mMotionInstances.size()); - return mMotionInstances[nr]; + MCORE_ASSERT(nr < m_motionInstances.size()); + return m_motionInstances[nr]; } // return number of motion instances size_t MotionSystem::GetNumMotionInstances() const { - return mMotionInstances.size(); + return m_motionInstances.size(); } // set a new motion queue void MotionSystem::SetMotionQueue(MotionQueue* motionQueue) { - if (mMotionQueue) + if (m_motionQueue) { - mMotionQueue->Destroy(); + m_motionQueue->Destroy(); } - mMotionQueue = motionQueue; + m_motionQueue = motionQueue; } @@ -291,7 +278,7 @@ namespace EMotionFX // copy entries from the given queue to the motion system's one for (size_t i = 0; i < motionQueue->GetNumEntries(); ++i) { - mMotionQueue->AddEntry(motionQueue->GetEntry(i)); + m_motionQueue->AddEntry(motionQueue->GetEntry(i)); } // get rid of the given motion queue @@ -302,25 +289,25 @@ namespace EMotionFX // return motion queue pointer MotionQueue* MotionSystem::GetMotionQueue() const { - return mMotionQueue; + return m_motionQueue; } // return the actor to which this motion system belongs to ActorInstance* MotionSystem::GetActorInstance() const { - return mActorInstance; + return m_actorInstance; } void MotionSystem::AddMotionInstance(MotionInstance* instance) { - mMotionInstances.emplace_back(instance); + m_motionInstances.emplace_back(instance); } bool MotionSystem::GetIsPlaying() const { - return !mMotionInstances.empty(); + return !m_motionInstances.empty(); } } // namespace EMotionFX diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/MotionSystem.h b/Gems/EMotionFX/Code/EMotionFX/Source/MotionSystem.h index 109cf5d41f..611ccd731a 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/MotionSystem.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/MotionSystem.h @@ -215,9 +215,9 @@ namespace EMotionFX protected: - AZStd::vector mMotionInstances; /**< The collection of motion instances. */ - ActorInstance* mActorInstance; /**< The actor instance where this motion system belongs to. */ - MotionQueue* mMotionQueue; /**< The motion queue. */ + AZStd::vector m_motionInstances; /**< The collection of motion instances. */ + ActorInstance* m_actorInstance; /**< The actor instance where this motion system belongs to. */ + MotionQueue* m_motionQueue; /**< The motion queue. */ /** * Constructor. diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/MultiThreadScheduler.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/MultiThreadScheduler.cpp index 3cc4d027a8..6f07936fe7 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/MultiThreadScheduler.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/MultiThreadScheduler.cpp @@ -30,8 +30,8 @@ namespace EMotionFX MultiThreadScheduler::MultiThreadScheduler() : ActorUpdateScheduler() { - mCleanTimer = 0.0f; // time passed since last schedule cleanup, in seconds - mSteps.reserve(1000); + m_cleanTimer = 0.0f; // time passed since last schedule cleanup, in seconds + m_steps.reserve(1000); } @@ -52,7 +52,7 @@ namespace EMotionFX void MultiThreadScheduler::Clear() { Lock(); - mSteps.clear(); + m_steps.clear(); Unlock(); } @@ -78,10 +78,10 @@ namespace EMotionFX void MultiThreadScheduler::Print() { // for all steps - const size_t numSteps = mSteps.size(); + const size_t numSteps = m_steps.size(); for (size_t i = 0; i < numSteps; ++i) { - AZ_Printf("EMotionFX", "STEP %.3zu - %zu", i, mSteps[i].mActorInstances.size()); + AZ_Printf("EMotionFX", "STEP %.3zu - %zu", i, m_steps[i].m_actorInstances.size()); } AZ_Printf("EMotionFX", "---------"); @@ -91,15 +91,15 @@ namespace EMotionFX void MultiThreadScheduler::RemoveEmptySteps() { // process all steps - for (size_t s = 0; s < mSteps.size(); ) + for (size_t s = 0; s < m_steps.size(); ) { - if (!mSteps[s].mActorInstances.empty()) + if (!m_steps[s].m_actorInstances.empty()) { s++; } else { - mSteps.erase(AZStd::next(begin(mSteps), s)); + m_steps.erase(AZStd::next(begin(m_steps), s)); } } } @@ -108,21 +108,21 @@ namespace EMotionFX // execute the schedule void MultiThreadScheduler::Execute(float timePassedInSeconds) { - MCore::LockGuardRecursive guard(mMutex); + MCore::LockGuardRecursive guard(m_mutex); - size_t numSteps = mSteps.size(); + size_t numSteps = m_steps.size(); if (numSteps == 0) { return; } // check if we need to cleanup the schedule - mCleanTimer += timePassedInSeconds; - if (mCleanTimer >= 1.0f) + m_cleanTimer += timePassedInSeconds; + if (m_cleanTimer >= 1.0f) { - mCleanTimer = 0.0f; + m_cleanTimer = 0.0f; RemoveEmptySteps(); - numSteps = mSteps.size(); + numSteps = m_steps.size(); } //----------------------------------------------------------- @@ -142,20 +142,20 @@ namespace EMotionFX } // reset stats - mNumUpdated.SetValue(0); - mNumVisible.SetValue(0); - mNumSampled.SetValue(0); + m_numUpdated.SetValue(0); + m_numVisible.SetValue(0); + m_numSampled.SetValue(0); - for (const ScheduleStep& currentStep : mSteps) + for (const ScheduleStep& currentStep : m_steps) { - if (currentStep.mActorInstances.empty()) + if (currentStep.m_actorInstances.empty()) { continue; } // process the actor instances in the current step in parallel AZ::JobCompletion jobCompletion; - for (ActorInstance* actorInstance : currentStep.mActorInstances) + for (ActorInstance* actorInstance : currentStep.m_actorInstances) { if (actorInstance->GetIsEnabled() == false) { @@ -173,7 +173,7 @@ namespace EMotionFX const bool isVisible = actorInstance->GetIsVisible(); if (isVisible) { - mNumVisible.Increment(); + m_numVisible.Increment(); } // check if we want to sample motions @@ -186,7 +186,7 @@ namespace EMotionFX if (isVisible) { - mNumSampled.Increment(); + m_numSampled.Increment(); } } @@ -197,7 +197,7 @@ namespace EMotionFX job->SetDependent(&jobCompletion); job->Start(); - mNumUpdated.Increment(); + m_numUpdated.Increment(); } jobCompletion.StartAndWaitForCompletion(); @@ -209,11 +209,11 @@ namespace EMotionFX bool MultiThreadScheduler::FindNextFreeItem(ActorInstance* actorInstance, size_t startStep, size_t* outStepNr) { // try out all steps - const size_t numSteps = mSteps.size(); + const size_t numSteps = m_steps.size(); for (size_t s = startStep; s < numSteps; ++s) { // if there is a conflicting dependency, skip this step - if (CheckIfHasMatchingDependency(actorInstance, &mSteps[s])) + if (CheckIfHasMatchingDependency(actorInstance, &m_steps[s])) { continue; } @@ -229,11 +229,11 @@ namespace EMotionFX bool MultiThreadScheduler::HasActorInstanceInSteps(const ActorInstance* actorInstance) const { - const size_t numSteps = mSteps.size(); + const size_t numSteps = m_steps.size(); for (size_t s = 0; s < numSteps; ++s) { - const ScheduleStep& step = mSteps[s]; - if (AZStd::find(step.mActorInstances.begin(), step.mActorInstances.end(), actorInstance) != step.mActorInstances.end()) + const ScheduleStep& step = m_steps[s]; + if (AZStd::find(step.m_actorInstances.begin(), step.m_actorInstances.end(), actorInstance) != step.m_actorInstances.end()) { return true; } @@ -244,33 +244,33 @@ namespace EMotionFX void MultiThreadScheduler::RecursiveInsertActorInstance(ActorInstance* instance, size_t startStep) { - MCore::LockGuardRecursive guard(mMutex); + MCore::LockGuardRecursive guard(m_mutex); AZ_Assert(!HasActorInstanceInSteps(instance), "Expected the actor instance not being part of another step already."); // find the first free location that doesn't conflict size_t outStep = startStep; if (!FindNextFreeItem(instance, startStep, &outStep)) { - mSteps.reserve(10); - mSteps.emplace_back(); - outStep = mSteps.size() - 1; + m_steps.reserve(10); + m_steps.emplace_back(); + outStep = m_steps.size() - 1; } // pre-allocate step size - if (mSteps[outStep].mActorInstances.size() % 10 == 0) + if (m_steps[outStep].m_actorInstances.size() % 10 == 0) { - mSteps[outStep].mActorInstances.reserve(mSteps[outStep].mActorInstances.size() + 10); + m_steps[outStep].m_actorInstances.reserve(m_steps[outStep].m_actorInstances.size() + 10); } - if (mSteps[outStep].mDependencies.size() % 5 == 0) + if (m_steps[outStep].m_dependencies.size() % 5 == 0) { - mSteps[outStep].mDependencies.reserve(mSteps[outStep].mDependencies.size() + 5); + m_steps[outStep].m_dependencies.reserve(m_steps[outStep].m_dependencies.size() + 5); } // add the actor instance and its dependencies - mSteps[ outStep ].mActorInstances.reserve(GetEMotionFX().GetNumThreads()); - mSteps[ outStep ].mActorInstances.emplace_back(instance); - AddDependenciesToStep(instance, &mSteps[outStep]); + m_steps[ outStep ].m_actorInstances.reserve(GetEMotionFX().GetNumThreads()); + m_steps[ outStep ].m_actorInstances.emplace_back(instance); + AddDependenciesToStep(instance, &m_steps[outStep]); // recursively add all attachments too const size_t numAttachments = instance->GetNumAttachments(); @@ -288,27 +288,27 @@ namespace EMotionFX // remove the actor instance from the schedule (excluding attachments) size_t MultiThreadScheduler::RemoveActorInstance(ActorInstance* actorInstance, size_t startStep) { - MCore::LockGuardRecursive guard(mMutex); + MCore::LockGuardRecursive guard(m_mutex); // for all scheduler steps, starting from the specified start step number - const size_t numSteps = mSteps.size(); + const size_t numSteps = m_steps.size(); for (size_t s = startStep; s < numSteps; ++s) { - ScheduleStep& step = mSteps[s]; + ScheduleStep& step = m_steps[s]; // Remove all occurrences of the actor instance. - const size_t numActorInstancesPreRemove = step.mActorInstances.size(); - step.mActorInstances.erase(AZStd::remove(step.mActorInstances.begin(), step.mActorInstances.end(), actorInstance), step.mActorInstances.end()); + const size_t numActorInstancesPreRemove = step.m_actorInstances.size(); + step.m_actorInstances.erase(AZStd::remove(step.m_actorInstances.begin(), step.m_actorInstances.end(), actorInstance), step.m_actorInstances.end()); // try to see if there is anything to remove in this step // and if so, reconstruct the dependencies of this step - if (step.mActorInstances.size() < numActorInstancesPreRemove) + if (step.m_actorInstances.size() < numActorInstancesPreRemove) { // clear the dependencies (but don't delete the memory) - step.mDependencies.clear(); + step.m_dependencies.clear(); // calculate the new dependencies for this step - for (ActorInstance* stepActorInstance : step.mActorInstances) + for (ActorInstance* stepActorInstance : step.m_actorInstances) { AddDependenciesToStep(stepActorInstance, &step); } @@ -326,7 +326,7 @@ namespace EMotionFX // remove the actor instance (including all of its attachments) void MultiThreadScheduler::RecursiveRemoveActorInstance(ActorInstance* actorInstance, size_t startStep) { - MCore::LockGuardRecursive guard(mMutex); + MCore::LockGuardRecursive guard(m_mutex); // remove the actual actor instance const size_t step = RemoveActorInstance(actorInstance, startStep); @@ -346,12 +346,12 @@ namespace EMotionFX void MultiThreadScheduler::Lock() { - mMutex.Lock(); + m_mutex.Lock(); } void MultiThreadScheduler::Unlock() { - mMutex.Unlock(); + m_mutex.Unlock(); } } // namespace EMotionFX diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/MultiThreadScheduler.h b/Gems/EMotionFX/Code/EMotionFX/Source/MultiThreadScheduler.h index 6d5a7251e5..cf22875d97 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/MultiThreadScheduler.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/MultiThreadScheduler.h @@ -50,8 +50,8 @@ namespace EMotionFX */ struct EMFX_API ScheduleStep { - AZStd::vector mDependencies; /**< The dependencies of this scheduler step. No actor instances with the same dependencies are allowed to be added to this step. */ - AZStd::vector mActorInstances; /**< The actor instances used inside this step. Each array entry will execute in another thread. */ + AZStd::vector m_dependencies; /**< The dependencies of this scheduler step. No actor instances with the same dependencies are allowed to be added to this step. */ + AZStd::vector m_actorInstances; /**< The actor instances used inside this step. Each array entry will execute in another thread. */ }; /** @@ -119,13 +119,13 @@ namespace EMotionFX void Lock(); void Unlock(); - const ScheduleStep& GetScheduleStep(size_t index) const { return mSteps[index]; } - size_t GetNumScheduleSteps() const { return mSteps.size(); } + const ScheduleStep& GetScheduleStep(size_t index) const { return m_steps[index]; } + size_t GetNumScheduleSteps() const { return m_steps.size(); } protected: - AZStd::vector< ScheduleStep > mSteps; /**< An array of update steps, that together form the schedule. */ - float mCleanTimer; /**< The time passed since the last automatic call to the Optimize method. */ - MCore::MutexRecursive mMutex; + AZStd::vector< ScheduleStep > m_steps; /**< An array of update steps, that together form the schedule. */ + float m_cleanTimer; /**< The time passed since the last automatic call to the Optimize method. */ + MCore::MutexRecursive m_mutex; bool HasActorInstanceInSteps(const ActorInstance* actorInstance) const; diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/Node.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/Node.cpp index 4bb1d850c9..1217c928bc 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/Node.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/Node.cpp @@ -20,20 +20,20 @@ namespace EMotionFX Node::Node(const char* name, Skeleton* skeleton) : BaseObject() { - mParentIndex = InvalidIndex; - mNodeIndex = InvalidIndex; // hasn't been set yet - mSkeletalLODs = 0xFFFFFFFF; // set all bits of the integer to 1, which enables this node in all LOD levels on default - mSkeleton = skeleton; - mSemanticNameID = InvalidIndex32; - mNodeFlags = FLAG_INCLUDEINBOUNDSCALC; + m_parentIndex = InvalidIndex; + m_nodeIndex = InvalidIndex; // hasn't been set yet + m_skeletalLoDs = 0xFFFFFFFF; // set all bits of the integer to 1, which enables this node in all LOD levels on default + m_skeleton = skeleton; + m_semanticNameId = InvalidIndex32; + m_nodeFlags = FLAG_INCLUDEINBOUNDSCALC; if (name) { - mNameID = MCore::GetStringIdPool().GenerateIdForString(name); + m_nameId = MCore::GetStringIdPool().GenerateIdForString(name); } else { - mNameID = InvalidIndex32; + m_nameId = InvalidIndex32; } } @@ -41,13 +41,13 @@ namespace EMotionFX Node::Node(uint32 nameID, Skeleton* skeleton) : BaseObject() { - mParentIndex = InvalidIndex; - mNodeIndex = InvalidIndex; // hasn't been set yet - mSkeletalLODs = 0xFFFFFFFF;// set all bits of the integer to 1, which enables this node in all LOD levels on default - mSkeleton = skeleton; - mNameID = nameID; - mSemanticNameID = InvalidIndex32; - mNodeFlags = FLAG_INCLUDEINBOUNDSCALC; + m_parentIndex = InvalidIndex; + m_nodeIndex = InvalidIndex; // hasn't been set yet + m_skeletalLoDs = 0xFFFFFFFF;// set all bits of the integer to 1, which enables this node in all LOD levels on default + m_skeleton = skeleton; + m_nameId = nameID; + m_semanticNameId = InvalidIndex32; + m_nodeFlags = FLAG_INCLUDEINBOUNDSCALC; } @@ -78,19 +78,19 @@ namespace EMotionFX // create a clone of this node Node* Node::Clone(Skeleton* skeleton) const { - Node* result = Node::Create(mNameID, skeleton); + Node* result = Node::Create(m_nameId, skeleton); // copy attributes - result->mParentIndex = mParentIndex; - result->mNodeIndex = mNodeIndex; - result->mSkeletalLODs = mSkeletalLODs; - result->mChildIndices = mChildIndices; - result->mNodeFlags = mNodeFlags; - result->mSemanticNameID = mSemanticNameID; + result->m_parentIndex = m_parentIndex; + result->m_nodeIndex = m_nodeIndex; + result->m_skeletalLoDs = m_skeletalLoDs; + result->m_childIndices = m_childIndices; + result->m_nodeFlags = m_nodeFlags; + result->m_semanticNameId = m_semanticNameId; // copy the node attributes - result->mAttributes.reserve(mAttributes.size()); - for (const NodeAttribute* attribute : mAttributes) + result->m_attributes.reserve(m_attributes.size()); + for (const NodeAttribute* attribute : m_attributes) { result->AddAttribute(attribute->Clone()); } @@ -103,10 +103,10 @@ namespace EMotionFX // removes all attributes void Node::RemoveAllAttributes() { - while (!mAttributes.empty()) + while (!m_attributes.empty()) { - mAttributes.back()->Destroy(); - mAttributes.pop_back(); + m_attributes.back()->Destroy(); + m_attributes.pop_back(); } } @@ -118,9 +118,9 @@ namespace EMotionFX size_t result = 0; // retrieve the number of child nodes of the actual node - for (size_t childIndex : mChildIndices) + for (size_t childIndex : m_childIndices) { - mSkeleton->GetNode(childIndex)->RecursiveCountChildNodes(result); + m_skeleton->GetNode(childIndex)->RecursiveCountChildNodes(result); } return result; @@ -134,9 +134,9 @@ namespace EMotionFX numNodes++; // recurse down the hierarchy - for (size_t childIndex : mChildIndices) + for (size_t childIndex : m_childIndices) { - mSkeleton->GetNode(childIndex)->RecursiveCountChildNodes(numNodes); + m_skeleton->GetNode(childIndex)->RecursiveCountChildNodes(numNodes); } } @@ -173,7 +173,7 @@ namespace EMotionFX // remove the given attribute of the given type from the node void Node::RemoveAttributeByType(uint32 attributeTypeID, size_t occurrence) { - const auto foundAttribute = AZStd::find_if(begin(mAttributes), end(mAttributes), [attributeTypeID, occurrence, currentOccurrence = size_t{0}] (const NodeAttribute* attribute) mutable + const auto foundAttribute = AZStd::find_if(begin(m_attributes), end(m_attributes), [attributeTypeID, occurrence, currentOccurrence = size_t{0}] (const NodeAttribute* attribute) mutable { if (attribute->GetType() == attributeTypeID) { @@ -183,14 +183,14 @@ namespace EMotionFX return false; }); - mAttributes.erase(foundAttribute); + m_attributes.erase(foundAttribute); } // remove all attributes of the given type from the node size_t Node::RemoveAllAttributesByType(uint32 attributeTypeID) { - return AZStd::erase_if(mAttributes, [attributeTypeID](const NodeAttribute* attribute) + return AZStd::erase_if(m_attributes, [attributeTypeID](const NodeAttribute* attribute) { return attribute->GetType() == attributeTypeID; }); @@ -201,12 +201,12 @@ namespace EMotionFX // recursively find the root node (expensive call) Node* Node::FindRoot() const { - size_t parentIndex = mParentIndex; + size_t parentIndex = m_parentIndex; const Node* curNode = this; while (parentIndex != InvalidIndex) { - curNode = mSkeleton->GetNode(parentIndex); + curNode = m_skeleton->GetNode(parentIndex); parentIndex = curNode->GetParentIndex(); } @@ -217,9 +217,9 @@ namespace EMotionFX // get the parent node, or nullptr when it doesn't exist Node* Node::GetParentNode() const { - if (mParentIndex != InvalidIndex) + if (m_parentIndex != InvalidIndex) { - return mSkeleton->GetNode(mParentIndex); + return m_skeleton->GetNode(m_parentIndex); } return nullptr; @@ -231,11 +231,11 @@ namespace EMotionFX { if (name) { - mNameID = MCore::GetStringIdPool().GenerateIdForString(name); + m_nameId = MCore::GetStringIdPool().GenerateIdForString(name); } else { - mNameID = InvalidIndex32; + m_nameId = InvalidIndex32; } } @@ -245,53 +245,53 @@ namespace EMotionFX { if (name) { - mSemanticNameID = MCore::GetStringIdPool().GenerateIdForString(name); + m_semanticNameId = MCore::GetStringIdPool().GenerateIdForString(name); } else { - mSemanticNameID = InvalidIndex32; + m_semanticNameId = InvalidIndex32; } } void Node::SetParentIndex(size_t parentNodeIndex) { - mParentIndex = parentNodeIndex; + m_parentIndex = parentNodeIndex; } // get the name const char* Node::GetName() const { - return MCore::GetStringIdPool().GetName(mNameID).c_str(); + return MCore::GetStringIdPool().GetName(m_nameId).c_str(); } // get the name of the node as pointer to chars const AZStd::string& Node::GetNameString() const { - return MCore::GetStringIdPool().GetName(mNameID); + return MCore::GetStringIdPool().GetName(m_nameId); } // get the semantic name const char* Node::GetSemanticName() const { - return MCore::GetStringIdPool().GetName(mSemanticNameID).c_str(); + return MCore::GetStringIdPool().GetName(m_semanticNameId).c_str(); } // get the semantic name of the node as pointer to chars const AZStd::string& Node::GetSemanticNameString() const { - return MCore::GetStringIdPool().GetName(mSemanticNameID); + return MCore::GetStringIdPool().GetName(m_semanticNameId); } // returns true if this is a root node, so if it has no parents bool Node::GetIsRootNode() const { - return (mParentIndex == InvalidIndex); + return (m_parentIndex == InvalidIndex); } @@ -299,110 +299,110 @@ namespace EMotionFX void Node::AddAttribute(NodeAttribute* attribute) { - mAttributes.emplace_back(attribute); + m_attributes.emplace_back(attribute); } size_t Node::GetNumAttributes() const { - return mAttributes.size(); + return m_attributes.size(); } NodeAttribute* Node::GetAttribute(size_t attributeNr) { // make sure we are in range - MCORE_ASSERT(attributeNr < mAttributes.size()); + MCORE_ASSERT(attributeNr < m_attributes.size()); // return the attribute - return mAttributes[attributeNr]; + return m_attributes[attributeNr]; } size_t Node::FindAttributeNumber(uint32 attributeTypeID) const { // check all attributes, and find where the specific attribute is - const auto foundAttribute = AZStd::find_if(begin(mAttributes), end(mAttributes), [attributeTypeID](const NodeAttribute* attribute) + const auto foundAttribute = AZStd::find_if(begin(m_attributes), end(m_attributes), [attributeTypeID](const NodeAttribute* attribute) { return attribute->GetType() == attributeTypeID; }); - return foundAttribute != end(mAttributes) ? AZStd::distance(begin(mAttributes), foundAttribute) : InvalidIndex; + return foundAttribute != end(m_attributes) ? AZStd::distance(begin(m_attributes), foundAttribute) : InvalidIndex; } NodeAttribute* Node::GetAttributeByType(uint32 attributeType) { // check all attributes - const auto foundAttribute = AZStd::find_if(begin(mAttributes), end(mAttributes), [attributeType](const NodeAttribute* attribute) + const auto foundAttribute = AZStd::find_if(begin(m_attributes), end(m_attributes), [attributeType](const NodeAttribute* attribute) { return attribute->GetType() == attributeType; }); - return foundAttribute != end(mAttributes) ? *foundAttribute : nullptr; + return foundAttribute != end(m_attributes) ? *foundAttribute : nullptr; } // remove the given attribute void Node::RemoveAttribute(size_t index) { - mAttributes.erase(AZStd::next(begin(mAttributes), index)); + m_attributes.erase(AZStd::next(begin(m_attributes), index)); } void Node::AddChild(size_t nodeIndex) { - mChildIndices.emplace_back(nodeIndex); + m_childIndices.emplace_back(nodeIndex); } void Node::SetChild(size_t childNr, size_t childNodeIndex) { - mChildIndices[childNr] = childNodeIndex; + m_childIndices[childNr] = childNodeIndex; } void Node::SetNumChildNodes(size_t numChildNodes) { - mChildIndices.resize(numChildNodes); + m_childIndices.resize(numChildNodes); } void Node::PreAllocNumChildNodes(size_t numChildNodes) { - mChildIndices.reserve(numChildNodes); + m_childIndices.reserve(numChildNodes); } void Node::RemoveChild(size_t nodeIndex) { - if (const auto it = AZStd::find(begin(mChildIndices), end(mChildIndices), nodeIndex); it != end(mChildIndices)) + if (const auto it = AZStd::find(begin(m_childIndices), end(m_childIndices), nodeIndex); it != end(m_childIndices)) { - mChildIndices.erase(it); + m_childIndices.erase(it); } } void Node::RemoveAllChildNodes() { - mChildIndices.clear(); + m_childIndices.clear(); } bool Node::GetHasChildNodes() const { - return !mChildIndices.empty(); + return !m_childIndices.empty(); } void Node::SetNodeIndex(size_t index) { - mNodeIndex = index; + m_nodeIndex = index; } void Node::SetSkeletalLODLevelBits(size_t bitValues) { - mSkeletalLODs = bitValues; + m_skeletalLoDs = bitValues; } @@ -411,11 +411,11 @@ namespace EMotionFX MCORE_ASSERT(lodLevel <= 63); if (enabled) { - mSkeletalLODs |= (1ull << lodLevel); + m_skeletalLoDs |= (1ull << lodLevel); } else { - mSkeletalLODs &= ~(1ull << lodLevel); + m_skeletalLoDs &= ~(1ull << lodLevel); } } @@ -424,11 +424,11 @@ namespace EMotionFX { if (includeThisNode) { - mNodeFlags |= FLAG_INCLUDEINBOUNDSCALC; + m_nodeFlags |= FLAG_INCLUDEINBOUNDSCALC; } else { - mNodeFlags &= ~FLAG_INCLUDEINBOUNDSCALC; + m_nodeFlags &= ~FLAG_INCLUDEINBOUNDSCALC; } } @@ -436,18 +436,18 @@ namespace EMotionFX { if (isCritical) { - mNodeFlags |= FLAG_CRITICAL; + m_nodeFlags |= FLAG_CRITICAL; } else { - mNodeFlags &= ~FLAG_CRITICAL; + m_nodeFlags &= ~FLAG_CRITICAL; } } bool Node::GetIsAttachmentNode() const { - return (mNodeFlags & FLAG_ATTACHMENT) != 0; + return (m_nodeFlags & FLAG_ATTACHMENT) != 0; } @@ -455,11 +455,11 @@ namespace EMotionFX { if (isAttachmentNode) { - mNodeFlags |= FLAG_ATTACHMENT; + m_nodeFlags |= FLAG_ATTACHMENT; } else { - mNodeFlags &= ~FLAG_ATTACHMENT; + m_nodeFlags &= ~FLAG_ATTACHMENT; } } } // namespace EMotionFX diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/Node.h b/Gems/EMotionFX/Code/EMotionFX/Source/Node.h index 19d9f53ff8..01dfacc28c 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/Node.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/Node.h @@ -92,7 +92,7 @@ namespace EMotionFX * This is either a valid index, or MCORE_INVALIDINDEX32 in case there is no parent node. * @result The index of the parent node, or MCORE_INVALIDINDEX32 in case this node has no parent. */ - MCORE_INLINE size_t GetParentIndex() const { return mParentIndex; } + MCORE_INLINE size_t GetParentIndex() const { return m_parentIndex; } /** * Get the parent node as node pointer. @@ -155,20 +155,20 @@ namespace EMotionFX * same ID number. * @result The node ID number, which can be used for fast compares between nodes. */ - MCORE_INLINE uint32 GetID() const { return mNameID; } + MCORE_INLINE uint32 GetID() const { return m_nameId; } /** * Get the semantic name ID. * To get the name you can also use GetSemanticName() and GetSemanticNameString(). * @result The semantic name ID. */ - MCORE_INLINE uint32 GetSemanticID() const { return mSemanticNameID; } + MCORE_INLINE uint32 GetSemanticID() const { return m_semanticNameId; } /** * Get the number of child nodes attached to this node. * @result The number of child nodes. */ - MCORE_INLINE size_t GetNumChildNodes() const { return mChildIndices.size(); } + MCORE_INLINE size_t GetNumChildNodes() const { return m_childIndices.size(); } /** * Get the number of child nodes down the hierarchy of this node. @@ -182,14 +182,14 @@ namespace EMotionFX * @param nr The child number. * @result The index of the child node, which is a node number inside the actor. */ - MCORE_INLINE size_t GetChildIndex(size_t nr) const { return mChildIndices[nr]; } + MCORE_INLINE size_t GetChildIndex(size_t nr) const { return m_childIndices[nr]; } /** * Checks if the given node is a child of this node. * @param nodeIndex The node to check whether it is a child or not. * @result True if the given node is a child, false if not. */ - MCORE_INLINE bool CheckIfIsChildNode(size_t nodeIndex) const { return (AZStd::find(begin(mChildIndices), end(mChildIndices), nodeIndex) != end(mChildIndices)); } + MCORE_INLINE bool CheckIfIsChildNode(size_t nodeIndex) const { return (AZStd::find(begin(m_childIndices), end(m_childIndices), nodeIndex) != end(m_childIndices)); } /** * Add a child to this node. @@ -336,7 +336,7 @@ namespace EMotionFX * So Actor::GetNode( nodeIndex ) will return this node. * @result The index of the node. */ - MCORE_INLINE size_t GetNodeIndex() const { return mNodeIndex; } + MCORE_INLINE size_t GetNodeIndex() const { return m_nodeIndex; } //------------------------------ @@ -364,7 +364,7 @@ namespace EMotionFX * @param lodLevel The skeletal LOD level to check. * @result Returns true when this node is enabled in the specified LOD level. Otherwise false is returned. */ - MCORE_INLINE bool GetSkeletalLODStatus(size_t lodLevel) const { return (mSkeletalLODs & (1ull << lodLevel)) != 0; } + MCORE_INLINE bool GetSkeletalLODStatus(size_t lodLevel) const { return (m_skeletalLoDs & (1ull << lodLevel)) != 0; } //-------------------------------------------- @@ -376,7 +376,7 @@ namespace EMotionFX * On default all nodes are included inside the bounding volume calculations. * @result Returns true when this node will be included in the bounds calculation, or false when it won't. */ - MCORE_INLINE bool GetIncludeInBoundsCalc() const { return mNodeFlags & FLAG_INCLUDEINBOUNDSCALC; } + MCORE_INLINE bool GetIncludeInBoundsCalc() const { return m_nodeFlags & FLAG_INCLUDEINBOUNDSCALC; } /** * Specify whether this node should be included inside the bounding volume calculations or not. @@ -394,7 +394,7 @@ namespace EMotionFX * Sometimes we perform optimization process on the node. This flag make sure that critical node will always be included in the actor heirarchy. * @result Returns true when this node is critical, or false when it won't. */ - MCORE_INLINE bool GetIsCritical() const { return mNodeFlags & FLAG_CRITICAL; } + MCORE_INLINE bool GetIsCritical() const { return m_nodeFlags & FLAG_CRITICAL; } /** * Specify whether this node is critcal and should not be optimized out in any situations. @@ -415,15 +415,15 @@ namespace EMotionFX void SetIsAttachmentNode(bool isAttachmentNode); private: - size_t mNodeIndex; /**< The node index, which is the index into the array of nodes inside the Skeleton class. */ - size_t mParentIndex; /**< The parent node index, or MCORE_INVALIDINDEX32 when there is no parent. */ - size_t mSkeletalLODs; /**< The skeletal LOD status values. Each bit represents if this node is enabled or disabled in the given LOD. */ - uint32 mNameID; /**< The ID, which is generated from the name. You can use this for fast compares between nodes. */ - uint32 mSemanticNameID; /**< The semantic name ID, for example "LeftHand" or "RightFoot" or so, this can be used for retargeting. */ - Skeleton* mSkeleton; /**< The skeleton where this node belongs to. */ - AZStd::vector mChildIndices; /**< The indices that point to the child nodes. */ - AZStd::vector mAttributes; /**< The node attributes. */ - uint8 mNodeFlags; /**< The node flags are used to store boolean attributes of the node as single bits. */ + size_t m_nodeIndex; /**< The node index, which is the index into the array of nodes inside the Skeleton class. */ + size_t m_parentIndex; /**< The parent node index, or MCORE_INVALIDINDEX32 when there is no parent. */ + size_t m_skeletalLoDs; /**< The skeletal LOD status values. Each bit represents if this node is enabled or disabled in the given LOD. */ + uint32 m_nameId; /**< The ID, which is generated from the name. You can use this for fast compares between nodes. */ + uint32 m_semanticNameId; /**< The semantic name ID, for example "LeftHand" or "RightFoot" or so, this can be used for retargeting. */ + Skeleton* m_skeleton; /**< The skeleton where this node belongs to. */ + AZStd::vector m_childIndices; /**< The indices that point to the child nodes. */ + AZStd::vector m_attributes; /**< The node attributes. */ + uint8 m_nodeFlags; /**< The node flags are used to store boolean attributes of the node as single bits. */ /** * Constructor. diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/NodeGroup.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/NodeGroup.cpp index cd2139ec9a..293d64775d 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/NodeGroup.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/NodeGroup.cpp @@ -18,9 +18,9 @@ namespace EMotionFX NodeGroup::NodeGroup(const AZStd::string& groupName, uint16 numNodes, bool enabledOnDefault) - : mName(groupName) - , mNodes(numNodes) - , mEnabledOnDefault(enabledOnDefault) + : m_name(groupName) + , m_nodes(numNodes) + , m_enabledOnDefault(enabledOnDefault) { } @@ -28,59 +28,59 @@ namespace EMotionFX // set the name of the group void NodeGroup::SetName(const AZStd::string& groupName) { - mName = groupName; + m_name = groupName; } // get the name of the group as character buffer const char* NodeGroup::GetName() const { - return mName.c_str(); + return m_name.c_str(); } // get the name of the string as mcore string object const AZStd::string& NodeGroup::GetNameString() const { - return mName; + return m_name; } // set the number of nodes void NodeGroup::SetNumNodes(const uint16 numNodes) { - mNodes.Resize(numNodes); + m_nodes.Resize(numNodes); } // get the number of nodes uint16 NodeGroup::GetNumNodes() const { - return static_cast(mNodes.GetLength()); + return static_cast(m_nodes.GetLength()); } // set a given node to a given node number void NodeGroup::SetNode(uint16 index, uint16 nodeIndex) { - mNodes[index] = nodeIndex; + m_nodes[index] = nodeIndex; } // get the node number of a given index uint16 NodeGroup::GetNode(uint16 index) const { - return mNodes[index]; + return m_nodes[index]; } // enable all nodes in the group inside a given actor instance void NodeGroup::EnableNodes(ActorInstance* targetActorInstance) { - const uint16 numNodes = static_cast(mNodes.GetLength()); + const uint16 numNodes = static_cast(m_nodes.GetLength()); for (uint16 i = 0; i < numNodes; ++i) { - targetActorInstance->EnableNode(mNodes[i]); + targetActorInstance->EnableNode(m_nodes[i]); } } @@ -88,10 +88,10 @@ namespace EMotionFX // disable all nodes in the group inside a given actor instance void NodeGroup::DisableNodes(ActorInstance* targetActorInstance) { - const uint16 numNodes = static_cast(mNodes.GetLength()); + const uint16 numNodes = static_cast(m_nodes.GetLength()); for (uint16 i = 0; i < numNodes; ++i) { - targetActorInstance->DisableNode(mNodes[i]); + targetActorInstance->DisableNode(m_nodes[i]); } } @@ -99,42 +99,42 @@ namespace EMotionFX // add a given node to the group (performs a realloc internally) void NodeGroup::AddNode(uint16 nodeIndex) { - mNodes.Add(nodeIndex); + m_nodes.Add(nodeIndex); } // remove a given node by its node number void NodeGroup::RemoveNodeByNodeIndex(uint16 nodeIndex) { - mNodes.RemoveByValue(nodeIndex); + m_nodes.RemoveByValue(nodeIndex); } // remove a given array element from the list of nodes void NodeGroup::RemoveNodeByGroupIndex(uint16 index) { - mNodes.Remove(index); + m_nodes.Remove(index); } // get the node array directly MCore::SmallArray& NodeGroup::GetNodeArray() { - return mNodes; + return m_nodes; } // is this group enabled on default? bool NodeGroup::GetIsEnabledOnDefault() const { - return mEnabledOnDefault; + return m_enabledOnDefault; } // set the default enabled state void NodeGroup::SetIsEnabledOnDefault(bool enabledOnDefault) { - mEnabledOnDefault = enabledOnDefault; + m_enabledOnDefault = enabledOnDefault; } NodeGroup::NodeGroup(const NodeGroup& aOther) @@ -144,9 +144,9 @@ namespace EMotionFX NodeGroup& NodeGroup::operator=(const NodeGroup& aOther) { - mName = aOther.mName; - mNodes = aOther.mNodes; - mEnabledOnDefault = aOther.mEnabledOnDefault; + m_name = aOther.m_name; + m_nodes = aOther.m_nodes; + m_enabledOnDefault = aOther.m_enabledOnDefault; return *this; } diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/NodeGroup.h b/Gems/EMotionFX/Code/EMotionFX/Source/NodeGroup.h index b3e82e648b..7ee74415c0 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/NodeGroup.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/NodeGroup.h @@ -154,8 +154,8 @@ namespace EMotionFX void SetIsEnabledOnDefault(bool enabledOnDefault); private: - AZStd::string mName; /**< The name of the group. */ - MCore::SmallArray mNodes; /**< The node index numbers that are inside this group. */ - bool mEnabledOnDefault; /**< Specifies whether this group is enabled on default (true) or disabled (false). With on default we mean after directly after the actor instance using this group has been created. */ + AZStd::string m_name; /**< The name of the group. */ + MCore::SmallArray m_nodes; /**< The node index numbers that are inside this group. */ + bool m_enabledOnDefault; /**< Specifies whether this group is enabled on default (true) or disabled (false). With on default we mean after directly after the actor instance using this group has been created. */ }; } // namespace EMotionFX diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/NodeMap.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/NodeMap.cpp index fb2fbd9ed7..f9774751ba 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/NodeMap.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/NodeMap.cpp @@ -27,7 +27,7 @@ namespace EMotionFX NodeMap::NodeMap() : BaseObject() { - mSourceActor = nullptr; + m_sourceActor = nullptr; } @@ -41,36 +41,36 @@ namespace EMotionFX // preallocate space void NodeMap::Reserve(size_t numEntries) { - mEntries.reserve(numEntries); + m_entries.reserve(numEntries); } // resize the entries array void NodeMap::Resize(size_t numEntries) { - mEntries.resize(numEntries); + m_entries.resize(numEntries); } // modify the first name of a given entry void NodeMap::SetFirstName(size_t entryIndex, const char* name) { - mEntries[entryIndex].mFirstNameID = MCore::GetStringIdPool().GenerateIdForString(name); + m_entries[entryIndex].m_firstNameId = MCore::GetStringIdPool().GenerateIdForString(name); } // modify the second name void NodeMap::SetSecondName(size_t entryIndex, const char* name) { - mEntries[entryIndex].mSecondNameID = MCore::GetStringIdPool().GenerateIdForString(name); + m_entries[entryIndex].m_secondNameId = MCore::GetStringIdPool().GenerateIdForString(name); } // modify a given entry void NodeMap::SetEntry(size_t entryIndex, const char* firstName, const char* secondName) { - mEntries[entryIndex].mFirstNameID = MCore::GetStringIdPool().GenerateIdForString(firstName); - mEntries[entryIndex].mSecondNameID = MCore::GetStringIdPool().GenerateIdForString(secondName); + m_entries[entryIndex].m_firstNameId = MCore::GetStringIdPool().GenerateIdForString(firstName); + m_entries[entryIndex].m_secondNameId = MCore::GetStringIdPool().GenerateIdForString(secondName); } @@ -101,15 +101,15 @@ namespace EMotionFX void NodeMap::AddEntry(const char* firstName, const char* secondName) { MCORE_ASSERT(GetHasEntry(firstName) == false); // prevent duplicates - mEntries.emplace_back(); - SetEntry(mEntries.size() - 1, firstName, secondName); + m_entries.emplace_back(); + SetEntry(m_entries.size() - 1, firstName, secondName); } // remove a given entry by its index void NodeMap::RemoveEntryByIndex(size_t entryIndex) { - mEntries.erase(AZStd::next(begin(mEntries), entryIndex)); + m_entries.erase(AZStd::next(begin(m_entries), entryIndex)); } @@ -122,7 +122,7 @@ namespace EMotionFX return; } - mEntries.erase(AZStd::next(begin(mEntries), entryIndex)); + m_entries.erase(AZStd::next(begin(m_entries), entryIndex)); } @@ -135,28 +135,28 @@ namespace EMotionFX return; } - mEntries.erase(AZStd::next(begin(mEntries), entryIndex)); + m_entries.erase(AZStd::next(begin(m_entries), entryIndex)); } // set the filename void NodeMap::SetFileName(const char* fileName) { - mFileName = fileName; + m_fileName = fileName; } // get the filename const char* NodeMap::GetFileName() const { - return mFileName.c_str(); + return m_fileName.c_str(); } // get the filename const AZStd::string& NodeMap::GetFileNameString() const { - return mFileName; + return m_fileName; } @@ -211,7 +211,7 @@ namespace EMotionFX size_t numBytes = sizeof(FileFormat::NodeMapChunk); // for all entries - const size_t numEntries = mEntries.size(); + const size_t numEntries = m_entries.size(); for (size_t i = 0; i < numEntries; ++i) { numBytes += CalcFileStringSize(GetFirstNameString(i)); @@ -236,13 +236,13 @@ namespace EMotionFX // try to write the file header FileFormat::NodeMap_Header header{}; - header.mFourCC[0] = 'N'; - header.mFourCC[1] = 'O'; - header.mFourCC[2] = 'M'; - header.mFourCC[3] = 'P'; - header.mHiVersion = 1; - header.mLoVersion = 0; - header.mEndianType = (uint8)targetEndianType; + header.m_fourCc[0] = 'N'; + header.m_fourCc[1] = 'O'; + header.m_fourCc[2] = 'M'; + header.m_fourCc[3] = 'P'; + header.m_hiVersion = 1; + header.m_loVersion = 0; + header.m_endianType = (uint8)targetEndianType; if (f.Write(&header, sizeof(FileFormat::NodeMap_Header)) == 0) { MCore::LogError("NodeMap::Save() - Cannot write the header to file '%s', is the file maybe in use by another application?", fileName); @@ -251,12 +251,12 @@ namespace EMotionFX // write the chunk header FileFormat::FileChunk chunkHeader{}; - chunkHeader.mChunkID = FileFormat::CHUNK_NODEMAP; - chunkHeader.mVersion = 1; - chunkHeader.mSizeInBytes = CalcFileChunkSize();// calculate the chunk size - MCore::Endian::ConvertUnsignedInt32To(&chunkHeader.mChunkID, targetEndianType); - MCore::Endian::ConvertUnsignedInt32To(&chunkHeader.mSizeInBytes, targetEndianType); - MCore::Endian::ConvertUnsignedInt32To(&chunkHeader.mVersion, targetEndianType); + chunkHeader.m_chunkId = FileFormat::CHUNK_NODEMAP; + chunkHeader.m_version = 1; + chunkHeader.m_sizeInBytes = CalcFileChunkSize();// calculate the chunk size + MCore::Endian::ConvertUnsignedInt32To(&chunkHeader.m_chunkId, targetEndianType); + MCore::Endian::ConvertUnsignedInt32To(&chunkHeader.m_sizeInBytes, targetEndianType); + MCore::Endian::ConvertUnsignedInt32To(&chunkHeader.m_version, targetEndianType); if (f.Write(&chunkHeader, sizeof(FileFormat::FileChunk)) == 0) { MCore::LogError("NodeMap::Save() - Cannot write the chunk header to file '%s', is the file maybe in use by another application?", fileName); @@ -265,8 +265,8 @@ namespace EMotionFX // the main info FileFormat::NodeMapChunk nodeMapChunk{}; - nodeMapChunk.mNumEntries = aznumeric_caster(mEntries.size()); - MCore::Endian::ConvertUnsignedInt32To(&nodeMapChunk.mNumEntries, targetEndianType); + nodeMapChunk.m_numEntries = aznumeric_caster(m_entries.size()); + MCore::Endian::ConvertUnsignedInt32To(&nodeMapChunk.m_numEntries, targetEndianType); if (f.Write(&nodeMapChunk, sizeof(FileFormat::NodeMapChunk)) == 0) { MCore::LogError("NodeMap::Save() - Cannot write the node map chunk to file '%s', is the file maybe in use by another application?", fileName); @@ -282,7 +282,7 @@ namespace EMotionFX } // for all entries - const uint32 numEntries = aznumeric_caster(mEntries.size()); + const uint32 numEntries = aznumeric_caster(m_entries.size()); for (uint32 i = 0; i < numEntries; ++i) { if (WriteFileString(&f, GetFirstNameString(i), targetEndianType) == false) @@ -308,49 +308,49 @@ namespace EMotionFX // update the source actor pointer void NodeMap::SetSourceActor(Actor* actor) { - mSourceActor = actor; + m_sourceActor = actor; } // get the source actor pointer Actor* NodeMap::GetSourceActor() const { - return mSourceActor; + return m_sourceActor; } // get the number of entries size_t NodeMap::GetNumEntries() const { - return mEntries.size(); + return m_entries.size(); } // get the first name as char pointer const char* NodeMap::GetFirstName(size_t entryIndex) const { - return MCore::GetStringIdPool().GetName(mEntries[entryIndex].mFirstNameID).c_str(); + return MCore::GetStringIdPool().GetName(m_entries[entryIndex].m_firstNameId).c_str(); } // get the second node name as char pointer const char* NodeMap::GetSecondName(size_t entryIndex) const { - return MCore::GetStringIdPool().GetName(mEntries[entryIndex].mSecondNameID).c_str(); + return MCore::GetStringIdPool().GetName(m_entries[entryIndex].m_secondNameId).c_str(); } // get the first node name as string const AZStd::string& NodeMap::GetFirstNameString(size_t entryIndex) const { - return MCore::GetStringIdPool().GetName(mEntries[entryIndex].mFirstNameID); + return MCore::GetStringIdPool().GetName(m_entries[entryIndex].m_firstNameId); } // get the second node name as string const AZStd::string& NodeMap::GetSecondNameString(size_t entryIndex) const { - return MCore::GetStringIdPool().GetName(mEntries[entryIndex].mSecondNameID); + return MCore::GetStringIdPool().GetName(m_entries[entryIndex].m_secondNameId); } @@ -364,22 +364,22 @@ namespace EMotionFX // find an entry index by its name size_t NodeMap::FindEntryIndexByName(const char* firstName) const { - const auto foundEntry = AZStd::find_if(begin(mEntries), end(mEntries), [firstName](const MapEntry& entry) + const auto foundEntry = AZStd::find_if(begin(m_entries), end(m_entries), [firstName](const MapEntry& entry) { - return MCore::GetStringIdPool().GetName(entry.mFirstNameID) == firstName; + return MCore::GetStringIdPool().GetName(entry.m_firstNameId) == firstName; }); - return foundEntry != end(mEntries) ? AZStd::distance(begin(mEntries), foundEntry) : InvalidIndex; + return foundEntry != end(m_entries) ? AZStd::distance(begin(m_entries), foundEntry) : InvalidIndex; } // find an entry index by its name ID size_t NodeMap::FindEntryIndexByNameID(uint32 firstNameID) const { - const auto foundEntry = AZStd::find_if(begin(mEntries), end(mEntries), [firstNameID](const MapEntry& entry) + const auto foundEntry = AZStd::find_if(begin(m_entries), end(m_entries), [firstNameID](const MapEntry& entry) { - return entry.mFirstNameID == firstNameID; + return entry.m_firstNameId == firstNameID; }); - return foundEntry != end(mEntries) ? AZStd::distance(begin(mEntries), foundEntry) : InvalidIndex; + return foundEntry != end(m_entries) ? AZStd::distance(begin(m_entries), foundEntry) : InvalidIndex; } diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/NodeMap.h b/Gems/EMotionFX/Code/EMotionFX/Source/NodeMap.h index 3fe2c94386..c0744323af 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/NodeMap.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/NodeMap.h @@ -39,8 +39,8 @@ namespace EMotionFX public: struct MapEntry { - uint32 mFirstNameID = InvalidIndex32; /**< The first name ID, which is the primary key in the map. */ - uint32 mSecondNameID = InvalidIndex32; /**< The second name ID. */ + uint32 m_firstNameId = InvalidIndex32; /**< The first name ID, which is the primary key in the map. */ + uint32 m_secondNameId = InvalidIndex32; /**< The second name ID. */ }; static NodeMap* Create(); @@ -84,9 +84,9 @@ namespace EMotionFX bool Save(const char* fileName, MCore::Endian::EEndianType targetEndianType) const; private: - AZStd::vector mEntries; /**< The array of entries. */ - AZStd::string mFileName; /**< The filename. */ - Actor* mSourceActor; /**< The source actor. */ + AZStd::vector m_entries; /**< The array of entries. */ + AZStd::string m_fileName; /**< The filename. */ + Actor* m_sourceActor; /**< The source actor. */ // constructor and destructor NodeMap(); diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/PhysicsSetup.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/PhysicsSetup.cpp index dbe57cdd34..02b3fd7649 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/PhysicsSetup.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/PhysicsSetup.cpp @@ -510,15 +510,15 @@ namespace EMotionFX const Node* childNode = skeleton->GetNode(childIndex); const float numSubChildren = static_cast(1 + childNode->GetNumChildNodesRecursive()); totalSubChildren += numSubChildren; - meanChildPosition += numSubChildren * (bindPose->GetModelSpaceTransform(childIndex).mPosition); + meanChildPosition += numSubChildren * (bindPose->GetModelSpaceTransform(childIndex).m_position); } - boneDirection = meanChildPosition / totalSubChildren - nodeBindTransform.mPosition; + boneDirection = meanChildPosition / totalSubChildren - nodeBindTransform.m_position; } // otherwise, point the bone direction away from the parent else { - boneDirection = nodeBindTransform.mPosition - parentBindTransform.mPosition; + boneDirection = nodeBindTransform.m_position - parentBindTransform.m_position; } return boneDirection; diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/PlayBackInfo.h b/Gems/EMotionFX/Code/EMotionFX/Source/PlayBackInfo.h index 6ae2b0d809..de84a97da8 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/PlayBackInfo.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/PlayBackInfo.h @@ -65,29 +65,29 @@ namespace EMotionFX *
          * Member Name           - Default Value
          * ---------------------------------
-         * mBlendInTime          - 0.3 (seconds)
-         * mBlendOutTime         - 0.3 (seconds)
-         * mPlaySpeed            - 1.0 (original speed)
-         * mTargetWeight         - 1.0 (fully blend in)
-         * mEventWeightThreshold - 0.0 (allow all events even with low motion instance weight values)
-         * mMaxPlayTime          - 0.0 (disabled when zero or negative)
-         * mClipStartTime        - 0.0 (start and loop from the beginning of the motion)
-         * mClipEndTime          - 0.0 (set to negative or zero to play the full range of the motion)
-         * mNumLoops             - EMFX_LOOPFOREVER
-         * mBlendMode            - BLENDMODE_OVERWRITE (overwrites motions)
-         * mPlayMode             - PLAYMODE_FORWARD (regular forward playing motion)
-         * mMirrorMotion         - false (disable motion mirroring)
-         * mPlayNow              - true (start playing immediately)
-         * mMix                  - false (non mixing motion)
-         * mPriorityLevel        - 0 (no priority)
-         * mMotionExtractionEnabled - true
-         * mRetarget             - false (no motion retargeting allowed)
-         * mFreezeAtLastFrame    - true (motion freezes in last frame when not looping forever)
-         * mEnableMotionEvents   - true (all motion events will be processed for this motion instance
-         * mBlendOutBeforeEnded  - true (blend out so that it faded out at the end of the motion).
-         * mCanOverwrite         - true (can overwrite other motion instances when reaching a weight of 1.0)
-         * mDeleteOnZeroWeight   - true (delete this motion instance when it reaches a weight of 0.0)
-         * mFreezeAtTime;        - -1.0 (Freeze at a given time offset in seconds. The current play time would continue running though, and a blend out would be triggered, unlike the mFreezeAtLastFrame. Set to negative value to disable.
+         * m_blendInTime          - 0.3 (seconds)
+         * m_blendOutTime         - 0.3 (seconds)
+         * m_playSpeed            - 1.0 (original speed)
+         * m_targetWeight         - 1.0 (fully blend in)
+         * m_eventWeightThreshold - 0.0 (allow all events even with low motion instance weight values)
+         * m_maxPlayTime          - 0.0 (disabled when zero or negative)
+         * m_clipStartTime        - 0.0 (start and loop from the beginning of the motion)
+         * m_clipEndTime          - 0.0 (set to negative or zero to play the full range of the motion)
+         * m_numLoops             - EMFX_LOOPFOREVER
+         * m_blendMode            - BLENDMODE_OVERWRITE (overwrites motions)
+         * m_playMode             - PLAYMODE_FORWARD (regular forward playing motion)
+         * m_mirrorMotion         - false (disable motion mirroring)
+         * m_playNow              - true (start playing immediately)
+         * m_mix                  - false (non mixing motion)
+         * m_priorityLevel        - 0 (no priority)
+         * m_motionExtractionEnabled - true
+         * m_retarget             - false (no motion retargeting allowed)
+         * m_freezeAtLastFrame    - true (motion freezes in last frame when not looping forever)
+         * m_enableMotionEvents   - true (all motion events will be processed for this motion instance
+         * m_blendOutBeforeEnded  - true (blend out so that it faded out at the end of the motion).
+         * m_canOverwrite         - true (can overwrite other motion instances when reaching a weight of 1.0)
+         * m_deleteOnZeroWeight   - true (delete this motion instance when it reaches a weight of 0.0)
+         * m_freezeAtTime;        - -1.0 (Freeze at a given time offset in seconds. The current play time would continue running though, and a blend out would be triggered, unlike the m_freezeAtLastFrame. Set to negative value to disable.
          *
          * 
* @@ -95,30 +95,30 @@ namespace EMotionFX */ PlayBackInfo() { - mBlendInTime = 0.3f; - mBlendOutTime = 0.3f; - mPlaySpeed = 1.0f; - mTargetWeight = 1.0f; - mEventWeightThreshold = 0.0f; - mMaxPlayTime = 0.0f; - mClipStartTime = 0.0f; - mClipEndTime = 0.0f; - mFreezeAtTime = -1.0f; - mNumLoops = EMFX_LOOPFOREVER; - mBlendMode = BLENDMODE_OVERWRITE; - mPlayMode = PLAYMODE_FORWARD; - mMirrorMotion = false; - mPlayNow = true; - mMix = false; - mMotionExtractionEnabled = true; - mRetarget = false; - mFreezeAtLastFrame = true; - mEnableMotionEvents = true; - mBlendOutBeforeEnded = true; - mCanOverwrite = true; - mDeleteOnZeroWeight = true; - mInPlace = false; - mPriorityLevel = 0; + m_blendInTime = 0.3f; + m_blendOutTime = 0.3f; + m_playSpeed = 1.0f; + m_targetWeight = 1.0f; + m_eventWeightThreshold = 0.0f; + m_maxPlayTime = 0.0f; + m_clipStartTime = 0.0f; + m_clipEndTime = 0.0f; + m_freezeAtTime = -1.0f; + m_numLoops = EMFX_LOOPFOREVER; + m_blendMode = BLENDMODE_OVERWRITE; + m_playMode = PLAYMODE_FORWARD; + m_mirrorMotion = false; + m_playNow = true; + m_mix = false; + m_motionExtractionEnabled = true; + m_retarget = false; + m_freezeAtLastFrame = true; + m_enableMotionEvents = true; + m_blendOutBeforeEnded = true; + m_canOverwrite = true; + m_deleteOnZeroWeight = true; + m_inPlace = false; + m_priorityLevel = 0; } /** @@ -128,29 +128,29 @@ namespace EMotionFX public: - float mBlendInTime; /**< The time, in seconds, which it will take to fully have blended to the target weight. */ - float mBlendOutTime; /**< The time, in seconds, which it takes to smoothly fadeout the motion, after it has been stopped playing. */ - float mPlaySpeed; /**< The playback speed factor. A value of 1 stands for the original speed, while for example 2 means twice the original speed. */ - float mTargetWeight; /**< The target weight, where 1 means fully active, and 0 means not active at all. */ - float mEventWeightThreshold; /**< The motion event weight threshold. If the motion instance weight is lower than this value, no motion events will be executed for this motion instance. */ - float mMaxPlayTime; /**< The maximum play time, in seconds. Set to zero or a negative value to disable it. */ - float mClipStartTime; /**< The start playback time in seconds. Also in case of looping it will jump to this position on a loop. */ - float mClipEndTime; /**< The end playback time in seconds. It will jump back to the clip start time after reaching this playback time. */ - float mFreezeAtTime; /**< Freeze at a given time offset in seconds. The current play time would continue running though, and a blend out would be triggered, unlike the mFreezeAtLastFrame. Set to negative value to disable. Default=-1.*/ - uint32 mNumLoops; /**< The number of times you want to play this motion. A value of EMFX_LOOPFOREVER means it will loop forever. */ - uint32 mPriorityLevel; /**< The priority level, the higher this value, the higher priority it has on overwriting other motions. */ - EMotionBlendMode mBlendMode; /**< The motion blend mode. Please read the MotionInstance::SetBlendMode(...) method for more information. */ - EPlayMode mPlayMode; /**< The motion playback mode. This means forward or backward playback. */ - bool mMirrorMotion; /**< Is motion mirroring enabled or not? When set to true, the mMirrorPlaneNormal is used as mirroring axis. */ - bool mMix; /**< Set to true if you want this motion to mix or not. */ - bool mPlayNow; /**< Set to true if you want to start playing the motion right away. If set to false it will be scheduled for later by inserting it into the motion queue. */ - bool mMotionExtractionEnabled; /**< Set to true if you want this motion to move and rotate the actor instance, otherwise set to false. */ - bool mRetarget; /**< Set to true if you want to enable motion retargeting. Read the manual for more information. */ - bool mFreezeAtLastFrame; /**< Set to true if you like the motion to freeze at the last frame, for example in case of a death motion. */ - bool mEnableMotionEvents; /**< Set to true to enable motion events, or false to disable processing of motion events for this motion instance. */ - bool mBlendOutBeforeEnded; /**< Set to true if you want the motion to be stopped so that it exactly faded out when the motion/loop fully finished. If set to false it will fade out after the loop has completed (and starts repeating). The default is true. */ - bool mCanOverwrite; /**< Set to true if you want this motion to be able to delete other underlaying motion instances when this motion instance reaches a weight of 1.0.*/ - bool mDeleteOnZeroWeight; /**< Set to true if you wish to delete this motion instance once it reaches a weight of 0.0. */ - bool mInPlace; /**< Set to true if you want the motion to play in place. This means the root of the motion will not move. */ + float m_blendInTime; /**< The time, in seconds, which it will take to fully have blended to the target weight. */ + float m_blendOutTime; /**< The time, in seconds, which it takes to smoothly fadeout the motion, after it has been stopped playing. */ + float m_playSpeed; /**< The playback speed factor. A value of 1 stands for the original speed, while for example 2 means twice the original speed. */ + float m_targetWeight; /**< The target weight, where 1 means fully active, and 0 means not active at all. */ + float m_eventWeightThreshold; /**< The motion event weight threshold. If the motion instance weight is lower than this value, no motion events will be executed for this motion instance. */ + float m_maxPlayTime; /**< The maximum play time, in seconds. Set to zero or a negative value to disable it. */ + float m_clipStartTime; /**< The start playback time in seconds. Also in case of looping it will jump to this position on a loop. */ + float m_clipEndTime; /**< The end playback time in seconds. It will jump back to the clip start time after reaching this playback time. */ + float m_freezeAtTime; /**< Freeze at a given time offset in seconds. The current play time would continue running though, and a blend out would be triggered, unlike the m_freezeAtLastFrame. Set to negative value to disable. Default=-1.*/ + uint32 m_numLoops; /**< The number of times you want to play this motion. A value of EMFX_LOOPFOREVER means it will loop forever. */ + uint32 m_priorityLevel; /**< The priority level, the higher this value, the higher priority it has on overwriting other motions. */ + EMotionBlendMode m_blendMode; /**< The motion blend mode. Please read the MotionInstance::SetBlendMode(...) method for more information. */ + EPlayMode m_playMode; /**< The motion playback mode. This means forward or backward playback. */ + bool m_mirrorMotion; /**< Is motion mirroring enabled or not? When set to true, the m_mirrorPlaneNormal is used as mirroring axis. */ + bool m_mix; /**< Set to true if you want this motion to mix or not. */ + bool m_playNow; /**< Set to true if you want to start playing the motion right away. If set to false it will be scheduled for later by inserting it into the motion queue. */ + bool m_motionExtractionEnabled; /**< Set to true if you want this motion to move and rotate the actor instance, otherwise set to false. */ + bool m_retarget; /**< Set to true if you want to enable motion retargeting. Read the manual for more information. */ + bool m_freezeAtLastFrame; /**< Set to true if you like the motion to freeze at the last frame, for example in case of a death motion. */ + bool m_enableMotionEvents; /**< Set to true to enable motion events, or false to disable processing of motion events for this motion instance. */ + bool m_blendOutBeforeEnded; /**< Set to true if you want the motion to be stopped so that it exactly faded out when the motion/loop fully finished. If set to false it will fade out after the loop has completed (and starts repeating). The default is true. */ + bool m_canOverwrite; /**< Set to true if you want this motion to be able to delete other underlaying motion instances when this motion instance reaches a weight of 1.0.*/ + bool m_deleteOnZeroWeight; /**< Set to true if you wish to delete this motion instance once it reaches a weight of 0.0. */ + bool m_inPlace; /**< Set to true if you want the motion to play in place. This means the root of the motion will not move. */ }; } // namespace EMotionFX diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/Pose.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/Pose.cpp index b9f223eded..23390bf69b 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/Pose.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/Pose.cpp @@ -21,19 +21,13 @@ namespace EMotionFX // default constructor Pose::Pose() { - mActorInstance = nullptr; - mActor = nullptr; - mSkeleton = nullptr; - mLocalSpaceTransforms.SetMemoryCategory(EMFX_MEMCATEGORY_ANIMGRAPH_POSE); - mModelSpaceTransforms.SetMemoryCategory(EMFX_MEMCATEGORY_ANIMGRAPH_POSE); - mFlags.SetMemoryCategory(EMFX_MEMCATEGORY_ANIMGRAPH_POSE); - mMorphWeights.SetMemoryCategory(EMFX_MEMCATEGORY_ANIMGRAPH_POSE); - - // reset morph weights - //mMorphWeights.Reserve(32); - //mLocalSpaceTransforms.Reserve(128); - //mModelSpaceTransforms.Reserve(128); - //mFlags.Reserve(128); + m_actorInstance = nullptr; + m_actor = nullptr; + m_skeleton = nullptr; + m_localSpaceTransforms.SetMemoryCategory(EMFX_MEMCATEGORY_ANIMGRAPH_POSE); + m_modelSpaceTransforms.SetMemoryCategory(EMFX_MEMCATEGORY_ANIMGRAPH_POSE); + m_flags.SetMemoryCategory(EMFX_MEMCATEGORY_ANIMGRAPH_POSE); + m_morphWeights.SetMemoryCategory(EMFX_MEMCATEGORY_ANIMGRAPH_POSE); } @@ -55,16 +49,16 @@ namespace EMotionFX void Pose::LinkToActorInstance(const ActorInstance* actorInstance, uint8 initialFlags) { // store the pointer to the actor instance etc - mActorInstance = actorInstance; - mActor = actorInstance->GetActor(); - mSkeleton = mActor->GetSkeleton(); + m_actorInstance = actorInstance; + m_actor = actorInstance->GetActor(); + m_skeleton = m_actor->GetSkeleton(); // resize the buffers - const size_t numTransforms = mActor->GetSkeleton()->GetNumNodes(); - mLocalSpaceTransforms.ResizeFast(numTransforms); - mModelSpaceTransforms.ResizeFast(numTransforms); - mFlags.ResizeFast(numTransforms); - mMorphWeights.ResizeFast(actorInstance->GetMorphSetupInstance()->GetNumMorphTargets()); + const size_t numTransforms = m_actor->GetSkeleton()->GetNumNodes(); + m_localSpaceTransforms.ResizeFast(numTransforms); + m_modelSpaceTransforms.ResizeFast(numTransforms); + m_flags.ResizeFast(numTransforms); + m_morphWeights.ResizeFast(actorInstance->GetMorphSetupInstance()->GetNumMorphTargets()); for (const auto& poseDataItem : m_poseDatas) { @@ -79,27 +73,27 @@ namespace EMotionFX // link the pose to a given actor void Pose::LinkToActor(const Actor* actor, uint8 initialFlags, bool clearAllFlags) { - mActorInstance = nullptr; - mActor = actor; - mSkeleton = actor->GetSkeleton(); + m_actorInstance = nullptr; + m_actor = actor; + m_skeleton = actor->GetSkeleton(); // resize the buffers - const size_t numTransforms = mActor->GetSkeleton()->GetNumNodes(); - mLocalSpaceTransforms.ResizeFast(numTransforms); - mModelSpaceTransforms.ResizeFast(numTransforms); + const size_t numTransforms = m_actor->GetSkeleton()->GetNumNodes(); + m_localSpaceTransforms.ResizeFast(numTransforms); + m_modelSpaceTransforms.ResizeFast(numTransforms); - const size_t oldSize = mFlags.GetLength(); - mFlags.ResizeFast(numTransforms); + const size_t oldSize = m_flags.GetLength(); + m_flags.ResizeFast(numTransforms); if (oldSize < numTransforms && clearAllFlags == false) { for (size_t i = oldSize; i < numTransforms; ++i) { - mFlags[i] = initialFlags; + m_flags[i] = initialFlags; } } - MorphSetup* morphSetup = mActor->GetMorphSetup(0); - mMorphWeights.ResizeFast((morphSetup) ? morphSetup->GetNumMorphTargets() : 0); + MorphSetup* morphSetup = m_actor->GetMorphSetup(0); + m_morphWeights.ResizeFast((morphSetup) ? morphSetup->GetNumMorphTargets() : 0); for (const auto& poseDataItem : m_poseDatas) { @@ -117,15 +111,15 @@ namespace EMotionFX void Pose::SetNumTransforms(size_t numTransforms) { // resize the buffers - mLocalSpaceTransforms.ResizeFast(numTransforms); - mModelSpaceTransforms.ResizeFast(numTransforms); + m_localSpaceTransforms.ResizeFast(numTransforms); + m_modelSpaceTransforms.ResizeFast(numTransforms); - const size_t oldSize = mFlags.GetLength(); - mFlags.ResizeFast(numTransforms); + const size_t oldSize = m_flags.GetLength(); + m_flags.ResizeFast(numTransforms); for (size_t i = oldSize; i < numTransforms; ++i) { - mFlags[i] = 0; + m_flags[i] = 0; SetLocalSpaceTransform(i, Transform::CreateIdentity()); } } @@ -133,10 +127,10 @@ namespace EMotionFX void Pose::Clear(bool clearMem) { - mLocalSpaceTransforms.Clear(clearMem); - mModelSpaceTransforms.Clear(clearMem); - mFlags.Clear(clearMem); - mMorphWeights.Clear(clearMem); + m_localSpaceTransforms.Clear(clearMem); + m_modelSpaceTransforms.Clear(clearMem); + m_flags.Clear(clearMem); + m_morphWeights.Clear(clearMem); ClearPoseDatas(); } @@ -145,25 +139,10 @@ namespace EMotionFX // clear the pose flags void Pose::ClearFlags(uint8 newFlags) { - MCore::MemSet((uint8*)mFlags.GetPtr(), newFlags, sizeof(uint8) * mFlags.GetLength()); + MCore::MemSet((uint8*)m_flags.GetPtr(), newFlags, sizeof(uint8) * m_flags.GetLength()); } - /* - // init from a set of local space transformations - void Pose::InitFromLocalTransforms(ActorInstance* actorInstance, const Transform* localTransforms) - { - // link to an actor instance - LinkToActorInstance( actorInstance, FLAG_LOCALTRANSFORMREADY ); - - // reset all flags - //MCore::MemSet( (uint8*)mFlags.GetPtr(), FLAG_LOCALTRANSFORMREADY, sizeof(uint8)*mFlags.GetLength() ); - - // copy over the local transforms - MCore::MemCopy((uint8*)mLocalTransforms.GetPtr(), (uint8*)localTransforms, sizeof(Transform)*mLocalTransforms.GetLength()); - } - */ - // initialize this pose to the bind pose void Pose::InitFromBindPose(const ActorInstance* actorInstance) { @@ -192,23 +171,23 @@ namespace EMotionFX // update the full local space pose void Pose::ForceUpdateFullLocalSpacePose() { - Skeleton* skeleton = mActor->GetSkeleton(); + Skeleton* skeleton = m_actor->GetSkeleton(); const size_t numNodes = skeleton->GetNumNodes(); for (size_t i = 0; i < numNodes; ++i) { const size_t parentIndex = skeleton->GetNode(i)->GetParentIndex(); if (parentIndex != InvalidIndex) { - GetModelSpaceTransform(parentIndex, &mLocalSpaceTransforms[i]); - mLocalSpaceTransforms[i].Inverse(); - mLocalSpaceTransforms[i].PreMultiply(mModelSpaceTransforms[i]); + GetModelSpaceTransform(parentIndex, &m_localSpaceTransforms[i]); + m_localSpaceTransforms[i].Inverse(); + m_localSpaceTransforms[i].PreMultiply(m_modelSpaceTransforms[i]); } else { - mLocalSpaceTransforms[i] = mModelSpaceTransforms[i]; + m_localSpaceTransforms[i] = m_modelSpaceTransforms[i]; } - mFlags[i] |= FLAG_LOCALTRANSFORMREADY; + m_flags[i] |= FLAG_LOCALTRANSFORMREADY; } } @@ -217,21 +196,21 @@ namespace EMotionFX void Pose::ForceUpdateFullModelSpacePose() { // iterate from root towards child nodes recursively, updating all model space transforms on the way - Skeleton* skeleton = mActor->GetSkeleton(); + Skeleton* skeleton = m_actor->GetSkeleton(); const size_t numNodes = skeleton->GetNumNodes(); for (size_t i = 0; i < numNodes; ++i) { const size_t parentIndex = skeleton->GetNode(i)->GetParentIndex(); if (parentIndex != InvalidIndex) { - mModelSpaceTransforms[parentIndex].PreMultiply(mLocalSpaceTransforms[i], &mModelSpaceTransforms[i]); + m_modelSpaceTransforms[parentIndex].PreMultiply(m_localSpaceTransforms[i], &m_modelSpaceTransforms[i]); } else { - mModelSpaceTransforms[i] = mLocalSpaceTransforms[i]; + m_modelSpaceTransforms[i] = m_localSpaceTransforms[i]; } - mFlags[i] |= FLAG_MODELTRANSFORMREADY; + m_flags[i] |= FLAG_MODELTRANSFORMREADY; } } @@ -239,28 +218,28 @@ namespace EMotionFX // recursively update void Pose::UpdateModelSpaceTransform(size_t nodeIndex) const { - Skeleton* skeleton = mActor->GetSkeleton(); + Skeleton* skeleton = m_actor->GetSkeleton(); const size_t parentIndex = skeleton->GetNode(nodeIndex)->GetParentIndex(); - if (parentIndex != InvalidIndex && !(mFlags[parentIndex] & FLAG_MODELTRANSFORMREADY)) + if (parentIndex != InvalidIndex && !(m_flags[parentIndex] & FLAG_MODELTRANSFORMREADY)) { UpdateModelSpaceTransform(parentIndex); } // update the model space transform if needed - if ((mFlags[nodeIndex] & FLAG_MODELTRANSFORMREADY) == false) + if ((m_flags[nodeIndex] & FLAG_MODELTRANSFORMREADY) == false) { const Transform& localTransform = GetLocalSpaceTransform(nodeIndex); if (parentIndex != InvalidIndex) { - mModelSpaceTransforms[parentIndex].PreMultiply(localTransform, &mModelSpaceTransforms[nodeIndex]); + m_modelSpaceTransforms[parentIndex].PreMultiply(localTransform, &m_modelSpaceTransforms[nodeIndex]); } else { - mModelSpaceTransforms[nodeIndex] = mLocalSpaceTransforms[nodeIndex]; + m_modelSpaceTransforms[nodeIndex] = m_localSpaceTransforms[nodeIndex]; } - mFlags[nodeIndex] |= FLAG_MODELTRANSFORMREADY; + m_flags[nodeIndex] |= FLAG_MODELTRANSFORMREADY; } } @@ -268,7 +247,7 @@ namespace EMotionFX // update the local transform void Pose::UpdateLocalSpaceTransform(size_t nodeIndex) const { - const uint8 flags = mFlags[nodeIndex]; + const uint8 flags = m_flags[nodeIndex]; if (flags & FLAG_LOCALTRANSFORMREADY) { return; @@ -276,20 +255,20 @@ namespace EMotionFX MCORE_ASSERT(flags & FLAG_MODELTRANSFORMREADY); // the model space transform has to be updated already, otherwise we cannot possibly calculate the local space one - Skeleton* skeleton = mActor->GetSkeleton(); + Skeleton* skeleton = m_actor->GetSkeleton(); const size_t parentIndex = skeleton->GetNode(nodeIndex)->GetParentIndex(); if (parentIndex != InvalidIndex) { - GetModelSpaceTransform(parentIndex, &mLocalSpaceTransforms[nodeIndex]); - mLocalSpaceTransforms[nodeIndex].Inverse(); - mLocalSpaceTransforms[nodeIndex].PreMultiply(mModelSpaceTransforms[nodeIndex]); + GetModelSpaceTransform(parentIndex, &m_localSpaceTransforms[nodeIndex]); + m_localSpaceTransforms[nodeIndex].Inverse(); + m_localSpaceTransforms[nodeIndex].PreMultiply(m_modelSpaceTransforms[nodeIndex]); } else { - mLocalSpaceTransforms[nodeIndex] = mModelSpaceTransforms[nodeIndex]; + m_localSpaceTransforms[nodeIndex] = m_modelSpaceTransforms[nodeIndex]; } - mFlags[nodeIndex] |= FLAG_LOCALTRANSFORMREADY; + m_flags[nodeIndex] |= FLAG_LOCALTRANSFORMREADY; } @@ -297,63 +276,63 @@ namespace EMotionFX const Transform& Pose::GetLocalSpaceTransform(size_t nodeIndex) const { UpdateLocalSpaceTransform(nodeIndex); - return mLocalSpaceTransforms[nodeIndex]; + return m_localSpaceTransforms[nodeIndex]; } const Transform& Pose::GetModelSpaceTransform(size_t nodeIndex) const { UpdateModelSpaceTransform(nodeIndex); - return mModelSpaceTransforms[nodeIndex]; + return m_modelSpaceTransforms[nodeIndex]; } Transform Pose::GetWorldSpaceTransform(size_t nodeIndex) const { UpdateModelSpaceTransform(nodeIndex); - return mModelSpaceTransforms[nodeIndex].Multiplied(mActorInstance->GetWorldSpaceTransform()); + return m_modelSpaceTransforms[nodeIndex].Multiplied(m_actorInstance->GetWorldSpaceTransform()); } void Pose::GetWorldSpaceTransform(size_t nodeIndex, Transform* outResult) const { UpdateModelSpaceTransform(nodeIndex); - *outResult = mModelSpaceTransforms[nodeIndex]; - outResult->Multiply(mActorInstance->GetWorldSpaceTransform()); + *outResult = m_modelSpaceTransforms[nodeIndex]; + outResult->Multiply(m_actorInstance->GetWorldSpaceTransform()); } // calculate a local transform void Pose::GetLocalSpaceTransform(size_t nodeIndex, Transform* outResult) const { - if ((mFlags[nodeIndex] & FLAG_LOCALTRANSFORMREADY) == false) + if ((m_flags[nodeIndex] & FLAG_LOCALTRANSFORMREADY) == false) { UpdateLocalSpaceTransform(nodeIndex); } - *outResult = mLocalSpaceTransforms[nodeIndex]; + *outResult = m_localSpaceTransforms[nodeIndex]; } void Pose::GetModelSpaceTransform(size_t nodeIndex, Transform* outResult) const { UpdateModelSpaceTransform(nodeIndex); - *outResult = mModelSpaceTransforms[nodeIndex]; + *outResult = m_modelSpaceTransforms[nodeIndex]; } // set the local transform void Pose::SetLocalSpaceTransform(size_t nodeIndex, const Transform& newTransform, bool invalidateGlobalTransforms) { - mLocalSpaceTransforms[nodeIndex] = newTransform; - mFlags[nodeIndex] |= FLAG_LOCALTRANSFORMREADY; + m_localSpaceTransforms[nodeIndex] = newTransform; + m_flags[nodeIndex] |= FLAG_LOCALTRANSFORMREADY; // mark all child node model space transforms as dirty (recursively) if (invalidateGlobalTransforms) { - if (mFlags[nodeIndex] & FLAG_MODELTRANSFORMREADY) + if (m_flags[nodeIndex] & FLAG_MODELTRANSFORMREADY) { - RecursiveInvalidateModelSpaceTransforms(mActor, nodeIndex); + RecursiveInvalidateModelSpaceTransforms(m_actor, nodeIndex); } } } @@ -363,13 +342,13 @@ namespace EMotionFX void Pose::RecursiveInvalidateModelSpaceTransforms(const Actor* actor, size_t nodeIndex) { // if this model space transform ain't ready yet assume all child nodes are also not - if ((mFlags[nodeIndex] & FLAG_MODELTRANSFORMREADY) == false) + if ((m_flags[nodeIndex] & FLAG_MODELTRANSFORMREADY) == false) { return; } // mark the global transform as invalid - mFlags[nodeIndex] &= ~FLAG_MODELTRANSFORMREADY; + m_flags[nodeIndex] &= ~FLAG_MODELTRANSFORMREADY; // recurse through all child nodes Skeleton* skeleton = actor->GetSkeleton(); @@ -384,34 +363,34 @@ namespace EMotionFX void Pose::SetModelSpaceTransform(size_t nodeIndex, const Transform& newTransform, bool invalidateChildGlobalTransforms) { - mModelSpaceTransforms[nodeIndex] = newTransform; + m_modelSpaceTransforms[nodeIndex] = newTransform; // invalidate the local transform - mFlags[nodeIndex] &= ~FLAG_LOCALTRANSFORMREADY; + m_flags[nodeIndex] &= ~FLAG_LOCALTRANSFORMREADY; // recursively invalidate all model space transforms of all child nodes if (invalidateChildGlobalTransforms) { - RecursiveInvalidateModelSpaceTransforms(mActor, nodeIndex); + RecursiveInvalidateModelSpaceTransforms(m_actor, nodeIndex); } // mark this model space transform as ready - mFlags[nodeIndex] |= FLAG_MODELTRANSFORMREADY; + m_flags[nodeIndex] |= FLAG_MODELTRANSFORMREADY; UpdateLocalSpaceTransform(nodeIndex); } void Pose::SetWorldSpaceTransform(size_t nodeIndex, const Transform& newTransform, bool invalidateChildGlobalTransforms) { - mModelSpaceTransforms[nodeIndex] = newTransform.Multiplied(mActorInstance->GetWorldSpaceTransformInversed()); - mFlags[nodeIndex] &= ~FLAG_LOCALTRANSFORMREADY; + m_modelSpaceTransforms[nodeIndex] = newTransform.Multiplied(m_actorInstance->GetWorldSpaceTransformInversed()); + m_flags[nodeIndex] &= ~FLAG_LOCALTRANSFORMREADY; if (invalidateChildGlobalTransforms) { - RecursiveInvalidateModelSpaceTransforms(mActor, nodeIndex); + RecursiveInvalidateModelSpaceTransforms(m_actor, nodeIndex); } - mFlags[nodeIndex] |= FLAG_MODELTRANSFORMREADY; + m_flags[nodeIndex] |= FLAG_MODELTRANSFORMREADY; UpdateLocalSpaceTransform(nodeIndex); } @@ -419,38 +398,38 @@ namespace EMotionFX // invalidate all local transforms void Pose::InvalidateAllLocalSpaceTransforms() { - const size_t numFlags = mFlags.GetLength(); + const size_t numFlags = m_flags.GetLength(); for (size_t i = 0; i < numFlags; ++i) { - mFlags[i] &= ~FLAG_LOCALTRANSFORMREADY; + m_flags[i] &= ~FLAG_LOCALTRANSFORMREADY; } } void Pose::InvalidateAllModelSpaceTransforms() { - const size_t numFlags = mFlags.GetLength(); + const size_t numFlags = m_flags.GetLength(); for (size_t i = 0; i < numFlags; ++i) { - mFlags[i] &= ~FLAG_MODELTRANSFORMREADY; + m_flags[i] &= ~FLAG_MODELTRANSFORMREADY; } } void Pose::InvalidateAllLocalAndModelSpaceTransforms() { - const size_t numFlags = mFlags.GetLength(); + const size_t numFlags = m_flags.GetLength(); for (size_t i = 0; i < numFlags; ++i) { - mFlags[i] &= ~(FLAG_LOCALTRANSFORMREADY | FLAG_MODELTRANSFORMREADY); + m_flags[i] &= ~(FLAG_LOCALTRANSFORMREADY | FLAG_MODELTRANSFORMREADY); } } Transform Pose::CalcTrajectoryTransform() const { - MCORE_ASSERT(mActor); - const size_t motionExtractionNodeIndex = mActor->GetMotionExtractionNodeIndex(); + MCORE_ASSERT(m_actor); + const size_t motionExtractionNodeIndex = m_actor->GetMotionExtractionNodeIndex(); if (motionExtractionNodeIndex == InvalidIndex) { return Transform::CreateIdentity(); @@ -462,7 +441,7 @@ namespace EMotionFX void Pose::UpdateAllLocalSpaceTranforms() { - Skeleton* skeleton = mActor->GetSkeleton(); + Skeleton* skeleton = m_actor->GetSkeleton(); const size_t numNodes = skeleton->GetNumNodes(); for (size_t i = 0; i < numNodes; ++i) { @@ -473,7 +452,7 @@ namespace EMotionFX void Pose::UpdateAllModelSpaceTranforms() { - Skeleton* skeleton = mActor->GetSkeleton(); + Skeleton* skeleton = m_actor->GetSkeleton(); const size_t numNodes = skeleton->GetNumNodes(); for (size_t i = 0; i < numNodes; ++i) { @@ -490,8 +469,8 @@ namespace EMotionFX // make sure the number of transforms are equal MCORE_ASSERT(destPose); MCORE_ASSERT(outPose); - MCORE_ASSERT(mLocalSpaceTransforms.GetLength() == destPose->mLocalSpaceTransforms.GetLength()); - MCORE_ASSERT(mLocalSpaceTransforms.GetLength() == outPose->mLocalSpaceTransforms.GetLength()); + MCORE_ASSERT(m_localSpaceTransforms.GetLength() == destPose->m_localSpaceTransforms.GetLength()); + MCORE_ASSERT(m_localSpaceTransforms.GetLength() == outPose->m_localSpaceTransforms.GetLength()); MCORE_ASSERT(instance->GetIsMixing() == false); // get some motion instance properties which we use to decide the optimized blending routine @@ -530,12 +509,12 @@ namespace EMotionFX } // blend the morph weights - const size_t numMorphs = mMorphWeights.GetLength(); + const size_t numMorphs = m_morphWeights.GetLength(); MCORE_ASSERT(actorInstance->GetMorphSetupInstance()->GetNumMorphTargets() == numMorphs); MCORE_ASSERT(numMorphs == destPose->GetNumMorphWeights()); for (size_t i = 0; i < numMorphs; ++i) { - mMorphWeights[i] = MCore::LinearInterpolate(mMorphWeights[i], destPose->mMorphWeights[i], weight); + m_morphWeights[i] = MCore::LinearInterpolate(m_morphWeights[i], destPose->m_morphWeights[i], weight); } } else @@ -554,12 +533,12 @@ namespace EMotionFX outPose->InvalidateAllModelSpaceTransforms(); // blend the morph weights - const size_t numMorphs = mMorphWeights.GetLength(); + const size_t numMorphs = m_morphWeights.GetLength(); MCORE_ASSERT(actorInstance->GetMorphSetupInstance()->GetNumMorphTargets() == numMorphs); MCORE_ASSERT(numMorphs == destPose->GetNumMorphWeights()); for (size_t i = 0; i < numMorphs; ++i) { - mMorphWeights[i] += destPose->mMorphWeights[i] * weight; + m_morphWeights[i] += destPose->m_morphWeights[i] * weight; } } } @@ -571,8 +550,8 @@ namespace EMotionFX // make sure the number of transforms are equal MCORE_ASSERT(destPose); MCORE_ASSERT(outPose); - MCORE_ASSERT(mLocalSpaceTransforms.GetLength() == destPose->mLocalSpaceTransforms.GetLength()); - MCORE_ASSERT(mLocalSpaceTransforms.GetLength() == outPose->mLocalSpaceTransforms.GetLength()); + MCORE_ASSERT(m_localSpaceTransforms.GetLength() == destPose->m_localSpaceTransforms.GetLength()); + MCORE_ASSERT(m_localSpaceTransforms.GetLength() == outPose->m_localSpaceTransforms.GetLength()); MCORE_ASSERT(instance->GetIsMixing()); const bool additive = (instance->GetBlendMode() == BLENDMODE_ADDITIVE); @@ -585,7 +564,7 @@ namespace EMotionFX Transform result; const MotionLinkData* motionLinkData = instance->GetMotion()->GetMotionData()->FindMotionLinkData(actorInstance->GetActor()); - AZ_Assert(motionLinkData->GetJointDataLinks().size() == mLocalSpaceTransforms.GetLength(), "Expecting there to be the same amount of motion links as pose transforms."); + AZ_Assert(motionLinkData->GetJointDataLinks().size() == m_localSpaceTransforms.GetLength(), "Expecting there to be the same amount of motion links as pose transforms."); // blend all transforms if (!additive) @@ -610,12 +589,12 @@ namespace EMotionFX outPose->InvalidateAllModelSpaceTransforms(); // blend the morph weights - const size_t numMorphs = mMorphWeights.GetLength(); + const size_t numMorphs = m_morphWeights.GetLength(); MCORE_ASSERT(actorInstance->GetMorphSetupInstance()->GetNumMorphTargets() == numMorphs); MCORE_ASSERT(numMorphs == destPose->GetNumMorphWeights()); for (size_t i = 0; i < numMorphs; ++i) { - mMorphWeights[i] = MCore::LinearInterpolate(mMorphWeights[i], destPose->mMorphWeights[i], weight); + m_morphWeights[i] = MCore::LinearInterpolate(m_morphWeights[i], destPose->m_morphWeights[i], weight); } } else @@ -640,12 +619,12 @@ namespace EMotionFX outPose->InvalidateAllModelSpaceTransforms(); // blend the morph weights - const size_t numMorphs = mMorphWeights.GetLength(); + const size_t numMorphs = m_morphWeights.GetLength(); MCORE_ASSERT(actorInstance->GetMorphSetupInstance()->GetNumMorphTargets() == numMorphs); MCORE_ASSERT(numMorphs == destPose->GetNumMorphWeights()); for (size_t i = 0; i < numMorphs; ++i) { - mMorphWeights[i] += destPose->mMorphWeights[i] * weight; + m_morphWeights[i] += destPose->m_morphWeights[i] * weight; } } } @@ -656,22 +635,22 @@ namespace EMotionFX { if (!sourcePose) { - if (mActorInstance) + if (m_actorInstance) { - InitFromBindPose(mActorInstance); + InitFromBindPose(m_actorInstance); } else { - InitFromBindPose(mActor); + InitFromBindPose(m_actor); } return; } - mModelSpaceTransforms.MemCopyContentsFrom(sourcePose->mModelSpaceTransforms); - mLocalSpaceTransforms.MemCopyContentsFrom(sourcePose->mLocalSpaceTransforms); - mFlags.MemCopyContentsFrom(sourcePose->mFlags); - mMorphWeights.MemCopyContentsFrom(sourcePose->mMorphWeights); + m_modelSpaceTransforms.MemCopyContentsFrom(sourcePose->m_modelSpaceTransforms); + m_localSpaceTransforms.MemCopyContentsFrom(sourcePose->m_localSpaceTransforms); + m_flags.MemCopyContentsFrom(sourcePose->m_flags); + m_morphWeights.MemCopyContentsFrom(sourcePose->m_morphWeights); // Deactivate pose datas from the current pose that are not in the source that we copy from. // This is needed in order to prevent leftover pose datas and to avoid de-/allocations. @@ -739,35 +718,35 @@ namespace EMotionFX // reset all transforms to zero void Pose::Zero() { - if (mActorInstance) + if (m_actorInstance) { - const size_t numNodes = mActorInstance->GetNumEnabledNodes(); + const size_t numNodes = m_actorInstance->GetNumEnabledNodes(); for (size_t i = 0; i < numNodes; ++i) { - const uint16 nodeNr = mActorInstance->GetEnabledNode(i); - mLocalSpaceTransforms[nodeNr].Zero(); + const uint16 nodeNr = m_actorInstance->GetEnabledNode(i); + m_localSpaceTransforms[nodeNr].Zero(); } - const size_t numMorphs = mMorphWeights.GetLength(); - MCORE_ASSERT(mActorInstance->GetMorphSetupInstance()->GetNumMorphTargets() == numMorphs); + const size_t numMorphs = m_morphWeights.GetLength(); + MCORE_ASSERT(m_actorInstance->GetMorphSetupInstance()->GetNumMorphTargets() == numMorphs); for (size_t i = 0; i < numMorphs; ++i) { - mMorphWeights[i] = 0.0f; + m_morphWeights[i] = 0.0f; } } else { - const size_t numNodes = mActor->GetSkeleton()->GetNumNodes(); + const size_t numNodes = m_actor->GetSkeleton()->GetNumNodes(); for (size_t i = 0; i < numNodes; ++i) { - mLocalSpaceTransforms[i].Zero(); + m_localSpaceTransforms[i].Zero(); } - const size_t numMorphs = mMorphWeights.GetLength(); - MCORE_ASSERT(mActor->GetMorphSetup(0)->GetNumMorphTargets() == numMorphs); + const size_t numMorphs = m_morphWeights.GetLength(); + MCORE_ASSERT(m_actor->GetMorphSetup(0)->GetNumMorphTargets() == numMorphs); for (size_t i = 0; i < numMorphs; ++i) { - mMorphWeights[i] = 0.0f; + m_morphWeights[i] = 0.0f; } } @@ -778,23 +757,23 @@ namespace EMotionFX // normalize all quaternions void Pose::NormalizeQuaternions() { - if (mActorInstance) + if (m_actorInstance) { - const size_t numNodes = mActorInstance->GetNumEnabledNodes(); + const size_t numNodes = m_actorInstance->GetNumEnabledNodes(); for (size_t i = 0; i < numNodes; ++i) { - const uint16 nodeNr = mActorInstance->GetEnabledNode(i); + const uint16 nodeNr = m_actorInstance->GetEnabledNode(i); UpdateLocalSpaceTransform(nodeNr); - mLocalSpaceTransforms[nodeNr].mRotation.Normalize(); + m_localSpaceTransforms[nodeNr].m_rotation.Normalize(); } } else { - const size_t numNodes = mActor->GetSkeleton()->GetNumNodes(); + const size_t numNodes = m_actor->GetSkeleton()->GetNumNodes(); for (size_t i = 0; i < numNodes; ++i) { UpdateLocalSpaceTransform(i); - mLocalSpaceTransforms[i].mRotation.Normalize(); + m_localSpaceTransforms[i].m_rotation.Normalize(); } } } @@ -803,12 +782,12 @@ namespace EMotionFX // add the transforms of another pose to this one void Pose::Sum(const Pose* other, float weight) { - if (mActorInstance) + if (m_actorInstance) { - const size_t numNodes = mActorInstance->GetNumEnabledNodes(); + const size_t numNodes = m_actorInstance->GetNumEnabledNodes(); for (size_t i = 0; i < numNodes; ++i) { - const uint16 nodeNr = mActorInstance->GetEnabledNode(i); + const uint16 nodeNr = m_actorInstance->GetEnabledNode(i); Transform& transform = const_cast(GetLocalSpaceTransform(nodeNr)); const Transform& otherTransform = other->GetLocalSpaceTransform(nodeNr); @@ -816,17 +795,17 @@ namespace EMotionFX } // blend the morph weights - const size_t numMorphs = mMorphWeights.GetLength(); - MCORE_ASSERT(mActorInstance->GetMorphSetupInstance()->GetNumMorphTargets() == numMorphs); + const size_t numMorphs = m_morphWeights.GetLength(); + MCORE_ASSERT(m_actorInstance->GetMorphSetupInstance()->GetNumMorphTargets() == numMorphs); MCORE_ASSERT(numMorphs == other->GetNumMorphWeights()); for (size_t i = 0; i < numMorphs; ++i) { - mMorphWeights[i] += other->mMorphWeights[i] * weight; + m_morphWeights[i] += other->m_morphWeights[i] * weight; } } else { - const size_t numNodes = mActor->GetSkeleton()->GetNumNodes(); + const size_t numNodes = m_actor->GetSkeleton()->GetNumNodes(); for (size_t i = 0; i < numNodes; ++i) { Transform& transform = const_cast(GetLocalSpaceTransform(i)); @@ -835,12 +814,12 @@ namespace EMotionFX } // blend the morph weights - const size_t numMorphs = mMorphWeights.GetLength(); - MCORE_ASSERT(mActor->GetMorphSetup(0)->GetNumMorphTargets() == numMorphs); + const size_t numMorphs = m_morphWeights.GetLength(); + MCORE_ASSERT(m_actor->GetMorphSetup(0)->GetNumMorphTargets() == numMorphs); MCORE_ASSERT(numMorphs == other->GetNumMorphWeights()); for (size_t i = 0; i < numMorphs; ++i) { - mMorphWeights[i] += other->mMorphWeights[i] * weight; + m_morphWeights[i] += other->m_morphWeights[i] * weight; } } @@ -851,23 +830,23 @@ namespace EMotionFX // blend, without motion instance void Pose::Blend(const Pose* destPose, float weight) { - if (mActorInstance) + if (m_actorInstance) { - const size_t numNodes = mActorInstance->GetNumEnabledNodes(); + const size_t numNodes = m_actorInstance->GetNumEnabledNodes(); for (size_t i = 0; i < numNodes; ++i) { - const uint16 nodeNr = mActorInstance->GetEnabledNode(i); + const uint16 nodeNr = m_actorInstance->GetEnabledNode(i); Transform& curTransform = const_cast(GetLocalSpaceTransform(nodeNr)); curTransform.Blend(destPose->GetLocalSpaceTransform(nodeNr), weight); } // blend the morph weights - const size_t numMorphs = mMorphWeights.GetLength(); - MCORE_ASSERT(mActorInstance->GetMorphSetupInstance()->GetNumMorphTargets() == numMorphs); + const size_t numMorphs = m_morphWeights.GetLength(); + MCORE_ASSERT(m_actorInstance->GetMorphSetupInstance()->GetNumMorphTargets() == numMorphs); MCORE_ASSERT(numMorphs == destPose->GetNumMorphWeights()); for (size_t i = 0; i < numMorphs; ++i) { - mMorphWeights[i] = MCore::LinearInterpolate(mMorphWeights[i], destPose->mMorphWeights[i], weight); + m_morphWeights[i] = MCore::LinearInterpolate(m_morphWeights[i], destPose->m_morphWeights[i], weight); } for (const auto& poseDataItem : m_poseDatas) @@ -878,7 +857,7 @@ namespace EMotionFX } else { - const size_t numNodes = mActor->GetSkeleton()->GetNumNodes(); + const size_t numNodes = m_actor->GetSkeleton()->GetNumNodes(); for (size_t i = 0; i < numNodes; ++i) { Transform& curTransform = const_cast(GetLocalSpaceTransform(i)); @@ -886,12 +865,12 @@ namespace EMotionFX } // blend the morph weights - const size_t numMorphs = mMorphWeights.GetLength(); - MCORE_ASSERT(mActor->GetMorphSetup(0)->GetNumMorphTargets() == numMorphs); + const size_t numMorphs = m_morphWeights.GetLength(); + MCORE_ASSERT(m_actor->GetMorphSetup(0)->GetNumMorphTargets() == numMorphs); MCORE_ASSERT(numMorphs == destPose->GetNumMorphWeights()); for (size_t i = 0; i < numMorphs; ++i) { - mMorphWeights[i] = MCore::LinearInterpolate(mMorphWeights[i], destPose->mMorphWeights[i], weight); + m_morphWeights[i] = MCore::LinearInterpolate(m_morphWeights[i], destPose->m_morphWeights[i], weight); } for (const auto& poseDataItem : m_poseDatas) @@ -907,20 +886,20 @@ namespace EMotionFX Pose& Pose::MakeRelativeTo(const Pose& other) { - AZ_Assert(mLocalSpaceTransforms.GetLength() == other.mLocalSpaceTransforms.GetLength(), "Poses must be of the same size"); - if (mActorInstance) + AZ_Assert(m_localSpaceTransforms.GetLength() == other.m_localSpaceTransforms.GetLength(), "Poses must be of the same size"); + if (m_actorInstance) { - const size_t numNodes = mActorInstance->GetNumEnabledNodes(); + const size_t numNodes = m_actorInstance->GetNumEnabledNodes(); for (size_t i = 0; i < numNodes; ++i) { - const uint16 nodeNr = mActorInstance->GetEnabledNode(i); + const uint16 nodeNr = m_actorInstance->GetEnabledNode(i); Transform& transform = const_cast(GetLocalSpaceTransform(nodeNr)); transform = transform.CalcRelativeTo(other.GetLocalSpaceTransform(nodeNr)); } } else { - const size_t numNodes = mLocalSpaceTransforms.GetLength(); + const size_t numNodes = m_localSpaceTransforms.GetLength(); for (size_t i = 0; i < numNodes; ++i) { Transform& transform = const_cast(GetLocalSpaceTransform(i)); @@ -928,11 +907,11 @@ namespace EMotionFX } } - const size_t numMorphs = mMorphWeights.GetLength(); + const size_t numMorphs = m_morphWeights.GetLength(); AZ_Assert(numMorphs == other.GetNumMorphWeights(), "Number of morphs in the pose doesn't match the number of morphs inside the provided input pose."); for (size_t i = 0; i < numMorphs; ++i) { - mMorphWeights[i] -= other.mMorphWeights[i]; + m_morphWeights[i] -= other.m_morphWeights[i]; } InvalidateAllModelSpaceTransforms(); @@ -942,8 +921,8 @@ namespace EMotionFX Pose& Pose::ApplyAdditive(const Pose& additivePose, float weight) { - AZ_Assert(mLocalSpaceTransforms.GetLength() == additivePose.mLocalSpaceTransforms.GetLength(), "Poses must be of the same size"); - if (mActorInstance) + AZ_Assert(m_localSpaceTransforms.GetLength() == additivePose.m_localSpaceTransforms.GetLength(), "Poses must be of the same size"); + if (m_actorInstance) { AZ_Assert(weight > -MCore::Math::epsilon && weight < (1 + MCore::Math::epsilon), "Expected weight to be between 0..1"); } @@ -960,46 +939,46 @@ namespace EMotionFX } else { - AZ_Assert(mLocalSpaceTransforms.GetLength() == additivePose.mLocalSpaceTransforms.GetLength(), "Poses must be of the same size"); - if (mActorInstance) + AZ_Assert(m_localSpaceTransforms.GetLength() == additivePose.m_localSpaceTransforms.GetLength(), "Poses must be of the same size"); + if (m_actorInstance) { - const size_t numNodes = mActorInstance->GetNumEnabledNodes(); + const size_t numNodes = m_actorInstance->GetNumEnabledNodes(); for (size_t i = 0; i < numNodes; ++i) { - uint16 nodeNr = mActorInstance->GetEnabledNode(i); + uint16 nodeNr = m_actorInstance->GetEnabledNode(i); Transform& transform = const_cast(GetLocalSpaceTransform(nodeNr)); const Transform& additiveTransform = additivePose.GetLocalSpaceTransform(nodeNr); - transform.mPosition += additiveTransform.mPosition * weight; - transform.mRotation = transform.mRotation.NLerp(additiveTransform.mRotation * transform.mRotation, weight); + transform.m_position += additiveTransform.m_position * weight; + transform.m_rotation = transform.m_rotation.NLerp(additiveTransform.m_rotation * transform.m_rotation, weight); EMFX_SCALECODE ( - transform.mScale *= AZ::Vector3::CreateOne().Lerp(additiveTransform.mScale, weight); + transform.m_scale *= AZ::Vector3::CreateOne().Lerp(additiveTransform.m_scale, weight); ) - transform.mRotation.Normalize(); + transform.m_rotation.Normalize(); } } else { - const size_t numNodes = mLocalSpaceTransforms.GetLength(); + const size_t numNodes = m_localSpaceTransforms.GetLength(); for (size_t i = 0; i < numNodes; ++i) { Transform& transform = const_cast(GetLocalSpaceTransform(i)); const Transform& additiveTransform = additivePose.GetLocalSpaceTransform(i); - transform.mPosition += additiveTransform.mPosition * weight; - transform.mRotation = transform.mRotation.NLerp(additiveTransform.mRotation * transform.mRotation, weight); + transform.m_position += additiveTransform.m_position * weight; + transform.m_rotation = transform.m_rotation.NLerp(additiveTransform.m_rotation * transform.m_rotation, weight); EMFX_SCALECODE ( - transform.mScale *= AZ::Vector3::CreateOne().Lerp(additiveTransform.mScale, weight); + transform.m_scale *= AZ::Vector3::CreateOne().Lerp(additiveTransform.m_scale, weight); ) - transform.mRotation.Normalize(); + transform.m_rotation.Normalize(); } } - const size_t numMorphs = mMorphWeights.GetLength(); + const size_t numMorphs = m_morphWeights.GetLength(); AZ_Assert(numMorphs == additivePose.GetNumMorphWeights(), "Number of morphs in the pose doesn't match the number of morphs inside the provided input pose."); for (size_t i = 0; i < numMorphs; ++i) { - mMorphWeights[i] += additivePose.mMorphWeights[i] * weight; + m_morphWeights[i] += additivePose.m_morphWeights[i] * weight; } InvalidateAllModelSpaceTransforms(); @@ -1010,46 +989,46 @@ namespace EMotionFX Pose& Pose::ApplyAdditive(const Pose& additivePose) { - AZ_Assert(mLocalSpaceTransforms.GetLength() == additivePose.mLocalSpaceTransforms.GetLength(), "Poses must be of the same size"); - if (mActorInstance) + AZ_Assert(m_localSpaceTransforms.GetLength() == additivePose.m_localSpaceTransforms.GetLength(), "Poses must be of the same size"); + if (m_actorInstance) { - const size_t numNodes = mActorInstance->GetNumEnabledNodes(); + const size_t numNodes = m_actorInstance->GetNumEnabledNodes(); for (size_t i = 0; i < numNodes; ++i) { - uint16 nodeNr = mActorInstance->GetEnabledNode(i); + uint16 nodeNr = m_actorInstance->GetEnabledNode(i); Transform& transform = const_cast(GetLocalSpaceTransform(nodeNr)); const Transform& additiveTransform = additivePose.GetLocalSpaceTransform(nodeNr); - transform.mPosition += additiveTransform.mPosition; - transform.mRotation = transform.mRotation * additiveTransform.mRotation; + transform.m_position += additiveTransform.m_position; + transform.m_rotation = transform.m_rotation * additiveTransform.m_rotation; EMFX_SCALECODE ( - transform.mScale *= additiveTransform.mScale; + transform.m_scale *= additiveTransform.m_scale; ) - transform.mRotation.Normalize(); + transform.m_rotation.Normalize(); } } else { - const size_t numNodes = mLocalSpaceTransforms.GetLength(); + const size_t numNodes = m_localSpaceTransforms.GetLength(); for (size_t i = 0; i < numNodes; ++i) { Transform& transform = const_cast(GetLocalSpaceTransform(i)); const Transform& additiveTransform = additivePose.GetLocalSpaceTransform(i); - transform.mPosition += additiveTransform.mPosition; - transform.mRotation = transform.mRotation * additiveTransform.mRotation; + transform.m_position += additiveTransform.m_position; + transform.m_rotation = transform.m_rotation * additiveTransform.m_rotation; EMFX_SCALECODE ( - transform.mScale *= additiveTransform.mScale; + transform.m_scale *= additiveTransform.m_scale; ) - transform.mRotation.Normalize(); + transform.m_rotation.Normalize(); } } - const size_t numMorphs = mMorphWeights.GetLength(); + const size_t numMorphs = m_morphWeights.GetLength(); AZ_Assert(numMorphs == additivePose.GetNumMorphWeights(), "Number of morphs in the pose doesn't match the number of morphs inside the provided input pose."); for (size_t i = 0; i < numMorphs; ++i) { - mMorphWeights[i] += additivePose.mMorphWeights[i]; + m_morphWeights[i] += additivePose.m_morphWeights[i]; } InvalidateAllModelSpaceTransforms(); @@ -1059,44 +1038,44 @@ namespace EMotionFX Pose& Pose::MakeAdditive(const Pose& refPose) { - AZ_Assert(mLocalSpaceTransforms.GetLength() == refPose.mLocalSpaceTransforms.GetLength(), "Poses must be of the same size"); - if (mActorInstance) + AZ_Assert(m_localSpaceTransforms.GetLength() == refPose.m_localSpaceTransforms.GetLength(), "Poses must be of the same size"); + if (m_actorInstance) { - const size_t numNodes = mActorInstance->GetNumEnabledNodes(); + const size_t numNodes = m_actorInstance->GetNumEnabledNodes(); for (size_t i = 0; i < numNodes; ++i) { - uint16 nodeNr = mActorInstance->GetEnabledNode(i); + uint16 nodeNr = m_actorInstance->GetEnabledNode(i); Transform& transform = const_cast(GetLocalSpaceTransform(nodeNr)); const Transform& refTransform = refPose.GetLocalSpaceTransform(nodeNr); - transform.mPosition = transform.mPosition - refTransform.mPosition; - transform.mRotation = refTransform.mRotation.GetConjugate() * transform.mRotation; + transform.m_position = transform.m_position - refTransform.m_position; + transform.m_rotation = refTransform.m_rotation.GetConjugate() * transform.m_rotation; EMFX_SCALECODE ( - transform.mScale *= refTransform.mScale; + transform.m_scale *= refTransform.m_scale; ) } } else { - const size_t numNodes = mLocalSpaceTransforms.GetLength(); + const size_t numNodes = m_localSpaceTransforms.GetLength(); for (size_t i = 0; i < numNodes; ++i) { Transform& transform = const_cast(GetLocalSpaceTransform(i)); const Transform& refTransform = refPose.GetLocalSpaceTransform(i); - transform.mPosition = transform.mPosition - refTransform.mPosition; - transform.mRotation = refTransform.mRotation.GetConjugate() * transform.mRotation; + transform.m_position = transform.m_position - refTransform.m_position; + transform.m_rotation = refTransform.m_rotation.GetConjugate() * transform.m_rotation; EMFX_SCALECODE ( - transform.mScale *= refTransform.mScale; + transform.m_scale *= refTransform.m_scale; ) } } - const size_t numMorphs = mMorphWeights.GetLength(); + const size_t numMorphs = m_morphWeights.GetLength(); AZ_Assert(numMorphs == refPose.GetNumMorphWeights(), "Number of morphs in the pose doesn't match the number of morphs inside the provided input pose."); for (size_t i = 0; i < numMorphs; ++i) { - mMorphWeights[i] -= refPose.mMorphWeights[i]; + m_morphWeights[i] -= refPose.m_morphWeights[i]; } InvalidateAllModelSpaceTransforms(); @@ -1107,36 +1086,36 @@ namespace EMotionFX // additive blend void Pose::BlendAdditiveUsingBindPose(const Pose* destPose, float weight) { - if (mActorInstance) + if (m_actorInstance) { - const TransformData* transformData = mActorInstance->GetTransformData(); + const TransformData* transformData = m_actorInstance->GetTransformData(); Pose* bindPose = transformData->GetBindPose(); Transform result; - const size_t numNodes = mActorInstance->GetNumEnabledNodes(); + const size_t numNodes = m_actorInstance->GetNumEnabledNodes(); for (size_t i = 0; i < numNodes; ++i) { - const uint16 nodeNr = mActorInstance->GetEnabledNode(i); + const uint16 nodeNr = m_actorInstance->GetEnabledNode(i); BlendTransformAdditiveUsingBindPose(bindPose->GetLocalSpaceTransform(nodeNr), GetLocalSpaceTransform(nodeNr), destPose->GetLocalSpaceTransform(nodeNr), weight, &result); SetLocalSpaceTransform(nodeNr, result, false); } // blend the morph weights - const size_t numMorphs = mMorphWeights.GetLength(); - MCORE_ASSERT(mActorInstance->GetMorphSetupInstance()->GetNumMorphTargets() == numMorphs); + const size_t numMorphs = m_morphWeights.GetLength(); + MCORE_ASSERT(m_actorInstance->GetMorphSetupInstance()->GetNumMorphTargets() == numMorphs); MCORE_ASSERT(numMorphs == destPose->GetNumMorphWeights()); for (size_t i = 0; i < numMorphs; ++i) { - mMorphWeights[i] += destPose->mMorphWeights[i] * weight; + m_morphWeights[i] += destPose->m_morphWeights[i] * weight; } } else { - const TransformData* transformData = mActorInstance->GetTransformData(); + const TransformData* transformData = m_actorInstance->GetTransformData(); Pose* bindPose = transformData->GetBindPose(); Transform result; - const size_t numNodes = mActor->GetSkeleton()->GetNumNodes(); + const size_t numNodes = m_actor->GetSkeleton()->GetNumNodes(); for (size_t i = 0; i < numNodes; ++i) { BlendTransformAdditiveUsingBindPose(bindPose->GetLocalSpaceTransform(i), GetLocalSpaceTransform(i), destPose->GetLocalSpaceTransform(i), weight, &result); @@ -1144,12 +1123,12 @@ namespace EMotionFX } // blend the morph weights - const size_t numMorphs = mMorphWeights.GetLength(); - MCORE_ASSERT(mActor->GetMorphSetup(0)->GetNumMorphTargets() == numMorphs); + const size_t numMorphs = m_morphWeights.GetLength(); + MCORE_ASSERT(m_actor->GetMorphSetup(0)->GetNumMorphTargets() == numMorphs); MCORE_ASSERT(numMorphs == destPose->GetNumMorphWeights()); for (size_t i = 0; i < numMorphs; ++i) { - mMorphWeights[i] += destPose->mMorphWeights[i] * weight; + m_morphWeights[i] += destPose->m_morphWeights[i] * weight; } } @@ -1253,11 +1232,11 @@ namespace EMotionFX // compensate for motion extraction, basically making it in-place void Pose::CompensateForMotionExtractionDirect(EMotionExtractionFlags motionExtractionFlags) { - const size_t motionExtractionNodeIndex = mActor->GetMotionExtractionNodeIndex(); + const size_t motionExtractionNodeIndex = m_actor->GetMotionExtractionNodeIndex(); if (motionExtractionNodeIndex != InvalidIndex) { Transform motionExtractionNodeTransform = GetLocalSpaceTransformDirect(motionExtractionNodeIndex); - mActorInstance->MotionExtractionCompensate(motionExtractionNodeTransform, motionExtractionFlags); + m_actorInstance->MotionExtractionCompensate(motionExtractionNodeTransform, motionExtractionFlags); SetLocalSpaceTransformDirect(motionExtractionNodeIndex, motionExtractionNodeTransform); } } @@ -1266,11 +1245,11 @@ namespace EMotionFX // compensate for motion extraction, basically making it in-place void Pose::CompensateForMotionExtraction(EMotionExtractionFlags motionExtractionFlags) { - const size_t motionExtractionNodeIndex = mActor->GetMotionExtractionNodeIndex(); + const size_t motionExtractionNodeIndex = m_actor->GetMotionExtractionNodeIndex(); if (motionExtractionNodeIndex != InvalidIndex) { Transform motionExtractionNodeTransform = GetLocalSpaceTransform(motionExtractionNodeIndex); - mActorInstance->MotionExtractionCompensate(motionExtractionNodeTransform, motionExtractionFlags); + m_actorInstance->MotionExtractionCompensate(motionExtractionNodeTransform, motionExtractionFlags); SetLocalSpaceTransform(motionExtractionNodeIndex, motionExtractionNodeTransform); } } @@ -1279,14 +1258,14 @@ namespace EMotionFX // apply the morph target weights to the morph setup instance of the given actor instance void Pose::ApplyMorphWeightsToActorInstance() { - MorphSetupInstance* morphSetupInstance = mActorInstance->GetMorphSetupInstance(); + MorphSetupInstance* morphSetupInstance = m_actorInstance->GetMorphSetupInstance(); const size_t numMorphs = morphSetupInstance->GetNumMorphTargets(); for (size_t m = 0; m < numMorphs; ++m) { MorphSetupInstance::MorphTarget* morphTarget = morphSetupInstance->GetMorphTarget(m); if (morphTarget->GetIsInManualMode() == false) { - morphTarget->SetWeight(mMorphWeights[m]); + morphTarget->SetWeight(m_morphWeights[m]); } } } @@ -1295,29 +1274,29 @@ namespace EMotionFX // zero all morph weights void Pose::ZeroMorphWeights() { - const size_t numMorphs = mMorphWeights.GetLength(); + const size_t numMorphs = m_morphWeights.GetLength(); for (size_t m = 0; m < numMorphs; ++m) { - mMorphWeights[m] = 0.0f; + m_morphWeights[m] = 0.0f; } } void Pose::ResizeNumMorphs(size_t numMorphTargets) { - mMorphWeights.Resize(numMorphTargets); + m_morphWeights.Resize(numMorphTargets); } Pose& Pose::PreMultiply(const Pose& other) { - AZ_Assert(mLocalSpaceTransforms.GetLength() == other.mLocalSpaceTransforms.GetLength(), "Poses must be of the same size"); - if (mActorInstance) + AZ_Assert(m_localSpaceTransforms.GetLength() == other.m_localSpaceTransforms.GetLength(), "Poses must be of the same size"); + if (m_actorInstance) { - const size_t numNodes = mActorInstance->GetNumEnabledNodes(); + const size_t numNodes = m_actorInstance->GetNumEnabledNodes(); for (size_t i = 0; i < numNodes; ++i) { - const uint16 nodeNr = mActorInstance->GetEnabledNode(i); + const uint16 nodeNr = m_actorInstance->GetEnabledNode(i); Transform& transform = const_cast(GetLocalSpaceTransform(nodeNr)); Transform otherTransform = other.GetLocalSpaceTransform(nodeNr); transform = otherTransform * transform; @@ -1325,7 +1304,7 @@ namespace EMotionFX } else { - const size_t numNodes = mLocalSpaceTransforms.GetLength(); + const size_t numNodes = m_localSpaceTransforms.GetLength(); for (size_t i = 0; i < numNodes; ++i) { Transform& transform = const_cast(GetLocalSpaceTransform(i)); @@ -1341,20 +1320,20 @@ namespace EMotionFX Pose& Pose::Multiply(const Pose& other) { - AZ_Assert(mLocalSpaceTransforms.GetLength() == other.mLocalSpaceTransforms.GetLength(), "Poses must be of the same size"); - if (mActorInstance) + AZ_Assert(m_localSpaceTransforms.GetLength() == other.m_localSpaceTransforms.GetLength(), "Poses must be of the same size"); + if (m_actorInstance) { - const size_t numNodes = mActorInstance->GetNumEnabledNodes(); + const size_t numNodes = m_actorInstance->GetNumEnabledNodes(); for (size_t i = 0; i < numNodes; ++i) { - uint16 nodeNr = mActorInstance->GetEnabledNode(i); + uint16 nodeNr = m_actorInstance->GetEnabledNode(i); Transform& transform = const_cast(GetLocalSpaceTransform(nodeNr)); transform.Multiply(other.GetLocalSpaceTransform(nodeNr)); } } else { - const size_t numNodes = mLocalSpaceTransforms.GetLength(); + const size_t numNodes = m_localSpaceTransforms.GetLength(); for (size_t i = 0; i < numNodes; ++i) { Transform& transform = const_cast(GetLocalSpaceTransform(i)); @@ -1369,13 +1348,13 @@ namespace EMotionFX Pose& Pose::MultiplyInverse(const Pose& other) { - AZ_Assert(mLocalSpaceTransforms.GetLength() == other.mLocalSpaceTransforms.GetLength(), "Poses must be of the same size"); - if (mActorInstance) + AZ_Assert(m_localSpaceTransforms.GetLength() == other.m_localSpaceTransforms.GetLength(), "Poses must be of the same size"); + if (m_actorInstance) { - const size_t numNodes = mActorInstance->GetNumEnabledNodes(); + const size_t numNodes = m_actorInstance->GetNumEnabledNodes(); for (size_t i = 0; i < numNodes; ++i) { - uint16 nodeNr = mActorInstance->GetEnabledNode(i); + uint16 nodeNr = m_actorInstance->GetEnabledNode(i); Transform& transform = const_cast(GetLocalSpaceTransform(nodeNr)); Transform otherTransform = other.GetLocalSpaceTransform(nodeNr); otherTransform.Inverse(); @@ -1384,7 +1363,7 @@ namespace EMotionFX } else { - const size_t numNodes = mLocalSpaceTransforms.GetLength(); + const size_t numNodes = m_localSpaceTransforms.GetLength(); for (size_t i = 0; i < numNodes; ++i) { Transform& transform = const_cast(GetLocalSpaceTransform(i)); @@ -1401,15 +1380,15 @@ namespace EMotionFX Transform Pose::GetMeshNodeWorldSpaceTransform(size_t lodLevel, size_t nodeIndex) const { - if (!mActorInstance) + if (!m_actorInstance) { return Transform::CreateIdentity(); } - Actor* actor = mActorInstance->GetActor(); + Actor* actor = m_actorInstance->GetActor(); if (actor->CheckIfHasSkinningDeformer(lodLevel, nodeIndex)) { - return mActorInstance->GetWorldSpaceTransform(); + return m_actorInstance->GetWorldSpaceTransform(); } return GetWorldSpaceTransform(nodeIndex); @@ -1419,21 +1398,21 @@ namespace EMotionFX void Pose::Mirror(const MotionLinkData* motionLinkData) { AZ_Assert(motionLinkData, "Expecting valid motionLinkData pointer."); - AZ_Assert(mActorInstance, "Mirroring is only possible in combination with an actor instance."); + AZ_Assert(m_actorInstance, "Mirroring is only possible in combination with an actor instance."); - const Actor* actor = mActorInstance->GetActor(); - const TransformData* transformData = mActorInstance->GetTransformData(); + const Actor* actor = m_actorInstance->GetActor(); + const TransformData* transformData = m_actorInstance->GetTransformData(); const Pose* bindPose = transformData->GetBindPose(); const AZStd::vector& jointLinks = motionLinkData->GetJointDataLinks(); - AnimGraphPose* tempPose = GetEMotionFX().GetThreadData(mActorInstance->GetThreadIndex())->GetPosePool().RequestPose(mActorInstance); + AnimGraphPose* tempPose = GetEMotionFX().GetThreadData(m_actorInstance->GetThreadIndex())->GetPosePool().RequestPose(m_actorInstance); Pose& unmirroredPose = tempPose->GetPose(); unmirroredPose = *this; - const size_t numNodes = mActorInstance->GetNumEnabledNodes(); + const size_t numNodes = m_actorInstance->GetNumEnabledNodes(); for (size_t i = 0; i < numNodes; ++i) { - const size_t nodeNumber = mActorInstance->GetEnabledNode(i); + const size_t nodeNumber = m_actorInstance->GetEnabledNode(i); const size_t jointDataIndex = jointLinks[nodeNumber]; if (jointDataIndex == InvalidIndex) { @@ -1444,12 +1423,12 @@ namespace EMotionFX Transform mirrored = bindPose->GetLocalSpaceTransform(nodeNumber); AZ::Vector3 mirrorAxis = AZ::Vector3::CreateZero(); - mirrorAxis.SetElement(mirrorInfo.mAxis, 1.0f); - mirrored.ApplyDeltaMirrored(bindPose->GetLocalSpaceTransform(mirrorInfo.mSourceNode), unmirroredPose.GetLocalSpaceTransform(mirrorInfo.mSourceNode), mirrorAxis, mirrorInfo.mFlags); + mirrorAxis.SetElement(mirrorInfo.m_axis, 1.0f); + mirrored.ApplyDeltaMirrored(bindPose->GetLocalSpaceTransform(mirrorInfo.m_sourceNode), unmirroredPose.GetLocalSpaceTransform(mirrorInfo.m_sourceNode), mirrorAxis, mirrorInfo.m_flags); SetLocalSpaceTransformDirect(nodeNumber, mirrored); } - GetEMotionFX().GetThreadData(mActorInstance->GetThreadIndex())->GetPosePool().FreePose(tempPose); + GetEMotionFX().GetThreadData(m_actorInstance->GetThreadIndex())->GetPosePool().FreePose(tempPose); } } // namespace EMotionFX diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/Pose.h b/Gems/EMotionFX/Code/EMotionFX/Source/Pose.h index 58dcb59ee4..32c7a33bd2 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/Pose.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/Pose.h @@ -87,7 +87,7 @@ namespace EMotionFX * The difference between using GetWorldSpaceTransform directly from the current pose is that this looks whether the mesh is skinned or not. * Right now we handle skinned meshes differently. This will change in the future. Skinned meshes will always return an identity transform and therefore act like they cannot be animated. * This requires the pose to be linked to an actor instance. If this is not the case, identity transform is returned. - * @param The LOD level, which must be in range of 0..mActor->GetNumLODLevels(). + * @param The LOD level, which must be in range of 0..m_actor->GetNumLODLevels(). * @param nodeIndex The index of the node. If this node happens to have no mesh the regular current world space transform is returned. */ Transform GetMeshNodeWorldSpaceTransform(size_t lodLevel, size_t nodeIndex) const; @@ -98,25 +98,25 @@ namespace EMotionFX Transform CalcTrajectoryTransform() const; - MCORE_INLINE const Transform* GetLocalSpaceTransforms() const { return mLocalSpaceTransforms.GetReadPtr(); } - MCORE_INLINE const Transform* GetModelSpaceTransforms() const { return mModelSpaceTransforms.GetReadPtr(); } - MCORE_INLINE size_t GetNumTransforms() const { return mLocalSpaceTransforms.GetLength(); } - MCORE_INLINE const ActorInstance* GetActorInstance() const { return mActorInstance; } - MCORE_INLINE const Actor* GetActor() const { return mActor; } - MCORE_INLINE const Skeleton* GetSkeleton() const { return mSkeleton; } + MCORE_INLINE const Transform* GetLocalSpaceTransforms() const { return m_localSpaceTransforms.GetReadPtr(); } + MCORE_INLINE const Transform* GetModelSpaceTransforms() const { return m_modelSpaceTransforms.GetReadPtr(); } + MCORE_INLINE size_t GetNumTransforms() const { return m_localSpaceTransforms.GetLength(); } + MCORE_INLINE const ActorInstance* GetActorInstance() const { return m_actorInstance; } + MCORE_INLINE const Actor* GetActor() const { return m_actor; } + MCORE_INLINE const Skeleton* GetSkeleton() const { return m_skeleton; } - MCORE_INLINE Transform& GetLocalSpaceTransformDirect(size_t nodeIndex) { return mLocalSpaceTransforms[nodeIndex]; } - MCORE_INLINE Transform& GetModelSpaceTransformDirect(size_t nodeIndex) { return mModelSpaceTransforms[nodeIndex]; } - MCORE_INLINE const Transform& GetLocalSpaceTransformDirect(size_t nodeIndex) const { return mLocalSpaceTransforms[nodeIndex]; } - MCORE_INLINE const Transform& GetModelSpaceTransformDirect(size_t nodeIndex) const { return mModelSpaceTransforms[nodeIndex]; } - MCORE_INLINE void SetLocalSpaceTransformDirect(size_t nodeIndex, const Transform& transform){ mLocalSpaceTransforms[nodeIndex] = transform; mFlags[nodeIndex] |= FLAG_LOCALTRANSFORMREADY; } - MCORE_INLINE void SetModelSpaceTransformDirect(size_t nodeIndex, const Transform& transform){ mModelSpaceTransforms[nodeIndex] = transform; mFlags[nodeIndex] |= FLAG_MODELTRANSFORMREADY; } - MCORE_INLINE void InvalidateLocalSpaceTransform(size_t nodeIndex) { mFlags[nodeIndex] &= ~FLAG_LOCALTRANSFORMREADY; } - MCORE_INLINE void InvalidateModelSpaceTransform(size_t nodeIndex) { mFlags[nodeIndex] &= ~FLAG_MODELTRANSFORMREADY; } + MCORE_INLINE Transform& GetLocalSpaceTransformDirect(size_t nodeIndex) { return m_localSpaceTransforms[nodeIndex]; } + MCORE_INLINE Transform& GetModelSpaceTransformDirect(size_t nodeIndex) { return m_modelSpaceTransforms[nodeIndex]; } + MCORE_INLINE const Transform& GetLocalSpaceTransformDirect(size_t nodeIndex) const { return m_localSpaceTransforms[nodeIndex]; } + MCORE_INLINE const Transform& GetModelSpaceTransformDirect(size_t nodeIndex) const { return m_modelSpaceTransforms[nodeIndex]; } + MCORE_INLINE void SetLocalSpaceTransformDirect(size_t nodeIndex, const Transform& transform){ m_localSpaceTransforms[nodeIndex] = transform; m_flags[nodeIndex] |= FLAG_LOCALTRANSFORMREADY; } + MCORE_INLINE void SetModelSpaceTransformDirect(size_t nodeIndex, const Transform& transform){ m_modelSpaceTransforms[nodeIndex] = transform; m_flags[nodeIndex] |= FLAG_MODELTRANSFORMREADY; } + MCORE_INLINE void InvalidateLocalSpaceTransform(size_t nodeIndex) { m_flags[nodeIndex] &= ~FLAG_LOCALTRANSFORMREADY; } + MCORE_INLINE void InvalidateModelSpaceTransform(size_t nodeIndex) { m_flags[nodeIndex] &= ~FLAG_MODELTRANSFORMREADY; } - MCORE_INLINE void SetMorphWeight(size_t index, float weight) { mMorphWeights[index] = weight; } - MCORE_INLINE float GetMorphWeight(size_t index) const { return mMorphWeights[index]; } - MCORE_INLINE size_t GetNumMorphWeights() const { return mMorphWeights.GetLength(); } + MCORE_INLINE void SetMorphWeight(size_t index, float weight) { m_morphWeights[index] = weight; } + MCORE_INLINE float GetMorphWeight(size_t index) const { return m_morphWeights[index]; } + MCORE_INLINE size_t GetNumMorphWeights() const { return m_morphWeights.GetLength(); } void ResizeNumMorphs(size_t numMorphTargets); /** @@ -168,8 +168,8 @@ namespace EMotionFX Pose& operator=(const Pose& other); - MCORE_INLINE uint8 GetFlags(size_t nodeIndex) const { return mFlags[nodeIndex]; } - MCORE_INLINE void SetFlags(size_t nodeIndex, uint8 flags) { mFlags[nodeIndex] = flags; } + MCORE_INLINE uint8 GetFlags(size_t nodeIndex) const { return m_flags[nodeIndex]; } + MCORE_INLINE void SetFlags(size_t nodeIndex, uint8 flags) { m_flags[nodeIndex] = flags; } bool HasPoseData(const AZ::TypeId& typeId) const; PoseData* GetPoseDataByType(const AZ::TypeId& typeId) const; @@ -193,14 +193,14 @@ namespace EMotionFX T* GetAndPreparePoseData(ActorInstance* linkToActorInstance) { return azdynamic_cast(GetAndPreparePoseData(azrtti_typeid(), linkToActorInstance)); } private: - mutable MCore::AlignedArray mLocalSpaceTransforms; - mutable MCore::AlignedArray mModelSpaceTransforms; - mutable MCore::AlignedArray mFlags; + mutable MCore::AlignedArray m_localSpaceTransforms; + mutable MCore::AlignedArray m_modelSpaceTransforms; + mutable MCore::AlignedArray m_flags; AZStd::unordered_map > m_poseDatas; - MCore::AlignedArray mMorphWeights; /**< The morph target weights. */ - const ActorInstance* mActorInstance; - const Actor* mActor; - const Skeleton* mSkeleton; + MCore::AlignedArray m_morphWeights; /**< The morph target weights. */ + const ActorInstance* m_actorInstance; + const Actor* m_actor; + const Skeleton* m_skeleton; void RecursiveInvalidateModelSpaceTransforms(const Actor* actor, size_t nodeIndex); diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/PoseDataRagdoll.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/PoseDataRagdoll.cpp index e5c3aa7d8c..1d53b4961d 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/PoseDataRagdoll.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/PoseDataRagdoll.cpp @@ -94,8 +94,8 @@ namespace EMotionFX if (nodeState.m_simulationType == Physics::SimulationType::Kinematic && destNodeState.m_simulationType == Physics::SimulationType::Dynamic) { - nodeState.m_position = jointTransform.mPosition.Lerp(destNodeState.m_position, weight); - nodeState.m_orientation = jointTransform.mRotation.NLerp(destNodeState.m_orientation, weight); + nodeState.m_position = jointTransform.m_position.Lerp(destNodeState.m_position, weight); + nodeState.m_orientation = jointTransform.m_rotation.NLerp(destNodeState.m_orientation, weight); // We're blending from a kinematic to a dynamic joint, which means when starting the blend we know that the animation pose matches the ragdoll pose. // The closest a powered ragdoll joint can be to its target pose and thus matching the kinematic one is by using its maximum strength. @@ -114,8 +114,8 @@ namespace EMotionFX else if (nodeState.m_simulationType == Physics::SimulationType::Dynamic && destNodeState.m_simulationType == Physics::SimulationType::Kinematic) { - nodeState.m_position = nodeState.m_position.Lerp(destJointTransform.mPosition, weight); - nodeState.m_orientation = nodeState.m_orientation.NLerp(destJointTransform.mRotation, weight); + nodeState.m_position = nodeState.m_position.Lerp(destJointTransform.m_position, weight); + nodeState.m_orientation = nodeState.m_orientation.NLerp(destJointTransform.m_rotation, weight); // Inverse way here. Blending towards the maximum strength possible to make sure we're as close as possible to the target pose when switching simulation // state to kinematic. diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/RagdollInstance.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/RagdollInstance.cpp index 87221c0bd2..c7da3430b1 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/RagdollInstance.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/RagdollInstance.cpp @@ -333,12 +333,12 @@ namespace EMotionFX void RagdollInstance::GetWorldSpaceTransform(const Pose* pose, size_t jointIndex, AZ::Vector3& outPosition, AZ::Quaternion& outRotation) { const Transform& globalTransform = pose->GetModelSpaceTransform(jointIndex); - const AZ::Quaternion actorInstanceRotation = m_actorInstance->GetLocalSpaceTransform().mRotation; - const AZ::Vector3& actorInstanceTranslation = m_actorInstance->GetLocalSpaceTransform().mPosition; + const AZ::Quaternion actorInstanceRotation = m_actorInstance->GetLocalSpaceTransform().m_rotation; + const AZ::Vector3& actorInstanceTranslation = m_actorInstance->GetLocalSpaceTransform().m_position; // Calculate the world space position and rotation (The actor instance position and rotation equal the entity transform). - outPosition = actorInstanceRotation.TransformVector(globalTransform.mPosition) + actorInstanceTranslation; - outRotation = actorInstanceRotation * globalTransform.mRotation; + outPosition = actorInstanceRotation.TransformVector(globalTransform.m_position) + actorInstanceTranslation; + outRotation = actorInstanceRotation * globalTransform.m_rotation; } void RagdollInstance::ReadRagdollStateFromActorInstance(Physics::RagdollState& outRagdollState, AZ::Vector3& outRagdollPos, AZ::Quaternion& outRagdollRot) @@ -349,8 +349,8 @@ namespace EMotionFX const Skeleton* skeleton = actor->GetSkeleton(); const Pose* currentPose = m_actorInstance->GetTransformData()->GetCurrentPose(); - const AZ::Quaternion& actorInstanceRotation = m_actorInstance->GetLocalSpaceTransform().mRotation; - const AZ::Vector3& actorInstanceTranslation = m_actorInstance->GetLocalSpaceTransform().mPosition; + const AZ::Quaternion& actorInstanceRotation = m_actorInstance->GetLocalSpaceTransform().m_rotation; + const AZ::Vector3& actorInstanceTranslation = m_actorInstance->GetLocalSpaceTransform().m_position; const size_t ragdollNodeCount = m_ragdoll->GetNumNodes(); outRagdollState.resize(ragdollNodeCount); @@ -371,14 +371,14 @@ namespace EMotionFX { // Calculate the ragdoll world space position and rotation from the ragdoll root node representative in the animation skeleton (e.g. the Pelvis). const Transform& globalTransform = currentPose->GetModelSpaceTransform(m_ragdollRootJoint->GetNodeIndex()); - outRagdollPos = actorInstanceRotation.TransformVector(globalTransform.mPosition) + actorInstanceTranslation; - outRagdollRot = actorInstanceRotation * globalTransform.mRotation; + outRagdollPos = actorInstanceRotation.TransformVector(globalTransform.m_position) + actorInstanceTranslation; + outRagdollRot = actorInstanceRotation * globalTransform.m_rotation; } else { AZ_Assert(false, "Expected valid ragdoll root node. Either the ragdoll root node does not exist in the animation skeleton or the ragdoll is empty."); - outRagdollPos = m_actorInstance->GetLocalSpaceTransform().mPosition; - outRagdollRot = m_actorInstance->GetLocalSpaceTransform().mRotation; + outRagdollPos = m_actorInstance->GetLocalSpaceTransform().m_position; + outRagdollRot = m_actorInstance->GetLocalSpaceTransform().m_rotation; } } @@ -512,8 +512,8 @@ namespace EMotionFX drawLine(currentParentPos, simulatedColor, currentPos, simulatedColor, defaultLineThickness); // Render target pose - const AZ::Vector3& targetPos = targetPose.GetWorldSpaceTransform(jointIndex).mPosition; - const AZ::Vector3& targetParentPos = targetPose.GetWorldSpaceTransform(ragdollParentJoint->GetNodeIndex()).mPosition; + const AZ::Vector3& targetPos = targetPose.GetWorldSpaceTransform(jointIndex).m_position; + const AZ::Vector3& targetParentPos = targetPose.GetWorldSpaceTransform(ragdollParentJoint->GetNodeIndex()).m_position; drawLine(targetParentPos, simulatedTargetColor, targetPos, simulatedTargetColor, targetLineThickness); } else diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/Recorder.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/Recorder.cpp index 3eb32f24ce..085d164a94 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/Recorder.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/Recorder.cpp @@ -48,10 +48,10 @@ namespace EMotionFX serializeContext->Class() ->Version(1) - ->Field("positions", &Recorder::TransformTracks::mPositions) - ->Field("rotations", &Recorder::TransformTracks::mRotations) + ->Field("positions", &Recorder::TransformTracks::m_positions) + ->Field("rotations", &Recorder::TransformTracks::m_rotations) #ifndef EMFX_SCALE_DISABLED - ->Field("scales", &Recorder::TransformTracks::mScales) + ->Field("scales", &Recorder::TransformTracks::m_scales) #endif ; } @@ -80,27 +80,27 @@ namespace EMotionFX serializeContext->Class() ->Version(1) - ->Field("fps", &Recorder::RecordSettings::mFPS) - ->Field("recordTransforms", &Recorder::RecordSettings::mRecordTransforms) - ->Field("recordNodeHistory", &Recorder::RecordSettings::mRecordNodeHistory) - ->Field("historyStatesOnly", &Recorder::RecordSettings::mHistoryStatesOnly) - ->Field("recordAnimGraphStates", &Recorder::RecordSettings::mRecordAnimGraphStates) - ->Field("recordEvents", &Recorder::RecordSettings::mRecordEvents) - ->Field("recordScale", &Recorder::RecordSettings::mRecordScale) - ->Field("recordMorphs", &Recorder::RecordSettings::mRecordMorphs) - ->Field("interpolate", &Recorder::RecordSettings::mInterpolate) + ->Field("fps", &Recorder::RecordSettings::m_fps) + ->Field("recordTransforms", &Recorder::RecordSettings::m_recordTransforms) + ->Field("recordNodeHistory", &Recorder::RecordSettings::m_recordNodeHistory) + ->Field("historyStatesOnly", &Recorder::RecordSettings::m_historyStatesOnly) + ->Field("recordAnimGraphStates", &Recorder::RecordSettings::m_recordAnimGraphStates) + ->Field("recordEvents", &Recorder::RecordSettings::m_recordEvents) + ->Field("recordScale", &Recorder::RecordSettings::m_recordScale) + ->Field("recordMorphs", &Recorder::RecordSettings::m_recordMorphs) + ->Field("interpolate", &Recorder::RecordSettings::m_interpolate) ; } Recorder::Recorder() : BaseObject() { - mIsInPlayMode = false; - mIsRecording = false; - mAutoPlay = false; - mRecordTime = 0.0f; - mLastRecordTime = 0.0f; - mCurrentPlayTime = 0.0f; + m_isInPlayMode = false; + m_isRecording = false; + m_autoPlay = false; + m_recordTime = 0.0f; + m_lastRecordTime = 0.0f; + m_currentPlayTime = 0.0f; EMotionFX::ActorInstanceNotificationBus::Handler::BusConnect(); } @@ -133,30 +133,30 @@ namespace EMotionFX ->Version(1) ->Field("actorInstanceDatas", &Recorder::m_actorInstanceDatas) ->Field("timeDeltas", &Recorder::m_timeDeltas) - ->Field("settings", &Recorder::mRecordSettings) + ->Field("settings", &Recorder::m_recordSettings) ; } // enable or disable auto play mode void Recorder::SetAutoPlay(bool enabled) { - mAutoPlay = enabled; + m_autoPlay = enabled; } // set the current play time void Recorder::SetCurrentPlayTime(float timeInSeconds) { - mCurrentPlayTime = timeInSeconds; + m_currentPlayTime = timeInSeconds; - if (mCurrentPlayTime < 0.0f) + if (m_currentPlayTime < 0.0f) { - mCurrentPlayTime = 0.0f; + m_currentPlayTime = 0.0f; } - if (mCurrentPlayTime > mRecordTime) + if (m_currentPlayTime > m_recordTime) { - mCurrentPlayTime = mRecordTime; + m_currentPlayTime = m_recordTime; } } @@ -165,21 +165,21 @@ namespace EMotionFX void Recorder::StartPlayBack() { StopRecording(); - mIsInPlayMode = true; + m_isInPlayMode = true; } // stop playback mode void Recorder::StopPlayBack() { - mIsInPlayMode = false; + m_isInPlayMode = false; } // rewind the playback void Recorder::Rewind() { - mCurrentPlayTime = 0.0f; + m_currentPlayTime = 0.0f; } bool Recorder::HasRecording() const @@ -192,13 +192,13 @@ namespace EMotionFX { Lock(); - mIsInPlayMode = false; - mIsRecording = false; - mAutoPlay = false; - mRecordTime = 0.0f; - mLastRecordTime = 0.0f; - mCurrentPlayTime = 0.0f; - mRecordSettings.m_actorInstances.clear(); + m_isInPlayMode = false; + m_isRecording = false; + m_autoPlay = false; + m_recordTime = 0.0f; + m_lastRecordTime = 0.0f; + m_currentPlayTime = 0.0f; + m_recordSettings.m_actorInstances.clear(); m_timeDeltas.clear(); // delete all actor instance datas @@ -225,18 +225,18 @@ namespace EMotionFX m_sessionUuid = AZ::Uuid::Create(); // we are recording again - mRecordSettings = settings; - mIsRecording = true; + m_recordSettings = settings; + m_isRecording = true; // Add all actor instances if we did not specify them explicitly. - if (mRecordSettings.m_actorInstances.empty()) + if (m_recordSettings.m_actorInstances.empty()) { const size_t numActorInstances = GetActorManager().GetNumActorInstances(); - mRecordSettings.m_actorInstances.resize(numActorInstances); + m_recordSettings.m_actorInstances.resize(numActorInstances); for (size_t i = 0; i < numActorInstances; ++i) { ActorInstance* actorInstance = GetActorManager().GetActorInstance(i); - mRecordSettings.m_actorInstances[i] = actorInstance; + m_recordSettings.m_actorInstances[i] = actorInstance; } } @@ -255,9 +255,9 @@ namespace EMotionFX void Recorder::UpdatePlayMode(float timeDelta) { // increase the playtime if we are in automatic play mode and playback is enabled - if (mIsInPlayMode && mAutoPlay) + if (m_isInPlayMode && m_autoPlay) { - SetCurrentPlayTime(mCurrentPlayTime + timeDelta); + SetCurrentPlayTime(m_currentPlayTime + timeDelta); } } @@ -268,18 +268,18 @@ namespace EMotionFX Lock(); // if we are not recording there is nothing to do - if (mIsRecording == false) + if (m_isRecording == false) { Unlock(); return; } // increase the time we record - mRecordTime += timeDelta; + m_recordTime += timeDelta; // save a sample when more time passed than the desired sample rate - const float sampleRate = 1.0f / (float)mRecordSettings.mFPS; - if (mRecordTime - mLastRecordTime >= sampleRate) + const float sampleRate = 1.0f / (float)m_recordSettings.m_fps; + if (m_recordTime - m_lastRecordTime >= sampleRate) { RecordCurrentFrame(timeDelta); } @@ -296,7 +296,7 @@ namespace EMotionFX Lock(); } - mIsRecording = false; + m_isRecording = false; FinalizeAllNodeHistoryItems(); if (lock) @@ -309,7 +309,7 @@ namespace EMotionFX // prepare for recording by resizing and preallocating space/arrays void Recorder::PrepareForRecording() { - const size_t numActorInstances = mRecordSettings.m_actorInstances.size(); + const size_t numActorInstances = m_recordSettings.m_actorInstances.size(); m_actorInstanceDatas.resize(numActorInstances); for (size_t i = 0; i < numActorInstances; ++i) { @@ -317,54 +317,54 @@ namespace EMotionFX ActorInstanceData& actorInstanceData = *m_actorInstanceDatas[i]; // link it to the right actor instance - ActorInstance* actorInstance = mRecordSettings.m_actorInstances[i]; - actorInstanceData.mActorInstance = actorInstance; + ActorInstance* actorInstance = m_recordSettings.m_actorInstances[i]; + actorInstanceData.m_actorInstance = actorInstance; // add the transform tracks - if (mRecordSettings.mRecordTransforms) + if (m_recordSettings.m_recordTransforms) { // for all nodes in the actor instance const size_t numNodes = actorInstance->GetNumNodes(); actorInstanceData.m_transformTracks.resize(numNodes); for (size_t n = 0; n < numNodes; ++n) { - actorInstanceData.m_transformTracks[n].mPositions.Reserve(mRecordSettings.mNumPreAllocTransformKeys); - actorInstanceData.m_transformTracks[n].mRotations.Reserve(mRecordSettings.mNumPreAllocTransformKeys); + actorInstanceData.m_transformTracks[n].m_positions.Reserve(m_recordSettings.m_numPreAllocTransformKeys); + actorInstanceData.m_transformTracks[n].m_rotations.Reserve(m_recordSettings.m_numPreAllocTransformKeys); EMFX_SCALECODE ( - if (mRecordSettings.mRecordScale) + if (m_recordSettings.m_recordScale) { - actorInstanceData.m_transformTracks[n].mScales.Reserve(mRecordSettings.mNumPreAllocTransformKeys); + actorInstanceData.m_transformTracks[n].m_scales.Reserve(m_recordSettings.m_numPreAllocTransformKeys); } ) } } // if recording transforms // if recording morph targets, resize the morphs array - if (mRecordSettings.mRecordMorphs) + if (m_recordSettings.m_recordMorphs) { const size_t numMorphs = actorInstance->GetMorphSetupInstance()->GetNumMorphTargets(); - actorInstanceData.mMorphTracks.resize(numMorphs); + actorInstanceData.m_morphTracks.resize(numMorphs); for (size_t m = 0; m < numMorphs; ++m) { - actorInstanceData.mMorphTracks[m].Reserve(256); + actorInstanceData.m_morphTracks[m].Reserve(256); } } // add the animgraph data - if (mRecordSettings.mRecordAnimGraphStates) + if (m_recordSettings.m_recordAnimGraphStates) { if (actorInstance->GetAnimGraphInstance()) { - actorInstanceData.mAnimGraphData = new AnimGraphInstanceData(); - actorInstanceData.mAnimGraphData->mAnimGraphInstance = actorInstance->GetAnimGraphInstance(); - if (mRecordSettings.mInitialAnimGraphAnimBytes > 0) + actorInstanceData.m_animGraphData = new AnimGraphInstanceData(); + actorInstanceData.m_animGraphData->m_animGraphInstance = actorInstance->GetAnimGraphInstance(); + if (m_recordSettings.m_initialAnimGraphAnimBytes > 0) { - actorInstanceData.mAnimGraphData->mDataBuffer = (uint8*)MCore::Allocate(mRecordSettings.mInitialAnimGraphAnimBytes, EMFX_MEMCATEGORY_RECORDER); + actorInstanceData.m_animGraphData->m_dataBuffer = (uint8*)MCore::Allocate(m_recordSettings.m_initialAnimGraphAnimBytes, EMFX_MEMCATEGORY_RECORDER); } - actorInstanceData.mAnimGraphData->mDataBufferSize = mRecordSettings.mInitialAnimGraphAnimBytes; + actorInstanceData.m_animGraphData->m_dataBufferSize = m_recordSettings.m_initialAnimGraphAnimBytes; } } // if recording animgraphs } // for all actor instances @@ -381,7 +381,7 @@ namespace EMotionFX { for (ActorInstanceData* actorInstanceData : m_actorInstanceDatas) { - const ActorInstance* actorInstance = actorInstanceData->mActorInstance; + const ActorInstance* actorInstance = actorInstanceData->m_actorInstance; if (actorInstanceData->m_transformTracks.empty()) { continue; @@ -390,12 +390,12 @@ namespace EMotionFX const size_t numNodes = actorInstance->GetNumNodes(); for (size_t n = 0; n < numNodes; ++n) { - actorInstanceData->m_transformTracks[n].mPositions.Shrink(); - actorInstanceData->m_transformTracks[n].mRotations.Shrink(); + actorInstanceData->m_transformTracks[n].m_positions.Shrink(); + actorInstanceData->m_transformTracks[n].m_rotations.Shrink(); EMFX_SCALECODE ( - actorInstanceData->m_transformTracks[n].mScales.Shrink(); + actorInstanceData->m_transformTracks[n].m_scales.Shrink(); ) } } @@ -424,13 +424,13 @@ namespace EMotionFX m_timeDeltas.emplace_back(timeDelta); // record the current transforms - if (mRecordSettings.mRecordTransforms) + if (m_recordSettings.m_recordTransforms) { RecordCurrentTransforms(); } // record the current anim graph states - if (mRecordSettings.mRecordAnimGraphStates) + if (m_recordSettings.m_recordAnimGraphStates) { if (!RecordCurrentAnimGraphStates()) { @@ -444,25 +444,25 @@ namespace EMotionFX RecordMainLocalTransforms(); // record morphs - if (mRecordSettings.mRecordMorphs) + if (m_recordSettings.m_recordMorphs) { RecordMorphs(); } // update (while recording) the node history items - if (mRecordSettings.mRecordNodeHistory) + if (m_recordSettings.m_recordNodeHistory) { UpdateNodeHistoryItems(); } // recordo the events - if (mRecordSettings.mRecordEvents) + if (m_recordSettings.m_recordEvents) { RecordEvents(); } // update the last record time - mLastRecordTime = mRecordTime; + m_lastRecordTime = m_recordTime; } @@ -474,13 +474,13 @@ namespace EMotionFX for (size_t i = 0; i < numActorInstances; ++i) { ActorInstanceData& actorInstanceData = *m_actorInstanceDatas[i]; - ActorInstance* actorInstance = actorInstanceData.mActorInstance; + ActorInstance* actorInstance = actorInstanceData.m_actorInstance; const size_t numMorphs = actorInstance->GetMorphSetupInstance()->GetNumMorphTargets(); for (size_t m = 0; m < numMorphs; ++m) { - KeyTrackLinearDynamic& morphTrack = actorInstanceData.mMorphTracks[i]; // morph animation data - morphTrack.AddKey(mRecordTime, actorInstance->GetMorphSetupInstance()->GetMorphTarget(i)->GetWeight()); + KeyTrackLinearDynamic& morphTrack = actorInstanceData.m_morphTracks[i]; // morph animation data + morphTrack.AddKey(m_recordTime, actorInstance->GetMorphSetupInstance()->GetMorphTarget(i)->GetWeight()); } } } @@ -492,13 +492,13 @@ namespace EMotionFX // for all actor instances for (ActorInstanceData* actorInstanceData : m_actorInstanceDatas) { - ActorInstance* actorInstance = actorInstanceData->mActorInstance; + ActorInstance* actorInstance = actorInstanceData->m_actorInstance; const Transform& transform = actorInstance->GetLocalSpaceTransform(); #ifndef EMFX_SCALE_DISABLED - AddTransformKey(actorInstanceData->mActorLocalTransform, transform.mPosition, transform.mRotation, transform.mScale); + AddTransformKey(actorInstanceData->m_actorLocalTransform, transform.m_position, transform.m_rotation, transform.m_scale); #else - AddTransformKey(actorInstanceData->mActorLocalTransform, transform.mPosition, transform.mRotation, AZ::Vector3(1.0f, 1.0f, 1.0f)); + AddTransformKey(actorInstanceData->m_actorLocalTransform, transform.m_position, transform.m_rotation, AZ::Vector3(1.0f, 1.0f, 1.0f)); #endif } } @@ -509,7 +509,7 @@ namespace EMotionFX { for (ActorInstanceData* actorInstanceData : m_actorInstanceDatas) { - ActorInstance* actorInstance = actorInstanceData->mActorInstance; + ActorInstance* actorInstance = actorInstanceData->m_actorInstance; const TransformData* transformData = actorInstance->GetTransformData(); { @@ -519,9 +519,9 @@ namespace EMotionFX const Transform& localTransform = transformData->GetCurrentPose()->GetLocalSpaceTransform(n); #ifndef EMFX_SCALE_DISABLED - AddTransformKey(actorInstanceData->m_transformTracks[n], localTransform.mPosition, localTransform.mRotation, localTransform.mScale); + AddTransformKey(actorInstanceData->m_transformTracks[n], localTransform.m_position, localTransform.m_rotation, localTransform.m_scale); #else - AddTransformKey(actorInstanceData->m_transformTracks[n], localTransform.mPosition, localTransform.mRotation, AZ::Vector3(1.0f, 1.0f, 1.0f)); + AddTransformKey(actorInstanceData->m_transformTracks[n], localTransform.m_position, localTransform.m_rotation, AZ::Vector3(1.0f, 1.0f, 1.0f)); #endif } } @@ -535,43 +535,43 @@ namespace EMotionFX // for all actor instances for (const ActorInstanceData* actorInstanceData : m_actorInstanceDatas) { - if (actorInstanceData->mAnimGraphData == nullptr) + if (actorInstanceData->m_animGraphData == nullptr) { continue; } { // get some shortcuts - AnimGraphInstanceData& animGraphInstanceData = *actorInstanceData->mAnimGraphData; - AnimGraphInstance* animGraphInstance = animGraphInstanceData.mAnimGraphInstance; + AnimGraphInstanceData& animGraphInstanceData = *actorInstanceData->m_animGraphData; + AnimGraphInstance* animGraphInstance = animGraphInstanceData.m_animGraphInstance; const AnimGraph* animGraph = animGraphInstance->GetAnimGraph(); // add a new frame - AZStd::vector& frames = animGraphInstanceData.mFrames; + AZStd::vector& frames = animGraphInstanceData.m_frames; if (!frames.empty()) { - const size_t byteOffset = frames.back().mByteOffset + frames.back().mNumBytes; + const size_t byteOffset = frames.back().m_byteOffset + frames.back().m_numBytes; frames.emplace_back(); - frames.back().mByteOffset = byteOffset; - frames.back().mNumBytes = 0; + frames.back().m_byteOffset = byteOffset; + frames.back().m_numBytes = 0; } else { frames.emplace_back(); - frames.back().mByteOffset = 0; - frames.back().mNumBytes = 0; + frames.back().m_byteOffset = 0; + frames.back().m_numBytes = 0; } // get the current frame AnimGraphAnimFrame& currentFrame = frames.back(); - currentFrame.mTimeValue = mRecordTime; + currentFrame.m_timeValue = m_recordTime; // save the parameter values const size_t numParams = animGraphInstance->GetAnimGraph()->GetNumValueParameters(); - currentFrame.mParameterValues.resize(numParams); + currentFrame.m_parameterValues.resize(numParams); for (size_t p = 0; p < numParams; ++p) { - currentFrame.mParameterValues[p] = AZStd::unique_ptr(animGraphInstance->GetParameterValue(p)->Clone()); + currentFrame.m_parameterValues[p] = AZStd::unique_ptr(animGraphInstance->GetParameterValue(p)->Clone()); } // recursively save all unique datas @@ -581,9 +581,7 @@ namespace EMotionFX } // increase the frames counter - animGraphInstanceData.mNumFrames++; - - //MCore::LogInfo("Frame %d = %d bytes (offset=%d), with %d objects - dataBuffer = %d kb", animGraphInstanceData.mNumFrames, frames.GetLast().mNumBytes, frames.GetLast().mByteOffset, frames.GetLast().mObjectInfos.GetLength(), animGraphInstanceData.mDataBufferSize / 1024); + animGraphInstanceData.m_numFrames++; } } // for all actor instances return true; @@ -594,52 +592,52 @@ namespace EMotionFX bool Recorder::SaveUniqueData(AnimGraphInstance* animGraphInstance, AnimGraphObject* object, AnimGraphInstanceData& animGraphInstanceData) { // get the current frame's data pointer - AnimGraphAnimFrame& currentFrame = animGraphInstanceData.mFrames.back(); - const size_t frameOffset = currentFrame.mByteOffset; + AnimGraphAnimFrame& currentFrame = animGraphInstanceData.m_frames.back(); + const size_t frameOffset = currentFrame.m_byteOffset; // prepare the objects array - mObjects.clear(); - mObjects.reserve(1024); + m_objects.clear(); + m_objects.reserve(1024); // collect the objects we are going to save for this frame - object->RecursiveCollectObjects(mObjects); + object->RecursiveCollectObjects(m_objects); // resize the object infos array - const size_t numObjects = mObjects.size(); - currentFrame.mObjectInfos.resize(numObjects); + const size_t numObjects = m_objects.size(); + currentFrame.m_objectInfos.resize(numObjects); // calculate how much memory we need for this frame size_t requiredFrameBytes = 0; - for (const AnimGraphObject* animGraphObject : mObjects) + for (const AnimGraphObject* animGraphObject : m_objects) { requiredFrameBytes += animGraphObject->SaveUniqueData(animGraphInstance, nullptr); } // make sure we have at least the given amount of space in the buffer we are going to write the frame data to - if (!AssureAnimGraphBufferSize(animGraphInstanceData, requiredFrameBytes + currentFrame.mByteOffset)) + if (!AssureAnimGraphBufferSize(animGraphInstanceData, requiredFrameBytes + currentFrame.m_byteOffset)) { return false; } - uint8* dataPointer = &animGraphInstanceData.mDataBuffer[frameOffset]; + uint8* dataPointer = &animGraphInstanceData.m_dataBuffer[frameOffset]; // save all the unique datas for the objects for (size_t i = 0; i < numObjects; ++i) { // store the object info - AnimGraphObject* curObject = mObjects[i]; - currentFrame.mObjectInfos[i].mObject = curObject; - currentFrame.mObjectInfos[i].mFrameByteOffset = currentFrame.mNumBytes; + AnimGraphObject* curObject = m_objects[i]; + currentFrame.m_objectInfos[i].m_object = curObject; + currentFrame.m_objectInfos[i].m_frameByteOffset = currentFrame.m_numBytes; // write the unique data const size_t numBytesWritten = curObject->SaveUniqueData(animGraphInstance, dataPointer); // increase some offsets/pointers - currentFrame.mNumBytes += numBytesWritten; + currentFrame.m_numBytes += numBytesWritten; dataPointer += numBytesWritten; } // make sure we have a match here, otherwise some of the object->SaveUniqueData(dataPointer) returns different values than object->SaveUniqueData(nullptr) - MCORE_ASSERT(requiredFrameBytes == currentFrame.mNumBytes); + MCORE_ASSERT(requiredFrameBytes == currentFrame.m_numBytes); return true; } @@ -649,19 +647,19 @@ namespace EMotionFX bool Recorder::AssureAnimGraphBufferSize(AnimGraphInstanceData& animGraphInstanceData, size_t numBytes) { // if the buffer is big enough, do nothing - if (animGraphInstanceData.mDataBufferSize >= numBytes) + if (animGraphInstanceData.m_dataBufferSize >= numBytes) { return true; } // we need to reallocate to grow the buffer - const size_t newNumBytes = animGraphInstanceData.mDataBufferSize + (numBytes - animGraphInstanceData.mDataBufferSize) * 100; // allocate 100 frames ahead - void* newBuffer = MCore::Realloc(animGraphInstanceData.mDataBuffer, newNumBytes, EMFX_MEMCATEGORY_RECORDER); + const size_t newNumBytes = animGraphInstanceData.m_dataBufferSize + (numBytes - animGraphInstanceData.m_dataBufferSize) * 100; // allocate 100 frames ahead + void* newBuffer = MCore::Realloc(animGraphInstanceData.m_dataBuffer, newNumBytes, EMFX_MEMCATEGORY_RECORDER); MCORE_ASSERT(newBuffer); if (newBuffer) { - animGraphInstanceData.mDataBuffer = static_cast(newBuffer); - animGraphInstanceData.mDataBufferSize = newNumBytes; + animGraphInstanceData.m_dataBuffer = static_cast(newBuffer); + animGraphInstanceData.m_dataBufferSize = newNumBytes; return true; } RecorderNotificationBus::Broadcast(&RecorderNotificationBus::Events::OnRecordingFailed, @@ -681,51 +679,51 @@ namespace EMotionFX #endif // check if we need to add a position key at all - if (track.mPositions.GetNumKeys() > 0) + if (track.m_positions.GetNumKeys() > 0) { - const AZ::Vector3 lastPos = track.mPositions.GetLastKey()->GetValue(); + const AZ::Vector3 lastPos = track.m_positions.GetLastKey()->GetValue(); if (!pos.IsClose(lastPos, 0.0001f)) { - track.mPositions.AddKey(mRecordTime, pos); + track.m_positions.AddKey(m_recordTime, pos); } } else { - track.mPositions.AddKey(mRecordTime, pos); + track.m_positions.AddKey(m_recordTime, pos); } // check if we need to add a rotation key at all - if (track.mRotations.GetNumKeys() > 0) + if (track.m_rotations.GetNumKeys() > 0) { - const AZ::Quaternion lastRot = track.mRotations.GetLastKey()->GetValue(); + const AZ::Quaternion lastRot = track.m_rotations.GetLastKey()->GetValue(); if (!rot.IsClose(lastRot, 0.0001f)) { - track.mRotations.AddKey(mRecordTime, rot); + track.m_rotations.AddKey(m_recordTime, rot); } } else { - track.mRotations.AddKey(mRecordTime, rot); + track.m_rotations.AddKey(m_recordTime, rot); } EMFX_SCALECODE ( - if (mRecordSettings.mRecordScale) + if (m_recordSettings.m_recordScale) { // check if we need to add a scale key - if (track.mScales.GetNumKeys() > 0) + if (track.m_scales.GetNumKeys() > 0) { - const AZ::Vector3 lastScale = track.mScales.GetLastKey()->GetValue(); + const AZ::Vector3 lastScale = track.m_scales.GetLastKey()->GetValue(); if (!scale.IsClose(lastScale, 0.0001f)) { - track.mScales.AddKey(mRecordTime, scale); + track.m_scales.AddKey(m_recordTime, scale); } } else { - track.mScales.AddKey(mRecordTime, scale); + track.m_scales.AddKey(m_recordTime, scale); } } ) @@ -733,7 +731,7 @@ namespace EMotionFX void Recorder::SampleAndApplyTransforms(float timeInSeconds, ActorInstance* actorInstance) const { - const AZStd::vector& recordedActorInstances = mRecordSettings.m_actorInstances; + const AZStd::vector& recordedActorInstances = m_recordSettings.m_actorInstances; const auto iterator = AZStd::find(recordedActorInstances.begin(), recordedActorInstances.end(), actorInstance); if (iterator != recordedActorInstances.end()) { @@ -746,16 +744,16 @@ namespace EMotionFX { for (const ActorInstanceData* actorInstanceData : m_actorInstanceDatas) { - if(actorInstanceData->mAnimGraphData) + if(actorInstanceData->m_animGraphData) { - SampleAndApplyAnimGraphStates(timeInSeconds, *actorInstanceData->mAnimGraphData); + SampleAndApplyAnimGraphStates(timeInSeconds, *actorInstanceData->m_animGraphData); } } } void Recorder::SampleAndApplyMainTransform(float timeInSeconds, ActorInstance* actorInstance) const { - const AZStd::vector& recordedActorInstances = mRecordSettings.m_actorInstances; + const AZStd::vector& recordedActorInstances = m_recordSettings.m_actorInstances; const auto iterator = AZStd::find(recordedActorInstances.begin(), recordedActorInstances.end(), actorInstance); if (iterator != recordedActorInstances.end()) { @@ -766,18 +764,18 @@ namespace EMotionFX void Recorder::SampleAndApplyMorphs(float timeInSeconds, ActorInstance* actorInstance) const { - const AZStd::vector& recordedActorInstances = mRecordSettings.m_actorInstances; + const AZStd::vector& recordedActorInstances = m_recordSettings.m_actorInstances; const auto iterator = AZStd::find(recordedActorInstances.begin(), recordedActorInstances.end(), actorInstance); if (iterator != recordedActorInstances.end()) { const size_t index = AZStd::distance(recordedActorInstances.begin(), iterator); const ActorInstanceData& actorInstanceData = *m_actorInstanceDatas[index]; - const size_t numMorphs = actorInstanceData.mMorphTracks.size(); + const size_t numMorphs = actorInstanceData.m_morphTracks.size(); if (numMorphs == actorInstance->GetMorphSetupInstance()->GetNumMorphTargets()) { for (size_t i = 0; i < numMorphs; ++i) { - actorInstance->GetMorphSetupInstance()->GetMorphTarget(i)->SetWeight(actorInstanceData.mMorphTracks[i].GetValueAtTime(timeInSeconds)); + actorInstance->GetMorphSetupInstance()->GetMorphTarget(i)->SetWeight(actorInstanceData.m_morphTracks[i].GetValueAtTime(timeInSeconds)); } } } @@ -787,17 +785,17 @@ namespace EMotionFX { // get the actor instance const ActorInstanceData& actorInstanceData = *m_actorInstanceDatas[actorInstanceIndex]; - ActorInstance* actorInstance = actorInstanceData.mActorInstance; + ActorInstance* actorInstance = actorInstanceData.m_actorInstance; // sample and apply - const TransformTracks& track = actorInstanceData.mActorLocalTransform; - actorInstance->SetLocalSpacePosition(track.mPositions.GetValueAtTime(timeInSeconds, nullptr, nullptr, mRecordSettings.mInterpolate)); - actorInstance->SetLocalSpaceRotation(track.mRotations.GetValueAtTime(timeInSeconds, nullptr, nullptr, mRecordSettings.mInterpolate)); + const TransformTracks& track = actorInstanceData.m_actorLocalTransform; + actorInstance->SetLocalSpacePosition(track.m_positions.GetValueAtTime(timeInSeconds, nullptr, nullptr, m_recordSettings.m_interpolate)); + actorInstance->SetLocalSpaceRotation(track.m_rotations.GetValueAtTime(timeInSeconds, nullptr, nullptr, m_recordSettings.m_interpolate)); EMFX_SCALECODE ( - if (mRecordSettings.mRecordScale) + if (m_recordSettings.m_recordScale) { - actorInstance->SetLocalSpaceScale(track.mScales.GetValueAtTime(timeInSeconds, nullptr, nullptr, mRecordSettings.mInterpolate)); + actorInstance->SetLocalSpaceScale(track.m_scales.GetValueAtTime(timeInSeconds, nullptr, nullptr, m_recordSettings.m_interpolate)); } ) } @@ -805,7 +803,7 @@ namespace EMotionFX void Recorder::SampleAndApplyTransforms(float timeInSeconds, size_t actorInstanceIndex) const { const ActorInstanceData& actorInstanceData = *m_actorInstanceDatas[actorInstanceIndex]; - ActorInstance* actorInstance = actorInstanceData.mActorInstance; + ActorInstance* actorInstance = actorInstanceData.m_actorInstance; TransformData* transformData = actorInstance->GetTransformData(); // for all nodes in the actor instance @@ -817,14 +815,14 @@ namespace EMotionFX const TransformTracks& track = actorInstanceData.m_transformTracks[n]; // build the output transform by sampling the keytracks - outTransform.mPosition = track.mPositions.GetValueAtTime(timeInSeconds, nullptr, nullptr, mRecordSettings.mInterpolate); - outTransform.mRotation = track.mRotations.GetValueAtTime(timeInSeconds, nullptr, nullptr, mRecordSettings.mInterpolate); + outTransform.m_position = track.m_positions.GetValueAtTime(timeInSeconds, nullptr, nullptr, m_recordSettings.m_interpolate); + outTransform.m_rotation = track.m_rotations.GetValueAtTime(timeInSeconds, nullptr, nullptr, m_recordSettings.m_interpolate); EMFX_SCALECODE ( - if (mRecordSettings.mRecordScale) + if (m_recordSettings.m_recordScale) { - outTransform.mScale = track.mScales.GetValueAtTime(timeInSeconds, nullptr, nullptr, mRecordSettings.mInterpolate); + outTransform.m_scale = track.m_scales.GetValueAtTime(timeInSeconds, nullptr, nullptr, m_recordSettings.m_interpolate); } ) @@ -843,25 +841,25 @@ namespace EMotionFX } // for all animgraph instances that we recorded, restore their internal states - AnimGraphInstance* animGraphInstance = animGraphInstanceData.mAnimGraphInstance; + AnimGraphInstance* animGraphInstance = animGraphInstanceData.m_animGraphInstance; // get the real frame number (clamped) - const size_t realFrameNumber = AZStd::min(frameNumber, animGraphInstanceData.mFrames.size() - 1); - const AnimGraphAnimFrame& currentFrame = animGraphInstanceData.mFrames[realFrameNumber]; + const size_t realFrameNumber = AZStd::min(frameNumber, animGraphInstanceData.m_frames.size() - 1); + const AnimGraphAnimFrame& currentFrame = animGraphInstanceData.m_frames[realFrameNumber]; // get the data and objects buffers - const size_t byteOffset = currentFrame.mByteOffset; - const uint8* frameDataBuffer = &animGraphInstanceData.mDataBuffer[byteOffset]; - const AZStd::vector& frameObjects = currentFrame.mObjectInfos; + const size_t byteOffset = currentFrame.m_byteOffset; + const uint8* frameDataBuffer = &animGraphInstanceData.m_dataBuffer[byteOffset]; + const AZStd::vector& frameObjects = currentFrame.m_objectInfos; // first lets update all parameter values - MCORE_ASSERT(currentFrame.mParameterValues.size() == animGraphInstance->GetAnimGraph()->GetNumParameters()); - const size_t numParameters = currentFrame.mParameterValues.size(); + MCORE_ASSERT(currentFrame.m_parameterValues.size() == animGraphInstance->GetAnimGraph()->GetNumParameters()); + const size_t numParameters = currentFrame.m_parameterValues.size(); for (size_t p = 0; p < numParameters; ++p) { // make sure the parameters are of the same type - MCORE_ASSERT(animGraphInstance->GetParameterValue(p)->GetType() == currentFrame.mParameterValues[p]->GetType()); - animGraphInstance->GetParameterValue(p)->InitFrom(currentFrame.mParameterValues[p].get()); + MCORE_ASSERT(animGraphInstance->GetParameterValue(p)->GetType() == currentFrame.m_parameterValues[p]->GetType()); + animGraphInstance->GetParameterValue(p)->InitFrom(currentFrame.m_parameterValues[p].get()); } // process all objects for this frame @@ -870,25 +868,25 @@ namespace EMotionFX for (size_t a = 0; a < numObjects; ++a) { const AnimGraphAnimObjectInfo& objectInfo = frameObjects[a]; - const size_t numBytesRead = objectInfo.mObject->LoadUniqueData(animGraphInstance, &frameDataBuffer[objectInfo.mFrameByteOffset]); + const size_t numBytesRead = objectInfo.m_object->LoadUniqueData(animGraphInstance, &frameDataBuffer[objectInfo.m_frameByteOffset]); totalBytesRead += numBytesRead; } // make sure this matches, otherwise the data read is not the same as we have written - MCORE_ASSERT(totalBytesRead == currentFrame.mNumBytes); + MCORE_ASSERT(totalBytesRead == currentFrame.m_numBytes); } bool Recorder::GetHasRecorded(ActorInstance* actorInstance) const { - return AZStd::find(mRecordSettings.m_actorInstances.begin(), mRecordSettings.m_actorInstances.end(), actorInstance) - != mRecordSettings.m_actorInstances.end(); + return AZStd::find(m_recordSettings.m_actorInstances.begin(), m_recordSettings.m_actorInstances.end(), actorInstance) + != m_recordSettings.m_actorInstances.end(); } size_t Recorder::FindActorInstanceDataIndex(ActorInstance* actorInstance) const { const auto found = AZStd::find_if(begin(m_actorInstanceDatas), end(m_actorInstanceDatas), [actorInstance](const ActorInstanceData* data) { - return data->mActorInstance == actorInstance; + return data->m_actorInstance == actorInstance; }); return found != end(m_actorInstanceDatas) ? AZStd::distance(begin(m_actorInstanceDatas), found) : InvalidIndex; } @@ -899,46 +897,46 @@ namespace EMotionFX for (ActorInstanceData* actorInstanceData : m_actorInstanceDatas) { // get the animgraph instance - AnimGraphInstance* animGraphInstance = actorInstanceData->mActorInstance->GetAnimGraphInstance(); + AnimGraphInstance* animGraphInstance = actorInstanceData->m_actorInstance->GetAnimGraphInstance(); if (animGraphInstance == nullptr) { continue; } // collect all active motion nodes - animGraphInstance->CollectActiveAnimGraphNodes(&mActiveNodes); + animGraphInstance->CollectActiveAnimGraphNodes(&m_activeNodes); // get the history items as shortcut - AZStd::vector& historyItems = actorInstanceData->mNodeHistoryItems; + AZStd::vector& historyItems = actorInstanceData->m_nodeHistoryItems; // finalize items for (NodeHistoryItem* curItem : historyItems) { - if (curItem->mIsFinalized) + if (curItem->m_isFinalized) { continue; } // check if we have an active node for the given item - const bool haveActiveNode = AZStd::find_if(begin(mActiveNodes), end(mActiveNodes), [curItem](const AnimGraphNode* activeNode) + const bool haveActiveNode = AZStd::find_if(begin(m_activeNodes), end(m_activeNodes), [curItem](const AnimGraphNode* activeNode) { - return activeNode->GetId() == curItem->mNodeId; - }) != end(mActiveNodes); + return activeNode->GetId() == curItem->m_nodeId; + }) != end(m_activeNodes); // the node got deactivated, finalize the item if (haveActiveNode) { - curItem->mGlobalWeights.Optimize(0.0001f); - curItem->mLocalWeights.Optimize(0.0001f); - curItem->mPlayTimes.Optimize(0.0001f); - curItem->mIsFinalized = true; - curItem->mEndTime = mRecordTime; + curItem->m_globalWeights.Optimize(0.0001f); + curItem->m_localWeights.Optimize(0.0001f); + curItem->m_playTimes.Optimize(0.0001f); + curItem->m_isFinalized = true; + curItem->m_endTime = m_recordTime; continue; } } // iterate over all active nodes - for (const AnimGraphNode* activeNode : mActiveNodes) + for (const AnimGraphNode* activeNode : m_activeNodes) { if (activeNode == animGraphInstance->GetRootNode()) // skip the root node { @@ -948,7 +946,7 @@ namespace EMotionFX const AZ::TypeId typeID = azrtti_typeid(activeNode); // if the parent isn't a state machine then it isn't a state - if (mRecordSettings.mHistoryStatesOnly) + if (m_recordSettings.m_historyStatesOnly) { if (azrtti_typeid(activeNode->GetParentNode()) != azrtti_typeid()) { @@ -957,42 +955,42 @@ namespace EMotionFX } // make sure this node is on our capture list - if (!mRecordSettings.mNodeHistoryTypes.empty()) + if (!m_recordSettings.m_nodeHistoryTypes.empty()) { - if (mRecordSettings.mNodeHistoryTypes.find(typeID) == mRecordSettings.mNodeHistoryTypes.end()) + if (m_recordSettings.m_nodeHistoryTypes.find(typeID) == m_recordSettings.m_nodeHistoryTypes.end()) { continue; } } // skip node types we do not want to capture - if (!mRecordSettings.mNodeHistoryTypesToIgnore.empty()) + if (!m_recordSettings.m_nodeHistoryTypesToIgnore.empty()) { - if (mRecordSettings.mNodeHistoryTypesToIgnore.find(typeID) != mRecordSettings.mNodeHistoryTypesToIgnore.end()) + if (m_recordSettings.m_nodeHistoryTypesToIgnore.find(typeID) != m_recordSettings.m_nodeHistoryTypesToIgnore.end()) { continue; } } // try to locate an existing item - NodeHistoryItem* item = FindNodeHistoryItem(*actorInstanceData, activeNode, mRecordTime); + NodeHistoryItem* item = FindNodeHistoryItem(*actorInstanceData, activeNode, m_recordTime); if (item == nullptr) { item = new NodeHistoryItem(); - item->mName = activeNode->GetName(); - item->mAnimGraphID = animGraphInstance->GetAnimGraph()->GetID(); - item->mStartTime = mRecordTime; - item->mIsFinalized = false; - item->mTrackIndex = FindFreeNodeHistoryItemTrack(*actorInstanceData, item); - item->mNodeId = activeNode->GetId(); - item->mColor = activeNode->GetVisualizeColor(); - item->mTypeColor = activeNode->GetVisualColor(); - item->mCategoryID = (uint32)activeNode->GetPaletteCategory(); - item->mNodeType = typeID; - item->mAnimGraphInstance = animGraphInstance; - item->mGlobalWeights.Reserve(1024); - item->mLocalWeights.Reserve(1024); - item->mPlayTimes.Reserve(1024); + item->m_name = activeNode->GetName(); + item->m_animGraphId = animGraphInstance->GetAnimGraph()->GetID(); + item->m_startTime = m_recordTime; + item->m_isFinalized = false; + item->m_trackIndex = FindFreeNodeHistoryItemTrack(*actorInstanceData, item); + item->m_nodeId = activeNode->GetId(); + item->m_color = activeNode->GetVisualizeColor(); + item->m_typeColor = activeNode->GetVisualColor(); + item->m_categoryId = (uint32)activeNode->GetPaletteCategory(); + item->m_nodeType = typeID; + item->m_animGraphInstance = animGraphInstance; + item->m_globalWeights.Reserve(1024); + item->m_localWeights.Reserve(1024); + item->m_playTimes.Reserve(1024); // get the motion instance if (typeID == azrtti_typeid()) @@ -1001,8 +999,8 @@ namespace EMotionFX MotionInstance* motionInstance = motionNode->FindMotionInstance(animGraphInstance); if (motionInstance) { - item->mMotionID = motionInstance->GetMotion()->GetID(); - AzFramework::StringFunc::Path::GetFileName(item->mMotionFileName.c_str(), item->mMotionFileName); + item->m_motionId = motionInstance->GetMotion()->GetID(); + AzFramework::StringFunc::Path::GetFileName(item->m_motionFileName.c_str(), item->m_motionFileName); } } @@ -1011,9 +1009,9 @@ namespace EMotionFX // add the weight key and update infos const AnimGraphNodeData* uniqueData = activeNode->FindOrCreateUniqueNodeData(animGraphInstance); - const float keyTime = mRecordTime - item->mStartTime; - item->mGlobalWeights.AddKey(keyTime, uniqueData->GetGlobalWeight()); - item->mLocalWeights.AddKey(keyTime, uniqueData->GetLocalWeight()); + const float keyTime = m_recordTime - item->m_startTime; + item->m_globalWeights.AddKey(keyTime, uniqueData->GetGlobalWeight()); + item->m_localWeights.AddKey(keyTime, uniqueData->GetLocalWeight()); float normalizedTime = uniqueData->GetCurrentPlayTime(); const float duration = uniqueData->GetDuration(); @@ -1026,8 +1024,8 @@ namespace EMotionFX normalizedTime = 0.0f; } - item->mPlayTimes.AddKey(keyTime, normalizedTime); - item->mEndTime = mRecordTime; + item->m_playTimes.AddKey(keyTime, normalizedTime); + item->m_endTime = m_recordTime; } } // for all actor instances } @@ -1036,15 +1034,15 @@ namespace EMotionFX // try to find a given node history item Recorder::NodeHistoryItem* Recorder::FindNodeHistoryItem(const ActorInstanceData& actorInstanceData, const AnimGraphNode* node, float recordTime) const { - const AZStd::vector& historyItems = actorInstanceData.mNodeHistoryItems; + const AZStd::vector& historyItems = actorInstanceData.m_nodeHistoryItems; for (NodeHistoryItem* curItem : historyItems) { - if (curItem->mNodeId == node->GetId() && curItem->mStartTime <= recordTime && curItem->mIsFinalized == false) + if (curItem->m_nodeId == node->GetId() && curItem->m_startTime <= recordTime && curItem->m_isFinalized == false) { return curItem; } - if (curItem->mNodeId == node->GetId() && curItem->mStartTime <= recordTime && curItem->mEndTime >= recordTime && curItem->mIsFinalized) + if (curItem->m_nodeId == node->GetId() && curItem->m_startTime <= recordTime && curItem->m_endTime >= recordTime && curItem->m_isFinalized) { return curItem; } @@ -1057,7 +1055,7 @@ namespace EMotionFX // find a free track size_t Recorder::FindFreeNodeHistoryItemTrack(const ActorInstanceData& actorInstanceData, NodeHistoryItem* item) const { - const AZStd::vector& historyItems = actorInstanceData.mNodeHistoryItems; + const AZStd::vector& historyItems = actorInstanceData.m_nodeHistoryItems; bool found = false; size_t trackIndex = 0; @@ -1067,23 +1065,23 @@ namespace EMotionFX for (const NodeHistoryItem* curItem : historyItems) { - if (curItem->mTrackIndex != trackIndex) + if (curItem->m_trackIndex != trackIndex) { continue; } // if the current item is not active anymore - if (curItem->mIsFinalized) + if (curItem->m_isFinalized) { // if the start time of the item we try to insert is within the range of this item - if (item->mStartTime > curItem->mStartTime && item->mStartTime < curItem->mEndTime) + if (item->m_startTime > curItem->m_startTime && item->m_startTime < curItem->m_endTime) { hasCollision = true; break; } // if the end time of this item is within the range of this item - if (item->mEndTime > curItem->mStartTime && item->mEndTime < curItem->mEndTime) + if (item->m_endTime > curItem->m_startTime && item->m_endTime < curItem->m_endTime) { hasCollision = true; break; @@ -1091,7 +1089,7 @@ namespace EMotionFX } else // if the current item is still active and has no real end time yet { - if (item->mStartTime >= curItem->mStartTime) + if (item->m_startTime >= curItem->m_startTime) { hasCollision = true; break; @@ -1117,12 +1115,12 @@ namespace EMotionFX size_t Recorder::CalcMaxNodeHistoryTrackIndex(const ActorInstanceData& actorInstanceData) const { size_t result = 0; - const AZStd::vector& historyItems = actorInstanceData.mNodeHistoryItems; + const AZStd::vector& historyItems = actorInstanceData.m_nodeHistoryItems; for (const NodeHistoryItem* curItem : historyItems) { - if (curItem->mTrackIndex > result) + if (curItem->m_trackIndex > result) { - result = curItem->mTrackIndex; + result = curItem->m_trackIndex; } } @@ -1134,12 +1132,12 @@ namespace EMotionFX size_t Recorder::CalcMaxEventHistoryTrackIndex(const ActorInstanceData& actorInstanceData) const { size_t result = 0; - const AZStd::vector& historyItems = actorInstanceData.mEventHistoryItems; + const AZStd::vector& historyItems = actorInstanceData.m_eventHistoryItems; for (const EventHistoryItem* curItem : historyItems) { - if (curItem->mTrackIndex > result) + if (curItem->m_trackIndex > result) { - result = curItem->mTrackIndex; + result = curItem->m_trackIndex; } } @@ -1169,28 +1167,28 @@ namespace EMotionFX for (const ActorInstanceData* actorInstanceData : m_actorInstanceDatas) { // get the animgraph instance - AnimGraphInstance* animGraphInstance = actorInstanceData->mActorInstance->GetAnimGraphInstance(); + AnimGraphInstance* animGraphInstance = actorInstanceData->m_actorInstance->GetAnimGraphInstance(); if (animGraphInstance == nullptr) { continue; } // collect all active motion nodes - animGraphInstance->CollectActiveAnimGraphNodes(&mActiveNodes); + animGraphInstance->CollectActiveAnimGraphNodes(&m_activeNodes); // get the history items as shortcut - const AZStd::vector& historyItems = actorInstanceData->mNodeHistoryItems; + const AZStd::vector& historyItems = actorInstanceData->m_nodeHistoryItems; // finalize all items for (NodeHistoryItem* historyItem : historyItems) { // remove unneeded key frames - if (historyItem->mIsFinalized == false) + if (historyItem->m_isFinalized == false) { - historyItem->mGlobalWeights.Optimize(0.0001f); - historyItem->mLocalWeights.Optimize(0.0001f); - historyItem->mPlayTimes.Optimize(0.0001f); - historyItem->mIsFinalized = true; + historyItem->m_globalWeights.Optimize(0.0001f); + historyItem->m_localWeights.Optimize(0.0001f); + historyItem->m_playTimes.Optimize(0.0001f); + historyItem->m_isFinalized = true; } } } @@ -1204,7 +1202,7 @@ namespace EMotionFX for (ActorInstanceData* actorInstanceData : m_actorInstanceDatas) { // get the animgraph instance - AnimGraphInstance* animGraphInstance = actorInstanceData->mActorInstance->GetAnimGraphInstance(); + AnimGraphInstance* animGraphInstance = actorInstanceData->m_actorInstance->GetAnimGraphInstance(); if (animGraphInstance == nullptr) { continue; @@ -1214,7 +1212,7 @@ namespace EMotionFX const AnimGraphEventBuffer& eventBuffer = animGraphInstance->GetEventBuffer(); // iterate over all events - AZStd::vector& historyItems = actorInstanceData->mEventHistoryItems; + AZStd::vector& historyItems = actorInstanceData->m_eventHistoryItems; const size_t numEvents = eventBuffer.GetNumEvents(); for (size_t i = 0; i < numEvents; ++i) { @@ -1223,26 +1221,26 @@ namespace EMotionFX { continue; } - EventHistoryItem* item = FindEventHistoryItem(*actorInstanceData, eventInfo, mRecordTime); + EventHistoryItem* item = FindEventHistoryItem(*actorInstanceData, eventInfo, m_recordTime); if (item == nullptr) // create a new one { item = new EventHistoryItem(); // TODO - //item->mEventIndex = GetEventManager().FindEventTypeIndex(eventInfo.mTypeID); - item->mEventInfo = eventInfo; - item->mIsTickEvent = eventInfo.mEvent->GetIsTickEvent(); - item->mStartTime = mRecordTime; - item->mAnimGraphID = animGraphInstance->GetAnimGraph()->GetID(); - item->mEmitterNodeId= eventInfo.mEmitter->GetId(); - item->mColor = eventInfo.mEmitter->GetVisualizeColor(); + //item->m_eventIndex = GetEventManager().FindEventTypeIndex(eventInfo.m_typeID); + item->m_eventInfo = eventInfo; + item->m_isTickEvent = eventInfo.m_event->GetIsTickEvent(); + item->m_startTime = m_recordTime; + item->m_animGraphId = animGraphInstance->GetAnimGraph()->GetID(); + item->m_emitterNodeId= eventInfo.m_emitter->GetId(); + item->m_color = eventInfo.m_emitter->GetVisualizeColor(); - item->mTrackIndex = FindFreeEventHistoryItemTrack(*actorInstanceData, item); + item->m_trackIndex = FindFreeEventHistoryItemTrack(*actorInstanceData, item); historyItems.emplace_back(item); } - item->mEndTime = mRecordTime; + item->m_endTime = m_recordTime; } } } @@ -1252,10 +1250,10 @@ namespace EMotionFX Recorder::EventHistoryItem* Recorder::FindEventHistoryItem(const ActorInstanceData& actorInstanceData, const EventInfo& eventInfo, float recordTime) { MCORE_UNUSED(recordTime); - const AZStd::vector& historyItems = actorInstanceData.mEventHistoryItems; + const AZStd::vector& historyItems = actorInstanceData.m_eventHistoryItems; for (const EventHistoryItem* curItem : historyItems) { - if (curItem->mStartTime < eventInfo.mTimeValue) + if (curItem->m_startTime < eventInfo.m_timeValue) { continue; } @@ -1268,7 +1266,7 @@ namespace EMotionFX // find a free event track index size_t Recorder::FindFreeEventHistoryItemTrack(const ActorInstanceData& actorInstanceData, EventHistoryItem* item) const { - const AZStd::vector& historyItems = actorInstanceData.mEventHistoryItems; + const AZStd::vector& historyItems = actorInstanceData.m_eventHistoryItems; bool found = false; size_t trackIndex = 0; while (found == false) @@ -1277,12 +1275,12 @@ namespace EMotionFX for (const EventHistoryItem* curItem : historyItems) { - if (curItem->mTrackIndex != trackIndex) + if (curItem->m_trackIndex != trackIndex) { continue; } - if (MCore::Compare::CheckIfIsClose(curItem->mStartTime, item->mStartTime, 0.01f)) + if (MCore::Compare::CheckIfIsClose(curItem->m_startTime, item->m_startTime, 0.01f)) { hasCollision = true; break; @@ -1314,13 +1312,13 @@ namespace EMotionFX // just search in the first actor instances data const ActorInstanceData& actorInstanceData = *m_actorInstanceDatas[0]; - const AnimGraphInstanceData* animGraphData = actorInstanceData.mAnimGraphData; + const AnimGraphInstanceData* animGraphData = actorInstanceData.m_animGraphData; if (animGraphData == nullptr) { return InvalidIndex; } - const size_t numFrames = animGraphData->mFrames.size(); + const size_t numFrames = animGraphData->m_frames.size(); if (numFrames == 0) { return InvalidIndex; @@ -1335,16 +1333,16 @@ namespace EMotionFX return 0; } - if (timeValue > animGraphData->mFrames.back().mTimeValue) + if (timeValue > animGraphData->m_frames.back().m_timeValue) { - return animGraphData->mFrames.size() - 1; + return animGraphData->m_frames.size() - 1; } for (size_t i = 0; i < numFrames - 1; ++i) { - const AnimGraphAnimFrame& curFrame = animGraphData->mFrames[i]; - const AnimGraphAnimFrame& nextFrame = animGraphData->mFrames[i + 1]; - if (curFrame.mTimeValue <= timeValue && nextFrame.mTimeValue > timeValue) + const AnimGraphAnimFrame& curFrame = animGraphData->m_frames[i]; + const AnimGraphAnimFrame& nextFrame = animGraphData->m_frames[i + 1]; + if (curFrame.m_timeValue <= timeValue && nextFrame.m_timeValue > timeValue) { return i; } @@ -1358,7 +1356,7 @@ namespace EMotionFX Lock(); // Remove the actor instance from the record settings. - AZStd::vector& recordedActorInstances = mRecordSettings.m_actorInstances; + AZStd::vector& recordedActorInstances = m_recordSettings.m_actorInstances; recordedActorInstances.erase(AZStd::remove_if(recordedActorInstances.begin(), recordedActorInstances.end(), [&actorInstance](ActorInstance* recordedActorInstance){ return recordedActorInstance == actorInstance;}), recordedActorInstances.end()); @@ -1366,7 +1364,7 @@ namespace EMotionFX // Remove the actual recorded data. for (size_t i = 0; i < m_actorInstanceDatas.size();) { - if (m_actorInstanceDatas[i]->mActorInstance == actorInstance) + if (m_actorInstanceDatas[i]->m_actorInstance == actorInstance) { delete m_actorInstanceDatas[i]; m_actorInstanceDatas.erase(AZStd::next(m_actorInstanceDatas.begin(), i)); @@ -1386,16 +1384,16 @@ namespace EMotionFX for (ActorInstanceData* actorInstanceData : m_actorInstanceDatas) { - if (actorInstanceData->mAnimGraphData && actorInstanceData->mAnimGraphData->mAnimGraphInstance) + if (actorInstanceData->m_animGraphData && actorInstanceData->m_animGraphData->m_animGraphInstance) { - AnimGraph* curAnimGraph = actorInstanceData->mAnimGraphData->mAnimGraphInstance->GetAnimGraph(); + AnimGraph* curAnimGraph = actorInstanceData->m_animGraphData->m_animGraphInstance->GetAnimGraph(); if (animGraph != curAnimGraph) { continue; } - delete actorInstanceData->mAnimGraphData; - actorInstanceData->mAnimGraphData = nullptr; + delete actorInstanceData->m_animGraphData; + actorInstanceData->m_animGraphData = nullptr; } } @@ -1411,12 +1409,12 @@ namespace EMotionFX void Recorder::Lock() { - mLock.Lock(); + m_lock.Lock(); } void Recorder::Unlock() { - mLock.Unlock(); + m_lock.Unlock(); } @@ -1429,44 +1427,44 @@ namespace EMotionFX for (size_t i = 0; i <= maxIndex; ++i) { ExtractedNodeHistoryItem item; - item.mTrackIndex = i; - item.mValue = 0.0f; - item.mKeyTrackSampleTime = 0.0f; - item.mNodeHistoryItem = nullptr; + item.m_trackIndex = i; + item.m_value = 0.0f; + item.m_keyTrackSampleTime = 0.0f; + item.m_nodeHistoryItem = nullptr; outItems->emplace(AZStd::next(begin(*outItems), i), AZStd::move(item)); } // find all node history items - const AZStd::vector& historyItems = actorInstanceData.mNodeHistoryItems; + const AZStd::vector& historyItems = actorInstanceData.m_nodeHistoryItems; for (NodeHistoryItem* curItem : historyItems) { - if (curItem->mStartTime <= timeValue && curItem->mEndTime > timeValue) + if (curItem->m_startTime <= timeValue && curItem->m_endTime > timeValue) { ExtractedNodeHistoryItem item; - item.mTrackIndex = curItem->mTrackIndex; - item.mKeyTrackSampleTime = timeValue - curItem->mStartTime; - item.mNodeHistoryItem = curItem; + item.m_trackIndex = curItem->m_trackIndex; + item.m_keyTrackSampleTime = timeValue - curItem->m_startTime; + item.m_nodeHistoryItem = curItem; switch (valueType) { case VALUETYPE_GLOBALWEIGHT: - item.mValue = curItem->mGlobalWeights.GetValueAtTime(item.mKeyTrackSampleTime, nullptr, nullptr, mRecordSettings.mInterpolate); + item.m_value = curItem->m_globalWeights.GetValueAtTime(item.m_keyTrackSampleTime, nullptr, nullptr, m_recordSettings.m_interpolate); break; case VALUETYPE_LOCALWEIGHT: - item.mValue = curItem->mLocalWeights.GetValueAtTime(item.mKeyTrackSampleTime, nullptr, nullptr, mRecordSettings.mInterpolate); + item.m_value = curItem->m_localWeights.GetValueAtTime(item.m_keyTrackSampleTime, nullptr, nullptr, m_recordSettings.m_interpolate); break; case VALUETYPE_PLAYTIME: - item.mValue = curItem->mPlayTimes.GetValueAtTime(item.mKeyTrackSampleTime, nullptr, nullptr, mRecordSettings.mInterpolate); + item.m_value = curItem->m_playTimes.GetValueAtTime(item.m_keyTrackSampleTime, nullptr, nullptr, m_recordSettings.m_interpolate); break; default: MCORE_ASSERT(false); // unsupported mode - item.mValue = curItem->mGlobalWeights.GetValueAtTime(item.mKeyTrackSampleTime, nullptr, nullptr, mRecordSettings.mInterpolate); + item.m_value = curItem->m_globalWeights.GetValueAtTime(item.m_keyTrackSampleTime, nullptr, nullptr, m_recordSettings.m_interpolate); } - outItems->emplace(AZStd::next(begin(*outItems), curItem->mTrackIndex), item); + outItems->emplace(AZStd::next(begin(*outItems), curItem->m_trackIndex), item); } } @@ -1484,7 +1482,7 @@ namespace EMotionFX for (size_t i = 0; i <= maxIndex; ++i) { - outMap->emplace(AZStd::next(begin(*outMap), outItems->at(i).mTrackIndex), i); + outMap->emplace(AZStd::next(begin(*outMap), outItems->at(i).m_trackIndex), i); } } } @@ -1499,13 +1497,13 @@ namespace EMotionFX const size_t maxNumTracks = static_cast(CalcMaxNodeHistoryTrackIndex()) + 1; trackFlags.resize(maxNumTracks); - const size_t numNodeHistoryItems = actorInstanceData.mNodeHistoryItems.size(); + const size_t numNodeHistoryItems = actorInstanceData.m_nodeHistoryItems.size(); for (size_t i = 0; i < numNodeHistoryItems; ++i) { - EMotionFX::Recorder::NodeHistoryItem* item = actorInstanceData.mNodeHistoryItems[i]; + EMotionFX::Recorder::NodeHistoryItem* item = actorInstanceData.m_nodeHistoryItems[i]; // Only process motion history items. - if (item->mMotionID == MCORE_INVALIDINDEX32) + if (item->m_motionId == MCORE_INVALIDINDEX32) { continue; } @@ -1518,32 +1516,32 @@ namespace EMotionFX // We at least have a single active motion. size_t intermediateResult = 1; - trackFlags[item->mTrackIndex] = true; + trackFlags[item->m_trackIndex] = true; for (size_t j = 0; j < numNodeHistoryItems; ++j) { - EMotionFX::Recorder::NodeHistoryItem* innerItem = actorInstanceData.mNodeHistoryItems[j]; + EMotionFX::Recorder::NodeHistoryItem* innerItem = actorInstanceData.m_nodeHistoryItems[j]; // Did we count this track in already? If yes, skip. - if (trackFlags[innerItem->mTrackIndex]) + if (trackFlags[innerItem->m_trackIndex]) { continue; } // Skip self comparison and only process motion history items. - if (i == j || innerItem->mMotionID == MCORE_INVALIDINDEX32) + if (i == j || innerItem->m_motionId == MCORE_INVALIDINDEX32) { continue; } // Are the item and innerItem events overlapping? - if ((item->mStartTime >= innerItem->mStartTime && item->mStartTime <= innerItem->mEndTime) || - (item->mEndTime >= innerItem->mStartTime && item->mEndTime <= innerItem->mEndTime) || - (innerItem->mStartTime >= item->mStartTime && innerItem->mStartTime <= item->mEndTime) || - (innerItem->mEndTime >= item->mStartTime && innerItem->mEndTime <= item->mEndTime)) + if ((item->m_startTime >= innerItem->m_startTime && item->m_startTime <= innerItem->m_endTime) || + (item->m_endTime >= innerItem->m_startTime && item->m_endTime <= innerItem->m_endTime) || + (innerItem->m_startTime >= item->m_startTime && innerItem->m_startTime <= item->m_endTime) || + (innerItem->m_endTime >= item->m_startTime && innerItem->m_endTime <= item->m_endTime)) { intermediateResult++; - trackFlags[innerItem->mTrackIndex] = true; + trackFlags[innerItem->m_trackIndex] = true; } } diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/Recorder.h b/Gems/EMotionFX/Code/EMotionFX/Source/Recorder.h index 7d76b09483..fe87d36ea1 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/Recorder.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/Recorder.h @@ -59,33 +59,33 @@ namespace EMotionFX AZ_TYPE_INFO(EMotionFX::Recorder::RecordSettings, "{A3F9D69E-3543-4B9D-B6F1-C0D5BAB1EDB1}"); AZStd::vector m_actorInstances; /**< The actor instances to record, or specify none to record all (default=record all). */ - AZStd::unordered_set mNodeHistoryTypes; /**< The array of type node type IDs to capture. Empty array means everything. */ - AZStd::unordered_set mNodeHistoryTypesToIgnore; /**< The array of type node type IDs to NOT capture. Empty array means nothing to ignore. */ - uint32 mFPS; /**< The rate at which to sample (default=15). */ - uint32 mNumPreAllocTransformKeys; /**< Pre-allocate space for this amount of transformation keys per node per actor instance (default=32). */ - size_t mInitialAnimGraphAnimBytes; /**< The number of bytes to allocate to store the anim graph recording (default=2*1024*1024, which is 2mb). This is only used when actually recording anim graph internal state animation. */ - bool mRecordTransforms; /**< Record transformations? (default=true). */ - bool mRecordAnimGraphStates; /**< Record the anim graph internal state? (default=false). */ - bool mRecordNodeHistory; /**< Record the node history? (default=false). */ - bool mHistoryStatesOnly; /**< Record only states in the node history? (default=false, and only used when mRecordNodeHistory is true). */ - bool mRecordScale; /**< Record scale changes when recording transforms? */ - bool mRecordEvents; /**< Record events (default=false). */ - bool mRecordMorphs; /**< Record morph target weight animation (default=true). */ - bool mInterpolate; /**< Interpolate playback? (default=false) */ + AZStd::unordered_set m_nodeHistoryTypes; /**< The array of type node type IDs to capture. Empty array means everything. */ + AZStd::unordered_set m_nodeHistoryTypesToIgnore; /**< The array of type node type IDs to NOT capture. Empty array means nothing to ignore. */ + uint32 m_fps; /**< The rate at which to sample (default=15). */ + uint32 m_numPreAllocTransformKeys; /**< Pre-allocate space for this amount of transformation keys per node per actor instance (default=32). */ + size_t m_initialAnimGraphAnimBytes; /**< The number of bytes to allocate to store the anim graph recording (default=2*1024*1024, which is 2mb). This is only used when actually recording anim graph internal state animation. */ + bool m_recordTransforms; /**< Record transformations? (default=true). */ + bool m_recordAnimGraphStates; /**< Record the anim graph internal state? (default=false). */ + bool m_recordNodeHistory; /**< Record the node history? (default=false). */ + bool m_historyStatesOnly; /**< Record only states in the node history? (default=false, and only used when m_recordNodeHistory is true). */ + bool m_recordScale; /**< Record scale changes when recording transforms? */ + bool m_recordEvents; /**< Record events (default=false). */ + bool m_recordMorphs; /**< Record morph target weight animation (default=true). */ + bool m_interpolate; /**< Interpolate playback? (default=false) */ RecordSettings() { - mFPS = 60; - mNumPreAllocTransformKeys = 32; - mInitialAnimGraphAnimBytes = 1 * 1024 * 1024; // 1 megabyte - mRecordTransforms = true; - mRecordNodeHistory = false; - mHistoryStatesOnly = false; - mRecordAnimGraphStates = false; - mRecordEvents = false; - mRecordScale = true; - mRecordMorphs = true; - mInterpolate = false; + m_fps = 60; + m_numPreAllocTransformKeys = 32; + m_initialAnimGraphAnimBytes = 1 * 1024 * 1024; // 1 megabyte + m_recordTransforms = true; + m_recordNodeHistory = false; + m_historyStatesOnly = false; + m_recordAnimGraphStates = false; + m_recordEvents = false; + m_recordScale = true; + m_recordMorphs = true; + m_interpolate = false; } static void Reflect(AZ::ReflectContext* context); @@ -94,25 +94,25 @@ namespace EMotionFX struct EMFX_API EventHistoryItem { - EventInfo mEventInfo; - size_t mEventIndex; /**< The index to use in combination with GetEventManager().GetEvent(index). */ - size_t mTrackIndex; - AnimGraphNodeId mEmitterNodeId; - uint32 mAnimGraphID; - AZ::Color mColor; - float mStartTime; - float mEndTime; - bool mIsTickEvent; + EventInfo m_eventInfo; + size_t m_eventIndex; /**< The index to use in combination with GetEventManager().GetEvent(index). */ + size_t m_trackIndex; + AnimGraphNodeId m_emitterNodeId; + uint32 m_animGraphId; + AZ::Color m_color; + float m_startTime; + float m_endTime; + bool m_isTickEvent; EventHistoryItem() { - mEventIndex = InvalidIndex; - mTrackIndex = InvalidIndex; - mEmitterNodeId = AnimGraphNodeId(); - mAnimGraphID = MCORE_INVALIDINDEX32; + m_eventIndex = InvalidIndex; + m_trackIndex = InvalidIndex; + m_emitterNodeId = AnimGraphNodeId(); + m_animGraphId = MCORE_INVALIDINDEX32; const AZ::u32 col = MCore::GenerateColor(); - mColor = AZ::Color( + m_color = AZ::Color( MCore::ExtractRed(col)/255.0f, MCore::ExtractGreen(col)/255.0f, MCore::ExtractBlue(col)/255.0f, @@ -122,40 +122,40 @@ namespace EMotionFX struct EMFX_API NodeHistoryItem { - AZStd::string mName; - AZStd::string mMotionFileName; - float mStartTime; // time the motion starts being active - float mEndTime; // time the motion stops being active - KeyTrackLinearDynamic mGlobalWeights; // the global weights at given time values - KeyTrackLinearDynamic mLocalWeights; // the local weights at given time values - KeyTrackLinearDynamic mPlayTimes; // normalized time values (current time in the node/motion) - uint32 mMotionID; // the ID of the Motion object used - size_t mTrackIndex; // the track index - size_t mCachedKey; // a cached key - AnimGraphNodeId mNodeId; // animgraph node Id - AnimGraphInstance* mAnimGraphInstance; // the anim graph instance this node was recorded from - AZ::Color mColor; // the node viz color - AZ::Color mTypeColor; // the node type color - uint32 mAnimGraphID; // the animgraph ID - AZ::TypeId mNodeType; // the node type (Uuid) - uint32 mCategoryID; // the category ID - bool mIsFinalized; // is this a finalized item? + AZStd::string m_name; + AZStd::string m_motionFileName; + float m_startTime; // time the motion starts being active + float m_endTime; // time the motion stops being active + KeyTrackLinearDynamic m_globalWeights; // the global weights at given time values + KeyTrackLinearDynamic m_localWeights; // the local weights at given time values + KeyTrackLinearDynamic m_playTimes; // normalized time values (current time in the node/motion) + uint32 m_motionId; // the ID of the Motion object used + size_t m_trackIndex; // the track index + size_t m_cachedKey; // a cached key + AnimGraphNodeId m_nodeId; // animgraph node Id + AnimGraphInstance* m_animGraphInstance; // the anim graph instance this node was recorded from + AZ::Color m_color; // the node viz color + AZ::Color m_typeColor; // the node type color + uint32 m_animGraphId; // the animgraph ID + AZ::TypeId m_nodeType; // the node type (Uuid) + uint32 m_categoryId; // the category ID + bool m_isFinalized; // is this a finalized item? NodeHistoryItem() { - mStartTime = 0.0f; - mEndTime = 0.0f; - mMotionID = MCORE_INVALIDINDEX32; - mTrackIndex = InvalidIndex; - mCachedKey = InvalidIndex; - mNodeId = AnimGraphNodeId(); - mAnimGraphInstance = nullptr; - mAnimGraphID = MCORE_INVALIDINDEX32; - mNodeType = AZ::TypeId::CreateNull(); - mCategoryID = MCORE_INVALIDINDEX32; - mColor.Set(1.0f, 0.0f, 0.0f, 1.0f); - mTypeColor.Set(1.0f, 0.0f, 0.0f, 1.0f); - mIsFinalized = false; + m_startTime = 0.0f; + m_endTime = 0.0f; + m_motionId = MCORE_INVALIDINDEX32; + m_trackIndex = InvalidIndex; + m_cachedKey = InvalidIndex; + m_nodeId = AnimGraphNodeId(); + m_animGraphInstance = nullptr; + m_animGraphId = MCORE_INVALIDINDEX32; + m_nodeType = AZ::TypeId::CreateNull(); + m_categoryId = MCORE_INVALIDINDEX32; + m_color.Set(1.0f, 0.0f, 0.0f, 1.0f); + m_typeColor.Set(1.0f, 0.0f, 0.0f, 1.0f); + m_isFinalized = false; } }; @@ -168,13 +168,13 @@ namespace EMotionFX struct EMFX_API ExtractedNodeHistoryItem { - NodeHistoryItem* mNodeHistoryItem; - size_t mTrackIndex; - float mValue; - float mKeyTrackSampleTime; + NodeHistoryItem* m_nodeHistoryItem; + size_t m_trackIndex; + float m_value; + float m_keyTrackSampleTime; - friend bool operator< (const ExtractedNodeHistoryItem& a, const ExtractedNodeHistoryItem& b) { return (a.mValue > b.mValue); } - friend bool operator==(const ExtractedNodeHistoryItem& a, const ExtractedNodeHistoryItem& b) { return (a.mValue == b.mValue); } + friend bool operator< (const ExtractedNodeHistoryItem& a, const ExtractedNodeHistoryItem& b) { return (a.m_value > b.m_value); } + friend bool operator==(const ExtractedNodeHistoryItem& a, const ExtractedNodeHistoryItem& b) { return (a.m_value == b.m_value); } }; struct EMFX_API TransformTracks final @@ -183,38 +183,38 @@ namespace EMotionFX static void Reflect(AZ::ReflectContext* context); - KeyTrackLinearDynamic mPositions; - KeyTrackLinearDynamic mRotations; + KeyTrackLinearDynamic m_positions; + KeyTrackLinearDynamic m_rotations; #ifndef EMFX_SCALE_DISABLED - KeyTrackLinearDynamic mScales; + KeyTrackLinearDynamic m_scales; #endif }; struct EMFX_API AnimGraphAnimObjectInfo { - size_t mFrameByteOffset; - AnimGraphObject* mObject; + size_t m_frameByteOffset; + AnimGraphObject* m_object; }; struct EMFX_API AnimGraphAnimFrame { - float mTimeValue = 0.0f; - size_t mByteOffset = 0; - size_t mNumBytes = 0; - AZStd::vector mObjectInfos{}; - AZStd::vector> mParameterValues{}; + float m_timeValue = 0.0f; + size_t m_byteOffset = 0; + size_t m_numBytes = 0; + AZStd::vector m_objectInfos{}; + AZStd::vector> m_parameterValues{}; }; struct EMFX_API AnimGraphInstanceData { - AnimGraphInstance* mAnimGraphInstance = nullptr; - size_t mNumFrames = 0; - size_t mDataBufferSize = 0; - uint8* mDataBuffer = nullptr; - AZStd::vector mFrames{}; + AnimGraphInstance* m_animGraphInstance = nullptr; + size_t m_numFrames = 0; + size_t m_dataBufferSize = 0; + uint8* m_dataBuffer = nullptr; + AZStd::vector m_frames{}; AnimGraphInstanceData() = default; AnimGraphInstanceData(const AnimGraphInstanceData&) = delete; @@ -224,16 +224,16 @@ namespace EMotionFX { return; } - mAnimGraphInstance = rhs.mAnimGraphInstance; - mNumFrames = rhs.mNumFrames; - mDataBufferSize = rhs.mDataBufferSize; - mDataBuffer = rhs.mDataBuffer; - mFrames = AZStd::move(rhs.mFrames); - rhs.mAnimGraphInstance = nullptr; - rhs.mNumFrames = 0; - rhs.mDataBufferSize = 0; - rhs.mDataBuffer = nullptr; - rhs.mFrames = {}; + m_animGraphInstance = rhs.m_animGraphInstance; + m_numFrames = rhs.m_numFrames; + m_dataBufferSize = rhs.m_dataBufferSize; + m_dataBuffer = rhs.m_dataBuffer; + m_frames = AZStd::move(rhs.m_frames); + rhs.m_animGraphInstance = nullptr; + rhs.m_numFrames = 0; + rhs.m_dataBufferSize = 0; + rhs.m_dataBuffer = nullptr; + rhs.m_frames = {}; } AnimGraphInstanceData& operator=(const AnimGraphInstanceData&) = delete; @@ -243,22 +243,22 @@ namespace EMotionFX { return *this; } - mAnimGraphInstance = rhs.mAnimGraphInstance; - mNumFrames = rhs.mNumFrames; - mDataBufferSize = rhs.mDataBufferSize; - mDataBuffer = rhs.mDataBuffer; - mFrames = AZStd::move(rhs.mFrames); - rhs.mAnimGraphInstance = nullptr; - rhs.mNumFrames = 0; - rhs.mDataBufferSize = 0; - rhs.mDataBuffer = nullptr; - rhs.mFrames = {}; + m_animGraphInstance = rhs.m_animGraphInstance; + m_numFrames = rhs.m_numFrames; + m_dataBufferSize = rhs.m_dataBufferSize; + m_dataBuffer = rhs.m_dataBuffer; + m_frames = AZStd::move(rhs.m_frames); + rhs.m_animGraphInstance = nullptr; + rhs.m_numFrames = 0; + rhs.m_dataBufferSize = 0; + rhs.m_dataBuffer = nullptr; + rhs.m_frames = {}; return *this; } ~AnimGraphInstanceData() { - MCore::Free(mDataBuffer); + MCore::Free(m_dataBuffer); } }; @@ -267,40 +267,40 @@ namespace EMotionFX AZ_TYPE_INFO(EMotionFX::Recorder::ActorInstanceData, "{955A7EF9-5DC6-4548-BB72-10C974CF3886}"); AZ_CLASS_ALLOCATOR_DECL - ActorInstance* mActorInstance; // the actor instance this data is about - AnimGraphInstanceData* mAnimGraphData; // the anim graph instance data + ActorInstance* m_actorInstance; // the actor instance this data is about + AnimGraphInstanceData* m_animGraphData; // the anim graph instance data AZStd::vector m_transformTracks; // the transformation tracks, one for each node - AZStd::vector mNodeHistoryItems; // node history items - AZStd::vector mEventHistoryItems; // event history item - TransformTracks mActorLocalTransform; // the actor instance's local transformation - AZStd::vector< KeyTrackLinearDynamic > mMorphTracks; // morph animation data + AZStd::vector m_nodeHistoryItems; // node history items + AZStd::vector m_eventHistoryItems; // event history item + TransformTracks m_actorLocalTransform; // the actor instance's local transformation + AZStd::vector< KeyTrackLinearDynamic > m_morphTracks; // morph animation data ActorInstanceData() { - mNodeHistoryItems.reserve(64); - mEventHistoryItems.reserve(1024); - mMorphTracks.reserve(32); - mAnimGraphData = nullptr; - mActorInstance = nullptr; + m_nodeHistoryItems.reserve(64); + m_eventHistoryItems.reserve(1024); + m_morphTracks.reserve(32); + m_animGraphData = nullptr; + m_actorInstance = nullptr; } ~ActorInstanceData() { // clear the node history items - for (NodeHistoryItem* nodeHistoryItem : mNodeHistoryItems) + for (NodeHistoryItem* nodeHistoryItem : m_nodeHistoryItems) { delete nodeHistoryItem; } - mNodeHistoryItems.clear(); + m_nodeHistoryItems.clear(); // clear the event history items - for (auto & eventHistoryItem : mEventHistoryItems) + for (auto & eventHistoryItem : m_eventHistoryItems) { delete eventHistoryItem; } - mEventHistoryItems.clear(); + m_eventHistoryItems.clear(); - delete mAnimGraphData; + delete m_animGraphData; } static void Reflect(AZ::ReflectContext* context); @@ -334,13 +334,13 @@ namespace EMotionFX void SampleAndApplyAnimGraphs(float timeInSeconds) const; void SampleAndApplyMorphs(float timeInSeconds, ActorInstance* actorInstance) const; - MCORE_INLINE float GetRecordTime() const { return mRecordTime; } - MCORE_INLINE float GetCurrentPlayTime() const { return mCurrentPlayTime; } - MCORE_INLINE bool GetIsRecording() const { return mIsRecording; } - MCORE_INLINE bool GetIsInPlayMode() const { return mIsInPlayMode; } - MCORE_INLINE bool GetIsInAutoPlayMode() const { return mAutoPlay; } + MCORE_INLINE float GetRecordTime() const { return m_recordTime; } + MCORE_INLINE float GetCurrentPlayTime() const { return m_currentPlayTime; } + MCORE_INLINE bool GetIsRecording() const { return m_isRecording; } + MCORE_INLINE bool GetIsInPlayMode() const { return m_isInPlayMode; } + MCORE_INLINE bool GetIsInAutoPlayMode() const { return m_autoPlay; } bool GetHasRecorded(ActorInstance* actorInstance) const; - MCORE_INLINE const RecordSettings& GetRecordSettings() const { return mRecordSettings; } + MCORE_INLINE const RecordSettings& GetRecordSettings() const { return m_recordSettings; } const AZ::Uuid& GetSessionUuid() const { return m_sessionUuid; } const AZStd::vector& GetTimeDeltas() { return m_timeDeltas; } @@ -367,19 +367,19 @@ namespace EMotionFX void Unlock(); private: - RecordSettings mRecordSettings; + RecordSettings m_recordSettings; AZStd::vector m_actorInstanceDatas; AZStd::vector m_timeDeltas; // The value of the time deltas whenever a key is made - AZStd::vector mObjects; - AZStd::vector mActiveNodes; /**< A temp array to store active animgraph nodes in. */ - MCore::Mutex mLock; + AZStd::vector m_objects; + AZStd::vector m_activeNodes; /**< A temp array to store active animgraph nodes in. */ + MCore::Mutex m_lock; AZ::TypeId m_sessionUuid; - float mRecordTime; - float mLastRecordTime; - float mCurrentPlayTime; - bool mIsRecording; - bool mIsInPlayMode; - bool mAutoPlay; + float m_recordTime; + float m_lastRecordTime; + float m_currentPlayTime; + bool m_isRecording; + bool m_isInPlayMode; + bool m_autoPlay; void PrepareForRecording(); void RecordMorphs(); diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/RepositioningLayerPass.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/RepositioningLayerPass.cpp index 6bbf60700b..1e3171d419 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/RepositioningLayerPass.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/RepositioningLayerPass.cpp @@ -26,7 +26,7 @@ namespace EMotionFX RepositioningLayerPass::RepositioningLayerPass(MotionLayerSystem* motionLayerSystem) : LayerPass(motionLayerSystem) { - mLastReposNode = InvalidIndex; + m_lastReposNode = InvalidIndex; } @@ -53,7 +53,7 @@ namespace EMotionFX // The main function that processes the pass. void RepositioningLayerPass::Process() { - ActorInstance* actorInstance = mMotionSystem->GetActorInstance(); + ActorInstance* actorInstance = m_motionSystem->GetActorInstance(); if (!actorInstance->GetMotionExtractionEnabled()) { actorInstance->SetTrajectoryDeltaTransform(Transform::CreateIdentityWithZeroScale()); @@ -63,7 +63,7 @@ namespace EMotionFX // Get the motion extraction node and check if we are actually playing any motions. Actor* actor = actorInstance->GetActor(); Node* motionExtractNode = actor->GetMotionExtractionNode(); - if (!motionExtractNode || mMotionSystem->GetNumMotionInstances() == 0) + if (!motionExtractNode || m_motionSystem->GetNumMotionInstances() == 0) { actorInstance->SetTrajectoryDeltaTransform(Transform::CreateIdentityWithZeroScale()); return; @@ -77,10 +77,10 @@ namespace EMotionFX // Bottom up traversal of the layers. bool firstBlend = true; - const size_t numMotionInstances = mMotionSystem->GetNumMotionInstances(); + const size_t numMotionInstances = m_motionSystem->GetNumMotionInstances(); for (size_t i = numMotionInstances - 1; i != InvalidIndex; --i) { - MotionInstance* motionInstance = mMotionSystem->GetMotionInstance(i); + MotionInstance* motionInstance = m_motionSystem->GetMotionInstance(i); if (!motionInstance->GetMotionExtractionEnabled()) { continue; diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/RepositioningLayerPass.h b/Gems/EMotionFX/Code/EMotionFX/Source/RepositioningLayerPass.h index 4df680092a..333749141a 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/RepositioningLayerPass.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/RepositioningLayerPass.h @@ -59,8 +59,8 @@ namespace EMotionFX private: - AZStd::vector mHierarchyPath; /**< The path of node indices to the repositioning node. */ - size_t mLastReposNode; /**< The last repositioning node index that was used. When this changes, the hierarchy path has to be updated. */ + AZStd::vector m_hierarchyPath; /**< The path of node indices to the repositioning node. */ + size_t m_lastReposNode; /**< The last repositioning node index that was used. When this changes, the hierarchy path has to be updated. */ /** * The constructor. diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/SingleThreadScheduler.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/SingleThreadScheduler.cpp index 0e871499df..f5ba7856ac 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/SingleThreadScheduler.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/SingleThreadScheduler.cpp @@ -45,9 +45,9 @@ namespace EMotionFX const ActorManager& actorManager = GetActorManager(); // reset stats - mNumUpdated.SetValue(0); - mNumVisible.SetValue(0); - mNumSampled.SetValue(0); + m_numUpdated.SetValue(0); + m_numVisible.SetValue(0); + m_numSampled.SetValue(0); // propagate root actor instance visibility to their attachments const size_t numRootActorInstances = GetActorManager().GetNumRootActorInstances(); @@ -81,7 +81,7 @@ namespace EMotionFX { actorInstance->SetThreadIndex(0); - mNumUpdated.Increment(); + m_numUpdated.Increment(); const bool isVisible = actorInstance->GetIsVisible(); @@ -95,13 +95,13 @@ namespace EMotionFX if (isVisible) { - mNumSampled.Increment(); + m_numSampled.Increment(); } } if (isVisible) { - mNumVisible.Increment(); + m_numVisible.Increment(); } // update the transformations diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/SkinningInfoVertexAttributeLayer.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/SkinningInfoVertexAttributeLayer.cpp index 4483d98e40..5a3c01802e 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/SkinningInfoVertexAttributeLayer.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/SkinningInfoVertexAttributeLayer.cpp @@ -23,8 +23,8 @@ namespace EMotionFX { if (allocData) { - mData.SetNumPreCachedElements(2); // assume 2 weights per vertex - mData.Resize(numAttributes); + m_data.SetNumPreCachedElements(2); // assume 2 weights per vertex + m_data.Resize(numAttributes); } } @@ -65,25 +65,25 @@ namespace EMotionFX // add a given influence (using a bone and a weight) void SkinningInfoVertexAttributeLayer::AddInfluence(size_t attributeNr, size_t nodeNr, float weight, size_t boneNr) { - mData.Add(attributeNr, SkinInfluence(static_cast(nodeNr), weight, static_cast(boneNr))); + m_data.Add(attributeNr, SkinInfluence(static_cast(nodeNr), weight, static_cast(boneNr))); } // remove the given skin influence void SkinningInfoVertexAttributeLayer::RemoveInfluence(size_t attributeNr, size_t influenceNr) { - mData.Remove(attributeNr, influenceNr); + m_data.Remove(attributeNr, influenceNr); } // the uv vertex attribute layer VertexAttributeLayer* SkinningInfoVertexAttributeLayer::Clone() { - SkinningInfoVertexAttributeLayer* clone = aznew SkinningInfoVertexAttributeLayer(mNumAttributes); + SkinningInfoVertexAttributeLayer* clone = aznew SkinningInfoVertexAttributeLayer(m_numAttributes); // copy over the data - clone->mData = mData; - clone->mNameID = mNameID; + clone->m_data = m_data; + clone->m_nameId = m_nameId; // return the clone return clone; @@ -93,14 +93,14 @@ namespace EMotionFX // swap attribute data data void SkinningInfoVertexAttributeLayer::SwapAttributes(uint32 attribA, uint32 attribB) { - mData.Swap(attribA, attribB); + m_data.Swap(attribA, attribB); } // remove attributes void SkinningInfoVertexAttributeLayer::RemoveAttributes(uint32 startAttributeNr, uint32 endAttributeNr) { - mData.RemoveRows(startAttributeNr, endAttributeNr, true); + m_data.RemoveRows(startAttributeNr, endAttributeNr, true); } @@ -108,7 +108,7 @@ namespace EMotionFX void SkinningInfoVertexAttributeLayer::RemapInfluences(size_t oldNodeNr, size_t newNodeNr) { // get the number of vertices/attributes - const size_t numAttributes = mData.GetNumRows(); + const size_t numAttributes = m_data.GetNumRows(); for (size_t a = 0; a < numAttributes; ++a) { // iterate through all influences and compare them with the old node @@ -129,7 +129,7 @@ namespace EMotionFX void SkinningInfoVertexAttributeLayer::RemoveAllInfluencesForNode(size_t nodeNr) { // get the number of vertices/attributes - const size_t numAttributes = mData.GetNumRows(); + const size_t numAttributes = m_data.GetNumRows(); for (size_t a = 0; a < numAttributes; ++a) { // iterate through all influences and compare them with the given node @@ -159,7 +159,7 @@ namespace EMotionFX } // get the number of vertices/attributes - const size_t numAttributes = mData.GetNumRows(); + const size_t numAttributes = m_data.GetNumRows(); for (size_t a = 0; a < numAttributes; ++a) { // get the number of influences for the current vertex @@ -183,7 +183,7 @@ namespace EMotionFX // optimize the memory usage void SkinningInfoVertexAttributeLayer::OptimizeMemoryUsage() { - mData.Shrink(); + m_data.Shrink(); } @@ -191,7 +191,7 @@ namespace EMotionFX void SkinningInfoVertexAttributeLayer::OptimizeInfluences(float tolerance, size_t maxWeights) { // get the number of vertices/attributes - const size_t numAttributes = mData.GetNumRows(); + const size_t numAttributes = m_data.GetNumRows(); for (size_t a = 0; a < numAttributes; ++a) { if (GetNumInfluences(a) == 0) @@ -257,7 +257,7 @@ namespace EMotionFX const float remaining = 1.0f - totalWeight; for (size_t i = 0; i < numInfluences; ++i) { - const float percentage = mData.GetElement(a, i).GetWeight() / totalWeight; + const float percentage = m_data.GetElement(a, i).GetWeight() / totalWeight; GetInfluence(a, i)->SetWeight(GetInfluence(a, i)->GetWeight() + percentage * remaining); } } diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/SkinningInfoVertexAttributeLayer.h b/Gems/EMotionFX/Code/EMotionFX/Source/SkinningInfoVertexAttributeLayer.h index 48eeabac77..1dfec9926f 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/SkinningInfoVertexAttributeLayer.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/SkinningInfoVertexAttributeLayer.h @@ -28,9 +28,9 @@ namespace EMotionFX * Default constructor. */ SkinInfluence() - : mWeight(0.0f) - , mBoneNr(0) - , mNodeNr(0) {} + : m_weight(0.0f) + , m_boneNr(0) + , m_nodeNr(0) {} /** * Constructor. @@ -39,52 +39,52 @@ namespace EMotionFX * @param boneNr The bone number, used as optimization inside the softskin deformer. */ SkinInfluence(uint16 nodeNr, float weight, uint16 boneNr = 0) - : mWeight(weight) - , mBoneNr(boneNr) - , mNodeNr(nodeNr) {} + : m_weight(weight) + , m_boneNr(boneNr) + , m_nodeNr(nodeNr) {} /** * Get the weight of this influence. * @result The weight, which should be in range of [0..1]. */ - MCORE_INLINE float GetWeight() const { return mWeight; } + MCORE_INLINE float GetWeight() const { return m_weight; } /** * Adjust the weight value. * @param weight The weight value, which must be in range of [0..1]. */ - void SetWeight(float weight) { mWeight = weight; } + void SetWeight(float weight) { m_weight = weight; } /** * Get the node number that points inside an actor. * So this number is an index you can pass to Actor::GetNode(...) to get the actual node that acts as bone. * @result The node number, which points inside the nodes array of the actor. */ - MCORE_INLINE uint16 GetNodeNr() const { return mNodeNr; } + MCORE_INLINE uint16 GetNodeNr() const { return m_nodeNr; } /** * Set the node number that points inside an actor. * So this number is an index you can pass to Actor::GetNode(...) to get the actual node that acts as bone. * @param nodeNr The node number, which points inside the nodes array of the actor. */ - void SetNodeNr(uint16 nodeNr) { mNodeNr = nodeNr; } + void SetNodeNr(uint16 nodeNr) { m_nodeNr = nodeNr; } /** * Set the bone number, used for precalculations. * @param boneNr The bone number. */ - void SetBoneNr(uint16 boneNr) { mBoneNr = boneNr; } + void SetBoneNr(uint16 boneNr) { m_boneNr = boneNr; } /** * Get the bone number, which is used for precalculations. * @result The bone number. */ - MCORE_INLINE uint16 GetBoneNr() const { return mBoneNr; } + MCORE_INLINE uint16 GetBoneNr() const { return m_boneNr; } private: - float mWeight; /**< The weight value, between 0 and 1. */ - uint16 mBoneNr; /**< A bone number, which points in an array of bone info structs used for precalculating the skinning matrices. */ - uint16 mNodeNr; /**< The node number inside the actor which acts as a bone. */ + float m_weight; /**< The weight value, between 0 and 1. */ + uint16 m_boneNr; /**< A bone number, which points in an array of bone info structs used for precalculating the skinning matrices. */ + uint16 m_nodeNr; /**< The node number inside the actor which acts as a bone. */ }; @@ -149,7 +149,7 @@ namespace EMotionFX * @param attributeNr The attribute/vertex number. * @result The number of influences. */ - MCORE_INLINE size_t GetNumInfluences(size_t attributeNr) { return mData.GetNumElements(attributeNr); } + MCORE_INLINE size_t GetNumInfluences(size_t attributeNr) { return m_data.GetNumElements(attributeNr); } /** * Get a given influence. @@ -157,14 +157,14 @@ namespace EMotionFX * @param influenceNr The influence number, which must be in range of [0..GetNumInfluences()] * @result The given influence. */ - MCORE_INLINE SkinInfluence* GetInfluence(size_t attributeNr, size_t influenceNr) { return &mData.GetElement(attributeNr, influenceNr); } + MCORE_INLINE SkinInfluence* GetInfluence(size_t attributeNr, size_t influenceNr) { return &m_data.GetElement(attributeNr, influenceNr); } /** * Get direct access to the jagged 2D array that contains the skinning influence data. * This can be used in the importers for fast loading and not having to add influence per influence. * @result A reference to the 2D array containing all the skinning influences. */ - MCORE_INLINE MCore::Array2D& GetArray2D() { return mData; } + MCORE_INLINE MCore::Array2D& GetArray2D() { return m_data; } /** * Collect all unique joint indices used by the skin. @@ -251,7 +251,7 @@ namespace EMotionFX void CollapseInfluences(size_t attributeNr); private: - MCore::Array2D mData; /**< The stored influence data. The Array2D template allows a different number of skinning influences per vertex. */ + MCore::Array2D m_data; /**< The stored influence data. The Array2D template allows a different number of skinning influences per vertex. */ /** * The constructor. diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/SoftSkinDeformer.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/SoftSkinDeformer.cpp index 004e415501..9b9c808eac 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/SoftSkinDeformer.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/SoftSkinDeformer.cpp @@ -34,8 +34,8 @@ namespace EMotionFX // destructor SoftSkinDeformer::~SoftSkinDeformer() { - mNodeNumbers.clear(); - mBoneMatrices.clear(); + m_nodeNumbers.clear(); + m_boneMatrices.clear(); } @@ -67,8 +67,8 @@ namespace EMotionFX SoftSkinDeformer* result = aznew SoftSkinDeformer(mesh); // copy the bone info (for precalc/optimization reasons) - result->mNodeNumbers = mNodeNumbers; - result->mBoneMatrices = mBoneMatrices; + result->m_nodeNumbers = m_nodeNumbers; + result->m_boneMatrices = m_boneMatrices; // return the result return result; @@ -86,24 +86,24 @@ namespace EMotionFX const AZ::Matrix3x4* skinningMatrices = transformData->GetSkinningMatrices(); // precalc the skinning matrices - const size_t numBones = mBoneMatrices.size(); + const size_t numBones = m_boneMatrices.size(); for (size_t i = 0; i < numBones; i++) { - const size_t nodeIndex = mNodeNumbers[i]; - mBoneMatrices[i] = skinningMatrices[nodeIndex]; + const size_t nodeIndex = m_nodeNumbers[i]; + m_boneMatrices[i] = skinningMatrices[nodeIndex]; } // find the skinning layer - SkinningInfoVertexAttributeLayer* layer = (SkinningInfoVertexAttributeLayer*)mMesh->FindSharedVertexAttributeLayer(SkinningInfoVertexAttributeLayer::TYPE_ID); + SkinningInfoVertexAttributeLayer* layer = (SkinningInfoVertexAttributeLayer*)m_mesh->FindSharedVertexAttributeLayer(SkinningInfoVertexAttributeLayer::TYPE_ID); AZ_Assert(layer, "Cannot find skinning info"); // Perform the skinning. - AZ::Vector3* __restrict positions = static_cast(mMesh->FindVertexData(Mesh::ATTRIB_POSITIONS)); - AZ::Vector3* __restrict normals = static_cast(mMesh->FindVertexData(Mesh::ATTRIB_NORMALS)); - AZ::Vector4* __restrict tangents = static_cast(mMesh->FindVertexData(Mesh::ATTRIB_TANGENTS)); - AZ::Vector3* __restrict bitangents = static_cast(mMesh->FindVertexData(Mesh::ATTRIB_BITANGENTS)); - AZ::u32* __restrict orgVerts = static_cast(mMesh->FindVertexData(Mesh::ATTRIB_ORGVTXNUMBERS)); - SkinVertexRange(0, mMesh->GetNumVertices(), positions, normals, tangents, bitangents, orgVerts, layer); + AZ::Vector3* __restrict positions = static_cast(m_mesh->FindVertexData(Mesh::ATTRIB_POSITIONS)); + AZ::Vector3* __restrict normals = static_cast(m_mesh->FindVertexData(Mesh::ATTRIB_NORMALS)); + AZ::Vector4* __restrict tangents = static_cast(m_mesh->FindVertexData(Mesh::ATTRIB_TANGENTS)); + AZ::Vector3* __restrict bitangents = static_cast(m_mesh->FindVertexData(Mesh::ATTRIB_BITANGENTS)); + AZ::u32* __restrict orgVerts = static_cast(m_mesh->FindVertexData(Mesh::ATTRIB_ORGVTXNUMBERS)); + SkinVertexRange(0, m_mesh->GetNumVertices(), positions, normals, tangents, bitangents, orgVerts, layer); } @@ -134,7 +134,7 @@ namespace EMotionFX for (size_t i = 0; i < numInfluences; ++i) { const SkinInfluence* influence = layer->GetInfluence(orgVertex, i); - MCore::Skin(mBoneMatrices[influence->GetBoneNr()], &vtxPos, &normal, &tangent, &bitangent, &newPos, &newNormal, &newTangent, &newBitangent, influence->GetWeight()); + MCore::Skin(m_boneMatrices[influence->GetBoneNr()], &vtxPos, &normal, &tangent, &bitangent, &newPos, &newNormal, &newTangent, &newBitangent, influence->GetWeight()); } newTangent.SetW(tangents[v].GetW()); @@ -163,7 +163,7 @@ namespace EMotionFX for (size_t i = 0; i < numInfluences; ++i) { const SkinInfluence* influence = layer->GetInfluence(orgVertex, i); - MCore::Skin(mBoneMatrices[influence->GetBoneNr()], &vtxPos, &normal, &tangent, &newPos, &newNormal, &newTangent, influence->GetWeight()); + MCore::Skin(m_boneMatrices[influence->GetBoneNr()], &vtxPos, &normal, &tangent, &newPos, &newNormal, &newTangent, influence->GetWeight()); } newTangent.SetW(tangents[v].GetW()); @@ -190,7 +190,7 @@ namespace EMotionFX for (size_t i = 0; i < numInfluences; ++i) { const SkinInfluence* influence = layer->GetInfluence(orgVertex, i); - MCore::Skin(mBoneMatrices[influence->GetBoneNr()], &vtxPos, &normal, &newPos, &newNormal, influence->GetWeight()); + MCore::Skin(m_boneMatrices[influence->GetBoneNr()], &vtxPos, &normal, &newPos, &newNormal, influence->GetWeight()); } // output the skinned values @@ -209,24 +209,21 @@ namespace EMotionFX MCORE_UNUSED(lodLevel); // clear the bone information array - mBoneMatrices.clear(); - mNodeNumbers.clear(); + m_boneMatrices.clear(); + m_nodeNumbers.clear(); // if there is no mesh - if (mMesh == nullptr) + if (m_mesh == nullptr) { return; } // get the attribute number - SkinningInfoVertexAttributeLayer* skinningLayer = (SkinningInfoVertexAttributeLayer*)mMesh->FindSharedVertexAttributeLayer(SkinningInfoVertexAttributeLayer::TYPE_ID); + SkinningInfoVertexAttributeLayer* skinningLayer = (SkinningInfoVertexAttributeLayer*)m_mesh->FindSharedVertexAttributeLayer(SkinningInfoVertexAttributeLayer::TYPE_ID); MCORE_ASSERT(skinningLayer); - // reserve space for the bone array - //mBones.Reserve( actor->GetNumNodes() ); - // find out what bones this mesh uses - const uint32 numOrgVerts = mMesh->GetNumOrgVertices(); + const uint32 numOrgVerts = m_mesh->GetNumOrgVertices(); for (uint32 i = 0; i < numOrgVerts; i++) { // now we have located the skinning information for this vertex, we can see if our bones array @@ -246,17 +243,14 @@ namespace EMotionFX if (boneIndex == InvalidIndex) { // add the bone to the array of bones in this deformer - mNodeNumbers.emplace_back(influence->GetNodeNr()); - mBoneMatrices.emplace_back(mat); - boneIndex = mBoneMatrices.size() - 1; + m_nodeNumbers.emplace_back(influence->GetNodeNr()); + m_boneMatrices.emplace_back(mat); + boneIndex = m_boneMatrices.size() - 1; } // set the bone number in the influence influence->SetBoneNr(static_cast(boneIndex)); - //MCore::LogInfo("influence %d/%d = %s with weight %f [nodeIndex=%d] [boneIndex=%d]", a+1, numInfluences, actor->GetNode(influence->GetNodeNr())->GetName(), influence->GetWeight(), influence->GetNodeNr(), boneIndex); } } - // get rid of all items in the used bones array - // mBones.Shrink(); } } // namespace EMotionFX diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/SoftSkinDeformer.h b/Gems/EMotionFX/Code/EMotionFX/Source/SoftSkinDeformer.h index 466f1702a7..ce157baf49 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/SoftSkinDeformer.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/SoftSkinDeformer.h @@ -100,26 +100,26 @@ namespace EMotionFX * This is the number of different bones that the skinning information of the mesh where this deformer works on uses. * @result The number of bones. */ - MCORE_INLINE size_t GetNumLocalBones() const { return mNodeNumbers.size(); } + MCORE_INLINE size_t GetNumLocalBones() const { return m_nodeNumbers.size(); } /** * Get the node number of a given local bone. * @param index The local bone number, which must be in range of [0..GetNumLocalBones()-1]. * @result The node number, which is in range of [0..Actor::GetNumNodes()-1], depending on the actor where this deformer works on. */ - MCORE_INLINE size_t GetLocalBone(size_t index) const { return mNodeNumbers[index]; } + MCORE_INLINE size_t GetLocalBone(size_t index) const { return m_nodeNumbers[index]; } /** * Pre-allocate space for a given number of local bones. * This does not alter the value returned by GetNumLocalBones(). * @param numBones The number of bones to pre-allocate space for. */ - MCORE_INLINE void ReserveLocalBones(size_t numBones) { mNodeNumbers.reserve(numBones); mBoneMatrices.reserve(numBones); } + MCORE_INLINE void ReserveLocalBones(size_t numBones) { m_nodeNumbers.reserve(numBones); m_boneMatrices.reserve(numBones); } protected: - AZStd::vector mBoneMatrices; - AZStd::vector mNodeNumbers; + AZStd::vector m_boneMatrices; + AZStd::vector m_nodeNumbers; /** * Default constructor. @@ -135,12 +135,12 @@ namespace EMotionFX /** * Find the entry number that uses a specified node number. * @param nodeIndex The node number to search for. - * @result The index inside the mBones member array, which uses the given node. + * @result The index inside the m_bones member array, which uses the given node. */ MCORE_INLINE size_t FindLocalBoneIndex(size_t nodeIndex) const { - const auto foundBoneIndex = AZStd::find(begin(mNodeNumbers), end(mNodeNumbers), nodeIndex); - return foundBoneIndex != end(mNodeNumbers) ? AZStd::distance(begin(mNodeNumbers), foundBoneIndex) : InvalidIndex; + const auto foundBoneIndex = AZStd::find(begin(m_nodeNumbers), end(m_nodeNumbers), nodeIndex); + return foundBoneIndex != end(m_nodeNumbers) ? AZStd::distance(begin(m_nodeNumbers), foundBoneIndex) : InvalidIndex; } void SkinVertexRange(uint32 startVertex, uint32 endVertex, AZ::Vector3* positions, AZ::Vector3* normals, AZ::Vector4* tangents, AZ::Vector3* bitangents, uint32* orgVerts, SkinningInfoVertexAttributeLayer* layer); diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/SoftSkinManager.h b/Gems/EMotionFX/Code/EMotionFX/Source/SoftSkinManager.h index 946fd531d2..3682bc1abb 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/SoftSkinManager.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/SoftSkinManager.h @@ -51,8 +51,6 @@ namespace EMotionFX SoftSkinDeformer* CreateDeformer(Mesh* mesh); private: - //bool mDetectedSSE; /**< Does the cpu support SSE instructions? */ - /** * The constructor. * When constructed, the class checks if SSE is available on the hardware. diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/SpringSolver.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/SpringSolver.cpp index 8765a0e991..83cbc41a36 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/SpringSolver.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/SpringSolver.cpp @@ -412,7 +412,7 @@ namespace EMotionFX const size_t jointIndexA = m_particles[spring.m_particleA].m_joint->GetSkeletonJointIndex(); const size_t jointIndexB = m_particles[spring.m_particleB].m_joint->GetSkeletonJointIndex(); const Pose* bindPose = m_actorInstance->GetTransformData()->GetBindPose(); - const float restLength = (bindPose->GetModelSpaceTransform(jointIndexB).mPosition - bindPose->GetModelSpaceTransform(jointIndexA).mPosition).GetLength(); + const float restLength = (bindPose->GetModelSpaceTransform(jointIndexB).m_position - bindPose->GetModelSpaceTransform(jointIndexA).m_position).GetLength(); if (restLength > AZ::Constants::FloatEpsilon) { spring.m_restLength = restLength; @@ -472,7 +472,7 @@ namespace EMotionFX const float radius = particle.m_joint->GetCollisionRadius() * scaleFactor; if (radius > 0.0f) { - const AZ::Quaternion& jointRotation = pose.GetWorldSpaceTransform(particle.m_joint->GetSkeletonJointIndex()).mRotation; + const AZ::Quaternion& jointRotation = pose.GetWorldSpaceTransform(particle.m_joint->GetSkeletonJointIndex()).m_rotation; drawData->DrawWireframeSphere(particle.m_pos, radius, AZ::Color(0.3f, 0.3f, 0.3f, 1.0f), jointRotation, 12, 12); } } @@ -485,7 +485,7 @@ namespace EMotionFX { if (collider.GetType() == CollisionObject::CollisionType::Sphere) { - const AZ::Quaternion& jointRotation = pose.GetWorldSpaceTransform(collider.m_jointIndex).mRotation; + const AZ::Quaternion& jointRotation = pose.GetWorldSpaceTransform(collider.m_jointIndex).m_rotation; drawData->DrawWireframeSphere(collider.m_globalStart, collider.m_scaledRadius, color * 0.65f, jointRotation, 16, 16); } else if (collider.GetType() == CollisionObject::CollisionType::Capsule) @@ -562,7 +562,7 @@ namespace EMotionFX AZ_Assert(joint->GetMass() > AZ::Constants::FloatEpsilon, "Expected mass to be larger than zero."); Particle particle; particle.m_joint = joint; - particle.m_pos = m_actorInstance->GetTransformData()->GetBindPose()->GetModelSpaceTransform(joint->GetSkeletonJointIndex()).mPosition; + particle.m_pos = m_actorInstance->GetTransformData()->GetBindPose()->GetModelSpaceTransform(joint->GetSkeletonJointIndex()).m_position; particle.m_oldPos = particle.m_pos; particle.m_parentParticleIndex = m_parentParticle; m_particles.emplace_back(particle); @@ -586,8 +586,8 @@ namespace EMotionFX if (restLength < 0.0f) { const Pose* pose = m_actorInstance->GetTransformData()->GetCurrentPose(); - const AZ::Vector3 posA = pose->GetWorldSpaceTransform(nodeA).mPosition; - const AZ::Vector3 posB = pose->GetWorldSpaceTransform(nodeB).mPosition; + const AZ::Vector3 posA = pose->GetWorldSpaceTransform(nodeA).m_position; + const AZ::Vector3 posB = pose->GetWorldSpaceTransform(nodeB).m_position; restLength = (posB - posA).GetLength(); } @@ -695,7 +695,7 @@ namespace EMotionFX float SpringSolver::GetScaleFactor() const { #ifndef EMFX_SCALE_DISABLED - float scaleFactor = m_actorInstance->GetWorldSpaceTransform().mScale.GetX(); + float scaleFactor = m_actorInstance->GetWorldSpaceTransform().m_scale.GetX(); if (AZ::IsClose(scaleFactor, 0.0f, AZ::Constants::FloatEpsilon)) { return AZ::Constants::FloatEpsilon; @@ -725,7 +725,7 @@ namespace EMotionFX if (stiffnessFactor > 0.0f) { const Transform jointWorldTransform = pose.GetWorldSpaceTransform(joint->GetSkeletonJointIndex()); - const AZ::Vector3 force = (jointWorldTransform.mPosition - particle.m_pos) + particle.m_externalForce; + const AZ::Vector3 force = (jointWorldTransform.m_position - particle.m_pos) + particle.m_externalForce; particle.m_force += force * stiffnessFactor; } @@ -816,17 +816,17 @@ namespace EMotionFX } else if (pinnedA && pinnedB) { - particleA.m_pos = worldTransformA.mPosition; - particleB.m_pos = worldTransformB.mPosition; + particleA.m_pos = worldTransformA.m_position; + particleB.m_pos = worldTransformB.m_position; } else if (pinnedB) { - particleB.m_pos = worldTransformB.mPosition; + particleB.m_pos = worldTransformB.m_position; particleA.m_pos += delta * diff; } else // Only particleA is pinned. { - particleA.m_pos = worldTransformA.mPosition; + particleA.m_pos = worldTransformA.m_position; particleB.m_pos -= delta * diff; } @@ -839,7 +839,7 @@ namespace EMotionFX } else { - particleB.m_limitDir = worldTransformA.mPosition - worldTransformB.mPosition; + particleB.m_limitDir = worldTransformA.m_position - worldTransformB.m_position; } PerformConeLimit(particleA, particleB, particleB.m_limitDir); } @@ -886,7 +886,7 @@ namespace EMotionFX const SimulatedJoint* joint = particle.m_joint; if (joint->IsPinned()) { - particle.m_pos = pose.GetWorldSpaceTransform(joint->GetSkeletonJointIndex()).mPosition; + particle.m_pos = pose.GetWorldSpaceTransform(joint->GetSkeletonJointIndex()).m_position; particle.m_oldPos = particle.m_pos; particle.m_force = AZ::Vector3::CreateZero(); } @@ -954,15 +954,15 @@ namespace EMotionFX const Particle& particleB = m_particles[spring.m_particleB]; Transform modelTransformB = pose.GetModelSpaceTransform(particleB.m_joint->GetSkeletonJointIndex()); const Transform& modelTransformA = pose.GetModelSpaceTransform(particleA.m_joint->GetSkeletonJointIndex()); - const AZ::Vector3 oldDir = (modelTransformA.mPosition - modelTransformB.mPosition).GetNormalizedSafe(); + const AZ::Vector3 oldDir = (modelTransformA.m_position - modelTransformB.m_position).GetNormalizedSafe(); const AZ::Vector3 newDir = m_actorInstance->GetWorldSpaceTransformInversed().TransformVector(particleA.m_pos - particleB.m_pos).GetNormalizedSafe(); - modelTransformB.mRotation = AZ::Quaternion::CreateShortestArc(oldDir, newDir).GetNormalized() * modelTransformB.mRotation; - modelTransformB.mRotation.Normalize(); + modelTransformB.m_rotation = AZ::Quaternion::CreateShortestArc(oldDir, newDir).GetNormalized() * modelTransformB.m_rotation; + modelTransformB.m_rotation.Normalize(); if (spring.m_allowStretch) { - modelTransformB.mPosition = particleB.m_pos; + modelTransformB.m_position = particleB.m_pos; } pose.SetModelSpaceTransform(particleB.m_joint->GetSkeletonJointIndex(), modelTransformB); diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/StandardMaterial.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/StandardMaterial.cpp index 5f5c439f7c..ab89b0f4b2 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/StandardMaterial.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/StandardMaterial.cpp @@ -20,15 +20,15 @@ namespace EMotionFX StandardMaterialLayer::StandardMaterialLayer() : BaseObject() { - mLayerTypeID = LAYERTYPE_UNKNOWN; - mFileNameID = MCORE_INVALIDINDEX32; - mBlendMode = LAYERBLENDMODE_NONE; - mAmount = 1.0f; - mUOffset = 0.0f; - mVOffset = 0.0f; - mUTiling = 1.0f; - mVTiling = 1.0f; - mRotationRadians = 0.0f; + m_layerTypeId = LAYERTYPE_UNKNOWN; + m_fileNameId = MCORE_INVALIDINDEX32; + m_blendMode = LAYERBLENDMODE_NONE; + m_amount = 1.0f; + m_uOffset = 0.0f; + m_vOffset = 0.0f; + m_uTiling = 1.0f; + m_vTiling = 1.0f; + m_rotationRadians = 0.0f; } @@ -36,17 +36,17 @@ namespace EMotionFX StandardMaterialLayer::StandardMaterialLayer(uint32 layerType, const char* fileName, float amount) : BaseObject() { - mLayerTypeID = layerType; - mAmount = amount; - mUOffset = 0.0f; - mVOffset = 0.0f; - mUTiling = 1.0f; - mVTiling = 1.0f; - mRotationRadians = 0.0f; - mBlendMode = LAYERBLENDMODE_NONE; + m_layerTypeId = layerType; + m_amount = amount; + m_uOffset = 0.0f; + m_vOffset = 0.0f; + m_uTiling = 1.0f; + m_vTiling = 1.0f; + m_rotationRadians = 0.0f; + m_blendMode = LAYERBLENDMODE_NONE; // calculate the ID - mFileNameID = MCore::GetStringIdPool().GenerateIdForString(fileName); + m_fileNameId = MCore::GetStringIdPool().GenerateIdForString(fileName); } @@ -73,22 +73,22 @@ namespace EMotionFX // init from another layer void StandardMaterialLayer::InitFrom(StandardMaterialLayer* layer) { - mLayerTypeID = layer->mLayerTypeID; - mFileNameID = layer->mFileNameID; - mBlendMode = layer->mBlendMode; - mAmount = layer->mAmount; - mUOffset = layer->mUOffset; - mVOffset = layer->mVOffset; - mUTiling = layer->mUTiling; - mVTiling = layer->mVTiling; - mRotationRadians = layer->mRotationRadians; + m_layerTypeId = layer->m_layerTypeId; + m_fileNameId = layer->m_fileNameId; + m_blendMode = layer->m_blendMode; + m_amount = layer->m_amount; + m_uOffset = layer->m_uOffset; + m_vOffset = layer->m_vOffset; + m_uTiling = layer->m_uTiling; + m_vTiling = layer->m_vTiling; + m_rotationRadians = layer->m_rotationRadians; } // return the layer type string const char* StandardMaterialLayer::GetTypeString() const { - switch (mLayerTypeID) + switch (m_layerTypeId) { case LAYERTYPE_UNKNOWN: { @@ -163,7 +163,7 @@ namespace EMotionFX // return the blend mode string const char* StandardMaterialLayer::GetBlendModeString() const { - switch (mBlendMode) + switch (m_blendMode) { case LAYERBLENDMODE_NONE: { @@ -225,116 +225,116 @@ namespace EMotionFX float StandardMaterialLayer::GetUOffset() const { - return mUOffset; + return m_uOffset; } float StandardMaterialLayer::GetVOffset() const { - return mVOffset; + return m_vOffset; } float StandardMaterialLayer::GetUTiling() const { - return mUTiling; + return m_uTiling; } float StandardMaterialLayer::GetVTiling() const { - return mVTiling; + return m_vTiling; } float StandardMaterialLayer::GetRotationRadians() const { - return mRotationRadians; + return m_rotationRadians; } void StandardMaterialLayer::SetUOffset(float uOffset) { - mUOffset = uOffset; + m_uOffset = uOffset; } void StandardMaterialLayer::SetVOffset(float vOffset) { - mVOffset = vOffset; + m_vOffset = vOffset; } void StandardMaterialLayer::SetUTiling(float uTiling) { - mUTiling = uTiling; + m_uTiling = uTiling; } void StandardMaterialLayer::SetVTiling(float vTiling) { - mVTiling = vTiling; + m_vTiling = vTiling; } void StandardMaterialLayer::SetRotationRadians(float rotationRadians) { - mRotationRadians = rotationRadians; + m_rotationRadians = rotationRadians; } const char* StandardMaterialLayer::GetFileName() const { - return MCore::GetStringIdPool().GetName(mFileNameID).c_str(); + return MCore::GetStringIdPool().GetName(m_fileNameId).c_str(); } const AZStd::string& StandardMaterialLayer::GetFileNameString() const { - return MCore::GetStringIdPool().GetName(mFileNameID); + return MCore::GetStringIdPool().GetName(m_fileNameId); } void StandardMaterialLayer::SetFileName(const char* fileName) { // calculate the new ID - mFileNameID = MCore::GetStringIdPool().GenerateIdForString(fileName); + m_fileNameId = MCore::GetStringIdPool().GenerateIdForString(fileName); } void StandardMaterialLayer::SetAmount(float amount) { - mAmount = amount; + m_amount = amount; } float StandardMaterialLayer::GetAmount() const { - return mAmount; + return m_amount; } uint32 StandardMaterialLayer::GetType() const { - return mLayerTypeID; + return m_layerTypeId; } void StandardMaterialLayer::SetType(uint32 typeID) { - mLayerTypeID = typeID; + m_layerTypeId = typeID; } void StandardMaterialLayer::SetBlendMode(unsigned char layerBlendMode) { - mBlendMode = layerBlendMode; + m_blendMode = layerBlendMode; } unsigned char StandardMaterialLayer::GetBlendMode() const { - return mBlendMode; + return m_blendMode; } @@ -346,16 +346,16 @@ namespace EMotionFX StandardMaterial::StandardMaterial(const char* name) : Material(name) { - mAmbient = MCore::RGBAColor(0.2f, 0.2f, 0.2f); - mDiffuse = MCore::RGBAColor(1.0f, 0.0f, 0.0f); - mSpecular = MCore::RGBAColor(1.0f, 1.0f, 1.0f); - mEmissive = MCore::RGBAColor(1.0f, 0.0f, 0.0f); - mShine = 100.0f; - mShineStrength = 1.0f; - mOpacity = 1.0f; - mIOR = 1.5f; - mDoubleSided = true; - mWireFrame = false; + m_ambient = MCore::RGBAColor(0.2f, 0.2f, 0.2f); + m_diffuse = MCore::RGBAColor(1.0f, 0.0f, 0.0f); + m_specular = MCore::RGBAColor(1.0f, 1.0f, 1.0f); + m_emissive = MCore::RGBAColor(1.0f, 0.0f, 0.0f); + m_shine = 100.0f; + m_shineStrength = 1.0f; + m_opacity = 1.0f; + m_ior = 1.5f; + m_doubleSided = true; + m_wireFrame = false; } @@ -384,24 +384,24 @@ namespace EMotionFX StandardMaterial* standardMaterial = static_cast(clone); // copy the attributes - standardMaterial->mAmbient = mAmbient; - standardMaterial->mDiffuse = mDiffuse; - standardMaterial->mSpecular = mSpecular; - standardMaterial->mEmissive = mEmissive; - standardMaterial->mShine = mShine; - standardMaterial->mShineStrength = mShineStrength; - standardMaterial->mOpacity = mOpacity; - standardMaterial->mIOR = mIOR; - standardMaterial->mDoubleSided = mDoubleSided; - standardMaterial->mWireFrame = mWireFrame; + standardMaterial->m_ambient = m_ambient; + standardMaterial->m_diffuse = m_diffuse; + standardMaterial->m_specular = m_specular; + standardMaterial->m_emissive = m_emissive; + standardMaterial->m_shine = m_shine; + standardMaterial->m_shineStrength = m_shineStrength; + standardMaterial->m_opacity = m_opacity; + standardMaterial->m_ior = m_ior; + standardMaterial->m_doubleSided = m_doubleSided; + standardMaterial->m_wireFrame = m_wireFrame; // copy the layers - const size_t numLayers = mLayers.size(); - standardMaterial->mLayers.resize(numLayers); + const size_t numLayers = m_layers.size(); + standardMaterial->m_layers.resize(numLayers); for (size_t i = 0; i < numLayers; ++i) { - standardMaterial->mLayers[i] = StandardMaterialLayer::Create(); - standardMaterial->mLayers[i]->InitFrom(mLayers[i]); + standardMaterial->m_layers[i] = StandardMaterialLayer::Create(); + standardMaterial->m_layers[i]->InitFrom(m_layers[i]); } // return the result @@ -418,9 +418,9 @@ namespace EMotionFX { layer->Destroy(); } - if (const auto it = AZStd::find(begin(mLayers), end(mLayers), layer); it != end(mLayers)) + if (const auto it = AZStd::find(begin(m_layers), end(m_layers), layer); it != end(m_layers)) { - mLayers.erase(it); + m_layers.erase(it); } } } @@ -428,180 +428,180 @@ namespace EMotionFX void StandardMaterial::SetAmbient(const MCore::RGBAColor& ambient) { - mAmbient = ambient; + m_ambient = ambient; } void StandardMaterial::SetDiffuse(const MCore::RGBAColor& diffuse) { - mDiffuse = diffuse; + m_diffuse = diffuse; } void StandardMaterial::SetSpecular(const MCore::RGBAColor& specular) { - mSpecular = specular; + m_specular = specular; } void StandardMaterial::SetEmissive(const MCore::RGBAColor& emissive) { - mEmissive = emissive; + m_emissive = emissive; } void StandardMaterial::SetShine(float shine) { - mShine = shine; + m_shine = shine; } void StandardMaterial::SetShineStrength(float shineStrength) { - mShineStrength = shineStrength; + m_shineStrength = shineStrength; } void StandardMaterial::SetOpacity(float opacity) { - mOpacity = opacity; + m_opacity = opacity; } void StandardMaterial::SetIOR(float ior) { - mIOR = ior; + m_ior = ior; } void StandardMaterial::SetDoubleSided(bool doubleSided) { - mDoubleSided = doubleSided; + m_doubleSided = doubleSided; } void StandardMaterial::SetWireFrame(bool wireFrame) { - mWireFrame = wireFrame; + m_wireFrame = wireFrame; } const MCore::RGBAColor& StandardMaterial::GetAmbient() const { - return mAmbient; + return m_ambient; } const MCore::RGBAColor& StandardMaterial::GetDiffuse() const { - return mDiffuse; + return m_diffuse; } const MCore::RGBAColor& StandardMaterial::GetSpecular() const { - return mSpecular; + return m_specular; } const MCore::RGBAColor& StandardMaterial::GetEmissive() const { - return mEmissive; + return m_emissive; } float StandardMaterial::GetShine() const { - return mShine; + return m_shine; } float StandardMaterial::GetShineStrength() const { - return mShineStrength; + return m_shineStrength; } float StandardMaterial::GetOpacity() const { - return mOpacity; + return m_opacity; } float StandardMaterial::GetIOR() const { - return mIOR; + return m_ior; } bool StandardMaterial::GetDoubleSided() const { - return mDoubleSided; + return m_doubleSided; } bool StandardMaterial::GetWireFrame() const { - return mWireFrame; + return m_wireFrame; } StandardMaterialLayer* StandardMaterial::AddLayer(StandardMaterialLayer* layer) { - mLayers.emplace_back(layer); + m_layers.emplace_back(layer); return layer; } size_t StandardMaterial::GetNumLayers() const { - return mLayers.size(); + return m_layers.size(); } StandardMaterialLayer* StandardMaterial::GetLayer(size_t nr) { - MCORE_ASSERT(nr < mLayers.size()); - return mLayers[nr]; + MCORE_ASSERT(nr < m_layers.size()); + return m_layers[nr]; } void StandardMaterial::RemoveLayer(size_t nr, bool delFromMem) { - MCORE_ASSERT(nr < mLayers.size()); + MCORE_ASSERT(nr < m_layers.size()); if (delFromMem) { - mLayers[nr]->Destroy(); + m_layers[nr]->Destroy(); } - mLayers.erase(AZStd::next(begin(mLayers), nr)); + m_layers.erase(AZStd::next(begin(m_layers), nr)); } void StandardMaterial::RemoveAllLayers() { - for (StandardMaterialLayer* layer : mLayers) + for (StandardMaterialLayer* layer : m_layers) { layer->Destroy(); } - mLayers.clear(); + m_layers.clear(); } size_t StandardMaterial::FindLayer(uint32 layerType) const { // search through all layers - const auto foundLayer = AZStd::find_if(begin(mLayers), end(mLayers), [layerType](const StandardMaterialLayer* layer) + const auto foundLayer = AZStd::find_if(begin(m_layers), end(m_layers), [layerType](const StandardMaterialLayer* layer) { return layer->GetType() == layerType; }); - return foundLayer != end(mLayers) ? AZStd::distance(begin(mLayers), foundLayer) : InvalidIndex; + return foundLayer != end(m_layers) ? AZStd::distance(begin(m_layers), foundLayer) : InvalidIndex; } void StandardMaterial::ReserveLayers(size_t numLayers) { - mLayers.reserve(numLayers); + m_layers.reserve(numLayers); } } // namespace EMotionFX diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/StandardMaterial.h b/Gems/EMotionFX/Code/EMotionFX/Source/StandardMaterial.h index 05f8154a72..6e90d8cf1f 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/StandardMaterial.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/StandardMaterial.h @@ -223,15 +223,15 @@ namespace EMotionFX float GetRotationRadians() const; private: - uint32 mFileNameID; /**< The filename of the texture, without extension or path. */ - uint32 mLayerTypeID; /**< The layer type. See the enum for some possibilities. */ - float mAmount; /**< The amount value, between 0 and 1. This can for example represent how intens the layer is. */ - float mUOffset; /**< U offset (horizontal texture shift). */ - float mVOffset; /**< V offset (vertical texture shift). */ - float mUTiling; /**< Horizontal tiling factor. */ - float mVTiling; /**< Vertical tiling factor. */ - float mRotationRadians; /**< Texture rotation in radians. */ - unsigned char mBlendMode; /**< The blend mode is used to control how successive layers of textures are combined together. */ + uint32 m_fileNameId; /**< The filename of the texture, without extension or path. */ + uint32 m_layerTypeId; /**< The layer type. See the enum for some possibilities. */ + float m_amount; /**< The amount value, between 0 and 1. This can for example represent how intens the layer is. */ + float m_uOffset; /**< U offset (horizontal texture shift). */ + float m_vOffset; /**< V offset (vertical texture shift). */ + float m_uTiling; /**< Horizontal tiling factor. */ + float m_vTiling; /**< Vertical tiling factor. */ + float m_rotationRadians; /**< Texture rotation in radians. */ + unsigned char m_blendMode; /**< The blend mode is used to control how successive layers of textures are combined together. */ /** * Default constructor. @@ -471,17 +471,17 @@ namespace EMotionFX protected: - AZStd::vector< StandardMaterialLayer* > mLayers; /**< StandardMaterial layers. */ - MCore::RGBAColor mAmbient; /**< Ambient color. */ - MCore::RGBAColor mDiffuse; /**< Diffuse color. */ - MCore::RGBAColor mSpecular; /**< Specular color. */ - MCore::RGBAColor mEmissive; /**< Self illumination color. */ - float mShine; /**< The shine value, from the phong component (the power). */ - float mShineStrength; /**< Shine strength. */ - float mOpacity; /**< The opacity amount [1.0=full opac, 0.0=full transparent]. */ - float mIOR; /**< Index of refraction. */ - bool mDoubleSided; /**< Double sided?. */ - bool mWireFrame; /**< Render in wireframe?. */ + AZStd::vector< StandardMaterialLayer* > m_layers; /**< StandardMaterial layers. */ + MCore::RGBAColor m_ambient; /**< Ambient color. */ + MCore::RGBAColor m_diffuse; /**< Diffuse color. */ + MCore::RGBAColor m_specular; /**< Specular color. */ + MCore::RGBAColor m_emissive; /**< Self illumination color. */ + float m_shine; /**< The shine value, from the phong component (the power). */ + float m_shineStrength; /**< Shine strength. */ + float m_opacity; /**< The opacity amount [1.0=full opac, 0.0=full transparent]. */ + float m_ior; /**< Index of refraction. */ + bool m_doubleSided; /**< Double sided?. */ + bool m_wireFrame; /**< Render in wireframe?. */ /** * Constructor. diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/SubMesh.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/SubMesh.cpp index d18006527f..548816b82c 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/SubMesh.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/SubMesh.cpp @@ -21,14 +21,14 @@ namespace EMotionFX // constructor SubMesh::SubMesh(Mesh* parentMesh, uint32 startVertex, uint32 startIndex, uint32 startPolygon, uint32 numVerts, uint32 numIndices, uint32 numPolygons, uint32 materialIndex, size_t numBones) { - mParentMesh = parentMesh; - mNumVertices = numVerts; - mNumIndices = numIndices; - mNumPolygons = numPolygons; - mStartIndex = startIndex; - mStartVertex = startVertex; - mStartPolygon = startPolygon; - mMaterial = materialIndex; + m_parentMesh = parentMesh; + m_numVertices = numVerts; + m_numIndices = numIndices; + m_numPolygons = numPolygons; + m_startIndex = startIndex; + m_startVertex = startVertex; + m_startPolygon = startPolygon; + m_material = materialIndex; SetNumBones(numBones); } @@ -50,8 +50,8 @@ namespace EMotionFX // clone the submesh SubMesh* SubMesh::Clone(Mesh* newParentMesh) { - SubMesh* clone = aznew SubMesh(newParentMesh, mStartVertex, mStartIndex, mStartPolygon, mNumVertices, mNumIndices, mNumPolygons, mMaterial, mBones.size()); - clone->mBones = mBones; + SubMesh* clone = aznew SubMesh(newParentMesh, m_startVertex, m_startIndex, m_startPolygon, m_numVertices, m_numIndices, m_numPolygons, m_material, m_bones.size()); + clone->m_bones = m_bones; return clone; } @@ -59,7 +59,7 @@ namespace EMotionFX // remap bone (oldNodeNr) to bone (newNodeNr) void SubMesh::RemapBone(size_t oldNodeNr, size_t newNodeNr) { - AZStd::replace(mBones.begin(), mBones.end(), oldNodeNr, newNodeNr); + AZStd::replace(m_bones.begin(), m_bones.end(), oldNodeNr, newNodeNr); } @@ -67,10 +67,10 @@ namespace EMotionFX void SubMesh::ReinitBonesArray(SkinningInfoVertexAttributeLayer* skinLayer) { // clear the bones array - mBones.clear(); + m_bones.clear(); // get shortcuts to the original vertex numbers - const uint32* orgVertices = (uint32*)mParentMesh->FindOriginalVertexData(Mesh::ATTRIB_ORGVTXNUMBERS); + const uint32* orgVertices = (uint32*)m_parentMesh->FindOriginalVertexData(Mesh::ATTRIB_ORGVTXNUMBERS); // for all vertices in the submesh const uint32 startVertex = GetStartVertex(); @@ -89,9 +89,9 @@ namespace EMotionFX const uint16 nodeNr = influence->GetNodeNr(); // put the node index in the bones array in case it isn't in already - if (AZStd::find(begin(mBones), end(mBones), nodeNr) == end(mBones)) + if (AZStd::find(begin(m_bones), end(m_bones), nodeNr) == end(m_bones)) { - mBones.emplace_back(nodeNr); + m_bones.emplace_back(nodeNr); } } } @@ -116,118 +116,118 @@ namespace EMotionFX uint32 SubMesh::GetStartIndex() const { - return mStartIndex; + return m_startIndex; } uint32 SubMesh::GetStartVertex() const { - return mStartVertex; + return m_startVertex; } uint32 SubMesh::GetStartPolygon() const { - return mStartPolygon; + return m_startPolygon; } uint32* SubMesh::GetIndices() const { - return (uint32*)(((uint8*)mParentMesh->GetIndices()) + mStartIndex * sizeof(uint32)); + return (uint32*)(((uint8*)m_parentMesh->GetIndices()) + m_startIndex * sizeof(uint32)); } uint8* SubMesh::GetPolygonVertexCounts() const { - uint8* polyVertCounts = mParentMesh->GetPolygonVertexCounts(); - return &polyVertCounts[mStartPolygon]; + uint8* polyVertCounts = m_parentMesh->GetPolygonVertexCounts(); + return &polyVertCounts[m_startPolygon]; } uint32 SubMesh::GetNumVertices() const { - return mNumVertices; + return m_numVertices; } uint32 SubMesh::GetNumIndices() const { - return mNumIndices; + return m_numIndices; } uint32 SubMesh::GetNumPolygons() const { - return mNumPolygons; + return m_numPolygons; } Mesh* SubMesh::GetParentMesh() const { - return mParentMesh; + return m_parentMesh; } void SubMesh::SetParentMesh(Mesh* mesh) { - mParentMesh = mesh; + m_parentMesh = mesh; } void SubMesh::SetMaterial(uint32 materialIndex) { - mMaterial = materialIndex; + m_material = materialIndex; } uint32 SubMesh::GetMaterial() const { - return mMaterial; + return m_material; } void SubMesh::SetStartIndex(uint32 indexOffset) { - mStartIndex = indexOffset; + m_startIndex = indexOffset; } void SubMesh::SetStartPolygon(uint32 polygonNumber) { - mStartPolygon = polygonNumber; + m_startPolygon = polygonNumber; } void SubMesh::SetStartVertex(uint32 vertexOffset) { - mStartVertex = vertexOffset; + m_startVertex = vertexOffset; } void SubMesh::SetNumIndices(uint32 numIndices) { - mNumIndices = numIndices; + m_numIndices = numIndices; } void SubMesh::SetNumVertices(uint32 numVertices) { - mNumVertices = numVertices; + m_numVertices = numVertices; } size_t SubMesh::FindBoneIndex(size_t nodeNr) const { - const auto foundBone = AZStd::find(mBones.begin(), mBones.end(), nodeNr); - return foundBone != mBones.end() ? AZStd::distance(mBones.begin(), foundBone) : InvalidIndex; + const auto foundBone = AZStd::find(m_bones.begin(), m_bones.end(), nodeNr); + return foundBone != m_bones.end() ? AZStd::distance(m_bones.begin(), foundBone) : InvalidIndex; } // remove the given bone void SubMesh::RemoveBone(size_t index) { - mBones.erase(AZStd::next(begin(mBones), index)); + m_bones.erase(AZStd::next(begin(m_bones), index)); } @@ -235,17 +235,17 @@ namespace EMotionFX { if (numBones == 0) { - mBones.clear(); + m_bones.clear(); } else { - mBones.resize(numBones); + m_bones.resize(numBones); } } void SubMesh::SetBone(size_t index, size_t nodeIndex) { - mBones[index] = nodeIndex; + m_bones[index] = nodeIndex; } } // namespace EMotionFX diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/SubMesh.h b/Gems/EMotionFX/Code/EMotionFX/Source/SubMesh.h index d234a9e4c1..57e3f2b486 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/SubMesh.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/SubMesh.h @@ -191,35 +191,35 @@ namespace EMotionFX * Get the number of bones used by this submesh. * @result The number of bones used by this submesh. */ - MCORE_INLINE size_t GetNumBones() const { return mBones.size(); } + MCORE_INLINE size_t GetNumBones() const { return m_bones.size(); } /** * Get the node index for a given bone. * @param index The bone number, which must be in range of [0..GetNumBones()-1]. * @result The node index value for the given bone. */ - MCORE_INLINE size_t GetBone(size_t index) const { return mBones[index]; } + MCORE_INLINE size_t GetBone(size_t index) const { return m_bones[index]; } /** * Get direct access to the bone values, by getting a pointer to the first bone index. * Each integer in the array represents the node number that acts as bone on this submesh. * @result A pointer to the array of bones used by this submesh. */ - MCORE_INLINE size_t* GetBones() { return mBones.data(); } + MCORE_INLINE size_t* GetBones() { return m_bones.data(); } /** * Get direct access to the bones array. * Each integer in the array represents the node number that acts as bone on this submesh. * @result A read only reference to the array of bones used by this submesh. */ - MCORE_INLINE const AZStd::vector& GetBonesArray() const { return mBones; } + MCORE_INLINE const AZStd::vector& GetBonesArray() const { return m_bones; } /** * Get direct access to the bones array. * Each integer in the array represents the node number that acts as bone on this submesh. * @result A reference to the array of bones used by this submesh. */ - MCORE_INLINE AZStd::vector& GetBonesArray() { return mBones; } + MCORE_INLINE AZStd::vector& GetBonesArray() { return m_bones; } /** * Reinitialize the bones. @@ -268,15 +268,15 @@ namespace EMotionFX protected: - AZStd::vector mBones; /**< The collection of bones. These are stored as node numbers that point into the actor. */ - uint32 mStartVertex; /**< The start vertex number in the vertex data arrays of the parent mesh. */ - uint32 mStartIndex; /**< The start index number in the index array of the parent mesh. */ - uint32 mStartPolygon; /**< The start polygon number in the polygon vertex count array of the parent mesh. */ - uint32 mNumVertices; /**< The number of vertices in this submesh. */ - uint32 mNumIndices; /**< The number of indices in this submesh. */ - uint32 mNumPolygons; /**< The number of polygons in this submesh. */ - uint32 mMaterial; /**< The material index, which points into the materials array in the Node class. */ - Mesh* mParentMesh; /**< The parent mesh. */ + AZStd::vector m_bones; /**< The collection of bones. These are stored as node numbers that point into the actor. */ + uint32 m_startVertex; /**< The start vertex number in the vertex data arrays of the parent mesh. */ + uint32 m_startIndex; /**< The start index number in the index array of the parent mesh. */ + uint32 m_startPolygon; /**< The start polygon number in the polygon vertex count array of the parent mesh. */ + uint32 m_numVertices; /**< The number of vertices in this submesh. */ + uint32 m_numIndices; /**< The number of indices in this submesh. */ + uint32 m_numPolygons; /**< The number of polygons in this submesh. */ + uint32 m_material; /**< The material index, which points into the materials array in the Node class. */ + Mesh* m_parentMesh; /**< The parent mesh. */ /** * Constructor. diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/ThreadData.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/ThreadData.cpp index e0e3f2ba3c..d36a568245 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/ThreadData.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/ThreadData.cpp @@ -19,14 +19,14 @@ namespace EMotionFX ThreadData::ThreadData() : BaseObject() { - mThreadIndex = MCORE_INVALIDINDEX32; + m_threadIndex = MCORE_INVALIDINDEX32; } // constructor ThreadData::ThreadData(uint32 threadIndex) { - mThreadIndex = threadIndex; + m_threadIndex = threadIndex; } @@ -52,12 +52,12 @@ namespace EMotionFX void ThreadData::SetThreadIndex(uint32 index) { - mThreadIndex = index; + m_threadIndex = index; } uint32 ThreadData::GetThreadIndex() const { - return mThreadIndex; + return m_threadIndex; } } // namespace EMotionFX diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/ThreadData.h b/Gems/EMotionFX/Code/EMotionFX/Source/ThreadData.h index cf66a1543e..3ad8ae605a 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/ThreadData.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/ThreadData.h @@ -34,16 +34,16 @@ namespace EMotionFX void SetThreadIndex(uint32 index); uint32 GetThreadIndex() const; - MCORE_INLINE const AnimGraphPosePool& GetPosePool() const { return mPosePool; } - MCORE_INLINE AnimGraphPosePool& GetPosePool() { return mPosePool; } + MCORE_INLINE const AnimGraphPosePool& GetPosePool() const { return m_posePool; } + MCORE_INLINE AnimGraphPosePool& GetPosePool() { return m_posePool; } - MCORE_INLINE AnimGraphRefCountedDataPool& GetRefCountedDataPool() { return mRefCountedDataPool; } - MCORE_INLINE const AnimGraphRefCountedDataPool& GetRefCountedDataPool() const { return mRefCountedDataPool; } + MCORE_INLINE AnimGraphRefCountedDataPool& GetRefCountedDataPool() { return m_refCountedDataPool; } + MCORE_INLINE const AnimGraphRefCountedDataPool& GetRefCountedDataPool() const { return m_refCountedDataPool; } private: - uint32 mThreadIndex; - AnimGraphPosePool mPosePool; - AnimGraphRefCountedDataPool mRefCountedDataPool; + uint32 m_threadIndex; + AnimGraphPosePool m_posePool; + AnimGraphRefCountedDataPool m_refCountedDataPool; ThreadData(); ThreadData(uint32 threadIndex); diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/Transform.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/Transform.cpp index 77f3382d6c..d8b9015044 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/Transform.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/Transform.cpp @@ -52,12 +52,12 @@ namespace EMotionFX // set void Transform::Set(const AZ::Vector3& position, const AZ::Quaternion& rotation) { - mRotation = rotation; - mPosition = position; + m_rotation = rotation; + m_position = position; EMFX_SCALECODE ( - mScale = AZ::Vector3::CreateOne(); + m_scale = AZ::Vector3::CreateOne(); ) } @@ -69,12 +69,12 @@ namespace EMotionFX MCORE_UNUSED(scale); #endif - mRotation = rotation; - mPosition = position; + m_rotation = rotation; + m_position = position; EMFX_SCALECODE ( - mScale = scale; + m_scale = scale; ) } @@ -82,19 +82,19 @@ namespace EMotionFX // check if this transform is equal to another bool Transform::operator == (const Transform& right) const { - if (MCore::Compare::CheckIfIsClose(mPosition, right.mPosition, MCore::Math::epsilon) == false) + if (MCore::Compare::CheckIfIsClose(m_position, right.m_position, MCore::Math::epsilon) == false) { return false; } - if (MCore::Compare::CheckIfIsClose(mRotation, right.mRotation, MCore::Math::epsilon) == false) + if (MCore::Compare::CheckIfIsClose(m_rotation, right.m_rotation, MCore::Math::epsilon) == false) { return false; } EMFX_SCALECODE ( - if (MCore::Compare::CheckIfIsClose(mScale, right.mScale, MCore::Math::epsilon) == false) + if (MCore::Compare::CheckIfIsClose(m_scale, right.m_scale, MCore::Math::epsilon) == false) { return false; } @@ -107,19 +107,19 @@ namespace EMotionFX // check if this transform is not equal to another bool Transform::operator != (const Transform& right) const { - if (MCore::Compare::CheckIfIsClose(mPosition, right.mPosition, MCore::Math::epsilon)) + if (MCore::Compare::CheckIfIsClose(m_position, right.m_position, MCore::Math::epsilon)) { return true; } - if (MCore::Compare::CheckIfIsClose(mRotation, right.mRotation, MCore::Math::epsilon)) + if (MCore::Compare::CheckIfIsClose(m_rotation, right.m_rotation, MCore::Math::epsilon)) { return true; } EMFX_SCALECODE ( - if (MCore::Compare::CheckIfIsClose(mScale, right.mScale, MCore::Math::epsilon)) + if (MCore::Compare::CheckIfIsClose(m_scale, right.m_scale, MCore::Math::epsilon)) { return true; } @@ -178,15 +178,15 @@ namespace EMotionFX void Transform::InitFromAZTransform(const AZ::Transform& transform) { #ifndef EMFX_SCALE_DISABLED - mPosition = transform.GetTranslation(); - mScale = AZ::Vector3(transform.GetUniformScale()); - mRotation = transform.GetRotation(); + m_position = transform.GetTranslation(); + m_scale = AZ::Vector3(transform.GetUniformScale()); + m_rotation = transform.GetRotation(); #else - mPosition = transform.GetTranslation(); - mRotation = transform.GetRotation(); + m_position = transform.GetTranslation(); + m_rotation = transform.GetRotation(); #endif - mRotation.Normalize(); + m_rotation.Normalize(); } @@ -196,10 +196,10 @@ namespace EMotionFX AZ::Transform result; #ifndef EMFX_SCALE_DISABLED - result = MCore::CreateFromQuaternionAndTranslationAndScale(mRotation, mPosition, mScale); + result = MCore::CreateFromQuaternionAndTranslationAndScale(m_rotation, m_position, m_scale); #else - result = AZ::Transform::CreateFromQuaternionAndTranslation(mRotation, mPosition); + result = AZ::Transform::CreateFromQuaternionAndTranslation(m_rotation, m_position); #endif return result; @@ -209,35 +209,35 @@ namespace EMotionFX // identity the transform void Transform::Identity() { - mPosition = AZ::Vector3::CreateZero(); - mRotation = AZ::Quaternion::CreateIdentity(); + m_position = AZ::Vector3::CreateZero(); + m_rotation = AZ::Quaternion::CreateIdentity(); EMFX_SCALECODE ( - mScale = AZ::Vector3::CreateOne(); + m_scale = AZ::Vector3::CreateOne(); ) } // Zero out the position, scale, and rotation. void Transform::Zero() { - mPosition = AZ::Vector3::CreateZero(); - mRotation = AZ::Quaternion::CreateZero(); + m_position = AZ::Vector3::CreateZero(); + m_rotation = AZ::Quaternion::CreateZero(); EMFX_SCALECODE ( - mScale = AZ::Vector3::CreateZero(); + m_scale = AZ::Vector3::CreateZero(); ) } // Zero out the position and scale, but set quaternion to identity. void Transform::IdentityWithZeroScale() { - mPosition = AZ::Vector3::CreateZero(); - mRotation = AZ::Quaternion::CreateIdentity(); + m_position = AZ::Vector3::CreateZero(); + m_rotation = AZ::Quaternion::CreateIdentity(); EMFX_SCALECODE ( - mScale = AZ::Vector3::CreateZero(); + m_scale = AZ::Vector3::CreateZero(); ); } @@ -245,17 +245,17 @@ namespace EMotionFX Transform& Transform::PreMultiply(const Transform& other) { #ifdef EMFX_SCALE_DISABLED - mPosition += mRotation * other.mPosition; + m_position += m_rotation * other.m_position; #else - mPosition += mRotation.TransformVector((other.mPosition * mScale)); + m_position += m_rotation.TransformVector((other.m_position * m_scale)); #endif - mRotation = mRotation * other.mRotation; - mRotation.Normalize(); + m_rotation = m_rotation * other.m_rotation; + m_rotation.Normalize(); EMFX_SCALECODE ( - mScale = mScale * other.mScale; + m_scale = m_scale * other.m_scale; ) return *this; @@ -274,25 +274,25 @@ namespace EMotionFX AZ::Vector3 Transform::TransformPoint(const AZ::Vector3& point) const { #ifdef EMFX_SCALE_DISABLED - return mPosition + mRotation * point; + return m_position + m_rotation * point; #else - return mPosition + mRotation.TransformVector((point * mScale)); + return m_position + m_rotation.TransformVector((point * m_scale)); #endif } AZ::Vector3 Transform::RotateVector(const AZ::Vector3& v) const { - return mRotation.TransformVector(v); + return m_rotation.TransformVector(v); } AZ::Vector3 Transform::TransformVector(const AZ::Vector3& v) const { #ifdef EMFX_SCALE_DISABLED - return mRotation.TransformVector(v); + return m_rotation.TransformVector(v); #else - return mRotation.TransformVector((v * mScale)); + return m_rotation.TransformVector((v * m_scale)); #endif } @@ -301,17 +301,17 @@ namespace EMotionFX Transform& Transform::Multiply(const Transform& other) { #ifdef EMFX_SCALE_DISABLED - mPosition = other.mRotation.TransformVector(mPosition) + other.mPosition; + m_position = other.m_rotation.TransformVector(m_position) + other.m_position; #else - mPosition = other.mRotation.TransformVector((mPosition * other.mScale)) + other.mPosition; + m_position = other.m_rotation.TransformVector((m_position * other.m_scale)) + other.m_position; #endif - mRotation = other.mRotation * mRotation; - mRotation.Normalize(); + m_rotation = other.m_rotation * m_rotation; + m_rotation.Normalize(); EMFX_SCALECODE ( - mScale = other.mScale * mScale; + m_scale = other.m_scale * m_scale; ) return *this; } @@ -329,7 +329,7 @@ namespace EMotionFX // normalize the quaternions Transform& Transform::Normalize() { - mRotation.Normalize(); + m_rotation.Normalize(); return *this; } @@ -348,15 +348,15 @@ namespace EMotionFX { EMFX_SCALECODE ( - mScale = mScale.GetReciprocal(); + m_scale = m_scale.GetReciprocal(); ) - mRotation = mRotation.GetConjugate(); + m_rotation = m_rotation.GetConjugate(); #ifdef EMFX_SCALE_DISABLED - mPosition = mRotation.TransformVector(-mPosition); + m_position = m_rotation.TransformVector(-m_position); #else - mPosition = mRotation.TransformVector(-mPosition) * mScale; + m_position = m_rotation.TransformVector(-m_position) * m_scale; #endif return *this; @@ -376,14 +376,14 @@ namespace EMotionFX Transform& Transform::Mirror(const AZ::Vector3& planeNormal) { // mirror the position over the plane with the specified normal - mPosition = MCore::Mirror(mPosition, planeNormal); + m_position = MCore::Mirror(m_position, planeNormal); // mirror the quaternion axis component - AZ::Vector3 mirrored = MCore::Mirror(AZ::Vector3(mRotation.GetX(), mRotation.GetY(), mRotation.GetZ()), planeNormal); + AZ::Vector3 mirrored = MCore::Mirror(AZ::Vector3(m_rotation.GetX(), m_rotation.GetY(), m_rotation.GetZ()), planeNormal); // update the rotation quaternion with inverted angle - mRotation.Set(mirrored.GetX(), mirrored.GetY(), mirrored.GetZ(), -mRotation.GetW()); - mRotation.Normalize(); + m_rotation.Set(mirrored.GetX(), mirrored.GetY(), mirrored.GetZ(), -m_rotation.GetW()); + m_rotation.Normalize(); return *this; } @@ -396,14 +396,14 @@ namespace EMotionFX ApplyMirrorFlags(this, mirrorFlags); // mirror the position over the plane with the specified normal - mPosition = MCore::Mirror(mPosition, planeNormal); + m_position = MCore::Mirror(m_position, planeNormal); // mirror the quaternion axis component - AZ::Vector3 mirrored = MCore::Mirror(AZ::Vector3(mRotation.GetX(), mRotation.GetY(), mRotation.GetZ()), planeNormal); + AZ::Vector3 mirrored = MCore::Mirror(AZ::Vector3(m_rotation.GetX(), m_rotation.GetY(), m_rotation.GetZ()), planeNormal); // update the rotation quaternion with inverted angle - mRotation.Set(mirrored.GetX(), mirrored.GetY(), mirrored.GetZ(), -mRotation.GetW()); - mRotation.Normalize(); + m_rotation.Set(mirrored.GetX(), mirrored.GetY(), mirrored.GetZ(), -m_rotation.GetW()); + m_rotation.Normalize(); return *this; } @@ -422,17 +422,17 @@ namespace EMotionFX void Transform::PreMultiply(const Transform& other, Transform* outResult) const { #ifdef EMFX_SCALE_DISABLED - outResult->mPosition = mPosition + mRotation.TransformVector(other.mPosition); + outResult->m_position = m_position + m_rotation.TransformVector(other.m_position); #else - outResult->mPosition = mPosition + (mRotation.TransformVector(other.mPosition) * mScale); + outResult->m_position = m_position + (m_rotation.TransformVector(other.m_position) * m_scale); #endif - outResult->mRotation = mRotation * other.mRotation; - outResult->mRotation.Normalize(); + outResult->m_rotation = m_rotation * other.m_rotation; + outResult->m_rotation.Normalize(); EMFX_SCALECODE ( - outResult->mScale = mScale * other.mScale; + outResult->m_scale = m_scale * other.m_scale; ) } @@ -441,17 +441,17 @@ namespace EMotionFX void Transform::Multiply(const Transform& other, Transform* outResult) const { #ifdef EMFX_SCALE_DISABLED - outResult->mPosition = other.mPosition + other.mRotation.TransformVector(mPosition); + outResult->m_position = other.m_position + other.m_rotation.TransformVector(m_position); #else - outResult->mPosition = other.mPosition + (other.mRotation.TransformVector(mPosition) * other.mScale); + outResult->m_position = other.m_position + (other.m_rotation.TransformVector(m_position) * other.m_scale); #endif - outResult->mRotation = other.mRotation * mRotation; - outResult->mRotation.Normalize(); + outResult->m_rotation = other.m_rotation * m_rotation; + outResult->m_rotation.Normalize(); EMFX_SCALECODE ( - outResult->mScale = other.mScale * mScale; + outResult->m_scale = other.m_scale * m_scale; ) } @@ -469,18 +469,18 @@ namespace EMotionFX void Transform::CalcRelativeTo(const Transform& relativeTo, Transform* outTransform) const { #ifndef EMFX_SCALE_DISABLED - const AZ::Vector3 invScale = relativeTo.mScale.GetReciprocal(); - const AZ::Quaternion invRot = relativeTo.mRotation.GetConjugate(); + const AZ::Vector3 invScale = relativeTo.m_scale.GetReciprocal(); + const AZ::Quaternion invRot = relativeTo.m_rotation.GetConjugate(); - outTransform->mPosition = (invRot.TransformVector(mPosition - relativeTo.mPosition)) * invScale; - outTransform->mRotation = invRot * mRotation; - outTransform->mScale = mScale * invScale; + outTransform->m_position = (invRot.TransformVector(m_position - relativeTo.m_position)) * invScale; + outTransform->m_rotation = invRot * m_rotation; + outTransform->m_scale = m_scale * invScale; #else - const AZ::Quaternion invRot = relativeTo.mRotation.GetConjugate(); - outTransform->mPosition = invRot.TransformVector(mPosition - relativeTo.mPosition); - outTransform->mRotation = invRot * mRotation; + const AZ::Quaternion invRot = relativeTo.m_rotation.GetConjugate(); + outTransform->m_position = invRot.TransformVector(m_position - relativeTo.m_position); + outTransform->m_rotation = invRot * m_rotation; #endif - outTransform->mRotation.Normalize(); + outTransform->m_rotation.Normalize(); } @@ -497,16 +497,16 @@ namespace EMotionFX void Transform::Mirror(const AZ::Vector3& planeNormal, Transform* outResult) const { // mirror the position over the normal - outResult->mPosition = MCore::Mirror(mPosition, planeNormal); + outResult->m_position = MCore::Mirror(m_position, planeNormal); // mirror the quaternion axis component - AZ::Vector3 mirrored = MCore::Mirror(AZ::Vector3(mRotation.GetX(), mRotation.GetY(), mRotation.GetZ()), planeNormal); - outResult->mRotation.Set(mirrored.GetX(), mirrored.GetY(), mirrored.GetZ(), -mRotation.GetW()); // store the mirrored quat - outResult->mRotation.Normalize(); + AZ::Vector3 mirrored = MCore::Mirror(AZ::Vector3(m_rotation.GetX(), m_rotation.GetY(), m_rotation.GetZ()), planeNormal); + outResult->m_rotation.Set(mirrored.GetX(), mirrored.GetY(), mirrored.GetZ(), -m_rotation.GetW()); // store the mirrored quat + outResult->m_rotation.Normalize(); EMFX_SCALECODE ( - outResult->mScale = mScale; + outResult->m_scale = m_scale; ) } @@ -518,9 +518,9 @@ namespace EMotionFX return false; #else return ( - !MCore::Compare::CheckIfIsClose(mScale.GetX(), 1.0f, MCore::Math::epsilon) || - !MCore::Compare::CheckIfIsClose(mScale.GetY(), 1.0f, MCore::Math::epsilon) || - !MCore::Compare::CheckIfIsClose(mScale.GetZ(), 1.0f, MCore::Math::epsilon)); + !MCore::Compare::CheckIfIsClose(m_scale.GetX(), 1.0f, MCore::Math::epsilon) || + !MCore::Compare::CheckIfIsClose(m_scale.GetY(), 1.0f, MCore::Math::epsilon) || + !MCore::Compare::CheckIfIsClose(m_scale.GetZ(), 1.0f, MCore::Math::epsilon)); #endif } @@ -528,12 +528,12 @@ namespace EMotionFX // blend into another transform Transform& Transform::Blend(const Transform& dest, float weight) { - mPosition = MCore::LinearInterpolate(mPosition, dest.mPosition, weight); - mRotation = MCore::NLerp(mRotation, dest.mRotation, weight); + m_position = MCore::LinearInterpolate(m_position, dest.m_position, weight); + m_rotation = MCore::NLerp(m_rotation, dest.m_rotation, weight); EMFX_SCALECODE ( - mScale = MCore::LinearInterpolate(mScale, dest.mScale, weight); + m_scale = MCore::LinearInterpolate(m_scale, dest.m_scale, weight); ) return *this; @@ -543,18 +543,18 @@ namespace EMotionFX // additive blend Transform& Transform::BlendAdditive(const Transform& dest, const Transform& orgTransform, float weight) { - const AZ::Vector3 relPos = dest.mPosition - orgTransform.mPosition; - const AZ::Quaternion& orgRot = orgTransform.mRotation; - const AZ::Quaternion rot = MCore::NLerp(orgRot, dest.mRotation, weight); + const AZ::Vector3 relPos = dest.m_position - orgTransform.m_position; + const AZ::Quaternion& orgRot = orgTransform.m_rotation; + const AZ::Quaternion rot = MCore::NLerp(orgRot, dest.m_rotation, weight); // apply the relative changes - mRotation = mRotation * (orgRot.GetConjugate() * rot); - mRotation.Normalize(); - mPosition += (relPos * weight); + m_rotation = m_rotation * (orgRot.GetConjugate() * rot); + m_rotation.Normalize(); + m_position += (relPos * weight); EMFX_SCALECODE ( - mScale += (dest.mScale - orgTransform.mScale) * weight; + m_scale += (dest.m_scale - orgTransform.m_scale) * weight; ) return *this; @@ -563,13 +563,13 @@ namespace EMotionFX Transform& Transform::ApplyAdditive(const Transform& additive) { - mPosition += additive.mPosition; - mRotation = mRotation * additive.mRotation; - mRotation.Normalize(); + m_position += additive.m_position; + m_rotation = m_rotation * additive.m_rotation; + m_rotation.Normalize(); EMFX_SCALECODE ( - mScale *= additive.mScale; + m_scale *= additive.m_scale; ) return *this; } @@ -577,11 +577,11 @@ namespace EMotionFX Transform& Transform::ApplyAdditive(const Transform& additive, float weight) { - mPosition += additive.mPosition * weight; - mRotation = MCore::NLerp(mRotation, mRotation * additive.mRotation, weight); + m_position += additive.m_position * weight; + m_rotation = MCore::NLerp(m_rotation, m_rotation * additive.m_rotation, weight); EMFX_SCALECODE ( - mScale *= AZ::Vector3::CreateOne().Lerp(additive.mScale, weight); + m_scale *= AZ::Vector3::CreateOne().Lerp(additive.m_scale, weight); ) return *this; } @@ -590,21 +590,21 @@ namespace EMotionFX // sum the transforms Transform& Transform::Add(const Transform& other, float weight) { - mPosition += other.mPosition * weight; + m_position += other.m_position * weight; // make sure we use the correct hemisphere - if (mRotation.Dot(other.mRotation) < 0.0f) + if (m_rotation.Dot(other.m_rotation) < 0.0f) { - mRotation += -(other.mRotation) * weight; + m_rotation += -(other.m_rotation) * weight; } else { - mRotation += other.mRotation * weight; + m_rotation += other.m_rotation * weight; } EMFX_SCALECODE ( - mScale += other.mScale * weight; + m_scale += other.m_scale * weight; ) return *this; @@ -614,11 +614,11 @@ namespace EMotionFX // add a transform Transform& Transform::Add(const Transform& other) { - mPosition += other.mPosition; - mRotation += other.mRotation; + m_position += other.m_position; + m_rotation += other.m_rotation; EMFX_SCALECODE ( - mScale += other.mScale; + m_scale += other.m_scale; ) return *this; } @@ -627,11 +627,11 @@ namespace EMotionFX // subtract a transform Transform& Transform::Subtract(const Transform& other) { - mPosition -= other.mPosition; - mRotation -= other.mRotation; + m_position -= other.m_position; + m_rotation -= other.m_rotation; EMFX_SCALECODE ( - mScale -= other.mScale; + m_scale -= other.m_scale; ) return *this; } @@ -645,22 +645,22 @@ namespace EMotionFX MCore::LogInfo("Transform(%s):", name); } - MCore::LogInfo("mPosition = %.6f, %.6f, %.6f", - static_cast(mPosition.GetX()), - static_cast(mPosition.GetY()), - static_cast(mPosition.GetZ())); - MCore::LogInfo("mRotation = %.6f, %.6f, %.6f, %.6f", - static_cast(mRotation.GetX()), - static_cast(mRotation.GetY()), - static_cast(mRotation.GetZ()), - static_cast(mRotation.GetW())); + MCore::LogInfo("m_position = %.6f, %.6f, %.6f", + static_cast(m_position.GetX()), + static_cast(m_position.GetY()), + static_cast(m_position.GetZ())); + MCore::LogInfo("m_rotation = %.6f, %.6f, %.6f, %.6f", + static_cast(m_rotation.GetX()), + static_cast(m_rotation.GetY()), + static_cast(m_rotation.GetZ()), + static_cast(m_rotation.GetW())); EMFX_SCALECODE ( - MCore::LogInfo("mScale = %.6f, %.6f, %.6f", - static_cast(mScale.GetX()), - static_cast(mScale.GetY()), - static_cast(mScale.GetZ())); + MCore::LogInfo("m_scale = %.6f, %.6f, %.6f", + static_cast(m_scale.GetX()), + static_cast(m_scale.GetY()), + static_cast(m_scale.GetZ())); ) } @@ -675,26 +675,26 @@ namespace EMotionFX if (mirrorFlags & Actor::MIRRORFLAG_INVERT_X) { - inOutTransform->mRotation.SetW(inOutTransform->mRotation.GetW() * -1.0f); - inOutTransform->mRotation.SetX(inOutTransform->mRotation.GetX() * -1.0f); - inOutTransform->mPosition.SetY(inOutTransform->mPosition.GetY() * -1.0f); - inOutTransform->mPosition.SetZ(inOutTransform->mPosition.GetZ() * -1.0f); + inOutTransform->m_rotation.SetW(inOutTransform->m_rotation.GetW() * -1.0f); + inOutTransform->m_rotation.SetX(inOutTransform->m_rotation.GetX() * -1.0f); + inOutTransform->m_position.SetY(inOutTransform->m_position.GetY() * -1.0f); + inOutTransform->m_position.SetZ(inOutTransform->m_position.GetZ() * -1.0f); return; } if (mirrorFlags & Actor::MIRRORFLAG_INVERT_Y) { - inOutTransform->mRotation.SetW(inOutTransform->mRotation.GetW() * -1.0f); - inOutTransform->mRotation.SetY(inOutTransform->mPosition.GetY() * -1.0f); - inOutTransform->mPosition.SetX(inOutTransform->mPosition.GetX() * -1.0f); - inOutTransform->mPosition.SetZ(inOutTransform->mPosition.GetZ() * -1.0f); + inOutTransform->m_rotation.SetW(inOutTransform->m_rotation.GetW() * -1.0f); + inOutTransform->m_rotation.SetY(inOutTransform->m_position.GetY() * -1.0f); + inOutTransform->m_position.SetX(inOutTransform->m_position.GetX() * -1.0f); + inOutTransform->m_position.SetZ(inOutTransform->m_position.GetZ() * -1.0f); return; } if (mirrorFlags & Actor::MIRRORFLAG_INVERT_Z) { - inOutTransform->mRotation.SetW(inOutTransform->mRotation.GetW() * -1.0f); - inOutTransform->mRotation.SetZ(inOutTransform->mPosition.GetZ() * -1.0f); - inOutTransform->mPosition.SetX(inOutTransform->mPosition.GetX() * -1.0f); - inOutTransform->mPosition.SetY(inOutTransform->mPosition.GetY() * -1.0f); + inOutTransform->m_rotation.SetW(inOutTransform->m_rotation.GetW() * -1.0f); + inOutTransform->m_rotation.SetZ(inOutTransform->m_position.GetZ() * -1.0f); + inOutTransform->m_position.SetX(inOutTransform->m_position.GetX() * -1.0f); + inOutTransform->m_position.SetY(inOutTransform->m_position.GetY() * -1.0f); return; } } @@ -748,13 +748,13 @@ namespace EMotionFX // Only keep translation over the XY plane and assume a height of 0. if (!(flags & MOTIONEXTRACT_CAPTURE_Z)) { - mPosition.SetZ(0.0f); + m_position.SetZ(0.0f); } // Only keep the rotation on the Z axis. - mRotation.SetX(0.0f); - mRotation.SetY(0.0f); - mRotation.Normalize(); + m_rotation.SetX(0.0f); + m_rotation.SetY(0.0f); + m_rotation.Normalize(); } @@ -764,12 +764,12 @@ namespace EMotionFX Transform result(*this); // Only keep translation over the XY plane and assume a height of 0. - result.mPosition.SetZ(0.0f); + result.m_position.SetZ(0.0f); // Only keep the rotation on the Z axis. - result.mRotation.SetX(0.0f); - result.mRotation.SetY(0.0f); - result.mRotation.Normalize(); + result.m_rotation.SetX(0.0f); + result.m_rotation.SetY(0.0f); + result.m_rotation.Normalize(); return result; } diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/Transform.h b/Gems/EMotionFX/Code/EMotionFX/Source/Transform.h index 950d39fb55..764de9e8f9 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/Transform.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/Transform.h @@ -137,10 +137,10 @@ namespace EMotionFX bool operator != (const Transform& right) const; public: - AZ::Quaternion mRotation; /**< The rotation. */ - AZ::Vector3 mPosition; /**< The position. */ + AZ::Quaternion m_rotation; /**< The rotation. */ + AZ::Vector3 m_position; /**< The position. */ #ifndef EMFX_SCALE_DISABLED - AZ::Vector3 mScale; /**< The scale. */ + AZ::Vector3 m_scale; /**< The scale. */ #endif } MCORE_ALIGN_POST(16); diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/TransformData.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/TransformData.cpp index 5164f97c01..5349c16ec0 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/TransformData.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/TransformData.cpp @@ -25,10 +25,10 @@ namespace EMotionFX TransformData::TransformData() : BaseObject() { - mSkinningMatrices = nullptr; - mBindPose = nullptr; - mNumTransforms = 0; - mHasUniqueBindPose = false; + m_skinningMatrices = nullptr; + m_bindPose = nullptr; + m_numTransforms = 0; + m_hasUniqueBindPose = false; } @@ -49,17 +49,17 @@ namespace EMotionFX // get rid of all allocated data void TransformData::Release() { - MCore::AlignedFree(mSkinningMatrices); + MCore::AlignedFree(m_skinningMatrices); - if (mHasUniqueBindPose) + if (m_hasUniqueBindPose) { - delete mBindPose; + delete m_bindPose; } - mPose.Clear(); - mSkinningMatrices = nullptr; - mBindPose = nullptr; - mNumTransforms = 0; + m_pose.Clear(); + m_skinningMatrices = nullptr; + m_bindPose = nullptr; + m_numTransforms = 0; } @@ -69,7 +69,7 @@ namespace EMotionFX Release(); // link to the given actor instance - mPose.LinkToActorInstance(actorInstance); + m_pose.LinkToActorInstance(actorInstance); // release all memory if we want to resize to zero nodes const size_t numNodes = actorInstance->GetNumNodes(); @@ -79,23 +79,23 @@ namespace EMotionFX return; } - mSkinningMatrices = (AZ::Matrix3x4*)MCore::AlignedAllocate(sizeof(AZ::Matrix3x4) * numNodes, static_cast(AZStd::alignment_of()), EMFX_MEMCATEGORY_TRANSFORMDATA); - mNumTransforms = numNodes; + m_skinningMatrices = (AZ::Matrix3x4*)MCore::AlignedAllocate(sizeof(AZ::Matrix3x4) * numNodes, static_cast(AZStd::alignment_of()), EMFX_MEMCATEGORY_TRANSFORMDATA); + m_numTransforms = numNodes; - if (mHasUniqueBindPose) + if (m_hasUniqueBindPose) { - mBindPose = new Pose(); - mBindPose->LinkToActorInstance(actorInstance); + m_bindPose = new Pose(); + m_bindPose->LinkToActorInstance(actorInstance); } else { - mBindPose = actorInstance->GetActor()->GetBindPose(); + m_bindPose = actorInstance->GetActor()->GetBindPose(); } // now initialize the data with the actor transforms for (size_t i = 0; i < numNodes; ++i) { - mSkinningMatrices[i] = AZ::Matrix3x4::CreateIdentity(); + m_skinningMatrices[i] = AZ::Matrix3x4::CreateIdentity(); } } @@ -103,16 +103,16 @@ namespace EMotionFX // make the bind pose transforms unique void TransformData::MakeBindPoseTransformsUnique() { - if (mHasUniqueBindPose) + if (m_hasUniqueBindPose) { return; } - const ActorInstance* actorInstance = mPose.GetActorInstance(); - mHasUniqueBindPose = true; - mBindPose = new Pose(); - mBindPose->LinkToActorInstance(actorInstance); - *mBindPose = *actorInstance->GetActor()->GetBindPose(); + const ActorInstance* actorInstance = m_pose.GetActorInstance(); + m_hasUniqueBindPose = true; + m_bindPose = new Pose(); + m_bindPose->LinkToActorInstance(actorInstance); + *m_bindPose = *actorInstance->GetActor()->GetBindPose(); } @@ -121,7 +121,7 @@ namespace EMotionFX // set the scaling value for the node and all child nodes void TransformData::SetBindPoseLocalScaleInherit(size_t nodeIndex, const AZ::Vector3& scale) { - const ActorInstance* actorInstance = mPose.GetActorInstance(); + const ActorInstance* actorInstance = m_pose.GetActorInstance(); const Actor* actor = actorInstance->GetActor(); // get the node index and the number of children of the given node @@ -141,15 +141,15 @@ namespace EMotionFX // update the local space scale void TransformData::SetBindPoseLocalScale(size_t nodeIndex, const AZ::Vector3& scale) { - Transform newTransform = mBindPose->GetLocalSpaceTransform(nodeIndex); - newTransform.mScale = scale; - mBindPose->SetLocalSpaceTransform(nodeIndex, newTransform); + Transform newTransform = m_bindPose->GetLocalSpaceTransform(nodeIndex); + newTransform.m_scale = scale; + m_bindPose->SetLocalSpaceTransform(nodeIndex, newTransform); } ) // EMFX_SCALECODE // set the number of morph weights void TransformData::SetNumMorphWeights(size_t numMorphWeights) { - mPose.ResizeNumMorphs(numMorphWeights); + m_pose.ResizeNumMorphs(numMorphWeights); } } // namespace EMotionFX diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/TransformData.h b/Gems/EMotionFX/Code/EMotionFX/Source/TransformData.h index d4e70134a3..71c2ee6446 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/TransformData.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/TransformData.h @@ -64,33 +64,33 @@ namespace EMotionFX * The size of the returned array is equal to the amount of nodes in the actor or the value returned by GetNumTransforms() * @result The array of skinning matrices. */ - MCORE_INLINE AZ::Matrix3x4* GetSkinningMatrices() { return mSkinningMatrices; } + MCORE_INLINE AZ::Matrix3x4* GetSkinningMatrices() { return m_skinningMatrices; } /** * Get the skinning matrices (offset from the pose), in read-only (const) mode. * The size of the returned array is equal to the amount of nodes in the actor or the value returned by GetNumTransforms() * @result The array of skinning matrices. */ - MCORE_INLINE const AZ::Matrix3x4* GetSkinningMatrices() const { return mSkinningMatrices; } + MCORE_INLINE const AZ::Matrix3x4* GetSkinningMatrices() const { return m_skinningMatrices; } - MCORE_INLINE Pose* GetBindPose() const { return mBindPose; } - MCORE_INLINE const Pose* GetCurrentPose() const { return &mPose; } - MCORE_INLINE Pose* GetCurrentPose() { return &mPose; } + MCORE_INLINE Pose* GetBindPose() const { return m_bindPose; } + MCORE_INLINE const Pose* GetCurrentPose() const { return &m_pose; } + MCORE_INLINE Pose* GetCurrentPose() { return &m_pose; } /** * Reset the local space transform of a given node to its bind pose local space transform. * @param nodeIndex The node number, which must be in range of [0..GetNumTransforms()-1]. */ - void ResetToBindPoseTransformation(size_t nodeIndex) { mPose.SetLocalSpaceTransform(nodeIndex, mBindPose->GetLocalSpaceTransform(nodeIndex)); } + void ResetToBindPoseTransformation(size_t nodeIndex) { m_pose.SetLocalSpaceTransform(nodeIndex, m_bindPose->GetLocalSpaceTransform(nodeIndex)); } /** * Reset all local space transforms to the local space transforms of the bind pose. */ void ResetToBindPoseTransformations() { - for (size_t i = 0; i < mNumTransforms; ++i) + for (size_t i = 0; i < m_numTransforms; ++i) { - mPose.SetLocalSpaceTransform(i, mBindPose->GetLocalSpaceTransform(i)); + m_pose.SetLocalSpaceTransform(i, m_bindPose->GetLocalSpaceTransform(i)); } } @@ -100,8 +100,8 @@ namespace EMotionFX void SetBindPoseLocalScale(size_t nodeIndex, const AZ::Vector3& scale); ) - MCORE_INLINE const ActorInstance* GetActorInstance() const { return mPose.GetActorInstance(); } - MCORE_INLINE size_t GetNumTransforms() const { return mNumTransforms; } + MCORE_INLINE const ActorInstance* GetActorInstance() const { return m_pose.GetActorInstance(); } + MCORE_INLINE size_t GetNumTransforms() const { return m_numTransforms; } void MakeBindPoseTransformsUnique(); @@ -109,11 +109,11 @@ namespace EMotionFX private: - Pose mPose; /**< The current pose. */ - Pose* mBindPose; /**< The bind pose, which can be unique or point to the bind pose in the actor. */ - AZ::Matrix3x4* mSkinningMatrices; /**< The matrices used for skinning. They are the offset to the bind pose. */ - size_t mNumTransforms; /**< The number of transforms, which is equal to the number of nodes in the linked actor instance. */ - bool mHasUniqueBindPose; /**< Do we have a unique bind pose (when set to true) or do we use the one from the Actor object (when set to false)? */ + Pose m_pose; /**< The current pose. */ + Pose* m_bindPose; /**< The bind pose, which can be unique or point to the bind pose in the actor. */ + AZ::Matrix3x4* m_skinningMatrices; /**< The matrices used for skinning. They are the offset to the bind pose. */ + size_t m_numTransforms; /**< The number of transforms, which is equal to the number of nodes in the linked actor instance. */ + bool m_hasUniqueBindPose; /**< Do we have a unique bind pose (when set to true) or do we use the one from the Actor object (when set to false)? */ /** * The constructor. diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/VertexAttributeLayer.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/VertexAttributeLayer.cpp index 25614c17a9..722d599b2d 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/VertexAttributeLayer.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/VertexAttributeLayer.cpp @@ -21,9 +21,9 @@ namespace EMotionFX VertexAttributeLayer::VertexAttributeLayer(uint32 numAttributes, bool keepOriginals) : BaseObject() { - mNumAttributes = numAttributes; - mKeepOriginals = keepOriginals; - mNameID = MCore::GetStringIdPool().GenerateIdForString(""); + m_numAttributes = numAttributes; + m_keepOriginals = keepOriginals; + m_nameId = MCore::GetStringIdPool().GenerateIdForString(""); } @@ -44,27 +44,27 @@ namespace EMotionFX // set the name void VertexAttributeLayer::SetName(const char* name) { - mNameID = MCore::GetStringIdPool().GenerateIdForString(name); + m_nameId = MCore::GetStringIdPool().GenerateIdForString(name); } // get the name const char* VertexAttributeLayer::GetName() const { - return MCore::GetStringIdPool().GetName(mNameID).c_str(); + return MCore::GetStringIdPool().GetName(m_nameId).c_str(); } // get the name string const AZStd::string& VertexAttributeLayer::GetNameString() const { - return MCore::GetStringIdPool().GetName(mNameID); + return MCore::GetStringIdPool().GetName(m_nameId); } // get the name ID uint32 VertexAttributeLayer::GetNameID() const { - return mNameID; + return m_nameId; } } // namespace EMotionFX diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/VertexAttributeLayer.h b/Gems/EMotionFX/Code/EMotionFX/Source/VertexAttributeLayer.h index 1affcb9b79..525061b5a7 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/VertexAttributeLayer.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/VertexAttributeLayer.h @@ -72,7 +72,7 @@ namespace EMotionFX * Get the number of attributes inside this layer. * @result The number of attributes. */ - MCORE_INLINE uint32 GetNumAttributes() const { return mNumAttributes; } + MCORE_INLINE uint32 GetNumAttributes() const { return m_numAttributes; } /** * Check if this class also stores original vertex data or not. @@ -82,7 +82,7 @@ namespace EMotionFX * The initialization to the original data happens inside the ResetToOriginalData method. * @result Returns true when this class also stores the original (undeformed) data, next to the current (deformed) data. */ - MCORE_INLINE bool GetKeepOriginals() const { return mKeepOriginals; } + MCORE_INLINE bool GetKeepOriginals() const { return m_keepOriginals; } /** * Reset the layer data to it's original data. @@ -129,9 +129,9 @@ namespace EMotionFX protected: - uint32 mNumAttributes; /**< The number of attributes inside this layer. */ - uint32 mNameID; /**< The name ID. */ - bool mKeepOriginals; /**< Should we store a copy of the original data as well? */ + uint32 m_numAttributes; /**< The number of attributes inside this layer. */ + uint32 m_nameId; /**< The name ID. */ + bool m_keepOriginals; /**< Should we store a copy of the original data as well? */ /** * The constructor. diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/VertexAttributeLayerAbstractData.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/VertexAttributeLayerAbstractData.cpp index c0bf0c3a54..b1757c09d1 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/VertexAttributeLayerAbstractData.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/VertexAttributeLayerAbstractData.cpp @@ -20,22 +20,22 @@ namespace EMotionFX VertexAttributeLayerAbstractData::VertexAttributeLayerAbstractData(uint32 numAttributes, uint32 typeID, uint32 attribSizeInBytes, bool keepOriginals) : VertexAttributeLayer(numAttributes, keepOriginals) { - mData = nullptr; - mSwapBuffer = nullptr; - mTypeID = typeID; - mAttribSizeInBytes = attribSizeInBytes; + m_data = nullptr; + m_swapBuffer = nullptr; + m_typeId = typeID; + m_attribSizeInBytes = attribSizeInBytes; // allocate the data - const uint32 numBytes = CalcTotalDataSizeInBytes(mKeepOriginals); - mData = (uint8*)MCore::AlignedAllocate(numBytes, 16, EMFX_MEMCATEGORY_GEOMETRY_VERTEXATTRIBUTES); + const uint32 numBytes = CalcTotalDataSizeInBytes(m_keepOriginals); + m_data = (uint8*)MCore::AlignedAllocate(numBytes, 16, EMFX_MEMCATEGORY_GEOMETRY_VERTEXATTRIBUTES); } // the destructor VertexAttributeLayerAbstractData::~VertexAttributeLayerAbstractData() { - MCore::AlignedFree(mData); - MCore::AlignedFree(mSwapBuffer); + MCore::AlignedFree(m_data); + MCore::AlignedFree(m_swapBuffer); } @@ -49,7 +49,7 @@ namespace EMotionFX // get the layer type uint32 VertexAttributeLayerAbstractData::GetType() const { - return mTypeID; + return m_typeId; } @@ -63,13 +63,13 @@ namespace EMotionFX // calculate the total data size uint32 VertexAttributeLayerAbstractData::CalcTotalDataSizeInBytes(bool includeOriginals) const { - if (includeOriginals && mKeepOriginals) + if (includeOriginals && m_keepOriginals) { - return (mAttribSizeInBytes * mNumAttributes) << 1; // multiplied by two, as we store the originals right after it + return (m_attribSizeInBytes * m_numAttributes) << 1; // multiplied by two, as we store the originals right after it } else { - return mAttribSizeInBytes * mNumAttributes; + return m_attribSizeInBytes * m_numAttributes; } } @@ -78,13 +78,13 @@ namespace EMotionFX VertexAttributeLayer* VertexAttributeLayerAbstractData::Clone() { // create the clone - VertexAttributeLayerAbstractData* clone = aznew VertexAttributeLayerAbstractData(mNumAttributes, mTypeID, mAttribSizeInBytes, mKeepOriginals); + VertexAttributeLayerAbstractData* clone = aznew VertexAttributeLayerAbstractData(m_numAttributes, m_typeId, m_attribSizeInBytes, m_keepOriginals); // copy over the data uint8* cloneData = (uint8*)clone->GetData(); - MCore::MemCopy(cloneData, mData, CalcTotalDataSizeInBytes(true)); + MCore::MemCopy(cloneData, m_data, CalcTotalDataSizeInBytes(true)); - clone->mNameID = mNameID; + clone->m_nameId = m_nameId; return clone; } @@ -93,7 +93,7 @@ namespace EMotionFX void VertexAttributeLayerAbstractData::ResetToOriginalData() { // if we dont have any original data, there is nothing to do - if (mKeepOriginals == false) + if (m_keepOriginals == false) { return; } @@ -111,9 +111,9 @@ namespace EMotionFX void VertexAttributeLayerAbstractData::SwapAttributes(uint32 attribA, uint32 attribB) { // create a swap buffer if we haven't got it already - if (mSwapBuffer == nullptr) + if (m_swapBuffer == nullptr) { - mSwapBuffer = (uint8*)MCore::AlignedAllocate(mAttribSizeInBytes, 16, EMFX_MEMCATEGORY_GEOMETRY_VERTEXATTRIBUTES); + m_swapBuffer = (uint8*)MCore::AlignedAllocate(m_attribSizeInBytes, 16, EMFX_MEMCATEGORY_GEOMETRY_VERTEXATTRIBUTES); } // get the locations of where the attributes are stored @@ -121,18 +121,18 @@ namespace EMotionFX uint8* attribPtrB = (uint8*)GetData(attribB); // swap the attribute data - MCore::MemCopy(mSwapBuffer, attribPtrA, mAttribSizeInBytes); // copy attribute A into the temp swap buffer - MCore::MemCopy(attribPtrA, attribPtrB, mAttribSizeInBytes); // copy attribute B into A - MCore::MemCopy(attribPtrB, mSwapBuffer, mAttribSizeInBytes); // copy the temp swap buffer data into attribute B + MCore::MemCopy(m_swapBuffer, attribPtrA, m_attribSizeInBytes); // copy attribute A into the temp swap buffer + MCore::MemCopy(attribPtrA, attribPtrB, m_attribSizeInBytes); // copy attribute B into A + MCore::MemCopy(attribPtrB, m_swapBuffer, m_attribSizeInBytes); // copy the temp swap buffer data into attribute B // swap the originals - if (mKeepOriginals) + if (m_keepOriginals) { attribPtrA = (uint8*)GetOriginalData(attribA); attribPtrB = (uint8*)GetOriginalData(attribB); - MCore::MemCopy(mSwapBuffer, attribPtrA, mAttribSizeInBytes); // copy attribute A into the temp swap buffer - MCore::MemCopy(attribPtrA, attribPtrB, mAttribSizeInBytes); // copy attribute B into A - MCore::MemCopy(attribPtrB, mSwapBuffer, mAttribSizeInBytes); // copy the temp swap buffer data into attribute B + MCore::MemCopy(m_swapBuffer, attribPtrA, m_attribSizeInBytes); // copy attribute A into the temp swap buffer + MCore::MemCopy(attribPtrA, attribPtrB, m_attribSizeInBytes); // copy attribute B into A + MCore::MemCopy(attribPtrB, m_swapBuffer, m_attribSizeInBytes); // copy the temp swap buffer data into attribute B } } @@ -140,8 +140,8 @@ namespace EMotionFX // remove the swap buffer from memory void VertexAttributeLayerAbstractData::RemoveSwapBuffer() { - MCore::AlignedFree(mSwapBuffer); - mSwapBuffer = nullptr; + MCore::AlignedFree(m_swapBuffer); + m_swapBuffer = nullptr; } @@ -149,11 +149,11 @@ namespace EMotionFX void VertexAttributeLayerAbstractData::RemoveAttributes(uint32 startAttributeNr, uint32 endAttributeNr) { // perform some checks on the input data - MCORE_ASSERT(startAttributeNr < mNumAttributes); - MCORE_ASSERT(endAttributeNr < mNumAttributes); + MCORE_ASSERT(startAttributeNr < m_numAttributes); + MCORE_ASSERT(endAttributeNr < m_numAttributes); // Store the original number of bytes for the reallocation - const size_t numOriginalBytes = CalcTotalDataSizeInBytes(mKeepOriginals); + const size_t numOriginalBytes = CalcTotalDataSizeInBytes(m_keepOriginals); // make sure the start attribute number is lower than the end uint32 start = startAttributeNr; @@ -174,33 +174,33 @@ namespace EMotionFX } // remove the attributes from the current data - const uint32 numBytesToMove = (mNumAttributes - end - 1) * mAttribSizeInBytes; + const uint32 numBytesToMove = (m_numAttributes - end - 1) * m_attribSizeInBytes; if (numBytesToMove > 0) { - MCore::MemMove(mData + start * mAttribSizeInBytes, mData + (end + 1) * mAttribSizeInBytes, numBytesToMove); + MCore::MemMove(m_data + start * m_attribSizeInBytes, m_data + (end + 1) * m_attribSizeInBytes, numBytesToMove); } // remove the attributes from the original data - if (mKeepOriginals) + if (m_keepOriginals) { // remove them from the original data uint8* orgData = (uint8*)GetOriginalData(); if (numBytesToMove > 0) { - MCore::MemMove(orgData + start * mAttribSizeInBytes, orgData + (end + 1) * mAttribSizeInBytes, numBytesToMove); + MCore::MemMove(orgData + start * m_attribSizeInBytes, orgData + (end + 1) * m_attribSizeInBytes, numBytesToMove); } // remove the created gap between the current data and original data, as both original and current data remain in the same continuous piece of memory - MCore::MemMove(mData + (mNumAttributes - numAttribsToRemove) * mAttribSizeInBytes, orgData, (mNumAttributes - numAttribsToRemove) * mAttribSizeInBytes); + MCore::MemMove(m_data + (m_numAttributes - numAttribsToRemove) * m_attribSizeInBytes, orgData, (m_numAttributes - numAttribsToRemove) * m_attribSizeInBytes); } // decrease the number of attributes - mNumAttributes -= numAttribsToRemove; + m_numAttributes -= numAttribsToRemove; // reallocate, to make the data array smaller - const uint32 numBytes = CalcTotalDataSizeInBytes(mKeepOriginals); - mData = (uint8*)MCore::AlignedRealloc(mData, numBytes, numOriginalBytes, 16, EMFX_MEMCATEGORY_GEOMETRY_VERTEXATTRIBUTES); + const uint32 numBytes = CalcTotalDataSizeInBytes(m_keepOriginals); + m_data = (uint8*)MCore::AlignedRealloc(m_data, numBytes, numOriginalBytes, 16, EMFX_MEMCATEGORY_GEOMETRY_VERTEXATTRIBUTES); } diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/VertexAttributeLayerAbstractData.h b/Gems/EMotionFX/Code/EMotionFX/Source/VertexAttributeLayerAbstractData.h index f2520e6b70..fcd625dbb3 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/VertexAttributeLayerAbstractData.h +++ b/Gems/EMotionFX/Code/EMotionFX/Source/VertexAttributeLayerAbstractData.h @@ -92,13 +92,13 @@ namespace EMotionFX * Get a pointer to the data for a given attribute. You have to typecast the data yourself. * @result A pointer to the vertex data of the specified attribute number. */ - MCORE_INLINE void* GetData(uint32 attributeNr) { return (mData + mAttribSizeInBytes * attributeNr); } + MCORE_INLINE void* GetData(uint32 attributeNr) { return (m_data + m_attribSizeInBytes * attributeNr); } /** * Get a pointer to the data. You have to typecast the data yourself. * @result A pointer to the vertex data. */ - MCORE_INLINE void* GetData() override { return mData; } + MCORE_INLINE void* GetData() override { return m_data; } /** * Get the size of one attribute in bytes. @@ -106,7 +106,7 @@ namespace EMotionFX * equal to sizeof(Vector3). * @result The size of a single attribute, in bytes. */ - MCORE_INLINE uint32 GetAttributeSizeInBytes() const { return mAttribSizeInBytes; } + MCORE_INLINE uint32 GetAttributeSizeInBytes() const { return m_attribSizeInBytes; } /** * Get a pointer to the original data, as it is stored in the base pose, before any mesh deformers have been applied. @@ -115,13 +115,13 @@ namespace EMotionFX */ MCORE_INLINE void* GetOriginalData() override { - if (mKeepOriginals) + if (m_keepOriginals) { - return (mData + (mAttribSizeInBytes * mNumAttributes)); + return (m_data + (m_attribSizeInBytes * m_numAttributes)); } else { - return mData; + return m_data; } } @@ -132,13 +132,13 @@ namespace EMotionFX */ MCORE_INLINE void* GetOriginalData(uint32 attributeNr) { - if (mKeepOriginals) + if (m_keepOriginals) { - return (mData + (mAttribSizeInBytes * mNumAttributes) + (mAttribSizeInBytes * attributeNr)); + return (m_data + (m_attribSizeInBytes * m_numAttributes) + (m_attribSizeInBytes * attributeNr)); } else { - return (mData + mAttribSizeInBytes * attributeNr); + return (m_data + m_attribSizeInBytes * attributeNr); } } @@ -166,10 +166,10 @@ namespace EMotionFX bool GetIsAbstractDataClass() const override; private: - uint8* mData; /**< The buffer containing the data. */ - uint8* mSwapBuffer; /**< The swap buffer, used for swapping items. This will only be allocated once you call SwapAttribute, like the LOD generation system does. */ - uint32 mAttribSizeInBytes; /**< The size of a single attribute, in bytes. */ - uint32 mTypeID; /**< The type ID that identifies the type of the data, for example if it is position data, normal data, or colors, etc. */ + uint8* m_data; /**< The buffer containing the data. */ + uint8* m_swapBuffer; /**< The swap buffer, used for swapping items. This will only be allocated once you call SwapAttribute, like the LOD generation system does. */ + uint32 m_attribSizeInBytes; /**< The size of a single attribute, in bytes. */ + uint32 m_typeId; /**< The type ID that identifies the type of the data, for example if it is position data, normal data, or colors, etc. */ /** * The constructor. diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/DockWidgetPlugin.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/DockWidgetPlugin.cpp index 26addcf6e8..4c62d48610 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/DockWidgetPlugin.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/DockWidgetPlugin.cpp @@ -19,23 +19,23 @@ namespace EMStudio // constructor DockWidgetPlugin::DockWidgetPlugin() : EMStudioPlugin() - , mDock() + , m_dock() { } // destructor DockWidgetPlugin::~DockWidgetPlugin() { - if (!mDock.isNull()) + if (!m_dock.isNull()) { - // Disconnecting all signals from mDock to this object since we are + // Disconnecting all signals from m_dock to this object since we are // destroying it. Some plugins connect to visibility change that gets // triggered from removeDockWidget. Calling those slots at this point // is not safe since the plugin is being destroyed. - mDock->disconnect(this); + m_dock->disconnect(this); - EMStudio::GetMainWindow()->removeDockWidget(mDock); - delete mDock; + EMStudio::GetMainWindow()->removeDockWidget(m_dock); + delete m_dock; } } @@ -47,13 +47,13 @@ namespace EMStudio // check if we have a window that uses this object name bool DockWidgetPlugin::GetHasWindowWithObjectName(const AZStd::string& objectName) { - if (mDock.isNull()) + if (m_dock.isNull()) { return false; } // check if the object name is equal to the one of the dock widget - return objectName == FromQtString(mDock->objectName()); + return objectName == FromQtString(m_dock->objectName()); } @@ -75,25 +75,25 @@ namespace EMStudio // set the interface title void DockWidgetPlugin::SetInterfaceTitle(const char* name) { - if (!mDock.isNull()) + if (!m_dock.isNull()) { - mDock->setWindowTitle(name); + m_dock->setWindowTitle(name); } } QDockWidget* DockWidgetPlugin::GetDockWidget() { - if (!mDock.isNull()) + if (!m_dock.isNull()) { - return mDock; + return m_dock; } // get the main window QMainWindow* mainWindow = GetMainWindow(); // create a window for the plugin - mDock = new RemovePluginOnCloseDockWidget(mainWindow, GetName(), this); - mDock->setAllowedAreas(Qt::AllDockWidgetAreas); + m_dock = new RemovePluginOnCloseDockWidget(mainWindow, GetName(), this); + m_dock->setAllowedAreas(Qt::AllDockWidgetAreas); QDockWidget::DockWidgetFeatures features = QDockWidget::NoDockWidgetFeatures; if (GetIsClosable()) @@ -113,11 +113,11 @@ namespace EMStudio features |= QDockWidget::DockWidgetFloatable; } - mDock->setFeatures(features); + m_dock->setFeatures(features); - mainWindow->addDockWidget(Qt::RightDockWidgetArea, mDock); + mainWindow->addDockWidget(Qt::RightDockWidgetArea, m_dock); - return mDock; + return m_dock; } QWidget* DockWidgetPlugin::CreateErrorContentWidget(const char* errorMessage) const diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/DockWidgetPlugin.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/DockWidgetPlugin.h index ac58dd9be7..0db8a68ff6 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/DockWidgetPlugin.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/DockWidgetPlugin.h @@ -41,7 +41,7 @@ namespace EMStudio virtual void SetInterfaceTitle(const char* name); void CreateBaseInterface(const char* objectName) override; - QString GetObjectName() const override { AZ_Assert(mDock, "mDock is null"); return mDock->objectName(); } + QString GetObjectName() const override { AZ_Assert(m_dock, "m_dock is null"); return m_dock->objectName(); } void SetObjectName(const QString& name) override { GetDockWidget()->setObjectName(name); } virtual QSize GetInitialWindowSize() const { return QSize(500, 650); } @@ -53,6 +53,6 @@ namespace EMStudio protected: QWidget* CreateErrorContentWidget(const char* errorMessage) const; - QPointer mDock; + QPointer m_dock; }; } // namespace EMStudio diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/EMStudioManager.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/EMStudioManager.cpp index 2f557ad290..2321d7c71b 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/EMStudioManager.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/EMStudioManager.cpp @@ -62,12 +62,12 @@ namespace EMStudio // Flag that we have an editor around EMotionFX::GetEMotionFX().SetIsInEditorMode(true); - mHTMLLinkString.reserve(32768); - mEventProcessingCallback = nullptr; - mAutoLoadLastWorkspace = false; - mAvoidRendering = false; + m_htmlLinkString.reserve(32768); + m_eventProcessingCallback = nullptr; + m_autoLoadLastWorkspace = false; + m_avoidRendering = false; - mApp = app; + m_app = app; AZ::AllocatorInstance::Create(); @@ -86,20 +86,20 @@ namespace EMStudio MCore::GetLogManager().SetLogLevels(MCore::LogCallback::LOGLEVEL_ALL); // Register editor specific commands. - mCommandManager = new CommandSystem::CommandManager(); - mCommandManager->RegisterCommand(new CommandSaveActorAssetInfo()); - mCommandManager->RegisterCommand(new CommandSaveMotionAssetInfo()); - mCommandManager->RegisterCommand(new CommandSaveMotionSet()); - mCommandManager->RegisterCommand(new CommandSaveAnimGraph()); - mCommandManager->RegisterCommand(new CommandSaveWorkspace()); - mCommandManager->RegisterCommand(new CommandEditorLoadAnimGraph()); - mCommandManager->RegisterCommand(new CommandEditorLoadMotionSet()); + m_commandManager = new CommandSystem::CommandManager(); + m_commandManager->RegisterCommand(new CommandSaveActorAssetInfo()); + m_commandManager->RegisterCommand(new CommandSaveMotionAssetInfo()); + m_commandManager->RegisterCommand(new CommandSaveMotionSet()); + m_commandManager->RegisterCommand(new CommandSaveAnimGraph()); + m_commandManager->RegisterCommand(new CommandSaveWorkspace()); + m_commandManager->RegisterCommand(new CommandEditorLoadAnimGraph()); + m_commandManager->RegisterCommand(new CommandEditorLoadMotionSet()); - mEventPresetManager = new MotionEventPresetManager(); - mPluginManager = new PluginManager(); - mLayoutManager = new LayoutManager(); - mNotificationWindowManager = new NotificationWindowManager(); - mCompileDate = AZStd::string::format("%s", MCORE_DATE); + m_eventPresetManager = new MotionEventPresetManager(); + m_pluginManager = new PluginManager(); + m_layoutManager = new LayoutManager(); + m_notificationWindowManager = new NotificationWindowManager(); + m_compileDate = AZStd::string::format("%s", MCORE_DATE); EMotionFX::SkeletonOutlinerNotificationBus::Handler::BusConnect(); @@ -113,33 +113,33 @@ namespace EMStudio { EMotionFX::SkeletonOutlinerNotificationBus::Handler::BusDisconnect(); - if (mEventProcessingCallback) + if (m_eventProcessingCallback) { - EMStudio::GetCommandManager()->RemoveCallback(mEventProcessingCallback, false); - delete mEventProcessingCallback; + EMStudio::GetCommandManager()->RemoveCallback(m_eventProcessingCallback, false); + delete m_eventProcessingCallback; } // delete all animgraph instances etc ClearScene(); - delete mEventPresetManager; - delete mPluginManager; - delete mLayoutManager; - delete mNotificationWindowManager; - delete mMainWindow; - delete mCommandManager; + delete m_eventPresetManager; + delete m_pluginManager; + delete m_layoutManager; + delete m_notificationWindowManager; + delete m_mainWindow; + delete m_commandManager; AZ::AllocatorInstance::Destroy(); } MainWindow* EMStudioManager::GetMainWindow() { - if (mMainWindow.isNull()) + if (m_mainWindow.isNull()) { - mMainWindow = new MainWindow(); - mMainWindow->Init(); + m_mainWindow = new MainWindow(); + m_mainWindow->Init(); } - return mMainWindow; + return m_mainWindow; } @@ -166,18 +166,18 @@ namespace EMStudio int EMStudioManager::ExecuteApp() { - MCORE_ASSERT(mApp); - MCORE_ASSERT(mMainWindow); + MCORE_ASSERT(m_app); + MCORE_ASSERT(m_mainWindow); #if !defined(EMFX_EMSTUDIOLYEMBEDDED) // try to load all plugins AZStd::string pluginDir = MysticQt::GetAppDir() + "Plugins/"; - mPluginManager->LoadPluginsFromDirectory(pluginDir.c_str()); + m_pluginManager->LoadPluginsFromDirectory(pluginDir.c_str()); #endif // EMFX_EMSTUDIOLYEMBEDDED // Give a chance to every plugin to reflect data - const size_t numPlugins = mPluginManager->GetNumPlugins(); + const size_t numPlugins = m_pluginManager->GetNumPlugins(); if (numPlugins) { AZ::SerializeContext* serializeContext = nullptr; @@ -190,31 +190,31 @@ namespace EMStudio { for (size_t i = 0; i < numPlugins; ++i) { - EMStudioPlugin* plugin = mPluginManager->GetPlugin(i); + EMStudioPlugin* plugin = m_pluginManager->GetPlugin(i); plugin->Reflect(serializeContext); } } } // Register the command event processing callback. - mEventProcessingCallback = new EventProcessingCallback(); - EMStudio::GetCommandManager()->RegisterCallback(mEventProcessingCallback); + m_eventProcessingCallback = new EventProcessingCallback(); + EMStudio::GetCommandManager()->RegisterCallback(m_eventProcessingCallback); // Update the main window create window item with, so that it shows all loaded plugins. - mMainWindow->UpdateCreateWindowMenu(); + m_mainWindow->UpdateCreateWindowMenu(); // Set the recover save path. - MCore::FileSystem::mSecureSavePath = GetManager()->GetRecoverFolder().c_str(); + MCore::FileSystem::s_secureSavePath = GetManager()->GetRecoverFolder().c_str(); // Show the main dialog and wait until it closes. MCore::LogInfo("EMotion Studio initialized..."); #if !defined(EMFX_EMSTUDIOLYEMBEDDED) - mMainWindow->show(); + m_mainWindow->show(); #endif // EMFX_EMSTUDIOLYEMBEDDED // Show the recover window in case we have some .recover files in the recovery folder. - const QString secureSavePath = MCore::FileSystem::mSecureSavePath.c_str(); + const QString secureSavePath = MCore::FileSystem::s_secureSavePath.c_str(); const QStringList recoverFileList = QDir(secureSavePath).entryList(QStringList("*.recover"), QDir::Files); if (!recoverFileList.empty()) { @@ -240,16 +240,16 @@ namespace EMStudio // Show the recover files window only in case there is a valid file to recover. if (!recoverStringArray.empty()) { - RecoverFilesWindow* recoverFilesWindow = new RecoverFilesWindow(mMainWindow, recoverStringArray); + RecoverFilesWindow* recoverFilesWindow = new RecoverFilesWindow(m_mainWindow, recoverStringArray); recoverFilesWindow->exec(); } } - mApp->processEvents(); + m_app->processEvents(); #if !defined(EMFX_EMSTUDIOLYEMBEDDED) // execute the application - return mApp->exec(); + return m_app->exec(); #else return 0; #endif // EMFX_EMSTUDIOLYEMBEDDED @@ -263,12 +263,12 @@ namespace EMStudio const char* EMStudioManager::ConstructHTMLLink(const char* text, const MCore::RGBAColor& color) { - int32 r = aznumeric_cast(color.r * 256); - int32 g = aznumeric_cast(color.g * 256); - int32 b = aznumeric_cast(color.b * 256); + int32 r = aznumeric_cast(color.m_r * 256); + int32 g = aznumeric_cast(color.m_g * 256); + int32 b = aznumeric_cast(color.m_b * 256); - mHTMLLinkString = AZStd::string::format("%s", r, g, b, text, text); - return mHTMLLinkString.c_str(); + m_htmlLinkString = AZStd::string::format("%s", r, g, b, text, text); + return m_htmlLinkString.c_str(); } @@ -432,7 +432,7 @@ namespace EMStudio } // add and return the manipulator - mTransformationManipulators.emplace_back(manipulator); + m_transformationManipulators.emplace_back(manipulator); return manipulator; } @@ -440,9 +440,9 @@ namespace EMStudio // remove the given gizmo from the array void EMStudioManager::RemoveTransformationManipulator(MCommon::TransformationManipulator* manipulator) { - if (const auto it = AZStd::find(begin(mTransformationManipulators), end(mTransformationManipulators), manipulator); it != end(mTransformationManipulators)) + if (const auto it = AZStd::find(begin(m_transformationManipulators), end(m_transformationManipulators), manipulator); it != end(m_transformationManipulators)) { - mTransformationManipulators.erase(it); + m_transformationManipulators.erase(it); } } @@ -450,7 +450,7 @@ namespace EMStudio // returns the gizmo array AZStd::vector* EMStudioManager::GetTransformationManipulators() { - return &mTransformationManipulators; + return &m_transformationManipulators; } diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/EMStudioManager.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/EMStudioManager.h index 95dbd3012a..909f0231f3 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/EMStudioManager.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/EMStudioManager.h @@ -59,15 +59,15 @@ namespace EMStudio EMStudioManager(QApplication* app, int& argc, char* argv[]); ~EMStudioManager(); - const char* GetCompileDate() const { return mCompileDate.c_str(); } + const char* GetCompileDate() const { return m_compileDate.c_str(); } - MCORE_INLINE QApplication* GetApp() { return mApp; } - MCORE_INLINE bool HasMainWindow() const { return !mMainWindow.isNull(); } + MCORE_INLINE QApplication* GetApp() { return m_app; } + MCORE_INLINE bool HasMainWindow() const { return !m_mainWindow.isNull(); } MainWindow* GetMainWindow(); - MCORE_INLINE PluginManager* GetPluginManager() { return mPluginManager; } - MCORE_INLINE LayoutManager* GetLayoutManager() { return mLayoutManager; } - MCORE_INLINE NotificationWindowManager* GetNotificationWindowManager() { return mNotificationWindowManager; } - MCORE_INLINE CommandSystem::CommandManager* GetCommandManager() { return mCommandManager; } + MCORE_INLINE PluginManager* GetPluginManager() { return m_pluginManager; } + MCORE_INLINE LayoutManager* GetLayoutManager() { return m_layoutManager; } + MCORE_INLINE NotificationWindowManager* GetNotificationWindowManager() { return m_notificationWindowManager; } + MCORE_INLINE CommandSystem::CommandManager* GetCommandManager() { return m_commandManager; } AZStd::string GetAppDataFolder() const; AZStd::string GetRecoverFolder() const; AZStd::string GetAutosavesFolder() const; @@ -76,10 +76,10 @@ namespace EMStudio static void RenderText(QPainter& painter, const QString& text, const QColor& textColor, const QFont& font, const QFontMetrics& fontMetrics, Qt::Alignment textAlignment, const QRect& rect); // motion event presets - MotionEventPresetManager* GetEventPresetManger() const { return mEventPresetManager; } + MotionEventPresetManager* GetEventPresetManger() const { return m_eventPresetManager; } - void SetAutoLoadLastWorkspace(bool autoLoad) { mAutoLoadLastWorkspace = autoLoad; } - bool GetAutoLoadLastWorkspace() const { return mAutoLoadLastWorkspace; } + void SetAutoLoadLastWorkspace(bool autoLoad) { m_autoLoadLastWorkspace = autoLoad; } + bool GetAutoLoadLastWorkspace() const { return m_autoLoadLastWorkspace; } const char* ConstructHTMLLink(const char* text, const MCore::RGBAColor& color = MCore::RGBAColor(0.95315f, 0.609375f, 0.109375f)); void SetWidgetAsInvalidInput(QWidget* widget); @@ -99,7 +99,7 @@ namespace EMStudio void SetSelectedJointIndices(const AZStd::unordered_set& selectedJointIndices); const AZStd::unordered_set& GetSelectedJointIndices() const { return m_selectedJointIndices; } - Workspace* GetWorkspace() { return &mWorkspace; } + Workspace* GetWorkspace() { return &m_workspace; } // functions for adding/removing gizmos MCommon::TransformationManipulator* AddTransformationManipulator(MCommon::TransformationManipulator* manipulator); @@ -108,29 +108,29 @@ namespace EMStudio void ClearScene(); // remove animgraphs, animgraph instances and actors - MCORE_INLINE bool GetAvoidRendering() const { return mAvoidRendering; } - MCORE_INLINE void SetAvoidRendering(bool avoidRendering) { mAvoidRendering = avoidRendering; } - MCORE_INLINE bool GetIgnoreVisibility() const { return mIgnoreVisible; } - MCORE_INLINE void SetIgnoreVisibility(bool ignoreVisible) { mIgnoreVisible = ignoreVisible; } + MCORE_INLINE bool GetAvoidRendering() const { return m_avoidRendering; } + MCORE_INLINE void SetAvoidRendering(bool avoidRendering) { m_avoidRendering = avoidRendering; } + MCORE_INLINE bool GetIgnoreVisibility() const { return m_ignoreVisible; } + MCORE_INLINE void SetIgnoreVisibility(bool ignoreVisible) { m_ignoreVisible = ignoreVisible; } MCORE_INLINE bool GetSkipSourceControlCommands() { return m_skipSourceControlCommands; } MCORE_INLINE void SetSkipSourceControlCommands(bool skip) { m_skipSourceControlCommands = skip; } private: - AZStd::vector mTransformationManipulators; - QPointer mMainWindow; - QApplication* mApp; - PluginManager* mPluginManager; - LayoutManager* mLayoutManager; - NotificationWindowManager* mNotificationWindowManager; - CommandSystem::CommandManager* mCommandManager; - AZStd::string mCompileDate; + AZStd::vector m_transformationManipulators; + QPointer m_mainWindow; + QApplication* m_app; + PluginManager* m_pluginManager; + LayoutManager* m_layoutManager; + NotificationWindowManager* m_notificationWindowManager; + CommandSystem::CommandManager* m_commandManager; + AZStd::string m_compileDate; AZStd::unordered_set m_visibleJointIndices; AZStd::unordered_set m_selectedJointIndices; - Workspace mWorkspace; - bool mAutoLoadLastWorkspace; - AZStd::string mHTMLLinkString; - bool mAvoidRendering; - bool mIgnoreVisible = false; - MotionEventPresetManager* mEventPresetManager; + Workspace m_workspace; + bool m_autoLoadLastWorkspace; + AZStd::string m_htmlLinkString; + bool m_avoidRendering; + bool m_ignoreVisible = false; + MotionEventPresetManager* m_eventPresetManager; bool m_skipSourceControlCommands = false; // SkeletonOutlinerNotificationBus @@ -150,7 +150,7 @@ namespace EMStudio void OnRemoveCommand(size_t historyIndex) override { MCORE_UNUSED(historyIndex); } void OnSetCurrentCommand(size_t index) override { MCORE_UNUSED(index); } }; - EventProcessingCallback* mEventProcessingCallback; + EventProcessingCallback* m_eventProcessingCallback; }; diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/EMStudioPlugin.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/EMStudioPlugin.h index 49f306c7e0..0de4ab946c 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/EMStudioPlugin.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/EMStudioPlugin.h @@ -80,16 +80,16 @@ namespace EMStudio RenderInfo(MCommon::RenderUtil* renderUtil, MCommon::Camera* camera, uint32 screenWidth, uint32 screenHeight) { - mRenderUtil = renderUtil; - mCamera = camera; - mScreenWidth = screenWidth; - mScreenHeight = screenHeight; + m_renderUtil = renderUtil; + m_camera = camera; + m_screenWidth = screenWidth; + m_screenHeight = screenHeight; } - MCommon::RenderUtil* mRenderUtil; - MCommon::Camera* mCamera; - uint32 mScreenWidth; - uint32 mScreenHeight; + MCommon::RenderUtil* m_renderUtil; + MCommon::Camera* m_camera; + uint32 m_screenWidth; + uint32 m_screenHeight; }; virtual void Render(RenderPlugin* renderPlugin, RenderInfo* renderInfo) { MCORE_UNUSED(renderPlugin); MCORE_UNUSED(renderInfo); } diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/FileManager.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/FileManager.cpp index dcb7c46fe5..5a89729e49 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/FileManager.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/FileManager.cpp @@ -46,11 +46,11 @@ namespace EMStudio FileManager::FileManager(QWidget* parent) : QObject(parent) { - mLastActorFolder = EMotionFX::GetEMotionFX().GetAssetSourceFolder().c_str(); - mLastMotionSetFolder = EMotionFX::GetEMotionFX().GetAssetSourceFolder().c_str(); - mLastAnimGraphFolder = EMotionFX::GetEMotionFX().GetAssetSourceFolder().c_str(); - mLastWorkspaceFolder = EMotionFX::GetEMotionFX().GetAssetSourceFolder().c_str(); - mLastNodeMapFolder = EMotionFX::GetEMotionFX().GetAssetSourceFolder().c_str(); + m_lastActorFolder = EMotionFX::GetEMotionFX().GetAssetSourceFolder().c_str(); + m_lastMotionSetFolder = EMotionFX::GetEMotionFX().GetAssetSourceFolder().c_str(); + m_lastAnimGraphFolder = EMotionFX::GetEMotionFX().GetAssetSourceFolder().c_str(); + m_lastWorkspaceFolder = EMotionFX::GetEMotionFX().GetAssetSourceFolder().c_str(); + m_lastNodeMapFolder = EMotionFX::GetEMotionFX().GetAssetSourceFolder().c_str(); // Connect to the asset catalog bus for product asset changes. AzFramework::AssetCatalogEventBus::Handler::BusConnect(); @@ -416,14 +416,14 @@ namespace EMStudio QString selectedFilter; const AZStd::string filename = QFileDialog::getSaveFileName(parent, // parent "Save", // caption - GetLastUsedFolder(mLastActorFolder), // directory + GetLastUsedFolder(m_lastActorFolder), // directory "EMotion FX Actor Files (*.actor)", &selectedFilter, options).toUtf8().data(); GetManager()->SetAvoidRendering(false); - UpdateLastUsedFolder(filename.c_str(), mLastActorFolder); + UpdateLastUsedFolder(filename.c_str(), m_lastActorFolder); return filename; } @@ -456,12 +456,12 @@ namespace EMStudio QString selectedFilter; AZStd::string filename = QFileDialog::getOpenFileName(parent, // parent "Open", // caption - GetLastUsedFolder(mLastWorkspaceFolder), // directory + GetLastUsedFolder(m_lastWorkspaceFolder), // directory "EMotionFX Editor Workspace Files (*.emfxworkspace);;All Files (*)", &selectedFilter, options).toUtf8().data(); - UpdateLastUsedFolder(filename.c_str(), mLastWorkspaceFolder); + UpdateLastUsedFolder(filename.c_str(), m_lastWorkspaceFolder); GetManager()->SetAvoidRendering(false); return filename; } @@ -475,7 +475,7 @@ namespace EMStudio QString selectedFilter; AZStd::string filename = QFileDialog::getSaveFileName(parent, // parent "Save", // caption - GetLastUsedFolder(mLastWorkspaceFolder), // directory + GetLastUsedFolder(m_lastWorkspaceFolder), // directory "EMotionFX Editor Workspace Files (*.emfxworkspace)", &selectedFilter, options).toUtf8().data(); @@ -488,7 +488,7 @@ namespace EMStudio return AZStd::string(); } - UpdateLastUsedFolder(filename.c_str(), mLastWorkspaceFolder); + UpdateLastUsedFolder(filename.c_str(), m_lastWorkspaceFolder); return filename; } @@ -557,14 +557,14 @@ namespace EMStudio QString selectedFilter; AZStd::string filename = QFileDialog::getSaveFileName(parent, // parent "Save", // caption - GetLastUsedFolder(mLastMotionSetFolder), // directory + GetLastUsedFolder(m_lastMotionSetFolder), // directory "EMotion FX Motion Set Files (*.motionset)", &selectedFilter, options).toUtf8().data(); GetManager()->SetAvoidRendering(false); - UpdateLastUsedFolder(filename.c_str(), mLastMotionSetFolder); + UpdateLastUsedFolder(filename.c_str(), m_lastMotionSetFolder); return filename; } @@ -636,14 +636,14 @@ namespace EMStudio QString selectedFilter; AZStd::string filename = QFileDialog::getSaveFileName(parent, // parent "Save", // caption - GetLastUsedFolder(mLastAnimGraphFolder), // directory + GetLastUsedFolder(m_lastAnimGraphFolder), // directory "EMotion FX Anim Graph Files (*.animgraph);;All Files (*)", &selectedFilter, options).toUtf8().data(); GetManager()->SetAvoidRendering(false); - UpdateLastUsedFolder(filename.c_str(), mLastAnimGraphFolder); + UpdateLastUsedFolder(filename.c_str(), m_lastAnimGraphFolder); return filename; } @@ -658,14 +658,14 @@ namespace EMStudio QString selectedFilter; const AZStd::string filename = QFileDialog::getOpenFileName(parent, // parent "Open", // caption - GetLastUsedFolder(mLastNodeMapFolder), // directory + GetLastUsedFolder(m_lastNodeMapFolder), // directory "Node Map Files (*.nodeMap);;All Files (*)", &selectedFilter, options).toUtf8().data(); GetManager()->SetAvoidRendering(false); - UpdateLastUsedFolder(filename.c_str(), mLastNodeMapFolder); + UpdateLastUsedFolder(filename.c_str(), m_lastNodeMapFolder); return filename; } @@ -679,14 +679,14 @@ namespace EMStudio QString selectedFilter; const AZStd::string filename = QFileDialog::getSaveFileName(parent, // parent "Save", // caption - GetLastUsedFolder(mLastNodeMapFolder), // directory + GetLastUsedFolder(m_lastNodeMapFolder), // directory "Node Map Files (*.nodeMap);;All Files (*)", &selectedFilter, options).toUtf8().data(); GetManager()->SetAvoidRendering(false); - UpdateLastUsedFolder(filename.c_str(), mLastNodeMapFolder); + UpdateLastUsedFolder(filename.c_str(), m_lastNodeMapFolder); return filename; } diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/FileManager.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/FileManager.h index 50dfce390a..98d7de188d 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/FileManager.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/FileManager.h @@ -106,13 +106,13 @@ namespace EMStudio private: AZStd::vector m_savedSourceAssets; - QString mLastActorFolder; - QString mLastMotionSetFolder; - QString mLastAnimGraphFolder; - QString mLastWorkspaceFolder; - QString mLastNodeMapFolder; + QString m_lastActorFolder; + QString m_lastMotionSetFolder; + QString m_lastAnimGraphFolder; + QString m_lastWorkspaceFolder; + QString m_lastNodeMapFolder; - bool mSkipFileChangedCheck; + bool m_skipFileChangedCheck; void UpdateLastUsedFolder(const char* filename, QString& outLastFolder) const; QString GetLastUsedFolder(const QString& lastUsedFolder) const; diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/KeyboardShortcutsWindow.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/KeyboardShortcutsWindow.cpp index 7355b1da0a..bccf4e1be3 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/KeyboardShortcutsWindow.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/KeyboardShortcutsWindow.cpp @@ -34,8 +34,8 @@ namespace EMStudio KeyboardShortcutsWindow::KeyboardShortcutsWindow(QWidget* parent) : QWidget(parent) { - mSelectedGroup = -1; - mShortcutReceiverDialog = nullptr; + m_selectedGroup = -1; + m_shortcutReceiverDialog = nullptr; // fill the table Init(); @@ -52,51 +52,51 @@ namespace EMStudio void KeyboardShortcutsWindow::Init() { // create the node groups table - mTableWidget = new QTableWidget(); + m_tableWidget = new QTableWidget(); // create the table widget - mTableWidget->setSortingEnabled(false); - mTableWidget->setAlternatingRowColors(true); - mTableWidget->setCornerButtonEnabled(false); - mTableWidget->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); - mTableWidget->setContextMenuPolicy(Qt::DefaultContextMenu); + m_tableWidget->setSortingEnabled(false); + m_tableWidget->setAlternatingRowColors(true); + m_tableWidget->setCornerButtonEnabled(false); + m_tableWidget->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); + m_tableWidget->setContextMenuPolicy(Qt::DefaultContextMenu); // set the table to row single selection - mTableWidget->setSelectionBehavior(QAbstractItemView::SelectRows); - mTableWidget->setSelectionMode(QAbstractItemView::SingleSelection); + m_tableWidget->setSelectionBehavior(QAbstractItemView::SelectRows); + m_tableWidget->setSelectionMode(QAbstractItemView::SingleSelection); - connect(mTableWidget, &QTableWidget::cellDoubleClicked, this, &KeyboardShortcutsWindow::OnShortcutChange); + connect(m_tableWidget, &QTableWidget::cellDoubleClicked, this, &KeyboardShortcutsWindow::OnShortcutChange); // create the list widget - mListWidget = new QListWidget(); - mListWidget->setAlternatingRowColors(true); - connect(mListWidget, &QListWidget::itemSelectionChanged, this, &KeyboardShortcutsWindow::OnGroupSelectionChanged); + m_listWidget = new QListWidget(); + m_listWidget->setAlternatingRowColors(true); + connect(m_listWidget, &QListWidget::itemSelectionChanged, this, &KeyboardShortcutsWindow::OnGroupSelectionChanged); // build the layout - mHLayout = new QHBoxLayout(); - mHLayout->setMargin(0); - mHLayout->setAlignment(Qt::AlignLeft); + m_hLayout = new QHBoxLayout(); + m_hLayout->setMargin(0); + m_hLayout->setAlignment(Qt::AlignLeft); - mHLayout->addWidget(mListWidget); + m_hLayout->addWidget(m_listWidget); QVBoxLayout* vLayout = new QVBoxLayout(); vLayout->setMargin(0); - vLayout->addWidget(mTableWidget); + vLayout->addWidget(m_tableWidget); QLabel* label = new QLabel("Double-click to adjust shortcut"); label->setAlignment(Qt::AlignCenter); vLayout->addWidget(label); - mHLayout->addLayout(vLayout); + m_hLayout->addLayout(vLayout); // set the main layout - setLayout(mHLayout); + setLayout(m_hLayout); ReInit(); // automatically select the first entry - if (mListWidget->count() > 0) + if (m_listWidget->count() > 0) { - mListWidget->setCurrentRow(0); + m_listWidget->setCurrentRow(0); } } @@ -115,14 +115,14 @@ namespace EMStudio // reconstruct the whole interface void KeyboardShortcutsWindow::ReInit() { - mTableWidget->blockSignals(true); + m_tableWidget->blockSignals(true); // clear - mListWidget->clear(); + m_listWidget->clear(); // make the list widget smaller than the table - mListWidget->setMinimumWidth(150); - mListWidget->setMaximumWidth(150); + m_listWidget->setMinimumWidth(150); + m_listWidget->setMaximumWidth(150); // add the groups to the left list widget MysticQt::KeyboardShortcutManager* shortcutManager = GetMainWindow()->GetShortcutManager(); @@ -130,13 +130,13 @@ namespace EMStudio for (uint32 i = 0; i < numGroups; ++i) { MysticQt::KeyboardShortcutManager::Group* group = shortcutManager->GetGroup(i); - mListWidget->addItem(FromStdString(group->GetName())); + m_listWidget->addItem(FromStdString(group->GetName())); } - mTableWidget->blockSignals(false); + m_tableWidget->blockSignals(false); // automatically select the first entry - mListWidget->setCurrentRow(mSelectedGroup); + m_listWidget->setCurrentRow(m_selectedGroup); } @@ -144,37 +144,37 @@ namespace EMStudio void KeyboardShortcutsWindow::OnGroupSelectionChanged() { // get the group index - mSelectedGroup = mListWidget->currentRow(); - if (mSelectedGroup == -1) + m_selectedGroup = m_listWidget->currentRow(); + if (m_selectedGroup == -1) { return; } // clear the table - mTableWidget->clear(); + m_tableWidget->clear(); // set header item for the table - mTableWidget->setColumnCount(2); + m_tableWidget->setColumnCount(2); QTableWidgetItem* headerItem = new QTableWidgetItem("Action"); headerItem->setTextAlignment(Qt::AlignVCenter | Qt::AlignLeft); - mTableWidget->setHorizontalHeaderItem(0, headerItem); + m_tableWidget->setHorizontalHeaderItem(0, headerItem); headerItem = new QTableWidgetItem("Shortcut"); headerItem->setTextAlignment(Qt::AlignVCenter | Qt::AlignLeft); - mTableWidget->setHorizontalHeaderItem(1, headerItem); + m_tableWidget->setHorizontalHeaderItem(1, headerItem); // set the vertical header not visible - QHeaderView* verticalHeader = mTableWidget->verticalHeader(); + QHeaderView* verticalHeader = m_tableWidget->verticalHeader(); verticalHeader->setVisible(false); // get access to the shortcut group and some data MysticQt::KeyboardShortcutManager* shortcutManager = GetMainWindow()->GetShortcutManager(); - MysticQt::KeyboardShortcutManager::Group* group = shortcutManager->GetGroup(mSelectedGroup); + MysticQt::KeyboardShortcutManager::Group* group = shortcutManager->GetGroup(m_selectedGroup); const size_t numActions = group->GetNumActions(); // set the row count - mTableWidget->setRowCount(aznumeric_caster(numActions)); + m_tableWidget->setRowCount(aznumeric_caster(numActions)); // fill the table with the media root folders for (uint32 i = 0; i < numActions; ++i) @@ -185,25 +185,25 @@ namespace EMStudio // add the item to the table and set the row height QTableWidgetItem* item = new QTableWidgetItem(action->m_qaction->text()); item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable); - mTableWidget->setItem(i, 0, item); + m_tableWidget->setItem(i, 0, item); const QString keyText = ConstructStringFromShortcut(action->m_qaction->shortcut()); item = new QTableWidgetItem(keyText); item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable); - mTableWidget->setItem(i, 1, item); + m_tableWidget->setItem(i, 1, item); - mTableWidget->setRowHeight(i, 21); + m_tableWidget->setRowHeight(i, 21); } // resize the first column - mTableWidget->resizeColumnToContents(0); + m_tableWidget->resizeColumnToContents(0); // needed to have the last column stretching correctly - mTableWidget->setColumnWidth(1, 0); + m_tableWidget->setColumnWidth(1, 0); // set the last column to take the whole space - mTableWidget->horizontalHeader()->setStretchLastSection(true); + m_tableWidget->horizontalHeader()->setStretchLastSection(true); } @@ -211,7 +211,7 @@ namespace EMStudio MysticQt::KeyboardShortcutManager::Group* KeyboardShortcutsWindow::GetCurrentGroup() const { // get access to the group - int32 groupIndex = mListWidget->currentRow(); + int32 groupIndex = m_listWidget->currentRow(); if (groupIndex == -1) { return nullptr; @@ -237,17 +237,17 @@ namespace EMStudio MysticQt::KeyboardShortcutManager::Action* action = group->GetAction(row); ShortcutReceiverDialog shortcutWindow(this, action, group); - mShortcutReceiverDialog = &shortcutWindow; + m_shortcutReceiverDialog = &shortcutWindow; if (shortcutWindow.exec() == QDialog::Accepted) { // handle conflicts - if (shortcutWindow.mConflictDetected) + if (shortcutWindow.m_conflictDetected) { - shortcutWindow.mConflictAction->m_qaction->setShortcut({}); + shortcutWindow.m_conflictAction->m_qaction->setShortcut({}); } // adjust the shortcut action - action->m_qaction->setShortcut(shortcutWindow.mKey); + action->m_qaction->setShortcut(shortcutWindow.m_key); // save the new shortcuts QSettings settings(FromStdString(AZStd::string(GetManager()->GetAppDataFolder() + "EMStudioKeyboardShortcuts.cfg")), QSettings::IniFormat, this); @@ -256,7 +256,7 @@ namespace EMStudio // reinit the window ReInit(); } - mShortcutReceiverDialog = nullptr; + m_shortcutReceiverDialog = nullptr; } @@ -275,12 +275,12 @@ namespace EMStudio // reset to default after pressing context menu void KeyboardShortcutsWindow::OnResetToDefault() { - if (mContextMenuAction == nullptr) + if (m_contextMenuAction == nullptr) { return; } - mContextMenuAction->m_qaction->setShortcut(mContextMenuAction->m_defaultKeySequence); + m_contextMenuAction->m_qaction->setShortcut(m_contextMenuAction->m_defaultKeySequence); ReInit(); } @@ -289,13 +289,13 @@ namespace EMStudio // assign a new key after pressing the context menu item void KeyboardShortcutsWindow::OnAssignNewKey() { - if (mContextMenuAction == nullptr) + if (m_contextMenuAction == nullptr) { return; } // assign the new shortcut - OnShortcutChange(mContextMenuActionIndex, 0); + OnShortcutChange(m_contextMenuActionIndex, 0); } @@ -303,7 +303,7 @@ namespace EMStudio void KeyboardShortcutsWindow::contextMenuEvent(QContextMenuEvent* event) { // find the table widget item at the clicked position - QTableWidgetItem* clickedItem = mTableWidget->itemAt(mTableWidget->viewport()->mapFromGlobal(event->globalPos())); + QTableWidgetItem* clickedItem = m_tableWidget->itemAt(m_tableWidget->viewport()->mapFromGlobal(event->globalPos())); if (clickedItem == nullptr) { return; @@ -315,8 +315,8 @@ namespace EMStudio MysticQt::KeyboardShortcutManager::Group* group = GetCurrentGroup(); // get access to the action - mContextMenuAction = group->GetAction(actionIndex); - mContextMenuActionIndex = actionIndex; + m_contextMenuAction = group->GetAction(actionIndex); + m_contextMenuActionIndex = actionIndex; // create the context menu QMenu menu(this); @@ -343,33 +343,33 @@ namespace EMStudio setWindowTitle(" "); layout->addWidget(new QLabel("Press the new shortcut on the keyboard:")); - mOrgAction = action; - mOrgGroup = group; + m_orgAction = action; + m_orgGroup = group; - mConflictAction = nullptr; - mConflictDetected = false; - mKey = action->m_qaction->shortcut(); + m_conflictAction = nullptr; + m_conflictDetected = false; + m_key = action->m_qaction->shortcut(); - QString keyText = KeyboardShortcutsWindow::ConstructStringFromShortcut(mKey); + QString keyText = KeyboardShortcutsWindow::ConstructStringFromShortcut(m_key); - mLabel = new QLabel(keyText); - mLabel->setAlignment(Qt::AlignHCenter); - QFont font = mLabel->font(); + m_label = new QLabel(keyText); + m_label->setAlignment(Qt::AlignHCenter); + QFont font = m_label->font(); font.setPointSize(14); font.setBold(true); - mLabel->setFont(font); - layout->addWidget(mLabel); + m_label->setFont(font); + layout->addWidget(m_label); - mConflictKeyLabel = new QLabel(""); - mConflictKeyLabel->setAlignment(Qt::AlignHCenter); - layout->addWidget(mConflictKeyLabel); + m_conflictKeyLabel = new QLabel(""); + m_conflictKeyLabel->setAlignment(Qt::AlignHCenter); + layout->addWidget(m_conflictKeyLabel); QHBoxLayout* buttonLayout = new QHBoxLayout(); buttonLayout->setMargin(0); - mOKButton = new QPushButton("OK"); - buttonLayout->addWidget(mOKButton); - connect(mOKButton, &QPushButton::clicked, this, &ShortcutReceiverDialog::accept); + m_okButton = new QPushButton("OK"); + buttonLayout->addWidget(m_okButton); + connect(m_okButton, &QPushButton::clicked, this, &ShortcutReceiverDialog::accept); QPushButton* defaultButton = new QPushButton("Default"); buttonLayout->addWidget(defaultButton); @@ -391,7 +391,7 @@ namespace EMStudio // reset the shortcut to its default value void ShortcutReceiverDialog::ResetToDefault() { - mKey = mOrgAction->m_defaultKeySequence; + m_key = m_orgAction->m_defaultKeySequence; UpdateInterface(); } @@ -403,41 +403,41 @@ namespace EMStudio MysticQt::KeyboardShortcutManager* shortcutManager = GetMainWindow()->GetShortcutManager(); // check if the currently assigned shortcut is already taken by another shortcut - mConflictAction = shortcutManager->FindShortcut(mKey, mOrgGroup); - if (mConflictAction == nullptr || mConflictAction == mOrgAction) + m_conflictAction = shortcutManager->FindShortcut(m_key, m_orgGroup); + if (m_conflictAction == nullptr || m_conflictAction == m_orgAction) { - mOKButton->setToolTip(""); - mLabel->setStyleSheet(""); - mConflictKeyLabel->setStyleSheet(""); - mConflictKeyLabel->setText(""); - mConflictDetected = false; + m_okButton->setToolTip(""); + m_label->setStyleSheet(""); + m_conflictKeyLabel->setStyleSheet(""); + m_conflictKeyLabel->setText(""); + m_conflictDetected = false; } else { - mLabel->setStyleSheet("color: rgb(244, 156, 28);"); - mConflictKeyLabel->setStyleSheet("color: rgb(244, 156, 28);"); + m_label->setStyleSheet("color: rgb(244, 156, 28);"); + m_conflictKeyLabel->setStyleSheet("color: rgb(244, 156, 28);"); - mConflictDetected = true; + m_conflictDetected = true; - if (mConflictAction) + if (m_conflictAction) { - mOKButton->setToolTip(QString("Assigning new shortcut will unassign '%1' automatically.").arg(mConflictAction->m_qaction->text())); + m_okButton->setToolTip(QString("Assigning new shortcut will unassign '%1' automatically.").arg(m_conflictAction->m_qaction->text())); - MysticQt::KeyboardShortcutManager::Group* conflictGroup = shortcutManager->FindGroupForShortcut(mConflictAction); + MysticQt::KeyboardShortcutManager::Group* conflictGroup = shortcutManager->FindGroupForShortcut(m_conflictAction); if (conflictGroup) { - mConflictKeyLabel->setText(QString("Conflicts with: %1 -> %2").arg(FromStdString(conflictGroup->GetName())).arg(mConflictAction->m_qaction->text())); + m_conflictKeyLabel->setText(QString("Conflicts with: %1 -> %2").arg(FromStdString(conflictGroup->GetName())).arg(m_conflictAction->m_qaction->text())); } else { - mConflictKeyLabel->setText(QString("Conflicts with: %1").arg(mConflictAction->m_qaction->text())); + m_conflictKeyLabel->setText(QString("Conflicts with: %1").arg(m_conflictAction->m_qaction->text())); } } } // adjust the label text to the new shortcut - const QString keyText = KeyboardShortcutsWindow::ConstructStringFromShortcut(mKey); - mLabel->setText(keyText); + const QString keyText = KeyboardShortcutsWindow::ConstructStringFromShortcut(m_key); + m_label->setText(keyText); } // called when the user pressed a new shortcut @@ -460,7 +460,7 @@ namespace EMStudio } else { - mKey = event->key() | event->modifiers(); + m_key = event->key() | event->modifiers(); } UpdateInterface(); diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/KeyboardShortcutsWindow.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/KeyboardShortcutsWindow.h index bcc33ae9f8..bf109af0ca 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/KeyboardShortcutsWindow.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/KeyboardShortcutsWindow.h @@ -39,18 +39,18 @@ namespace EMStudio void keyPressEvent(QKeyEvent* event) override; void UpdateInterface(); - QKeySequence mKey; - bool mConflictDetected; - MysticQt::KeyboardShortcutManager::Action* mConflictAction; + QKeySequence m_key; + bool m_conflictDetected; + MysticQt::KeyboardShortcutManager::Action* m_conflictAction; private slots: void ResetToDefault(); private: - QLabel* mLabel; - QLabel* mConflictKeyLabel; - QPushButton* mOKButton; - MysticQt::KeyboardShortcutManager::Action* mOrgAction; - MysticQt::KeyboardShortcutManager::Group* mOrgGroup; + QLabel* m_label; + QLabel* m_conflictKeyLabel; + QPushButton* m_okButton; + MysticQt::KeyboardShortcutManager::Action* m_orgAction; + MysticQt::KeyboardShortcutManager::Group* m_orgGroup; }; @@ -79,13 +79,13 @@ namespace EMStudio void OnAssignNewKey(); private: - QTableWidget* mTableWidget; - QListWidget* mListWidget; - QHBoxLayout* mHLayout; - int mSelectedGroup; - MysticQt::KeyboardShortcutManager::Action* mContextMenuAction; - int mContextMenuActionIndex; - ShortcutReceiverDialog* mShortcutReceiverDialog; + QTableWidget* m_tableWidget; + QListWidget* m_listWidget; + QHBoxLayout* m_hLayout; + int m_selectedGroup; + MysticQt::KeyboardShortcutManager::Action* m_contextMenuAction; + int m_contextMenuActionIndex; + ShortcutReceiverDialog* m_shortcutReceiverDialog; void contextMenuEvent(QContextMenuEvent* event) override; }; diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/LayoutManager.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/LayoutManager.cpp index eed352ad7c..e2dbb3df60 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/LayoutManager.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/LayoutManager.cpp @@ -26,7 +26,7 @@ namespace EMStudio { LayoutManager::LayoutManager() { - mIsSwitching = false; + m_isSwitching = false; } LayoutManager::~LayoutManager() @@ -109,25 +109,25 @@ namespace EMStudio } LayoutHeader header; - header.mFileTypeCode[0] = 'E'; - header.mFileTypeCode[1] = 'M'; - header.mFileTypeCode[2] = 'S'; - header.mFileTypeCode[3] = 'L'; - header.mFileTypeCode[4] = 'A'; - header.mFileTypeCode[5] = 'Y'; - header.mFileTypeCode[6] = 'O'; - header.mFileTypeCode[7] = 'U'; - header.mFileTypeCode[8] = 'T'; - header.mEMFXVersionHigh = EMotionFX::GetEMotionFX().GetHighVersion(); - header.mEMFXVersionLow = EMotionFX::GetEMotionFX().GetLowVersion(); + header.m_fileTypeCode[0] = 'E'; + header.m_fileTypeCode[1] = 'M'; + header.m_fileTypeCode[2] = 'S'; + header.m_fileTypeCode[3] = 'L'; + header.m_fileTypeCode[4] = 'A'; + header.m_fileTypeCode[5] = 'Y'; + header.m_fileTypeCode[6] = 'O'; + header.m_fileTypeCode[7] = 'U'; + header.m_fileTypeCode[8] = 'T'; + header.m_emfxVersionHigh = EMotionFX::GetEMotionFX().GetHighVersion(); + header.m_emfxVersionLow = EMotionFX::GetEMotionFX().GetLowVersion(); - azstrcpy(header.mEMFXCompileDate, 64, EMotionFX::GetEMotionFX().GetCompilationDate()); - azstrcpy(header.mCompileDate, 64, MCORE_DATE); - azstrcpy(header.mDescription, 256, ""); + azstrcpy(header.m_emfxCompileDate, 64, EMotionFX::GetEMotionFX().GetCompilationDate()); + azstrcpy(header.m_compileDate, 64, MCORE_DATE); + azstrcpy(header.m_description, 256, ""); - header.mLayoutVersionHigh = 0; - header.mLayoutVersionLow = 1; - header.mNumPlugins = aznumeric_caster(GetPluginManager()->GetNumActivePlugins()); + header.m_layoutVersionHigh = 0; + header.m_layoutVersionLow = 1; + header.m_numPlugins = aznumeric_caster(GetPluginManager()->GetNumActivePlugins()); if (file.write((char*)&header, sizeof(LayoutHeader)) == -1) { MCore::LogWarning("Failed to write layout header to layout file '%s'", filename); @@ -135,7 +135,7 @@ namespace EMStudio } // For each plugin (window) save the object name. - for (uint32 i = 0; i < header.mNumPlugins; ++i) + for (uint32 i = 0; i < header.m_numPlugins; ++i) { EMStudioPlugin* plugin = GetPluginManager()->GetActivePlugin(i); @@ -145,16 +145,14 @@ namespace EMStudio // Save the plugin header. LayoutPluginHeader pluginHeader; - pluginHeader.mDataSize = static_cast(memFile.GetFileSize()); - pluginHeader.mDataVersion = plugin->GetLayoutDataVersion(); + pluginHeader.m_dataSize = static_cast(memFile.GetFileSize()); + pluginHeader.m_dataVersion = plugin->GetLayoutDataVersion(); - azstrcpy(pluginHeader.mObjectName, 128, FromQtString(plugin->GetObjectName()).c_str()); - azstrcpy(pluginHeader.mPluginName, 128, plugin->GetName()); + azstrcpy(pluginHeader.m_objectName, 128, FromQtString(plugin->GetObjectName()).c_str()); + azstrcpy(pluginHeader.m_pluginName, 128, plugin->GetName()); file.write((char*)&pluginHeader, sizeof(LayoutPluginHeader)); - //MCore::LogDetailedInfo("pluginHeader.mDataSize = %d bytes (version=%d) (name=%s)", pluginHeader.mDataSize, pluginHeader.mDataVersion, pluginHeader.mPluginName); - if (memFile.GetMemoryStart()) { if (file.write((char*)memFile.GetMemoryStart(), memFile.GetFileSize()) == -1) @@ -195,17 +193,17 @@ namespace EMStudio bool LayoutManager::LoadLayout(const char* filename) { // If we are already switching, skip directly. - if (mIsSwitching) + if (m_isSwitching) { return true; } - mIsSwitching = true; + m_isSwitching = true; QFile file(filename); if (file.open(QIODevice::ReadOnly) == false) { - mIsSwitching = false; + m_isSwitching = false; return false; } @@ -218,42 +216,31 @@ namespace EMStudio if (file.read((char*)&header, sizeof(LayoutHeader)) == -1) { MCore::LogWarning("Error reading header from layout file '%s'", filename); - mIsSwitching = false; + m_isSwitching = false; return false; } // Check if this is a valid layout file. - if (header.mFileTypeCode[0] != 'E' || header.mFileTypeCode[1] != 'M' || header.mFileTypeCode[2] != 'S' || - header.mFileTypeCode[3] != 'L' || header.mFileTypeCode[4] != 'A' || header.mFileTypeCode[5] != 'Y' || header.mFileTypeCode[6] != 'O' || header.mFileTypeCode[7] != 'U' || header.mFileTypeCode[8] != 'T') + if (header.m_fileTypeCode[0] != 'E' || header.m_fileTypeCode[1] != 'M' || header.m_fileTypeCode[2] != 'S' || + header.m_fileTypeCode[3] != 'L' || header.m_fileTypeCode[4] != 'A' || header.m_fileTypeCode[5] != 'Y' || header.m_fileTypeCode[6] != 'O' || header.m_fileTypeCode[7] != 'U' || header.m_fileTypeCode[8] != 'T') { MCore::LogWarning("Failed to load file '%s' as it is not a valid EMotion Studio layout file.", filename); - mIsSwitching = false; + m_isSwitching = false; return false; } - //MCore::LogDetailedInfo("EMotion FX version = v%d.%d", header.mEMFXVersionHigh, header.mEMFXVersionLow / 100); - //MCore::LogDetailedInfo("EMotion FX compile date = %s", header.mEMFXCompileDate); - //MCore::LogDetailedInfo("EMStudio compile date = %s", header.mCompileDate); - //MCore::LogDetailedInfo("Layout description = %s", header.mDescription); - //MCore::LogDetailedInfo("Layout version = v%d.%d", header.mLayoutVersionHigh, header.mLayoutVersionLow); - //MCore::LogDetailedInfo("Num active plugins = %d", header.mNumPlugins); - // Iterate through the plugins and try to reuse them. - for (uint32 i = 0; i < header.mNumPlugins; ++i) + for (uint32 i = 0; i < header.m_numPlugins; ++i) { // load the plugin header LayoutPluginHeader pluginHeader; if (file.read((char*)&pluginHeader, sizeof(LayoutPluginHeader)) == -1) { MCore::LogWarning("Error reading plugin header from layout file '%s'", filename); - mIsSwitching = false; + m_isSwitching = false; return false; } - //MCore::LogDetailedInfo("Loading plugin settings for plugin '%s'...", pluginHeader.mPluginName); - //MCore::LogDetailedInfo(" + Data size = %d bytes", pluginHeader.mDataSize); - //MCore::LogDetailedInfo(" + Data version = %d", pluginHeader.mDataVersion); - EMStudioPlugin* plugin = nullptr; // Check if we already have a window using a similar plugin. @@ -264,10 +251,10 @@ namespace EMStudio while (itActivePlugin != activePlugins.end()) { // Is the plugin name the same as we need to create? - if (AzFramework::StringFunc::Equal((*itActivePlugin)->GetName(), pluginHeader.mPluginName)) + if (AzFramework::StringFunc::Equal((*itActivePlugin)->GetName(), pluginHeader.m_pluginName)) { plugin = *itActivePlugin; - plugin->SetObjectName(pluginHeader.mObjectName); + plugin->SetObjectName(pluginHeader.m_objectName); if (plugin->GetPluginType() == EMStudioPlugin::PLUGINTYPE_DOCKWIDGET) { DockWidgetPlugin* dockPlugin = static_cast(plugin); @@ -289,23 +276,23 @@ namespace EMStudio // Try to create the plugin of this type. if (!plugin) { - plugin = GetPluginManager()->CreateWindowOfType(pluginHeader.mPluginName, pluginHeader.mObjectName); + plugin = GetPluginManager()->CreateWindowOfType(pluginHeader.m_pluginName, pluginHeader.m_objectName); if (!plugin) { - MCore::LogError("Failed to create plugin window of type '%s', with data size %d bytes", pluginHeader.mPluginName, pluginHeader.mDataSize); + MCore::LogError("Failed to create plugin window of type '%s', with data size %d bytes", pluginHeader.m_pluginName, pluginHeader.m_dataSize); // Skip the data. - file.seek(file.pos() + pluginHeader.mDataSize); + file.seek(file.pos() + pluginHeader.m_dataSize); continue; } } - if (plugin->ReadLayoutSettings(file, pluginHeader.mDataSize, pluginHeader.mDataVersion) == false) + if (plugin->ReadLayoutSettings(file, pluginHeader.m_dataSize, pluginHeader.m_dataVersion) == false) { MCore::LogWarning("Error reading plugin settings from layout file '%s'", filename); - mIsSwitching = false; + m_isSwitching = false; return false; } } @@ -321,7 +308,7 @@ namespace EMStudio if (file.read((char*)&stateLength, sizeof(uint32)) == -1) { MCore::LogWarning("Error reading main window state length from layout file '%s'", filename); - mIsSwitching = false; + m_isSwitching = false; return false; } @@ -330,7 +317,7 @@ namespace EMStudio if (layout.size() == 0) { MCore::LogWarning("Error reading main window state data from layout file '%s'", filename); - mIsSwitching = false; + m_isSwitching = false; return false; } @@ -345,7 +332,7 @@ namespace EMStudio GetPluginManager()->GetActivePlugin(p)->OnAfterLoadLayout(); } - mIsSwitching = false; + m_isSwitching = false; return true; } } // namespace EMStudio diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/LayoutManager.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/LayoutManager.h index 5aabbd6024..4059f8f006 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/LayoutManager.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/LayoutManager.h @@ -17,18 +17,18 @@ namespace EMStudio // layout file header struct LayoutHeader { - char mFileTypeCode[9]; // "EMSLAYOUT", otherwise no valid layout file - uint32 mEMFXVersionHigh; // EMotion FX high version as used in EMStudio - uint32 mEMFXVersionLow; // EMotion FX low version as used in EMStudio - char mEMFXCompileDate[64];// EMotion FX compile date - uint32 mLayoutVersionHigh; // layout file type high version - uint32 mLayoutVersionLow; // layout file type low version - char mCompileDate[64]; // EMStudio compile date - char mDescription[256]; // optional description of the layout - uint32 mNumPlugins; // the number of plugins + char m_fileTypeCode[9]; // "EMSLAYOUT", otherwise no valid layout file + uint32 m_emfxVersionHigh; // EMotion FX high version as used in EMStudio + uint32 m_emfxVersionLow; // EMotion FX low version as used in EMStudio + char m_emfxCompileDate[64];// EMotion FX compile date + uint32 m_layoutVersionHigh; // layout file type high version + uint32 m_layoutVersionLow; // layout file type low version + char m_compileDate[64]; // EMStudio compile date + char m_description[256]; // optional description of the layout + uint32 m_numPlugins; // the number of plugins // followed by: - // LayoutPluginHeader[mNumPlugins] + // LayoutPluginHeader[m_numPlugins] // uint32 mainWindowStateSize // int8 mainWindowState[mainWindowStateSize] }; @@ -36,13 +36,13 @@ namespace EMStudio // the plugin data header struct LayoutPluginHeader { - uint32 mDataSize; // data size of the data which the given plugin will store - char mPluginName[128]; // the name of the plugin (its ID to create as passed to PluginManager::CreateWindowOfType) - char mObjectName[128]; - uint32 mDataVersion; // the data version, to for backward compatibility of loading individual plugin settings from layout files + uint32 m_dataSize; // data size of the data which the given plugin will store + char m_pluginName[128]; // the name of the plugin (its ID to create as passed to PluginManager::CreateWindowOfType) + char m_objectName[128]; + uint32 m_dataVersion; // the data version, to for backward compatibility of loading individual plugin settings from layout files // followed by: - // int8 pluginData[mDataSize] + // int8 pluginData[m_dataSize] }; class EMSTUDIO_API LayoutManager @@ -62,7 +62,7 @@ namespace EMStudio InputDialogValidatable* GetSaveLayoutNameDialog(); private: - bool mIsSwitching; + bool m_isSwitching; InputDialogValidatable* m_inputDialog = nullptr; }; } // namespace EMStudio diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/LoadActorSettingsWindow.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/LoadActorSettingsWindow.cpp index 090875f20f..179ea26e34 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/LoadActorSettingsWindow.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/LoadActorSettingsWindow.cpp @@ -40,101 +40,101 @@ namespace EMStudio const QSettings loadActorSettings(GetConfigFilename(), QSettings::IniFormat, this); // create the load meshes checkbox - mLoadMeshesCheckbox = new QCheckBox("Load Meshes"); + m_loadMeshesCheckbox = new QCheckBox("Load Meshes"); const bool loadMeshesValue = loadActorSettings.value("LoadMeshes", true).toBool(); - mLoadMeshesCheckbox->setChecked(loadMeshesValue); + m_loadMeshesCheckbox->setChecked(loadMeshesValue); // connect the load meshes checkbox to enable/disable all related to mesh - connect(mLoadMeshesCheckbox, &QCheckBox::clicked, this, &LoadActorSettingsWindow::LoadMeshesClicked); + connect(m_loadMeshesCheckbox, &QCheckBox::clicked, this, &LoadActorSettingsWindow::LoadMeshesClicked); // create the load collision meshes checkbox - mLoadCollisionMeshesCheckbox = new QCheckBox("Load Collision Meshes"); + m_loadCollisionMeshesCheckbox = new QCheckBox("Load Collision Meshes"); const bool loadCollisionMeshesValue = loadActorSettings.value("LoadCollisionMeshes", true).toBool(); - mLoadCollisionMeshesCheckbox->setChecked(loadCollisionMeshesValue); + m_loadCollisionMeshesCheckbox->setChecked(loadCollisionMeshesValue); // create the load standard material layers checkbox - mLoadStandardMaterialLayersCheckbox = new QCheckBox("Load Standard Material Layers"); + m_loadStandardMaterialLayersCheckbox = new QCheckBox("Load Standard Material Layers"); const bool loadStandardMaterialLayersValue = loadActorSettings.value("LoadStandardMaterialLayers", true).toBool(); - mLoadStandardMaterialLayersCheckbox->setChecked(loadStandardMaterialLayersValue); + m_loadStandardMaterialLayersCheckbox->setChecked(loadStandardMaterialLayersValue); // create the load skinning info checkbox - mLoadSkinningInfoCheckbox = new QCheckBox("Load Skinning Info"); + m_loadSkinningInfoCheckbox = new QCheckBox("Load Skinning Info"); const bool loadSkinningInfoValue = loadActorSettings.value("LoadSkinningInfo", true).toBool(); - mLoadSkinningInfoCheckbox->setChecked(loadSkinningInfoValue); + m_loadSkinningInfoCheckbox->setChecked(loadSkinningInfoValue); // connect the load meshes checkbox to enable/disable all related to mesh - connect(mLoadSkinningInfoCheckbox, &QCheckBox::clicked, this, &LoadActorSettingsWindow::LoadSkinningInfoClicked); + connect(m_loadSkinningInfoCheckbox, &QCheckBox::clicked, this, &LoadActorSettingsWindow::LoadSkinningInfoClicked); // create the load limits checkbox - mLoadLimitsCheckbox = new QCheckBox("Load Limits"); + m_loadLimitsCheckbox = new QCheckBox("Load Limits"); const bool loadLimitsValue = loadActorSettings.value("LoadLimits", true).toBool(); - mLoadLimitsCheckbox->setChecked(loadLimitsValue); + m_loadLimitsCheckbox->setChecked(loadLimitsValue); // create the load geometry LODs checkbox - mLoadGeometryLODsCheckbox = new QCheckBox("Load Geometry LODs"); + m_loadGeometryLoDsCheckbox = new QCheckBox("Load Geometry LODs"); const bool loadGeometryLODsValue = loadActorSettings.value("LoadGeometryLODs", true).toBool(); - mLoadGeometryLODsCheckbox->setChecked(loadGeometryLODsValue); + m_loadGeometryLoDsCheckbox->setChecked(loadGeometryLODsValue); // create the load skeletal LODs checkbox - mLoadSkeletalLODsCheckbox = new QCheckBox("Load Skeletal LODs"); + m_loadSkeletalLoDsCheckbox = new QCheckBox("Load Skeletal LODs"); const bool loadSkeletalLODsValue = loadActorSettings.value("LoadSkeletalLODs", true).toBool(); - mLoadSkeletalLODsCheckbox->setChecked(loadSkeletalLODsValue); + m_loadSkeletalLoDsCheckbox->setChecked(loadSkeletalLODsValue); // create the load tangents checkbox - mLoadTangentsCheckbox = new QCheckBox("Load Tangents"); + m_loadTangentsCheckbox = new QCheckBox("Load Tangents"); const bool loadTangentsValue = loadActorSettings.value("LoadTangents", true).toBool(); - mLoadTangentsCheckbox->setChecked(loadTangentsValue); + m_loadTangentsCheckbox->setChecked(loadTangentsValue); // create the auto generate tangents checkbox - mAutoGenerateTangentsCheckbox = new QCheckBox("Auto Generate Tangents"); + m_autoGenerateTangentsCheckbox = new QCheckBox("Auto Generate Tangents"); const bool autoGenerateTangentsValue = loadActorSettings.value("AutoGenerateTangents", true).toBool(); - mAutoGenerateTangentsCheckbox->setChecked(autoGenerateTangentsValue); + m_autoGenerateTangentsCheckbox->setChecked(autoGenerateTangentsValue); // create the load morph targets checkbox - mLoadMorphTargetsCheckbox = new QCheckBox("Load Morph Targets"); + m_loadMorphTargetsCheckbox = new QCheckBox("Load Morph Targets"); const bool loadMorphTargetsValue = loadActorSettings.value("LoadMorphTargets", true).toBool(); - mLoadMorphTargetsCheckbox->setChecked(loadMorphTargetsValue); + m_loadMorphTargetsCheckbox->setChecked(loadMorphTargetsValue); // create the dual quaternion skinning checkbox - mDualQuaternionSkinningCheckbox = new QCheckBox("Dual Quaternion Skinning"); + m_dualQuaternionSkinningCheckbox = new QCheckBox("Dual Quaternion Skinning"); const bool dualQuaternionSkinningValue = loadActorSettings.value("DualQuaternionSkinning", false).toBool(); - mDualQuaternionSkinningCheckbox->setChecked(dualQuaternionSkinningValue); + m_dualQuaternionSkinningCheckbox->setChecked(dualQuaternionSkinningValue); // disable the controls if load meshes is not enabled if (loadMeshesValue == false) { - mLoadStandardMaterialLayersCheckbox->setDisabled(true); - mLoadSkinningInfoCheckbox->setDisabled(true); - mLoadGeometryLODsCheckbox->setDisabled(true); - mLoadTangentsCheckbox->setDisabled(true); - mAutoGenerateTangentsCheckbox->setDisabled(true); - mDualQuaternionSkinningCheckbox->setDisabled(true); + m_loadStandardMaterialLayersCheckbox->setDisabled(true); + m_loadSkinningInfoCheckbox->setDisabled(true); + m_loadGeometryLoDsCheckbox->setDisabled(true); + m_loadTangentsCheckbox->setDisabled(true); + m_autoGenerateTangentsCheckbox->setDisabled(true); + m_dualQuaternionSkinningCheckbox->setDisabled(true); } else { // disable dual quaternion skinning control if the load dual skinning info is not enabled if (loadSkinningInfoValue == false) { - mDualQuaternionSkinningCheckbox->setDisabled(true); + m_dualQuaternionSkinningCheckbox->setDisabled(true); } } // create the left part settings layout QVBoxLayout* leftPartSettingsLayout = new QVBoxLayout(); - leftPartSettingsLayout->addWidget(mLoadMeshesCheckbox); - leftPartSettingsLayout->addWidget(mLoadCollisionMeshesCheckbox); - leftPartSettingsLayout->addWidget(mLoadStandardMaterialLayersCheckbox); - leftPartSettingsLayout->addWidget(mLoadSkinningInfoCheckbox); - leftPartSettingsLayout->addWidget(mLoadLimitsCheckbox); + leftPartSettingsLayout->addWidget(m_loadMeshesCheckbox); + leftPartSettingsLayout->addWidget(m_loadCollisionMeshesCheckbox); + leftPartSettingsLayout->addWidget(m_loadStandardMaterialLayersCheckbox); + leftPartSettingsLayout->addWidget(m_loadSkinningInfoCheckbox); + leftPartSettingsLayout->addWidget(m_loadLimitsCheckbox); // create the right part settings layout QVBoxLayout* rightPartSettingsLayout = new QVBoxLayout(); - rightPartSettingsLayout->addWidget(mLoadGeometryLODsCheckbox); - rightPartSettingsLayout->addWidget(mLoadSkeletalLODsCheckbox); - rightPartSettingsLayout->addWidget(mLoadTangentsCheckbox); - rightPartSettingsLayout->addWidget(mAutoGenerateTangentsCheckbox); - rightPartSettingsLayout->addWidget(mLoadMorphTargetsCheckbox); - rightPartSettingsLayout->addWidget(mDualQuaternionSkinningCheckbox); + rightPartSettingsLayout->addWidget(m_loadGeometryLoDsCheckbox); + rightPartSettingsLayout->addWidget(m_loadSkeletalLoDsCheckbox); + rightPartSettingsLayout->addWidget(m_loadTangentsCheckbox); + rightPartSettingsLayout->addWidget(m_autoGenerateTangentsCheckbox); + rightPartSettingsLayout->addWidget(m_loadMorphTargetsCheckbox); + rightPartSettingsLayout->addWidget(m_dualQuaternionSkinningCheckbox); // create the settings layout QHBoxLayout* settingsLayout = new QHBoxLayout(); @@ -189,17 +189,17 @@ namespace EMStudio LoadActorSettingsWindow::LoadActorSettings LoadActorSettingsWindow::GetLoadActorSettings() const { LoadActorSettings loadActorSettings; - loadActorSettings.mLoadMeshes = mLoadMeshesCheckbox->isChecked(); - loadActorSettings.mLoadCollisionMeshes = mLoadCollisionMeshesCheckbox->isChecked(); - loadActorSettings.mLoadStandardMaterialLayers = mLoadStandardMaterialLayersCheckbox->isChecked(); - loadActorSettings.mLoadSkinningInfo = mLoadSkinningInfoCheckbox->isChecked(); - loadActorSettings.mLoadLimits = mLoadLimitsCheckbox->isChecked(); - loadActorSettings.mLoadGeometryLODs = mLoadGeometryLODsCheckbox->isChecked(); - loadActorSettings.mLoadSkeletalLODs = mLoadSkeletalLODsCheckbox->isChecked(); - loadActorSettings.mLoadTangents = mLoadTangentsCheckbox->isChecked(); - loadActorSettings.mAutoGenerateTangents = mAutoGenerateTangentsCheckbox->isChecked(); - loadActorSettings.mLoadMorphTargets = mLoadMorphTargetsCheckbox->isChecked(); - loadActorSettings.mDualQuaternionSkinning = mDualQuaternionSkinningCheckbox->isChecked(); + loadActorSettings.m_loadMeshes = m_loadMeshesCheckbox->isChecked(); + loadActorSettings.m_loadCollisionMeshes = m_loadCollisionMeshesCheckbox->isChecked(); + loadActorSettings.m_loadStandardMaterialLayers = m_loadStandardMaterialLayersCheckbox->isChecked(); + loadActorSettings.m_loadSkinningInfo = m_loadSkinningInfoCheckbox->isChecked(); + loadActorSettings.m_loadLimits = m_loadLimitsCheckbox->isChecked(); + loadActorSettings.m_loadGeometryLoDs = m_loadGeometryLoDsCheckbox->isChecked(); + loadActorSettings.m_loadSkeletalLoDs = m_loadSkeletalLoDsCheckbox->isChecked(); + loadActorSettings.m_loadTangents = m_loadTangentsCheckbox->isChecked(); + loadActorSettings.m_autoGenerateTangents = m_autoGenerateTangentsCheckbox->isChecked(); + loadActorSettings.m_loadMorphTargets = m_loadMorphTargetsCheckbox->isChecked(); + loadActorSettings.m_dualQuaternionSkinning = m_dualQuaternionSkinningCheckbox->isChecked(); return loadActorSettings; } @@ -210,45 +210,45 @@ namespace EMStudio QSettings loadActorSettings(GetConfigFilename(), QSettings::IniFormat, this); // set all values - loadActorSettings.setValue("LoadMeshes", mLoadMeshesCheckbox->isChecked()); - loadActorSettings.setValue("LoadCollisionMeshes", mLoadCollisionMeshesCheckbox->isChecked()); - loadActorSettings.setValue("LoadStandardMaterialLayers", mLoadStandardMaterialLayersCheckbox->isChecked()); - loadActorSettings.setValue("LoadSkinningInfo", mLoadSkinningInfoCheckbox->isChecked()); - loadActorSettings.setValue("LoadLimits", mLoadLimitsCheckbox->isChecked()); - loadActorSettings.setValue("LoadGeometryLODs", mLoadGeometryLODsCheckbox->isChecked()); - loadActorSettings.setValue("LoadSkeletalLODs", mLoadSkeletalLODsCheckbox->isChecked()); - loadActorSettings.setValue("LoadTangents", mLoadTangentsCheckbox->isChecked()); - loadActorSettings.setValue("AutoGenerateTangents", mAutoGenerateTangentsCheckbox->isChecked()); - loadActorSettings.setValue("LoadMorphTargets", mLoadMorphTargetsCheckbox->isChecked()); - loadActorSettings.setValue("DualQuaternionSkinning", mDualQuaternionSkinningCheckbox->isChecked()); + loadActorSettings.setValue("LoadMeshes", m_loadMeshesCheckbox->isChecked()); + loadActorSettings.setValue("LoadCollisionMeshes", m_loadCollisionMeshesCheckbox->isChecked()); + loadActorSettings.setValue("LoadStandardMaterialLayers", m_loadStandardMaterialLayersCheckbox->isChecked()); + loadActorSettings.setValue("LoadSkinningInfo", m_loadSkinningInfoCheckbox->isChecked()); + loadActorSettings.setValue("LoadLimits", m_loadLimitsCheckbox->isChecked()); + loadActorSettings.setValue("LoadGeometryLODs", m_loadGeometryLoDsCheckbox->isChecked()); + loadActorSettings.setValue("LoadSkeletalLODs", m_loadSkeletalLoDsCheckbox->isChecked()); + loadActorSettings.setValue("LoadTangents", m_loadTangentsCheckbox->isChecked()); + loadActorSettings.setValue("AutoGenerateTangents", m_autoGenerateTangentsCheckbox->isChecked()); + loadActorSettings.setValue("LoadMorphTargets", m_loadMorphTargetsCheckbox->isChecked()); + loadActorSettings.setValue("DualQuaternionSkinning", m_dualQuaternionSkinningCheckbox->isChecked()); } void LoadActorSettingsWindow::LoadMeshesClicked(bool checked) { // enable or disable controls - mLoadStandardMaterialLayersCheckbox->setEnabled(checked); - mLoadSkinningInfoCheckbox->setEnabled(checked); - mLoadGeometryLODsCheckbox->setEnabled(checked); - mLoadTangentsCheckbox->setEnabled(checked); - mAutoGenerateTangentsCheckbox->setEnabled(checked); + m_loadStandardMaterialLayersCheckbox->setEnabled(checked); + m_loadSkinningInfoCheckbox->setEnabled(checked); + m_loadGeometryLoDsCheckbox->setEnabled(checked); + m_loadTangentsCheckbox->setEnabled(checked); + m_autoGenerateTangentsCheckbox->setEnabled(checked); // the dual quaternion skinning control is enabled based on the laod skinning info control // when the the load meshes is not enabled, the control is disabled if (checked) { - mDualQuaternionSkinningCheckbox->setEnabled(mLoadSkinningInfoCheckbox->isChecked()); + m_dualQuaternionSkinningCheckbox->setEnabled(m_loadSkinningInfoCheckbox->isChecked()); } else { - mDualQuaternionSkinningCheckbox->setDisabled(true); + m_dualQuaternionSkinningCheckbox->setDisabled(true); } } void LoadActorSettingsWindow::LoadSkinningInfoClicked(bool checked) { - mDualQuaternionSkinningCheckbox->setEnabled(checked); + m_dualQuaternionSkinningCheckbox->setEnabled(checked); } @@ -261,17 +261,17 @@ namespace EMStudio LoadActorSettingsWindow::LoadActorSettings::LoadActorSettings() : - mLoadMeshes(true), - mLoadCollisionMeshes(true), - mLoadStandardMaterialLayers(true), - mLoadSkinningInfo(true), - mLoadLimits(true), - mLoadGeometryLODs(true), - mLoadSkeletalLODs(true), - mLoadTangents(true), - mAutoGenerateTangents(true), - mLoadMorphTargets(true), - mDualQuaternionSkinning(false) + m_loadMeshes(true), + m_loadCollisionMeshes(true), + m_loadStandardMaterialLayers(true), + m_loadSkinningInfo(true), + m_loadLimits(true), + m_loadGeometryLoDs(true), + m_loadSkeletalLoDs(true), + m_loadTangents(true), + m_autoGenerateTangents(true), + m_loadMorphTargets(true), + m_dualQuaternionSkinning(false) { } diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/LoadActorSettingsWindow.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/LoadActorSettingsWindow.h index eb98036750..265469952b 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/LoadActorSettingsWindow.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/LoadActorSettingsWindow.h @@ -26,17 +26,17 @@ namespace EMStudio public: struct LoadActorSettings { - bool mLoadMeshes; - bool mLoadCollisionMeshes; - bool mLoadStandardMaterialLayers; - bool mLoadSkinningInfo; - bool mLoadLimits; - bool mLoadGeometryLODs; - bool mLoadSkeletalLODs; - bool mLoadTangents; - bool mAutoGenerateTangents; - bool mLoadMorphTargets; - bool mDualQuaternionSkinning; + bool m_loadMeshes; + bool m_loadCollisionMeshes; + bool m_loadStandardMaterialLayers; + bool m_loadSkinningInfo; + bool m_loadLimits; + bool m_loadGeometryLoDs; + bool m_loadSkeletalLoDs; + bool m_loadTangents; + bool m_autoGenerateTangents; + bool m_loadMorphTargets; + bool m_dualQuaternionSkinning; LoadActorSettings(); }; @@ -54,16 +54,16 @@ namespace EMStudio private: QString GetConfigFilename() const; - QCheckBox* mLoadMeshesCheckbox; - QCheckBox* mLoadCollisionMeshesCheckbox; - QCheckBox* mLoadStandardMaterialLayersCheckbox; - QCheckBox* mLoadSkinningInfoCheckbox; - QCheckBox* mLoadLimitsCheckbox; - QCheckBox* mLoadGeometryLODsCheckbox; - QCheckBox* mLoadSkeletalLODsCheckbox; - QCheckBox* mLoadTangentsCheckbox; - QCheckBox* mAutoGenerateTangentsCheckbox; - QCheckBox* mLoadMorphTargetsCheckbox; - QCheckBox* mDualQuaternionSkinningCheckbox; + QCheckBox* m_loadMeshesCheckbox; + QCheckBox* m_loadCollisionMeshesCheckbox; + QCheckBox* m_loadStandardMaterialLayersCheckbox; + QCheckBox* m_loadSkinningInfoCheckbox; + QCheckBox* m_loadLimitsCheckbox; + QCheckBox* m_loadGeometryLoDsCheckbox; + QCheckBox* m_loadSkeletalLoDsCheckbox; + QCheckBox* m_loadTangentsCheckbox; + QCheckBox* m_autoGenerateTangentsCheckbox; + QCheckBox* m_loadMorphTargetsCheckbox; + QCheckBox* m_dualQuaternionSkinningCheckbox; }; } // namespace EMStudio diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/MainWindow.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/MainWindow.cpp index c5781ebf12..8ca4e1de81 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/MainWindow.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/MainWindow.cpp @@ -99,7 +99,7 @@ namespace EMStudio // add the link to the actual object ObjectPointer objPointer; - objPointer.mWorkspace = workspace; + objPointer.m_workspace = workspace; outObjects->push_back(objPointer); } } @@ -113,12 +113,12 @@ namespace EMStudio { // get the current object pointer and skip directly if the type check fails ObjectPointer objPointer = objects[i]; - if (objPointer.mWorkspace == nullptr) + if (objPointer.m_workspace == nullptr) { continue; } - Workspace* workspace = objPointer.mWorkspace; + Workspace* workspace = objPointer.m_workspace; // has the workspace been saved already or is it a new one? if (workspace->GetFilenameString().empty()) @@ -183,9 +183,9 @@ namespace EMStudio QHBoxLayout* mainLayout = new QHBoxLayout(); mainLayout->setMargin(0); - mTextEdit = new QTextEdit(); - mTextEdit->setTextInteractionFlags(Qt::NoTextInteraction | Qt::TextSelectableByMouse); - mainLayout->addWidget(mTextEdit); + m_textEdit = new QTextEdit(); + m_textEdit->setTextInteractionFlags(Qt::NoTextInteraction | Qt::TextSelectableByMouse); + mainLayout->addWidget(m_textEdit); setMinimumWidth(600); setMinimumHeight(400); @@ -222,7 +222,7 @@ namespace EMStudio text += "

"; } - mTextEdit->setText(text.c_str()); + m_textEdit->setText(text.c_str()); } MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags flags) @@ -232,45 +232,45 @@ namespace EMStudio , m_undoMenuCallback(nullptr) , m_fancyDockingManager(new AzQtComponents::FancyDocking(this, "emotionstudiosdk")) { - mLoadingOptions = false; - mAutosaveTimer = nullptr; - mPreferencesWindow = nullptr; - mApplicationMode = nullptr; - mDirtyFileManager = nullptr; - mFileManager = nullptr; - mShortcutManager = nullptr; - mNativeEventFilter = nullptr; - mImportActorCallback = nullptr; - mRemoveActorCallback = nullptr; - mRemoveActorInstanceCallback = nullptr; - mImportMotionCallback = nullptr; - mRemoveMotionCallback = nullptr; - mCreateMotionSetCallback = nullptr; - mRemoveMotionSetCallback = nullptr; - mLoadMotionSetCallback = nullptr; - mCreateAnimGraphCallback = nullptr; - mRemoveAnimGraphCallback = nullptr; - mLoadAnimGraphCallback = nullptr; - mSelectCallback = nullptr; - mUnselectCallback = nullptr; + m_loadingOptions = false; + m_autosaveTimer = nullptr; + m_preferencesWindow = nullptr; + m_applicationMode = nullptr; + m_dirtyFileManager = nullptr; + m_fileManager = nullptr; + m_shortcutManager = nullptr; + m_nativeEventFilter = nullptr; + m_importActorCallback = nullptr; + m_removeActorCallback = nullptr; + m_removeActorInstanceCallback = nullptr; + m_importMotionCallback = nullptr; + m_removeMotionCallback = nullptr; + m_createMotionSetCallback = nullptr; + m_removeMotionSetCallback = nullptr; + m_loadMotionSetCallback = nullptr; + m_createAnimGraphCallback = nullptr; + m_removeAnimGraphCallback = nullptr; + m_loadAnimGraphCallback = nullptr; + m_selectCallback = nullptr; + m_unselectCallback = nullptr; m_clearSelectionCallback = nullptr; - mSaveWorkspaceCallback = nullptr; + m_saveWorkspaceCallback = nullptr; } // destructor MainWindow::~MainWindow() { - if (mNativeEventFilter) + if (m_nativeEventFilter) { - QAbstractEventDispatcher::instance()->removeNativeEventFilter(mNativeEventFilter); - delete mNativeEventFilter; - mNativeEventFilter = nullptr; + QAbstractEventDispatcher::instance()->removeNativeEventFilter(m_nativeEventFilter); + delete m_nativeEventFilter; + m_nativeEventFilter = nullptr; } - if (mAutosaveTimer) + if (m_autosaveTimer) { - mAutosaveTimer->stop(); + m_autosaveTimer->stop(); } PluginOptionsNotificationsBus::Router::BusRouterDisconnect(); @@ -280,42 +280,42 @@ namespace EMStudio // results in an empty scene Reset(); - delete mShortcutManager; - delete mFileManager; - delete mDirtyFileManager; + delete m_shortcutManager; + delete m_fileManager; + delete m_dirtyFileManager; // unregister the command callbacks and get rid of the memory - GetCommandManager()->RemoveCommandCallback(mImportActorCallback, false); - GetCommandManager()->RemoveCommandCallback(mRemoveActorCallback, false); - GetCommandManager()->RemoveCommandCallback(mRemoveActorInstanceCallback, false); - GetCommandManager()->RemoveCommandCallback(mImportMotionCallback, false); - GetCommandManager()->RemoveCommandCallback(mRemoveMotionCallback, false); - GetCommandManager()->RemoveCommandCallback(mCreateMotionSetCallback, false); - GetCommandManager()->RemoveCommandCallback(mRemoveMotionSetCallback, false); - GetCommandManager()->RemoveCommandCallback(mLoadMotionSetCallback, false); - GetCommandManager()->RemoveCommandCallback(mCreateAnimGraphCallback, false); - GetCommandManager()->RemoveCommandCallback(mRemoveAnimGraphCallback, false); - GetCommandManager()->RemoveCommandCallback(mLoadAnimGraphCallback, false); - GetCommandManager()->RemoveCommandCallback(mSelectCallback, false); - GetCommandManager()->RemoveCommandCallback(mUnselectCallback, false); + GetCommandManager()->RemoveCommandCallback(m_importActorCallback, false); + GetCommandManager()->RemoveCommandCallback(m_removeActorCallback, false); + GetCommandManager()->RemoveCommandCallback(m_removeActorInstanceCallback, false); + GetCommandManager()->RemoveCommandCallback(m_importMotionCallback, false); + GetCommandManager()->RemoveCommandCallback(m_removeMotionCallback, false); + GetCommandManager()->RemoveCommandCallback(m_createMotionSetCallback, false); + GetCommandManager()->RemoveCommandCallback(m_removeMotionSetCallback, false); + GetCommandManager()->RemoveCommandCallback(m_loadMotionSetCallback, false); + GetCommandManager()->RemoveCommandCallback(m_createAnimGraphCallback, false); + GetCommandManager()->RemoveCommandCallback(m_removeAnimGraphCallback, false); + GetCommandManager()->RemoveCommandCallback(m_loadAnimGraphCallback, false); + GetCommandManager()->RemoveCommandCallback(m_selectCallback, false); + GetCommandManager()->RemoveCommandCallback(m_unselectCallback, false); GetCommandManager()->RemoveCommandCallback(m_clearSelectionCallback, false); - GetCommandManager()->RemoveCommandCallback(mSaveWorkspaceCallback, false); + GetCommandManager()->RemoveCommandCallback(m_saveWorkspaceCallback, false); GetCommandManager()->RemoveCallback(&m_mainWindowCommandManagerCallback, false); - delete mImportActorCallback; - delete mRemoveActorCallback; - delete mRemoveActorInstanceCallback; - delete mImportMotionCallback; - delete mRemoveMotionCallback; - delete mCreateMotionSetCallback; - delete mRemoveMotionSetCallback; - delete mLoadMotionSetCallback; - delete mCreateAnimGraphCallback; - delete mRemoveAnimGraphCallback; - delete mLoadAnimGraphCallback; - delete mSelectCallback; - delete mUnselectCallback; + delete m_importActorCallback; + delete m_removeActorCallback; + delete m_removeActorInstanceCallback; + delete m_importMotionCallback; + delete m_removeMotionCallback; + delete m_createMotionSetCallback; + delete m_removeMotionSetCallback; + delete m_loadMotionSetCallback; + delete m_createAnimGraphCallback; + delete m_removeAnimGraphCallback; + delete m_loadAnimGraphCallback; + delete m_selectCallback; + delete m_unselectCallback; delete m_clearSelectionCallback; - delete mSaveWorkspaceCallback; + delete m_saveWorkspaceCallback; EMotionFX::ActorEditorRequestBus::Handler::BusDisconnect(); @@ -363,8 +363,8 @@ namespace EMStudio QMenuBar* menuBar = new QMenuBar(menuWidget); menuLayout->addWidget(menuBar); - mApplicationMode = new QComboBox(); - menuLayout->addWidget(mApplicationMode); + m_applicationMode = new QComboBox(); + menuLayout->addWidget(m_applicationMode); setMenuWidget(menuWidget); @@ -373,26 +373,26 @@ namespace EMStudio menu->setObjectName("EMFX.MainWindow.FileMenu"); // reset action - mResetAction = menu->addAction(tr("&Reset"), this, &MainWindow::OnReset, QKeySequence::New); - mResetAction->setObjectName("EMFX.MainWindow.ResetAction"); + m_resetAction = menu->addAction(tr("&Reset"), this, &MainWindow::OnReset, QKeySequence::New); + m_resetAction->setObjectName("EMFX.MainWindow.ResetAction"); // save all - mSaveAllAction = menu->addAction(tr("Save All..."), this, &MainWindow::OnSaveAll, QKeySequence::Save); - mSaveAllAction->setObjectName("EMFX.MainWindow.SaveAllAction"); + m_saveAllAction = menu->addAction(tr("Save All..."), this, &MainWindow::OnSaveAll, QKeySequence::Save); + m_saveAllAction->setObjectName("EMFX.MainWindow.SaveAllAction"); // disable the reset and save all menus until one thing is loaded - mResetAction->setDisabled(true); - mSaveAllAction->setDisabled(true); + m_resetAction->setDisabled(true); + m_saveAllAction->setDisabled(true); menu->addSeparator(); // actor file actions QAction* openAction = menu->addAction(tr("&Open Actor"), this, &MainWindow::OnFileOpenActor, QKeySequence::Open); openAction->setObjectName("EMFX.MainWindow.OpenActorAction"); - mMergeActorAction = menu->addAction(tr("&Merge Actor"), this, &MainWindow::OnFileMergeActor, Qt::CTRL + Qt::Key_I); - mMergeActorAction->setObjectName("EMFX.MainWindow.MergeActorAction"); - mSaveSelectedActorsAction = menu->addAction(tr("&Save Selected Actors"), this, &MainWindow::OnFileSaveSelectedActors); - mSaveSelectedActorsAction->setObjectName("EMFX.MainWindow.SaveActorAction"); + m_mergeActorAction = menu->addAction(tr("&Merge Actor"), this, &MainWindow::OnFileMergeActor, Qt::CTRL + Qt::Key_I); + m_mergeActorAction->setObjectName("EMFX.MainWindow.MergeActorAction"); + m_saveSelectedActorsAction = menu->addAction(tr("&Save Selected Actors"), this, &MainWindow::OnFileSaveSelectedActors); + m_saveSelectedActorsAction->setObjectName("EMFX.MainWindow.SaveActorAction"); // disable the merge actor menu until one actor is in the scene DisableMergeActorMenu(); @@ -401,8 +401,8 @@ namespace EMStudio DisableSaveSelectedActorsMenu(); // recent actors submenu - mRecentActors.Init(menu, mOptions.GetMaxRecentFiles(), "Recent Actors", "recentActorFiles"); - connect(&mRecentActors, &MysticQt::RecentFiles::OnRecentFile, this, &MainWindow::OnRecentFile); + m_recentActors.Init(menu, m_options.GetMaxRecentFiles(), "Recent Actors", "recentActorFiles"); + connect(&m_recentActors, &MysticQt::RecentFiles::OnRecentFile, this, &MainWindow::OnRecentFile); // workspace file actions menu->addSeparator(); @@ -416,8 +416,8 @@ namespace EMStudio saveWorkspaceAsAction->setObjectName("EMFX.MainWindow.SaveWorkspaceAsAction"); // recent workspace submenu - mRecentWorkspaces.Init(menu, mOptions.GetMaxRecentFiles(), "Recent Workspaces", "recentWorkspaces"); - connect(&mRecentWorkspaces, &MysticQt::RecentFiles::OnRecentFile, this, &MainWindow::OnRecentFile); + m_recentWorkspaces.Init(menu, m_options.GetMaxRecentFiles(), "Recent Workspaces", "recentWorkspaces"); + connect(&m_recentWorkspaces, &MysticQt::RecentFiles::OnRecentFile, this, &MainWindow::OnRecentFile); // edit menu menu = menuBar->addMenu(tr("&Edit")); @@ -443,19 +443,19 @@ namespace EMStudio preferencesAction->setObjectName("EMFX.MainWindow.PrefsAction"); // layouts item - mLayoutsMenu = menuBar->addMenu(tr("&Layouts")); - mLayoutsMenu->setObjectName("LayoutsMenu"); + m_layoutsMenu = menuBar->addMenu(tr("&Layouts")); + m_layoutsMenu->setObjectName("LayoutsMenu"); UpdateLayoutsMenu(); // reset the application mode selection and connect it - mApplicationMode->setCurrentIndex(-1); - connect(mApplicationMode, qOverload(&QComboBox::currentIndexChanged), this, qOverload(&MainWindow::ApplicationModeChanged)); - mLayoutLoaded = false; + m_applicationMode->setCurrentIndex(-1); + connect(m_applicationMode, qOverload(&QComboBox::currentIndexChanged), this, qOverload(&MainWindow::ApplicationModeChanged)); + m_layoutLoaded = false; // view item menu = menuBar->addMenu(tr("&View")); - mCreateWindowMenu = menu; - mCreateWindowMenu->setObjectName("ViewMenu"); + m_createWindowMenu = menu; + m_createWindowMenu->setObjectName("ViewMenu"); // help menu menu = menuBar->addMenu(tr("&Help")); @@ -483,27 +483,27 @@ namespace EMStudio SetWindowTitleFromFileName(""); // create the autosave timer - mAutosaveTimer = new QTimer(this); - connect(mAutosaveTimer, &QTimer::timeout, this, &MainWindow::OnAutosaveTimeOut); + m_autosaveTimer = new QTimer(this); + connect(m_autosaveTimer, &QTimer::timeout, this, &MainWindow::OnAutosaveTimeOut); // load preferences PluginOptionsNotificationsBus::Router::BusRouterConnect(); LoadPreferences(); - mAutosaveTimer->setInterval(mOptions.GetAutoSaveInterval() * 60 * 1000); + m_autosaveTimer->setInterval(m_options.GetAutoSaveInterval() * 60 * 1000); // Create the dirty file manager and register the workspace callback. - mDirtyFileManager = new DirtyFileManager; - mDirtyFileManager->AddCallback(new SaveDirtyWorkspaceCallback); + m_dirtyFileManager = new DirtyFileManager; + m_dirtyFileManager->AddCallback(new SaveDirtyWorkspaceCallback); // init the file manager - mFileManager = new EMStudio::FileManager(this); + m_fileManager = new EMStudio::FileManager(this); //////////////////////////////////////////////////////////////////////// // Keyboard Shortcut Manager //////////////////////////////////////////////////////////////////////// // create the shortcut manager - mShortcutManager = new MysticQt::KeyboardShortcutManager(); + m_shortcutManager = new MysticQt::KeyboardShortcutManager(); // load the old shortcuts LoadKeyboardShortcuts(); @@ -514,24 +514,24 @@ namespace EMStudio "AnimGraph", this); animGraphLayoutAction->setShortcut(Qt::Key_1 | Qt::AltModifier); - mShortcutManager->RegisterKeyboardShortcut(animGraphLayoutAction, layoutGroupName, false); - connect(animGraphLayoutAction, &QAction::triggered, [this]{ mApplicationMode->setCurrentIndex(0); }); + m_shortcutManager->RegisterKeyboardShortcut(animGraphLayoutAction, layoutGroupName, false); + connect(animGraphLayoutAction, &QAction::triggered, [this]{ m_applicationMode->setCurrentIndex(0); }); addAction(animGraphLayoutAction); QAction* animationLayoutAction = new QAction( "Animation", this); animationLayoutAction->setShortcut(Qt::Key_2 | Qt::AltModifier); - mShortcutManager->RegisterKeyboardShortcut(animationLayoutAction, layoutGroupName, false); - connect(animationLayoutAction, &QAction::triggered, [this]{ mApplicationMode->setCurrentIndex(1); }); + m_shortcutManager->RegisterKeyboardShortcut(animationLayoutAction, layoutGroupName, false); + connect(animationLayoutAction, &QAction::triggered, [this]{ m_applicationMode->setCurrentIndex(1); }); addAction(animationLayoutAction); QAction* characterLayoutAction = new QAction( "Character", this); characterLayoutAction->setShortcut(Qt::Key_1 | Qt::AltModifier); - mShortcutManager->RegisterKeyboardShortcut(characterLayoutAction, layoutGroupName, false); - connect(characterLayoutAction, &QAction::triggered, [this]{ mApplicationMode->setCurrentIndex(2); }); + m_shortcutManager->RegisterKeyboardShortcut(characterLayoutAction, layoutGroupName, false); + connect(characterLayoutAction, &QAction::triggered, [this]{ m_applicationMode->setCurrentIndex(2); }); addAction(characterLayoutAction); EMotionFX::ActorEditorRequestBus::Handler::BusConnect(); @@ -541,42 +541,42 @@ namespace EMStudio EMotionFX::ActorEditorRequestBus::Handler::BusConnect(); // create and register the command callbacks - mImportActorCallback = new CommandImportActorCallback(false); - mRemoveActorCallback = new CommandRemoveActorCallback(false); - mRemoveActorInstanceCallback = new CommandRemoveActorInstanceCallback(false); - mImportMotionCallback = new CommandImportMotionCallback(false); - mRemoveMotionCallback = new CommandRemoveMotionCallback(false); - mCreateMotionSetCallback = new CommandCreateMotionSetCallback(false); - mRemoveMotionSetCallback = new CommandRemoveMotionSetCallback(false); - mLoadMotionSetCallback = new CommandLoadMotionSetCallback(false); - mCreateAnimGraphCallback = new CommandCreateAnimGraphCallback(false); - mRemoveAnimGraphCallback = new CommandRemoveAnimGraphCallback(false); - mLoadAnimGraphCallback = new CommandLoadAnimGraphCallback(false); - mSelectCallback = new CommandSelectCallback(false); - mUnselectCallback = new CommandUnselectCallback(false); + m_importActorCallback = new CommandImportActorCallback(false); + m_removeActorCallback = new CommandRemoveActorCallback(false); + m_removeActorInstanceCallback = new CommandRemoveActorInstanceCallback(false); + m_importMotionCallback = new CommandImportMotionCallback(false); + m_removeMotionCallback = new CommandRemoveMotionCallback(false); + m_createMotionSetCallback = new CommandCreateMotionSetCallback(false); + m_removeMotionSetCallback = new CommandRemoveMotionSetCallback(false); + m_loadMotionSetCallback = new CommandLoadMotionSetCallback(false); + m_createAnimGraphCallback = new CommandCreateAnimGraphCallback(false); + m_removeAnimGraphCallback = new CommandRemoveAnimGraphCallback(false); + m_loadAnimGraphCallback = new CommandLoadAnimGraphCallback(false); + m_selectCallback = new CommandSelectCallback(false); + m_unselectCallback = new CommandUnselectCallback(false); m_clearSelectionCallback = new CommandClearSelectionCallback(false); - mSaveWorkspaceCallback = new CommandSaveWorkspaceCallback(false); - GetCommandManager()->RegisterCommandCallback("ImportActor", mImportActorCallback); - GetCommandManager()->RegisterCommandCallback("RemoveActor", mRemoveActorCallback); - GetCommandManager()->RegisterCommandCallback("RemoveActorInstance", mRemoveActorInstanceCallback); - GetCommandManager()->RegisterCommandCallback("ImportMotion", mImportMotionCallback); - GetCommandManager()->RegisterCommandCallback("RemoveMotion", mRemoveMotionCallback); - GetCommandManager()->RegisterCommandCallback("CreateMotionSet", mCreateMotionSetCallback); - GetCommandManager()->RegisterCommandCallback("RemoveMotionSet", mRemoveMotionSetCallback); - GetCommandManager()->RegisterCommandCallback("LoadMotionSet", mLoadMotionSetCallback); - GetCommandManager()->RegisterCommandCallback("CreateAnimGraph", mCreateAnimGraphCallback); - GetCommandManager()->RegisterCommandCallback("RemoveAnimGraph", mRemoveAnimGraphCallback); - GetCommandManager()->RegisterCommandCallback("LoadAnimGraph", mLoadAnimGraphCallback); - GetCommandManager()->RegisterCommandCallback("Select", mSelectCallback); - GetCommandManager()->RegisterCommandCallback("Unselect", mUnselectCallback); + m_saveWorkspaceCallback = new CommandSaveWorkspaceCallback(false); + GetCommandManager()->RegisterCommandCallback("ImportActor", m_importActorCallback); + GetCommandManager()->RegisterCommandCallback("RemoveActor", m_removeActorCallback); + GetCommandManager()->RegisterCommandCallback("RemoveActorInstance", m_removeActorInstanceCallback); + GetCommandManager()->RegisterCommandCallback("ImportMotion", m_importMotionCallback); + GetCommandManager()->RegisterCommandCallback("RemoveMotion", m_removeMotionCallback); + GetCommandManager()->RegisterCommandCallback("CreateMotionSet", m_createMotionSetCallback); + GetCommandManager()->RegisterCommandCallback("RemoveMotionSet", m_removeMotionSetCallback); + GetCommandManager()->RegisterCommandCallback("LoadMotionSet", m_loadMotionSetCallback); + GetCommandManager()->RegisterCommandCallback("CreateAnimGraph", m_createAnimGraphCallback); + GetCommandManager()->RegisterCommandCallback("RemoveAnimGraph", m_removeAnimGraphCallback); + GetCommandManager()->RegisterCommandCallback("LoadAnimGraph", m_loadAnimGraphCallback); + GetCommandManager()->RegisterCommandCallback("Select", m_selectCallback); + GetCommandManager()->RegisterCommandCallback("Unselect", m_unselectCallback); GetCommandManager()->RegisterCommandCallback("ClearSelection", m_clearSelectionCallback); - GetCommandManager()->RegisterCommandCallback("SaveWorkspace", mSaveWorkspaceCallback); + GetCommandManager()->RegisterCommandCallback("SaveWorkspace", m_saveWorkspaceCallback); GetCommandManager()->RegisterCallback(&m_mainWindowCommandManagerCallback); - AZ_Assert(!mNativeEventFilter, "Double initialization?"); - mNativeEventFilter = new NativeEventFilter(this); - QAbstractEventDispatcher::instance()->installNativeEventFilter(mNativeEventFilter); + AZ_Assert(!m_nativeEventFilter, "Double initialization?"); + m_nativeEventFilter = new NativeEventFilter(this); + QAbstractEventDispatcher::instance()->installNativeEventFilter(m_nativeEventFilter); } MainWindow::MainWindowCommandManagerCallback::MainWindowCommandManagerCallback() @@ -965,7 +965,7 @@ namespace EMStudio void MainWindow::OnWorkspaceSaved(const char* filename) { - mRecentWorkspaces.AddRecentFile(filename); + m_recentWorkspaces.AddRecentFile(filename); SetWindowTitleFromFileName(filename); } @@ -975,50 +975,50 @@ namespace EMStudio // enable the menus if at least one actor if (EMotionFX::GetActorManager().GetNumActors() > 0) { - mResetAction->setEnabled(true); - mSaveAllAction->setEnabled(true); + m_resetAction->setEnabled(true); + m_saveAllAction->setEnabled(true); return; } // enable the menus if at least one motion if (EMotionFX::GetMotionManager().GetNumMotions() > 0) { - mResetAction->setEnabled(true); - mSaveAllAction->setEnabled(true); + m_resetAction->setEnabled(true); + m_saveAllAction->setEnabled(true); return; } // enable the menus if at least one motion set if (EMotionFX::GetMotionManager().GetNumMotionSets() > 0) { - mResetAction->setEnabled(true); - mSaveAllAction->setEnabled(true); + m_resetAction->setEnabled(true); + m_saveAllAction->setEnabled(true); return; } // enable the menus if at least one anim graph if (EMotionFX::GetAnimGraphManager().GetNumAnimGraphs() > 0) { - mResetAction->setEnabled(true); - mSaveAllAction->setEnabled(true); + m_resetAction->setEnabled(true); + m_saveAllAction->setEnabled(true); return; } // nothing loaded, disable the menus - mResetAction->setDisabled(true); - mSaveAllAction->setDisabled(true); + m_resetAction->setDisabled(true); + m_saveAllAction->setDisabled(true); } void MainWindow::EnableMergeActorMenu() { - mMergeActorAction->setEnabled(true); + m_mergeActorAction->setEnabled(true); } void MainWindow::DisableMergeActorMenu() { - mMergeActorAction->setDisabled(true); + m_mergeActorAction->setDisabled(true); } @@ -1052,13 +1052,13 @@ namespace EMStudio void MainWindow::EnableSaveSelectedActorsMenu() { - mSaveSelectedActorsAction->setEnabled(true); + m_saveSelectedActorsAction->setEnabled(true); } void MainWindow::DisableSaveSelectedActorsMenu() { - mSaveSelectedActorsAction->setDisabled(true); + m_saveSelectedActorsAction->setDisabled(true); } @@ -1100,7 +1100,7 @@ namespace EMStudio AZStd::sort(begin(sortedPlugins), end(sortedPlugins)); // clear the window menu - mCreateWindowMenu->clear(); + m_createWindowMenu->clear(); // for all registered plugins, create a menu items for (size_t p = 0; p < numPlugins; ++p) @@ -1120,14 +1120,14 @@ namespace EMStudio if (plugin->AllowMultipleInstances()) { // create the menu - mCreateWindowMenu->addMenu(plugin->GetName()); + m_createWindowMenu->addMenu(plugin->GetName()); // TODO: add each instance inside the submenu } else { // create the action - QAction* action = mCreateWindowMenu->addAction(plugin->GetName()); + QAction* action = m_createWindowMenu->addAction(plugin->GetName()); action->setData(plugin->GetName()); // connect the action to activate the plugin when clicked on it @@ -1144,7 +1144,7 @@ namespace EMStudio if (activePlugin) { // must use the active plugin, as it needs to be initialized to create window entries - activePlugin->AddWindowMenuEntries(mCreateWindowMenu); + activePlugin->AddWindowMenuEntries(m_createWindowMenu); } } } @@ -1210,16 +1210,16 @@ namespace EMStudio // show the preferences dialog void MainWindow::OnPreferences() { - if (mPreferencesWindow == nullptr) + if (m_preferencesWindow == nullptr) { - mPreferencesWindow = new PreferencesWindow(this); - mPreferencesWindow->Init(); + m_preferencesWindow = new PreferencesWindow(this); + m_preferencesWindow->Init(); - AzToolsFramework::ReflectedPropertyEditor* generalPropertyWidget = mPreferencesWindow->AddCategory("General"); + AzToolsFramework::ReflectedPropertyEditor* generalPropertyWidget = m_preferencesWindow->AddCategory("General"); generalPropertyWidget->ClearInstances(); generalPropertyWidget->InvalidateAll(); - generalPropertyWidget->AddInstance(&mOptions, azrtti_typeid(mOptions)); + generalPropertyWidget->AddInstance(&m_options, azrtti_typeid(m_options)); PluginManager* pluginManager = GetPluginManager(); const size_t numPlugins = pluginManager->GetNumActivePlugins(); @@ -1247,11 +1247,11 @@ namespace EMStudio generalPropertyWidget->InvalidateAll(); // Keyboard shortcuts - KeyboardShortcutsWindow* shortcutsWindow = new KeyboardShortcutsWindow(mPreferencesWindow); - mPreferencesWindow->AddCategory(shortcutsWindow, "Keyboard shortcuts"); + KeyboardShortcutsWindow* shortcutsWindow = new KeyboardShortcutsWindow(m_preferencesWindow); + m_preferencesWindow->AddCategory(shortcutsWindow, "Keyboard shortcuts"); } - mPreferencesWindow->exec(); + m_preferencesWindow->exec(); SavePreferences(); } @@ -1261,7 +1261,7 @@ namespace EMStudio { // open the config file QSettings settings(this); - mOptions.Save(settings, *this); + m_options.Save(settings, *this); } @@ -1270,24 +1270,24 @@ namespace EMStudio { // When a setting changes, OnOptionChanged will save. To avoid saving while settings are being // loaded, we use this flag - mLoadingOptions = true; + m_loadingOptions = true; // open the config file QSettings settings(this); - mOptions = GUIOptions::Load(settings, *this); + m_options = GUIOptions::Load(settings, *this); - mLoadingOptions = false; + m_loadingOptions = false; } void MainWindow::AddRecentActorFile(const QString& fileName) { - mRecentActors.AddRecentFile(fileName.toUtf8().data()); + m_recentActors.AddRecentFile(fileName.toUtf8().data()); } void MainWindow::LoadKeyboardShortcuts() { QSettings shortcutSettings(AZStd::string(GetManager()->GetAppDataFolder() + "EMStudioKeyboardShortcuts.cfg").c_str(), QSettings::IniFormat, this); - mShortcutManager->Load(&shortcutSettings); + m_shortcutManager->Load(&shortcutSettings); } void MainWindow::LoadActor(const char* fileName, bool replaceCurrentScene) @@ -1321,17 +1321,17 @@ namespace EMStudio // add the load actor settings LoadActorSettingsWindow::LoadActorSettings loadActorSettings; - loadActorCommand += "-loadMeshes " + AZStd::to_string(loadActorSettings.mLoadMeshes); - loadActorCommand += " -loadTangents " + AZStd::to_string(loadActorSettings.mLoadTangents); - loadActorCommand += " -autoGenTangents " + AZStd::to_string(loadActorSettings.mAutoGenerateTangents); - loadActorCommand += " -loadLimits " + AZStd::to_string(loadActorSettings.mLoadLimits); - loadActorCommand += " -loadGeomLods " + AZStd::to_string(loadActorSettings.mLoadGeometryLODs); - loadActorCommand += " -loadMorphTargets " + AZStd::to_string(loadActorSettings.mLoadMorphTargets); - loadActorCommand += " -loadCollisionMeshes " + AZStd::to_string(loadActorSettings.mLoadCollisionMeshes); - loadActorCommand += " -loadMaterialLayers " + AZStd::to_string(loadActorSettings.mLoadStandardMaterialLayers); - loadActorCommand += " -loadSkinningInfo " + AZStd::to_string(loadActorSettings.mLoadSkinningInfo); - loadActorCommand += " -loadSkeletalLODs " + AZStd::to_string(loadActorSettings.mLoadSkeletalLODs); - loadActorCommand += " -dualQuatSkinning " + AZStd::to_string(loadActorSettings.mDualQuaternionSkinning); + loadActorCommand += "-loadMeshes " + AZStd::to_string(loadActorSettings.m_loadMeshes); + loadActorCommand += " -loadTangents " + AZStd::to_string(loadActorSettings.m_loadTangents); + loadActorCommand += " -autoGenTangents " + AZStd::to_string(loadActorSettings.m_autoGenerateTangents); + loadActorCommand += " -loadLimits " + AZStd::to_string(loadActorSettings.m_loadLimits); + loadActorCommand += " -loadGeomLods " + AZStd::to_string(loadActorSettings.m_loadGeometryLoDs); + loadActorCommand += " -loadMorphTargets " + AZStd::to_string(loadActorSettings.m_loadMorphTargets); + loadActorCommand += " -loadCollisionMeshes " + AZStd::to_string(loadActorSettings.m_loadCollisionMeshes); + loadActorCommand += " -loadMaterialLayers " + AZStd::to_string(loadActorSettings.m_loadStandardMaterialLayers); + loadActorCommand += " -loadSkinningInfo " + AZStd::to_string(loadActorSettings.m_loadSkinningInfo); + loadActorCommand += " -loadSkeletalLODs " + AZStd::to_string(loadActorSettings.m_loadSkeletalLoDs); + loadActorCommand += " -dualQuatSkinning " + AZStd::to_string(loadActorSettings.m_dualQuaternionSkinning); // add the load and the create instance commands commandGroup.AddCommandString(loadActorCommand.c_str()); @@ -1346,14 +1346,14 @@ namespace EMStudio // add the actor in the recent actor list // if the same actor is already in the list, the duplicate is removed - mRecentActors.AddRecentFile(fileName); + m_recentActors.AddRecentFile(fileName); } void MainWindow::LoadCharacter(const AZ::Data::AssetId& actorAssetId, const AZ::Data::AssetId& animgraphId, const AZ::Data::AssetId& motionSetId) { - mCharacterFiles.clear(); + m_characterFiles.clear(); AZStd::string cachePath = gEnv->pFileIO->GetAlias("@assets@"); AZStd::string filename; AzFramework::StringFunc::AssetDatabasePath::Normalize(cachePath); @@ -1396,10 +1396,10 @@ namespace EMStudio AZStd::vector objects; AZStd::vector dirtyObjects; - const size_t numDirtyFilesCallbacks = mDirtyFileManager->GetNumCallbacks(); + const size_t numDirtyFilesCallbacks = m_dirtyFileManager->GetNumCallbacks(); for (size_t i = 0; i < numDirtyFilesCallbacks; ++i) { - SaveDirtyFilesCallback* callback = mDirtyFileManager->GetCallback(i); + SaveDirtyFilesCallback* callback = m_dirtyFileManager->GetCallback(i); callback->GetDirtyFileNames(&filenames, &objects); const size_t numFileNames = filenames.size(); for (size_t j = 0; j < numFileNames; ++j) @@ -1429,18 +1429,18 @@ namespace EMStudio // Dont reload dirty files that are already open. if (!foundActor) { - mCharacterFiles.push_back(actorFilename); + m_characterFiles.push_back(actorFilename); } if (!foundAnimgraph) { - mCharacterFiles.push_back(animgraphFilename); + m_characterFiles.push_back(animgraphFilename); } if (!foundMotionSet) { - mCharacterFiles.push_back(motionSetFilename); + m_characterFiles.push_back(motionSetFilename); } - if (isVisible() && mLayoutLoaded) + if (isVisible() && m_layoutLoaded) { LoadCharacterFiles(); } @@ -1449,7 +1449,7 @@ namespace EMStudio void MainWindow::OnFileNewWorkspace() { // save all files that have been changed - if (mDirtyFileManager->SaveDirtyFiles() == DirtyFileManager::CANCELED) + if (m_dirtyFileManager->SaveDirtyFiles() == DirtyFileManager::CANCELED) { return; } @@ -1491,7 +1491,7 @@ namespace EMStudio void MainWindow::OnFileOpenWorkspace() { - const AZStd::string filename = mFileManager->LoadWorkspaceFileDialog(this); + const AZStd::string filename = m_fileManager->LoadWorkspaceFileDialog(this); if (filename.empty()) { return; @@ -1503,14 +1503,14 @@ namespace EMStudio void MainWindow::OnSaveAll() { - mDirtyFileManager->SaveDirtyFiles(MCORE_INVALIDINDEX32, MCORE_INVALIDINDEX32, QDialogButtonBox::Ok | QDialogButtonBox::Cancel); + m_dirtyFileManager->SaveDirtyFiles(MCORE_INVALIDINDEX32, MCORE_INVALIDINDEX32, QDialogButtonBox::Ok | QDialogButtonBox::Cancel); } void MainWindow::OnFileSaveWorkspace() { // save all files that have been changed, filter to not show the workspace files - if (mDirtyFileManager->SaveDirtyFiles(MCORE_INVALIDINDEX32, SaveDirtyWorkspaceCallback::TYPE_ID) == DirtyFileManager::CANCELED) + if (m_dirtyFileManager->SaveDirtyFiles(MCORE_INVALIDINDEX32, SaveDirtyWorkspaceCallback::TYPE_ID) == DirtyFileManager::CANCELED) { return; } @@ -1552,7 +1552,7 @@ namespace EMStudio void MainWindow::OnFileSaveWorkspaceAs() { // save all files that have been changed, filter to not show the workspace files - if (mDirtyFileManager->SaveDirtyFiles(MCORE_INVALIDINDEX32, SaveDirtyWorkspaceCallback::TYPE_ID) == DirtyFileManager::CANCELED) + if (m_dirtyFileManager->SaveDirtyFiles(MCORE_INVALIDINDEX32, SaveDirtyWorkspaceCallback::TYPE_ID) == DirtyFileManager::CANCELED) { return; } @@ -1643,7 +1643,7 @@ namespace EMStudio void MainWindow::OnReset() { - if (mDirtyFileManager->SaveDirtyFiles() == DirtyFileManager::CANCELED) + if (m_dirtyFileManager->SaveDirtyFiles() == DirtyFileManager::CANCELED) { return; } @@ -1673,52 +1673,52 @@ namespace EMStudio if (optionChanged == GUIOptions::s_maxRecentFilesOptionName) { // Set the maximum number of recent files - mRecentActors.SetMaxRecentFiles(mOptions.GetMaxRecentFiles()); - mRecentWorkspaces.SetMaxRecentFiles(mOptions.GetMaxRecentFiles()); + m_recentActors.SetMaxRecentFiles(m_options.GetMaxRecentFiles()); + m_recentWorkspaces.SetMaxRecentFiles(m_options.GetMaxRecentFiles()); } else if (optionChanged == GUIOptions::s_maxHistoryItemsOptionName) { // Set the maximum number of history items in the command manager - GetCommandManager()->SetMaxHistoryItems(mOptions.GetMaxHistoryItems()); + GetCommandManager()->SetMaxHistoryItems(m_options.GetMaxHistoryItems()); } else if (optionChanged == GUIOptions::s_notificationVisibleTimeOptionName) { // Set the notification visible time - GetNotificationWindowManager()->SetVisibleTime(mOptions.GetNotificationInvisibleTime()); + GetNotificationWindowManager()->SetVisibleTime(m_options.GetNotificationInvisibleTime()); } else if (optionChanged == GUIOptions::s_enableAutosaveOptionName) { // Enable or disable the autosave timer - if (mOptions.GetEnableAutoSave()) + if (m_options.GetEnableAutoSave()) { - mAutosaveTimer->setInterval(mOptions.GetAutoSaveInterval() * 60 * 1000); - mAutosaveTimer->start(); + m_autosaveTimer->setInterval(m_options.GetAutoSaveInterval() * 60 * 1000); + m_autosaveTimer->start(); } else { - mAutosaveTimer->stop(); + m_autosaveTimer->stop(); } } else if (optionChanged == GUIOptions::s_autosaveIntervalOptionName) { // Set the autosave interval - mAutosaveTimer->stop(); - mAutosaveTimer->setInterval(mOptions.GetAutoSaveInterval() * 60 * 1000); - mAutosaveTimer->start(); + m_autosaveTimer->stop(); + m_autosaveTimer->setInterval(m_options.GetAutoSaveInterval() * 60 * 1000); + m_autosaveTimer->start(); } else if (optionChanged == GUIOptions::s_importerLogDetailsEnabledOptionName) { // Set if the detail logging of the importer is enabled or not - EMotionFX::GetImporter().SetLogDetails(mOptions.GetImporterLogDetailsEnabled()); + EMotionFX::GetImporter().SetLogDetails(m_options.GetImporterLogDetailsEnabled()); } else if (optionChanged == GUIOptions::s_autoLoadLastWorkspaceOptionName) { // Set if auto loading the last workspace is enabled or not - GetManager()->SetAutoLoadLastWorkspace(mOptions.GetAutoLoadLastWorkspace()); + GetManager()->SetAutoLoadLastWorkspace(m_options.GetAutoLoadLastWorkspace()); } // Save preferences - if (!mLoadingOptions) + if (!m_loadingOptions) { SavePreferences(); } @@ -1727,12 +1727,12 @@ namespace EMStudio // open an actor void MainWindow::OnFileOpenActor() { - if (mDirtyFileManager->SaveDirtyFiles({azrtti_typeid()}) == DirtyFileManager::CANCELED) + if (m_dirtyFileManager->SaveDirtyFiles({azrtti_typeid()}) == DirtyFileManager::CANCELED) { return; } - AZStd::vector filenames = mFileManager->LoadActorsFileDialog(this); + AZStd::vector filenames = m_fileManager->LoadActorsFileDialog(this); activateWindow(); if (filenames.empty()) { @@ -1750,7 +1750,7 @@ namespace EMStudio // merge an actor void MainWindow::OnFileMergeActor() { - AZStd::vector filenames = mFileManager->LoadActorsFileDialog(this); + AZStd::vector filenames = m_fileManager->LoadActorsFileDialog(this); activateWindow(); if (filenames.empty()) { @@ -1829,7 +1829,7 @@ namespace EMStudio void MainWindow::UpdateLayoutsMenu() { // clear the current menu - mLayoutsMenu->clear(); + m_layoutsMenu->clear(); // generate the layouts path QDir layoutsPath = QDir{ QString(MysticQt::GetDataDir().c_str()) }.filePath("Layouts"); @@ -1840,7 +1840,7 @@ namespace EMStudio dir.setSorting(QDir::Name); // add each layout - mLayoutNames.clear(); + m_layoutNames.clear(); AZStd::string filename; const QFileInfoList list = dir.entryInfoList(); const int listSize = list.size(); @@ -1857,36 +1857,36 @@ namespace EMStudio if (extension == "layout") { AzFramework::StringFunc::Path::GetFileName(filename.c_str(), filename); - mLayoutNames.emplace_back(filename); + m_layoutNames.emplace_back(filename); } } // add each menu - for (const AZStd::string& layoutName : mLayoutNames) + for (const AZStd::string& layoutName : m_layoutNames) { - QAction* action = mLayoutsMenu->addAction(layoutName.c_str()); + QAction* action = m_layoutsMenu->addAction(layoutName.c_str()); connect(action, &QAction::triggered, this, &MainWindow::OnLoadLayout); } // add the separator only if at least one layout - if (!mLayoutNames.empty()) + if (!m_layoutNames.empty()) { - mLayoutsMenu->addSeparator(); + m_layoutsMenu->addSeparator(); } // add the save current menu - QAction* saveCurrentAction = mLayoutsMenu->addAction("Save Current"); + QAction* saveCurrentAction = m_layoutsMenu->addAction("Save Current"); connect(saveCurrentAction, &QAction::triggered, this, &MainWindow::OnLayoutSaveAs); // remove menu is needed only if at least one layout - if (!mLayoutNames.empty()) + if (!m_layoutNames.empty()) { // add the remove menu - QMenu* removeMenu = mLayoutsMenu->addMenu("Remove"); + QMenu* removeMenu = m_layoutsMenu->addMenu("Remove"); removeMenu->setObjectName("RemoveMenu"); // add each layout in the remove menu - for (const AZStd::string& layoutName : mLayoutNames) + for (const AZStd::string& layoutName : m_layoutNames) { // User cannot remove the default layout. This layout is referenced in the qrc file, removing it will // cause compiling issue too. @@ -1900,26 +1900,26 @@ namespace EMStudio } // disable signals to avoid to switch of layout - mApplicationMode->blockSignals(true); + m_applicationMode->blockSignals(true); // update the combo box - mApplicationMode->clear(); - for (const AZStd::string& layoutName : mLayoutNames) + m_applicationMode->clear(); + for (const AZStd::string& layoutName : m_layoutNames) { - mApplicationMode->addItem(layoutName.c_str()); + m_applicationMode->addItem(layoutName.c_str()); } // update the current selection of combo box - const int layoutIndex = mApplicationMode->findText(QString(mOptions.GetApplicationMode().c_str())); - mApplicationMode->setCurrentIndex(layoutIndex); + const int layoutIndex = m_applicationMode->findText(QString(m_options.GetApplicationMode().c_str())); + m_applicationMode->setCurrentIndex(layoutIndex); // enable signals - mApplicationMode->blockSignals(false); + m_applicationMode->blockSignals(false); } void MainWindow::ApplicationModeChanged(int index) { - QString text = mApplicationMode->itemText(index); + QString text = m_applicationMode->itemText(index); ApplicationModeChanged(text); } @@ -1935,7 +1935,7 @@ namespace EMStudio } // update the last used layout and save it in the preferences file - mOptions.SetApplicationMode(text.toUtf8().data()); + m_options.SetApplicationMode(text.toUtf8().data()); SavePreferences(); // generate the filename @@ -1972,16 +1972,16 @@ namespace EMStudio } // check if the layout removed is the current used - if (QString(mOptions.GetApplicationMode().c_str()) == m_removeLayoutNameText) + if (QString(m_options.GetApplicationMode().c_str()) == m_removeLayoutNameText) { // find the layout index on the application mode combo box - const int layoutIndex = mApplicationMode->findText(m_removeLayoutNameText); + const int layoutIndex = m_applicationMode->findText(m_removeLayoutNameText); // set the new layout index, take the previous if the last layout is removed, the next is taken otherwise - const int newLayoutIndex = (layoutIndex == (mApplicationMode->count() - 1)) ? layoutIndex - 1 : layoutIndex + 1; + const int newLayoutIndex = (layoutIndex == (m_applicationMode->count() - 1)) ? layoutIndex - 1 : layoutIndex + 1; // select the layout, it also keeps it and saves to config - mApplicationMode->setCurrentIndex(newLayoutIndex); + m_applicationMode->setCurrentIndex(newLayoutIndex); } // update the layouts menu @@ -2021,7 +2021,7 @@ namespace EMStudio QAction* action = qobject_cast(sender()); // update the last used layout and save it in the preferences file - mOptions.SetApplicationMode(action->text().toUtf8().data()); + m_options.SetApplicationMode(action->text().toUtf8().data()); SavePreferences(); // generate the filename @@ -2031,10 +2031,10 @@ namespace EMStudio if (GetLayoutManager()->LoadLayout(filename.c_str())) { // update the combo box - mApplicationMode->blockSignals(true); - const int layoutIndex = mApplicationMode->findText(action->text()); - mApplicationMode->setCurrentIndex(layoutIndex); - mApplicationMode->blockSignals(false); + m_applicationMode->blockSignals(true); + const int layoutIndex = m_applicationMode->findText(action->text()); + m_applicationMode->setCurrentIndex(layoutIndex); + m_applicationMode->blockSignals(false); } else { @@ -2195,8 +2195,8 @@ namespace EMStudio const size_t actorCount = actorFilenames.size(); if (actorCount == 1) { - mDroppedActorFileName = actorFilenames[0].c_str(); - mRecentActors.AddRecentFile(mDroppedActorFileName.c_str()); + m_droppedActorFileName = actorFilenames[0].c_str(); + m_recentActors.AddRecentFile(m_droppedActorFileName.c_str()); if (contextMenuEnabled) { @@ -2252,11 +2252,11 @@ namespace EMStudio if (numWorkspaces > 0) { // make sure we did not cancel load workspace - if (mDirtyFileManager->SaveDirtyFiles() != DirtyFileManager::CANCELED) + if (m_dirtyFileManager->SaveDirtyFiles() != DirtyFileManager::CANCELED) { // add the workspace in the recent workspace list // if the same workspace is already in the list, the duplicate is removed - mRecentWorkspaces.AddRecentFile(workspaceFilenames[0]); + m_recentWorkspaces.AddRecentFile(workspaceFilenames[0]); // create the command group MCore::CommandGroup workspaceCommandGroup("Load workspace", 64); @@ -2344,21 +2344,21 @@ namespace EMStudio void MainWindow::LoadLayoutAfterShow() { - if (!mLayoutLoaded) + if (!m_layoutLoaded) { - mLayoutLoaded = true; + m_layoutLoaded = true; LoadDefaultLayout(); - if (mCharacterFiles.empty() && GetManager()->GetAutoLoadLastWorkspace()) + if (m_characterFiles.empty() && GetManager()->GetAutoLoadLastWorkspace()) { // load last workspace - const AZStd::string lastRecentWorkspace = mRecentWorkspaces.GetLastRecentFileName(); + const AZStd::string lastRecentWorkspace = m_recentWorkspaces.GetLastRecentFileName(); if (!lastRecentWorkspace.empty()) { - mCharacterFiles.push_back(lastRecentWorkspace); + m_characterFiles.push_back(lastRecentWorkspace); } } - if (!mCharacterFiles.empty()) + if (!m_characterFiles.empty()) { // Need to defer loading the character until the layout is ready. We also // need a couple of initializeGL/paintGL to happen before the character @@ -2391,7 +2391,7 @@ namespace EMStudio // Load default layout. void MainWindow::LoadDefaultLayout() { - if (mApplicationMode->count() == 0) + if (m_applicationMode->count() == 0) { // When the combo box is empty, the call to setCurrentIndex will // not cause any slots to be fired, so dispatch the call manually. @@ -2401,23 +2401,23 @@ namespace EMStudio return; } - int layoutIndex = mApplicationMode->findText(mOptions.GetApplicationMode().c_str()); + int layoutIndex = m_applicationMode->findText(m_options.GetApplicationMode().c_str()); // If searching for the last used layout fails load the default or viewer layout if they exist if (layoutIndex == -1) { - layoutIndex = mApplicationMode->findText("AnimGraph"); + layoutIndex = m_applicationMode->findText("AnimGraph"); } if (layoutIndex == -1) { - layoutIndex = mApplicationMode->findText("Character"); + layoutIndex = m_applicationMode->findText("Character"); } if (layoutIndex == -1) { - layoutIndex = mApplicationMode->findText("Animation"); + layoutIndex = m_applicationMode->findText("Animation"); } - mApplicationMode->setCurrentIndex(layoutIndex); + m_applicationMode->setCurrentIndex(layoutIndex); } @@ -2457,10 +2457,10 @@ namespace EMStudio void MainWindow::LoadCharacterFiles() { - if (!mCharacterFiles.empty()) + if (!m_characterFiles.empty()) { - LoadFiles(mCharacterFiles, 0, 0, false, true); - mCharacterFiles.clear(); + LoadFiles(m_characterFiles, 0, 0, false, true); + m_characterFiles.clear(); // for all registered plugins, call the after load actors callback PluginManager* pluginManager = GetPluginManager(); @@ -2494,18 +2494,18 @@ namespace EMStudio // gets called when the user drag&dropped an actor to the application and then chose to open it in the context menu void MainWindow::OnOpenDroppedActor() { - if (mDirtyFileManager->SaveDirtyFiles({azrtti_typeid()}) == DirtyFileManager::CANCELED) + if (m_dirtyFileManager->SaveDirtyFiles({azrtti_typeid()}) == DirtyFileManager::CANCELED) { return; } - LoadActor(mDroppedActorFileName.c_str(), true); + LoadActor(m_droppedActorFileName.c_str(), true); } // gets called when the user drag&dropped an actor to the application and then chose to merge it in the context menu void MainWindow::OnMergeDroppedActor() { - LoadActor(mDroppedActorFileName.c_str(), false); + LoadActor(m_droppedActorFileName.c_str(), false); } @@ -2536,13 +2536,13 @@ namespace EMStudio void MainWindow::closeEvent(QCloseEvent* event) { - if (mDirtyFileManager->SaveDirtyFiles() == DirtyFileManager::CANCELED) + if (m_dirtyFileManager->SaveDirtyFiles() == DirtyFileManager::CANCELED) { event->ignore(); } else { - mAutosaveTimer->stop(); + m_autosaveTimer->stop(); PluginManager* pluginManager = GetPluginManager(); @@ -2570,22 +2570,22 @@ namespace EMStudio // We mark it as false so next time is shown the layout is re-loaded if // necessary - mLayoutLoaded = false; + m_layoutLoaded = false; } void MainWindow::showEvent(QShowEvent* event) { - if (mOptions.GetEnableAutoSave()) + if (m_options.GetEnableAutoSave()) { - mAutosaveTimer->setInterval(mOptions.GetAutoSaveInterval() * 60 * 1000); - mAutosaveTimer->start(); + m_autosaveTimer->setInterval(m_options.GetAutoSaveInterval() * 60 * 1000); + m_autosaveTimer->start(); } // EMotionFX dock widget is created the first time it's opened, so we need to load layout after that // The singleShot is needed because show event is fired before the dock widget resizes (in the same function dock widget is created) // So we want to load layout after that. It's a bit hacky, but most sensible at the moment. - if (!mLayoutLoaded) + if (!m_layoutLoaded) { QTimer::singleShot(0, this, &MainWindow::LoadLayoutAfterShow); } @@ -2603,7 +2603,7 @@ namespace EMStudio const char* MainWindow::GetCurrentLayoutName() const { // get the selected layout - const int currentLayoutIndex = mApplicationMode->currentIndex(); + const int currentLayoutIndex = m_applicationMode->currentIndex(); // if the index is out of range, return empty name if ((currentLayoutIndex < 0) || (currentLayoutIndex >= (int32)GetNumLayouts())) @@ -2628,10 +2628,10 @@ namespace EMStudio AZStd::vector objects; AZStd::vector dirtyObjects; - const size_t numDirtyFilesCallbacks = mDirtyFileManager->GetNumCallbacks(); + const size_t numDirtyFilesCallbacks = m_dirtyFileManager->GetNumCallbacks(); for (size_t i = 0; i < numDirtyFilesCallbacks; ++i) { - SaveDirtyFilesCallback* callback = mDirtyFileManager->GetCallback(i); + SaveDirtyFilesCallback* callback = m_dirtyFileManager->GetCallback(i); callback->GetDirtyFileNames(&filenames, &objects); const size_t numFileNames = filenames.size(); for (size_t j = 0; j < numFileNames; ++j) @@ -2721,11 +2721,11 @@ namespace EMStudio } // check if the length is upper than the max num files - if (autosaveFileList.length() >= mOptions.GetAutoSaveNumberOfFiles()) + if (autosaveFileList.length() >= m_options.GetAutoSaveNumberOfFiles()) { // number of files to delete // one is added because one space needs to be free for the new file - const int numFilesToDelete = mOptions.GetAutoSaveNumberOfFiles() ? (autosaveFileList.size() - mOptions.GetAutoSaveNumberOfFiles() + 1) : autosaveFileList.size(); + const int numFilesToDelete = m_options.GetAutoSaveNumberOfFiles() ? (autosaveFileList.size() - m_options.GetAutoSaveNumberOfFiles() + 1) : autosaveFileList.size(); // delete each file for (int j = 0; j < numFilesToDelete; ++j) @@ -2749,18 +2749,18 @@ namespace EMStudio AZ_Printf("EMotionFX", "Saving to '%s'\n", newFileFilename.c_str()); // Backing up actors and motions doesn't work anymore as we just update the .assetinfos and the asset processor does the rest. - if (dirtyObjects[i].mMotionSet) + if (dirtyObjects[i].m_motionSet) { - command = AZStd::string::format("SaveMotionSet -motionSetID %i -filename \"%s\" -updateFilename false -updateDirtyFlag false -sourceControl false", dirtyObjects[i].mMotionSet->GetID(), newFileFilename.c_str()); + command = AZStd::string::format("SaveMotionSet -motionSetID %i -filename \"%s\" -updateFilename false -updateDirtyFlag false -sourceControl false", dirtyObjects[i].m_motionSet->GetID(), newFileFilename.c_str()); commandGroup.AddCommandString(command); } - else if (dirtyObjects[i].mAnimGraph) + else if (dirtyObjects[i].m_animGraph) { - const size_t animGraphIndex = EMotionFX::GetAnimGraphManager().FindAnimGraphIndex(dirtyObjects[i].mAnimGraph); + const size_t animGraphIndex = EMotionFX::GetAnimGraphManager().FindAnimGraphIndex(dirtyObjects[i].m_animGraph); command = AZStd::string::format("SaveAnimGraph -index %zu -filename \"%s\" -updateFilename false -updateDirtyFlag false -sourceControl false", animGraphIndex, newFileFilename.c_str()); commandGroup.AddCommandString(command); } - else if (dirtyObjects[i].mWorkspace) + else if (dirtyObjects[i].m_workspace) { Workspace* workspace = GetManager()->GetWorkspace(); workspace->Save(newFileFilename.c_str(), false, false); diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/MainWindow.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/MainWindow.h index d49d47452b..734dd7840d 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/MainWindow.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/MainWindow.h @@ -91,7 +91,7 @@ namespace EMStudio void Init(const AZStd::vector& errors); private: - QTextEdit* mTextEdit = nullptr; + QTextEdit* m_textEdit = nullptr; }; // the main window @@ -114,7 +114,7 @@ namespace EMStudio static void Reflect(AZ::ReflectContext* context); void Init(); - MCORE_INLINE QMenu* GetLayoutsMenu() { return mLayoutsMenu; } + MCORE_INLINE QMenu* GetLayoutsMenu() { return m_layoutsMenu; } void LoadActor(const char* fileName, bool replaceCurrentScene); void LoadCharacter(const AZ::Data::AssetId& actorAssetId, const AZ::Data::AssetId& animgraphId, const AZ::Data::AssetId& motionSetId); @@ -123,9 +123,9 @@ namespace EMStudio void Activate(const AZ::Data::AssetId& actorAssetId, const EMotionFX::AnimGraph* animGraph, const EMotionFX::MotionSet* motionSet); - MysticQt::RecentFiles* GetRecentWorkspaces() { return &mRecentWorkspaces; } + MysticQt::RecentFiles* GetRecentWorkspaces() { return &m_recentWorkspaces; } - GUIOptions& GetOptions() { return mOptions; } + GUIOptions& GetOptions() { return m_options; } void Reset(bool clearActors = true, bool clearMotionSets = true, bool clearMotions = true, bool clearAnimGraphs = true, MCore::CommandGroup* commandGroup = nullptr); @@ -143,17 +143,17 @@ namespace EMStudio void OnWorkspaceSaved(const char* filename); - MCORE_INLINE QComboBox* GetApplicationModeComboBox() { return mApplicationMode; } - DirtyFileManager* GetDirtyFileManager() const { return mDirtyFileManager; } - FileManager* GetFileManager() const { return mFileManager; } - PreferencesWindow* GetPreferencesWindow() const { return mPreferencesWindow; } + MCORE_INLINE QComboBox* GetApplicationModeComboBox() { return m_applicationMode; } + DirtyFileManager* GetDirtyFileManager() const { return m_dirtyFileManager; } + FileManager* GetFileManager() const { return m_fileManager; } + PreferencesWindow* GetPreferencesWindow() const { return m_preferencesWindow; } - size_t GetNumLayouts() const { return mLayoutNames.size(); } - const char* GetLayoutName(uint32 index) const { return mLayoutNames[index].c_str(); } + size_t GetNumLayouts() const { return m_layoutNames.size(); } + const char* GetLayoutName(uint32 index) const { return m_layoutNames[index].c_str(); } const char* GetCurrentLayoutName() const; static const char* GetEMotionFXPaneName(); - MysticQt::KeyboardShortcutManager* GetShortcutManager() const { return mShortcutManager; } + MysticQt::KeyboardShortcutManager* GetShortcutManager() const { return m_shortcutManager; } AzQtComponents::FancyDocking* GetFancyDockingManager() const { return m_fancyDockingManager; } @@ -186,56 +186,56 @@ namespace EMStudio EMotionFX::Actor* m_prevSelectedActor; EMotionFX::ActorInstance* m_prevSelectedActorInstance; - QMenu* mCreateWindowMenu; - QMenu* mLayoutsMenu; + QMenu* m_createWindowMenu; + QMenu* m_layoutsMenu; QAction* m_undoAction; QAction* m_redoAction; // keyboard shortcut manager - MysticQt::KeyboardShortcutManager* mShortcutManager; + MysticQt::KeyboardShortcutManager* m_shortcutManager; // layouts (application modes) - AZStd::vector mLayoutNames; - bool mLayoutLoaded; + AZStd::vector m_layoutNames; + bool m_layoutLoaded; // menu actions - QAction* mResetAction; - QAction* mSaveAllAction; - QAction* mMergeActorAction; - QAction* mSaveSelectedActorsAction; + QAction* m_resetAction; + QAction* m_saveAllAction; + QAction* m_mergeActorAction; + QAction* m_saveSelectedActorsAction; #ifdef EMFX_DEVELOPMENT_BUILD - QAction* mSaveSelectedActorAsAttachmentsAction; + QAction* m_saveSelectedActorAsAttachmentsAction; #endif // application mode - QComboBox* mApplicationMode; + QComboBox* m_applicationMode; - PreferencesWindow* mPreferencesWindow; + PreferencesWindow* m_preferencesWindow; - FileManager* mFileManager; + FileManager* m_fileManager; - MysticQt::RecentFiles mRecentActors; - MysticQt::RecentFiles mRecentWorkspaces; + MysticQt::RecentFiles m_recentActors; + MysticQt::RecentFiles m_recentWorkspaces; // dirty files - DirtyFileManager* mDirtyFileManager; + DirtyFileManager* m_dirtyFileManager; void SetWindowTitleFromFileName(const AZStd::string& fileName); // drag & drop support void dragEnterEvent(QDragEnterEvent* event) override; void dropEvent(QDropEvent* event) override; - AZStd::string mDroppedActorFileName; + AZStd::string m_droppedActorFileName; // General options - GUIOptions mOptions; - bool mLoadingOptions; + GUIOptions m_options; + bool m_loadingOptions; - QTimer* mAutosaveTimer; + QTimer* m_autosaveTimer; - AZStd::vector mCharacterFiles; + AZStd::vector m_characterFiles; - NativeEventFilter* mNativeEventFilter; + NativeEventFilter* m_nativeEventFilter; void closeEvent(QCloseEvent* event) override; void showEvent(QShowEvent* event) override; @@ -266,21 +266,21 @@ namespace EMStudio MCORE_DEFINECOMMANDCALLBACK(CommandUnselectCallback); MCORE_DEFINECOMMANDCALLBACK(CommandClearSelectionCallback); MCORE_DEFINECOMMANDCALLBACK(CommandSaveWorkspaceCallback); - CommandImportActorCallback* mImportActorCallback; - CommandRemoveActorCallback* mRemoveActorCallback; - CommandRemoveActorInstanceCallback* mRemoveActorInstanceCallback; - CommandImportMotionCallback* mImportMotionCallback; - CommandRemoveMotionCallback* mRemoveMotionCallback; - CommandCreateMotionSetCallback* mCreateMotionSetCallback; - CommandRemoveMotionSetCallback* mRemoveMotionSetCallback; - CommandLoadMotionSetCallback* mLoadMotionSetCallback; - CommandCreateAnimGraphCallback* mCreateAnimGraphCallback; - CommandRemoveAnimGraphCallback* mRemoveAnimGraphCallback; - CommandLoadAnimGraphCallback* mLoadAnimGraphCallback; - CommandSelectCallback* mSelectCallback; - CommandUnselectCallback* mUnselectCallback; + CommandImportActorCallback* m_importActorCallback; + CommandRemoveActorCallback* m_removeActorCallback; + CommandRemoveActorInstanceCallback* m_removeActorInstanceCallback; + CommandImportMotionCallback* m_importMotionCallback; + CommandRemoveMotionCallback* m_removeMotionCallback; + CommandCreateMotionSetCallback* m_createMotionSetCallback; + CommandRemoveMotionSetCallback* m_removeMotionSetCallback; + CommandLoadMotionSetCallback* m_loadMotionSetCallback; + CommandCreateAnimGraphCallback* m_createAnimGraphCallback; + CommandRemoveAnimGraphCallback* m_removeAnimGraphCallback; + CommandLoadAnimGraphCallback* m_loadAnimGraphCallback; + CommandSelectCallback* m_selectCallback; + CommandUnselectCallback* m_unselectCallback; CommandClearSelectionCallback* m_clearSelectionCallback; - CommandSaveWorkspaceCallback* mSaveWorkspaceCallback; + CommandSaveWorkspaceCallback* m_saveWorkspaceCallback; class MainWindowCommandManagerCallback : public MCore::CommandManagerCallback { diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/MainWindowEventFilter.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/MainWindowEventFilter.h index d6afacf602..c7e82b13e9 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/MainWindowEventFilter.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/MainWindowEventFilter.h @@ -20,13 +20,13 @@ namespace EMStudio public: NativeEventFilter(MainWindow* mainWindow) : QAbstractNativeEventFilter(), - m_MainWindow(mainWindow) + m_mainWindow(mainWindow) { } virtual bool nativeEventFilter(const QByteArray& /*eventType*/, void* message, long* /*result*/) Q_DECL_OVERRIDE; private: - MainWindow* m_MainWindow; + MainWindow* m_mainWindow; }; } diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/MorphTargetSelectionWindow.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/MorphTargetSelectionWindow.cpp index e189b98dcf..326b1b9902 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/MorphTargetSelectionWindow.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/MorphTargetSelectionWindow.cpp @@ -21,30 +21,30 @@ namespace EMStudio QVBoxLayout* layout = new QVBoxLayout(); - mListWidget = new QListWidget(); - mListWidget->setAlternatingRowColors(true); + m_listWidget = new QListWidget(); + m_listWidget->setAlternatingRowColors(true); if (multiSelect) { - mListWidget->setSelectionMode(QListWidget::ExtendedSelection); + m_listWidget->setSelectionMode(QListWidget::ExtendedSelection); } else { - mListWidget->setSelectionMode(QAbstractItemView::SelectionMode::SingleSelection); + m_listWidget->setSelectionMode(QAbstractItemView::SelectionMode::SingleSelection); } QHBoxLayout* buttonLayout = new QHBoxLayout(); - mOKButton = new QPushButton("OK"); - mCancelButton = new QPushButton("Cancel"); - buttonLayout->addWidget(mOKButton); - buttonLayout->addWidget(mCancelButton); + m_okButton = new QPushButton("OK"); + m_cancelButton = new QPushButton("Cancel"); + buttonLayout->addWidget(m_okButton); + buttonLayout->addWidget(m_cancelButton); - layout->addWidget(mListWidget); + layout->addWidget(m_listWidget); layout->addLayout(buttonLayout); setLayout(layout); - connect(mOKButton, &QPushButton::clicked, this, &MorphTargetSelectionWindow::accept); - connect(mCancelButton, &QPushButton::clicked, this, &MorphTargetSelectionWindow::reject); - connect(mListWidget, &QListWidget::itemSelectionChanged, this, &MorphTargetSelectionWindow::OnSelectionChanged); + connect(m_okButton, &QPushButton::clicked, this, &MorphTargetSelectionWindow::accept); + connect(m_cancelButton, &QPushButton::clicked, this, &MorphTargetSelectionWindow::reject); + connect(m_listWidget, &QListWidget::itemSelectionChanged, this, &MorphTargetSelectionWindow::OnSelectionChanged); } @@ -55,25 +55,25 @@ namespace EMStudio const AZStd::vector& MorphTargetSelectionWindow::GetMorphTargetIDs() const { - return mSelection; + return m_selection; } void MorphTargetSelectionWindow::OnSelectionChanged() { - mSelection.clear(); + m_selection.clear(); - const int numItems = mListWidget->count(); - mSelection.reserve(numItems); + const int numItems = m_listWidget->count(); + m_selection.reserve(numItems); for (int i = 0; i < numItems; ++i) { - QListWidgetItem* item = mListWidget->item(i); + QListWidgetItem* item = m_listWidget->item(i); if (!item->isSelected()) { continue; } - mSelection.emplace_back(item->data(Qt::UserRole).toInt()); + m_selection.emplace_back(item->data(Qt::UserRole).toInt()); } } @@ -85,10 +85,10 @@ namespace EMStudio return; } - mListWidget->blockSignals(true); - mListWidget->clear(); + m_listWidget->blockSignals(true); + m_listWidget->clear(); - mSelection = selection; + m_selection = selection; const size_t numMorphTargets = morphSetup->GetNumMorphTargets(); for (size_t i = 0; i < numMorphTargets; ++i) @@ -100,16 +100,16 @@ namespace EMStudio item->setText(morphTarget->GetName()); item->setData(Qt::UserRole, morphTargetID); - mListWidget->addItem(item); + m_listWidget->addItem(item); - if (AZStd::find(mSelection.begin(), mSelection.end(), morphTargetID) != mSelection.end()) + if (AZStd::find(m_selection.begin(), m_selection.end(), morphTargetID) != m_selection.end()) { item->setSelected(true); } } - mListWidget->blockSignals(false); - mSelection = selection; + m_listWidget->blockSignals(false); + m_selection = selection; } } // namespace EMStudio diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/MorphTargetSelectionWindow.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/MorphTargetSelectionWindow.h index aee6f38754..c05fa91a3d 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/MorphTargetSelectionWindow.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/MorphTargetSelectionWindow.h @@ -38,9 +38,9 @@ namespace EMStudio void OnSelectionChanged(); private: - AZStd::vector mSelection; - QListWidget* mListWidget; - QPushButton* mOKButton; - QPushButton* mCancelButton; + AZStd::vector m_selection; + QListWidget* m_listWidget; + QPushButton* m_okButton; + QPushButton* m_cancelButton; }; } // namespace EMStudio diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/MotionEventPresetManager.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/MotionEventPresetManager.cpp index e6f3fd5ac8..ac5dd80f4f 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/MotionEventPresetManager.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/MotionEventPresetManager.cpp @@ -70,12 +70,12 @@ namespace EMStudio //----------------------------------- - const AZ::u32 MotionEventPresetManager::m_unknownEventColor = MCore::RGBA(193, 195, 196, 255); + const AZ::u32 MotionEventPresetManager::s_unknownEventColor = MCore::RGBA(193, 195, 196, 255); MotionEventPresetManager::MotionEventPresetManager() - : mDirtyFlag(false) + : m_dirtyFlag(false) { - mFileName = GetManager()->GetAppDataFolder() + "EMStudioDefaultEventPresets.cfg"; + m_fileName = GetManager()->GetAppDataFolder() + "EMStudioDefaultEventPresets.cfg"; } @@ -96,51 +96,51 @@ namespace EMStudio serializeContext->Class() ->Version(1) - ->Field("eventPresets", &MotionEventPresetManager::mEventPresets) + ->Field("eventPresets", &MotionEventPresetManager::m_eventPresets) ; } void MotionEventPresetManager::Clear() { - for (MotionEventPreset* eventPreset : mEventPresets) + for (MotionEventPreset* eventPreset : m_eventPresets) { delete eventPreset; } - mEventPresets.clear(); + m_eventPresets.clear(); } size_t MotionEventPresetManager::GetNumPresets() const { - return mEventPresets.size(); + return m_eventPresets.size(); } bool MotionEventPresetManager::IsEmpty() const { - return mEventPresets.empty(); + return m_eventPresets.empty(); } void MotionEventPresetManager::AddPreset(MotionEventPreset* preset) { - mEventPresets.emplace_back(preset); - mDirtyFlag = true; + m_eventPresets.emplace_back(preset); + m_dirtyFlag = true; } void MotionEventPresetManager::RemovePreset(size_t index) { - delete mEventPresets[index]; - mEventPresets.erase(mEventPresets.begin() + index); - mDirtyFlag = true; + delete m_eventPresets[index]; + m_eventPresets.erase(m_eventPresets.begin() + index); + m_dirtyFlag = true; } MotionEventPreset* MotionEventPresetManager::GetPreset(size_t index) const { - return mEventPresets[index]; + return m_eventPresets[index]; } @@ -152,14 +152,14 @@ namespace EMStudio MotionEventPreset* rightFootPreset = aznew MotionEventPreset("RightFoot", {AZStd::move(rightFootData)}, AZ::Color(AZ::u8(0), 255, 0, 255)); leftFootPreset->SetIsDefault(true); rightFootPreset->SetIsDefault(true); - mEventPresets.emplace(mEventPresets.begin(), leftFootPreset); - mEventPresets.emplace(AZStd::next(mEventPresets.begin(), 1), rightFootPreset); + m_eventPresets.emplace(m_eventPresets.begin(), leftFootPreset); + m_eventPresets.emplace(AZStd::next(m_eventPresets.begin(), 1), rightFootPreset); } void MotionEventPresetManager::Load(const AZStd::string& filename) { - mFileName = filename; + m_fileName = filename; // Clear the old event presets. Clear(); @@ -169,11 +169,11 @@ namespace EMStudio LoadLegacyQSettingsFormat(); } - // LoadLYSerializedFormat() will clear mEventPresets, so default + // LoadLYSerializedFormat() will clear m_eventPresets, so default // presets have to be made afterwards CreateDefaultPresets(); - mDirtyFlag = false; + m_dirtyFlag = false; // Update the default preset settings filename so that next startup the presets get auto-loaded. SaveToSettings(); @@ -182,7 +182,7 @@ namespace EMStudio bool MotionEventPresetManager::LoadLegacyQSettingsFormat() { - QSettings settings(mFileName.c_str(), QSettings::IniFormat, GetManager()->GetMainWindow()); + QSettings settings(m_fileName.c_str(), QSettings::IniFormat, GetManager()->GetMainWindow()); if (settings.status() != QSettings::Status::NoError) { @@ -221,18 +221,18 @@ namespace EMStudio bool MotionEventPresetManager::LoadLYSerializedFormat() { - return AZ::Utils::LoadObjectFromFileInPlace(mFileName, azrtti_typeid(mEventPresets), &mEventPresets); + return AZ::Utils::LoadObjectFromFileInPlace(m_fileName, azrtti_typeid(m_eventPresets), &m_eventPresets); } void MotionEventPresetManager::SaveAs(const AZStd::string& filename, bool showNotification) { - mFileName = filename; + m_fileName = filename; // Skip saving the built-in presets AZStd::vector presets; - presets.reserve(mEventPresets.size()); - for (MotionEventPreset* preset : mEventPresets) + presets.reserve(m_eventPresets.size()); + for (MotionEventPreset* preset : m_eventPresets) { if (preset->GetIsDefault()) { @@ -251,7 +251,7 @@ namespace EMStudio // Check if the settings correctly saved. if (AZ::Utils::SaveObjectToFile(filename, AZ::DataStream::ST_XML, &presets)) { - mDirtyFlag = false; + m_dirtyFlag = false; // Add file in case it did not exist before (when saving it the first time). if (!SourceControlCommand::CheckOutFile(filename.c_str(), fileExisted, checkoutResultString, /*useSourceControl=*/true, /*add=*/true)) @@ -279,11 +279,11 @@ namespace EMStudio void MotionEventPresetManager::SaveToSettings() { - if (!mFileName.empty()) + if (!m_fileName.empty()) { QSettings settings(GetManager()->GetMainWindow()); settings.beginGroup("EMotionFX"); - settings.setValue("lastEventPresetFile", mFileName.c_str()); + settings.setValue("lastEventPresetFile", m_fileName.c_str()); settings.endGroup(); } } @@ -298,7 +298,7 @@ namespace EMStudio if (!filename.empty()) { - mFileName = AZStd::move(filename); + m_fileName = AZStd::move(filename); } } @@ -306,7 +306,7 @@ namespace EMStudio // Check if motion event with this configuration exists and return color. AZ::u32 MotionEventPresetManager::GetEventColor(const EMotionFX::EventDataSet& eventDatas) const { - for (const MotionEventPreset* preset : mEventPresets) + for (const MotionEventPreset* preset : m_eventPresets) { EMotionFX::EventDataSet commonDatas; const EMotionFX::EventDataSet& presetDatas = preset->GetEventDatas(); @@ -325,6 +325,6 @@ namespace EMStudio } // Use the same color for all events that are not from a preset. - return m_unknownEventColor; + return s_unknownEventColor; } } // namespace EMStudio diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/MotionEventPresetManager.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/MotionEventPresetManager.h index 89e997a96f..8e5853291c 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/MotionEventPresetManager.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/MotionEventPresetManager.h @@ -75,16 +75,16 @@ namespace EMStudio void Clear(); void Load(const AZStd::string& filename); - void Load() { Load(mFileName); } + void Load() { Load(m_fileName); } void LoadFromSettings(); void SaveAs(const AZStd::string& filename, bool showNotification=true); - void Save(bool showNotification=true) { SaveAs(mFileName, showNotification); } + void Save(bool showNotification=true) { SaveAs(m_fileName, showNotification); } - bool GetIsDirty() const { return mDirtyFlag; } - void SetDirtyFlag(bool isDirty) { mDirtyFlag = isDirty; } - const char* GetFileName() const { return mFileName.c_str(); } - const AZStd::string& GetFileNameString() const { return mFileName; } - void SetFileName(const char* filename) { mFileName = filename; } + bool GetIsDirty() const { return m_dirtyFlag; } + void SetDirtyFlag(bool isDirty) { m_dirtyFlag = isDirty; } + const char* GetFileName() const { return m_fileName.c_str(); } + const AZStd::string& GetFileNameString() const { return m_fileName; } + void SetFileName(const char* filename) { m_fileName = filename; } AZ::u32 GetEventColor(const EMotionFX::EventDataSet& eventDatas) const; @@ -92,10 +92,10 @@ namespace EMStudio bool LoadLYSerializedFormat(); bool LoadLegacyQSettingsFormat(); - AZStd::vector mEventPresets; - AZStd::string mFileName; - bool mDirtyFlag; - static const AZ::u32 m_unknownEventColor; + AZStd::vector m_eventPresets; + AZStd::string m_fileName; + bool m_dirtyFlag; + static const AZ::u32 s_unknownEventColor; void SaveToSettings(); void CreateDefaultPresets(); diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/MotionSetHierarchyWidget.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/MotionSetHierarchyWidget.cpp index a5e3a64f1f..99180a716c 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/MotionSetHierarchyWidget.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/MotionSetHierarchyWidget.cpp @@ -32,10 +32,10 @@ namespace EMStudio MotionSetHierarchyWidget::MotionSetHierarchyWidget(QWidget* parent, bool useSingleSelection, CommandSystem::SelectionList* selectionList) : QWidget(parent) { - mCurrentSelectionList = selectionList; + m_currentSelectionList = selectionList; if (selectionList == nullptr) { - mCurrentSelectionList = &(GetCommandManager()->GetCurrentSelection()); + m_currentSelectionList = &(GetCommandManager()->GetCurrentSelection()); } QVBoxLayout* layout = new QVBoxLayout(); @@ -46,34 +46,34 @@ namespace EMStudio connect(m_searchWidget, &AzQtComponents::FilteredSearchWidget::TextFilterChanged, this, &MotionSetHierarchyWidget::OnTextFilterChanged); // create the tree widget - mHierarchy = new QTreeWidget(); + m_hierarchy = new QTreeWidget(); // create header items - mHierarchy->setColumnCount(2); + m_hierarchy->setColumnCount(2); QStringList headerList; headerList.append("ID"); headerList.append("FileName"); - mHierarchy->setHeaderLabels(headerList); + m_hierarchy->setHeaderLabels(headerList); // set optical stuff for the tree - mHierarchy->setColumnWidth(0, 400); - mHierarchy->setSortingEnabled(false); - mHierarchy->setSelectionMode(QAbstractItemView::SingleSelection); - mHierarchy->setMinimumWidth(620); - mHierarchy->setMinimumHeight(500); - mHierarchy->setAlternatingRowColors(true); - mHierarchy->setExpandsOnDoubleClick(true); - mHierarchy->setAnimated(true); + m_hierarchy->setColumnWidth(0, 400); + m_hierarchy->setSortingEnabled(false); + m_hierarchy->setSelectionMode(QAbstractItemView::SingleSelection); + m_hierarchy->setMinimumWidth(620); + m_hierarchy->setMinimumHeight(500); + m_hierarchy->setAlternatingRowColors(true); + m_hierarchy->setExpandsOnDoubleClick(true); + m_hierarchy->setAnimated(true); // disable the move of section to have column order fixed - mHierarchy->header()->setSectionsMovable(false); + m_hierarchy->header()->setSectionsMovable(false); layout->addWidget(m_searchWidget); - layout->addWidget(mHierarchy); + layout->addWidget(m_hierarchy); setLayout(layout); - connect(mHierarchy, &QTreeWidget::itemSelectionChanged, this, &MotionSetHierarchyWidget::UpdateSelection); - connect(mHierarchy, &QTreeWidget::itemDoubleClicked, this, &MotionSetHierarchyWidget::ItemDoubleClicked); + connect(m_hierarchy, &QTreeWidget::itemSelectionChanged, this, &MotionSetHierarchyWidget::UpdateSelection); + connect(m_hierarchy, &QTreeWidget::itemDoubleClicked, this, &MotionSetHierarchyWidget::ItemDoubleClicked); // connect the window activation signal to refresh if reactivated //connect( this, SIGNAL(visibilityChanged(bool)), this, SLOT(OnVisibilityChanged(bool)) ); @@ -91,12 +91,12 @@ namespace EMStudio // update from a motion set and selection list void MotionSetHierarchyWidget::Update(EMotionFX::MotionSet* motionSet, CommandSystem::SelectionList* selectionList) { - mMotionSet = motionSet; - mCurrentSelectionList = selectionList; + m_motionSet = motionSet; + m_currentSelectionList = selectionList; if (selectionList == nullptr) { - mCurrentSelectionList = &(GetCommandManager()->GetCurrentSelection()); + m_currentSelectionList = &(GetCommandManager()->GetCurrentSelection()); } Update(); @@ -106,12 +106,12 @@ namespace EMStudio // update the widget void MotionSetHierarchyWidget::Update() { - mHierarchy->clear(); + m_hierarchy->clear(); - mHierarchy->blockSignals(true); - if (mMotionSet) + m_hierarchy->blockSignals(true); + if (m_motionSet) { - AddMotionSetWithParents(mMotionSet); + AddMotionSetWithParents(m_motionSet); } else { @@ -128,12 +128,12 @@ namespace EMStudio if (motionSet->GetParentSet() == nullptr) { - RecursiveAddMotionSet(nullptr, EMotionFX::GetMotionManager().GetMotionSet(i), mCurrentSelectionList); + RecursiveAddMotionSet(nullptr, EMotionFX::GetMotionManager().GetMotionSet(i), m_currentSelectionList); } } } - mHierarchy->blockSignals(false); + m_hierarchy->blockSignals(false); UpdateSelection(); } @@ -144,8 +144,8 @@ namespace EMStudio QTreeWidgetItem* motionSetItem; if (parent == nullptr) { - motionSetItem = new QTreeWidgetItem(mHierarchy); - mHierarchy->addTopLevelItem(motionSetItem); + motionSetItem = new QTreeWidgetItem(m_hierarchy); + m_hierarchy->addTopLevelItem(motionSetItem); } else { @@ -196,7 +196,7 @@ namespace EMStudio void MotionSetHierarchyWidget::AddMotionSetWithParents(EMotionFX::MotionSet* motionSet) { // create the motion set item - QTreeWidgetItem* motionSetItem = new QTreeWidgetItem(mHierarchy); + QTreeWidgetItem* motionSetItem = new QTreeWidgetItem(m_hierarchy); // set the name motionSetItem->setText(0, motionSet->GetName()); @@ -232,7 +232,7 @@ namespace EMStudio while (parentMotionSet) { // create the motion set item - QTreeWidgetItem* parentMotionSetItem = new QTreeWidgetItem(mHierarchy); + QTreeWidgetItem* parentMotionSetItem = new QTreeWidgetItem(m_hierarchy); // set the name parentMotionSetItem->setText(0, parentMotionSet->GetName()); @@ -264,7 +264,7 @@ namespace EMStudio } // add the last motion set item as child and set this parent as last motion set item - parentMotionSetItem->addChild(mHierarchy->takeTopLevelItem(mHierarchy->indexOfTopLevelItem(motionSetItem))); + parentMotionSetItem->addChild(m_hierarchy->takeTopLevelItem(m_hierarchy->indexOfTopLevelItem(motionSetItem))); motionSetItem = parentMotionSetItem; // set the next parent motion set @@ -272,19 +272,19 @@ namespace EMStudio } // expand all to show all items - mHierarchy->expandAll(); + m_hierarchy->expandAll(); } void MotionSetHierarchyWidget::Select(const AZStd::vector& selectedItems) { - mSelected = selectedItems; + m_selected = selectedItems; for (const MotionSetSelectionItem& selectionItem : selectedItems) { - const AZStd::string& motionId = selectionItem.mMotionId; + const AZStd::string& motionId = selectionItem.m_motionId; - QTreeWidgetItemIterator itemIterator(mHierarchy); + QTreeWidgetItemIterator itemIterator(m_hierarchy); while (*itemIterator) { QTreeWidgetItem* item = *itemIterator; @@ -302,11 +302,11 @@ namespace EMStudio void MotionSetHierarchyWidget::UpdateSelection() { // Get the selected items in the tree widget. - QList selectedItems = mHierarchy->selectedItems(); + QList selectedItems = m_hierarchy->selectedItems(); // Reset the selection. - mSelected.clear(); - mSelected.reserve(selectedItems.size()); + m_selected.clear(); + m_selected.reserve(selectedItems.size()); AZStd::string motionId; for (const QTreeWidgetItem* item : selectedItems) @@ -325,7 +325,7 @@ namespace EMStudio } MotionSetSelectionItem selectionItem(motionId, motionSet); - mSelected.push_back(selectionItem); + m_selected.push_back(selectionItem); } } @@ -334,14 +334,14 @@ namespace EMStudio { if (useSingleSelection) { - mHierarchy->setSelectionMode(QAbstractItemView::SingleSelection); + m_hierarchy->setSelectionMode(QAbstractItemView::SingleSelection); } else { - mHierarchy->setSelectionMode(QAbstractItemView::ExtendedSelection); + m_hierarchy->setSelectionMode(QAbstractItemView::ExtendedSelection); } - mUseSingleSelection = useSingleSelection; + m_useSingleSelection = useSingleSelection; } @@ -364,14 +364,14 @@ namespace EMStudio void MotionSetHierarchyWidget::FireSelectionDoneSignal() { - emit SelectionChanged(mSelected); + emit SelectionChanged(m_selected); } AZStd::vector& MotionSetHierarchyWidget::GetSelectedItems() { UpdateSelection(); - return mSelected; + return m_selected; } @@ -384,9 +384,9 @@ namespace EMStudio for (const MotionSetSelectionItem& selectedItem : selectedItems) { - if (selectedItem.mMotionSet == motionSet) + if (selectedItem.m_motionSet == motionSet) { - result.push_back(selectedItem.mMotionId); + result.push_back(selectedItem.m_motionId); } } @@ -395,9 +395,9 @@ namespace EMStudio void MotionSetHierarchyWidget::SelectItemsWithText(QString text) { - QList items = mHierarchy->findItems(text, Qt::MatchWrap | Qt::MatchWildcard | Qt::MatchRecursive); + QList items = m_hierarchy->findItems(text, Qt::MatchWrap | Qt::MatchWildcard | Qt::MatchRecursive); - mHierarchy->clearSelection(); + m_hierarchy->clearSelection(); for (QTreeWidgetItem* item : items) { diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/MotionSetHierarchyWidget.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/MotionSetHierarchyWidget.h index 838044c010..50e86cf8ba 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/MotionSetHierarchyWidget.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/MotionSetHierarchyWidget.h @@ -33,12 +33,12 @@ namespace EMStudio { struct EMSTUDIO_API MotionSetSelectionItem { - AZStd::string mMotionId; - EMotionFX::MotionSet* mMotionSet; + AZStd::string m_motionId; + EMotionFX::MotionSet* m_motionSet; MotionSetSelectionItem(const AZStd::string& motionId, EMotionFX::MotionSet* motionSet) - : mMotionId(motionId) - , mMotionSet(motionSet) + : m_motionId(motionId) + , m_motionSet(motionSet) { } }; @@ -58,7 +58,7 @@ namespace EMStudio void Update(EMotionFX::MotionSet* motionSet, CommandSystem::SelectionList* selectionList = nullptr); void FireSelectionDoneSignal(); - MCORE_INLINE QTreeWidget* GetTreeWidget() { return mHierarchy; } + MCORE_INLINE QTreeWidget* GetTreeWidget() { return m_hierarchy; } MCORE_INLINE AzQtComponents::FilteredSearchWidget* GetSearchWidget() { return m_searchWidget; } void Select(const AZStd::vector& selectedItems); @@ -84,12 +84,12 @@ namespace EMStudio void RecursiveAddMotionSet(QTreeWidgetItem* parent, EMotionFX::MotionSet* motionSet, CommandSystem::SelectionList* selectionList); void AddMotionSetWithParents(EMotionFX::MotionSet* motionSet); - EMotionFX::MotionSet* mMotionSet; - QTreeWidget* mHierarchy; + EMotionFX::MotionSet* m_motionSet; + QTreeWidget* m_hierarchy; AzQtComponents::FilteredSearchWidget* m_searchWidget; AZStd::string m_searchWidgetText; - AZStd::vector mSelected; - CommandSystem::SelectionList* mCurrentSelectionList; - bool mUseSingleSelection; + AZStd::vector m_selected; + CommandSystem::SelectionList* m_currentSelectionList; + bool m_useSingleSelection; }; } // namespace EMStudio diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/MotionSetSelectionWindow.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/MotionSetSelectionWindow.cpp index 79b53da0f9..23c2000754 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/MotionSetSelectionWindow.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/MotionSetSelectionWindow.cpp @@ -26,29 +26,29 @@ namespace EMStudio QVBoxLayout* layout = new QVBoxLayout(); - mHierarchyWidget = new MotionSetHierarchyWidget(this, useSingleSelection, selectionList); + m_hierarchyWidget = new MotionSetHierarchyWidget(this, useSingleSelection, selectionList); // create the ok and cancel buttons QHBoxLayout* buttonLayout = new QHBoxLayout(); - mOKButton = new QPushButton("OK"); - mOKButton->setObjectName("EMFX.MotionSetSelectionWindow.Ok"); - mCancelButton = new QPushButton("Cancel"); - mCancelButton->setObjectName("EMFX.MotionSetSelectionWindow.Cancel"); - buttonLayout->addWidget(mOKButton); - buttonLayout->addWidget(mCancelButton); + m_okButton = new QPushButton("OK"); + m_okButton->setObjectName("EMFX.MotionSetSelectionWindow.Ok"); + m_cancelButton = new QPushButton("Cancel"); + m_cancelButton->setObjectName("EMFX.MotionSetSelectionWindow.Cancel"); + buttonLayout->addWidget(m_okButton); + buttonLayout->addWidget(m_cancelButton); - layout->addWidget(mHierarchyWidget); + layout->addWidget(m_hierarchyWidget); layout->addLayout(buttonLayout); setLayout(layout); - connect(mOKButton, &QPushButton::clicked, this, &MotionSetSelectionWindow::accept); - connect(mCancelButton, &QPushButton::clicked, this, &MotionSetSelectionWindow::reject); + connect(m_okButton, &QPushButton::clicked, this, &MotionSetSelectionWindow::accept); + connect(m_cancelButton, &QPushButton::clicked, this, &MotionSetSelectionWindow::reject); connect(this, &MotionSetSelectionWindow::accepted, this, &MotionSetSelectionWindow::OnAccept); - connect(mHierarchyWidget, &MotionSetHierarchyWidget::SelectionChanged, this, &MotionSetSelectionWindow::OnSelectionChanged); + connect(m_hierarchyWidget, &MotionSetHierarchyWidget::SelectionChanged, this, &MotionSetSelectionWindow::OnSelectionChanged); // set the selection mode - mHierarchyWidget->SetSelectionMode(useSingleSelection); - mUseSingleSelection = useSingleSelection; + m_hierarchyWidget->SetSelectionMode(useSingleSelection); + m_useSingleSelection = useSingleSelection; } @@ -59,7 +59,7 @@ namespace EMStudio void MotionSetSelectionWindow::Select(const AZStd::vector& selectedItems) { - mHierarchyWidget->Select(selectedItems); + m_hierarchyWidget->Select(selectedItems); } @@ -85,9 +85,9 @@ namespace EMStudio void MotionSetSelectionWindow::OnAccept() { - if (mUseSingleSelection == false) + if (m_useSingleSelection == false) { - mHierarchyWidget->FireSelectionDoneSignal(); + m_hierarchyWidget->FireSelectionDoneSignal(); } } } // namespace EMStudio diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/MotionSetSelectionWindow.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/MotionSetSelectionWindow.h index 552b45d249..c35e46fc54 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/MotionSetSelectionWindow.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/MotionSetSelectionWindow.h @@ -29,8 +29,8 @@ namespace EMStudio MotionSetSelectionWindow(QWidget* parent, bool useSingleSelection = true, CommandSystem::SelectionList* selectionList = nullptr); virtual ~MotionSetSelectionWindow(); - MCORE_INLINE MotionSetHierarchyWidget* GetHierarchyWidget() { return mHierarchyWidget; } - void Update(EMotionFX::MotionSet* motionSet, CommandSystem::SelectionList* selectionList = nullptr) { mHierarchyWidget->Update(motionSet, selectionList); } + MCORE_INLINE MotionSetHierarchyWidget* GetHierarchyWidget() { return m_hierarchyWidget; } + void Update(EMotionFX::MotionSet* motionSet, CommandSystem::SelectionList* selectionList = nullptr) { m_hierarchyWidget->Update(motionSet, selectionList); } void Select(const AZStd::vector& selectedItems); void Select(const AZStd::vector& selectedMotionIds, EMotionFX::MotionSet* motionSet); @@ -40,9 +40,9 @@ namespace EMStudio void OnSelectionChanged(AZStd::vector selection); private: - MotionSetHierarchyWidget* mHierarchyWidget; - QPushButton* mOKButton; - QPushButton* mCancelButton; - bool mUseSingleSelection; + MotionSetHierarchyWidget* m_hierarchyWidget; + QPushButton* m_okButton; + QPushButton* m_cancelButton; + bool m_useSingleSelection; }; } // namespace EMStudio diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/NodeHierarchyWidget.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/NodeHierarchyWidget.cpp index 1aa8082f08..63934a380c 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/NodeHierarchyWidget.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/NodeHierarchyWidget.cpp @@ -25,7 +25,7 @@ EMotionFX::Node* SelectionItem::GetNode() const { - EMotionFX::ActorInstance* actorInstance = EMotionFX::GetActorManager().FindActorInstanceByID(mActorInstanceID); + EMotionFX::ActorInstance* actorInstance = EMotionFX::GetActorManager().FindActorInstanceByID(m_actorInstanceId); if (!actorInstance) { return nullptr; @@ -46,10 +46,10 @@ namespace EMStudio const auto boneIconFilename = iconFilename("Bone.svg"); const auto nodeIconFilename = iconFilename("Node.svg"); const auto meshIconFilename = iconFilename("Mesh.svg"); - mBoneIcon = new QIcon(boneIconFilename); - mNodeIcon = new QIcon(nodeIconFilename); - mMeshIcon = new QIcon(meshIconFilename); - mCharacterIcon = new QIcon(iconFilename("Character.svg")); + m_boneIcon = new QIcon(boneIconFilename); + m_nodeIcon = new QIcon(nodeIconFilename); + m_meshIcon = new QIcon(meshIconFilename); + m_characterIcon = new QIcon(iconFilename("Character.svg")); QVBoxLayout* layout = new QVBoxLayout(); layout->setMargin(0); @@ -67,7 +67,7 @@ namespace EMStudio addFilter(tr("Meshes"), meshIconFilename, FilterType::Meshes); addFilter(tr("Nodes"), nodeIconFilename, FilterType::Nodes); addFilter(tr("Bones"), boneIconFilename, FilterType::Bones); - mFilterState = {FilterType::Meshes, FilterType::Nodes, FilterType::Bones}; + m_filterState = {FilterType::Meshes, FilterType::Nodes, FilterType::Bones}; connect(m_searchWidget, &AzQtComponents::FilteredSearchWidget::TextFilterChanged, this, &NodeHierarchyWidget::OnTextFilterChanged); connect(m_searchWidget, &AzQtComponents::FilteredSearchWidget::TypeFilterChanged, this, [this](const auto& filters) { FilterTypes filterState; @@ -75,52 +75,52 @@ namespace EMStudio { filterState.setFlag(static_cast(filter.metadata.toInt())); } - if (filterState == mFilterState) + if (filterState == m_filterState) { return; } - mFilterState = filterState; + m_filterState = filterState; Update(); emit FilterStateChanged(filterState); }); layout->addWidget(m_searchWidget); // create the tree widget - mHierarchy = new QTreeWidget(); + m_hierarchy = new QTreeWidget(); // create header items - mHierarchy->setColumnCount(1); + m_hierarchy->setColumnCount(1); // set optical stuff for the tree - mHierarchy->header()->setVisible(false); - mHierarchy->header()->setStretchLastSection(true); - mHierarchy->setSortingEnabled(false); - mHierarchy->setSelectionMode(QAbstractItemView::SingleSelection); + m_hierarchy->header()->setVisible(false); + m_hierarchy->header()->setStretchLastSection(true); + m_hierarchy->setSortingEnabled(false); + m_hierarchy->setSelectionMode(QAbstractItemView::SingleSelection); if (useDefaultMinWidth) { - mHierarchy->setMinimumWidth(500); + m_hierarchy->setMinimumWidth(500); } - mHierarchy->setMinimumHeight(400); - mHierarchy->setExpandsOnDoubleClick(true); - mHierarchy->setAnimated(true); + m_hierarchy->setMinimumHeight(400); + m_hierarchy->setExpandsOnDoubleClick(true); + m_hierarchy->setAnimated(true); // disable the move of section to have column order fixed - mHierarchy->header()->setSectionsMovable(false); + m_hierarchy->header()->setSectionsMovable(false); if (useSingleSelection == false) { - mHierarchy->setContextMenuPolicy(Qt::CustomContextMenu); - connect(mHierarchy, &QTreeWidget::customContextMenuRequested, this, &NodeHierarchyWidget::TreeContextMenu); + m_hierarchy->setContextMenuPolicy(Qt::CustomContextMenu); + connect(m_hierarchy, &QTreeWidget::customContextMenuRequested, this, &NodeHierarchyWidget::TreeContextMenu); } - layout->addWidget(mHierarchy); + layout->addWidget(m_hierarchy); setLayout(layout); - connect(mHierarchy, &QTreeWidget::itemSelectionChanged, this, &NodeHierarchyWidget::UpdateSelection); - connect(mHierarchy, &QTreeWidget::itemDoubleClicked, this, &NodeHierarchyWidget::ItemDoubleClicked); - connect(mHierarchy, &QTreeWidget::itemSelectionChanged, this, &NodeHierarchyWidget::OnSelectionChanged); + connect(m_hierarchy, &QTreeWidget::itemSelectionChanged, this, &NodeHierarchyWidget::UpdateSelection); + connect(m_hierarchy, &QTreeWidget::itemDoubleClicked, this, &NodeHierarchyWidget::ItemDoubleClicked); + connect(m_hierarchy, &QTreeWidget::itemSelectionChanged, this, &NodeHierarchyWidget::OnSelectionChanged); // connect the window activation signal to refresh if reactivated //connect( this, SIGNAL(visibilityChanged(bool)), this, SLOT(OnVisibilityChanged(bool)) ); @@ -133,16 +133,16 @@ namespace EMStudio // destructor NodeHierarchyWidget::~NodeHierarchyWidget() { - delete mBoneIcon; - delete mMeshIcon; - delete mNodeIcon; - delete mCharacterIcon; + delete m_boneIcon; + delete m_meshIcon; + delete m_nodeIcon; + delete m_characterIcon; } void NodeHierarchyWidget::Update(const AZStd::vector& actorInstanceIDs, CommandSystem::SelectionList* selectionList) { - mActorInstanceIDs = actorInstanceIDs; + m_actorInstanceIDs = actorInstanceIDs; ConvertFromSelectionList(selectionList); Update(); @@ -151,7 +151,7 @@ namespace EMStudio void NodeHierarchyWidget::Update(uint32 actorInstanceID, CommandSystem::SelectionList* selectionList) { - mActorInstanceIDs.clear(); + m_actorInstanceIDs.clear(); if (actorInstanceID == MCORE_INVALIDINDEX32) { @@ -167,27 +167,27 @@ namespace EMStudio continue; } - mActorInstanceIDs.emplace_back(actorInstance->GetID()); + m_actorInstanceIDs.emplace_back(actorInstance->GetID()); } } else { - mActorInstanceIDs.emplace_back(actorInstanceID); + m_actorInstanceIDs.emplace_back(actorInstanceID); } - Update(mActorInstanceIDs, selectionList); + Update(m_actorInstanceIDs, selectionList); } void NodeHierarchyWidget::Update() { - mHierarchy->blockSignals(true); + m_hierarchy->blockSignals(true); // clear the whole thing (don't put this before blockSignals() else we have a bug in the skeletal LOD choosing, before also doesn't make any sense cause the OnNodesChanged() gets called and resets the selection!) - mHierarchy->clear(); + m_hierarchy->clear(); // get the number actor instances and iterate over them - for (const uint32 actorInstanceID : mActorInstanceIDs) + for (const uint32 actorInstanceID : m_actorInstanceIDs) { // get the actor instance by its id EMotionFX::ActorInstance* actorInstance = EMotionFX::GetActorManager().FindActorInstanceByID(actorInstanceID); @@ -197,7 +197,7 @@ namespace EMStudio } } - mHierarchy->blockSignals(false); + m_hierarchy->blockSignals(false); // after we refilled everything, update the selection UpdateSelection(); @@ -212,13 +212,13 @@ namespace EMStudio const size_t numNodes = actor->GetNumNodes(); // extract the bones from the actor - actor->ExtractBoneList(actorInstance->GetLODLevel(), &mBoneList); + actor->ExtractBoneList(actorInstance->GetLODLevel(), &m_boneList); // calculate the number of polygons and indices uint32 numPolygons, numVertices, numIndices; actor->CalcMeshTotals(actorInstance->GetLODLevel(), &numPolygons, &numVertices, &numIndices); - QTreeWidgetItem* rootItem = new QTreeWidgetItem(mHierarchy); + QTreeWidgetItem* rootItem = new QTreeWidgetItem(m_hierarchy); // select the item in case the actor if (CheckIfActorInstanceSelected(actorInstance->GetID())) @@ -232,11 +232,11 @@ namespace EMStudio rootItem->setText(3, AZStd::to_string(numIndices / 3).c_str()); rootItem->setText(4, ""); rootItem->setExpanded(true); - rootItem->setIcon(0, *mCharacterIcon); + rootItem->setIcon(0, *m_characterIcon); QString whatsthis = AZStd::to_string(actorInstance->GetID()).c_str(); rootItem->setWhatsThis(0, whatsthis); - mHierarchy->addTopLevelItem(rootItem); + m_hierarchy->addTopLevelItem(rootItem); // get the number of root nodes and iterate through them const size_t numRootNodes = actor->GetSkeleton()->GetNumRootNodes(); @@ -264,7 +264,7 @@ namespace EMStudio AZStd::to_lower(nodeName.begin(), nodeName.end()); EMotionFX::Mesh* mesh = actorInstance->GetActor()->GetMesh(actorInstance->GetLODLevel(), nodeIndex); const bool isMeshNode = (mesh); - const bool isBone = (AZStd::find(begin(mBoneList), end(mBoneList), nodeIndex) != end(mBoneList)); + const bool isBone = (AZStd::find(begin(m_boneList), end(m_boneList), nodeIndex) != end(m_boneList)); const bool isNode = (isMeshNode == false && isBone == false); return CheckIfNodeVisible(nodeName, isMeshNode, isBone, isNode); @@ -293,7 +293,7 @@ namespace EMStudio const size_t numChildren = node->GetNumChildNodes(); EMotionFX::Mesh* mesh = actor->GetMesh(actorInstance->GetLODLevel(), nodeIndex); const bool isMeshNode = (mesh); - const bool isBone = (AZStd::find(begin(mBoneList), end(mBoneList), nodeIndex) != end(mBoneList)); + const bool isBone = (AZStd::find(begin(m_boneList), end(m_boneList), nodeIndex) != end(m_boneList)); const bool isNode = (isMeshNode == false && isBone == false); if (CheckIfNodeVisible(nodeName, isMeshNode, isBone, isNode)) @@ -314,18 +314,18 @@ namespace EMStudio // set the correct icon and the type if (isMeshNode) { - item->setIcon(0, *mMeshIcon); + item->setIcon(0, *m_meshIcon); item->setText(1, "Mesh"); item->setText(3, QString::number(mesh->GetNumIndices() / 3)); } else if (isBone) { - item->setIcon(0, *mBoneIcon); + item->setIcon(0, *m_boneIcon); item->setText(1, "Bone"); } else if (isNode) { - item->setIcon(0, *mNodeIcon); + item->setIcon(0, *m_nodeIcon); item->setText(1, "Node"); } else @@ -336,13 +336,13 @@ namespace EMStudio // the mirrored node const bool hasMirrorInfo = actor->GetHasMirrorInfo(); - if (hasMirrorInfo == false || actor->GetNodeMirrorInfo(nodeIndex).mSourceNode == MCORE_INVALIDINDEX16 || actor->GetNodeMirrorInfo(nodeIndex).mSourceNode == nodeIndex) + if (hasMirrorInfo == false || actor->GetNodeMirrorInfo(nodeIndex).m_sourceNode == MCORE_INVALIDINDEX16 || actor->GetNodeMirrorInfo(nodeIndex).m_sourceNode == nodeIndex) { item->setText(4, ""); } else { - item->setText(4, actor->GetSkeleton()->GetNode(actor->GetNodeMirrorInfo(nodeIndex).mSourceNode)->GetName()); + item->setText(4, actor->GetSkeleton()->GetNode(actor->GetNodeMirrorInfo(nodeIndex).m_sourceNode)->GetName()); } parent->addChild(item); @@ -384,7 +384,7 @@ namespace EMStudio for (size_t i = 0; i < m_selectedNodes.size(); ) { // check if this is our node, if yes remove it - if (nodeNameID == m_selectedNodes[i].mNodeNameID && actorInstanceID == m_selectedNodes[i].mActorInstanceID) + if (nodeNameID == m_selectedNodes[i].m_nodeNameId && actorInstanceID == m_selectedNodes[i].m_actorInstanceId) { m_selectedNodes.erase(m_selectedNodes.begin() + i); //LOG("Removing: %s", nodeName); @@ -405,7 +405,7 @@ namespace EMStudio for (size_t i = 0; i < m_selectedNodes.size(); ) { // check if this is our node, if yes remove it - if (emptyStringID == m_selectedNodes[i].mNodeNameID && actorInstanceID == m_selectedNodes[i].mActorInstanceID) + if (emptyStringID == m_selectedNodes[i].m_nodeNameId && actorInstanceID == m_selectedNodes[i].m_actorInstanceId) { m_selectedNodes.erase(m_selectedNodes.begin() + i); //LOG("Removing: %s", nodeName); @@ -430,13 +430,13 @@ namespace EMStudio // Make sure this node is not already in our selection list for (const SelectionItem& selectedItem : m_selectedNodes) { - if (item.mNodeNameID == selectedItem.mNodeNameID && item.mActorInstanceID == selectedItem.mActorInstanceID) + if (item.m_nodeNameId == selectedItem.m_nodeNameId && item.m_actorInstanceId == selectedItem.m_actorInstanceId) { return; } } - if (mUseSingleSelection) + if (m_useSingleSelection) { m_selectedNodes.clear(); } @@ -452,9 +452,9 @@ namespace EMStudio if (item->isSelected() == false) { // get the actor instance id to which this item belongs to - mActorInstanceIDString = FromQtString(item->whatsThis(0)); + m_actorInstanceIdString = FromQtString(item->whatsThis(0)); int actorInstanceID; - const bool validConversion = AzFramework::StringFunc::LooksLikeInt(mActorInstanceIDString.c_str(), &actorInstanceID); + const bool validConversion = AzFramework::StringFunc::LooksLikeInt(m_actorInstanceIdString.c_str(), &actorInstanceID); MCORE_ASSERT(validConversion); // remove the node from the selected nodes @@ -480,24 +480,24 @@ namespace EMStudio void NodeHierarchyWidget::UpdateSelection() { // get the selected items and the number of them - QList selectedItems = mHierarchy->selectedItems(); + QList selectedItems = m_hierarchy->selectedItems(); // remove the unselected tree widget items from the selected nodes - const int numTopLevelItems = mHierarchy->topLevelItemCount(); + const int numTopLevelItems = m_hierarchy->topLevelItemCount(); for (int i = 0; i < numTopLevelItems; ++i) { - RecursiveRemoveUnselectedItems(mHierarchy->topLevelItem(i)); + RecursiveRemoveUnselectedItems(m_hierarchy->topLevelItem(i)); } // iterate through all selected items for (const QTreeWidgetItem* item : selectedItems) { // get the item name - FromQtString(item->text(0), &mItemName); - FromQtString(item->whatsThis(0), &mActorInstanceIDString); + FromQtString(item->text(0), &m_itemName); + FromQtString(item->whatsThis(0), &m_actorInstanceIdString); int actorInstanceID; - const bool validConversion = AzFramework::StringFunc::LooksLikeInt(mActorInstanceIDString.c_str(), &actorInstanceID); + const bool validConversion = AzFramework::StringFunc::LooksLikeInt(m_actorInstanceIdString.c_str(), &actorInstanceID); MCORE_ASSERT(validConversion); EMotionFX::ActorInstance* actorInstance = EMotionFX::GetActorManager().FindActorInstanceByID(actorInstanceID); @@ -509,9 +509,9 @@ namespace EMStudio // check if the item name is actually a valid node EMotionFX::Actor* actor = actorInstance->GetActor(); - if (actor->GetSkeleton()->FindNodeByName(mItemName.c_str())) + if (actor->GetSkeleton()->FindNodeByName(m_itemName.c_str())) { - AddNodeToSelectedNodes(mItemName.c_str(), actorInstanceID); + AddNodeToSelectedNodes(m_itemName.c_str(), actorInstanceID); } // check if we are dealing with an actor instance @@ -528,14 +528,14 @@ namespace EMStudio { if (useSingleSelection) { - mHierarchy->setSelectionMode(QAbstractItemView::SingleSelection); + m_hierarchy->setSelectionMode(QAbstractItemView::SingleSelection); } else { - mHierarchy->setSelectionMode(QAbstractItemView::ExtendedSelection); + m_hierarchy->setSelectionMode(QAbstractItemView::ExtendedSelection); } - mUseSingleSelection = useSingleSelection; + m_useSingleSelection = useSingleSelection; } @@ -571,7 +571,7 @@ namespace EMStudio menu.addAction("Add all towards root to selection"); AZStd::vector itemsToAdd; - if (menu.exec(mHierarchy->mapToGlobal(pos))) + if (menu.exec(m_hierarchy->mapToGlobal(pos))) { // Collect the list of items to select. Actual adding to the // selection has to happen in a separate loop so that the iterators @@ -581,7 +581,7 @@ namespace EMStudio // Ensure the actor instance is still valid before looking at // its skeleton const EMotionFX::ActorInstance* actorInstance = - EMotionFX::GetActorManager().FindActorInstanceByID(selectedItem.mActorInstanceID); + EMotionFX::GetActorManager().FindActorInstanceByID(selectedItem.m_actorInstanceId); if (!actorInstance) { continue; @@ -592,7 +592,7 @@ namespace EMStudio actorInstance->GetActor()->GetSkeleton()->FindNodeByName(selectedItem.GetNodeName()); for(; parentNode; parentNode = parentNode->GetParentNode()) { - itemsToAdd.emplace_back(selectedItem.mActorInstanceID, parentNode->GetName()); + itemsToAdd.emplace_back(selectedItem.m_actorInstanceId, parentNode->GetName()); } } @@ -607,7 +607,6 @@ namespace EMStudio void NodeHierarchyWidget::OnTextFilterChanged(const QString& text) { - //mFindString = String(text.toAscii().data()).Lowered(); FromQtString(text, &m_searchWidgetText); AZStd::to_lower(m_searchWidgetText.begin(), m_searchWidgetText.end()); Update(); @@ -632,7 +631,7 @@ namespace EMStudio { return AZStd::any_of(begin(m_selectedNodes), end(m_selectedNodes), [nodeName, actorInstanceID](const SelectionItem& selectedItem) { - return selectedItem.mActorInstanceID == actorInstanceID && selectedItem.GetNodeNameString() == nodeName; + return selectedItem.m_actorInstanceId == actorInstanceID && selectedItem.GetNodeNameString() == nodeName; }); } @@ -642,7 +641,7 @@ namespace EMStudio { return AZStd::any_of(begin(m_selectedNodes), end(m_selectedNodes), [actorInstanceID](const SelectionItem& selectedItem) { - return selectedItem.mActorInstanceID == actorInstanceID && selectedItem.GetNodeNameString().empty(); + return selectedItem.m_actorInstanceId == actorInstanceID && selectedItem.GetNodeNameString().empty(); }); } @@ -659,7 +658,7 @@ namespace EMStudio m_selectedNodes.clear(); // get the number actor instances and iterate over them - for (const uint32 actorInstanceID : mActorInstanceIDs) + for (const uint32 actorInstanceID : m_actorInstanceIDs) { // add the actor to the node hierarchy widget // get the number of selected nodes and iterate through them @@ -670,7 +669,7 @@ namespace EMStudio if (joint) { SelectionItem selectionItem; - selectionItem.mActorInstanceID = actorInstanceID; + selectionItem.m_actorInstanceId = actorInstanceID; selectionItem.SetNodeName(joint->GetName()); m_selectedNodes.emplace_back(selectionItem); } @@ -681,19 +680,19 @@ namespace EMStudio bool NodeHierarchyWidget::GetDisplayMeshes() const { - return mFilterState.testFlag(FilterType::Meshes); + return m_filterState.testFlag(FilterType::Meshes); } bool NodeHierarchyWidget::GetDisplayNodes() const { - return mFilterState.testFlag(FilterType::Nodes); + return m_filterState.testFlag(FilterType::Nodes); } bool NodeHierarchyWidget::GetDisplayBones() const { - return mFilterState.testFlag(FilterType::Bones); + return m_filterState.testFlag(FilterType::Bones); } } // namespace EMStudio diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/NodeHierarchyWidget.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/NodeHierarchyWidget.h index e4dd215819..c566be6005 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/NodeHierarchyWidget.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/NodeHierarchyWidget.h @@ -30,26 +30,26 @@ namespace AzQtComponents struct EMSTUDIO_API SelectionItem { - uint32 mActorInstanceID; - uint32 mNodeNameID; - uint32 mMorphTargetID; + uint32 m_actorInstanceId; + uint32 m_nodeNameId; + uint32 m_morphTargetId; SelectionItem() { - mActorInstanceID = MCORE_INVALIDINDEX32; - mNodeNameID = MCORE_INVALIDINDEX32; - mMorphTargetID = MCORE_INVALIDINDEX32; + m_actorInstanceId = MCORE_INVALIDINDEX32; + m_nodeNameId = MCORE_INVALIDINDEX32; + m_morphTargetId = MCORE_INVALIDINDEX32; } SelectionItem(const uint32 actorInstanceID, const char* nodeName, const uint32 morphTargetID = MCORE_INVALIDINDEX32) - : mActorInstanceID(actorInstanceID), mMorphTargetID(morphTargetID) + : m_actorInstanceId(actorInstanceID), m_morphTargetId(morphTargetID) { SetNodeName(nodeName); } - void SetNodeName(const char* nodeName) { mNodeNameID = MCore::GetStringIdPool().GenerateIdForString(nodeName); } - const char* GetNodeName() const { return MCore::GetStringIdPool().GetName(mNodeNameID).c_str(); } - const AZStd::string& GetNodeNameString() const { return MCore::GetStringIdPool().GetName(mNodeNameID); } + void SetNodeName(const char* nodeName) { m_nodeNameId = MCore::GetStringIdPool().GenerateIdForString(nodeName); } + const char* GetNodeName() const { return MCore::GetStringIdPool().GetName(m_nodeNameId).c_str(); } + const AZStd::string& GetNodeNameString() const { return MCore::GetStringIdPool().GetName(m_nodeNameId); } EMotionFX::Node* GetNode() const; }; @@ -70,7 +70,7 @@ namespace EMStudio void Update(uint32 actorInstanceID, CommandSystem::SelectionList* selectionList = nullptr); void Update(const AZStd::vector& actorInstanceIDs, CommandSystem::SelectionList* selectionList = nullptr); void FireSelectionDoneSignal(); - MCORE_INLINE QTreeWidget* GetTreeWidget() { return mHierarchy; } + MCORE_INLINE QTreeWidget* GetTreeWidget() { return m_hierarchy; } MCORE_INLINE AzQtComponents::FilteredSearchWidget* GetSearchWidget() { return m_searchWidget; } // is node shown in the hierarchy widget? @@ -126,18 +126,18 @@ namespace EMStudio void RecursiveRemoveUnselectedItems(QTreeWidgetItem* item); AZStd::vector m_selectedNodes; - QTreeWidget* mHierarchy; + QTreeWidget* m_hierarchy; AzQtComponents::FilteredSearchWidget* m_searchWidget; AZStd::string m_searchWidgetText; - QIcon* mBoneIcon; - QIcon* mNodeIcon; - QIcon* mMeshIcon; - QIcon* mCharacterIcon; - AZStd::vector mBoneList; - AZStd::vector mActorInstanceIDs; - AZStd::string mItemName; - AZStd::string mActorInstanceIDString; - bool mUseSingleSelection; - FilterTypes mFilterState; + QIcon* m_boneIcon; + QIcon* m_nodeIcon; + QIcon* m_meshIcon; + QIcon* m_characterIcon; + AZStd::vector m_boneList; + AZStd::vector m_actorInstanceIDs; + AZStd::string m_itemName; + AZStd::string m_actorInstanceIdString; + bool m_useSingleSelection; + FilterTypes m_filterState; }; } // namespace EMStudio diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/NodeSelectionWindow.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/NodeSelectionWindow.cpp index e0d562ee0f..3458a44de1 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/NodeSelectionWindow.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/NodeSelectionWindow.cpp @@ -28,35 +28,35 @@ namespace EMStudio NodeSelectionWindow::NodeSelectionWindow(QWidget* parent, bool useSingleSelection) : QDialog(parent) { - mAccepted = false; + m_accepted = false; setWindowTitle("Node Selection Window"); QVBoxLayout* layout = new QVBoxLayout(); - mHierarchyWidget = new NodeHierarchyWidget(this, useSingleSelection); + m_hierarchyWidget = new NodeHierarchyWidget(this, useSingleSelection); // create the ok and cancel buttons QHBoxLayout* buttonLayout = new QHBoxLayout(); - mOKButton = new QPushButton("OK"); - mCancelButton = new QPushButton("Cancel"); - buttonLayout->addWidget(mOKButton); - buttonLayout->addWidget(mCancelButton); + m_okButton = new QPushButton("OK"); + m_cancelButton = new QPushButton("Cancel"); + buttonLayout->addWidget(m_okButton); + buttonLayout->addWidget(m_cancelButton); - layout->addWidget(mHierarchyWidget); + layout->addWidget(m_hierarchyWidget); layout->addLayout(buttonLayout); setLayout(layout); - connect(mOKButton, &QPushButton::clicked, this, &NodeSelectionWindow::accept); - connect(mCancelButton, &QPushButton::clicked, this, &NodeSelectionWindow::reject); + connect(m_okButton, &QPushButton::clicked, this, &NodeSelectionWindow::accept); + connect(m_cancelButton, &QPushButton::clicked, this, &NodeSelectionWindow::reject); connect(this, &NodeSelectionWindow::accepted, this, &NodeSelectionWindow::OnAccept); - connect(mHierarchyWidget, static_cast)>(&NodeHierarchyWidget::OnDoubleClicked), this, &NodeSelectionWindow::OnDoubleClicked); + connect(m_hierarchyWidget, static_cast)>(&NodeHierarchyWidget::OnDoubleClicked), this, &NodeSelectionWindow::OnDoubleClicked); // connect the window activation signal to refresh if reactivated //connect( this, SIGNAL(visibilityChanged(bool)), this, SLOT(OnVisibilityChanged(bool)) ); // set the selection mode - mHierarchyWidget->SetSelectionMode(useSingleSelection); - mUseSingleSelection = useSingleSelection; + m_hierarchyWidget->SetSelectionMode(useSingleSelection); + m_useSingleSelection = useSingleSelection; setMinimumSize(QSize(500, 400)); resize(700, 800); @@ -72,7 +72,7 @@ namespace EMStudio void NodeSelectionWindow::OnAccept() { - mHierarchyWidget->FireSelectionDoneSignal(); + m_hierarchyWidget->FireSelectionDoneSignal(); } } // namespace EMStudio diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/NodeSelectionWindow.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/NodeSelectionWindow.h index 46eabf7b58..df6f0195bc 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/NodeSelectionWindow.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/NodeSelectionWindow.h @@ -28,9 +28,9 @@ namespace EMStudio * 2. Use the itemSelectionChanged() signal of the GetNodeHierarchyWidget()->GetTreeWidget() to detect when the user adjusts the selection in the node hierarchy widget. * 3. Use the OnSelectionDone() in the GetNodeHierarchyWidget() to detect when the user finished selecting and pressed the OK button. * Example: - * connect( mNodeSelectionWindow, SIGNAL(rejected()), this, SLOT(UserWantsToCancel_1()) ); - * connect( mNodeSelectionWindow->GetNodeHierarchyWidget()->GetTreeWidget(), SIGNAL(itemSelectionChanged()), this, SLOT(SelectionChanged_2()) ); - * connect( mNodeSelectionWindow->GetNodeHierarchyWidget(), SIGNAL(OnSelectionDone(AZStd::vector)), this, SLOT(FinishedSelectionAndPressedOK_3(AZStd::vector)) ); + * connect( m_nodeSelectionWindow, SIGNAL(rejected()), this, SLOT(UserWantsToCancel_1()) ); + * connect( m_nodeSelectionWindow->GetNodeHierarchyWidget()->GetTreeWidget(), SIGNAL(itemSelectionChanged()), this, SLOT(SelectionChanged_2()) ); + * connect( m_nodeSelectionWindow->GetNodeHierarchyWidget(), SIGNAL(OnSelectionDone(AZStd::vector)), this, SLOT(FinishedSelectionAndPressedOK_3(AZStd::vector)) ); */ class EMSTUDIO_API NodeSelectionWindow : public QDialog @@ -41,20 +41,20 @@ namespace EMStudio public: NodeSelectionWindow(QWidget* parent, bool useSingleSelection); - MCORE_INLINE NodeHierarchyWidget* GetNodeHierarchyWidget() { return mHierarchyWidget; } - void Update(uint32 actorInstanceID, CommandSystem::SelectionList* selectionList = nullptr) { mHierarchyWidget->Update(actorInstanceID, selectionList); } - void Update(const AZStd::vector& actorInstanceIDs, CommandSystem::SelectionList* selectionList = nullptr) { mHierarchyWidget->Update(actorInstanceIDs, selectionList); } + MCORE_INLINE NodeHierarchyWidget* GetNodeHierarchyWidget() { return m_hierarchyWidget; } + void Update(uint32 actorInstanceID, CommandSystem::SelectionList* selectionList = nullptr) { m_hierarchyWidget->Update(actorInstanceID, selectionList); } + void Update(const AZStd::vector& actorInstanceIDs, CommandSystem::SelectionList* selectionList = nullptr) { m_hierarchyWidget->Update(actorInstanceIDs, selectionList); } public slots: void OnAccept(); void OnDoubleClicked(AZStd::vector selection); private: - NodeHierarchyWidget* mHierarchyWidget; - QPushButton* mOKButton; - QPushButton* mCancelButton; - bool mUseSingleSelection; - bool mAccepted; + NodeHierarchyWidget* m_hierarchyWidget; + QPushButton* m_okButton; + QPushButton* m_cancelButton; + bool m_useSingleSelection; + bool m_accepted; }; } // namespace EMStudio diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/NotificationWindow.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/NotificationWindow.cpp index c1316878c8..0b277c6195 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/NotificationWindow.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/NotificationWindow.cpp @@ -22,7 +22,7 @@ namespace EMStudio : QWidget(parent) { // set the opacity - mOpacity = 210; + m_opacity = 210; // set the window title setWindowTitle("Notification"); @@ -40,42 +40,42 @@ namespace EMStudio setFixedWidth(300); // create the icon - mIcon = new QToolButton(); - mIcon->setObjectName("NotificationIcon"); - mIcon->setStyleSheet("#NotificationIcon{ background-color: transparent; border: none; }"); - mIcon->setIconSize(QSize(22, 22)); - mIcon->setFocusPolicy(Qt::NoFocus); + m_icon = new QToolButton(); + m_icon->setObjectName("NotificationIcon"); + m_icon->setStyleSheet("#NotificationIcon{ background-color: transparent; border: none; }"); + m_icon->setIconSize(QSize(22, 22)); + m_icon->setFocusPolicy(Qt::NoFocus); if (type == TYPE_ERROR) { - mIcon->setIcon(MysticQt::GetMysticQt()->FindIcon("Images/Icons/ExclamationMark.svg")); + m_icon->setIcon(MysticQt::GetMysticQt()->FindIcon("Images/Icons/ExclamationMark.svg")); } else if (type == TYPE_WARNING) { - mIcon->setIcon(MysticQt::GetMysticQt()->FindIcon("Images/Icons/Warning.svg")); + m_icon->setIcon(MysticQt::GetMysticQt()->FindIcon("Images/Icons/Warning.svg")); } else if (type == TYPE_SUCCESS) { - mIcon->setIcon(MysticQt::GetMysticQt()->FindIcon("Images/Icons/Confirm.svg")); + m_icon->setIcon(MysticQt::GetMysticQt()->FindIcon("Images/Icons/Confirm.svg")); } - connect(mIcon, &QToolButton::pressed, this, &NotificationWindow::IconPressed); + connect(m_icon, &QToolButton::pressed, this, &NotificationWindow::IconPressed); // create the message label - mMessageLabel = new QLabel(Message); - mMessageLabel->setWordWrap(true); + m_messageLabel = new QLabel(Message); + m_messageLabel->setWordWrap(true); // create the layout QHBoxLayout* layout = new QHBoxLayout(); - layout->addWidget(mIcon); - layout->addWidget(mMessageLabel); + layout->addWidget(m_icon); + layout->addWidget(m_messageLabel); // set the layout setLayout(layout); // start the timer - mTimer = new QTimer(this); - mTimer->setSingleShot(true); - connect(mTimer, &QTimer::timeout, this, &NotificationWindow::TimerTimeOut); - mTimer->start(GetNotificationWindowManager()->GetVisibleTime() * 1000); + m_timer = new QTimer(this); + m_timer->setSingleShot(true); + connect(m_timer, &QTimer::timeout, this, &NotificationWindow::TimerTimeOut); + m_timer->start(GetNotificationWindowManager()->GetVisibleTime() * 1000); } NotificationWindow::~NotificationWindow() @@ -91,7 +91,7 @@ namespace EMStudio MCORE_UNUSED(event); QPainter p(this); p.setPen(Qt::transparent); - p.setBrush(QColor(0, 0, 0, mOpacity)); + p.setBrush(QColor(0, 0, 0, m_opacity)); p.setRenderHint(QPainter::Antialiasing); p.drawRoundedRect(rect(), 10, 10); } @@ -109,13 +109,13 @@ namespace EMStudio void NotificationWindow::mousePressEvent(QMouseEvent* event) { // we only want the left button, stop here if the timer is not active too - if ((mTimer->isActive() == false) || (event->button() != Qt::LeftButton)) + if ((m_timer->isActive() == false) || (event->button() != Qt::LeftButton)) { return; } // stop the timer because the event will be called before - mTimer->stop(); + m_timer->stop(); // call the timer time out function TimerTimeOut(); @@ -126,13 +126,13 @@ namespace EMStudio void NotificationWindow::IconPressed() { // stop here if the timer is not active - if (mTimer->isActive() == false) + if (m_timer->isActive() == false) { return; } // stop the timer because the event will be called before - mTimer->stop(); + m_timer->stop(); // call the timer time out function TimerTimeOut(); @@ -144,24 +144,24 @@ namespace EMStudio { // create the opacity effect and set it on the icon QGraphicsOpacityEffect* iconOpacityEffect = new QGraphicsOpacityEffect(this); - mIcon->setGraphicsEffect(iconOpacityEffect); + m_icon->setGraphicsEffect(iconOpacityEffect); // create the property animation to control the property value QPropertyAnimation* iconPropertyAnimation = new QPropertyAnimation(iconOpacityEffect, "opacity"); iconPropertyAnimation->setDuration(500); - iconPropertyAnimation->setStartValue((double)mOpacity / 255.0); + iconPropertyAnimation->setStartValue((double)m_opacity / 255.0); iconPropertyAnimation->setEndValue(0.0); iconPropertyAnimation->setEasingCurve(QEasingCurve::Linear); iconPropertyAnimation->start(QPropertyAnimation::DeleteWhenStopped); // create the opacity effect and set it on the label QGraphicsOpacityEffect* labelOpacityEffect = new QGraphicsOpacityEffect(this); - mMessageLabel->setGraphicsEffect(labelOpacityEffect); + m_messageLabel->setGraphicsEffect(labelOpacityEffect); // create the property animation to control the property value QPropertyAnimation* labelPropertyAnimation = new QPropertyAnimation(labelOpacityEffect, "opacity"); labelPropertyAnimation->setDuration(500); - labelPropertyAnimation->setStartValue((double)mOpacity / 255.0); + labelPropertyAnimation->setStartValue((double)m_opacity / 255.0); labelPropertyAnimation->setEndValue(0.0); labelPropertyAnimation->setEasingCurve(QEasingCurve::Linear); labelPropertyAnimation->start(QPropertyAnimation::DeleteWhenStopped); @@ -176,7 +176,7 @@ namespace EMStudio void NotificationWindow::OpacityChanged(qreal opacity) { // set the new opacity for the paint of the window - mOpacity = aznumeric_cast(opacity * 255); + m_opacity = aznumeric_cast(opacity * 255); // update the window update(); diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/NotificationWindow.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/NotificationWindow.h index b4dfb70ef1..72a53cafdf 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/NotificationWindow.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/NotificationWindow.h @@ -50,9 +50,9 @@ namespace EMStudio void FadeOutFinished(); private: - QLabel* mMessageLabel; - QToolButton* mIcon; - QTimer* mTimer; - int mOpacity; + QLabel* m_messageLabel; + QToolButton* m_icon; + QTimer* m_timer; + int m_opacity; }; } // namespace EMStudio diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/NotificationWindowManager.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/NotificationWindowManager.cpp index e1c22ee60d..8b651314ca 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/NotificationWindowManager.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/NotificationWindowManager.cpp @@ -33,7 +33,7 @@ namespace EMStudio // compute the height of all notification windows with the spacing int allNotificationWindowsHeight = 0; - for (const NotificationWindow* currentNotificationWindow : mNotificationWindows) + for (const NotificationWindow* currentNotificationWindow : m_notificationWindows) { allNotificationWindowsHeight += currentNotificationWindow->geometry().height() + notificationWindowSpacing; } @@ -44,7 +44,7 @@ namespace EMStudio notificationWindow->move(mainWindowBottomRight.x() - notificationWindowGeometry.width() - notificationWindowMainWindowPadding, mainWindowBottomRight.y() - allNotificationWindowsHeight - notificationWindowGeometry.height() - notificationWindowMainWindowPadding); // add the notification window in the array - mNotificationWindows.emplace_back(notificationWindow); + m_notificationWindows.emplace_back(notificationWindow); } @@ -52,24 +52,24 @@ namespace EMStudio void NotificationWindowManager::RemoveNotificationWindow(NotificationWindow* notificationWindow) { // find the notification window - auto windowIt = AZStd::find(begin(mNotificationWindows), end(mNotificationWindows), notificationWindow); + auto windowIt = AZStd::find(begin(m_notificationWindows), end(m_notificationWindows), notificationWindow); // if not found, stop here - if (windowIt == end(mNotificationWindows)) + if (windowIt == end(m_notificationWindows)) { return; } // move down each notification window after this one, spacing is added on the height const int notificationWindowHeight = notificationWindow->geometry().height() + notificationWindowSpacing; - for (auto it = windowIt + 1; it != end(mNotificationWindows); ++it) + for (auto it = windowIt + 1; it != end(m_notificationWindows); ++it) { const QPoint pos = (*it)->pos(); (*it)->move(pos.x(), pos.y() + notificationWindowHeight); } // remove the notification window - mNotificationWindows.erase(windowIt); + m_notificationWindows.erase(windowIt); } @@ -81,7 +81,7 @@ namespace EMStudio // move each notification window int currentNotificationWindowHeight = notificationWindowMainWindowPadding; - for (NotificationWindow* notificationWindow : mNotificationWindows) + for (NotificationWindow* notificationWindow : m_notificationWindows) { // add the height of the notification window currentNotificationWindowHeight += notificationWindow->geometry().height(); diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/NotificationWindowManager.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/NotificationWindowManager.h index 8817f3d451..4724b4ba54 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/NotificationWindowManager.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/NotificationWindowManager.h @@ -24,7 +24,7 @@ namespace EMStudio public: MCORE_INLINE NotificationWindowManager() { - mVisibleTime = 5; + m_visibleTime = 5; } void CreateNotificationWindow(NotificationWindow::EType type, const QString& message); @@ -32,28 +32,28 @@ namespace EMStudio MCORE_INLINE NotificationWindow* GetNotificationWindow(uint32 index) const { - return mNotificationWindows[index]; + return m_notificationWindows[index]; } MCORE_INLINE size_t GetNumNotificationWindow() const { - return mNotificationWindows.size(); + return m_notificationWindows.size(); } void OnMovedOrResized(); MCORE_INLINE void SetVisibleTime(int32 timeSeconds) { - mVisibleTime = timeSeconds; + m_visibleTime = timeSeconds; } MCORE_INLINE int32 GetVisibleTime() const { - return mVisibleTime; + return m_visibleTime; } private: - AZStd::vector mNotificationWindows; - int32 mVisibleTime; + AZStd::vector m_notificationWindows; + int32 m_visibleTime; }; } // namespace EMStudio diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/PluginManager.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/PluginManager.cpp index d0e8730e52..fde4336a49 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/PluginManager.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/PluginManager.cpp @@ -34,8 +34,8 @@ namespace EMStudio // constructor PluginManager::PluginManager() { - mActivePlugins.reserve(50); - mPlugins.reserve(50); + m_activePlugins.reserve(50); + m_plugins.reserve(50); } @@ -50,19 +50,19 @@ namespace EMStudio // remove a given active plugin void PluginManager::RemoveActivePlugin(EMStudioPlugin* plugin) { - PluginVector::const_iterator itPlugin = AZStd::find(mActivePlugins.begin(), mActivePlugins.end(), plugin); - if (itPlugin == mActivePlugins.end()) + PluginVector::const_iterator itPlugin = AZStd::find(m_activePlugins.begin(), m_activePlugins.end(), plugin); + if (itPlugin == m_activePlugins.end()) { MCore::LogWarning("Failed to remove plugin '%s'", plugin->GetName()); return; } - for (EMStudioPlugin* activePlugin : mActivePlugins) + for (EMStudioPlugin* activePlugin : m_activePlugins) { activePlugin->OnBeforeRemovePlugin(plugin->GetClassID()); } - mActivePlugins.erase(itPlugin); + m_activePlugins.erase(itPlugin); delete plugin; } @@ -74,22 +74,22 @@ namespace EMStudio QApplication::processEvents(); // delete all plugins - for (EMStudioPlugin* plugin : mPlugins) + for (EMStudioPlugin* plugin : m_plugins) { delete plugin; } - mPlugins.clear(); + m_plugins.clear(); // delete all active plugins - for (auto plugin = mActivePlugins.rbegin(); plugin != mActivePlugins.rend(); ++plugin) + for (auto plugin = m_activePlugins.rbegin(); plugin != m_activePlugins.rend(); ++plugin) { - for (EMStudioPlugin* pluginToNotify : mActivePlugins) + for (EMStudioPlugin* pluginToNotify : m_activePlugins) { pluginToNotify->OnBeforeRemovePlugin((*plugin)->GetClassID()); } delete *plugin; - mActivePlugins.pop_back(); + m_activePlugins.pop_back(); } } @@ -97,7 +97,7 @@ namespace EMStudio // register the plugin void PluginManager::RegisterPlugin(EMStudioPlugin* plugin) { - mPlugins.push_back(plugin); + m_plugins.push_back(plugin); } @@ -112,7 +112,7 @@ namespace EMStudio } // create the new plugin of this type - EMStudioPlugin* newPlugin = mPlugins[ pluginIndex ]->Clone(); + EMStudioPlugin* newPlugin = m_plugins[ pluginIndex ]->Clone(); // init the plugin newPlugin->CreateBaseInterface(objectName); @@ -120,7 +120,7 @@ namespace EMStudio // register as active plugin. This has to be done at this point since // the initialization could try to access the plugin and assume that // is active. - mActivePlugins.push_back(newPlugin); + m_activePlugins.push_back(newPlugin); newPlugin->Init(); @@ -131,20 +131,20 @@ namespace EMStudio // find a given plugin by its name (type string) size_t PluginManager::FindPluginByTypeString(const char* pluginType) const { - const auto foundPlugin = AZStd::find_if(begin(mPlugins), end(mPlugins), [pluginType](const EMStudioPlugin* plugin) + const auto foundPlugin = AZStd::find_if(begin(m_plugins), end(m_plugins), [pluginType](const EMStudioPlugin* plugin) { return AzFramework::StringFunc::Equal(pluginType, plugin->GetName()); }); - return foundPlugin != end(mPlugins) ? AZStd::distance(begin(mPlugins), foundPlugin) : InvalidIndex; + return foundPlugin != end(m_plugins) ? AZStd::distance(begin(m_plugins), foundPlugin) : InvalidIndex; } EMStudioPlugin* PluginManager::GetActivePluginByTypeString(const char* pluginType) const { - const auto foundPlugin = AZStd::find_if(begin(mActivePlugins), end(mActivePlugins), [pluginType](const EMStudioPlugin* plugin) + const auto foundPlugin = AZStd::find_if(begin(m_activePlugins), end(m_activePlugins), [pluginType](const EMStudioPlugin* plugin) { return AzFramework::StringFunc::Equal(pluginType, plugin->GetName()); }); - return foundPlugin != end(mActivePlugins) ? *foundPlugin : nullptr; + return foundPlugin != end(m_activePlugins) ? *foundPlugin : nullptr; } // generate a unique object name @@ -166,7 +166,7 @@ namespace EMStudio ); // check if we have a conflict with a current plugin - const bool hasConflict = AZStd::any_of(begin(mActivePlugins), end(mActivePlugins), [&randomString](EMStudioPlugin* plugin) + const bool hasConflict = AZStd::any_of(begin(m_activePlugins), end(m_activePlugins), [&randomString](EMStudioPlugin* plugin) { return plugin->GetHasWindowWithObjectName(randomString); }); @@ -181,7 +181,7 @@ namespace EMStudio // find the number of active plugins of a given type size_t PluginManager::GetNumActivePluginsOfType(const char* pluginType) const { - return AZStd::accumulate(mActivePlugins.begin(), mActivePlugins.end(), size_t{0}, [pluginType](size_t total, const EMStudioPlugin* plugin) + return AZStd::accumulate(m_activePlugins.begin(), m_activePlugins.end(), size_t{0}, [pluginType](size_t total, const EMStudioPlugin* plugin) { return total + AzFramework::StringFunc::Equal(pluginType, plugin->GetName()); }); @@ -191,11 +191,11 @@ namespace EMStudio // find the first active plugin of a given type EMStudioPlugin* PluginManager::FindActivePlugin(uint32 classID) const { - const auto foundPlugin = AZStd::find_if(begin(mActivePlugins), end(mActivePlugins), [classID](const EMStudioPlugin* plugin) + const auto foundPlugin = AZStd::find_if(begin(m_activePlugins), end(m_activePlugins), [classID](const EMStudioPlugin* plugin) { return plugin->GetClassID() == classID; }); - return foundPlugin != end(mActivePlugins) ? *foundPlugin : nullptr; + return foundPlugin != end(m_activePlugins) ? *foundPlugin : nullptr; } @@ -203,7 +203,7 @@ namespace EMStudio // find the number of active plugins of a given type size_t PluginManager::GetNumActivePluginsOfType(uint32 classID) const { - return AZStd::accumulate(mActivePlugins.begin(), mActivePlugins.end(), size_t{0}, [classID](size_t total, const EMStudioPlugin* plugin) + return AZStd::accumulate(m_activePlugins.begin(), m_activePlugins.end(), size_t{0}, [classID](size_t total, const EMStudioPlugin* plugin) { return total + (plugin->GetClassID() == classID); }); diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/PluginManager.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/PluginManager.h index 2937c3b387..e3a5f9627a 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/PluginManager.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/PluginManager.h @@ -47,12 +47,12 @@ namespace EMStudio } EMStudioPlugin* FindActivePlugin(uint32 classID) const; // find first active plugin, or nullptr when not found - MCORE_INLINE size_t GetNumPlugins() const { return mPlugins.size(); } - MCORE_INLINE EMStudioPlugin* GetPlugin(const size_t index) { return mPlugins[index]; } + MCORE_INLINE size_t GetNumPlugins() const { return m_plugins.size(); } + MCORE_INLINE EMStudioPlugin* GetPlugin(const size_t index) { return m_plugins[index]; } - MCORE_INLINE size_t GetNumActivePlugins() const { return mActivePlugins.size(); } - MCORE_INLINE EMStudioPlugin* GetActivePlugin(const size_t index) { return mActivePlugins[index]; } - MCORE_INLINE const PluginVector& GetActivePlugins() { return mActivePlugins; } + MCORE_INLINE size_t GetNumActivePlugins() const { return m_activePlugins.size(); } + MCORE_INLINE EMStudioPlugin* GetActivePlugin(const size_t index) { return m_activePlugins[index]; } + MCORE_INLINE const PluginVector& GetActivePlugins() { return m_activePlugins; } size_t GetNumActivePluginsOfType(const char* pluginType) const; size_t GetNumActivePluginsOfType(uint32 classID) const; @@ -61,9 +61,9 @@ namespace EMStudio QString GenerateObjectName() const; private: - PluginVector mPlugins; + PluginVector m_plugins; - PluginVector mActivePlugins; + PluginVector m_activePlugins; void UnloadPlugins(); }; diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/RecoverFilesWindow.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/RecoverFilesWindow.cpp index 3c2fe98e06..04104e4acd 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/RecoverFilesWindow.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/RecoverFilesWindow.cpp @@ -25,7 +25,7 @@ namespace EMStudio RecoverFilesWindow::RecoverFilesWindow(QWidget* parent, const AZStd::vector& files) : QDialog(parent) { - mFiles = files; + m_files = files; // Update title of the dialog. setWindowTitle("Recover Files"); @@ -39,43 +39,43 @@ namespace EMStudio layout->addWidget(new QLabel("Some files have been corrupted but can be restored. The following files can be recovered:")); // Create the table widget. - mTableWidget = new QTableWidget(); - mTableWidget->setAlternatingRowColors(true); - mTableWidget->setSelectionMode(QAbstractItemView::NoSelection); - mTableWidget->setEditTriggers(QAbstractItemView::NoEditTriggers); - mTableWidget->setMinimumHeight(250); - mTableWidget->setMinimumWidth(600); - mTableWidget->horizontalHeader()->setStretchLastSection(true); - mTableWidget->setCornerButtonEnabled(false); - mTableWidget->setSortingEnabled(false); + m_tableWidget = new QTableWidget(); + m_tableWidget->setAlternatingRowColors(true); + m_tableWidget->setSelectionMode(QAbstractItemView::NoSelection); + m_tableWidget->setEditTriggers(QAbstractItemView::NoEditTriggers); + m_tableWidget->setMinimumHeight(250); + m_tableWidget->setMinimumWidth(600); + m_tableWidget->horizontalHeader()->setStretchLastSection(true); + m_tableWidget->setCornerButtonEnabled(false); + m_tableWidget->setSortingEnabled(false); - mTableWidget->setColumnCount(3); + m_tableWidget->setColumnCount(3); // Set the header items. QTableWidgetItem* headerItem = new QTableWidgetItem(""); headerItem->setTextAlignment(Qt::AlignVCenter | Qt::AlignLeft); - mTableWidget->setHorizontalHeaderItem(0, headerItem); + m_tableWidget->setHorizontalHeaderItem(0, headerItem); headerItem = new QTableWidgetItem("Filename"); headerItem->setTextAlignment(Qt::AlignVCenter | Qt::AlignLeft); - mTableWidget->setHorizontalHeaderItem(1, headerItem); + m_tableWidget->setHorizontalHeaderItem(1, headerItem); headerItem = new QTableWidgetItem("Type"); headerItem->setTextAlignment(Qt::AlignVCenter | Qt::AlignLeft); - mTableWidget->setHorizontalHeaderItem(2, headerItem); + m_tableWidget->setHorizontalHeaderItem(2, headerItem); // Set the horizontal header params. - QHeaderView* horizontalHeader = mTableWidget->horizontalHeader(); + QHeaderView* horizontalHeader = m_tableWidget->horizontalHeader(); horizontalHeader->setSectionResizeMode(0, QHeaderView::Fixed); horizontalHeader->setStretchLastSection(true); - mTableWidget->verticalHeader()->hide(); + m_tableWidget->verticalHeader()->hide(); // Set the left column smaller to only fits the checkbox. - mTableWidget->horizontalHeader()->resizeSection(0, 19); + m_tableWidget->horizontalHeader()->resizeSection(0, 19); // Set the row count. const size_t numFiles = files.size(); const int rowCount = static_cast(numFiles); - mTableWidget->setRowCount(rowCount); + m_tableWidget->setRowCount(rowCount); // For each file that might be recovered. AZStd::string backupFilename; @@ -170,22 +170,22 @@ namespace EMStudio itemType->setData(Qt::UserRole, row); // Add table items to the current row. - mTableWidget->setCellWidget(row, 0, checkbox); - mTableWidget->setCellWidget(row, 1, filenameLabel); - mTableWidget->setItem(row, 2, itemType); + m_tableWidget->setCellWidget(row, 0, checkbox); + m_tableWidget->setCellWidget(row, 1, filenameLabel); + m_tableWidget->setItem(row, 2, itemType); - mTableWidget->setRowHeight(row, 21); + m_tableWidget->setRowHeight(row, 21); } - mTableWidget->setSortingEnabled(true); + m_tableWidget->setSortingEnabled(true); // Set the size of the filename column to take the whole space. - mTableWidget->setColumnWidth(1, 894); + m_tableWidget->setColumnWidth(1, 894); // Needed to have the last column stretching correctly. - mTableWidget->setColumnWidth(2, 0); + m_tableWidget->setColumnWidth(2, 0); - layout->addWidget(mTableWidget); + layout->addWidget(m_tableWidget); // Create the warning message. QLabel* warningLabel = new QLabel("Warning: Files that will not be recovered will be deleted"); @@ -265,16 +265,16 @@ namespace EMStudio AZStd::string backupFilename; AZStd::string originalFilename; - const int numRows = mTableWidget->rowCount(); + const int numRows = m_tableWidget->rowCount(); for (int i = 0; i < numRows; ++i) { - QWidget* widget = mTableWidget->cellWidget(i, 0); + QWidget* widget = m_tableWidget->cellWidget(i, 0); QCheckBox* checkbox = static_cast(widget); - QTableWidgetItem* item = mTableWidget->item(i, 2); + QTableWidgetItem* item = m_tableWidget->item(i, 2); const int32 filesIndex = item->data(Qt::UserRole).toInt(); // Get the recover and the backup filenames - const AZStd::string& recoverFilename = mFiles[filesIndex]; + const AZStd::string& recoverFilename = m_files[filesIndex]; backupFilename = recoverFilename; AzFramework::StringFunc::Path::StripExtension(backupFilename); @@ -359,17 +359,17 @@ namespace EMStudio using namespace AZ::IO; FileIOBase* fileIo = FileIOBase::GetInstance(); - const size_t numFiles = mFiles.size(); + const size_t numFiles = m_files.size(); AZStd::string backupFilename; for (size_t i = 0; i < numFiles; ++i) { - backupFilename = mFiles[i]; + backupFilename = m_files[i]; AzFramework::StringFunc::Path::StripExtension(backupFilename); // Remove the recover file. - if (fileIo->Remove(mFiles[i].c_str()) == ResultCode::Error) + if (fileIo->Remove(m_files[i].c_str()) == ResultCode::Error) { - const AZStd::string errorMessage = AZStd::string::format("Cannot delete file '%s'.", mFiles[i].c_str()); + const AZStd::string errorMessage = AZStd::string::format("Cannot delete file '%s'.", m_files[i].c_str()); CommandSystem::GetCommandManager()->AddError(errorMessage); AZ_Error("EMotionFX", false, errorMessage.c_str()); } diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/RecoverFilesWindow.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/RecoverFilesWindow.h index f6e25e8ca5..5804db1aa1 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/RecoverFilesWindow.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/RecoverFilesWindow.h @@ -35,7 +35,7 @@ namespace EMStudio private: AZStd::string GetOriginalFilenameFromRecoverFile(const char* recoverFilename); - QTableWidget* mTableWidget; - AZStd::vector mFiles; + QTableWidget* m_tableWidget; + AZStd::vector m_files; }; } // namespace EMStudio diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/RemovePluginOnCloseDockWidget.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/RemovePluginOnCloseDockWidget.cpp index 1f703b8cfb..8d37c933a4 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/RemovePluginOnCloseDockWidget.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/RemovePluginOnCloseDockWidget.cpp @@ -15,13 +15,13 @@ namespace EMStudio { RemovePluginOnCloseDockWidget::RemovePluginOnCloseDockWidget(QWidget* parent, const QString& name, EMStudio::EMStudioPlugin* plugin) : AzQtComponents::StyledDockWidget(name, parent) - , mPlugin(plugin) + , m_plugin(plugin) {} void RemovePluginOnCloseDockWidget::closeEvent(QCloseEvent* event) { MCORE_UNUSED(event); - GetPluginManager()->RemoveActivePlugin(mPlugin); + GetPluginManager()->RemoveActivePlugin(m_plugin); GetMainWindow()->UpdateCreateWindowMenu(); } } diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/RemovePluginOnCloseDockWidget.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/RemovePluginOnCloseDockWidget.h index 21db2524cc..5a08cd7981 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/RemovePluginOnCloseDockWidget.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/RemovePluginOnCloseDockWidget.h @@ -28,6 +28,6 @@ namespace EMStudio void closeEvent(QCloseEvent* event) override; private: - EMStudio::EMStudioPlugin* mPlugin; + EMStudio::EMStudioPlugin* m_plugin; }; } diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/RenderPlugin/ManipulatorCallbacks.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/RenderPlugin/ManipulatorCallbacks.cpp index 750de85344..7758ba9163 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/RenderPlugin/ManipulatorCallbacks.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/RenderPlugin/ManipulatorCallbacks.cpp @@ -21,20 +21,20 @@ namespace EMStudio ManipulatorCallback::Update(value); // update the position, if actorinstance is still valid - size_t actorInstanceID = EMotionFX::GetActorManager().FindActorInstanceIndex(mActorInstance); + size_t actorInstanceID = EMotionFX::GetActorManager().FindActorInstanceIndex(m_actorInstance); if (actorInstanceID != InvalidIndex) { - mActorInstance->SetLocalSpacePosition(value); + m_actorInstance->SetLocalSpacePosition(value); } } void TranslateManipulatorCallback::UpdateOldValues() { // update the rotation, if actorinstance is still valid - size_t actorInstanceID = EMotionFX::GetActorManager().FindActorInstanceIndex(mActorInstance); + size_t actorInstanceID = EMotionFX::GetActorManager().FindActorInstanceIndex(m_actorInstance); if (actorInstanceID != InvalidIndex) { - mOldValueVec = mActorInstance->GetLocalSpaceTransform().mPosition; + m_oldValueVec = m_actorInstance->GetLocalSpaceTransform().m_position; } } @@ -43,10 +43,10 @@ namespace EMStudio EMotionFX::ActorInstance* actorInstance = GetCommandManager()->GetCurrentSelection().GetSingleActorInstance(); if (actorInstance) { - const AZ::Vector3 newPos = actorInstance->GetLocalSpaceTransform().mPosition; - actorInstance->SetLocalSpacePosition(mOldValueVec); + const AZ::Vector3 newPos = actorInstance->GetLocalSpaceTransform().m_position; + actorInstance->SetLocalSpacePosition(m_oldValueVec); - if ((mOldValueVec - newPos).GetLength() >= MCore::Math::epsilon) + if ((m_oldValueVec - newPos).GetLength() >= MCore::Math::epsilon) { AZStd::string outResult; if (GetCommandManager()->ExecuteCommand( @@ -66,24 +66,24 @@ namespace EMStudio void RotateManipulatorCallback::Update(const AZ::Quaternion& value) { // update the rotation, if actorinstance is still valid - size_t actorInstanceID = EMotionFX::GetActorManager().FindActorInstanceIndex(mActorInstance); + size_t actorInstanceID = EMotionFX::GetActorManager().FindActorInstanceIndex(m_actorInstance); if (actorInstanceID != InvalidIndex) { // temporarily update the actor instance - mActorInstance->SetLocalSpaceRotation(value * mActorInstance->GetLocalSpaceTransform().mRotation.GetNormalized()); + m_actorInstance->SetLocalSpaceRotation(value * m_actorInstance->GetLocalSpaceTransform().m_rotation.GetNormalized()); // update the callback parent - ManipulatorCallback::Update(mActorInstance->GetLocalSpaceTransform().mRotation); + ManipulatorCallback::Update(m_actorInstance->GetLocalSpaceTransform().m_rotation); } } void RotateManipulatorCallback::UpdateOldValues() { // update the rotation, if actorinstance is still valid - size_t actorInstanceID = EMotionFX::GetActorManager().FindActorInstanceIndex(mActorInstance); + size_t actorInstanceID = EMotionFX::GetActorManager().FindActorInstanceIndex(m_actorInstance); if (actorInstanceID != InvalidIndex) { - mOldValueQuat = mActorInstance->GetLocalSpaceTransform().mRotation; + m_oldValueQuat = m_actorInstance->GetLocalSpaceTransform().m_rotation; } } @@ -92,10 +92,10 @@ namespace EMStudio EMotionFX::ActorInstance* actorInstance = GetCommandManager()->GetCurrentSelection().GetSingleActorInstance(); if (actorInstance) { - const AZ::Quaternion newRot = actorInstance->GetLocalSpaceTransform().mRotation; - actorInstance->SetLocalSpaceRotation(mOldValueQuat); + const AZ::Quaternion newRot = actorInstance->GetLocalSpaceTransform().m_rotation; + actorInstance->SetLocalSpaceRotation(m_oldValueQuat); - const float dot = newRot.Dot(mOldValueQuat); + const float dot = newRot.Dot(m_oldValueQuat); if (dot < 1.0f - MCore::Math::epsilon && dot > -1.0f + MCore::Math::epsilon) { AZStd::string outResult; @@ -117,11 +117,11 @@ namespace EMStudio AZ::Vector3 ScaleManipulatorCallback::GetCurrValueVec() { - size_t actorInstanceID = EMotionFX::GetActorManager().FindActorInstanceIndex(mActorInstance); + size_t actorInstanceID = EMotionFX::GetActorManager().FindActorInstanceIndex(m_actorInstance); if (actorInstanceID != InvalidIndex) { #ifndef EMFX_SCALE_DISABLED - return mActorInstance->GetLocalSpaceTransform().mScale; + return m_actorInstance->GetLocalSpaceTransform().m_scale; #else return AZ::Vector3::CreateOne(); #endif @@ -137,16 +137,16 @@ namespace EMStudio EMFX_SCALECODE ( // update the position, if actorinstance is still valid - size_t actorInstanceID = EMotionFX::GetActorManager().FindActorInstanceIndex(mActorInstance); + size_t actorInstanceID = EMotionFX::GetActorManager().FindActorInstanceIndex(m_actorInstance); if (actorInstanceID != InvalidIndex) { float minScale = 0.001f; const AZ::Vector3 scale = AZ::Vector3( - MCore::Max(float(mOldValueVec.GetX() * value.GetX()), minScale), - MCore::Max(float(mOldValueVec.GetY() * value.GetY()), minScale), - MCore::Max(float(mOldValueVec.GetZ() * value.GetZ()), minScale)); + MCore::Max(float(m_oldValueVec.GetX() * value.GetX()), minScale), + MCore::Max(float(m_oldValueVec.GetY() * value.GetY()), minScale), + MCore::Max(float(m_oldValueVec.GetZ() * value.GetZ()), minScale)); - mActorInstance->SetLocalSpaceScale(scale); + m_actorInstance->SetLocalSpaceScale(scale); // update the callback ManipulatorCallback::Update(scale); @@ -159,10 +159,10 @@ namespace EMStudio EMFX_SCALECODE ( // update the rotation, if actorinstance is still valid - size_t actorInstanceID = EMotionFX::GetActorManager().FindActorInstanceIndex(mActorInstance); + size_t actorInstanceID = EMotionFX::GetActorManager().FindActorInstanceIndex(m_actorInstance); if (actorInstanceID != InvalidIndex) { - mOldValueVec = mActorInstance->GetLocalSpaceTransform().mScale; + m_oldValueVec = m_actorInstance->GetLocalSpaceTransform().m_scale; } ) } @@ -174,10 +174,10 @@ namespace EMStudio EMotionFX::ActorInstance* actorInstance = GetCommandManager()->GetCurrentSelection().GetSingleActorInstance(); if (actorInstance) { - AZ::Vector3 newScale = actorInstance->GetLocalSpaceTransform().mScale; - actorInstance->SetLocalSpaceScale(mOldValueVec); + AZ::Vector3 newScale = actorInstance->GetLocalSpaceTransform().m_scale; + actorInstance->SetLocalSpaceScale(m_oldValueVec); - if ((mOldValueVec - newScale).GetLength() >= MCore::Math::epsilon) + if ((m_oldValueVec - newScale).GetLength() >= MCore::Math::epsilon) { AZStd::string outResult; if (GetCommandManager()->ExecuteCommand( diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/RenderPlugin/RenderOptions.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/RenderPlugin/RenderOptions.cpp index 274edd36ce..af2cb2c8e8 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/RenderPlugin/RenderOptions.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/RenderPlugin/RenderOptions.cpp @@ -130,7 +130,7 @@ namespace EMStudio MCommon::OrbitCamera tempCam; m_nearClipPlaneDistance = tempCam.GetNearClipDistance(); m_farClipPlaneDistance = tempCam.GetFarClipDistance(); - m_FOV = tempCam.GetFOV(); + m_fov = tempCam.GetFOV(); } RenderOptions& RenderOptions::operator=(const RenderOptions& other) @@ -229,7 +229,7 @@ namespace EMStudio settings->setValue(s_tangentsScaleOptionName, (double)m_tangentsScale); settings->setValue(s_nearClipPlaneDistanceOptionName, (double)m_nearClipPlaneDistance); settings->setValue(s_farClipPlaneDistanceOptionName, (double)m_farClipPlaneDistance); - settings->setValue(s_FOVOptionName, (double)m_FOV); + settings->setValue(s_FOVOptionName, (double)m_fov); settings->setValue(s_showFPSOptionName, m_showFPS); settings->setValue(s_lastUsedLayoutOptionName, m_lastUsedLayout.c_str()); @@ -300,7 +300,7 @@ namespace EMStudio options.m_nearClipPlaneDistance = (float)settings->value(s_nearClipPlaneDistanceOptionName, (double)options.m_nearClipPlaneDistance).toDouble(); options.m_farClipPlaneDistance = (float)settings->value(s_farClipPlaneDistanceOptionName, (double)options.m_farClipPlaneDistance).toDouble(); - options.m_FOV = (float)settings->value(s_FOVOptionName, (double)options.m_FOV).toDouble(); + options.m_fov = (float)settings->value(s_FOVOptionName, (double)options.m_fov).toDouble(); options.m_mainLightIntensity = (float)settings->value(s_mainLightIntensityOptionName, (double)options.m_mainLightIntensity).toDouble(); options.m_mainLightAngleA = (float)settings->value(s_mainLightAngleAOptionName, (double)options.m_mainLightAngleA).toDouble(); @@ -358,7 +358,7 @@ namespace EMStudio ->Field(s_scaleBonesOnLengthOptionName, &RenderOptions::m_scaleBonesOnLength) ->Field(s_nearClipPlaneDistanceOptionName, &RenderOptions::m_nearClipPlaneDistance) ->Field(s_farClipPlaneDistanceOptionName, &RenderOptions::m_farClipPlaneDistance) - ->Field(s_FOVOptionName, &RenderOptions::m_FOV) + ->Field(s_FOVOptionName, &RenderOptions::m_fov) ->Field(s_mainLightIntensityOptionName, &RenderOptions::m_mainLightIntensity) ->Field(s_mainLightAngleAOptionName, &RenderOptions::m_mainLightAngleA) ->Field(s_mainLightAngleBOptionName, &RenderOptions::m_mainLightAngleB) @@ -449,7 +449,7 @@ namespace EMStudio ->Attribute(AZ::Edit::Attributes::ChangeNotify, &RenderOptions::OnFarClipPlaneDistanceChangedCallback) ->Attribute(AZ::Edit::Attributes::Min, 1.0f) ->Attribute(AZ::Edit::Attributes::Max, 100000.0f) - ->DataElement(AZ::Edit::UIHandlers::Default, &RenderOptions::m_FOV, "Field of view", + ->DataElement(AZ::Edit::UIHandlers::Default, &RenderOptions::m_fov, "Field of view", "Angle in degrees of the field of view.") ->Attribute(AZ::Edit::Attributes::ChangeNotify, &RenderOptions::OnFOVChangedCallback) ->Attribute(AZ::Edit::Attributes::Min, 1.0f) @@ -662,9 +662,9 @@ namespace EMStudio void RenderOptions::SetFOV(float FOV) { - if (!AZ::IsClose(FOV, m_FOV, std::numeric_limits::epsilon())) + if (!AZ::IsClose(FOV, m_fov, std::numeric_limits::epsilon())) { - m_FOV = FOV; + m_fov = FOV; OnFOVChangedCallback(); } } diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/RenderPlugin/RenderOptions.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/RenderPlugin/RenderOptions.h index 60f7aa1291..f146f62215 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/RenderPlugin/RenderOptions.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/RenderPlugin/RenderOptions.h @@ -114,7 +114,7 @@ namespace EMStudio float GetFarClipPlaneDistance() const { return m_farClipPlaneDistance; } void SetFarClipPlaneDistance(float farClipPlaneDistance); - float GetFOV() const { return m_FOV; } + float GetFOV() const { return m_fov; } void SetFOV(float FOV); float GetMainLightIntensity() const { return m_mainLightIntensity; } @@ -324,7 +324,7 @@ namespace EMStudio bool m_scaleBonesOnLength; float m_nearClipPlaneDistance; float m_farClipPlaneDistance; - float m_FOV; + float m_fov; float m_mainLightIntensity; float m_mainLightAngleA; float m_mainLightAngleB; diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/RenderPlugin/RenderPlugin.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/RenderPlugin/RenderPlugin.cpp index d3e9593add..db0c355002 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/RenderPlugin/RenderPlugin.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/RenderPlugin/RenderPlugin.cpp @@ -27,34 +27,34 @@ namespace EMStudio RenderPlugin::RenderPlugin() : DockWidgetPlugin() { - mIsVisible = true; - mRenderUtil = nullptr; - mUpdateCallback = nullptr; + m_isVisible = true; + m_renderUtil = nullptr; + m_updateCallback = nullptr; - mUpdateRenderActorsCallback = nullptr; - mReInitRenderActorsCallback = nullptr; - mCreateActorInstanceCallback = nullptr; - mRemoveActorInstanceCallback = nullptr; - mSelectCallback = nullptr; - mUnselectCallback = nullptr; - mClearSelectionCallback = nullptr; - mResetToBindPoseCallback = nullptr; - mAdjustActorInstanceCallback = nullptr; + m_updateRenderActorsCallback = nullptr; + m_reInitRenderActorsCallback = nullptr; + m_createActorInstanceCallback = nullptr; + m_removeActorInstanceCallback = nullptr; + m_selectCallback = nullptr; + m_unselectCallback = nullptr; + m_clearSelectionCallback = nullptr; + m_resetToBindPoseCallback = nullptr; + m_adjustActorInstanceCallback = nullptr; - mZoomInCursor = nullptr; - mZoomOutCursor = nullptr; + m_zoomInCursor = nullptr; + m_zoomOutCursor = nullptr; - mBaseLayout = nullptr; - mRenderLayoutWidget = nullptr; - mActiveViewWidget = nullptr; - mCurrentSelection = nullptr; + m_baseLayout = nullptr; + m_renderLayoutWidget = nullptr; + m_activeViewWidget = nullptr; + m_currentSelection = nullptr; m_currentLayout = nullptr; - mFocusViewWidget = nullptr; - mFirstFrameAfterReInit = false; + m_focusViewWidget = nullptr; + m_firstFrameAfterReInit = false; - mTranslateManipulator = nullptr; - mRotateManipulator = nullptr; - mScaleManipulator = nullptr; + m_translateManipulator = nullptr; + m_rotateManipulator = nullptr; + m_scaleManipulator = nullptr; EMotionFX::ActorNotificationBus::Handler::BusConnect(); } @@ -83,38 +83,38 @@ namespace EMStudio m_layouts.clear(); // delete the gizmos - GetManager()->RemoveTransformationManipulator(mTranslateManipulator); - GetManager()->RemoveTransformationManipulator(mRotateManipulator); - GetManager()->RemoveTransformationManipulator(mScaleManipulator); + GetManager()->RemoveTransformationManipulator(m_translateManipulator); + GetManager()->RemoveTransformationManipulator(m_rotateManipulator); + GetManager()->RemoveTransformationManipulator(m_scaleManipulator); - delete mTranslateManipulator; - delete mRotateManipulator; - delete mScaleManipulator; + delete m_translateManipulator; + delete m_rotateManipulator; + delete m_scaleManipulator; // get rid of the cursors - delete mZoomInCursor; - delete mZoomOutCursor; + delete m_zoomInCursor; + delete m_zoomOutCursor; // unregister the command callbacks and get rid of the memory - GetCommandManager()->RemoveCommandCallback(mUpdateRenderActorsCallback, false); - GetCommandManager()->RemoveCommandCallback(mReInitRenderActorsCallback, false); - GetCommandManager()->RemoveCommandCallback(mCreateActorInstanceCallback, false); - GetCommandManager()->RemoveCommandCallback(mRemoveActorInstanceCallback, false); - GetCommandManager()->RemoveCommandCallback(mSelectCallback, false); - GetCommandManager()->RemoveCommandCallback(mUnselectCallback, false); - GetCommandManager()->RemoveCommandCallback(mClearSelectionCallback, false); - GetCommandManager()->RemoveCommandCallback(mResetToBindPoseCallback, false); - GetCommandManager()->RemoveCommandCallback(mAdjustActorInstanceCallback, false); + GetCommandManager()->RemoveCommandCallback(m_updateRenderActorsCallback, false); + GetCommandManager()->RemoveCommandCallback(m_reInitRenderActorsCallback, false); + GetCommandManager()->RemoveCommandCallback(m_createActorInstanceCallback, false); + GetCommandManager()->RemoveCommandCallback(m_removeActorInstanceCallback, false); + GetCommandManager()->RemoveCommandCallback(m_selectCallback, false); + GetCommandManager()->RemoveCommandCallback(m_unselectCallback, false); + GetCommandManager()->RemoveCommandCallback(m_clearSelectionCallback, false); + GetCommandManager()->RemoveCommandCallback(m_resetToBindPoseCallback, false); + GetCommandManager()->RemoveCommandCallback(m_adjustActorInstanceCallback, false); - delete mUpdateRenderActorsCallback; - delete mReInitRenderActorsCallback; - delete mCreateActorInstanceCallback; - delete mRemoveActorInstanceCallback; - delete mSelectCallback; - delete mUnselectCallback; - delete mClearSelectionCallback; - delete mResetToBindPoseCallback; - delete mAdjustActorInstanceCallback; + delete m_updateRenderActorsCallback; + delete m_reInitRenderActorsCallback; + delete m_createActorInstanceCallback; + delete m_removeActorInstanceCallback; + delete m_selectCallback; + delete m_unselectCallback; + delete m_clearSelectionCallback; + delete m_resetToBindPoseCallback; + delete m_adjustActorInstanceCallback; for (MCommon::RenderUtil::TrajectoryTracePath* trajectoryPath : m_trajectoryTracePaths) { @@ -128,14 +128,14 @@ namespace EMStudio void RenderPlugin::CleanEMStudioActors() { // get rid of the actors - for (EMStudioRenderActor* actor : mActors) + for (EMStudioRenderActor* actor : m_actors) { if (actor) { delete actor; } } - mActors.clear(); + m_actors.clear(); } @@ -156,7 +156,7 @@ namespace EMStudio // get rid of the emstudio actor delete emstudioActor; - mActors.erase(AZStd::next(begin(mActors), index)); + m_actors.erase(AZStd::next(begin(m_actors), index)); return true; } @@ -216,40 +216,40 @@ namespace EMStudio void RenderPlugin::ReInitTransformationManipulators() { EMotionFX::ActorInstance* actorInstance = GetCommandManager()->GetCurrentSelection().GetSingleActorInstance(); - const RenderOptions::ManipulatorMode mode = mRenderOptions.GetManipulatorMode(); + const RenderOptions::ManipulatorMode mode = m_renderOptions.GetManipulatorMode(); - if (mTranslateManipulator) + if (m_translateManipulator) { if (actorInstance) { - mTranslateManipulator->Init(actorInstance->GetLocalSpaceTransform().mPosition); - mTranslateManipulator->SetCallback(new TranslateManipulatorCallback(actorInstance, actorInstance->GetLocalSpaceTransform().mPosition)); + m_translateManipulator->Init(actorInstance->GetLocalSpaceTransform().m_position); + m_translateManipulator->SetCallback(new TranslateManipulatorCallback(actorInstance, actorInstance->GetLocalSpaceTransform().m_position)); } - mTranslateManipulator->SetIsVisible(actorInstance && mode == RenderOptions::ManipulatorMode::TRANSLATE); + m_translateManipulator->SetIsVisible(actorInstance && mode == RenderOptions::ManipulatorMode::TRANSLATE); } - if (mRotateManipulator) + if (m_rotateManipulator) { if (actorInstance) { - mRotateManipulator->Init(actorInstance->GetLocalSpaceTransform().mPosition); - mRotateManipulator->SetCallback(new RotateManipulatorCallback(actorInstance, actorInstance->GetLocalSpaceTransform().mRotation)); + m_rotateManipulator->Init(actorInstance->GetLocalSpaceTransform().m_position); + m_rotateManipulator->SetCallback(new RotateManipulatorCallback(actorInstance, actorInstance->GetLocalSpaceTransform().m_rotation)); } - mRotateManipulator->SetIsVisible(actorInstance && mode == RenderOptions::ManipulatorMode::ROTATE); + m_rotateManipulator->SetIsVisible(actorInstance && mode == RenderOptions::ManipulatorMode::ROTATE); } - if (mScaleManipulator) + if (m_scaleManipulator) { if (actorInstance) { - mScaleManipulator->Init(actorInstance->GetLocalSpaceTransform().mPosition); + m_scaleManipulator->Init(actorInstance->GetLocalSpaceTransform().m_position); #ifndef EMFX_SCALE_DISABLED - mScaleManipulator->SetCallback(new ScaleManipulatorCallback(actorInstance, actorInstance->GetLocalSpaceTransform().mScale)); + m_scaleManipulator->SetCallback(new ScaleManipulatorCallback(actorInstance, actorInstance->GetLocalSpaceTransform().m_scale)); #else - mScaleManipulator->SetCallback(new ScaleManipulatorCallback(actorInstance, AZ::Vector3::CreateOne())); + m_scaleManipulator->SetCallback(new ScaleManipulatorCallback(actorInstance, AZ::Vector3::CreateOne())); #endif } - mScaleManipulator->SetIsVisible(actorInstance && mode == RenderOptions::ManipulatorMode::SCALE); + m_scaleManipulator->SetIsVisible(actorInstance && mode == RenderOptions::ManipulatorMode::SCALE); } } @@ -269,14 +269,14 @@ namespace EMStudio for (const EMotionFX::Node* joint : joints) { - const AZ::Vector3 jointPosition = pose->GetWorldSpaceTransform(joint->GetNodeIndex()).mPosition; + const AZ::Vector3 jointPosition = pose->GetWorldSpaceTransform(joint->GetNodeIndex()).m_position; aabb.AddPoint(jointPosition); const size_t childCount = joint->GetNumChildNodes(); for (size_t i = 0; i < childCount; ++i) { EMotionFX::Node* childJoint = skeleton->GetNode(joint->GetChildIndex(i)); - const AZ::Vector3 childPosition = pose->GetWorldSpaceTransform(childJoint->GetNodeIndex()).mPosition; + const AZ::Vector3 childPosition = pose->GetWorldSpaceTransform(childJoint->GetNodeIndex()).m_position; aabb.AddPoint(childPosition); } } @@ -300,7 +300,7 @@ namespace EMStudio if (isFollowModeActive) { - QMessageBox::warning(mDock, "Please disable character follow mode", "Zoom to joints is only working in case character follow mode is disabled.\nPlease disable character follow mode in the render view menu: Camera -> Follow Mode", QMessageBox::Ok); + QMessageBox::warning(m_dock, "Please disable character follow mode", "Zoom to joints is only working in case character follow mode is disabled.\nPlease disable character follow mode in the render view menu: Camera -> Follow Mode", QMessageBox::Ok); } } } @@ -313,23 +313,23 @@ namespace EMStudio // try to locate the helper actor for a given instance RenderPlugin::EMStudioRenderActor* RenderPlugin::FindEMStudioActor(const EMotionFX::ActorInstance* actorInstance, bool doubleCheckInstance) const { - const auto foundActor = AZStd::find_if(begin(mActors), end(mActors), [actorInstance, doubleCheckInstance](const EMStudioRenderActor* renderActor) + const auto foundActor = AZStd::find_if(begin(m_actors), end(m_actors), [actorInstance, doubleCheckInstance](const EMStudioRenderActor* renderActor) { // is the parent actor of the instance the same as the one in the emstudio actor? - if (renderActor->mActor == actorInstance->GetActor()) + if (renderActor->m_actor == actorInstance->GetActor()) { // double check if the actor instance is in the actor instance array inside the emstudio actor if (doubleCheckInstance) { // now double check if the actor instance really is in the array of instances of this emstudio actor - const auto foundActorInstance = AZStd::find(begin(renderActor->mActorInstances), end(renderActor->mActorInstances), actorInstance); - return foundActorInstance != end(renderActor->mActorInstances); + const auto foundActorInstance = AZStd::find(begin(renderActor->m_actorInstances), end(renderActor->m_actorInstances), actorInstance); + return foundActorInstance != end(renderActor->m_actorInstances); } return true; } return false; }); - return foundActor != end(mActors) ? *foundActor : nullptr; + return foundActor != end(m_actors) ? *foundActor : nullptr; } @@ -341,19 +341,19 @@ namespace EMStudio return nullptr; } - const auto foundActor = AZStd::find_if(begin(mActors), end(mActors), [match = actor](const EMStudioRenderActor* actor) + const auto foundActor = AZStd::find_if(begin(m_actors), end(m_actors), [match = actor](const EMStudioRenderActor* actor) { - return actor->mActor == match; + return actor->m_actor == match; }); - return foundActor != end(mActors) ? *foundActor : nullptr; + return foundActor != end(m_actors) ? *foundActor : nullptr; } // get the index of the given emstudio actor size_t RenderPlugin::FindEMStudioActorIndex(const EMStudioRenderActor* EMStudioRenderActor) const { - const auto foundActor = AZStd::find(begin(mActors), end(mActors), EMStudioRenderActor); - return foundActor != end(mActors) ? AZStd::distance(begin(mActors), foundActor) : InvalidIndex; + const auto foundActor = AZStd::find(begin(m_actors), end(m_actors), EMStudioRenderActor); + return foundActor != end(m_actors) ? AZStd::distance(begin(m_actors), foundActor) : InvalidIndex; } @@ -371,13 +371,13 @@ namespace EMStudio void RenderPlugin::AddEMStudioActor(EMStudioRenderActor* emstudioActor) { // add the actor to the list and return success - mActors.emplace_back(emstudioActor); + m_actors.emplace_back(emstudioActor); } void RenderPlugin::ReInit(bool resetViewCloseup) { - if (!mRenderUtil) + if (!m_renderUtil) { return; } @@ -404,10 +404,10 @@ namespace EMStudio } } - for (size_t i = 0; i < mActors.size(); ++i) + for (size_t i = 0; i < m_actors.size(); ++i) { - EMStudioRenderActor* emstudioActor = mActors[i]; - EMotionFX::Actor* actor = emstudioActor->mActor; + EMStudioRenderActor* emstudioActor = m_actors[i]; + EMotionFX::Actor* actor = emstudioActor->m_actor; bool found = false; for (size_t j = 0; j < numActors; ++j) @@ -442,9 +442,9 @@ namespace EMStudio if (!emstudioActor) { - for (EMStudioRenderActor* currentEMStudioActor : mActors) + for (EMStudioRenderActor* currentEMStudioActor : m_actors) { - if (actor == currentEMStudioActor->mActor) + if (actor == currentEMStudioActor->m_actor) { emstudioActor = currentEMStudioActor; break; @@ -455,22 +455,22 @@ namespace EMStudio if (emstudioActor) { // set the GL actor - actorInstance->SetCustomData(emstudioActor->mRenderActor); + actorInstance->SetCustomData(emstudioActor->m_renderActor); // add the actor instance to the emstudio actor instances in case it is not in yet - if (AZStd::find(begin(emstudioActor->mActorInstances), end(emstudioActor->mActorInstances), actorInstance) == end(emstudioActor->mActorInstances)) + if (AZStd::find(begin(emstudioActor->m_actorInstances), end(emstudioActor->m_actorInstances), actorInstance) == end(emstudioActor->m_actorInstances)) { - emstudioActor->mActorInstances.emplace_back(actorInstance); + emstudioActor->m_actorInstances.emplace_back(actorInstance); } } } // 4. Unlink invalid actor instances from the emstudio actors - for (EMStudioRenderActor* emstudioActor : mActors) + for (EMStudioRenderActor* emstudioActor : m_actors) { - for (size_t j = 0; j < emstudioActor->mActorInstances.size();) + for (size_t j = 0; j < emstudioActor->m_actorInstances.size();) { - EMotionFX::ActorInstance* emstudioActorInstance = emstudioActor->mActorInstances[j]; + EMotionFX::ActorInstance* emstudioActorInstance = emstudioActor->m_actorInstances[j]; bool found = false; for (size_t k = 0; k < numActorInstances; ++k) @@ -484,7 +484,7 @@ namespace EMStudio if (found == false) { - emstudioActor->mActorInstances.erase(AZStd::next(begin(emstudioActor->mActorInstances), j)); + emstudioActor->m_actorInstances.erase(AZStd::next(begin(emstudioActor->m_actorInstances), j)); } else { @@ -493,7 +493,7 @@ namespace EMStudio } } - mFirstFrameAfterReInit = true; + m_firstFrameAfterReInit = true; m_reinitRequested = false; // zoom the camera to the available character only in case we're dealing with a single instance @@ -513,15 +513,15 @@ namespace EMStudio // constructor RenderPlugin::EMStudioRenderActor::EMStudioRenderActor(EMotionFX::Actor* actor, RenderGL::GLActor* renderActor) { - mRenderActor = renderActor; - mActor = actor; - mNormalsScaleMultiplier = 1.0f; - mCharacterHeight = 0.0f; - mOffsetFromTrajectoryNode = 0.0f; - mMustCalcNormalScale = true; + m_renderActor = renderActor; + m_actor = actor; + m_normalsScaleMultiplier = 1.0f; + m_characterHeight = 0.0f; + m_offsetFromTrajectoryNode = 0.0f; + m_mustCalcNormalScale = true; // extract the bones from the actor and add it to the array - actor->ExtractBoneList(0, &mBoneList); + actor->ExtractBoneList(0, &m_boneList); CalculateNormalScaleMultiplier(); } @@ -531,7 +531,7 @@ namespace EMStudio RenderPlugin::EMStudioRenderActor::~EMStudioRenderActor() { // get the number of actor instances and iterate through them - for (EMotionFX::ActorInstance* actorInstance : mActorInstances) + for (EMotionFX::ActorInstance* actorInstance : m_actorInstances) { // only delete the actor instance in case it is still inside the actor manager // in case it is not present there anymore this means an undo command has already deleted it @@ -549,17 +549,17 @@ namespace EMStudio // only delete the actor in case it is still inside the actor manager // in case it is not present there anymore this means an undo command has already deleted it - if (EMotionFX::GetActorManager().FindActorIndex(mActor) == InvalidIndex) + if (EMotionFX::GetActorManager().FindActorIndex(m_actor) == InvalidIndex) { // in case the actor is not valid anymore make sure to unselect it to avoid bad pointers CommandSystem::SelectionList& selection = GetCommandManager()->GetCurrentSelection(); - selection.RemoveActor(mActor); + selection.RemoveActor(m_actor); } // get rid of the OpenGL actor - if (mRenderActor) + if (m_renderActor) { - mRenderActor->Destroy(); + m_renderActor->Destroy(); } } @@ -567,7 +567,7 @@ namespace EMStudio void RenderPlugin::EMStudioRenderActor::CalculateNormalScaleMultiplier() { // calculate the max extent of the character - EMotionFX::ActorInstance* actorInstance = EMotionFX::ActorInstance::Create(mActor); + EMotionFX::ActorInstance* actorInstance = EMotionFX::ActorInstance::Create(m_actor); actorInstance->UpdateMeshDeformers(0.0f, true); AZ::Aabb aabb; @@ -578,14 +578,14 @@ namespace EMStudio actorInstance->CalcNodeBasedAabb(&aabb); } - mCharacterHeight = aabb.GetExtents().GetZ(); - mOffsetFromTrajectoryNode = aabb.GetMin().GetY() + (mCharacterHeight * 0.5f); + m_characterHeight = aabb.GetExtents().GetZ(); + m_offsetFromTrajectoryNode = aabb.GetMin().GetY() + (m_characterHeight * 0.5f); actorInstance->Destroy(); // scale the normals down to 1% of the character size, that looks pretty nice on all models const float radius = AZ::Vector3(aabb.GetMax() - aabb.GetMin()).GetLength() * 0.5f; - mNormalsScaleMultiplier = radius * 0.01f; + m_normalsScaleMultiplier = radius * 0.01f; } @@ -640,55 +640,55 @@ namespace EMStudio { // load the cursors QDir dataDir{ QString(MysticQt::GetDataDir().c_str()) }; - mZoomInCursor = new QCursor(QPixmap(dataDir.filePath("Images/Rendering/ZoomInCursor.png")).scaled(32, 32)); - mZoomOutCursor = new QCursor(QPixmap(dataDir.filePath("Images/Rendering/ZoomOutCursor.png")).scaled(32, 32)); + m_zoomInCursor = new QCursor(QPixmap(dataDir.filePath("Images/Rendering/ZoomInCursor.png")).scaled(32, 32)); + m_zoomOutCursor = new QCursor(QPixmap(dataDir.filePath("Images/Rendering/ZoomOutCursor.png")).scaled(32, 32)); - mCurrentSelection = &GetCommandManager()->GetCurrentSelection(); + m_currentSelection = &GetCommandManager()->GetCurrentSelection(); - connect(mDock, &QDockWidget::visibilityChanged, this, &RenderPlugin::VisibilityChanged); + connect(m_dock, &QDockWidget::visibilityChanged, this, &RenderPlugin::VisibilityChanged); // add the available render template layouts RegisterRenderPluginLayouts(this); // create the inner widget which contains the base layout - mInnerWidget = new QWidget(); - mDock->setWidget(mInnerWidget); + m_innerWidget = new QWidget(); + m_dock->setWidget(m_innerWidget); // the base layout contains the render layout templates on the left and the render views on the right - mBaseLayout = new QHBoxLayout(mInnerWidget); - mBaseLayout->setContentsMargins(0, 2, 2, 2); - mBaseLayout->setSpacing(0); + m_baseLayout = new QHBoxLayout(m_innerWidget); + m_baseLayout->setContentsMargins(0, 2, 2, 2); + m_baseLayout->setSpacing(0); SetSelectionMode(); // create and register the command callbacks only (only execute this code once for all plugins) - mUpdateRenderActorsCallback = new UpdateRenderActorsCallback(false); - mReInitRenderActorsCallback = new ReInitRenderActorsCallback(false); - mCreateActorInstanceCallback = new CreateActorInstanceCallback(false); - mRemoveActorInstanceCallback = new RemoveActorInstanceCallback(false); - mSelectCallback = new SelectCallback(false); - mUnselectCallback = new UnselectCallback(false); - mClearSelectionCallback = new ClearSelectionCallback(false); - mResetToBindPoseCallback = new CommandResetToBindPoseCallback(false); - mAdjustActorInstanceCallback = new AdjustActorInstanceCallback(false); - GetCommandManager()->RegisterCommandCallback("UpdateRenderActors", mUpdateRenderActorsCallback); - GetCommandManager()->RegisterCommandCallback("ReInitRenderActors", mReInitRenderActorsCallback); - GetCommandManager()->RegisterCommandCallback("CreateActorInstance", mCreateActorInstanceCallback); - GetCommandManager()->RegisterCommandCallback("RemoveActorInstance", mRemoveActorInstanceCallback); - GetCommandManager()->RegisterCommandCallback("Select", mSelectCallback); - GetCommandManager()->RegisterCommandCallback("Unselect", mUnselectCallback); - GetCommandManager()->RegisterCommandCallback("ClearSelection", mClearSelectionCallback); - GetCommandManager()->RegisterCommandCallback("ResetToBindPose", mResetToBindPoseCallback); - GetCommandManager()->RegisterCommandCallback("AdjustActorInstance", mAdjustActorInstanceCallback); + m_updateRenderActorsCallback = new UpdateRenderActorsCallback(false); + m_reInitRenderActorsCallback = new ReInitRenderActorsCallback(false); + m_createActorInstanceCallback = new CreateActorInstanceCallback(false); + m_removeActorInstanceCallback = new RemoveActorInstanceCallback(false); + m_selectCallback = new SelectCallback(false); + m_unselectCallback = new UnselectCallback(false); + m_clearSelectionCallback = new ClearSelectionCallback(false); + m_resetToBindPoseCallback = new CommandResetToBindPoseCallback(false); + m_adjustActorInstanceCallback = new AdjustActorInstanceCallback(false); + GetCommandManager()->RegisterCommandCallback("UpdateRenderActors", m_updateRenderActorsCallback); + GetCommandManager()->RegisterCommandCallback("ReInitRenderActors", m_reInitRenderActorsCallback); + GetCommandManager()->RegisterCommandCallback("CreateActorInstance", m_createActorInstanceCallback); + GetCommandManager()->RegisterCommandCallback("RemoveActorInstance", m_removeActorInstanceCallback); + GetCommandManager()->RegisterCommandCallback("Select", m_selectCallback); + GetCommandManager()->RegisterCommandCallback("Unselect", m_unselectCallback); + GetCommandManager()->RegisterCommandCallback("ClearSelection", m_clearSelectionCallback); + GetCommandManager()->RegisterCommandCallback("ResetToBindPose", m_resetToBindPoseCallback); + GetCommandManager()->RegisterCommandCallback("AdjustActorInstance", m_adjustActorInstanceCallback); // initialize the gizmos - mTranslateManipulator = (MCommon::TranslateManipulator*)GetManager()->AddTransformationManipulator(new MCommon::TranslateManipulator(70.0f, false)); - mScaleManipulator = (MCommon::ScaleManipulator*)GetManager()->AddTransformationManipulator(new MCommon::ScaleManipulator(70.0f, false)); - mRotateManipulator = (MCommon::RotateManipulator*)GetManager()->AddTransformationManipulator(new MCommon::RotateManipulator(70.0f, false)); + m_translateManipulator = (MCommon::TranslateManipulator*)GetManager()->AddTransformationManipulator(new MCommon::TranslateManipulator(70.0f, false)); + m_scaleManipulator = (MCommon::ScaleManipulator*)GetManager()->AddTransformationManipulator(new MCommon::ScaleManipulator(70.0f, false)); + m_rotateManipulator = (MCommon::RotateManipulator*)GetManager()->AddTransformationManipulator(new MCommon::RotateManipulator(70.0f, false)); // Load the render options and set the last used layout. LoadRenderOptions(); - LayoutButtonPressed(mRenderOptions.GetLastUsedLayout().c_str()); + LayoutButtonPressed(m_renderOptions.GetLastUsedLayout().c_str()); EMotionFX::SkeletonOutlinerNotificationBus::Handler::BusConnect(); return true; @@ -702,7 +702,7 @@ namespace EMStudio QSettings settings(renderOptionsFilename.c_str(), QSettings::IniFormat, this); // save the general render options - mRenderOptions.Save(&settings); + m_renderOptions.Save(&settings); AZStd::string groupName; if (m_currentLayout) @@ -727,7 +727,7 @@ namespace EMStudio AZStd::string renderOptionsFilename(GetManager()->GetAppDataFolder()); renderOptionsFilename += "EMStudioRenderOptions.cfg"; QSettings settings(renderOptionsFilename.c_str(), QSettings::IniFormat, this); - mRenderOptions = RenderOptions::Load(&settings); + m_renderOptions = RenderOptions::Load(&settings); AZStd::string groupName; if (m_currentLayout) @@ -745,13 +745,12 @@ namespace EMStudio } } - //SetAspiredRenderingFPS(mRenderOptions.mAspiredRenderFPS); - SetManipulatorMode(mRenderOptions.GetManipulatorMode()); + SetManipulatorMode(m_renderOptions.GetManipulatorMode()); } void RenderPlugin::SetManipulatorMode(RenderOptions::ManipulatorMode mode) { - mRenderOptions.SetManipulatorMode(mode); + m_renderOptions.SetManipulatorMode(mode); for (RenderViewWidget* viewWidget : m_viewWidgets) { @@ -763,7 +762,7 @@ namespace EMStudio void RenderPlugin::VisibilityChanged(bool visible) { - mIsVisible = visible; + m_isVisible = visible; } void RenderPlugin::UpdateActorInstances(float timePassedInSeconds) @@ -794,7 +793,7 @@ namespace EMStudio void RenderPlugin::ProcessFrame(float timePassedInSeconds) { // skip rendering in case we want to avoid updating any 3d views - if (GetManager()->GetAvoidRendering() || mIsVisible == false) + if (GetManager()->GetAvoidRendering() || m_isVisible == false) { return; } @@ -811,14 +810,14 @@ namespace EMStudio { RenderWidget* renderWidget = viewWidget->GetRenderWidget(); - if (!mFirstFrameAfterReInit) + if (!m_firstFrameAfterReInit) { renderWidget->GetCamera()->Update(timePassedInSeconds); } - if (mFirstFrameAfterReInit) + if (m_firstFrameAfterReInit) { - mFirstFrameAfterReInit = false; + m_firstFrameAfterReInit = false; } // redraw @@ -833,17 +832,17 @@ namespace EMStudio AZ::Aabb finalAabb = AZ::Aabb::CreateNull(); CommandSystem::SelectionList& selection = GetCommandManager()->GetCurrentSelection(); - if (mUpdateCallback) + if (m_updateCallback) { - mUpdateCallback->SetEnableRendering(false); + m_updateCallback->SetEnableRendering(false); } // update EMotion FX, but don't render EMotionFX::GetEMotionFX().Update(0.0f); - if (mUpdateCallback) + if (m_updateCallback) { - mUpdateCallback->SetEnableRendering(true); + m_updateCallback->SetEnableRendering(true); } // get the number of actor instances and iterate through them @@ -933,26 +932,26 @@ namespace EMStudio } // save the current settings and disable rendering - mRenderOptions.SetLastUsedLayout(layout->GetName()); + m_renderOptions.SetLastUsedLayout(layout->GetName()); ClearViewWidgets(); VisibilityChanged(false); m_currentLayout = layout; - QWidget* oldLayoutWidget = mRenderLayoutWidget; - QWidget* newLayoutWidget = layout->Create(this, mInnerWidget); + QWidget* oldLayoutWidget = m_renderLayoutWidget; + QWidget* newLayoutWidget = layout->Create(this, m_innerWidget); // delete the old render layout after we created the new one, so we can keep the old resources // this only removes it from the layout - mBaseLayout->removeWidget(oldLayoutWidget); + m_baseLayout->removeWidget(oldLayoutWidget); - mRenderLayoutWidget = newLayoutWidget; + m_renderLayoutWidget = newLayoutWidget; // create thw new one and add it to the base layout - mBaseLayout->addWidget(mRenderLayoutWidget); - mRenderLayoutWidget->update(); - mBaseLayout->update(); - mRenderLayoutWidget->show(); + m_baseLayout->addWidget(m_renderLayoutWidget); + m_renderLayoutWidget->update(); + m_baseLayout->update(); + m_renderLayoutWidget->show(); LoadRenderOptions(); ViewCloseup(false, nullptr, 0.0f); @@ -981,7 +980,7 @@ namespace EMStudio { for (MCommon::RenderUtil::TrajectoryTracePath* trajectoryPath : m_trajectoryTracePaths) { - if (trajectoryPath->mActorInstance == actorInstance) + if (trajectoryPath->m_actorInstance == actorInstance) { return trajectoryPath; } @@ -990,8 +989,8 @@ namespace EMStudio // we haven't created a path for the given actor instance yet, do so MCommon::RenderUtil::TrajectoryTracePath* tracePath = new MCommon::RenderUtil::TrajectoryTracePath(); - tracePath->mActorInstance = actorInstance; - tracePath->mTraceParticles.reserve(512); + tracePath->m_actorInstance = actorInstance; + tracePath->m_traceParticles.reserve(512); m_trajectoryTracePaths.emplace_back(tracePath); return tracePath; @@ -1032,20 +1031,20 @@ namespace EMStudio const EMotionFX::Transform& worldTM = actorInstance->GetWorldSpaceTransform(); bool distanceTraveledEnough = false; - if (trajectoryPath->mTraceParticles.empty()) + if (trajectoryPath->m_traceParticles.empty()) { distanceTraveledEnough = true; } else { - const size_t numParticles = trajectoryPath->mTraceParticles.size(); - const EMotionFX::Transform& oldWorldTM = trajectoryPath->mTraceParticles[numParticles - 1].mWorldTM; + const size_t numParticles = trajectoryPath->m_traceParticles.size(); + const EMotionFX::Transform& oldWorldTM = trajectoryPath->m_traceParticles[numParticles - 1].m_worldTm; - const AZ::Vector3& oldPos = oldWorldTM.mPosition; - const AZ::Quaternion oldRot = oldWorldTM.mRotation.GetNormalized(); - const AZ::Quaternion rotation = worldTM.mRotation.GetNormalized(); + const AZ::Vector3& oldPos = oldWorldTM.m_position; + const AZ::Quaternion oldRot = oldWorldTM.m_rotation.GetNormalized(); + const AZ::Quaternion rotation = worldTM.m_rotation.GetNormalized(); - const AZ::Vector3 deltaPos = worldTM.mPosition - oldPos; + const AZ::Vector3 deltaPos = worldTM.m_position - oldPos; const float deltaRot = MCore::Math::Abs(rotation.Dot(oldRot)); if (MCore::SafeLength(deltaPos) > 0.0001f || deltaRot < 0.99f) { @@ -1054,25 +1053,25 @@ namespace EMStudio } // add the time delta to the time passed since the last add - trajectoryPath->mTimePassed += timePassedInSeconds; + trajectoryPath->m_timePassed += timePassedInSeconds; const uint32 particleSampleRate = 30; - if (trajectoryPath->mTimePassed >= (1.0f / particleSampleRate) && distanceTraveledEnough) + if (trajectoryPath->m_timePassed >= (1.0f / particleSampleRate) && distanceTraveledEnough) { // create the particle, fill its data and add it to the trajectory trace path MCommon::RenderUtil::TrajectoryPathParticle trajectoryParticle; - trajectoryParticle.mWorldTM = worldTM; - trajectoryPath->mTraceParticles.emplace_back(trajectoryParticle); + trajectoryParticle.m_worldTm = worldTM; + trajectoryPath->m_traceParticles.emplace_back(trajectoryParticle); // reset the time passed as we just added a new particle - trajectoryPath->mTimePassed = 0.0f; + trajectoryPath->m_timePassed = 0.0f; } } // make sure we don't have too many items in our array - if (trajectoryPath->mTraceParticles.size() > 50) + if (trajectoryPath->m_traceParticles.size() > 50) { - trajectoryPath->mTraceParticles.erase(begin(trajectoryPath->mTraceParticles)); + trajectoryPath->m_traceParticles.erase(begin(trajectoryPath->m_traceParticles)); } } } @@ -1106,9 +1105,9 @@ namespace EMStudio if (widget->GetRenderFlag(RenderViewWidget::RENDER_AABB)) { MCommon::RenderUtil::AABBRenderSettings settings; - settings.mNodeBasedColor = renderOptions->GetNodeAABBColor(); - settings.mStaticBasedColor = renderOptions->GetStaticAABBColor(); - settings.mMeshBasedColor = renderOptions->GetMeshAABBColor(); + settings.m_nodeBasedColor = renderOptions->GetNodeAABBColor(); + settings.m_staticBasedColor = renderOptions->GetStaticAABBColor(); + settings.m_meshBasedColor = renderOptions->GetMeshAABBColor(); renderUtil->RenderAabbs(actorInstance, settings); } @@ -1146,11 +1145,11 @@ namespace EMStudio renderUtil->EnableLighting(false); // disable lighting if (widget->GetRenderFlag(RenderViewWidget::RENDER_SKELETON)) { - renderUtil->RenderSkeleton(actorInstance, emstudioActor->mBoneList, &visibleJointIndices, &selectedJointIndices, renderOptions->GetSkeletonColor(), renderOptions->GetSelectedObjectColor()); + renderUtil->RenderSkeleton(actorInstance, emstudioActor->m_boneList, &visibleJointIndices, &selectedJointIndices, renderOptions->GetSkeletonColor(), renderOptions->GetSelectedObjectColor()); } if (widget->GetRenderFlag(RenderViewWidget::RENDER_NODEORIENTATION)) { - renderUtil->RenderNodeOrientations(actorInstance, emstudioActor->mBoneList, &visibleJointIndices, &selectedJointIndices, emstudioActor->mNormalsScaleMultiplier * renderOptions->GetNodeOrientationScale(), renderOptions->GetScaleBonesOnLength()); + renderUtil->RenderNodeOrientations(actorInstance, emstudioActor->m_boneList, &visibleJointIndices, &selectedJointIndices, emstudioActor->m_normalsScaleMultiplier * renderOptions->GetNodeOrientationScale(), renderOptions->GetScaleBonesOnLength()); } if (widget->GetRenderFlag(RenderViewWidget::RENDER_ACTORBINDPOSE)) { @@ -1161,7 +1160,7 @@ namespace EMStudio if (widget->GetRenderFlag(RenderViewWidget::RENDER_MOTIONEXTRACTION)) { // render an arrow for the trajectory - renderUtil->RenderTrajectoryPath(FindTracePath(actorInstance), renderOptions->GetTrajectoryArrowInnerColor(), emstudioActor->mCharacterHeight * 0.05f); + renderUtil->RenderTrajectoryPath(FindTracePath(actorInstance), renderOptions->GetTrajectoryArrowInnerColor(), emstudioActor->m_characterHeight * 0.05f); } renderUtil->EnableCulling(cullingEnabled); // reset to the old state renderUtil->EnableLighting(lightingEnabled); @@ -1181,9 +1180,9 @@ namespace EMStudio const size_t numEnabled = actorInstance->GetNumEnabledNodes(); for (size_t i = 0; i < numEnabled; ++i) { - EMotionFX::Node* node = emstudioActor->mActor->GetSkeleton()->GetNode(actorInstance->GetEnabledNode(i)); + EMotionFX::Node* node = emstudioActor->m_actor->GetSkeleton()->GetNode(actorInstance->GetEnabledNode(i)); const size_t nodeIndex = node->GetNodeIndex(); - EMotionFX::Mesh* mesh = emstudioActor->mActor->GetMesh(geomLODLevel, nodeIndex); + EMotionFX::Mesh* mesh = emstudioActor->m_actor->GetMesh(geomLODLevel, nodeIndex); renderUtil->ResetCurrentMesh(); @@ -1196,20 +1195,20 @@ namespace EMStudio if (!mesh->GetIsCollisionMesh()) { - renderUtil->RenderNormals(mesh, worldTM, renderVertexNormals, renderFaceNormals, renderOptions->GetVertexNormalsScale() * emstudioActor->mNormalsScaleMultiplier, renderOptions->GetFaceNormalsScale() * emstudioActor->mNormalsScaleMultiplier, renderOptions->GetVertexNormalsColor(), renderOptions->GetFaceNormalsColor()); + renderUtil->RenderNormals(mesh, worldTM, renderVertexNormals, renderFaceNormals, renderOptions->GetVertexNormalsScale() * emstudioActor->m_normalsScaleMultiplier, renderOptions->GetFaceNormalsScale() * emstudioActor->m_normalsScaleMultiplier, renderOptions->GetVertexNormalsColor(), renderOptions->GetFaceNormalsColor()); if (renderTangents) { - renderUtil->RenderTangents(mesh, worldTM, renderOptions->GetTangentsScale() * emstudioActor->mNormalsScaleMultiplier, renderOptions->GetTangentsColor(), renderOptions->GetMirroredBitangentsColor(), renderOptions->GetBitangentsColor()); + renderUtil->RenderTangents(mesh, worldTM, renderOptions->GetTangentsScale() * emstudioActor->m_normalsScaleMultiplier, renderOptions->GetTangentsColor(), renderOptions->GetMirroredBitangentsColor(), renderOptions->GetBitangentsColor()); } if (renderWireframe) { - renderUtil->RenderWireframe(mesh, worldTM, renderOptions->GetWireframeColor(), false, emstudioActor->mNormalsScaleMultiplier); + renderUtil->RenderWireframe(mesh, worldTM, renderOptions->GetWireframeColor(), false, emstudioActor->m_normalsScaleMultiplier); } } else if (renderCollisionMeshes) { - renderUtil->RenderWireframe(mesh, worldTM, renderOptions->GetCollisionMeshColor(), false, emstudioActor->mNormalsScaleMultiplier); + renderUtil->RenderWireframe(mesh, worldTM, renderOptions->GetCollisionMeshColor(), false, emstudioActor->m_normalsScaleMultiplier); } } } diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/RenderPlugin/RenderPlugin.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/RenderPlugin/RenderPlugin.h index a99a64ef68..01678e024d 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/RenderPlugin/RenderPlugin.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/RenderPlugin/RenderPlugin.h @@ -52,14 +52,14 @@ namespace EMStudio { MCORE_MEMORYOBJECTCATEGORY(RenderPlugin::EMStudioRenderActor, MCore::MCORE_DEFAULT_ALIGNMENT, MEMCATEGORY_EMSTUDIOSDK_RENDERPLUGINBASE); - EMotionFX::Actor* mActor; - AZStd::vector mBoneList; - RenderGL::GLActor* mRenderActor; - AZStd::vector mActorInstances; - float mNormalsScaleMultiplier; - float mCharacterHeight; - float mOffsetFromTrajectoryNode; - bool mMustCalcNormalScale; + EMotionFX::Actor* m_actor; + AZStd::vector m_boneList; + RenderGL::GLActor* m_renderActor; + AZStd::vector m_actorInstances; + float m_normalsScaleMultiplier; + float m_characterHeight; + float m_offsetFromTrajectoryNode; + bool m_mustCalcNormalScale; EMStudioRenderActor(EMotionFX::Actor* actor, RenderGL::GLActor* renderActor); virtual ~EMStudioRenderActor(); @@ -72,14 +72,14 @@ namespace EMStudio MCORE_MEMORYOBJECTCATEGORY(RenderPlugin::Layout, MCore::MCORE_DEFAULT_ALIGNMENT, MEMCATEGORY_EMSTUDIOSDK_RENDERPLUGINBASE); public: - Layout() { mRenderPlugin = nullptr; } + Layout() { m_renderPlugin = nullptr; } virtual ~Layout() { } virtual QWidget* Create(RenderPlugin* renderPlugin, QWidget* parent) = 0; virtual const char* GetName() = 0; virtual const char* GetImageFileName() = 0; private: - RenderPlugin* mRenderPlugin; + RenderPlugin* m_renderPlugin; }; RenderPlugin(); @@ -103,7 +103,7 @@ namespace EMStudio EMStudioPlugin::EPluginType GetPluginType() const override { return EMStudioPlugin::PLUGINTYPE_RENDERING; } uint32 GetProcessFramePriority() const override { return 100; } - PluginOptions* GetOptions() override { return &mRenderOptions; } + PluginOptions* GetOptions() override { return &m_renderOptions; } // render actors EMStudioRenderActor* FindEMStudioActor(const EMotionFX::ActorInstance* actorInstance, bool doubleCheckInstance = true) const; @@ -123,16 +123,16 @@ namespace EMStudio // manipulators void ReInitTransformationManipulators(); MCommon::TransformationManipulator* GetActiveManipulator(MCommon::Camera* camera, int32 mousePosX, int32 mousePosY); - MCORE_INLINE MCommon::TranslateManipulator* GetTranslateManipulator() { return mTranslateManipulator; } - MCORE_INLINE MCommon::RotateManipulator* GetRotateManipulator() { return mRotateManipulator; } - MCORE_INLINE MCommon::ScaleManipulator* GetScaleManipulator() { return mScaleManipulator; } + MCORE_INLINE MCommon::TranslateManipulator* GetTranslateManipulator() { return m_translateManipulator; } + MCORE_INLINE MCommon::RotateManipulator* GetRotateManipulator() { return m_rotateManipulator; } + MCORE_INLINE MCommon::ScaleManipulator* GetScaleManipulator() { return m_scaleManipulator; } // other helpers - MCORE_INLINE RenderOptions* GetRenderOptions() { return &mRenderOptions; } + MCORE_INLINE RenderOptions* GetRenderOptions() { return &m_renderOptions; } // view widget helpers - MCORE_INLINE RenderViewWidget* GetFocusViewWidget() { return mFocusViewWidget; } - MCORE_INLINE void SetFocusViewWidget(RenderViewWidget* focusViewWidget) { mFocusViewWidget = focusViewWidget; } + MCORE_INLINE RenderViewWidget* GetFocusViewWidget() { return m_focusViewWidget; } + MCORE_INLINE void SetFocusViewWidget(RenderViewWidget* focusViewWidget) { m_focusViewWidget = focusViewWidget; } RenderViewWidget* GetViewWidget(size_t index) { return m_viewWidgets[index]; } size_t GetNumViewWidgets() const { return m_viewWidgets.size(); } @@ -140,19 +140,19 @@ namespace EMStudio void RemoveViewWidget(RenderViewWidget* viewWidget); void ClearViewWidgets(); - MCORE_INLINE RenderViewWidget* GetActiveViewWidget() { return mActiveViewWidget; } - MCORE_INLINE void SetActiveViewWidget(RenderViewWidget* viewWidget) { mActiveViewWidget = viewWidget; } + MCORE_INLINE RenderViewWidget* GetActiveViewWidget() { return m_activeViewWidget; } + MCORE_INLINE void SetActiveViewWidget(RenderViewWidget* viewWidget) { m_activeViewWidget = viewWidget; } void AddLayout(Layout* layout) { m_layouts.emplace_back(layout); } Layout* FindLayoutByName(const AZStd::string& layoutName) const; Layout* GetCurrentLayout() const { return m_currentLayout; } const AZStd::vector& GetLayouts() { return m_layouts; } - MCORE_INLINE QCursor& GetZoomInCursor() { assert(mZoomInCursor); return *mZoomInCursor; } - MCORE_INLINE QCursor& GetZoomOutCursor() { assert(mZoomOutCursor); return *mZoomOutCursor; } + MCORE_INLINE QCursor& GetZoomInCursor() { assert(m_zoomInCursor); return *m_zoomInCursor; } + MCORE_INLINE QCursor& GetZoomOutCursor() { assert(m_zoomOutCursor); return *m_zoomOutCursor; } - MCORE_INLINE CommandSystem::SelectionList* GetCurrentSelection() const { return mCurrentSelection; } - MCORE_INLINE MCommon::RenderUtil* GetRenderUtil() const { return mRenderUtil; } + MCORE_INLINE CommandSystem::SelectionList* GetCurrentSelection() const { return m_currentSelection; } + MCORE_INLINE MCommon::RenderUtil* GetRenderUtil() const { return m_renderUtil; } AZ::Aabb GetSceneAabb(bool selectedInstancesOnly); @@ -195,38 +195,38 @@ namespace EMStudio AZStd::vector m_trajectoryTracePaths; // the transformation manipulators - MCommon::TranslateManipulator* mTranslateManipulator; - MCommon::RotateManipulator* mRotateManipulator; - MCommon::ScaleManipulator* mScaleManipulator; + MCommon::TranslateManipulator* m_translateManipulator; + MCommon::RotateManipulator* m_rotateManipulator; + MCommon::ScaleManipulator* m_scaleManipulator; - MCommon::RenderUtil* mRenderUtil; - RenderUpdateCallback* mUpdateCallback; + MCommon::RenderUtil* m_renderUtil; + RenderUpdateCallback* m_updateCallback; - RenderOptions mRenderOptions; - AZStd::vector mActors; + RenderOptions m_renderOptions; + AZStd::vector m_actors; // view widgets AZStd::vector m_viewWidgets; - RenderViewWidget* mActiveViewWidget; - RenderViewWidget* mFocusViewWidget; + RenderViewWidget* m_activeViewWidget; + RenderViewWidget* m_focusViewWidget; // render view layouts AZStd::vector m_layouts; Layout* m_currentLayout; // cursor image files - QCursor* mZoomInCursor; - QCursor* mZoomOutCursor; + QCursor* m_zoomInCursor; + QCursor* m_zoomOutCursor; // window visibility - bool mIsVisible; + bool m_isVisible; // base layout and interface functionality - QHBoxLayout* mBaseLayout; - QWidget* mRenderLayoutWidget; - QWidget* mInnerWidget; - CommandSystem::SelectionList* mCurrentSelection; - bool mFirstFrameAfterReInit; + QHBoxLayout* m_baseLayout; + QWidget* m_renderLayoutWidget; + QWidget* m_innerWidget; + CommandSystem::SelectionList* m_currentSelection; + bool m_firstFrameAfterReInit; bool m_reinitRequested = false; // command callbacks @@ -239,14 +239,14 @@ namespace EMStudio MCORE_DEFINECOMMANDCALLBACK(ClearSelectionCallback); MCORE_DEFINECOMMANDCALLBACK(CommandResetToBindPoseCallback); MCORE_DEFINECOMMANDCALLBACK(AdjustActorInstanceCallback); - UpdateRenderActorsCallback* mUpdateRenderActorsCallback; - ReInitRenderActorsCallback* mReInitRenderActorsCallback; - CreateActorInstanceCallback* mCreateActorInstanceCallback; - RemoveActorInstanceCallback* mRemoveActorInstanceCallback; - SelectCallback* mSelectCallback; - UnselectCallback* mUnselectCallback; - ClearSelectionCallback* mClearSelectionCallback; - CommandResetToBindPoseCallback* mResetToBindPoseCallback; - AdjustActorInstanceCallback* mAdjustActorInstanceCallback; + UpdateRenderActorsCallback* m_updateRenderActorsCallback; + ReInitRenderActorsCallback* m_reInitRenderActorsCallback; + CreateActorInstanceCallback* m_createActorInstanceCallback; + RemoveActorInstanceCallback* m_removeActorInstanceCallback; + SelectCallback* m_selectCallback; + UnselectCallback* m_unselectCallback; + ClearSelectionCallback* m_clearSelectionCallback; + CommandResetToBindPoseCallback* m_resetToBindPoseCallback; + AdjustActorInstanceCallback* m_adjustActorInstanceCallback; }; } // namespace EMStudio diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/RenderPlugin/RenderUpdateCallback.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/RenderPlugin/RenderUpdateCallback.cpp index 3c146c528b..5cc88db0b0 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/RenderPlugin/RenderUpdateCallback.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/RenderPlugin/RenderUpdateCallback.cpp @@ -21,15 +21,15 @@ namespace EMStudio // constructor RenderUpdateCallback::RenderUpdateCallback(RenderPlugin* plugin) { - mEnableRendering = true; - mPlugin = plugin; + m_enableRendering = true; + m_plugin = plugin; } // enable or disable rendering void RenderUpdateCallback::SetEnableRendering(bool renderingEnabled) { - mEnableRendering = renderingEnabled; + m_enableRendering = renderingEnabled; } @@ -41,7 +41,7 @@ namespace EMStudio // set to visible for the cases the active view widget is nullptr // this happens when call the Process() function from the render plugin before we update our view - RenderViewWidget* widget = mPlugin->GetActiveViewWidget(); + RenderViewWidget* widget = m_plugin->GetActiveViewWidget(); if (widget == nullptr) { actorInstance->SetIsVisible(true); @@ -72,7 +72,7 @@ namespace EMStudio //actorInstance->UpdateTransformations( timePassedInSeconds, true); // find the corresponding trajectory trace path for the given actor instance - MCommon::RenderUtil::TrajectoryTracePath* trajectoryPath = mPlugin->FindTracePath(actorInstance); + MCommon::RenderUtil::TrajectoryTracePath* trajectoryPath = m_plugin->FindTracePath(actorInstance); if (trajectoryPath) { EMotionFX::Actor* actor = actorInstance->GetActor(); @@ -84,20 +84,20 @@ namespace EMStudio const EMotionFX::Transform globalTM = transformData->GetCurrentPose()->GetWorldSpaceTransform(motionExtractionNode->GetNodeIndex()).ProjectedToGroundPlane(); bool distanceTraveledEnough = false; - if (trajectoryPath->mTraceParticles.empty()) + if (trajectoryPath->m_traceParticles.empty()) { distanceTraveledEnough = true; } else { - const size_t numParticles = trajectoryPath->mTraceParticles.size(); - const EMotionFX::Transform& oldGlobalTM = trajectoryPath->mTraceParticles[numParticles - 1].mWorldTM; + const size_t numParticles = trajectoryPath->m_traceParticles.size(); + const EMotionFX::Transform& oldGlobalTM = trajectoryPath->m_traceParticles[numParticles - 1].m_worldTm; - const AZ::Vector3& oldPos = oldGlobalTM.mPosition; - const AZ::Quaternion& oldRot = oldGlobalTM.mRotation; - const AZ::Quaternion rotation = globalTM.mRotation.GetNormalized(); + const AZ::Vector3& oldPos = oldGlobalTM.m_position; + const AZ::Quaternion& oldRot = oldGlobalTM.m_rotation; + const AZ::Quaternion rotation = globalTM.m_rotation.GetNormalized(); - const AZ::Vector3 deltaPos = globalTM.mPosition - oldPos; + const AZ::Vector3 deltaPos = globalTM.m_position - oldPos; float deltaRot = MCore::Math::Abs(rotation.Dot(oldRot)); if (MCore::SafeLength(deltaPos) > 0.0001f || deltaRot < 0.99f) @@ -107,25 +107,25 @@ namespace EMStudio } // add the time delta to the time passed since the last add - trajectoryPath->mTimePassed += timePassedInSeconds; + trajectoryPath->m_timePassed += timePassedInSeconds; const uint32 particleSampleRate = 30; - if (trajectoryPath->mTimePassed >= (1.0f / particleSampleRate) && distanceTraveledEnough) + if (trajectoryPath->m_timePassed >= (1.0f / particleSampleRate) && distanceTraveledEnough) { // create the particle, fill its data and add it to the trajectory trace path MCommon::RenderUtil::TrajectoryPathParticle trajectoryParticle; - trajectoryParticle.mWorldTM = globalTM; - trajectoryPath->mTraceParticles.emplace_back(trajectoryParticle); + trajectoryParticle.m_worldTm = globalTM; + trajectoryPath->m_traceParticles.emplace_back(trajectoryParticle); // reset the time passed as we just added a new particle - trajectoryPath->mTimePassed = 0.0f; + trajectoryPath->m_timePassed = 0.0f; } } // make sure we don't have too many items in our array - if (trajectoryPath->mTraceParticles.size() > 50) + if (trajectoryPath->m_traceParticles.size() > 50) { - trajectoryPath->mTraceParticles.erase(begin(trajectoryPath->mTraceParticles)); + trajectoryPath->m_traceParticles.erase(begin(trajectoryPath->m_traceParticles)); } } } @@ -136,19 +136,19 @@ namespace EMStudio { MCORE_UNUSED(timePassedInSeconds); - if (mEnableRendering == false) + if (m_enableRendering == false) { return; } - RenderPlugin::EMStudioRenderActor* emstudioActor = mPlugin->FindEMStudioActor(actorInstance); + RenderPlugin::EMStudioRenderActor* emstudioActor = m_plugin->FindEMStudioActor(actorInstance); if (emstudioActor == nullptr) { return; } // renderUtil options - MCommon::RenderUtil* renderUtil = mPlugin->GetRenderUtil(); + MCommon::RenderUtil* renderUtil = m_plugin->GetRenderUtil(); if (renderUtil == nullptr) { return; @@ -157,8 +157,8 @@ namespace EMStudio actorInstance->UpdateMeshDeformers(timePassedInSeconds); // get the active widget & it's rendering options - RenderViewWidget* widget = mPlugin->GetActiveViewWidget(); - RenderOptions* renderOptions = mPlugin->GetRenderOptions(); + RenderViewWidget* widget = m_plugin->GetActiveViewWidget(); + RenderOptions* renderOptions = m_plugin->GetRenderOptions(); const AZStd::unordered_set& visibleJointIndices = GetManager()->GetVisibleJointIndices(); const AZStd::unordered_set& selectedJointIndices = GetManager()->GetSelectedJointIndices(); @@ -167,9 +167,9 @@ namespace EMStudio if (widget->GetRenderFlag(RenderViewWidget::RENDER_AABB)) { MCommon::RenderUtil::AABBRenderSettings settings; - settings.mNodeBasedColor = renderOptions->GetNodeAABBColor(); - settings.mStaticBasedColor = renderOptions->GetStaticAABBColor(); - settings.mMeshBasedColor = renderOptions->GetMeshAABBColor(); + settings.m_nodeBasedColor = renderOptions->GetNodeAABBColor(); + settings.m_staticBasedColor = renderOptions->GetStaticAABBColor(); + settings.m_meshBasedColor = renderOptions->GetMeshAABBColor(); renderUtil->RenderAabbs(actorInstance, settings); } @@ -185,11 +185,11 @@ namespace EMStudio renderUtil->EnableLighting(false); // disable lighting if (widget->GetRenderFlag(RenderViewWidget::RENDER_SKELETON)) { - renderUtil->RenderSkeleton(actorInstance, emstudioActor->mBoneList, &visibleJointIndices, &selectedJointIndices, renderOptions->GetSkeletonColor(), renderOptions->GetSelectedObjectColor()); + renderUtil->RenderSkeleton(actorInstance, emstudioActor->m_boneList, &visibleJointIndices, &selectedJointIndices, renderOptions->GetSkeletonColor(), renderOptions->GetSelectedObjectColor()); } if (widget->GetRenderFlag(RenderViewWidget::RENDER_NODEORIENTATION)) { - renderUtil->RenderNodeOrientations(actorInstance, emstudioActor->mBoneList, &visibleJointIndices, &selectedJointIndices, renderOptions->GetNodeOrientationScale(), renderOptions->GetScaleBonesOnLength()); + renderUtil->RenderNodeOrientations(actorInstance, emstudioActor->m_boneList, &visibleJointIndices, &selectedJointIndices, renderOptions->GetNodeOrientationScale(), renderOptions->GetScaleBonesOnLength()); } if (widget->GetRenderFlag(RenderViewWidget::RENDER_ACTORBINDPOSE)) { @@ -200,8 +200,7 @@ namespace EMStudio if (widget->GetRenderFlag(RenderViewWidget::RENDER_MOTIONEXTRACTION)) { // render an arrow for the trajectory node - //renderUtil->RenderTrajectoryNode(actorInstance, renderOptions->mTrajectoryArrowInnerColor, renderOptions->mTrajectoryArrowBorderColor, emstudioActor->mCharacterHeight*0.05f); - renderUtil->RenderTrajectoryPath(mPlugin->FindTracePath(actorInstance), renderOptions->GetTrajectoryArrowInnerColor(), emstudioActor->mCharacterHeight * 0.05f); + renderUtil->RenderTrajectoryPath(m_plugin->FindTracePath(actorInstance), renderOptions->GetTrajectoryArrowInnerColor(), emstudioActor->m_characterHeight * 0.05f); } renderUtil->EnableCulling(cullingEnabled); // reset to the old state renderUtil->EnableLighting(lightingEnabled); @@ -220,9 +219,8 @@ namespace EMStudio const size_t numEnabled = actorInstance->GetNumEnabledNodes(); for (size_t i = 0; i < numEnabled; ++i) { - EMotionFX::Node* node = emstudioActor->mActor->GetSkeleton()->GetNode(actorInstance->GetEnabledNode(i)); - EMotionFX::Mesh* mesh = emstudioActor->mActor->GetMesh(geomLODLevel, node->GetNodeIndex()); - //EMotionFX::Mesh* collisionMesh = emstudioActor->mActor->GetCollisionMesh( geomLODLevel, node->GetNodeIndex() ); + EMotionFX::Node* node = emstudioActor->m_actor->GetSkeleton()->GetNode(actorInstance->GetEnabledNode(i)); + EMotionFX::Mesh* mesh = emstudioActor->m_actor->GetMesh(geomLODLevel, node->GetNodeIndex()); const AZ::Transform globalTM = pose->GetWorldSpaceTransform(node->GetNodeIndex()).ToAZTransform(); renderUtil->ResetCurrentMesh(); @@ -234,10 +232,10 @@ namespace EMStudio if (mesh->GetIsCollisionMesh() == false) { - renderUtil->RenderNormals(mesh, globalTM, renderVertexNormals, renderFaceNormals, renderOptions->GetVertexNormalsScale() * emstudioActor->mNormalsScaleMultiplier, renderOptions->GetFaceNormalsScale() * emstudioActor->mNormalsScaleMultiplier, renderOptions->GetVertexNormalsColor(), renderOptions->GetFaceNormalsColor()); + renderUtil->RenderNormals(mesh, globalTM, renderVertexNormals, renderFaceNormals, renderOptions->GetVertexNormalsScale() * emstudioActor->m_normalsScaleMultiplier, renderOptions->GetFaceNormalsScale() * emstudioActor->m_normalsScaleMultiplier, renderOptions->GetVertexNormalsColor(), renderOptions->GetFaceNormalsColor()); if (renderTangents) { - renderUtil->RenderTangents(mesh, globalTM, renderOptions->GetTangentsScale() * emstudioActor->mNormalsScaleMultiplier, renderOptions->GetTangentsColor(), renderOptions->GetMirroredBitangentsColor(), renderOptions->GetBitangentsColor()); + renderUtil->RenderTangents(mesh, globalTM, renderOptions->GetTangentsScale() * emstudioActor->m_normalsScaleMultiplier, renderOptions->GetTangentsColor(), renderOptions->GetMirroredBitangentsColor(), renderOptions->GetBitangentsColor()); } if (renderWireframe) { @@ -253,7 +251,7 @@ namespace EMStudio } // render the selection - if (renderOptions->GetRenderSelectionBox() && EMotionFX::GetActorManager().GetNumActorInstances() != 1 && mPlugin->GetCurrentSelection()->CheckIfHasActorInstance(actorInstance)) + if (renderOptions->GetRenderSelectionBox() && EMotionFX::GetActorManager().GetNumActorInstances() != 1 && m_plugin->GetCurrentSelection()->CheckIfHasActorInstance(actorInstance)) { AZ::Aabb aabb = actorInstance->GetAabb(); aabb.Expand(aabb.GetExtents() * 0.005f); diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/RenderPlugin/RenderUpdateCallback.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/RenderPlugin/RenderUpdateCallback.h index fed8d5feec..a9bc26ae22 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/RenderPlugin/RenderUpdateCallback.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/RenderPlugin/RenderUpdateCallback.h @@ -34,8 +34,8 @@ namespace EMStudio void SetEnableRendering(bool renderingEnabled); protected: - bool mEnableRendering; - RenderPlugin* mPlugin; + bool m_enableRendering; + RenderPlugin* m_plugin; }; } // namespace EMStudio diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/RenderPlugin/RenderViewWidget.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/RenderPlugin/RenderViewWidget.cpp index 55699c165f..93a6dd3019 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/RenderPlugin/RenderViewWidget.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/RenderPlugin/RenderViewWidget.cpp @@ -26,12 +26,12 @@ namespace EMStudio { for (uint32 i = 0; i < NUM_RENDER_OPTIONS; ++i) { - mToolbarButtons[i] = nullptr; - mActions[i] = nullptr; + m_toolbarButtons[i] = nullptr; + m_actions[i] = nullptr; } - mRenderOptionsWindow = nullptr; - mPlugin = parentPlugin; + m_renderOptionsWindow = nullptr; + m_plugin = parentPlugin; // create the vertical layout with the menu and the gl widget as entries QVBoxLayout* verticalLayout = new QVBoxLayout(this); @@ -40,14 +40,14 @@ namespace EMStudio verticalLayout->setMargin(0); // create toolbar - mToolBar = new QToolBar(this); - mToolBar->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); + m_toolBar = new QToolBar(this); + m_toolBar->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); // add the toolbar to the vertical layout - verticalLayout->addWidget(mToolBar); + verticalLayout->addWidget(m_toolBar); QWidget* renderWidget = nullptr; - mPlugin->CreateRenderWidget(this, &mRenderWidget, &renderWidget); + m_plugin->CreateRenderWidget(this, &m_renderWidget, &renderWidget); verticalLayout->addWidget(renderWidget); new QActionGroup(this); @@ -65,14 +65,14 @@ namespace EMStudio group->addAction(action); } - mToolBar->addSeparator(); + m_toolBar->addSeparator(); QAction* layoutsAction = AddToolBarAction("Layouts", "Layout_category.svg"); { QMenu* contextMenu = new QMenu(this); - const AZStd::vector& layouts = mPlugin->GetLayouts(); - const RenderPlugin::Layout* currentLayout = mPlugin->GetCurrentLayout(); + const AZStd::vector& layouts = m_plugin->GetLayouts(); + const RenderPlugin::Layout* currentLayout = m_plugin->GetCurrentLayout(); for (RenderPlugin::Layout* layout : layouts) { QAction* layoutAction = contextMenu->addAction(layout->GetName()); @@ -80,15 +80,15 @@ namespace EMStudio layoutAction->setCheckable(true); layoutAction->setChecked(layout == currentLayout); - connect(layoutAction, &QAction::triggered, mPlugin, [this, layout](){ - mPlugin->LayoutButtonPressed(layout->GetName()); + connect(layoutAction, &QAction::triggered, m_plugin, [this, layout](){ + m_plugin->LayoutButtonPressed(layout->GetName()); }); } connect(layoutsAction, &QAction::toggled, contextMenu, &QMenu::show); layoutsAction->setMenu(contextMenu); - auto widgetForAction = qobject_cast(mToolBar->widgetForAction(layoutsAction)); + auto widgetForAction = qobject_cast(m_toolBar->widgetForAction(layoutsAction)); if (widgetForAction) { connect(layoutsAction, &QAction::triggered, widgetForAction, &QToolButton::showMenu); @@ -131,7 +131,7 @@ namespace EMStudio viewOptionsAction->setMenu(contextMenu); - auto widgetForAction = qobject_cast(mToolBar->widgetForAction(viewOptionsAction)); + auto widgetForAction = qobject_cast(m_toolBar->widgetForAction(viewOptionsAction)); if (widgetForAction) { connect(viewOptionsAction, &QAction::triggered, widgetForAction, &QToolButton::showMenu); @@ -166,26 +166,26 @@ namespace EMStudio cameraMenu->addSeparator(); - mFollowCharacterAction = cameraMenu->addAction(tr("Follow Character")); - mFollowCharacterAction->setCheckable(true); - mFollowCharacterAction->setChecked(true); - connect(mFollowCharacterAction, &QAction::triggered, this, &RenderViewWidget::OnFollowCharacter); + m_followCharacterAction = cameraMenu->addAction(tr("Follow Character")); + m_followCharacterAction->setCheckable(true); + m_followCharacterAction->setChecked(true); + connect(m_followCharacterAction, &QAction::triggered, this, &RenderViewWidget::OnFollowCharacter); cameraOptionsAction->setMenu(cameraMenu); - mCameraMenu = cameraMenu; + m_cameraMenu = cameraMenu; - auto widgetForAction = qobject_cast(mToolBar->widgetForAction(cameraOptionsAction)); + auto widgetForAction = qobject_cast(m_toolBar->widgetForAction(cameraOptionsAction)); if (widgetForAction) { connect(cameraOptionsAction, &QAction::triggered, widgetForAction, &QToolButton::showMenu); } } - connect(m_manipulatorModes[RenderOptions::SELECT], &QAction::triggered, mPlugin, &RenderPlugin::SetSelectionMode); - connect(m_manipulatorModes[RenderOptions::TRANSLATE], &QAction::triggered, mPlugin, &RenderPlugin::SetTranslationMode); - connect(m_manipulatorModes[RenderOptions::ROTATE], &QAction::triggered, mPlugin, &RenderPlugin::SetRotationMode); - connect(m_manipulatorModes[RenderOptions::SCALE], &QAction::triggered, mPlugin, &RenderPlugin::SetScaleMode); + connect(m_manipulatorModes[RenderOptions::SELECT], &QAction::triggered, m_plugin, &RenderPlugin::SetSelectionMode); + connect(m_manipulatorModes[RenderOptions::TRANSLATE], &QAction::triggered, m_plugin, &RenderPlugin::SetTranslationMode); + connect(m_manipulatorModes[RenderOptions::ROTATE], &QAction::triggered, m_plugin, &RenderPlugin::SetRotationMode); + connect(m_manipulatorModes[RenderOptions::SCALE], &QAction::triggered, m_plugin, &RenderPlugin::SetScaleMode); QAction* toggleSelectionBoxRendering = new QAction( "Toggle Selection Box Rendering", @@ -195,7 +195,7 @@ namespace EMStudio GetMainWindow()->GetShortcutManager()->RegisterKeyboardShortcut(toggleSelectionBoxRendering, RenderPlugin::s_renderWindowShortcutGroupName, true); connect(toggleSelectionBoxRendering, &QAction::triggered, this, [this] { - mPlugin->GetRenderOptions()->SetRenderSelectionBox(mPlugin->GetRenderOptions()->GetRenderSelectionBox() ^ true); + m_plugin->GetRenderOptions()->SetRenderSelectionBox(m_plugin->GetRenderOptions()->GetRenderSelectionBox() ^ true); }); addAction(toggleSelectionBoxRendering); @@ -257,13 +257,13 @@ namespace EMStudio { const uint32 optionIndex = (uint32)option; - if (mToolbarButtons[optionIndex]) + if (m_toolbarButtons[optionIndex]) { - mToolbarButtons[optionIndex]->setChecked(isEnabled); + m_toolbarButtons[optionIndex]->setChecked(isEnabled); } - if (mActions[optionIndex]) + if (m_actions[optionIndex]) { - mActions[optionIndex]->setChecked(isEnabled); + m_actions[optionIndex]->setChecked(isEnabled); } } @@ -280,7 +280,7 @@ namespace EMStudio if (actionIndex >= 0) { - mActions[actionIndex] = action; + m_actions[actionIndex] = action; } } @@ -290,7 +290,7 @@ namespace EMStudio iconFileName += iconName; const QIcon& icon = MysticQt::GetMysticQt()->FindIcon(iconFileName.c_str()); - QAction* action = mToolBar->addAction(icon, entryName); + QAction* action = m_toolBar->addAction(icon, entryName); return action; } @@ -299,22 +299,22 @@ namespace EMStudio // destructor RenderViewWidget::~RenderViewWidget() { - mPlugin->RemoveViewWidget(this); + m_plugin->RemoveViewWidget(this); } // show the global rendering options dialog void RenderViewWidget::OnOptions() { - if (mRenderOptionsWindow == nullptr) + if (m_renderOptionsWindow == nullptr) { - mRenderOptionsWindow = new PreferencesWindow(this); - mRenderOptionsWindow->Init(); + m_renderOptionsWindow = new PreferencesWindow(this); + m_renderOptionsWindow->Init(); - AzToolsFramework::ReflectedPropertyEditor* generalPropertyWidget = mRenderOptionsWindow->FindPropertyWidgetByName("General"); + AzToolsFramework::ReflectedPropertyEditor* generalPropertyWidget = m_renderOptionsWindow->FindPropertyWidgetByName("General"); if (!generalPropertyWidget) { - generalPropertyWidget = mRenderOptionsWindow->AddCategory("General"); + generalPropertyWidget = m_renderOptionsWindow->AddCategory("General"); generalPropertyWidget->ClearInstances(); generalPropertyWidget->InvalidateAll(); } @@ -327,7 +327,7 @@ namespace EMStudio return; } - PluginOptions* pluginOptions = mPlugin->GetOptions(); + PluginOptions* pluginOptions = m_plugin->GetOptions(); AZ_Assert(pluginOptions, "Expected options in render plugin"); generalPropertyWidget->AddInstance(pluginOptions, azrtti_typeid(pluginOptions)); @@ -339,25 +339,25 @@ namespace EMStudio generalPropertyWidget->InvalidateAll(); } - mRenderOptionsWindow->show(); + m_renderOptionsWindow->show(); } void RenderViewWidget::OnShowSelected() { - mRenderWidget->ViewCloseup(true, DEFAULT_FLIGHT_TIME); + m_renderWidget->ViewCloseup(true, DEFAULT_FLIGHT_TIME); } void RenderViewWidget::OnShowEntireScene() { - mRenderWidget->ViewCloseup(false, DEFAULT_FLIGHT_TIME); + m_renderWidget->ViewCloseup(false, DEFAULT_FLIGHT_TIME); } void RenderViewWidget::SetCharacterFollowModeActive(bool active) { - mFollowCharacterAction->setChecked(active); + m_followCharacterAction->setChecked(active); } @@ -366,9 +366,9 @@ namespace EMStudio CommandSystem::SelectionList& selectionList = GetCommandManager()->GetCurrentSelection(); EMotionFX::ActorInstance* followInstance = selectionList.GetFirstActorInstance(); - if (followInstance && GetIsCharacterFollowModeActive() && mRenderWidget) + if (followInstance && GetIsCharacterFollowModeActive() && m_renderWidget) { - mRenderWidget->ViewCloseup(true, DEFAULT_FLIGHT_TIME, 1); + m_renderWidget->ViewCloseup(true, DEFAULT_FLIGHT_TIME, 1); } } @@ -379,7 +379,7 @@ namespace EMStudio { QAction* action = actionModePair.first; action->setCheckable(true); - action->setChecked(mRenderWidget->GetCameraMode() == actionModePair.second); + action->setChecked(m_renderWidget->GetCameraMode() == actionModePair.second); } } @@ -389,10 +389,10 @@ namespace EMStudio for (uint32 i = 0; i < numRenderOptions; ++i) { QString name = QString(i); - settings->setValue(name, mActions[i] ? mActions[i]->isChecked() : false); + settings->setValue(name, m_actions[i] ? m_actions[i]->isChecked() : false); } - settings->setValue("CameraMode", (int32)mRenderWidget->GetCameraMode()); + settings->setValue("CameraMode", (int32)m_renderWidget->GetCameraMode()); settings->setValue("CharacterFollowMode", GetIsCharacterFollowModeActive()); } @@ -403,7 +403,7 @@ namespace EMStudio for (uint32 i = 0; i < numRenderOptions; ++i) { QString name = QString(i); - const bool isEnabled = settings->value(name, mActions[i] ? mActions[i]->isChecked() : false).toBool(); + const bool isEnabled = settings->value(name, m_actions[i] ? m_actions[i]->isChecked() : false).toBool(); SetRenderFlag((ERenderFlag)i, isEnabled); } @@ -411,8 +411,8 @@ namespace EMStudio SetRenderFlag(RENDER_COLLISIONMESHES, false); SetRenderFlag(RENDER_TEXTURING, false); - RenderWidget::CameraMode cameraMode = (RenderWidget::CameraMode)settings->value("CameraMode", (int32)mRenderWidget->GetCameraMode()).toInt(); - mRenderWidget->SwitchCamera(cameraMode); + RenderWidget::CameraMode cameraMode = (RenderWidget::CameraMode)settings->value("CameraMode", (int32)m_renderWidget->GetCameraMode()).toInt(); + m_renderWidget->SwitchCamera(cameraMode); const bool followMode = settings->value("CharacterFollowMode", GetIsCharacterFollowModeActive()).toBool(); SetCharacterFollowModeActive(followMode); @@ -426,7 +426,7 @@ namespace EMStudio const uint32 numRenderOptions = NUM_RENDER_OPTIONS; for (uint32 i = 0; i < numRenderOptions; ++i) { - if (mActions[i] == action) + if (m_actions[i] == action) { return i; } diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/RenderPlugin/RenderViewWidget.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/RenderPlugin/RenderViewWidget.h index defdb0d2a7..aed4f0c133 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/RenderPlugin/RenderViewWidget.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/RenderPlugin/RenderViewWidget.h @@ -71,16 +71,16 @@ namespace EMStudio NUM_RENDER_OPTIONS = 26 }; - MCORE_INLINE bool GetRenderFlag(ERenderFlag option) { return mActions[(uint32)option] ? mActions[(uint32)option]->isChecked() : false; } + MCORE_INLINE bool GetRenderFlag(ERenderFlag option) { return m_actions[(uint32)option] ? m_actions[(uint32)option]->isChecked() : false; } void SetRenderFlag(ERenderFlag option, bool isEnabled); uint32 FindActionIndex(QAction* action); - RenderWidget* GetRenderWidget() const { return mRenderWidget; } - QMenu* GetCameraMenu() const { return mCameraMenu; } + RenderWidget* GetRenderWidget() const { return m_renderWidget; } + QMenu* GetCameraMenu() const { return m_cameraMenu; } void SaveOptions(QSettings* settings); void LoadOptions(QSettings* settings); - bool GetIsCharacterFollowModeActive() const { return mFollowCharacterAction->isChecked(); } + bool GetIsCharacterFollowModeActive() const { return m_followCharacterAction->isChecked(); } void SetCharacterFollowModeActive(bool active); void OnContextMenuEvent(QWidget* renderWidget, bool ctrlPressed, int32 localMouseX, int32 localMouseY, QPoint globalMousePos, RenderPlugin* plugin, MCommon::Camera* camera); @@ -89,17 +89,17 @@ namespace EMStudio public slots: void OnOptions(); - void OnOrbitCamera() { mRenderWidget->SwitchCamera(RenderWidget::CAMMODE_ORBIT); UpdateInterface(); } - void OnFirstPersonCamera() { mRenderWidget->SwitchCamera(RenderWidget::CAMMODE_FIRSTPERSON); UpdateInterface(); } - void OnOrthoFrontCamera() { mRenderWidget->SwitchCamera(RenderWidget::CAMMODE_FRONT); UpdateInterface(); } - void OnOrthoBackCamera() { mRenderWidget->SwitchCamera(RenderWidget::CAMMODE_BACK); UpdateInterface(); } - void OnOrthoLeftCamera() { mRenderWidget->SwitchCamera(RenderWidget::CAMMODE_LEFT); UpdateInterface(); } - void OnOrthoRightCamera() { mRenderWidget->SwitchCamera(RenderWidget::CAMMODE_RIGHT); UpdateInterface(); } - void OnOrthoTopCamera() { mRenderWidget->SwitchCamera(RenderWidget::CAMMODE_TOP); UpdateInterface(); } - void OnOrthoBottomCamera() { mRenderWidget->SwitchCamera(RenderWidget::CAMMODE_BOTTOM); UpdateInterface(); } + void OnOrbitCamera() { m_renderWidget->SwitchCamera(RenderWidget::CAMMODE_ORBIT); UpdateInterface(); } + void OnFirstPersonCamera() { m_renderWidget->SwitchCamera(RenderWidget::CAMMODE_FIRSTPERSON); UpdateInterface(); } + void OnOrthoFrontCamera() { m_renderWidget->SwitchCamera(RenderWidget::CAMMODE_FRONT); UpdateInterface(); } + void OnOrthoBackCamera() { m_renderWidget->SwitchCamera(RenderWidget::CAMMODE_BACK); UpdateInterface(); } + void OnOrthoLeftCamera() { m_renderWidget->SwitchCamera(RenderWidget::CAMMODE_LEFT); UpdateInterface(); } + void OnOrthoRightCamera() { m_renderWidget->SwitchCamera(RenderWidget::CAMMODE_RIGHT); UpdateInterface(); } + void OnOrthoTopCamera() { m_renderWidget->SwitchCamera(RenderWidget::CAMMODE_TOP); UpdateInterface(); } + void OnOrthoBottomCamera() { m_renderWidget->SwitchCamera(RenderWidget::CAMMODE_BOTTOM); UpdateInterface(); } void OnResetCamera(float flightTime = 1.0f) { - MCommon::Camera* camera = mRenderWidget->GetCamera(); + MCommon::Camera* camera = m_renderWidget->GetCamera(); if (camera) { camera->Reset(flightTime); @@ -117,15 +117,15 @@ namespace EMStudio QAction* AddToolBarAction(const char* entryName, const char* iconName); void Reset(); - QToolBar* mToolBar; - QMenu* mCameraMenu; - RenderWidget* mRenderWidget; - QAction* mActions[NUM_RENDER_OPTIONS]; - QAction* mFollowCharacterAction; + QToolBar* m_toolBar; + QMenu* m_cameraMenu; + RenderWidget* m_renderWidget; + QAction* m_actions[NUM_RENDER_OPTIONS]; + QAction* m_followCharacterAction; AZStd::vector> m_cameraModeActions; - QPushButton* mToolbarButtons[NUM_RENDER_OPTIONS]; + QPushButton* m_toolbarButtons[NUM_RENDER_OPTIONS]; AZStd::array m_manipulatorModes; - RenderPlugin* mPlugin; - PreferencesWindow* mRenderOptionsWindow; + RenderPlugin* m_plugin; + PreferencesWindow* m_renderOptionsWindow; }; } // namespace EMStudio diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/RenderPlugin/RenderWidget.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/RenderPlugin/RenderWidget.cpp index 56d27222bb..429a0bffae 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/RenderPlugin/RenderWidget.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/RenderPlugin/RenderWidget.cpp @@ -30,31 +30,28 @@ namespace EMStudio // constructor RenderWidget::RenderWidget(RenderPlugin* renderPlugin, RenderViewWidget* viewWidget) - : mEventHandler(this) + : m_eventHandler(this) { // create our event handler - EMotionFX::GetEventManager().AddEventHandler(&mEventHandler); - - //mLines.SetMemoryCategory(MEMCATEGORY_EMSTUDIOSDK_RENDERPLUGINBASE); - //mLines.Reserve(2048); + EMotionFX::GetEventManager().AddEventHandler(&m_eventHandler); // camera used to render the little axis on the bottom left - mAxisFakeCamera = new MCommon::OrthographicCamera(MCommon::OrthographicCamera::VIEWMODE_FRONT); + m_axisFakeCamera = new MCommon::OrthographicCamera(MCommon::OrthographicCamera::VIEWMODE_FRONT); - mPlugin = renderPlugin; - mViewWidget = viewWidget; - mWidth = 0; - mHeight = 0; - mViewCloseupWaiting = 0; - mPrevMouseX = 0; - mPrevMouseY = 0; - mPrevLocalMouseX = 0; - mPrevLocalMouseY = 0; - mOldActorInstancePos = AZ::Vector3::CreateZero(); - mCamera = nullptr; - mActiveTransformManip = nullptr; - mSkipFollowCalcs = false; - mNeedDisableFollowMode = true; + m_plugin = renderPlugin; + m_viewWidget = viewWidget; + m_width = 0; + m_height = 0; + m_viewCloseupWaiting = 0; + m_prevMouseX = 0; + m_prevMouseY = 0; + m_prevLocalMouseX = 0; + m_prevLocalMouseY = 0; + m_oldActorInstancePos = AZ::Vector3::CreateZero(); + m_camera = nullptr; + m_activeTransformManip = nullptr; + m_skipFollowCalcs = false; + m_needDisableFollowMode = true; } @@ -62,81 +59,81 @@ namespace EMStudio RenderWidget::~RenderWidget() { // get rid of the event handler - EMotionFX::GetEventManager().RemoveEventHandler(&mEventHandler); + EMotionFX::GetEventManager().RemoveEventHandler(&m_eventHandler); // get rid of the camera objects - delete mCamera; - delete mAxisFakeCamera; + delete m_camera; + delete m_axisFakeCamera; } // start view closeup flight void RenderWidget::ViewCloseup(const AZ::Aabb& aabb, float flightTime, uint32 viewCloseupWaiting) { - mViewCloseupWaiting = viewCloseupWaiting; - mViewCloseupAABB = aabb; - mViewCloseupFlightTime = flightTime; + m_viewCloseupWaiting = viewCloseupWaiting; + m_viewCloseupAabb = aabb; + m_viewCloseupFlightTime = flightTime; } void RenderWidget::ViewCloseup(bool selectedInstancesOnly, float flightTime, uint32 viewCloseupWaiting) { - mViewCloseupWaiting = viewCloseupWaiting; - mViewCloseupAABB = mPlugin->GetSceneAabb(selectedInstancesOnly); - mViewCloseupFlightTime = flightTime; + m_viewCloseupWaiting = viewCloseupWaiting; + m_viewCloseupAabb = m_plugin->GetSceneAabb(selectedInstancesOnly); + m_viewCloseupFlightTime = flightTime; } // switch the active camera void RenderWidget::SwitchCamera(CameraMode mode) { - delete mCamera; - mCameraMode = mode; + delete m_camera; + m_cameraMode = mode; switch (mode) { case CAMMODE_ORBIT: { - mCamera = new MCommon::OrbitCamera(); + m_camera = new MCommon::OrbitCamera(); break; } case CAMMODE_FIRSTPERSON: { - mCamera = new MCommon::FirstPersonCamera(); + m_camera = new MCommon::FirstPersonCamera(); break; } case CAMMODE_FRONT: { - mCamera = new MCommon::OrthographicCamera(MCommon::OrthographicCamera::VIEWMODE_FRONT); + m_camera = new MCommon::OrthographicCamera(MCommon::OrthographicCamera::VIEWMODE_FRONT); break; } case CAMMODE_BACK: { - mCamera = new MCommon::OrthographicCamera(MCommon::OrthographicCamera::VIEWMODE_BACK); + m_camera = new MCommon::OrthographicCamera(MCommon::OrthographicCamera::VIEWMODE_BACK); break; } case CAMMODE_LEFT: { - mCamera = new MCommon::OrthographicCamera(MCommon::OrthographicCamera::VIEWMODE_LEFT); + m_camera = new MCommon::OrthographicCamera(MCommon::OrthographicCamera::VIEWMODE_LEFT); break; } case CAMMODE_RIGHT: { - mCamera = new MCommon::OrthographicCamera(MCommon::OrthographicCamera::VIEWMODE_RIGHT); + m_camera = new MCommon::OrthographicCamera(MCommon::OrthographicCamera::VIEWMODE_RIGHT); break; } case CAMMODE_TOP: { - mCamera = new MCommon::OrthographicCamera(MCommon::OrthographicCamera::VIEWMODE_TOP); + m_camera = new MCommon::OrthographicCamera(MCommon::OrthographicCamera::VIEWMODE_TOP); break; } case CAMMODE_BOTTOM: { - mCamera = new MCommon::OrthographicCamera(MCommon::OrthographicCamera::VIEWMODE_BOTTOM); + m_camera = new MCommon::OrthographicCamera(MCommon::OrthographicCamera::VIEWMODE_BOTTOM); break; } } // show the entire scene - mPlugin->ViewCloseup(false, this, 0.0f); + m_plugin->ViewCloseup(false, this, 0.0f); } @@ -160,7 +157,7 @@ namespace EMStudio float camDist = 0.0f; // calculate cam distance for the orthographic cam mode - if (mCamera->GetProjectionMode() == MCommon::Camera::PROJMODE_ORTHOGRAPHIC) + if (m_camera->GetProjectionMode() == MCommon::Camera::PROJMODE_ORTHOGRAPHIC) { camDist = 0.75f; switch (GetCameraMode()) @@ -168,20 +165,20 @@ namespace EMStudio case CAMMODE_FRONT: case CAMMODE_BOTTOM: // -(scale.x) - camDist *= -2.0f / static_cast(mCamera->GetViewProjMatrix().GetElement(0, 0)); + camDist *= -2.0f / static_cast(m_camera->GetViewProjMatrix().GetElement(0, 0)); break; case CAMMODE_BACK: case CAMMODE_TOP: // scale.x - camDist *= 2.0f / static_cast(mCamera->GetViewProjMatrix().GetElement(0, 0)); + camDist *= 2.0f / static_cast(m_camera->GetViewProjMatrix().GetElement(0, 0)); break; case CAMMODE_LEFT: // -(scale.y) - camDist *= -2.0f / static_cast(mCamera->GetViewProjMatrix().GetElement(0, 1)); + camDist *= -2.0f / static_cast(m_camera->GetViewProjMatrix().GetElement(0, 1)); break; case CAMMODE_RIGHT: // scale.y - camDist *= 2.0f / static_cast(mCamera->GetViewProjMatrix().GetElement(0, 1)); + camDist *= 2.0f / static_cast(m_camera->GetViewProjMatrix().GetElement(0, 1)); break; default: break; @@ -191,14 +188,14 @@ namespace EMStudio else { if (activeManipulator->GetSelectionLocked() && - mViewWidget->GetIsCharacterFollowModeActive() == false && + m_viewWidget->GetIsCharacterFollowModeActive() == false && activeManipulator->GetType() == MCommon::TransformationManipulator::GIZMOTYPE_TRANSLATION) { - camDist = (callback->GetOldValueVec() - mCamera->GetPosition()).GetLength(); + camDist = (callback->GetOldValueVec() - m_camera->GetPosition()).GetLength(); } else { - camDist = (activeManipulator->GetPosition() - mCamera->GetPosition()).GetLength(); + camDist = (activeManipulator->GetPosition() - m_camera->GetPosition()).GetLength(); } } @@ -213,14 +210,14 @@ namespace EMStudio } else if (activeManipulator->GetType() == MCommon::TransformationManipulator::GIZMOTYPE_SCALE) { - activeManipulator->SetScale(aznumeric_cast(camDist * 0.15), mCamera); + activeManipulator->SetScale(aznumeric_cast(camDist * 0.15), m_camera); } // update position of the actor instance (needed for camera follow mode) EMotionFX::ActorInstance* actorInstance = callback->GetActorInstance(); if (actorInstance) { - activeManipulator->Init(actorInstance->GetLocalSpaceTransform().mPosition); + activeManipulator->Init(actorInstance->GetLocalSpaceTransform().m_position); } } @@ -229,14 +226,14 @@ namespace EMStudio void RenderWidget::OnMouseMoveEvent(QWidget* renderWidget, QMouseEvent* event) { // calculate the delta mouse movement - int32 deltaX = event->globalX() - mPrevMouseX; - int32 deltaY = event->globalY() - mPrevMouseY; + int32 deltaX = event->globalX() - m_prevMouseX; + int32 deltaY = event->globalY() - m_prevMouseY; // store the current value as previous value - mPrevMouseX = event->globalX(); - mPrevMouseY = event->globalY(); - mPrevLocalMouseX = event->x(); - mPrevLocalMouseY = event->y(); + m_prevMouseX = event->globalX(); + m_prevMouseY = event->globalY(); + m_prevLocalMouseX = event->x(); + m_prevLocalMouseY = event->y(); // get the button states const bool leftButtonPressed = event->buttons() & Qt::LeftButton; @@ -249,7 +246,7 @@ namespace EMStudio // accumulate the number of pixels moved since the last right click if (leftButtonPressed == false && middleButtonPressed == false && rightButtonPressed && altPressed == false) { - mPixelsMovedSinceRightClick += (int32)MCore::Math::Abs(aznumeric_cast(deltaX)) + (int32)MCore::Math::Abs(aznumeric_cast(deltaY)); + m_pixelsMovedSinceRightClick += (int32)MCore::Math::Abs(aznumeric_cast(deltaX)) + (int32)MCore::Math::Abs(aznumeric_cast(deltaY)); } // update size/bounding volumes volumes of all existing gizmos @@ -268,16 +265,16 @@ namespace EMStudio } // get the translate manipulator - MCommon::TransformationManipulator* mouseOveredManip = mPlugin->GetActiveManipulator(mCamera, event->x(), event->y()); + MCommon::TransformationManipulator* mouseOveredManip = m_plugin->GetActiveManipulator(m_camera, event->x(), event->y()); // check if the current manipulator is hit if (mouseOveredManip) { - gizmoHit = mouseOveredManip->Hit(mCamera, event->x(), event->y()); + gizmoHit = mouseOveredManip->Hit(m_camera, event->x(), event->y()); } else { - mouseOveredManip = mActiveTransformManip; + mouseOveredManip = m_activeTransformManip; } // flag to check if mouse wrapping occured @@ -287,34 +284,34 @@ namespace EMStudio //if (activeManipulator != (MCommon::TransformationManipulator*)translateManipulator || (translateManipulator && translateManipulator->GetMode() == MCommon::TranslateManipulator::TRANSLATE_NONE)) if (mouseOveredManip == nullptr || (mouseOveredManip && mouseOveredManip->GetType() != MCommon::TransformationManipulator::GIZMOTYPE_TRANSLATION)) { - const int32 width = mCamera->GetScreenWidth(); - const int32 height = mCamera->GetScreenHeight(); + const int32 width = m_camera->GetScreenWidth(); + const int32 height = m_camera->GetScreenHeight(); // handle mouse wrapping, to enable smoother panning if (event->x() > (int32)width) { mouseWrapped = true; QCursor::setPos(QPoint(event->globalX() - width, event->globalY())); - mPrevMouseX = event->globalX() - width; + m_prevMouseX = event->globalX() - width; } else if (event->x() < 0) { mouseWrapped = true; QCursor::setPos(QPoint(event->globalX() + width, event->globalY())); - mPrevMouseX = event->globalX() + width; + m_prevMouseX = event->globalX() + width; } if (event->y() > (int32)height) { mouseWrapped = true; QCursor::setPos(QPoint(event->globalX(), event->globalY() - height)); - mPrevMouseY = event->globalY() - height; + m_prevMouseY = event->globalY() - height; } else if (event->y() < 0) { mouseWrapped = true; QCursor::setPos(QPoint(event->globalX(), event->globalY() + height)); - mPrevMouseY = event->globalY() + height; + m_prevMouseY = event->globalY() + height; } // don't apply the delta, if mouse has been wrapped @@ -335,16 +332,16 @@ namespace EMStudio } else if (mouseOveredManip->GetSelectionLocked()) { - if (mNeedDisableFollowMode) + if (m_needDisableFollowMode) { MCommon::ManipulatorCallback* callback = mouseOveredManip->GetCallback(); if (callback) { if (callback->GetResetFollowMode()) { - mIsCharacterFollowModeActive = mViewWidget->GetIsCharacterFollowModeActive(); - mViewWidget->SetCharacterFollowModeActive(false); - mNeedDisableFollowMode = false; + m_isCharacterFollowModeActive = m_viewWidget->GetIsCharacterFollowModeActive(); + m_viewWidget->SetCharacterFollowModeActive(false); + m_needDisableFollowMode = false; } } } @@ -363,7 +360,7 @@ namespace EMStudio */ // send mouse movement to the manipulators - mouseOveredManip->ProcessMouseInput(mCamera, event->x(), event->y(), deltaX, deltaY, leftButtonPressed && !altPressed, middleButtonPressed, rightButtonPressed); + mouseOveredManip->ProcessMouseInput(m_camera, event->x(), event->y(), deltaX, deltaY, leftButtonPressed && !altPressed, middleButtonPressed, rightButtonPressed); } else { @@ -379,9 +376,9 @@ namespace EMStudio else { // adjust the camera based on keyboard and mouse input - if (mCamera) + if (m_camera) { - switch (mCameraMode) + switch (m_cameraMode) { case CAMMODE_ORBIT: { @@ -395,11 +392,11 @@ namespace EMStudio { if (deltaY < 0) { - renderWidget->setCursor(mPlugin->GetZoomOutCursor()); + renderWidget->setCursor(m_plugin->GetZoomOutCursor()); } else { - renderWidget->setCursor(mPlugin->GetZoomInCursor()); + renderWidget->setCursor(m_plugin->GetZoomInCursor()); } } // move camera forward, backward, left or right @@ -424,11 +421,11 @@ namespace EMStudio { if (deltaY < 0) { - renderWidget->setCursor(mPlugin->GetZoomOutCursor()); + renderWidget->setCursor(m_plugin->GetZoomOutCursor()); } else { - renderWidget->setCursor(mPlugin->GetZoomInCursor()); + renderWidget->setCursor(m_plugin->GetZoomInCursor()); } } // move camera forward, backward, left or right @@ -442,8 +439,8 @@ namespace EMStudio } } - mCamera->ProcessMouseInput(deltaX, deltaY, leftButtonPressed, middleButtonPressed, rightButtonPressed); - mCamera->Update(); + m_camera->ProcessMouseInput(deltaX, deltaY, leftButtonPressed, middleButtonPressed, rightButtonPressed); + m_camera->Update(); } } @@ -455,13 +452,11 @@ namespace EMStudio void RenderWidget::OnMousePressEvent(QWidget* renderWidget, QMouseEvent* event) { // reset the number of pixels moved since the last right click - mPixelsMovedSinceRightClick = 0; + m_pixelsMovedSinceRightClick = 0; // calculate the delta mouse movement and set old mouse position - //const int32 deltaX = event->globalX() - mPrevMouseX; - //const int32 deltaY = event->globalY() - mPrevMouseY; - mPrevMouseX = event->globalX(); - mPrevMouseY = event->globalY(); + m_prevMouseX = event->globalX(); + m_prevMouseY = event->globalY(); // get the button states const bool leftButtonPressed = event->buttons() & Qt::LeftButton; @@ -473,8 +468,8 @@ namespace EMStudio // set the click position if right click was done if (rightButtonPressed) { - mRightClickPosX = QCursor::pos().x(); - mRightClickPosY = QCursor::pos().y(); + m_rightClickPosX = QCursor::pos().x(); + m_rightClickPosY = QCursor::pos().y(); } // get the current selection @@ -485,7 +480,7 @@ namespace EMStudio MCommon::TransformationManipulator* activeManipulator = nullptr; if (leftButtonPressed && middleButtonPressed == false && rightButtonPressed == false) { - activeManipulator = mPlugin->GetActiveManipulator(mCamera, event->x(), event->y()); + activeManipulator = m_plugin->GetActiveManipulator(m_camera, event->x(), event->y()); } if (activeManipulator) @@ -497,12 +492,12 @@ namespace EMStudio { if (gizmoHit && callback->GetResetFollowMode()) { - mIsCharacterFollowModeActive = mViewWidget->GetIsCharacterFollowModeActive(); - mViewWidget->SetCharacterFollowModeActive(false); - mNeedDisableFollowMode = false; + m_isCharacterFollowModeActive = m_viewWidget->GetIsCharacterFollowModeActive(); + m_viewWidget->SetCharacterFollowModeActive(false); + m_needDisableFollowMode = false; - mActiveTransformManip = activeManipulator; - mActiveTransformManip->ProcessMouseInput(mCamera, event->x(), event->y(), 0, 0, leftButtonPressed && !altPressed, middleButtonPressed, rightButtonPressed); + m_activeTransformManip = activeManipulator; + m_activeTransformManip->ProcessMouseInput(m_camera, event->x(), event->y(), 0, 0, leftButtonPressed && !altPressed, middleButtonPressed, rightButtonPressed); } } @@ -552,7 +547,7 @@ namespace EMStudio EMotionFX::ActorInstance* selectedActorInstance = nullptr; AZ::Vector3 oldIntersectionPoint; - const MCore::Ray ray = mCamera->Unproject(mousePosX, mousePosY); + const MCore::Ray ray = m_camera->Unproject(mousePosX, mousePosY); // get the number of actor instances and iterate through them const size_t numActorInstances = EMotionFX::GetActorManager().GetNumActorInstances(); @@ -581,8 +576,8 @@ namespace EMStudio else { // find the actor instance closer to the camera - const float distOld = (mCamera->GetPosition() - oldIntersectionPoint).GetLength(); - const float distNew = (mCamera->GetPosition() - intersect).GetLength(); + const float distOld = (m_camera->GetPosition() - oldIntersectionPoint).GetLength(); + const float distNew = (m_camera->GetPosition() - intersect).GetLength(); if (distNew < distOld) { selectedActorInstance = actorInstance; @@ -615,7 +610,7 @@ namespace EMStudio } } - mSelectedActorInstances.clear(); + m_selectedActorInstances.clear(); if (ctrlPressed) { @@ -623,16 +618,16 @@ namespace EMStudio const size_t numSelectedActorInstances = selection.GetNumSelectedActorInstances(); for (size_t i = 0; i < numSelectedActorInstances; ++i) { - mSelectedActorInstances.emplace_back(selection.GetActorInstance(i)); + m_selectedActorInstances.emplace_back(selection.GetActorInstance(i)); } } if (selectedActorInstance) { - mSelectedActorInstances.emplace_back(selectedActorInstance); + m_selectedActorInstances.emplace_back(selectedActorInstance); } - CommandSystem::SelectActorInstancesUsingCommands(mSelectedActorInstances); + CommandSystem::SelectActorInstancesUsingCommands(m_selectedActorInstances); } } } @@ -647,10 +642,10 @@ namespace EMStudio if (altPressed == false) { // check which manipulator is currently mouse-overed and use the active one in case we're not hoving any - MCommon::TransformationManipulator* mouseOveredManip = mPlugin->GetActiveManipulator(mCamera, event->x(), event->y()); + MCommon::TransformationManipulator* mouseOveredManip = m_plugin->GetActiveManipulator(m_camera, event->x(), event->y()); if (mouseOveredManip == nullptr) { - mouseOveredManip = mActiveTransformManip; + mouseOveredManip = m_activeTransformManip; } // only do in case a manipulator got hovered or is active @@ -664,35 +659,28 @@ namespace EMStudio } // the manipulator - mouseOveredManip->ProcessMouseInput(mCamera, 0, 0, 0, 0, false, false, false); + mouseOveredManip->ProcessMouseInput(m_camera, 0, 0, 0, 0, false, false, false); // reset the camera follow mode state - if (callback && callback->GetResetFollowMode() && mIsCharacterFollowModeActive) + if (callback && callback->GetResetFollowMode() && m_isCharacterFollowModeActive) { - mViewWidget->SetCharacterFollowModeActive(mIsCharacterFollowModeActive); - mSkipFollowCalcs = true; - - /* CommandSystem::SelectionList& selectionList = GetCommandManager()->GetCurrentSelection(); - ActorInstance* followInstance = selectionList.GetFirstActorInstance(); - if (followInstance) - mOldActorInstancePos = followInstance->GetLocalPos();*/ - - //mViewWidget->OnFollowCharacter(); + m_viewWidget->SetCharacterFollowModeActive(m_isCharacterFollowModeActive); + m_skipFollowCalcs = true; } } } // reset the active manipulator - mActiveTransformManip = nullptr; + m_activeTransformManip = nullptr; // reset the disable follow flag - mNeedDisableFollowMode = true; + m_needDisableFollowMode = true; // set the arrow cursor renderWidget->setCursor(Qt::ArrowCursor); // context menu handling - if (mPixelsMovedSinceRightClick < 5) + if (m_pixelsMovedSinceRightClick < 5) { OnContextMenuEvent(renderWidget, event->modifiers() & Qt::ControlModifier, event->modifiers() & Qt::AltModifier, event->x(), event->y(), event->globalPos()); } @@ -704,14 +692,14 @@ namespace EMStudio { MCORE_UNUSED(renderWidget); - mCamera->ProcessMouseInput(0, + m_camera->ProcessMouseInput(0, event->angleDelta().y(), false, false, true ); - mCamera->Update(); + m_camera->Update(); } @@ -720,29 +708,29 @@ namespace EMStudio { // stop context menu execution, if mouse position changed or alt is pressed // so block it if zooming, moving etc. is enabled - if (QCursor::pos().x() != mRightClickPosX || QCursor::pos().y() != mRightClickPosY || altPressed) + if (QCursor::pos().x() != m_rightClickPosX || QCursor::pos().y() != m_rightClickPosY || altPressed) { return; } // call the context menu handler - mViewWidget->OnContextMenuEvent(renderWidget, shiftPressed, localMouseX, localMouseY, globalMousePos, mPlugin, mCamera); + m_viewWidget->OnContextMenuEvent(renderWidget, shiftPressed, localMouseX, localMouseY, globalMousePos, m_plugin, m_camera); } void RenderWidget::RenderAxis() { - MCommon::RenderUtil* renderUtil = mPlugin->GetRenderUtil(); + MCommon::RenderUtil* renderUtil = m_plugin->GetRenderUtil(); if (renderUtil == nullptr) { return; } // set the camera used to render the axis - MCommon::Camera* camera = mCamera; - if (mCamera->GetType() == MCommon::OrthographicCamera::TYPE_ID) + MCommon::Camera* camera = m_camera; + if (m_camera->GetType() == MCommon::OrthographicCamera::TYPE_ID) { - camera = mAxisFakeCamera; + camera = m_axisFakeCamera; } // store the old projection mode so that we can set it back later on @@ -756,103 +744,103 @@ namespace EMStudio // fake zoom the camera so that we draw the axis in a nice size and remember the old distance int32 distanceFromBorder = 40; float size = 25; - if (mCamera->GetType() == MCommon::OrthographicCamera::TYPE_ID) + if (m_camera->GetType() == MCommon::OrthographicCamera::TYPE_ID) { - MCommon::OrthographicCamera* orgCamera = (MCommon::OrthographicCamera*)mCamera; + MCommon::OrthographicCamera* orgCamera = (MCommon::OrthographicCamera*)m_camera; MCommon::OrthographicCamera* orthoCamera = (MCommon::OrthographicCamera*)camera; orthoCamera->SetCurrentDistance(1.0f); orthoCamera->SetPosition(orgCamera->GetPosition()); orthoCamera->SetMode(orgCamera->GetMode()); - orthoCamera->SetScreenDimensions(mWidth, mHeight); + orthoCamera->SetScreenDimensions(m_width, m_height); size *= 0.001f; } // update the camera - camera->SetOrthoClipDimensions(AZ::Vector2(aznumeric_cast(mWidth), aznumeric_cast(mHeight))); + camera->SetOrthoClipDimensions(AZ::Vector2(aznumeric_cast(m_width), aznumeric_cast(m_height))); camera->Update(); MCommon::RenderUtil::AxisRenderingSettings axisRenderingSettings; int32 originScreenX = 0; int32 originScreenY = 0; - switch (mCameraMode) + switch (m_cameraMode) { case CAMMODE_ORBIT: { originScreenX = distanceFromBorder; - originScreenY = mHeight - distanceFromBorder; - axisRenderingSettings.mRenderXAxis = true; - axisRenderingSettings.mRenderYAxis = true; - axisRenderingSettings.mRenderZAxis = true; + originScreenY = m_height - distanceFromBorder; + axisRenderingSettings.m_renderXAxis = true; + axisRenderingSettings.m_renderYAxis = true; + axisRenderingSettings.m_renderZAxis = true; break; } case CAMMODE_FIRSTPERSON: { originScreenX = distanceFromBorder; - originScreenY = mHeight - distanceFromBorder; - axisRenderingSettings.mRenderXAxis = true; - axisRenderingSettings.mRenderYAxis = true; - axisRenderingSettings.mRenderZAxis = true; + originScreenY = m_height - distanceFromBorder; + axisRenderingSettings.m_renderXAxis = true; + axisRenderingSettings.m_renderYAxis = true; + axisRenderingSettings.m_renderZAxis = true; break; } case CAMMODE_FRONT: { originScreenX = distanceFromBorder; - originScreenY = mHeight - distanceFromBorder; - axisRenderingSettings.mRenderXAxis = true; - axisRenderingSettings.mRenderYAxis = true; - axisRenderingSettings.mRenderZAxis = false; + originScreenY = m_height - distanceFromBorder; + axisRenderingSettings.m_renderXAxis = true; + axisRenderingSettings.m_renderYAxis = true; + axisRenderingSettings.m_renderZAxis = false; break; } case CAMMODE_BACK: { originScreenX = 2 * distanceFromBorder; - originScreenY = mHeight - distanceFromBorder; - axisRenderingSettings.mRenderXAxis = true; - axisRenderingSettings.mRenderYAxis = true; - axisRenderingSettings.mRenderZAxis = false; + originScreenY = m_height - distanceFromBorder; + axisRenderingSettings.m_renderXAxis = true; + axisRenderingSettings.m_renderYAxis = true; + axisRenderingSettings.m_renderZAxis = false; break; } case CAMMODE_LEFT: { originScreenX = distanceFromBorder; - originScreenY = mHeight - distanceFromBorder; - axisRenderingSettings.mRenderXAxis = false; - axisRenderingSettings.mRenderYAxis = true; - axisRenderingSettings.mRenderZAxis = true; + originScreenY = m_height - distanceFromBorder; + axisRenderingSettings.m_renderXAxis = false; + axisRenderingSettings.m_renderYAxis = true; + axisRenderingSettings.m_renderZAxis = true; break; } case CAMMODE_RIGHT: { originScreenX = 2 * distanceFromBorder; - originScreenY = mHeight - distanceFromBorder; - axisRenderingSettings.mRenderXAxis = false; - axisRenderingSettings.mRenderYAxis = true; - axisRenderingSettings.mRenderZAxis = true; + originScreenY = m_height - distanceFromBorder; + axisRenderingSettings.m_renderXAxis = false; + axisRenderingSettings.m_renderYAxis = true; + axisRenderingSettings.m_renderZAxis = true; break; } case CAMMODE_TOP: { originScreenX = distanceFromBorder; - originScreenY = mHeight - distanceFromBorder; - axisRenderingSettings.mRenderXAxis = true; - axisRenderingSettings.mRenderYAxis = false; - axisRenderingSettings.mRenderZAxis = true; + originScreenY = m_height - distanceFromBorder; + axisRenderingSettings.m_renderXAxis = true; + axisRenderingSettings.m_renderYAxis = false; + axisRenderingSettings.m_renderZAxis = true; break; } case CAMMODE_BOTTOM: { originScreenX = 2 * distanceFromBorder; - originScreenY = mHeight - distanceFromBorder; - axisRenderingSettings.mRenderXAxis = true; - axisRenderingSettings.mRenderYAxis = false; - axisRenderingSettings.mRenderZAxis = true; + originScreenY = m_height - distanceFromBorder; + axisRenderingSettings.m_renderXAxis = true; + axisRenderingSettings.m_renderYAxis = false; + axisRenderingSettings.m_renderZAxis = true; break; } default: MCORE_ASSERT(false); } - const AZ::Vector3 axisPosition = MCore::UnprojectOrtho(aznumeric_cast(originScreenX), aznumeric_cast(originScreenY), aznumeric_cast(mWidth), aznumeric_cast(mHeight), 0.0f, camera->GetProjectionMatrix(), camera->GetViewMatrix()); + const AZ::Vector3 axisPosition = MCore::UnprojectOrtho(aznumeric_cast(originScreenX), aznumeric_cast(originScreenY), aznumeric_cast(m_width), aznumeric_cast(m_height), 0.0f, camera->GetProjectionMatrix(), camera->GetViewMatrix()); AZ::Matrix4x4 inverseCameraMatrix = camera->GetViewMatrix(); inverseCameraMatrix.InvertFull(); @@ -860,13 +848,13 @@ namespace EMStudio AZ::Transform worldTM = AZ::Transform::CreateIdentity(); worldTM.SetTranslation(axisPosition); - axisRenderingSettings.mSize = size; - axisRenderingSettings.mWorldTM = worldTM; - axisRenderingSettings.mCameraRight = MCore::GetRight(inverseCameraMatrix).GetNormalized(); - axisRenderingSettings.mCameraUp = MCore::GetUp(inverseCameraMatrix).GetNormalized(); - axisRenderingSettings.mRenderXAxisName = true; - axisRenderingSettings.mRenderYAxisName = true; - axisRenderingSettings.mRenderZAxisName = true; + axisRenderingSettings.m_size = size; + axisRenderingSettings.m_worldTm = worldTM; + axisRenderingSettings.m_cameraRight = MCore::GetRight(inverseCameraMatrix).GetNormalized(); + axisRenderingSettings.m_cameraUp = MCore::GetUp(inverseCameraMatrix).GetNormalized(); + axisRenderingSettings.m_renderXAxisName = true; + axisRenderingSettings.m_renderYAxisName = true; + axisRenderingSettings.m_renderZAxisName = true; // render directly as we have to disable the depth test, hope the additional render call won't slow down so much renderUtil->RenderLineAxis(axisRenderingSettings); @@ -881,18 +869,18 @@ namespace EMStudio void RenderWidget::RenderNodeFilterString() { - MCommon::RenderUtil* renderUtil = mPlugin->GetRenderUtil(); + MCommon::RenderUtil* renderUtil = m_plugin->GetRenderUtil(); if (renderUtil == nullptr) { return; } // render the camera mode name at the bottom of the gl widget - const char* text = mCamera->GetTypeString(); + const char* text = m_camera->GetTypeString(); const uint32 textSize = 10; const uint32 cameraNameColor = MCore::RGBAColor(1.0f, 1.0f, 1.0f, 1.0f).ToInt(); - const uint32 cameraNameX = aznumeric_cast(mWidth * 0.5f); - const uint32 cameraNameY = mHeight - 20; + const uint32 cameraNameX = aznumeric_cast(m_width * 0.5f); + const uint32 cameraNameY = m_height - 20; renderUtil->RenderText(aznumeric_cast(cameraNameX), aznumeric_cast(cameraNameY), text, cameraNameColor, textSize, true); //glColor4f(1.0f, 1.0f, 1.0f, 1.0f); @@ -905,17 +893,17 @@ namespace EMStudio void RenderWidget::UpdateCharacterFollowModeData() { - if (mViewWidget->GetIsCharacterFollowModeActive()) + if (m_viewWidget->GetIsCharacterFollowModeActive()) { const CommandSystem::SelectionList& selectionList = GetCommandManager()->GetCurrentSelection(); EMotionFX::ActorInstance* followInstance = selectionList.GetFirstActorInstance(); - if (followInstance && mCamera) + if (followInstance && m_camera) { - const AZ::Vector3& localPos = followInstance->GetLocalSpaceTransform().mPosition; - mPlugin->GetTranslateManipulator()->Init(localPos); - mPlugin->GetRotateManipulator()->Init(localPos); - mPlugin->GetScaleManipulator()->Init(localPos); + const AZ::Vector3& localPos = followInstance->GetLocalSpaceTransform().m_position; + m_plugin->GetTranslateManipulator()->Init(localPos); + m_plugin->GetRotateManipulator()->Init(localPos); + m_plugin->GetScaleManipulator()->Init(localPos); AZ::Vector3 actorInstancePos; @@ -923,12 +911,12 @@ namespace EMStudio const size_t motionExtractionNodeIndex = followActor->GetMotionExtractionNodeIndex(); if (motionExtractionNodeIndex != InvalidIndex) { - actorInstancePos = followInstance->GetWorldSpaceTransform().mPosition; - RenderPlugin::EMStudioRenderActor* emstudioActor = mPlugin->FindEMStudioActor(followActor); + actorInstancePos = followInstance->GetWorldSpaceTransform().m_position; + RenderPlugin::EMStudioRenderActor* emstudioActor = m_plugin->FindEMStudioActor(followActor); if (emstudioActor) { #ifndef EMFX_SCALE_DISABLED - const float scaledOffsetFromTrajectoryNode = followInstance->GetWorldSpaceTransform().mScale.GetZ() * emstudioActor->mOffsetFromTrajectoryNode; + const float scaledOffsetFromTrajectoryNode = followInstance->GetWorldSpaceTransform().m_scale.GetZ() * emstudioActor->m_offsetFromTrajectoryNode; #else const float scaledOffsetFromTrajectoryNode = 1.0f; #endif @@ -937,25 +925,25 @@ namespace EMStudio } else { - actorInstancePos = followInstance->GetWorldSpaceTransform().mPosition; + actorInstancePos = followInstance->GetWorldSpaceTransform().m_position; } // Calculate movement since last frame. - AZ::Vector3 deltaPos = actorInstancePos - mOldActorInstancePos; + AZ::Vector3 deltaPos = actorInstancePos - m_oldActorInstancePos; - if (mSkipFollowCalcs) + if (m_skipFollowCalcs) { deltaPos = AZ::Vector3::CreateZero(); - mSkipFollowCalcs = false; + m_skipFollowCalcs = false; } - mOldActorInstancePos = actorInstancePos; + m_oldActorInstancePos = actorInstancePos; - switch (mCamera->GetType()) + switch (m_camera->GetType()) { case MCommon::OrbitCamera::TYPE_ID: { - MCommon::OrbitCamera* orbitCamera = static_cast(mCamera); + MCommon::OrbitCamera* orbitCamera = static_cast(m_camera); if (orbitCamera->GetIsFlightActive()) { @@ -972,7 +960,7 @@ namespace EMStudio case MCommon::OrthographicCamera::TYPE_ID: { - MCommon::OrthographicCamera* orthoCamera = static_cast(mCamera); + MCommon::OrthographicCamera* orthoCamera = static_cast(m_camera); if (orthoCamera->GetIsFlightActive()) { @@ -990,7 +978,7 @@ namespace EMStudio } else { - mOldActorInstancePos.Set(0.0f, 0.0f, 0.0f); + m_oldActorInstancePos.Set(0.0f, 0.0f, 0.0f); } } @@ -998,7 +986,7 @@ namespace EMStudio // render the manipulator gizmos void RenderWidget::RenderManipulators() { - MCommon::RenderUtil* renderUtil = mPlugin->GetRenderUtil(); + MCommon::RenderUtil* renderUtil = m_plugin->GetRenderUtil(); if (renderUtil == nullptr) { return; @@ -1019,7 +1007,7 @@ namespace EMStudio UpdateActiveTransformationManipulator(activeManipulator); // render the current actor - activeManipulator->Render(mCamera, renderUtil); + activeManipulator->Render(m_camera, renderUtil); } // render any remaining lines @@ -1033,16 +1021,16 @@ namespace EMStudio // render all triangles that got added to the render util void RenderWidget::RenderTriangles() { - MCommon::RenderUtil* renderUtil = mPlugin->GetRenderUtil(); + MCommon::RenderUtil* renderUtil = m_plugin->GetRenderUtil(); if (renderUtil == nullptr) { return; } // render custom triangles - for (const Triangle& curTri : mTriangles) + for (const Triangle& curTri : m_triangles) { - renderUtil->AddTriangle(curTri.mPosA, curTri.mPosB, curTri.mPosC, curTri.mNormalA, curTri.mNormalB, curTri.mNormalC, curTri.mColor); // TODO: make renderutil use uint32 colors instead + renderUtil->AddTriangle(curTri.m_posA, curTri.m_posB, curTri.m_posC, curTri.m_normalA, curTri.m_normalB, curTri.m_normalC, curTri.m_color); // TODO: make renderutil use uint32 colors instead } ClearTriangles(); @@ -1053,7 +1041,7 @@ namespace EMStudio // iterate through all plugins and render their helper data void RenderWidget::RenderCustomPluginData() { - MCommon::RenderUtil* renderUtil = mPlugin->GetRenderUtil(); + MCommon::RenderUtil* renderUtil = m_plugin->GetRenderUtil(); if (renderUtil == nullptr) { return; @@ -1064,9 +1052,9 @@ namespace EMStudio for (size_t i = 0; i < numPlugins; ++i) { EMStudioPlugin* plugin = GetPluginManager()->GetActivePlugin(i); - EMStudioPlugin::RenderInfo renderInfo(renderUtil, mCamera, mWidth, mHeight); + EMStudioPlugin::RenderInfo renderInfo(renderUtil, m_camera, m_width, m_height); - plugin->Render(mPlugin, &renderInfo); + plugin->Render(m_plugin, &renderInfo); } RenderDebugDraw(); @@ -1078,7 +1066,7 @@ namespace EMStudio void RenderWidget::RenderDebugDraw() { - MCommon::RenderUtil* renderUtil = mPlugin->GetRenderUtil(); + MCommon::RenderUtil* renderUtil = m_plugin->GetRenderUtil(); if (!renderUtil) { return; @@ -1107,14 +1095,14 @@ namespace EMStudio // render solid characters void RenderWidget::RenderActorInstances() { - MCommon::RenderUtil* renderUtil = mPlugin->GetRenderUtil(); + MCommon::RenderUtil* renderUtil = m_plugin->GetRenderUtil(); if (renderUtil == nullptr) { return; } // backface culling - const bool backfaceCullingEnabled = mViewWidget->GetRenderFlag(RenderViewWidget::RENDER_BACKFACECULLING); + const bool backfaceCullingEnabled = m_viewWidget->GetRenderFlag(RenderViewWidget::RENDER_BACKFACECULLING); renderUtil->EnableCulling(backfaceCullingEnabled); EMotionFX::GetAnimGraphManager().SetAnimGraphVisualizationEnabled(true); @@ -1129,7 +1117,7 @@ namespace EMStudio EMotionFX::ActorInstance* actorInstance = EMotionFX::GetActorManager().GetActorInstance(i); if (actorInstance->GetRender() && actorInstance->GetIsVisible() && actorInstance->GetIsOwnedByRuntime() == false) { - mPlugin->RenderActorInstance(actorInstance, 0.0f); + m_plugin->RenderActorInstance(actorInstance, 0.0f); } } } @@ -1138,34 +1126,34 @@ namespace EMStudio // prepare the camera void RenderWidget::UpdateCamera() { - if (mCamera == nullptr) + if (m_camera == nullptr) { return; } - RenderOptions* renderOptions = mPlugin->GetRenderOptions(); + RenderOptions* renderOptions = m_plugin->GetRenderOptions(); // update the camera - mCamera->SetNearClipDistance(renderOptions->GetNearClipPlaneDistance()); - mCamera->SetFarClipDistance(renderOptions->GetFarClipPlaneDistance()); - mCamera->SetFOV(renderOptions->GetFOV()); - mCamera->SetAspectRatio(mWidth / (float)mHeight); - mCamera->SetScreenDimensions(mWidth, mHeight); - mCamera->AutoUpdateLimits(); + m_camera->SetNearClipDistance(renderOptions->GetNearClipPlaneDistance()); + m_camera->SetFarClipDistance(renderOptions->GetFarClipPlaneDistance()); + m_camera->SetFOV(renderOptions->GetFOV()); + m_camera->SetAspectRatio(m_width / (float)m_height); + m_camera->SetScreenDimensions(m_width, m_height); + m_camera->AutoUpdateLimits(); - if (mViewCloseupWaiting != 0 && mHeight != 0 && mWidth != 0) + if (m_viewCloseupWaiting != 0 && m_height != 0 && m_width != 0) { - mViewCloseupWaiting--; - if (mViewCloseupWaiting == 0) + m_viewCloseupWaiting--; + if (m_viewCloseupWaiting == 0) { - mCamera->ViewCloseup(MCore::AABB(mViewCloseupAABB.GetMin(), mViewCloseupAABB.GetMax()), mViewCloseupFlightTime); + m_camera->ViewCloseup(MCore::AABB(m_viewCloseupAabb.GetMin(), m_viewCloseupAabb.GetMax()), m_viewCloseupFlightTime); } } // update the manipulators, camera, old actor instance position etc. when using the character follow mode UpdateCharacterFollowModeData(); - mCamera->Update(); + m_camera->Update(); } @@ -1173,14 +1161,14 @@ namespace EMStudio void RenderWidget::RenderGrid() { // directly return in case we do not want to render any type of grid - if (mViewWidget->GetRenderFlag(RenderViewWidget::RENDER_GRID) == false) + if (m_viewWidget->GetRenderFlag(RenderViewWidget::RENDER_GRID) == false) { return; } // get access to the render utility and render options - MCommon::RenderUtil* renderUtil = mPlugin->GetRenderUtil(); - RenderOptions* renderOptions = mPlugin->GetRenderOptions(); + MCommon::RenderUtil* renderUtil = m_plugin->GetRenderUtil(); + RenderOptions* renderOptions = m_plugin->GetRenderOptions(); if (renderUtil == nullptr || renderOptions == nullptr) { return; @@ -1189,20 +1177,20 @@ namespace EMStudio const float unitSize = renderOptions->GetGridUnitSize(); AZ::Vector3 gridNormal = AZ::Vector3(0.0f, 0.0f, 1.0f); - if (mCamera->GetType() == MCommon::OrthographicCamera::TYPE_ID) + if (m_camera->GetType() == MCommon::OrthographicCamera::TYPE_ID) { // disable depth writing for ortho views renderUtil->SetDepthMaskWrite(false); - switch (mCameraMode) + switch (m_cameraMode) { case CAMMODE_LEFT: case CAMMODE_RIGHT: - gridNormal = MCore::GetForward(mCamera->GetViewMatrix()); + gridNormal = MCore::GetForward(m_camera->GetViewMatrix()); break; default: - gridNormal = MCore::GetUp(mCamera->GetViewMatrix()); + gridNormal = MCore::GetUp(m_camera->GetViewMatrix()); } gridNormal.Normalize(); } @@ -1210,8 +1198,8 @@ namespace EMStudio // render the grid AZ::Vector2 gridStart, gridEnd; - renderUtil->CalcVisibleGridArea(mCamera, mWidth, mHeight, unitSize, &gridStart, &gridEnd); - if (mViewWidget->GetRenderFlag(RenderViewWidget::RENDER_GRID)) + renderUtil->CalcVisibleGridArea(m_camera, m_width, m_height, unitSize, &gridStart, &gridEnd); + if (m_viewWidget->GetRenderFlag(RenderViewWidget::RENDER_GRID)) { renderUtil->RenderGrid(gridStart, gridEnd, gridNormal, unitSize, renderOptions->GetMainAxisColor(), renderOptions->GetGridColor(), renderOptions->GetSubStepColor(), true); } @@ -1222,9 +1210,9 @@ namespace EMStudio void RenderWidget::closeEvent([[maybe_unused]] QCloseEvent* event) { - if (mPlugin) + if (m_plugin) { - mPlugin->SaveRenderOptions(); + m_plugin->SaveRenderOptions(); } } } // namespace EMStudio diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/RenderPlugin/RenderWidget.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/RenderPlugin/RenderWidget.h index d2ec5d71ea..d4906355da 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/RenderPlugin/RenderWidget.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/RenderPlugin/RenderWidget.h @@ -47,25 +47,25 @@ namespace EMStudio struct Triangle { - AZ::Vector3 mPosA; - AZ::Vector3 mPosB; - AZ::Vector3 mPosC; + AZ::Vector3 m_posA; + AZ::Vector3 m_posB; + AZ::Vector3 m_posC; - AZ::Vector3 mNormalA; - AZ::Vector3 mNormalB; - AZ::Vector3 mNormalC; + AZ::Vector3 m_normalA; + AZ::Vector3 m_normalB; + AZ::Vector3 m_normalC; - uint32 mColor; + uint32 m_color; Triangle() {} Triangle(const AZ::Vector3& posA, const AZ::Vector3& posB, const AZ::Vector3& posC, const AZ::Vector3& normalA, const AZ::Vector3& normalB, const AZ::Vector3& normalC, uint32 color) - : mPosA(posA) - , mPosB(posB) - , mPosC(posC) - , mNormalA(normalA) - , mNormalB(normalB) - , mNormalC(normalC) - , mColor(color) {} + : m_posA(posA) + , m_posB(posB) + , m_posC(posC) + , m_normalA(normalA) + , m_normalB(normalB) + , m_normalC(normalC) + , m_color(color) {} }; @@ -76,16 +76,16 @@ namespace EMStudio AZ_CLASS_ALLOCATOR_DECL EventHandler(RenderWidget* widget) - : EMotionFX::EventHandler() { mWidget = widget; } + : EMotionFX::EventHandler() { m_widget = widget; } ~EventHandler() {} // overloaded const AZStd::vector GetHandledEventTypes() const override { return { EMotionFX::EVENT_TYPE_ON_DRAW_LINE, EMotionFX::EVENT_TYPE_ON_DRAW_TRIANGLE, EMotionFX::EVENT_TYPE_ON_DRAW_TRIANGLES }; } - MCORE_INLINE void OnDrawTriangle(const AZ::Vector3& posA, const AZ::Vector3& posB, const AZ::Vector3& posC, const AZ::Vector3& normalA, const AZ::Vector3& normalB, const AZ::Vector3& normalC, uint32 color) { mWidget->AddTriangle(posA, posB, posC, normalA, normalB, normalC, color); } - MCORE_INLINE void OnDrawTriangles() { mWidget->RenderTriangles(); } + MCORE_INLINE void OnDrawTriangle(const AZ::Vector3& posA, const AZ::Vector3& posB, const AZ::Vector3& posC, const AZ::Vector3& normalA, const AZ::Vector3& normalB, const AZ::Vector3& normalC, uint32 color) { m_widget->AddTriangle(posA, posB, posC, normalA, normalB, normalC, color); } + MCORE_INLINE void OnDrawTriangles() { m_widget->RenderTriangles(); } private: - RenderWidget* mWidget; + RenderWidget* m_widget; }; RenderWidget(RenderPlugin* renderPlugin, RenderViewWidget* viewWidget); @@ -98,8 +98,8 @@ namespace EMStudio virtual void Update() = 0; // line rendering helper functions - MCORE_INLINE void AddTriangle(const AZ::Vector3& posA, const AZ::Vector3& posB, const AZ::Vector3& posC, const AZ::Vector3& normalA, const AZ::Vector3& normalB, const AZ::Vector3& normalC, uint32 color) { mTriangles.emplace_back(Triangle(posA, posB, posC, normalA, normalB, normalC, color)); } - MCORE_INLINE void ClearTriangles() { mTriangles.clear(); } + MCORE_INLINE void AddTriangle(const AZ::Vector3& posA, const AZ::Vector3& posB, const AZ::Vector3& posC, const AZ::Vector3& normalA, const AZ::Vector3& normalB, const AZ::Vector3& normalC, uint32 color) { m_triangles.emplace_back(Triangle(posA, posB, posC, normalA, normalB, normalC, color)); } + MCORE_INLINE void ClearTriangles() { m_triangles.clear(); } void RenderTriangles(); // helper rendering functions @@ -113,16 +113,16 @@ namespace EMStudio void UpdateCamera(); // camera helper functions - MCORE_INLINE MCommon::Camera* GetCamera() const { return mCamera; } - MCORE_INLINE CameraMode GetCameraMode() const { return mCameraMode; } - MCORE_INLINE void SetSkipFollowCalcs(bool skipFollowCalcs) { mSkipFollowCalcs = skipFollowCalcs; } + MCORE_INLINE MCommon::Camera* GetCamera() const { return m_camera; } + MCORE_INLINE CameraMode GetCameraMode() const { return m_cameraMode; } + MCORE_INLINE void SetSkipFollowCalcs(bool skipFollowCalcs) { m_skipFollowCalcs = skipFollowCalcs; } void ViewCloseup(const AZ::Aabb& aabb, float flightTime, uint32 viewCloseupWaiting = 5); void ViewCloseup(bool selectedInstancesOnly, float flightTime, uint32 viewCloseupWaiting = 5); void SwitchCamera(CameraMode mode); // render bugger dimensions - MCORE_INLINE uint32 GetScreenWidth() const { return mWidth; } - MCORE_INLINE uint32 GetScreenHeight() const { return mHeight; } + MCORE_INLINE uint32 GetScreenWidth() const { return m_width; } + MCORE_INLINE uint32 GetScreenHeight() const { return m_height; } // helper functions for easy calling void OnMouseMoveEvent(QWidget* renderWidget, QMouseEvent* event); @@ -137,40 +137,40 @@ namespace EMStudio void closeEvent(QCloseEvent* event); - RenderPlugin* mPlugin; - RenderViewWidget* mViewWidget; - AZStd::vector mTriangles; - EventHandler mEventHandler; + RenderPlugin* m_plugin; + RenderViewWidget* m_viewWidget; + AZStd::vector m_triangles; + EventHandler m_eventHandler; - AZStd::vector mSelectedActorInstances; + AZStd::vector m_selectedActorInstances; - MCommon::TransformationManipulator* mActiveTransformManip; + MCommon::TransformationManipulator* m_activeTransformManip; // camera helper data - CameraMode mCameraMode; - MCommon::Camera* mCamera; - MCommon::Camera* mAxisFakeCamera; - bool mIsCharacterFollowModeActive; - bool mSkipFollowCalcs; - bool mNeedDisableFollowMode; + CameraMode m_cameraMode; + MCommon::Camera* m_camera; + MCommon::Camera* m_axisFakeCamera; + bool m_isCharacterFollowModeActive; + bool m_skipFollowCalcs; + bool m_needDisableFollowMode; // render buffer dimensions - uint32 mWidth; - uint32 mHeight; + uint32 m_width; + uint32 m_height; // used for closeup camera flights - uint32 mViewCloseupWaiting; - AZ::Aabb mViewCloseupAABB; - float mViewCloseupFlightTime; + uint32 m_viewCloseupWaiting; + AZ::Aabb m_viewCloseupAabb; + float m_viewCloseupFlightTime; // manipulator helper data - AZ::Vector3 mOldActorInstancePos; - int32 mPrevMouseX; - int32 mPrevMouseY; - int32 mPrevLocalMouseX; - int32 mPrevLocalMouseY; - int32 mRightClickPosX; - int32 mRightClickPosY; - int32 mPixelsMovedSinceRightClick; + AZ::Vector3 m_oldActorInstancePos; + int32 m_prevMouseX; + int32 m_prevMouseY; + int32 m_prevLocalMouseX; + int32 m_prevLocalMouseY; + int32 m_rightClickPosX; + int32 m_rightClickPosY; + int32 m_pixelsMovedSinceRightClick; }; } // namespace EMStudio diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/SaveChangedFilesManager.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/SaveChangedFilesManager.cpp index 5e624fd75e..6919877170 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/SaveChangedFilesManager.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/SaveChangedFilesManager.cpp @@ -30,11 +30,11 @@ namespace EMStudio { SaveDirtyFilesCallback::ObjectPointer::ObjectPointer() : - mActor(nullptr), - mMotion(nullptr), - mMotionSet(nullptr), - mAnimGraph(nullptr), - mWorkspace(nullptr) + m_actor(nullptr), + m_motion(nullptr), + m_motionSet(nullptr), + m_animGraph(nullptr), + m_workspace(nullptr) { } @@ -52,7 +52,7 @@ namespace EMStudio return; } - mSaveDirtyFilesCallbacks.erase(AZStd::remove(mSaveDirtyFilesCallbacks.begin(), mSaveDirtyFilesCallbacks.end(), callback), mSaveDirtyFilesCallbacks.end()); + m_saveDirtyFilesCallbacks.erase(AZStd::remove(m_saveDirtyFilesCallbacks.begin(), m_saveDirtyFilesCallbacks.end(), callback), m_saveDirtyFilesCallbacks.end()); if (delFromMem) { @@ -63,21 +63,18 @@ namespace EMStudio void DirtyFileManager::SaveSettings() { - const size_t numDirtyFilesCallbacks = mSaveDirtyFilesCallbacks.size(); + const size_t numDirtyFilesCallbacks = m_saveDirtyFilesCallbacks.size(); // save the callback settings to the config file QSettings settings; settings.beginGroup("EMotionFX"); settings.beginGroup("DirtyFileManager"); - //settings.setValue("ShowSettingsWindow", mShowDirtyFileSettingsWindow); for (size_t i = 0; i < numDirtyFilesCallbacks; ++i) { - settings.beginGroup(mSaveDirtyFilesCallbacks[i]->GetFileType()); - settings.setValue("FileExtension", mSaveDirtyFilesCallbacks[i]->GetExtension()); - //settings.setValue( "AskIndividually", mSaveDirtyFilesCallbacks[i]->AskIndividually()); - //settings.setValue( "SkipSaving", mSaveDirtyFilesCallbacks[i]->SkipSaving()); + settings.beginGroup(m_saveDirtyFilesCallbacks[i]->GetFileType()); + settings.setValue("FileExtension", m_saveDirtyFilesCallbacks[i]->GetExtension()); settings.endGroup(); } @@ -89,12 +86,12 @@ namespace EMStudio // destructor DirtyFileManager::~DirtyFileManager() { - const size_t numDirtyFilesCallbacks = mSaveDirtyFilesCallbacks.size(); + const size_t numDirtyFilesCallbacks = m_saveDirtyFilesCallbacks.size(); for (size_t i = 0; i < numDirtyFilesCallbacks; ++i) { - delete mSaveDirtyFilesCallbacks[i]; + delete m_saveDirtyFilesCallbacks[i]; } - mSaveDirtyFilesCallbacks.clear(); + m_saveDirtyFilesCallbacks.clear(); } @@ -134,10 +131,10 @@ namespace EMStudio size_t insertIndex = MCORE_INVALIDINDEX32; // get the number of callbacks and iterate through them - const size_t numCallbacks = mSaveDirtyFilesCallbacks.size(); + const size_t numCallbacks = m_saveDirtyFilesCallbacks.size(); for (size_t i = 0; i < numCallbacks; ++i) { - const uint32 currentPriority = mSaveDirtyFilesCallbacks[i]->GetPriority(); + const uint32 currentPriority = m_saveDirtyFilesCallbacks[i]->GetPriority(); if (newPriority > currentPriority) { @@ -149,11 +146,11 @@ namespace EMStudio // add the new callback if (insertIndex == MCORE_INVALIDINDEX32) { - mSaveDirtyFilesCallbacks.push_back(callback); + m_saveDirtyFilesCallbacks.push_back(callback); } else { - mSaveDirtyFilesCallbacks.insert(mSaveDirtyFilesCallbacks.begin()+insertIndex, callback); + m_saveDirtyFilesCallbacks.insert(m_saveDirtyFilesCallbacks.begin()+insertIndex, callback); } } @@ -162,12 +159,12 @@ namespace EMStudio { AZStd::vector neededCallbacks; - const size_t numDirtyFilesCallbacks = mSaveDirtyFilesCallbacks.size(); + const size_t numDirtyFilesCallbacks = m_saveDirtyFilesCallbacks.size(); // check if there are any dirty files for (size_t i = 0; i < numDirtyFilesCallbacks; ++i) { - SaveDirtyFilesCallback* callback = mSaveDirtyFilesCallbacks[i]; + SaveDirtyFilesCallback* callback = m_saveDirtyFilesCallbacks[i]; // make sure we want to handle the given save dirty files callback if ((type != MCORE_INVALIDINDEX32 && callback->GetType() != type) || (filter != MCORE_INVALIDINDEX32 && callback->GetType() == filter)) @@ -184,11 +181,11 @@ namespace EMStudio { AZStd::vector neededCallbacks; - const size_t numDirtyFilesCallbacks = mSaveDirtyFilesCallbacks.size(); + const size_t numDirtyFilesCallbacks = m_saveDirtyFilesCallbacks.size(); for (size_t i = 0; i < numDirtyFilesCallbacks; ++i) { - SaveDirtyFilesCallback* callback = mSaveDirtyFilesCallbacks[i]; + SaveDirtyFilesCallback* callback = m_saveDirtyFilesCallbacks[i]; // make sure we want to handle the given save dirty files callback if (AZStd::find(typeIds.begin(), typeIds.end(), callback->GetFileRttiType()) != typeIds.end()) @@ -333,9 +330,9 @@ namespace EMStudio MCORE_ASSERT(dirtyFileNames.size() == objects.size()); // store values - mFileNames = dirtyFileNames; - mObjects = objects; - mSaveDirtyFiles = true; + m_fileNames = dirtyFileNames; + m_objects = objects; + m_saveDirtyFiles = true; // update title of the dialog setWindowTitle("Save Changes To Files"); @@ -350,54 +347,54 @@ namespace EMStudio vLayout->addWidget(new QLabel("Do you want to save changes? The following files have been changed but have not been saved yet:")); // create the lod information table - mTableWidget = new QTableWidget(); - mTableWidget->setAlternatingRowColors(true); - mTableWidget->setSelectionMode(QAbstractItemView::NoSelection); - mTableWidget->setEditTriggers(QAbstractItemView::NoEditTriggers); - mTableWidget->setMinimumHeight(250); - mTableWidget->setMinimumWidth(600); - mTableWidget->verticalHeader()->hide(); + m_tableWidget = new QTableWidget(); + m_tableWidget->setAlternatingRowColors(true); + m_tableWidget->setSelectionMode(QAbstractItemView::NoSelection); + m_tableWidget->setEditTriggers(QAbstractItemView::NoEditTriggers); + m_tableWidget->setMinimumHeight(250); + m_tableWidget->setMinimumWidth(600); + m_tableWidget->verticalHeader()->hide(); // disable the corner button between the row and column selection thingies - mTableWidget->setCornerButtonEnabled(false); + m_tableWidget->setCornerButtonEnabled(false); // enable the custom context menu for the motion table - mTableWidget->setContextMenuPolicy(Qt::DefaultContextMenu); + m_tableWidget->setContextMenuPolicy(Qt::DefaultContextMenu); // disable sorting when adding the items - mTableWidget->setSortingEnabled(false); + m_tableWidget->setSortingEnabled(false); // clear the table widget - mTableWidget->clear(); - mTableWidget->setColumnCount(3); + m_tableWidget->clear(); + m_tableWidget->setColumnCount(3); // set header items for the table QTableWidgetItem* headerItem = new QTableWidgetItem(""); headerItem->setTextAlignment(Qt::AlignVCenter | Qt::AlignLeft); - mTableWidget->setHorizontalHeaderItem(0, headerItem); + m_tableWidget->setHorizontalHeaderItem(0, headerItem); headerItem = new QTableWidgetItem("FileName"); headerItem->setTextAlignment(Qt::AlignVCenter | Qt::AlignLeft); - mTableWidget->setHorizontalHeaderItem(1, headerItem); + m_tableWidget->setHorizontalHeaderItem(1, headerItem); headerItem = new QTableWidgetItem("Type"); headerItem->setTextAlignment(Qt::AlignVCenter | Qt::AlignLeft); - mTableWidget->setHorizontalHeaderItem(2, headerItem); + m_tableWidget->setHorizontalHeaderItem(2, headerItem); // set column resize modes. The main filename is in column 1, and // stretches to fill any remaining space. The other columns are // informational only, and not very wide, so setting them to always // resize to their contents means we don't have to manage their column // widths. - QHeaderView* horizontalHeader = mTableWidget->horizontalHeader(); + QHeaderView* horizontalHeader = m_tableWidget->horizontalHeader(); horizontalHeader->setSectionResizeMode(0, QHeaderView::ResizeToContents); horizontalHeader->setSectionResizeMode(1, QHeaderView::Stretch); horizontalHeader->setSectionResizeMode(2, QHeaderView::ResizeToContents); const size_t numDirtyFiles = dirtyFileNames.size(); - mTableWidget->setRowCount(static_cast(numDirtyFiles)); + m_tableWidget->setRowCount(static_cast(numDirtyFiles)); for (size_t i = 0; i < numDirtyFiles; ++i) { - SaveDirtyFilesCallback::ObjectPointer object = mObjects[i]; + SaveDirtyFilesCallback::ObjectPointer object = m_objects[i]; QString labelText; if (dirtyFileNames[i].empty()) @@ -438,23 +435,23 @@ namespace EMStudio filenameLabel->setText(labelText); QString typeString; - if (object.mMotion) + if (object.m_motion) { typeString = "Motion"; } - else if (object.mActor) + else if (object.m_actor) { typeString = "Actor"; } - else if (object.mMotionSet) + else if (object.m_motionSet) { typeString = "Motion Set"; } - else if (object.mAnimGraph) + else if (object.m_animGraph) { typeString = "Anim Graph"; } - else if (object.mWorkspace) + else if (object.m_workspace) { typeString = "Workspace"; } @@ -464,19 +461,19 @@ namespace EMStudio itemType->setData(Qt::UserRole, row); // add table items to the current row - mTableWidget->setCellWidget(row, 0, checkbox); - mTableWidget->setCellWidget(row, 1, filenameLabel); - mTableWidget->setItem(row, 2, itemType); + m_tableWidget->setCellWidget(row, 0, checkbox); + m_tableWidget->setCellWidget(row, 1, filenameLabel); + m_tableWidget->setItem(row, 2, itemType); // set the row height - mTableWidget->setRowHeight(row, 21); + m_tableWidget->setRowHeight(row, 21); } // enable sorting - mTableWidget->setSortingEnabled(true); + m_tableWidget->setSortingEnabled(true); // add the table in the layout - vLayout->addWidget(mTableWidget); + vLayout->addWidget(m_tableWidget); // the buttons at the bottom of the dialog QDialogButtonBox* buttonBox = new QDialogButtonBox(buttons); @@ -525,26 +522,26 @@ namespace EMStudio outFileNames->clear(); outObjects->clear(); - const uint32 numRows = mTableWidget->rowCount(); + const uint32 numRows = m_tableWidget->rowCount(); // iteration for motions, motion sets, actors and anim graphs for (uint32 i = 0; i < numRows; ++i) { // get the checkbox - QWidget* widget = mTableWidget->cellWidget(i, 0); + QWidget* widget = m_tableWidget->cellWidget(i, 0); QCheckBox* checkbox = static_cast(widget); // get the type item - QTableWidgetItem* item = mTableWidget->item(i, 2); + QTableWidgetItem* item = m_tableWidget->item(i, 2); const int32 filenameIndex = item->data(Qt::UserRole).toInt(); // get the object pointer - SaveDirtyFilesCallback::ObjectPointer objPointer = mObjects[filenameIndex]; + SaveDirtyFilesCallback::ObjectPointer objPointer = m_objects[filenameIndex]; // add the filename to the list of selected filenames in case the checkbox in the same row is checked if (checkbox->isChecked()) { - outFileNames->push_back(mFileNames[filenameIndex]); + outFileNames->push_back(m_fileNames[filenameIndex]); outObjects->push_back(objPointer); } } diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/SaveChangedFilesManager.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/SaveChangedFilesManager.h index aabfddd687..48c47ef2ec 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/SaveChangedFilesManager.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/SaveChangedFilesManager.h @@ -40,11 +40,11 @@ namespace EMStudio ObjectPointer(); - EMotionFX::Actor * mActor; - EMotionFX::Motion* mMotion; - EMotionFX::MotionSet* mMotionSet; - EMotionFX::AnimGraph* mAnimGraph; - Workspace* mWorkspace; + EMotionFX::Actor * m_actor; + EMotionFX::Motion* m_motion; + EMotionFX::MotionSet* m_motionSet; + EMotionFX::AnimGraph* m_animGraph; + Workspace* m_workspace; }; SaveDirtyFilesCallback(); @@ -80,8 +80,8 @@ namespace EMStudio // dirty files callbacks void AddCallback(SaveDirtyFilesCallback* callback); void RemoveCallback(SaveDirtyFilesCallback* callback, bool delFromMem = true); - SaveDirtyFilesCallback* GetCallback(size_t index) const { return mSaveDirtyFilesCallbacks[index]; } - size_t GetNumCallbacks() const { return mSaveDirtyFilesCallbacks.size(); } + SaveDirtyFilesCallback* GetCallback(size_t index) const { return m_saveDirtyFilesCallbacks[index]; } + size_t GetNumCallbacks() const { return m_saveDirtyFilesCallbacks.size(); } int SaveDirtyFiles(uint32 type = MCORE_INVALIDINDEX32, uint32 filter = MCORE_INVALIDINDEX32, QDialogButtonBox::StandardButtons buttons = QDialogButtonBox::Ok | QDialogButtonBox::Discard | QDialogButtonBox::Cancel @@ -94,7 +94,7 @@ namespace EMStudio void SaveSettings(); private: - AZStd::vector mSaveDirtyFilesCallbacks; + AZStd::vector m_saveDirtyFilesCallbacks; int SaveDirtyFiles(const AZStd::vector& neededSaveDirtyFilesCallbacks, QDialogButtonBox::StandardButtons buttons); }; @@ -115,18 +115,18 @@ namespace EMStudio ); virtual ~SaveDirtySettingsWindow(); - bool GetSaveDirtyFiles() { return mSaveDirtyFiles; } + bool GetSaveDirtyFiles() { return m_saveDirtyFiles; } void GetSelectedFileNames(AZStd::vector* outFileNames, AZStd::vector* outObjects); public slots: - void OnSaveButton() { mSaveDirtyFiles = true; emit accept(); } - void OnSkipSavingButton() { mSaveDirtyFiles = false; emit accept(); } - void OnCancelButton() { mSaveDirtyFiles = false; emit reject(); } + void OnSaveButton() { m_saveDirtyFiles = true; emit accept(); } + void OnSkipSavingButton() { m_saveDirtyFiles = false; emit accept(); } + void OnCancelButton() { m_saveDirtyFiles = false; emit reject(); } private: - QTableWidget* mTableWidget; - bool mSaveDirtyFiles; - AZStd::vector mFileNames; - AZStd::vector mObjects; + QTableWidget* m_tableWidget; + bool m_saveDirtyFiles; + AZStd::vector m_fileNames; + AZStd::vector m_objects; }; } // namespace EMStudio diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/ToolBarPlugin.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/ToolBarPlugin.cpp index f0820b3b5c..87511e19ce 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/ToolBarPlugin.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/ToolBarPlugin.cpp @@ -17,7 +17,7 @@ namespace EMStudio // constructor ToolBarPlugin::ToolBarPlugin() : EMStudioPlugin() - , mBar() + , m_bar() { } @@ -25,10 +25,10 @@ namespace EMStudio // destructor ToolBarPlugin::~ToolBarPlugin() { - if (!mBar.isNull()) + if (!m_bar.isNull()) { - EMStudio::GetMainWindow()->removeToolBar(mBar); - delete mBar; + EMStudio::GetMainWindow()->removeToolBar(m_bar); + delete m_bar; } } @@ -40,13 +40,13 @@ namespace EMStudio // check if we have a window that uses this object name bool ToolBarPlugin::GetHasWindowWithObjectName(const AZStd::string& objectName) { - if (mBar.isNull()) + if (m_bar.isNull()) { return false; } // check if the object name is equal to the one of the dock widget - return objectName == FromQtString(mBar->objectName()); + return objectName == FromQtString(m_bar->objectName()); } @@ -68,33 +68,33 @@ namespace EMStudio // set the interface title void ToolBarPlugin::SetInterfaceTitle(const char* name) { - if (!mBar.isNull()) + if (!m_bar.isNull()) { - mBar->setWindowTitle(name); + m_bar->setWindowTitle(name); } } QToolBar* ToolBarPlugin::GetToolBar() { - if (!mBar.isNull()) + if (!m_bar.isNull()) { - return mBar; + return m_bar; } MainWindow* mainWindow = GetMainWindow(); // create the toolbar - mBar = new QToolBar(GetName(), mainWindow); - mBar->setAllowedAreas(GetAllowedAreas()); - mBar->setFloatable(GetIsFloatable()); - mBar->setMovable(GetIsMovable()); - mBar->setOrientation(GetIsVertical() ? Qt::Vertical : Qt::Horizontal); - mBar->setToolButtonStyle(GetToolButtonStyle()); + m_bar = new QToolBar(GetName(), mainWindow); + m_bar->setAllowedAreas(GetAllowedAreas()); + m_bar->setFloatable(GetIsFloatable()); + m_bar->setMovable(GetIsMovable()); + m_bar->setOrientation(GetIsVertical() ? Qt::Vertical : Qt::Horizontal); + m_bar->setToolButtonStyle(GetToolButtonStyle()); // add the toolbar to the main window - mainWindow->addToolBar(GetToolBarCreationArea(), mBar); + mainWindow->addToolBar(GetToolBarCreationArea(), m_bar); - return mBar; + return m_bar; } } // namespace EMStudio diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/ToolBarPlugin.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/ToolBarPlugin.h index 72054ab926..dcda6d2c1f 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/ToolBarPlugin.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/ToolBarPlugin.h @@ -46,7 +46,7 @@ namespace EMStudio virtual void SetInterfaceTitle(const char* name); void CreateBaseInterface(const char* objectName) override; - QString GetObjectName() const override { AZ_Assert(!mBar.isNull(), "Unexpected null bar"); return mBar->objectName(); } + QString GetObjectName() const override { AZ_Assert(!m_bar.isNull(), "Unexpected null bar"); return m_bar->objectName(); } void SetObjectName(const QString& name) override { GetToolBar()->setObjectName(name); } bool GetHasWindowWithObjectName(const AZStd::string& objectName) override; @@ -56,7 +56,7 @@ namespace EMStudio QToolBar* GetToolBar(); protected: - QPointer mBar; + QPointer m_bar; }; } // namespace EMStudio diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/UnitScaleWindow.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/UnitScaleWindow.cpp index a39d24c3d7..f449adf733 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/UnitScaleWindow.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/UnitScaleWindow.cpp @@ -23,7 +23,7 @@ namespace EMStudio UnitScaleWindow::UnitScaleWindow(QWidget* parent) : QDialog(parent) { - mScaleFactor = 1.0f; + m_scaleFactor = 1.0f; setModal(true); setWindowTitle("Scale Factor Setup"); @@ -47,27 +47,27 @@ namespace EMStudio scaleLayout->addWidget(new QLabel("Scale Factor:")); - mScaleSpinBox = new AzQtComponents::DoubleSpinBox(); - mScaleSpinBox->setRange(0.00001, 100000.0f); - mScaleSpinBox->setSingleStep(0.01); - mScaleSpinBox->setDecimals(7); - mScaleSpinBox->setValue(1.0f); - scaleLayout->addWidget(mScaleSpinBox); + m_scaleSpinBox = new AzQtComponents::DoubleSpinBox(); + m_scaleSpinBox->setRange(0.00001, 100000.0f); + m_scaleSpinBox->setSingleStep(0.01); + m_scaleSpinBox->setDecimals(7); + m_scaleSpinBox->setValue(1.0f); + scaleLayout->addWidget(m_scaleSpinBox); layout->addLayout(scaleLayout); QHBoxLayout* hLayout = new QHBoxLayout(); hLayout->setContentsMargins(9, 0, 9, 9); - mOK = new QPushButton("OK"); - mCancel = new QPushButton("Cancel"); - hLayout->addWidget(mOK); - hLayout->addWidget(mCancel); + m_ok = new QPushButton("OK"); + m_cancel = new QPushButton("Cancel"); + hLayout->addWidget(m_ok); + hLayout->addWidget(m_cancel); layout->addLayout(hLayout); - connect(mOK, &QPushButton::clicked, this, &UnitScaleWindow::OnOKButton); - connect(mCancel, &QPushButton::clicked, this, &UnitScaleWindow::OnCancelButton); + connect(m_ok, &QPushButton::clicked, this, &UnitScaleWindow::OnOKButton); + connect(m_cancel, &QPushButton::clicked, this, &UnitScaleWindow::OnCancelButton); } @@ -80,7 +80,7 @@ namespace EMStudio // accept void UnitScaleWindow::OnOKButton() { - mScaleFactor = static_cast(mScaleSpinBox->value()); + m_scaleFactor = static_cast(m_scaleSpinBox->value()); emit accept(); } diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/UnitScaleWindow.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/UnitScaleWindow.h index c60c66fad1..3de0ed1787 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/UnitScaleWindow.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/UnitScaleWindow.h @@ -30,16 +30,16 @@ namespace EMStudio UnitScaleWindow(QWidget* parent); ~UnitScaleWindow(); - float GetScaleFactor() const { return mScaleFactor; } + float GetScaleFactor() const { return m_scaleFactor; } private slots: void OnOKButton(); void OnCancelButton(); private: - float mScaleFactor; - QPushButton* mOK; - QPushButton* mCancel; - AzQtComponents::DoubleSpinBox* mScaleSpinBox; + float m_scaleFactor; + QPushButton* m_ok; + QPushButton* m_cancel; + AzQtComponents::DoubleSpinBox* m_scaleSpinBox; }; } // namespace EMStudio diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/Workspace.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/Workspace.cpp index a791b17e25..4cdf645b16 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/Workspace.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/Workspace.cpp @@ -38,7 +38,7 @@ namespace EMStudio { Workspace::Workspace() { - mDirtyFlag = false; + m_dirtyFlag = false; } @@ -161,11 +161,11 @@ namespace EMStudio } const EMotionFX::Transform& transform = actorInstance->GetLocalSpaceTransform(); - const AZ::Vector3& pos = transform.mPosition; - const AZ::Quaternion& rot = transform.mRotation; + const AZ::Vector3& pos = transform.m_position; + const AZ::Quaternion& rot = transform.m_rotation; #ifndef EMFX_SCALE_DISABLED - const AZ::Vector3& scale = transform.mScale; + const AZ::Vector3& scale = transform.m_scale; #else const AZ::Vector3 scale = AZ::Vector3::CreateOne(); #endif @@ -371,14 +371,14 @@ namespace EMStudio // update the workspace filename if (updateFileName) { - mFilename = filename; + m_filename = filename; } // update the workspace dirty flag if (updateDirtyFlag) { GetCommandManager()->SetWorkspaceDirtyFlag(false); - mDirtyFlag = false; + m_dirtyFlag = false; } // save succeeded @@ -404,7 +404,7 @@ namespace EMStudio QSettings settings(filename, QSettings::IniFormat, (QWidget*)GetManager()->GetMainWindow()); - mFilename = filename; + m_filename = filename; AZStd::string commandsString = FromQtString(settings.value("startScript", "").toString()); @@ -435,23 +435,23 @@ namespace EMStudio } GetCommandManager()->SetWorkspaceDirtyFlag(false); - mDirtyFlag = false; + m_dirtyFlag = false; return true; } void Workspace::Reset() { - mFilename.clear(); + m_filename.clear(); GetCommandManager()->SetWorkspaceDirtyFlag(false); - mDirtyFlag = false; + m_dirtyFlag = false; } bool Workspace::GetDirtyFlag() const { - if (mDirtyFlag) + if (m_dirtyFlag) { return true; } @@ -467,7 +467,7 @@ namespace EMStudio void Workspace::SetDirtyFlag(bool dirty) { - mDirtyFlag = dirty; + m_dirtyFlag = dirty; GetCommandManager()->SetWorkspaceDirtyFlag(dirty); } } // namespace EMStudio diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/Workspace.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/Workspace.h index 6ef029f131..ad048c6d6b 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/Workspace.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/Workspace.h @@ -35,9 +35,9 @@ namespace EMStudio void Reset(); - void SetFilename(const char* filename) { mFilename = filename; mDirtyFlag = true; } - const AZStd::string& GetFilenameString() const { return mFilename; } - const char* GetFilename() const { return mFilename.c_str(); } + void SetFilename(const char* filename) { m_filename = filename; m_dirtyFlag = true; } + const AZStd::string& GetFilenameString() const { return m_filename; } + const char* GetFilename() const { return m_filename.c_str(); } /** * Set the dirty flag which indicates whether the user has made changes to the motion. This indicator should be set to true @@ -57,7 +57,7 @@ namespace EMStudio void AddFile(AZStd::string* inOutCommands, const char* command, const AZStd::string& filename, const char* additionalParameters = nullptr) const; bool SaveToFile(const char* filename) const; - AZStd::string mFilename; - bool mDirtyFlag; + AZStd::string m_filename; + bool m_dirtyFlag; }; } // namespace EMStudio diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/RenderPlugins/Source/OpenGLRender/GLWidget.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/RenderPlugins/Source/OpenGLRender/GLWidget.cpp index 2d3a8b9eda..622dd6b566 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/RenderPlugins/Source/OpenGLRender/GLWidget.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/RenderPlugins/Source/OpenGLRender/GLWidget.cpp @@ -26,11 +26,11 @@ namespace EMStudio : QOpenGLWidget(parentWidget) , RenderWidget(parentPlugin, parentWidget) { - mParentRenderPlugin = parentPlugin; + m_parentRenderPlugin = parentPlugin; // construct the font metrics used for overlay text rendering - mFont.setPointSize(10); - mFontMetrics = new QFontMetrics(mFont); + m_font.setPointSize(10); + m_fontMetrics = new QFontMetrics(m_font); // create our default camera SwitchCamera(CAMMODE_ORBIT); @@ -47,27 +47,27 @@ namespace EMStudio GLWidget::~GLWidget() { // destruct the font metrics used for overlay text rendering - delete mFontMetrics; + delete m_fontMetrics; } // initialize the Qt OpenGL widget (overloaded from the widget base class) void GLWidget::initializeGL() { - // initializeOpenGLFunctions() and mParentRenderPlugin->InitializeGraphicsManager must be called first to ensure + // initializeOpenGLFunctions() and m_parentRenderPlugin->InitializeGraphicsManager must be called first to ensure // all OpenGL functions have been resolved before doing anything that could make GL calls (e.g. resizing) initializeOpenGLFunctions(); - mParentRenderPlugin->InitializeGraphicsManager(); - if (mParentRenderPlugin->GetGraphicsManager()) + m_parentRenderPlugin->InitializeGraphicsManager(); + if (m_parentRenderPlugin->GetGraphicsManager()) { - mParentRenderPlugin->GetGraphicsManager()->SetGBuffer(&mGBuffer); + m_parentRenderPlugin->GetGraphicsManager()->SetGBuffer(&m_gBuffer); } // set minimum render view dimensions setMinimumHeight(100); setMinimumWidth(100); - mPerfTimer.StampAndGetDeltaTimeInSeconds(); + m_perfTimer.StampAndGetDeltaTimeInSeconds(); } @@ -80,14 +80,14 @@ namespace EMStudio return; } - mParentRenderPlugin->GetRenderUtil()->Validate(); + m_parentRenderPlugin->GetRenderUtil()->Validate(); - mWidth = width; - mHeight = height; - mGBuffer.Resize(width, height); + m_width = width; + m_height = height; + m_gBuffer.Resize(width, height); - RenderGL::GraphicsManager* graphicsManager = mParentRenderPlugin->GetGraphicsManager(); - if (graphicsManager == nullptr || mCamera == nullptr) + RenderGL::GraphicsManager* graphicsManager = m_parentRenderPlugin->GetGraphicsManager(); + if (graphicsManager == nullptr || m_camera == nullptr) { return; } @@ -115,23 +115,23 @@ namespace EMStudio return; } - mRenderTimer.Stamp(); + m_renderTimer.Stamp(); // render the scene - RenderGL::GraphicsManager* graphicsManager = mParentRenderPlugin->GetGraphicsManager(); - if (graphicsManager == nullptr || mCamera == nullptr) + RenderGL::GraphicsManager* graphicsManager = m_parentRenderPlugin->GetGraphicsManager(); + if (graphicsManager == nullptr || m_camera == nullptr) { return; } painter.beginNativePainting(); - graphicsManager->SetGBuffer(&mGBuffer); + graphicsManager->SetGBuffer(&m_gBuffer); - RenderOptions* renderOptions = mParentRenderPlugin->GetRenderOptions(); + RenderOptions* renderOptions = m_parentRenderPlugin->GetRenderOptions(); // get a pointer to the render utility - RenderGL::GLRenderUtil* renderUtil = mParentRenderPlugin->GetGraphicsManager()->GetRenderUtil(); + RenderGL::GLRenderUtil* renderUtil = m_parentRenderPlugin->GetGraphicsManager()->GetRenderUtil(); if (renderUtil == nullptr) { return; @@ -139,35 +139,23 @@ namespace EMStudio // set this as the active widget // note that this is done in paint() instead of by the plugin because of delay when glwidget::update is called - MCORE_ASSERT(mParentRenderPlugin->GetActiveViewWidget() == nullptr); - mParentRenderPlugin->SetActiveViewWidget(mViewWidget); + MCORE_ASSERT(m_parentRenderPlugin->GetActiveViewWidget() == nullptr); + m_parentRenderPlugin->SetActiveViewWidget(m_viewWidget); // set the background colors graphicsManager->SetClearColor(renderOptions->GetBackgroundColor()); graphicsManager->SetGradientSourceColor(renderOptions->GetGradientSourceColor()); graphicsManager->SetGradientTargetColor(renderOptions->GetGradientTargetColor()); - graphicsManager->SetUseGradientBackground(mViewWidget->GetRenderFlag(RenderViewWidget::RENDER_USE_GRADIENTBACKGROUND)); + graphicsManager->SetUseGradientBackground(m_viewWidget->GetRenderFlag(RenderViewWidget::RENDER_USE_GRADIENTBACKGROUND)); // needed to make multiple viewports working glEnable(GL_DEPTH_TEST); glEnable(GL_MULTISAMPLE); // tell the system about the current viewport - glViewport(0, 0, aznumeric_cast(mWidth * devicePixelRatioF()), aznumeric_cast(mHeight * devicePixelRatioF())); + glViewport(0, 0, aznumeric_cast(m_width * devicePixelRatioF()), aznumeric_cast(m_height * devicePixelRatioF())); renderUtil->SetDevicePixelRatio(aznumeric_cast(devicePixelRatioF())); - // update advanced render settings - /* graphicsManager->SetAdvancedRendering( renderOptions->mEnableAdvancedRendering ); - graphicsManager->SetBloomEnabled ( renderOptions->mBloomEnabled ); - graphicsManager->SetBloomThreshold ( renderOptions->mBloomThreshold ); - graphicsManager->SetBloomIntensity ( renderOptions->mBloomIntensity ); - graphicsManager->SetBloomRadius ( renderOptions->mBloomRadius ); - graphicsManager->SetDOFEnabled ( renderOptions->mDOFEnabled ); - graphicsManager->SetDOFFocalDistance( renderOptions->mDOFFocalPoint ); - graphicsManager->SetDOFNear ( renderOptions->mDOFNear ); - graphicsManager->SetDOFFar ( renderOptions->mDOFFar ); - graphicsManager->SetDOFBlurRadius ( renderOptions->mDOFBlurRadius ); - */ graphicsManager->SetRimAngle (renderOptions->GetRimAngle()); graphicsManager->SetRimIntensity (renderOptions->GetRimIntensity()); graphicsManager->SetRimWidth (renderOptions->GetRimWidth()); @@ -180,7 +168,7 @@ namespace EMStudio // update the camera UpdateCamera(); - graphicsManager->SetCamera(mCamera); + graphicsManager->SetCamera(m_camera); graphicsManager->BeginRender(); @@ -216,16 +204,16 @@ namespace EMStudio glDisable(GL_CULL_FACE); glDisable(GL_DEPTH_TEST); - MCommon::Camera* camera = mCamera; - if (mCamera->GetType() == MCommon::OrthographicCamera::TYPE_ID) + MCommon::Camera* camera = m_camera; + if (m_camera->GetType() == MCommon::OrthographicCamera::TYPE_ID) { - camera = mAxisFakeCamera; + camera = m_axisFakeCamera; } graphicsManager->SetCamera(camera); RenderWidget::RenderAxis(); - graphicsManager->SetCamera(mCamera); + graphicsManager->SetCamera(m_camera); glPopAttrib(); @@ -235,7 +223,7 @@ namespace EMStudio // render the border around the render view if (EMotionFX::GetRecorder().GetIsRecording() == false && EMotionFX::GetRecorder().GetIsInPlayMode() == false) { - if (mParentRenderPlugin->GetFocusViewWidget() == mViewWidget) + if (m_parentRenderPlugin->GetFocusViewWidget() == m_viewWidget) { RenderBorder(MCore::RGBAColor(1.0f, 0.647f, 0.0f)); } @@ -261,16 +249,16 @@ namespace EMStudio // makes no GL context the current context, needed in multithreaded environments //doneCurrent(); // Ben: results in a white screen - mParentRenderPlugin->SetActiveViewWidget(nullptr); + m_parentRenderPlugin->SetActiveViewWidget(nullptr); painter.endNativePainting(); if (renderOptions->GetShowFPS()) { - const float renderTime = mRenderTimer.GetDeltaTimeInSeconds() * 1000.0f; + const float renderTime = m_renderTimer.GetDeltaTimeInSeconds() * 1000.0f; // get the time delta between the current time and the last frame - const float perfTimeDelta = mPerfTimer.StampAndGetDeltaTimeInSeconds(); + const float perfTimeDelta = m_perfTimer.StampAndGetDeltaTimeInSeconds(); static float fpsTimeElapsed = 0.0f; static uint32 fpsNumFrames = 0; @@ -288,11 +276,7 @@ namespace EMStudio perfTempString = AZStd::string::format("%d FPS (%.1f ms)", lastFPS, renderTime); // initialize the painter and get the font metrics - //painter.setBrush( Qt::NoBrush ); - //painter.setPen( QColor(130, 130, 130) ); - //painter.setFont( mFont ); - EMStudioManager::RenderText(painter, perfTempString.c_str(), QColor(150, 150, 150), mFont, *mFontMetrics, Qt::AlignRight, QRect(width() - 55, height() - 20, 50, 20)); - //painter.drawText( QPoint(width() - 133, height() - 14), perfTempString.AsChar() ); + EMStudioManager::RenderText(painter, perfTempString.c_str(), QColor(150, 150, 150), m_font, *m_fontMetrics, Qt::AlignRight, QRect(width() - 55, height() - 20, 50, 20)); } } @@ -301,7 +285,7 @@ namespace EMStudio { glMatrixMode(GL_PROJECTION); glLoadIdentity(); - glOrtho(0.0f, mWidth, mHeight, 0.0f, 0.0f, 1.0f); + glOrtho(0.0f, m_width, m_height, 0.0f, 0.0f, 1.0f); glMatrixMode (GL_MODELVIEW); glLoadIdentity(); //glTranslatef(0.375f, 0.375f, 0.0f); @@ -312,20 +296,20 @@ namespace EMStudio glLineWidth(3.0f); - glColor3f(color.r, color.g, color.b); + glColor3f(color.m_r, color.m_g, color.m_b); glBegin(GL_LINES); // left glVertex2f(0.0f, 0.0f); - glVertex2f(0.0f, aznumeric_cast(mHeight)); + glVertex2f(0.0f, aznumeric_cast(m_height)); // bottom - glVertex2f(0.0f, aznumeric_cast(mHeight)); - glVertex2f(aznumeric_cast(mWidth), aznumeric_cast(mHeight)); + glVertex2f(0.0f, aznumeric_cast(m_height)); + glVertex2f(aznumeric_cast(m_width), aznumeric_cast(m_height)); // top glVertex2f(0.0f, 0.0f); - glVertex2f(aznumeric_cast(mWidth), 0); + glVertex2f(aznumeric_cast(m_width), 0); // right - glVertex2f(aznumeric_cast(mWidth), 0.0f); - glVertex2f(aznumeric_cast(mWidth), aznumeric_cast(mHeight)); + glVertex2f(aznumeric_cast(m_width), 0.0f); + glVertex2f(aznumeric_cast(m_width), aznumeric_cast(m_height)); glEnd(); glLineWidth(1.0f); @@ -335,7 +319,7 @@ namespace EMStudio void GLWidget::focusInEvent(QFocusEvent* event) { MCORE_UNUSED(event); - mParentRenderPlugin->SetFocusViewWidget(mViewWidget); + m_parentRenderPlugin->SetFocusViewWidget(m_viewWidget); grabKeyboard(); } @@ -343,7 +327,7 @@ namespace EMStudio void GLWidget::focusOutEvent(QFocusEvent* event) { MCORE_UNUSED(event); - mParentRenderPlugin->SetFocusViewWidget(nullptr); + m_parentRenderPlugin->SetFocusViewWidget(nullptr); releaseKeyboard(); } } // namespace EMStudio diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/RenderPlugins/Source/OpenGLRender/GLWidget.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/RenderPlugins/Source/OpenGLRender/GLWidget.h index 2306da0a5f..685ff4ef88 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/RenderPlugins/Source/OpenGLRender/GLWidget.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/RenderPlugins/Source/OpenGLRender/GLWidget.h @@ -76,12 +76,12 @@ namespace EMStudio void Update() { update(); } void RenderBorder(const MCore::RGBAColor& color); - RenderGL::GBuffer mGBuffer; - OpenGLRenderPlugin* mParentRenderPlugin; - QFont mFont; - QFontMetrics* mFontMetrics; - AZ::Debug::Timer mRenderTimer; - AZ::Debug::Timer mPerfTimer; + RenderGL::GBuffer m_gBuffer; + OpenGLRenderPlugin* m_parentRenderPlugin; + QFont m_font; + QFontMetrics* m_fontMetrics; + AZ::Debug::Timer m_renderTimer; + AZ::Debug::Timer m_perfTimer; }; } // namespace EMStudio diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/RenderPlugins/Source/OpenGLRender/OpenGLRenderPlugin.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/RenderPlugins/Source/OpenGLRender/OpenGLRenderPlugin.cpp index 396a7fc906..5626e482eb 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/RenderPlugins/Source/OpenGLRender/OpenGLRenderPlugin.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/RenderPlugins/Source/OpenGLRender/OpenGLRenderPlugin.cpp @@ -25,13 +25,13 @@ namespace EMStudio OpenGLRenderPlugin::OpenGLRenderPlugin() : EMStudio::RenderPlugin() { - mGraphicsManager = nullptr; + m_graphicsManager = nullptr; } OpenGLRenderPlugin::~OpenGLRenderPlugin() { // get rid of the OpenGL graphics manager - delete mGraphicsManager; + delete m_graphicsManager; } // init after the parent dock window has been created @@ -48,7 +48,7 @@ namespace EMStudio // initialize the OpenGL engine bool OpenGLRenderPlugin::InitializeGraphicsManager() { - if (mGraphicsManager) + if (m_graphicsManager) { // initialize all already existing actors and actor instances ReInit(); @@ -59,15 +59,15 @@ namespace EMStudio const auto shaderPath = AZ::IO::Path(MysticQt::GetDataDir()) / "Shaders"; // create graphics manager and initialize it - mGraphicsManager = new RenderGL::GraphicsManager(); - if (mGraphicsManager->Init(shaderPath) == false) + m_graphicsManager = new RenderGL::GraphicsManager(); + if (m_graphicsManager->Init(shaderPath) == false) { MCore::LogError("Could not initialize OpenGL graphics manager."); return false; } // set the render util in the base render plugin - mRenderUtil = mGraphicsManager->GetRenderUtil(); + m_renderUtil = m_graphicsManager->GetRenderUtil(); // initialize all already existing actors and actor instances ReInit(); diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/RenderPlugins/Source/OpenGLRender/OpenGLRenderPlugin.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/RenderPlugins/Source/OpenGLRender/OpenGLRenderPlugin.h index b75a4df24b..1203d7e381 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/RenderPlugins/Source/OpenGLRender/OpenGLRenderPlugin.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/RenderPlugins/Source/OpenGLRender/OpenGLRenderPlugin.h @@ -51,10 +51,10 @@ namespace EMStudio // OpenGL engine helper functions bool InitializeGraphicsManager(); - MCORE_INLINE RenderGL::GraphicsManager* GetGraphicsManager() { return mGraphicsManager; } + MCORE_INLINE RenderGL::GraphicsManager* GetGraphicsManager() { return m_graphicsManager; } private: - RenderGL::GraphicsManager* mGraphicsManager; // shared OpenGL engine object + RenderGL::GraphicsManager* m_graphicsManager; // shared OpenGL engine object // overloaded emstudio actor create function which creates an OpenGL render actor internally bool CreateEMStudioActor(EMotionFX::Actor* actor); diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/ActionHistory/ActionHistoryCallback.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/ActionHistory/ActionHistoryCallback.cpp index ac23dd489b..2715a0a0fe 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/ActionHistory/ActionHistoryCallback.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/ActionHistory/ActionHistoryCallback.cpp @@ -21,13 +21,13 @@ namespace EMStudio ActionHistoryCallback::ActionHistoryCallback(QListWidget* list) : MCore::CommandManagerCallback() { - mList = list; - mIndex = 0; - mIsRemoving = false; - mGroupExecuting = false; - mExecutedGroup = nullptr; - mNumGroupCommands = 0; - mCurrentCommandIndex = 0; + m_list = list; + m_index = 0; + m_isRemoving = false; + m_groupExecuting = false; + m_executedGroup = nullptr; + m_numGroupCommands = 0; + m_currentCommandIndex = 0; m_darkenedBrush.setColor(QColor(110, 110, 110)); m_brush.setColor(QColor(200, 200, 200)); } @@ -41,16 +41,16 @@ namespace EMStudio { if (MCore::GetLogManager().GetLogLevels() & MCore::LogCallback::LOGLEVEL_DEBUG) { - mTempString = command->GetName(); + m_tempString = command->GetName(); const size_t numParameters = commandLine.GetNumParameters(); for (size_t i = 0; i < numParameters; ++i) { - mTempString += " -"; - mTempString += commandLine.GetParameterName(i); - mTempString += " "; - mTempString += commandLine.GetParameterValue(i); + m_tempString += " -"; + m_tempString += commandLine.GetParameterName(i); + m_tempString += " "; + m_tempString += commandLine.GetParameterValue(i); } - MCore::LogDebugMsg(mTempString.c_str()); + MCore::LogDebugMsg(m_tempString.c_str()); } } } @@ -61,66 +61,66 @@ namespace EMStudio MCORE_UNUSED(group); MCORE_UNUSED(commandLine); MCORE_UNUSED(outResult); - if (mGroupExecuting && mExecutedGroup) + if (m_groupExecuting && m_executedGroup) { - mCurrentCommandIndex++; - if (mCurrentCommandIndex % 32 == 0) + m_currentCommandIndex++; + if (m_currentCommandIndex % 32 == 0) { - EMotionFX::GetEventManager().OnProgressValue(((float)mCurrentCommandIndex / (mNumGroupCommands + 1)) * 100.0f); + EMotionFX::GetEventManager().OnProgressValue(((float)m_currentCommandIndex / (m_numGroupCommands + 1)) * 100.0f); } } if (command && MCore::GetLogManager().GetLogLevels() & MCore::LogCallback::LOGLEVEL_DEBUG) { - mTempString = AZStd::string::format("%sExecution of command '%s' %s", wasSuccess ? " " : "*** ", command->GetName(), wasSuccess ? "completed successfully" : " FAILED"); - MCore::LogDebugMsg(mTempString.c_str()); + m_tempString = AZStd::string::format("%sExecution of command '%s' %s", wasSuccess ? " " : "*** ", command->GetName(), wasSuccess ? "completed successfully" : " FAILED"); + MCore::LogDebugMsg(m_tempString.c_str()); } } // Before executing a command group. void ActionHistoryCallback::OnPreExecuteCommandGroup(MCore::CommandGroup* group, bool undo) { - if (!mGroupExecuting && group->GetNumCommands() > 64) + if (!m_groupExecuting && group->GetNumCommands() > 64) { - mGroupExecuting = true; - mExecutedGroup = group; - mCurrentCommandIndex = 0; - mNumGroupCommands = group->GetNumCommands(); + m_groupExecuting = true; + m_executedGroup = group; + m_currentCommandIndex = 0; + m_numGroupCommands = group->GetNumCommands(); GetManager()->SetAvoidRendering(true); EMotionFX::GetEventManager().OnProgressStart(); - mTempString = AZStd::string::format("%s%s", undo ? "Undo: " : "", group->GetGroupName()); - EMotionFX::GetEventManager().OnProgressText(mTempString.c_str()); + m_tempString = AZStd::string::format("%s%s", undo ? "Undo: " : "", group->GetGroupName()); + EMotionFX::GetEventManager().OnProgressText(m_tempString.c_str()); } if (group && MCore::GetLogManager().GetLogLevels() & MCore::LogCallback::LOGLEVEL_DEBUG) { - mTempString = AZStd::string::format("Starting %s of command group '%s'", undo ? "undo" : "execution", group->GetGroupName()); - MCore::LogDebugMsg(mTempString.c_str()); + m_tempString = AZStd::string::format("Starting %s of command group '%s'", undo ? "undo" : "execution", group->GetGroupName()); + MCore::LogDebugMsg(m_tempString.c_str()); } } // After executing a command group. void ActionHistoryCallback::OnPostExecuteCommandGroup(MCore::CommandGroup* group, bool wasSuccess) { - if (mExecutedGroup == group) + if (m_executedGroup == group) { EMotionFX::GetEventManager().OnProgressEnd(); - mGroupExecuting = false; - mExecutedGroup = nullptr; - mNumGroupCommands = 0; - mCurrentCommandIndex = 0; + m_groupExecuting = false; + m_executedGroup = nullptr; + m_numGroupCommands = 0; + m_currentCommandIndex = 0; GetManager()->SetAvoidRendering(false); } if (group && MCore::GetLogManager().GetLogLevels() & MCore::LogCallback::LOGLEVEL_DEBUG) { - mTempString = AZStd::string::format("%sExecution of command group '%s' %s", wasSuccess ? " " : "*** ", group->GetGroupName(), wasSuccess ? "completed successfully" : " FAILED"); - MCore::LogDebugMsg(mTempString.c_str()); + m_tempString = AZStd::string::format("%sExecution of command group '%s' %s", wasSuccess ? " " : "*** ", group->GetGroupName(), wasSuccess ? "completed successfully" : " FAILED"); + MCore::LogDebugMsg(m_tempString.c_str()); } } @@ -128,44 +128,44 @@ namespace EMStudio void ActionHistoryCallback::OnAddCommandToHistory(size_t historyIndex, MCore::CommandGroup* group, MCore::Command* command, const MCore::CommandLine& commandLine) { MCORE_UNUSED(commandLine); - mTempString = MCore::CommandManager::CommandHistoryEntry::ToString(group, command, mIndex++).c_str(); + m_tempString = MCore::CommandManager::CommandHistoryEntry::ToString(group, command, m_index++).c_str(); - mList->insertItem(aznumeric_caster(historyIndex), new QListWidgetItem(mTempString.c_str(), mList)); - mList->setCurrentRow(aznumeric_caster(historyIndex)); + m_list->insertItem(aznumeric_caster(historyIndex), new QListWidgetItem(m_tempString.c_str(), m_list)); + m_list->setCurrentRow(aznumeric_caster(historyIndex)); } // Remove an item from the history. void ActionHistoryCallback::OnRemoveCommand(size_t historyIndex) { // Remove the item. - mIsRemoving = true; - delete mList->takeItem(aznumeric_caster(historyIndex)); - mIsRemoving = false; + m_isRemoving = true; + delete m_list->takeItem(aznumeric_caster(historyIndex)); + m_isRemoving = false; } // Set the current command. void ActionHistoryCallback::OnSetCurrentCommand(size_t index) { - if (mIsRemoving) + if (m_isRemoving) { return; } if (index == InvalidIndex) { - mList->setCurrentRow(-1); + m_list->setCurrentRow(-1); // Darken all history items. - const int numCommands = mList->count(); + const int numCommands = m_list->count(); for (int i = 0; i < numCommands; ++i) { - mList->item(i)->setForeground(m_darkenedBrush); + m_list->item(i)->setForeground(m_darkenedBrush); } return; } // get the list of selected items - mList->setCurrentRow(aznumeric_caster(index)); + m_list->setCurrentRow(aznumeric_caster(index)); // Get the current history index. const size_t historyIndex = GetCommandManager()->GetHistoryIndex(); @@ -225,13 +225,13 @@ namespace EMStudio const int numCommands = static_cast(GetCommandManager()->GetNumHistoryItems()); for (int i = aznumeric_caster(index); i < numCommands; ++i) { - mList->item(i)->setForeground(m_darkenedBrush); + m_list->item(i)->setForeground(m_darkenedBrush); } // Color enabled ones. for (int i = 0; i <= static_cast(index); ++i) { - mList->item(i)->setForeground(m_brush); + m_list->item(i)->setForeground(m_brush); } } } // namespace EMStudio diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/ActionHistory/ActionHistoryCallback.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/ActionHistory/ActionHistoryCallback.h index 0433b22d5d..621ed8ecff 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/ActionHistory/ActionHistoryCallback.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/ActionHistory/ActionHistoryCallback.h @@ -44,15 +44,15 @@ namespace EMStudio void OnSetCurrentCommand(size_t index) override; private: - QListWidget* mList; - AZStd::string mTempString; - uint32 mIndex; - bool mIsRemoving; + QListWidget* m_list; + AZStd::string m_tempString; + uint32 m_index; + bool m_isRemoving; - bool mGroupExecuting; - MCore::CommandGroup* mExecutedGroup; - size_t mNumGroupCommands; - uint32 mCurrentCommandIndex; + bool m_groupExecuting; + MCore::CommandGroup* m_executedGroup; + size_t m_numGroupCommands; + uint32 m_currentCommandIndex; QBrush m_brush; QBrush m_darkenedBrush; }; diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/ActionHistory/ActionHistoryPlugin.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/ActionHistory/ActionHistoryPlugin.cpp index 6a80fec548..d84bbebbc6 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/ActionHistory/ActionHistoryPlugin.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/ActionHistory/ActionHistoryPlugin.cpp @@ -18,20 +18,20 @@ namespace EMStudio ActionHistoryPlugin::ActionHistoryPlugin() : EMStudio::DockWidgetPlugin() { - mCallback = nullptr; - mList = nullptr; + m_callback = nullptr; + m_list = nullptr; } ActionHistoryPlugin::~ActionHistoryPlugin() { - if (mCallback) + if (m_callback) { - EMStudio::GetCommandManager()->RemoveCallback(mCallback, false); - delete mCallback; + EMStudio::GetCommandManager()->RemoveCallback(m_callback, false); + delete m_callback; } - delete mList; + delete m_list; } @@ -75,22 +75,22 @@ namespace EMStudio // Init after the parent dock window has been created. bool ActionHistoryPlugin::Init() { - mList = new QListWidget(mDock); + m_list = new QListWidget(m_dock); - mList->setFlow(QListView::TopToBottom); - mList->setMovement(QListView::Static); - mList->setViewMode(QListView::ListMode); - mList->setSelectionRectVisible(true); - mList->setSelectionBehavior(QAbstractItemView::SelectRows); - mList->setSelectionMode(QAbstractItemView::SingleSelection); - mDock->setWidget(mList); + m_list->setFlow(QListView::TopToBottom); + m_list->setMovement(QListView::Static); + m_list->setViewMode(QListView::ListMode); + m_list->setSelectionRectVisible(true); + m_list->setSelectionBehavior(QAbstractItemView::SelectRows); + m_list->setSelectionMode(QAbstractItemView::SingleSelection); + m_dock->setWidget(m_list); // Detect item selection changes. - connect(mList, &QListWidget::itemSelectionChanged, this, &ActionHistoryPlugin::OnSelectedItemChanged); + connect(m_list, &QListWidget::itemSelectionChanged, this, &ActionHistoryPlugin::OnSelectedItemChanged); // Register the callback. - mCallback = new ActionHistoryCallback(mList); - EMStudio::GetCommandManager()->RegisterCallback(mCallback); + m_callback = new ActionHistoryCallback(m_list); + EMStudio::GetCommandManager()->RegisterCallback(m_callback); // Sync the interface with the actual command history. ReInit(); @@ -109,12 +109,12 @@ namespace EMStudio { const MCore::CommandManager::CommandHistoryEntry& historyItem = commandManager->GetHistoryItem(i); - historyItemString = MCore::CommandManager::CommandHistoryEntry::ToString(historyItem.mCommandGroup, historyItem.mExecutedCommand, historyItem.m_historyItemNr); - mList->addItem(new QListWidgetItem(historyItemString.c_str(), mList)); + historyItemString = MCore::CommandManager::CommandHistoryEntry::ToString(historyItem.m_commandGroup, historyItem.m_executedCommand, historyItem.m_historyItemNr); + m_list->addItem(new QListWidgetItem(historyItemString.c_str(), m_list)); } // Set the current history index in case the user called undo. - mList->setCurrentRow(commandManager->GetHistoryIndex()); + m_list->setCurrentRow(commandManager->GetHistoryIndex()); } @@ -122,17 +122,17 @@ namespace EMStudio void ActionHistoryPlugin::OnSelectedItemChanged() { // Get the list of selected items and make sure exactly one is selected. - QList selected = mList->selectedItems(); + QList selected = m_list->selectedItems(); if (selected.count() != 1) { return; } // Get the selected item and its index (row number in the list). - const uint32 index = mList->row(selected.at(0)); + const uint32 index = m_list->row(selected.at(0)); // Change the command index. - mCallback->OnSetCurrentCommand(index); + m_callback->OnSetCurrentCommand(index); } } // namespace EMStudio diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/ActionHistory/ActionHistoryPlugin.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/ActionHistory/ActionHistoryPlugin.h index a9bff7780b..550e6628e3 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/ActionHistory/ActionHistoryPlugin.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/ActionHistory/ActionHistoryPlugin.h @@ -51,7 +51,7 @@ namespace EMStudio void OnSelectedItemChanged(); private: - QListWidget* mList; - ActionHistoryCallback* mCallback; + QListWidget* m_list; + ActionHistoryCallback* m_callback; }; } // namespace EMStudio diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/AnimGraphActionManager.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/AnimGraphActionManager.cpp index 9a4170d1b0..5e33659056 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/AnimGraphActionManager.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/AnimGraphActionManager.cpp @@ -206,8 +206,8 @@ namespace EMStudio // If found motion entry, add select and play motion command strings to command group. EMotionFX::Motion* motion = motionEntry->GetMotion(); EMotionFX::PlayBackInfo* defaultPlayBackInfo = motion->GetDefaultPlayBackInfo(); - defaultPlayBackInfo->mBlendInTime = 0.0f; - defaultPlayBackInfo->mBlendOutTime = 0.0f; + defaultPlayBackInfo->m_blendInTime = 0.0f; + defaultPlayBackInfo->m_blendOutTime = 0.0f; commandParameters = CommandSystem::CommandPlayMotion::PlayBackInfoToCommandParameters(defaultPlayBackInfo); const size_t motionIndex = EMotionFX::GetMotionManager().FindMotionIndexByName(motion->GetName()); diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/AnimGraphEditor.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/AnimGraphEditor.cpp index f6e308f07b..96bc39e29c 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/AnimGraphEditor.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/AnimGraphEditor.cpp @@ -26,8 +26,8 @@ namespace EMotionFX { - const int AnimGraphEditor::m_propertyLabelWidth = 120; - QString AnimGraphEditor::m_lastMotionSetText = ""; + const int AnimGraphEditor::s_propertyLabelWidth = 120; + QString AnimGraphEditor::s_lastMotionSetText = ""; AnimGraphEditor::AnimGraphEditor(EMotionFX::AnimGraph* animGraph, AZ::SerializeContext* serializeContext, QWidget* parent) : QWidget(parent) @@ -64,7 +64,7 @@ namespace EMotionFX m_propertyEditor = aznew AzToolsFramework::ReflectedPropertyEditor(this); m_propertyEditor->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum); m_propertyEditor->setObjectName("PropertyEditor"); - m_propertyEditor->Setup(serializeContext, nullptr, false/*enableScrollbars*/, m_propertyLabelWidth); + m_propertyEditor->Setup(serializeContext, nullptr, false/*enableScrollbars*/, s_propertyLabelWidth); m_propertyEditor->SetSizeHintOffset(QSize(0, 0)); m_propertyEditor->SetAutoResizeLabels(false); m_propertyEditor->SetLeafIndentation(0); @@ -86,9 +86,9 @@ namespace EMotionFX m_motionSetComboBox = new QComboBox(); m_motionSetComboBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); //initializes to last selection if it is there - if (!m_lastMotionSetText.isEmpty()) + if (!s_lastMotionSetText.isEmpty()) { - m_motionSetComboBox->addItem(m_lastMotionSetText); + m_motionSetComboBox->addItem(s_lastMotionSetText); m_motionSetComboBox->setCurrentIndex(0); } connect(m_motionSetComboBox, static_cast(&QComboBox::currentIndexChanged), this, &AnimGraphEditor::OnMotionSetChanged); @@ -303,7 +303,7 @@ namespace EMotionFX const CommandSystem::SelectionList& selectionList = CommandSystem::GetCommandManager()->GetCurrentSelection(); const size_t numActorInstances = selectionList.GetNumSelectedActorInstances(); - AnimGraphEditor::m_lastMotionSetText = m_motionSetComboBox->itemText(index); + AnimGraphEditor::s_lastMotionSetText = m_motionSetComboBox->itemText(index); // if no one actor instance is selected, the combo box has no effect if (numActorInstances == 0) { diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/AnimGraphEditor.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/AnimGraphEditor.h index 1d17c46815..836bc8f8ad 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/AnimGraphEditor.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/AnimGraphEditor.h @@ -58,9 +58,9 @@ namespace EMotionFX AnimGraph* m_animGraph; QLabel* m_filenameLabel; AzToolsFramework::ReflectedPropertyEditor* m_propertyEditor; - static const int m_propertyLabelWidth; + static const int s_propertyLabelWidth; QComboBox* m_motionSetComboBox; - static QString m_lastMotionSetText; + static QString s_lastMotionSetText; AZStd::vector m_commandCallbacks; }; diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/AnimGraphHierarchyWidget.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/AnimGraphHierarchyWidget.h index c10320a794..586f419292 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/AnimGraphHierarchyWidget.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/AnimGraphHierarchyWidget.h @@ -34,12 +34,12 @@ namespace CommandSystem struct AnimGraphSelectionItem { AnimGraphSelectionItem(uint32 animGraphID, const AZStd::string& nodeName) - : mAnimGraphID(animGraphID) - , mNodeName(nodeName) + : m_animGraphId(animGraphID) + , m_nodeName(nodeName) {} - uint32 mAnimGraphID; - AZStd::string mNodeName; + uint32 m_animGraphId; + AZStd::string m_nodeName; }; namespace EMotionFX diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/AnimGraphModelCallbacks.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/AnimGraphModelCallbacks.cpp index 5de2b58905..c7dc9304d9 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/AnimGraphModelCallbacks.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/AnimGraphModelCallbacks.cpp @@ -29,7 +29,7 @@ namespace EMStudio { CommandSystem::CommandLoadAnimGraph* commandLoadAnimGraph = static_cast(command); - EMotionFX::AnimGraph* animGraph = EMotionFX::GetAnimGraphManager().FindAnimGraphByID(commandLoadAnimGraph->mOldAnimGraphID); + EMotionFX::AnimGraph* animGraph = EMotionFX::GetAnimGraphManager().FindAnimGraphByID(commandLoadAnimGraph->m_oldAnimGraphId); if (animGraph) { m_animGraphModel.Add(animGraph); @@ -55,7 +55,7 @@ namespace EMStudio { CommandSystem::CommandCreateAnimGraph* commandCreateAnimGraph = static_cast(command); - EMotionFX::AnimGraph* animGraph = EMotionFX::GetAnimGraphManager().FindAnimGraphByID(commandCreateAnimGraph->mPreviouslyUsedID); + EMotionFX::AnimGraph* animGraph = EMotionFX::GetAnimGraphManager().FindAnimGraphByID(commandCreateAnimGraph->m_previouslyUsedId); m_animGraphModel.Add(animGraph); EMotionFX::AnimGraphStateMachine* rootStateMachine = animGraph->GetRootStateMachine(); @@ -164,7 +164,7 @@ namespace EMStudio bool AnimGraphModel::CommandDidActivateAnimGraphPostUndoCallback::Undo(MCore::Command* command, [[maybe_unused]] const MCore::CommandLine& commandLine) { CommandSystem::CommandActivateAnimGraph* commandActivateAnimGraph = static_cast(command); - EMotionFX::ActorInstance* actorInstance = EMotionFX::GetActorManager().FindActorInstanceByID(commandActivateAnimGraph->mActorInstanceID); + EMotionFX::ActorInstance* actorInstance = EMotionFX::GetActorManager().FindActorInstanceByID(commandActivateAnimGraph->m_actorInstanceId); if (actorInstance) { @@ -181,14 +181,14 @@ namespace EMStudio bool AnimGraphModel::CommandDidActivateAnimGraphCallback::Execute(MCore::Command* command, [[maybe_unused]] const MCore::CommandLine& commandLine) { CommandSystem::CommandActivateAnimGraph* commandActivateAnimGraph = static_cast(command); - EMotionFX::ActorInstance* actorInstance = EMotionFX::GetActorManager().FindActorInstanceByID(commandActivateAnimGraph->mActorInstanceID); + EMotionFX::ActorInstance* actorInstance = EMotionFX::GetActorManager().FindActorInstanceByID(commandActivateAnimGraph->m_actorInstanceId); if (actorInstance) { EMotionFX::AnimGraphInstance* currentAnimGraphInstance = actorInstance->GetAnimGraphInstance(); EMotionFX::AnimGraph* currentAnimGraph = currentAnimGraphInstance->GetAnimGraph(); EMotionFX::AnimGraph* oldAnimGraph = nullptr; - oldAnimGraph = EMotionFX::GetAnimGraphManager().FindAnimGraphByID(commandActivateAnimGraph->mOldAnimGraphUsed); + oldAnimGraph = EMotionFX::GetAnimGraphManager().FindAnimGraphByID(commandActivateAnimGraph->m_oldAnimGraphUsed); if (currentAnimGraphInstance) { @@ -209,7 +209,7 @@ namespace EMStudio bool AnimGraphModel::CommandDidActivateAnimGraphCallback::Undo(MCore::Command* command, const MCore::CommandLine& commandLine) { CommandSystem::CommandActivateAnimGraph* commandActivateAnimGraph = static_cast(command); - EMotionFX::ActorInstance* actorInstance = EMotionFX::GetActorManager().FindActorInstanceByID(commandActivateAnimGraph->mActorInstanceID); + EMotionFX::ActorInstance* actorInstance = EMotionFX::GetActorManager().FindActorInstanceByID(commandActivateAnimGraph->m_actorInstanceId); // TODO: do this better, we need to find the animgraphinstance that we are undoing after the undo finishes if (actorInstance) @@ -254,7 +254,7 @@ namespace EMStudio } CommandSystem::CommandAnimGraphCreateNode* commandCreateNode = static_cast(command); - EMotionFX::AnimGraphNode* node = animGraph->RecursiveFindNodeById(commandCreateNode->mNodeId); + EMotionFX::AnimGraphNode* node = animGraph->RecursiveFindNodeById(commandCreateNode->m_nodeId); return m_animGraphModel.NodeAdded(node); } @@ -656,10 +656,10 @@ namespace EMStudio { CommandSystem::CommandAnimGraphSetEntryState* commandSetEntryState = static_cast(command); - EMotionFX::AnimGraph* animGraph = EMotionFX::GetAnimGraphManager().FindAnimGraphByID(commandSetEntryState->mAnimGraphID); + EMotionFX::AnimGraph* animGraph = EMotionFX::GetAnimGraphManager().FindAnimGraphByID(commandSetEntryState->m_animGraphId); if (animGraph) { - EMotionFX::AnimGraphNode* entryNode = animGraph->RecursiveFindNodeById(commandSetEntryState->mOldEntryStateNodeId); + EMotionFX::AnimGraphNode* entryNode = animGraph->RecursiveFindNodeById(commandSetEntryState->m_oldEntryStateNodeId); if (entryNode) { static const QVector entryStateRole = { AnimGraphModel::ROLE_NODE_ENTRY_STATE }; diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/AnimGraphPlugin.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/AnimGraphPlugin.cpp index 1a713f52fe..4baec366f0 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/AnimGraphPlugin.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/AnimGraphPlugin.cpp @@ -130,7 +130,7 @@ namespace EMStudio // add the link to the actual object ObjectPointer objPointer; - objPointer.mAnimGraph = animGraph; + objPointer.m_animGraph = animGraph; outObjects->push_back(objPointer); } } @@ -150,12 +150,12 @@ namespace EMStudio for (const SaveDirtyFilesCallback::ObjectPointer& objPointer : objects) { // get the current object pointer and skip directly if the type check fails - if (objPointer.mAnimGraph == nullptr) + if (objPointer.m_animGraph == nullptr) { continue; } - EMotionFX::AnimGraph* animGraph = objPointer.mAnimGraph; + EMotionFX::AnimGraph* animGraph = objPointer.m_animGraph; if (animGraphPlugin->SaveDirtyAnimGraph(animGraph, commandGroup, false) == DirtyFileManager::CANCELED) { return DirtyFileManager::CANCELED; @@ -177,33 +177,32 @@ namespace EMStudio // constructor AnimGraphPlugin::AnimGraphPlugin() : EMStudio::DockWidgetPlugin() - , mEventHandler(this) + , m_eventHandler(this) { - mGraphWidget = nullptr; - mNavigateWidget = nullptr; - mAttributeDock = nullptr; - mNodeGroupDock = nullptr; - mPaletteWidget = nullptr; - mNodePaletteDock = nullptr; - mParameterDock = nullptr; - mParameterWindow = nullptr; - mNodeGroupWindow = nullptr; - mAttributesWindow = nullptr; - mActiveAnimGraph = nullptr; + m_graphWidget = nullptr; + m_navigateWidget = nullptr; + m_attributeDock = nullptr; + m_nodeGroupDock = nullptr; + m_paletteWidget = nullptr; + m_nodePaletteDock = nullptr; + m_parameterDock = nullptr; + m_parameterWindow = nullptr; + m_nodeGroupWindow = nullptr; + m_attributesWindow = nullptr; + m_activeAnimGraph = nullptr; m_animGraphObjectFactory = nullptr; - mGraphNodeFactory = nullptr; - mViewWidget = nullptr; - mDirtyFilesCallback = nullptr; + m_graphNodeFactory = nullptr; + m_viewWidget = nullptr; + m_dirtyFilesCallback = nullptr; m_navigationHistory = nullptr; - mDisplayFlags = 0; - // mShowProcessed = false; - mDisableRendering = false; - mLastPlayTime = -1; - mTotalTime = FLT_MAX; + m_displayFlags = 0; + m_disableRendering = false; + m_lastPlayTime = -1; + m_totalTime = FLT_MAX; #if AZ_TRAIT_EMOTIONFX_HAS_GAME_CONTROLLER - mGameControllerWindow = nullptr; - mGameControllerDock = nullptr; + m_gameControllerWindow = nullptr; + m_gameControllerDock = nullptr; #endif m_animGraphModel = nullptr; m_actionManager = nullptr; @@ -214,7 +213,7 @@ namespace EMStudio AnimGraphPlugin::~AnimGraphPlugin() { // destroy the event handler - EMotionFX::GetEventManager().RemoveEventHandler(&mEventHandler); + EMotionFX::GetEventManager().RemoveEventHandler(&m_eventHandler); // unregister the command callbacks and get rid of the memory for (MCore::Command::Callback* callback : m_commandCallbacks) @@ -223,48 +222,48 @@ namespace EMStudio } // remove the dirty file manager callback - GetMainWindow()->GetDirtyFileManager()->RemoveCallback(mDirtyFilesCallback, false); - delete mDirtyFilesCallback; + GetMainWindow()->GetDirtyFileManager()->RemoveCallback(m_dirtyFilesCallback, false); + delete m_dirtyFilesCallback; delete m_animGraphObjectFactory; // delete the graph node factory - delete mGraphNodeFactory; + delete m_graphNodeFactory; // remove the attribute dock widget - if (mParameterDock) + if (m_parameterDock) { - EMStudio::GetMainWindow()->removeDockWidget(mParameterDock); - delete mParameterDock; + EMStudio::GetMainWindow()->removeDockWidget(m_parameterDock); + delete m_parameterDock; } // remove the attribute dock widget - if (mAttributeDock) + if (m_attributeDock) { - EMStudio::GetMainWindow()->removeDockWidget(mAttributeDock); - delete mAttributeDock; + EMStudio::GetMainWindow()->removeDockWidget(m_attributeDock); + delete m_attributeDock; } // remove the node group dock widget - if (mNodeGroupDock) + if (m_nodeGroupDock) { - EMStudio::GetMainWindow()->removeDockWidget(mNodeGroupDock); - delete mNodeGroupDock; + EMStudio::GetMainWindow()->removeDockWidget(m_nodeGroupDock); + delete m_nodeGroupDock; } // remove the blend node palette - if (mNodePaletteDock) + if (m_nodePaletteDock) { - EMStudio::GetMainWindow()->removeDockWidget(mNodePaletteDock); - delete mNodePaletteDock; + EMStudio::GetMainWindow()->removeDockWidget(m_nodePaletteDock); + delete m_nodePaletteDock; } // remove the game controller dock #if AZ_TRAIT_EMOTIONFX_HAS_GAME_CONTROLLER - if (mGameControllerDock) + if (m_gameControllerDock) { - EMStudio::GetMainWindow()->removeDockWidget(mGameControllerDock); - delete mGameControllerDock; + EMStudio::GetMainWindow()->removeDockWidget(m_gameControllerDock); + delete m_gameControllerDock; } #endif if (m_navigationHistory) @@ -322,32 +321,32 @@ namespace EMStudio // During startup, plugins can be constructed more than once, so don't add connections for those items if (GetAttributeDock() != nullptr) { - mDockWindowActions[WINDOWS_PARAMETERWINDOW] = parent->addAction("Parameter Window"); - mDockWindowActions[WINDOWS_PARAMETERWINDOW]->setCheckable(true); - mDockWindowActions[WINDOWS_ATTRIBUTEWINDOW] = parent->addAction("Attribute Window"); - mDockWindowActions[WINDOWS_ATTRIBUTEWINDOW]->setCheckable(true); - mDockWindowActions[WINDOWS_NODEGROUPWINDOW] = parent->addAction("Node Group Window"); - mDockWindowActions[WINDOWS_NODEGROUPWINDOW]->setCheckable(true); - mDockWindowActions[WINDOWS_PALETTEWINDOW] = parent->addAction("Palette Window"); - mDockWindowActions[WINDOWS_PALETTEWINDOW]->setCheckable(true); + m_dockWindowActions[WINDOWS_PARAMETERWINDOW] = parent->addAction("Parameter Window"); + m_dockWindowActions[WINDOWS_PARAMETERWINDOW]->setCheckable(true); + m_dockWindowActions[WINDOWS_ATTRIBUTEWINDOW] = parent->addAction("Attribute Window"); + m_dockWindowActions[WINDOWS_ATTRIBUTEWINDOW]->setCheckable(true); + m_dockWindowActions[WINDOWS_NODEGROUPWINDOW] = parent->addAction("Node Group Window"); + m_dockWindowActions[WINDOWS_NODEGROUPWINDOW]->setCheckable(true); + m_dockWindowActions[WINDOWS_PALETTEWINDOW] = parent->addAction("Palette Window"); + m_dockWindowActions[WINDOWS_PALETTEWINDOW]->setCheckable(true); #if AZ_TRAIT_EMOTIONFX_HAS_GAME_CONTROLLER - mDockWindowActions[WINDOWS_GAMECONTROLLERWINDOW] = parent->addAction("Game Controller Window"); - mDockWindowActions[WINDOWS_GAMECONTROLLERWINDOW]->setCheckable(true); + m_dockWindowActions[WINDOWS_GAMECONTROLLERWINDOW] = parent->addAction("Game Controller Window"); + m_dockWindowActions[WINDOWS_GAMECONTROLLERWINDOW]->setCheckable(true); #endif - connect(mDockWindowActions[WINDOWS_PARAMETERWINDOW], &QAction::triggered, this, [this](bool checked) { + connect(m_dockWindowActions[WINDOWS_PARAMETERWINDOW], &QAction::triggered, this, [this](bool checked) { UpdateWindowVisibility(WINDOWS_PARAMETERWINDOW, checked); }); - connect(mDockWindowActions[WINDOWS_ATTRIBUTEWINDOW], &QAction::triggered, this, [this](bool checked) { + connect(m_dockWindowActions[WINDOWS_ATTRIBUTEWINDOW], &QAction::triggered, this, [this](bool checked) { UpdateWindowVisibility(WINDOWS_ATTRIBUTEWINDOW, checked); }); - connect(mDockWindowActions[WINDOWS_NODEGROUPWINDOW], &QAction::triggered, this, [this](bool checked) { + connect(m_dockWindowActions[WINDOWS_NODEGROUPWINDOW], &QAction::triggered, this, [this](bool checked) { UpdateWindowVisibility(WINDOWS_NODEGROUPWINDOW, checked); }); - connect(mDockWindowActions[WINDOWS_PALETTEWINDOW], &QAction::triggered, this, [this](bool checked) { + connect(m_dockWindowActions[WINDOWS_PALETTEWINDOW], &QAction::triggered, this, [this](bool checked) { UpdateWindowVisibility(WINDOWS_PALETTEWINDOW, checked); }); #if AZ_TRAIT_EMOTIONFX_HAS_GAME_CONTROLLER - connect(mDockWindowActions[WINDOWS_GAMECONTROLLERWINDOW], &QAction::triggered, this, [this](bool checked) { + connect(m_dockWindowActions[WINDOWS_GAMECONTROLLERWINDOW], &QAction::triggered, this, [this](bool checked) { UpdateWindowVisibility(WINDOWS_GAMECONTROLLERWINDOW, checked); }); #endif @@ -427,17 +426,17 @@ namespace EMStudio void AnimGraphPlugin::SetOptionFlag(EDockWindowOptionFlag option, bool isEnabled) { - if (mDockWindowActions[option]) + if (m_dockWindowActions[option]) { - mDockWindowActions[option]->setChecked(isEnabled); + m_dockWindowActions[option]->setChecked(isEnabled); } } void AnimGraphPlugin::SetOptionEnabled(EDockWindowOptionFlag option, bool isEnabled) { - if (mDockWindowActions[option]) + if (m_dockWindowActions[option]) { - mDockWindowActions[option]->setEnabled(isEnabled); + m_dockWindowActions[option]->setEnabled(isEnabled); } } @@ -474,18 +473,18 @@ namespace EMStudio void AnimGraphPlugin::RegisterPerFrameCallback(AnimGraphPerFrameCallback* callback) { - if (AZStd::find(mPerFrameCallbacks.begin(), mPerFrameCallbacks.end(), callback) == mPerFrameCallbacks.end()) + if (AZStd::find(m_perFrameCallbacks.begin(), m_perFrameCallbacks.end(), callback) == m_perFrameCallbacks.end()) { - mPerFrameCallbacks.push_back(callback); + m_perFrameCallbacks.push_back(callback); } } void AnimGraphPlugin::UnregisterPerFrameCallback(AnimGraphPerFrameCallback* callback) { - auto it = AZStd::find(mPerFrameCallbacks.begin(), mPerFrameCallbacks.end(), callback); - if (it != mPerFrameCallbacks.end()) + auto it = AZStd::find(m_perFrameCallbacks.begin(), m_perFrameCallbacks.end(), callback); + if (it != m_perFrameCallbacks.end()) { - mPerFrameCallbacks.erase(it); + m_perFrameCallbacks.erase(it); } } @@ -537,106 +536,102 @@ namespace EMStudio m_animGraphObjectFactory = aznew EMotionFX::AnimGraphObjectFactory(); // create the graph node factory - mGraphNodeFactory = new GraphNodeFactory(); + m_graphNodeFactory = new GraphNodeFactory(); // create the corresponding widget that holds the menu and the toolbar - mViewWidget = new BlendGraphViewWidget(this, mDock); - mDock->setWidget(mViewWidget); - //mDock->setWidget( mGraphWidget ); // old: without menu and toolbar + m_viewWidget = new BlendGraphViewWidget(this, m_dock); + m_dock->setWidget(m_viewWidget); // create the graph widget - mGraphWidget = new BlendGraphWidget(this, mViewWidget); - //mGraphWidget->resize(1000, 700); - //mGraphWidget->move(0,50); - //mGraphWidget->show(); + m_graphWidget = new BlendGraphWidget(this, m_viewWidget); // get the main window QMainWindow* mainWindow = GetMainWindow(); // create the attribute dock window - mAttributeDock = new AzQtComponents::StyledDockWidget("Attributes", mainWindow); - mainWindow->addDockWidget(Qt::RightDockWidgetArea, mAttributeDock); + m_attributeDock = new AzQtComponents::StyledDockWidget("Attributes", mainWindow); + mainWindow->addDockWidget(Qt::RightDockWidgetArea, m_attributeDock); QDockWidget::DockWidgetFeatures features = QDockWidget::NoDockWidgetFeatures; //features |= QDockWidget::DockWidgetClosable; features |= QDockWidget::DockWidgetFloatable; features |= QDockWidget::DockWidgetMovable; - mAttributeDock->setFeatures(features); - mAttributeDock->setObjectName("AnimGraphPlugin::mAttributeDock"); - mAttributesWindow = new AttributesWindow(this); - mAttributeDock->setWidget(mAttributesWindow); + m_attributeDock->setFeatures(features); + m_attributeDock->setObjectName("AnimGraphPlugin::m_attributeDock"); + m_attributesWindow = new AttributesWindow(this); + m_attributeDock->setWidget(m_attributesWindow); // create the node group dock window - mNodeGroupDock = new AzQtComponents::StyledDockWidget("Node Groups", mainWindow); - mainWindow->addDockWidget(Qt::RightDockWidgetArea, mNodeGroupDock); + m_nodeGroupDock = new AzQtComponents::StyledDockWidget("Node Groups", mainWindow); + mainWindow->addDockWidget(Qt::RightDockWidgetArea, m_nodeGroupDock); features = QDockWidget::NoDockWidgetFeatures; //features |= QDockWidget::DockWidgetClosable; features |= QDockWidget::DockWidgetFloatable; features |= QDockWidget::DockWidgetMovable; - mNodeGroupDock->setFeatures(features); - mNodeGroupDock->setObjectName("AnimGraphPlugin::mNodeGroupDock"); - mNodeGroupWindow = new NodeGroupWindow(this); - mNodeGroupDock->setWidget(mNodeGroupWindow); + m_nodeGroupDock->setFeatures(features); + m_nodeGroupDock->setObjectName("AnimGraphPlugin::m_nodeGroupDock"); + m_nodeGroupWindow = new NodeGroupWindow(this); + m_nodeGroupDock->setWidget(m_nodeGroupWindow); // create the node palette dock - mNodePaletteDock = new AzQtComponents::StyledDockWidget("Anim Graph Palette", mainWindow); - mainWindow->addDockWidget(Qt::RightDockWidgetArea, mNodePaletteDock); + m_nodePaletteDock = new AzQtComponents::StyledDockWidget("Anim Graph Palette", mainWindow); + mainWindow->addDockWidget(Qt::RightDockWidgetArea, m_nodePaletteDock); features = QDockWidget::NoDockWidgetFeatures; //features |= QDockWidget::DockWidgetClosable; features |= QDockWidget::DockWidgetFloatable; features |= QDockWidget::DockWidgetMovable; - mNodePaletteDock->setFeatures(features); - mNodePaletteDock->setObjectName("AnimGraphPlugin::mPaletteDock"); - mPaletteWidget = new NodePaletteWidget(this); - mNodePaletteDock->setWidget(mPaletteWidget); + m_nodePaletteDock->setFeatures(features); + m_nodePaletteDock->setObjectName("AnimGraphPlugin::m_paletteDock"); + m_paletteWidget = new NodePaletteWidget(this); + m_nodePaletteDock->setWidget(m_paletteWidget); // create the parameter dock QScrollArea* scrollArea = new QScrollArea(); - mParameterDock = new AzQtComponents::StyledDockWidget("Parameters", mainWindow); - mainWindow->addDockWidget(Qt::RightDockWidgetArea, mParameterDock); + m_parameterDock = new AzQtComponents::StyledDockWidget("Parameters", mainWindow); + mainWindow->addDockWidget(Qt::RightDockWidgetArea, m_parameterDock); features = QDockWidget::NoDockWidgetFeatures; //features |= QDockWidget::DockWidgetClosable; features |= QDockWidget::DockWidgetFloatable; features |= QDockWidget::DockWidgetMovable; - mParameterDock->setFeatures(features); - mParameterDock->setObjectName("AnimGraphPlugin::mParameterDock"); - mParameterWindow = new ParameterWindow(this); - mParameterDock->setWidget(scrollArea); - scrollArea->setWidget(mParameterWindow); + m_parameterDock->setFeatures(features); + m_parameterDock->setObjectName("AnimGraphPlugin::m_parameterDock"); + m_parameterWindow = new ParameterWindow(this); + m_parameterDock->setWidget(scrollArea); + scrollArea->setWidget(m_parameterWindow); scrollArea->setWidgetResizable(true); // Create Navigation Widget (embedded into BlendGraphViewWidget) - mNavigateWidget = new NavigateWidget(this); + m_navigateWidget = new NavigateWidget(this); // init the display flags - mDisplayFlags = 0; + m_displayFlags = 0; // init the view widget // it must be init after navigate widget is created because actions are linked to it - mViewWidget->Init(mGraphWidget); + m_viewWidget->Init(m_graphWidget); #if AZ_TRAIT_EMOTIONFX_HAS_GAME_CONTROLLER // create the game controller dock - mGameControllerDock = new AzQtComponents::StyledDockWidget("Game Controller", mainWindow); - mainWindow->addDockWidget(Qt::RightDockWidgetArea, mGameControllerDock); + m_gameControllerDock = new AzQtComponents::StyledDockWidget("Game Controller", mainWindow); + mainWindow->addDockWidget(Qt::RightDockWidgetArea, m_gameControllerDock); features = QDockWidget::NoDockWidgetFeatures; //features |= QDockWidget::DockWidgetClosable; features |= QDockWidget::DockWidgetFloatable; features |= QDockWidget::DockWidgetMovable; - mGameControllerDock->setFeatures(features); - mGameControllerDock->setObjectName("AnimGraphPlugin::mGameControllerDock"); - mGameControllerWindow = new GameControllerWindow(this); - mGameControllerDock->setWidget(mGameControllerWindow); + m_gameControllerDock->setFeatures(features); + m_gameControllerDock->setObjectName("AnimGraphPlugin::m_gameControllerDock"); + m_gameControllerWindow = new GameControllerWindow(this); + m_gameControllerDock->setWidget(m_gameControllerWindow); #endif // load options LoadOptions(); // initialize the dirty files callback - mDirtyFilesCallback = new SaveDirtyAnimGraphFilesCallback(); - GetMainWindow()->GetDirtyFileManager()->AddCallback(mDirtyFilesCallback); + m_dirtyFilesCallback = new SaveDirtyAnimGraphFilesCallback(); + GetMainWindow()->GetDirtyFileManager()->AddCallback(m_dirtyFilesCallback); // construct the event handler - EMotionFX::GetEventManager().AddEventHandler(&mEventHandler); + EMotionFX::GetEventManager().AddEventHandler(&m_eventHandler); // connect to the timeline recorder data TimeViewPlugin* timeViewPlugin = FindTimeViewPlugin(); @@ -645,7 +640,7 @@ namespace EMStudio connect(timeViewPlugin, &TimeViewPlugin::DoubleClickedRecorderNodeHistoryItem, this, &AnimGraphPlugin::OnDoubleClickedRecorderNodeHistoryItem); connect(timeViewPlugin, &TimeViewPlugin::ClickedRecorderNodeHistoryItem, this, &AnimGraphPlugin::OnClickedRecorderNodeHistoryItem); // detect changes in the recorder - connect(timeViewPlugin, &TimeViewPlugin::RecorderStateChanged, mParameterWindow, &ParameterWindow::OnRecorderStateChanged); + connect(timeViewPlugin, &TimeViewPlugin::RecorderStateChanged, m_parameterWindow, &ParameterWindow::OnRecorderStateChanged); } EMotionFX::AnimGraph* firstSelectedAnimGraph = CommandSystem::GetCommandManager()->GetCurrentSelection().GetFirstAnimGraph(); @@ -658,14 +653,14 @@ namespace EMStudio void AnimGraphPlugin::LoadOptions() { QSettings settings(AZStd::string(GetManager()->GetAppDataFolder() + "EMStudioRenderOptions.cfg").c_str(), QSettings::IniFormat, this); - mOptions = AnimGraphOptions::Load(&settings); + m_options = AnimGraphOptions::Load(&settings); } // save the options void AnimGraphPlugin::SaveOptions() { QSettings settings(AZStd::string(GetManager()->GetAppDataFolder() + "EMStudioRenderOptions.cfg").c_str(), QSettings::IniFormat, this); - mOptions.Save(&settings); + m_options.Save(&settings); } @@ -673,9 +668,9 @@ namespace EMStudio void AnimGraphPlugin::OnAfterLoadLayout() { // fit graph on screen - if (mGraphWidget->GetActiveGraph()) + if (m_graphWidget->GetActiveGraph()) { - mGraphWidget->GetActiveGraph()->FitGraphOnScreen(mGraphWidget->geometry().width(), mGraphWidget->geometry().height(), mGraphWidget->GetMousePos(), false); + m_graphWidget->GetActiveGraph()->FitGraphOnScreen(m_graphWidget->geometry().width(), m_graphWidget->geometry().height(), m_graphWidget->GetMousePos(), false); } // connect to the timeline recorder data @@ -700,13 +695,13 @@ namespace EMStudio void AnimGraphPlugin::InitForAnimGraph(EMotionFX::AnimGraph* setup) { AZ_UNUSED(setup); - mAttributesWindow->Unlock(); - mAttributesWindow->Init(QModelIndex(), true); // Force update - mParameterWindow->Reinit(); - mNodeGroupWindow->Init(); - mViewWidget->UpdateAnimGraphOptions(); + m_attributesWindow->Unlock(); + m_attributesWindow->Init(QModelIndex(), true); // Force update + m_parameterWindow->Reinit(); + m_nodeGroupWindow->Init(); + m_viewWidget->UpdateAnimGraphOptions(); #if AZ_TRAIT_EMOTIONFX_HAS_GAME_CONTROLLER - mGameControllerWindow->ReInit(); + m_gameControllerWindow->ReInit(); #endif } @@ -715,13 +710,13 @@ namespace EMStudio AnimGraphEventHandler::AnimGraphEventHandler(AnimGraphPlugin* plugin) : EMotionFX::EventHandler() { - mPlugin = plugin; + m_plugin = plugin; } bool AnimGraphEventHandler::OnRayIntersectionTest(const AZ::Vector3& start, const AZ::Vector3& end, EMotionFX::IntersectionInfo* outIntersectInfo) { - outIntersectInfo->mIsValid = true; + outIntersectInfo->m_isValid = true; AZ::Vector3 pos; AZ::Vector3 normal; @@ -745,7 +740,7 @@ namespace EMStudio continue; } - if (actorInstance == outIntersectInfo->mIgnoreActorInstance) + if (actorInstance == outIntersectInfo->m_ignoreActorInstance) { continue; } @@ -757,11 +752,11 @@ namespace EMStudio if (first) { - outIntersectInfo->mPosition = pos; - outIntersectInfo->mNormal = normal; - outIntersectInfo->mUV = uv; - outIntersectInfo->mBaryCentricU = baryU; - outIntersectInfo->mBaryCentricV = baryU; + outIntersectInfo->m_position = pos; + outIntersectInfo->m_normal = normal; + outIntersectInfo->m_uv = uv; + outIntersectInfo->m_baryCentricU = baryU; + outIntersectInfo->m_baryCentricV = baryU; closestDist = MCore::SafeLength(start - pos); } else @@ -769,11 +764,11 @@ namespace EMStudio float dist = MCore::SafeLength(start - pos); if (dist < closestDist) { - outIntersectInfo->mPosition = pos; - outIntersectInfo->mNormal = normal; - outIntersectInfo->mUV = uv; - outIntersectInfo->mBaryCentricU = baryU; - outIntersectInfo->mBaryCentricV = baryU; + outIntersectInfo->m_position = pos; + outIntersectInfo->m_normal = normal; + outIntersectInfo->m_uv = uv; + outIntersectInfo->m_baryCentricU = baryU; + outIntersectInfo->m_baryCentricV = baryU; closestDist = MCore::SafeLength(start - pos); closestDist = dist; } @@ -1008,24 +1003,24 @@ namespace EMStudio void AnimGraphEventHandler::OnDeleteAnimGraph(EMotionFX::AnimGraph* animGraph) { - if (mPlugin->GetActiveAnimGraph() == animGraph) + if (m_plugin->GetActiveAnimGraph() == animGraph) { - mPlugin->SetActiveAnimGraph(nullptr); + m_plugin->SetActiveAnimGraph(nullptr); } } void AnimGraphEventHandler::OnDeleteAnimGraphInstance(EMotionFX::AnimGraphInstance* animGraphInstance) { - mPlugin->GetAnimGraphModel().SetAnimGraphInstance(animGraphInstance->GetAnimGraph(), animGraphInstance, nullptr); + m_plugin->GetAnimGraphModel().SetAnimGraphInstance(animGraphInstance->GetAnimGraph(), animGraphInstance, nullptr); } // activate a given anim graph void AnimGraphPlugin::SetActiveAnimGraph(EMotionFX::AnimGraph* animGraph) { - if (mActiveAnimGraph != animGraph) + if (m_activeAnimGraph != animGraph) { - mActiveAnimGraph = animGraph; + m_activeAnimGraph = animGraph; InitForAnimGraph(animGraph); // Focus on the newly actived anim graph if it has already been added to the anim graph model. @@ -1108,7 +1103,7 @@ namespace EMStudio void AnimGraphPlugin::SaveAnimGraphAs(EMotionFX::AnimGraph* animGraph, MCore::CommandGroup* commandGroup) { - const AZStd::string filename = GetMainWindow()->GetFileManager()->SaveAnimGraphFileDialog(mViewWidget); + const AZStd::string filename = GetMainWindow()->GetFileManager()->SaveAnimGraphFileDialog(m_viewWidget); if (filename.empty()) { return; @@ -1127,7 +1122,7 @@ namespace EMStudio (sourceAnimGraph || cacheAnimGraph) && (sourceAnimGraph != focusedAnimGraph && cacheAnimGraph != focusedAnimGraph)) { - QMessageBox::warning(mDock, "Cannot overwrite anim graph", "Anim graph is already opened and cannot be overwritten.", QMessageBox::Ok); + QMessageBox::warning(m_dock, "Cannot overwrite anim graph", "Anim graph is already opened and cannot be overwritten.", QMessageBox::Ok); return; } @@ -1144,7 +1139,7 @@ namespace EMStudio void AnimGraphPlugin::OnFileOpen() { - AZStd::string filename = GetMainWindow()->GetFileManager()->LoadAnimGraphFileDialog(mViewWidget); + AZStd::string filename = GetMainWindow()->GetFileManager()->LoadAnimGraphFileDialog(m_viewWidget); GetMainWindow()->activateWindow(); if (filename.empty()) { @@ -1269,39 +1264,39 @@ namespace EMStudio // timer event void AnimGraphPlugin::ProcessFrame(float timePassedInSeconds) { - if (GetManager()->GetAvoidRendering() || !mGraphWidget || mGraphWidget->visibleRegion().isEmpty()) + if (GetManager()->GetAvoidRendering() || !m_graphWidget || m_graphWidget->visibleRegion().isEmpty()) { return; } - mTotalTime += timePassedInSeconds; + m_totalTime += timePassedInSeconds; - for (AnimGraphPerFrameCallback* callback : mPerFrameCallbacks) + for (AnimGraphPerFrameCallback* callback : m_perFrameCallbacks) { callback->ProcessFrame(timePassedInSeconds); } bool redraw = false; #ifdef MCORE_DEBUG - if (mTotalTime > 1.0f / 30.0f) + if (m_totalTime > 1.0f / 30.0f) #else - if (mTotalTime > 1.0f / 60.0f) + if (m_totalTime > 1.0f / 60.0f) #endif { redraw = true; - mTotalTime = 0.0f; + m_totalTime = 0.0f; } if (EMotionFX::GetRecorder().GetIsInPlayMode()) { - if (MCore::Compare::CheckIfIsClose(EMotionFX::GetRecorder().GetCurrentPlayTime(), mLastPlayTime, 0.001f) == false) + if (MCore::Compare::CheckIfIsClose(EMotionFX::GetRecorder().GetCurrentPlayTime(), m_lastPlayTime, 0.001f) == false) { - mParameterWindow->UpdateParameterValues(); - mLastPlayTime = EMotionFX::GetRecorder().GetCurrentPlayTime(); + m_parameterWindow->UpdateParameterValues(); + m_lastPlayTime = EMotionFX::GetRecorder().GetCurrentPlayTime(); } } - mGraphWidget->ProcessFrame(redraw); + m_graphWidget->ProcessFrame(redraw); } @@ -1392,17 +1387,17 @@ namespace EMStudio MCORE_UNUSED(actorInstanceData); // try to locate the node based on its unique ID - EMotionFX::AnimGraph* animGraph = EMotionFX::GetAnimGraphManager().FindAnimGraphByID(historyItem->mAnimGraphID); + EMotionFX::AnimGraph* animGraph = EMotionFX::GetAnimGraphManager().FindAnimGraphByID(historyItem->m_animGraphId); if (animGraph == nullptr) { - QMessageBox::warning(mDock, "Cannot Find Anim Graph", "The anim graph used by this node cannot be located anymore, did you delete it?", QMessageBox::Ok); + QMessageBox::warning(m_dock, "Cannot Find Anim Graph", "The anim graph used by this node cannot be located anymore, did you delete it?", QMessageBox::Ok); return; } - EMotionFX::AnimGraphNode* foundNode = animGraph->RecursiveFindNodeById(historyItem->mNodeId); + EMotionFX::AnimGraphNode* foundNode = animGraph->RecursiveFindNodeById(historyItem->m_nodeId); if (foundNode == nullptr) { - QMessageBox::warning(mDock, "Cannot Find Node", "The anim graph node cannot be found. Did you perhaps delete the node or change animgraph?", QMessageBox::Ok); + QMessageBox::warning(m_dock, "Cannot Find Node", "The anim graph node cannot be found. Did you perhaps delete the node or change animgraph?", QMessageBox::Ok); return; } @@ -1422,24 +1417,24 @@ namespace EMStudio MCORE_UNUSED(actorInstanceData); // try to locate the node based on its unique ID - EMotionFX::AnimGraph* animGraph = EMotionFX::GetAnimGraphManager().FindAnimGraphByID(historyItem->mAnimGraphID); + EMotionFX::AnimGraph* animGraph = EMotionFX::GetAnimGraphManager().FindAnimGraphByID(historyItem->m_animGraphId); if (animGraph == nullptr) { - QMessageBox::warning(mDock, "Cannot Find Anim Graph", "The anim graph used by this node cannot be located anymore, did you delete it?", QMessageBox::Ok); + QMessageBox::warning(m_dock, "Cannot Find Anim Graph", "The anim graph used by this node cannot be located anymore, did you delete it?", QMessageBox::Ok); return; } - EMotionFX::AnimGraphNode* foundNode = animGraph->RecursiveFindNodeById(historyItem->mNodeId); + EMotionFX::AnimGraphNode* foundNode = animGraph->RecursiveFindNodeById(historyItem->m_nodeId); if (foundNode == nullptr) { - QMessageBox::warning(mDock, "Cannot Find Node", "The anim graph node cannot be found. Did you perhaps delete the node or change animgraph?", QMessageBox::Ok); + QMessageBox::warning(m_dock, "Cannot Find Node", "The anim graph node cannot be found. Did you perhaps delete the node or change animgraph?", QMessageBox::Ok); return; } EMotionFX::AnimGraphNode* nodeToShow = foundNode->GetParentNode(); if (nodeToShow) { - const QModelIndex foundNodeIndex = m_animGraphModel->FindModelIndex(nodeToShow, historyItem->mAnimGraphInstance); + const QModelIndex foundNodeIndex = m_animGraphModel->FindModelIndex(nodeToShow, historyItem->m_animGraphInstance); if (foundNodeIndex.isValid()) { m_animGraphModel->Focus(foundNodeIndex); diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/AnimGraphPlugin.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/AnimGraphPlugin.h index af6fcde3d6..3510920d2c 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/AnimGraphPlugin.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/AnimGraphPlugin.h @@ -84,7 +84,7 @@ namespace EMStudio void OnDeleteAnimGraphInstance(EMotionFX::AnimGraphInstance* animGraphInstance) override; private: - AnimGraphPlugin* mPlugin; + AnimGraphPlugin* m_plugin; }; class AnimGraphPerFrameCallback @@ -133,7 +133,7 @@ namespace EMStudio void AddWindowMenuEntries(QMenu* parent) override; void SetActiveAnimGraph(EMotionFX::AnimGraph* animGraph); - EMotionFX::AnimGraph* GetActiveAnimGraph() { return mActiveAnimGraph; } + EMotionFX::AnimGraph* GetActiveAnimGraph() { return m_activeAnimGraph; } void SaveAnimGraph(const char* filename, size_t animGraphIndex, MCore::CommandGroup* commandGroup = nullptr); void SaveAnimGraph(EMotionFX::AnimGraph* animGraph, MCore::CommandGroup* commandGroup = nullptr); @@ -141,7 +141,7 @@ namespace EMStudio int SaveDirtyAnimGraph(EMotionFX::AnimGraph* animGraph, MCore::CommandGroup* commandGroup, bool askBeforeSaving, bool showCancelButton = true); int OnSaveDirtyAnimGraphs(); - PluginOptions* GetOptions() override { return &mOptions; } + PluginOptions* GetOptions() override { return &m_options; } void LoadOptions(); void SaveOptions(); @@ -193,41 +193,41 @@ namespace EMStudio void OnClickedRecorderNodeHistoryItem(EMotionFX::Recorder::ActorInstanceData* actorInstanceData, EMotionFX::Recorder::NodeHistoryItem* historyItem); public: - BlendGraphWidget* GetGraphWidget() { return mGraphWidget; } - NavigateWidget* GetNavigateWidget() { return mNavigateWidget; } - NodePaletteWidget* GetPaletteWidget() { return mPaletteWidget; } - AttributesWindow* GetAttributesWindow() { return mAttributesWindow; } - ParameterWindow* GetParameterWindow() { return mParameterWindow; } - NodeGroupWindow* GetNodeGroupWidget() { return mNodeGroupWindow; } - BlendGraphViewWidget* GetViewWidget() { return mViewWidget; } + BlendGraphWidget* GetGraphWidget() { return m_graphWidget; } + NavigateWidget* GetNavigateWidget() { return m_navigateWidget; } + NodePaletteWidget* GetPaletteWidget() { return m_paletteWidget; } + AttributesWindow* GetAttributesWindow() { return m_attributesWindow; } + ParameterWindow* GetParameterWindow() { return m_parameterWindow; } + NodeGroupWindow* GetNodeGroupWidget() { return m_nodeGroupWindow; } + BlendGraphViewWidget* GetViewWidget() { return m_viewWidget; } NavigationHistory* GetNavigationHistory() const { return m_navigationHistory; } - QDockWidget* GetAttributeDock() { return mAttributeDock; } - QDockWidget* GetNodePaletteDock() { return mNodePaletteDock; } - QDockWidget* GetParameterDock() { return mParameterDock; } - QDockWidget* GetNodeGroupDock() { return mNodeGroupDock; } + QDockWidget* GetAttributeDock() { return m_attributeDock; } + QDockWidget* GetNodePaletteDock() { return m_nodePaletteDock; } + QDockWidget* GetParameterDock() { return m_parameterDock; } + QDockWidget* GetNodeGroupDock() { return m_nodeGroupDock; } #if AZ_TRAIT_EMOTIONFX_HAS_GAME_CONTROLLER - GameControllerWindow* GetGameControllerWindow() { return mGameControllerWindow; } - QDockWidget* GetGameControllerDock() { return mGameControllerDock; } + GameControllerWindow* GetGameControllerWindow() { return m_gameControllerWindow; } + QDockWidget* GetGameControllerDock() { return m_gameControllerDock; } #endif void SetDisplayFlagEnabled(uint32 flags, bool enabled) { if (enabled) { - mDisplayFlags |= flags; + m_displayFlags |= flags; } else { - mDisplayFlags &= ~flags; + m_displayFlags &= ~flags; } } - bool GetIsDisplayFlagEnabled(uint32 flags) const { return (mDisplayFlags & flags); } - uint32 GetDisplayFlags() const { return mDisplayFlags; } + bool GetIsDisplayFlagEnabled(uint32 flags) const { return (m_displayFlags & flags); } + uint32 GetDisplayFlags() const { return m_displayFlags; } const EMotionFX::AnimGraphObjectFactory* GetAnimGraphObjectFactory() const { return m_animGraphObjectFactory; } - GraphNodeFactory* GetGraphNodeFactory() { return mGraphNodeFactory; } + GraphNodeFactory* GetGraphNodeFactory() { return m_graphNodeFactory; } // overloaded main init function void Reflect(AZ::ReflectContext* serializeContext) override; @@ -235,10 +235,10 @@ namespace EMStudio void OnAfterLoadLayout() override; EMStudioPlugin* Clone() override; - const AnimGraphOptions& GetAnimGraphOptions() const { return mOptions; } + const AnimGraphOptions& GetAnimGraphOptions() const { return m_options; } - void SetDisableRendering(bool flag) { mDisableRendering = flag; } - bool GetDisableRendering() const { return mDisableRendering; } + void SetDisableRendering(bool flag) { m_disableRendering = flag; } + bool GetDisableRendering() const { return m_disableRendering; } void SetActionFilter(const AnimGraphActionFilter& actionFilter); const AnimGraphActionFilter& GetActionFilter() const; @@ -264,44 +264,44 @@ namespace EMStudio MCORE_DEFINECOMMANDCALLBACK(CommandPlayMotionCallback); AZStd::vector m_commandCallbacks; - AZStd::vector mPerFrameCallbacks; + AZStd::vector m_perFrameCallbacks; - bool mDisableRendering; + bool m_disableRendering; - AnimGraphEventHandler mEventHandler; + AnimGraphEventHandler m_eventHandler; - BlendGraphWidget* mGraphWidget; - NavigateWidget* mNavigateWidget; - NodePaletteWidget* mPaletteWidget; - AttributesWindow* mAttributesWindow; - ParameterWindow* mParameterWindow; - NodeGroupWindow* mNodeGroupWindow; - BlendGraphViewWidget* mViewWidget; + BlendGraphWidget* m_graphWidget; + NavigateWidget* m_navigateWidget; + NodePaletteWidget* m_paletteWidget; + AttributesWindow* m_attributesWindow; + ParameterWindow* m_parameterWindow; + NodeGroupWindow* m_nodeGroupWindow; + BlendGraphViewWidget* m_viewWidget; NavigationHistory* m_navigationHistory; - SaveDirtyAnimGraphFilesCallback* mDirtyFilesCallback; + SaveDirtyAnimGraphFilesCallback* m_dirtyFilesCallback; - QDockWidget* mAttributeDock; - QDockWidget* mNodePaletteDock; - QDockWidget* mParameterDock; - QDockWidget* mNodeGroupDock; - QAction* mDockWindowActions[NUM_DOCKWINDOW_OPTIONS]; - EMotionFX::AnimGraph* mActiveAnimGraph; + QDockWidget* m_attributeDock; + QDockWidget* m_nodePaletteDock; + QDockWidget* m_parameterDock; + QDockWidget* m_nodeGroupDock; + QAction* m_dockWindowActions[NUM_DOCKWINDOW_OPTIONS]; + EMotionFX::AnimGraph* m_activeAnimGraph; #if AZ_TRAIT_EMOTIONFX_HAS_GAME_CONTROLLER - GameControllerWindow* mGameControllerWindow; - QPointer mGameControllerDock; + GameControllerWindow* m_gameControllerWindow; + QPointer m_gameControllerDock; #endif - float mLastPlayTime; - float mTotalTime; + float m_lastPlayTime; + float m_totalTime; - uint32 mDisplayFlags; + uint32 m_displayFlags; - AnimGraphOptions mOptions; + AnimGraphOptions m_options; EMotionFX::AnimGraphObjectFactory* m_animGraphObjectFactory; - GraphNodeFactory* mGraphNodeFactory; + GraphNodeFactory* m_graphNodeFactory; // Model used for the MVC pattern AnimGraphModel* m_animGraphModel; @@ -311,7 +311,7 @@ namespace EMStudio AnimGraphActionFilter m_actionFilter; void InitForAnimGraph(EMotionFX::AnimGraph* setup); - bool GetOptionFlag(EDockWindowOptionFlag option) { return mDockWindowActions[(uint32)option]->isChecked(); } + bool GetOptionFlag(EDockWindowOptionFlag option) { return m_dockWindowActions[(uint32)option]->isChecked(); } void SetOptionFlag(EDockWindowOptionFlag option, bool isEnabled); void SetOptionEnabled(EDockWindowOptionFlag option, bool isEnabled); diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/AnimGraphVisualNode.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/AnimGraphVisualNode.cpp index 91f5e00dd0..8af57e6dee 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/AnimGraphVisualNode.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/AnimGraphVisualNode.cpp @@ -23,10 +23,10 @@ namespace EMStudio AnimGraphVisualNode::AnimGraphVisualNode(const QModelIndex& modelIndex, AnimGraphPlugin* plugin, EMotionFX::AnimGraphNode* node) : GraphNode(modelIndex, node->GetName(), 0, 0) { - mEMFXNode = node; - mCanHaveChildren = node->GetCanHaveChildren(); - mHasVisualGraph = node->GetHasVisualGraph(); - mPlugin = plugin; + m_emfxNode = node; + m_canHaveChildren = node->GetCanHaveChildren(); + m_hasVisualGraph = node->GetHasVisualGraph(); + m_plugin = plugin; SetSubTitle(node->GetPaletteName(), false); } @@ -45,24 +45,24 @@ namespace EMStudio void AnimGraphVisualNode::Sync() { - SetName(mEMFXNode->GetName()); - SetNodeInfo(mEMFXNode->GetNodeInfo()); + SetName(m_emfxNode->GetName()); + SetNodeInfo(m_emfxNode->GetNodeInfo()); - SetDeletable(mEMFXNode->GetIsDeletable()); - SetBaseColor(AzColorToQColor(mEMFXNode->GetVisualColor())); - SetHasChildIndicatorColor(AzColorToQColor(mEMFXNode->GetHasChildIndicatorColor())); - SetIsCollapsed(mEMFXNode->GetIsCollapsed()); + SetDeletable(m_emfxNode->GetIsDeletable()); + SetBaseColor(AzColorToQColor(m_emfxNode->GetVisualColor())); + SetHasChildIndicatorColor(AzColorToQColor(m_emfxNode->GetHasChildIndicatorColor())); + SetIsCollapsed(m_emfxNode->GetIsCollapsed()); // Update position UpdateRects(); - MoveAbsolute(QPoint(mEMFXNode->GetVisualPosX(), mEMFXNode->GetVisualPosY())); + MoveAbsolute(QPoint(m_emfxNode->GetVisualPosX(), m_emfxNode->GetVisualPosY())); - SetIsVisualized(mEMFXNode->GetIsVisualizationEnabled()); - SetCanVisualize(mEMFXNode->GetSupportsVisualization()); - SetIsEnabled(mEMFXNode->GetIsEnabled()); - SetVisualizeColor(AzColorToQColor(mEMFXNode->GetVisualizeColor())); - SetHasVisualOutputPorts(mEMFXNode->GetHasVisualOutputPorts()); - mHasVisualGraph = mEMFXNode->GetHasVisualGraph(); + SetIsVisualized(m_emfxNode->GetIsVisualizationEnabled()); + SetCanVisualize(m_emfxNode->GetSupportsVisualization()); + SetIsEnabled(m_emfxNode->GetIsEnabled()); + SetVisualizeColor(AzColorToQColor(m_emfxNode->GetVisualizeColor())); + SetHasVisualOutputPorts(m_emfxNode->GetHasVisualOutputPorts()); + m_hasVisualGraph = m_emfxNode->GetHasVisualGraph(); UpdateTextPixmap(); } @@ -72,30 +72,6 @@ namespace EMStudio void AnimGraphVisualNode::RenderDebugInfo(QPainter& painter) { MCORE_UNUSED(painter); - /* // get the selected actor instance - EMotionFX::ActorInstance* actorInstance = EMotionFX::GetCommandManager()->GetCurrentSelection().GetSingleActorInstance(); - if (actorInstance == nullptr) - return; - - // get the anim graph instance - EMotionFX::AnimGraphInstance* animGraphInstance = actorInstance->GetAnimGraphInstance(); - if (animGraphInstance == nullptr) - return; - - QRect rect( mRect.left(), mRect.bottom(), mRect.width(), 10 ); - - // draw header text - QTextOption textOptions; - textOptions.setAlignment( Qt::AlignCenter|Qt::AlignTop ); - painter.setPen( QColor(0,255,0) ); - - QString s; - //s.sprintf("%.3f %.3f", mEMFXNode->FindUniqueData(animGraphInstance)->GetInternalPlaySpeed(), mEMFXNode->FindUniqueData(animGraphInstance)->GetPlaySpeed()); - //painter.drawText( rect, s, textOptions ); - - //rect.translate(0, 12); - s.sprintf("%.3f %.3f", mEMFXNode->FindUniqueData(animGraphInstance)->GetGlobalWeight(), mEMFXNode->FindUniqueData(animGraphInstance)->GetLocalWeight()); - painter.drawText( rect, s, textOptions );*/ } @@ -103,7 +79,7 @@ namespace EMStudio void AnimGraphVisualNode::RenderTracks(QPainter& painter, const QColor bgColor, const QColor bgColor2, int32 heightOffset) { // get the sync track - QRect rect(mRect.left() + 5, mRect.bottom() - 13 + heightOffset, mRect.width() - 10, 8); + QRect rect(m_rect.left() + 5, m_rect.bottom() - 13 + heightOffset, m_rect.width() - 10, 8); painter.setPen(bgColor.darker(185)); painter.setBrush(bgColor2); @@ -116,7 +92,7 @@ namespace EMStudio return; } - const float duration = mEMFXNode->GetDuration(animGraphInstance); + const float duration = m_emfxNode->GetDuration(animGraphInstance); if (duration < MCore::Math::epsilon) { return; @@ -124,7 +100,7 @@ namespace EMStudio // draw the background rect QRect playRect = rect; - int32 x = aznumeric_cast(rect.left() + 1 + (rect.width() - 2) * (mEMFXNode->GetCurrentPlayTime(animGraphInstance) / duration)); + int32 x = aznumeric_cast(rect.left() + 1 + (rect.width() - 2) * (m_emfxNode->GetCurrentPlayTime(animGraphInstance) / duration)); playRect.setRight(x); playRect.setLeft(rect.left() + 1); playRect.setTop(rect.top() + 1); @@ -134,7 +110,7 @@ namespace EMStudio painter.drawRect(playRect); // draw the sync keys - const EMotionFX::AnimGraphNodeData* uniqueData = mEMFXNode->FindOrCreateUniqueNodeData(animGraphInstance); + const EMotionFX::AnimGraphNodeData* uniqueData = m_emfxNode->FindOrCreateUniqueNodeData(animGraphInstance); const EMotionFX::AnimGraphSyncTrack* syncTrack = uniqueData->GetSyncTrack(); const size_t numSyncPoints = syncTrack ? syncTrack->GetNumEvents() : 0; @@ -169,7 +145,7 @@ namespace EMStudio // draw the current play time painter.setPen(Qt::yellow); - x = aznumeric_cast(rect.left() + 1 + (rect.width() - 2) * (mEMFXNode->GetCurrentPlayTime(animGraphInstance) / duration)); + x = aznumeric_cast(rect.left() + 1 + (rect.width() - 2) * (m_emfxNode->GetCurrentPlayTime(animGraphInstance) / duration)); painter.drawLine(x, rect.top() + 1, x, rect.bottom()); } @@ -187,7 +163,7 @@ namespace EMStudio // extract anim graph instance EMotionFX::AnimGraphInstance* animGraphInstance = ExtractAnimGraphInstance(); - return (animGraphInstance == nullptr) || (animGraphInstance->GetIsOutputReady(mEMFXNode->GetParentNode()->GetObjectIndex()) == false); + return (animGraphInstance == nullptr) || (animGraphInstance->GetIsOutputReady(m_emfxNode->GetParentNode()->GetObjectIndex()) == false); } @@ -202,7 +178,7 @@ namespace EMStudio } // return the error state of the emfx node - EMotionFX::AnimGraphObjectData* uniqueData = mEMFXNode->FindOrCreateUniqueNodeData(animGraphInstance); - return mEMFXNode->HierarchicalHasError(uniqueData); + EMotionFX::AnimGraphObjectData* uniqueData = m_emfxNode->FindOrCreateUniqueNodeData(animGraphInstance); + return m_emfxNode->HierarchicalHasError(uniqueData); } } // namespace EMStudio diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/AnimGraphVisualNode.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/AnimGraphVisualNode.h index 7243d182bc..c25027ef91 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/AnimGraphVisualNode.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/AnimGraphVisualNode.h @@ -34,9 +34,9 @@ namespace EMStudio void Sync() override; - MCORE_INLINE void SetEMFXNode(EMotionFX::AnimGraphNode* emfxNode) { mEMFXNode = emfxNode; } - MCORE_INLINE EMotionFX::AnimGraphNode* GetEMFXNode() { return mEMFXNode; } - MCORE_INLINE AnimGraphPlugin* GetAnimGraphPlugin() const { return mPlugin; } + MCORE_INLINE void SetEMFXNode(EMotionFX::AnimGraphNode* emfxNode) { m_emfxNode = emfxNode; } + MCORE_INLINE EMotionFX::AnimGraphNode* GetEMFXNode() { return m_emfxNode; } + MCORE_INLINE AnimGraphPlugin* GetAnimGraphPlugin() const { return m_plugin; } EMotionFX::AnimGraphInstance* ExtractAnimGraphInstance() const; void RenderTracks(QPainter& painter, const QColor bgColor, const QColor bgColor2, int32 heightOffset = 0); @@ -48,8 +48,8 @@ namespace EMStudio protected: QColor AzColorToQColor(const AZ::Color& col) const; - EMotionFX::AnimGraphNode* mEMFXNode; - EMotionFX::AnimGraphPose mPose; - AnimGraphPlugin* mPlugin; + EMotionFX::AnimGraphNode* m_emfxNode; + EMotionFX::AnimGraphPose m_pose; + AnimGraphPlugin* m_plugin; }; } // namespace EMStudio diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/AttributesWindow.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/AttributesWindow.cpp index 3eb9447eb9..f3d629f300 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/AttributesWindow.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/AttributesWindow.cpp @@ -41,17 +41,17 @@ namespace EMStudio AttributesWindow::AttributesWindow(AnimGraphPlugin* plugin, QWidget* parent) : QWidget(parent) { - mPlugin = plugin; - mPasteConditionsWindow = nullptr; - mScrollArea = new QScrollArea(); + m_plugin = plugin; + m_pasteConditionsWindow = nullptr; + m_scrollArea = new QScrollArea(); QVBoxLayout* mainLayout = new QVBoxLayout(); mainLayout->setMargin(0); mainLayout->setSpacing(1); setLayout(mainLayout); - mainLayout->addWidget(mScrollArea); - mScrollArea->setWidgetResizable(true); + mainLayout->addWidget(m_scrollArea); + m_scrollArea->setWidgetResizable(true); // The main reflected widget will contain the non-custom attribute version of the // attribute widget. The intention is to reuse the Reflected Property Editor and @@ -111,7 +111,7 @@ namespace EMStudio m_conditionsLayout->setSizeConstraint(QLayout::SetMinAndMaxSize); conditionsVerticalLayout->addLayout(m_conditionsLayout); - m_addConditionButton = new AddConditionButton(mPlugin, m_conditionsWidget); + m_addConditionButton = new AddConditionButton(m_plugin, m_conditionsWidget); m_addConditionButton->setObjectName("EMFX.AttributesWindowWidget.NodeTransition.AddConditionsWidget"); connect(m_addConditionButton, &AddConditionButton::ObjectTypeChosen, this, [=](AZ::TypeId conditionType) { @@ -137,7 +137,7 @@ namespace EMStudio m_actionsLayout->setSizeConstraint(QLayout::SetMinAndMaxSize); actionVerticalLayout->addLayout(m_actionsLayout); - AddActionButton* addActionButton = new AddActionButton(mPlugin, m_actionsWidget); + AddActionButton* addActionButton = new AddActionButton(m_plugin, m_actionsWidget); connect(addActionButton, &AddActionButton::ObjectTypeChosen, this, [=](AZ::TypeId actionType) { const AnimGraphModel::ModelItemType itemType = m_displayingModelIndex.data(AnimGraphModel::ROLE_MODEL_ITEM_TYPE).value(); @@ -171,9 +171,9 @@ namespace EMStudio if (m_mainReflectedWidget) { - if (mScrollArea->widget() == m_mainReflectedWidget) + if (m_scrollArea->widget() == m_mainReflectedWidget) { - mScrollArea->takeWidget(); + m_scrollArea->takeWidget(); } delete m_mainReflectedWidget; } @@ -216,15 +216,15 @@ namespace EMStudio EMotionFX::AnimGraphObject* object = modelIndex.data(AnimGraphModel::ROLE_ANIM_GRAPH_OBJECT_PTR).value(); - QWidget* attributeWidget = mPlugin->GetGraphNodeFactory()->CreateAttributeWidget(azrtti_typeid(object)); + QWidget* attributeWidget = m_plugin->GetGraphNodeFactory()->CreateAttributeWidget(azrtti_typeid(object)); if (attributeWidget) { // In the case we have a custom attribute widget, we cannot reuse the widget, so we just replace it - if (mScrollArea->widget() == m_mainReflectedWidget) + if (m_scrollArea->widget() == m_mainReflectedWidget) { - mScrollArea->takeWidget(); + m_scrollArea->takeWidget(); } - mScrollArea->setWidget(attributeWidget); + m_scrollArea->setWidget(attributeWidget); } else { @@ -235,7 +235,7 @@ namespace EMStudio } else { - animGraph = mPlugin->GetActiveAnimGraph(); + animGraph = m_plugin->GetActiveAnimGraph(); } m_animGraphEditor->SetAnimGraph(animGraph); @@ -270,9 +270,9 @@ namespace EMStudio m_objectCard->setVisible(object); - if (mScrollArea->widget() != m_mainReflectedWidget) + if (m_scrollArea->widget() != m_mainReflectedWidget) { - mScrollArea->setWidget(m_mainReflectedWidget); + m_scrollArea->setWidget(m_mainReflectedWidget); } } @@ -472,7 +472,7 @@ namespace EMStudio void AttributesWindow::AddTransitionCopyPasteMenuEntries(QMenu* menu) { - const NodeGraph* activeGraph = mPlugin->GetGraphWidget()->GetActiveGraph(); + const NodeGraph* activeGraph = m_plugin->GetGraphWidget()->GetActiveGraph(); if (!activeGraph) { return; @@ -533,7 +533,7 @@ namespace EMStudio AZ_UNUSED(selected); AZ_UNUSED(deselected); - const QModelIndexList modelIndexes = mPlugin->GetAnimGraphModel().GetSelectionModel().selectedRows(); + const QModelIndexList modelIndexes = m_plugin->GetAnimGraphModel().GetSelectionModel().selectedRows(); if (!modelIndexes.empty()) { Init(modelIndexes.front()); @@ -729,9 +729,9 @@ namespace EMStudio if (contents.IsSuccess()) { CopyPasteConditionObject copyPasteObject; - copyPasteObject.mContents = contents.GetValue(); - copyPasteObject.mConditionType = azrtti_typeid(condition); - condition->GetSummary(©PasteObject.mSummary); + copyPasteObject.m_contents = contents.GetValue(); + copyPasteObject.m_conditionType = azrtti_typeid(condition); + condition->GetSummary(©PasteObject.m_summary); m_copyPasteClipboard.m_conditions.push_back(copyPasteObject); } } @@ -776,9 +776,9 @@ namespace EMStudio CommandSystem::CommandAddTransitionCondition* addConditionCommand = aznew CommandSystem::CommandAddTransitionCondition( transition->GetAnimGraph()->GetID(), transition->GetId(), - copyPasteObject.mConditionType, + copyPasteObject.m_conditionType, /*insertAt=*/AZStd::nullopt, - copyPasteObject.mContents); + copyPasteObject.m_contents); commandGroup.AddCommand(addConditionCommand); } } @@ -804,14 +804,14 @@ namespace EMStudio return; } - delete mPasteConditionsWindow; - mPasteConditionsWindow = nullptr; + delete m_pasteConditionsWindow; + m_pasteConditionsWindow = nullptr; EMotionFX::AnimGraphStateTransition* transition = m_displayingModelIndex.data(AnimGraphModel::ROLE_TRANSITION_POINTER).value(); // Open the select conditions window and return if the user canceled it. - mPasteConditionsWindow = new PasteConditionsWindow(this); - if (mPasteConditionsWindow->exec() == QDialog::Rejected) + m_pasteConditionsWindow = new PasteConditionsWindow(this); + if (m_pasteConditionsWindow->exec() == QDialog::Rejected) { return; } @@ -824,7 +824,7 @@ namespace EMStudio for (size_t i = 0; i < numConditions; ++i) { // check if the condition was selected in the window, if not skip it - if (!mPasteConditionsWindow->GetIsConditionSelected(i)) + if (!m_pasteConditionsWindow->GetIsConditionSelected(i)) { continue; } @@ -832,9 +832,9 @@ namespace EMStudio CommandSystem::CommandAddTransitionCondition* addConditionCommand = aznew CommandSystem::CommandAddTransitionCondition( transition->GetAnimGraph()->GetID(), transition->GetId(), - m_copyPasteClipboard.m_conditions[i].mConditionType, + m_copyPasteClipboard.m_conditions[i].m_conditionType, /*insertAt=*/AZStd::nullopt, - m_copyPasteClipboard.m_conditions[i].mContents); + m_copyPasteClipboard.m_conditions[i].m_contents); commandGroup.AddCommand(addConditionCommand); numPastedConditions++; @@ -911,28 +911,28 @@ namespace EMStudio layout->addWidget(new QLabel("Please select the conditions you want to paste:")); - mCheckboxes.clear(); + m_checkboxes.clear(); const AttributesWindow::CopyPasteClipboard& copyPasteClipboard = attributeWindow->GetCopyPasteConditionClipboard(); for (const AttributesWindow::CopyPasteConditionObject& copyPasteObject : copyPasteClipboard.m_conditions) { - QCheckBox* checkbox = new QCheckBox(copyPasteObject.mSummary.c_str()); - mCheckboxes.push_back(checkbox); + QCheckBox* checkbox = new QCheckBox(copyPasteObject.m_summary.c_str()); + m_checkboxes.push_back(checkbox); checkbox->setCheckState(Qt::Checked); layout->addWidget(checkbox); } // create the ok and cancel buttons QHBoxLayout* buttonLayout = new QHBoxLayout(); - mOKButton = new QPushButton("OK"); - mCancelButton = new QPushButton("Cancel"); - buttonLayout->addWidget(mOKButton); - buttonLayout->addWidget(mCancelButton); + m_okButton = new QPushButton("OK"); + m_cancelButton = new QPushButton("Cancel"); + buttonLayout->addWidget(m_okButton); + buttonLayout->addWidget(m_cancelButton); layout->addLayout(buttonLayout); setLayout(layout); - connect(mOKButton, &QPushButton::clicked, this, &PasteConditionsWindow::accept); - connect(mCancelButton, &QPushButton::clicked, this, &PasteConditionsWindow::reject); + connect(m_okButton, &QPushButton::clicked, this, &PasteConditionsWindow::accept); + connect(m_cancelButton, &QPushButton::clicked, this, &PasteConditionsWindow::reject); } @@ -945,7 +945,7 @@ namespace EMStudio // check if the condition is selected bool PasteConditionsWindow::GetIsConditionSelected(size_t index) const { - return mCheckboxes[index]->checkState() == Qt::Checked; + return m_checkboxes[index]->checkState() == Qt::Checked; } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/AttributesWindow.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/AttributesWindow.h index 5e278760a6..38bceb4426 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/AttributesWindow.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/AttributesWindow.h @@ -82,9 +82,9 @@ namespace EMStudio virtual ~PasteConditionsWindow(); bool GetIsConditionSelected(size_t index) const; private: - QPushButton* mOKButton; - QPushButton* mCancelButton; - AZStd::vector mCheckboxes; + QPushButton* m_okButton; + QPushButton* m_cancelButton; + AZStd::vector m_checkboxes; }; @@ -102,9 +102,9 @@ namespace EMStudio // copy & paste struct CopyPasteConditionObject { - AZStd::string mContents; - AZStd::string mSummary; - AZ::TypeId mConditionType; + AZStd::string m_contents; + AZStd::string m_summary; + AZ::TypeId m_conditionType; }; struct CopyPasteClipboard @@ -156,8 +156,8 @@ namespace EMStudio void PasteTransition(bool pasteTransitionProperties, bool pasteConditions); - AnimGraphPlugin* mPlugin; - QScrollArea* mScrollArea; + AnimGraphPlugin* m_plugin; + QScrollArea* m_scrollArea; QPersistentModelIndex m_displayingModelIndex; QWidget* m_mainReflectedWidget; @@ -187,7 +187,7 @@ namespace EMStudio QLayout* m_actionsLayout; AZStd::vector m_actionsCachedWidgets; - PasteConditionsWindow* mPasteConditionsWindow; + PasteConditionsWindow* m_pasteConditionsWindow; CopyPasteClipboard m_copyPasteClipboard; diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/BlendGraphViewWidget.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/BlendGraphViewWidget.cpp index 037d75a9b9..59a7e33f04 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/BlendGraphViewWidget.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/BlendGraphViewWidget.cpp @@ -369,9 +369,9 @@ namespace EMStudio toolBar->addAction(m_actions[NAVIGATION_FORWARD]); - mNavigationLink = new NavigationLinkWidget(m_parentPlugin, this); - mNavigationLink->setMinimumHeight(28); - toolBar->addWidget(mNavigationLink); + m_navigationLink = new NavigationLinkWidget(m_parentPlugin, this); + m_navigationLink->setMinimumHeight(28); + toolBar->addWidget(m_navigationLink); toolBar->addAction(m_actions[NAVIGATION_NAVPANETOGGLE]); diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/BlendGraphViewWidget.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/BlendGraphViewWidget.h index d1ebfb67d4..f795bef347 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/BlendGraphViewWidget.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/BlendGraphViewWidget.h @@ -133,7 +133,7 @@ namespace EMStudio QHBoxLayout* m_toolbarLayout = nullptr; AZStd::array m_actions{}; AnimGraphPlugin* m_parentPlugin = nullptr; - NavigationLinkWidget* mNavigationLink = nullptr; + NavigationLinkWidget* m_navigationLink = nullptr; QStackedWidget m_viewportStack; QSplitter* m_viewportSplitter = nullptr; diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/BlendGraphWidget.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/BlendGraphWidget.cpp index 5d57763ea6..293dc51864 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/BlendGraphWidget.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/BlendGraphWidget.cpp @@ -51,10 +51,10 @@ namespace EMStudio // constructor BlendGraphWidget::BlendGraphWidget(AnimGraphPlugin* plugin, QWidget* parent) : NodeGraphWidget(plugin, nullptr, parent) - , mContextMenuEventMousePos(0, 0) - , mDoubleClickHappened(false) + , m_contextMenuEventMousePos(0, 0) + , m_doubleClickHappened(false) { - mMoveGroup.SetGroupName("Move anim graph nodes"); + m_moveGroup.SetGroupName("Move anim graph nodes"); setAutoFillBackground(false); setAttribute(Qt::WA_OpaquePaintEvent); @@ -78,9 +78,9 @@ namespace EMStudio return; } - if (!mActiveGraph || - !mPlugin->GetActionFilter().m_createNodes || - mActiveGraph->IsInReferencedGraph()) + if (!m_activeGraph || + !m_plugin->GetActionFilter().m_createNodes || + m_activeGraph->IsInReferencedGraph()) { event->ignore(); return; @@ -440,7 +440,7 @@ namespace EMStudio QAction* action = qobject_cast(sender()); // calculate the position - const QPoint offset = SnapLocalToGrid(LocalToGlobal(mContextMenuEventMousePos)); + const QPoint offset = SnapLocalToGrid(LocalToGlobal(m_contextMenuEventMousePos)); // build the name prefix and create the node const AZStd::string typeString = FromQtString(action->whatsThis()); @@ -523,7 +523,7 @@ namespace EMStudio void BlendGraphWidget::OnContextMenuEvent(QPoint mousePos, QPoint globalMousePos, const AnimGraphActionFilter& actionFilter) { - if (!mAllowContextMenu) + if (!m_allowContextMenu) { return; } @@ -542,7 +542,7 @@ namespace EMStudio return; } - mContextMenuEventMousePos = mousePos; + m_contextMenuEventMousePos = mousePos; const AZStd::vector selectedAnimGraphNodes = nodeGraph->GetSelectedAnimGraphNodes(); const AZStd::vector selectedConnections = nodeGraph->GetSelectedNodeConnections(); @@ -597,7 +597,7 @@ namespace EMStudio EMotionFX::AnimGraphStateTransition* transition = FindTransitionForConnection(selectedConnections[0]); if (transition) { - mPlugin->GetAttributesWindow()->AddTransitionCopyPasteMenuEntries(&menu); + m_plugin->GetAttributesWindow()->AddTransitionCopyPasteMenuEntries(&menu); } } } @@ -608,7 +608,7 @@ namespace EMStudio } if (actionFilter.m_delete && - !mActiveGraph->IsInReferencedGraph()) + !m_activeGraph->IsInReferencedGraph()) { QAction* removeConnectionAction = menu.addAction(removeConnectionActionName); connect(removeConnectionAction, &QAction::triggered, this, static_cast(&BlendGraphWidget::DeleteSelectedItems)); @@ -618,22 +618,22 @@ namespace EMStudio } else { - OnContextMenuEvent(this, mousePos, globalMousePos, mPlugin, selectedAnimGraphNodes, true, false, actionFilter); + OnContextMenuEvent(this, mousePos, globalMousePos, m_plugin, selectedAnimGraphNodes, true, false, actionFilter); } } void BlendGraphWidget::mouseDoubleClickEvent(QMouseEvent* event) { - if (mActiveGraph == nullptr) + if (m_activeGraph == nullptr) { return; } - mDoubleClickHappened = true; + m_doubleClickHappened = true; NodeGraphWidget::mouseDoubleClickEvent(event); - GraphNode* node = mActiveGraph->FindNode(event->pos()); + GraphNode* node = m_activeGraph->FindNode(event->pos()); if (node) { const QModelIndex nodeModelIndex = node->GetModelIndex(); @@ -642,9 +642,9 @@ namespace EMStudio { if (animGraphNode->GetHasVisualGraph()) { - if (!node->GetIsInsideArrowRect(mMousePos)) + if (!node->GetIsInsideArrowRect(m_mousePos)) { - mPlugin->GetAnimGraphModel().Focus(nodeModelIndex); + m_plugin->GetAnimGraphModel().Focus(nodeModelIndex); } } } @@ -656,7 +656,7 @@ namespace EMStudio void BlendGraphWidget::mousePressEvent(QMouseEvent* event) { - mDoubleClickHappened = false; + m_doubleClickHappened = false; NodeGraphWidget::mousePressEvent(event); } @@ -666,25 +666,25 @@ namespace EMStudio { //MCore::LogError("mouse release"); - if (mDoubleClickHappened == false) + if (m_doubleClickHappened == false) { if (event->button() == Qt::RightButton) { - OnContextMenuEvent(event->pos(), event->globalPos(), mPlugin->GetActionFilter()); + OnContextMenuEvent(event->pos(), event->globalPos(), m_plugin->GetActionFilter()); //setCursor( Qt::ArrowCursor ); } } NodeGraphWidget::mouseReleaseEvent(event); //setCursor( Qt::ArrowCursor ); - mDoubleClickHappened = false; + m_doubleClickHappened = false; } // start moving void BlendGraphWidget::OnMoveStart() { - mMoveGroup.RemoveAllCommands(); + m_moveGroup.RemoveAllCommands(); } @@ -701,7 +701,7 @@ namespace EMStudio y); // add it to the group - mMoveGroup.AddCommandString(moveString); + m_moveGroup.AddCommandString(moveString); } @@ -711,7 +711,7 @@ namespace EMStudio AZStd::string resultString; // execute the command - if (GetCommandManager()->ExecuteCommandGroup(mMoveGroup, resultString) == false) + if (GetCommandManager()->ExecuteCommandGroup(m_moveGroup, resultString) == false) { if (resultString.size() > 0) { @@ -813,9 +813,9 @@ namespace EMStudio bool BlendGraphWidget::CheckIfIsCreateConnectionValid(AZ::u16 portNr, GraphNode* portNode, NodePort* port, bool isInputPort) { MCORE_UNUSED(port); - MCORE_ASSERT(mActiveGraph); + MCORE_ASSERT(m_activeGraph); - GraphNode* sourceNode = mActiveGraph->GetCreateConnectionNode(); + GraphNode* sourceNode = m_activeGraph->GetCreateConnectionNode(); GraphNode* targetNode = portNode; // don't allow connection to itself @@ -828,7 +828,7 @@ namespace EMStudio if (sourceNode->GetType() != StateGraphNode::TYPE_ID || targetNode->GetType() != StateGraphNode::TYPE_ID) { // dont allow to connect an input port to another input port or output port to another output port - if (isInputPort == mActiveGraph->GetCreateConnectionIsInputPort()) + if (isInputPort == m_activeGraph->GetCreateConnectionIsInputPort()) { return false; } @@ -853,7 +853,7 @@ namespace EMStudio { sourceBlendNode = static_cast(sourceNode); targetBlendNode = static_cast(targetNode); - sourcePortNr = mActiveGraph->GetCreateConnectionPortNr(); + sourcePortNr = m_activeGraph->GetCreateConnectionPortNr(); targetPortNr = portNr; } else @@ -861,7 +861,7 @@ namespace EMStudio sourceBlendNode = static_cast(targetNode); targetBlendNode = static_cast(sourceNode); sourcePortNr = portNr; - targetPortNr = mActiveGraph->GetCreateConnectionPortNr(); + targetPortNr = m_activeGraph->GetCreateConnectionPortNr(); } EMotionFX::AnimGraphNode::Port& sourcePort = sourceBlendNode->GetEMFXNode()->GetOutputPort(sourcePortNr); @@ -936,7 +936,7 @@ namespace EMStudio void BlendGraphWidget::OnCreateConnection(AZ::u16 sourcePortNr, GraphNode* sourceNode, bool sourceIsInputPort, AZ::u16 targetPortNr, GraphNode* targetNode, bool targetIsInputPort, const QPoint& startOffset, const QPoint& endOffset) { MCORE_UNUSED(targetIsInputPort); - MCORE_ASSERT(mActiveGraph); + MCORE_ASSERT(m_activeGraph); GraphNode* realSourceNode; GraphNode* realTargetNode; @@ -964,7 +964,7 @@ namespace EMStudio AZStd::string command; // Check if there already is a connection plugged into the port where we want to put our new connection in. - NodeConnection* existingConnection = mActiveGraph->FindInputConnection(realTargetNode, realInputPortNr); + NodeConnection* existingConnection = m_activeGraph->FindInputConnection(realTargetNode, realInputPortNr); // Special case for state nodes. AZ::TypeId transitionType = AZ::TypeId::CreateNull(); @@ -1039,12 +1039,12 @@ namespace EMStudio // curved connection when creating a new one? bool BlendGraphWidget::CreateConnectionMustBeCurved() { - if (mActiveGraph == nullptr) + if (m_activeGraph == nullptr) { return true; } - if (mActiveGraph->GetCreateConnectionNode()->GetType() == StateGraphNode::TYPE_ID) + if (m_activeGraph->GetCreateConnectionNode()->GetType() == StateGraphNode::TYPE_ID) { return false; } @@ -1056,12 +1056,12 @@ namespace EMStudio // show helper connection suggestion lines when creating a new connection? bool BlendGraphWidget::CreateConnectionShowsHelpers() { - if (mActiveGraph == nullptr) + if (m_activeGraph == nullptr) { return true; } - if (mActiveGraph->GetCreateConnectionNode()->GetType() == StateGraphNode::TYPE_ID) + if (m_activeGraph->GetCreateConnectionNode()->GetType() == StateGraphNode::TYPE_ID) { return false; } @@ -1181,7 +1181,7 @@ namespace EMStudio QAction* action = qobject_cast(sender()); // find the selected node - const QItemSelection selection = mPlugin->GetAnimGraphModel().GetSelectionModel().selection(); + const QItemSelection selection = m_plugin->GetAnimGraphModel().GetSelectionModel().selection(); const QModelIndexList selectionList = selection.indexes(); if (selectionList.empty()) { @@ -1266,19 +1266,19 @@ namespace EMStudio bool BlendGraphWidget::PreparePainting() { // skip rendering in case rendering is disabled - if (mPlugin->GetDisableRendering()) + if (m_plugin->GetDisableRendering()) { return false; } - if (mActiveGraph) + if (m_activeGraph) { // enable or disable graph animation - mActiveGraph->SetUseAnimation(mPlugin->GetAnimGraphOptions().GetGraphAnimation()); + m_activeGraph->SetUseAnimation(m_plugin->GetAnimGraphOptions().GetGraphAnimation()); } // pass down the show fps options flag - NodeGraphWidget::SetShowFPS(mPlugin->GetAnimGraphOptions().GetShowFPS()); + NodeGraphWidget::SetShowFPS(m_plugin->GetAnimGraphOptions().GetShowFPS()); return true; } @@ -1310,7 +1310,7 @@ namespace EMStudio void BlendGraphWidget::OnSetupVisualizeOptions(GraphNode* node) { BlendTreeVisualNode* blendNode = static_cast(node); - mPlugin->GetActionManager().ShowNodeColorPicker(blendNode->GetEMFXNode()); + m_plugin->GetActionManager().ShowNodeColorPicker(blendNode->GetEMFXNode()); } @@ -1326,7 +1326,7 @@ namespace EMStudio boldFont.setBold(true); QFontMetrics boldFontMetrics(boldFont); - if (mActiveGraph) + if (m_activeGraph) { AZStd::string toolTipString; @@ -1335,7 +1335,7 @@ namespace EMStudio QPoint tooltipPos = helpEvent->globalPos(); // find the connection at the mouse position - NodeConnection* connection = mActiveGraph->FindConnection(globalPos); + NodeConnection* connection = m_activeGraph->FindConnection(globalPos); if (connection) { bool conditionFound = false; @@ -1455,7 +1455,7 @@ namespace EMStudio } } - GraphNode* node = mActiveGraph->FindNode(localPos); + GraphNode* node = m_activeGraph->FindNode(localPos); EMotionFX::AnimGraphNode* animGraphNode = nullptr; if (node) @@ -1542,15 +1542,15 @@ namespace EMStudio const AZ::s32 newEndOffsetX = transition->GetVisualEndOffsetX(); const AZ::s32 newEndOffsetY = transition->GetVisualEndOffsetY(); - mActiveGraph->StopReplaceTransitionHead(); - mActiveGraph->StopReplaceTransitionTail(); + m_activeGraph->StopReplaceTransitionHead(); + m_activeGraph->StopReplaceTransitionTail(); // Reset the visual transition before calling the actual command so that undo captures the right previous values. stateConnection->SetSourceNode(oldSourceNode); stateConnection->SetTargetNode(oldTargetNode); transition->SetVisualOffsets(oldStartOffset.x(), oldStartOffset.y(), oldEndOffset.x(), oldEndOffset.y()); - if (mActiveGraph->GetReplaceTransitionValid()) + if (m_activeGraph->GetReplaceTransitionValid()) { CommandSystem::AdjustTransition(transition, /*isDisabled=*/AZStd::nullopt, @@ -1706,8 +1706,8 @@ namespace EMStudio if (newFocusIndex != newFocusParent) { // We are focusing on a node inside a blendtree/statemachine/referencenode - GraphNode* graphNode = mActiveGraph->FindGraphNode(newFocusIndex); - mActiveGraph->ZoomOnRect(graphNode->GetRect(), geometry().width(), geometry().height(), true); + GraphNode* graphNode = m_activeGraph->FindGraphNode(newFocusIndex); + m_activeGraph->ZoomOnRect(graphNode->GetRect(), geometry().width(), geometry().height(), true); } } else diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/BlendGraphWidget.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/BlendGraphWidget.h index fa0801cdc1..f213b0f2e6 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/BlendGraphWidget.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/BlendGraphWidget.h @@ -126,8 +126,8 @@ namespace EMStudio using NodeGraphByModelIndex = AZStd::unordered_map, QPersistentModelIndexHash>; NodeGraphByModelIndex m_nodeGraphByModelIndex; - QPoint mContextMenuEventMousePos; - bool mDoubleClickHappened; - MCore::CommandGroup mMoveGroup; + QPoint m_contextMenuEventMousePos; + bool m_doubleClickHappened; + MCore::CommandGroup m_moveGroup; }; } // namespace EMStudio diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/BlendNodeSelectionWindow.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/BlendNodeSelectionWindow.cpp index 81812145e7..3b130f5bd7 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/BlendNodeSelectionWindow.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/BlendNodeSelectionWindow.cpp @@ -22,27 +22,27 @@ namespace EMStudio QVBoxLayout* layout = new QVBoxLayout(); - mHierarchyWidget = new AnimGraphHierarchyWidget(this); + m_hierarchyWidget = new AnimGraphHierarchyWidget(this); // create the ok and cancel buttons QHBoxLayout* buttonLayout = new QHBoxLayout(); - mOKButton = new QPushButton("OK"); - mCancelButton = new QPushButton("Cancel"); - buttonLayout->addWidget(mOKButton); - buttonLayout->addWidget(mCancelButton); + m_okButton = new QPushButton("OK"); + m_cancelButton = new QPushButton("Cancel"); + buttonLayout->addWidget(m_okButton); + buttonLayout->addWidget(m_cancelButton); - layout->addWidget(mHierarchyWidget); + layout->addWidget(m_hierarchyWidget); layout->addLayout(buttonLayout); setLayout(layout); setMinimumSize(QSize(400, 400)); - mOKButton->setEnabled(false); + m_okButton->setEnabled(false); - connect(mOKButton, &QPushButton::clicked, this, &BlendNodeSelectionWindow::accept); - connect(mCancelButton, &QPushButton::clicked, this, &BlendNodeSelectionWindow::reject); - connect(mHierarchyWidget, &AnimGraphHierarchyWidget::OnSelectionDone, this, &BlendNodeSelectionWindow::OnNodeSelected); - connect(mHierarchyWidget, &AnimGraphHierarchyWidget::OnSelectionChanged, this, &BlendNodeSelectionWindow::OnSelectionChanged); + connect(m_okButton, &QPushButton::clicked, this, &BlendNodeSelectionWindow::accept); + connect(m_cancelButton, &QPushButton::clicked, this, &BlendNodeSelectionWindow::reject); + connect(m_hierarchyWidget, &AnimGraphHierarchyWidget::OnSelectionDone, this, &BlendNodeSelectionWindow::OnNodeSelected); + connect(m_hierarchyWidget, &AnimGraphHierarchyWidget::OnSelectionChanged, this, &BlendNodeSelectionWindow::OnSelectionChanged); } @@ -54,7 +54,7 @@ namespace EMStudio void BlendNodeSelectionWindow::OnNodeSelected() { - if (mUseSingleSelection) + if (m_useSingleSelection) { accept(); } @@ -66,7 +66,7 @@ namespace EMStudio AZ_UNUSED(selected); AZ_UNUSED(deselected); - mOKButton->setEnabled(mHierarchyWidget->HasSelectedItems()); + m_okButton->setEnabled(m_hierarchyWidget->HasSelectedItems()); } } // namespace EMStudio diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/BlendNodeSelectionWindow.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/BlendNodeSelectionWindow.h index 4ec48bbffb..9d49008d40 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/BlendNodeSelectionWindow.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/BlendNodeSelectionWindow.h @@ -27,9 +27,9 @@ namespace EMStudio * 2. Use the itemSelectionChanged() signal of the GetNodeHierarchyWidget()->GetTreeWidget() to detect when the user adjusts the selection in the node hierarchy widget. * 3. Use the OnSelectionDone() in the GetNodeHierarchyWidget() to detect when the user finished selecting and pressed the OK button. * Example: - * connect( mNodeSelectionWindow, SIGNAL(rejected()), this, SLOT(UserWantsToCancel_1()) ); - * connect( mNodeSelectionWindow->GetNodeHierarchyWidget()->GetTreeWidget(), SIGNAL(itemSelectionChanged()), this, SLOT(SelectionChanged_2()) ); - * connect( mNodeSelectionWindow->GetNodeHierarchyWidget(), SIGNAL(OnSelectionDone(AZStd::vector)), this, SLOT(FinishedSelectionAndPressedOK_3(AZStd::vector)) ); + * connect( m_nodeSelectionWindow, SIGNAL(rejected()), this, SLOT(UserWantsToCancel_1()) ); + * connect( m_nodeSelectionWindow->GetNodeHierarchyWidget()->GetTreeWidget(), SIGNAL(itemSelectionChanged()), this, SLOT(SelectionChanged_2()) ); + * connect( m_nodeSelectionWindow->GetNodeHierarchyWidget(), SIGNAL(OnSelectionDone(AZStd::vector)), this, SLOT(FinishedSelectionAndPressedOK_3(AZStd::vector)) ); */ class BlendNodeSelectionWindow : public QDialog @@ -41,16 +41,16 @@ namespace EMStudio BlendNodeSelectionWindow(QWidget* parent = nullptr); virtual ~BlendNodeSelectionWindow(); - AnimGraphHierarchyWidget& GetAnimGraphHierarchyWidget() { return *mHierarchyWidget; } + AnimGraphHierarchyWidget& GetAnimGraphHierarchyWidget() { return *m_hierarchyWidget; } public slots: void OnNodeSelected(); void OnSelectionChanged(const QItemSelection& selected, const QItemSelection& deselected); private: - AnimGraphHierarchyWidget* mHierarchyWidget; - QPushButton* mOKButton; - QPushButton* mCancelButton; - bool mUseSingleSelection; + AnimGraphHierarchyWidget* m_hierarchyWidget; + QPushButton* m_okButton; + QPushButton* m_cancelButton; + bool m_useSingleSelection; }; } // namespace EMStudio diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/BlendTreeVisualNode.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/BlendTreeVisualNode.cpp index 0cf44af794..823d9a4a88 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/BlendTreeVisualNode.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/BlendTreeVisualNode.cpp @@ -38,26 +38,26 @@ namespace EMStudio RemoveAllConnections(); // add all input ports - const AZStd::vector& inPorts = mEMFXNode->GetInputPorts(); + const AZStd::vector& inPorts = m_emfxNode->GetInputPorts(); const AZ::u16 numInputs = aznumeric_caster(inPorts.size()); - mInputPorts.reserve(numInputs); + m_inputPorts.reserve(numInputs); for (AZ::u16 i = 0; i < numInputs; ++i) { NodePort* port = AddInputPort(false); - port->SetNameID(inPorts[i].mNameID); + port->SetNameID(inPorts[i].m_nameId); port->SetColor(GetPortColor(inPorts[i])); } if (GetHasVisualOutputPorts()) { // add all output ports - const AZStd::vector& outPorts = mEMFXNode->GetOutputPorts(); + const AZStd::vector& outPorts = m_emfxNode->GetOutputPorts(); const AZ::u16 numOutputs = aznumeric_caster(outPorts.size()); - mOutputPorts.reserve(numOutputs); + m_outputPorts.reserve(numOutputs); for (AZ::u16 i = 0; i < numOutputs; ++i) { NodePort* port = AddOutputPort(false); - port->SetNameID(outPorts[i].mNameID); + port->SetNameID(outPorts[i].m_nameId); port->SetColor(GetPortColor(outPorts[i])); } } @@ -71,12 +71,12 @@ namespace EMStudio { EMotionFX::BlendTreeConnection* connection = childIndex.data(AnimGraphModel::ROLE_CONNECTION_POINTER).value(); - GraphNode* source = mParentGraph->FindGraphNode(connection->GetSourceNode()); + GraphNode* source = m_parentGraph->FindGraphNode(connection->GetSourceNode()); GraphNode* target = this; const AZ::u16 sourcePort = connection->GetSourcePort(); const AZ::u16 targetPort = connection->GetTargetPort(); - NodeConnection* visualConnection = new NodeConnection(mParentGraph, childIndex, target, targetPort, source, sourcePort); + NodeConnection* visualConnection = new NodeConnection(m_parentGraph, childIndex, target, targetPort, source, sourcePort); target->AddConnection(visualConnection); } } @@ -90,7 +90,7 @@ namespace EMStudio // get the port color for a given EMotion FX port QColor BlendTreeVisualNode::GetPortColor(const EMotionFX::AnimGraphNode::Port& port) const { - switch (port.mCompatibleTypes[0]) + switch (port.m_compatibleTypes[0]) { case EMotionFX::AttributePose::TYPE_ID: return QColor(150, 150, 255); @@ -119,7 +119,7 @@ namespace EMStudio void BlendTreeVisualNode::Render(QPainter& painter, QPen* pen, bool renderShadow) { // only render if the given node is visible - if (mIsVisible == false) + if (m_isVisible == false) { return; } @@ -130,8 +130,8 @@ namespace EMStudio RenderShadow(painter); } - float opacityFactor = mOpacity; - if (mIsEnabled == false) + float opacityFactor = m_opacity; + if (m_isEnabled == false) { opacityFactor *= 0.35f; } @@ -155,7 +155,7 @@ namespace EMStudio { borderColor.setRgb(255, 128, 0); - if (mParentGraph->GetScale() > 0.75f) + if (m_parentGraph->GetScale() > 0.75f) { pen->setWidth(2); } @@ -166,12 +166,9 @@ namespace EMStudio { borderColor.setRgb(255, 0, 0); } - //else - //if (mIsProcessed) - //borderColor.setRgb(255,225,0); else { - borderColor = mBorderColor; + borderColor = m_borderColor; } } @@ -183,11 +180,11 @@ namespace EMStudio } else // not selected { - if (mIsEnabled) + if (m_isEnabled) { - if (mIsProcessed || colorAllNodes) + if (m_isProcessed || colorAllNodes) { - bgColor = mBaseColor; + bgColor = m_baseColor; } else { @@ -204,9 +201,9 @@ namespace EMStudio // blinking error if (hasError && !isSelected) { - if (mParentGraph->GetUseAnimation()) + if (m_parentGraph->GetUseAnimation()) { - borderColor = mParentGraph->GetErrorBlinkColor(); + borderColor = m_parentGraph->GetErrorBlinkColor(); } else { @@ -220,16 +217,13 @@ namespace EMStudio QColor headerBgColor; bgColor2 = bgColor.lighter(30);// make darker actually, 30% of the old color, same as bgColor * 0.3f; - //if (mIsProcessed == false/* && mIsUpdated*/ && hasError == false && mIsSelected == false) - //headerBgColor = mBaseColor.lighter(30); - //else headerBgColor = bgColor.lighter(20); // text color QColor textColor; if (!isSelected) { - if (mIsEnabled) + if (m_isEnabled) { textColor = Qt::white; } @@ -243,10 +237,10 @@ namespace EMStudio textColor = QColor(bgColor); } - if (mIsCollapsed == false) + if (m_isCollapsed == false) { // is highlighted/hovered (on-mouse-over effect) - if (mIsHighlighted) + if (m_isHighlighted) { bgColor = bgColor.lighter(120); bgColor2 = bgColor2.lighter(120); @@ -255,9 +249,9 @@ namespace EMStudio // draw the main rect painter.setPen(borderColor); - if (!mIsProcessed && mIsEnabled && !isSelected && !colorAllNodes) + if (!m_isProcessed && m_isEnabled && !isSelected && !colorAllNodes) { - if (mIsHighlighted == false) + if (m_isHighlighted == false) { painter.setBrush(QColor(40, 40, 40)); } @@ -268,21 +262,21 @@ namespace EMStudio } else { - QLinearGradient bgGradient(0, mRect.top(), 0, mRect.bottom()); + QLinearGradient bgGradient(0, m_rect.top(), 0, m_rect.bottom()); bgGradient.setColorAt(0.0f, bgColor); bgGradient.setColorAt(1.0f, bgColor2); painter.setBrush(bgGradient); } - painter.drawRoundedRect(mRect, BORDER_RADIUS, BORDER_RADIUS); + painter.drawRoundedRect(m_rect, BORDER_RADIUS, BORDER_RADIUS); // if the scale is so small that we can't see those small things anymore - QRect fullHeaderRect(mRect.left(), mRect.top(), mRect.width(), 30); - QRect headerRect(mRect.left(), mRect.top(), mRect.width(), 15); - QRect subHeaderRect(mRect.left(), mRect.top() + 13, mRect.width(), 15); + QRect fullHeaderRect(m_rect.left(), m_rect.top(), m_rect.width(), 30); + QRect headerRect(m_rect.left(), m_rect.top(), m_rect.width(), 15); + QRect subHeaderRect(m_rect.left(), m_rect.top() + 13, m_rect.width(), 15); // if the scale is so small that we can't see those small things anymore - if (mParentGraph->GetScale() < 0.3f) + if (m_parentGraph->GetScale() < 0.3f) { painter.setOpacity(1.0f); painter.setClipping(false); @@ -294,19 +288,19 @@ namespace EMStudio painter.setPen(borderColor); painter.setClipRect(fullHeaderRect, Qt::ReplaceClip); painter.setBrush(headerBgColor); - painter.drawRoundedRect(mRect, BORDER_RADIUS, BORDER_RADIUS); + painter.drawRoundedRect(m_rect, BORDER_RADIUS, BORDER_RADIUS); painter.setClipping(false); // if the scale is so small that we can't see those small things anymore - if (mParentGraph->GetScale() > 0.5f) + if (m_parentGraph->GetScale() > 0.5f) { // draw the input ports QColor portBrushColor, portPenColor; - const AZ::u16 numInputs = aznumeric_caster(mInputPorts.size()); + const AZ::u16 numInputs = aznumeric_caster(m_inputPorts.size()); for (AZ::u16 i = 0; i < numInputs; ++i) { // get the input port and the corresponding rect - NodePort* inputPort = &mInputPorts[i]; + NodePort* inputPort = &m_inputPorts[i]; const QRect& portRect = inputPort->GetRect(); // get and set the pen and brush colors @@ -321,11 +315,11 @@ namespace EMStudio if (GetHasVisualOutputPorts()) { // draw the output ports - const AZ::u16 numOutputs = aznumeric_caster(mOutputPorts.size()); + const AZ::u16 numOutputs = aznumeric_caster(m_outputPorts.size()); for (AZ::u16 i = 0; i < numOutputs; ++i) { // get the output port and the corresponding rect - NodePort* outputPort = &mOutputPorts[i]; + NodePort* outputPort = &m_outputPorts[i]; const QRect& portRect = outputPort->GetRect(); // get and set the pen and brush colors @@ -342,16 +336,16 @@ namespace EMStudio else // it is collapsed { // is highlighted/hovered (on-mouse-over effect) - if (mIsHighlighted) + if (m_isHighlighted) { bgColor = bgColor.lighter(160); headerBgColor = headerBgColor.lighter(160); } // if the scale is so small that we can't see those small things anymore - QRect fullHeaderRect(mRect.left(), mRect.top(), mRect.width(), 30); - QRect headerRect(mRect.left(), mRect.top(), mRect.width(), 15); - QRect subHeaderRect(mRect.left(), mRect.top() + 13, mRect.width(), 15); + QRect fullHeaderRect(m_rect.left(), m_rect.top(), m_rect.width(), 30); + QRect headerRect(m_rect.left(), m_rect.top(), m_rect.width(), 15); + QRect subHeaderRect(m_rect.left(), m_rect.top() + 13, m_rect.width(), 15); // draw the header painter.setPen(borderColor); @@ -359,7 +353,7 @@ namespace EMStudio painter.drawRoundedRect(fullHeaderRect, 7.0, 7.0); // if the scale is so small that we can't see those small things anymore - if (mParentGraph->GetScale() < 0.3f) + if (m_parentGraph->GetScale() < 0.3f) { painter.setOpacity(1.0f); return; @@ -370,7 +364,7 @@ namespace EMStudio painter.setClipping(false); } - if (mParentGraph->GetScale() > 0.3f) + if (m_parentGraph->GetScale() > 0.3f) { // draw the collapse triangle if (isSelected) @@ -384,37 +378,37 @@ namespace EMStudio painter.setBrush(QColor(175, 175, 175)); } - if (mIsCollapsed == false) + if (m_isCollapsed == false) { QPoint triangle[3]; - triangle[0].setX(mArrowRect.left()); - triangle[0].setY(mArrowRect.top()); - triangle[1].setX(mArrowRect.right()); - triangle[1].setY(mArrowRect.top()); - triangle[2].setX(mArrowRect.center().x()); - triangle[2].setY(mArrowRect.bottom()); + triangle[0].setX(m_arrowRect.left()); + triangle[0].setY(m_arrowRect.top()); + triangle[1].setX(m_arrowRect.right()); + triangle[1].setY(m_arrowRect.top()); + triangle[2].setX(m_arrowRect.center().x()); + triangle[2].setY(m_arrowRect.bottom()); painter.drawPolygon(triangle, 3, Qt::WindingFill); } else { QPoint triangle[3]; - triangle[0].setX(mArrowRect.left()); - triangle[0].setY(mArrowRect.top()); - triangle[1].setX(mArrowRect.right()); - triangle[1].setY(mArrowRect.center().y()); - triangle[2].setX(mArrowRect.left()); - triangle[2].setY(mArrowRect.bottom()); + triangle[0].setX(m_arrowRect.left()); + triangle[0].setY(m_arrowRect.top()); + triangle[1].setX(m_arrowRect.right()); + triangle[1].setY(m_arrowRect.center().y()); + triangle[2].setX(m_arrowRect.left()); + triangle[2].setY(m_arrowRect.bottom()); painter.drawPolygon(triangle, 3, Qt::WindingFill); } // draw the visualize area - if (mCanVisualize) + if (m_canVisualize) { RenderVisualizeRect(painter, bgColor, bgColor2); } // render the tracks etc - if (mIsCollapsed == false && mEMFXNode->GetHasOutputPose() && mIsProcessed) + if (m_isCollapsed == false && m_emfxNode->GetHasOutputPose() && m_isProcessed) { RenderTracks(painter, bgColor, bgColor2); } @@ -424,60 +418,57 @@ namespace EMStudio } // render the text overlay with the pre-baked node name and port names etc. - float textOpacity = MCore::Clamp(mParentGraph->GetScale() * mParentGraph->GetScale() * 1.5f, 0.0f, 1.0f); - //if (mIsProcessed == false && mIsEnabled) - //textOpacity *= 0.65f; + float textOpacity = MCore::Clamp(m_parentGraph->GetScale() * m_parentGraph->GetScale() * 1.5f, 0.0f, 1.0f); painter.setOpacity(textOpacity); // draw the title - //painter.drawPixmap( mRect, mTextPixmap ); painter.setBrush(Qt::NoBrush); painter.setPen(textColor); - painter.setFont(mHeaderFont); - painter.drawStaticText(mRect.left(), mRect.top(), mTitleText); + painter.setFont(m_headerFont); + painter.drawStaticText(m_rect.left(), m_rect.top(), m_titleText); // draw the subtitle - painter.setFont(mSubTitleFont); - painter.drawStaticText(mRect.left(), aznumeric_cast(mRect.top() + mTitleText.size().height() - 3), mSubTitleText); + painter.setFont(m_subTitleFont); + painter.drawStaticText(m_rect.left(), aznumeric_cast(m_rect.top() + m_titleText.size().height() - 3), m_subTitleText); // draw the info text - if (mIsCollapsed == false) + if (m_isCollapsed == false) { // draw info text QRect textRect; CalcInfoTextRect(textRect, false); - painter.setFont(mInfoTextFont); + painter.setFont(m_infoTextFont); painter.setPen(QColor(255, 128, 0)); - painter.drawStaticText(mRect.left(), textRect.top() + 4, mInfoText); + painter.drawStaticText(m_rect.left(), textRect.top() + 4, m_infoText); painter.setPen(textColor); - painter.setFont(mPortNameFont); + painter.setFont(m_portNameFont); // draw input port text - const AZ::u16 numInputs = aznumeric_caster(mInputPorts.size()); + const AZ::u16 numInputs = aznumeric_caster(m_inputPorts.size()); for (AZ::u16 i = 0; i < numInputs; ++i) { - NodePort* inputPort = &mInputPorts[i]; + NodePort* inputPort = &m_inputPorts[i]; const QRect& portRect = inputPort->GetRect(); if (inputPort->GetNameID() == MCORE_INVALIDINDEX32) { continue; } - painter.drawStaticText(mRect.left() + 8, portRect.top() - 3, mInputPortText[i]); + painter.drawStaticText(m_rect.left() + 8, portRect.top() - 3, m_inputPortText[i]); } // draw output port text - const AZ::u16 numOutputs = aznumeric_caster(mOutputPorts.size()); + const AZ::u16 numOutputs = aznumeric_caster(m_outputPorts.size()); for (AZ::u16 i = 0; i < numOutputs; ++i) { - NodePort* outputPort = &mOutputPorts[i]; + NodePort* outputPort = &m_outputPorts[i]; const QRect& portRect = outputPort->GetRect(); if (outputPort->GetNameID() == MCORE_INVALIDINDEX32) { continue; } - painter.drawStaticText(aznumeric_cast(mRect.right() - 10 - mOutputPortText[i].size().width()), portRect.top() - 3, mOutputPortText[i]); + painter.drawStaticText(aznumeric_cast(m_rect.right() - 10 - m_outputPortText[i].size().width()), portRect.top() - 3, m_outputPortText[i]); } } diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/ContextMenu.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/ContextMenu.cpp index da092f93f6..01a7cb1bd1 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/ContextMenu.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/ContextMenu.cpp @@ -36,7 +36,7 @@ namespace EMStudio const AZStd::vector& objectPrototypes = plugin->GetAnimGraphObjectFactory()->GetUiObjectPrototypes(); for (EMotionFX::AnimGraphObject* objectPrototype : objectPrototypes) { - if (mPlugin->CheckIfCanCreateObject(focusedGraphObject, objectPrototype, category)) + if (m_plugin->CheckIfCanCreateObject(focusedGraphObject, objectPrototype, category)) { isEmpty = false; break; @@ -54,7 +54,7 @@ namespace EMStudio for (const EMotionFX::AnimGraphObject* objectPrototype : objectPrototypes) { - if (mPlugin->CheckIfCanCreateObject(focusedGraphObject, objectPrototype, category)) + if (m_plugin->CheckIfCanCreateObject(focusedGraphObject, objectPrototype, category)) { const EMotionFX::AnimGraphNode* nodePrototype = static_cast(objectPrototype); QAction* action = menu->addAction(nodePrototype->GetPaletteName()); @@ -287,7 +287,7 @@ namespace EMStudio { menu->addSeparator(); QAction* action = menu->addAction("Adjust Visualization Color"); - connect(action, &QAction::triggered, [this, animGraphNode](bool) { mPlugin->GetActionManager().ShowNodeColorPicker(animGraphNode); }); + connect(action, &QAction::triggered, [this, animGraphNode](bool) { m_plugin->GetActionManager().ShowNodeColorPicker(animGraphNode); }); } } } diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/GameController.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/GameController.cpp index c1d0d25c9e..4c32cdb0cc 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/GameController.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/GameController.cpp @@ -20,17 +20,17 @@ BOOL CALLBACK GameController::EnumJoysticksCallback(const DIDEVICEINSTANCE* pdid GameController* manager = static_cast(pContext); // store the name - manager->mDeviceInfo.mName = pdidInstance->tszProductName; + manager->m_deviceInfo.m_name = pdidInstance->tszProductName; // Skip anything other than the perferred Joystick device as defined by the control panel. // Instead you could store all the enumerated Joysticks and let the user pick. - if (manager->mEnumContext.mPrefJoystickConfigValid && IsEqualGUID(pdidInstance->guidInstance, manager->mEnumContext.mPrefJoystickConfig->guidInstance) == false) + if (manager->m_enumContext.m_prefJoystickConfigValid && IsEqualGUID(pdidInstance->guidInstance, manager->m_enumContext.m_prefJoystickConfig->guidInstance) == false) { return DIENUM_CONTINUE; } // Obtain an interface to the enumerated Joystick. - HRESULT result = manager->mDirectInput->CreateDevice(pdidInstance->guidInstance, &manager->mJoystick, nullptr); + HRESULT result = manager->m_directInput->CreateDevice(pdidInstance->guidInstance, &manager->m_joystick, nullptr); // If it failed, then we can't use this Joystick. (Maybe the user unplugged // it while we were in the middle of enumerating it.) @@ -63,7 +63,7 @@ BOOL CALLBACK GameController::EnumObjectsCallback(const DIDEVICEOBJECTINSTANCE* diprg.lMax = +1000; // Set the range for the axis - if (FAILED(manager->mJoystick->SetProperty(DIPROP_RANGE, &diprg.diph))) + if (FAILED(manager->m_joystick->SetProperty(DIPROP_RANGE, &diprg.diph))) { return DIENUM_STOP; } @@ -71,103 +71,94 @@ BOOL CALLBACK GameController::EnumObjectsCallback(const DIDEVICEOBJECTINSTANCE* if (pdidoi->guidType == GUID_XAxis) { - manager->mDeviceElements[ ELEM_POS_X ].mName = pdidoi->tszName; - manager->mDeviceElements[ ELEM_POS_X ].mPresent = true; - manager->mDeviceElements[ ELEM_POS_X ].mValue = 0.0f; - //manager->mDeviceElements[ ELEM_POS_X ].mCalibrationValue = 0.0f; - manager->mDeviceElements[ ELEM_POS_X ].mType = ELEMTYPE_AXIS; - manager->mDeviceInfo.mNumAxes++; + manager->m_deviceElements[ ELEM_POS_X ].m_name = pdidoi->tszName; + manager->m_deviceElements[ ELEM_POS_X ].m_present = true; + manager->m_deviceElements[ ELEM_POS_X ].m_value = 0.0f; + manager->m_deviceElements[ ELEM_POS_X ].m_type = ELEMTYPE_AXIS; + manager->m_deviceInfo.m_numAxes++; } if (pdidoi->guidType == GUID_YAxis) { - manager->mDeviceElements[ ELEM_POS_Y ].mName = pdidoi->tszName; - manager->mDeviceElements[ ELEM_POS_Y ].mPresent = true; - manager->mDeviceElements[ ELEM_POS_Y ].mValue = 0.0f; - //manager->mDeviceElements[ ELEM_POS_Y ].mCalibrationValue = 0.0f; - manager->mDeviceElements[ ELEM_POS_Y ].mType = ELEMTYPE_AXIS; - manager->mDeviceInfo.mNumAxes++; + manager->m_deviceElements[ ELEM_POS_Y ].m_name = pdidoi->tszName; + manager->m_deviceElements[ ELEM_POS_Y ].m_present = true; + manager->m_deviceElements[ ELEM_POS_Y ].m_value = 0.0f; + manager->m_deviceElements[ ELEM_POS_Y ].m_type = ELEMTYPE_AXIS; + manager->m_deviceInfo.m_numAxes++; } if (pdidoi->guidType == GUID_ZAxis) { - manager->mDeviceElements[ ELEM_POS_Z ].mName = pdidoi->tszName; - manager->mDeviceElements[ ELEM_POS_Z ].mPresent = true; - manager->mDeviceElements[ ELEM_POS_Z ].mValue = 0.0f; - //manager->mDeviceElements[ ELEM_POS_Z ].mCalibrationValue = 0.0f; - manager->mDeviceElements[ ELEM_POS_Z ].mType = ELEMTYPE_AXIS; - manager->mDeviceInfo.mNumAxes++; + manager->m_deviceElements[ ELEM_POS_Z ].m_name = pdidoi->tszName; + manager->m_deviceElements[ ELEM_POS_Z ].m_present = true; + manager->m_deviceElements[ ELEM_POS_Z ].m_value = 0.0f; + manager->m_deviceElements[ ELEM_POS_Z ].m_type = ELEMTYPE_AXIS; + manager->m_deviceInfo.m_numAxes++; } if (pdidoi->guidType == GUID_RxAxis) { - manager->mDeviceElements[ ELEM_ROT_X ].mName = pdidoi->tszName; - manager->mDeviceElements[ ELEM_ROT_X ].mPresent = true; - manager->mDeviceElements[ ELEM_ROT_X ].mValue = 0.0f; - //manager->mDeviceElements[ ELEM_ROT_X ].mCalibrationValue = 0.0f; - manager->mDeviceElements[ ELEM_ROT_X ].mType = ELEMTYPE_AXIS; - manager->mDeviceInfo.mNumAxes++; + manager->m_deviceElements[ ELEM_ROT_X ].m_name = pdidoi->tszName; + manager->m_deviceElements[ ELEM_ROT_X ].m_present = true; + manager->m_deviceElements[ ELEM_ROT_X ].m_value = 0.0f; + manager->m_deviceElements[ ELEM_ROT_X ].m_type = ELEMTYPE_AXIS; + manager->m_deviceInfo.m_numAxes++; } if (pdidoi->guidType == GUID_RyAxis) { - manager->mDeviceElements[ ELEM_ROT_Y ].mName = pdidoi->tszName; - manager->mDeviceElements[ ELEM_ROT_Y ].mPresent = true; - manager->mDeviceElements[ ELEM_ROT_Y ].mValue = 0.0f; - //manager->mDeviceElements[ ELEM_ROT_Y ].mCalibrationValue = 0.0f; - manager->mDeviceElements[ ELEM_ROT_Y ].mType = ELEMTYPE_AXIS; - manager->mDeviceInfo.mNumAxes++; + manager->m_deviceElements[ ELEM_ROT_Y ].m_name = pdidoi->tszName; + manager->m_deviceElements[ ELEM_ROT_Y ].m_present = true; + manager->m_deviceElements[ ELEM_ROT_Y ].m_value = 0.0f; + manager->m_deviceElements[ ELEM_ROT_Y ].m_type = ELEMTYPE_AXIS; + manager->m_deviceInfo.m_numAxes++; } if (pdidoi->guidType == GUID_RzAxis) { - manager->mDeviceElements[ ELEM_ROT_Z ].mName = pdidoi->tszName; - manager->mDeviceElements[ ELEM_ROT_Z ].mPresent = true; - manager->mDeviceElements[ ELEM_ROT_Z ].mValue = 0.0f; - //manager->mDeviceElements[ ELEM_ROT_Z ].mCalibrationValue = 0.0f; - manager->mDeviceElements[ ELEM_ROT_Z ].mType = ELEMTYPE_AXIS; - manager->mDeviceInfo.mNumAxes++; + manager->m_deviceElements[ ELEM_ROT_Z ].m_name = pdidoi->tszName; + manager->m_deviceElements[ ELEM_ROT_Z ].m_present = true; + manager->m_deviceElements[ ELEM_ROT_Z ].m_value = 0.0f; + manager->m_deviceElements[ ELEM_ROT_Z ].m_type = ELEMTYPE_AXIS; + manager->m_deviceInfo.m_numAxes++; } // a slider if (pdidoi->guidType == GUID_Slider) { - if (manager->mDeviceInfo.mNumSliders == 0) + if (manager->m_deviceInfo.m_numSliders == 0) { - manager->mDeviceElements[ ELEM_SLIDER_1 ].mName = pdidoi->tszName; - manager->mDeviceElements[ ELEM_SLIDER_1 ].mPresent = true; - manager->mDeviceElements[ ELEM_SLIDER_1 ].mValue = 0.0f; - //manager->mDeviceElements[ ELEM_SLIDER_1 ].mCalibrationValue = 0.0f; - manager->mDeviceElements[ ELEM_SLIDER_1 ].mType = ELEMTYPE_SLIDER; + manager->m_deviceElements[ ELEM_SLIDER_1 ].m_name = pdidoi->tszName; + manager->m_deviceElements[ ELEM_SLIDER_1 ].m_present = true; + manager->m_deviceElements[ ELEM_SLIDER_1 ].m_value = 0.0f; + manager->m_deviceElements[ ELEM_SLIDER_1 ].m_type = ELEMTYPE_SLIDER; } else { - manager->mDeviceElements[ ELEM_SLIDER_2 ].mName = pdidoi->tszName; - manager->mDeviceElements[ ELEM_SLIDER_2 ].mPresent = true; - manager->mDeviceElements[ ELEM_SLIDER_2 ].mValue = 0.0f; - //manager->mDeviceElements[ ELEM_SLIDER_2 ].mCalibrationValue = 0.0f; - manager->mDeviceElements[ ELEM_SLIDER_2 ].mType = ELEMTYPE_SLIDER; + manager->m_deviceElements[ ELEM_SLIDER_2 ].m_name = pdidoi->tszName; + manager->m_deviceElements[ ELEM_SLIDER_2 ].m_present = true; + manager->m_deviceElements[ ELEM_SLIDER_2 ].m_value = 0.0f; + manager->m_deviceElements[ ELEM_SLIDER_2 ].m_type = ELEMTYPE_SLIDER; } - manager->mDeviceInfo.mNumSliders++; + manager->m_deviceInfo.m_numSliders++; } // a POV if (pdidoi->guidType == GUID_POV) { - const uint32 povIndex = manager->mDeviceInfo.mNumPOVs; - manager->mDeviceElements[ ELEM_POV_1 + povIndex ].mName = pdidoi->tszName; - manager->mDeviceElements[ ELEM_POV_1 + povIndex ].mPresent = true; - manager->mDeviceElements[ ELEM_POV_1 + povIndex ].mValue = 0.0f; - //manager->mDeviceElements[ ELEM_POV_1 + povIndex ].mCalibrationValue = 0.0f; - manager->mDeviceElements[ ELEM_POV_1 + povIndex ].mType = ELEMTYPE_POV; - manager->mDeviceInfo.mNumPOVs++; + const uint32 povIndex = manager->m_deviceInfo.m_numPoVs; + manager->m_deviceElements[ ELEM_POV_1 + povIndex ].m_name = pdidoi->tszName; + manager->m_deviceElements[ ELEM_POV_1 + povIndex ].m_present = true; + manager->m_deviceElements[ ELEM_POV_1 + povIndex ].m_value = 0.0f; + manager->m_deviceElements[ ELEM_POV_1 + povIndex ].m_type = ELEMTYPE_POV; + manager->m_deviceInfo.m_numPoVs++; } // a button if (pdidoi->guidType == GUID_Button) { - manager->mDeviceInfo.mNumButtons++; + manager->m_deviceInfo.m_numButtons++; } return DIENUM_CONTINUE; @@ -183,7 +174,7 @@ bool GameController::Init(HWND hWnd) // reinit if (FAILED(InitDirectInput(hWnd))) { - mValid = false; + m_valid = false; return false; } @@ -199,24 +190,24 @@ HRESULT GameController::InitDirectInput(HWND hWnd) HRESULT result; // reset the device info - mDeviceInfo.mName = ""; - mDeviceInfo.mNumAxes = 0; - mDeviceInfo.mNumButtons = 0; - mDeviceInfo.mNumPOVs = 0; - mDeviceInfo.mNumSliders = 0; + m_deviceInfo.m_name = ""; + m_deviceInfo.m_numAxes = 0; + m_deviceInfo.m_numButtons = 0; + m_deviceInfo.m_numPoVs = 0; + m_deviceInfo.m_numSliders = 0; uint32 i; for (i = 0; i < NUM_ELEMENTS; ++i) { - mDeviceElements[i].mPresent = false; - mDeviceElements[i].mValue = 0.0f; + m_deviceElements[i].m_present = false; + m_deviceElements[i].m_value = 0.0f; } // register with the DirectInput subsystem and get a pointer to a IDirectInput interface we can use - result = DirectInput8Create(GetModuleHandle(nullptr), DIRECTINPUT_VERSION, IID_IDirectInput8, ( VOID** )&mDirectInput, nullptr); + result = DirectInput8Create(GetModuleHandle(nullptr), DIRECTINPUT_VERSION, IID_IDirectInput8, ( VOID** )&m_directInput, nullptr); if (FAILED(result)) { - mValid = false; + m_valid = false; return result; } @@ -224,21 +215,21 @@ HRESULT GameController::InitDirectInput(HWND hWnd) memset(&prefJoystickConfig, 0, sizeof(DIJOYCONFIG)); prefJoystickConfig.dwSize = sizeof(DIJOYCONFIG); - mEnumContext.mPrefJoystickConfig = &prefJoystickConfig; - mEnumContext.mPrefJoystickConfigValid = false; + m_enumContext.m_prefJoystickConfig = &prefJoystickConfig; + m_enumContext.m_prefJoystickConfigValid = false; IDirectInputJoyConfig8* joystickConfig = nullptr; - result = mDirectInput->QueryInterface(IID_IDirectInputJoyConfig8, (void**)&joystickConfig); + result = m_directInput->QueryInterface(IID_IDirectInputJoyConfig8, (void**)&joystickConfig); if (FAILED(result)) { - mValid = false; + m_valid = false; return result; } result = joystickConfig->GetConfig(0, &prefJoystickConfig, DIJC_GUIDINSTANCE); if (SUCCEEDED(result)) // this function is expected to fail if no joystick is attached { - mEnumContext.mPrefJoystickConfigValid = true; + m_enumContext.m_prefJoystickConfigValid = true; } if (joystickConfig) @@ -248,18 +239,18 @@ HRESULT GameController::InitDirectInput(HWND hWnd) } // look for a simple Joystick we can use for this sample program. - result = mDirectInput->EnumDevices(DI8DEVCLASS_GAMECTRL, EnumJoysticksCallback, this, DIEDFL_ATTACHEDONLY); + result = m_directInput->EnumDevices(DI8DEVCLASS_GAMECTRL, EnumJoysticksCallback, this, DIEDFL_ATTACHEDONLY); if (FAILED(result)) { - mValid = false; + m_valid = false; return result; } // make sure we got a Joystick - if (mJoystick == nullptr) + if (m_joystick == nullptr) { // No joystick found. - mValid = false; + m_valid = false; return S_OK; } @@ -268,10 +259,10 @@ HRESULT GameController::InitDirectInput(HWND hWnd) // A data format specifies which controls on a device we are interested in, // and how they should be reported. This tells DInput that we will be // passing a DIJOYSTATE2 structure to IDirectInputDevice::GetDeviceState(). - result = mJoystick->SetDataFormat(&c_dfDIJoystick2); + result = m_joystick->SetDataFormat(&c_dfDIJoystick2); if (FAILED(result)) { - mValid = false; + m_valid = false; return result; } @@ -279,10 +270,10 @@ HRESULT GameController::InitDirectInput(HWND hWnd) // interact with the system and with other DInput applications. if (hWnd) { - result = mJoystick->SetCooperativeLevel(hWnd, DISCL_EXCLUSIVE | DISCL_BACKGROUND); + result = m_joystick->SetCooperativeLevel(hWnd, DISCL_EXCLUSIVE | DISCL_BACKGROUND); if (FAILED(result)) { - mValid = false; + m_valid = false; return result; } } @@ -290,37 +281,37 @@ HRESULT GameController::InitDirectInput(HWND hWnd) // Enumerate the Joystick objects. The callback function enabled user // interface elements for objects that are found, and sets the min/max // values property for discovered axes. - result = mJoystick->EnumObjects(EnumObjectsCallback, (VOID*)this, DIDFT_ALL); + result = m_joystick->EnumObjects(EnumObjectsCallback, (VOID*)this, DIDFT_ALL); if (FAILED(result)) { - mValid = false; + m_valid = false; return result; } // acquire the joystick - mJoystick->Acquire(); + m_joystick->Acquire(); // display the device info - MCore::LogDetailedInfo("- Controller = %s", mDeviceInfo.mName.c_str()); - MCore::LogDetailedInfo(" + Num buttons = %d", mDeviceInfo.mNumButtons); - MCore::LogDetailedInfo(" + Num axes = %d", mDeviceInfo.mNumAxes); - MCore::LogDetailedInfo(" + Num sliders = %d", mDeviceInfo.mNumSliders); - MCore::LogDetailedInfo(" + Num POVs = %d", mDeviceInfo.mNumPOVs); + MCore::LogDetailedInfo("- Controller = %s", m_deviceInfo.m_name.c_str()); + MCore::LogDetailedInfo(" + Num buttons = %d", m_deviceInfo.m_numButtons); + MCore::LogDetailedInfo(" + Num axes = %d", m_deviceInfo.m_numAxes); + MCore::LogDetailedInfo(" + Num sliders = %d", m_deviceInfo.m_numSliders); + MCore::LogDetailedInfo(" + Num POVs = %d", m_deviceInfo.m_numPoVs); // display all elements uint32 numPresentElements = 0; for (i = 0; i < NUM_ELEMENTS; ++i) { - if (mDeviceElements[i].mPresent == false) + if (m_deviceElements[i].m_present == false) { continue; } numPresentElements++; - MCore::LogDetailedInfo(" + Element #%d = %s", numPresentElements, mDeviceElements[i].mName.c_str()); + MCore::LogDetailedInfo(" + Element #%d = %s", numPresentElements, m_deviceElements[i].m_name.c_str()); } - mValid = true; + m_valid = true; return S_OK; } @@ -329,18 +320,18 @@ HRESULT GameController::InitDirectInput(HWND hWnd) void GameController::Shutdown() { // unacquire the device one last time just in case - if (mJoystick) + if (m_joystick) { - mJoystick->Unacquire(); - mJoystick->Release(); - mJoystick = nullptr; + m_joystick->Unacquire(); + m_joystick->Release(); + m_joystick = nullptr; } // release any DirectInput objects - if (mDirectInput) + if (m_directInput) { - mDirectInput->Release(); - mDirectInput = nullptr; + m_directInput->Release(); + m_directInput = nullptr; } } @@ -348,42 +339,38 @@ void GameController::Shutdown() // calibrate void GameController::Calibrate() { - mDeviceElements[ELEM_POS_X].mCalibrationValue = -(mJoystickState.lX / 1000.0f); - mDeviceElements[ELEM_POS_Y].mCalibrationValue = -(mJoystickState.lY / 1000.0f); - mDeviceElements[ELEM_POS_Z].mCalibrationValue = -(mJoystickState.lZ / 1000.0f); - mDeviceElements[ELEM_ROT_X].mCalibrationValue = -(mJoystickState.lRx / 1000.0f); - mDeviceElements[ELEM_ROT_Y].mCalibrationValue = -(mJoystickState.lRy / 1000.0f); - mDeviceElements[ELEM_ROT_Z].mCalibrationValue = -(mJoystickState.lRz / 1000.0f); - //mDeviceElements[ELEM_POV_1].mCalibrationValue = -(mJoystickState.rgdwPOV[0] / 1000.0f); - //mDeviceElements[ELEM_POV_2].mCalibrationValue = -(mJoystickState.rgdwPOV[1] / 1000.0f); - //mDeviceElements[ELEM_POV_3].mCalibrationValue = -(mJoystickState.rgdwPOV[2] / 1000.0f); - //mDeviceElements[ELEM_POV_4].mCalibrationValue = -(mJoystickState.rgdwPOV[3] / 1000.0f); - mDeviceElements[ELEM_SLIDER_1].mCalibrationValue = -(mJoystickState.rglSlider[0] / 1000.0f); - mDeviceElements[ELEM_SLIDER_2].mCalibrationValue = -(mJoystickState.rglSlider[1] / 1000.0f); + m_deviceElements[ELEM_POS_X].m_calibrationValue = -(m_joystickState.lX / 1000.0f); + m_deviceElements[ELEM_POS_Y].m_calibrationValue = -(m_joystickState.lY / 1000.0f); + m_deviceElements[ELEM_POS_Z].m_calibrationValue = -(m_joystickState.lZ / 1000.0f); + m_deviceElements[ELEM_ROT_X].m_calibrationValue = -(m_joystickState.lRx / 1000.0f); + m_deviceElements[ELEM_ROT_Y].m_calibrationValue = -(m_joystickState.lRy / 1000.0f); + m_deviceElements[ELEM_ROT_Z].m_calibrationValue = -(m_joystickState.lRz / 1000.0f); + m_deviceElements[ELEM_SLIDER_1].m_calibrationValue = -(m_joystickState.rglSlider[0] / 1000.0f); + m_deviceElements[ELEM_SLIDER_2].m_calibrationValue = -(m_joystickState.rglSlider[1] / 1000.0f); } // update the controller bool GameController::Update() { - if (mJoystick == nullptr) + if (m_joystick == nullptr) { - mValid = false; + m_valid = false; return false; } // poll the device to read the current state - HRESULT result = mJoystick->Poll(); + HRESULT result = m_joystick->Poll(); if (FAILED(result)) { // DInput is telling us that the input stream has been // interrupted. We aren't tracking any state between polls, so // we don't have any special reset that needs to be done. We // just re-acquire and try again. - result = mJoystick->Acquire(); + result = m_joystick->Acquire(); while (result == DIERR_INPUTLOST) { - result = mJoystick->Acquire(); + result = m_joystick->Acquire(); } // reset all buttons @@ -398,70 +385,70 @@ bool GameController::Update() // switching, so just try again later if (result == DIERR_OTHERAPPHASPRIO) { - mValid = true; + m_valid = true; return true; } if (FAILED(result)) { - mValid = false; + m_valid = false; return false; } } // Get the input's device state - result = mJoystick->GetDeviceState(sizeof(DIJOYSTATE2), &mJoystickState); + result = m_joystick->GetDeviceState(sizeof(DIJOYSTATE2), &m_joystickState); if (FAILED(result)) { - mValid = false; + m_valid = false; return false; // The device should have been acquired during the Poll() } // update the values of the elements - mDeviceElements[ELEM_POS_X].mValue = mJoystickState.lX / 1000.0f; - mDeviceElements[ELEM_POS_Y].mValue = mJoystickState.lY / 1000.0f; - mDeviceElements[ELEM_POS_Z].mValue = mJoystickState.lZ / 1000.0f; - mDeviceElements[ELEM_ROT_X].mValue = mJoystickState.lRx / 1000.0f; - mDeviceElements[ELEM_ROT_Y].mValue = mJoystickState.lRy / 1000.0f; - mDeviceElements[ELEM_ROT_Z].mValue = mJoystickState.lRz / 1000.0f; - mDeviceElements[ELEM_SLIDER_1].mValue = mJoystickState.rglSlider[0] / 1000.0f; - mDeviceElements[ELEM_SLIDER_2].mValue = mJoystickState.rglSlider[1] / 1000.0f; + m_deviceElements[ELEM_POS_X].m_value = m_joystickState.lX / 1000.0f; + m_deviceElements[ELEM_POS_Y].m_value = m_joystickState.lY / 1000.0f; + m_deviceElements[ELEM_POS_Z].m_value = m_joystickState.lZ / 1000.0f; + m_deviceElements[ELEM_ROT_X].m_value = m_joystickState.lRx / 1000.0f; + m_deviceElements[ELEM_ROT_Y].m_value = m_joystickState.lRy / 1000.0f; + m_deviceElements[ELEM_ROT_Z].m_value = m_joystickState.lRz / 1000.0f; + m_deviceElements[ELEM_SLIDER_1].m_value = m_joystickState.rglSlider[0] / 1000.0f; + m_deviceElements[ELEM_SLIDER_2].m_value = m_joystickState.rglSlider[1] / 1000.0f; - if (mJoystickState.rgdwPOV[0] == MCORE_INVALIDINDEX32) + if (m_joystickState.rgdwPOV[0] == MCORE_INVALIDINDEX32) { - mDeviceElements[ELEM_POV_1].mValue = 0.0f; + m_deviceElements[ELEM_POV_1].m_value = 0.0f; } else { - mDeviceElements[ELEM_POV_1].mValue = (mJoystickState.rgdwPOV[0] / 100.0f) / 360.0f; + m_deviceElements[ELEM_POV_1].m_value = (m_joystickState.rgdwPOV[0] / 100.0f) / 360.0f; } - if (mJoystickState.rgdwPOV[1] == MCORE_INVALIDINDEX32) + if (m_joystickState.rgdwPOV[1] == MCORE_INVALIDINDEX32) { - mDeviceElements[ELEM_POV_2].mValue = 0.0f; + m_deviceElements[ELEM_POV_2].m_value = 0.0f; } else { - mDeviceElements[ELEM_POV_2].mValue = (mJoystickState.rgdwPOV[1] / 100.0f) / 360.0f; + m_deviceElements[ELEM_POV_2].m_value = (m_joystickState.rgdwPOV[1] / 100.0f) / 360.0f; } - if (mJoystickState.rgdwPOV[2] == MCORE_INVALIDINDEX32) + if (m_joystickState.rgdwPOV[2] == MCORE_INVALIDINDEX32) { - mDeviceElements[ELEM_POV_3].mValue = 0.0f; + m_deviceElements[ELEM_POV_3].m_value = 0.0f; } else { - mDeviceElements[ELEM_POV_3].mValue = (mJoystickState.rgdwPOV[2] / 100.0f) / 360.0f; + m_deviceElements[ELEM_POV_3].m_value = (m_joystickState.rgdwPOV[2] / 100.0f) / 360.0f; } - if (mJoystickState.rgdwPOV[3] == MCORE_INVALIDINDEX32) + if (m_joystickState.rgdwPOV[3] == MCORE_INVALIDINDEX32) { - mDeviceElements[ELEM_POV_4].mValue = 0.0f; + m_deviceElements[ELEM_POV_4].m_value = 0.0f; } else { - mDeviceElements[ELEM_POV_4].mValue = (mJoystickState.rgdwPOV[3] / 100.0f) / 360.0f; + m_deviceElements[ELEM_POV_4].m_value = (m_joystickState.rgdwPOV[3] / 100.0f) / 360.0f; } // apply the dead zone - const float minValue = mDeadZone; + const float minValue = m_deadZone; const float maxValue = 1.0f; const float range = maxValue - minValue; @@ -469,12 +456,12 @@ bool GameController::Update() for (uint32 i = 0; i < 8; ++i) { // get the current normalized value - float value = mDeviceElements[i].mValue; + float value = m_deviceElements[i].m_value; // ignore all values that are smaller than the dead zone - if (value > -mDeadZone && value < mDeadZone) + if (value > -m_deadZone && value < m_deadZone) { - mDeviceElements[i].mValue = 0.0f; + m_deviceElements[i].m_value = 0.0f; } else { @@ -487,14 +474,14 @@ bool GameController::Update() } // calculate the value in the new range excluding the dead zone range - const float newValue = (value - mDeadZone) / range; + const float newValue = (value - m_deadZone) / range; // set it back in normal or negated version - mDeviceElements[i].mValue = negativeValue == false ? newValue : -newValue; + m_deviceElements[i].m_value = negativeValue == false ? newValue : -newValue; } } - mValid = true; + m_valid = true; return true; } diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/GameController.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/GameController.h index f1ee2e0e9d..47cfb9ddfc 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/GameController.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/GameController.h @@ -59,7 +59,7 @@ public: ELEMTYPE_POV = 2 }; - GameController() { mDirectInput = nullptr; mJoystick = nullptr; mHWnd = nullptr; mDeadZone = 0.15f; mValid = false; } + GameController() { m_directInput = nullptr; m_joystick = nullptr; m_hWnd = nullptr; m_deadZone = 0.15f; m_valid = false; } ~GameController() { Shutdown(); } bool Init(HWND hWnd); @@ -67,61 +67,61 @@ public: void Calibrate(); void Shutdown(); - MCORE_INLINE IDirectInputDevice8* GetJoystick() const { return mJoystick; } // returns nullptr when no joystick found during init + MCORE_INLINE IDirectInputDevice8* GetJoystick() const { return m_joystick; } // returns nullptr when no joystick found during init - MCORE_INLINE const char* GetDeviceName() const { return mDeviceInfo.mName.c_str(); } - MCORE_INLINE const AZStd::string& GetDeviceNameString() const { return mDeviceInfo.mName; } - MCORE_INLINE uint32 GetNumButtons() const { return mDeviceInfo.mNumButtons; } - MCORE_INLINE uint32 GetNumSliders() const { return mDeviceInfo.mNumSliders; } - MCORE_INLINE uint32 GetNumPOVs() const { return mDeviceInfo.mNumPOVs; } - MCORE_INLINE uint32 GetNumAxes() const { return mDeviceInfo.mNumAxes; } - void SetDeadZone(float deadZone) { mDeadZone = deadZone; } - MCORE_INLINE float GetDeadZone() const { return mDeadZone; } + MCORE_INLINE const char* GetDeviceName() const { return m_deviceInfo.m_name.c_str(); } + MCORE_INLINE const AZStd::string& GetDeviceNameString() const { return m_deviceInfo.m_name; } + MCORE_INLINE uint32 GetNumButtons() const { return m_deviceInfo.m_numButtons; } + MCORE_INLINE uint32 GetNumSliders() const { return m_deviceInfo.m_numSliders; } + MCORE_INLINE uint32 GetNumPOVs() const { return m_deviceInfo.m_numPoVs; } + MCORE_INLINE uint32 GetNumAxes() const { return m_deviceInfo.m_numAxes; } + void SetDeadZone(float deadZone) { m_deadZone = deadZone; } + MCORE_INLINE float GetDeadZone() const { return m_deadZone; } const char* GetElementEnumName(uint32 index); uint32 FindElementIDByName(const AZStd::string& elementEnumName); - MCORE_INLINE bool GetIsPresent(uint32 elementID) const { return mDeviceElements[elementID].mPresent; } + MCORE_INLINE bool GetIsPresent(uint32 elementID) const { return m_deviceElements[elementID].m_present; } MCORE_INLINE bool GetIsButtonPressed(uint8 buttonIndex) const { if (buttonIndex < 128) { - return (mJoystickState.rgbButtons[buttonIndex] & 0x80) != 0; + return (m_joystickState.rgbButtons[buttonIndex] & 0x80) != 0; } return false; } - MCORE_INLINE float GetValue(uint32 elementID) const { return mDeviceElements[elementID].mValue; } - MCORE_INLINE const char* GetElementName(uint32 elementID) const { return mDeviceElements[elementID].mName.c_str(); } - MCORE_INLINE bool GetIsValid() const { return mValid; } + MCORE_INLINE float GetValue(uint32 elementID) const { return m_deviceElements[elementID].m_value; } + MCORE_INLINE const char* GetElementName(uint32 elementID) const { return m_deviceElements[elementID].m_name.c_str(); } + MCORE_INLINE bool GetIsValid() const { return m_valid; } private: struct DeviceInfo { MCORE_MEMORYOBJECTCATEGORY(GameController::DeviceInfo, EMFX_DEFAULT_ALIGNMENT, MEMCATEGORY_STANDARDPLUGINS_ANIMGRAPH); - AZStd::string mName; - uint32 mNumButtons; - uint32 mNumAxes; - uint32 mNumPOVs; - uint32 mNumSliders; + AZStd::string m_name; + uint32 m_numButtons; + uint32 m_numAxes; + uint32 m_numPoVs; + uint32 m_numSliders; }; struct DeviceElement { MCORE_MEMORYOBJECTCATEGORY(GameController::DeviceElement, EMFX_DEFAULT_ALIGNMENT, MEMCATEGORY_STANDARDPLUGINS_ANIMGRAPH); - AZStd::string mName; - float mValue; - float mCalibrationValue; - ElementType mType; - bool mPresent; + AZStd::string m_name; + float m_value; + float m_calibrationValue; + ElementType m_type; + bool m_present; }; struct EnumContext { MCORE_MEMORYOBJECTCATEGORY(GameController::EnumContext, EMFX_DEFAULT_ALIGNMENT, MEMCATEGORY_STANDARDPLUGINS_ANIMGRAPH); - DIJOYCONFIG* mPrefJoystickConfig; - bool mPrefJoystickConfigValid; + DIJOYCONFIG* m_prefJoystickConfig; + bool m_prefJoystickConfigValid; }; MCORE_INLINE void SetButtonPressed(uint8 buttonIndex, bool isPressed) @@ -132,23 +132,23 @@ private: } if (isPressed) { - mJoystickState.rgbButtons[buttonIndex] |= 0x80; + m_joystickState.rgbButtons[buttonIndex] |= 0x80; } else { - mJoystickState.rgbButtons[buttonIndex] &= ~0x80; + m_joystickState.rgbButtons[buttonIndex] &= ~0x80; } } - IDirectInput8* mDirectInput; - IDirectInputDevice8* mJoystick; - DIJOYSTATE2 mJoystickState; // DInput Joystick state - EnumContext mEnumContext; - HWND mHWnd; - DeviceInfo mDeviceInfo; - DeviceElement mDeviceElements[NUM_ELEMENTS]; - float mDeadZone; - bool mValid; + IDirectInput8* m_directInput; + IDirectInputDevice8* m_joystick; + DIJOYSTATE2 m_joystickState; // DInput Joystick state + EnumContext m_enumContext; + HWND m_hWnd; + DeviceInfo m_deviceInfo; + DeviceElement m_deviceElements[NUM_ELEMENTS]; + float m_deadZone; + bool m_valid; static BOOL CALLBACK EnumJoysticksCallback(const DIDEVICEINSTANCE* pdidInstance, void* pContext); static BOOL CALLBACK EnumObjectsCallback(const DIDEVICEOBJECTINSTANCE* pdidoi, void* pContext); diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/GameControllerWindow.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/GameControllerWindow.cpp index eeb765ce54..c17ff12947 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/GameControllerWindow.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/GameControllerWindow.cpp @@ -54,20 +54,20 @@ namespace EMStudio GameControllerWindow::GameControllerWindow(AnimGraphPlugin* plugin, QWidget* parent) : QWidget(parent) { - mPlugin = plugin; - mAnimGraph = nullptr; - mDynamicWidget = nullptr; - mPresetNameLineEdit = nullptr; - mParameterGridLayout = nullptr; - mDeadZoneValueLabel = nullptr; - mButtonGridLayout = nullptr; - mDeadZoneSlider = nullptr; - mPresetComboBox = nullptr; - mInterfaceTimerID = MCORE_INVALIDINDEX32; - mGameControllerTimerID = MCORE_INVALIDINDEX32; - mString.reserve(4096); + m_plugin = plugin; + m_animGraph = nullptr; + m_dynamicWidget = nullptr; + m_presetNameLineEdit = nullptr; + m_parameterGridLayout = nullptr; + m_deadZoneValueLabel = nullptr; + m_buttonGridLayout = nullptr; + m_deadZoneSlider = nullptr; + m_presetComboBox = nullptr; + m_interfaceTimerId = MCORE_INVALIDINDEX32; + m_gameControllerTimerId = MCORE_INVALIDINDEX32; + m_string.reserve(4096); #if AZ_TRAIT_EMOTIONFX_HAS_GAME_CONTROLLER - mGameController = nullptr; + m_gameController = nullptr; #endif Init(); @@ -78,29 +78,29 @@ namespace EMStudio GameControllerWindow::~GameControllerWindow() { // stop the timers - mInterfaceTimer.stop(); - mGameControllerTimer.stop(); + m_interfaceTimer.stop(); + m_gameControllerTimer.stop(); // unregister the command callbacks and get rid of the memory - GetCommandManager()->RemoveCommandCallback(mCreateCallback, false); - GetCommandManager()->RemoveCommandCallback(mRemoveCallback, false); - GetCommandManager()->RemoveCommandCallback(mAdjustCallback, false); - GetCommandManager()->RemoveCommandCallback(mSelectCallback, false); - GetCommandManager()->RemoveCommandCallback(mUnselectCallback, false); - GetCommandManager()->RemoveCommandCallback(mClearSelectionCallback, false); - delete mCreateCallback; - delete mRemoveCallback; - delete mAdjustCallback; - delete mClearSelectionCallback; - delete mSelectCallback; - delete mUnselectCallback; + GetCommandManager()->RemoveCommandCallback(m_createCallback, false); + GetCommandManager()->RemoveCommandCallback(m_removeCallback, false); + GetCommandManager()->RemoveCommandCallback(m_adjustCallback, false); + GetCommandManager()->RemoveCommandCallback(m_selectCallback, false); + GetCommandManager()->RemoveCommandCallback(m_unselectCallback, false); + GetCommandManager()->RemoveCommandCallback(m_clearSelectionCallback, false); + delete m_createCallback; + delete m_removeCallback; + delete m_adjustCallback; + delete m_clearSelectionCallback; + delete m_selectCallback; + delete m_unselectCallback; // get rid of the game controller #if AZ_TRAIT_EMOTIONFX_HAS_GAME_CONTROLLER - if (mGameController) + if (m_gameController) { - mGameController->Shutdown(); - delete mGameController; + m_gameController->Shutdown(); + delete m_gameController; } #endif } @@ -110,20 +110,20 @@ namespace EMStudio void GameControllerWindow::Init() { // create the callbacks - mCreateCallback = new CommandCreateBlendParameterCallback(false); - mRemoveCallback = new CommandRemoveBlendParameterCallback(false); - mAdjustCallback = new CommandAdjustBlendParameterCallback(false); - mSelectCallback = new CommandSelectCallback(false); - mUnselectCallback = new CommandUnselectCallback(false); - mClearSelectionCallback = new CommandClearSelectionCallback(false); + m_createCallback = new CommandCreateBlendParameterCallback(false); + m_removeCallback = new CommandRemoveBlendParameterCallback(false); + m_adjustCallback = new CommandAdjustBlendParameterCallback(false); + m_selectCallback = new CommandSelectCallback(false); + m_unselectCallback = new CommandUnselectCallback(false); + m_clearSelectionCallback = new CommandClearSelectionCallback(false); // hook the callbacks to the commands - GetCommandManager()->RegisterCommandCallback("AnimGraphCreateParameter", mCreateCallback); - GetCommandManager()->RegisterCommandCallback("AnimGraphRemoveParameter", mRemoveCallback); - GetCommandManager()->RegisterCommandCallback("AnimGraphAdjustParameter", mAdjustCallback); - GetCommandManager()->RegisterCommandCallback("Select", mSelectCallback); - GetCommandManager()->RegisterCommandCallback("Unselect", mUnselectCallback); - GetCommandManager()->RegisterCommandCallback("ClearSelection", mClearSelectionCallback); + GetCommandManager()->RegisterCommandCallback("AnimGraphCreateParameter", m_createCallback); + GetCommandManager()->RegisterCommandCallback("AnimGraphRemoveParameter", m_removeCallback); + GetCommandManager()->RegisterCommandCallback("AnimGraphAdjustParameter", m_adjustCallback); + GetCommandManager()->RegisterCommandCallback("Select", m_selectCallback); + GetCommandManager()->RegisterCommandCallback("Unselect", m_unselectCallback); + GetCommandManager()->RegisterCommandCallback("ClearSelection", m_clearSelectionCallback); InitGameController(); @@ -132,11 +132,11 @@ namespace EMStudio setLayout(layout); // create the dialog stack - mDialogStack = new MysticQt::DialogStack(); - layout->addWidget(mDialogStack); + m_dialogStack = new MysticQt::DialogStack(); + layout->addWidget(m_dialogStack); // add the game controller - mGameControllerComboBox = new QComboBox(); + m_gameControllerComboBox = new QComboBox(); UpdateGameControllerComboBox(); QHBoxLayout* gameControllerLayout = new QHBoxLayout(); @@ -144,44 +144,44 @@ namespace EMStudio QLabel* activeControllerLabel = new QLabel("Active Controller:"); activeControllerLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); gameControllerLayout->addWidget(activeControllerLabel); - gameControllerLayout->addWidget(mGameControllerComboBox); + gameControllerLayout->addWidget(m_gameControllerComboBox); gameControllerLayout->addWidget(EMStudioManager::MakeSeperatorLabel(1, 20)); // create the presets interface QHBoxLayout* horizontalLayout = new QHBoxLayout(); horizontalLayout->setMargin(0); - mPresetComboBox = new QComboBox(); - mAddPresetButton = new QPushButton(); - mRemovePresetButton = new QPushButton(); - mPresetNameLineEdit = new QLineEdit(); + m_presetComboBox = new QComboBox(); + m_addPresetButton = new QPushButton(); + m_removePresetButton = new QPushButton(); + m_presetNameLineEdit = new QLineEdit(); - connect(mPresetComboBox, static_cast(&QComboBox::currentIndexChanged), this, &GameControllerWindow::OnPresetComboBox); - connect(mAddPresetButton, &QPushButton::clicked, this, &GameControllerWindow::OnAddPresetButton); - connect(mRemovePresetButton, &QPushButton::clicked, this, &GameControllerWindow::OnRemovePresetButton); - connect(mPresetNameLineEdit, &QLineEdit::textEdited, this, &GameControllerWindow::OnPresetNameEdited); - connect(mPresetNameLineEdit, &QLineEdit::returnPressed, this, &GameControllerWindow::OnPresetNameChanged); + connect(m_presetComboBox, static_cast(&QComboBox::currentIndexChanged), this, &GameControllerWindow::OnPresetComboBox); + connect(m_addPresetButton, &QPushButton::clicked, this, &GameControllerWindow::OnAddPresetButton); + connect(m_removePresetButton, &QPushButton::clicked, this, &GameControllerWindow::OnRemovePresetButton); + connect(m_presetNameLineEdit, &QLineEdit::textEdited, this, &GameControllerWindow::OnPresetNameEdited); + connect(m_presetNameLineEdit, &QLineEdit::returnPressed, this, &GameControllerWindow::OnPresetNameChanged); - EMStudioManager::MakeTransparentButton(mAddPresetButton, "Images/Icons/Plus.svg", "Add a game controller preset"); - EMStudioManager::MakeTransparentButton(mRemovePresetButton, "Images/Icons/Remove.svg", "Remove a game controller preset"); + EMStudioManager::MakeTransparentButton(m_addPresetButton, "Images/Icons/Plus.svg", "Add a game controller preset"); + EMStudioManager::MakeTransparentButton(m_removePresetButton, "Images/Icons/Remove.svg", "Remove a game controller preset"); QHBoxLayout* buttonsLayout = new QHBoxLayout(); - buttonsLayout->addWidget(mAddPresetButton); - buttonsLayout->addWidget(mRemovePresetButton); + buttonsLayout->addWidget(m_addPresetButton); + buttonsLayout->addWidget(m_removePresetButton); buttonsLayout->setSpacing(0); buttonsLayout->setMargin(0); horizontalLayout->addWidget(new QLabel("Preset:")); - horizontalLayout->addWidget(mPresetComboBox); + horizontalLayout->addWidget(m_presetComboBox); horizontalLayout->addLayout(buttonsLayout); - horizontalLayout->addWidget(mPresetNameLineEdit); + horizontalLayout->addWidget(m_presetNameLineEdit); gameControllerLayout->addLayout(horizontalLayout); QWidget* dummyWidget = new QWidget(); dummyWidget->setObjectName("StyledWidgetDark"); dummyWidget->setLayout(gameControllerLayout); - mDialogStack->Add(dummyWidget, "Game Controller And Preset Selection"); - connect(mGameControllerComboBox, static_cast(&QComboBox::currentIndexChanged), this, &GameControllerWindow::OnGameControllerComboBox); + m_dialogStack->Add(dummyWidget, "Game Controller And Preset Selection"); + connect(m_gameControllerComboBox, static_cast(&QComboBox::currentIndexChanged), this, &GameControllerWindow::OnGameControllerComboBox); DisablePresetInterface(); AutoSelectGameController(); @@ -195,13 +195,13 @@ namespace EMStudio { #if AZ_TRAIT_EMOTIONFX_HAS_GAME_CONTROLLER // this will call ReInit(); - if (mGameController->GetDeviceNameString().empty() == false && mGameControllerComboBox->count() > 1) + if (m_gameController->GetDeviceNameString().empty() == false && m_gameControllerComboBox->count() > 1) { - mGameControllerComboBox->setCurrentIndex(1); + m_gameControllerComboBox->setCurrentIndex(1); } else { - mGameControllerComboBox->setCurrentIndex(0); + m_gameControllerComboBox->setCurrentIndex(0); } #endif } @@ -211,15 +211,15 @@ namespace EMStudio void GameControllerWindow::InitGameController() { #if AZ_TRAIT_EMOTIONFX_HAS_GAME_CONTROLLER - if (mGameController) + if (m_gameController) { - mGameController->Shutdown(); - delete mGameController; - mGameController = nullptr; + m_gameController->Shutdown(); + delete m_gameController; + m_gameController = nullptr; } // create the game controller object - mGameController = new GameController(); + m_gameController = new GameController(); // Call mainWindow->window() to make sure you get the top level window which the mainWindow might not in fact be. //IEditor* editor = nullptr; @@ -227,7 +227,7 @@ namespace EMStudio //QMainWindow* mainWindow = editor->GetEditorMainWindow(); //HWND hWnd = reinterpret_cast( mainWindow->window()->winId() ); HWND hWnd = nullptr; - if (mGameController->Init(hWnd) == false) + if (m_gameController->Init(hWnd) == false) { MCore::LogError("Cannot initialize game controller."); } @@ -238,19 +238,19 @@ namespace EMStudio void GameControllerWindow::UpdateGameControllerComboBox() { // clear it and add the none option - mGameControllerComboBox->clear(); - mGameControllerComboBox->addItem(NO_GAMECONTROLLER_NAME); + m_gameControllerComboBox->clear(); + m_gameControllerComboBox->addItem(NO_GAMECONTROLLER_NAME); // add the gamepad in case it is valid and the device name is not empty #if AZ_TRAIT_EMOTIONFX_HAS_GAME_CONTROLLER - if (mGameController->GetIsValid() && mGameController->GetDeviceNameString().empty() == false) + if (m_gameController->GetIsValid() && m_gameController->GetDeviceNameString().empty() == false) { - mGameControllerComboBox->addItem(mGameController->GetDeviceName()); + m_gameControllerComboBox->addItem(m_gameController->GetDeviceName()); } #endif // always adjust the size of the combobox to the currently selected text - mGameControllerComboBox->setSizeAdjustPolicy(QComboBox::AdjustToContents); + m_gameControllerComboBox->setSizeAdjustPolicy(QComboBox::AdjustToContents); } @@ -264,24 +264,24 @@ namespace EMStudio ReInit(); // update the parameter window - mPlugin->GetParameterWindow()->Reinit(/*forceReinit*/true); + m_plugin->GetParameterWindow()->Reinit(/*forceReinit*/true); } void GameControllerWindow::DisablePresetInterface() { - mPresetComboBox->blockSignals(true); - mPresetComboBox->clear(); - mPresetComboBox->blockSignals(false); + m_presetComboBox->blockSignals(true); + m_presetComboBox->clear(); + m_presetComboBox->blockSignals(false); - mPresetNameLineEdit->blockSignals(true); - mPresetNameLineEdit->setText(""); - mPresetNameLineEdit->blockSignals(false); + m_presetNameLineEdit->blockSignals(true); + m_presetNameLineEdit->setText(""); + m_presetNameLineEdit->blockSignals(false); - mPresetComboBox->setEnabled(false); - mPresetNameLineEdit->setEnabled(false); - mAddPresetButton->setEnabled(false); - mRemovePresetButton->setEnabled(false); + m_presetComboBox->setEnabled(false); + m_presetNameLineEdit->setEnabled(false); + m_addPresetButton->setEnabled(false); + m_removePresetButton->setEnabled(false); } @@ -289,21 +289,21 @@ namespace EMStudio void GameControllerWindow::ReInit() { // get the anim graph - EMotionFX::AnimGraph* animGraph = mPlugin->GetActiveAnimGraph(); - mAnimGraph = animGraph; + EMotionFX::AnimGraph* animGraph = m_plugin->GetActiveAnimGraph(); + m_animGraph = animGraph; // remove all existing items - if (mDynamicWidget) + if (m_dynamicWidget) { - mDialogStack->Remove(mDynamicWidget); + m_dialogStack->Remove(m_dynamicWidget); } - mDynamicWidget = nullptr; - mInterfaceTimer.stop(); - mGameControllerTimer.stop(); + m_dynamicWidget = nullptr; + m_interfaceTimer.stop(); + m_gameControllerTimer.stop(); // check if we need to recreate the dynamic widget #if AZ_TRAIT_EMOTIONFX_HAS_GAME_CONTROLLER - if (mGameController->GetIsValid() == false || mGameControllerComboBox->currentText() != mGameController->GetDeviceName()) + if (m_gameController->GetIsValid() == false || m_gameControllerComboBox->currentText() != m_gameController->GetDeviceName()) { DisablePresetInterface(); return; @@ -320,8 +320,8 @@ namespace EMStudio } // create the dynamic widget - mDynamicWidget = new QWidget(); - mDynamicWidget->setObjectName("StyledWidgetDark"); + m_dynamicWidget = new QWidget(); + m_dynamicWidget->setObjectName("StyledWidgetDark"); // get the game controller settings from the anim graph EMotionFX::AnimGraphGameControllerSettings& gameControllerSettings = animGraph->GetGameControllerSettings(); @@ -340,16 +340,16 @@ namespace EMStudio EMotionFX::AnimGraphGameControllerSettings::Preset* activePreset = gameControllerSettings.GetActivePreset(); // create the parameter grid layout - mParameterGridLayout = new QGridLayout(); - mParameterGridLayout->setAlignment(Qt::AlignTop); - mParameterGridLayout->setMargin(0); + m_parameterGridLayout = new QGridLayout(); + m_parameterGridLayout->setAlignment(Qt::AlignTop); + m_parameterGridLayout->setMargin(0); // add all parameters - mParameterInfos.clear(); + m_parameterInfos.clear(); const EMotionFX::ValueParameterVector& parameters = animGraph->RecursivelyGetValueParameters(); const int numParameters = aznumeric_caster(parameters.size()); - mParameterInfos.reserve(numParameters); + m_parameterInfos.reserve(numParameters); for (int parameterIndex = 0; parameterIndex < numParameters; ++parameterIndex) { @@ -373,7 +373,7 @@ namespace EMStudio QLabel* label = new QLabel(labelString.c_str()); label->setToolTip(parameter->GetDescription().c_str()); label->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); - mParameterGridLayout->addWidget(label, static_cast(parameterIndex), 0); + m_parameterGridLayout->addWidget(label, static_cast(parameterIndex), 0); // add the axis combo box to the layout QComboBox* axesComboBox = new QComboBox(); @@ -389,10 +389,10 @@ namespace EMStudio for (uint32 j = 0; j < GameController::NUM_ELEMENTS; ++j) { // check if the element is present and add it to the combo box if yes - if (mGameController->GetIsPresent(j)) + if (m_gameController->GetIsPresent(j)) { // add the name of the element to the combo box - axesComboBox->addItem(mGameController->GetElementEnumName(j)); + axesComboBox->addItem(m_gameController->GetElementEnumName(j)); // in case the current element is the one the parameter is assigned to, remember the correct index if (j == settingsInfo->m_axis) @@ -408,7 +408,7 @@ namespace EMStudio else if (parameter->GetType() == MCore::AttributeVector2::TYPE_ID) { uint32 numPresentElements = 0; - if (mGameController->GetIsPresent(GameController::ELEM_POS_X) && mGameController->GetIsPresent(GameController::ELEM_POS_Y)) + if (m_gameController->GetIsPresent(GameController::ELEM_POS_X) && m_gameController->GetIsPresent(GameController::ELEM_POS_Y)) { axesComboBox->addItem("Pos XY"); if (settingsInfo->m_axis == 0) @@ -418,7 +418,7 @@ namespace EMStudio numPresentElements++; } - if (mGameController->GetIsPresent(GameController::ELEM_ROT_X) && mGameController->GetIsPresent(GameController::ELEM_ROT_Y)) + if (m_gameController->GetIsPresent(GameController::ELEM_ROT_X) && m_gameController->GetIsPresent(GameController::ELEM_ROT_Y)) { axesComboBox->addItem("Rot XY"); if (settingsInfo->m_axis == 1) @@ -433,7 +433,7 @@ namespace EMStudio // select the given axis in the combo box or select none if there is no assignment yet or the assigned axis wasn't found on the current game controller axesComboBox->setCurrentIndex(selectedComboItem); - mParameterGridLayout->addWidget(axesComboBox, static_cast(parameterIndex), 1); + m_parameterGridLayout->addWidget(axesComboBox, static_cast(parameterIndex), 1); // add the mode combo box to the layout QComboBox* modeComboBox = new QComboBox(); @@ -446,7 +446,7 @@ namespace EMStudio modeComboBox->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed); connect(modeComboBox, static_cast(&QComboBox::currentIndexChanged), this, &GameControllerWindow::OnParameterModeComboBox); modeComboBox->setCurrentIndex(settingsInfo->m_mode); - mParameterGridLayout->addWidget(modeComboBox, static_cast(parameterIndex), 2); + m_parameterGridLayout->addWidget(modeComboBox, static_cast(parameterIndex), 2); // add the invert checkbox to the layout QHBoxLayout* invertCheckBoxLayout = new QHBoxLayout(); @@ -459,7 +459,7 @@ namespace EMStudio connect(invertCheckbox, &QCheckBox::stateChanged, this, &GameControllerWindow::OnInvertCheckBoxChanged); invertCheckbox->setCheckState(settingsInfo->m_invert ? Qt::Checked : Qt::Unchecked); invertCheckBoxLayout->addWidget(invertCheckbox); - mParameterGridLayout->addLayout(invertCheckBoxLayout, static_cast(parameterIndex), 3); + m_parameterGridLayout->addLayout(invertCheckBoxLayout, static_cast(parameterIndex), 3); // add the current value edit field to the layout QLineEdit* valueEdit = new QLineEdit(); @@ -468,42 +468,42 @@ namespace EMStudio valueEdit->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); valueEdit->setMinimumWidth(70); valueEdit->setMaximumWidth(70); - mParameterGridLayout->addWidget(valueEdit, static_cast(parameterIndex), 4); + m_parameterGridLayout->addWidget(valueEdit, static_cast(parameterIndex), 4); // create the parameter info and add it to the array ParameterInfo paramInfo; - paramInfo.mParameter = parameter; - paramInfo.mAxis = axesComboBox; - paramInfo.mMode = modeComboBox; - paramInfo.mInvert = invertCheckbox; - paramInfo.mValue = valueEdit; - mParameterInfos.emplace_back(paramInfo); + paramInfo.m_parameter = parameter; + paramInfo.m_axis = axesComboBox; + paramInfo.m_mode = modeComboBox; + paramInfo.m_invert = invertCheckbox; + paramInfo.m_value = valueEdit; + m_parameterInfos.emplace_back(paramInfo); // update the interface UpdateParameterInterface(¶mInfo); } // create the button layout - mButtonGridLayout = new QGridLayout(); - mButtonGridLayout->setAlignment(Qt::AlignTop); - mButtonGridLayout->setMargin(0); + m_buttonGridLayout = new QGridLayout(); + m_buttonGridLayout->setAlignment(Qt::AlignTop); + m_buttonGridLayout->setMargin(0); // clear the button infos - mButtonInfos.clear(); + m_buttonInfos.clear(); // get the number of buttons and iterate through them #if AZ_TRAIT_EMOTIONFX_HAS_GAME_CONTROLLER - const uint32 numButtons = mGameController->GetNumButtons(); + const uint32 numButtons = m_gameController->GetNumButtons(); for (uint32 i = 0; i < numButtons; ++i) { EMotionFX::AnimGraphGameControllerSettings::ButtonInfo* settingsInfo = activePreset->FindButtonInfo(i); MCORE_ASSERT(settingsInfo); // add the button name to the layout - mString = AZStd::string::format("Button %s%d", (i < 10) ? "0" : "", i); - QLabel* nameLabel = new QLabel(mString.c_str()); + m_string = AZStd::string::format("Button %s%d", (i < 10) ? "0" : "", i); + QLabel* nameLabel = new QLabel(m_string.c_str()); nameLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); - mButtonGridLayout->addWidget(nameLabel, i, 0); + m_buttonGridLayout->addWidget(nameLabel, i, 0); // add the mode combo box to the layout QComboBox* modeComboBox = new QComboBox(); @@ -517,17 +517,17 @@ namespace EMStudio modeComboBox->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed); connect(modeComboBox, static_cast(&QComboBox::currentIndexChanged), this, &GameControllerWindow::OnButtonModeComboBox); modeComboBox->setCurrentIndex(settingsInfo->m_mode); - mButtonGridLayout->addWidget(modeComboBox, i, 1); + m_buttonGridLayout->addWidget(modeComboBox, i, 1); - mButtonInfos.emplace_back(ButtonInfo(i, modeComboBox)); + m_buttonInfos.emplace_back(ButtonInfo(i, modeComboBox)); // reinit the dynamic part of the button layout ReInitButtonInterface(i); } // real time preview of the controller - mPreviewLabels.clear(); - mPreviewLabels.resize(GameController::NUM_ELEMENTS + 1); + m_previewLabels.clear(); + m_previewLabels.resize(GameController::NUM_ELEMENTS + 1); QVBoxLayout* realtimePreviewLayout = new QVBoxLayout(); QGridLayout* previewGridLayout = new QGridLayout(); previewGridLayout->setAlignment(Qt::AlignTop); @@ -535,30 +535,30 @@ namespace EMStudio uint32 realTimePreviewLabelCounter = 0; for (uint32 i = 0; i < GameController::NUM_ELEMENTS; ++i) { - if (mGameController->GetIsPresent(i)) + if (m_gameController->GetIsPresent(i)) { - QLabel* elementNameLabel = new QLabel(mGameController->GetElementEnumName(i)); + QLabel* elementNameLabel = new QLabel(m_gameController->GetElementEnumName(i)); elementNameLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); previewGridLayout->addWidget(elementNameLabel, realTimePreviewLabelCounter, 0); - mPreviewLabels[i] = new QLabel(); - previewGridLayout->addWidget(mPreviewLabels[i], realTimePreviewLabelCounter, 1, Qt::AlignLeft); + m_previewLabels[i] = new QLabel(); + previewGridLayout->addWidget(m_previewLabels[i], realTimePreviewLabelCounter, 1, Qt::AlignLeft); realTimePreviewLabelCounter++; } else { - mPreviewLabels[i] = nullptr; + m_previewLabels[i] = nullptr; } } realtimePreviewLayout->addLayout(previewGridLayout); // add the special case label for the pressed buttons - mPreviewLabels[GameController::NUM_ELEMENTS] = new QLabel(); + m_previewLabels[GameController::NUM_ELEMENTS] = new QLabel(); QLabel* realtimeButtonNameLabel = new QLabel("Buttons"); realtimeButtonNameLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); previewGridLayout->addWidget(realtimeButtonNameLabel, realTimePreviewLabelCounter, 0); - previewGridLayout->addWidget(mPreviewLabels[GameController::NUM_ELEMENTS], realTimePreviewLabelCounter, 1, Qt::AlignLeft); + previewGridLayout->addWidget(m_previewLabels[GameController::NUM_ELEMENTS], realTimePreviewLabelCounter, 1, Qt::AlignLeft); // add the dead zone elements QHBoxLayout* deadZoneLayout = new QHBoxLayout(); @@ -568,26 +568,26 @@ namespace EMStudio deadZoneLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); previewGridLayout->addWidget(deadZoneLabel, realTimePreviewLabelCounter + 1, 0); - mDeadZoneSlider = new AzQtComponents::SliderInt(Qt::Horizontal); - mDeadZoneSlider->setRange(1, 90); - mDeadZoneSlider->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); - deadZoneLayout->addWidget(mDeadZoneSlider); + m_deadZoneSlider = new AzQtComponents::SliderInt(Qt::Horizontal); + m_deadZoneSlider->setRange(1, 90); + m_deadZoneSlider->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); + deadZoneLayout->addWidget(m_deadZoneSlider); - mDeadZoneValueLabel = new QLabel(); - deadZoneLayout->addWidget(mDeadZoneValueLabel); + m_deadZoneValueLabel = new QLabel(); + deadZoneLayout->addWidget(m_deadZoneValueLabel); previewGridLayout->addLayout(deadZoneLayout, realTimePreviewLabelCounter + 1, 1); - mDeadZoneSlider->setValue(aznumeric_cast(mGameController->GetDeadZone() * 100)); - mString = AZStd::string::format("%.2f", mGameController->GetDeadZone()); - mDeadZoneValueLabel->setText(mString.c_str()); - connect(mDeadZoneSlider, &AzQtComponents::SliderInt::valueChanged, this, &GameControllerWindow::OnDeadZoneSliderChanged); + m_deadZoneSlider->setValue(aznumeric_cast(m_gameController->GetDeadZone() * 100)); + m_string = AZStd::string::format("%.2f", m_gameController->GetDeadZone()); + m_deadZoneValueLabel->setText(m_string.c_str()); + connect(m_deadZoneSlider, &AzQtComponents::SliderInt::valueChanged, this, &GameControllerWindow::OnDeadZoneSliderChanged); #endif // start the timers - mInterfaceTimer.start(1000 / 20, this); - mInterfaceTimerID = mInterfaceTimer.timerId(); - mGameControllerTimer.start(1000 / 100, this); - mGameControllerTimerID = mGameControllerTimer.timerId(); + m_interfaceTimer.start(1000 / 20, this); + m_interfaceTimerId = m_interfaceTimer.timerId(); + m_gameControllerTimer.start(1000 / 100, this); + m_gameControllerTimerId = m_gameControllerTimer.timerId(); // create the vertical layout for the parameter and the button setup QVBoxLayout* verticalLayout = new QVBoxLayout(); @@ -595,34 +595,34 @@ namespace EMStudio //////////////////////////// - mPresetComboBox->blockSignals(true); - mPresetComboBox->clear(); + m_presetComboBox->blockSignals(true); + m_presetComboBox->clear(); // add the presets to the combo box for (size_t i = 0; i < numPresets; ++i) { - mPresetComboBox->addItem(gameControllerSettings.GetPreset(i)->GetName()); + m_presetComboBox->addItem(gameControllerSettings.GetPreset(i)->GetName()); } // select the active preset const size_t activePresetIndex = gameControllerSettings.GetActivePresetIndex(); if (activePresetIndex != InvalidIndex) { - mPresetComboBox->setCurrentIndex(aznumeric_caster(activePresetIndex)); + m_presetComboBox->setCurrentIndex(aznumeric_caster(activePresetIndex)); } - mPresetComboBox->blockSignals(false); + m_presetComboBox->blockSignals(false); // set the name of the active preset if (gameControllerSettings.GetActivePreset()) { - mPresetNameLineEdit->blockSignals(true); - mPresetNameLineEdit->setText(gameControllerSettings.GetActivePreset()->GetName()); - mPresetNameLineEdit->blockSignals(false); + m_presetNameLineEdit->blockSignals(true); + m_presetNameLineEdit->setText(gameControllerSettings.GetActivePreset()->GetName()); + m_presetNameLineEdit->blockSignals(false); } - mPresetComboBox->setEnabled(true); - mPresetNameLineEdit->setEnabled(true); - mAddPresetButton->setEnabled(true); - mRemovePresetButton->setEnabled(true); + m_presetComboBox->setEnabled(true); + m_presetNameLineEdit->setEnabled(true); + m_addPresetButton->setEnabled(true); + m_removePresetButton->setEnabled(true); //////////////////////////// @@ -658,9 +658,9 @@ namespace EMStudio buttonNameLayout->addWidget(spacerItem); verticalLayout->addLayout(parameterNameLayout); - verticalLayout->addLayout(mParameterGridLayout); + verticalLayout->addLayout(m_parameterGridLayout); verticalLayout->addLayout(buttonNameLayout); - verticalLayout->addLayout(mButtonGridLayout); + verticalLayout->addLayout(m_buttonGridLayout); // main dynamic widget layout QHBoxLayout* dynamicWidgetLayout = new QHBoxLayout(); @@ -679,18 +679,18 @@ namespace EMStudio dynamicWidgetLayout->addWidget(realTimePreviewWidget); dynamicWidgetLayout->setAlignment(realTimePreviewWidget, Qt::AlignTop); #endif - mDynamicWidget->setLayout(dynamicWidgetLayout); + m_dynamicWidget->setLayout(dynamicWidgetLayout); - mDialogStack->Add(mDynamicWidget, "Game Controller Mapping", false, true); + m_dialogStack->Add(m_dynamicWidget, "Game Controller Mapping", false, true); } void GameControllerWindow::OnDeadZoneSliderChanged(int value) { #if AZ_TRAIT_EMOTIONFX_HAS_GAME_CONTROLLER - mGameController->SetDeadZone(value * 0.01f); - mString = AZStd::string::format("%.2f", value * 0.01f); - mDeadZoneValueLabel->setText(mString.c_str()); + m_gameController->SetDeadZone(value * 0.01f); + m_string = AZStd::string::format("%.2f", value * 0.01f); + m_deadZoneValueLabel->setText(m_string.c_str()); #else MCORE_UNUSED(value); #endif @@ -700,22 +700,22 @@ namespace EMStudio GameControllerWindow::ButtonInfo* GameControllerWindow::FindButtonInfo(QWidget* widget) { // get the number of button infos and iterate through them - const auto foundButtonInfo = AZStd::find_if(begin(mButtonInfos), end(mButtonInfos), [widget](const ButtonInfo& buttonInfo) + const auto foundButtonInfo = AZStd::find_if(begin(m_buttonInfos), end(m_buttonInfos), [widget](const ButtonInfo& buttonInfo) { - return buttonInfo.mWidget == widget; + return buttonInfo.m_widget == widget; }); - return foundButtonInfo != end(mButtonInfos) ? &(*foundButtonInfo) : nullptr; + return foundButtonInfo != end(m_buttonInfos) ? &(*foundButtonInfo) : nullptr; } GameControllerWindow::ParameterInfo* GameControllerWindow::FindParamInfoByModeComboBox(QComboBox* comboBox) { // get the number of parameter infos and iterate through them - const auto foundParameterInfo = AZStd::find_if(begin(mParameterInfos), end(mParameterInfos), [comboBox](const ParameterInfo& parameterInfo) + const auto foundParameterInfo = AZStd::find_if(begin(m_parameterInfos), end(m_parameterInfos), [comboBox](const ParameterInfo& parameterInfo) { - return parameterInfo.mMode == comboBox; + return parameterInfo.m_mode == comboBox; }); - return foundParameterInfo != end(mParameterInfos) ? &(*foundParameterInfo) : nullptr; + return foundParameterInfo != end(m_parameterInfos) ? &(*foundParameterInfo) : nullptr; } @@ -723,30 +723,30 @@ namespace EMStudio GameControllerWindow::ParameterInfo* GameControllerWindow::FindButtonInfoByAttributeInfo(const EMotionFX::Parameter* parameter) { // get the number of parameter infos and iterate through them - const auto foundParameterInfo = AZStd::find_if(begin(mParameterInfos), end(mParameterInfos), [parameter](const ParameterInfo& parameterInfo) + const auto foundParameterInfo = AZStd::find_if(begin(m_parameterInfos), end(m_parameterInfos), [parameter](const ParameterInfo& parameterInfo) { - return parameterInfo.mParameter == parameter; + return parameterInfo.m_parameter == parameter; }); - return foundParameterInfo != end(mParameterInfos) ? &(*foundParameterInfo) : nullptr; + return foundParameterInfo != end(m_parameterInfos) ? &(*foundParameterInfo) : nullptr; } // enable/disable controls for a given parameter void GameControllerWindow::UpdateParameterInterface(ParameterInfo* parameterInfo) { - int comboAxisIndex = parameterInfo->mAxis->currentIndex(); + int comboAxisIndex = parameterInfo->m_axis->currentIndex(); if (comboAxisIndex == 0) // None { - parameterInfo->mMode->setEnabled(false); - parameterInfo->mInvert->setEnabled(false); - parameterInfo->mValue->setEnabled(false); - parameterInfo->mValue->setText(""); + parameterInfo->m_mode->setEnabled(false); + parameterInfo->m_invert->setEnabled(false); + parameterInfo->m_value->setEnabled(false); + parameterInfo->m_value->setText(""); } else // some mode set { - parameterInfo->mMode->setEnabled(true); - parameterInfo->mInvert->setEnabled(true); - parameterInfo->mValue->setEnabled(true); + parameterInfo->m_mode->setEnabled(true); + parameterInfo->m_invert->setEnabled(true); + parameterInfo->m_value->setEnabled(true); } } @@ -756,7 +756,7 @@ namespace EMStudio MCORE_UNUSED(value); // get the game controller settings from the current anim graph - EMotionFX::AnimGraphGameControllerSettings& gameControllerSettings = mAnimGraph->GetGameControllerSettings(); + EMotionFX::AnimGraphGameControllerSettings& gameControllerSettings = m_animGraph->GetGameControllerSettings(); // get the active preset EMotionFX::AnimGraphGameControllerSettings::Preset* activePreset = gameControllerSettings.GetActivePreset(); @@ -772,7 +772,7 @@ namespace EMStudio return; } - EMotionFX::AnimGraphGameControllerSettings::ParameterInfo* settingsInfo = activePreset->FindParameterInfo(paramInfo->mParameter->GetName().c_str()); + EMotionFX::AnimGraphGameControllerSettings::ParameterInfo* settingsInfo = activePreset->FindParameterInfo(paramInfo->m_parameter->GetName().c_str()); MCORE_ASSERT(settingsInfo); settingsInfo->m_mode = (EMotionFX::AnimGraphGameControllerSettings::ParameterMode)combo->currentIndex(); } @@ -781,7 +781,7 @@ namespace EMStudio void GameControllerWindow::ReInitButtonInterface(uint32 buttonIndex) { // get the game controller settings from the current anim graph - EMotionFX::AnimGraphGameControllerSettings& gameControllerSettings = mAnimGraph->GetGameControllerSettings(); + EMotionFX::AnimGraphGameControllerSettings& gameControllerSettings = m_animGraph->GetGameControllerSettings(); // get the active preset EMotionFX::AnimGraphGameControllerSettings::Preset* activePreset = gameControllerSettings.GetActivePreset(); @@ -794,7 +794,7 @@ namespace EMStudio MCORE_ASSERT(settingsInfo); // remove the old widget - QLayoutItem* oldLayoutItem = mButtonGridLayout->itemAtPosition(buttonIndex, 2); + QLayoutItem* oldLayoutItem = m_buttonGridLayout->itemAtPosition(buttonIndex, 2); if (oldLayoutItem) { QWidget* oldWidget = oldLayoutItem->widget(); @@ -850,7 +850,7 @@ namespace EMStudio layout->setMargin(0); QComboBox* comboBox = new QComboBox(); - const EMotionFX::ValueParameterVector& valueParameters = mAnimGraph->RecursivelyGetValueParameters(); + const EMotionFX::ValueParameterVector& valueParameters = m_animGraph->RecursivelyGetValueParameters(); for (const EMotionFX::ValueParameter* valueParameter : valueParameters) { if (azrtti_typeid(valueParameter) == azrtti_typeid() || @@ -888,7 +888,7 @@ namespace EMStudio if (widget) { - mButtonGridLayout->addWidget(widget, buttonIndex, 2); + m_buttonGridLayout->addWidget(widget, buttonIndex, 2); } } @@ -905,7 +905,7 @@ namespace EMStudio } // get the game controller settings from the current anim graph - EMotionFX::AnimGraphGameControllerSettings& gameControllerSettings = mAnimGraph->GetGameControllerSettings(); + EMotionFX::AnimGraphGameControllerSettings& gameControllerSettings = m_animGraph->GetGameControllerSettings(); // get the active preset EMotionFX::AnimGraphGameControllerSettings::Preset* activePreset = gameControllerSettings.GetActivePreset(); @@ -936,8 +936,8 @@ namespace EMStudio return; } - settingsInfo->m_string = selectedStates[0].mNodeName.c_str(); - browseEdit->setPlaceholderText(selectedStates[0].mNodeName.c_str()); + settingsInfo->m_string = selectedStates[0].m_nodeName.c_str(); + browseEdit->setPlaceholderText(selectedStates[0].m_nodeName.c_str()); } @@ -947,7 +947,7 @@ namespace EMStudio MCORE_UNUSED(value); // get the game controller settings from the current anim graph - EMotionFX::AnimGraphGameControllerSettings& gameControllerSettings = mAnimGraph->GetGameControllerSettings(); + EMotionFX::AnimGraphGameControllerSettings& gameControllerSettings = m_animGraph->GetGameControllerSettings(); // get the active preset EMotionFX::AnimGraphGameControllerSettings::Preset* activePreset = gameControllerSettings.GetActivePreset(); @@ -963,7 +963,7 @@ namespace EMStudio MCORE_ASSERT(settingsInfo); const AZStd::string parameterName = combo->currentText().toUtf8().data(); - const EMotionFX::Parameter* parameter = mAnimGraph->FindParameterByName(parameterName); + const EMotionFX::Parameter* parameter = m_animGraph->FindParameterByName(parameterName); if (parameter) { settingsInfo->m_string = parameter->GetName(); @@ -974,7 +974,7 @@ namespace EMStudio } // update the parameter window - mPlugin->GetParameterWindow()->Reinit(/*forceReinit*/true); + m_plugin->GetParameterWindow()->Reinit(/*forceReinit*/true); } @@ -984,7 +984,7 @@ namespace EMStudio MCORE_UNUSED(value); // get the game controller settings from the current anim graph - EMotionFX::AnimGraphGameControllerSettings& gameControllerSettings = mAnimGraph->GetGameControllerSettings(); + EMotionFX::AnimGraphGameControllerSettings& gameControllerSettings = m_animGraph->GetGameControllerSettings(); // get the active preset EMotionFX::AnimGraphGameControllerSettings::Preset* activePreset = gameControllerSettings.GetActivePreset(); @@ -1000,7 +1000,7 @@ namespace EMStudio return; } - EMotionFX::AnimGraphGameControllerSettings::ButtonInfo* settingsInfo = activePreset->FindButtonInfo(buttonInfo->mButtonIndex); + EMotionFX::AnimGraphGameControllerSettings::ButtonInfo* settingsInfo = activePreset->FindButtonInfo(buttonInfo->m_buttonIndex); MCORE_ASSERT(settingsInfo); settingsInfo->m_mode = (EMotionFX::AnimGraphGameControllerSettings::ButtonMode)combo->currentIndex(); @@ -1010,7 +1010,7 @@ namespace EMStudio { // The parameter name is empty in case the button info has not been assigned with one yet. // Default it to the first compatible parameter. - const EMotionFX::ValueParameterVector& valueParameters = mAnimGraph->RecursivelyGetValueParameters(); + const EMotionFX::ValueParameterVector& valueParameters = m_animGraph->RecursivelyGetValueParameters(); for (const EMotionFX::ValueParameter* valueParameter : valueParameters) { if (azrtti_typeid(valueParameter) == azrtti_typeid() || @@ -1022,27 +1022,27 @@ namespace EMStudio } } - ReInitButtonInterface(buttonInfo->mButtonIndex); + ReInitButtonInterface(buttonInfo->m_buttonIndex); // update the parameter window - mPlugin->GetParameterWindow()->Reinit(/*forceReinit*/true); + m_plugin->GetParameterWindow()->Reinit(/*forceReinit*/true); } void GameControllerWindow::OnAddPresetButton() { // get the game controller settings from the current anim graph - EMotionFX::AnimGraphGameControllerSettings& gameControllerSettings = mAnimGraph->GetGameControllerSettings(); + EMotionFX::AnimGraphGameControllerSettings& gameControllerSettings = m_animGraph->GetGameControllerSettings(); size_t presetNumber = gameControllerSettings.GetNumPresets(); - mString = AZStd::string::format("Preset %zu", presetNumber); - while (gameControllerSettings.FindPresetIndexByName(mString.c_str()) != InvalidIndex) + m_string = AZStd::string::format("Preset %zu", presetNumber); + while (gameControllerSettings.FindPresetIndexByName(m_string.c_str()) != InvalidIndex) { presetNumber++; - mString = AZStd::string::format("Preset %zu", presetNumber); + m_string = AZStd::string::format("Preset %zu", presetNumber); } - EMotionFX::AnimGraphGameControllerSettings::Preset* preset = aznew EMotionFX::AnimGraphGameControllerSettings::Preset(mString.c_str()); + EMotionFX::AnimGraphGameControllerSettings::Preset* preset = aznew EMotionFX::AnimGraphGameControllerSettings::Preset(m_string.c_str()); gameControllerSettings.AddPreset(preset); ReInit(); @@ -1054,7 +1054,7 @@ namespace EMStudio MCORE_UNUSED(value); // get the game controller settings from the current anim graph - EMotionFX::AnimGraphGameControllerSettings& gameControllerSettings = mAnimGraph->GetGameControllerSettings(); + EMotionFX::AnimGraphGameControllerSettings& gameControllerSettings = m_animGraph->GetGameControllerSettings(); QComboBox* combo = qobject_cast(sender()); EMotionFX::AnimGraphGameControllerSettings::Preset* preset = gameControllerSettings.GetPreset(combo->currentIndex()); @@ -1067,9 +1067,9 @@ namespace EMStudio void GameControllerWindow::OnRemovePresetButton() { // get the game controller settings from the current anim graph - EMotionFX::AnimGraphGameControllerSettings& gameControllerSettings = mAnimGraph->GetGameControllerSettings(); + EMotionFX::AnimGraphGameControllerSettings& gameControllerSettings = m_animGraph->GetGameControllerSettings(); - uint32 presetIndex = mPresetComboBox->currentIndex(); + uint32 presetIndex = m_presetComboBox->currentIndex(); gameControllerSettings.RemovePreset(presetIndex); EMotionFX::AnimGraphGameControllerSettings::Preset* preset = nullptr; @@ -1094,7 +1094,7 @@ namespace EMStudio void GameControllerWindow::OnPresetNameChanged() { // get the game controller settings from the current anim graph - EMotionFX::AnimGraphGameControllerSettings& gameControllerSettings = mAnimGraph->GetGameControllerSettings(); + EMotionFX::AnimGraphGameControllerSettings& gameControllerSettings = m_animGraph->GetGameControllerSettings(); assert(sender()->inherits("QLineEdit")); QLineEdit* widget = qobject_cast(sender()); @@ -1102,7 +1102,7 @@ namespace EMStudio FromQtString(widget->text(), &newValue); // get the currently selected preset - uint32 presetIndex = mPresetComboBox->currentIndex(); + uint32 presetIndex = m_presetComboBox->currentIndex(); size_t newValueIndex = gameControllerSettings.FindPresetIndexByName(newValue.c_str()); if (newValueIndex == InvalidIndex) @@ -1117,28 +1117,28 @@ namespace EMStudio void GameControllerWindow::OnPresetNameEdited(const QString& text) { // get the game controller settings from the current anim graph - EMotionFX::AnimGraphGameControllerSettings& gameControllerSettings = mAnimGraph->GetGameControllerSettings(); + EMotionFX::AnimGraphGameControllerSettings& gameControllerSettings = m_animGraph->GetGameControllerSettings(); // check if there already is a preset with the currently entered name size_t presetIndex = gameControllerSettings.FindPresetIndexByName(FromQtString(text).c_str()); if (presetIndex != InvalidIndex && presetIndex != gameControllerSettings.GetActivePresetIndex()) { - GetManager()->SetWidgetAsInvalidInput(mPresetNameLineEdit); + GetManager()->SetWidgetAsInvalidInput(m_presetNameLineEdit); } else { - mPresetNameLineEdit->setStyleSheet(""); + m_presetNameLineEdit->setStyleSheet(""); } } GameControllerWindow::ParameterInfo* GameControllerWindow::FindParamInfoByAxisComboBox(QComboBox* comboBox) { - const auto foundParameterInfo = AZStd::find_if(begin(mParameterInfos), end(mParameterInfos), [comboBox](const ParameterInfo& parameterInfo) + const auto foundParameterInfo = AZStd::find_if(begin(m_parameterInfos), end(m_parameterInfos), [comboBox](const ParameterInfo& parameterInfo) { - return parameterInfo.mAxis == comboBox; + return parameterInfo.m_axis == comboBox; }); - return foundParameterInfo != end(mParameterInfos) ? &(*foundParameterInfo) : nullptr; + return foundParameterInfo != end(m_parameterInfos) ? &(*foundParameterInfo) : nullptr; } @@ -1147,7 +1147,7 @@ namespace EMStudio MCORE_UNUSED(value); // get the game controller settings from the current anim graph - EMotionFX::AnimGraphGameControllerSettings& gameControllerSettings = mAnimGraph->GetGameControllerSettings(); + EMotionFX::AnimGraphGameControllerSettings& gameControllerSettings = m_animGraph->GetGameControllerSettings(); // get the active preset EMotionFX::AnimGraphGameControllerSettings::Preset* activePreset = gameControllerSettings.GetActivePreset(); @@ -1163,13 +1163,13 @@ namespace EMStudio return; } - EMotionFX::AnimGraphGameControllerSettings::ParameterInfo* settingsInfo = activePreset->FindParameterInfo(paramInfo->mParameter->GetName().c_str()); + EMotionFX::AnimGraphGameControllerSettings::ParameterInfo* settingsInfo = activePreset->FindParameterInfo(paramInfo->m_parameter->GetName().c_str()); MCORE_ASSERT(settingsInfo); #if AZ_TRAIT_EMOTIONFX_HAS_GAME_CONTROLLER - if (azrtti_istypeof(paramInfo->mParameter)) + if (azrtti_istypeof(paramInfo->m_parameter)) { - const uint32 elementID = mGameController->FindElementIDByName(FromQtString(combo->currentText()).c_str()); + const uint32 elementID = m_gameController->FindElementIDByName(FromQtString(combo->currentText()).c_str()); if (elementID >= MCORE_INVALIDINDEX8) { settingsInfo->m_axis = MCORE_INVALIDINDEX8; @@ -1180,7 +1180,7 @@ namespace EMStudio } } else - if (azrtti_typeid(paramInfo->mParameter) == azrtti_typeid()) + if (azrtti_typeid(paramInfo->m_parameter) == azrtti_typeid()) { if (value == 0) { @@ -1199,17 +1199,17 @@ namespace EMStudio UpdateParameterInterface(paramInfo); // update the parameter window - mPlugin->GetParameterWindow()->Reinit(/*forceReinit*/true); + m_plugin->GetParameterWindow()->Reinit(/*forceReinit*/true); } GameControllerWindow::ParameterInfo* GameControllerWindow::FindParamInfoByCheckBox(QCheckBox* checkBox) { - const auto foundParameterInfo = AZStd::find_if(begin(mParameterInfos), end(mParameterInfos), [checkBox](const ParameterInfo& parameterInfo) + const auto foundParameterInfo = AZStd::find_if(begin(m_parameterInfos), end(m_parameterInfos), [checkBox](const ParameterInfo& parameterInfo) { - return parameterInfo.mInvert == checkBox; + return parameterInfo.m_invert == checkBox; }); - return foundParameterInfo != end(mParameterInfos) ? &(*foundParameterInfo) : nullptr; + return foundParameterInfo != end(m_parameterInfos) ? &(*foundParameterInfo) : nullptr; } @@ -1218,7 +1218,7 @@ namespace EMStudio MCORE_UNUSED(state); // get the game controller settings from the current anim graph - EMotionFX::AnimGraphGameControllerSettings& gameControllerSettings = mAnimGraph->GetGameControllerSettings(); + EMotionFX::AnimGraphGameControllerSettings& gameControllerSettings = m_animGraph->GetGameControllerSettings(); // get the active preset EMotionFX::AnimGraphGameControllerSettings::Preset* activePreset = gameControllerSettings.GetActivePreset(); @@ -1234,7 +1234,7 @@ namespace EMStudio return; } - EMotionFX::AnimGraphGameControllerSettings::ParameterInfo* settingsInfo = activePreset->FindParameterInfo(paramInfo->mParameter->GetName().c_str()); + EMotionFX::AnimGraphGameControllerSettings::ParameterInfo* settingsInfo = activePreset->FindParameterInfo(paramInfo->m_parameter->GetName().c_str()); MCORE_ASSERT(settingsInfo); settingsInfo->m_invert = checkBox->checkState() == Qt::Checked ? true : false; } @@ -1248,7 +1248,7 @@ namespace EMStudio UpdateGameControllerComboBox(); AutoSelectGameController(); ReInit(); - mPlugin->GetParameterWindow()->Reinit(/*forceReinit*/true); + m_plugin->GetParameterWindow()->Reinit(/*forceReinit*/true); } @@ -1266,10 +1266,10 @@ namespace EMStudio // update the game controller #if AZ_TRAIT_EMOTIONFX_HAS_GAME_CONTROLLER - mGameController->Update(); + m_gameController->Update(); // check if the game controller is usable and if we have actually checked it in the combobox, if not return directly - if (mGameController->GetIsValid() == false || mGameControllerComboBox->currentIndex() == 0) + if (m_gameController->GetIsValid() == false || m_gameControllerComboBox->currentIndex() == 0) { return; } @@ -1290,7 +1290,7 @@ namespace EMStudio animGraphInstance = actorInstance->GetAnimGraphInstance(); if (animGraphInstance) { - if (animGraphInstance->GetAnimGraph() != mAnimGraph) // if the selected anim graph instance isn't equal to the one of the actor instance + if (animGraphInstance->GetAnimGraph() != m_animGraph) // if the selected anim graph instance isn't equal to the one of the actor instance { return; } @@ -1301,7 +1301,7 @@ namespace EMStudio } // get the game controller settings from the anim graph - EMotionFX::AnimGraphGameControllerSettings& gameControllerSettings = mAnimGraph->GetGameControllerSettings(); + EMotionFX::AnimGraphGameControllerSettings& gameControllerSettings = m_animGraph->GetGameControllerSettings(); // get the active preset EMotionFX::AnimGraphGameControllerSettings::Preset* activePreset = gameControllerSettings.GetActivePreset(); @@ -1310,10 +1310,10 @@ namespace EMStudio return; } - const float timeDelta = mDeltaTimer.StampAndGetDeltaTimeInSeconds(); + const float timeDelta = m_deltaTimer.StampAndGetDeltaTimeInSeconds(); // get the number of parameters and iterate through them - const EMotionFX::ValueParameterVector& valueParameters = mAnimGraph->RecursivelyGetValueParameters(); + const EMotionFX::ValueParameterVector& valueParameters = m_animGraph->RecursivelyGetValueParameters(); const size_t valueParametersCount = valueParameters.size(); for (size_t parameterIndex = 0; parameterIndex < valueParametersCount; ++parameterIndex) { @@ -1334,7 +1334,7 @@ namespace EMStudio if (attribute->GetType() == MCore::AttributeFloat::TYPE_ID) { // get the current value from the game controller - float value = mGameController->GetValue(settingsInfo->m_axis); + float value = m_gameController->GetValue(settingsInfo->m_axis); const EMotionFX::FloatParameter* floatParameter = static_cast(valueParameter); const float minValue = floatParameter->GetMinValue(); const float maxValue = floatParameter->GetMaxValue(); @@ -1421,7 +1421,7 @@ namespace EMStudio // only process in case the parameter info is enabled if (settingsInfo->m_enabled) { - AZ::Quaternion localRot = actorInstance->GetLocalSpaceTransform().mRotation; + AZ::Quaternion localRot = actorInstance->GetLocalSpaceTransform().m_rotation; localRot = localRot * MCore::CreateFromAxisAndAngle(AZ::Vector3(0.0f, 0.0f, 1.0f), value * timeDelta * 3.0f); actorInstance->SetLocalSpaceRotation(localRot); } @@ -1438,20 +1438,20 @@ namespace EMStudio } // check if we also need to update the attribute widget in the parameter window - if (event->timerId() == mInterfaceTimerID) + if (event->timerId() == m_interfaceTimerId) { // find the corresponding attribute widget and set the value in case the parameter info is enabled if (settingsInfo->m_enabled) { - mPlugin->GetParameterWindow()->UpdateParameterValue(valueParameter); + m_plugin->GetParameterWindow()->UpdateParameterValue(valueParameter); } // also update the preview value in the game controller window ParameterInfo* interfaceParamInfo = FindButtonInfoByAttributeInfo(valueParameter); if (interfaceParamInfo) { - mString = AZStd::string::format("%.2f", value); - interfaceParamInfo->mValue->setText(mString.c_str()); + m_string = AZStd::string::format("%.2f", value); + interfaceParamInfo->m_value->setText(m_string.c_str()); } } } // if it's a float attribute @@ -1461,13 +1461,13 @@ namespace EMStudio AZ::Vector2 value(0.0f, 0.0f); if (settingsInfo->m_axis == 0) { - value.SetX(mGameController->GetValue(GameController::ELEM_POS_X)); - value.SetY(mGameController->GetValue(GameController::ELEM_POS_Y)); + value.SetX(m_gameController->GetValue(GameController::ELEM_POS_X)); + value.SetY(m_gameController->GetValue(GameController::ELEM_POS_Y)); } else { - value.SetX(mGameController->GetValue(GameController::ELEM_ROT_X)); - value.SetY(mGameController->GetValue(GameController::ELEM_ROT_Y)); + value.SetX(m_gameController->GetValue(GameController::ELEM_ROT_X)); + value.SetY(m_gameController->GetValue(GameController::ELEM_ROT_Y)); } const EMotionFX::Vector2Parameter* vector2Parameter = static_cast(valueParameter); @@ -1577,7 +1577,7 @@ namespace EMStudio // only process in case the parameter info is enabled if (settingsInfo->m_enabled) { - AZ::Quaternion localRot = actorInstance->GetLocalSpaceTransform().mRotation; + AZ::Quaternion localRot = actorInstance->GetLocalSpaceTransform().m_rotation; localRot = localRot * MCore::CreateFromAxisAndAngle(AZ::Vector3(0.0f, 0.0f, 1.0f), value.GetX() * timeDelta * 3.0f); actorInstance->SetLocalSpaceRotation(localRot); } @@ -1596,30 +1596,30 @@ namespace EMStudio } // check if we also need to update the attribute widget in the parameter window - if (event->timerId() == mInterfaceTimerID) + if (event->timerId() == m_interfaceTimerId) { // find the corresponding attribute widget and set the value in case the parameter info is enabled if (settingsInfo->m_enabled) { - mPlugin->GetParameterWindow()->UpdateParameterValue(valueParameter); + m_plugin->GetParameterWindow()->UpdateParameterValue(valueParameter); } // also update the preview value in the game controller window ParameterInfo* interfaceParamInfo = FindButtonInfoByAttributeInfo(valueParameter); if (interfaceParamInfo) { - mString = AZStd::string::format("%.2f, %.2f", value.GetX(), value.GetY()); - interfaceParamInfo->mValue->setText(mString.c_str()); + m_string = AZStd::string::format("%.2f, %.2f", value.GetX(), value.GetY()); + interfaceParamInfo->m_value->setText(m_string.c_str()); } } } // if it's a vector2 attribute } // for all parameters // update the buttons - const uint32 numButtons = mGameController->GetNumButtons(); + const uint32 numButtons = m_gameController->GetNumButtons(); for (uint32 i = 0; i < numButtons; ++i) { - const bool isPressed = mGameController->GetIsButtonPressed(i); + const bool isPressed = m_gameController->GetIsButtonPressed(i); // get the game controller settings info for the given button EMotionFX::AnimGraphGameControllerSettings::ButtonInfo* settingsInfo = activePreset->FindButtonInfo(i); @@ -1637,7 +1637,7 @@ namespace EMStudio } // Find the corresponding value parameter. - const AZ::Outcome parameterIndex = mAnimGraph->FindValueParameterIndexByName(settingsInfo->m_string); + const AZ::Outcome parameterIndex = m_animGraph->FindValueParameterIndexByName(settingsInfo->m_string); MCore::AttributeBool* boolAttribute = nullptr; if (parameterIndex.IsSuccess()) @@ -1680,10 +1680,10 @@ namespace EMStudio } // check if we also need to update the attribute widget in the parameter window - if (event->timerId() == mInterfaceTimerID) + if (event->timerId() == m_interfaceTimerId) { - const EMotionFX::ValueParameter* valueParameter = mAnimGraph->FindValueParameter(parameterIndex.GetValue()); - mPlugin->GetParameterWindow()->UpdateParameterValue(valueParameter); + const EMotionFX::ValueParameter* valueParameter = m_animGraph->FindValueParameter(parameterIndex.GetValue()); + m_plugin->GetParameterWindow()->UpdateParameterValue(valueParameter); } } @@ -1697,10 +1697,10 @@ namespace EMStudio boolAttribute->SetValue(isPressed ? true : false); // check if we also need to update the attribute widget in the parameter window - if (event->timerId() == mInterfaceTimerID) + if (event->timerId() == m_interfaceTimerId) { - const EMotionFX::ValueParameter* valueParameter = mAnimGraph->FindValueParameter(parameterIndex.GetValue()); - mPlugin->GetParameterWindow()->UpdateParameterValue(valueParameter); + const EMotionFX::ValueParameter* valueParameter = m_animGraph->FindValueParameter(parameterIndex.GetValue()); + m_plugin->GetParameterWindow()->UpdateParameterValue(valueParameter); } } @@ -1714,10 +1714,10 @@ namespace EMStudio boolAttribute->SetValue((!isPressed) ? true : false); // check if we also need to update the attribute widget in the parameter window - if (event->timerId() == mInterfaceTimerID) + if (event->timerId() == m_interfaceTimerId) { - const EMotionFX::ValueParameter* valueParameter = mAnimGraph->FindValueParameter(parameterIndex.GetValue()); - mPlugin->GetParameterWindow()->UpdateParameterValue(valueParameter); + const EMotionFX::ValueParameter* valueParameter = m_animGraph->FindValueParameter(parameterIndex.GetValue()); + m_plugin->GetParameterWindow()->UpdateParameterValue(valueParameter); } } @@ -1751,10 +1751,10 @@ namespace EMStudio } // check if we also need to update the attribute widget in the parameter window - if (event->timerId() == mInterfaceTimerID) + if (event->timerId() == m_interfaceTimerId) { - const EMotionFX::ValueParameter* valueParameter = mAnimGraph->FindValueParameter(parameterIndex.GetValue()); - mPlugin->GetParameterWindow()->UpdateParameterValue(valueParameter); + const EMotionFX::ValueParameter* valueParameter = m_animGraph->FindValueParameter(parameterIndex.GetValue()); + m_plugin->GetParameterWindow()->UpdateParameterValue(valueParameter); } } @@ -1767,43 +1767,43 @@ namespace EMStudio } // check if the interface timer is ticking - if (event->timerId() == mInterfaceTimerID) + if (event->timerId() == m_interfaceTimerId) { // update the interface elements for (uint32 i = 0; i < GameController::NUM_ELEMENTS; ++i) { - if (mGameController->GetIsPresent(i)) + if (m_gameController->GetIsPresent(i)) { - const float value = mGameController->GetValue(i); + const float value = m_gameController->GetValue(i); if (value > 1000.0f) { - mString.clear(); + m_string.clear(); } else { - mString = AZStd::string::format("%.2f", value); + m_string = AZStd::string::format("%.2f", value); } - mPreviewLabels[i]->setText(mString.c_str()); + m_previewLabels[i]->setText(m_string.c_str()); } } // update the active button string - mString.clear(); + m_string.clear(); for (uint32 i = 0; i < numButtons; ++i) { - if (mGameController->GetIsButtonPressed(i)) + if (m_gameController->GetIsButtonPressed(i)) { - mString += AZStd::string::format("%s%d ", (i < 10) ? "0" : "", i); + m_string += AZStd::string::format("%s%d ", (i < 10) ? "0" : "", i); } } - if (mString.size() == 0) + if (m_string.size() == 0) { - mPreviewLabels[GameController::NUM_ELEMENTS]->setText(" "); + m_previewLabels[GameController::NUM_ELEMENTS]->setText(" "); } else { - mPreviewLabels[GameController::NUM_ELEMENTS]->setText(mString.c_str()); + m_previewLabels[GameController::NUM_ELEMENTS]->setText(m_string.c_str()); } } #endif diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/GameControllerWindow.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/GameControllerWindow.h index c9ea776337..059108625a 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/GameControllerWindow.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/GameControllerWindow.h @@ -71,15 +71,15 @@ namespace EMStudio MCORE_INLINE bool GetIsGameControllerValid() const { #if AZ_TRAIT_EMOTIONFX_HAS_GAME_CONTROLLER - if (mGameController == nullptr) + if (m_gameController == nullptr) { return false; } - if (mGameControllerComboBox->currentIndex() == 0) + if (m_gameControllerComboBox->currentIndex() == 0) { return false; } - return mGameController->GetIsValid(); + return m_gameController->GetIsValid(); #else return false; #endif @@ -112,22 +112,22 @@ namespace EMStudio MCORE_DEFINECOMMANDCALLBACK(CommandUnselectCallback); MCORE_DEFINECOMMANDCALLBACK(CommandClearSelectionCallback); - CommandCreateBlendParameterCallback* mCreateCallback; - CommandRemoveBlendParameterCallback* mRemoveCallback; - CommandAdjustBlendParameterCallback* mAdjustCallback; - CommandSelectCallback* mSelectCallback; - CommandUnselectCallback* mUnselectCallback; - CommandClearSelectionCallback* mClearSelectionCallback; + CommandCreateBlendParameterCallback* m_createCallback; + CommandRemoveBlendParameterCallback* m_removeCallback; + CommandAdjustBlendParameterCallback* m_adjustCallback; + CommandSelectCallback* m_selectCallback; + CommandUnselectCallback* m_unselectCallback; + CommandClearSelectionCallback* m_clearSelectionCallback; struct ParameterInfo { MCORE_MEMORYOBJECTCATEGORY(GameControllerWindow::ParameterInfo, EMFX_DEFAULT_ALIGNMENT, MEMCATEGORY_STANDARDPLUGINS_ANIMGRAPH); - const EMotionFX::Parameter* mParameter; - QComboBox* mAxis; - QComboBox* mMode; - QCheckBox* mInvert; - QLineEdit* mValue; + const EMotionFX::Parameter* m_parameter; + QComboBox* m_axis; + QComboBox* m_mode; + QCheckBox* m_invert; + QLineEdit* m_value; }; struct ButtonInfo @@ -135,12 +135,12 @@ namespace EMStudio MCORE_MEMORYOBJECTCATEGORY(GameControllerWindow::ButtonInfo, EMFX_DEFAULT_ALIGNMENT, MEMCATEGORY_STANDARDPLUGINS_ANIMGRAPH); ButtonInfo(uint32 index, QWidget* widget) { - mButtonIndex = index; - mWidget = widget; + m_buttonIndex = index; + m_widget = widget; } - uint32 mButtonIndex; - QWidget* mWidget; + uint32 m_buttonIndex; + QWidget* m_widget; }; ParameterInfo* FindParamInfoByModeComboBox(QComboBox* comboBox); @@ -153,37 +153,37 @@ namespace EMStudio void UpdateParameterInterface(ParameterInfo* parameterInfo); void UpdateGameControllerComboBox(); - AnimGraphPlugin* mPlugin; - AZStd::vector mPreviewLabels; - AZStd::vector mParameterInfos; - AZStd::vector mButtonInfos; - QBasicTimer mInterfaceTimer; - QBasicTimer mGameControllerTimer; - AZ::Debug::Timer mDeltaTimer; - int mInterfaceTimerID; - int mGameControllerTimerID; + AnimGraphPlugin* m_plugin; + AZStd::vector m_previewLabels; + AZStd::vector m_parameterInfos; + AZStd::vector m_buttonInfos; + QBasicTimer m_interfaceTimer; + QBasicTimer m_gameControllerTimer; + AZ::Debug::Timer m_deltaTimer; + int m_interfaceTimerId; + int m_gameControllerTimerId; #if AZ_TRAIT_EMOTIONFX_HAS_GAME_CONTROLLER - GameController* mGameController; + GameController* m_gameController; #endif - EMotionFX::AnimGraph* mAnimGraph; + EMotionFX::AnimGraph* m_animGraph; - MysticQt::DialogStack* mDialogStack; + MysticQt::DialogStack* m_dialogStack; - QWidget* mDynamicWidget; - AzQtComponents::SliderInt* mDeadZoneSlider; - QLabel* mDeadZoneValueLabel; - QGridLayout* mParameterGridLayout; - QGridLayout* mButtonGridLayout; - QComboBox* mGameControllerComboBox; + QWidget* m_dynamicWidget; + AzQtComponents::SliderInt* m_deadZoneSlider; + QLabel* m_deadZoneValueLabel; + QGridLayout* m_parameterGridLayout; + QGridLayout* m_buttonGridLayout; + QComboBox* m_gameControllerComboBox; // preset interface elements - QComboBox* mPresetComboBox; - QLineEdit* mPresetNameLineEdit; - QPushButton* mAddPresetButton; - QPushButton* mRemovePresetButton; + QComboBox* m_presetComboBox; + QLineEdit* m_presetNameLineEdit; + QPushButton* m_addPresetButton; + QPushButton* m_removePresetButton; - AZStd::string mString; + AZStd::string m_string; void timerEvent(QTimerEvent* event); void InitGameController(); diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/GraphNode.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/GraphNode.cpp index 4f29a15669..75cca66e3d 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/GraphNode.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/GraphNode.cpp @@ -17,59 +17,59 @@ namespace EMStudio { // statics - QColor GraphNode::mPortHighlightColor = QColor(255, 128, 0); - QColor GraphNode::mPortHighlightBGColor = QColor(128, 64, 0); + QColor GraphNode::s_portHighlightColo = QColor(255, 128, 0); + QColor GraphNode::s_portHighlightBGColor = QColor(128, 64, 0); // constructor GraphNode::GraphNode(const QModelIndex& modelIndex, const char* name, AZ::u16 numInputs, AZ::u16 numOutputs) : m_modelIndex(modelIndex) { - mRect = QRect(0, 0, 200, 128); - mBaseColor = QColor(74, 63, 238); - mVisualizeColor = QColor(0, 255, 0); - mOpacity = 1.0f; - mFinalRect = mRect; - mIsDeletable = true; - mIsHighlighted = false; - mConFromOutputOnly = false; - mIsCollapsed = false; - mIsProcessed = false; - mIsUpdated = false; - mIsEnabled = true; - mVisualize = false; - mCanVisualize = false; - mVisualizeHighlighted = false; - mNameAndPortsUpdated = false; - mCanHaveChildren = false; - mHasVisualGraph = false; - mHasVisualOutputPorts = true; - mMaxInputWidth = 0; - mMaxOutputWidth = 0; + m_rect = QRect(0, 0, 200, 128); + m_baseColor = QColor(74, 63, 238); + m_visualizeColor = QColor(0, 255, 0); + m_opacity = 1.0f; + m_finalRect = m_rect; + m_isDeletable = true; + m_isHighlighted = false; + m_conFromOutputOnly = false; + m_isCollapsed = false; + m_isProcessed = false; + m_isUpdated = false; + m_isEnabled = true; + m_visualize = false; + m_canVisualize = false; + m_visualizeHighlighted = false; + m_nameAndPortsUpdated = false; + m_canHaveChildren = false; + m_hasVisualGraph = false; + m_hasVisualOutputPorts = true; + m_maxInputWidth = 0; + m_maxOutputWidth = 0; - mHeaderFont.setPixelSize(12); - mHeaderFont.setBold(true); - mPortNameFont.setPixelSize(9); - mInfoTextFont.setPixelSize(10); - mInfoTextFont.setBold(true); - mSubTitleFont.setPixelSize(10); + m_headerFont.setPixelSize(12); + m_headerFont.setBold(true); + m_portNameFont.setPixelSize(9); + m_infoTextFont.setPixelSize(10); + m_infoTextFont.setBold(true); + m_subTitleFont.setPixelSize(10); // has child node indicator - mSubstPoly.resize(4); + m_substPoly.resize(4); - mTextOptionsCenter.setAlignment(Qt::AlignCenter); - mTextOptionsCenterHV.setAlignment(Qt::AlignHCenter | Qt::AlignVCenter); - mTextOptionsAlignRight.setAlignment(Qt::AlignRight | Qt::AlignVCenter); - mTextOptionsAlignLeft.setAlignment(Qt::AlignLeft | Qt::AlignVCenter); + m_textOptionsCenter.setAlignment(Qt::AlignCenter); + m_textOptionsCenterHv.setAlignment(Qt::AlignHCenter | Qt::AlignVCenter); + m_textOptionsAlignRight.setAlignment(Qt::AlignRight | Qt::AlignVCenter); + m_textOptionsAlignLeft.setAlignment(Qt::AlignLeft | Qt::AlignVCenter); - mInputPorts.resize(numInputs); - mOutputPorts.resize(numOutputs); + m_inputPorts.resize(numInputs); + m_outputPorts.resize(numOutputs); // initialize the port metrics - mPortFontMetrics = new QFontMetrics(mPortNameFont); - mHeaderFontMetrics = new QFontMetrics(mHeaderFont); - mInfoFontMetrics = new QFontMetrics(mInfoTextFont); - mSubTitleFontMetrics = new QFontMetrics(mSubTitleFont); + m_portFontMetrics = new QFontMetrics(m_portNameFont); + m_headerFontMetrics = new QFontMetrics(m_headerFont); + m_infoFontMetrics = new QFontMetrics(m_infoTextFont); + m_subTitleFontMetrics = new QFontMetrics(m_subTitleFont); SetName(name, false); ResetBorderColor(); @@ -80,10 +80,10 @@ namespace EMStudio GraphNode::~GraphNode() { // delete the font metrics - delete mPortFontMetrics; - delete mHeaderFontMetrics; - delete mInfoFontMetrics; - delete mSubTitleFontMetrics; + delete m_portFontMetrics; + delete m_headerFontMetrics; + delete m_infoFontMetrics; + delete m_subTitleFontMetrics; RemoveAllConnections(); } @@ -93,55 +93,53 @@ namespace EMStudio void GraphNode::UpdateTextPixmap() { // init the title text - mTitleText.setTextOption(mTextOptionsCenter); - mTitleText.setTextFormat(Qt::PlainText); - mTitleText.setPerformanceHint(QStaticText::AggressiveCaching); - mTitleText.setTextWidth(mRect.width()); - mTitleText.setText(mElidedName); - mTitleText.prepare(QTransform(), mHeaderFont); + m_titleText.setTextOption(m_textOptionsCenter); + m_titleText.setTextFormat(Qt::PlainText); + m_titleText.setPerformanceHint(QStaticText::AggressiveCaching); + m_titleText.setTextWidth(m_rect.width()); + m_titleText.setText(m_elidedName); + m_titleText.prepare(QTransform(), m_headerFont); // init the title text - mSubTitleText.setTextOption(mTextOptionsCenter); - mSubTitleText.setTextFormat(Qt::PlainText); - mSubTitleText.setPerformanceHint(QStaticText::AggressiveCaching); - mSubTitleText.setTextWidth(mRect.width()); - mSubTitleText.setText(mElidedSubTitle); - mSubTitleText.prepare(QTransform(), mSubTitleFont); + m_subTitleText.setTextOption(m_textOptionsCenter); + m_subTitleText.setTextFormat(Qt::PlainText); + m_subTitleText.setPerformanceHint(QStaticText::AggressiveCaching); + m_subTitleText.setTextWidth(m_rect.width()); + m_subTitleText.setText(m_elidedSubTitle); + m_subTitleText.prepare(QTransform(), m_subTitleFont); // draw the info text QRect textRect; CalcInfoTextRect(textRect, true); - mInfoText.setTextOption(mTextOptionsCenterHV); - mInfoText.setTextFormat(Qt::PlainText); - mInfoText.setPerformanceHint(QStaticText::AggressiveCaching); - mInfoText.setTextWidth(mRect.width()); - mInfoText.setText(mElidedNodeInfo); - mInfoText.prepare(QTransform(), mSubTitleFont); + m_infoText.setTextOption(m_textOptionsCenterHv); + m_infoText.setTextFormat(Qt::PlainText); + m_infoText.setPerformanceHint(QStaticText::AggressiveCaching); + m_infoText.setTextWidth(m_rect.width()); + m_infoText.setText(m_elidedNodeInfo); + m_infoText.prepare(QTransform(), m_subTitleFont); // input ports - const size_t numInputs = mInputPorts.size(); - mInputPortText.resize(numInputs); + const size_t numInputs = m_inputPorts.size(); + m_inputPortText.resize(numInputs); for (size_t i = 0; i < numInputs; ++i) { - QStaticText& staticText = mInputPortText[i]; + QStaticText& staticText = m_inputPortText[i]; staticText.setTextFormat(Qt::PlainText); staticText.setPerformanceHint(QStaticText::AggressiveCaching); - // staticText.setTextWidth( mRect.width() ); - staticText.setText(mInputPorts[i].GetName()); - staticText.prepare(QTransform(), mPortNameFont); + staticText.setText(m_inputPorts[i].GetName()); + staticText.prepare(QTransform(), m_portNameFont); } // output ports - const size_t numOutputs = mOutputPorts.size(); - mOutputPortText.resize(numOutputs); + const size_t numOutputs = m_outputPorts.size(); + m_outputPortText.resize(numOutputs); for (size_t i = 0; i < numOutputs; ++i) { - QStaticText& staticText = mOutputPortText[i]; + QStaticText& staticText = m_outputPortText[i]; staticText.setTextFormat(Qt::PlainText); staticText.setPerformanceHint(QStaticText::AggressiveCaching); - // staticText.setTextWidth( mRect.width() ); - staticText.setText(mOutputPorts[i].GetName()); - staticText.prepare(QTransform(), mPortNameFont); + staticText.setText(m_outputPorts[i].GetName()); + staticText.prepare(QTransform(), m_portNameFont); } } @@ -149,20 +147,20 @@ namespace EMStudio // remove all node connections void GraphNode::RemoveAllConnections() { - for (NodeConnection* connection : mConnections) + for (NodeConnection* connection : m_connections) { delete connection; } - mConnections.clear(); + m_connections.clear(); } // set the name of the node void GraphNode::SetName(const char* name, bool updatePixmap) { - mName = name; - mElidedName = mHeaderFontMetrics->elidedText(name, Qt::ElideMiddle, MAX_NODEWIDTH); + m_name = name; + m_elidedName = m_headerFontMetrics->elidedText(name, Qt::ElideMiddle, MAX_NODEWIDTH); if (updatePixmap) { @@ -175,8 +173,8 @@ namespace EMStudio void GraphNode::SetSubTitle(const char* subTitle, bool updatePixmap) { - mSubTitle = subTitle; - mElidedSubTitle = mSubTitleFontMetrics->elidedText(subTitle, Qt::ElideMiddle, MAX_NODEWIDTH); + m_subTitle = subTitle; + m_elidedSubTitle = m_subTitleFontMetrics->elidedText(subTitle, Qt::ElideMiddle, MAX_NODEWIDTH); if (updatePixmap) { @@ -189,8 +187,8 @@ namespace EMStudio void GraphNode::SetNodeInfo(const AZStd::string& info) { - mNodeInfo = info; - mElidedNodeInfo = mInfoFontMetrics->elidedText(mNodeInfo.c_str(), Qt::ElideMiddle, MAX_NODEWIDTH - mMaxInputWidth - mMaxOutputWidth); + m_nodeInfo = info; + m_elidedNodeInfo = m_infoFontMetrics->elidedText(m_nodeInfo.c_str(), Qt::ElideMiddle, MAX_NODEWIDTH - m_maxInputWidth - m_maxOutputWidth); UpdateNameAndPorts(); UpdateRects(); @@ -201,18 +199,18 @@ namespace EMStudio void GraphNode::UpdateRects() { // calc window rect - mRect.setWidth(CalcRequiredWidth()); - mRect.setHeight(CalcRequiredHeight()); + m_rect.setWidth(CalcRequiredWidth()); + m_rect.setHeight(CalcRequiredHeight()); // calc the rect in screen space (after scrolling and zooming) - mFinalRect = mParentGraph->GetTransform().mapRect(mRect); + m_finalRect = m_parentGraph->GetTransform().mapRect(m_rect); } // adjust the collapsed state void GraphNode::SetIsCollapsed(bool collapsed) { - mIsCollapsed = collapsed; + m_isCollapsed = collapsed; UpdateRects(); UpdateTextPixmap(); } @@ -224,48 +222,46 @@ namespace EMStudio UpdateRects(); // check if this rect is visible - mIsVisible = mFinalRect.intersects(visibleRect); + m_isVisible = m_finalRect.intersects(visibleRect); // check if the node is visible and skip some calculations in case its not - mIsHighlighted = false; - mVisualizeHighlighted = false; - //if (mIsVisible) - //{ + m_isHighlighted = false; + m_visualizeHighlighted = false; // check if the mouse is over the node, if yes highlight the node - if (mIsVisible && mRect.contains(mousePos)) + if (m_isVisible && m_rect.contains(mousePos)) { - mIsHighlighted = true; + m_isHighlighted = true; } // set the arrow rect - mArrowRect.setCoords(mRect.left() + 5, mRect.top() + 9, mRect.left() + 17, mRect.top() + 20); + m_arrowRect.setCoords(m_rect.left() + 5, m_rect.top() + 9, m_rect.left() + 17, m_rect.top() + 20); // set the visualize rect - mVisualizeRect.setCoords(mRect.right() - 13, mRect.top() + 6, mRect.right() - 5, mRect.top() + 14); + m_visualizeRect.setCoords(m_rect.right() - 13, m_rect.top() + 6, m_rect.right() - 5, m_rect.top() + 14); // update the input ports and reset the port highlight flags - const AZ::u16 numInputPorts = aznumeric_caster(mInputPorts.size()); + const AZ::u16 numInputPorts = aznumeric_caster(m_inputPorts.size()); for (AZ::u16 i = 0; i < numInputPorts; ++i) { - mInputPorts[i].SetRect(CalcInputPortRect(i)); - mInputPorts[i].SetIsHighlighted(false); + m_inputPorts[i].SetRect(CalcInputPortRect(i)); + m_inputPorts[i].SetIsHighlighted(false); } // update the output ports and reset the port highlight flags - const AZ::u16 numOutputPorts = aznumeric_caster(mOutputPorts.size()); + const AZ::u16 numOutputPorts = aznumeric_caster(m_outputPorts.size()); for (AZ::u16 i = 0; i < numOutputPorts; ++i) { - mOutputPorts[i].SetRect(CalcOutputPortRect(i)); - mOutputPorts[i].SetIsHighlighted(false); + m_outputPorts[i].SetRect(CalcOutputPortRect(i)); + m_outputPorts[i].SetIsHighlighted(false); } // update the visualize highlight flag, only do this in case: // the mouse position is inside the node and we haven't zoomed too much out - if (mIsHighlighted && mParentGraph->GetScale() > 0.3f) + if (m_isHighlighted && m_parentGraph->GetScale() > 0.3f) { - if (mCanVisualize && GetIsInsideVisualizeRect(mousePos)) + if (m_canVisualize && GetIsInsideVisualizeRect(mousePos)) { - mVisualizeHighlighted = true; + m_visualizeHighlighted = true; } } @@ -273,11 +269,11 @@ namespace EMStudio // 1. the node is NOT collapsed // 2. we haven't zoomed too much out so that the ports aren't visible anymore // 3. the mouse position is inside the adjusted node rect, adjusted because the ports stand bit out of the node - if (mIsCollapsed == false && mParentGraph->GetScale() > 0.5f && mRect.adjusted(-6, 0, 6, 0).contains(mousePos)) + if (m_isCollapsed == false && m_parentGraph->GetScale() > 0.5f && m_rect.adjusted(-6, 0, 6, 0).contains(mousePos)) { // set the set highlight flags for the input ports bool highlightedPortFound = false; - for (NodePort& inputPort : mInputPorts) + for (NodePort& inputPort : m_inputPorts) { // get the input port and the corresponding rect const QRect& portRect = inputPort.GetRect(); @@ -295,7 +291,7 @@ namespace EMStudio if (highlightedPortFound == false) { // set the set highlight flags for the output ports - for (NodePort& outputPort : mOutputPorts) + for (NodePort& outputPort : m_outputPorts) { // get the output port and the corresponding rect const QRect& portRect = outputPort.GetRect(); @@ -322,7 +318,7 @@ namespace EMStudio void GraphNode::Render(QPainter& painter, QPen* pen, bool renderShadow) { // only render if the given node is visible - if (mIsVisible == false) + if (m_isVisible == false) { return; } @@ -336,8 +332,8 @@ namespace EMStudio RenderShadow(painter); } - float opacityFactor = mOpacity; - if (mIsEnabled == false) + float opacityFactor = m_opacity; + if (m_isEnabled == false) { opacityFactor *= 0.35f; } @@ -358,20 +354,11 @@ namespace EMStudio { borderColor.setRgb(255, 128, 0); - if (mParentGraph->GetScale() > 0.75f) + if (m_parentGraph->GetScale() > 0.75f) { pen->setWidth(2); } } - else - { - /* if (mHasError) - borderColor.setRgb(255,0,0); - else if (mIsProcessed) - borderColor.setRgb(255,0,255); - else - borderColor = mBorderColor;*/ - } // background and header colors QColor bgColor; @@ -381,9 +368,9 @@ namespace EMStudio } else // not selected { - if (mIsEnabled) + if (m_isEnabled) { - bgColor = mBaseColor; + bgColor = m_baseColor; } else { @@ -400,7 +387,7 @@ namespace EMStudio QColor textColor; if (!isSelected) { - if (mIsEnabled) + if (m_isEnabled) { textColor = Qt::white; } @@ -415,30 +402,30 @@ namespace EMStudio } - if (mIsCollapsed == false) + if (m_isCollapsed == false) { // is highlighted/hovered (on-mouse-over effect) - if (mIsHighlighted) + if (m_isHighlighted) { bgColor = bgColor.lighter(120); bgColor2 = bgColor2.lighter(120); } // draw the main rect - QLinearGradient bgGradient(0, mRect.top(), 0, mRect.bottom()); + QLinearGradient bgGradient(0, m_rect.top(), 0, m_rect.bottom()); bgGradient.setColorAt(0.0f, bgColor); bgGradient.setColorAt(1.0f, bgColor2); painter.setBrush(bgGradient); painter.setPen(borderColor); - painter.drawRoundedRect(mRect, BORDER_RADIUS, BORDER_RADIUS); + painter.drawRoundedRect(m_rect, BORDER_RADIUS, BORDER_RADIUS); // if the scale is so small that we can't see those small things anymore - QRect fullHeaderRect(mRect.left(), mRect.top(), mRect.width(), 25); - QRect headerRect(mRect.left(), mRect.top(), mRect.width(), 15); - QRect subHeaderRect(mRect.left(), mRect.top() + 13, mRect.width(), 10); + QRect fullHeaderRect(m_rect.left(), m_rect.top(), m_rect.width(), 25); + QRect headerRect(m_rect.left(), m_rect.top(), m_rect.width(), 15); + QRect subHeaderRect(m_rect.left(), m_rect.top() + 13, m_rect.width(), 10); // if the scale is so small that we can't see those small things anymore - if (mParentGraph->GetScale() < 0.3f) + if (m_parentGraph->GetScale() < 0.3f) { painter.setOpacity(1.0f); painter.setClipping(false); @@ -450,39 +437,28 @@ namespace EMStudio painter.setPen(borderColor); painter.setClipRect(fullHeaderRect, Qt::ReplaceClip); painter.setBrush(headerBgColor); - painter.drawRoundedRect(mRect, BORDER_RADIUS, BORDER_RADIUS); + painter.drawRoundedRect(m_rect, BORDER_RADIUS, BORDER_RADIUS); - // draw header text - // REPLACED BY PIXMAP - /*painter.setBrush( Qt::NoBrush ); - painter.setPen( textColor ); - painter.setFont( mHeaderFont ); - painter.drawText( headerRect, mElidedName, mTextOptionsCenter ); - - painter.setFont( mSubTitleFont ); - painter.setBrush( Qt::NoBrush ); - painter.setPen( textColor ); - painter.drawText( subHeaderRect, mElidedSubTitle, mTextOptionsCenter );*/ painter.setClipping(false); // if the scale is so small that we can't see those small things anymore - if (mParentGraph->GetScale() > 0.5f) + if (m_parentGraph->GetScale() > 0.5f) { QRect textRect; // draw the info text CalcInfoTextRect(textRect); painter.setPen(QColor(255, 128, 0)); - painter.setFont(mInfoTextFont); - painter.drawText(textRect, mElidedNodeInfo, mTextOptionsCenterHV); + painter.setFont(m_infoTextFont); + painter.drawText(textRect, m_elidedNodeInfo, m_textOptionsCenterHv); // draw the input ports QColor portBrushColor, portPenColor; - const AZ::u16 numInputs = aznumeric_caster(mInputPorts.size()); + const AZ::u16 numInputs = aznumeric_caster(m_inputPorts.size()); for (AZ::u16 i = 0; i < numInputs; ++i) { // get the input port and the corresponding rect - NodePort* inputPort = &mInputPorts[i]; + NodePort* inputPort = &m_inputPorts[i]; const QRect& portRect = inputPort->GetRect(); // get and set the pen and brush colors @@ -496,18 +472,18 @@ namespace EMStudio // draw the text CalcInputPortTextRect(i, textRect); painter.setPen(textColor); - painter.setFont(mPortNameFont); - painter.drawText(textRect, inputPort->GetName(), mTextOptionsAlignLeft); + painter.setFont(m_portNameFont); + painter.drawText(textRect, inputPort->GetName(), m_textOptionsAlignLeft); } if (GetHasVisualOutputPorts()) { // draw the output ports - const AZ::u16 numOutputs = aznumeric_caster(mOutputPorts.size()); + const AZ::u16 numOutputs = aznumeric_caster(m_outputPorts.size()); for (AZ::u16 i = 0; i < numOutputs; ++i) { // get the output port and the corresponding rect - NodePort* outputPort = &mOutputPorts[i]; + NodePort* outputPort = &m_outputPorts[i]; const QRect& portRect = outputPort->GetRect(); // get and set the pen and brush colors @@ -521,8 +497,8 @@ namespace EMStudio // draw the text CalcOutputPortTextRect(i, textRect); painter.setPen(textColor); - painter.setFont(mPortNameFont); - painter.drawText(textRect, outputPort->GetName(), mTextOptionsAlignRight); + painter.setFont(m_portNameFont); + painter.drawText(textRect, outputPort->GetName(), m_textOptionsAlignRight); } } } @@ -530,16 +506,16 @@ namespace EMStudio else { // is highlighted/hovered (on-mouse-over effect) - if (mIsHighlighted) + if (m_isHighlighted) { bgColor = bgColor.lighter(160); headerBgColor = headerBgColor.lighter(160); } // if the scale is so small that we can't see those small things anymore - QRect fullHeaderRect(mRect.left(), mRect.top(), mRect.width(), 25); - QRect headerRect(mRect.left(), mRect.top(), mRect.width(), 15); - QRect subHeaderRect(mRect.left(), mRect.top() + 13, mRect.width(), 10); + QRect fullHeaderRect(m_rect.left(), m_rect.top(), m_rect.width(), 25); + QRect headerRect(m_rect.left(), m_rect.top(), m_rect.width(), 15); + QRect subHeaderRect(m_rect.left(), m_rect.top() + 13, m_rect.width(), 10); // draw the header painter.setPen(borderColor); @@ -547,7 +523,7 @@ namespace EMStudio painter.drawRoundedRect(fullHeaderRect, 7.0, 7.0); // if the scale is so small that we can't see those small things anymore - if (mParentGraph->GetScale() < 0.3f) + if (m_parentGraph->GetScale() < 0.3f) { painter.setOpacity(1.0f); return; @@ -560,15 +536,15 @@ namespace EMStudio QTextOption textOptions; textOptions.setAlignment(Qt::AlignCenter); painter.setPen(textColor); - painter.setFont(mHeaderFont); - painter.drawText(headerRect, mElidedName, textOptions); + painter.setFont(m_headerFont); + painter.drawText(headerRect, m_elidedName, textOptions); - painter.setFont(mSubTitleFont); - painter.drawText(subHeaderRect, mElidedSubTitle, textOptions); + painter.setFont(m_subTitleFont); + painter.drawText(subHeaderRect, m_elidedSubTitle, textOptions); painter.setClipping(false); } - if (mParentGraph->GetScale() > 0.3f) + if (m_parentGraph->GetScale() > 0.3f) { // draw the collapse triangle if (isSelected) @@ -582,31 +558,31 @@ namespace EMStudio painter.setBrush(QColor(175, 175, 175)); } - if (mIsCollapsed == false) + if (m_isCollapsed == false) { QPoint triangle[3]; - triangle[0].setX(mArrowRect.left()); - triangle[0].setY(mArrowRect.top()); - triangle[1].setX(mArrowRect.right()); - triangle[1].setY(mArrowRect.top()); - triangle[2].setX(mArrowRect.center().x()); - triangle[2].setY(mArrowRect.bottom()); + triangle[0].setX(m_arrowRect.left()); + triangle[0].setY(m_arrowRect.top()); + triangle[1].setX(m_arrowRect.right()); + triangle[1].setY(m_arrowRect.top()); + triangle[2].setX(m_arrowRect.center().x()); + triangle[2].setY(m_arrowRect.bottom()); painter.drawPolygon(triangle, 3, Qt::WindingFill); } else { QPoint triangle[3]; - triangle[0].setX(mArrowRect.left()); - triangle[0].setY(mArrowRect.top()); - triangle[1].setX(mArrowRect.right()); - triangle[1].setY(mArrowRect.center().y()); - triangle[2].setX(mArrowRect.left()); - triangle[2].setY(mArrowRect.bottom()); + triangle[0].setX(m_arrowRect.left()); + triangle[0].setY(m_arrowRect.top()); + triangle[1].setX(m_arrowRect.right()); + triangle[1].setY(m_arrowRect.center().y()); + triangle[2].setX(m_arrowRect.left()); + triangle[2].setY(m_arrowRect.bottom()); painter.drawPolygon(triangle, 3, Qt::WindingFill); } // draw the visualize area - if (mCanVisualize) + if (m_canVisualize) { RenderVisualizeRect(painter, bgColor, bgColor2); } @@ -614,12 +590,6 @@ namespace EMStudio // render the marker which indicates that you can go inside this node RenderHasChildsIndicator(painter, pen, borderColor, bgColor2); } - - /* // render the text overlay with the pre-baked node name and port names etc. - const float textOpacity = mParentGraph->GetScale(); - painter.setOpacity( textOpacity ); - painter.drawPixmap( mRect, mTextPixmap ); - painter.setOpacity( 1.0f );*/ } @@ -629,10 +599,10 @@ namespace EMStudio MCORE_UNUSED(pen); // render the marker which indicates that you can go inside this node - if (mCanHaveChildren || mHasVisualGraph) + if (m_canHaveChildren || m_hasVisualGraph) { const int indicatorSize = 13; - QRect childIndicatorRect(aznumeric_cast(mRect.right() - indicatorSize - 2 * BORDER_RADIUS), mRect.top(), aznumeric_cast(indicatorSize + 2 * BORDER_RADIUS + 1), aznumeric_cast(indicatorSize + 2 * BORDER_RADIUS)); + QRect childIndicatorRect(aznumeric_cast(m_rect.right() - indicatorSize - 2 * BORDER_RADIUS), m_rect.top(), aznumeric_cast(indicatorSize + 2 * BORDER_RADIUS + 1), aznumeric_cast(indicatorSize + 2 * BORDER_RADIUS)); // set the border color to the same one as the node border painter.setPen(borderColor); @@ -648,10 +618,10 @@ namespace EMStudio } // construct the clipping polygon - mSubstPoly[0] = QPointF(childIndicatorRect.right() - indicatorSize, childIndicatorRect.top()); // top right - mSubstPoly[1] = QPointF(childIndicatorRect.right() - 5 * indicatorSize, childIndicatorRect.top()); // top left - mSubstPoly[2] = QPointF(childIndicatorRect.right() + 1, childIndicatorRect.top() + 5 * indicatorSize);// bottom down - mSubstPoly[3] = QPointF(childIndicatorRect.right() + 1, childIndicatorRect.top() + indicatorSize);// bottom up + m_substPoly[0] = QPointF(childIndicatorRect.right() - indicatorSize, childIndicatorRect.top()); // top right + m_substPoly[1] = QPointF(childIndicatorRect.right() - 5 * indicatorSize, childIndicatorRect.top()); // top left + m_substPoly[2] = QPointF(childIndicatorRect.right() + 1, childIndicatorRect.top() + 5 * indicatorSize);// bottom down + m_substPoly[3] = QPointF(childIndicatorRect.right() + 1, childIndicatorRect.top() + indicatorSize);// bottom up // matched mini rounded rect on top of the node rect QPainterPath path; @@ -659,7 +629,7 @@ namespace EMStudio // substract the clipping polygon from the mini rounded rect QPainterPath substPath; - substPath.addPolygon(mSubstPoly); + substPath.addPolygon(m_substPoly); QPainterPath finalPath = path.subtracted(substPath); // draw the indicator @@ -685,8 +655,8 @@ namespace EMStudio } else { - *outPenColor = mPortHighlightColor; - *outBrushColor = mPortHighlightBGColor; + *outPenColor = s_portHighlightColo; + *outBrushColor = s_portHighlightBGColor; } } } @@ -695,8 +665,8 @@ namespace EMStudio // render the shadow for this node void GraphNode::RenderShadow(QPainter& painter) { - float opacityFactor = mOpacity; - if (mIsEnabled == false) + float opacityFactor = m_opacity; + if (m_isEnabled == false) { opacityFactor = 0.10f; } @@ -706,9 +676,9 @@ namespace EMStudio painter.setBrush(QColor(0, 0, 0, 70)); // normal - if (mIsCollapsed == false) + if (m_isCollapsed == false) { - QRect shadowRect = mRect; + QRect shadowRect = m_rect; shadowRect.translate(3, 4); // draw the shadow rect @@ -716,7 +686,7 @@ namespace EMStudio } else // collapsed { - QRect shadowRect(mRect.left(), mRect.top(), mRect.width(), 25); + QRect shadowRect(m_rect.left(), m_rect.top(), m_rect.width(), 25); shadowRect.translate(3, 4); // draw the shadow rect @@ -731,12 +701,12 @@ namespace EMStudio const bool alwaysColor = GetAlwaysColor(); // for all connections - for (NodeConnection* nodeConnection : mConnections) + for (NodeConnection* nodeConnection : m_connections) { if (nodeConnection->GetIsVisible()) { float opacity = 1.0f; - if (!mIsEnabled) + if (!m_isEnabled) { opacity = 0.25f; } @@ -765,7 +735,7 @@ namespace EMStudio { QColor vizBorder; QColor vizBackGround = bgColor2.lighter(110); - if (mVisualize) + if (m_visualize) { vizBorder = Qt::black; } @@ -774,57 +744,56 @@ namespace EMStudio vizBorder = bgColor.darker(180); } - painter.setPen(mVisualizeHighlighted ? QColor(255, 128, 0) : vizBorder); + painter.setPen(m_visualizeHighlighted ? QColor(255, 128, 0) : vizBorder); if (!GetIsSelected()) { - painter.setBrush(mVisualize ? mVisualizeColor : vizBackGround); + painter.setBrush(m_visualize ? m_visualizeColor : vizBackGround); } else { - painter.setBrush(mVisualize ? QColor(255, 128, 0) : bgColor); + painter.setBrush(m_visualize ? QColor(255, 128, 0) : bgColor); } - painter.drawRect(mVisualizeRect); + painter.drawRect(m_visualizeRect); } // test if a point is inside the node bool GraphNode::GetIsInside(const QPoint& globalPoint) const { - return mFinalRect.contains(globalPoint); + return m_finalRect.contains(globalPoint); } // check if we are selected bool GraphNode::GetIsSelected() const { - return mParentGraph->GetAnimGraphModel().GetSelectionModel().isSelected(m_modelIndex); + return m_parentGraph->GetAnimGraphModel().GetSelectionModel().isSelected(m_modelIndex); } // move the node relatively void GraphNode::MoveRelative(const QPoint& deltaMove) { - mRect.translate(deltaMove); + m_rect.translate(deltaMove); } // move absolute void GraphNode::MoveAbsolute(const QPoint& newUpperLeft) { - const int32 width = mRect.width(); - const int32 height = mRect.height(); - mRect = QRect(newUpperLeft.x(), newUpperLeft.y(), width, height); - //MCore::LOG("MoveAbsolute: (%i, %i, %i, %i)", mRect.top(), mRect.left(), mRect.bottom(), mRect.right()); + const int32 width = m_rect.width(); + const int32 height = m_rect.height(); + m_rect = QRect(newUpperLeft.x(), newUpperLeft.y(), width, height); } // calculate the height (including title and bottom) int32 GraphNode::CalcRequiredHeight() const { - if (mIsCollapsed == false) + if (m_isCollapsed == false) { - int32 numPorts = aznumeric_caster(AZStd::max(mInputPorts.size(), mOutputPorts.size())); + int32 numPorts = aznumeric_caster(AZStd::max(m_inputPorts.size(), m_outputPorts.size())); int32 result = (numPorts * 15) + 34; return MCore::Math::Align(result, 10); } @@ -840,9 +809,9 @@ namespace EMStudio { // calc the maximum input port width int maxInputWidth = 0; - for (const NodePort& nodePort : mInputPorts) + for (const NodePort& nodePort : m_inputPorts) { - maxInputWidth = AZStd::max(maxInputWidth, mPortFontMetrics->horizontalAdvance(nodePort.GetName())); + maxInputWidth = AZStd::max(maxInputWidth, m_portFontMetrics->horizontalAdvance(nodePort.GetName())); } return maxInputWidth; @@ -853,9 +822,9 @@ namespace EMStudio { // calc the maximum output port width int maxOutputWidth = 0; - for (const NodePort& nodePort : mOutputPorts) + for (const NodePort& nodePort : m_outputPorts) { - maxOutputWidth = AZStd::max(maxOutputWidth, mPortFontMetrics->horizontalAdvance(nodePort.GetName())); + maxOutputWidth = AZStd::max(maxOutputWidth, m_portFontMetrics->horizontalAdvance(nodePort.GetName())); } return maxOutputWidth; @@ -864,40 +833,40 @@ namespace EMStudio // calculate the width int32 GraphNode::CalcRequiredWidth() { - if (mNameAndPortsUpdated) + if (m_nameAndPortsUpdated) { - return mRequiredWidth; + return m_requiredWidth; } // calc the maximum input port width - mMaxInputWidth = CalcMaxInputPortWidth(); - mMaxOutputWidth = CalcMaxOutputPortWidth(); + m_maxInputWidth = CalcMaxInputPortWidth(); + m_maxOutputWidth = CalcMaxOutputPortWidth(); - const int infoWidth = mInfoFontMetrics->horizontalAdvance(mElidedNodeInfo); - const int totalPortWidth = mMaxInputWidth + mMaxOutputWidth + 40 + infoWidth; + const int infoWidth = m_infoFontMetrics->horizontalAdvance(m_elidedNodeInfo); + const int totalPortWidth = m_maxInputWidth + m_maxOutputWidth + 40 + infoWidth; // make sure the node is at least 100 units in width - const int headerWidth = AZStd::max(mHeaderFontMetrics->horizontalAdvance(mElidedName) + 40, 100); + const int headerWidth = AZStd::max(m_headerFontMetrics->horizontalAdvance(m_elidedName) + 40, 100); - mRequiredWidth = AZStd::max(headerWidth, totalPortWidth); - mRequiredWidth = MCore::Math::Align(mRequiredWidth, 10); + m_requiredWidth = AZStd::max(headerWidth, totalPortWidth); + m_requiredWidth = MCore::Math::Align(m_requiredWidth, 10); - mNameAndPortsUpdated = true; + m_nameAndPortsUpdated = true; - return mRequiredWidth; + return m_requiredWidth; } // get the rect for a given input port QRect GraphNode::CalcInputPortRect(AZ::u16 portNr) { - return QRect(mRect.left() - 5, mRect.top() + 35 + portNr * 15, 8, 8); + return QRect(m_rect.left() - 5, m_rect.top() + 35 + portNr * 15, 8, 8); } // get the rect for a given output port QRect GraphNode::CalcOutputPortRect(AZ::u16 portNr) { - return QRect(mRect.right() - 5, mRect.top() + 35 + portNr * 15, 8, 8); + return QRect(m_rect.right() - 5, m_rect.top() + 35 + portNr * 15, 8, 8); } @@ -906,11 +875,11 @@ namespace EMStudio { if (local == false) { - outRect = QRect(mRect.left() + 15 + mMaxInputWidth, mRect.top() + 24, mRect.width() - 20 - mMaxInputWidth - mMaxOutputWidth, 20); + outRect = QRect(m_rect.left() + 15 + m_maxInputWidth, m_rect.top() + 24, m_rect.width() - 20 - m_maxInputWidth - m_maxOutputWidth, 20); } else { - outRect = QRect(15 + mMaxInputWidth, 24, mRect.width() - 20 - mMaxInputWidth - mMaxOutputWidth, 20); + outRect = QRect(15 + m_maxInputWidth, 24, m_rect.width() - 20 - m_maxInputWidth - m_maxOutputWidth, 20); } } @@ -920,11 +889,11 @@ namespace EMStudio { if (local == false) { - outRect = QRect(mRect.left() + 10, mRect.top() + 24 + portNr * 15, mRect.width() - 20, 20); + outRect = QRect(m_rect.left() + 10, m_rect.top() + 24 + portNr * 15, m_rect.width() - 20, 20); } else { - outRect = QRect(10, 24 + portNr * 15, mRect.width() - 20, 20); + outRect = QRect(10, 24 + portNr * 15, m_rect.width() - 20, 20); } } @@ -934,11 +903,11 @@ namespace EMStudio { if (local == false) { - outRect = QRect(mRect.left() + 10, mRect.top() + 24 + portNr * 15, mRect.width() - 20, 20); + outRect = QRect(m_rect.left() + 10, m_rect.top() + 24 + portNr * 15, m_rect.width() - 20, 20); } else { - outRect = QRect(10, 24 + portNr * 15, mRect.width() - 20, 20); + outRect = QRect(10, 24 + portNr * 15, m_rect.width() - 20, 20); } } @@ -946,40 +915,40 @@ namespace EMStudio // remove all input ports void GraphNode::RemoveAllInputPorts() { - mInputPorts.clear(); + m_inputPorts.clear(); } // remove all output ports void GraphNode::RemoveAllOutputPorts() { - mOutputPorts.clear(); + m_outputPorts.clear(); } // add a new input port NodePort* GraphNode::AddInputPort(bool updateTextPixMap) { - mInputPorts.emplace_back(); - mInputPorts.back().SetNode(this); + m_inputPorts.emplace_back(); + m_inputPorts.back().SetNode(this); if (updateTextPixMap) { UpdateTextPixmap(); } - return &mInputPorts.back(); + return &m_inputPorts.back(); } // add a new output port NodePort* GraphNode::AddOutputPort(bool updateTextPixMap) { - mOutputPorts.emplace_back(); - mOutputPorts.back().SetNode(this); + m_outputPorts.emplace_back(); + m_outputPorts.back().SetNode(this); if (updateTextPixMap) { UpdateTextPixmap(); } - return &mOutputPorts.back(); + return &m_outputPorts.back(); } @@ -987,13 +956,13 @@ namespace EMStudio NodePort* GraphNode::FindPort(int32 x, int32 y, AZ::u16* outPortNr, bool* outIsInputPort, bool includeInputPorts) { // if the node is not visible at all skip directly - if (mIsVisible == false) + if (m_isVisible == false) { return nullptr; } // if the node is collapsed we can skip directly, too - if (mIsCollapsed) + if (m_isCollapsed) { return nullptr; } @@ -1001,7 +970,7 @@ namespace EMStudio // check the input ports if (includeInputPorts) { - const AZ::u16 numInputPorts = aznumeric_caster(mInputPorts.size()); + const AZ::u16 numInputPorts = aznumeric_caster(m_inputPorts.size()); for (AZ::u16 i = 0; i < numInputPorts; ++i) { QRect rect = CalcInputPortRect(i); @@ -1009,13 +978,13 @@ namespace EMStudio { *outPortNr = i; *outIsInputPort = true; - return &mInputPorts[i]; + return &m_inputPorts[i]; } } } // check the output ports - const AZ::u16 numOutputPorts = aznumeric_caster(mOutputPorts.size()); + const AZ::u16 numOutputPorts = aznumeric_caster(m_outputPorts.size()); for (AZ::u16 i = 0; i < numOutputPorts; ++i) { QRect rect = CalcOutputPortRect(i); @@ -1023,7 +992,7 @@ namespace EMStudio { *outPortNr = i; *outIsInputPort = false; - return &mOutputPorts[i]; + return &m_outputPorts[i]; } } @@ -1033,12 +1002,12 @@ namespace EMStudio // remove a given connection bool GraphNode::RemoveConnection(const void* connection, bool removeFromMemory) { - const auto foundConnection = AZStd::find_if(begin(mConnections), end(mConnections), [match = connection](const NodeConnection* connection) + const auto foundConnection = AZStd::find_if(begin(m_connections), end(m_connections), [match = connection](const NodeConnection* connection) { return connection->GetModelIndex().data(AnimGraphModel::ROLE_POINTER).value() == match; }); - if (foundConnection == end(mConnections)) + if (foundConnection == end(m_connections)) { return false; } @@ -1047,7 +1016,7 @@ namespace EMStudio { delete *foundConnection; } - mConnections.erase(foundConnection); + m_connections.erase(foundConnection); return true; } @@ -1055,12 +1024,12 @@ namespace EMStudio // Remove a given connection by model index bool GraphNode::RemoveConnection(const QModelIndex& modelIndex, bool removeFromMemory) { - const auto foundConnection = AZStd::find_if(begin(mConnections), end(mConnections), [match = modelIndex](const NodeConnection* connection) + const auto foundConnection = AZStd::find_if(begin(m_connections), end(m_connections), [match = modelIndex](const NodeConnection* connection) { return connection->GetModelIndex() == match; }); - if (foundConnection == end(mConnections)) + if (foundConnection == end(m_connections)) { return false; } @@ -1069,7 +1038,7 @@ namespace EMStudio { delete *foundConnection; } - mConnections.erase(foundConnection); + m_connections.erase(foundConnection); return true; } @@ -1077,14 +1046,14 @@ namespace EMStudio // called when the name of a port got changed void NodePort::OnNameChanged() { - if (mNode == nullptr) + if (m_node == nullptr) { return; } - mNode->UpdateNameAndPorts(); - mNode->UpdateRects(); - mNode->UpdateTextPixmap(); + m_node->UpdateNameAndPorts(); + m_node->UpdateRects(); + m_node->UpdateTextPixmap(); } diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/GraphNode.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/GraphNode.h index 125317408d..297e6c2cd1 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/GraphNode.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/GraphNode.h @@ -43,28 +43,28 @@ namespace EMStudio public: NodePort() - : mIsHighlighted(false) { mNode = nullptr; mNameID = MCORE_INVALIDINDEX32; mColor.setRgb(50, 150, 250); } + : m_isHighlighted(false) { m_node = nullptr; m_nameId = MCORE_INVALIDINDEX32; m_color.setRgb(50, 150, 250); } - MCORE_INLINE void SetName(const char* name) { mNameID = MCore::GetStringIdPool().GenerateIdForString(name); OnNameChanged(); } - MCORE_INLINE const char* GetName() const { return MCore::GetStringIdPool().GetName(mNameID).c_str(); } - MCORE_INLINE void SetNameID(uint32 id) { mNameID = id; } - MCORE_INLINE uint32 GetNameID() const { return mNameID; } - MCORE_INLINE void SetRect(const QRect& rect) { mRect = rect; } - MCORE_INLINE const QRect& GetRect() const { return mRect; } - MCORE_INLINE void SetColor(const QColor& color) { mColor = color; } - MCORE_INLINE const QColor& GetColor() const { return mColor; } - MCORE_INLINE void SetNode(GraphNode* node) { mNode = node; } - MCORE_INLINE bool GetIsHighlighted() const { return mIsHighlighted; } - MCORE_INLINE void SetIsHighlighted(bool enabled) { mIsHighlighted = enabled; } + MCORE_INLINE void SetName(const char* name) { m_nameId = MCore::GetStringIdPool().GenerateIdForString(name); OnNameChanged(); } + MCORE_INLINE const char* GetName() const { return MCore::GetStringIdPool().GetName(m_nameId).c_str(); } + MCORE_INLINE void SetNameID(uint32 id) { m_nameId = id; } + MCORE_INLINE uint32 GetNameID() const { return m_nameId; } + MCORE_INLINE void SetRect(const QRect& rect) { m_rect = rect; } + MCORE_INLINE const QRect& GetRect() const { return m_rect; } + MCORE_INLINE void SetColor(const QColor& color) { m_color = color; } + MCORE_INLINE const QColor& GetColor() const { return m_color; } + MCORE_INLINE void SetNode(GraphNode* node) { m_node = node; } + MCORE_INLINE bool GetIsHighlighted() const { return m_isHighlighted; } + MCORE_INLINE void SetIsHighlighted(bool enabled) { m_isHighlighted = enabled; } void OnNameChanged(); private: - QRect mRect; - QColor mColor; - GraphNode* mNode; - uint32 mNameID; - bool mIsHighlighted; + QRect m_rect; + QColor m_color; + GraphNode* m_node; + uint32 m_nameId; + bool m_isHighlighted; }; @@ -83,59 +83,58 @@ namespace EMStudio const QModelIndex& GetModelIndex() const { return m_modelIndex; } - MCORE_INLINE void UpdateNameAndPorts() { mNameAndPortsUpdated = false; } - MCORE_INLINE AZStd::vector& GetConnections() { return mConnections; } - MCORE_INLINE size_t GetNumConnections() { return mConnections.size(); } - MCORE_INLINE NodeConnection* GetConnection(size_t index) { return mConnections[index]; } - MCORE_INLINE NodeConnection* AddConnection(NodeConnection* con) { mConnections.emplace_back(con); return con; } - MCORE_INLINE void SetParentGraph(NodeGraph* graph) { mParentGraph = graph; } - MCORE_INLINE NodeGraph* GetParentGraph() { return mParentGraph; } - MCORE_INLINE NodePort* GetInputPort(AZ::u16 index) { return &mInputPorts[index]; } - MCORE_INLINE NodePort* GetOutputPort(AZ::u16 index) { return &mOutputPorts[index]; } - MCORE_INLINE const QRect& GetRect() const { return mRect; } - MCORE_INLINE const QRect& GetFinalRect() const { return mFinalRect; } - MCORE_INLINE const QRect& GetVizRect() const { return mVisualizeRect; } - MCORE_INLINE void SetBaseColor(const QColor& color) { mBaseColor = color; } - MCORE_INLINE QColor GetBaseColor() const { return mBaseColor; } - MCORE_INLINE bool GetIsVisible() const { return mIsVisible; } - MCORE_INLINE const char* GetName() const { return mName.c_str(); } - MCORE_INLINE const AZStd::string& GetNameString() const { return mName; } + MCORE_INLINE void UpdateNameAndPorts() { m_nameAndPortsUpdated = false; } + MCORE_INLINE AZStd::vector& GetConnections() { return m_connections; } + MCORE_INLINE size_t GetNumConnections() { return m_connections.size(); } + MCORE_INLINE NodeConnection* GetConnection(size_t index) { return m_connections[index]; } + MCORE_INLINE NodeConnection* AddConnection(NodeConnection* con) { m_connections.emplace_back(con); return con; } + MCORE_INLINE void SetParentGraph(NodeGraph* graph) { m_parentGraph = graph; } + MCORE_INLINE NodeGraph* GetParentGraph() { return m_parentGraph; } + MCORE_INLINE NodePort* GetInputPort(AZ::u16 index) { return &m_inputPorts[index]; } + MCORE_INLINE NodePort* GetOutputPort(AZ::u16 index) { return &m_outputPorts[index]; } + MCORE_INLINE const QRect& GetRect() const { return m_rect; } + MCORE_INLINE const QRect& GetFinalRect() const { return m_finalRect; } + MCORE_INLINE const QRect& GetVizRect() const { return m_visualizeRect; } + MCORE_INLINE void SetBaseColor(const QColor& color) { m_baseColor = color; } + MCORE_INLINE QColor GetBaseColor() const { return m_baseColor; } + MCORE_INLINE bool GetIsVisible() const { return m_isVisible; } + MCORE_INLINE const char* GetName() const { return m_name.c_str(); } + MCORE_INLINE const AZStd::string& GetNameString() const { return m_name; } - MCORE_INLINE bool GetCreateConFromOutputOnly() const { return mConFromOutputOnly; } - MCORE_INLINE void SetCreateConFromOutputOnly(bool enable) { mConFromOutputOnly = enable; } - MCORE_INLINE bool GetIsDeletable() const { return mIsDeletable; } - MCORE_INLINE bool GetIsCollapsed() const { return mIsCollapsed; } + MCORE_INLINE bool GetCreateConFromOutputOnly() const { return m_conFromOutputOnly; } + MCORE_INLINE void SetCreateConFromOutputOnly(bool enable) { m_conFromOutputOnly = enable; } + MCORE_INLINE bool GetIsDeletable() const { return m_isDeletable; } + MCORE_INLINE bool GetIsCollapsed() const { return m_isCollapsed; } void SetIsCollapsed(bool collapsed); - MCORE_INLINE void SetDeletable(bool deletable) { mIsDeletable = deletable; } + MCORE_INLINE void SetDeletable(bool deletable) { m_isDeletable = deletable; } void SetSubTitle(const char* subTitle, bool updatePixmap = true); - MCORE_INLINE const char* GetSubTitle() const { return mSubTitle.c_str(); } - //MCORE_INLINE const AZStd::string& GetSubTitleString() const { return mSubTitle; } - MCORE_INLINE bool GetIsInsideArrowRect(const QPoint& point) const { return mArrowRect.contains(point, true); } + MCORE_INLINE const char* GetSubTitle() const { return m_subTitle.c_str(); } + MCORE_INLINE bool GetIsInsideArrowRect(const QPoint& point) const { return m_arrowRect.contains(point, true); } - MCORE_INLINE void SetVisualizeColor(const QColor& color) { mVisualizeColor = color; } - MCORE_INLINE const QColor& GetVisualizeColor() const { return mVisualizeColor; } + MCORE_INLINE void SetVisualizeColor(const QColor& color) { m_visualizeColor = color; } + MCORE_INLINE const QColor& GetVisualizeColor() const { return m_visualizeColor; } - MCORE_INLINE void SetHasChildIndicatorColor(const QColor& color) { mHasChildIndicatorColor = color; } - MCORE_INLINE const QColor& GetHasChildIndicatorColor() const { return mHasChildIndicatorColor; } + MCORE_INLINE void SetHasChildIndicatorColor(const QColor& color) { m_hasChildIndicatorColor = color; } + MCORE_INLINE const QColor& GetHasChildIndicatorColor() const { return m_hasChildIndicatorColor; } - MCORE_INLINE bool GetIsHighlighted() const { return mIsHighlighted; } - MCORE_INLINE bool GetIsVisualizedHighlighted() const { return mVisualizeHighlighted; } - MCORE_INLINE bool GetIsInsideVisualizeRect(const QPoint& point) const { return mVisualizeRect.contains(point, true); } + MCORE_INLINE bool GetIsHighlighted() const { return m_isHighlighted; } + MCORE_INLINE bool GetIsVisualizedHighlighted() const { return m_visualizeHighlighted; } + MCORE_INLINE bool GetIsInsideVisualizeRect(const QPoint& point) const { return m_visualizeRect.contains(point, true); } - MCORE_INLINE void SetIsVisualized(bool enabled) { mVisualize = enabled; } - MCORE_INLINE bool GetIsVisualized() const { return mVisualize; } + MCORE_INLINE void SetIsVisualized(bool enabled) { m_visualize = enabled; } + MCORE_INLINE bool GetIsVisualized() const { return m_visualize; } - MCORE_INLINE void SetIsEnabled(bool enabled) { mIsEnabled = enabled; } - MCORE_INLINE bool GetIsEnabled() const { return mIsEnabled; } + MCORE_INLINE void SetIsEnabled(bool enabled) { m_isEnabled = enabled; } + MCORE_INLINE bool GetIsEnabled() const { return m_isEnabled; } - MCORE_INLINE void SetCanVisualize(bool canViz) { mCanVisualize = canViz; } - MCORE_INLINE bool GetCanVisualize() const { return mCanVisualize; } + MCORE_INLINE void SetCanVisualize(bool canViz) { m_canVisualize = canViz; } + MCORE_INLINE bool GetCanVisualize() const { return m_canVisualize; } - MCORE_INLINE float GetOpacity() const { return mOpacity; } - MCORE_INLINE void SetOpacity(float opacity) { mOpacity = opacity; } + MCORE_INLINE float GetOpacity() const { return m_opacity; } + MCORE_INLINE void SetOpacity(float opacity) { m_opacity = opacity; } - AZ::u16 GetNumInputPorts() const { return aznumeric_caster(mInputPorts.size()); } - AZ::u16 GetNumOutputPorts() const { return aznumeric_caster(mOutputPorts.size()); } + AZ::u16 GetNumInputPorts() const { return aznumeric_caster(m_inputPorts.size()); } + AZ::u16 GetNumOutputPorts() const { return aznumeric_caster(m_outputPorts.size()); } NodePort* AddInputPort(bool updateTextPixMap); NodePort* AddOutputPort(bool updateTextPixMap); @@ -180,11 +179,11 @@ namespace EMStudio virtual bool GetAlwaysColor() const { return true; } virtual bool GetHasError() const { return true; } - MCORE_INLINE bool GetIsProcessed() const { return mIsProcessed; } - MCORE_INLINE void SetIsProcessed(bool processed) { mIsProcessed = processed; } + MCORE_INLINE bool GetIsProcessed() const { return m_isProcessed; } + MCORE_INLINE void SetIsProcessed(bool processed) { m_isProcessed = processed; } - MCORE_INLINE bool GetIsUpdated() const { return mIsUpdated; } - MCORE_INLINE void SetIsUpdated(bool updated) { mIsUpdated = updated; } + MCORE_INLINE bool GetIsUpdated() const { return m_isUpdated; } + MCORE_INLINE void SetIsUpdated(bool updated) { m_isUpdated = updated; } virtual void Sync() {} @@ -192,12 +191,12 @@ namespace EMStudio void CalcInputPortTextRect(AZ::u16 portNr, QRect& outRect, bool local = false); void CalcInfoTextRect(QRect& outRect, bool local = false); - MCORE_INLINE void SetHasVisualOutputPorts(bool hasVisualOutputPorts) { mHasVisualOutputPorts = hasVisualOutputPorts; } - MCORE_INLINE bool GetHasVisualOutputPorts() const { return mHasVisualOutputPorts; } + MCORE_INLINE void SetHasVisualOutputPorts(bool hasVisualOutputPorts) { m_hasVisualOutputPorts = hasVisualOutputPorts; } + MCORE_INLINE bool GetHasVisualOutputPorts() const { return m_hasVisualOutputPorts; } - const QColor& GetBorderColor() const { return mBorderColor; } - void SetBorderColor(const QColor& color) { mBorderColor = color; } - void ResetBorderColor() { mBorderColor = QColor(0, 0, 0); } + const QColor& GetBorderColor() const { return m_borderColor; } + void SetBorderColor(const QColor& color) { m_borderColor = color; } + void ResetBorderColor() { m_borderColor = QColor(0, 0, 0); } virtual void UpdateTextPixmap(); static void RenderText(QPainter& painter, const QString& text, const QColor& textColor, const QFont& font, const QFontMetrics& fontMetrics, Qt::Alignment textAlignment, const QRect& rect); @@ -208,75 +207,74 @@ namespace EMStudio void GetNodePortColors(NodePort* nodePort, const QColor& borderColor, const QColor& headerBgColor, QColor* outBrushColor, QColor* outPenColor); QPersistentModelIndex m_modelIndex; - AZStd::string mName; - QString mElidedName; + AZStd::string m_name; + QString m_elidedName; - QPainter mTextPainter; - //QPixmap mTextPixmap; - AZStd::string mSubTitle; - QString mElidedSubTitle; - AZStd::string mNodeInfo; - QString mElidedNodeInfo; - QBrush mBrush; - QColor mBaseColor; - QRect mRect; - QRect mFinalRect; - QRect mArrowRect; - QRect mVisualizeRect; - QColor mBorderColor; - QColor mVisualizeColor; - QColor mHasChildIndicatorColor; - AZStd::vector mConnections; - float mOpacity; - bool mIsVisible; - static QColor mPortHighlightColor; - static QColor mPortHighlightBGColor; + QPainter m_textPainter; + AZStd::string m_subTitle; + QString m_elidedSubTitle; + AZStd::string m_nodeInfo; + QString m_elidedNodeInfo; + QBrush m_brush; + QColor m_baseColor; + QRect m_rect; + QRect m_finalRect; + QRect m_arrowRect; + QRect m_visualizeRect; + QColor m_borderColor; + QColor m_visualizeColor; + QColor m_hasChildIndicatorColor; + AZStd::vector m_connections; + float m_opacity; + bool m_isVisible; + static QColor s_portHighlightColo; + static QColor s_portHighlightBGColor; // font stuff - QFont mHeaderFont; - QFont mPortNameFont; - QFont mSubTitleFont; - QFont mInfoTextFont; - QFontMetrics* mPortFontMetrics; - QFontMetrics* mHeaderFontMetrics; - QFontMetrics* mInfoFontMetrics; - QFontMetrics* mSubTitleFontMetrics; - QTextOption mTextOptionsCenter; - QTextOption mTextOptionsAlignLeft; - QTextOption mTextOptionsAlignRight; - QTextOption mTextOptionsCenterHV; + QFont m_headerFont; + QFont m_portNameFont; + QFont m_subTitleFont; + QFont m_infoTextFont; + QFontMetrics* m_portFontMetrics; + QFontMetrics* m_headerFontMetrics; + QFontMetrics* m_infoFontMetrics; + QFontMetrics* m_subTitleFontMetrics; + QTextOption m_textOptionsCenter; + QTextOption m_textOptionsAlignLeft; + QTextOption m_textOptionsAlignRight; + QTextOption m_textOptionsCenterHv; - QStaticText mTitleText; - QStaticText mSubTitleText; - QStaticText mInfoText; + QStaticText m_titleText; + QStaticText m_subTitleText; + QStaticText m_infoText; - AZStd::vector mInputPortText; - AZStd::vector mOutputPortText; + AZStd::vector m_inputPortText; + AZStd::vector m_outputPortText; - int32 mRequiredWidth; - bool mNameAndPortsUpdated; + int32 m_requiredWidth; + bool m_nameAndPortsUpdated; - NodeGraph* mParentGraph; - AZStd::vector mInputPorts; - AZStd::vector mOutputPorts; - bool mConFromOutputOnly; - bool mIsDeletable; - bool mIsCollapsed; - bool mIsProcessed; - bool mIsUpdated; - bool mVisualize; - bool mCanVisualize; - bool mVisualizeHighlighted; - bool mIsEnabled; - bool mIsHighlighted; - bool mCanHaveChildren; - bool mHasVisualGraph; - bool mHasVisualOutputPorts; + NodeGraph* m_parentGraph; + AZStd::vector m_inputPorts; + AZStd::vector m_outputPorts; + bool m_conFromOutputOnly; + bool m_isDeletable; + bool m_isCollapsed; + bool m_isProcessed; + bool m_isUpdated; + bool m_visualize; + bool m_canVisualize; + bool m_visualizeHighlighted; + bool m_isEnabled; + bool m_isHighlighted; + bool m_canHaveChildren; + bool m_hasVisualGraph; + bool m_hasVisualOutputPorts; - int mMaxInputWidth; // will be calculated automatically in CalcRequiredWidth() - int mMaxOutputWidth; // will be calculated automatically in CalcRequiredWidth() + int m_maxInputWidth; // will be calculated automatically in CalcRequiredWidth() + int m_maxOutputWidth; // will be calculated automatically in CalcRequiredWidth() // has child node indicator - QPolygonF mSubstPoly; + QPolygonF m_substPoly; }; } // namespace EMStudio diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/GraphWidgetCallback.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/GraphWidgetCallback.h index f57828c646..ff14484dc5 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/GraphWidgetCallback.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/GraphWidgetCallback.h @@ -27,13 +27,13 @@ namespace EMStudio public: // constructor and destructor - GraphWidgetCallback(NodeGraphWidget* graphWidget) { mGraphWidget = graphWidget; } + GraphWidgetCallback(NodeGraphWidget* graphWidget) { m_graphWidget = graphWidget; } virtual ~GraphWidgetCallback() {} virtual void DrawOverlay(QPainter& painter) = 0; protected: - NodeGraphWidget* mGraphWidget; + NodeGraphWidget* m_graphWidget; }; } // namespace EMStudio diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/NodeConnection.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/NodeConnection.cpp index cefbb0d0af..c8a36b9f8e 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/NodeConnection.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/NodeConnection.cpp @@ -21,18 +21,18 @@ namespace EMStudio : m_modelIndex(modelIndex) , m_parentGraph(parentGraph) { - mSourceNode = sourceNode; - mSourcePortNr = sourceOutputPortNr; - mTargetNode = targetNode; - mPortNr = portNr; - mIsVisible = false; - mIsProcessed = false; - mIsDashed = false; - mIsDisabled = false; - mIsHeadHighlighted = false; - mIsTailHighlighted = false; - mIsSynced = false; - mColor = QColor(128, 255, 128); + m_sourceNode = sourceNode; + m_sourcePortNr = sourceOutputPortNr; + m_targetNode = targetNode; + m_portNr = portNr; + m_isVisible = false; + m_isProcessed = false; + m_isDashed = false; + m_isDisabled = false; + m_isHeadHighlighted = false; + m_isTailHighlighted = false; + m_isSynced = false; + m_color = QColor(128, 255, 128); } @@ -48,15 +48,15 @@ namespace EMStudio MCORE_UNUSED(mousePos); // calculate the rects - mRect = CalcRect(); - mFinalRect = CalcFinalRect(); + m_rect = CalcRect(); + m_finalRect = CalcFinalRect(); // check for visibility - mIsVisible = mFinalRect.intersects(visibleRect); + m_isVisible = m_finalRect.intersects(visibleRect); // reset the is highlighted flags - mIsHighlighted = false; - mIsConnectedHighlighted = false; + m_isHighlighted = false; + m_isConnectedHighlighted = false; } @@ -73,12 +73,12 @@ namespace EMStudio int32 endY = targetRect.center().y() + 1; // draw the connection - mPainterPath = QPainterPath(); + m_painterPath = QPainterPath(); const float width = aznumeric_cast(abs((endX - 3) - (startX + 3))); - mPainterPath.moveTo(startX, startY); - mPainterPath.lineTo(startX + 3, startY); - mPainterPath.cubicTo(startX + (width / 2), startY, endX - (width / 2), endY, endX - 3, endY); - mPainterPath.lineTo(endX, endY); + m_painterPath.moveTo(startX, startY); + m_painterPath.lineTo(startX + 3, startY); + m_painterPath.cubicTo(startX + (width / 2), startY, endX - (width / 2), endY, endX - 3, endY); + m_painterPath.lineTo(endX, endY); } @@ -90,14 +90,14 @@ namespace EMStudio AZ_UNUSED(visibleRect); // used when relinking - if (mIsDashed) + if (m_isDashed) { return; } painter.setOpacity(opacity); - const float scale = mSourceNode->GetParentGraph()->GetScale(); + const float scale = m_sourceNode->GetParentGraph()->GetScale(); QColor penColor; // draw some small horizontal lines that go outside of the connection port @@ -117,11 +117,10 @@ namespace EMStudio else // unselected { // don't make it bold when not selected - if (mIsProcessed == false && alwaysColor == false) + if (m_isProcessed == false && alwaysColor == false) { - if (mSourceNode) + if (m_sourceNode) { - //penColor = mSourceNode->GetOutputPort(mSourcePortNr)->GetColor(); penColor.setRgb(75, 75, 75); } else @@ -133,14 +132,14 @@ namespace EMStudio } else { - if (mSourceNode) + if (m_sourceNode) { if (alwaysColor == false) { pen->setWidthF(1.5f); } - penColor = mSourceNode->GetOutputPort(mSourcePortNr)->GetColor(); + penColor = m_sourceNode->GetOutputPort(m_sourcePortNr)->GetColor(); } else { @@ -152,13 +151,13 @@ namespace EMStudio } // lighten the color in case the transition is highlighted - if (mIsHighlighted) + if (m_isHighlighted) { penColor = penColor.lighter(160); } // lighten the color in case the transition is connected to the currently selected node - if (mIsConnectedHighlighted) + if (m_isConnectedHighlighted) { const float minInput = 0.1f; const float maxInput = 1.0f; @@ -184,9 +183,9 @@ namespace EMStudio } // blinking red error color - if (mSourceNode && mSourceNode->GetHasError() && !GetIsSelected()) + if (m_sourceNode && m_sourceNode->GetHasError() && !GetIsSelected()) { - NodeGraph* parentGraph = mTargetNode->GetParentGraph(); + NodeGraph* parentGraph = m_targetNode->GetParentGraph(); if (parentGraph->GetUseAnimation()) { penColor = parentGraph->GetErrorBlinkColor(); @@ -199,9 +198,9 @@ namespace EMStudio // set the pen pen->setColor(penColor); - if (mIsProcessed) + if (m_isProcessed) { - NodeGraph* parentGraph = mTargetNode->GetParentGraph(); + NodeGraph* parentGraph = m_targetNode->GetParentGraph(); if (parentGraph->GetScale() > 0.5f && parentGraph->GetUseAnimation()) { pen->setStyle(Qt::PenStyle::DashLine); @@ -229,7 +228,7 @@ namespace EMStudio // draw the curve UpdatePainterPath(); - painter.drawPath(mPainterPath); + painter.drawPath(m_painterPath); // restore opacity and width painter.setOpacity(1.0f); @@ -240,11 +239,11 @@ namespace EMStudio // get the source rect QRect NodeConnection::GetSourceRect() const { - if (mSourceNode) + if (m_sourceNode) { - if (mSourceNode->GetIsCollapsed() == false) + if (m_sourceNode->GetIsCollapsed() == false) { - return mSourceNode->GetOutputPort(mSourcePortNr)->GetRect(); + return m_sourceNode->GetOutputPort(m_sourcePortNr)->GetRect(); } else { @@ -262,9 +261,9 @@ namespace EMStudio // get the target rect QRect NodeConnection::GetTargetRect() const { - if (mTargetNode->GetIsCollapsed() == false) + if (m_targetNode->GetIsCollapsed() == false) { - return mTargetNode->GetInputPort(mPortNr)->GetRect(); + return m_targetNode->GetInputPort(m_portNr)->GetRect(); } else { @@ -276,7 +275,7 @@ namespace EMStudio // intersects this connection? bool NodeConnection::Intersects(const QRect& rect) { - if (mRect.intersects(rect) == false) + if (m_rect.intersects(rect) == false) { return false; } @@ -291,7 +290,7 @@ namespace EMStudio //testPath.addRect( rect ); UpdatePainterPath(); - return mPainterPath.intersects(rect); + return m_painterPath.intersects(rect); } @@ -299,12 +298,12 @@ namespace EMStudio bool NodeConnection::CheckIfIsCloseTo(const QPoint& point) { // if we're not visible don't check - if (mIsVisible == false) + if (m_isVisible == false) { return false; } - if (mRect.contains(point) == false) + if (m_rect.contains(point) == false) { return false; } @@ -325,7 +324,7 @@ namespace EMStudio // get the collapsed source rect QRect NodeConnection::CalcCollapsedSourceRect() const { - QRect tempRect = mSourceNode->GetRect(); + QRect tempRect = m_sourceNode->GetRect(); // QPoint a = QPoint(tempRect.right(), tempRect.top() + tempRect.height() / 2); QPoint a = QPoint(tempRect.right(), tempRect.top() + 13); return QRect(a - QPoint(1, 1), a); @@ -335,7 +334,7 @@ namespace EMStudio // get the collapsed target rect QRect NodeConnection::CalcCollapsedTargetRect() const { - QRect tempRect = mTargetNode->GetRect(); + QRect tempRect = m_targetNode->GetRect(); // QPoint a = QPoint(tempRect.left(), tempRect.top() + tempRect.height() / 2); QPoint a = QPoint(tempRect.left(), tempRect.top() + 13); return QRect(a, a + QPoint(1, 1)); @@ -354,14 +353,14 @@ namespace EMStudio // calc the final rect QRect NodeConnection::CalcFinalRect() const { - if (mSourceNode) + if (m_sourceNode) { - return mSourceNode->GetParentGraph()->GetTransform().mapRect(CalcRect()); + return m_sourceNode->GetParentGraph()->GetTransform().mapRect(CalcRect()); } - if (mTargetNode) + if (m_targetNode) { - return mTargetNode->GetParentGraph()->GetTransform().mapRect(CalcRect()); + return m_targetNode->GetParentGraph()->GetTransform().mapRect(CalcRect()); } MCORE_ASSERT(false); diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/NodeConnection.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/NodeConnection.h index 2e305dbd0c..4fd7d41c97 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/NodeConnection.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/NodeConnection.h @@ -60,71 +60,71 @@ namespace EMStudio bool GetIsSelected() const; - MCORE_INLINE bool GetIsVisible() { return mIsVisible; } + MCORE_INLINE bool GetIsVisible() { return m_isVisible; } - MCORE_INLINE AZ::u16 GetInputPortNr() const { return mPortNr; } - MCORE_INLINE AZ::u16 GetOutputPortNr() const { return mSourcePortNr; } - MCORE_INLINE GraphNode* GetSourceNode() { return mSourceNode; } - MCORE_INLINE GraphNode* GetTargetNode() { return mTargetNode; } + MCORE_INLINE AZ::u16 GetInputPortNr() const { return m_portNr; } + MCORE_INLINE AZ::u16 GetOutputPortNr() const { return m_sourcePortNr; } + MCORE_INLINE GraphNode* GetSourceNode() { return m_sourceNode; } + MCORE_INLINE GraphNode* GetTargetNode() { return m_targetNode; } - MCORE_INLINE bool GetIsSynced() const { return mIsSynced; } - MCORE_INLINE void SetIsSynced(bool synced) { mIsSynced = synced; } + MCORE_INLINE bool GetIsSynced() const { return m_isSynced; } + MCORE_INLINE void SetIsSynced(bool synced) { m_isSynced = synced; } - MCORE_INLINE bool GetIsProcessed() const { return mIsProcessed; } - MCORE_INLINE void SetIsProcessed(bool processed) { mIsProcessed = processed; } + MCORE_INLINE bool GetIsProcessed() const { return m_isProcessed; } + MCORE_INLINE void SetIsProcessed(bool processed) { m_isProcessed = processed; } - MCORE_INLINE bool GetIsDashed() const { return mIsDashed; } - MCORE_INLINE void SetIsDashed(bool flag) { mIsDashed = flag; } + MCORE_INLINE bool GetIsDashed() const { return m_isDashed; } + MCORE_INLINE void SetIsDashed(bool flag) { m_isDashed = flag; } - MCORE_INLINE bool GetIsDisabled() const { return mIsDisabled; } - MCORE_INLINE void SetIsDisabled(bool flag) { mIsDisabled = flag; } + MCORE_INLINE bool GetIsDisabled() const { return m_isDisabled; } + MCORE_INLINE void SetIsDisabled(bool flag) { m_isDisabled = flag; } - MCORE_INLINE bool GetIsHighlighted() const { return mIsHighlighted; } - MCORE_INLINE void SetIsHighlighted(bool flag) { mIsHighlighted = flag; } + MCORE_INLINE bool GetIsHighlighted() const { return m_isHighlighted; } + MCORE_INLINE void SetIsHighlighted(bool flag) { m_isHighlighted = flag; } // when a node is selected, we highlight all incoming/outgoing connections from/to that, this is the flag to indicate that - MCORE_INLINE bool GetIsConnectedHighlighted() const { return mIsConnectedHighlighted; } - MCORE_INLINE void SetIsConnectedHighlighted(bool flag) { mIsConnectedHighlighted = flag; } + MCORE_INLINE bool GetIsConnectedHighlighted() const { return m_isConnectedHighlighted; } + MCORE_INLINE void SetIsConnectedHighlighted(bool flag) { m_isConnectedHighlighted = flag; } - MCORE_INLINE void SetIsTailHighlighted(bool flag) { mIsTailHighlighted = flag; } - MCORE_INLINE void SetIsHeadHighlighted(bool flag) { mIsHeadHighlighted = flag; } - MCORE_INLINE bool GetIsTailHighlighted() const { return mIsTailHighlighted; } - MCORE_INLINE bool GetIsHeadHighlighted() const { return mIsHeadHighlighted; } + MCORE_INLINE void SetIsTailHighlighted(bool flag) { m_isTailHighlighted = flag; } + MCORE_INLINE void SetIsHeadHighlighted(bool flag) { m_isHeadHighlighted = flag; } + MCORE_INLINE bool GetIsTailHighlighted() const { return m_isTailHighlighted; } + MCORE_INLINE bool GetIsHeadHighlighted() const { return m_isHeadHighlighted; } virtual bool CheckIfIsCloseToHead(const QPoint& point) const { MCORE_UNUSED(point); return false; } virtual bool CheckIfIsCloseToTail(const QPoint& point) const { MCORE_UNUSED(point); return false; } virtual void CalcStartAndEndPoints(QPoint& start, QPoint& end) const { MCORE_UNUSED(start); MCORE_UNUSED(end); } virtual bool GetIsWildcardTransition() const { return false; } - MCORE_INLINE void SetColor(const QColor& color) { mColor = color; } - MCORE_INLINE const QColor& GetColor() const { return mColor; } + MCORE_INLINE void SetColor(const QColor& color) { m_color = color; } + MCORE_INLINE const QColor& GetColor() const { return m_color; } - void SetSourceNode(GraphNode* node) { mSourceNode = node; } - void SetTargetNode(GraphNode* node) { mTargetNode = node; } + void SetSourceNode(GraphNode* node) { m_sourceNode = node; } + void SetTargetNode(GraphNode* node) { m_targetNode = node; } - void SetTargetPort(AZ::u16 portIndex) { mPortNr = portIndex; } + void SetTargetPort(AZ::u16 portIndex) { m_portNr = portIndex; } protected: NodeGraph* m_parentGraph = nullptr; QPersistentModelIndex m_modelIndex; - QRect mRect; - QRect mFinalRect; - QColor mColor; - GraphNode* mSourceNode; // source node from which the connection comes - GraphNode* mTargetNode; // the target node - QPainterPath mPainterPath; - AZ::u16 mPortNr; // input port where this is connected to - AZ::u16 mSourcePortNr; // source output port number - bool mIsVisible; // is this connection visible? - bool mIsProcessed; // is this connection processed? - bool mIsDisabled; - bool mIsDashed; - bool mIsHighlighted; - bool mIsHeadHighlighted; - bool mIsTailHighlighted; - bool mIsConnectedHighlighted; - bool mIsSynced; + QRect m_rect; + QRect m_finalRect; + QColor m_color; + GraphNode* m_sourceNode; // source node from which the connection comes + GraphNode* m_targetNode; // the target node + QPainterPath m_painterPath; + AZ::u16 m_portNr; // input port where this is connected to + AZ::u16 m_sourcePortNr; // source output port number + bool m_isVisible; // is this connection visible? + bool m_isProcessed; // is this connection processed? + bool m_isDisabled; + bool m_isDashed; + bool m_isHighlighted; + bool m_isHeadHighlighted; + bool m_isTailHighlighted; + bool m_isConnectedHighlighted; + bool m_isSynced; }; } // namespace EMStudio diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/NodeGraph.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/NodeGraph.cpp index 37ec2cfd8b..596f3d7e30 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/NodeGraph.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/NodeGraph.cpp @@ -42,55 +42,55 @@ namespace EMStudio parent = parent.parent(); } - mErrorBlinkOffset = 0.0f; - mUseAnimation = true; - mDashOffset = 0.0f; - mScale = 1.0f; - mScrollOffset = QPoint(0, 0); - mScalePivot = QPoint(0, 0); - mMinStepSize = 1; - mMaxStepSize = 75; - mEntryNode = nullptr; + m_errorBlinkOffset = 0.0f; + m_useAnimation = true; + m_dashOffset = 0.0f; + m_scale = 1.0f; + m_scrollOffset = QPoint(0, 0); + m_scalePivot = QPoint(0, 0); + m_minStepSize = 1; + m_maxStepSize = 75; + m_entryNode = nullptr; // init connection creation - mConStartOffset = QPoint(0, 0); - mConEndOffset = QPoint(0, 0); - mConPortNr = InvalidIndex16; - mConIsInputPort = true; - mConNode = nullptr; // nullptr when no connection is being created - mConPort = nullptr; - mConIsValid = false; - mTargetPort = nullptr; - mRelinkConnection = nullptr; - mReplaceTransitionHead = nullptr; - mReplaceTransitionTail = nullptr; - mReplaceTransitionSourceNode = nullptr; - mReplaceTransitionTargetNode = nullptr; - mReplaceTransitionStartOffset = QPoint(0, 0); - mReplaceTransitionEndOffset = QPoint(0, 0); + m_conStartOffset = QPoint(0, 0); + m_conEndOffset = QPoint(0, 0); + m_conPortNr = InvalidIndex16; + m_conIsInputPort = true; + m_conNode = nullptr; // nullptr when no connection is being created + m_conPort = nullptr; + m_conIsValid = false; + m_targetPort = nullptr; + m_relinkConnection = nullptr; + m_replaceTransitionHead = nullptr; + m_replaceTransitionTail = nullptr; + m_replaceTransitionSourceNode = nullptr; + m_replaceTransitionTargetNode = nullptr; + m_replaceTransitionStartOffset = QPoint(0, 0); + m_replaceTransitionEndOffset = QPoint(0, 0); // setup scroll interpolator - mStartScrollOffset = QPointF(0.0f, 0.0f); - mTargetScrollOffset = QPointF(0.0f, 0.0f); - mScrollTimer.setSingleShot(false); - connect(&mScrollTimer, &QTimer::timeout, this, &NodeGraph::UpdateAnimatedScrollOffset); + m_startScrollOffset = QPointF(0.0f, 0.0f); + m_targetScrollOffset = QPointF(0.0f, 0.0f); + m_scrollTimer.setSingleShot(false); + connect(&m_scrollTimer, &QTimer::timeout, this, &NodeGraph::UpdateAnimatedScrollOffset); // setup scale interpolator - mStartScale = 1.0f; - mTargetScale = 1.0f; - mScaleTimer.setSingleShot(false); - connect(&mScaleTimer, &QTimer::timeout, this, &NodeGraph::UpdateAnimatedScale); + m_startScale = 1.0f; + m_targetScale = 1.0f; + m_scaleTimer.setSingleShot(false); + connect(&m_scaleTimer, &QTimer::timeout, this, &NodeGraph::UpdateAnimatedScale); - mReplaceTransitionValid = false; + m_replaceTransitionValid = false; // Overlay - mFont.setPixelSize(12); - mTextOptions.setAlignment(Qt::AlignCenter); - mFontMetrics = new QFontMetrics(mFont); + m_font.setPixelSize(12); + m_textOptions.setAlignment(Qt::AlignCenter); + m_fontMetrics = new QFontMetrics(m_font); // Group nodes m_groupFont.setPixelSize(18); - m_groupFontMetrics = new QFontMetrics(mFont); + m_groupFontMetrics = new QFontMetrics(m_font); } @@ -99,7 +99,7 @@ namespace EMStudio { m_graphNodeByModelIndex.clear(); - delete mFontMetrics; + delete m_fontMetrics; } AZStd::vector NodeGraph::GetSelectedGraphNodes() const @@ -213,7 +213,7 @@ namespace EMStudio const QColor textColor = graphNode->GetIsHighlighted() ? QColor(0, 255, 0) : QColor(255, 255, 0); painter.setPen(textColor); - painter.setFont(mFont); + painter.setFont(m_font); QPoint textPosition = textRect.topLeft(); textPosition.setX(textPosition.x() + 3); @@ -222,32 +222,32 @@ namespace EMStudio // add the playspeed if (plugin->GetIsDisplayFlagEnabled(AnimGraphPlugin::DISPLAYFLAG_PLAYSPEED)) { - mQtTempString.asprintf("Play Speed = %.2f", emfxNode->GetPlaySpeed(animGraphInstance)); - painter.drawText(textPosition, mQtTempString); + m_qtTempString.asprintf("Play Speed = %.2f", emfxNode->GetPlaySpeed(animGraphInstance)); + painter.drawText(textPosition, m_qtTempString); textPosition.setY(textPosition.y() + heightSpacing); } // add the global weight if (plugin->GetIsDisplayFlagEnabled(AnimGraphPlugin::DISPLAYFLAG_GLOBALWEIGHT)) { - mQtTempString.asprintf("Global Weight = %.2f", uniqueData->GetGlobalWeight()); - painter.drawText(textPosition, mQtTempString); + m_qtTempString.asprintf("Global Weight = %.2f", uniqueData->GetGlobalWeight()); + painter.drawText(textPosition, m_qtTempString); textPosition.setY(textPosition.y() + heightSpacing); } // add the sync if (plugin->GetIsDisplayFlagEnabled(AnimGraphPlugin::DISPLAYFLAG_SYNCSTATUS)) { - mQtTempString.asprintf("Synced = %s", animGraphInstance->GetIsSynced(emfxNode->GetObjectIndex()) ? "Yes" : "No"); - painter.drawText(textPosition, mQtTempString); + m_qtTempString.asprintf("Synced = %s", animGraphInstance->GetIsSynced(emfxNode->GetObjectIndex()) ? "Yes" : "No"); + painter.drawText(textPosition, m_qtTempString); textPosition.setY(textPosition.y() + heightSpacing); } // add the play position if (plugin->GetIsDisplayFlagEnabled(AnimGraphPlugin::DISPLAYFLAG_PLAYPOSITION)) { - mQtTempString.asprintf("Play Time = %.3f / %.3f", uniqueData->GetCurrentPlayTime(), uniqueData->GetDuration()); - painter.drawText(textPosition, mQtTempString); + m_qtTempString.asprintf("Play Time = %.3f / %.3f", uniqueData->GetCurrentPlayTime(), uniqueData->GetDuration()); + painter.drawText(textPosition, m_qtTempString); textPosition.setY(textPosition.y() + heightSpacing); } } @@ -411,7 +411,7 @@ namespace EMStudio QPoint connectionAttachPoint = visualConnection->CalcFinalRect().center(); const int halfTextHeight = 6; - const int textWidth = mFontMetrics->horizontalAdvance(m_tempStringA.c_str()); + const int textWidth = m_fontMetrics->horizontalAdvance(m_tempStringA.c_str()); const int halfTextWidth = textWidth / 2; const QRect textRect(connectionAttachPoint.x() - halfTextWidth - 1, connectionAttachPoint.y() - halfTextHeight, textWidth + 4, halfTextHeight * 2); @@ -429,11 +429,8 @@ namespace EMStudio // draw the text const QColor& color = visualConnection->GetTargetNode()->GetInputPort(visualConnection->GetInputPortNr())->GetColor(); painter.setPen(color); - painter.setFont(mFont); - // OLD: - //painter.drawText( textPosition, mTempString.c_str() ); - // NEW: - GraphNode::RenderText(painter, m_tempStringA.c_str(), color, mFont, *mFontMetrics, Qt::AlignCenter, textRect); + painter.setFont(m_font); + GraphNode::RenderText(painter, m_tempStringA.c_str(), color, m_font, *m_fontMetrics, Qt::AlignCenter, textRect); } } } @@ -656,12 +653,12 @@ namespace EMStudio connection->SetIsTailHighlighted(false); } - if (mReplaceTransitionHead == connection) + if (m_replaceTransitionHead == connection) { connection->SetIsHeadHighlighted(true); } - if (mReplaceTransitionTail == connection) + if (m_replaceTransitionTail == connection) { connection->SetIsTailHighlighted(true); } @@ -693,8 +690,8 @@ namespace EMStudio void NodeGraph::Render(const QItemSelectionModel& selectionModel, QPainter& painter, int32 width, int32 height, const QPoint& mousePos, float timePassedInSeconds) { // control the scroll speed of the dashed blend tree connections etc - mDashOffset -= 7.5f * timePassedInSeconds; - mErrorBlinkOffset += 5.0f * timePassedInSeconds; + m_dashOffset -= 7.5f * timePassedInSeconds; + m_errorBlinkOffset += 5.0f * timePassedInSeconds; #ifdef GRAPH_PERFORMANCE_FRAMEDURATION MCore::Timer timer; @@ -706,11 +703,11 @@ namespace EMStudio //visibleRect.adjust(50, 50, -50, -50); // setup the transform - mTransform.reset(); - mTransform.translate(mScalePivot.x(), mScalePivot.y()); - mTransform.scale(mScale, mScale); - mTransform.translate(-mScalePivot.x() + mScrollOffset.x(), -mScalePivot.y() + mScrollOffset.y()); - painter.setTransform(mTransform); + m_transform.reset(); + m_transform.translate(m_scalePivot.x(), m_scalePivot.y()); + m_transform.scale(m_scale, m_scale); + m_transform.translate(-m_scalePivot.x() + m_scrollOffset.x(), -m_scalePivot.y() + m_scrollOffset.y()); + painter.setTransform(m_transform); // render the background #ifdef GRAPH_PERFORMANCE_INFO @@ -744,10 +741,10 @@ namespace EMStudio // calculate the connection stepsize // the higher the value, the less lines it renders (so faster) - int32 stepSize = aznumeric_cast(((1.0f / (mScale * (mScale * 1.75f))) * 10) - 7); - stepSize = MCore::Clamp(stepSize, mMinStepSize, mMaxStepSize); + int32 stepSize = aznumeric_cast(((1.0f / (m_scale * (m_scale * 1.75f))) * 10) - 7); + stepSize = MCore::Clamp(stepSize, m_minStepSize, m_maxStepSize); - QRect scaledVisibleRect = mTransform.inverted().mapRect(visibleRect); + QRect scaledVisibleRect = m_transform.inverted().mapRect(visibleRect); bool renderShadow = false; if (GetScale() >= 0.3f) @@ -791,7 +788,7 @@ namespace EMStudio StateConnection::RenderInterruptedTransitions(painter, GetAnimGraphModel(), *this); // render the entry state arrow - RenderEntryPoint(painter, mEntryNode); + RenderEntryPoint(painter, m_entryNode); #ifdef GRAPH_PERFORMANCE_FRAMEDURATION MCore::LogInfo("GraphRenderingTime: %.2f ms.", timer.GetTime() * 1000); @@ -815,7 +812,7 @@ namespace EMStudio painter.setOpacity(1.0f); painter.setPen(QColor(233, 233, 233)); - painter.setFont(mFont); + painter.setFont(m_font); painter.drawText(titleRect, text, QTextOption(Qt::AlignCenter)); painter.restore(); @@ -969,8 +966,8 @@ namespace EMStudio painter.setPen(QColor(40, 40, 40)); // calculate the coordinates in 'zoomed out and scrolled' coordinates, of the window rect - QPoint upperLeft = mTransform.inverted().map(QPoint(0, 0)); - QPoint lowerRight = mTransform.inverted().map(QPoint(width, height)); + QPoint upperLeft = m_transform.inverted().map(QPoint(0, 0)); + QPoint lowerRight = m_transform.inverted().map(QPoint(width, height)); // calculate the start and end ranges in 'scrolled and zoomed out' coordinates // we need to render sub-grids covering that area @@ -986,7 +983,7 @@ namespace EMStudio */ // calculate the alpha - float scale = mScale * mScale * 1.5f; + float scale = m_scale * m_scale * 1.5f; scale = MCore::Clamp(scale, 0.0f, 1.0f); const int32 alpha = aznumeric_cast(MCore::CalcCosineInterpolationWeight(scale) * 255); @@ -995,16 +992,14 @@ namespace EMStudio return; } - // mGridPen.setColor( QColor(58, 58, 58, alpha) ); - // mGridPen.setColor( QColor(46, 46, 46, alpha) ); - mGridPen.setColor(QColor(61, 61, 61, alpha)); - mSubgridPen.setColor(QColor(55, 55, 55, alpha)); + m_gridPen.setColor(QColor(61, 61, 61, alpha)); + m_subgridPen.setColor(QColor(55, 55, 55, alpha)); // setup spacing and size of the grid const int32 spacing = 10; // grid cell size of 20 // draw subgridlines first - painter.setPen(mSubgridPen); + painter.setPen(m_subgridPen); // draw vertical lines for (int32 x = startX; x < endX; x += spacing) @@ -1025,7 +1020,7 @@ namespace EMStudio } // draw render grid lines - painter.setPen(mGridPen); + painter.setPen(m_gridPen); // draw vertical lines for (int32 x = startX; x < endX; x += spacing) @@ -1292,8 +1287,8 @@ namespace EMStudio } else { - mScrollOffset = offset; - mScale = 1.0f; + m_scrollOffset = offset; + m_scale = 1.0f; } } else @@ -1309,7 +1304,7 @@ namespace EMStudio } else { - mScrollOffset = offset; + m_scrollOffset = offset; } // set the zoom factor so it exactly fits @@ -1333,7 +1328,7 @@ namespace EMStudio if (animate == false) { - mScale = MCore::Min(widthZoom, heightZoom); + m_scale = MCore::Min(widthZoom, heightZoom); } else { @@ -1346,10 +1341,10 @@ namespace EMStudio // start an animated scroll to the given scroll offset void NodeGraph::ScrollTo(const QPointF& point) { - mStartScrollOffset = mScrollOffset; - mTargetScrollOffset = point; - mScrollTimer.start(1000 / 60); - mScrollPreciseTimer.Stamp(); + m_startScrollOffset = m_scrollOffset; + m_targetScrollOffset = point; + m_scrollTimer.start(1000 / 60); + m_scrollPreciseTimer.Stamp(); } @@ -1358,16 +1353,15 @@ namespace EMStudio { const float duration = 0.75f; // duration in seconds - float timePassed = mScrollPreciseTimer.GetDeltaTimeInSeconds(); + float timePassed = m_scrollPreciseTimer.GetDeltaTimeInSeconds(); if (timePassed > duration) { timePassed = duration; - mScrollTimer.stop(); + m_scrollTimer.stop(); } const float t = timePassed / duration; - mScrollOffset = MCore::CosineInterpolate(mStartScrollOffset, mTargetScrollOffset, t).toPoint(); - //mGraphWidget->update(); + m_scrollOffset = MCore::CosineInterpolate(m_startScrollOffset, m_targetScrollOffset, t).toPoint(); } @@ -1376,16 +1370,15 @@ namespace EMStudio { const float duration = 0.75f; // duration in seconds - float timePassed = mScalePreciseTimer.GetDeltaTimeInSeconds(); + float timePassed = m_scalePreciseTimer.GetDeltaTimeInSeconds(); if (timePassed > duration) { timePassed = duration; - mScaleTimer.stop(); + m_scaleTimer.stop(); } const float t = timePassed / duration; - mScale = MCore::CosineInterpolate(mStartScale, mTargetScale, t); - //mGraphWidget->update(); + m_scale = MCore::CosineInterpolate(m_startScale, m_targetScale, t); } //static float scaleExp = 1.0f; @@ -1400,7 +1393,7 @@ namespace EMStudio //float t = -6 + (6 * scaleExp); //float newScale = 1/(1+exp(-t)) * 2; - float newScale = mScale + 0.35f; + float newScale = m_scale + 0.35f; newScale = MCore::Clamp(newScale, sLowestScale, 1.0f); ZoomTo(newScale); } @@ -1410,7 +1403,7 @@ namespace EMStudio // zoom out void NodeGraph::ZoomOut() { - float newScale = mScale - 0.35f; + float newScale = m_scale - 0.35f; //scaleExp -= 0.2f; //if (scaleExp < 0.01f) //scaleExp = 0.01f; @@ -1426,10 +1419,10 @@ namespace EMStudio // zoom to a given amount void NodeGraph::ZoomTo(float scale) { - mStartScale = mScale; - mTargetScale = scale; - mScaleTimer.start(1000 / 60); - mScalePreciseTimer.Stamp(); + m_startScale = m_scale; + m_targetScale = scale; + m_scaleTimer.start(1000 / 60); + m_scalePreciseTimer.Stamp(); if (scale < sLowestScale) { sLowestScale = scale; @@ -1440,14 +1433,14 @@ namespace EMStudio // stop an animated zoom void NodeGraph::StopAnimatedZoom() { - mScaleTimer.stop(); + m_scaleTimer.stop(); } // stop an animated scroll void NodeGraph::StopAnimatedScroll() { - mScrollTimer.stop(); + m_scrollTimer.stop(); } @@ -1462,7 +1455,7 @@ namespace EMStudio if (sceneRect.isEmpty() == false) { - const int border = aznumeric_cast(10.0f * (1.0f / mScale)); + const int border = aznumeric_cast(10.0f * (1.0f / m_scale)); sceneRect.adjust(-border, -border, border, border); ZoomOnRect(sceneRect, width, height, animate); } @@ -1500,20 +1493,20 @@ namespace EMStudio // start creating a connection void NodeGraph::StartCreateConnection(AZ::u16 portNr, bool isInputPort, GraphNode* portNode, NodePort* port, const QPoint& startOffset) { - mConPortNr = portNr; - mConIsInputPort = isInputPort; - mConNode = portNode; - mConPort = port; - mConStartOffset = startOffset; + m_conPortNr = portNr; + m_conIsInputPort = isInputPort; + m_conNode = portNode; + m_conPort = port; + m_conStartOffset = startOffset; } // start relinking a connection void NodeGraph::StartRelinkConnection(NodeConnection* connection, AZ::u16 portNr, GraphNode* node) { - mConPortNr = portNr; - mConNode = node; - mRelinkConnection = connection; + m_conPortNr = portNr; + m_conNode = node; + m_relinkConnection = connection; //MCore::LogInfo( "StartRelinkConnection: Connection=(%s->%s) portNr=%i, graphNode=%s", connection->GetSourceNode()->GetName(), connection->GetTargetNode()->GetName(), portNr, node->GetName() ); } @@ -1521,53 +1514,53 @@ namespace EMStudio void NodeGraph::StartReplaceTransitionHead(NodeConnection* connection, QPoint startOffset, QPoint endOffset, GraphNode* sourceNode, GraphNode* targetNode) { - mReplaceTransitionHead = connection; + m_replaceTransitionHead = connection; - mReplaceTransitionStartOffset = startOffset; - mReplaceTransitionEndOffset = endOffset; - mReplaceTransitionSourceNode = sourceNode; - mReplaceTransitionTargetNode = targetNode; + m_replaceTransitionStartOffset = startOffset; + m_replaceTransitionEndOffset = endOffset; + m_replaceTransitionSourceNode = sourceNode; + m_replaceTransitionTargetNode = targetNode; } void NodeGraph::StartReplaceTransitionTail(NodeConnection* connection, QPoint startOffset, QPoint endOffset, GraphNode* sourceNode, GraphNode* targetNode) { - mReplaceTransitionTail = connection; + m_replaceTransitionTail = connection; - mReplaceTransitionStartOffset = startOffset; - mReplaceTransitionEndOffset = endOffset; - mReplaceTransitionSourceNode = sourceNode; - mReplaceTransitionTargetNode = targetNode; + m_replaceTransitionStartOffset = startOffset; + m_replaceTransitionEndOffset = endOffset; + m_replaceTransitionSourceNode = sourceNode; + m_replaceTransitionTargetNode = targetNode; } void NodeGraph::GetReplaceTransitionInfo(NodeConnection** outOldConnection, QPoint* outOldStartOffset, QPoint* outOldEndOffset, GraphNode** outOldSourceNode, GraphNode** outOldTargetNode) { - if (mReplaceTransitionHead) + if (m_replaceTransitionHead) { - *outOldConnection = mReplaceTransitionHead; + *outOldConnection = m_replaceTransitionHead; } - if (mReplaceTransitionTail) + if (m_replaceTransitionTail) { - *outOldConnection = mReplaceTransitionTail; + *outOldConnection = m_replaceTransitionTail; } - *outOldStartOffset = mReplaceTransitionStartOffset; - *outOldEndOffset = mReplaceTransitionEndOffset; - *outOldSourceNode = mReplaceTransitionSourceNode; - *outOldTargetNode = mReplaceTransitionTargetNode; + *outOldStartOffset = m_replaceTransitionStartOffset; + *outOldEndOffset = m_replaceTransitionEndOffset; + *outOldSourceNode = m_replaceTransitionSourceNode; + *outOldTargetNode = m_replaceTransitionTargetNode; } void NodeGraph::StopReplaceTransitionHead() { - mReplaceTransitionHead = nullptr; + m_replaceTransitionHead = nullptr; } void NodeGraph::StopReplaceTransitionTail() { - mReplaceTransitionTail = nullptr; + m_replaceTransitionTail = nullptr; } @@ -1575,11 +1568,11 @@ namespace EMStudio // reset members void NodeGraph::StopRelinkConnection() { - mConPortNr = InvalidIndex16; - mConNode = nullptr; - mRelinkConnection = nullptr; - mConIsValid = false; - mTargetPort = nullptr; + m_conPortNr = InvalidIndex16; + m_conNode = nullptr; + m_relinkConnection = nullptr; + m_conIsValid = false; + m_targetPort = nullptr; } @@ -1587,12 +1580,12 @@ namespace EMStudio // reset members void NodeGraph::StopCreateConnection() { - mConPortNr = InvalidIndex16; - mConIsInputPort = true; - mConNode = nullptr; // nullptr when no connection is being created - mConPort = nullptr; - mTargetPort = nullptr; - mConIsValid = false; + m_conPortNr = InvalidIndex16; + m_conIsInputPort = true; + m_conNode = nullptr; // nullptr when no connection is being created + m_conPort = nullptr; + m_targetPort = nullptr; + m_conIsValid = false; } @@ -1672,7 +1665,7 @@ namespace EMStudio const AZ::u16 numInputPorts = node->GetNumInputPorts(); for (AZ::u16 i = 0; i < numInputPorts; ++i) { - if (CheckIfIsRelinkConnectionValid(mRelinkConnection, node, i, true)) + if (CheckIfIsRelinkConnectionValid(m_relinkConnection, node, i, true)) { QPoint tempStart = end; QPoint tempEnd = node->GetInputPort(i)->GetRect().center(); @@ -1686,9 +1679,9 @@ namespace EMStudio } // figure out the color of the connection line - if (mTargetPort) + if (m_targetPort) { - if (mConIsValid) + if (m_conIsValid) { painter.setPen(QColor(0, 255, 0)); } @@ -1780,14 +1773,13 @@ namespace EMStudio //------------------------------ // update the end point - //start = mConPort->GetRect().center(); start = GetCreateConnectionNode()->GetRect().topLeft() + GetCreateConnectionStartOffset(); end = m_graphWidget->GetMousePos(); // figure out the color of the connection line - if (mTargetPort) + if (m_targetPort) { - if (mConIsValid) + if (m_conIsValid) { painter.setPen(QColor(0, 255, 0)); } @@ -1967,9 +1959,9 @@ namespace EMStudio GraphNodeByModelIndex::const_iterator it = m_graphNodeByModelIndex.find(modelIndex); if (it != m_graphNodeByModelIndex.end()) { - if (it->second.get() == mEntryNode) + if (it->second.get() == m_entryNode) { - mEntryNode = nullptr; + m_entryNode = nullptr; } m_graphNodeByModelIndex.erase(it); } @@ -2489,11 +2481,7 @@ namespace EMStudio // draw the name on top color.setAlpha(255); - //painter.setPen( color ); - //mTempString = nodeGroup->GetName(); - //painter.setFont( m_groupFont ); GraphNode::RenderText(painter, nodeGroup->GetName(), color, m_groupFont, *m_groupFontMetrics, Qt::AlignLeft, textRect); - //painter.drawText( left - 7, top - 7, mTempString ); } } // for all node groups } diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/NodeGraph.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/NodeGraph.h index 11490d8b49..47b316ff81 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/NodeGraph.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/NodeGraph.h @@ -49,43 +49,43 @@ namespace EMStudio bool IsInReferencedGraph() const { return m_parentReferenceNode.isValid(); } - const QTransform& GetTransform() const { return mTransform; } - float GetScale() const { return mScale; } - void SetScale(float scale) { mScale = scale; } - const QPoint& GetScrollOffset() const { return mScrollOffset; } - void SetScrollOffset(const QPoint& offset) { mScrollOffset = offset; } - void SetScalePivot(const QPoint& pivot) { mScalePivot = pivot; } + const QTransform& GetTransform() const { return m_transform; } + float GetScale() const { return m_scale; } + void SetScale(float scale) { m_scale = scale; } + const QPoint& GetScrollOffset() const { return m_scrollOffset; } + void SetScrollOffset(const QPoint& offset) { m_scrollOffset = offset; } + void SetScalePivot(const QPoint& pivot) { m_scalePivot = pivot; } float GetLowestScale() const { return sLowestScale; } - bool GetIsCreatingConnection() const { return (mConNode && mRelinkConnection == nullptr); } - bool GetIsRelinkingConnection() const { return (mConNode && mRelinkConnection); } - void SetCreateConnectionIsValid(bool isValid) { mConIsValid = isValid; } - bool GetIsCreateConnectionValid() const { return mConIsValid; } - void SetTargetPort(NodePort* port) { mTargetPort = port; } - NodePort* GetTargetPort() { return mTargetPort; } - float GetDashOffset() const { return mDashOffset; } - QColor GetErrorBlinkColor() const { int32 red = aznumeric_cast(160 + ((0.5f + 0.5f * MCore::Math::Cos(mErrorBlinkOffset)) * 96)); red = MCore::Clamp(red, 0, 255); return QColor(red, 0, 0); } + bool GetIsCreatingConnection() const { return (m_conNode && m_relinkConnection == nullptr); } + bool GetIsRelinkingConnection() const { return (m_conNode && m_relinkConnection); } + void SetCreateConnectionIsValid(bool isValid) { m_conIsValid = isValid; } + bool GetIsCreateConnectionValid() const { return m_conIsValid; } + void SetTargetPort(NodePort* port) { m_targetPort = port; } + NodePort* GetTargetPort() { return m_targetPort; } + float GetDashOffset() const { return m_dashOffset; } + QColor GetErrorBlinkColor() const { int32 red = aznumeric_cast(160 + ((0.5f + 0.5f * MCore::Math::Cos(m_errorBlinkOffset)) * 96)); red = MCore::Clamp(red, 0, 255); return QColor(red, 0, 0); } - bool GetIsRepositioningTransitionHead() const { return (mReplaceTransitionHead); } - bool GetIsRepositioningTransitionTail() const { return (mReplaceTransitionTail); } - NodeConnection* GetRepositionedTransitionHead() const { return mReplaceTransitionHead; } - NodeConnection* GetRepositionedTransitionTail() const { return mReplaceTransitionTail; } + bool GetIsRepositioningTransitionHead() const { return (m_replaceTransitionHead); } + bool GetIsRepositioningTransitionTail() const { return (m_replaceTransitionTail); } + NodeConnection* GetRepositionedTransitionHead() const { return m_replaceTransitionHead; } + NodeConnection* GetRepositionedTransitionTail() const { return m_replaceTransitionTail; } void StartReplaceTransitionHead(NodeConnection* connection, QPoint startOffset, QPoint endOffset, GraphNode* sourceNode, GraphNode* targetNode); void StartReplaceTransitionTail(NodeConnection* connection, QPoint startOffset, QPoint endOffset, GraphNode* sourceNode, GraphNode* targetNode); void GetReplaceTransitionInfo(NodeConnection** outConnection, QPoint* outOldStartOffset, QPoint* outOldEndOffset, GraphNode** outOldSourceNode, GraphNode** outOldTargetNode); void StopReplaceTransitionHead(); void StopReplaceTransitionTail(); - void SetReplaceTransitionValid(bool isValid) { mReplaceTransitionValid = isValid; } - bool GetReplaceTransitionValid() const { return mReplaceTransitionValid; } + void SetReplaceTransitionValid(bool isValid) { m_replaceTransitionValid = isValid; } + bool GetReplaceTransitionValid() const { return m_replaceTransitionValid; } void RenderReplaceTransition(QPainter& painter); - GraphNode* GetCreateConnectionNode() { return mConNode; } - NodeConnection* GetRelinkConnection() { return mRelinkConnection; } - AZ::u16 GetCreateConnectionPortNr() const { return mConPortNr; } - bool GetCreateConnectionIsInputPort() const { return mConIsInputPort; } - const QPoint& GetCreateConnectionStartOffset() const { return mConStartOffset; } - const QPoint& GetCreateConnectionEndOffset() const { return mConEndOffset; } - void SetCreateConnectionEndOffset(const QPoint& offset){ mConEndOffset = offset; } + GraphNode* GetCreateConnectionNode() { return m_conNode; } + NodeConnection* GetRelinkConnection() { return m_relinkConnection; } + AZ::u16 GetCreateConnectionPortNr() const { return m_conPortNr; } + bool GetCreateConnectionIsInputPort() const { return m_conIsInputPort; } + const QPoint& GetCreateConnectionStartOffset() const { return m_conStartOffset; } + const QPoint& GetCreateConnectionEndOffset() const { return m_conEndOffset; } + void SetCreateConnectionEndOffset(const QPoint& offset){ m_conEndOffset = offset; } bool CheckIfHasConnection(GraphNode* sourceNode, AZ::u16 outputPortNr, GraphNode* targetNode, AZ::u16 inputPortNr) const; NodeConnection* FindInputConnection(GraphNode* targetNode, AZ::u16 targetPortNr) const; @@ -121,7 +121,7 @@ namespace EMStudio NodePort* FindPort(int32 x, int32 y, GraphNode** outNode, AZ::u16* outPortNr, bool* outIsInputPort, bool includeInputPorts = true); // entry state helper functions - void SetEntryNode(GraphNode* entryNode) { mEntryNode = entryNode; } + void SetEntryNode(GraphNode* entryNode) { m_entryNode = entryNode; } static void RenderEntryPoint(QPainter& painter, GraphNode* node); void FitGraphOnScreen(int32 width, int32 height, const QPoint& mousePos, bool animate = true); @@ -140,8 +140,8 @@ namespace EMStudio static bool LineIntersectsRect(const QRect& b, float x1, float y1, float x2, float y2, double* outX = nullptr, double* outY = nullptr); void DrawOverlay(QPainter& painter); - bool GetUseAnimation() const { return mUseAnimation; } - void SetUseAnimation(bool useAnim) { mUseAnimation = useAnim; } + bool GetUseAnimation() const { return m_useAnimation; } + void SetUseAnimation(bool useAnim) { m_useAnimation = useAnim; } // These methods are not slots, they are being called from BlendGraphWidget void OnRowsAboutToBeRemoved(const QModelIndexList& modelIndexes); @@ -175,55 +175,55 @@ namespace EMStudio using GraphNodeByModelIndex = AZStd::unordered_map, QPersistentModelIndexHash>; GraphNodeByModelIndex m_graphNodeByModelIndex; - GraphNode* mEntryNode; - QTransform mTransform; - float mScale; + GraphNode* m_entryNode; + QTransform m_transform; + float m_scale; static float sLowestScale; - int32 mMinStepSize; - int32 mMaxStepSize; - QPoint mScrollOffset; - QPoint mScalePivot; + int32 m_minStepSize; + int32 m_maxStepSize; + QPoint m_scrollOffset; + QPoint m_scalePivot; - QPointF mTargetScrollOffset; - QPointF mStartScrollOffset; - QTimer mScrollTimer; - AZ::Debug::Timer mScrollPreciseTimer; + QPointF m_targetScrollOffset; + QPointF m_startScrollOffset; + QTimer m_scrollTimer; + AZ::Debug::Timer m_scrollPreciseTimer; - float mTargetScale; - float mStartScale; - QTimer mScaleTimer; - AZ::Debug::Timer mScalePreciseTimer; + float m_targetScale; + float m_startScale; + QTimer m_scaleTimer; + AZ::Debug::Timer m_scalePreciseTimer; // connection info - QPoint mConStartOffset; - QPoint mConEndOffset; - AZ::u16 mConPortNr; - bool mConIsInputPort; - GraphNode* mConNode; // nullptr when no connection is being created - NodeConnection* mRelinkConnection; // nullptr when not relinking a connection - NodePort* mConPort; - NodePort* mTargetPort; - bool mConIsValid; - float mDashOffset; - float mErrorBlinkOffset; - bool mUseAnimation; + QPoint m_conStartOffset; + QPoint m_conEndOffset; + AZ::u16 m_conPortNr; + bool m_conIsInputPort; + GraphNode* m_conNode; // nullptr when no connection is being created + NodeConnection* m_relinkConnection; // nullptr when not relinking a connection + NodePort* m_conPort; + NodePort* m_targetPort; + bool m_conIsValid; + float m_dashOffset; + float m_errorBlinkOffset; + bool m_useAnimation; - NodeConnection* mReplaceTransitionHead; // nullptr when not replacing a transition head - NodeConnection* mReplaceTransitionTail; // nullptr when not replacing a transition tail - QPoint mReplaceTransitionStartOffset; - QPoint mReplaceTransitionEndOffset; - GraphNode* mReplaceTransitionSourceNode; - GraphNode* mReplaceTransitionTargetNode; - bool mReplaceTransitionValid; + NodeConnection* m_replaceTransitionHead; // nullptr when not replacing a transition head + NodeConnection* m_replaceTransitionTail; // nullptr when not replacing a transition tail + QPoint m_replaceTransitionStartOffset; + QPoint m_replaceTransitionEndOffset; + GraphNode* m_replaceTransitionSourceNode; + GraphNode* m_replaceTransitionTargetNode; + bool m_replaceTransitionValid; - QPen mSubgridPen; - QPen mGridPen; + QPen m_subgridPen; + QPen m_gridPen; // Overlay drawing - QFont mFont; - QString mQtTempString; - QTextOption mTextOptions; - QFontMetrics* mFontMetrics; + QFont m_font; + QString m_qtTempString; + QTextOption m_textOptions; + QFontMetrics* m_fontMetrics; AZStd::string m_tempStringA; AZStd::string m_tempStringB; AZStd::string m_tempStringC; diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/NodeGraphWidget.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/NodeGraphWidget.cpp index d7afe634a1..c8085a876a 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/NodeGraphWidget.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/NodeGraphWidget.cpp @@ -37,8 +37,8 @@ namespace EMStudio { setObjectName("NodeGraphWidget"); - mPlugin = plugin; - mFontMetrics = new QFontMetrics(mFont); + m_plugin = plugin; + m_fontMetrics = new QFontMetrics(m_font); // update the active graph SetActiveGraph(activeGraph); @@ -47,19 +47,19 @@ namespace EMStudio setMouseTracking(true); // init members - mShowFPS = false; - mLeftMousePressed = false; - mPanning = false; - mMiddleMousePressed = false; - mRightMousePressed = false; - mRectSelecting = false; - mShiftPressed = false; - mControlPressed = false; - mAltPressed = false; - mMoveNode = nullptr; - mMouseLastPos = QPoint(0, 0); - mMouseLastPressPos = QPoint(0, 0); - mMousePos = QPoint(0, 0); + m_showFps = false; + m_leftMousePressed = false; + m_panning = false; + m_middleMousePressed = false; + m_rightMousePressed = false; + m_rectSelecting = false; + m_shiftPressed = false; + m_controlPressed = false; + m_altPressed = false; + m_moveNode = nullptr; + m_mouseLastPos = QPoint(0, 0); + m_mouseLastPressPos = QPoint(0, 0); + m_mousePos = QPoint(0, 0); // setup to get focus when we click or use the mouse wheel setFocusPolicy((Qt::FocusPolicy)(Qt::ClickFocus | Qt::WheelFocus)); @@ -70,10 +70,10 @@ namespace EMStudio setAutoFillBackground(false); setAttribute(Qt::WA_OpaquePaintEvent); - mCurWidth = geometry().width(); - mCurHeight = geometry().height(); - mPrevWidth = mCurWidth; - mPrevHeight = mCurHeight; + m_curWidth = geometry().width(); + m_curHeight = geometry().height(); + m_prevWidth = m_curWidth; + m_prevHeight = m_curHeight; } @@ -81,7 +81,7 @@ namespace EMStudio NodeGraphWidget::~NodeGraphWidget() { // delete the overlay font metrics - delete mFontMetrics; + delete m_fontMetrics; } @@ -98,20 +98,20 @@ namespace EMStudio { static QPoint sizeDiff(0, 0); - mCurWidth = w; - mCurHeight = h; + m_curWidth = w; + m_curHeight = h; // specify the center of the window, so that that is the origin - if (mActiveGraph) + if (m_activeGraph) { - mActiveGraph->SetScalePivot(QPoint(w / 2, h / 2)); + m_activeGraph->SetScalePivot(QPoint(w / 2, h / 2)); - QPoint scrollOffset = mActiveGraph->GetScrollOffset(); + QPoint scrollOffset = m_activeGraph->GetScrollOffset(); int32 scrollOffsetX = scrollOffset.x(); int32 scrollOffsetY = scrollOffset.y(); // calculate the size delta - QPoint oldSize = QPoint(mPrevWidth, mPrevHeight); + QPoint oldSize = QPoint(m_prevWidth, m_prevHeight); QPoint size = QPoint(w, h); QPoint diff = oldSize - size; sizeDiff += diff; @@ -136,35 +136,35 @@ namespace EMStudio sizeDiff.setY(modRes); } - mActiveGraph->SetScrollOffset(QPoint(scrollOffsetX, scrollOffsetY)); + m_activeGraph->SetScrollOffset(QPoint(scrollOffsetX, scrollOffsetY)); //MCore::LOG("%d, %d", scrollOffsetX, scrollOffsetY); } QOpenGLWidget::resizeGL(w, h); - mPrevWidth = w; - mPrevHeight = h; + m_prevWidth = w; + m_prevHeight = h; } // set the active graph void NodeGraphWidget::SetActiveGraph(NodeGraph* graph) { - if (mActiveGraph == graph) + if (m_activeGraph == graph) { return; } - if (mActiveGraph) + if (m_activeGraph) { - mActiveGraph->StopCreateConnection(); - mActiveGraph->StopRelinkConnection(); - mActiveGraph->StopReplaceTransitionHead(); - mActiveGraph->StopReplaceTransitionTail(); + m_activeGraph->StopCreateConnection(); + m_activeGraph->StopRelinkConnection(); + m_activeGraph->StopReplaceTransitionHead(); + m_activeGraph->StopReplaceTransitionTail(); } - mActiveGraph = graph; - mMoveNode = nullptr; + m_activeGraph = graph; + m_moveNode = nullptr; emit ActiveGraphChanged(); } @@ -173,7 +173,7 @@ namespace EMStudio // get the active graph NodeGraph* NodeGraphWidget::GetActiveGraph() const { - return mActiveGraph; + return m_activeGraph; } @@ -193,7 +193,7 @@ namespace EMStudio glClear(GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // calculate the time passed since the last render - const float timePassedInSeconds = mRenderTimer.StampAndGetDeltaTimeInSeconds(); + const float timePassedInSeconds = m_renderTimer.StampAndGetDeltaTimeInSeconds(); // start painting QPainter painter(this); @@ -202,8 +202,8 @@ namespace EMStudio painter.setRenderHint(QPainter::TextAntialiasing); // get the width and height - const uint32 width = mCurWidth; - const uint32 height = mCurHeight; + const uint32 width = m_curWidth; + const uint32 height = m_curHeight; // fill the background //painter.fillRect( event->rect(), QColor(30, 30, 30) ); @@ -212,19 +212,19 @@ namespace EMStudio painter.drawRect(QRect(0, 0, width, height)); // render the active graph - if (mActiveGraph) + if (m_activeGraph) { - mActiveGraph->Render(mPlugin->GetAnimGraphModel().GetSelectionModel(), painter, width, height, mMousePos, timePassedInSeconds); + m_activeGraph->Render(m_plugin->GetAnimGraphModel().GetSelectionModel(), painter, width, height, m_mousePos, timePassedInSeconds); } // render selection rect - if (mRectSelecting) + if (m_rectSelecting) { painter.resetTransform(); QRect selectRect; CalcSelectRect(selectRect); - if (mAltPressed) + if (m_altPressed) { painter.setBrush(QColor(0, 100, 200, 75)); painter.setPen(QColor(0, 100, 255)); @@ -242,10 +242,10 @@ namespace EMStudio OnDrawOverlay(painter); // render the callback overlay - if (mActiveGraph) + if (m_activeGraph) { painter.resetTransform(); - mActiveGraph->DrawOverlay(painter); + m_activeGraph->DrawOverlay(painter); } // draw the border @@ -277,7 +277,7 @@ namespace EMStudio //painter.setBackgroundMode(Qt::TransparentMode); // render FPS counter - if (mShowFPS) + if (m_showFps) { // get the time delta between the current time and the last frame static AZ::Debug::Timer perfTimer; @@ -288,7 +288,7 @@ namespace EMStudio static uint32 fpsNumFrames = 0; static uint32 lastFPS = 0; fpsTimeElapsed += perfTimeDelta; - const float renderTime = mRenderTimer.StampAndGetDeltaTimeInSeconds() * 1000.0f; + const float renderTime = m_renderTimer.StampAndGetDeltaTimeInSeconds() * 1000.0f; fpsNumFrames++; if (fpsTimeElapsed > 1.0f) { @@ -300,7 +300,7 @@ namespace EMStudio static AZStd::string perfTempString; perfTempString = AZStd::string::format("%i FPS (%.1f ms)", lastFPS, renderTime); - GraphNode::RenderText(painter, perfTempString.c_str(), QColor(150, 150, 150), mFont, *mFontMetrics, Qt::AlignRight, QRect(width - 55, height - 20, 50, 20)); + GraphNode::RenderText(painter, perfTempString.c_str(), QColor(150, 150, 150), m_font, *m_fontMetrics, Qt::AlignRight, QRect(width - 55, height - 20, 50, 20)); } // show the info to which actor the currently rendered graph belongs to @@ -312,13 +312,13 @@ namespace EMStudio EMotionFX::ActorInstance* firstActorInstance = selectionList.GetFirstActorInstance(); // update the stored short filename without path - if (mFullActorName != firstActorInstance->GetActor()->GetFileName()) + if (m_fullActorName != firstActorInstance->GetActor()->GetFileName()) { - AzFramework::StringFunc::Path::GetFileName(firstActorInstance->GetActor()->GetFileNameString().c_str(), mActorName); + AzFramework::StringFunc::Path::GetFileName(firstActorInstance->GetActor()->GetFileNameString().c_str(), m_actorName); } - mTempString = AZStd::string::format("Showing graph for ActorInstance with ID %d and Actor file \"%s\"", firstActorInstance->GetID(), mActorName.c_str()); - GraphNode::RenderText(painter, mTempString.c_str(), QColor(150, 150, 150), mFont, *mFontMetrics, Qt::AlignLeft, QRect(8, 0, 50, 20)); + m_tempString = AZStd::string::format("Showing graph for ActorInstance with ID %d and Actor file \"%s\"", firstActorInstance->GetID(), m_actorName.c_str()); + GraphNode::RenderText(painter, m_tempString.c_str(), QColor(150, 150, 150), m_font, *m_fontMetrics, Qt::AlignLeft, QRect(8, 0, 50, 20)); } } @@ -326,9 +326,9 @@ namespace EMStudio // convert to a global position QPoint NodeGraphWidget::LocalToGlobal(const QPoint& inPoint) const { - if (mActiveGraph) + if (m_activeGraph) { - return mActiveGraph->GetTransform().inverted().map(inPoint); + return m_activeGraph->GetTransform().inverted().map(inPoint); } return inPoint; @@ -338,9 +338,9 @@ namespace EMStudio // convert to a local position QPoint NodeGraphWidget::GlobalToLocal(const QPoint& inPoint) const { - if (mActiveGraph) + if (m_activeGraph) { - return mActiveGraph->GetTransform().map(inPoint); + return m_activeGraph->GetTransform().map(inPoint); } return inPoint; @@ -351,19 +351,16 @@ namespace EMStudio { MCORE_UNUSED(cellSize); - //QPoint scaledMouseDelta = (mousePos - mMouseLastPos) * (1.0f / mActiveGraph->GetScale()); - //QPoint unSnappedTopRight = oldTopRight + scaledMouseDelta; QPoint snapped; snapped.setX(inPoint.x() - aznumeric_cast(MCore::Math::FMod(aznumeric_cast(inPoint.x()), 10.0f))); snapped.setY(inPoint.y() - aznumeric_cast(MCore::Math::FMod(aznumeric_cast(inPoint.y()), 10.0f))); - //snapDelta = snappedTopRight - unSnappedTopRight; return snapped; } // mouse is moving over the widget void NodeGraphWidget::mouseMoveEvent(QMouseEvent* event) { - if (mActiveGraph == nullptr) + if (m_activeGraph == nullptr) { return; } @@ -372,51 +369,51 @@ namespace EMStudio QPoint mousePos = event->pos(); QPoint snapDelta(0, 0); - if (mMoveNode && mLeftMousePressed && mPanning == false && mRectSelecting == false) + if (m_moveNode && m_leftMousePressed && m_panning == false && m_rectSelecting == false) { - QPoint oldTopRight = mMoveNode->GetRect().topRight(); - QPoint scaledMouseDelta = (mousePos - mMouseLastPos) * (1.0f / mActiveGraph->GetScale()); + QPoint oldTopRight = m_moveNode->GetRect().topRight(); + QPoint scaledMouseDelta = (mousePos - m_mouseLastPos) * (1.0f / m_activeGraph->GetScale()); QPoint unSnappedTopRight = oldTopRight + scaledMouseDelta; QPoint snappedTopRight = SnapLocalToGrid(unSnappedTopRight, 10); snapDelta = snappedTopRight - unSnappedTopRight; } - mousePos += snapDelta * mActiveGraph->GetScale(); - QPoint delta = (mousePos - mMouseLastPos) * (1.0f / mActiveGraph->GetScale()); - mMouseLastPos = mousePos; + mousePos += snapDelta * m_activeGraph->GetScale(); + QPoint delta = (mousePos - m_mouseLastPos) * (1.0f / m_activeGraph->GetScale()); + m_mouseLastPos = mousePos; QPoint globalPos = LocalToGlobal(mousePos); SetMousePos(globalPos); //if (delta.x() > 0 || delta.x() < -0 || delta.y() > 0 || delta.y() < -0) if (delta.x() != 0 || delta.y() != 0) { - mAllowContextMenu = false; + m_allowContextMenu = false; } // update modifiers - mAltPressed = event->modifiers() & Qt::AltModifier; - mShiftPressed = event->modifiers() & Qt::ShiftModifier; - mControlPressed = event->modifiers() & Qt::ControlModifier; + m_altPressed = event->modifiers() & Qt::AltModifier; + m_shiftPressed = event->modifiers() & Qt::ShiftModifier; + m_controlPressed = event->modifiers() & Qt::ControlModifier; /*GraphNode* node = */ UpdateMouseCursor(mousePos, globalPos); - if (mRectSelecting == false && mMoveNode == nullptr && - mPlugin->GetActionFilter().m_editConnections && - !mActiveGraph->IsInReferencedGraph()) + if (m_rectSelecting == false && m_moveNode == nullptr && + m_plugin->GetActionFilter().m_editConnections && + !m_activeGraph->IsInReferencedGraph()) { // check if we are clicking on a port GraphNode* portNode = nullptr; NodePort* port = nullptr; AZ::u16 portNr = InvalidIndex16; bool isInputPort = true; - port = mActiveGraph->FindPort(globalPos.x(), globalPos.y(), &portNode, &portNr, &isInputPort); + port = m_activeGraph->FindPort(globalPos.x(), globalPos.y(), &portNode, &portNr, &isInputPort); // check if we are adjusting a transition head or tail - if (mActiveGraph->GetIsRepositioningTransitionHead() || mActiveGraph->GetIsRepositioningTransitionTail()) + if (m_activeGraph->GetIsRepositioningTransitionHead() || m_activeGraph->GetIsRepositioningTransitionTail()) { - NodeConnection* connection = mActiveGraph->GetRepositionedTransitionHead(); + NodeConnection* connection = m_activeGraph->GetRepositionedTransitionHead(); if (connection == nullptr) { - connection = mActiveGraph->GetRepositionedTransitionTail(); + connection = m_activeGraph->GetRepositionedTransitionTail(); } MCORE_ASSERT(connection->GetType() == StateConnection::TYPE_ID); @@ -426,13 +423,13 @@ namespace EMStudio if (transition) { // check if our mouse is-over a node - GraphNode* hoveredNode = mActiveGraph->FindNode(mousePos); + GraphNode* hoveredNode = m_activeGraph->FindNode(mousePos); if (hoveredNode == nullptr && portNode) { hoveredNode = portNode; } - if (mActiveGraph->GetIsRepositioningTransitionHead()) + if (m_activeGraph->GetIsRepositioningTransitionHead()) { // when adjusting the arrow head and we are over the source node with the mouse if (hoveredNode @@ -440,11 +437,11 @@ namespace EMStudio && CheckIfIsValidTransition(stateConnection->GetSourceNode(), hoveredNode)) { stateConnection->SetTargetNode(hoveredNode); - mActiveGraph->SetReplaceTransitionValid(true); + m_activeGraph->SetReplaceTransitionValid(true); } else { - mActiveGraph->SetReplaceTransitionValid(false); + m_activeGraph->SetReplaceTransitionValid(false); } GraphNode* targetNode = stateConnection->GetTargetNode(); @@ -455,7 +452,7 @@ namespace EMStudio newEndOffset.x(), newEndOffset.y()); } } - else if (mActiveGraph->GetIsRepositioningTransitionTail()) + else if (m_activeGraph->GetIsRepositioningTransitionTail()) { // when adjusting the arrow tail and we are over the target node with the mouse if (hoveredNode @@ -463,11 +460,11 @@ namespace EMStudio && CheckIfIsValidTransition(hoveredNode, stateConnection->GetTargetNode())) { stateConnection->SetSourceNode(hoveredNode); - mActiveGraph->SetReplaceTransitionValid(true); + m_activeGraph->SetReplaceTransitionValid(true); } else { - mActiveGraph->SetReplaceTransitionValid(false); + m_activeGraph->SetReplaceTransitionValid(false); } GraphNode* sourceNode = stateConnection->GetSourceNode(); @@ -484,19 +481,19 @@ namespace EMStudio // connection relinking or creation if (port) { - if (mActiveGraph->GetIsCreatingConnection()) + if (m_activeGraph->GetIsCreatingConnection()) { const bool isValid = CheckIfIsCreateConnectionValid(portNr, portNode, port, isInputPort); - mActiveGraph->SetCreateConnectionIsValid(isValid); - mActiveGraph->SetTargetPort(port); + m_activeGraph->SetCreateConnectionIsValid(isValid); + m_activeGraph->SetTargetPort(port); //update(); return; } - else if (mActiveGraph->GetIsRelinkingConnection()) + else if (m_activeGraph->GetIsRelinkingConnection()) { - bool isValid = NodeGraph::CheckIfIsRelinkConnectionValid(mActiveGraph->GetRelinkConnection(), portNode, portNr, isInputPort); - mActiveGraph->SetCreateConnectionIsValid(isValid); - mActiveGraph->SetTargetPort(port); + bool isValid = NodeGraph::CheckIfIsRelinkConnectionValid(m_activeGraph->GetRelinkConnection(), portNode, portNr, isInputPort); + m_activeGraph->SetCreateConnectionIsValid(isValid); + m_activeGraph->SetTargetPort(port); //update(); return; } @@ -512,12 +509,12 @@ namespace EMStudio } else { - mActiveGraph->SetTargetPort(nullptr); + m_activeGraph->SetTargetPort(nullptr); } } // if we are panning - if (mPanning) + if (m_panning) { // handle mouse wrapping, to enable smoother panning bool mouseWrapped = false; @@ -525,26 +522,26 @@ namespace EMStudio { mouseWrapped = true; QCursor::setPos(QPoint(event->globalX() - width(), event->globalY())); - mMouseLastPos = QPoint(event->x() - width(), event->y()); + m_mouseLastPos = QPoint(event->x() - width(), event->y()); } else if (event->x() < 0) { mouseWrapped = true; QCursor::setPos(QPoint(event->globalX() + width(), event->globalY())); - mMouseLastPos = QPoint(event->x() + width(), event->y()); + m_mouseLastPos = QPoint(event->x() + width(), event->y()); } if (event->y() > (int32)height()) { mouseWrapped = true; QCursor::setPos(QPoint(event->globalX(), event->globalY() - height())); - mMouseLastPos = QPoint(event->x(), event->y() - height()); + m_mouseLastPos = QPoint(event->x(), event->y() - height()); } else if (event->y() < 0) { mouseWrapped = true; QCursor::setPos(QPoint(event->globalX(), event->globalY() + height())); - mMouseLastPos = QPoint(event->x(), event->y() + height()); + m_mouseLastPos = QPoint(event->x(), event->y() + height()); } // don't apply the delta, if mouse has been wrapped @@ -553,15 +550,15 @@ namespace EMStudio delta = QPoint(0, 0); } - if (mActiveGraph) + if (m_activeGraph) { // scrolling - if (mAltPressed == false) + if (m_altPressed == false) { - QPoint newOffset = mActiveGraph->GetScrollOffset(); + QPoint newOffset = m_activeGraph->GetScrollOffset(); newOffset += delta; - mActiveGraph->SetScrollOffset(newOffset); - mActiveGraph->StopAnimatedScroll(); + m_activeGraph->SetScrollOffset(newOffset); + m_activeGraph->StopAnimatedScroll(); UpdateMouseCursor(mousePos, globalPos); //update(); return; @@ -570,12 +567,12 @@ namespace EMStudio else { // stop the automated zoom - mActiveGraph->StopAnimatedZoom(); + m_activeGraph->StopAnimatedZoom(); // calculate the new scale value const float scaleDelta = (delta.y() / 120.0f) * 0.2f; - float newScale = MCore::Clamp(mActiveGraph->GetScale() + scaleDelta, mActiveGraph->GetLowestScale(), 1.0f); - mActiveGraph->SetScale(newScale); + float newScale = MCore::Clamp(m_activeGraph->GetScale() + scaleDelta, m_activeGraph->GetLowestScale(), 1.0f); + m_activeGraph->SetScale(newScale); // redraw the viewport //update(); @@ -584,15 +581,15 @@ namespace EMStudio } // if the left mouse button is pressed - if (mLeftMousePressed) + if (m_leftMousePressed) { - if (mMoveNode) + if (m_moveNode) { - if (mActiveGraph && - mPlugin->GetActionFilter().m_editNodes && - !mActiveGraph->IsInReferencedGraph()) + if (m_activeGraph && + m_plugin->GetActionFilter().m_editNodes && + !m_activeGraph->IsInReferencedGraph()) { - const AZStd::vector selectedGraphNodes = mActiveGraph->GetSelectedGraphNodes(); + const AZStd::vector selectedGraphNodes = m_activeGraph->GetSelectedGraphNodes(); if (!selectedGraphNodes.empty()) { // move all selected nodes @@ -601,9 +598,9 @@ namespace EMStudio graphNode->MoveRelative(delta); } } - else if (mMoveNode) + else if (m_moveNode) { - mMoveNode->MoveRelative(delta); + m_moveNode->MoveRelative(delta); } return; } @@ -612,9 +609,9 @@ namespace EMStudio { //setCursor( Qt::ArrowCursor ); - if (mRectSelecting) + if (m_rectSelecting) { - mSelectEnd = mousePos; + m_selectEnd = mousePos; } } @@ -632,27 +629,27 @@ namespace EMStudio // mouse button has been pressed void NodeGraphWidget::mousePressEvent(QMouseEvent* event) { - if (!mActiveGraph) + if (!m_activeGraph) { return; } GetMainWindow()->DisableUndoRedo(); - mAllowContextMenu = true; + m_allowContextMenu = true; // get the mouse position, calculate the global mouse position and update the relevant data QPoint mousePos = event->pos(); - mMouseLastPos = mousePos; - mMouseLastPressPos = mousePos; + m_mouseLastPos = mousePos; + m_mouseLastPressPos = mousePos; QPoint globalPos = LocalToGlobal(mousePos); SetMousePos(globalPos); // update modifiers - mAltPressed = event->modifiers() & Qt::AltModifier; - mShiftPressed = event->modifiers() & Qt::ShiftModifier; - mControlPressed = event->modifiers() & Qt::ControlModifier; - const AnimGraphActionFilter& actionFilter = mPlugin->GetActionFilter(); + m_altPressed = event->modifiers() & Qt::AltModifier; + m_shiftPressed = event->modifiers() & Qt::ShiftModifier; + m_controlPressed = event->modifiers() & Qt::ControlModifier; + const AnimGraphActionFilter& actionFilter = m_plugin->GetActionFilter(); // check if we can start panning if ((event->buttons() & Qt::RightButton && event->buttons() & Qt::LeftButton) || event->button() == Qt::RightButton || event->button() == Qt::MidButton) @@ -660,21 +657,21 @@ namespace EMStudio // update button booleans if (event->buttons() & Qt::RightButton && event->buttons() & Qt::LeftButton) { - mLeftMousePressed = true; - mRightMousePressed = true; + m_leftMousePressed = true; + m_rightMousePressed = true; } if (event->button() == Qt::RightButton) { - mRightMousePressed = true; + m_rightMousePressed = true; GraphNode* node = UpdateMouseCursor(mousePos, globalPos); if (node && node->GetCanVisualize() && node->GetIsInsideVisualizeRect(globalPos)) { OnSetupVisualizeOptions(node); - mRectSelecting = false; - mPanning = false; - mMoveNode = nullptr; + m_rectSelecting = false; + m_panning = false; + m_moveNode = nullptr; //update(); return; } @@ -682,7 +679,7 @@ namespace EMStudio // Right click on the node will trigger a single selection, if the node is not already selected. if (node && !node->GetIsSelected() && !node->GetIsInsideArrowRect(globalPos)) { - mPlugin->GetAnimGraphModel().GetSelectionModel().select(QItemSelection(node->GetModelIndex(), node->GetModelIndex()), + m_plugin->GetAnimGraphModel().GetSelectionModel().select(QItemSelection(node->GetModelIndex(), node->GetModelIndex()), QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Rows); return; } @@ -690,37 +687,33 @@ namespace EMStudio if (event->button() == Qt::MidButton) { - mMiddleMousePressed = true; + m_middleMousePressed = true; } - mPanning = true; - mRectSelecting = false; + m_panning = true; + m_rectSelecting = false; setCursor(Qt::ClosedHandCursor); - //mMoveNode = nullptr; - - // update viewport and return - //update(); return; } // if we press the left mouse button if (event->button() == Qt::LeftButton) { - mLeftMousePressed = true; + m_leftMousePressed = true; // get the node we click on GraphNode* node = UpdateMouseCursor(mousePos, globalPos); // if we pressed the visualize icon - GraphNode* orgNode = mActiveGraph->FindNode(mousePos); + GraphNode* orgNode = m_activeGraph->FindNode(mousePos); if (orgNode && orgNode->GetCanVisualize() && orgNode->GetIsInsideVisualizeRect(globalPos)) { const bool viz = !orgNode->GetIsVisualized(); orgNode->SetIsVisualized(viz); OnVisualizeToggle(orgNode, viz); - mRectSelecting = false; - mPanning = false; - mMoveNode = nullptr; + m_rectSelecting = false; + m_panning = false; + m_moveNode = nullptr; //update(); return; } @@ -805,29 +798,29 @@ namespace EMStudio timeViewPlugin->SetMode(TimeViewMode::AnimGraph); } - if (!mActiveGraph->IsInReferencedGraph()) + if (!m_activeGraph->IsInReferencedGraph()) { // check if we are clicking on an input port GraphNode* portNode = nullptr; NodePort* port = nullptr; AZ::u16 portNr = InvalidIndex16; bool isInputPort = true; - port = mActiveGraph->FindPort(globalPos.x(), globalPos.y(), &portNode, &portNr, &isInputPort); + port = m_activeGraph->FindPort(globalPos.x(), globalPos.y(), &portNode, &portNr, &isInputPort); if (port) { - mMoveNode = nullptr; - mPanning = false; - mRectSelecting = false; + m_moveNode = nullptr; + m_panning = false; + m_rectSelecting = false; // relink existing connection - NodeConnection* connection = mActiveGraph->FindInputConnection(portNode, portNr); + NodeConnection* connection = m_activeGraph->FindInputConnection(portNode, portNr); if (actionFilter.m_editConnections && isInputPort && connection && portNode->GetType() != StateGraphNode::TYPE_ID) { connection->SetIsDashed(true); UpdateMouseCursor(mousePos, globalPos); - mActiveGraph->StartRelinkConnection(connection, portNr, portNode); + m_activeGraph->StartRelinkConnection(connection, portNr, portNode); return; } @@ -839,7 +832,7 @@ namespace EMStudio { QPoint offset = globalPos - portNode->GetRect().topLeft(); UpdateMouseCursor(mousePos, globalPos); - mActiveGraph->StartCreateConnection(portNr, isInputPort, portNode, port, offset); + m_activeGraph->StartCreateConnection(portNr, isInputPort, portNode, port, offset); //update(); return; } @@ -847,7 +840,7 @@ namespace EMStudio } // check if we click on an transition arrow head or tail - NodeConnection* connection = mActiveGraph->FindConnection(globalPos); + NodeConnection* connection = m_activeGraph->FindConnection(globalPos); if (actionFilter.m_editConnections && connection && connection->GetType() == StateConnection::TYPE_ID) { @@ -860,21 +853,21 @@ namespace EMStudio if (!stateConnection->GetIsWildcardTransition() && stateConnection->CheckIfIsCloseToHead(globalPos)) { - mMoveNode = nullptr; - mPanning = false; - mRectSelecting = false; + m_moveNode = nullptr; + m_panning = false; + m_rectSelecting = false; - mActiveGraph->StartReplaceTransitionHead(stateConnection, startOffset, endOffset, stateConnection->GetSourceNode(), stateConnection->GetTargetNode()); + m_activeGraph->StartReplaceTransitionHead(stateConnection, startOffset, endOffset, stateConnection->GetSourceNode(), stateConnection->GetTargetNode()); return; } if (!stateConnection->GetIsWildcardTransition() && stateConnection->CheckIfIsCloseToTail(globalPos)) { - mMoveNode = nullptr; - mPanning = false; - mRectSelecting = false; + m_moveNode = nullptr; + m_panning = false; + m_rectSelecting = false; - mActiveGraph->StartReplaceTransitionTail(stateConnection, startOffset, endOffset, stateConnection->GetSourceNode(), stateConnection->GetTargetNode()); + m_activeGraph->StartReplaceTransitionTail(stateConnection, startOffset, endOffset, stateConnection->GetSourceNode(), stateConnection->GetTargetNode()); return; } } @@ -883,32 +876,32 @@ namespace EMStudio // get the node we click on node = UpdateMouseCursor(mousePos, globalPos); - if (node && mShiftPressed) + if (node && m_shiftPressed) { OnShiftClickedNode(node); } else { - if (node && mShiftPressed == false && mControlPressed == false && mAltPressed == false && + if (node && m_shiftPressed == false && m_controlPressed == false && m_altPressed == false && actionFilter.m_editNodes && - !mActiveGraph->IsInReferencedGraph()) + !m_activeGraph->IsInReferencedGraph()) { - mMoveNode = node; - mPanning = false; + m_moveNode = node; + m_panning = false; setCursor(Qt::ClosedHandCursor); } else { - mMoveNode = nullptr; - mPanning = false; - mRectSelecting = true; - mSelectStart = mousePos; - mSelectEnd = mSelectStart; + m_moveNode = nullptr; + m_panning = false; + m_rectSelecting = true; + m_selectStart = mousePos; + m_selectEnd = m_selectStart; setCursor(Qt::ArrowCursor); } } - if (mActiveGraph) + if (m_activeGraph) { // shift is used to activate a state, disable all selection behavior in case we press shift! // check if we clicked a node and additionally not clicked its arrow rect @@ -917,42 +910,42 @@ namespace EMStudio { nodeClicked = true; } - if (!mShiftPressed) + if (!m_shiftPressed) { // check the node we're clicking on - if (!mControlPressed) + if (!m_controlPressed) { // only reset the selection in case we clicked in empty space or in case the node we clicked on is not part of if (!node || (node && !node->GetIsSelected())) { - mPlugin->GetAnimGraphModel().GetSelectionModel().clear(); + m_plugin->GetAnimGraphModel().GetSelectionModel().clear(); } } // node clicked with shift only - if (nodeClicked && mControlPressed) + if (nodeClicked && m_controlPressed) { - mPlugin->GetAnimGraphModel().GetSelectionModel().select(QItemSelection(node->GetModelIndex(), node->GetModelIndex()), + m_plugin->GetAnimGraphModel().GetSelectionModel().select(QItemSelection(node->GetModelIndex(), node->GetModelIndex()), QItemSelectionModel::Toggle | QItemSelectionModel::Rows); } // node clicked with ctrl only - else if (nodeClicked && !mControlPressed) + else if (nodeClicked && !m_controlPressed) { - mPlugin->GetAnimGraphModel().GetSelectionModel().select(QItemSelection(node->GetModelIndex(), node->GetModelIndex()), + m_plugin->GetAnimGraphModel().GetSelectionModel().select(QItemSelection(node->GetModelIndex(), node->GetModelIndex()), QItemSelectionModel::Select | QItemSelectionModel::Rows); } // in case we didn't click on a node, check if we click on a connection else if (!nodeClicked) { - mActiveGraph->SelectConnectionCloseTo(LocalToGlobal(event->pos()), mControlPressed == false, true); + m_activeGraph->SelectConnectionCloseTo(LocalToGlobal(event->pos()), m_controlPressed == false, true); } } else { // in case shift and control are both pressed, special case! - if (mControlPressed && node) + if (m_controlPressed && node) { - mPlugin->GetAnimGraphModel().GetSelectionModel().select(QItemSelection(node->GetModelIndex(), node->GetModelIndex()), + m_plugin->GetAnimGraphModel().GetSelectionModel().select(QItemSelection(node->GetModelIndex(), node->GetModelIndex()), QItemSelectionModel::Current | QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Rows); } } @@ -969,7 +962,7 @@ namespace EMStudio const QPoint globalPos = LocalToGlobal(mousePos); SetMousePos(globalPos); - if (mActiveGraph == nullptr) + if (m_activeGraph == nullptr) { return; } @@ -977,24 +970,24 @@ namespace EMStudio GetMainWindow()->UpdateUndoRedo(); // update modifiers - mAltPressed = event->modifiers() & Qt::AltModifier; - mShiftPressed = event->modifiers() & Qt::ShiftModifier; - mControlPressed = event->modifiers() & Qt::ControlModifier; + m_altPressed = event->modifiers() & Qt::AltModifier; + m_shiftPressed = event->modifiers() & Qt::ShiftModifier; + m_controlPressed = event->modifiers() & Qt::ControlModifier; - const AnimGraphActionFilter& actionFilter = mPlugin->GetActionFilter(); + const AnimGraphActionFilter& actionFilter = m_plugin->GetActionFilter(); // both left and right released at the same time if (event->buttons() & Qt::RightButton && event->buttons() & Qt::LeftButton) { - mRightMousePressed = false; - mLeftMousePressed = false; + m_rightMousePressed = false; + m_leftMousePressed = false; } // right mouse button if (event->button() == Qt::RightButton) { - mRightMousePressed = false; - mPanning = false; + m_rightMousePressed = false; + m_panning = false; UpdateMouseCursor(mousePos, globalPos); //update(); return; @@ -1003,23 +996,23 @@ namespace EMStudio // middle mouse button if (event->button() == Qt::MidButton) { - mMiddleMousePressed = false; - mPanning = false; + m_middleMousePressed = false; + m_panning = false; } // if we release the left mouse button if (event->button() == Qt::LeftButton) { - const bool mouseMoved = (event->pos() != mMouseLastPressPos); + const bool mouseMoved = (event->pos() != m_mouseLastPressPos); // if we pressed the visualize icon GraphNode* node = UpdateMouseCursor(mousePos, globalPos); if (node && node->GetCanVisualize() && node->GetIsInsideVisualizeRect(globalPos)) { - mRectSelecting = false; - mPanning = false; - mMoveNode = nullptr; - mLeftMousePressed = false; + m_rectSelecting = false; + m_panning = false; + m_moveNode = nullptr; + m_leftMousePressed = false; UpdateMouseCursor(mousePos, globalPos); //update(); return; @@ -1027,80 +1020,80 @@ namespace EMStudio if (node && node->GetIsInsideArrowRect(globalPos)) { - mRectSelecting = false; - mPanning = false; - mMoveNode = nullptr; - mLeftMousePressed = false; + m_rectSelecting = false; + m_panning = false; + m_moveNode = nullptr; + m_leftMousePressed = false; UpdateMouseCursor(mousePos, globalPos); //update(); return; } // if we were creating a connection - if (mActiveGraph->GetIsCreatingConnection()) + if (m_activeGraph->GetIsCreatingConnection()) { - AZ_Assert(!mActiveGraph->IsInReferencedGraph(), "Expected to not be in a referenced graph"); + AZ_Assert(!m_activeGraph->IsInReferencedGraph(), "Expected to not be in a referenced graph"); // create the connection if needed - if (mActiveGraph->GetTargetPort()) + if (m_activeGraph->GetTargetPort()) { - if (mActiveGraph->GetIsCreateConnectionValid()) + if (m_activeGraph->GetIsCreateConnectionValid()) { AZ::u16 targetPortNr; bool targetIsInputPort; GraphNode* targetNode; - NodePort* targetPort = mActiveGraph->FindPort(globalPos.x(), globalPos.y(), &targetNode, &targetPortNr, &targetIsInputPort); - if (targetPort && mActiveGraph->GetTargetPort() == targetPort - && targetNode != mActiveGraph->GetCreateConnectionNode()) + NodePort* targetPort = m_activeGraph->FindPort(globalPos.x(), globalPos.y(), &targetNode, &targetPortNr, &targetIsInputPort); + if (targetPort && m_activeGraph->GetTargetPort() == targetPort + && targetNode != m_activeGraph->GetCreateConnectionNode()) { #ifndef MCORE_DEBUG MCORE_UNUSED(targetPort); #endif QPoint endOffset = globalPos - targetNode->GetRect().topLeft(); - mActiveGraph->SetCreateConnectionEndOffset(endOffset); + m_activeGraph->SetCreateConnectionEndOffset(endOffset); // trigger the callback - OnCreateConnection(mActiveGraph->GetCreateConnectionPortNr(), - mActiveGraph->GetCreateConnectionNode(), - mActiveGraph->GetCreateConnectionIsInputPort(), + OnCreateConnection(m_activeGraph->GetCreateConnectionPortNr(), + m_activeGraph->GetCreateConnectionNode(), + m_activeGraph->GetCreateConnectionIsInputPort(), targetPortNr, targetNode, targetIsInputPort, - mActiveGraph->GetCreateConnectionStartOffset(), - mActiveGraph->GetCreateConnectionEndOffset()); + m_activeGraph->GetCreateConnectionStartOffset(), + m_activeGraph->GetCreateConnectionEndOffset()); } } } - mActiveGraph->StopCreateConnection(); - mLeftMousePressed = false; + m_activeGraph->StopCreateConnection(); + m_leftMousePressed = false; UpdateMouseCursor(mousePos, globalPos); //update(); return; } // if we were relinking a connection - if (mActiveGraph->GetIsRelinkingConnection()) + if (m_activeGraph->GetIsRelinkingConnection()) { AZ_Assert(actionFilter.m_editConnections, "Expected edit connections being enabled."); - AZ_Assert(!mActiveGraph->IsInReferencedGraph(), "Expected to not be in a referenced graph"); + AZ_Assert(!m_activeGraph->IsInReferencedGraph(), "Expected to not be in a referenced graph"); // get the information from the current mouse position AZ::u16 newTargetPortNr; bool newTargetIsInputPort; GraphNode* newTargetNode; - NodePort* newTargetPort = mActiveGraph->FindPort(globalPos.x(), globalPos.y(), &newTargetNode, &newTargetPortNr, &newTargetIsInputPort); + NodePort* newTargetPort = m_activeGraph->FindPort(globalPos.x(), globalPos.y(), &newTargetNode, &newTargetPortNr, &newTargetIsInputPort); // relink existing connection NodeConnection* connection = nullptr; if (newTargetPort) { - connection = mActiveGraph->FindInputConnection(newTargetNode, newTargetPortNr); + connection = m_activeGraph->FindInputConnection(newTargetNode, newTargetPortNr); } - NodeConnection* relinkedConnection = mActiveGraph->GetRelinkConnection(); + NodeConnection* relinkedConnection = m_activeGraph->GetRelinkConnection(); if (relinkedConnection) { relinkedConnection->SetIsDashed(false); @@ -1146,7 +1139,7 @@ namespace EMStudio CommandSystem::RelinkConnectionTarget(&commandGroup, animGraph->GetID(), sourceNodeName.c_str(), sourcePortNr, oldTargetNodeName.c_str(), oldTargetPortNr, newTargetNodeName.c_str(), newTargetPortNr); // call this before calling the commands as the commands will trigger a graph update - mActiveGraph->StopRelinkConnection(); + m_activeGraph->StopRelinkConnection(); // execute the command group AZStd::string commandResult; @@ -1160,113 +1153,111 @@ namespace EMStudio } } - //mActiveGraph->StopCreateConnection(); - mActiveGraph->StopRelinkConnection(); - mLeftMousePressed = false; + m_activeGraph->StopRelinkConnection(); + m_leftMousePressed = false; UpdateMouseCursor(mousePos, globalPos); - //update(); return; } // in case we adjusted a transition start or end point - if (mActiveGraph->GetIsRepositioningTransitionHead() || mActiveGraph->GetIsRepositioningTransitionTail()) + if (m_activeGraph->GetIsRepositioningTransitionHead() || m_activeGraph->GetIsRepositioningTransitionTail()) { AZ_Assert(actionFilter.m_editConnections, "Expected edit connections being enabled."); - AZ_Assert(!mActiveGraph->IsInReferencedGraph(), "Expected to not be in a referenced graph"); + AZ_Assert(!m_activeGraph->IsInReferencedGraph(), "Expected to not be in a referenced graph"); NodeConnection* connection; QPoint oldStartOffset, oldEndOffset; GraphNode* oldSourceNode; GraphNode* oldTargetNode; - mActiveGraph->GetReplaceTransitionInfo(&connection, &oldStartOffset, &oldEndOffset, &oldSourceNode, &oldTargetNode); - GraphNode* newDropNode = mActiveGraph->FindNode(event->pos()); + m_activeGraph->GetReplaceTransitionInfo(&connection, &oldStartOffset, &oldEndOffset, &oldSourceNode, &oldTargetNode); + GraphNode* newDropNode = m_activeGraph->FindNode(event->pos()); if (newDropNode && newDropNode != oldSourceNode) { - if (mActiveGraph->GetIsRepositioningTransitionHead()) + if (m_activeGraph->GetIsRepositioningTransitionHead()) { ReplaceTransition(connection, oldStartOffset, oldEndOffset, oldSourceNode, oldTargetNode, oldSourceNode, newDropNode); - mActiveGraph->StopReplaceTransitionHead(); + m_activeGraph->StopReplaceTransitionHead(); } - else if (mActiveGraph->GetIsRepositioningTransitionTail() && newDropNode != oldTargetNode) + else if (m_activeGraph->GetIsRepositioningTransitionTail() && newDropNode != oldTargetNode) { ReplaceTransition(connection, oldStartOffset, oldEndOffset, oldSourceNode, oldTargetNode, newDropNode, oldTargetNode); - mActiveGraph->StopReplaceTransitionTail(); + m_activeGraph->StopReplaceTransitionTail(); } } else { ReplaceTransition(connection, oldStartOffset, oldEndOffset, oldSourceNode, oldTargetNode, oldSourceNode, oldTargetNode); - if (mActiveGraph->GetIsRepositioningTransitionHead()) + if (m_activeGraph->GetIsRepositioningTransitionHead()) { - mActiveGraph->StopReplaceTransitionHead(); + m_activeGraph->StopReplaceTransitionHead(); } - else if (mActiveGraph->GetIsRepositioningTransitionTail()) + else if (m_activeGraph->GetIsRepositioningTransitionTail()) { - mActiveGraph->StopReplaceTransitionTail(); + m_activeGraph->StopReplaceTransitionTail(); } } return; } // if we are finished moving, trigger the OnMoveNode callbacks - if (mMoveNode && mouseMoved && + if (m_moveNode && mouseMoved && actionFilter.m_editNodes && - !mActiveGraph->IsInReferencedGraph()) + !m_activeGraph->IsInReferencedGraph()) { OnMoveStart(); bool moveNodeSelected = false; // prevent moving the same node twice - const AZStd::vector selectedNodes = mActiveGraph->GetSelectedGraphNodes(); + const AZStd::vector selectedNodes = m_activeGraph->GetSelectedGraphNodes(); for (GraphNode* currentNode : selectedNodes) { OnMoveNode(currentNode, currentNode->GetRect().topLeft().x(), currentNode->GetRect().topLeft().y()); - if (currentNode == mMoveNode) + if (currentNode == m_moveNode) { moveNodeSelected = true; } } - if (!moveNodeSelected && !mMoveNode) + if (!moveNodeSelected && !m_moveNode) { - OnMoveNode(mMoveNode, mMoveNode->GetRect().topLeft().x(), mMoveNode->GetRect().topLeft().y()); + OnMoveNode(m_moveNode, m_moveNode->GetRect().topLeft().x(), m_moveNode->GetRect().topLeft().y()); } OnMoveEnd(); } - mPanning = false; - mMoveNode = nullptr; + m_panning = false; + m_moveNode = nullptr; UpdateMouseCursor(mousePos, globalPos); // get the node we click on node = UpdateMouseCursor(mousePos, globalPos); - if (mRectSelecting && mouseMoved) + if (m_rectSelecting && mouseMoved) { // calc the selection rect QRect selectRect; CalcSelectRect(selectRect); // select things inside it - if (selectRect.isEmpty() == false && mActiveGraph) + if (selectRect.isEmpty() == false && m_activeGraph) { - selectRect = mActiveGraph->GetTransform().inverted().mapRect(selectRect); + selectRect = m_activeGraph->GetTransform().inverted().mapRect(selectRect); // select nodes when alt is not pressed - if (mAltPressed == false) + if (m_altPressed == false) { - const bool overwriteSelection = (mControlPressed == false); - mActiveGraph->SelectNodesInRect(selectRect, overwriteSelection, mControlPressed); + const bool overwriteSelection = (m_controlPressed == false); + m_activeGraph->SelectNodesInRect(selectRect, overwriteSelection, m_controlPressed); } else // zoom into the selected rect { - mActiveGraph->ZoomOnRect(selectRect, geometry().width(), geometry().height(), true); + m_activeGraph->ZoomOnRect(selectRect, geometry().width(), geometry().height(), true); } } } - mLeftMousePressed = false; - mRectSelecting = false; + m_leftMousePressed = false; + m_rectSelecting = false; } } @@ -1275,7 +1266,7 @@ namespace EMStudio void NodeGraphWidget::mouseDoubleClickEvent(QMouseEvent* event) { // only do things when a graph is active - if (mActiveGraph == nullptr) + if (m_activeGraph == nullptr) { return; } @@ -1291,12 +1282,12 @@ namespace EMStudio if (event->button() == Qt::LeftButton) { // check if double clicked on a node - GraphNode* node = mActiveGraph->FindNode(mousePos); + GraphNode* node = m_activeGraph->FindNode(mousePos); if (node == nullptr) { // if we didn't double click on a node zoom in to the clicked area - mActiveGraph->ScrollTo(-LocalToGlobal(mousePos) + geometry().center()); - mActiveGraph->ZoomIn(); + m_activeGraph->ScrollTo(-LocalToGlobal(mousePos) + geometry().center()); + m_activeGraph->ZoomIn(); } } @@ -1304,18 +1295,18 @@ namespace EMStudio if (event->button() == Qt::RightButton) { // check if double clicked on a node - GraphNode* node = mActiveGraph->FindNode(mousePos); + GraphNode* node = m_activeGraph->FindNode(mousePos); if (node == nullptr) { - mActiveGraph->ScrollTo(-LocalToGlobal(mousePos) + geometry().center()); - mActiveGraph->ZoomOut(); + m_activeGraph->ScrollTo(-LocalToGlobal(mousePos) + geometry().center()); + m_activeGraph->ZoomOut(); } } setCursor(Qt::ArrowCursor); // reset flags - mRectSelecting = false; + m_rectSelecting = false; // redraw the viewport //update(); @@ -1326,7 +1317,7 @@ namespace EMStudio void NodeGraphWidget::wheelEvent(QWheelEvent* event) { // only do things when a graph is active - if (mActiveGraph == nullptr) + if (m_activeGraph == nullptr) { return; } @@ -1344,12 +1335,12 @@ namespace EMStudio SetMousePos(globalPos); // stop the automated zoom - mActiveGraph->StopAnimatedZoom(); + m_activeGraph->StopAnimatedZoom(); // calculate the new scale value const float scaleDelta = (event->angleDelta().y() / 120.0f) * 0.05f; - float newScale = MCore::Clamp(mActiveGraph->GetScale() + scaleDelta, mActiveGraph->GetLowestScale(), 1.0f); - mActiveGraph->SetScale(newScale); + float newScale = MCore::Clamp(m_activeGraph->GetScale() + scaleDelta, m_activeGraph->GetLowestScale(), 1.0f); + m_activeGraph->SetScale(newScale); // redraw the viewport //update(); @@ -1360,20 +1351,20 @@ namespace EMStudio GraphNode* NodeGraphWidget::UpdateMouseCursor(const QPoint& localMousePos, const QPoint& globalMousePos) { // if there is no active graph - if (mActiveGraph == nullptr) + if (m_activeGraph == nullptr) { setCursor(Qt::ArrowCursor); return nullptr; } - if (mPanning || mMoveNode) + if (m_panning || m_moveNode) { setCursor(Qt::ClosedHandCursor); return nullptr; } // check if we hover above a node - GraphNode* node = mActiveGraph->FindNode(localMousePos); + GraphNode* node = m_activeGraph->FindNode(localMousePos); // check if the node is valid // we test firstly the node to have the visualize cursor correct @@ -1407,7 +1398,7 @@ namespace EMStudio AZ::u16 portNr; GraphNode* portNode; bool isInputPort; - NodePort* nodePort = mActiveGraph->FindPort(globalMousePos.x(), globalMousePos.y(), &portNode, &portNr, &isInputPort); + NodePort* nodePort = m_activeGraph->FindPort(globalMousePos.x(), globalMousePos.y(), &portNode, &portNr, &isInputPort); if (nodePort) { if ((isInputPort && portNode->GetCreateConFromOutputOnly() == false) || isInputPort == false) @@ -1427,7 +1418,7 @@ namespace EMStudio AZ::u16 portNr; GraphNode* portNode; bool isInputPort; - NodePort* nodePort = mActiveGraph->FindPort(globalMousePos.x(), globalMousePos.y(), &portNode, &portNr, &isInputPort); + NodePort* nodePort = m_activeGraph->FindPort(globalMousePos.x(), globalMousePos.y(), &portNode, &portNr, &isInputPort); if (nodePort) { if ((isInputPort && portNode->GetCreateConFromOutputOnly() == false) || isInputPort == false) @@ -1454,10 +1445,10 @@ namespace EMStudio // calculate the selection rect void NodeGraphWidget::CalcSelectRect(QRect& outRect) { - const int32 startX = MCore::Min(mSelectStart.x(), mSelectEnd.x()); - const int32 startY = MCore::Min(mSelectStart.y(), mSelectEnd.y()); - const int32 width = abs(mSelectEnd.x() - mSelectStart.x()); - const int32 height = abs(mSelectEnd.y() - mSelectStart.y()); + const int32 startX = MCore::Min(m_selectStart.x(), m_selectEnd.x()); + const int32 startY = MCore::Min(m_selectStart.y(), m_selectEnd.y()); + const int32 width = abs(m_selectEnd.x() - m_selectStart.x()); + const int32 height = abs(m_selectEnd.y() - m_selectStart.y()); outRect = QRect(startX, startY, width, height); } @@ -1470,17 +1461,17 @@ namespace EMStudio { case Qt::Key_Shift: { - mShiftPressed = true; + m_shiftPressed = true; break; } case Qt::Key_Control: { - mControlPressed = true; + m_controlPressed = true; break; } case Qt::Key_Alt: { - mAltPressed = true; + m_altPressed = true; break; } } @@ -1495,17 +1486,17 @@ namespace EMStudio { case Qt::Key_Shift: { - mShiftPressed = false; + m_shiftPressed = false; break; } case Qt::Key_Control: { - mControlPressed = false; + m_controlPressed = false; break; } case Qt::Key_Alt: { - mAltPressed = false; + m_altPressed = false; break; } } @@ -1529,15 +1520,15 @@ namespace EMStudio void NodeGraphWidget::focusOutEvent(QFocusEvent* event) { MCORE_UNUSED(event); - mShiftPressed = false; - mControlPressed = false; - mAltPressed = false; + m_shiftPressed = false; + m_controlPressed = false; + m_altPressed = false; releaseKeyboard(); - if (mActiveGraph && mActiveGraph->GetIsCreatingConnection()) + if (m_activeGraph && m_activeGraph->GetIsCreatingConnection()) { - mActiveGraph->StopCreateConnection(); - mLeftMousePressed = false; + m_activeGraph->StopCreateConnection(); + m_leftMousePressed = false; } } @@ -1545,9 +1536,9 @@ namespace EMStudio // return the number of selected nodes size_t NodeGraphWidget::CalcNumSelectedNodes() const { - if (mActiveGraph) + if (m_activeGraph) { - return mActiveGraph->CalcNumSelectedNodes(); + return m_activeGraph->CalcNumSelectedNodes(); } return 0; } @@ -1559,12 +1550,12 @@ namespace EMStudio MCORE_UNUSED(portNr); MCORE_UNUSED(port); - if (mActiveGraph == nullptr) + if (m_activeGraph == nullptr) { return false; } - GraphNode* sourceNode = mActiveGraph->GetCreateConnectionNode(); + GraphNode* sourceNode = m_activeGraph->GetCreateConnectionNode(); GraphNode* targetNode = portNode; // don't allow connection to itself @@ -1574,7 +1565,7 @@ namespace EMStudio } // dont allow to connect an input port to another input port or output port to another output port - if (isInputPort == mActiveGraph->GetCreateConnectionIsInputPort()) + if (isInputPort == m_activeGraph->GetCreateConnectionIsInputPort()) { return false; } diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/NodeGraphWidget.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/NodeGraphWidget.h index d8b73ee5be..f3bea6d5f9 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/NodeGraphWidget.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/NodeGraphWidget.h @@ -48,16 +48,16 @@ namespace EMStudio NodeGraphWidget(AnimGraphPlugin* plugin, NodeGraph* activeGraph = nullptr, QWidget* parent = nullptr); virtual ~NodeGraphWidget(); - AnimGraphPlugin* GetPlugin() { return mPlugin; } + AnimGraphPlugin* GetPlugin() { return m_plugin; } void SetActiveGraph(NodeGraph* graph); NodeGraph* GetActiveGraph() const; void SetCallback(GraphWidgetCallback* callback); - MCORE_INLINE GraphWidgetCallback* GetCallback() { return mCallback; } - MCORE_INLINE const QPoint& GetMousePos() const { return mMousePos; } - MCORE_INLINE void SetMousePos(const QPoint& pos) { mMousePos = pos; } - MCORE_INLINE void SetShowFPS(bool showFPS) { mShowFPS = showFPS; } + MCORE_INLINE GraphWidgetCallback* GetCallback() { return m_callback; } + MCORE_INLINE const QPoint& GetMousePos() const { return m_mousePos; } + MCORE_INLINE void SetMousePos(const QPoint& pos) { m_mousePos = pos; } + MCORE_INLINE void SetShowFPS(bool showFPS) { m_showFps = showFPS; } size_t CalcNumSelectedNodes() const; @@ -125,35 +125,35 @@ namespace EMStudio GraphNode* UpdateMouseCursor(const QPoint& localMousePos, const QPoint& globalMousePos); protected: - AnimGraphPlugin* mPlugin; - bool mShowFPS; - QPoint mMousePos; - QPoint mMouseLastPos; - QPoint mMouseLastPressPos; - QPoint mSelectStart; - QPoint mSelectEnd; - int mPrevWidth; - int mPrevHeight; - int mCurWidth; - int mCurHeight; - GraphNode* mMoveNode; // the node we're moving - NodeGraph* mActiveGraph = nullptr; - GraphWidgetCallback* mCallback; - QFont mFont; - QFontMetrics* mFontMetrics; - AZ::Debug::Timer mRenderTimer; - AZStd::string mTempString; - AZStd::string mFullActorName; - AZStd::string mActorName; - bool mAllowContextMenu; - bool mLeftMousePressed; - bool mMiddleMousePressed; - bool mRightMousePressed; - bool mPanning; - bool mRectSelecting; - bool mShiftPressed; - bool mControlPressed; - bool mAltPressed; + AnimGraphPlugin* m_plugin; + bool m_showFps; + QPoint m_mousePos; + QPoint m_mouseLastPos; + QPoint m_mouseLastPressPos; + QPoint m_selectStart; + QPoint m_selectEnd; + int m_prevWidth; + int m_prevHeight; + int m_curWidth; + int m_curHeight; + GraphNode* m_moveNode; // the node we're moving + NodeGraph* m_activeGraph = nullptr; + GraphWidgetCallback* m_callback; + QFont m_font; + QFontMetrics* m_fontMetrics; + AZ::Debug::Timer m_renderTimer; + AZStd::string m_tempString; + AZStd::string m_fullActorName; + AZStd::string m_actorName; + bool m_allowContextMenu; + bool m_leftMousePressed; + bool m_middleMousePressed; + bool m_rightMousePressed; + bool m_panning; + bool m_rectSelecting; + bool m_shiftPressed; + bool m_controlPressed; + bool m_altPressed; bool m_borderOverwrite = false; QColor m_borderOverwriteColor; float m_borderOverwriteWidth; diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/NodeGroupWindow.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/NodeGroupWindow.cpp index 3183bc8a0f..71eba1205e 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/NodeGroupWindow.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/NodeGroupWindow.cpp @@ -52,8 +52,8 @@ namespace EMStudio : QDialog(parent) { // Store the values - mAnimGraph = animGraph; - mNodeGroup = nodeGroup; + m_animGraph = animGraph; + m_nodeGroup = nodeGroup; // set the window title setWindowTitle("Rename Node Group"); @@ -68,24 +68,23 @@ namespace EMStudio layout->addWidget(new QLabel("Please enter the new node group name:")); // add the line edit - mLineEdit = new QLineEdit(); - connect(mLineEdit, &QLineEdit::textEdited, this, &NodeGroupRenameWindow::TextEdited); - layout->addWidget(mLineEdit); + m_lineEdit = new QLineEdit(); + connect(m_lineEdit, &QLineEdit::textEdited, this, &NodeGroupRenameWindow::TextEdited); + layout->addWidget(m_lineEdit); // set the current name and select all - mLineEdit->setText(nodeGroup.c_str()); - mLineEdit->selectAll(); + m_lineEdit->setText(nodeGroup.c_str()); + m_lineEdit->selectAll(); // create the button layout QHBoxLayout* buttonLayout = new QHBoxLayout(); - mOKButton = new QPushButton("OK"); + m_okButton = new QPushButton("OK"); QPushButton* cancelButton = new QPushButton("Cancel"); - //buttonLayout->addWidget(mErrorMsg); - buttonLayout->addWidget(mOKButton); + buttonLayout->addWidget(m_okButton); buttonLayout->addWidget(cancelButton); // connect the buttons - connect(mOKButton, &QPushButton::clicked, this, &NodeGroupRenameWindow::Accepted); + connect(m_okButton, &QPushButton::clicked, this, &NodeGroupRenameWindow::Accepted); connect(cancelButton, &QPushButton::clicked, this, &NodeGroupRenameWindow::reject); // set the new layout @@ -99,36 +98,32 @@ namespace EMStudio const AZStd::string convertedNewName = FromQtString(text); if (text.isEmpty()) { - //mErrorMsg->setVisible(false); - mOKButton->setEnabled(false); - GetManager()->SetWidgetAsInvalidInput(mLineEdit); + m_okButton->setEnabled(false); + GetManager()->SetWidgetAsInvalidInput(m_lineEdit); } - else if (mNodeGroup == convertedNewName) + else if (m_nodeGroup == convertedNewName) { - //mErrorMsg->setVisible(false); - mOKButton->setEnabled(true); - mLineEdit->setStyleSheet(""); + m_okButton->setEnabled(true); + m_lineEdit->setStyleSheet(""); } else { // find duplicate name in the anim graph other than this node group - const size_t numNodeGroups = mAnimGraph->GetNumNodeGroups(); + const size_t numNodeGroups = m_animGraph->GetNumNodeGroups(); for (size_t i = 0; i < numNodeGroups; ++i) { - EMotionFX::AnimGraphNodeGroup* nodeGroup = mAnimGraph->GetNodeGroup(i); + EMotionFX::AnimGraphNodeGroup* nodeGroup = m_animGraph->GetNodeGroup(i); if (nodeGroup->GetNameString() == convertedNewName) { - //mErrorMsg->setVisible(true); - mOKButton->setEnabled(false); - GetManager()->SetWidgetAsInvalidInput(mLineEdit); + m_okButton->setEnabled(false); + GetManager()->SetWidgetAsInvalidInput(m_lineEdit); return; } } // no duplicate name found - //mErrorMsg->setVisible(false); - mOKButton->setEnabled(true); - mLineEdit->setStyleSheet(""); + m_okButton->setEnabled(true); + m_lineEdit->setStyleSheet(""); } } @@ -137,11 +132,11 @@ namespace EMStudio { // Execute the command AZStd::string outResult; - const AZStd::string convertedNewName = FromQtString(mLineEdit->text()); + const AZStd::string convertedNewName = FromQtString(m_lineEdit->text()); auto* command = aznew CommandSystem::CommandAnimGraphAdjustNodeGroup( GetCommandManager()->FindCommand(CommandSystem::CommandAnimGraphAdjustNodeGroup::s_commandName), - mAnimGraph->GetID(), - /*name = */ mNodeGroup, + m_animGraph->GetID(), + /*name = */ m_nodeGroup, /*visible = */ AZStd::nullopt, /*newName = */ convertedNewName ); @@ -158,25 +153,25 @@ namespace EMStudio NodeGroupWindow::NodeGroupWindow(AnimGraphPlugin* plugin) : QWidget() { - mPlugin = plugin; - mTableWidget = nullptr; - mAddAction = nullptr; + m_plugin = plugin; + m_tableWidget = nullptr; + m_addAction = nullptr; // create and register the command callbacks - mCreateCallback = new CommandAnimGraphAddNodeGroupCallback(false); - mRemoveCallback = new CommandAnimGraphRemoveNodeGroupCallback(false); - mAdjustCallback = new CommandAnimGraphAdjustNodeGroupCallback(false); - GetCommandManager()->RegisterCommandCallback("AnimGraphAddNodeGroup", mCreateCallback); - GetCommandManager()->RegisterCommandCallback("AnimGraphRemoveNodeGroup", mRemoveCallback); - GetCommandManager()->RegisterCommandCallback(CommandSystem::CommandAnimGraphAdjustNodeGroup::s_commandName.data(), mAdjustCallback); + m_createCallback = new CommandAnimGraphAddNodeGroupCallback(false); + m_removeCallback = new CommandAnimGraphRemoveNodeGroupCallback(false); + m_adjustCallback = new CommandAnimGraphAdjustNodeGroupCallback(false); + GetCommandManager()->RegisterCommandCallback("AnimGraphAddNodeGroup", m_createCallback); + GetCommandManager()->RegisterCommandCallback("AnimGraphRemoveNodeGroup", m_removeCallback); + GetCommandManager()->RegisterCommandCallback(CommandSystem::CommandAnimGraphAdjustNodeGroup::s_commandName.data(), m_adjustCallback); // add the add button - mAddAction = new QAction(MysticQt::GetMysticQt()->FindIcon("Images/Icons/Plus.svg"), tr("Add new node group"), this); - connect(mAddAction, &QAction::triggered, this, &NodeGroupWindow::OnAddNodeGroup); + m_addAction = new QAction(MysticQt::GetMysticQt()->FindIcon("Images/Icons/Plus.svg"), tr("Add new node group"), this); + connect(m_addAction, &QAction::triggered, this, &NodeGroupWindow::OnAddNodeGroup); // add the buttons to add, remove and clear the motions QToolBar* toolBar = new QToolBar(); - toolBar->addAction(mAddAction); + toolBar->addAction(m_addAction); toolBar->addSeparator(); @@ -186,59 +181,57 @@ namespace EMStudio toolBar->addWidget(m_searchWidget); // create the table widget - mTableWidget = new QTableWidget(); - mTableWidget->setAlternatingRowColors(true); - mTableWidget->setCornerButtonEnabled(false); - mTableWidget->setSelectionBehavior(QAbstractItemView::SelectRows); - mTableWidget->setSelectionMode(QAbstractItemView::ExtendedSelection); - mTableWidget->setEditTriggers(QAbstractItemView::NoEditTriggers); - mTableWidget->setContextMenuPolicy(Qt::DefaultContextMenu); - connect(mTableWidget, &QTableWidget::itemSelectionChanged, this, &NodeGroupWindow::UpdateInterface); - //connect( mTableWidget, SIGNAL(cellChanged(int, int)), this, SLOT(OnCellChanged(int, int)) ); - //connect( mTableWidget, SIGNAL(itemChanged(QTableWidgetItem*)), this, SLOT(OnNameEdited(QTableWidgetItem*)) ); + m_tableWidget = new QTableWidget(); + m_tableWidget->setAlternatingRowColors(true); + m_tableWidget->setCornerButtonEnabled(false); + m_tableWidget->setSelectionBehavior(QAbstractItemView::SelectRows); + m_tableWidget->setSelectionMode(QAbstractItemView::ExtendedSelection); + m_tableWidget->setEditTriggers(QAbstractItemView::NoEditTriggers); + m_tableWidget->setContextMenuPolicy(Qt::DefaultContextMenu); + connect(m_tableWidget, &QTableWidget::itemSelectionChanged, this, &NodeGroupWindow::UpdateInterface); // set the column count - mTableWidget->setColumnCount(3); + m_tableWidget->setColumnCount(3); // set header items for the table QTableWidgetItem* headerItem = new QTableWidgetItem("Vis"); headerItem->setTextAlignment(Qt::AlignVCenter | Qt::AlignLeft); - mTableWidget->setHorizontalHeaderItem(0, headerItem); + m_tableWidget->setHorizontalHeaderItem(0, headerItem); headerItem = new QTableWidgetItem("Color"); headerItem->setTextAlignment(Qt::AlignVCenter | Qt::AlignLeft); - mTableWidget->setHorizontalHeaderItem(1, headerItem); + m_tableWidget->setHorizontalHeaderItem(1, headerItem); headerItem = new QTableWidgetItem("Name"); headerItem->setTextAlignment(Qt::AlignVCenter | Qt::AlignLeft); - mTableWidget->setHorizontalHeaderItem(2, headerItem); + m_tableWidget->setHorizontalHeaderItem(2, headerItem); // set the column params - mTableWidget->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Fixed); - mTableWidget->horizontalHeader()->setSectionResizeMode(1, QHeaderView::Fixed); - mTableWidget->setColumnWidth(0, 25); - mTableWidget->setColumnWidth(1, 41); - mTableWidget->horizontalHeader()->setVisible(false); + m_tableWidget->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Fixed); + m_tableWidget->horizontalHeader()->setSectionResizeMode(1, QHeaderView::Fixed); + m_tableWidget->setColumnWidth(0, 25); + m_tableWidget->setColumnWidth(1, 41); + m_tableWidget->horizontalHeader()->setVisible(false); - mTableWidget->setShowGrid(false); + m_tableWidget->setShowGrid(false); - AzQtComponents::CheckBox::setVisibilityMode(mTableWidget, true); - connect(mTableWidget, &QTableWidget::itemChanged, this, &NodeGroupWindow::OnItemChanged); + AzQtComponents::CheckBox::setVisibilityMode(m_tableWidget, true); + connect(m_tableWidget, &QTableWidget::itemChanged, this, &NodeGroupWindow::OnItemChanged); // ser the horizontal header params - QHeaderView* horizontalHeader = mTableWidget->horizontalHeader(); + QHeaderView* horizontalHeader = m_tableWidget->horizontalHeader(); horizontalHeader->setSortIndicator(2, Qt::AscendingOrder); horizontalHeader->setStretchLastSection(true); // hide the vertical header - QHeaderView* verticalHeader = mTableWidget->verticalHeader(); + QHeaderView* verticalHeader = m_tableWidget->verticalHeader(); verticalHeader->setVisible(false); // create the vertical layout - mVerticalLayout = new QVBoxLayout(); - mVerticalLayout->setSpacing(2); - mVerticalLayout->setMargin(3); - mVerticalLayout->setAlignment(Qt::AlignTop); - mVerticalLayout->addWidget(toolBar); - mVerticalLayout->addWidget(mTableWidget); + m_verticalLayout = new QVBoxLayout(); + m_verticalLayout->setSpacing(2); + m_verticalLayout->setMargin(3); + m_verticalLayout->setAlignment(Qt::AlignTop); + m_verticalLayout->addWidget(toolBar); + m_verticalLayout->addWidget(m_tableWidget); // set the object name setObjectName("StyledWidget"); @@ -246,7 +239,7 @@ namespace EMStudio // create the fake widget and layout QWidget* fakeWidget = new QWidget(); fakeWidget->setObjectName("StyledWidget"); - fakeWidget->setLayout(mVerticalLayout); + fakeWidget->setLayout(m_verticalLayout); QVBoxLayout* fakeLayout = new QVBoxLayout(); fakeLayout->setMargin(0); @@ -267,12 +260,12 @@ namespace EMStudio NodeGroupWindow::~NodeGroupWindow() { // unregister the command callbacks and get rid of the memory - GetCommandManager()->RemoveCommandCallback(mCreateCallback, false); - GetCommandManager()->RemoveCommandCallback(mRemoveCallback, false); - GetCommandManager()->RemoveCommandCallback(mAdjustCallback, false); - delete mCreateCallback; - delete mRemoveCallback; - delete mAdjustCallback; + GetCommandManager()->RemoveCommandCallback(m_createCallback, false); + GetCommandManager()->RemoveCommandCallback(m_removeCallback, false); + GetCommandManager()->RemoveCommandCallback(m_adjustCallback, false); + delete m_createCallback; + delete m_removeCallback; + delete m_adjustCallback; } @@ -283,7 +276,7 @@ namespace EMStudio AZStd::vector selectedNodeGroups; // get the current selection - const QList selectedItems = mTableWidget->selectedItems(); + const QList selectedItems = m_tableWidget->selectedItems(); // get the number of selected items const int numSelectedItems = selectedItems.count(); @@ -293,7 +286,7 @@ namespace EMStudio for (int i = 0; i < numSelectedItems; ++i) { const int rowIndex = selectedItems[i]->row(); - const AZStd::string nodeGroupName = FromQtString(mTableWidget->item(rowIndex, 2)->text()); + const AZStd::string nodeGroupName = FromQtString(m_tableWidget->item(rowIndex, 2)->text()); if (AZStd::find(begin(selectedNodeGroups), end(selectedNodeGroups), nodeGroupName) == end(selectedNodeGroups)) { selectedNodeGroups.emplace_back(nodeGroupName); @@ -301,28 +294,28 @@ namespace EMStudio } // clear the lookup array - mWidgetTable.clear(); + m_widgetTable.clear(); // get the anim graph - EMotionFX::AnimGraph* animGraph = mPlugin->GetActiveAnimGraph(); + EMotionFX::AnimGraph* animGraph = m_plugin->GetActiveAnimGraph(); if (animGraph == nullptr) { - mTableWidget->setRowCount(0); + m_tableWidget->setRowCount(0); UpdateInterface(); return; } // disable signals - mTableWidget->blockSignals(true); + m_tableWidget->blockSignals(true); // get the number of node groups const int numNodeGroups = aznumeric_caster(animGraph->GetNumNodeGroups()); // set table size and add header items - mTableWidget->setRowCount(numNodeGroups); + m_tableWidget->setRowCount(numNodeGroups); // disable the sorting - mTableWidget->setSortingEnabled(false); + m_tableWidget->setSortingEnabled(false); // add each node group for (int i = 0; i < numNodeGroups; ++i) @@ -343,13 +336,13 @@ namespace EMStudio visibilityCheckboxItem->setData(Qt::CheckStateRole, nodeGroup->GetIsVisible() ? Qt::Checked : Qt::Unchecked); // add the item, it's needed to have the background color + the widget - mTableWidget->setItem(i, 0, visibilityCheckboxItem); + m_tableWidget->setItem(i, 0, visibilityCheckboxItem); // create the color item QTableWidgetItem* colorItem = new QTableWidgetItem(); // add the item, it's needed to have the background color + the widget - mTableWidget->setItem(i, 1, colorItem); + m_tableWidget->setItem(i, 1, colorItem); // create the color widget AzQtComponents::ColorLabel* colorWidget = new AzQtComponents::ColorLabel(color); @@ -365,15 +358,15 @@ namespace EMStudio colorLayout->addWidget(colorWidget); colorLayoutWidget->setLayout(colorLayout); - mWidgetTable.emplace_back(WidgetLookup{colorWidget, i}); + m_widgetTable.emplace_back(WidgetLookup{colorWidget, i}); connect(colorWidget, &AzQtComponents::ColorLabel::colorChanged, this, &NodeGroupWindow::OnColorChanged); // add the color label in the table - mTableWidget->setCellWidget(i, 1, colorLayoutWidget); + m_tableWidget->setCellWidget(i, 1, colorLayoutWidget); // create the node group name label QTableWidgetItem* nameItem = new QTableWidgetItem(nodeGroup->GetName()); - mTableWidget->setItem(i, 2, nameItem); + m_tableWidget->setItem(i, 2, nameItem); // set the item selected visibilityCheckboxItem->setSelected(itemSelected); @@ -381,24 +374,24 @@ namespace EMStudio nameItem->setSelected(itemSelected); // set the row height - mTableWidget->setRowHeight(i, 21); + m_tableWidget->setRowHeight(i, 21); // check if the current item contains the find text if (QString(nodeGroup->GetName()).contains(m_searchWidgetText.c_str(), Qt::CaseInsensitive)) { - mTableWidget->showRow(i); + m_tableWidget->showRow(i); } else { - mTableWidget->hideRow(i); + m_tableWidget->hideRow(i); } } // enable the sorting - mTableWidget->setSortingEnabled(true); + m_tableWidget->setSortingEnabled(true); // enable signals - mTableWidget->blockSignals(false); + m_tableWidget->blockSignals(false); // update the interface UpdateInterface(); @@ -416,7 +409,7 @@ namespace EMStudio void NodeGroupWindow::OnAddNodeGroup() { // add the parameter - EMotionFX::AnimGraph* animGraph = mPlugin->GetActiveAnimGraph(); + EMotionFX::AnimGraph* animGraph = m_plugin->GetActiveAnimGraph(); if (animGraph == nullptr) { MCore::LogWarning("NodeGroupWindow::OnAddNodeGroup() - No AnimGraph active!"); @@ -439,12 +432,12 @@ namespace EMStudio { // select the new node group EMotionFX::AnimGraphNodeGroup* lastNodeGroup = animGraph->GetNodeGroup(animGraph->GetNumNodeGroups() - 1); - const int numRows = mTableWidget->rowCount(); + const int numRows = m_tableWidget->rowCount(); for (int i = 0; i < numRows; ++i) { - if (mTableWidget->item(i, 2)->text() == QString(lastNodeGroup->GetName())) + if (m_tableWidget->item(i, 2)->text() == QString(lastNodeGroup->GetName())) { - mTableWidget->selectRow(i); + m_tableWidget->selectRow(i); break; } } @@ -455,18 +448,18 @@ namespace EMStudio // find the index for the given widget int NodeGroupWindow::FindGroupIndexByWidget(QObject* widget) const { - const auto foundGroup = AZStd::find_if(begin(mWidgetTable), end(mWidgetTable), [widget](const auto& tableEntry) + const auto foundGroup = AZStd::find_if(begin(m_widgetTable), end(m_widgetTable), [widget](const auto& tableEntry) { - return tableEntry.mWidget == widget; + return tableEntry.m_widget == widget; }); - return foundGroup != end(mWidgetTable) ? foundGroup->mGroupIndex : MCore::InvalidIndexT; + return foundGroup != end(m_widgetTable) ? foundGroup->m_groupIndex : MCore::InvalidIndexT; } void NodeGroupWindow::OnIsVisible(int state, int row) { // get the anim graph - EMotionFX::AnimGraph* animGraph = mPlugin->GetActiveAnimGraph(); + EMotionFX::AnimGraph* animGraph = m_plugin->GetActiveAnimGraph(); if (animGraph == nullptr) { return; @@ -504,7 +497,7 @@ namespace EMStudio void NodeGroupWindow::OnColorChanged(const AZ::Color& color) { // get the anim graph - EMotionFX::AnimGraph* animGraph = mPlugin->GetActiveAnimGraph(); + EMotionFX::AnimGraph* animGraph = m_plugin->GetActiveAnimGraph(); if (animGraph == nullptr) { return; @@ -544,14 +537,14 @@ namespace EMStudio void NodeGroupWindow::UpdateInterface() { // get the anim graph - EMotionFX::AnimGraph* animGraph = mPlugin->GetActiveAnimGraph(); + EMotionFX::AnimGraph* animGraph = m_plugin->GetActiveAnimGraph(); if (animGraph == nullptr) { - mAddAction->setEnabled(false); + m_addAction->setEnabled(false); return; } - mAddAction->setEnabled(true); + m_addAction->setEnabled(true); } @@ -559,14 +552,14 @@ namespace EMStudio void NodeGroupWindow::OnRemoveSelectedGroups() { // get the anim graph - EMotionFX::AnimGraph* animGraph = mPlugin->GetActiveAnimGraph(); + EMotionFX::AnimGraph* animGraph = m_plugin->GetActiveAnimGraph(); if (animGraph == nullptr) { return; } // get the current selection - const QList selectedItems = mTableWidget->selectedItems(); + const QList selectedItems = m_tableWidget->selectedItems(); // get the number of selected items const int numSelectedItems = selectedItems.count(); @@ -612,7 +605,7 @@ namespace EMStudio AZStd::string tempString; for (size_t i = 0; i < numRowIndices; ++i) { - const AZStd::string nodeGroupName = FromQtString(mTableWidget->item(rowIndices[i], 2)->text()); + const AZStd::string nodeGroupName = FromQtString(m_tableWidget->item(rowIndices[i], 2)->text()); if (i == 0 || i == numRowIndices - 1) { tempString = AZStd::string::format("AnimGraphRemoveNodeGroup -animGraphID %i -name \"%s\"", animGraph->GetID(), nodeGroupName.c_str()); @@ -631,13 +624,13 @@ namespace EMStudio } // selected the next row - if (rowIndices[0] > (mTableWidget->rowCount() - 1)) + if (rowIndices[0] > (m_tableWidget->rowCount() - 1)) { - mTableWidget->selectRow(rowIndices[0] - 1); + m_tableWidget->selectRow(rowIndices[0] - 1); } else { - mTableWidget->selectRow(rowIndices[0]); + m_tableWidget->selectRow(rowIndices[0]); } } @@ -646,11 +639,11 @@ namespace EMStudio void NodeGroupWindow::OnRenameSelectedNodeGroup() { // take the item of the name column - const QList selectedItems = mTableWidget->selectedItems(); - QTableWidgetItem* item = mTableWidget->item(selectedItems[0]->row(), 2); + const QList selectedItems = m_tableWidget->selectedItems(); + QTableWidgetItem* item = m_tableWidget->item(selectedItems[0]->row(), 2); // show the rename window - NodeGroupRenameWindow nodeGroupRenameWindow(this, mPlugin->GetActiveAnimGraph(), FromQtString(item->text())); + NodeGroupRenameWindow nodeGroupRenameWindow(this, m_plugin->GetActiveAnimGraph(), FromQtString(item->text())); nodeGroupRenameWindow.exec(); } @@ -658,7 +651,7 @@ namespace EMStudio void NodeGroupWindow::OnClearNodeGroups() { // get the anim graph - EMotionFX::AnimGraph* animGraph = mPlugin->GetActiveAnimGraph(); + EMotionFX::AnimGraph* animGraph = m_plugin->GetActiveAnimGraph(); if (animGraph == nullptr) { return; @@ -715,7 +708,7 @@ namespace EMStudio void NodeGroupWindow::contextMenuEvent(QContextMenuEvent* event) { // get the current selection - const QList selectedItems = mTableWidget->selectedItems(); + const QList selectedItems = m_tableWidget->selectedItems(); // get the number of selected items const int numSelectedItems = selectedItems.count(); diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/NodeGroupWindow.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/NodeGroupWindow.h index e19b831790..69255ce9b4 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/NodeGroupWindow.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/NodeGroupWindow.h @@ -54,10 +54,10 @@ namespace EMStudio void Accepted(); private: - EMotionFX::AnimGraph* mAnimGraph; - AZStd::string mNodeGroup; - QLineEdit* mLineEdit; - QPushButton* mOKButton; + EMotionFX::AnimGraph* m_animGraph; + AZStd::string m_nodeGroup; + QLineEdit* m_lineEdit; + QPushButton* m_okButton; }; class NodeGroupWindow @@ -98,22 +98,22 @@ namespace EMStudio MCORE_DEFINECOMMANDCALLBACK(CommandAnimGraphAdjustNodeGroupCallback); MCORE_DEFINECOMMANDCALLBACK(CommandAnimGraphRemoveNodeGroupCallback); - CommandAnimGraphAddNodeGroupCallback* mCreateCallback; - CommandAnimGraphAdjustNodeGroupCallback* mAdjustCallback; - CommandAnimGraphRemoveNodeGroupCallback* mRemoveCallback; + CommandAnimGraphAddNodeGroupCallback* m_createCallback; + CommandAnimGraphAdjustNodeGroupCallback* m_adjustCallback; + CommandAnimGraphRemoveNodeGroupCallback* m_removeCallback; struct WidgetLookup { - QObject* mWidget; - int mGroupIndex; + QObject* m_widget; + int m_groupIndex; }; - AnimGraphPlugin* mPlugin; - QTableWidget* mTableWidget; - QVBoxLayout* mVerticalLayout; - QAction* mAddAction; + AnimGraphPlugin* m_plugin; + QTableWidget* m_tableWidget; + QVBoxLayout* m_verticalLayout; + QAction* m_addAction; AzQtComponents::FilteredSearchWidget* m_searchWidget; AZStd::string m_searchWidgetText; - AZStd::vector mWidgetTable; + AZStd::vector m_widgetTable; }; } // namespace EMStudio diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/NodePaletteWidget.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/NodePaletteWidget.cpp index a0ee45be0b..bd55ce2905 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/NodePaletteWidget.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/NodePaletteWidget.cpp @@ -287,23 +287,23 @@ namespace EMStudio } NodePaletteWidget::EventHandler::EventHandler(NodePaletteWidget* widget) - : mWidget(widget) + : m_widget(widget) {} void NodePaletteWidget::EventHandler::OnCreatedNode(EMotionFX::AnimGraph* animGraph, EMotionFX::AnimGraphNode* node) { - if (mWidget->mNode && node->GetParentNode() == mWidget->mNode) + if (m_widget->m_node && node->GetParentNode() == m_widget->m_node) { - mWidget->Init(animGraph, mWidget->mNode); + m_widget->Init(animGraph, m_widget->m_node); } } void NodePaletteWidget::EventHandler::OnRemovedChildNode(EMotionFX::AnimGraph* animGraph, EMotionFX::AnimGraphNode* parentNode) { - if (mWidget->mNode && parentNode && parentNode == mWidget->mNode) + if (m_widget->m_node && parentNode && parentNode == m_widget->m_node) { - mWidget->Init(animGraph, mWidget->mNode); + m_widget->Init(animGraph, m_widget->m_node); } } @@ -311,52 +311,52 @@ namespace EMStudio // constructor NodePaletteWidget::NodePaletteWidget(AnimGraphPlugin* plugin) : QWidget() - , mPlugin(plugin) - , mModel(new NodePaletteModel(plugin, this)) + , m_plugin(plugin) + , m_model(new NodePaletteModel(plugin, this)) { - mNode = nullptr; + m_node = nullptr; // create the default layout - mLayout = new QVBoxLayout(); - mLayout->setMargin(0); - mLayout->setSpacing(0); + m_layout = new QVBoxLayout(); + m_layout->setMargin(0); + m_layout->setSpacing(0); // create the initial text - mInitialText = new QLabel("Create and activate a Anim Graph first.
Then drag and drop items from the
palette into the Anim Graph window.
"); - mInitialText->setAlignment(Qt::AlignCenter); - mInitialText->setTextFormat(Qt::RichText); - mInitialText->setMaximumSize(10000, 10000); - mInitialText->setMargin(0); - mInitialText->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum); + m_initialText = new QLabel("Create and activate a Anim Graph first.
Then drag and drop items from the
palette into the Anim Graph window.
"); + m_initialText->setAlignment(Qt::AlignCenter); + m_initialText->setTextFormat(Qt::RichText); + m_initialText->setMaximumSize(10000, 10000); + m_initialText->setMargin(0); + m_initialText->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum); // add the initial text in the layout - mLayout->addWidget(mInitialText); + m_layout->addWidget(m_initialText); // create the tree view - mTreeView = new QTreeView(this); - mTreeView->setHeaderHidden(true); - mTreeView->setModel(mModel); - mTreeView->setDragDropMode(QAbstractItemView::DragOnly); + m_treeView = new QTreeView(this); + m_treeView->setHeaderHidden(true); + m_treeView->setModel(m_model); + m_treeView->setDragDropMode(QAbstractItemView::DragOnly); // add the tree view in the layout - mLayout->addWidget(mTreeView); + m_layout->addWidget(m_treeView); // set the default layout - setLayout(mLayout); + setLayout(m_layout); // register the event handler - mEventHandler = aznew NodePaletteWidget::EventHandler(this); - EMotionFX::GetEventManager().AddEventHandler(mEventHandler); + m_eventHandler = aznew NodePaletteWidget::EventHandler(this); + EMotionFX::GetEventManager().AddEventHandler(m_eventHandler); - connect(&mPlugin->GetAnimGraphModel(), &AnimGraphModel::FocusChanged, this, &NodePaletteWidget::OnFocusChanged); + connect(&m_plugin->GetAnimGraphModel(), &AnimGraphModel::FocusChanged, this, &NodePaletteWidget::OnFocusChanged); } // destructor NodePaletteWidget::~NodePaletteWidget() { - EMotionFX::GetEventManager().RemoveEventHandler(mEventHandler); - delete mEventHandler; + EMotionFX::GetEventManager().RemoveEventHandler(m_eventHandler); + delete m_eventHandler; } @@ -364,33 +364,33 @@ namespace EMStudio void NodePaletteWidget::Init(EMotionFX::AnimGraph* animGraph, EMotionFX::AnimGraphNode* node) { // set the node - mNode = node; + m_node = node; // check if the anim graph is not valid // on this case we show a message to say no one anim graph is activated if (animGraph == nullptr) { // set the layout params - mLayout->setMargin(0); - mLayout->setSpacing(0); + m_layout->setMargin(0); + m_layout->setSpacing(0); // set the widget visible or not - mInitialText->setVisible(true); - mTreeView->setVisible(false); + m_initialText->setVisible(true); + m_treeView->setVisible(false); } else { // set the layout params - mLayout->setMargin(2); - mLayout->setSpacing(2); + m_layout->setMargin(2); + m_layout->setSpacing(2); // set the widget visible or not - mInitialText->setVisible(false); - mTreeView->setVisible(true); + m_initialText->setVisible(false); + m_treeView->setVisible(true); } SaveExpandStates(); - mModel->setNode(mNode); + m_model->setNode(m_node); RestoreExpandStates(); } @@ -398,16 +398,16 @@ namespace EMStudio void NodePaletteWidget::SaveExpandStates() { m_expandedCatagory.clear(); - const auto& catagoryNames = mModel->GetCategoryNames(); + const auto& catagoryNames = m_model->GetCategoryNames(); // Save the expand state. for (const auto& categoryName : catagoryNames) { const QString& str = categoryName.second; - const QModelIndexList items = mModel->match(mModel->index(0, 0), Qt::DisplayRole, QVariant::fromValue(str)); + const QModelIndexList items = m_model->match(m_model->index(0, 0), Qt::DisplayRole, QVariant::fromValue(str)); if (!items.isEmpty()) { - if (mTreeView->isExpanded(items.first())) + if (m_treeView->isExpanded(items.first())) { m_expandedCatagory.emplace(categoryName.first); } @@ -418,7 +418,7 @@ namespace EMStudio void NodePaletteWidget::RestoreExpandStates() { - const auto& catagoryNames = mModel->GetCategoryNames(); + const auto& catagoryNames = m_model->GetCategoryNames(); // Restore the expand state. for (const auto& categoryName : catagoryNames) @@ -430,10 +430,10 @@ namespace EMStudio } const QString& str = categoryName.second; - const QModelIndexList items = mModel->match(mModel->index(0, 0), Qt::DisplayRole, QVariant::fromValue(str)); + const QModelIndexList items = m_model->match(m_model->index(0, 0), Qt::DisplayRole, QVariant::fromValue(str)); if (!items.isEmpty()) { - mTreeView->setExpanded(items.first(), true); + m_treeView->setExpanded(items.first(), true); } } m_expandedCatagory.clear(); diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/NodePaletteWidget.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/NodePaletteWidget.h index be6d17bc12..2ca1a85f74 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/NodePaletteWidget.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/NodePaletteWidget.h @@ -48,7 +48,7 @@ namespace EMStudio void OnRemovedChildNode(EMotionFX::AnimGraph* animGraph, EMotionFX::AnimGraphNode* parentNode) override; private: - NodePaletteWidget* mWidget; + NodePaletteWidget* m_widget; }; NodePaletteWidget(AnimGraphPlugin* plugin); @@ -65,13 +65,13 @@ namespace EMStudio void SaveExpandStates(); void RestoreExpandStates(); - AnimGraphPlugin* mPlugin; - NodePaletteModel* mModel; - QTreeView* mTreeView; - EMotionFX::AnimGraphNode* mNode; - EventHandler* mEventHandler; - QVBoxLayout* mLayout; - QLabel* mInitialText; + AnimGraphPlugin* m_plugin; + NodePaletteModel* m_model; + QTreeView* m_treeView; + EMotionFX::AnimGraphNode* m_node; + EventHandler* m_eventHandler; + QVBoxLayout* m_layout; + QLabel* m_initialText; // Cache the expanded states. AZStd::unordered_set m_expandedCatagory; diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/ParameterCreateEditDialog.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/ParameterCreateEditDialog.cpp index f93e72821c..eb4696ef23 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/ParameterCreateEditDialog.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/ParameterCreateEditDialog.cpp @@ -25,7 +25,7 @@ namespace EMStudio { - int ParameterCreateEditDialog::m_parameterEditorMinWidth = 300; + int ParameterCreateEditDialog::s_parameterEditorMinWidth = 300; ParameterCreateEditDialog::ParameterCreateEditDialog(AnimGraphPlugin* plugin, QWidget* parent, const EMotionFX::Parameter* editParameter) : QDialog(parent) @@ -74,7 +74,7 @@ namespace EMStudio m_parameterEditorWidget->setSizePolicy(QSizePolicy::Policy::MinimumExpanding, QSizePolicy::Policy::MinimumExpanding); m_parameterEditorWidget->SetSizeHintOffset(QSize(0, 0)); m_parameterEditorWidget->SetLeafIndentation(0); - m_parameterEditorWidget->setMinimumWidth(m_parameterEditorMinWidth); + m_parameterEditorWidget->setMinimumWidth(s_parameterEditorMinWidth); mainLayout->addWidget(m_parameterEditorWidget); // Add the preview information diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/ParameterCreateEditDialog.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/ParameterCreateEditDialog.h index 75b0777269..941ee53727 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/ParameterCreateEditDialog.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/ParameterCreateEditDialog.h @@ -78,6 +78,6 @@ namespace EMStudio AZStd::unique_ptr m_parameter; AZStd::string m_originalName; - static int m_parameterEditorMinWidth; + static int s_parameterEditorMinWidth; }; } // namespace EMStudio diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/ParameterEditor/ColorParameterEditor.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/ParameterEditor/ColorParameterEditor.cpp index 0302bb66ee..047de95f15 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/ParameterEditor/ColorParameterEditor.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/ParameterEditor/ColorParameterEditor.cpp @@ -63,7 +63,7 @@ namespace EMStudio if (!m_attributes.empty()) { MCore::AttributeColor* attribute = static_cast(m_attributes[0]); - m_currentValue = AZ::Color(attribute->GetValue().r, attribute->GetValue().g, attribute->GetValue().b, attribute->GetValue().a); + m_currentValue = AZ::Color(attribute->GetValue().m_r, attribute->GetValue().m_g, attribute->GetValue().m_b, attribute->GetValue().m_a); } else { diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/ParameterSelectionWindow.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/ParameterSelectionWindow.cpp index 6b17148fe4..51a47a47bf 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/ParameterSelectionWindow.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/ParameterSelectionWindow.cpp @@ -24,32 +24,32 @@ namespace EMStudio ParameterSelectionWindow::ParameterSelectionWindow(QWidget* parent, bool useSingleSelection) : QDialog(parent) { - mAccepted = false; + m_accepted = false; setWindowTitle("Parameter Selection Window"); QVBoxLayout* layout = new QVBoxLayout(); - mParameterWidget = new ParameterWidget(this, useSingleSelection); + m_parameterWidget = new ParameterWidget(this, useSingleSelection); // create the ok and cancel buttons QHBoxLayout* buttonLayout = new QHBoxLayout(); - mOKButton = new QPushButton("OK"); - mCancelButton = new QPushButton("Cancel"); - buttonLayout->addWidget(mOKButton); - buttonLayout->addWidget(mCancelButton); + m_okButton = new QPushButton("OK"); + m_cancelButton = new QPushButton("Cancel"); + buttonLayout->addWidget(m_okButton); + buttonLayout->addWidget(m_cancelButton); - layout->addWidget(mParameterWidget); + layout->addWidget(m_parameterWidget); layout->addLayout(buttonLayout); setLayout(layout); - connect(mOKButton, &QPushButton::clicked, this, &ParameterSelectionWindow::accept); - connect(mCancelButton, &QPushButton::clicked, this, &ParameterSelectionWindow::reject); + connect(m_okButton, &QPushButton::clicked, this, &ParameterSelectionWindow::accept); + connect(m_cancelButton, &QPushButton::clicked, this, &ParameterSelectionWindow::reject); connect(this, &ParameterSelectionWindow::accepted, this, &ParameterSelectionWindow::OnAccept); - connect(mParameterWidget, &ParameterWidget::OnDoubleClicked, this, &ParameterSelectionWindow::OnDoubleClicked); + connect(m_parameterWidget, &ParameterWidget::OnDoubleClicked, this, &ParameterSelectionWindow::OnDoubleClicked); // set the selection mode - mParameterWidget->SetSelectionMode(useSingleSelection); - mUseSingleSelection = useSingleSelection; + m_parameterWidget->SetSelectionMode(useSingleSelection); + m_useSingleSelection = useSingleSelection; } @@ -67,7 +67,7 @@ namespace EMStudio void ParameterSelectionWindow::OnAccept() { - mParameterWidget->FireSelectionDoneSignal(); + m_parameterWidget->FireSelectionDoneSignal(); } } // namespace EMStudio diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/ParameterSelectionWindow.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/ParameterSelectionWindow.h index 25e717f473..cb8e28c476 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/ParameterSelectionWindow.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/ParameterSelectionWindow.h @@ -26,9 +26,9 @@ namespace EMStudio * 2. Use the itemSelectionChanged() signal of the GetNodeHierarchyWidget()->GetTreeWidget() to detect when the user adjusts the selection in the node hierarchy widget. * 3. Use the OnSelectionDone() in the GetNodeHierarchyWidget() to detect when the user finished selecting and pressed the OK button. * Example: - * connect( mParameterSelectionWindow, SIGNAL(rejected()), this, SLOT(UserWantsToCancel_1()) ); - * connect( mParameterSelectionWindow->GetNodeHierarchyWidget()->GetTreeWidget(), SIGNAL(itemSelectionChanged()), this, SLOT(SelectionChanged_2()) ); - * connect( mParameterSelectionWindow->GetNodeHierarchyWidget(), SIGNAL(OnSelectionDone(AZStd::vector)), this, SLOT(FinishedSelectionAndPressedOK_3(AZStd::vector)) ); + * connect( m_parameterSelectionWindow, SIGNAL(rejected()), this, SLOT(UserWantsToCancel_1()) ); + * connect( m_parameterSelectionWindow->GetNodeHierarchyWidget()->GetTreeWidget(), SIGNAL(itemSelectionChanged()), this, SLOT(SelectionChanged_2()) ); + * connect( m_parameterSelectionWindow->GetNodeHierarchyWidget(), SIGNAL(OnSelectionDone(AZStd::vector)), this, SLOT(FinishedSelectionAndPressedOK_3(AZStd::vector)) ); */ class ParameterSelectionWindow : public QDialog @@ -40,18 +40,18 @@ namespace EMStudio ParameterSelectionWindow(QWidget* parent, bool useSingleSelection); virtual ~ParameterSelectionWindow(); - MCORE_INLINE ParameterWidget* GetParameterWidget() { return mParameterWidget; } - void Update(EMotionFX::AnimGraph* animGraph, const AZStd::vector& selectedParameters) { mParameterWidget->Update(animGraph, selectedParameters); } + MCORE_INLINE ParameterWidget* GetParameterWidget() { return m_parameterWidget; } + void Update(EMotionFX::AnimGraph* animGraph, const AZStd::vector& selectedParameters) { m_parameterWidget->Update(animGraph, selectedParameters); } public slots: void OnAccept(); void OnDoubleClicked(const AZStd::string& item); private: - ParameterWidget* mParameterWidget; - QPushButton* mOKButton; - QPushButton* mCancelButton; - bool mUseSingleSelection; - bool mAccepted; + ParameterWidget* m_parameterWidget; + QPushButton* m_okButton; + QPushButton* m_cancelButton; + bool m_useSingleSelection; + bool m_accepted; }; } // namespace EMStudio diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/ParameterWidget.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/ParameterWidget.cpp index 87f9782c95..3c96367d1f 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/ParameterWidget.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/ParameterWidget.cpp @@ -36,32 +36,32 @@ namespace EMStudio layout->setMargin(0); // create the tree widget - mTreeWidget = new QTreeWidget(); + m_treeWidget = new QTreeWidget(); // create header items - mTreeWidget->setColumnCount(1); + m_treeWidget->setColumnCount(1); QStringList headerList; headerList.append("Name"); - mTreeWidget->setHeaderLabels(headerList); + m_treeWidget->setHeaderLabels(headerList); // set optical stuff for the tree - mTreeWidget->setSortingEnabled(false); - mTreeWidget->setSelectionMode(QAbstractItemView::SingleSelection); - mTreeWidget->setMinimumWidth(620); - mTreeWidget->setMinimumHeight(500); - mTreeWidget->setAlternatingRowColors(true); - mTreeWidget->setExpandsOnDoubleClick(true); - mTreeWidget->setAnimated(true); + m_treeWidget->setSortingEnabled(false); + m_treeWidget->setSelectionMode(QAbstractItemView::SingleSelection); + m_treeWidget->setMinimumWidth(620); + m_treeWidget->setMinimumHeight(500); + m_treeWidget->setAlternatingRowColors(true); + m_treeWidget->setExpandsOnDoubleClick(true); + m_treeWidget->setAnimated(true); // disable the move of section to have column order fixed - mTreeWidget->header()->setSectionsMovable(false); + m_treeWidget->header()->setSectionsMovable(false); layout->addWidget(m_searchWidget); - layout->addWidget(mTreeWidget); + layout->addWidget(m_treeWidget); setLayout(layout); - connect(mTreeWidget, &QTreeWidget::itemSelectionChanged, this, &ParameterWidget::UpdateSelection); - connect(mTreeWidget, &QTreeWidget::itemDoubleClicked, this, &ParameterWidget::ItemDoubleClicked); + connect(m_treeWidget, &QTreeWidget::itemSelectionChanged, this, &ParameterWidget::UpdateSelection); + connect(m_treeWidget, &QTreeWidget::itemDoubleClicked, this, &ParameterWidget::ItemDoubleClicked); // set the selection mode SetSelectionMode(useSingleSelection); @@ -75,9 +75,9 @@ namespace EMStudio void ParameterWidget::Update(EMotionFX::AnimGraph* animGraph, const AZStd::vector& selectedParameters) { - mAnimGraph = animGraph; - mSelectedParameters = selectedParameters; - mOldSelectedParameters = selectedParameters; + m_animGraph = animGraph; + m_selectedParameters = selectedParameters; + m_oldSelectedParameters = selectedParameters; Update(); } @@ -102,15 +102,15 @@ namespace EMStudio } else { - item = new QTreeWidgetItem(mTreeWidget); - mTreeWidget->addTopLevelItem(item); + item = new QTreeWidgetItem(m_treeWidget); + m_treeWidget->addTopLevelItem(item); } item->setText(0, parameter->GetName().c_str()); item->setExpanded(true); // check if the given parameter is selected - if (AZStd::find(mOldSelectedParameters.begin(), mOldSelectedParameters.end(), parameter->GetName()) != mOldSelectedParameters.end()) + if (AZStd::find(m_oldSelectedParameters.begin(), m_oldSelectedParameters.end(), parameter->GetName()) != m_oldSelectedParameters.end()) { item->setSelected(true); } @@ -120,39 +120,39 @@ namespace EMStudio void ParameterWidget::Update() { - mTreeWidget->clear(); - mTreeWidget->blockSignals(true); + m_treeWidget->clear(); + m_treeWidget->blockSignals(true); // add all parameters that belong to no group parameter - const EMotionFX::ValueParameterVector childValueParameters = mAnimGraph->GetChildValueParameters(); + const EMotionFX::ValueParameterVector childValueParameters = m_animGraph->GetChildValueParameters(); for (const EMotionFX::ValueParameter* parameter : childValueParameters) { - AddParameterToInterface(mAnimGraph, parameter, nullptr); + AddParameterToInterface(m_animGraph, parameter, nullptr); } // get all group parameters and iterate through them AZStd::string tempString; - const EMotionFX::GroupParameterVector groupParameters = mAnimGraph->RecursivelyGetGroupParameters(); + const EMotionFX::GroupParameterVector groupParameters = m_animGraph->RecursivelyGetGroupParameters(); for (const EMotionFX::GroupParameter* groupParameter : groupParameters) { // add the group item to the tree widget - QTreeWidgetItem* groupItem = new QTreeWidgetItem(mTreeWidget); + QTreeWidgetItem* groupItem = new QTreeWidgetItem(m_treeWidget); groupItem->setText(0, groupParameter->GetName().c_str()); groupItem->setExpanded(true); const EMotionFX::ValueParameterVector childValueParameters2 = groupParameter->GetChildValueParameters(); tempString = AZStd::string::format("%zu Parameters", childValueParameters2.size()); groupItem->setToolTip(1, tempString.c_str()); - mTreeWidget->addTopLevelItem(groupItem); + m_treeWidget->addTopLevelItem(groupItem); // add all parameters that belong to the given group bool groupSelected = !childValueParameters2.empty(); for (const EMotionFX::ValueParameter* valueParameter : childValueParameters2) { - AddParameterToInterface(mAnimGraph, valueParameter, groupItem); + AddParameterToInterface(m_animGraph, valueParameter, groupItem); // check if the given parameter is selected - if (groupSelected && AZStd::find(mOldSelectedParameters.begin(), mOldSelectedParameters.end(), valueParameter->GetName()) == mOldSelectedParameters.end()) + if (groupSelected && AZStd::find(m_oldSelectedParameters.begin(), m_oldSelectedParameters.end(), valueParameter->GetName()) == m_oldSelectedParameters.end()) { groupSelected = false; } @@ -161,18 +161,18 @@ namespace EMStudio groupItem->setSelected(groupSelected); } - mTreeWidget->blockSignals(false); + m_treeWidget->blockSignals(false); UpdateSelection(); } void ParameterWidget::UpdateSelection() { - QList selectedItems = mTreeWidget->selectedItems(); + QList selectedItems = m_treeWidget->selectedItems(); - mSelectedParameters.clear(); + m_selectedParameters.clear(); const uint32 numSelectedItems = selectedItems.count(); - mSelectedParameters.reserve(numSelectedItems); + m_selectedParameters.reserve(numSelectedItems); // Iterate through the selected items in the tree widget. AZStd::string itemName; @@ -183,7 +183,7 @@ namespace EMStudio // Get the parameter by name. // Skip elements that we can't find as they also shouldn't be selectable. - const EMotionFX::Parameter* parameter = mAnimGraph->FindParameterByName(itemName); + const EMotionFX::Parameter* parameter = m_animGraph->FindParameterByName(itemName); if (!parameter) { continue; @@ -192,9 +192,9 @@ namespace EMStudio // check if the selected item is a parameter if (azrtti_typeid(parameter) != azrtti_typeid()) { - if (AZStd::find(mSelectedParameters.begin(), mSelectedParameters.end(), itemName) == mSelectedParameters.end()) + if (AZStd::find(m_selectedParameters.begin(), m_selectedParameters.end(), itemName) == m_selectedParameters.end()) { - mSelectedParameters.emplace_back(itemName); + m_selectedParameters.emplace_back(itemName); } } // selected item is a group @@ -205,9 +205,9 @@ namespace EMStudio const EMotionFX::ValueParameterVector valueParameters = groupParameter->RecursivelyGetChildValueParameters(); for (const EMotionFX::ValueParameter* valueParameter : valueParameters) { - if (AZStd::find(mSelectedParameters.begin(), mSelectedParameters.end(), valueParameter->GetName()) == mSelectedParameters.end()) + if (AZStd::find(m_selectedParameters.begin(), m_selectedParameters.end(), valueParameter->GetName()) == m_selectedParameters.end()) { - mSelectedParameters.emplace_back(valueParameter->GetName()); + m_selectedParameters.emplace_back(valueParameter->GetName()); } } } @@ -219,14 +219,14 @@ namespace EMStudio { if (useSingleSelection) { - mTreeWidget->setSelectionMode(QAbstractItemView::SingleSelection); + m_treeWidget->setSelectionMode(QAbstractItemView::SingleSelection); } else { - mTreeWidget->setSelectionMode(QAbstractItemView::ExtendedSelection); + m_treeWidget->setSelectionMode(QAbstractItemView::ExtendedSelection); } - mUseSingleSelection = useSingleSelection; + m_useSingleSelection = useSingleSelection; } void ParameterWidget::SetFilterTypes(const AZStd::vector& filterTypes) @@ -240,9 +240,9 @@ namespace EMStudio MCORE_UNUSED(column); UpdateSelection(); - if (!mSelectedParameters.empty()) + if (!m_selectedParameters.empty()) { - emit OnDoubleClicked(mSelectedParameters[0]); + emit OnDoubleClicked(m_selectedParameters[0]); } } @@ -257,7 +257,7 @@ namespace EMStudio void ParameterWidget::FireSelectionDoneSignal() { - emit OnSelectionDone(mSelectedParameters); + emit OnSelectionDone(m_selectedParameters); } } // namespace EMStudio diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/ParameterWidget.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/ParameterWidget.h index ed2bd1c4e9..9f0601243b 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/ParameterWidget.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/ParameterWidget.h @@ -45,11 +45,11 @@ namespace EMStudio void SetFilterTypes(const AZStd::vector& filterTypes); void Update(EMotionFX::AnimGraph* animGraph, const AZStd::vector& selectedParameters); void FireSelectionDoneSignal(); - MCORE_INLINE QTreeWidget* GetTreeWidget() { return mTreeWidget; } + MCORE_INLINE QTreeWidget* GetTreeWidget() { return m_treeWidget; } MCORE_INLINE AzQtComponents::FilteredSearchWidget* GetSearchWidget() { return m_searchWidget; } // this calls UpdateSelection() and then returns the member array containing the selected items - AZStd::vector& GetSelectedParameters() { UpdateSelection(); return mSelectedParameters; } + AZStd::vector& GetSelectedParameters() { UpdateSelection(); return m_selectedParameters; } signals: void OnSelectionDone(const AZStd::vector& selectedItems); @@ -65,13 +65,13 @@ namespace EMStudio private: void AddParameterToInterface(EMotionFX::AnimGraph* animGraph, const EMotionFX::Parameter* parameter, QTreeWidgetItem* groupParameterItem); - EMotionFX::AnimGraph* mAnimGraph; - QTreeWidget* mTreeWidget; + EMotionFX::AnimGraph* m_animGraph; + QTreeWidget* m_treeWidget; AzQtComponents::FilteredSearchWidget* m_searchWidget; AZStd::string m_searchWidgetText; AZStd::vector m_filterTypes; - AZStd::vector mSelectedParameters; - AZStd::vector mOldSelectedParameters; - bool mUseSingleSelection; + AZStd::vector m_selectedParameters; + AZStd::vector m_oldSelectedParameters; + bool m_useSingleSelection; }; } // namespace EMStudio diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/ParameterWindow.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/ParameterWindow.cpp index 9664011083..c93d358c07 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/ParameterWindow.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/ParameterWindow.cpp @@ -47,7 +47,7 @@ namespace EMStudio { - int ParameterWindow::m_contextMenuWidth = 100; + int ParameterWindow::s_contextMenuWidth = 100; // constructor ParameterCreateRenameWindow::ParameterCreateRenameWindow(const char* windowTitle, const char* topText, const char* defaultName, const char* oldName, const AZStd::vector& invalidNames, QWidget* parent) @@ -56,8 +56,8 @@ namespace EMStudio setObjectName("EMFX.ParameterCreateRenameDialog"); // store values - mOldName = oldName; - mInvalidNames = invalidNames; + m_oldName = oldName; + m_invalidNames = invalidNames; // update title of the about dialog setWindowTitle(windowTitle); @@ -75,27 +75,27 @@ namespace EMStudio } // add the line edit - mLineEdit = new QLineEdit(defaultName); - connect(mLineEdit, &QLineEdit::textChanged, this, &ParameterCreateRenameWindow::NameEditChanged); - mLineEdit->selectAll(); + m_lineEdit = new QLineEdit(defaultName); + connect(m_lineEdit, &QLineEdit::textChanged, this, &ParameterCreateRenameWindow::NameEditChanged); + m_lineEdit->selectAll(); // create the button layout QHBoxLayout* buttonLayout = new QHBoxLayout(); - mOKButton = new QPushButton("OK"); - mCancelButton = new QPushButton("Cancel"); - buttonLayout->addWidget(mOKButton); - buttonLayout->addWidget(mCancelButton); + m_okButton = new QPushButton("OK"); + m_cancelButton = new QPushButton("Cancel"); + buttonLayout->addWidget(m_okButton); + buttonLayout->addWidget(m_cancelButton); // set the layout - layout->addWidget(mLineEdit); + layout->addWidget(m_lineEdit); layout->addLayout(buttonLayout); setLayout(layout); // connect the buttons - connect(mOKButton, &QPushButton::clicked, this, &ParameterCreateRenameWindow::accept); - connect(mCancelButton, &QPushButton::clicked, this, &ParameterCreateRenameWindow::reject); + connect(m_okButton, &QPushButton::clicked, this, &ParameterCreateRenameWindow::accept); + connect(m_cancelButton, &QPushButton::clicked, this, &ParameterCreateRenameWindow::reject); - mOKButton->setDefault(true); + m_okButton->setDefault(true); } // check for duplicate names upon editing @@ -104,44 +104,44 @@ namespace EMStudio const AZStd::string convertedNewName = text.toUtf8().data(); if (text.isEmpty()) { - mOKButton->setEnabled(false); - GetManager()->SetWidgetAsInvalidInput(mLineEdit); + m_okButton->setEnabled(false); + GetManager()->SetWidgetAsInvalidInput(m_lineEdit); } - else if (mOldName == convertedNewName) + else if (m_oldName == convertedNewName) { - mOKButton->setEnabled(true); - mLineEdit->setStyleSheet(""); + m_okButton->setEnabled(true); + m_lineEdit->setStyleSheet(""); } else { // Check if the name has invalid characters. if (!EMotionFX::Parameter::IsNameValid(convertedNewName, nullptr)) { - mOKButton->setEnabled(false); - GetManager()->SetWidgetAsInvalidInput(mLineEdit); + m_okButton->setEnabled(false); + GetManager()->SetWidgetAsInvalidInput(m_lineEdit); return; } // Is there a parameter with the given name already? - if (AZStd::find(mInvalidNames.begin(), mInvalidNames.end(), convertedNewName) != mInvalidNames.end()) + if (AZStd::find(m_invalidNames.begin(), m_invalidNames.end(), convertedNewName) != m_invalidNames.end()) { - mOKButton->setEnabled(false); - GetManager()->SetWidgetAsInvalidInput(mLineEdit); + m_okButton->setEnabled(false); + GetManager()->SetWidgetAsInvalidInput(m_lineEdit); return; } // no duplicate name found - mOKButton->setEnabled(true); - mLineEdit->setStyleSheet(""); + m_okButton->setEnabled(true); + m_lineEdit->setStyleSheet(""); } } ParameterWindow::ParameterWindow(AnimGraphPlugin* plugin) : QWidget() { - mPlugin = plugin; - mEnsureVisibility = false; - mLockSelection = false; + m_plugin = plugin; + m_ensureVisibility = false; + m_lockSelection = false; // add the add button QToolBar* toolBar = new QToolBar(this); @@ -182,55 +182,55 @@ namespace EMStudio toolBar->addWidget(m_searchWidget); // create the parameter tree widget - mTreeWidget = new ParameterWindowTreeWidget(); - mTreeWidget->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); - mTreeWidget->setObjectName("AnimGraphParamWindow"); - mTreeWidget->header()->setVisible(false); + m_treeWidget = new ParameterWindowTreeWidget(); + m_treeWidget->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); + m_treeWidget->setObjectName("AnimGraphParamWindow"); + m_treeWidget->header()->setVisible(false); // adjust selection mode and enable some other helpful things - mTreeWidget->setSelectionBehavior(QAbstractItemView::SelectRows); - mTreeWidget->setSelectionMode(QAbstractItemView::ExtendedSelection); - mTreeWidget->setExpandsOnDoubleClick(true); - mTreeWidget->setColumnCount(3); - mTreeWidget->setUniformRowHeights(true); - mTreeWidget->setIndentation(10); - mTreeWidget->header()->setSectionResizeMode(0, QHeaderView::ResizeToContents); - mTreeWidget->header()->setSectionResizeMode(1, QHeaderView::ResizeToContents); - mTreeWidget->header()->setSectionResizeMode(2, QHeaderView::Stretch); + m_treeWidget->setSelectionBehavior(QAbstractItemView::SelectRows); + m_treeWidget->setSelectionMode(QAbstractItemView::ExtendedSelection); + m_treeWidget->setExpandsOnDoubleClick(true); + m_treeWidget->setColumnCount(3); + m_treeWidget->setUniformRowHeights(true); + m_treeWidget->setIndentation(10); + m_treeWidget->header()->setSectionResizeMode(0, QHeaderView::ResizeToContents); + m_treeWidget->header()->setSectionResizeMode(1, QHeaderView::ResizeToContents); + m_treeWidget->header()->setSectionResizeMode(2, QHeaderView::Stretch); // enable drag and drop - mTreeWidget->setDragEnabled(true); - mTreeWidget->setDragDropMode(QAbstractItemView::InternalMove); + m_treeWidget->setDragEnabled(true); + m_treeWidget->setDragDropMode(QAbstractItemView::InternalMove); // connect the tree widget - connect(mTreeWidget, &QTreeWidget::itemSelectionChanged, this, &ParameterWindow::OnSelectionChanged); - connect(mTreeWidget, &QTreeWidget::itemCollapsed, this, &ParameterWindow::OnGroupCollapsed); - connect(mTreeWidget, &QTreeWidget::itemExpanded, this, &ParameterWindow::OnGroupExpanded); - connect(mTreeWidget, &ParameterWindowTreeWidget::ParameterMoved, this, &ParameterWindow::OnMoveParameterTo); - connect(mTreeWidget, &ParameterWindowTreeWidget::DragEnded, this, [this]() + connect(m_treeWidget, &QTreeWidget::itemSelectionChanged, this, &ParameterWindow::OnSelectionChanged); + connect(m_treeWidget, &QTreeWidget::itemCollapsed, this, &ParameterWindow::OnGroupCollapsed); + connect(m_treeWidget, &QTreeWidget::itemExpanded, this, &ParameterWindow::OnGroupExpanded); + connect(m_treeWidget, &ParameterWindowTreeWidget::ParameterMoved, this, &ParameterWindow::OnMoveParameterTo); + connect(m_treeWidget, &ParameterWindowTreeWidget::DragEnded, this, [this]() { Reinit(/*forceReinit*/true); }); // create and fill the vertical layout - mVerticalLayout = new QVBoxLayout(); - mVerticalLayout->setObjectName("StyledWidget"); - mVerticalLayout->setSpacing(2); - mVerticalLayout->setMargin(0); - mVerticalLayout->setAlignment(Qt::AlignTop); - mVerticalLayout->addWidget(toolBar); - mVerticalLayout->addWidget(mTreeWidget); + m_verticalLayout = new QVBoxLayout(); + m_verticalLayout->setObjectName("StyledWidget"); + m_verticalLayout->setSpacing(2); + m_verticalLayout->setMargin(0); + m_verticalLayout->setAlignment(Qt::AlignTop); + m_verticalLayout->addWidget(toolBar); + m_verticalLayout->addWidget(m_treeWidget); // set the object name setObjectName("StyledWidget"); - setLayout(mVerticalLayout); + setLayout(m_verticalLayout); // set the focus policy setFocusPolicy(Qt::ClickFocus); // Force reinitialize in case e.g. a parameter got added or removed. - connect(&mPlugin->GetAnimGraphModel(), &AnimGraphModel::ParametersChanged, [this](EMotionFX::AnimGraph* animGraph) + connect(&m_plugin->GetAnimGraphModel(), &AnimGraphModel::ParametersChanged, [this](EMotionFX::AnimGraph* animGraph) { if (animGraph == m_animGraph) { @@ -238,7 +238,7 @@ namespace EMStudio } }); - connect(&mPlugin->GetAnimGraphModel(), &AnimGraphModel::FocusChanged, this, &ParameterWindow::OnFocusChanged); + connect(&m_plugin->GetAnimGraphModel(), &AnimGraphModel::FocusChanged, this, &ParameterWindow::OnFocusChanged); // Trigger actions are processed from EMotionFX worker threads, which // are not allowed to update the UI. Use a QueuedConnection to force @@ -267,7 +267,7 @@ namespace EMStudio // get access to the game controller and check if it is valid bool isGameControllerValid = false; #if AZ_TRAIT_EMOTIONFX_HAS_GAME_CONTROLLER - GameControllerWindow* gameControllerWindow = mPlugin->GetGameControllerWindow(); + GameControllerWindow* gameControllerWindow = m_plugin->GetGameControllerWindow(); if (gameControllerWindow) { isGameControllerValid = gameControllerWindow->GetIsGameControllerValid(); @@ -318,7 +318,7 @@ namespace EMStudio bool isGameControllerValid = false; #if AZ_TRAIT_EMOTIONFX_HAS_GAME_CONTROLLER - GameControllerWindow* gameControllerWindow = mPlugin->GetGameControllerWindow(); + GameControllerWindow* gameControllerWindow = m_plugin->GetGameControllerWindow(); if (gameControllerWindow) { isGameControllerValid = gameControllerWindow->GetIsGameControllerValid(); @@ -343,9 +343,9 @@ namespace EMStudio void ParameterWindow::AddParameterToInterface(EMotionFX::AnimGraph* animGraph, const EMotionFX::Parameter* parameter, QTreeWidgetItem* parentWidgetItem) { // Only filter value parameters - if (!mFilterString.empty() + if (!m_filterString.empty() && azrtti_typeid(parameter) != azrtti_typeid() - && AzFramework::StringFunc::Find(parameter->GetName().c_str(), mFilterString.c_str()) == AZStd::string::npos) + && AzFramework::StringFunc::Find(parameter->GetName().c_str(), m_filterString.c_str()) == AZStd::string::npos) { return; } @@ -360,10 +360,10 @@ namespace EMStudio if (GetIsParameterSelected(parameter->GetName())) { widgetItem->setSelected(true); - if (mEnsureVisibility) + if (m_ensureVisibility) { - mTreeWidget->scrollToItem(widgetItem); - mEnsureVisibility = false; + m_treeWidget->scrollToItem(widgetItem); + m_ensureVisibility = false; } } @@ -405,7 +405,7 @@ namespace EMStudio AZ_Error("EMotionFX", false, "Can't get serialize context from component application."); return; } - parameterWidget.m_propertyEditor = aznew AzToolsFramework::ReflectedPropertyEditor(mTreeWidget); + parameterWidget.m_propertyEditor = aznew AzToolsFramework::ReflectedPropertyEditor(m_treeWidget); parameterWidget.m_propertyEditor->SetSizeHintOffset(QSize(0, 0)); parameterWidget.m_propertyEditor->SetAutoResizeLabels(false); parameterWidget.m_propertyEditor->SetLeafIndentation(0); @@ -419,7 +419,7 @@ namespace EMStudio parameterWidget.m_propertyEditor->ExpandAll(); parameterWidget.m_propertyEditor->InvalidateAll(); - mTreeWidget->setItemWidget(widgetItem, 2, parameterWidget.m_propertyEditor); + m_treeWidget->setItemWidget(widgetItem, 2, parameterWidget.m_propertyEditor); // create the gizmo widget in case the parameter is currently not being controlled by the gamepad QWidget* gizmoWidget = nullptr; @@ -445,8 +445,8 @@ namespace EMStudio } if (gizmoWidget) { - mTreeWidget->setItemWidget(widgetItem, 1, gizmoWidget); - mTreeWidget->setColumnWidth(1, 20); + m_treeWidget->setItemWidget(widgetItem, 1, gizmoWidget); + m_treeWidget->setColumnWidth(1, 20); } auto insertIt = m_parameterWidgets.emplace(parameter, AZStd::move(parameterWidget)); @@ -520,7 +520,7 @@ namespace EMStudio QAction* editAction = menu->addAction("Edit"); connect(editAction, &QAction::triggered, this, &ParameterWindow::OnEditButton); } - if (!mSelectedParameterNames.empty()) + if (!m_selectedParameterNames.empty()) { menu->addSeparator(); @@ -561,7 +561,7 @@ namespace EMStudio && AZStd::find(groupParametersInCurrentParameter.begin(), groupParametersInCurrentParameter.end(), groupParameter) == groupParametersInCurrentParameter.end() - && AZStd::find(mSelectedParameterNames.begin(), mSelectedParameterNames.end(), groupParameter->GetName()) == mSelectedParameterNames.end()) + && AZStd::find(m_selectedParameterNames.begin(), m_selectedParameterNames.end(), groupParameter->GetName()) == m_selectedParameterNames.end()) { QAction* groupAction = groupMenu->addAction(groupParameter->GetName().c_str()); groupAction->setCheckable(true); @@ -586,7 +586,7 @@ namespace EMStudio menu->addSeparator(); // remove action - if (!mSelectedParameterNames.empty()) + if (!m_selectedParameterNames.empty()) { QAction* removeAction = menu->addAction("Remove"); connect(removeAction, &QAction::triggered, this, &ParameterWindow::OnRemoveSelected); @@ -676,29 +676,29 @@ namespace EMStudio void ParameterWindow::Reinit(bool forceReinit) { - mLockSelection = true; + m_lockSelection = true; // Early out in case we're already showing the parameters from the focused anim graph. - if (!forceReinit && m_animGraph == mPlugin->GetAnimGraphModel().GetFocusedAnimGraph()) + if (!forceReinit && m_animGraph == m_plugin->GetAnimGraphModel().GetFocusedAnimGraph()) { UpdateAttributesForParameterWidgets(); UpdateInterface(); - mLockSelection = false; + m_lockSelection = false; return; } - m_animGraph = mPlugin->GetAnimGraphModel().GetFocusedAnimGraph(); - qobject_cast(mTreeWidget)->SetAnimGraph(m_animGraph); + m_animGraph = m_plugin->GetAnimGraphModel().GetFocusedAnimGraph(); + qobject_cast(m_treeWidget)->SetAnimGraph(m_animGraph); // First clear the parameter widgets array and then the actual tree widget. // Don't change the order here as the tree widget clear call calls an on selection changed which uses the parameter widget array. m_parameterWidgets.clear(); - mTreeWidget->clear(); + m_treeWidget->clear(); if (!m_animGraph) { UpdateInterface(); - mLockSelection = false; + m_lockSelection = false; return; } @@ -706,10 +706,10 @@ namespace EMStudio const EMotionFX::ParameterVector& childParameters = m_animGraph->GetChildParameters(); for (const EMotionFX::Parameter* parameter : childParameters) { - AddParameterToInterface(m_animGraph, parameter, mTreeWidget->invisibleRootItem()); + AddParameterToInterface(m_animGraph, parameter, m_treeWidget->invisibleRootItem()); } - mLockSelection = false; + m_lockSelection = false; UpdateAttributesForParameterWidgets(); UpdateInterface(); @@ -718,11 +718,11 @@ namespace EMStudio void ParameterWindow::SingleSelectGroupParameter(const char* groupName, bool ensureVisibility, bool updateInterface) { - mSelectedParameterNames.clear(); + m_selectedParameterNames.clear(); - mSelectedParameterNames.push_back(groupName); + m_selectedParameterNames.push_back(groupName); - mEnsureVisibility = ensureVisibility; + m_ensureVisibility = ensureVisibility; if (updateInterface) { @@ -732,10 +732,10 @@ namespace EMStudio void ParameterWindow::SelectParameters(const AZStd::vector& parameterNames, bool updateInterface) { - mTreeWidget->clearSelection(); + m_treeWidget->clearSelection(); for (const AZStd::string& parameterName : parameterNames) { - const QList foundItems = mTreeWidget->findItems(parameterName.c_str(), Qt::MatchFixedString); + const QList foundItems = m_treeWidget->findItems(parameterName.c_str(), Qt::MatchFixedString); for (QTreeWidgetItem* foundItem : foundItems) { foundItem->setSelected(true); @@ -753,7 +753,7 @@ namespace EMStudio void ParameterWindow::OnTextFilterChanged(const QString& text) { - mFilterString = text.toUtf8().data(); + m_filterString = text.toUtf8().data(); Reinit(/*forceReinit=*/true); } @@ -829,7 +829,7 @@ namespace EMStudio // disable the remove and edit buttton if we dont have any parameter selected m_editAction->setEnabled(true); - if (mSelectedParameterNames.empty()) + if (m_selectedParameterNames.empty()) { m_editAction->setEnabled(false); } @@ -838,7 +838,7 @@ namespace EMStudio bool moveUpPossible, moveDownPossible; CanMove(&moveUpPossible, &moveDownPossible); - bool isAnimGraphActive = mPlugin->IsAnimGraphActive(m_animGraph); + bool isAnimGraphActive = m_plugin->IsAnimGraphActive(m_animGraph); // Make the parameter widgets read-only in case they are either controlled by the gamepad or the anim graph is not running on an actor instance. for (const auto& iterator : m_parameterWidgets) @@ -912,7 +912,7 @@ namespace EMStudio return; } - ParameterCreateEditDialog* createEditParameterDialog = new ParameterCreateEditDialog(mPlugin, this); + ParameterCreateEditDialog* createEditParameterDialog = new ParameterCreateEditDialog(m_plugin, this); createEditParameterDialog->Init(); EMStudio::ParameterCreateEditDialog::connect(createEditParameterDialog, &QDialog::finished, [=](int resultCode) @@ -988,7 +988,7 @@ namespace EMStudio const AZStd::string oldName = parameter->GetName(); // create and init the dialog - ParameterCreateEditDialog* dialog = new ParameterCreateEditDialog(mPlugin, this, parameter); + ParameterCreateEditDialog* dialog = new ParameterCreateEditDialog(m_plugin, this, parameter); dialog->Init(); // We cannot use exec here as we need to access it from the tests EMStudio::ParameterCreateEditDialog::connect(dialog, &QDialog::finished, [=](int resultCode) @@ -1023,7 +1023,7 @@ namespace EMStudio EMotionFX::AnimGraphNode::Port newPort; if (const EMotionFX::ValueParameter* valueParameter = azrtti_cast(editedParameter.get())) { - newPort.mCompatibleTypes[0] = valueParameter->GetType(); + newPort.m_compatibleTypes[0] = valueParameter->GetType(); } // Get the list of all parameter nodes @@ -1107,13 +1107,13 @@ namespace EMStudio void ParameterWindow::UpdateSelectionArrays() { // only update the selection in case it is not locked - if (mLockSelection) + if (m_lockSelection) { return; } // clear the selection - mSelectedParameterNames.clear(); + m_selectedParameterNames.clear(); if (!m_animGraph) { @@ -1121,14 +1121,14 @@ namespace EMStudio } // make sure we only have exactly one selected item - QList selectedItems = mTreeWidget->selectedItems(); + QList selectedItems = m_treeWidget->selectedItems(); int32 numSelectedItems = selectedItems.count(); for (int32 i = 0; i < numSelectedItems; ++i) { // get the selected item QTreeWidgetItem* selectedItem = selectedItems[i]; - mSelectedParameterNames.emplace_back(selectedItem->data(0, Qt::UserRole).toString().toUtf8().data()); + m_selectedParameterNames.emplace_back(selectedItem->data(0, Qt::UserRole).toString().toUtf8().data()); } } @@ -1136,7 +1136,7 @@ namespace EMStudio // get the index of the selected parameter const EMotionFX::Parameter* ParameterWindow::GetSingleSelectedParameter() const { - if (mSelectedParameterNames.size() != 1) + if (m_selectedParameterNames.size() != 1) { return nullptr; } @@ -1147,7 +1147,7 @@ namespace EMStudio } // find and return the index of the parameter in the anim graph - return m_animGraph->FindParameterByName(mSelectedParameterNames[0]); + return m_animGraph->FindParameterByName(m_selectedParameterNames[0]); } @@ -1192,7 +1192,7 @@ namespace EMStudio AZStd::vector selectedValueParameters; // get the number of selected parameters and iterate through them - for (const AZStd::string& selectedParameter : mSelectedParameterNames) + for (const AZStd::string& selectedParameter : m_selectedParameterNames) { const EMotionFX::Parameter* parameter = m_animGraph->FindParameterByName(selectedParameter); if (!parameter) @@ -1211,7 +1211,7 @@ namespace EMStudio for (const EMotionFX::Parameter* parameter2 : parametersInGroup) { const AZStd::string& parameterName = parameter2->GetName(); - if (AZStd::find(mSelectedParameterNames.begin(), mSelectedParameterNames.end(), parameterName) == mSelectedParameterNames.end()) + if (AZStd::find(m_selectedParameterNames.begin(), m_selectedParameterNames.end(), parameterName) == m_selectedParameterNames.end()) { paramsOfSelectedGroup.push_back(parameterName); } @@ -1294,7 +1294,7 @@ namespace EMStudio int ParameterWindow::GetTopLevelItemCount() const { - return mTreeWidget->topLevelItemCount(); + return m_treeWidget->topLevelItemCount(); } // move parameter under a specific parent, at a determined index @@ -1345,7 +1345,7 @@ namespace EMStudio } // get the number of selected parameters and return directly in case there aren't any selected - const size_t numSelectedParameters = mSelectedParameterNames.size(); + const size_t numSelectedParameters = m_selectedParameterNames.size(); if (numSelectedParameters == 0) { return; @@ -1364,7 +1364,7 @@ namespace EMStudio const EMotionFX::GroupParameter* groupParameter = m_animGraph->FindGroupParameterByName(groupParameterName); AZStd::string parameterNames; - AZ::StringFunc::Join(parameterNames, begin(mSelectedParameterNames), end(mSelectedParameterNames), ";"); + AZ::StringFunc::Join(parameterNames, begin(m_selectedParameterNames), end(m_selectedParameterNames), ";"); if (groupParameter) { commandString = AZStd::string::format(R"(AnimGraphAdjustGroupParameter -animGraphID %d -name "%s" -parameterNames "%s" -action "add")", diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/ParameterWindow.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/ParameterWindow.h index 3d53469c16..66cb62f0a5 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/ParameterWindow.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/ParameterWindow.h @@ -63,18 +63,18 @@ namespace EMStudio AZStd::string GetName() const { - return mLineEdit->text().toUtf8().data(); + return m_lineEdit->text().toUtf8().data(); } private slots: void NameEditChanged(const QString& text); private: - AZStd::string mOldName; - AZStd::vector mInvalidNames; - QPushButton* mOKButton; - QPushButton* mCancelButton; - QLineEdit* mLineEdit; + AZStd::string m_oldName; + AZStd::vector m_invalidNames; + QPushButton* m_okButton; + QPushButton* m_cancelButton; + QLineEdit* m_lineEdit; }; class ParameterWindow @@ -96,7 +96,7 @@ namespace EMStudio bool GetIsParameterSelected(const AZStd::string& parameterName) { - if (AZStd::find(mSelectedParameterNames.begin(), mSelectedParameterNames.end(), parameterName) == mSelectedParameterNames.end()) + if (AZStd::find(m_selectedParameterNames.begin(), m_selectedParameterNames.end(), parameterName) == m_selectedParameterNames.end()) { return false; } @@ -192,21 +192,21 @@ namespace EMStudio // toolbar buttons QAction* m_addAction; - static int m_contextMenuWidth; + static int s_contextMenuWidth; QAction* m_editAction; - AZStd::vector mSelectedParameterNames; - bool mEnsureVisibility; - bool mLockSelection; + AZStd::vector m_selectedParameterNames; + bool m_ensureVisibility; + bool m_lockSelection; - AZStd::string mFilterString; - AnimGraphPlugin* mPlugin; - ParameterWindowTreeWidget* mTreeWidget; + AZStd::string m_filterString; + AnimGraphPlugin* m_plugin; + ParameterWindowTreeWidget* m_treeWidget; AzQtComponents::FilteredSearchWidget* m_searchWidget; - QVBoxLayout* mVerticalLayout; - QScrollArea* mScrollArea; - AZStd::string mNameString; + QVBoxLayout* m_verticalLayout; + QScrollArea* m_scrollArea; + AZStd::string m_nameString; struct ParameterWidget { AZStd::unique_ptr m_valueParameterEditor; diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/StateFilterSelectionWindow.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/StateFilterSelectionWindow.cpp index b7abf10da0..846dd45c07 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/StateFilterSelectionWindow.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/StateFilterSelectionWindow.cpp @@ -33,16 +33,16 @@ namespace EMStudio setLayout(mainLayout); mainLayout->setAlignment(Qt::AlignTop); - mTableWidget = new QTableWidget(); - mTableWidget->setAlternatingRowColors(true); - mTableWidget->setSelectionBehavior(QAbstractItemView::SelectRows); - mTableWidget->setSelectionMode(QAbstractItemView::ExtendedSelection); - mTableWidget->horizontalHeader()->setStretchLastSection(true); - mTableWidget->setCornerButtonEnabled(false); - mTableWidget->setContextMenuPolicy(Qt::DefaultContextMenu); - connect(mTableWidget, &QTableWidget::itemSelectionChanged, this, &StateFilterSelectionWindow::OnSelectionChanged); + m_tableWidget = new QTableWidget(); + m_tableWidget->setAlternatingRowColors(true); + m_tableWidget->setSelectionBehavior(QAbstractItemView::SelectRows); + m_tableWidget->setSelectionMode(QAbstractItemView::ExtendedSelection); + m_tableWidget->horizontalHeader()->setStretchLastSection(true); + m_tableWidget->setCornerButtonEnabled(false); + m_tableWidget->setContextMenuPolicy(Qt::DefaultContextMenu); + connect(m_tableWidget, &QTableWidget::itemSelectionChanged, this, &StateFilterSelectionWindow::OnSelectionChanged); - mainLayout->addWidget(mTableWidget); + mainLayout->addWidget(m_tableWidget); QHBoxLayout* buttonLayout = new QHBoxLayout(); mainLayout->addLayout(buttonLayout); @@ -69,25 +69,25 @@ namespace EMStudio void StateFilterSelectionWindow::ReInit(EMotionFX::AnimGraphStateMachine* stateMachine, const AZStd::vector& oldNodeSelection, const AZStd::vector& oldGroupSelection) { m_stateMachine = stateMachine; - mSelectedGroupNames = oldGroupSelection; + m_selectedGroupNames = oldGroupSelection; m_selectedNodeIds = oldNodeSelection; // clear the table widget - mWidgetTable.clear(); - mTableWidget->clear(); - mTableWidget->setColumnCount(2); + m_widgetTable.clear(); + m_tableWidget->clear(); + m_tableWidget->setColumnCount(2); // set header items for the table QTableWidgetItem* headerItem = new QTableWidgetItem("Name"); headerItem->setTextAlignment(Qt::AlignVCenter | Qt::AlignLeft); - mTableWidget->setHorizontalHeaderItem(0, headerItem); + m_tableWidget->setHorizontalHeaderItem(0, headerItem); headerItem = new QTableWidgetItem("Type"); headerItem->setTextAlignment(Qt::AlignVCenter | Qt::AlignLeft); - mTableWidget->setHorizontalHeaderItem(1, headerItem); + m_tableWidget->setHorizontalHeaderItem(1, headerItem); - mTableWidget->resizeColumnsToContents(); - QHeaderView* horizontalHeader = mTableWidget->horizontalHeader(); + m_tableWidget->resizeColumnsToContents(); + QHeaderView* horizontalHeader = m_tableWidget->horizontalHeader(); horizontalHeader->setStretchLastSection(true); if (!m_stateMachine) @@ -101,12 +101,12 @@ namespace EMStudio const size_t numNodeGroups = animGraph->GetNumNodeGroups(); const size_t numNodes = m_stateMachine->GetNumChildNodes(); const int numRows = aznumeric_caster(numNodeGroups + numNodes); - mTableWidget->setRowCount(numRows); + m_tableWidget->setRowCount(numRows); // Block signals for the table widget to not reach OnSelectionChanged() when adding rows as that // clears m_selectedNodeIds and thus breaks the 'is node selected' check in the following loop. { - QSignalBlocker signalBlocker(mTableWidget); + QSignalBlocker signalBlocker(m_tableWidget); // iterate the nodes and add them all uint32 currentRowIndex = 0; @@ -161,9 +161,9 @@ namespace EMStudio } // resize to contents and adjust header - QHeaderView* verticalHeader = mTableWidget->verticalHeader(); + QHeaderView* verticalHeader = m_tableWidget->verticalHeader(); verticalHeader->setVisible(false); - mTableWidget->resizeColumnsToContents(); + m_tableWidget->resizeColumnsToContents(); horizontalHeader->setStretchLastSection(true); } @@ -185,10 +185,10 @@ namespace EMStudio nameItem->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); // add the name item in the table - mTableWidget->setItem(rowIndex, 0, nameItem); + m_tableWidget->setItem(rowIndex, 0, nameItem); // add a lookup - mWidgetTable.emplace_back(WidgetLookup(nameItem, name, isGroup)); + m_widgetTable.emplace_back(WidgetLookup(nameItem, name, isGroup)); // create the type item QTableWidgetItem* typeItem = nullptr; @@ -205,10 +205,10 @@ namespace EMStudio typeItem->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); // add the type item in the table - mTableWidget->setItem(rowIndex, 1, typeItem); + m_tableWidget->setItem(rowIndex, 1, typeItem); // add a lookup - mWidgetTable.emplace_back(WidgetLookup(typeItem, name, isGroup)); + m_widgetTable.emplace_back(WidgetLookup(typeItem, name, isGroup)); // set backgroundcolor of the row if (isGroup) @@ -227,7 +227,7 @@ namespace EMStudio } // set the row height - mTableWidget->setRowHeight(rowIndex, 21); + m_tableWidget->setRowHeight(rowIndex, 21); } @@ -242,12 +242,12 @@ namespace EMStudio const EMotionFX::AnimGraph* animGraph = m_stateMachine->GetAnimGraph(); // for all table entries - const size_t numWidgets = mWidgetTable.size(); + const size_t numWidgets = m_widgetTable.size(); for (size_t i = 0; i < numWidgets; ++i) { - if (mWidgetTable[i].mIsGroup && mWidgetTable[i].mWidget == widget) + if (m_widgetTable[i].m_isGroup && m_widgetTable[i].m_widget == widget) { - return animGraph->FindNodeGroupByName(mWidgetTable[i].mName.c_str()); + return animGraph->FindNodeGroupByName(m_widgetTable[i].m_name.c_str()); } } @@ -267,12 +267,12 @@ namespace EMStudio const EMotionFX::AnimGraph* animGraph = m_stateMachine->GetAnimGraph(); // for all table entries - const size_t numWidgets = mWidgetTable.size(); + const size_t numWidgets = m_widgetTable.size(); for (size_t i = 0; i < numWidgets; ++i) { - if (mWidgetTable[i].mIsGroup == false && mWidgetTable[i].mWidget == widget) + if (m_widgetTable[i].m_isGroup == false && m_widgetTable[i].m_widget == widget) { - return animGraph->RecursiveFindNodeByName(mWidgetTable[i].mName.c_str()); + return animGraph->RecursiveFindNodeByName(m_widgetTable[i].m_name.c_str()); } } @@ -285,11 +285,11 @@ namespace EMStudio void StateFilterSelectionWindow::OnSelectionChanged() { // reset the selection arrays - mSelectedGroupNames.clear(); + m_selectedGroupNames.clear(); m_selectedNodeIds.clear(); // get the selected items and the number of them - QList selectedItems = mTableWidget->selectedItems(); + QList selectedItems = m_tableWidget->selectedItems(); const int numSelectedItems = selectedItems.count(); // iterate through the selected items @@ -311,9 +311,9 @@ namespace EMStudio if (nodeGroup) { // add the node group name in case it is not in yet - if (AZStd::find(mSelectedGroupNames.begin(), mSelectedGroupNames.end(), nodeGroup->GetName()) == mSelectedGroupNames.end()) + if (AZStd::find(m_selectedGroupNames.begin(), m_selectedGroupNames.end(), nodeGroup->GetName()) == m_selectedGroupNames.end()) { - mSelectedGroupNames.emplace_back(nodeGroup->GetName()); + m_selectedGroupNames.emplace_back(nodeGroup->GetName()); } } } diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/StateFilterSelectionWindow.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/StateFilterSelectionWindow.h index 0ebf063703..1789ff77cb 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/StateFilterSelectionWindow.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/StateFilterSelectionWindow.h @@ -38,7 +38,7 @@ namespace EMStudio void ReInit(EMotionFX::AnimGraphStateMachine* stateMachine, const AZStd::vector& oldNodeSelection, const AZStd::vector& oldGroupSelection); const AZStd::vector GetSelectedNodeIds() const { return m_selectedNodeIds; } - const AZStd::vector& GetSelectedGroupNames() const { return mSelectedGroupNames; } + const AZStd::vector& GetSelectedGroupNames() const { return m_selectedGroupNames; } protected slots: void OnSelectionChanged(); @@ -47,15 +47,15 @@ namespace EMStudio struct WidgetLookup { MCORE_MEMORYOBJECTCATEGORY(StateFilterSelectionWindow::WidgetLookup, EMFX_DEFAULT_ALIGNMENT, MEMCATEGORY_STANDARDPLUGINS_ANIMGRAPH); - QTableWidgetItem* mWidget; - AZStd::string mName; - bool mIsGroup; + QTableWidgetItem* m_widget; + AZStd::string m_name; + bool m_isGroup; WidgetLookup(QTableWidgetItem* widget, const char* name, bool isGroup) { - mWidget = widget; - mName = name; - mIsGroup = isGroup; + m_widget = widget; + m_name = name; + m_isGroup = isGroup; } }; @@ -63,10 +63,10 @@ namespace EMStudio EMotionFX::AnimGraphNode* FindNodeByWidget(QTableWidgetItem* widget) const; void AddRow(uint32 rowIndex, const char* name, bool isGroup, bool isSelected, const QColor& color = QColor(255, 255, 255)); - AZStd::vector mWidgetTable; - AZStd::vector mSelectedGroupNames; + AZStd::vector m_widgetTable; + AZStd::vector m_selectedGroupNames; AZStd::vector m_selectedNodeIds; - QTableWidget* mTableWidget; + QTableWidget* m_tableWidget; EMotionFX::AnimGraphStateMachine* m_stateMachine; }; } // namespace EMStudio diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/StateGraphNode.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/StateGraphNode.cpp index 0ce567c366..319f2c5b4f 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/StateGraphNode.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/StateGraphNode.cpp @@ -28,8 +28,8 @@ namespace EMStudio StateConnection::StateConnection(NodeGraph* parentGraph, const QModelIndex& modelIndex, GraphNode* sourceNode, GraphNode* targetNode, bool isWildcardConnection) : NodeConnection(parentGraph, modelIndex, targetNode, 0, sourceNode, 0) { - mColor = StateMachineColors::s_transitionColor; - mIsWildcardConnection = isWildcardConnection; + m_color = StateMachineColors::s_transitionColor; + m_isWildcardConnection = isWildcardConnection; } @@ -49,7 +49,7 @@ namespace EMStudio CalcStartAndEndPoints(start, end); // Adjust the start and end points in case this is a wildcard transition. - if (mIsWildcardConnection) + if (m_isWildcardConnection) { start = end - QPoint(WILDCARDTRANSITION_SIZE, WILDCARDTRANSITION_SIZE); end += QPoint(3, 3); @@ -130,7 +130,7 @@ namespace EMStudio } } - QColor color = mColor; + QColor color = m_color; if (GetIsSelected()) { @@ -140,26 +140,26 @@ namespace EMStudio { color = StateMachineColors::s_interruptionCandidateColor; } - else if (mIsSynced) + else if (m_isSynced) { color.setRgb(115, 125, 200); } // darken the color in case the transition is disabled - if (mIsDisabled) + if (m_isDisabled) { color = color.darker(165); } // lighten the color in case the transition is highlighted - if (mIsHighlighted) + if (m_isHighlighted) { color = color.lighter(150); painter.setOpacity(1.0); } // lighten the color in case the transition is connected to the currently selected node - if (mIsConnectedHighlighted) + if (m_isConnectedHighlighted) { pen->setWidth(2); color = color.lighter(150); @@ -186,12 +186,12 @@ namespace EMStudio RenderTransition(painter, *brush, *pen, start, end, color, activeColor, - isSelected, /*isDashed=*/mIsDisabled, + isSelected, /*isDashed=*/m_isDisabled, showBlendState, blendWeight, - /*highlightHead=*/mIsHeadHighlighted && mIsWildcardConnection == false, + /*highlightHead=*/m_isHeadHighlighted && m_isWildcardConnection == false, /*gradientActiveIndicator=*/!gotInterrupted); - if (mIsHeadHighlighted) + if (m_isHeadHighlighted) { brush->setColor(color); painter.setBrush(*brush); @@ -251,7 +251,7 @@ namespace EMStudio } // darken the color in case the transition is disabled - if (mIsDisabled) + if (m_isDisabled) { conditionColor = conditionColor.darker(185); } @@ -268,7 +268,7 @@ namespace EMStudio QColor actionColor = Qt::yellow; // darken the color in case the transition is disabled - if (mIsDisabled) + if (m_isDisabled) { actionColor = actionColor.darker(185); } @@ -299,7 +299,7 @@ namespace EMStudio CalcStartAndEndPoints(start, end); // check if we are dealing with a wildcard transition - if (mIsWildcardConnection) + if (m_isWildcardConnection) { start = end - QPoint(WILDCARDTRANSITION_SIZE, WILDCARDTRANSITION_SIZE); end += QPoint(3, 3); @@ -394,10 +394,10 @@ namespace EMStudio const QPoint endOffset = QPoint(transition->GetVisualEndOffsetX(), transition->GetVisualEndOffsetY()); QPoint start = startOffset; - QPoint end = mTargetNode->GetRect().topLeft() + endOffset; - if (mSourceNode) + QPoint end = m_targetNode->GetRect().topLeft() + endOffset; + if (m_sourceNode) { - start += mSourceNode->GetRect().topLeft(); + start += m_sourceNode->GetRect().topLeft(); } else { @@ -405,12 +405,12 @@ namespace EMStudio } QRect sourceRect; - if (mSourceNode) + if (m_sourceNode) { - sourceRect = mSourceNode->GetRect(); + sourceRect = m_sourceNode->GetRect(); } - QRect targetRect = mTargetNode->GetRect(); + QRect targetRect = m_targetNode->GetRect(); targetRect.adjust(-2, -2, 2, 2); // calc the real start point @@ -647,10 +647,8 @@ namespace EMStudio ResetBorderColor(); SetCreateConFromOutputOnly(true); - // mTextOptions.setAlignment( Qt::AlignCenter ); - - mInputPorts.resize(1); - mOutputPorts.resize(4); + m_inputPorts.resize(1); + m_outputPorts.resize(4); } StateGraphNode::~StateGraphNode() @@ -661,16 +659,16 @@ namespace EMStudio { AnimGraphVisualNode::Sync(); - EMotionFX::AnimGraphStateMachine* parentStateMachine = static_cast(mEMFXNode->GetParentNode()); - if (parentStateMachine->GetEntryState() == mEMFXNode) + EMotionFX::AnimGraphStateMachine* parentStateMachine = static_cast(m_emfxNode->GetParentNode()); + if (parentStateMachine->GetEntryState() == m_emfxNode) { - mParentGraph->SetEntryNode(this); + m_parentGraph->SetEntryNode(this); } } void StateGraphNode::Render(QPainter& painter, QPen* pen, bool renderShadow) { - if (!mIsVisible) + if (!m_isVisible) { return; } @@ -684,13 +682,13 @@ namespace EMStudio bool isActive = false; bool gotInterrupted = false; - if (animGraphInstance && mEMFXNode && animGraphInstance->GetAnimGraph() == mEMFXNode->GetAnimGraph()) + if (animGraphInstance && m_emfxNode && animGraphInstance->GetAnimGraph() == m_emfxNode->GetAnimGraph()) { - AZ_Assert(azrtti_typeid(mEMFXNode->GetParentNode()) == azrtti_typeid(), "Expected a valid state machine."); - const EMotionFX::AnimGraphStateMachine* stateMachine = static_cast(mEMFXNode->GetParentNode()); + AZ_Assert(azrtti_typeid(m_emfxNode->GetParentNode()) == azrtti_typeid(), "Expected a valid state machine."); + const EMotionFX::AnimGraphStateMachine* stateMachine = static_cast(m_emfxNode->GetParentNode()); const AZStd::vector& activeStates = stateMachine->GetActiveStates(animGraphInstance); - if (AZStd::find(activeStates.begin(), activeStates.end(), mEMFXNode) != activeStates.end()) + if (AZStd::find(activeStates.begin(), activeStates.end(), m_emfxNode) != activeStates.end()) { isActive = true; @@ -698,7 +696,7 @@ namespace EMStudio const EMotionFX::AnimGraphStateTransition* latestActiveTransition = stateMachine->GetLatestActiveTransition(animGraphInstance); for (const EMotionFX::AnimGraphStateTransition* activeTransition : activeTransitions) { - if (activeTransition != latestActiveTransition && activeTransition->GetTargetNode() == mEMFXNode) + if (activeTransition != latestActiveTransition && activeTransition->GetTargetNode() == m_emfxNode) { gotInterrupted = true; break; @@ -707,14 +705,14 @@ namespace EMStudio } } - mBorderColor.setRgb(0, 0, 0); + m_borderColor.setRgb(0, 0, 0); if (isActive) { - mBorderColor = StateMachineColors::s_activeColor; + m_borderColor = StateMachineColors::s_activeColor; } if (gotInterrupted) { - mBorderColor = StateMachineColors::s_interruptedColor; + m_borderColor = StateMachineColors::s_interruptedColor; } QColor borderColor; @@ -727,7 +725,7 @@ namespace EMStudio } else { - borderColor = mBorderColor; + borderColor = m_borderColor; } // background color @@ -738,16 +736,16 @@ namespace EMStudio } else { - bgColor = mBaseColor; + bgColor = m_baseColor; } // blinking red error color const bool hasError = GetHasError(); if (hasError && !isSelected) { - if (mParentGraph->GetUseAnimation()) + if (m_parentGraph->GetUseAnimation()) { - borderColor = mParentGraph->GetErrorBlinkColor(); + borderColor = m_parentGraph->GetErrorBlinkColor(); } else { @@ -761,18 +759,15 @@ namespace EMStudio QColor textColor = isSelected ? Qt::black : Qt::white; // is highlighted/hovered (on-mouse-over effect) - if (mIsHighlighted) + if (m_isHighlighted) { bgColor = bgColor.lighter(120); bgColor2 = bgColor2.lighter(120); } // draw the main rect - // check if we need to color all nodes or not - //const bool colorAllNodes = GetAlwaysColor(); - //if (mIsProcessed || colorAllNodes || mIsSelected==true) { - QLinearGradient bgGradient(0, mRect.top(), 0, mRect.bottom()); + QLinearGradient bgGradient(0, m_rect.top(), 0, m_rect.bottom()); bgGradient.setColorAt(0.0f, bgColor); bgGradient.setColorAt(1.0f, bgColor2); painter.setBrush(bgGradient); @@ -780,19 +775,19 @@ namespace EMStudio } // add 4px to have empty space for the visualize button - painter.drawRoundedRect(mRect, BORDER_RADIUS, BORDER_RADIUS); + painter.drawRoundedRect(m_rect, BORDER_RADIUS, BORDER_RADIUS); // if the scale is so small that we can still see the small things - if (mParentGraph->GetScale() > 0.3f) + if (m_parentGraph->GetScale() > 0.3f) { // draw the visualize area - if (mCanVisualize) + if (m_canVisualize) { RenderVisualizeRect(painter, bgColor, bgColor2); } // render the tracks etc - if (mEMFXNode->GetHasOutputPose() && mIsProcessed) + if (m_emfxNode->GetHasOutputPose() && m_isProcessed) { RenderTracks(painter, bgColor, bgColor2, 3); } @@ -804,14 +799,12 @@ namespace EMStudio painter.setClipping(false); // render the text overlay with the pre-baked node name and port names etc. - const float textOpacity = MCore::Clamp(mParentGraph->GetScale() * mParentGraph->GetScale() * 1.5f, 0.0f, 1.0f); + const float textOpacity = MCore::Clamp(m_parentGraph->GetScale() * m_parentGraph->GetScale() * 1.5f, 0.0f, 1.0f); painter.setOpacity(textOpacity); - painter.setFont(mHeaderFont); + painter.setFont(m_headerFont); painter.setBrush(Qt::NoBrush); painter.setPen(textColor); - //painter.drawStaticText(mRect.left(), mRect.center().y()-6, mTitleText); - painter.drawStaticText(mRect.left(), aznumeric_cast(mRect.center().y() - mTitleText.size().height() / 2), mTitleText); - // painter.drawPixmap( mRect, mTextPixmap ); + painter.drawStaticText(m_rect.left(), aznumeric_cast(m_rect.center().y() - m_titleText.size().height() / 2), m_titleText); painter.setOpacity(1.0f); RenderDebugInfo(painter); @@ -824,7 +817,7 @@ namespace EMStudio int32 StateGraphNode::CalcRequiredWidth() { - const uint32 headerWidth = mHeaderFontMetrics->horizontalAdvance(mElidedName) + 40; + const uint32 headerWidth = m_headerFontMetrics->horizontalAdvance(m_elidedName) + 40; // make sure the node is at least 100 units in width return MCore::Max(headerWidth, 100); @@ -833,7 +826,7 @@ namespace EMStudio QRect StateGraphNode::CalcInputPortRect(AZ::u16 portNr) { MCORE_UNUSED(portNr); - return mRect.adjusted(10, 10, -10, -10); + return m_rect.adjusted(10, 10, -10, -10); } QRect StateGraphNode::CalcOutputPortRect(AZ::u16 portNr) @@ -841,16 +834,16 @@ namespace EMStudio switch (portNr) { case 0: - return QRect(mRect.left(), mRect.top(), mRect.width(), 8); + return QRect(m_rect.left(), m_rect.top(), m_rect.width(), 8); break; // top case 1: - return QRect(mRect.left(), mRect.bottom() - 8, mRect.width(), 9); + return QRect(m_rect.left(), m_rect.bottom() - 8, m_rect.width(), 9); break; // bottom case 2: - return QRect(mRect.left(), mRect.top(), 8, mRect.height()); + return QRect(m_rect.left(), m_rect.top(), 8, m_rect.height()); break; // left case 3: - return QRect(mRect.right() - 8, mRect.top(), 9, mRect.height()); + return QRect(m_rect.right() - 8, m_rect.top(), 9, m_rect.height()); break; // right default: MCORE_ASSERT(false); @@ -864,7 +857,7 @@ namespace EMStudio MCORE_UNUSED(bgColor2); QColor vizBorder; - if (mVisualize) + if (m_visualize) { vizBorder = Qt::black; } @@ -873,26 +866,26 @@ namespace EMStudio vizBorder = bgColor.darker(225); } - painter.setPen(mVisualizeHighlighted ? StateMachineColors::s_selectedColor : vizBorder); + painter.setPen(m_visualizeHighlighted ? StateMachineColors::s_selectedColor : vizBorder); if (!GetIsSelected()) { - painter.setBrush(mVisualize ? mVisualizeColor : bgColor); + painter.setBrush(m_visualize ? m_visualizeColor : bgColor); } else { - painter.setBrush(mVisualize ? StateMachineColors::s_selectedColor : bgColor); + painter.setBrush(m_visualize ? StateMachineColors::s_selectedColor : bgColor); } - painter.drawRect(mVisualizeRect); + painter.drawRect(m_visualizeRect); } void StateGraphNode::UpdateTextPixmap() { - mTitleText.setTextOption(mTextOptionsCenter); - mTitleText.setTextFormat(Qt::PlainText); - mTitleText.setPerformanceHint(QStaticText::AggressiveCaching); - mTitleText.setTextWidth(mRect.width()); - mTitleText.setText(mElidedName); - mTitleText.prepare(QTransform(), mHeaderFont); + m_titleText.setTextOption(m_textOptionsCenter); + m_titleText.setTextFormat(Qt::PlainText); + m_titleText.setPerformanceHint(QStaticText::AggressiveCaching); + m_titleText.setTextWidth(m_rect.width()); + m_titleText.setText(m_elidedName); + m_titleText.prepare(QTransform(), m_headerFont); } } // namespace EMStudio diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/StateGraphNode.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/StateGraphNode.h index cee57b4a4f..6a7549e876 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/StateGraphNode.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/StateGraphNode.h @@ -58,7 +58,7 @@ namespace EMStudio EMotionFX::AnimGraphTransitionCondition* FindCondition(const QPoint& mousePos); - bool GetIsWildcardTransition() const override { return mIsWildcardConnection; } + bool GetIsWildcardTransition() const override { return m_isWildcardConnection; } static void RenderTransition(QPainter& painter, QBrush& brush, QPen& pen, QPoint start, QPoint end, @@ -70,7 +70,7 @@ namespace EMStudio private: void RenderConditionsAndActions(EMotionFX::AnimGraphInstance* animGraphInstance, QPainter* painter, QPen* pen, QBrush* brush, QPoint& start, QPoint& end); - bool mIsWildcardConnection; + bool m_isWildcardConnection; }; diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/Attachments/AttachmentNodesWindow.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/Attachments/AttachmentNodesWindow.cpp index 78eab3d362..be1feb93fc 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/Attachments/AttachmentNodesWindow.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/Attachments/AttachmentNodesWindow.cpp @@ -32,9 +32,9 @@ namespace EMStudio AttachmentNodesWindow::AttachmentNodesWindow(QWidget* parent) : QWidget(parent) { - mNodeTable = nullptr; - mSelectNodesButton = nullptr; - mNodeAction = ""; + m_nodeTable = nullptr; + m_selectNodesButton = nullptr; + m_nodeAction = ""; // init the widget Init(); @@ -51,49 +51,49 @@ namespace EMStudio void AttachmentNodesWindow::Init() { // create the node groups table - mNodeTable = new QTableWidget(0, 1, 0); + m_nodeTable = new QTableWidget(0, 1, 0); // create the table widget - mNodeTable->setMinimumHeight(125); - mNodeTable->setAlternatingRowColors(true); - mNodeTable->setCornerButtonEnabled(false); - mNodeTable->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); - mNodeTable->setContextMenuPolicy(Qt::DefaultContextMenu); + m_nodeTable->setMinimumHeight(125); + m_nodeTable->setAlternatingRowColors(true); + m_nodeTable->setCornerButtonEnabled(false); + m_nodeTable->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); + m_nodeTable->setContextMenuPolicy(Qt::DefaultContextMenu); // set the table to row selection - mNodeTable->setSelectionBehavior(QAbstractItemView::SelectRows); + m_nodeTable->setSelectionBehavior(QAbstractItemView::SelectRows); // make the table items read only - mNodeTable->setEditTriggers(QAbstractItemView::NoEditTriggers); + m_nodeTable->setEditTriggers(QAbstractItemView::NoEditTriggers); // set header items for the table QTableWidgetItem* nameHeaderItem = new QTableWidgetItem("Nodes"); nameHeaderItem->setTextAlignment(Qt::AlignVCenter | Qt::AlignLeft); - mNodeTable->setHorizontalHeaderItem(0, nameHeaderItem); + m_nodeTable->setHorizontalHeaderItem(0, nameHeaderItem); - QHeaderView* horizontalHeader = mNodeTable->horizontalHeader(); + QHeaderView* horizontalHeader = m_nodeTable->horizontalHeader(); horizontalHeader->setStretchLastSection(true); // create the node selection window - mNodeSelectionWindow = new NodeSelectionWindow(this, false); + m_nodeSelectionWindow = new NodeSelectionWindow(this, false); // create the selection buttons - mSelectNodesButton = new QToolButton(); - mAddNodesButton = new QToolButton(); - mRemoveNodesButton = new QToolButton(); + m_selectNodesButton = new QToolButton(); + m_addNodesButton = new QToolButton(); + m_removeNodesButton = new QToolButton(); - EMStudioManager::MakeTransparentButton(mSelectNodesButton, "Images/Icons/Plus.svg", "Select nodes and replace the current selection"); - EMStudioManager::MakeTransparentButton(mAddNodesButton, "Images/Icons/Plus.svg", "Select nodes and add them to the current selection"); - EMStudioManager::MakeTransparentButton(mRemoveNodesButton, "Images/Icons/Minus.svg", "Remove selected nodes from the list"); + EMStudioManager::MakeTransparentButton(m_selectNodesButton, "Images/Icons/Plus.svg", "Select nodes and replace the current selection"); + EMStudioManager::MakeTransparentButton(m_addNodesButton, "Images/Icons/Plus.svg", "Select nodes and add them to the current selection"); + EMStudioManager::MakeTransparentButton(m_removeNodesButton, "Images/Icons/Minus.svg", "Remove selected nodes from the list"); // create the buttons layout QHBoxLayout* buttonLayout = new QHBoxLayout(); buttonLayout->setSpacing(0); buttonLayout->setAlignment(Qt::AlignLeft); - buttonLayout->addWidget(mSelectNodesButton); - buttonLayout->addWidget(mAddNodesButton); - buttonLayout->addWidget(mRemoveNodesButton); + buttonLayout->addWidget(m_selectNodesButton); + buttonLayout->addWidget(m_addNodesButton); + buttonLayout->addWidget(m_removeNodesButton); // create the layouts QVBoxLayout* layout = new QVBoxLayout(); @@ -101,18 +101,18 @@ namespace EMStudio layout->setSpacing(2); layout->addLayout(buttonLayout); - layout->addWidget(mNodeTable); + layout->addWidget(m_nodeTable); // set the main layout setLayout(layout); // connect controls to the slots - connect(mSelectNodesButton, &QToolButton::clicked, this, &AttachmentNodesWindow::SelectNodesButtonPressed); - connect(mAddNodesButton, &QToolButton::clicked, this, &AttachmentNodesWindow::SelectNodesButtonPressed); - connect(mRemoveNodesButton, &QToolButton::clicked, this, &AttachmentNodesWindow::RemoveNodesButtonPressed); - connect(mNodeTable, &QTableWidget::itemSelectionChanged, this, &AttachmentNodesWindow::OnItemSelectionChanged); - connect(mNodeSelectionWindow->GetNodeHierarchyWidget(), &NodeHierarchyWidget::OnSelectionDone, this, &AttachmentNodesWindow::NodeSelectionFinished); - connect(mNodeSelectionWindow->GetNodeHierarchyWidget(), &NodeHierarchyWidget::OnDoubleClicked, this, &AttachmentNodesWindow::NodeSelectionFinished); + connect(m_selectNodesButton, &QToolButton::clicked, this, &AttachmentNodesWindow::SelectNodesButtonPressed); + connect(m_addNodesButton, &QToolButton::clicked, this, &AttachmentNodesWindow::SelectNodesButtonPressed); + connect(m_removeNodesButton, &QToolButton::clicked, this, &AttachmentNodesWindow::RemoveNodesButtonPressed); + connect(m_nodeTable, &QTableWidget::itemSelectionChanged, this, &AttachmentNodesWindow::OnItemSelectionChanged); + connect(m_nodeSelectionWindow->GetNodeHierarchyWidget(), &NodeHierarchyWidget::OnSelectionDone, this, &AttachmentNodesWindow::NodeSelectionFinished); + connect(m_nodeSelectionWindow->GetNodeHierarchyWidget(), &NodeHierarchyWidget::OnDoubleClicked, this, &AttachmentNodesWindow::NodeSelectionFinished); } @@ -120,13 +120,13 @@ namespace EMStudio void AttachmentNodesWindow::UpdateInterface() { // clear the table widget - mNodeTable->clear(); + m_nodeTable->clear(); // check if the current actor exists - if (mActor == nullptr) + if (m_actor == nullptr) { // set the column count - mNodeTable->setColumnCount(0); + m_nodeTable->setColumnCount(0); // disable the widgets SetWidgetDisabled(true); @@ -136,23 +136,23 @@ namespace EMStudio } // set the column count - mNodeTable->setColumnCount(1); + m_nodeTable->setColumnCount(1); // enable the widget SetWidgetDisabled(false); // set the remove nodes button enabled or not based on selection - mRemoveNodesButton->setEnabled((mNodeTable->rowCount() != 0) && (mNodeTable->selectedItems().size() != 0)); + m_removeNodesButton->setEnabled((m_nodeTable->rowCount() != 0) && (m_nodeTable->selectedItems().size() != 0)); // counter for attachment nodes int numAttachmentNodes = 0; // set the row count - const int numNodes = aznumeric_caster(mActor->GetNumNodes()); + const int numNodes = aznumeric_caster(m_actor->GetNumNodes()); for (int i = 0; i < numNodes; ++i) { // get the nodegroup - EMotionFX::Node* node = mActor->GetSkeleton()->GetNode(i); + EMotionFX::Node* node = m_actor->GetSkeleton()->GetNode(i); if (node->GetIsAttachmentNode()) { numAttachmentNodes++; @@ -160,19 +160,19 @@ namespace EMStudio } // set the row count - mNodeTable->setRowCount(numAttachmentNodes); + m_nodeTable->setRowCount(numAttachmentNodes); // set header items for the table - QTableWidgetItem* nameHeaderItem = new QTableWidgetItem(AZStd::string::format("Attachment Nodes (%d / %zu)", numAttachmentNodes, mActor->GetNumNodes()).c_str()); + QTableWidgetItem* nameHeaderItem = new QTableWidgetItem(AZStd::string::format("Attachment Nodes (%d / %zu)", numAttachmentNodes, m_actor->GetNumNodes()).c_str()); nameHeaderItem->setTextAlignment(Qt::AlignVCenter | Qt::AlignCenter); - mNodeTable->setHorizontalHeaderItem(0, nameHeaderItem); + m_nodeTable->setHorizontalHeaderItem(0, nameHeaderItem); // fill the table with content uint16 currentRow = 0; for (uint16 i = 0; i < numNodes; ++i) { // get the nodegroup - EMotionFX::Node* node = mActor->GetSkeleton()->GetNode(i); + EMotionFX::Node* node = m_actor->GetSkeleton()->GetNode(i); // continue if node does not exist if (node == nullptr || node->GetIsAttachmentNode() == false) @@ -182,24 +182,24 @@ namespace EMStudio // create table items QTableWidgetItem* tableItemNodeName = new QTableWidgetItem(node->GetName()); - mNodeTable->setItem(currentRow, 0, tableItemNodeName); + m_nodeTable->setItem(currentRow, 0, tableItemNodeName); // set the row height and increase row counter - mNodeTable->setRowHeight(currentRow, 21); + m_nodeTable->setRowHeight(currentRow, 21); ++currentRow; } // resize to contents and adjust header - QHeaderView* verticalHeader = mNodeTable->verticalHeader(); + QHeaderView* verticalHeader = m_nodeTable->verticalHeader(); verticalHeader->setVisible(false); - mNodeTable->resizeColumnsToContents(); - mNodeTable->horizontalHeader()->setStretchLastSection(true); + m_nodeTable->resizeColumnsToContents(); + m_nodeTable->horizontalHeader()->setStretchLastSection(true); // set table size - mNodeTable->setColumnWidth(0, 37); - mNodeTable->setColumnWidth(3, 0); - mNodeTable->setColumnHidden(3, true); - mNodeTable->sortItems(3); + m_nodeTable->setColumnWidth(0, 37); + m_nodeTable->setColumnWidth(3, 0); + m_nodeTable->setColumnHidden(3, true); + m_nodeTable->sortItems(3); // toggle enabled state of the remove button OnItemSelectionChanged(); @@ -210,7 +210,7 @@ namespace EMStudio void AttachmentNodesWindow::SetActor(EMotionFX::Actor* actor) { // set the new actor - mActor = actor; + m_actor = actor; // update the interface UpdateInterface(); @@ -221,20 +221,20 @@ namespace EMStudio void AttachmentNodesWindow::SelectNodesButtonPressed() { // check if actor is set - if (mActor == nullptr) + if (m_actor == nullptr) { return; } // set the action for the selected nodes QWidget* senderWidget = (QWidget*)sender(); - if (senderWidget == mAddNodesButton) + if (senderWidget == m_addNodesButton) { - mNodeAction = "add"; + m_nodeAction = "add"; } else { - mNodeAction = "select"; + m_nodeAction = "select"; } // get the selected actorinstance @@ -248,23 +248,23 @@ namespace EMStudio } // create selection list for the current nodes within the group - mNodeSelectionList.Clear(); - if (senderWidget == mSelectNodesButton) + m_nodeSelectionList.Clear(); + if (senderWidget == m_selectNodesButton) { - const size_t numNodes = mActor->GetNumNodes(); + const size_t numNodes = m_actor->GetNumNodes(); for (size_t i = 0; i < numNodes; ++i) { - EMotionFX::Node* node = mActor->GetSkeleton()->GetNode(i); + EMotionFX::Node* node = m_actor->GetSkeleton()->GetNode(i); if (node->GetIsAttachmentNode()) { - mNodeSelectionList.AddNode(node); + m_nodeSelectionList.AddNode(node); } } } // show the node selection window - mNodeSelectionWindow->Update(actorInstance->GetID(), &mNodeSelectionList); - mNodeSelectionWindow->show(); + m_nodeSelectionWindow->Update(actorInstance->GetID(), &m_nodeSelectionList); + m_nodeSelectionWindow->show(); } @@ -274,11 +274,11 @@ namespace EMStudio // generate node list string AZStd::string nodeList; int lowestSelectedRow = AZStd::numeric_limits::max(); - const int numTableRows = mNodeTable->rowCount(); + const int numTableRows = m_nodeTable->rowCount(); for (int i = 0; i < numTableRows; ++i) { // get the current table item - QTableWidgetItem* item = mNodeTable->item(i, 0); + QTableWidgetItem* item = m_nodeTable->item(i, 0); if (item == nullptr) { continue; @@ -304,20 +304,20 @@ namespace EMStudio // call command for adjusting disable on default flag AZStd::string outResult; AZStd::string command; - command = AZStd::string::format("AdjustActor -actorID %i -nodeAction \"remove\" -attachmentNodes \"%s\"", mActor->GetID(), nodeList.c_str()); + command = AZStd::string::format("AdjustActor -actorID %i -nodeAction \"remove\" -attachmentNodes \"%s\"", m_actor->GetID(), nodeList.c_str()); if (EMStudio::GetCommandManager()->ExecuteCommand(command.c_str(), outResult) == false) { MCore::LogError(outResult.c_str()); } // selected the next row - if (lowestSelectedRow > mNodeTable->rowCount() - 1) + if (lowestSelectedRow > m_nodeTable->rowCount() - 1) { - mNodeTable->selectRow(lowestSelectedRow - 1); + m_nodeTable->selectRow(lowestSelectedRow - 1); } else { - mNodeTable->selectRow(lowestSelectedRow); + m_nodeTable->selectRow(lowestSelectedRow); } } @@ -342,7 +342,7 @@ namespace EMStudio // call command for adjusting disable on default flag AZStd::string outResult; AZStd::string command; - command = AZStd::string::format("AdjustActor -actorID %i -nodeAction \"%s\" -attachmentNodes \"%s\"", mActor->GetID(), mNodeAction.c_str(), nodeList.c_str()); + command = AZStd::string::format("AdjustActor -actorID %i -nodeAction \"%s\" -attachmentNodes \"%s\"", m_actor->GetID(), m_nodeAction.c_str(), nodeList.c_str()); if (EMStudio::GetCommandManager()->ExecuteCommand(command.c_str(), outResult) == false) { MCore::LogError(outResult.c_str()); @@ -353,17 +353,17 @@ namespace EMStudio // enable/disable the dialog void AttachmentNodesWindow::SetWidgetDisabled(bool disabled) { - mNodeTable->setDisabled(disabled); - mSelectNodesButton->setDisabled(disabled); - mAddNodesButton->setDisabled(disabled); - mRemoveNodesButton->setDisabled(disabled); + m_nodeTable->setDisabled(disabled); + m_selectNodesButton->setDisabled(disabled); + m_addNodesButton->setDisabled(disabled); + m_removeNodesButton->setDisabled(disabled); } // handle item selection changes of the node table void AttachmentNodesWindow::OnItemSelectionChanged() { - mRemoveNodesButton->setEnabled((mNodeTable->rowCount() != 0) && (!mNodeTable->selectedItems().empty())); + m_removeNodesButton->setEnabled((m_nodeTable->rowCount() != 0) && (!m_nodeTable->selectedItems().empty())); } diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/Attachments/AttachmentNodesWindow.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/Attachments/AttachmentNodesWindow.h index 3a3c3f096e..1743db3ab9 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/Attachments/AttachmentNodesWindow.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/Attachments/AttachmentNodesWindow.h @@ -66,18 +66,18 @@ namespace EMStudio private: // the current actor - EMotionFX::Actor* mActor; + EMotionFX::Actor* m_actor; // the node selection window and node group - NodeSelectionWindow* mNodeSelectionWindow; - CommandSystem::SelectionList mNodeSelectionList; - AZStd::string mNodeAction; + NodeSelectionWindow* m_nodeSelectionWindow; + CommandSystem::SelectionList m_nodeSelectionList; + AZStd::string m_nodeAction; // widgets - QTableWidget* mNodeTable; - QToolButton* mSelectNodesButton; - QToolButton* mAddNodesButton; - QToolButton* mRemoveNodesButton; + QTableWidget* m_nodeTable; + QToolButton* m_selectNodesButton; + QToolButton* m_addNodesButton; + QToolButton* m_removeNodesButton; }; } // namespace EMStudio diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/Attachments/AttachmentsHierarchyWindow.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/Attachments/AttachmentsHierarchyWindow.cpp index 536ff16f57..5bdb61dea5 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/Attachments/AttachmentsHierarchyWindow.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/Attachments/AttachmentsHierarchyWindow.cpp @@ -24,7 +24,7 @@ namespace EMStudio AttachmentsHierarchyWindow::AttachmentsHierarchyWindow(QWidget* parent) : QWidget(parent) { - mHierarchy = nullptr; + m_hierarchy = nullptr; } @@ -40,27 +40,27 @@ namespace EMStudio verticalLayout->setMargin(0); setLayout(verticalLayout); - mHierarchy = new QTreeWidget(); - verticalLayout->addWidget(mHierarchy); - mHierarchy->setColumnCount(1); - mHierarchy->setHeaderHidden(true); + m_hierarchy = new QTreeWidget(); + verticalLayout->addWidget(m_hierarchy); + m_hierarchy->setColumnCount(1); + m_hierarchy->setHeaderHidden(true); // set optical stuff for the tree - mHierarchy->setColumnWidth(0, 200); - mHierarchy->setColumnWidth(1, 20); - mHierarchy->setColumnWidth(1, 100); - mHierarchy->setSortingEnabled(false); - mHierarchy->setSelectionMode(QAbstractItemView::NoSelection); - mHierarchy->setMinimumWidth(150); - mHierarchy->setMinimumHeight(125); - mHierarchy->setAlternatingRowColors(true); - mHierarchy->setExpandsOnDoubleClick(true); - mHierarchy->setAnimated(true); + m_hierarchy->setColumnWidth(0, 200); + m_hierarchy->setColumnWidth(1, 20); + m_hierarchy->setColumnWidth(1, 100); + m_hierarchy->setSortingEnabled(false); + m_hierarchy->setSelectionMode(QAbstractItemView::NoSelection); + m_hierarchy->setMinimumWidth(150); + m_hierarchy->setMinimumHeight(125); + m_hierarchy->setAlternatingRowColors(true); + m_hierarchy->setExpandsOnDoubleClick(true); + m_hierarchy->setAnimated(true); // disable the move of section to have column order fixed - mHierarchy->header()->setSectionsMovable(false); + m_hierarchy->header()->setSectionsMovable(false); - verticalLayout->addWidget(mHierarchy); + verticalLayout->addWidget(m_hierarchy); ReInit(); } @@ -69,7 +69,7 @@ namespace EMStudio void AttachmentsHierarchyWindow::ReInit() { // clear the tree - mHierarchy->clear(); + m_hierarchy->clear(); // get the number of actor instances and iterate through them const size_t numActorInstances = EMotionFX::GetActorManager().GetNumActorInstances(); @@ -88,12 +88,12 @@ namespace EMStudio // check if we are dealing with a root actor instance if (attachedTo == nullptr) { - QTreeWidgetItem* item = new QTreeWidgetItem(mHierarchy); + QTreeWidgetItem* item = new QTreeWidgetItem(m_hierarchy); AZStd::string actorFilename; AzFramework::StringFunc::Path::GetFileName(actor->GetFileNameString().c_str(), actorFilename); item->setText(0, QString("%1 (ID:%2)").arg(actorFilename.c_str()).arg(actorInstance->GetID())); item->setExpanded(true); - mHierarchy->addTopLevelItem(item); + m_hierarchy->addTopLevelItem(item); // get the number of attachments and iterate through them const size_t numAttachments = actorInstance->GetNumAttachments(); diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/Attachments/AttachmentsHierarchyWindow.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/Attachments/AttachmentsHierarchyWindow.h index 5621cb9bdd..92a55668e8 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/Attachments/AttachmentsHierarchyWindow.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/Attachments/AttachmentsHierarchyWindow.h @@ -39,7 +39,7 @@ namespace EMStudio private: void RecursivelyAddAttachments(QTreeWidgetItem* parent, EMotionFX::ActorInstance* actorInstance); - QTreeWidget* mHierarchy; + QTreeWidget* m_hierarchy; }; } // namespace EMStudio diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/Attachments/AttachmentsPlugin.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/Attachments/AttachmentsPlugin.cpp index 738879e96e..401945647e 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/Attachments/AttachmentsPlugin.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/Attachments/AttachmentsPlugin.cpp @@ -20,16 +20,16 @@ namespace EMStudio AttachmentsPlugin::AttachmentsPlugin() : EMStudio::DockWidgetPlugin() { - mDialogStack = nullptr; - mSelectCallback = nullptr; - mUnselectCallback = nullptr; - mClearSelectionCallback = nullptr; - mAddAttachmentCallback = nullptr; - mAddDeformableAttachmentCallback = nullptr; - mRemoveAttachmentCallback = nullptr; - mClearAttachmentsCallback = nullptr; - mAdjustActorCallback = nullptr; - mAttachmentNodesWindow = nullptr; + m_dialogStack = nullptr; + m_selectCallback = nullptr; + m_unselectCallback = nullptr; + m_clearSelectionCallback = nullptr; + m_addAttachmentCallback = nullptr; + m_addDeformableAttachmentCallback = nullptr; + m_removeAttachmentCallback = nullptr; + m_clearAttachmentsCallback = nullptr; + m_adjustActorCallback = nullptr; + m_attachmentNodesWindow = nullptr; } @@ -37,23 +37,23 @@ namespace EMStudio AttachmentsPlugin::~AttachmentsPlugin() { // unregister the command callbacks and get rid of the memory - GetCommandManager()->RemoveCommandCallback(mSelectCallback, false); - GetCommandManager()->RemoveCommandCallback(mUnselectCallback, false); - GetCommandManager()->RemoveCommandCallback(mClearSelectionCallback, false); - GetCommandManager()->RemoveCommandCallback(mAddAttachmentCallback, false); - GetCommandManager()->RemoveCommandCallback(mAddDeformableAttachmentCallback, false); - GetCommandManager()->RemoveCommandCallback(mRemoveAttachmentCallback, false); - GetCommandManager()->RemoveCommandCallback(mClearAttachmentsCallback, false); - GetCommandManager()->RemoveCommandCallback(mAdjustActorCallback, false); + GetCommandManager()->RemoveCommandCallback(m_selectCallback, false); + GetCommandManager()->RemoveCommandCallback(m_unselectCallback, false); + GetCommandManager()->RemoveCommandCallback(m_clearSelectionCallback, false); + GetCommandManager()->RemoveCommandCallback(m_addAttachmentCallback, false); + GetCommandManager()->RemoveCommandCallback(m_addDeformableAttachmentCallback, false); + GetCommandManager()->RemoveCommandCallback(m_removeAttachmentCallback, false); + GetCommandManager()->RemoveCommandCallback(m_clearAttachmentsCallback, false); + GetCommandManager()->RemoveCommandCallback(m_adjustActorCallback, false); - delete mSelectCallback; - delete mUnselectCallback; - delete mClearSelectionCallback; - delete mAddAttachmentCallback; - delete mAddDeformableAttachmentCallback; - delete mRemoveAttachmentCallback; - delete mClearAttachmentsCallback; - delete mAdjustActorCallback; + delete m_selectCallback; + delete m_unselectCallback; + delete m_clearSelectionCallback; + delete m_addAttachmentCallback; + delete m_addDeformableAttachmentCallback; + delete m_removeAttachmentCallback; + delete m_clearAttachmentsCallback; + delete m_adjustActorCallback; } @@ -70,52 +70,52 @@ namespace EMStudio //LogInfo("Initializing attachments window."); // create the dialog stack - assert(mDialogStack == nullptr); - mDialogStack = new MysticQt::DialogStack(mDock); - mDock->setWidget(mDialogStack); + assert(m_dialogStack == nullptr); + m_dialogStack = new MysticQt::DialogStack(m_dock); + m_dock->setWidget(m_dialogStack); // create the attachments window - mAttachmentsWindow = new AttachmentsWindow(mDialogStack); - mAttachmentsWindow->Init(); - mDialogStack->Add(mAttachmentsWindow, "Selected Actor Instance", false, true, true, false); + m_attachmentsWindow = new AttachmentsWindow(m_dialogStack); + m_attachmentsWindow->Init(); + m_dialogStack->Add(m_attachmentsWindow, "Selected Actor Instance", false, true, true, false); // create the attachment hierarchy window - mAttachmentsHierarchyWindow = new AttachmentsHierarchyWindow(mDialogStack); - mAttachmentsHierarchyWindow->Init(); - mDialogStack->Add(mAttachmentsHierarchyWindow, "Hierarchy", false, true, true, false); + m_attachmentsHierarchyWindow = new AttachmentsHierarchyWindow(m_dialogStack); + m_attachmentsHierarchyWindow->Init(); + m_dialogStack->Add(m_attachmentsHierarchyWindow, "Hierarchy", false, true, true, false); // create the attachment nodes window - mAttachmentNodesWindow = new AttachmentNodesWindow(mDialogStack); - mDialogStack->Add(mAttachmentNodesWindow, "Attachment Nodes", false, true); + m_attachmentNodesWindow = new AttachmentNodesWindow(m_dialogStack); + m_dialogStack->Add(m_attachmentNodesWindow, "Attachment Nodes", false, true); // create and register the command callbacks only (only execute this code once for all plugins) - mSelectCallback = new CommandSelectCallback(false); - mUnselectCallback = new CommandUnselectCallback(false); - mClearSelectionCallback = new CommandClearSelectionCallback(false); + m_selectCallback = new CommandSelectCallback(false); + m_unselectCallback = new CommandUnselectCallback(false); + m_clearSelectionCallback = new CommandClearSelectionCallback(false); - mAddAttachmentCallback = new CommandAddAttachmentCallback(false); - mAddDeformableAttachmentCallback = new CommandAddDeformableAttachmentCallback(false); - mRemoveAttachmentCallback = new CommandRemoveAttachmentCallback(false); - mClearAttachmentsCallback = new CommandClearAttachmentsCallback(false); - mAdjustActorCallback = new CommandAdjustActorCallback(false); - mRemoveActorInstanceCallback = new CommandRemoveActorInstanceCallback(false); + m_addAttachmentCallback = new CommandAddAttachmentCallback(false); + m_addDeformableAttachmentCallback = new CommandAddDeformableAttachmentCallback(false); + m_removeAttachmentCallback = new CommandRemoveAttachmentCallback(false); + m_clearAttachmentsCallback = new CommandClearAttachmentsCallback(false); + m_adjustActorCallback = new CommandAdjustActorCallback(false); + m_removeActorInstanceCallback = new CommandRemoveActorInstanceCallback(false); - GetCommandManager()->RegisterCommandCallback("Select", mSelectCallback); - GetCommandManager()->RegisterCommandCallback("Unselect", mUnselectCallback); - GetCommandManager()->RegisterCommandCallback("ClearSelection", mClearSelectionCallback); + GetCommandManager()->RegisterCommandCallback("Select", m_selectCallback); + GetCommandManager()->RegisterCommandCallback("Unselect", m_unselectCallback); + GetCommandManager()->RegisterCommandCallback("ClearSelection", m_clearSelectionCallback); - GetCommandManager()->RegisterCommandCallback("AddAttachment", mAddAttachmentCallback); - GetCommandManager()->RegisterCommandCallback("AddDeformableAttachment", mAddDeformableAttachmentCallback); - GetCommandManager()->RegisterCommandCallback("RemoveAttachment", mRemoveAttachmentCallback); - GetCommandManager()->RegisterCommandCallback("ClearAttachments", mClearAttachmentsCallback); - GetCommandManager()->RegisterCommandCallback("AdjustActor", mAdjustActorCallback); - GetCommandManager()->RegisterCommandCallback("RemoveActorInstance", mRemoveActorInstanceCallback); + GetCommandManager()->RegisterCommandCallback("AddAttachment", m_addAttachmentCallback); + GetCommandManager()->RegisterCommandCallback("AddDeformableAttachment", m_addDeformableAttachmentCallback); + GetCommandManager()->RegisterCommandCallback("RemoveAttachment", m_removeAttachmentCallback); + GetCommandManager()->RegisterCommandCallback("ClearAttachments", m_clearAttachmentsCallback); + GetCommandManager()->RegisterCommandCallback("AdjustActor", m_adjustActorCallback); + GetCommandManager()->RegisterCommandCallback("RemoveActorInstance", m_removeActorInstanceCallback); // reinit the dialog ReInit(); // connect the window activation signal to refresh if reactivated - connect(mDock, &QDockWidget::visibilityChanged, this, &AttachmentsPlugin::WindowReInit); + connect(m_dock, &QDockWidget::visibilityChanged, this, &AttachmentsPlugin::WindowReInit); return true; } @@ -124,8 +124,8 @@ namespace EMStudio // function to reinit the window void AttachmentsPlugin::ReInit() { - mAttachmentsWindow->ReInit(); - mAttachmentsHierarchyWindow->ReInit(); + m_attachmentsWindow->ReInit(); + m_attachmentsHierarchyWindow->ReInit(); // get the current actor const CommandSystem::SelectionList& selection = GetCommandManager()->GetCurrentSelection(); @@ -139,7 +139,7 @@ namespace EMStudio } // set the actor of the attachment nodes window - mAttachmentNodesWindow->SetActor(actor); + m_attachmentNodesWindow->SetActor(actor); } diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/Attachments/AttachmentsPlugin.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/Attachments/AttachmentsPlugin.h index 63ce91e187..d59d0d1b93 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/Attachments/AttachmentsPlugin.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/Attachments/AttachmentsPlugin.h @@ -58,7 +58,7 @@ namespace EMStudio bool Init() override; EMStudioPlugin* Clone() override; void ReInit(); - AttachmentsWindow* GetAttachmentsWindow() const { return mAttachmentsWindow; } + AttachmentsWindow* GetAttachmentsWindow() const { return m_attachmentsWindow; } public slots: void WindowReInit(bool visible); @@ -75,21 +75,21 @@ namespace EMStudio MCORE_DEFINECOMMANDCALLBACK(CommandAdjustActorCallback); MCORE_DEFINECOMMANDCALLBACK(CommandRemoveActorInstanceCallback); - CommandSelectCallback* mSelectCallback; - CommandUnselectCallback* mUnselectCallback; - CommandClearSelectionCallback* mClearSelectionCallback; - CommandAddAttachmentCallback* mAddAttachmentCallback; - CommandAddDeformableAttachmentCallback* mAddDeformableAttachmentCallback; - CommandRemoveAttachmentCallback* mRemoveAttachmentCallback; - CommandClearAttachmentsCallback* mClearAttachmentsCallback; - CommandAdjustActorCallback* mAdjustActorCallback; - CommandRemoveActorInstanceCallback* mRemoveActorInstanceCallback; + CommandSelectCallback* m_selectCallback; + CommandUnselectCallback* m_unselectCallback; + CommandClearSelectionCallback* m_clearSelectionCallback; + CommandAddAttachmentCallback* m_addAttachmentCallback; + CommandAddDeformableAttachmentCallback* m_addDeformableAttachmentCallback; + CommandRemoveAttachmentCallback* m_removeAttachmentCallback; + CommandClearAttachmentsCallback* m_clearAttachmentsCallback; + CommandAdjustActorCallback* m_adjustActorCallback; + CommandRemoveActorInstanceCallback* m_removeActorInstanceCallback; - QWidget* mNoSelectionWidget; - MysticQt::DialogStack* mDialogStack; - AttachmentsWindow* mAttachmentsWindow; - AttachmentsHierarchyWindow* mAttachmentsHierarchyWindow; - AttachmentNodesWindow* mAttachmentNodesWindow; + QWidget* m_noSelectionWidget; + MysticQt::DialogStack* m_dialogStack; + AttachmentsWindow* m_attachmentsWindow; + AttachmentsHierarchyWindow* m_attachmentsHierarchyWindow; + AttachmentNodesWindow* m_attachmentNodesWindow; }; } // namespace EMStudio diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/Attachments/AttachmentsWindow.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/Attachments/AttachmentsWindow.cpp index 4b971f9c32..9d25eeb41b 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/Attachments/AttachmentsWindow.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/Attachments/AttachmentsWindow.cpp @@ -40,12 +40,12 @@ namespace EMStudio AttachmentsWindow::AttachmentsWindow(QWidget* parent, bool deformable) : QWidget(parent) { - mTableWidget = nullptr; - mActorInstance = nullptr; - mNodeSelectionWindow = nullptr; - mWaitingForAttachment = false; - mIsDeformableAttachment = deformable; - mEscapeShortcut = new QShortcut(QKeySequence(Qt::Key_Escape), this); + m_tableWidget = nullptr; + m_actorInstance = nullptr; + m_nodeSelectionWindow = nullptr; + m_waitingForAttachment = false; + m_isDeformableAttachment = deformable; + m_escapeShortcut = new QShortcut(QKeySequence(Qt::Key_Escape), this); } @@ -58,54 +58,54 @@ namespace EMStudio // init the geometry lod window void AttachmentsWindow::Init() { - mTempString.reserve(16384); + m_tempString.reserve(16384); setObjectName("StackFrameOnlyBG"); setAcceptDrops(true); // create the lod information table - mTableWidget = new QTableWidget(); + m_tableWidget = new QTableWidget(); // set the alternating row colors - mTableWidget->setAlternatingRowColors(true); + m_tableWidget->setAlternatingRowColors(true); // set the table to row single selection - mTableWidget->setSelectionBehavior(QAbstractItemView::SelectRows); - mTableWidget->setSelectionMode(QAbstractItemView::ExtendedSelection); + m_tableWidget->setSelectionBehavior(QAbstractItemView::SelectRows); + m_tableWidget->setSelectionMode(QAbstractItemView::ExtendedSelection); // make the table items read only - mTableWidget->setEditTriggers(QAbstractItemView::NoEditTriggers); + m_tableWidget->setEditTriggers(QAbstractItemView::NoEditTriggers); // set the minimum size and the resizing policy - mTableWidget->setMinimumHeight(125); - mTableWidget->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); + m_tableWidget->setMinimumHeight(125); + m_tableWidget->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); // automatically adjust the size of the last entry to make it always fitting the table widget size - QHeaderView* horizontalHeader = mTableWidget->horizontalHeader(); + QHeaderView* horizontalHeader = m_tableWidget->horizontalHeader(); horizontalHeader->setStretchLastSection(true); // disable the corner button between the row and column selection thingies - mTableWidget->setCornerButtonEnabled(false); + m_tableWidget->setCornerButtonEnabled(false); // enable the custom context menu for the motion table - mTableWidget->setContextMenuPolicy(Qt::DefaultContextMenu); + m_tableWidget->setContextMenuPolicy(Qt::DefaultContextMenu); // set the column count - mTableWidget->setColumnCount(6); + m_tableWidget->setColumnCount(6); // set header items for the table - mTableWidget->setHorizontalHeaderItem(0, new QTableWidgetItem("Vis")); - mTableWidget->setHorizontalHeaderItem(1, new QTableWidgetItem("ID")); - mTableWidget->setHorizontalHeaderItem(2, new QTableWidgetItem("Name")); - mTableWidget->setHorizontalHeaderItem(3, new QTableWidgetItem("IsSkin")); - mTableWidget->setHorizontalHeaderItem(4, new QTableWidgetItem("Node")); - mTableWidget->setHorizontalHeaderItem(5, new QTableWidgetItem("Nodes")); + m_tableWidget->setHorizontalHeaderItem(0, new QTableWidgetItem("Vis")); + m_tableWidget->setHorizontalHeaderItem(1, new QTableWidgetItem("ID")); + m_tableWidget->setHorizontalHeaderItem(2, new QTableWidgetItem("Name")); + m_tableWidget->setHorizontalHeaderItem(3, new QTableWidgetItem("IsSkin")); + m_tableWidget->setHorizontalHeaderItem(4, new QTableWidgetItem("Node")); + m_tableWidget->setHorizontalHeaderItem(5, new QTableWidgetItem("Nodes")); // set the horizontal header alignement horizontalHeader->setDefaultAlignment(Qt::AlignVCenter | Qt::AlignLeft); // set the vertical header not visible - QHeaderView* verticalHeader = mTableWidget->verticalHeader(); + QHeaderView* verticalHeader = m_tableWidget->verticalHeader(); verticalHeader->setVisible(false); // set the vis fast updates and IsSkin columns fixed @@ -114,103 +114,103 @@ namespace EMStudio horizontalHeader->setSectionResizeMode(5, QHeaderView::Fixed); // set the width of the other columns - mTableWidget->setColumnWidth(0, 25); - mTableWidget->setColumnWidth(1, 25); - mTableWidget->setColumnWidth(2, 100); - mTableWidget->setColumnWidth(3, 44); - mTableWidget->setColumnWidth(4, 100); - mTableWidget->setColumnWidth(5, 32); + m_tableWidget->setColumnWidth(0, 25); + m_tableWidget->setColumnWidth(1, 25); + m_tableWidget->setColumnWidth(2, 100); + m_tableWidget->setColumnWidth(3, 44); + m_tableWidget->setColumnWidth(4, 100); + m_tableWidget->setColumnWidth(5, 32); // create buttons for the attachments dialog - mOpenAttachmentButton = new QToolButton(); - mOpenDeformableAttachmentButton = new QToolButton(); - mRemoveButton = new QToolButton(); - mClearButton = new QToolButton(); - mCancelSelectionButton = new QToolButton(); + m_openAttachmentButton = new QToolButton(); + m_openDeformableAttachmentButton = new QToolButton(); + m_removeButton = new QToolButton(); + m_clearButton = new QToolButton(); + m_cancelSelectionButton = new QToolButton(); - EMStudioManager::MakeTransparentButton(mOpenAttachmentButton, "Images/Icons/Open.svg", "Open actor from file and add it as regular attachment"); - EMStudioManager::MakeTransparentButton(mOpenDeformableAttachmentButton, "Images/Icons/Open.svg", "Open actor from file and add it as skin attachment"); - EMStudioManager::MakeTransparentButton(mRemoveButton, "Images/Icons/Minus.svg", "Remove selected attachments"); - EMStudioManager::MakeTransparentButton(mClearButton, "Images/Icons/Clear.svg", "Remove all attachments"); - EMStudioManager::MakeTransparentButton(mCancelSelectionButton, "Images/Icons/Remove.svg", "Cancel attachment selection"); + EMStudioManager::MakeTransparentButton(m_openAttachmentButton, "Images/Icons/Open.svg", "Open actor from file and add it as regular attachment"); + EMStudioManager::MakeTransparentButton(m_openDeformableAttachmentButton, "Images/Icons/Open.svg", "Open actor from file and add it as skin attachment"); + EMStudioManager::MakeTransparentButton(m_removeButton, "Images/Icons/Minus.svg", "Remove selected attachments"); + EMStudioManager::MakeTransparentButton(m_clearButton, "Images/Icons/Clear.svg", "Remove all attachments"); + EMStudioManager::MakeTransparentButton(m_cancelSelectionButton, "Images/Icons/Remove.svg", "Cancel attachment selection"); // create the buttons layout QHBoxLayout* buttonLayout = new QHBoxLayout(); buttonLayout->setSpacing(0); buttonLayout->setAlignment(Qt::AlignLeft); - buttonLayout->addWidget(mOpenAttachmentButton); - buttonLayout->addWidget(mOpenDeformableAttachmentButton); - buttonLayout->addWidget(mRemoveButton); - buttonLayout->addWidget(mClearButton); + buttonLayout->addWidget(m_openAttachmentButton); + buttonLayout->addWidget(m_openDeformableAttachmentButton); + buttonLayout->addWidget(m_removeButton); + buttonLayout->addWidget(m_clearButton); // create the buttons layout for selection mode QHBoxLayout* buttonLayoutSelectionMode = new QHBoxLayout(); buttonLayoutSelectionMode->setSpacing(0); buttonLayoutSelectionMode->setAlignment(Qt::AlignLeft); - buttonLayoutSelectionMode->addWidget(mCancelSelectionButton); + buttonLayoutSelectionMode->addWidget(m_cancelSelectionButton); // create info widgets - mWaitingForAttachmentWidget = new QWidget(); - mNoSelectionWidget = new QWidget(); - mWaitingForAttachmentLayout = new QVBoxLayout(); - mNoSelectionLayout = new QVBoxLayout(); + m_waitingForAttachmentWidget = new QWidget(); + m_noSelectionWidget = new QWidget(); + m_waitingForAttachmentLayout = new QVBoxLayout(); + m_noSelectionLayout = new QVBoxLayout(); QLabel* waitingForAttachmentLabel = new QLabel("Please select an actor instance."); QLabel* noSelectionLabel = new QLabel("No attachments to show."); - mWaitingForAttachmentLayout->addLayout(buttonLayoutSelectionMode); - mWaitingForAttachmentLayout->addWidget(waitingForAttachmentLabel); - mWaitingForAttachmentLayout->setAlignment(waitingForAttachmentLabel, Qt::AlignCenter); - mWaitingForAttachmentWidget->setLayout(mWaitingForAttachmentLayout); - mWaitingForAttachmentWidget->setHidden(true); + m_waitingForAttachmentLayout->addLayout(buttonLayoutSelectionMode); + m_waitingForAttachmentLayout->addWidget(waitingForAttachmentLabel); + m_waitingForAttachmentLayout->setAlignment(waitingForAttachmentLabel, Qt::AlignCenter); + m_waitingForAttachmentWidget->setLayout(m_waitingForAttachmentLayout); + m_waitingForAttachmentWidget->setHidden(true); - mNoSelectionLayout->addWidget(noSelectionLabel); - mNoSelectionLayout->setAlignment(noSelectionLabel, Qt::AlignCenter); - mNoSelectionWidget->setLayout(mNoSelectionLayout); - mNoSelectionWidget->setHidden(true); + m_noSelectionLayout->addWidget(noSelectionLabel); + m_noSelectionLayout->setAlignment(noSelectionLabel, Qt::AlignCenter); + m_noSelectionWidget->setLayout(m_noSelectionLayout); + m_noSelectionWidget->setHidden(true); // create the layouts - mAttachmentsWidget = new QWidget(); - mAttachmentsLayout = new QVBoxLayout(); - mMainLayout = new QVBoxLayout(); - mMainLayout->setMargin(0); - mMainLayout->setSpacing(2); - mAttachmentsLayout->setMargin(0); - mAttachmentsLayout->setSpacing(2); + m_attachmentsWidget = new QWidget(); + m_attachmentsLayout = new QVBoxLayout(); + m_mainLayout = new QVBoxLayout(); + m_mainLayout->setMargin(0); + m_mainLayout->setSpacing(2); + m_attachmentsLayout->setMargin(0); + m_attachmentsLayout->setSpacing(2); // fill the attachments layout - mAttachmentsLayout->addLayout(buttonLayout); - mAttachmentsLayout->addWidget(mTableWidget); - mAttachmentsWidget->setLayout(mAttachmentsLayout); - mAttachmentsWidget->setObjectName("StackFrameOnlyBG"); + m_attachmentsLayout->addLayout(buttonLayout); + m_attachmentsLayout->addWidget(m_tableWidget); + m_attachmentsWidget->setLayout(m_attachmentsLayout); + m_attachmentsWidget->setObjectName("StackFrameOnlyBG"); // settings for the selection mode widgets - mWaitingForAttachmentWidget->setObjectName("StackFrameOnlyBG"); - mWaitingForAttachmentWidget->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); - mWaitingForAttachmentLayout->setSpacing(0); - mWaitingForAttachmentLayout->setMargin(0); - mNoSelectionWidget->setObjectName("StackFrameOnlyBG"); - mNoSelectionWidget->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); + m_waitingForAttachmentWidget->setObjectName("StackFrameOnlyBG"); + m_waitingForAttachmentWidget->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); + m_waitingForAttachmentLayout->setSpacing(0); + m_waitingForAttachmentLayout->setMargin(0); + m_noSelectionWidget->setObjectName("StackFrameOnlyBG"); + m_noSelectionWidget->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); // fill the main layout - mMainLayout->addWidget(mAttachmentsWidget); - mMainLayout->addWidget(mWaitingForAttachmentWidget); - mMainLayout->addWidget(mNoSelectionWidget); - setLayout(mMainLayout); + m_mainLayout->addWidget(m_attachmentsWidget); + m_mainLayout->addWidget(m_waitingForAttachmentWidget); + m_mainLayout->addWidget(m_noSelectionWidget); + setLayout(m_mainLayout); // create the node selection window - mNodeSelectionWindow = new NodeSelectionWindow(this, true); + m_nodeSelectionWindow = new NodeSelectionWindow(this, true); // connect the controls to the slots - connect(mTableWidget, &QTableWidget::itemSelectionChanged, this, &AttachmentsWindow::OnSelectionChanged); - connect(mOpenAttachmentButton, &QToolButton::clicked, this, &AttachmentsWindow::OnOpenAttachmentButtonClicked); - connect(mOpenDeformableAttachmentButton, &QToolButton::clicked, this, &AttachmentsWindow::OnOpenDeformableAttachmentButtonClicked); - connect(mRemoveButton, &QToolButton::clicked, this, &AttachmentsWindow::OnRemoveButtonClicked); - connect(mClearButton, &QToolButton::clicked, this, &AttachmentsWindow::OnClearButtonClicked); - connect(mNodeSelectionWindow->GetNodeHierarchyWidget(), &NodeHierarchyWidget::OnSelectionDone, this, &AttachmentsWindow::OnAttachmentNodesSelected); - connect(mNodeSelectionWindow, &NodeSelectionWindow::rejected, this, &AttachmentsWindow::OnCancelAttachmentNodeSelection); - connect(mNodeSelectionWindow->GetNodeHierarchyWidget()->GetTreeWidget(), &QTreeWidget::itemSelectionChanged, this, &AttachmentsWindow::OnNodeChanged); - connect(mEscapeShortcut, &QShortcut::activated, this, &AttachmentsWindow::OnEscapeButtonPressed); - connect(mCancelSelectionButton, &QToolButton::clicked, this, &AttachmentsWindow::OnEscapeButtonPressed); + connect(m_tableWidget, &QTableWidget::itemSelectionChanged, this, &AttachmentsWindow::OnSelectionChanged); + connect(m_openAttachmentButton, &QToolButton::clicked, this, &AttachmentsWindow::OnOpenAttachmentButtonClicked); + connect(m_openDeformableAttachmentButton, &QToolButton::clicked, this, &AttachmentsWindow::OnOpenDeformableAttachmentButtonClicked); + connect(m_removeButton, &QToolButton::clicked, this, &AttachmentsWindow::OnRemoveButtonClicked); + connect(m_clearButton, &QToolButton::clicked, this, &AttachmentsWindow::OnClearButtonClicked); + connect(m_nodeSelectionWindow->GetNodeHierarchyWidget(), &NodeHierarchyWidget::OnSelectionDone, this, &AttachmentsWindow::OnAttachmentNodesSelected); + connect(m_nodeSelectionWindow, &NodeSelectionWindow::rejected, this, &AttachmentsWindow::OnCancelAttachmentNodeSelection); + connect(m_nodeSelectionWindow->GetNodeHierarchyWidget()->GetTreeWidget(), &QTreeWidget::itemSelectionChanged, this, &AttachmentsWindow::OnNodeChanged); + connect(m_escapeShortcut, &QShortcut::activated, this, &AttachmentsWindow::OnEscapeButtonPressed); + connect(m_cancelSelectionButton, &QToolButton::clicked, this, &AttachmentsWindow::OnEscapeButtonPressed); // reinit the window ReInit(); @@ -222,13 +222,13 @@ namespace EMStudio { // get the selected actor instance const CommandSystem::SelectionList& selection = GetCommandManager()->GetCurrentSelection(); - mActorInstance = selection.GetSingleActorInstance(); + m_actorInstance = selection.GetSingleActorInstance(); // disable controls if no actor instance is selected - if (mActorInstance == nullptr) + if (m_actorInstance == nullptr) { // set the row count - mTableWidget->setRowCount(0); + m_tableWidget->setRowCount(0); // update the interface UpdateInterface(); @@ -238,15 +238,15 @@ namespace EMStudio } // the number of existing attachments - const int numAttachments = aznumeric_caster(mActorInstance->GetNumAttachments()); + const int numAttachments = aznumeric_caster(m_actorInstance->GetNumAttachments()); // set table size and add header items - mTableWidget->setRowCount(numAttachments); + m_tableWidget->setRowCount(numAttachments); // loop trough all attachments and add them to the table for (int i = 0; i < numAttachments; ++i) { - EMotionFX::Attachment* attachment = mActorInstance->GetAttachment(i); + EMotionFX::Attachment* attachment = m_actorInstance->GetAttachment(i); if (attachment == nullptr) { continue; @@ -254,7 +254,7 @@ namespace EMStudio EMotionFX::ActorInstance* attachmentInstance = attachment->GetAttachmentActorInstance(); EMotionFX::Actor* attachmentActor = attachmentInstance->GetActor(); - EMotionFX::Actor* attachedToActor = mActorInstance->GetActor(); + EMotionFX::Actor* attachedToActor = m_actorInstance->GetActor(); EMotionFX::Node* attachedToNode = !attachment->GetIsInfluencedByMultipleJoints() ? attachedToNode = attachedToActor->GetSkeleton()->GetNode( @@ -262,14 +262,14 @@ namespace EMStudio : nullptr; // create table items - mTempString = AZStd::string::format("%i", attachmentInstance->GetID()); - QTableWidgetItem* tableItemID = new QTableWidgetItem(mTempString.c_str()); - AzFramework::StringFunc::Path::GetFileName(attachmentActor->GetFileNameString().c_str(), mTempString); - QTableWidgetItem* tableItemName = new QTableWidgetItem(mTempString.c_str()); - mTempString = attachment->GetIsInfluencedByMultipleJoints() ? "Yes" : "No"; - QTableWidgetItem* tableItemDeformable = new QTableWidgetItem(mTempString.c_str()); - mTempString = AZStd::string::format("%zu", attachmentInstance->GetNumNodes()); - QTableWidgetItem* tableItemNumNodes = new QTableWidgetItem(mTempString.c_str()); + m_tempString = AZStd::string::format("%i", attachmentInstance->GetID()); + QTableWidgetItem* tableItemID = new QTableWidgetItem(m_tempString.c_str()); + AzFramework::StringFunc::Path::GetFileName(attachmentActor->GetFileNameString().c_str(), m_tempString); + QTableWidgetItem* tableItemName = new QTableWidgetItem(m_tempString.c_str()); + m_tempString = attachment->GetIsInfluencedByMultipleJoints() ? "Yes" : "No"; + QTableWidgetItem* tableItemDeformable = new QTableWidgetItem(m_tempString.c_str()); + m_tempString = AZStd::string::format("%zu", attachmentInstance->GetNumNodes()); + QTableWidgetItem* tableItemNumNodes = new QTableWidgetItem(m_tempString.c_str()); QTableWidgetItem* tableItemNodeName = new QTableWidgetItem(""); // set node name if exists if (attachedToNode) @@ -279,7 +279,7 @@ namespace EMStudio auto nodeSelectionButton = new AzQtComponents::BrowseEdit(); nodeSelectionButton->setPlaceholderText(attachedToNode->GetName()); nodeSelectionButton->setStyleSheet("text-align: left;"); - mTableWidget->setCellWidget(i, 4, nodeSelectionButton); + m_tableWidget->setCellWidget(i, 4, nodeSelectionButton); connect(nodeSelectionButton, &AzQtComponents::BrowseEdit::attachedButtonTriggered, this, &AttachmentsWindow::OnSelectNodeButtonClicked); } @@ -290,18 +290,18 @@ namespace EMStudio isVisibleCheckBox->setChecked(true); // add table items to the current row - mTableWidget->setCellWidget(i, 0, isVisibleCheckBox); - mTableWidget->setItem(i, 1, tableItemID); - mTableWidget->setItem(i, 2, tableItemName); - mTableWidget->setItem(i, 3, tableItemDeformable); - mTableWidget->setItem(i, 4, tableItemNodeName); - mTableWidget->setItem(i, 5, tableItemNumNodes); + m_tableWidget->setCellWidget(i, 0, isVisibleCheckBox); + m_tableWidget->setItem(i, 1, tableItemID); + m_tableWidget->setItem(i, 2, tableItemName); + m_tableWidget->setItem(i, 3, tableItemDeformable); + m_tableWidget->setItem(i, 4, tableItemNodeName); + m_tableWidget->setItem(i, 5, tableItemNumNodes); // connect the controls to the functions connect(isVisibleCheckBox, &QCheckBox::stateChanged, this, &AttachmentsWindow::OnVisibilityChanged); // set the row height - mTableWidget->setRowHeight(i, 21); + m_tableWidget->setRowHeight(i, 21); } // update the interface @@ -312,8 +312,8 @@ namespace EMStudio // update the enabled state of the remove/clear button depending on the table entries void AttachmentsWindow::OnUpdateButtonsEnabled() { - mRemoveButton->setEnabled(mTableWidget->selectedItems().size() != 0); - mClearButton->setEnabled(mTableWidget->rowCount() != 0); + m_removeButton->setEnabled(m_tableWidget->selectedItems().size() != 0); + m_clearButton->setEnabled(m_tableWidget->rowCount() != 0); } @@ -321,8 +321,8 @@ namespace EMStudio void AttachmentsWindow::UpdateInterface() { // enable/disable widgets, based on the selection state - mAttachmentsWidget->setHidden(mWaitingForAttachment); - mWaitingForAttachmentWidget->setHidden((mWaitingForAttachment == false)); + m_attachmentsWidget->setHidden(m_waitingForAttachment); + m_waitingForAttachmentWidget->setHidden((m_waitingForAttachment == false)); // update remove/clear buttons OnUpdateButtonsEnabled(); @@ -340,8 +340,8 @@ namespace EMStudio const QList urls = mimeData->urls(); // clear the drop filenames - mDropFileNames.clear(); - mDropFileNames.reserve(urls.count()); + m_dropFileNames.clear(); + m_dropFileNames.reserve(urls.count()); // get the number of urls and iterate over them AZStd::string filename; @@ -355,12 +355,12 @@ namespace EMStudio if (extension == "actor") { - mDropFileNames.push_back(filename); + m_dropFileNames.push_back(filename); } } // get the number of dropped sound files - if (mDropFileNames.empty()) + if (m_dropFileNames.empty()) { MCore::LogWarning("Drag and drop failed. No valid actor file dropped."); } @@ -411,13 +411,13 @@ namespace EMStudio MCore::CommandGroup commandGroup("Add attachments"); // skip adding if no actor instance is selected - if (mActorInstance == nullptr) + if (m_actorInstance == nullptr) { return; } // get name of the first node - EMotionFX::Actor* actor = mActorInstance->GetActor(); + EMotionFX::Actor* actor = m_actorInstance->GetActor(); if (actor == nullptr) { return; @@ -447,19 +447,19 @@ namespace EMStudio } // add the attachment - if (mIsDeformableAttachment == false) + if (m_isDeformableAttachment == false) { - commandGroup.AddCommandString(AZStd::string::format("AddAttachment -attachmentID %%LASTRESULT%% -attachToID %i -attachToNode \"%s\"", mActorInstance->GetID(), nodeName).c_str()); + commandGroup.AddCommandString(AZStd::string::format("AddAttachment -attachmentID %%LASTRESULT%% -attachToID %i -attachToNode \"%s\"", m_actorInstance->GetID(), nodeName).c_str()); } else { - commandGroup.AddCommandString(AZStd::string::format("AddDeformableAttachment -attachmentID %%LASTRESULT%% -attachToID %i", mActorInstance->GetID()).c_str()); + commandGroup.AddCommandString(AZStd::string::format("AddDeformableAttachment -attachmentID %%LASTRESULT%% -attachToID %i", m_actorInstance->GetID()).c_str()); } } // select the old actorinstance commandGroup.AddCommandString("Unselect -actorInstanceID SELECT_ALL -actorID SELECT_ALL"); - commandGroup.AddCommandString(AZStd::string::format("Select -actorinstanceID %i", mActorInstance->GetID()).c_str()); + commandGroup.AddCommandString(AZStd::string::format("Select -actorinstanceID %i", m_actorInstance->GetID()).c_str()); // execute the command group GetCommandManager()->ExecuteCommandGroup(commandGroup, outString); @@ -485,7 +485,7 @@ namespace EMStudio const int id = GetIDFromTableRow(item->row()); const AZStd::string nodeName = GetNodeNameFromTableRow(item->row()); - group.AddCommandString(AZStd::string::format("RemoveAttachment -attachmentID %d -attachToID %i -attachToNode \"%s\"", id, mActorInstance->GetID(), nodeName.c_str()).c_str()); + group.AddCommandString(AZStd::string::format("RemoveAttachment -attachmentID %d -attachToID %i -attachToNode \"%s\"", id, m_actorInstance->GetID(), nodeName.c_str()).c_str()); } // execute the group command @@ -499,33 +499,33 @@ namespace EMStudio // called if an actor has been dropped for normal attachments void AttachmentsWindow::OnDroppedAttachmentsActors() { - mIsDeformableAttachment = false; + m_isDeformableAttachment = false; // add attachments to the selected actorinstance - AddAttachments(mDropFileNames); + AddAttachments(m_dropFileNames); // clear the attachments array - mDropFileNames.clear(); + m_dropFileNames.clear(); } // called if an actor has been dropped for deformable attachments void AttachmentsWindow::OnDroppedDeformableActors() { - mIsDeformableAttachment = true; + m_isDeformableAttachment = true; // add attachments to the selected actorinstance - AddAttachments(mDropFileNames); + AddAttachments(m_dropFileNames); // clear the attachments array - mDropFileNames.clear(); + m_dropFileNames.clear(); } // connects two selected actor instances void AttachmentsWindow::OnAttachmentSelected() { - if (mWaitingForAttachment == false) + if (m_waitingForAttachment == false) { return; } @@ -534,13 +534,13 @@ namespace EMStudio const CommandSystem::SelectionList& selection = GetCommandManager()->GetCurrentSelection(); EMotionFX::ActorInstance* attachmentInstance = selection.GetSingleActorInstance(); - if (mActorInstance == nullptr || attachmentInstance == nullptr) + if (m_actorInstance == nullptr || attachmentInstance == nullptr) { return; } // get name of the first node - EMotionFX::Actor* actor = mActorInstance->GetActor(); + EMotionFX::Actor* actor = m_actorInstance->GetActor(); if (actor == nullptr) { return; @@ -550,28 +550,28 @@ namespace EMStudio const char* nodeName = actor->GetSkeleton()->GetNode(0)->GetName(); // remove the attachment in case it is already attached - mActorInstance->RemoveAttachment(attachmentInstance); + m_actorInstance->RemoveAttachment(attachmentInstance); // execute command for the attachment AZStd::string outResult; MCore::CommandGroup commandGroup("Add Attachment"); // add the attachment - if (mIsDeformableAttachment == false) + if (m_isDeformableAttachment == false) { - commandGroup.AddCommandString(AZStd::string::format("AddAttachment -attachToID %i -attachmentID %i -attachToNode \"%s\"", mActorInstance->GetID(), attachmentInstance->GetID(), nodeName).c_str()); + commandGroup.AddCommandString(AZStd::string::format("AddAttachment -attachToID %i -attachmentID %i -attachToNode \"%s\"", m_actorInstance->GetID(), attachmentInstance->GetID(), nodeName).c_str()); } else { - commandGroup.AddCommandString(AZStd::string::format("AddDeformableAttachment -attachToID %i -attachmentID %i", mActorInstance->GetID(), attachmentInstance->GetID()).c_str()); + commandGroup.AddCommandString(AZStd::string::format("AddDeformableAttachment -attachToID %i -attachmentID %i", m_actorInstance->GetID(), attachmentInstance->GetID()).c_str()); } // clear selection and select the actor instance the attachment is attached to commandGroup.AddCommandString(AZStd::string::format("ClearSelection")); - commandGroup.AddCommandString(AZStd::string::format("Select -actorInstanceID %i", mActorInstance->GetID())); + commandGroup.AddCommandString(AZStd::string::format("Select -actorInstanceID %i", m_actorInstance->GetID())); // reset the state for selection - mWaitingForAttachment = false; + m_waitingForAttachment = false; // execute the command group EMStudio::GetCommandManager()->ExecuteCommandGroup(commandGroup, outResult); @@ -583,14 +583,14 @@ namespace EMStudio void AttachmentsWindow::OnNodeChanged() { - NodeHierarchyWidget* hierarchyWidget = mNodeSelectionWindow->GetNodeHierarchyWidget(); + NodeHierarchyWidget* hierarchyWidget = m_nodeSelectionWindow->GetNodeHierarchyWidget(); AZStd::vector& selectedItems = hierarchyWidget->GetSelectedItems(); if (selectedItems.size() != 1) { return; } - const uint32 actorInstanceID = selectedItems[0].mActorInstanceID; + const uint32 actorInstanceID = selectedItems[0].m_actorInstanceId; const char* nodeName = selectedItems[0].GetNodeName(); EMotionFX::ActorInstance* actorInstance = EMotionFX::GetActorManager().FindActorInstanceByID(actorInstanceID); if (actorInstance == nullptr) @@ -598,7 +598,7 @@ namespace EMStudio return; } - assert(actorInstance == mActorInstance); + assert(actorInstance == m_actorInstance); EMotionFX::Actor* actor = actorInstance->GetActor(); EMotionFX::Node* node = actor->GetSkeleton()->FindNodeByName(nodeName); @@ -615,18 +615,18 @@ namespace EMStudio } // reapply the attachment - mActorInstance->RemoveAttachment(attachment); + m_actorInstance->RemoveAttachment(attachment); // create and add the new attachment - EMotionFX::AttachmentNode* newAttachment = EMotionFX::AttachmentNode::Create(mActorInstance, node->GetNodeIndex(), attachment); - mActorInstance->AddAttachment(newAttachment); + EMotionFX::AttachmentNode* newAttachment = EMotionFX::AttachmentNode::Create(m_actorInstance, node->GetNodeIndex(), attachment); + m_actorInstance->AddAttachment(newAttachment); } EMotionFX::ActorInstance* AttachmentsWindow::GetSelectedAttachment() { // get the attachment id - const QList selectedTableItems = mTableWidget->selectedItems(); + const QList selectedTableItems = m_tableWidget->selectedItems(); if (selectedTableItems.length() < 1) { return nullptr; @@ -653,16 +653,15 @@ namespace EMStudio return; } - mActorInstance->RemoveAttachment(attachment); + m_actorInstance->RemoveAttachment(attachment); - EMotionFX::Actor* actor = mActorInstance->GetActor(); - EMotionFX::Node* node = actor->GetSkeleton()->FindNodeByName(mNodeBeforeSelectionWindow.c_str()); + EMotionFX::Actor* actor = m_actorInstance->GetActor(); + EMotionFX::Node* node = actor->GetSkeleton()->FindNodeByName(m_nodeBeforeSelectionWindow.c_str()); if (node) { - EMotionFX::AttachmentNode* newAttachment = EMotionFX::AttachmentNode::Create(mActorInstance, node->GetNodeIndex(), attachment); - mActorInstance->AddAttachment(newAttachment); - //mActorInstance->AddAttachment(node->GetNodeIndex(), attachment); + EMotionFX::AttachmentNode* newAttachment = EMotionFX::AttachmentNode::Create(m_actorInstance, node->GetNodeIndex(), attachment); + m_actorInstance->AddAttachment(newAttachment); } } @@ -670,7 +669,7 @@ namespace EMStudio void AttachmentsWindow::OnOpenAttachmentButtonClicked() { // set to normal attachment - mIsDeformableAttachment = false; + m_isDeformableAttachment = false; AZStd::vector filenames = GetMainWindow()->GetFileManager()->LoadActorsFileDialog(this); if (filenames.empty()) @@ -686,7 +685,7 @@ namespace EMStudio void AttachmentsWindow::OnOpenDeformableAttachmentButtonClicked() { // set to skin attachment - mIsDeformableAttachment = true; + m_isDeformableAttachment = true; AZStd::vector filenames = GetMainWindow()->GetFileManager()->LoadActorsFileDialog(this); if (filenames.empty()) @@ -702,7 +701,7 @@ namespace EMStudio void AttachmentsWindow::OnRemoveButtonClicked() { int lowestSelectedRow = AZStd::numeric_limits::max(); - const QList selectedItems = mTableWidget->selectedItems(); + const QList selectedItems = m_tableWidget->selectedItems(); for (const QTableWidgetItem* selectedItem : selectedItems) { if (selectedItem->row() < lowestSelectedRow) @@ -713,13 +712,13 @@ namespace EMStudio RemoveTableItems(selectedItems); - if (lowestSelectedRow > (mTableWidget->rowCount() - 1)) + if (lowestSelectedRow > (m_tableWidget->rowCount() - 1)) { - mTableWidget->selectRow(lowestSelectedRow - 1); + m_tableWidget->selectRow(lowestSelectedRow - 1); } else { - mTableWidget->selectRow(lowestSelectedRow); + m_tableWidget->selectRow(lowestSelectedRow); } } @@ -727,8 +726,8 @@ namespace EMStudio // remove all attachments void AttachmentsWindow::OnClearButtonClicked() { - mTableWidget->selectAll(); - RemoveTableItems(mTableWidget->selectedItems()); + m_tableWidget->selectAll(); + RemoveTableItems(m_tableWidget->selectedItems()); } @@ -746,14 +745,14 @@ namespace EMStudio const int row = GetRowContainingWidget(widget); if (row != -1) { - mTableWidget->selectRow(row); + m_tableWidget->selectRow(row); } - mNodeBeforeSelectionWindow = GetSelectedNodeName(); + m_nodeBeforeSelectionWindow = GetSelectedNodeName(); // show the node selection window - mNodeSelectionWindow->Update(mActorInstance->GetID()); - mNodeSelectionWindow->show(); + m_nodeSelectionWindow->Update(m_actorInstance->GetID()); + m_nodeSelectionWindow->show(); } @@ -767,7 +766,7 @@ namespace EMStudio return; } - const uint32 actorInstanceID = selection[0].mActorInstanceID; + const uint32 actorInstanceID = selection[0].m_actorInstanceId; const char* nodeName = selection[0].GetNodeName(); if (EMotionFX::GetActorManager().FindActorInstanceByID(actorInstanceID) == nullptr) { @@ -788,8 +787,8 @@ namespace EMStudio AZStd::string oldNodeName = GetSelectedNodeName(); // remove and readd the attachment - commandGroup.AddCommandString(AZStd::string::format("RemoveAttachment -attachmentID %i -attachToID %i -attachToNode \"%s\"", attachment->GetID(), mActorInstance->GetID(), oldNodeName.c_str()).c_str()); - commandGroup.AddCommandString(AZStd::string::format("AddAttachment -attachToID %i -attachmentID %i -attachToNode \"%s\"", mActorInstance->GetID(), attachment->GetID(), nodeName).c_str()); + commandGroup.AddCommandString(AZStd::string::format("RemoveAttachment -attachmentID %i -attachToID %i -attachToNode \"%s\"", attachment->GetID(), m_actorInstance->GetID(), oldNodeName.c_str()).c_str()); + commandGroup.AddCommandString(AZStd::string::format("AddAttachment -attachToID %i -attachmentID %i -attachToNode \"%s\"", m_actorInstance->GetID(), attachment->GetID(), nodeName).c_str()); // execute the command group GetCommandManager()->ExecuteCommandGroup(commandGroup, outResult); @@ -799,7 +798,7 @@ namespace EMStudio // get the selected node name AZStd::string AttachmentsWindow::GetSelectedNodeName() { - const QList items = mTableWidget->selectedItems(); + const QList items = m_tableWidget->selectedItems(); const size_t numItems = items.length(); if (numItems < 1) { @@ -834,7 +833,7 @@ namespace EMStudio // extracts the actor instance id from a given row int AttachmentsWindow::GetIDFromTableRow(int row) { - QTableWidgetItem* item = mTableWidget->item(row, 1); + QTableWidgetItem* item = m_tableWidget->item(row, 1); if (item == nullptr) { return MCore::InvalidIndexT; @@ -850,7 +849,7 @@ namespace EMStudio // extracts the node name from a given row AZStd::string AttachmentsWindow::GetNodeNameFromTableRow(int row) { - QTableWidgetItem* item = mTableWidget->item(row, 4); + QTableWidgetItem* item = m_tableWidget->item(row, 4); if (item == nullptr) { return {}; @@ -864,13 +863,13 @@ namespace EMStudio int AttachmentsWindow::GetRowContainingWidget(const QWidget* widget) { // loop trough the table items and search for widget - const int numRows = mTableWidget->rowCount(); - const int numCols = mTableWidget->columnCount(); + const int numRows = m_tableWidget->rowCount(); + const int numCols = m_tableWidget->columnCount(); for (int i = 0; i < numRows; ++i) { for (int j = 0; j < numCols; ++j) { - if (mTableWidget->cellWidget(i, j) == widget) + if (m_tableWidget->cellWidget(i, j) == widget) { return i; } @@ -891,7 +890,7 @@ namespace EMStudio // cancel selection of escape button is pressed void AttachmentsWindow::OnEscapeButtonPressed() { - mWaitingForAttachment = false; + m_waitingForAttachment = false; UpdateInterface(); } diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/Attachments/AttachmentsWindow.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/Attachments/AttachmentsWindow.h index b3bd45fb22..9d3cb2d0f6 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/Attachments/AttachmentsWindow.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/Attachments/AttachmentsWindow.h @@ -56,7 +56,7 @@ namespace EMStudio void AddAttachments(const AZStd::vector& filenames); void OnAttachmentSelected(); - bool GetIsWaitingForAttachment() const { return mWaitingForAttachment; } + bool GetIsWaitingForAttachment() const { return m_waitingForAttachment; } EMotionFX::ActorInstance* GetSelectedAttachment(); AZStd::string GetSelectedNodeName(); @@ -89,35 +89,35 @@ namespace EMStudio AZStd::string GetNodeNameFromTableRow(int row); int GetRowContainingWidget(const QWidget* widget); - bool mWaitingForAttachment; - bool mIsDeformableAttachment; + bool m_waitingForAttachment; + bool m_isDeformableAttachment; - QVBoxLayout* mWaitingForAttachmentLayout; - QVBoxLayout* mNoSelectionLayout; - QVBoxLayout* mMainLayout; - QVBoxLayout* mAttachmentsLayout; + QVBoxLayout* m_waitingForAttachmentLayout; + QVBoxLayout* m_noSelectionLayout; + QVBoxLayout* m_mainLayout; + QVBoxLayout* m_attachmentsLayout; - QWidget* mAttachmentsWidget; - QWidget* mWaitingForAttachmentWidget; - QWidget* mNoSelectionWidget; + QWidget* m_attachmentsWidget; + QWidget* m_waitingForAttachmentWidget; + QWidget* m_noSelectionWidget; - QShortcut* mEscapeShortcut; + QShortcut* m_escapeShortcut; - QTableWidget* mTableWidget; - EMotionFX::ActorInstance* mActorInstance; - AZStd::vector mAttachments; - AZStd::string mNodeBeforeSelectionWindow; + QTableWidget* m_tableWidget; + EMotionFX::ActorInstance* m_actorInstance; + AZStd::vector m_attachments; + AZStd::string m_nodeBeforeSelectionWindow; - QToolButton* mOpenAttachmentButton; - QToolButton* mOpenDeformableAttachmentButton; - QToolButton* mRemoveButton; - QToolButton* mClearButton; - QToolButton* mCancelSelectionButton; + QToolButton* m_openAttachmentButton; + QToolButton* m_openDeformableAttachmentButton; + QToolButton* m_removeButton; + QToolButton* m_clearButton; + QToolButton* m_cancelSelectionButton; - NodeSelectionWindow* mNodeSelectionWindow; + NodeSelectionWindow* m_nodeSelectionWindow; - AZStd::vector mDropFileNames; - AZStd::string mTempString; + AZStd::vector m_dropFileNames; + AZStd::string m_tempString; }; } // namespace EMStudio diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/CommandBar/CommandBarPlugin.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/CommandBar/CommandBarPlugin.cpp index f06dedfc67..80577de3b4 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/CommandBar/CommandBarPlugin.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/CommandBar/CommandBarPlugin.cpp @@ -91,11 +91,11 @@ namespace EMStudio m_commandEdit = new QLineEdit(); m_commandEdit->setPlaceholderText("Enter command"); connect(m_commandEdit, &QLineEdit::returnPressed, this, &CommandBarPlugin::OnEnter); - m_commandEditAction = mBar->addWidget(m_commandEdit); + m_commandEditAction = m_bar->addWidget(m_commandEdit); m_resultEdit = new QLineEdit(); m_resultEdit->setReadOnly(true); - m_commandResultAction = mBar->addWidget(m_resultEdit); + m_commandResultAction = m_bar->addWidget(m_resultEdit); m_globalSimSpeedSlider = new AzQtComponents::SliderDouble(Qt::Horizontal); m_globalSimSpeedSlider->setMaximumWidth(80); @@ -104,9 +104,9 @@ namespace EMStudio m_globalSimSpeedSlider->setValue(1.0); m_globalSimSpeedSlider->setToolTip("The global simulation speed factor.\nA value of 1.0 means the normal speed, which is when the slider handle is in the center.\nPress the button on the right of this slider to reset to the normal speed."); connect(m_globalSimSpeedSlider, &AzQtComponents::SliderDouble::valueChanged, this, &CommandBarPlugin::OnGlobalSimSpeedChanged); - m_globalSimSpeedSliderAction = mBar->addWidget(m_globalSimSpeedSlider); + m_globalSimSpeedSliderAction = m_bar->addWidget(m_globalSimSpeedSlider); - m_globalSimSpeedResetAction = mBar->addAction(MysticQt::GetMysticQt()->FindIcon("Images/Icons/Reset.svg"), + m_globalSimSpeedResetAction = m_bar->addAction(MysticQt::GetMysticQt()->FindIcon("Images/Icons/Reset.svg"), tr("Reset the global simulation speed factor to its normal speed"), this, &CommandBarPlugin::ResetGlobalSimSpeed); @@ -114,7 +114,7 @@ namespace EMStudio m_progressText->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); m_progressText->setAlignment(Qt::AlignRight); m_progressText->setStyleSheet("padding-right: 1px; color: rgb(140, 140, 140);"); - m_progressTextAction = mBar->addWidget(m_progressText); + m_progressTextAction = m_bar->addWidget(m_progressText); m_progressTextAction->setVisible(false); m_progressBar = new QProgressBar(); @@ -122,10 +122,10 @@ namespace EMStudio m_progressBar->setValue(0); m_progressBar->setMaximumWidth(300); m_progressBar->setStyleSheet("padding-right: 2px;"); - m_progressBarAction = mBar->addWidget(m_progressBar); + m_progressBarAction = m_bar->addWidget(m_progressBar); m_progressBarAction->setVisible(false); - m_lockSelectionAction = mBar->addAction(MysticQt::GetMysticQt()->FindIcon("Images/Icons/Reset.svg"), + m_lockSelectionAction = m_bar->addAction(MysticQt::GetMysticQt()->FindIcon("Images/Icons/Reset.svg"), tr("Lock or unlock the selection of actor instances"), this, &CommandBarPlugin::OnLockSelectionButton); diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/CommandBrowser/CommandBrowserPlugin.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/CommandBrowser/CommandBrowserPlugin.cpp deleted file mode 100644 index 2a8a8f99bc..0000000000 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/CommandBrowser/CommandBrowserPlugin.cpp +++ /dev/null @@ -1,280 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -/* - -// include required headers -#include "CommandBrowserPlugin.h" -#include "../../../../EMStudioSDK/Source/EMStudioManager.h" -#include - - -namespace EMStudio -{ - -// constructor -CommandBrowserPlugin::CommandBrowserPlugin() : EMStudio::DockWidgetPlugin() -{ - mWebView = nullptr; -} - - -// destructor -CommandBrowserPlugin::~CommandBrowserPlugin() -{ -} - - -// clone the log window -EMStudioPlugin* CommandBrowserPlugin::Clone() -{ - CommandBrowserPlugin* newPlugin = new CommandBrowserPlugin(); - return newPlugin; -} - - -// init after the parent dock window has been created -bool CommandBrowserPlugin::Init() -{ - //LogInfo("Initializing command browser window."); - //QWebSettings::globalSettings()->setAttribute(QWebSettings::JavascriptEnabled, true); - mWebView = new QWebView( mDock ); - mWebView->setObjectName( "QWebView" ); - mWebView->settings()->setAttribute(QWebSettings::JavascriptEnabled, true); - mWebView->settings()->setAttribute(QWebSettings::JavascriptCanOpenWindows, true ); - mDock->SetContents( mWebView ); - GenerateCommandList(); - return true; -} - - -void CommandBrowserPlugin::GenerateCommandList() -{ - CommandSystem::CommandManager* manager = GetCommandManager(); - - uint32 i; - const uint32 numCommands = manager->GetNumRegisteredCommands(); - - // generate the html header - QString html; - html = ""; - html += ""; - html += "\n"; - - html += "\n"; - html += "\n"; - html += "\n"; - - // init all commands as closed - html += "\n"; - - // write the alphabet - html += "\n"; - MCore::Command* prevCommand = nullptr; - for (i=0; iGetCommand(i); - - // find out if we need to show the leading character - bool newFirstCharacter = false; - if (prevCommand == nullptr) - newFirstCharacter = true; - else - if (prevCommand->GetName()[0] != command->GetName()[0]) - newFirstCharacter = true; - - // display the first character as link - if (newFirstCharacter) - { - const char character = command->GetName()[0]; - QString newString; - newString.sprintf("%c ", character, character); - html += newString; - } - - prevCommand = command; - } - html += ""; - html += "
"; - html += "
"; - html += "
\n"; - - - // show all commands as links - prevCommand = nullptr; - for (i=0; iGetCommand(i); - - // find out if we need to show the leading character - bool newFirstCharacter = false; - if (prevCommand == nullptr) - newFirstCharacter = true; - else - if (prevCommand->GetName()[0] != command->GetName()[0]) - newFirstCharacter = true; - - if (newFirstCharacter) - { - // if this isn't the first command - if (i != 0) - { - html += "
"; - //html += "
"; - html += "
"; - } - - QString newString; - newString.sprintf("", command->GetName()[0]); - html += newString; - - html += "\n"; - html += (char)command->GetName()[0]; - html += ""; - - html += "
"; - html += "
"; - //html += "
"; - //html += "
"; - } - - QString newString; - newString.sprintf("
%s
\n", command->GetName(), command->GetName()); - html += newString; - newString.sprintf("
\n", command->GetName()); - html += newString; - - prevCommand = command; - } - html += "\n"; - - - // set the html code - mWebView->setHtml( html ); -} - -} // namespace EMStudio -*/ diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/CommandBrowser/CommandBrowserPlugin.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/CommandBrowser/CommandBrowserPlugin.h deleted file mode 100644 index b4aa695ce5..0000000000 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/CommandBrowser/CommandBrowserPlugin.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#ifndef __EMSTUDIO_COMMANDBROWSERPLUGIN_H -#define __EMSTUDIO_COMMANDBROWSERPLUGIN_H -/* -// include MCore -//#include (); // init the max second column width - mMaxSecondColumnWidth = 0; + m_maxSecondColumnWidth = 0; // init the table setColumnCount(2); @@ -47,9 +47,9 @@ namespace EMStudio // set the filter #ifdef AZ_DEBUG_BUILD - mFilter = LOGLEVEL_FATAL | LOGLEVEL_ERROR | LOGLEVEL_WARNING | LOGLEVEL_INFO | LOGLEVEL_DETAILEDINFO | LOGLEVEL_DEBUG; + m_filter = LOGLEVEL_FATAL | LOGLEVEL_ERROR | LOGLEVEL_WARNING | LOGLEVEL_INFO | LOGLEVEL_DETAILEDINFO | LOGLEVEL_DEBUG; #else - mFilter = LOGLEVEL_FATAL | LOGLEVEL_ERROR | LOGLEVEL_WARNING | LOGLEVEL_INFO; + m_filter = LOGLEVEL_FATAL | LOGLEVEL_ERROR | LOGLEVEL_WARNING | LOGLEVEL_INFO; #endif connect(this, &LogWindowCallback::DoLog, this, &LogWindowCallback::LogImpl, Qt::QueuedConnection); @@ -113,17 +113,17 @@ namespace EMStudio setItem(newRowIndex, 1, messageItem); // check the filter, if the filter is not enabled, it's not needed to test the find value - if ((mFilter & (int)logLevel) != 0) + if ((m_filter & (int)logLevel) != 0) { // check the find value, set the row not visible if the text is not found - if (messageItem->text().contains(mFind, Qt::CaseInsensitive)) + if (messageItem->text().contains(m_find, Qt::CaseInsensitive)) { // set the row not hidden setRowHidden(newRowIndex, false); // custom resize of the column to be efficient const int itemWidth = itemDelegate()->sizeHint(viewOptions(), indexFromItem(messageItem)).width(); - mMaxSecondColumnWidth = qMax(mMaxSecondColumnWidth, itemWidth); + m_maxSecondColumnWidth = qMax(m_maxSecondColumnWidth, itemWidth); SetColumnWidthToTakeWholeSpace(); } else @@ -145,10 +145,10 @@ namespace EMStudio void LogWindowCallback::SetFind(const QString& find) { // store the new find - mFind = find; + m_find = find; // init the max second column width - mMaxSecondColumnWidth = 0; + m_maxSecondColumnWidth = 0; // test each row with the new find const int numRows = rowCount(); @@ -159,17 +159,17 @@ namespace EMStudio const int logLevel = messageItem->data(Qt::UserRole).toInt(); // check the filter, if the filter is not enabled, it's not needed to test the find value - if ((mFilter & logLevel) != 0) + if ((m_filter & logLevel) != 0) { // check the find value, set the row not visible if the text is not found - if (messageItem->text().contains(mFind, Qt::CaseInsensitive)) + if (messageItem->text().contains(m_find, Qt::CaseInsensitive)) { // set the row not hidden setRowHidden(i, false); // update the new column width to keep the maximum const int itemWidth = itemDelegate()->sizeHint(viewOptions(), indexFromItem(messageItem)).width(); - mMaxSecondColumnWidth = qMax(mMaxSecondColumnWidth, itemWidth); + m_maxSecondColumnWidth = qMax(m_maxSecondColumnWidth, itemWidth); } else { @@ -191,10 +191,10 @@ namespace EMStudio void LogWindowCallback::SetFilter(uint32 filter) { // store the new filter - mFilter = filter; + m_filter = filter; // init the max second column width - mMaxSecondColumnWidth = 0; + m_maxSecondColumnWidth = 0; // test each row with the new find const int numRows = rowCount(); @@ -205,17 +205,17 @@ namespace EMStudio const int logLevel = messageItem->data(Qt::UserRole).toInt(); // check the filter, if the filter is not enabled, it's not needed to test the find value - if ((mFilter & logLevel) != 0) + if ((m_filter & logLevel) != 0) { // check the find value, set the row not visible if the text is not found - if (messageItem->text().contains(mFind, Qt::CaseInsensitive)) + if (messageItem->text().contains(m_find, Qt::CaseInsensitive)) { // set the row not hidden setRowHidden(i, false); // update the new column width to keep the maximum const int itemWidth = itemDelegate()->sizeHint(viewOptions(), indexFromItem(messageItem)).width(); - mMaxSecondColumnWidth = qMax(mMaxSecondColumnWidth, itemWidth); + m_maxSecondColumnWidth = qMax(m_maxSecondColumnWidth, itemWidth); } else { @@ -263,13 +263,13 @@ namespace EMStudio { const int firstColumnWidth = columnWidth(0); const int widthWihoutFirstColumnWidth = qMax(0, viewport()->width() - firstColumnWidth); - if (mMaxSecondColumnWidth < widthWihoutFirstColumnWidth) + if (m_maxSecondColumnWidth < widthWihoutFirstColumnWidth) { setColumnWidth(1, widthWihoutFirstColumnWidth); } else { - setColumnWidth(1, mMaxSecondColumnWidth); + setColumnWidth(1, m_maxSecondColumnWidth); } } @@ -345,7 +345,7 @@ namespace EMStudio { setRowCount(0); setColumnWidth(1, 0); - mMaxSecondColumnWidth = 0; + m_maxSecondColumnWidth = 0; } diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/LogWindow/LogWindowCallback.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/LogWindow/LogWindowCallback.h index 3a1598e120..2e319e1dfa 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/LogWindow/LogWindowCallback.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/LogWindow/LogWindowCallback.h @@ -40,13 +40,13 @@ namespace EMStudio void SetFind(const QString& find); QString GetFind() const { - return mFind; + return m_find; } void SetFilter(uint32 filter); uint32 GetFilter() const { - return mFilter; + return m_filter; } protected: @@ -70,9 +70,9 @@ namespace EMStudio void SetColumnWidthToTakeWholeSpace(); private: - QString mFind; - uint32 mFilter; - int mMaxSecondColumnWidth; + QString m_find; + uint32 m_filter; + int m_maxSecondColumnWidth; bool m_scrollToBottom; }; } // namespace EMStudio diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/LogWindow/LogWindowPlugin.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/LogWindow/LogWindowPlugin.cpp index a9a7c6a174..8fd80bb584 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/LogWindow/LogWindowPlugin.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/LogWindow/LogWindowPlugin.cpp @@ -20,7 +20,7 @@ namespace EMStudio LogWindowPlugin::LogWindowPlugin() : EMStudio::DockWidgetPlugin() { - mLogCallback = nullptr; + m_logCallback = nullptr; } @@ -28,7 +28,7 @@ namespace EMStudio LogWindowPlugin::~LogWindowPlugin() { // remove the callback from the log manager (automatically deletes from memory as well) - const size_t index = MCore::GetLogManager().FindLogCallback(mLogCallback); + const size_t index = MCore::GetLogManager().FindLogCallback(m_logCallback); if (index != InvalidIndex) { MCore::GetLogManager().RemoveLogCallback(index); @@ -83,7 +83,7 @@ namespace EMStudio bool LogWindowPlugin::Init() { // create the widget - QWidget* windowWidget = new QWidget(mDock); + QWidget* windowWidget = new QWidget(m_dock); // create the layout QVBoxLayout* windowWidgetLayout = new QVBoxLayout(); @@ -91,7 +91,7 @@ namespace EMStudio windowWidgetLayout->setMargin(3); // create the find widget - mSearchWidget = new AzQtComponents::FilteredSearchWidget(windowWidget); + m_searchWidget = new AzQtComponents::FilteredSearchWidget(windowWidget); AddFilter(tr("Fatal"), MCore::LogCallback::LOGLEVEL_FATAL, true); AddFilter(tr("Error"), MCore::LogCallback::LOGLEVEL_ERROR, true); AddFilter(tr("Warning"), MCore::LogCallback::LOGLEVEL_WARNING, true); @@ -103,13 +103,13 @@ namespace EMStudio AddFilter(tr("Detailed Info"), MCore::LogCallback::LOGLEVEL_DETAILEDINFO, false); AddFilter(tr("Debug"), MCore::LogCallback::LOGLEVEL_DEBUG, false); #endif - connect(mSearchWidget, &AzQtComponents::FilteredSearchWidget::TextFilterChanged, this, &LogWindowPlugin::OnTextFilterChanged); - connect(mSearchWidget, &AzQtComponents::FilteredSearchWidget::TypeFilterChanged, this, &LogWindowPlugin::OnTypeFilterChanged); + connect(m_searchWidget, &AzQtComponents::FilteredSearchWidget::TextFilterChanged, this, &LogWindowPlugin::OnTextFilterChanged); + connect(m_searchWidget, &AzQtComponents::FilteredSearchWidget::TypeFilterChanged, this, &LogWindowPlugin::OnTypeFilterChanged); // create the filter layout QHBoxLayout* topLayout = new QHBoxLayout(); topLayout->addWidget(new QLabel("Filter:")); - topLayout->addWidget(mSearchWidget); + topLayout->addWidget(m_searchWidget); topLayout->addStretch(); topLayout->setSpacing(6); @@ -117,18 +117,18 @@ namespace EMStudio windowWidgetLayout->addLayout(topLayout); // create and add the table and callback - mLogCallback = new LogWindowCallback(nullptr); - windowWidgetLayout->addWidget(mLogCallback); + m_logCallback = new LogWindowCallback(nullptr); + windowWidgetLayout->addWidget(m_logCallback); // set the layout windowWidget->setLayout(windowWidgetLayout); // set the table as content - mDock->setWidget(windowWidget); + m_dock->setWidget(windowWidget); // create the callback - mLogCallback->SetLogLevels(MCore::LogCallback::LOGLEVEL_ALL); - MCore::GetLogManager().AddLogCallback(mLogCallback); + m_logCallback->SetLogLevels(MCore::LogCallback::LOGLEVEL_ALL); + MCore::GetLogManager().AddLogCallback(m_logCallback); // return true because the plugin is correctly initialized return true; @@ -138,7 +138,7 @@ namespace EMStudio // find changed void LogWindowPlugin::OnTextFilterChanged(const QString& text) { - mLogCallback->SetFind(text); + m_logCallback->SetFind(text); } @@ -150,7 +150,7 @@ namespace EMStudio { newFilter |= filter.metadata.toInt(); } - mLogCallback->SetFilter(newFilter); + m_logCallback->SetFilter(newFilter); } @@ -159,7 +159,7 @@ namespace EMStudio AzQtComponents::SearchTypeFilter filter(tr("Level"), name); filter.metadata = static_cast(level); filter.enabled = enabled; - mSearchWidget->AddTypeFilter(filter); + m_searchWidget->AddTypeFilter(filter); } } // namespace EMStudio diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/LogWindow/LogWindowPlugin.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/LogWindow/LogWindowPlugin.h index 1b40b3fa2a..61b6ab4b8c 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/LogWindow/LogWindowPlugin.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/LogWindow/LogWindowPlugin.h @@ -61,8 +61,8 @@ namespace EMStudio private: void AddFilter(const QString& name, MCore::LogCallback::ELogLevel level, bool enabled); - LogWindowCallback* mLogCallback; - AzQtComponents::FilteredSearchWidget* mSearchWidget; + LogWindowCallback* m_logCallback; + AzQtComponents::FilteredSearchWidget* m_searchWidget; }; } // namespace EMStudio diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MorphTargetsWindow/MorphTargetEditWindow.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MorphTargetsWindow/MorphTargetEditWindow.cpp index a53ed94909..7a38b0813d 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MorphTargetsWindow/MorphTargetEditWindow.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MorphTargetsWindow/MorphTargetEditWindow.cpp @@ -21,11 +21,11 @@ namespace EMStudio : QDialog(parent) { // keep values - mActorInstance = actorInstance; - mMorphTarget = morphTarget; + m_actorInstance = actorInstance; + m_morphTarget = morphTarget; // init the phoneme selection window - mPhonemeSelectionWindow = nullptr; + m_phonemeSelectionWindow = nullptr; // set the window name setWindowTitle(QString("Edit Morph Target: %1").arg(morphTarget->GetName())); @@ -35,35 +35,35 @@ namespace EMStudio layout->setAlignment(Qt::AlignVCenter); // get the morph target range min/max - const float morphTargetRangeMin = mMorphTarget->GetRangeMin(); - const float morphTargetRangeMax = mMorphTarget->GetRangeMax(); + const float morphTargetRangeMin = m_morphTarget->GetRangeMin(); + const float morphTargetRangeMax = m_morphTarget->GetRangeMax(); // create the range min label QLabel* rangeMinLabel = new QLabel("Range Min"); // create the range min double spinbox - mRangeMin = new AzQtComponents::DoubleSpinBox(); - mRangeMin->setSingleStep(0.1); - mRangeMin->setRange(std::numeric_limits::lowest(), morphTargetRangeMax); - mRangeMin->setValue(morphTargetRangeMin); - connect(mRangeMin, qOverload(&QDoubleSpinBox::valueChanged), this, &MorphTargetEditWindow::MorphTargetRangeMinValueChanged); + m_rangeMin = new AzQtComponents::DoubleSpinBox(); + m_rangeMin->setSingleStep(0.1); + m_rangeMin->setRange(std::numeric_limits::lowest(), morphTargetRangeMax); + m_rangeMin->setValue(morphTargetRangeMin); + connect(m_rangeMin, qOverload(&QDoubleSpinBox::valueChanged), this, &MorphTargetEditWindow::MorphTargetRangeMinValueChanged); // create the range max label QLabel* rangeMaxLabel = new QLabel("Range Max"); // create the range max double spinbox - mRangeMax = new AzQtComponents::DoubleSpinBox(); - mRangeMax->setSingleStep(0.1); - mRangeMax->setRange(morphTargetRangeMin, std::numeric_limits::max()); - mRangeMax->setValue(morphTargetRangeMax); - connect(mRangeMax, qOverload(&QDoubleSpinBox::valueChanged), this, &MorphTargetEditWindow::MorphTargetRangeMaxValueChanged); + m_rangeMax = new AzQtComponents::DoubleSpinBox(); + m_rangeMax->setSingleStep(0.1); + m_rangeMax->setRange(morphTargetRangeMin, std::numeric_limits::max()); + m_rangeMax->setValue(morphTargetRangeMax); + connect(m_rangeMax, qOverload(&QDoubleSpinBox::valueChanged), this, &MorphTargetEditWindow::MorphTargetRangeMaxValueChanged); // create the grid layout QGridLayout* gridLayout = new QGridLayout(); gridLayout->addWidget(rangeMinLabel, 0, 0); - gridLayout->addWidget(mRangeMin, 0, 1); + gridLayout->addWidget(m_rangeMin, 0, 1); gridLayout->addWidget(rangeMaxLabel, 1, 0); - gridLayout->addWidget(mRangeMax, 1, 1); + gridLayout->addWidget(m_rangeMax, 1, 1); // create the buttons layout QHBoxLayout* buttonsLayout = new QHBoxLayout(); @@ -95,36 +95,36 @@ namespace EMStudio MorphTargetEditWindow::~MorphTargetEditWindow() { - delete mPhonemeSelectionWindow; + delete m_phonemeSelectionWindow; } void MorphTargetEditWindow::UpdateInterface() { // get the morph target range min/max - const float morphTargetRangeMin = mMorphTarget->GetRangeMin(); - const float morphTargetRangeMax = mMorphTarget->GetRangeMax(); + const float morphTargetRangeMin = m_morphTarget->GetRangeMin(); + const float morphTargetRangeMax = m_morphTarget->GetRangeMax(); // disable signals - mRangeMin->blockSignals(true); - mRangeMax->blockSignals(true); + m_rangeMin->blockSignals(true); + m_rangeMax->blockSignals(true); // update the range min - mRangeMin->setRange(std::numeric_limits::lowest(), morphTargetRangeMax); - mRangeMin->setValue(morphTargetRangeMin); + m_rangeMin->setRange(std::numeric_limits::lowest(), morphTargetRangeMax); + m_rangeMin->setValue(morphTargetRangeMin); // update the range max - mRangeMax->setRange(morphTargetRangeMin, std::numeric_limits::max()); - mRangeMax->setValue(morphTargetRangeMax); + m_rangeMax->setRange(morphTargetRangeMin, std::numeric_limits::max()); + m_rangeMax->setValue(morphTargetRangeMax); // enable signals - mRangeMin->blockSignals(false); - mRangeMax->blockSignals(false); + m_rangeMin->blockSignals(false); + m_rangeMax->blockSignals(false); // update the phoneme selection window - if (mPhonemeSelectionWindow) + if (m_phonemeSelectionWindow) { - mPhonemeSelectionWindow->UpdateInterface(); + m_phonemeSelectionWindow->UpdateInterface(); } } @@ -132,24 +132,24 @@ namespace EMStudio void MorphTargetEditWindow::MorphTargetRangeMinValueChanged(double value) { const float rangeMin = (float)value; - mRangeMax->setRange(rangeMin, std::numeric_limits::max()); + m_rangeMax->setRange(rangeMin, std::numeric_limits::max()); } void MorphTargetEditWindow::MorphTargetRangeMaxValueChanged(double value) { const float rangeMax = (float)value; - mRangeMin->setRange(std::numeric_limits::lowest(), rangeMax); + m_rangeMin->setRange(std::numeric_limits::lowest(), rangeMax); } void MorphTargetEditWindow::Accepted() { - const float rangeMin = (float)mRangeMin->value(); - const float rangeMax = (float)mRangeMax->value(); + const float rangeMin = (float)m_rangeMin->value(); + const float rangeMax = (float)m_rangeMax->value(); AZStd::string result; - AZStd::string command = AZStd::string::format("AdjustMorphTarget -actorInstanceID %i -lodLevel %zu -name \"%s\" -rangeMin %f -rangeMax %f", mActorInstance->GetID(), mActorInstance->GetLODLevel(), mMorphTarget->GetNameString().c_str(), rangeMin, rangeMax); + AZStd::string command = AZStd::string::format("AdjustMorphTarget -actorInstanceID %i -lodLevel %zu -name \"%s\" -rangeMin %f -rangeMax %f", m_actorInstance->GetID(), m_actorInstance->GetLODLevel(), m_morphTarget->GetNameString().c_str(), rangeMin, rangeMax); if (EMStudio::GetCommandManager()->ExecuteCommand(command, result) == false) { AZ_Error("EMotionFX", false, result.c_str()); @@ -161,9 +161,9 @@ namespace EMStudio void MorphTargetEditWindow::EditPhonemeButtonClicked() { - delete mPhonemeSelectionWindow; - mPhonemeSelectionWindow = new PhonemeSelectionWindow(mActorInstance->GetActor(), mActorInstance->GetLODLevel(), mMorphTarget, this); - mPhonemeSelectionWindow->exec(); + delete m_phonemeSelectionWindow; + m_phonemeSelectionWindow = new PhonemeSelectionWindow(m_actorInstance->GetActor(), m_actorInstance->GetLODLevel(), m_morphTarget, this); + m_phonemeSelectionWindow->exec(); } } // namespace EMStudio diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MorphTargetsWindow/MorphTargetEditWindow.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MorphTargetsWindow/MorphTargetEditWindow.h index e5f6d59055..9439c9d84c 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MorphTargetsWindow/MorphTargetEditWindow.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MorphTargetsWindow/MorphTargetEditWindow.h @@ -31,7 +31,7 @@ namespace EMStudio ~MorphTargetEditWindow(); void UpdateInterface(); - EMotionFX::MorphTarget* GetMorphTarget() { return mMorphTarget; } + EMotionFX::MorphTarget* GetMorphTarget() { return m_morphTarget; } public slots: void Accepted(); @@ -40,10 +40,10 @@ namespace EMStudio void EditPhonemeButtonClicked(); private: - EMotionFX::ActorInstance* mActorInstance; - EMotionFX::MorphTarget* mMorphTarget; - AzQtComponents::DoubleSpinBox* mRangeMin; - AzQtComponents::DoubleSpinBox* mRangeMax; - PhonemeSelectionWindow* mPhonemeSelectionWindow; + EMotionFX::ActorInstance* m_actorInstance; + EMotionFX::MorphTarget* m_morphTarget; + AzQtComponents::DoubleSpinBox* m_rangeMin; + AzQtComponents::DoubleSpinBox* m_rangeMax; + PhonemeSelectionWindow* m_phonemeSelectionWindow; }; } // namespace EMStudio diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MorphTargetsWindow/MorphTargetGroupWidget.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MorphTargetsWindow/MorphTargetGroupWidget.cpp index aee88f9394..2fec1f424f 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MorphTargetsWindow/MorphTargetGroupWidget.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MorphTargetsWindow/MorphTargetGroupWidget.cpp @@ -23,11 +23,11 @@ namespace EMStudio : QWidget(parent) { // keep values - mName = name; - mActorInstance = actorInstance; + m_name = name; + m_actorInstance = actorInstance; // init the edit window to nullptr - mEditWindow = nullptr; + m_editWindow = nullptr; // create the layout QVBoxLayout* layout = new QVBoxLayout(); @@ -35,9 +35,9 @@ namespace EMStudio layout->setMargin(0); // checkbox to enable/disable manual mode for all morph targets - mSelectAll = new QCheckBox("Select All"); - mSelectAll->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Fixed); - connect(mSelectAll, &QCheckBox::stateChanged, this, &MorphTargetGroupWidget::SetManualModeForAll); + m_selectAll = new QCheckBox("Select All"); + m_selectAll->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Fixed); + connect(m_selectAll, &QCheckBox::stateChanged, this, &MorphTargetGroupWidget::SetManualModeForAll); // button for resetting all morph targets QPushButton* resetAll = new QPushButton("Reset All"); @@ -46,7 +46,7 @@ namespace EMStudio // add controls to the top layout QHBoxLayout* topControlLayout = new QHBoxLayout(); - topControlLayout->addWidget(mSelectAll); + topControlLayout->addWidget(m_selectAll); topControlLayout->addWidget(resetAll); topControlLayout->setSpacing(5); topControlLayout->setMargin(0); @@ -60,13 +60,13 @@ namespace EMStudio gridLayout->setVerticalSpacing(2); const size_t numMorphTargets = morphTargets.size(); - mMorphTargets.resize(numMorphTargets); + m_morphTargets.resize(numMorphTargets); for (size_t i=0; iaddWidget(numberLabel, intIndex, 0); // add the manual mode checkbox - mMorphTargets[i].mManualMode = new QCheckBox(); - mMorphTargets[i].mManualMode->setMaximumWidth(15); - mMorphTargets[i].mManualMode->setProperty("MorphTargetIndex", intIndex); - mMorphTargets[i].mManualMode->setStyleSheet("QCheckBox{ spacing: 0px; }"); - gridLayout->addWidget(mMorphTargets[i].mManualMode, intIndex, 1); - connect(mMorphTargets[i].mManualMode, &QCheckBox::clicked, this, &MorphTargetGroupWidget::ManualModeClicked); + m_morphTargets[i].m_manualMode = new QCheckBox(); + m_morphTargets[i].m_manualMode->setMaximumWidth(15); + m_morphTargets[i].m_manualMode->setProperty("MorphTargetIndex", intIndex); + m_morphTargets[i].m_manualMode->setStyleSheet("QCheckBox{ spacing: 0px; }"); + gridLayout->addWidget(m_morphTargets[i].m_manualMode, intIndex, 1); + connect(m_morphTargets[i].m_manualMode, &QCheckBox::clicked, this, &MorphTargetGroupWidget::ManualModeClicked); // create slider to adjust the morph target - mMorphTargets[i].mSliderWeight = new AzQtComponents::SliderDoubleCombo(); - mMorphTargets[i].mSliderWeight->setMinimumWidth(50); - mMorphTargets[i].mSliderWeight->setProperty("MorphTargetIndex", intIndex); - mMorphTargets[i].mSliderWeight->spinbox()->setMinimumWidth(40); - mMorphTargets[i].mSliderWeight->spinbox()->setMaximumWidth(40); - gridLayout->addWidget(mMorphTargets[i].mSliderWeight, intIndex, 2); - connect(mMorphTargets[i].mSliderWeight, &AzQtComponents::SliderDoubleCombo::valueChanged, this, &MorphTargetGroupWidget::SliderWeightMoved); - connect(mMorphTargets[i].mSliderWeight, &AzQtComponents::SliderDoubleCombo::editingFinished, this, &MorphTargetGroupWidget::SliderWeightReleased); + m_morphTargets[i].m_sliderWeight = new AzQtComponents::SliderDoubleCombo(); + m_morphTargets[i].m_sliderWeight->setMinimumWidth(50); + m_morphTargets[i].m_sliderWeight->setProperty("MorphTargetIndex", intIndex); + m_morphTargets[i].m_sliderWeight->spinbox()->setMinimumWidth(40); + m_morphTargets[i].m_sliderWeight->spinbox()->setMaximumWidth(40); + gridLayout->addWidget(m_morphTargets[i].m_sliderWeight, intIndex, 2); + connect(m_morphTargets[i].m_sliderWeight, &AzQtComponents::SliderDoubleCombo::valueChanged, this, &MorphTargetGroupWidget::SliderWeightMoved); + connect(m_morphTargets[i].m_sliderWeight, &AzQtComponents::SliderDoubleCombo::editingFinished, this, &MorphTargetGroupWidget::SliderWeightReleased); // create the name label QLabel* nameLabel = new QLabel(morphTargets[i]->GetName()); @@ -116,7 +116,7 @@ namespace EMStudio // the destructor MorphTargetGroupWidget::~MorphTargetGroupWidget() { - delete mEditWindow; + delete m_editWindow; } @@ -128,12 +128,12 @@ namespace EMStudio AZStd::string command; // loop trough all morph targets and enable/disable manual mode - const size_t numMorphTargets = mMorphTargets.size(); + const size_t numMorphTargets = m_morphTargets.size(); for (size_t i = 0; i < numMorphTargets; ++i) { - EMotionFX::MorphTarget* morphTarget = mMorphTargets[i].mMorphTarget; + EMotionFX::MorphTarget* morphTarget = m_morphTargets[i].m_morphTarget; - command = AZStd::string::format("AdjustMorphTarget -actorInstanceID %i -lodLevel %zu -name \"%s\" -manualMode ", mActorInstance->GetID(), mActorInstance->GetLODLevel(), morphTarget->GetName()); + command = AZStd::string::format("AdjustMorphTarget -actorInstanceID %i -lodLevel %zu -name \"%s\" -manualMode ", m_actorInstance->GetID(), m_actorInstance->GetLODLevel(), morphTarget->GetName()); command += AZStd::to_string(value == Qt::Checked); commandGroup.AddCommandString(command); } @@ -154,12 +154,12 @@ namespace EMStudio AZStd::string command; // loop trough all morph targets and enable/disable manual mode - const size_t numMorphTargets = mMorphTargets.size(); + const size_t numMorphTargets = m_morphTargets.size(); for (size_t i = 0; i < numMorphTargets; ++i) { - EMotionFX::MorphTarget* morphTarget = mMorphTargets[i].mMorphTarget; + EMotionFX::MorphTarget* morphTarget = m_morphTargets[i].m_morphTarget; - command = AZStd::string::format("AdjustMorphTarget -actorInstanceID %i -lodLevel %zu -name \"%s\" -weight %f", mActorInstance->GetID(), mActorInstance->GetLODLevel(), morphTarget->GetName(), morphTarget->CalcZeroInfluenceWeight()); + command = AZStd::string::format("AdjustMorphTarget -actorInstanceID %i -lodLevel %zu -name \"%s\" -weight %f", m_actorInstance->GetID(), m_actorInstance->GetLODLevel(), morphTarget->GetName(), morphTarget->CalcZeroInfluenceWeight()); commandGroup.AddCommandString(command); } @@ -176,12 +176,12 @@ namespace EMStudio { QCheckBox* checkBox = static_cast(sender()); const int morphTargetIndex = checkBox->property("MorphTargetIndex").toInt(); - EMotionFX::MorphTarget* morphTarget = mMorphTargets[morphTargetIndex].mMorphTarget; + EMotionFX::MorphTarget* morphTarget = m_morphTargets[morphTargetIndex].m_morphTarget; AZStd::string result; const AZStd::string command = AZStd::string::format("AdjustMorphTarget -actorInstanceID %i -lodLevel %zu -name \"%s\" -weight %f -manualMode %s", - mActorInstance->GetID(), - mActorInstance->GetLODLevel(), + m_actorInstance->GetID(), + m_actorInstance->GetLODLevel(), morphTarget->GetName(), 0.0f, AZStd::to_string(checkBox->isChecked()).c_str()); @@ -198,7 +198,7 @@ namespace EMStudio // get the morph target AzQtComponents::SliderDoubleCombo* floatSlider = static_cast(sender()); const int morphTargetIndex = floatSlider->property("MorphTargetIndex").toInt(); - EMotionFX::MorphSetupInstance::MorphTarget* morphTargetInstance = mMorphTargets[morphTargetIndex].mMorphTargetInstance; + EMotionFX::MorphSetupInstance::MorphTarget* morphTargetInstance = m_morphTargets[morphTargetIndex].m_morphTargetInstance; // update the weight morphTargetInstance->SetWeight(aznumeric_cast(floatSlider->value())); @@ -211,22 +211,22 @@ namespace EMStudio // get the morph target and the morph target instance AzQtComponents::SliderDoubleCombo* floatSlider = static_cast(sender()); const int morphTargetIndex = floatSlider->property("MorphTargetIndex").toInt(); - EMotionFX::MorphTarget* morphTarget = mMorphTargets[morphTargetIndex].mMorphTarget; - EMotionFX::MorphSetupInstance::MorphTarget* morphTargetInstance = mMorphTargets[morphTargetIndex].mMorphTargetInstance; + EMotionFX::MorphTarget* morphTarget = m_morphTargets[morphTargetIndex].m_morphTarget; + EMotionFX::MorphSetupInstance::MorphTarget* morphTargetInstance = m_morphTargets[morphTargetIndex].m_morphTargetInstance; // set the old weight to have the undo correct - morphTargetInstance->SetWeight(mMorphTargets[morphTargetIndex].mOldWeight); + morphTargetInstance->SetWeight(m_morphTargets[morphTargetIndex].m_oldWeight); // execute command AZStd::string result; - const AZStd::string command = AZStd::string::format("AdjustMorphTarget -actorInstanceID %i -lodLevel %zu -name \"%s\" -weight %f", mActorInstance->GetID(), mActorInstance->GetLODLevel(), morphTarget->GetName(), floatSlider->value()); + const AZStd::string command = AZStd::string::format("AdjustMorphTarget -actorInstanceID %i -lodLevel %zu -name \"%s\" -weight %f", m_actorInstance->GetID(), m_actorInstance->GetLODLevel(), morphTarget->GetName(), floatSlider->value()); if (EMStudio::GetCommandManager()->ExecuteCommand(command, result) == false) { AZ_Error("EMotionFX", false, result.c_str()); } // set the new old weight value - mMorphTargets[morphTargetIndex].mOldWeight = aznumeric_cast(floatSlider->value()); + m_morphTargets[morphTargetIndex].m_oldWeight = aznumeric_cast(floatSlider->value()); } @@ -236,12 +236,12 @@ namespace EMStudio // get the morph target QPushButton* button = static_cast(sender()); const int morphTargetIndex = button->property("MorphTargetIndex").toInt(); - EMotionFX::MorphTarget* morphTarget = mMorphTargets[morphTargetIndex].mMorphTarget; + EMotionFX::MorphTarget* morphTarget = m_morphTargets[morphTargetIndex].m_morphTarget; // show the edit window - delete mEditWindow; - mEditWindow = new MorphTargetEditWindow(mActorInstance, morphTarget, this); - mEditWindow->exec(); + delete m_editWindow; + m_editWindow = new MorphTargetEditWindow(m_actorInstance, morphTarget, this); + m_editWindow->exec(); } @@ -250,13 +250,13 @@ namespace EMStudio { bool selectAllChecked = true; - const size_t numMorphTargets = mMorphTargets.size(); + const size_t numMorphTargets = m_morphTargets.size(); for (size_t i = 0; i < numMorphTargets; ++i) { - const float rangeMin = mMorphTargets[i].mMorphTarget->GetRangeMin(); - const float rangeMax = mMorphTargets[i].mMorphTarget->GetRangeMax(); - const float weight = mMorphTargets[i].mMorphTargetInstance->GetWeight(); - const bool manualMode = mMorphTargets[i].mMorphTargetInstance->GetIsInManualMode(); + const float rangeMin = m_morphTargets[i].m_morphTarget->GetRangeMin(); + const float rangeMax = m_morphTargets[i].m_morphTarget->GetRangeMax(); + const float weight = m_morphTargets[i].m_morphTargetInstance->GetWeight(); + const bool manualMode = m_morphTargets[i].m_morphTargetInstance->GetIsInManualMode(); // check if the select all should not be checked if (manualMode == false) @@ -265,82 +265,82 @@ namespace EMStudio } // disable signals - QSignalBlocker sb(mMorphTargets[i].mSliderWeight); - mMorphTargets[i].mManualMode->blockSignals(true); + QSignalBlocker sb(m_morphTargets[i].m_sliderWeight); + m_morphTargets[i].m_manualMode->blockSignals(true); // update the manual mode - mMorphTargets[i].mManualMode->setChecked(manualMode); + m_morphTargets[i].m_manualMode->setChecked(manualMode); // update the slider weight - mMorphTargets[i].mSliderWeight->setDisabled(!manualMode); - mMorphTargets[i].mSliderWeight->setRange(rangeMin, rangeMax); + m_morphTargets[i].m_sliderWeight->setDisabled(!manualMode); + m_morphTargets[i].m_sliderWeight->setRange(rangeMin, rangeMax); // enforce single step of 0.1 - mMorphTargets[i].mSliderWeight->slider()->setNumSteps(aznumeric_cast((rangeMax - rangeMin) / 0.1)); - mMorphTargets[i].mSliderWeight->setValue(weight); + m_morphTargets[i].m_sliderWeight->slider()->setNumSteps(aznumeric_cast((rangeMax - rangeMin) / 0.1)); + m_morphTargets[i].m_sliderWeight->setValue(weight); // enable signals - mMorphTargets[i].mManualMode->blockSignals(false); + m_morphTargets[i].m_manualMode->blockSignals(false); // store the current weight // the weight is updated in realtime but before to execute the adjust command it has to be reset to have the undo correct - mMorphTargets[i].mOldWeight = weight; + m_morphTargets[i].m_oldWeight = weight; } // update the select all - mSelectAll->blockSignals(true); - mSelectAll->setChecked(selectAllChecked); - mSelectAll->blockSignals(false); + m_selectAll->blockSignals(true); + m_selectAll->setChecked(selectAllChecked); + m_selectAll->blockSignals(false); // update the edit window - if (mEditWindow) + if (m_editWindow) { - mEditWindow->UpdateInterface(); + m_editWindow->UpdateInterface(); } } void MorphTargetGroupWidget::UpdateMorphTarget(const char* name) { // update the row - const size_t numMorphTargets = mMorphTargets.size(); + const size_t numMorphTargets = m_morphTargets.size(); for (size_t i = 0; i < numMorphTargets; ++i) { // continue of the name is not the same - if (mMorphTargets[i].mMorphTarget->GetNameString() != name) + if (m_morphTargets[i].m_morphTarget->GetNameString() != name) { continue; } // get values - const float rangeMin = mMorphTargets[i].mMorphTarget->GetRangeMin(); - const float rangeMax = mMorphTargets[i].mMorphTarget->GetRangeMax(); - const float weight = mMorphTargets[i].mMorphTargetInstance->GetWeight(); - const bool manualMode = mMorphTargets[i].mMorphTargetInstance->GetIsInManualMode(); + const float rangeMin = m_morphTargets[i].m_morphTarget->GetRangeMin(); + const float rangeMax = m_morphTargets[i].m_morphTarget->GetRangeMax(); + const float weight = m_morphTargets[i].m_morphTargetInstance->GetWeight(); + const bool manualMode = m_morphTargets[i].m_morphTargetInstance->GetIsInManualMode(); // disable signals - QSignalBlocker sb(mMorphTargets[i].mSliderWeight); - mMorphTargets[i].mManualMode->blockSignals(true); + QSignalBlocker sb(m_morphTargets[i].m_sliderWeight); + m_morphTargets[i].m_manualMode->blockSignals(true); // update the manual mode - mMorphTargets[i].mManualMode->setChecked(manualMode); + m_morphTargets[i].m_manualMode->setChecked(manualMode); // update the slider weight - mMorphTargets[i].mSliderWeight->setDisabled(!manualMode); - mMorphTargets[i].mSliderWeight->setRange(rangeMin, rangeMax); + m_morphTargets[i].m_sliderWeight->setDisabled(!manualMode); + m_morphTargets[i].m_sliderWeight->setRange(rangeMin, rangeMax); // enforce single step of 0.1 - mMorphTargets[i].mSliderWeight->slider()->setNumSteps(aznumeric_cast((rangeMax - rangeMin) / 0.1)); - mMorphTargets[i].mSliderWeight->setValue(weight); + m_morphTargets[i].m_sliderWeight->slider()->setNumSteps(aznumeric_cast((rangeMax - rangeMin) / 0.1)); + m_morphTargets[i].m_sliderWeight->setValue(weight); // enable signals - mMorphTargets[i].mManualMode->blockSignals(false); + m_morphTargets[i].m_manualMode->blockSignals(false); // store the current weight // the weight is updated in realtime but before to execute the adjust command it has to be reset to have the undo correct - mMorphTargets[i].mOldWeight = weight; + m_morphTargets[i].m_oldWeight = weight; // update edit window in case it's the edit of this morph target - if (mEditWindow && mEditWindow->GetMorphTarget() == mMorphTargets[i].mMorphTarget) + if (m_editWindow && m_editWindow->GetMorphTarget() == m_morphTargets[i].m_morphTarget) { - mEditWindow->UpdateInterface(); + m_editWindow->UpdateInterface(); } // stop here because we found it @@ -351,15 +351,15 @@ namespace EMStudio bool selectAllChecked = true; for (uint32 i = 0; i < numMorphTargets; ++i) { - if (mMorphTargets[i].mMorphTargetInstance->GetIsInManualMode() == false) + if (m_morphTargets[i].m_morphTargetInstance->GetIsInManualMode() == false) { selectAllChecked = false; break; } } - mSelectAll->blockSignals(true); - mSelectAll->setChecked(selectAllChecked); - mSelectAll->blockSignals(false); + m_selectAll->blockSignals(true); + m_selectAll->setChecked(selectAllChecked); + m_selectAll->blockSignals(false); } } // namespace EMStudio diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MorphTargetsWindow/MorphTargetGroupWidget.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MorphTargetsWindow/MorphTargetGroupWidget.h index 7a4bdb40b6..5e8519afcc 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MorphTargetsWindow/MorphTargetGroupWidget.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MorphTargetsWindow/MorphTargetGroupWidget.h @@ -39,16 +39,16 @@ namespace EMStudio struct MorphTarget { - EMotionFX::MorphTarget* mMorphTarget; - EMotionFX::MorphSetupInstance::MorphTarget* mMorphTargetInstance; - QCheckBox* mManualMode; - AzQtComponents::SliderDoubleCombo* mSliderWeight = nullptr; - float mOldWeight; + EMotionFX::MorphTarget* m_morphTarget; + EMotionFX::MorphSetupInstance::MorphTarget* m_morphTargetInstance; + QCheckBox* m_manualMode; + AzQtComponents::SliderDoubleCombo* m_sliderWeight = nullptr; + float m_oldWeight; }; void UpdateInterface(); void UpdateMorphTarget(const char* name); - const MorphTarget* GetMorphTarget(size_t index){ return &mMorphTargets[index]; } + const MorphTarget* GetMorphTarget(size_t index){ return &m_morphTargets[index]; } public slots: void SetManualModeForAll(int value); @@ -59,10 +59,10 @@ namespace EMStudio void ResetAll(); private: - AZStd::string mName; - EMotionFX::ActorInstance* mActorInstance; - QCheckBox* mSelectAll; - AZStd::vector mMorphTargets; - MorphTargetEditWindow* mEditWindow; + AZStd::string m_name; + EMotionFX::ActorInstance* m_actorInstance; + QCheckBox* m_selectAll; + AZStd::vector m_morphTargets; + MorphTargetEditWindow* m_editWindow; }; } // namespace EMStudio diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MorphTargetsWindow/MorphTargetsWindowPlugin.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MorphTargetsWindow/MorphTargetsWindowPlugin.cpp index ce8de9483a..1ceeb155fa 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MorphTargetsWindow/MorphTargetsWindowPlugin.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MorphTargetsWindow/MorphTargetsWindowPlugin.cpp @@ -22,9 +22,9 @@ namespace EMStudio MorphTargetsWindowPlugin::MorphTargetsWindowPlugin() : EMStudio::DockWidgetPlugin() { - mDialogStack = nullptr; - mCurrentActorInstance = nullptr; - mStaticTextWidget = nullptr; + m_dialogStack = nullptr; + m_currentActorInstance = nullptr; + m_staticTextWidget = nullptr; EMotionFX::ActorInstanceNotificationBus::Handler::BusConnect(); } @@ -43,7 +43,7 @@ namespace EMStudio Clear(); // delete the dialog stack - delete mDialogStack; + delete m_dialogStack; } @@ -59,19 +59,19 @@ namespace EMStudio bool MorphTargetsWindowPlugin::Init() { // create the static text layout - mStaticTextWidget = new QWidget(); - mStaticTextLayout = new QVBoxLayout(); - mStaticTextWidget->setLayout(mStaticTextLayout); + m_staticTextWidget = new QWidget(); + m_staticTextLayout = new QVBoxLayout(); + m_staticTextWidget->setLayout(m_staticTextLayout); QLabel* label = new QLabel("No morph targets to show."); - mStaticTextLayout->addWidget(label); - mStaticTextLayout->setAlignment(label, Qt::AlignCenter); + m_staticTextLayout->addWidget(label); + m_staticTextLayout->setAlignment(label, Qt::AlignCenter); // create the dialog stack - assert(mDialogStack == nullptr); - mDialogStack = new MysticQt::DialogStack(); - mDock->setMinimumWidth(300); - mDock->setMinimumHeight(100); - mDock->setWidget(mStaticTextWidget); + assert(m_dialogStack == nullptr); + m_dialogStack = new MysticQt::DialogStack(); + m_dock->setMinimumWidth(300); + m_dock->setMinimumHeight(100); + m_dock->setWidget(m_staticTextWidget); GetCommandManager()->RegisterCommandCallback("Select", m_callbacks, false); GetCommandManager()->RegisterCommandCallback("Unselect", m_callbacks, false); @@ -83,7 +83,7 @@ namespace EMStudio ReInit(); // connect the window activation signal to refresh if reactivated - connect(mDock, &QDockWidget::visibilityChanged, this, &MorphTargetsWindowPlugin::WindowReInit); + connect(m_dock, &QDockWidget::visibilityChanged, this, &MorphTargetsWindowPlugin::WindowReInit); // done return true; @@ -93,18 +93,18 @@ namespace EMStudio // clear the morph target window void MorphTargetsWindowPlugin::Clear() { - if (mDock) + if (m_dock) { - mDock->setWidget(mStaticTextWidget); + m_dock->setWidget(m_staticTextWidget); } // clear the dialog stack - if (mDialogStack) + if (m_dialogStack) { - mDialogStack->Clear(); + m_dialogStack->Clear(); } - mMorphTargetGroups.clear(); + m_morphTargetGroups.clear(); } // reinit the morph target dialog, e.g. if selection changes @@ -121,13 +121,13 @@ namespace EMStudio if (actorInstance == nullptr) { // set the dock contents - mDock->setWidget(mStaticTextWidget); + m_dock->setWidget(m_staticTextWidget); // clear dialog and reset the current actor instance as we cleared the window - if (mCurrentActorInstance) + if (m_currentActorInstance) { Clear(); - mCurrentActorInstance = nullptr; + m_currentActorInstance = nullptr; } // done @@ -135,10 +135,10 @@ namespace EMStudio } // only reinit the morph targets if actor instance changed - if (mCurrentActorInstance != actorInstance || forceReInit) + if (m_currentActorInstance != actorInstance || forceReInit) { // set the current actor instance in any case - mCurrentActorInstance = actorInstance; + m_currentActorInstance = actorInstance; // arrays for the default morph targets and the phonemes AZStd::vector phonemes; @@ -150,7 +150,7 @@ namespace EMStudio EMotionFX::MorphSetup* morphSetup = actor->GetMorphSetup(actorInstance->GetLODLevel()); if (morphSetup == nullptr) { - mDock->setWidget(mStaticTextWidget); + m_dock->setWidget(m_staticTextWidget); return; } @@ -158,7 +158,7 @@ namespace EMStudio EMotionFX::MorphSetupInstance* morphSetupInstance = actorInstance->GetMorphSetupInstance(); if (morphSetupInstance == nullptr) { - mDock->setWidget(mStaticTextWidget); + m_dock->setWidget(m_staticTextWidget); return; } @@ -217,11 +217,11 @@ namespace EMStudio // create static text if no morph targets are available if (defaultMorphTargets.empty() && phonemes.empty()) { - mDock->setWidget(mStaticTextWidget); + m_dock->setWidget(m_staticTextWidget); } else { - mDock->setWidget(mDialogStack); + m_dock->setWidget(m_dialogStack); } // adjust the slider values to the correct weights of the selected actor instance @@ -237,11 +237,11 @@ namespace EMStudio return; } - MorphTargetGroupWidget* morphTargetGroup = new MorphTargetGroupWidget(name, mCurrentActorInstance, morphTargets, morphTargetInstances, mDialogStack); + MorphTargetGroupWidget* morphTargetGroup = new MorphTargetGroupWidget(name, m_currentActorInstance, morphTargets, morphTargetInstances, m_dialogStack); morphTargetGroup->setObjectName("EMFX.MorphTargetsWindowPlugin.MorphTargetGroupWidget"); - mMorphTargetGroups.push_back(morphTargetGroup); + m_morphTargetGroups.push_back(morphTargetGroup); - mDialogStack->Add(morphTargetGroup, name); + m_dialogStack->Add(morphTargetGroup, name); } @@ -258,7 +258,7 @@ namespace EMStudio // update the interface void MorphTargetsWindowPlugin::UpdateInterface() { - for (MorphTargetGroupWidget* group : mMorphTargetGroups) + for (MorphTargetGroupWidget* group : m_morphTargetGroups) { group->UpdateInterface(); } @@ -268,7 +268,7 @@ namespace EMStudio // update the morph target void MorphTargetsWindowPlugin::UpdateMorphTarget(const char* name) { - for (MorphTargetGroupWidget* group : mMorphTargetGroups) + for (MorphTargetGroupWidget* group : m_morphTargetGroups) { group->UpdateMorphTarget(name); } @@ -276,7 +276,7 @@ namespace EMStudio void MorphTargetsWindowPlugin::OnActorInstanceDestroyed(EMotionFX::ActorInstance* actorInstance) { - if (mCurrentActorInstance == actorInstance) + if (m_currentActorInstance == actorInstance) { ReInit(/*actorInstance=*/nullptr); } diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MorphTargetsWindow/MorphTargetsWindowPlugin.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MorphTargetsWindow/MorphTargetsWindowPlugin.h index 4e81a24b39..d2295fcd9c 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MorphTargetsWindow/MorphTargetsWindowPlugin.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MorphTargetsWindow/MorphTargetsWindowPlugin.h @@ -60,7 +60,7 @@ namespace EMStudio // creates a new group with several morph targets void CreateGroup(const char* name, const AZStd::vector& morphTargets, const AZStd::vector& morphTargetInstances); - EMotionFX::ActorInstance* GetActorInstance() const { return mCurrentActorInstance; } + EMotionFX::ActorInstance* GetActorInstance() const { return m_currentActorInstance; } void UpdateInterface(); void UpdateMorphTarget(const char* name); @@ -82,15 +82,15 @@ namespace EMStudio AZStd::vector m_callbacks; // holds the generated groups for the morph targets - AZStd::vector mMorphTargetGroups; + AZStd::vector m_morphTargetGroups; // holds the currently selected actor instance - EMotionFX::ActorInstance* mCurrentActorInstance; + EMotionFX::ActorInstance* m_currentActorInstance; // some qt stuff - QVBoxLayout* mStaticTextLayout; - QWidget* mStaticTextWidget; - MysticQt::DialogStack* mDialogStack; - QLabel* mInfoText; + QVBoxLayout* m_staticTextLayout; + QWidget* m_staticTextWidget; + MysticQt::DialogStack* m_dialogStack; + QLabel* m_infoText; }; } // namespace EMStudio diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MorphTargetsWindow/PhonemeSelectionWindow.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MorphTargetsWindow/PhonemeSelectionWindow.cpp index 5619398c67..4f1aa5b42b 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MorphTargetsWindow/PhonemeSelectionWindow.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MorphTargetsWindow/PhonemeSelectionWindow.cpp @@ -34,25 +34,25 @@ namespace EMStudio VisimeWidget::VisimeWidget(const AZStd::string& filename) { // set the file name and size hints - mFileName = filename; - mSelected = false; - mMouseWithinWidget = false; + m_fileName = filename; + m_selected = false; + m_mouseWithinWidget = false; setMinimumHeight(60); setMaximumHeight(60); setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); // extract the pure filename - AzFramework::StringFunc::Path::GetFileName(filename.c_str(), mFileNameWithoutExt); + AzFramework::StringFunc::Path::GetFileName(filename.c_str(), m_fileNameWithoutExt); // load the pixmap - mPixmap = new QPixmap(filename.c_str()); + m_pixmap = new QPixmap(filename.c_str()); } // destructor VisimeWidget::~VisimeWidget() { - delete mPixmap; + delete m_pixmap; } @@ -82,11 +82,11 @@ namespace EMStudio painter.setPen(QColor(66, 66, 66)); // draw selection border - if (mSelected) + if (m_selected) { painter.setBrush(QBrush(QColor(244, 156, 28))); } - else if (mMouseWithinWidget) + else if (m_mouseWithinWidget) { painter.setBrush(QBrush(QColor(153, 160, 178))); } @@ -98,11 +98,11 @@ namespace EMStudio painter.drawRoundedRect(0, 2, width(), height() - 4, 5.0, 5.0); // draw background - if (mSelected) + if (m_selected) { painter.setBrush(QBrush(QColor(56, 65, 72))); } - else if (mMouseWithinWidget) + else if (m_mouseWithinWidget) { painter.setBrush(QBrush(QColor(134, 142, 150))); } @@ -115,10 +115,10 @@ namespace EMStudio painter.drawRoundedRect(2, 4, width() - 4, height() - 8, 5.0, 5.0); // draw visime image - painter.drawPixmap(5, 5, height() - 10, height() - 10, *mPixmap); + painter.drawPixmap(5, 5, height() - 10, height() - 10, *m_pixmap); // draw visime name - if (mSelected) + if (m_selected) { painter.setPen(QColor(244, 156, 28)); } @@ -128,7 +128,7 @@ namespace EMStudio } //painter.setFont( QFont("MS Shell Dlg 2", 8) ); - painter.drawText(70, (height() / 2) + 4, mFileNameWithoutExt.c_str()); + painter.drawText(70, (height() / 2) + 4, m_fileNameWithoutExt.c_str()); } @@ -140,11 +140,11 @@ namespace EMStudio setMinimumWidth(800); setMinimumHeight(450); - mActor = actor; - mMorphTarget = morphTarget; - mLODLevel = lodLevel; - mMorphSetup = actor->GetMorphSetup(lodLevel); - mDirtyFlag = false; + m_actor = actor; + m_morphTarget = morphTarget; + m_lodLevel = lodLevel; + m_morphSetup = actor->GetMorphSetup(lodLevel); + m_dirtyFlag = false; // init the dialog Init(); @@ -165,49 +165,49 @@ namespace EMStudio setSizeGripEnabled(false); // buttons to add / remove / clear phonemes - mAddPhonemesButton = new QPushButton(""); - mAddPhonemesButtonArrow = new QPushButton(""); - mRemovePhonemesButton = new QPushButton(""); - mRemovePhonemesButtonArrow = new QPushButton(""); - mClearPhonemesButton = new QPushButton(""); + m_addPhonemesButton = new QPushButton(""); + m_addPhonemesButtonArrow = new QPushButton(""); + m_removePhonemesButton = new QPushButton(""); + m_removePhonemesButtonArrow = new QPushButton(""); + m_clearPhonemesButton = new QPushButton(""); - EMStudioManager::MakeTransparentButton(mAddPhonemesButtonArrow, "Images/Icons/PlayForward.svg", "Assign the selected phonemes to the morph target."); - EMStudioManager::MakeTransparentButton(mRemovePhonemesButtonArrow, "Images/Icons/PlayBackward.svg", "Unassign the selected phonemes from the morph target."); - EMStudioManager::MakeTransparentButton(mAddPhonemesButton, "Images/Icons/Plus.svg", "Assign the selected phonemes to the morph target."); - EMStudioManager::MakeTransparentButton(mRemovePhonemesButton, "Images/Icons/Minus.svg", "Unassign the selected phonemes from the morph target."); - EMStudioManager::MakeTransparentButton(mClearPhonemesButton, "Images/Icons/Clear.svg", "Unassign all phonemes from the morph target."); + EMStudioManager::MakeTransparentButton(m_addPhonemesButtonArrow, "Images/Icons/PlayForward.svg", "Assign the selected phonemes to the morph target."); + EMStudioManager::MakeTransparentButton(m_removePhonemesButtonArrow, "Images/Icons/PlayBackward.svg", "Unassign the selected phonemes from the morph target."); + EMStudioManager::MakeTransparentButton(m_addPhonemesButton, "Images/Icons/Plus.svg", "Assign the selected phonemes to the morph target."); + EMStudioManager::MakeTransparentButton(m_removePhonemesButton, "Images/Icons/Minus.svg", "Unassign the selected phonemes from the morph target."); + EMStudioManager::MakeTransparentButton(m_clearPhonemesButton, "Images/Icons/Clear.svg", "Unassign all phonemes from the morph target."); // init the visime tables - mPossiblePhonemeSetsTable = new DragTableWidget(0, 1); - mSelectedPhonemeSetsTable = new DragTableWidget(0, 1); - mPossiblePhonemeSetsTable->setCornerButtonEnabled(false); - mPossiblePhonemeSetsTable->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); - mPossiblePhonemeSetsTable->setContextMenuPolicy(Qt::DefaultContextMenu); - mSelectedPhonemeSetsTable->setCornerButtonEnabled(false); - mSelectedPhonemeSetsTable->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); - mSelectedPhonemeSetsTable->setContextMenuPolicy(Qt::DefaultContextMenu); + m_possiblePhonemeSetsTable = new DragTableWidget(0, 1); + m_selectedPhonemeSetsTable = new DragTableWidget(0, 1); + m_possiblePhonemeSetsTable->setCornerButtonEnabled(false); + m_possiblePhonemeSetsTable->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); + m_possiblePhonemeSetsTable->setContextMenuPolicy(Qt::DefaultContextMenu); + m_selectedPhonemeSetsTable->setCornerButtonEnabled(false); + m_selectedPhonemeSetsTable->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); + m_selectedPhonemeSetsTable->setContextMenuPolicy(Qt::DefaultContextMenu); // set the table to row single selection - mPossiblePhonemeSetsTable->setSelectionBehavior(QAbstractItemView::SelectRows); - mSelectedPhonemeSetsTable->setSelectionBehavior(QAbstractItemView::SelectRows); + m_possiblePhonemeSetsTable->setSelectionBehavior(QAbstractItemView::SelectRows); + m_selectedPhonemeSetsTable->setSelectionBehavior(QAbstractItemView::SelectRows); // make the table items read only - mPossiblePhonemeSetsTable->setEditTriggers(QAbstractItemView::NoEditTriggers); - mSelectedPhonemeSetsTable->setEditTriggers(QAbstractItemView::NoEditTriggers); + m_possiblePhonemeSetsTable->setEditTriggers(QAbstractItemView::NoEditTriggers); + m_selectedPhonemeSetsTable->setEditTriggers(QAbstractItemView::NoEditTriggers); // resize to contents and adjust header - QHeaderView* verticalHeaderPossible = mPossiblePhonemeSetsTable->verticalHeader(); - QHeaderView* verticalHeaderSelected = mSelectedPhonemeSetsTable->verticalHeader(); - QHeaderView* horizontalHeaderPossible = mPossiblePhonemeSetsTable->horizontalHeader(); - QHeaderView* horizontalHeaderSelected = mSelectedPhonemeSetsTable->horizontalHeader(); + QHeaderView* verticalHeaderPossible = m_possiblePhonemeSetsTable->verticalHeader(); + QHeaderView* verticalHeaderSelected = m_selectedPhonemeSetsTable->verticalHeader(); + QHeaderView* horizontalHeaderPossible = m_possiblePhonemeSetsTable->horizontalHeader(); + QHeaderView* horizontalHeaderSelected = m_selectedPhonemeSetsTable->horizontalHeader(); verticalHeaderPossible->setVisible(false); verticalHeaderSelected->setVisible(false); horizontalHeaderPossible->setVisible(false); horizontalHeaderSelected->setVisible(false); // create the dialog stacks - mPossiblePhonemeSets = new MysticQt::DialogStack(this); - mSelectedPhonemeSets = new MysticQt::DialogStack(this); + m_possiblePhonemeSets = new MysticQt::DialogStack(this); + m_selectedPhonemeSets = new MysticQt::DialogStack(this); // create and fill the main layout QHBoxLayout* layout = new QHBoxLayout(); @@ -232,10 +232,10 @@ namespace EMStudio QHBoxLayout* buttonLayout = new QHBoxLayout(); buttonLayout->setSpacing(0); buttonLayout->setAlignment(Qt::AlignLeft); - buttonLayout->addWidget(mAddPhonemesButton); + buttonLayout->addWidget(m_addPhonemesButton); leftLayout->addLayout(buttonLayout); - leftLayout->addWidget(mPossiblePhonemeSetsTable); + leftLayout->addWidget(m_possiblePhonemeSetsTable); leftLayout->addWidget(labelHelperWidgetAdd); // the center layout @@ -244,8 +244,8 @@ namespace EMStudio // fill the center layout centerLayout->addWidget(seperatorLineTop); - centerLayout->addWidget(mAddPhonemesButtonArrow); - centerLayout->addWidget(mRemovePhonemesButtonArrow); + centerLayout->addWidget(m_addPhonemesButtonArrow); + centerLayout->addWidget(m_removePhonemesButtonArrow); centerLayout->addWidget(seperatorLineBottom); // the right layout and info label @@ -262,12 +262,12 @@ namespace EMStudio buttonLayout = new QHBoxLayout(); buttonLayout->setSpacing(0); buttonLayout->setAlignment(Qt::AlignLeft); - buttonLayout->addWidget(mRemovePhonemesButton); - buttonLayout->addWidget(mClearPhonemesButton); + buttonLayout->addWidget(m_removePhonemesButton); + buttonLayout->addWidget(m_clearPhonemesButton); // fill the right layozt rightLayout->addLayout(buttonLayout); - rightLayout->addWidget(mSelectedPhonemeSetsTable); + rightLayout->addWidget(m_selectedPhonemeSetsTable); rightLayout->addWidget(labelHelperWidgetRemove); @@ -285,13 +285,13 @@ namespace EMStudio helperWidgetRight->setLayout(rightLayout); // add helper widgets to the dialog stacks - mPossiblePhonemeSets->Add(helperWidgetLeft, "Possible Phoneme Sets", false, true, false); - mSelectedPhonemeSets->Add(helperWidgetRight, "Selected Phoneme Sets", false, true, false); + m_possiblePhonemeSets->Add(helperWidgetLeft, "Possible Phoneme Sets", false, true, false); + m_selectedPhonemeSets->Add(helperWidgetRight, "Selected Phoneme Sets", false, true, false); // add sublayouts to the main layout - layout->addWidget(mPossiblePhonemeSets); + layout->addWidget(m_possiblePhonemeSets); layout->addLayout(centerLayout); - layout->addWidget(mSelectedPhonemeSets); + layout->addWidget(m_selectedPhonemeSets); // set the main layout setLayout(layout); @@ -300,35 +300,35 @@ namespace EMStudio UpdateInterface(); // connect signals to the slots - connect(mPossiblePhonemeSetsTable, &DragTableWidget::itemSelectionChanged, this, &PhonemeSelectionWindow::PhonemeSelectionChanged); - connect(mSelectedPhonemeSetsTable, &DragTableWidget::itemSelectionChanged, this, &PhonemeSelectionWindow::PhonemeSelectionChanged); - connect(mPossiblePhonemeSetsTable, &DragTableWidget::dataDropped, this, &PhonemeSelectionWindow::RemoveSelectedPhonemeSets); - connect(mRemovePhonemesButton, &QPushButton::clicked, this, &PhonemeSelectionWindow::RemoveSelectedPhonemeSets); - connect(mRemovePhonemesButtonArrow, &QPushButton::clicked, this, &PhonemeSelectionWindow::RemoveSelectedPhonemeSets); - connect(mAddPhonemesButton, &QPushButton::clicked, this, &PhonemeSelectionWindow::AddSelectedPhonemeSets); - connect(mAddPhonemesButtonArrow, &QPushButton::clicked, this, &PhonemeSelectionWindow::AddSelectedPhonemeSets); - connect(mSelectedPhonemeSetsTable, &DragTableWidget::dataDropped, this, &PhonemeSelectionWindow::AddSelectedPhonemeSets); - connect(mClearPhonemesButton, &QPushButton::clicked, this, &PhonemeSelectionWindow::ClearSelectedPhonemeSets); - connect(mPossiblePhonemeSetsTable, &DragTableWidget::itemDoubleClicked, this, &PhonemeSelectionWindow::AddSelectedPhonemeSets); - connect(mSelectedPhonemeSetsTable, &DragTableWidget::itemDoubleClicked, this, &PhonemeSelectionWindow::RemoveSelectedPhonemeSets); + connect(m_possiblePhonemeSetsTable, &DragTableWidget::itemSelectionChanged, this, &PhonemeSelectionWindow::PhonemeSelectionChanged); + connect(m_selectedPhonemeSetsTable, &DragTableWidget::itemSelectionChanged, this, &PhonemeSelectionWindow::PhonemeSelectionChanged); + connect(m_possiblePhonemeSetsTable, &DragTableWidget::dataDropped, this, &PhonemeSelectionWindow::RemoveSelectedPhonemeSets); + connect(m_removePhonemesButton, &QPushButton::clicked, this, &PhonemeSelectionWindow::RemoveSelectedPhonemeSets); + connect(m_removePhonemesButtonArrow, &QPushButton::clicked, this, &PhonemeSelectionWindow::RemoveSelectedPhonemeSets); + connect(m_addPhonemesButton, &QPushButton::clicked, this, &PhonemeSelectionWindow::AddSelectedPhonemeSets); + connect(m_addPhonemesButtonArrow, &QPushButton::clicked, this, &PhonemeSelectionWindow::AddSelectedPhonemeSets); + connect(m_selectedPhonemeSetsTable, &DragTableWidget::dataDropped, this, &PhonemeSelectionWindow::AddSelectedPhonemeSets); + connect(m_clearPhonemesButton, &QPushButton::clicked, this, &PhonemeSelectionWindow::ClearSelectedPhonemeSets); + connect(m_possiblePhonemeSetsTable, &DragTableWidget::itemDoubleClicked, this, &PhonemeSelectionWindow::AddSelectedPhonemeSets); + connect(m_selectedPhonemeSetsTable, &DragTableWidget::itemDoubleClicked, this, &PhonemeSelectionWindow::RemoveSelectedPhonemeSets); } void PhonemeSelectionWindow::UpdateInterface() { // return if morph setup is not valid - if (mMorphSetup == nullptr) + if (m_morphSetup == nullptr) { return; } // clear the tables - mPossiblePhonemeSetsTable->clear(); - mSelectedPhonemeSetsTable->clear(); + m_possiblePhonemeSetsTable->clear(); + m_selectedPhonemeSetsTable->clear(); // get number of morph targets - const size_t numMorphTargets = mMorphSetup->GetNumMorphTargets(); - const uint32 numPhonemeSets = mMorphTarget->GetNumAvailablePhonemeSets(); + const size_t numMorphTargets = m_morphSetup->GetNumMorphTargets(); + const uint32 numPhonemeSets = m_morphTarget->GetNumAvailablePhonemeSets(); int insertPosition = 0; for (int i = 1; i < numPhonemeSets; ++i) { @@ -336,7 +336,7 @@ namespace EMStudio bool phonemeSetFound = false; for (size_t j = 0; j < numMorphTargets; ++j) { - EMotionFX::MorphTarget* morphTarget = mMorphSetup->GetMorphTarget(j); + EMotionFX::MorphTarget* morphTarget = m_morphSetup->GetMorphTarget(j); if (morphTarget->GetIsPhonemeSetEnabled((EMotionFX::MorphTarget::EPhonemeSet)(1 << i))) { phonemeSetFound = true; @@ -352,69 +352,69 @@ namespace EMStudio // get the phoneme set name EMotionFX::MorphTarget::EPhonemeSet phonemeSet = (EMotionFX::MorphTarget::EPhonemeSet)(1 << i); - const AZStd::string phonemeSetName = mMorphTarget->GetPhonemeSetString(phonemeSet).c_str(); + const AZStd::string phonemeSetName = m_morphTarget->GetPhonemeSetString(phonemeSet).c_str(); // set the row count for the possible phoneme sets table - mPossiblePhonemeSetsTable->setRowCount(insertPosition + 1); + m_possiblePhonemeSetsTable->setRowCount(insertPosition + 1); // create dummy table widget item. QTableWidgetItem* item = new QTableWidgetItem(phonemeSetName.c_str()); item->setToolTip(GetPhonemeSetExample(phonemeSet)); - mPossiblePhonemeSetsTable->setItem(insertPosition, 0, item); + m_possiblePhonemeSetsTable->setItem(insertPosition, 0, item); // create the visime widget and add it to the table const AZStd::string filename = AZStd::string::format("%s/Images/Visimes/%s.png", MysticQt::GetDataDir().c_str(), phonemeSetName.c_str()); VisimeWidget* visimeWidget = new VisimeWidget(filename); - mPossiblePhonemeSetsTable->setCellWidget(insertPosition, 0, visimeWidget); + m_possiblePhonemeSetsTable->setCellWidget(insertPosition, 0, visimeWidget); // set row and column properties - mPossiblePhonemeSetsTable->setRowHeight(insertPosition, visimeWidget->height() + 2); + m_possiblePhonemeSetsTable->setRowHeight(insertPosition, visimeWidget->height() + 2); // increase insert position ++insertPosition; } // fill the table with the selected phoneme sets - const AZStd::string selectedPhonemeSets = mMorphTarget->GetPhonemeSetString(mMorphTarget->GetPhonemeSets()); + const AZStd::string selectedPhonemeSets = m_morphTarget->GetPhonemeSetString(m_morphTarget->GetPhonemeSets()); AZStd::vector splittedPhonemeSets; AzFramework::StringFunc::Tokenize(selectedPhonemeSets.c_str(), splittedPhonemeSets, MCore::CharacterConstants::comma, true /* keep empty strings */, true /* keep space strings */); const int numSelectedPhonemeSets = aznumeric_caster(splittedPhonemeSets.size()); - mSelectedPhonemeSetsTable->setRowCount(numSelectedPhonemeSets); + m_selectedPhonemeSetsTable->setRowCount(numSelectedPhonemeSets); for (int i = 0; i < numSelectedPhonemeSets; ++i) { // create dummy table widget item. - const EMotionFX::MorphTarget::EPhonemeSet phonemeSet = mMorphTarget->FindPhonemeSet(splittedPhonemeSets[i].c_str()); + const EMotionFX::MorphTarget::EPhonemeSet phonemeSet = m_morphTarget->FindPhonemeSet(splittedPhonemeSets[i].c_str()); QTableWidgetItem* item = new QTableWidgetItem(splittedPhonemeSets[i].c_str()); item->setToolTip(GetPhonemeSetExample(phonemeSet)); - mSelectedPhonemeSetsTable->setItem(i, 0, item); + m_selectedPhonemeSetsTable->setItem(i, 0, item); // create the visime widget and add it to the table const AZStd::string filename = AZStd::string::format("%s/Images/Visimes/%s.png", MysticQt::GetDataDir().c_str(), splittedPhonemeSets[i].c_str()); VisimeWidget* visimeWidget = new VisimeWidget(filename); - mSelectedPhonemeSetsTable->setCellWidget(i, 0, visimeWidget); + m_selectedPhonemeSetsTable->setCellWidget(i, 0, visimeWidget); // set row and column properties - mSelectedPhonemeSetsTable->setRowHeight(i, visimeWidget->height() + 2); + m_selectedPhonemeSetsTable->setRowHeight(i, visimeWidget->height() + 2); } // stretch last section of the tables and disable horizontal header - QHeaderView* horizontalHeaderSelected = mSelectedPhonemeSetsTable->horizontalHeader(); + QHeaderView* horizontalHeaderSelected = m_selectedPhonemeSetsTable->horizontalHeader(); horizontalHeaderSelected->setVisible(false); horizontalHeaderSelected->setStretchLastSection(true); - QHeaderView* horizontalHeaderPossible = mPossiblePhonemeSetsTable->horizontalHeader(); + QHeaderView* horizontalHeaderPossible = m_possiblePhonemeSetsTable->horizontalHeader(); horizontalHeaderPossible->setVisible(false); horizontalHeaderPossible->setStretchLastSection(true); // disable/enable buttons upon reinit of the tables - mAddPhonemesButton->setDisabled(true); - mAddPhonemesButtonArrow->setDisabled(true); - mRemovePhonemesButton->setDisabled(true); - mRemovePhonemesButtonArrow->setDisabled(true); - mClearPhonemesButton->setDisabled(mSelectedPhonemeSetsTable->rowCount() == 0); + m_addPhonemesButton->setDisabled(true); + m_addPhonemesButtonArrow->setDisabled(true); + m_removePhonemesButton->setDisabled(true); + m_removePhonemesButtonArrow->setDisabled(true); + m_clearPhonemesButton->setDisabled(m_selectedPhonemeSetsTable->rowCount() == 0); } @@ -426,15 +426,15 @@ namespace EMStudio // disable/enable buttons bool selected = !table->selectedItems().empty(); - if (table == mPossiblePhonemeSetsTable) + if (table == m_possiblePhonemeSetsTable) { - mAddPhonemesButton->setDisabled(!selected); - mAddPhonemesButtonArrow->setDisabled(!selected); + m_addPhonemesButton->setDisabled(!selected); + m_addPhonemesButtonArrow->setDisabled(!selected); } else { - mRemovePhonemesButton->setDisabled(!selected); - mRemovePhonemesButtonArrow->setDisabled(!selected); + m_removePhonemesButton->setDisabled(!selected); + m_removePhonemesButtonArrow->setDisabled(!selected); } // adjust selection state of the cell widgetsmActor @@ -461,7 +461,7 @@ namespace EMStudio // removes the selected phoneme sets void PhonemeSelectionWindow::RemoveSelectedPhonemeSets() { - QList selectedItems = mSelectedPhonemeSetsTable->selectedItems(); + QList selectedItems = m_selectedPhonemeSetsTable->selectedItems(); if (selectedItems.empty()) { return; @@ -475,7 +475,7 @@ namespace EMStudio } // call command to remove selected the phoneme sets - const AZStd::string command = AZStd::string::format("AdjustMorphTarget -actorID %i -lodLevel %zu -name \"%s\" -phonemeAction \"remove\" -phonemeSets \"%s\"", mActor->GetID(), mLODLevel, mMorphTarget->GetName(), phonemeSets.c_str()); + const AZStd::string command = AZStd::string::format("AdjustMorphTarget -actorID %i -lodLevel %zu -name \"%s\" -phonemeAction \"remove\" -phonemeSets \"%s\"", m_actor->GetID(), m_lodLevel, m_morphTarget->GetName(), phonemeSets.c_str()); AZStd::string result; if (!EMStudio::GetCommandManager()->ExecuteCommand(command, result)) @@ -484,7 +484,7 @@ namespace EMStudio } else { - mDirtyFlag = true; + m_dirtyFlag = true; } } @@ -492,7 +492,7 @@ namespace EMStudio // adds the selected phoneme sets void PhonemeSelectionWindow::AddSelectedPhonemeSets() { - QList selectedItems = mSelectedPhonemeSetsTable->selectedItems(); + QList selectedItems = m_selectedPhonemeSetsTable->selectedItems(); if (selectedItems.empty()) { return; @@ -506,7 +506,7 @@ namespace EMStudio } // call command to add the selected phoneme sets - const AZStd::string command = AZStd::string::format("AdjustMorphTarget -actorID %i -lodLevel %zu -name \"%s\" -phonemeAction \"add\" -phonemeSets \"%s\"", mActor->GetID(), mLODLevel, mMorphTarget->GetName(), phonemeSets.c_str()); + const AZStd::string command = AZStd::string::format("AdjustMorphTarget -actorID %i -lodLevel %zu -name \"%s\" -phonemeAction \"add\" -phonemeSets \"%s\"", m_actor->GetID(), m_lodLevel, m_morphTarget->GetName(), phonemeSets.c_str()); AZStd::string result; if (!EMStudio::GetCommandManager()->ExecuteCommand(command, result)) @@ -515,7 +515,7 @@ namespace EMStudio } else { - mDirtyFlag = true; + m_dirtyFlag = true; } } @@ -523,7 +523,7 @@ namespace EMStudio // clear the selected phoneme sets void PhonemeSelectionWindow::ClearSelectedPhonemeSets() { - const AZStd::string command = AZStd::string::format("AdjustMorphTarget -actorID %i -lodLevel %zu -name \"%s\" -phonemeAction \"clear\"", mActor->GetID(), mLODLevel, mMorphTarget->GetName()); + const AZStd::string command = AZStd::string::format("AdjustMorphTarget -actorID %i -lodLevel %zu -name \"%s\" -phonemeAction \"clear\"", m_actor->GetID(), m_lodLevel, m_morphTarget->GetName()); AZStd::string result; if (!EMStudio::GetCommandManager()->ExecuteCommand(command, result)) @@ -532,7 +532,7 @@ namespace EMStudio } else { - mDirtyFlag = true; + m_dirtyFlag = true; } } @@ -590,7 +590,7 @@ namespace EMStudio MCORE_UNUSED(event); // check if something changed - if (mDirtyFlag == false) + if (m_dirtyFlag == false) { return; } diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MorphTargetsWindow/PhonemeSelectionWindow.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MorphTargetsWindow/PhonemeSelectionWindow.h index a6bffffb75..80f0d9b19e 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MorphTargetsWindow/PhonemeSelectionWindow.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MorphTargetsWindow/PhonemeSelectionWindow.h @@ -91,19 +91,19 @@ namespace EMStudio VisimeWidget(const AZStd::string& filename); virtual ~VisimeWidget(); - void SetSelected(bool selected = true) { mSelected = selected; } + void SetSelected(bool selected = true) { m_selected = selected; } void UpdateInterface(); void paintEvent(QPaintEvent* event) override; - void enterEvent(QEvent* event) override { MCORE_UNUSED(event); mMouseWithinWidget = true; repaint(); } - void leaveEvent(QEvent* event) override { MCORE_UNUSED(event); mMouseWithinWidget = false; repaint(); } + void enterEvent(QEvent* event) override { MCORE_UNUSED(event); m_mouseWithinWidget = true; repaint(); } + void leaveEvent(QEvent* event) override { MCORE_UNUSED(event); m_mouseWithinWidget = false; repaint(); } private: - AZStd::string mFileName; - AZStd::string mFileNameWithoutExt; - QPixmap* mPixmap; - bool mSelected; - bool mMouseWithinWidget; + AZStd::string m_fileName; + AZStd::string m_fileNameWithoutExt; + QPixmap* m_pixmap; + bool m_selected; + bool m_mouseWithinWidget; }; @@ -138,23 +138,23 @@ namespace EMStudio private: // the morph target - EMotionFX::Actor* mActor; - EMotionFX::MorphTarget* mMorphTarget; - size_t mLODLevel; - EMotionFX::MorphSetup* mMorphSetup; + EMotionFX::Actor* m_actor; + EMotionFX::MorphTarget* m_morphTarget; + size_t m_lodLevel; + EMotionFX::MorphSetup* m_morphSetup; // the dialogstacks - MysticQt::DialogStack* mPossiblePhonemeSets; - MysticQt::DialogStack* mSelectedPhonemeSets; - DragTableWidget* mPossiblePhonemeSetsTable; - DragTableWidget* mSelectedPhonemeSetsTable; + MysticQt::DialogStack* m_possiblePhonemeSets; + MysticQt::DialogStack* m_selectedPhonemeSets; + DragTableWidget* m_possiblePhonemeSetsTable; + DragTableWidget* m_selectedPhonemeSetsTable; - QPushButton* mAddPhonemesButton; - QPushButton* mRemovePhonemesButton; - QPushButton* mClearPhonemesButton; - QPushButton* mAddPhonemesButtonArrow; - QPushButton* mRemovePhonemesButtonArrow; + QPushButton* m_addPhonemesButton; + QPushButton* m_removePhonemesButton; + QPushButton* m_clearPhonemesButton; + QPushButton* m_addPhonemesButtonArrow; + QPushButton* m_removePhonemesButtonArrow; - bool mDirtyFlag; + bool m_dirtyFlag; }; } // namespace EMStudio diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionEvents/MotionEventPresetsWidget.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionEvents/MotionEventPresetsWidget.cpp index 9432ad1d78..e0e9455770 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionEvents/MotionEventPresetsWidget.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionEvents/MotionEventPresetsWidget.cpp @@ -33,7 +33,7 @@ namespace EMStudio { MotionEventPresetsWidget::MotionEventPresetsWidget(QWidget* parent, MotionEventsPlugin* plugin) : QWidget(parent) - , mPlugin(plugin) + , m_plugin(plugin) { Init(); } @@ -48,17 +48,17 @@ namespace EMStudio layout->setSpacing(2); // create the table widget - mTableWidget = new DragTableWidget(0, 2, nullptr); - mTableWidget->setCornerButtonEnabled(false); - mTableWidget->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); - mTableWidget->setContextMenuPolicy(Qt::DefaultContextMenu); - mTableWidget->setShowGrid(false); + m_tableWidget = new DragTableWidget(0, 2, nullptr); + m_tableWidget->setCornerButtonEnabled(false); + m_tableWidget->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); + m_tableWidget->setContextMenuPolicy(Qt::DefaultContextMenu); + m_tableWidget->setShowGrid(false); // set the table to row single selection - mTableWidget->setSelectionBehavior(QAbstractItemView::SelectRows); - mTableWidget->setSelectionMode(QAbstractItemView::ExtendedSelection); + m_tableWidget->setSelectionBehavior(QAbstractItemView::SelectRows); + m_tableWidget->setSelectionMode(QAbstractItemView::ExtendedSelection); - QHeaderView* horizontalHeader = mTableWidget->horizontalHeader(); + QHeaderView* horizontalHeader = m_tableWidget->horizontalHeader(); horizontalHeader->setStretchLastSection(true); horizontalHeader->setVisible(false); @@ -89,15 +89,15 @@ namespace EMStudio } layout->addWidget(toolBar); - layout->addWidget(mTableWidget); + layout->addWidget(m_tableWidget); layout->addLayout(ioButtonsLayout); // set the main layout setLayout(layout); // connect the signals and the slots - connect(mTableWidget, &MotionEventPresetsWidget::DragTableWidget::itemSelectionChanged, this, &MotionEventPresetsWidget::SelectionChanged); - connect(mTableWidget, &QTableWidget::cellDoubleClicked, this, [this](int row, int column) + connect(m_tableWidget, &MotionEventPresetsWidget::DragTableWidget::itemSelectionChanged, this, &MotionEventPresetsWidget::SelectionChanged); + connect(m_tableWidget, &QTableWidget::cellDoubleClicked, this, [this](int row, int column) { AZ_UNUSED(column); MotionEventPreset* preset = GetEventPresetManager()->GetPreset(row); @@ -108,7 +108,7 @@ namespace EMStudio GetEventPresetManager()->SetDirtyFlag(true); ReInit(); - mPlugin->FireColorChangedSignal(); + m_plugin->FireColorChangedSignal(); } }); @@ -116,14 +116,14 @@ namespace EMStudio // initialize everything ReInit(); UpdateInterface(); - mPlugin->ReInit(); + m_plugin->ReInit(); } void MotionEventPresetsWidget::ReInit() { // Remember selected items - QList selectedItems = mTableWidget->selectedItems(); + QList selectedItems = m_tableWidget->selectedItems(); AZStd::vector selectedRows; selectedRows.reserve(selectedItems.size()); for (const QTableWidgetItem* selectedItem : selectedItems) @@ -133,11 +133,11 @@ namespace EMStudio } // clear the table widget - mTableWidget->clear(); - mTableWidget->setColumnCount(2); + m_tableWidget->clear(); + m_tableWidget->setColumnCount(2); const size_t numEventPresets = GetEventPresetManager()->GetNumPresets(); - mTableWidget->setRowCount(static_cast(numEventPresets)); + m_tableWidget->setRowCount(static_cast(numEventPresets)); // set header items for the table QTableWidgetItem* colorHeaderItem = new QTableWidgetItem("Color"); @@ -145,11 +145,11 @@ namespace EMStudio colorHeaderItem->setTextAlignment(Qt::AlignVCenter | Qt::AlignLeft); presetNameHeaderItem->setTextAlignment(Qt::AlignVCenter | Qt::AlignLeft); - mTableWidget->setHorizontalHeaderItem(0, colorHeaderItem); - mTableWidget->setHorizontalHeaderItem(1, presetNameHeaderItem); + m_tableWidget->setHorizontalHeaderItem(0, colorHeaderItem); + m_tableWidget->setHorizontalHeaderItem(1, presetNameHeaderItem); - mTableWidget->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Fixed); - mTableWidget->setColumnWidth(0, 39); + m_tableWidget->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Fixed); + m_tableWidget->setColumnWidth(0, 39); for (AZ::u32 i = 0; i < numEventPresets; ++i) { @@ -173,8 +173,8 @@ namespace EMStudio tableItemColor->setWhatsThis(whatsThisString.c_str()); tableItemPresetName->setWhatsThis(whatsThisString.c_str()); - mTableWidget->setItem(i, 0, tableItemColor); - mTableWidget->setItem(i, 1, tableItemPresetName); + m_tableWidget->setItem(i, 0, tableItemColor); + m_tableWidget->setItem(i, 1, tableItemPresetName); // Editing will be handled in the double click signal handler tableItemPresetName->setFlags(tableItemPresetName->flags() ^ Qt::ItemIsEditable); @@ -188,23 +188,23 @@ namespace EMStudio } // set the vertical header not visible - QHeaderView* verticalHeader = mTableWidget->verticalHeader(); + QHeaderView* verticalHeader = m_tableWidget->verticalHeader(); verticalHeader->setVisible(false); - mTableWidget->resizeColumnToContents(1); - mTableWidget->resizeColumnToContents(2); + m_tableWidget->resizeColumnToContents(1); + m_tableWidget->resizeColumnToContents(2); - if (mTableWidget->columnWidth(1) < 36) + if (m_tableWidget->columnWidth(1) < 36) { - mTableWidget->setColumnWidth(1, 36); + m_tableWidget->setColumnWidth(1, 36); } - if (mTableWidget->columnWidth(2) < 70) + if (m_tableWidget->columnWidth(2) < 70) { - mTableWidget->setColumnWidth(2, 70); + m_tableWidget->setColumnWidth(2, 70); } - mTableWidget->horizontalHeader()->setStretchLastSection(true); + m_tableWidget->horizontalHeader()->setStretchLastSection(true); // update the interface UpdateInterface(); @@ -243,7 +243,7 @@ namespace EMStudio void MotionEventPresetsWidget::RemoveSelectedMotionEventPresets() { - QList selectedItems = mTableWidget->selectedItems(); + QList selectedItems = m_tableWidget->selectedItems(); if (selectedItems.isEmpty()) { ClearMotionEventPresetsButton(); @@ -272,13 +272,13 @@ namespace EMStudio ReInit(); // selected the next row - if (firstSelectedRow > (mTableWidget->rowCount() - 1)) + if (firstSelectedRow > (m_tableWidget->rowCount() - 1)) { - mTableWidget->selectRow(firstSelectedRow - 1); + m_tableWidget->selectRow(firstSelectedRow - 1); } else { - mTableWidget->selectRow(firstSelectedRow); + m_tableWidget->selectRow(firstSelectedRow); } } @@ -303,7 +303,7 @@ namespace EMStudio void MotionEventPresetsWidget::ClearMotionEventPresets() { - mTableWidget->selectAll(); + m_tableWidget->selectAll(); RemoveSelectedMotionEventPresets(); UpdateInterface(); } @@ -329,7 +329,7 @@ namespace EMStudio ReInit(); UpdateInterface(); - mPlugin->ReInit(); + m_plugin->ReInit(); } @@ -366,7 +366,7 @@ namespace EMStudio void MotionEventPresetsWidget::contextMenuEvent(QContextMenuEvent* event) { - QList selectedItems = mTableWidget->selectedItems(); + QList selectedItems = m_tableWidget->selectedItems(); if (selectedItems.isEmpty()) { return; diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionEvents/MotionEventPresetsWidget.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionEvents/MotionEventPresetsWidget.h index 331780fe19..8d36f57c25 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionEvents/MotionEventPresetsWidget.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionEvents/MotionEventPresetsWidget.h @@ -46,7 +46,7 @@ namespace EMStudio void Init(); void UpdateInterface(); - QTableWidget* GetMotionEventPresetsTable() { return mTableWidget; } + QTableWidget* GetMotionEventPresetsTable() { return m_tableWidget; } public slots: void ReInit(); @@ -93,12 +93,12 @@ namespace EMStudio } }; - DragTableWidget* mTableWidget = nullptr; + DragTableWidget* m_tableWidget = nullptr; QAction* m_addAction = nullptr; QAction* m_saveMenuAction = nullptr; QAction* m_saveAction = nullptr; QAction* m_saveAsAction = nullptr; QAction* m_loadAction = nullptr; - MotionEventsPlugin* mPlugin = nullptr; + MotionEventsPlugin* m_plugin = nullptr; }; } // namespace EMStudio diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionEvents/MotionEventsPlugin.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionEvents/MotionEventsPlugin.cpp index 193fbec9e3..316b2017cc 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionEvents/MotionEventsPlugin.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionEvents/MotionEventsPlugin.cpp @@ -25,34 +25,34 @@ namespace EMStudio { MotionEventsPlugin::MotionEventsPlugin() : EMStudio::DockWidgetPlugin() - , mAdjustMotionCallback(nullptr) - , mSelectCallback(nullptr) - , mUnselectCallback(nullptr) - , mClearSelectionCallback(nullptr) - , mDialogStack(nullptr) - , mMotionEventPresetsWidget(nullptr) - , mMotionEventWidget(nullptr) - , mMotionTable(nullptr) - , mTimeViewPlugin(nullptr) - , mTrackHeaderWidget(nullptr) - , mTrackDataWidget(nullptr) - , mMotionWindowPlugin(nullptr) - , mMotionListWindow(nullptr) - , mMotion(nullptr) + , m_adjustMotionCallback(nullptr) + , m_selectCallback(nullptr) + , m_unselectCallback(nullptr) + , m_clearSelectionCallback(nullptr) + , m_dialogStack(nullptr) + , m_motionEventPresetsWidget(nullptr) + , m_motionEventWidget(nullptr) + , m_motionTable(nullptr) + , m_timeViewPlugin(nullptr) + , m_trackHeaderWidget(nullptr) + , m_trackDataWidget(nullptr) + , m_motionWindowPlugin(nullptr) + , m_motionListWindow(nullptr) + , m_motion(nullptr) { } MotionEventsPlugin::~MotionEventsPlugin() { - GetCommandManager()->RemoveCommandCallback(mAdjustMotionCallback, false); - GetCommandManager()->RemoveCommandCallback(mSelectCallback, false); - GetCommandManager()->RemoveCommandCallback(mUnselectCallback, false); - GetCommandManager()->RemoveCommandCallback(mClearSelectionCallback, false); - delete mAdjustMotionCallback; - delete mSelectCallback; - delete mUnselectCallback; - delete mClearSelectionCallback; + GetCommandManager()->RemoveCommandCallback(m_adjustMotionCallback, false); + GetCommandManager()->RemoveCommandCallback(m_selectCallback, false); + GetCommandManager()->RemoveCommandCallback(m_unselectCallback, false); + GetCommandManager()->RemoveCommandCallback(m_clearSelectionCallback, false); + delete m_adjustMotionCallback; + delete m_selectCallback; + delete m_unselectCallback; + delete m_clearSelectionCallback; } @@ -74,12 +74,12 @@ namespace EMStudio { if (classID == TimeViewPlugin::CLASS_ID) { - mTimeViewPlugin = nullptr; + m_timeViewPlugin = nullptr; } if (classID == MotionWindowPlugin::CLASS_ID) { - mMotionWindowPlugin = nullptr; + m_motionWindowPlugin = nullptr; } } @@ -91,28 +91,28 @@ namespace EMStudio GetEventPresetManager()->Load(); // create callbacks - mAdjustMotionCallback = new CommandAdjustMotionCallback(false); - mSelectCallback = new CommandSelectCallback(false); - mUnselectCallback = new CommandUnselectCallback(false); - mClearSelectionCallback = new CommandClearSelectionCallback(false); - GetCommandManager()->RegisterCommandCallback("AdjustMotion", mAdjustMotionCallback); - GetCommandManager()->RegisterCommandCallback("Select", mSelectCallback); - GetCommandManager()->RegisterCommandCallback("Unselect", mUnselectCallback); - GetCommandManager()->RegisterCommandCallback("ClearSelection", mClearSelectionCallback); + m_adjustMotionCallback = new CommandAdjustMotionCallback(false); + m_selectCallback = new CommandSelectCallback(false); + m_unselectCallback = new CommandUnselectCallback(false); + m_clearSelectionCallback = new CommandClearSelectionCallback(false); + GetCommandManager()->RegisterCommandCallback("AdjustMotion", m_adjustMotionCallback); + GetCommandManager()->RegisterCommandCallback("Select", m_selectCallback); + GetCommandManager()->RegisterCommandCallback("Unselect", m_unselectCallback); + GetCommandManager()->RegisterCommandCallback("ClearSelection", m_clearSelectionCallback); // create the dialog stack - assert(mDialogStack == nullptr); - mDialogStack = new MysticQt::DialogStack(mDock); - mDock->setWidget(mDialogStack); + assert(m_dialogStack == nullptr); + m_dialogStack = new MysticQt::DialogStack(m_dock); + m_dock->setWidget(m_dialogStack); // create the motion event presets widget - mMotionEventPresetsWidget = new MotionEventPresetsWidget(mDialogStack, this); - mDialogStack->Add(mMotionEventPresetsWidget, "Motion Event Presets", false, true); - connect(mDock, &QDockWidget::visibilityChanged, this, &MotionEventsPlugin::WindowReInit); + m_motionEventPresetsWidget = new MotionEventPresetsWidget(m_dialogStack, this); + m_dialogStack->Add(m_motionEventPresetsWidget, "Motion Event Presets", false, true); + connect(m_dock, &QDockWidget::visibilityChanged, this, &MotionEventsPlugin::WindowReInit); // create the motion event properties widget - mMotionEventWidget = new MotionEventWidget(mDialogStack); - mDialogStack->Add(mMotionEventWidget, "Motion Event Properties", false, true); + m_motionEventWidget = new MotionEventWidget(m_dialogStack); + m_dialogStack->Add(m_motionEventWidget, "Motion Event Properties", false, true); ValidatePluginLinks(); UpdateMotionEventWidget(); @@ -123,30 +123,30 @@ namespace EMStudio void MotionEventsPlugin::ValidatePluginLinks() { - if (!mTimeViewPlugin) + if (!m_timeViewPlugin) { EMStudioPlugin* timeViewBasePlugin = EMStudio::GetPluginManager()->FindActivePlugin(TimeViewPlugin::CLASS_ID); if (timeViewBasePlugin) { - mTimeViewPlugin = (TimeViewPlugin*)timeViewBasePlugin; - mTrackDataWidget = mTimeViewPlugin->GetTrackDataWidget(); - mTrackHeaderWidget = mTimeViewPlugin->GetTrackHeaderWidget(); + m_timeViewPlugin = (TimeViewPlugin*)timeViewBasePlugin; + m_trackDataWidget = m_timeViewPlugin->GetTrackDataWidget(); + m_trackHeaderWidget = m_timeViewPlugin->GetTrackHeaderWidget(); - connect(mTrackDataWidget, &TrackDataWidget::MotionEventPresetsDropped, this, &MotionEventsPlugin::OnEventPresetDropped); - connect(mTimeViewPlugin, &TimeViewPlugin::SelectionChanged, this, &MotionEventsPlugin::UpdateMotionEventWidget); - connect(this, &MotionEventsPlugin::OnColorChanged, mTimeViewPlugin, &TimeViewPlugin::ReInit); + connect(m_trackDataWidget, &TrackDataWidget::MotionEventPresetsDropped, this, &MotionEventsPlugin::OnEventPresetDropped); + connect(m_timeViewPlugin, &TimeViewPlugin::SelectionChanged, this, &MotionEventsPlugin::UpdateMotionEventWidget); + connect(this, &MotionEventsPlugin::OnColorChanged, m_timeViewPlugin, &TimeViewPlugin::ReInit); } } - if (!mMotionWindowPlugin) + if (!m_motionWindowPlugin) { EMStudioPlugin* motionBasePlugin = EMStudio::GetPluginManager()->FindActivePlugin(MotionWindowPlugin::CLASS_ID); if (motionBasePlugin) { - mMotionWindowPlugin = (MotionWindowPlugin*)motionBasePlugin; - mMotionListWindow = mMotionWindowPlugin->GetMotionListWindow(); + m_motionWindowPlugin = (MotionWindowPlugin*)motionBasePlugin; + m_motionListWindow = m_motionWindowPlugin->GetMotionListWindow(); - connect(mMotionListWindow, &MotionListWindow::MotionSelectionChanged, this, &MotionEventsPlugin::MotionSelectionChanged); + connect(m_motionListWindow, &MotionListWindow::MotionSelectionChanged, this, &MotionEventsPlugin::MotionSelectionChanged); } } } @@ -155,9 +155,9 @@ namespace EMStudio void MotionEventsPlugin::MotionSelectionChanged() { EMotionFX::Motion* motion = GetCommandManager()->GetCurrentSelection().GetSingleMotion(); - if (mMotion != motion) + if (m_motion != motion) { - mMotion = motion; + m_motion = motion; ReInit(); } } @@ -185,7 +185,7 @@ namespace EMStudio bool MotionEventsPlugin::CheckIfIsPresetReadyToDrop() { // get the motion event presets table - QTableWidget* eventPresetsTable = mMotionEventPresetsWidget->GetMotionEventPresetsTable(); + QTableWidget* eventPresetsTable = m_motionEventPresetsWidget->GetMotionEventPresetsTable(); if (eventPresetsTable == nullptr) { return false; @@ -210,18 +210,17 @@ namespace EMStudio void MotionEventsPlugin::OnEventPresetDropped(QPoint position) { // calculate the start time for the motion event - double dropTimeInSeconds = mTimeViewPlugin->PixelToTime(position.x()); - //mTimeViewPlugin->CalcTime( position.x(), &dropTimeInSeconds, nullptr, nullptr, nullptr, nullptr ); + double dropTimeInSeconds = m_timeViewPlugin->PixelToTime(position.x()); // get the time track on which we dropped the preset - TimeTrack* timeTrack = mTimeViewPlugin->GetTrackAt(position.y()); - if (!timeTrack || !mMotion) + TimeTrack* timeTrack = m_timeViewPlugin->GetTrackAt(position.y()); + if (!timeTrack || !m_motion) { return; } // get the corresponding motion event track - EMotionFX::MotionEventTable* eventTable = mMotion->GetEventTable(); + EMotionFX::MotionEventTable* eventTable = m_motion->GetEventTable(); EMotionFX::MotionEventTrack* eventTrack = eventTable->FindTrackByName(timeTrack->GetName()); if (eventTrack == nullptr) { @@ -229,7 +228,7 @@ namespace EMStudio } // get the motion event presets table - QTableWidget* eventPresetsTable = mMotionEventPresetsWidget->GetMotionEventPresetsTable(); + QTableWidget* eventPresetsTable = m_motionEventPresetsWidget->GetMotionEventPresetsTable(); if (eventPresetsTable == nullptr) { return; @@ -246,7 +245,7 @@ namespace EMStudio if (itemName->isSelected()) { CommandSystem::CommandCreateMotionEvent* createMotionEventCommand = aznew CommandSystem::CommandCreateMotionEvent(); - createMotionEventCommand->SetMotionID(mMotion->GetID()); + createMotionEventCommand->SetMotionID(m_motion->GetID()); createMotionEventCommand->SetEventTrackName(eventTrack->GetName()); createMotionEventCommand->SetStartTime(aznumeric_cast(dropTimeInSeconds)); createMotionEventCommand->SetEndTime(aznumeric_cast(dropTimeInSeconds)); @@ -263,20 +262,20 @@ namespace EMStudio void MotionEventsPlugin::UpdateMotionEventWidget() { - if (!mMotionEventWidget || !mTimeViewPlugin) + if (!m_motionEventWidget || !m_timeViewPlugin) { return; } - mTimeViewPlugin->UpdateSelection(); - if (mTimeViewPlugin->GetNumSelectedEvents() != 1) + m_timeViewPlugin->UpdateSelection(); + if (m_timeViewPlugin->GetNumSelectedEvents() != 1) { - mMotionEventWidget->ReInit(); + m_motionEventWidget->ReInit(); } else { - EventSelectionItem selectionItem = mTimeViewPlugin->GetSelectedEvent(0); - mMotionEventWidget->ReInit(selectionItem.mMotion, selectionItem.GetMotionEvent()); + EventSelectionItem selectionItem = m_timeViewPlugin->GetSelectedEvent(0); + m_motionEventWidget->ReInit(selectionItem.m_motion, selectionItem.GetMotionEvent()); } } diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionEvents/MotionEventsPlugin.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionEvents/MotionEventsPlugin.h index 7f3e821f8d..7cd34e4bca 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionEvents/MotionEventsPlugin.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionEvents/MotionEventsPlugin.h @@ -56,7 +56,7 @@ namespace EMStudio void OnBeforeRemovePlugin(uint32 classID) override; - MotionEventPresetsWidget* GetPresetsWidget() const { return mMotionEventPresetsWidget; } + MotionEventPresetsWidget* GetPresetsWidget() const { return m_motionEventPresetsWidget; } void ValidatePluginLinks(); @@ -78,21 +78,21 @@ namespace EMStudio MCORE_DEFINECOMMANDCALLBACK(CommandSelectCallback); MCORE_DEFINECOMMANDCALLBACK(CommandUnselectCallback); MCORE_DEFINECOMMANDCALLBACK(CommandClearSelectionCallback); - CommandAdjustMotionCallback* mAdjustMotionCallback; - CommandSelectCallback* mSelectCallback; - CommandUnselectCallback* mUnselectCallback; - CommandClearSelectionCallback* mClearSelectionCallback; + CommandAdjustMotionCallback* m_adjustMotionCallback; + CommandSelectCallback* m_selectCallback; + CommandUnselectCallback* m_unselectCallback; + CommandClearSelectionCallback* m_clearSelectionCallback; - MysticQt::DialogStack* mDialogStack; - MotionEventPresetsWidget* mMotionEventPresetsWidget; - MotionEventWidget* mMotionEventWidget; + MysticQt::DialogStack* m_dialogStack; + MotionEventPresetsWidget* m_motionEventPresetsWidget; + MotionEventWidget* m_motionEventWidget; - QTableWidget* mMotionTable; - TimeViewPlugin* mTimeViewPlugin; - TrackHeaderWidget* mTrackHeaderWidget; - TrackDataWidget* mTrackDataWidget; - MotionWindowPlugin* mMotionWindowPlugin; - MotionListWindow* mMotionListWindow; - EMotionFX::Motion* mMotion; + QTableWidget* m_motionTable; + TimeViewPlugin* m_timeViewPlugin; + TrackHeaderWidget* m_trackHeaderWidget; + TrackDataWidget* m_trackDataWidget; + MotionWindowPlugin* m_motionWindowPlugin; + MotionListWindow* m_motionListWindow; + EMotionFX::Motion* m_motion; }; } // namespace EMStudio diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionSetsWindow/MotionSetManagementWindow.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionSetsWindow/MotionSetManagementWindow.cpp index 5943263e3d..ca62d6d927 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionSetsWindow/MotionSetManagementWindow.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionSetsWindow/MotionSetManagementWindow.cpp @@ -120,7 +120,7 @@ namespace EMStudio : QDialog(parent) { // store the motion set - mMotionSet = motionSet; + m_motionSet = motionSet; // set the window title setWindowTitle("Enter new motion set name"); @@ -132,33 +132,27 @@ namespace EMStudio QVBoxLayout* layout = new QVBoxLayout(); // add the line edit - mLineEdit = new QLineEdit(); - connect(mLineEdit, &QLineEdit::textEdited, this, &MotionSetManagementRenameWindow::TextEdited); - layout->addWidget(mLineEdit); + m_lineEdit = new QLineEdit(); + connect(m_lineEdit, &QLineEdit::textEdited, this, &MotionSetManagementRenameWindow::TextEdited); + layout->addWidget(m_lineEdit); // set the current name and select all - mLineEdit->setText(motionSet->GetName()); - mLineEdit->selectAll(); - - // create add the error message - /*mErrorMsg = new QLabel("Error: Duplicate name found"); - mErrorMsg->setAlignment(Qt::AlignVCenter | Qt::AlignLeft); - mErrorMsg->setVisible(false);*/ + m_lineEdit->setText(motionSet->GetName()); + m_lineEdit->selectAll(); // create the button layout QHBoxLayout* buttonLayout = new QHBoxLayout(); - mOKButton = new QPushButton("OK"); + m_okButton = new QPushButton("OK"); QPushButton* cancelButton = new QPushButton("Cancel"); - //buttonLayout->addWidget(mErrorMsg); - buttonLayout->addWidget(mOKButton); + buttonLayout->addWidget(m_okButton); buttonLayout->addWidget(cancelButton); // Allow pressing the enter key as alternative to pressing the ok button for faster workflow. - mOKButton->setAutoDefault(true); - mOKButton->setDefault(true); + m_okButton->setAutoDefault(true); + m_okButton->setDefault(true); // connect the buttons - connect(mOKButton, &QPushButton::clicked, this, &MotionSetManagementRenameWindow::Accepted); + connect(m_okButton, &QPushButton::clicked, this, &MotionSetManagementRenameWindow::Accepted); connect(cancelButton, &QPushButton::clicked, this, &MotionSetManagementRenameWindow::reject); // set the new layout @@ -171,15 +165,13 @@ namespace EMStudio { if (text.isEmpty()) { - //mErrorMsg->setVisible(false); - mOKButton->setEnabled(false); - GetManager()->SetWidgetAsInvalidInput(mLineEdit); + m_okButton->setEnabled(false); + GetManager()->SetWidgetAsInvalidInput(m_lineEdit); } - else if (text == mMotionSet->GetName()) + else if (text == m_motionSet->GetName()) { - //mErrorMsg->setVisible(false); - mOKButton->setEnabled(true); - mLineEdit->setStyleSheet(""); + m_okButton->setEnabled(true); + m_lineEdit->setStyleSheet(""); } else { @@ -196,24 +188,22 @@ namespace EMStudio if (text == motionSet->GetName()) { - //mErrorMsg->setVisible(true); - mOKButton->setEnabled(false); - GetManager()->SetWidgetAsInvalidInput(mLineEdit); + m_okButton->setEnabled(false); + GetManager()->SetWidgetAsInvalidInput(m_lineEdit); return; } } // no duplicate name found - //mErrorMsg->setVisible(false); - mOKButton->setEnabled(true); - mLineEdit->setStyleSheet(""); + m_okButton->setEnabled(true); + m_lineEdit->setStyleSheet(""); } } void MotionSetManagementRenameWindow::Accepted() { - const AZStd::string commandString = AZStd::string::format("AdjustMotionSet -motionSetID %i -newName \"%s\"", mMotionSet->GetID(), mLineEdit->text().toUtf8().data()); + const AZStd::string commandString = AZStd::string::format("AdjustMotionSet -motionSetID %i -newName \"%s\"", m_motionSet->GetID(), m_lineEdit->text().toUtf8().data()); AZStd::string result; if (!EMStudio::GetCommandManager()->ExecuteCommand(commandString, result)) @@ -229,7 +219,7 @@ namespace EMStudio MotionSetManagementWindow::MotionSetManagementWindow(MotionSetsWindowPlugin* parentPlugin, QWidget* parent) : QWidget(parent) { - mPlugin = parentPlugin; + m_plugin = parentPlugin; } @@ -248,31 +238,31 @@ namespace EMStudio layout->setMargin(0); layout->setSpacing(2); - mMotionSetsTree = new QTreeWidget(); + m_motionSetsTree = new QTreeWidget(); // set the table to row single selection - mMotionSetsTree->setSelectionBehavior(QAbstractItemView::SelectRows); - mMotionSetsTree->setSelectionMode(QAbstractItemView::ExtendedSelection); + m_motionSetsTree->setSelectionBehavior(QAbstractItemView::SelectRows); + m_motionSetsTree->setSelectionMode(QAbstractItemView::ExtendedSelection); // set the minimum size and the resizing policy - mMotionSetsTree->setMinimumHeight(150); - mMotionSetsTree->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - mMotionSetsTree->setColumnCount(1); + m_motionSetsTree->setMinimumHeight(150); + m_motionSetsTree->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + m_motionSetsTree->setColumnCount(1); - mMotionSetsTree->setAlternatingRowColors(true); - mMotionSetsTree->setExpandsOnDoubleClick(true); - mMotionSetsTree->setAnimated(true); - mMotionSetsTree->setObjectName("EMFX.MotionSetManagementWindow.MotionSetsTree"); + m_motionSetsTree->setAlternatingRowColors(true); + m_motionSetsTree->setExpandsOnDoubleClick(true); + m_motionSetsTree->setAnimated(true); + m_motionSetsTree->setObjectName("EMFX.MotionSetManagementWindow.MotionSetsTree"); - connect(mMotionSetsTree, &QTreeWidget::itemSelectionChanged, this, &MotionSetManagementWindow::OnSelectionChanged); + connect(m_motionSetsTree, &QTreeWidget::itemSelectionChanged, this, &MotionSetManagementWindow::OnSelectionChanged); QStringList headerList; headerList.append("Name"); - mMotionSetsTree->setHeaderLabels(headerList); - mMotionSetsTree->header()->setSortIndicator(0, Qt::AscendingOrder); + m_motionSetsTree->setHeaderLabels(headerList); + m_motionSetsTree->header()->setSortIndicator(0, Qt::AscendingOrder); // disable the move of section to have column order fixed - mMotionSetsTree->header()->setSectionsMovable(false); + m_motionSetsTree->header()->setSectionsMovable(false); QToolBar* toolBar = new QToolBar(this); toolBar->setObjectName("MotionSetManagementWindow.ToolBar"); @@ -311,7 +301,7 @@ namespace EMStudio toolBar->addWidget(m_searchWidget); layout->addWidget(toolBar); - layout->addWidget(mMotionSetsTree); + layout->addWidget(m_motionSetsTree); ReInit(); UpdateInterface(); @@ -373,7 +363,7 @@ namespace EMStudio void MotionSetManagementWindow::ReInit() { // Get the selected items in the motion set tree widget.. - const QList selectedItems = mMotionSetsTree->selectedItems(); + const QList selectedItems = m_motionSetsTree->selectedItems(); const int numSelectedItems = selectedItems.size(); // Create and fill an array containing ids of all selected motion sets. @@ -385,11 +375,11 @@ namespace EMStudio }); // Set the sorting disabled to avoid index issues. - mMotionSetsTree->setSortingEnabled(false); + m_motionSetsTree->setSortingEnabled(false); // Clear all old items. - mMotionSetsTree->blockSignals(true); - mMotionSetsTree->clear(); + m_motionSetsTree->blockSignals(true); + m_motionSetsTree->clear(); // Iterate through root motion sets and fill in the table recursively. AZStd::string tempString; @@ -409,7 +399,7 @@ namespace EMStudio } // add the top level item - QTreeWidgetItem* item = new QTreeWidgetItem(mMotionSetsTree); + QTreeWidgetItem* item = new QTreeWidgetItem(m_motionSetsTree); item->setText(0, motionSet->GetName()); item->setData(0, Qt::UserRole, motionSet->GetID()); item->setIcon(0, QIcon(QStringLiteral(":/EMotionFX/MotionSet.svg"))); @@ -418,7 +408,7 @@ namespace EMStudio AZStd::to_string(tempString, motionSet->GetID()); item->setWhatsThis(0, tempString.c_str()); - mMotionSetsTree->addTopLevelItem(item); + m_motionSetsTree->addTopLevelItem(item); // Should the motion set be selected? if (AZStd::find(selectedMotionSetIDs.begin(), selectedMotionSetIDs.end(), motionSet->GetID()) != selectedMotionSetIDs.end()) @@ -459,20 +449,20 @@ namespace EMStudio } // enable the tree signals - mMotionSetsTree->blockSignals(false); + m_motionSetsTree->blockSignals(false); // enable the sorting - mMotionSetsTree->setSortingEnabled(true); + m_motionSetsTree->setSortingEnabled(true); } void MotionSetManagementWindow::OnSelectionChanged() { - const QList selectedItems = mMotionSetsTree->selectedItems(); + const QList selectedItems = m_motionSetsTree->selectedItems(); const size_t numSelected = selectedItems.count(); if (numSelected != 1) { - mPlugin->SetSelectedSet(nullptr); + m_plugin->SetSelectedSet(nullptr); } else { @@ -481,7 +471,7 @@ namespace EMStudio if (selectedSet) { - mPlugin->SetSelectedSet(selectedSet); + m_plugin->SetSelectedSet(selectedSet); } } } @@ -498,7 +488,7 @@ namespace EMStudio connect(addAction, &QAction::triggered, this, &MotionSetManagementWindow::OnCreateMotionSet); // get the selected items - const QList selectedItems = mMotionSetsTree->selectedItems(); + const QList selectedItems = m_motionSetsTree->selectedItems(); const int numSelectedItems = selectedItems.count(); // add remove if at least one item selected @@ -537,7 +527,7 @@ namespace EMStudio void MotionSetManagementWindow::OnCreateMotionSet() { - const QList selectedItems = mMotionSetsTree->selectedItems(); + const QList selectedItems = m_motionSetsTree->selectedItems(); const int numSelectedItems = selectedItems.count(); // only add the motion set as child if at least one item selected @@ -562,7 +552,7 @@ namespace EMStudio } // Select the new motion set - mMotionSetsTree->clearSelection(); + m_motionSetsTree->clearSelection(); const EMotionFX::MotionSet* motionSet = EMotionFX::GetMotionManager().FindMotionSetByName(uniqueMotionSetName.c_str()); if (motionSet) { @@ -611,7 +601,7 @@ namespace EMStudio } // Select the new motion sets. - mMotionSetsTree->clearSelection(); + m_motionSetsTree->clearSelection(); for (const AZStd::pair& nameAndParentMotionSet : parentMotionSetByName) { EMotionFX::MotionSet* motionSet = nameAndParentMotionSet.second->RecursiveFindMotionSetByName(nameAndParentMotionSet.first); @@ -624,8 +614,8 @@ namespace EMStudio void MotionSetManagementWindow::SelectItemsById(uint32 motionSetId) { bool selectionChanged = false; - disconnect(mMotionSetsTree, &QTreeWidget::itemSelectionChanged, this, &MotionSetManagementWindow::OnSelectionChanged); - QTreeWidgetItemIterator it(mMotionSetsTree); + disconnect(m_motionSetsTree, &QTreeWidget::itemSelectionChanged, this, &MotionSetManagementWindow::OnSelectionChanged); + QTreeWidgetItemIterator it(m_motionSetsTree); while (*it) { if ((*it)->data(0, Qt::UserRole).toUInt() == motionSetId) @@ -639,7 +629,7 @@ namespace EMStudio } ++it; } - connect(mMotionSetsTree, &QTreeWidget::itemSelectionChanged, this, &MotionSetManagementWindow::OnSelectionChanged); + connect(m_motionSetsTree, &QTreeWidget::itemSelectionChanged, this, &MotionSetManagementWindow::OnSelectionChanged); if (selectionChanged) { OnSelectionChanged(); @@ -649,7 +639,7 @@ namespace EMStudio void MotionSetManagementWindow::GetSelectedMotionSets(AZStd::vector& outSelectedMotionSets) const { // Get the selected items from the motion set tree widget. - const QList selectedItems = mMotionSetsTree->selectedItems(); + const QList selectedItems = m_motionSetsTree->selectedItems(); outSelectedMotionSets.resize(selectedItems.size()); @@ -721,7 +711,7 @@ namespace EMStudio void MotionSetManagementWindow::OnRemoveSelectedMotionSets() { - const QList selectedItems = mMotionSetsTree->selectedItems(); + const QList selectedItems = m_motionSetsTree->selectedItems(); if (selectedItems.empty()) { return; @@ -752,7 +742,7 @@ namespace EMStudio EMotionFX::MotionSet* motionSet = EMotionFX::GetMotionManager().FindMotionSetByID(motionSetID); // in case we modified the motion set ask if the user wants to save changes it before removing it - mPlugin->SaveDirtyMotionSet(motionSet, nullptr, true, false); + m_plugin->SaveDirtyMotionSet(motionSet, nullptr, true, false); // recursively increase motions reference count RecursiveIncreaseMotionsReferenceCount(motionSet); @@ -785,14 +775,14 @@ namespace EMStudio void MotionSetManagementWindow::OnRenameSelectedMotionSet() { - MotionSetManagementRenameWindow motionSetManagementRenameWindow(this, mPlugin->GetSelectedSet()); + MotionSetManagementRenameWindow motionSetManagementRenameWindow(this, m_plugin->GetSelectedSet()); motionSetManagementRenameWindow.exec(); } void MotionSetManagementWindow::OnClearMotionSets() { // show the save dirty files window before - if (mPlugin->OnSaveDirtyMotionSets() == DirtyFileManager::CANCELED) + if (m_plugin->OnSaveDirtyMotionSets() == DirtyFileManager::CANCELED) { return; } @@ -880,7 +870,7 @@ namespace EMStudio void MotionSetManagementWindow::UpdateInterface() { - const QList selectedItems = mMotionSetsTree->selectedItems(); + const QList selectedItems = m_motionSetsTree->selectedItems(); const int numSelectedItems = selectedItems.count(); // remove and save buttons are valid if at least one item is selected @@ -915,14 +905,14 @@ namespace EMStudio { AZStd::string filename = GetMainWindow()->GetFileManager()->LoadMotionSetFileDialog(this); GetMainWindow()->activateWindow(); - mPlugin->LoadMotionSet(filename); + m_plugin->LoadMotionSet(filename); } void MotionSetManagementWindow::OnSave() { // get the selected items and the number of selected items - const QList selectedItems = mMotionSetsTree->selectedItems(); + const QList selectedItems = m_motionSetsTree->selectedItems(); const int numSelectedItems = selectedItems.count(); // at leat one item must be selected @@ -996,7 +986,7 @@ namespace EMStudio void MotionSetManagementWindow::OnSaveAs() { // get the selected items and the number of selected items - const QList selectedItems = mMotionSetsTree->selectedItems(); + const QList selectedItems = m_motionSetsTree->selectedItems(); const int numSelectedItems = selectedItems.count(); // filter to only keep the root motion sets from the selected items diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionSetsWindow/MotionSetManagementWindow.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionSetsWindow/MotionSetManagementWindow.h index 368f5bd9c7..ffe5f0f698 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionSetsWindow/MotionSetManagementWindow.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionSetsWindow/MotionSetManagementWindow.h @@ -61,10 +61,9 @@ namespace EMStudio void Accepted(); private: - EMotionFX::MotionSet* mMotionSet; - QLineEdit* mLineEdit; - QPushButton* mOKButton; - //QLabel* mErrorMsg; + EMotionFX::MotionSet* m_motionSet; + QLineEdit* m_lineEdit; + QPushButton* m_okButton; }; @@ -113,8 +112,8 @@ namespace EMStudio void contextMenuEvent(QContextMenuEvent* event) override; private: - QVBoxLayout* mVLayout = nullptr; - QTreeWidget* mMotionSetsTree = nullptr; + QVBoxLayout* m_vLayout = nullptr; + QTreeWidget* m_motionSetsTree = nullptr; QAction* m_addAction = nullptr; QAction* m_openAction = nullptr; QAction* m_saveMenuAction = nullptr; @@ -122,6 +121,6 @@ namespace EMStudio QAction* m_saveAsAction = nullptr; AzQtComponents::FilteredSearchWidget* m_searchWidget = nullptr; AZStd::string m_searchWidgetText; - MotionSetsWindowPlugin* mPlugin = nullptr; + MotionSetsWindowPlugin* m_plugin = nullptr; }; } // namespace EMStudio diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionSetsWindow/MotionSetWindow.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionSetsWindow/MotionSetWindow.cpp index 3fd928c60c..6d16ea19b1 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionSetsWindow/MotionSetWindow.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionSetsWindow/MotionSetWindow.cpp @@ -124,11 +124,11 @@ namespace EMStudio RenameMotionEntryWindow::RenameMotionEntryWindow(QWidget* parent, EMotionFX::MotionSet* motionSet, const AZStd::string& motionId) : QDialog(parent) { - mMotionSet = motionSet; + m_motionSet = motionSet; m_motionId = motionId; // Build a list of unique string id values from all motion set entries. - mMotionSet->BuildIdStringList(m_existingIds); + m_motionSet->BuildIdStringList(m_existingIds); // Set the window title and minimum width. setWindowTitle("Enter new motion ID"); @@ -136,25 +136,25 @@ namespace EMStudio QVBoxLayout* layout = new QVBoxLayout(); - mLineEdit = new QLineEdit(); - connect(mLineEdit, &QLineEdit::textEdited, this, &RenameMotionEntryWindow::TextEdited); - layout->addWidget(mLineEdit); + m_lineEdit = new QLineEdit(); + connect(m_lineEdit, &QLineEdit::textEdited, this, &RenameMotionEntryWindow::TextEdited); + layout->addWidget(m_lineEdit); // Set the old motion id as text and select all so that the user can directly start typing. - mLineEdit->setText(m_motionId.c_str()); - mLineEdit->selectAll(); + m_lineEdit->setText(m_motionId.c_str()); + m_lineEdit->selectAll(); QHBoxLayout* buttonLayout = new QHBoxLayout(); - mOKButton = new QPushButton("OK"); + m_okButton = new QPushButton("OK"); QPushButton* cancelButton = new QPushButton("Cancel"); - buttonLayout->addWidget(mOKButton); + buttonLayout->addWidget(m_okButton); buttonLayout->addWidget(cancelButton); // Allow pressing the enter key as alternative to pressing the ok button for faster workflow. - mOKButton->setAutoDefault(true); - mOKButton->setDefault(true); + m_okButton->setAutoDefault(true); + m_okButton->setDefault(true); - connect(mOKButton, &QPushButton::clicked, this, &RenameMotionEntryWindow::Accepted); + connect(m_okButton, &QPushButton::clicked, this, &RenameMotionEntryWindow::Accepted); connect(cancelButton, &QPushButton::clicked, this, &RenameMotionEntryWindow::reject); layout->addLayout(buttonLayout); @@ -169,24 +169,22 @@ namespace EMStudio // Disable the ok button and put the text edit in error state in case the new motion id is either empty or does already exist in the motion set. if (newId.empty() || AZStd::find(m_existingIds.begin(), m_existingIds.end(), newId) != m_existingIds.end()) { - //mErrorMsg->setVisible(false); - mOKButton->setEnabled(false); - GetManager()->SetWidgetAsInvalidInput(mLineEdit); + m_okButton->setEnabled(false); + GetManager()->SetWidgetAsInvalidInput(m_lineEdit); return; } - //mErrorMsg->setVisible(false); - mOKButton->setEnabled(true); - mLineEdit->setStyleSheet(""); + m_okButton->setEnabled(true); + m_lineEdit->setStyleSheet(""); } void RenameMotionEntryWindow::Accepted() { AZStd::string commandString = AZStd::string::format("MotionSetAdjustMotion -motionSetID %i -idString \"%s\" -newIDString \"%s\" -updateMotionNodeStringIDs true", - mMotionSet->GetID(), + m_motionSet->GetID(), m_motionId.c_str(), - mLineEdit->text().toUtf8().data()); + m_lineEdit->text().toUtf8().data()); AZStd::string result; if (!EMStudio::GetCommandManager()->ExecuteCommand(commandString, result)) @@ -202,7 +200,7 @@ namespace EMStudio MotionSetWindow::MotionSetWindow(MotionSetsWindowPlugin* parentPlugin, QWidget* parent) : QWidget(parent) { - mPlugin = parentPlugin; + m_plugin = parentPlugin; } @@ -253,7 +251,7 @@ namespace EMStudio // left side - m_tableWidget = new MotionSetTableWidget(mPlugin, this); + m_tableWidget = new MotionSetTableWidget(m_plugin, this); m_tableWidget->setObjectName("EMFX.MotionSetWindow.TableWidget"); tableLayout->addWidget(m_tableWidget); m_tableWidget->setAlternatingRowColors(true); @@ -328,11 +326,11 @@ namespace EMStudio void MotionSetWindow::ReInit() { - EMotionFX::MotionSet* selectedSet = mPlugin->GetSelectedSet(); + EMotionFX::MotionSet* selectedSet = m_plugin->GetSelectedSet(); const size_t selectedSetIndex = EMotionFX::GetMotionManager().FindMotionSetIndex(selectedSet); if (selectedSetIndex != InvalidIndex) { - UpdateMotionSetTable(m_tableWidget, mPlugin->GetSelectedSet()); + UpdateMotionSetTable(m_tableWidget, m_plugin->GetSelectedSet()); } else { @@ -344,15 +342,11 @@ namespace EMStudio bool MotionSetWindow::AddMotion(EMotionFX::MotionSet* motionSet, EMotionFX::MotionSet::MotionEntry* motionEntry) { // check if the motion set is the one we currently see in the interface, if not there is nothing to do - if (mPlugin->GetSelectedSet() == motionSet) + if (m_plugin->GetSelectedSet() == motionSet) { InsertRow(motionSet, motionEntry, m_tableWidget, false); } - // check if the motion set is the one we currently see in the interface in the right table, if not there is nothing to do - //if (mRightSelectedSet == motionSet) - // InsertRow(motionSet, motionEntry, mMotionSetTableRight, true); - UpdateInterface(); return true; } @@ -373,7 +367,7 @@ namespace EMStudio } // Check if the motion set is the one we currently see in the interface, if not there is nothing to do. - if (mPlugin->GetSelectedSet() == motionSet) + if (m_plugin->GetSelectedSet() == motionSet) { FillRow(motionSet, motionEntry, rowIndex, m_tableWidget, false); } @@ -386,7 +380,7 @@ namespace EMStudio bool MotionSetWindow::RemoveMotion(EMotionFX::MotionSet* motionSet, EMotionFX::MotionSet::MotionEntry* motionEntry) { // Check if the motion set is the one we currently see in the interface, if not there is nothing to do. - if (mPlugin->GetSelectedSet() == motionSet) + if (m_plugin->GetSelectedSet() == motionSet) { RemoveRow(motionSet, motionEntry, m_tableWidget); } @@ -416,9 +410,9 @@ namespace EMStudio if (defaultPlayBackInfo) { // Don't blend in and out of the for previewing animations. We might only see a short bit of it for animations smaller than the blend in/out time. - defaultPlayBackInfo->mBlendInTime = 0.0f; - defaultPlayBackInfo->mBlendOutTime = 0.0f; - defaultPlayBackInfo->mFreezeAtLastFrame = (defaultPlayBackInfo->mNumLoops != EMFX_LOOPFOREVER); + defaultPlayBackInfo->m_blendInTime = 0.0f; + defaultPlayBackInfo->m_blendOutTime = 0.0f; + defaultPlayBackInfo->m_freezeAtLastFrame = (defaultPlayBackInfo->m_numLoops != EMFX_LOOPFOREVER); commandParameters = CommandSystem::CommandPlayMotion::PlayBackInfoToCommandParameters(defaultPlayBackInfo); } @@ -811,7 +805,7 @@ namespace EMStudio void MotionSetWindow::UpdateInterface() { - EMotionFX::MotionSet* motionSet = mPlugin->GetSelectedSet(); + EMotionFX::MotionSet* motionSet = m_plugin->GetSelectedSet(); const bool isEnabled = (motionSet != nullptr); m_addAction->setEnabled(isEnabled); @@ -866,7 +860,7 @@ namespace EMStudio void MotionSetWindow::OnAddNewEntry() { - EMotionFX::MotionSet* selectedSet = mPlugin->GetSelectedSet(); + EMotionFX::MotionSet* selectedSet = m_plugin->GetSelectedSet(); if (!selectedSet) { return; @@ -903,7 +897,7 @@ namespace EMStudio void MotionSetWindow::AddMotions(const AZStd::vector& filenames) { - EMotionFX::MotionSet* selectedSet = mPlugin->GetSelectedSet(); + EMotionFX::MotionSet* selectedSet = m_plugin->GetSelectedSet(); if (!selectedSet) { return; @@ -1068,7 +1062,7 @@ namespace EMStudio void MotionSetWindow::OnRemoveMotions() { - EMotionFX::MotionSet* motionSet = mPlugin->GetSelectedSet(); + EMotionFX::MotionSet* motionSet = m_plugin->GetSelectedSet(); if (!motionSet) { return; @@ -1254,7 +1248,7 @@ namespace EMStudio EMotionFX::MotionSet::MotionEntry* motionEntry = FindMotionEntry(item); // Show the entry renaming window. - RenameMotionEntryWindow window(this, mPlugin->GetSelectedSet(), motionEntry->GetId().c_str()); + RenameMotionEntryWindow window(this, m_plugin->GetSelectedSet(), motionEntry->GetId().c_str()); window.exec(); } @@ -1274,7 +1268,7 @@ namespace EMStudio void MotionSetWindow::OnUnassignMotions() { - EMotionFX::MotionSet* motionSet = mPlugin->GetSelectedSet(); + EMotionFX::MotionSet* motionSet = m_plugin->GetSelectedSet(); if (!motionSet) { return; @@ -1322,7 +1316,7 @@ namespace EMStudio void MotionSetWindow::OnClearMotions() { - EMotionFX::MotionSet* motionSet = mPlugin->GetSelectedSet(); + EMotionFX::MotionSet* motionSet = m_plugin->GetSelectedSet(); if (!motionSet) { return; @@ -1412,7 +1406,7 @@ namespace EMStudio GetRowIndices(selectedItems, rowIndices); // get the selected motion set - EMotionFX::MotionSet* motionSet = mPlugin->GetSelectedSet(); + EMotionFX::MotionSet* motionSet = m_plugin->GetSelectedSet(); // generate the motions IDs array AZStd::vector motionIDs; @@ -1442,7 +1436,7 @@ namespace EMStudio void MotionSetWindow::OnEntryDoubleClicked(QTableWidgetItem* item) { - const EMotionFX::MotionSet* motionSet = mPlugin->GetSelectedSet(); + const EMotionFX::MotionSet* motionSet = m_plugin->GetSelectedSet(); if (!motionSet) { return; @@ -1603,7 +1597,7 @@ namespace EMStudio : QTableWidget(parent) { // keep the parent plugin - mPlugin = parentPlugin; + m_plugin = parentPlugin; // enable drop only setAcceptDrops(true); @@ -1620,7 +1614,7 @@ namespace EMStudio void MotionSetTableWidget::dropEvent(QDropEvent* event) { - mPlugin->GetMotionSetWindow()->dropEvent(event); + m_plugin->GetMotionSetWindow()->dropEvent(event); } @@ -1639,7 +1633,7 @@ namespace EMStudio // return the mime data QMimeData* MotionSetTableWidget::mimeData(const QList items) const { - EMotionFX::MotionSet* motionSet = mPlugin->GetSelectedSet(); + EMotionFX::MotionSet* motionSet = m_plugin->GetSelectedSet(); if (motionSet == nullptr) { return nullptr; @@ -1682,13 +1676,13 @@ namespace EMStudio : QDialog(parent) { // save the motion set and the motion IDs - mMotionSet = motionSet; - mMotionIDs = motionIDs; + m_motionSet = motionSet; + m_motionIDs = motionIDs; // Reserve space. - mValids.reserve(mMotionIDs.size()); - mMotionToModifiedMap.reserve(mMotionIDs.size()); - mModifiedMotionIDs.reserve(motionSet->GetNumMotionEntries()); + m_valids.reserve(m_motionIDs.size()); + m_motionToModifiedMap.reserve(m_motionIDs.size()); + m_modifiedMotionIDs.reserve(motionSet->GetNumMotionEntries()); // set the window title setWindowTitle("Batch Edit Motion IDs"); @@ -1701,113 +1695,113 @@ namespace EMStudio spacerWidget->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed); // create the combobox - mComboBox = new QComboBox(); - mComboBox->addItem("Replace All"); - mComboBox->addItem("Replace First"); - mComboBox->addItem("Replace Last"); + m_comboBox = new QComboBox(); + m_comboBox->addItem("Replace All"); + m_comboBox->addItem("Replace First"); + m_comboBox->addItem("Replace Last"); // connect the combobox - connect(mComboBox, static_cast(&QComboBox::currentIndexChanged), this, &MotionEditStringIDWindow::CurrentIndexChanged); + connect(m_comboBox, static_cast(&QComboBox::currentIndexChanged), this, &MotionEditStringIDWindow::CurrentIndexChanged); // create the string line edits - mStringALineEdit = new QLineEdit(); - mStringBLineEdit = new QLineEdit(); + m_stringALineEdit = new QLineEdit(); + m_stringBLineEdit = new QLineEdit(); // connect the line edit - connect(mStringALineEdit, &QLineEdit::textChanged, this, &MotionEditStringIDWindow::StringABChanged); - connect(mStringBLineEdit, &QLineEdit::textChanged, this, &MotionEditStringIDWindow::StringABChanged); + connect(m_stringALineEdit, &QLineEdit::textChanged, this, &MotionEditStringIDWindow::StringABChanged); + connect(m_stringBLineEdit, &QLineEdit::textChanged, this, &MotionEditStringIDWindow::StringABChanged); // add the operation layout QHBoxLayout* operationLayout = new QHBoxLayout(); operationLayout->addWidget(new QLabel("Operation:")); - operationLayout->addWidget(mComboBox); + operationLayout->addWidget(m_comboBox); operationLayout->addWidget(spacerWidget); operationLayout->addWidget(new QLabel("StringA:")); - operationLayout->addWidget(mStringALineEdit); + operationLayout->addWidget(m_stringALineEdit); operationLayout->addWidget(new QLabel("StringB:")); - operationLayout->addWidget(mStringBLineEdit); + operationLayout->addWidget(m_stringBLineEdit); layout->addLayout(operationLayout); // create the table widget - mTableWidget = new QTableWidget(); - mTableWidget->setAlternatingRowColors(true); - mTableWidget->setGridStyle(Qt::SolidLine); - mTableWidget->setSelectionBehavior(QAbstractItemView::SelectRows); - mTableWidget->setSelectionMode(QAbstractItemView::SingleSelection); - mTableWidget->setEditTriggers(QAbstractItemView::NoEditTriggers); + m_tableWidget = new QTableWidget(); + m_tableWidget->setAlternatingRowColors(true); + m_tableWidget->setGridStyle(Qt::SolidLine); + m_tableWidget->setSelectionBehavior(QAbstractItemView::SelectRows); + m_tableWidget->setSelectionMode(QAbstractItemView::SingleSelection); + m_tableWidget->setEditTriggers(QAbstractItemView::NoEditTriggers); // set the table widget columns - mTableWidget->setColumnCount(2); + m_tableWidget->setColumnCount(2); QStringList headerLabels; headerLabels.append("Before"); headerLabels.append("After"); - mTableWidget->setHorizontalHeaderLabels(headerLabels); - mTableWidget->horizontalHeader()->setStretchLastSection(true); - mTableWidget->horizontalHeader()->setDefaultAlignment(Qt::AlignLeft); - mTableWidget->horizontalHeader()->setSortIndicator(0, Qt::AscendingOrder); + m_tableWidget->setHorizontalHeaderLabels(headerLabels); + m_tableWidget->horizontalHeader()->setStretchLastSection(true); + m_tableWidget->horizontalHeader()->setDefaultAlignment(Qt::AlignLeft); + m_tableWidget->horizontalHeader()->setSortIndicator(0, Qt::AscendingOrder); // Set the row count - const size_t numMotionIDs = mMotionIDs.size(); - mTableWidget->setRowCount(static_cast(numMotionIDs)); + const size_t numMotionIDs = m_motionIDs.size(); + m_tableWidget->setRowCount(static_cast(numMotionIDs)); // disable the sorting - mTableWidget->setSortingEnabled(false); + m_tableWidget->setSortingEnabled(false); // initialize the table for (size_t i = 0; i < numMotionIDs; ++i) { // create the before and after table widget items - QTableWidgetItem* beforeTableWidgetItem = new QTableWidgetItem(mMotionIDs[i].c_str()); - QTableWidgetItem* afterTableWidgetItem = new QTableWidgetItem(mMotionIDs[i].c_str()); + QTableWidgetItem* beforeTableWidgetItem = new QTableWidgetItem(m_motionIDs[i].c_str()); + QTableWidgetItem* afterTableWidgetItem = new QTableWidgetItem(m_motionIDs[i].c_str()); // set the text of the row const int row = static_cast(i); - mTableWidget->setItem(row, 0, beforeTableWidgetItem); - mTableWidget->setItem(row, 1, afterTableWidgetItem); + m_tableWidget->setItem(row, 0, beforeTableWidgetItem); + m_tableWidget->setItem(row, 1, afterTableWidgetItem); } - mTableWidget->setSortingEnabled(true); - mTableWidget->resizeColumnToContents(0); - mTableWidget->setCornerButtonEnabled(false); + m_tableWidget->setSortingEnabled(true); + m_tableWidget->resizeColumnToContents(0); + m_tableWidget->setCornerButtonEnabled(false); - layout->addWidget(mTableWidget); + layout->addWidget(m_tableWidget); // create the num motion IDs label // this label never change, it's the total of motion ID in the table - mNumMotionIDsLabel = new QLabel(); - mNumMotionIDsLabel->setAlignment(Qt::AlignLeft); - mNumMotionIDsLabel->setText(QString("Number of motion IDs: %1").arg(numMotionIDs)); + m_numMotionIDsLabel = new QLabel(); + m_numMotionIDsLabel->setAlignment(Qt::AlignLeft); + m_numMotionIDsLabel->setText(QString("Number of motion IDs: %1").arg(numMotionIDs)); // create the num modified IDs label - mNumModifiedIDsLabel = new QLabel(); - mNumModifiedIDsLabel->setAlignment(Qt::AlignCenter); - mNumModifiedIDsLabel->setText("Number of modified IDs: 0"); + m_numModifiedIDsLabel = new QLabel(); + m_numModifiedIDsLabel->setAlignment(Qt::AlignCenter); + m_numModifiedIDsLabel->setText("Number of modified IDs: 0"); // create the num duplicate IDs label - mNumDuplicateIDsLabel = new QLabel(); - mNumDuplicateIDsLabel->setAlignment(Qt::AlignRight); - mNumDuplicateIDsLabel->setText("Number of duplicate IDs: 0"); + m_numDuplicateIDsLabel = new QLabel(); + m_numDuplicateIDsLabel->setAlignment(Qt::AlignRight); + m_numDuplicateIDsLabel->setText("Number of duplicate IDs: 0"); // add the stats layout QHBoxLayout* statsLayout = new QHBoxLayout(); - statsLayout->addWidget(mNumMotionIDsLabel); - statsLayout->addWidget(mNumModifiedIDsLabel); - statsLayout->addWidget(mNumDuplicateIDsLabel); + statsLayout->addWidget(m_numMotionIDsLabel); + statsLayout->addWidget(m_numModifiedIDsLabel); + statsLayout->addWidget(m_numDuplicateIDsLabel); layout->addLayout(statsLayout); // add the bottom buttons QHBoxLayout* buttonLayout = new QHBoxLayout(); - mApplyButton = new QPushButton("Apply"); + m_applyButton = new QPushButton("Apply"); QPushButton* closeButton = new QPushButton("Close"); - buttonLayout->addWidget(mApplyButton); + buttonLayout->addWidget(m_applyButton); buttonLayout->addWidget(closeButton); layout->addLayout(buttonLayout); // apply button is disabled because nothing is changed - mApplyButton->setEnabled(false); + m_applyButton->setEnabled(false); // connect the buttons - connect(mApplyButton, &QPushButton::clicked, this, &MotionEditStringIDWindow::Accepted); + connect(m_applyButton, &QPushButton::clicked, this, &MotionEditStringIDWindow::Accepted); connect(closeButton, &QPushButton::clicked, this, &MotionEditStringIDWindow::reject); setLayout(layout); @@ -1823,13 +1817,13 @@ namespace EMStudio // add each command AZStd::string commandString; - for (size_t validID : mValids) + for (size_t validID : m_valids) { // get the motion ID and the modified ID - AZStd::string& motionID = mMotionIDs[validID]; - const AZStd::string& modifiedID = mModifiedMotionIDs[mMotionToModifiedMap[validID]]; + AZStd::string& motionID = m_motionIDs[validID]; + const AZStd::string& modifiedID = m_modifiedMotionIDs[m_motionToModifiedMap[validID]]; - commandString = AZStd::string::format("MotionSetAdjustMotion -motionSetID %i -idString \"%s\" -newIDString \"%s\" -updateMotionNodeStringIDs true", mMotionSet->GetID(), motionID.c_str(), modifiedID.c_str()); + commandString = AZStd::string::format("MotionSetAdjustMotion -motionSetID %i -idString \"%s\" -newIDString \"%s\" -updateMotionNodeStringIDs true", m_motionSet->GetID(), motionID.c_str(), modifiedID.c_str()); motionID = modifiedID; // add the command in the group @@ -1844,46 +1838,46 @@ namespace EMStudio } // block signals for the reset - mStringALineEdit->blockSignals(true); - mStringBLineEdit->blockSignals(true); + m_stringALineEdit->blockSignals(true); + m_stringBLineEdit->blockSignals(true); // reset the string line edits - mStringALineEdit->setText(""); - mStringBLineEdit->setText(""); + m_stringALineEdit->setText(""); + m_stringBLineEdit->setText(""); // enable signals after the reset - mStringALineEdit->blockSignals(false); - mStringBLineEdit->blockSignals(false); + m_stringALineEdit->blockSignals(false); + m_stringBLineEdit->blockSignals(false); // disable the sorting - mTableWidget->setSortingEnabled(false); + m_tableWidget->setSortingEnabled(false); // set the new table using modified motion IDs - const size_t numMotionIDs = mMotionIDs.size(); + const size_t numMotionIDs = m_motionIDs.size(); for (size_t i = 0; i < numMotionIDs; ++i) { // create the before and after table widget items - QTableWidgetItem* beforeTableWidgetItem = new QTableWidgetItem(mMotionIDs[i].c_str()); - QTableWidgetItem* afterTableWidgetItem = new QTableWidgetItem(mMotionIDs[i].c_str()); + QTableWidgetItem* beforeTableWidgetItem = new QTableWidgetItem(m_motionIDs[i].c_str()); + QTableWidgetItem* afterTableWidgetItem = new QTableWidgetItem(m_motionIDs[i].c_str()); // set the text of the row const int row = static_cast(i); - mTableWidget->setItem(row, 0, beforeTableWidgetItem); - mTableWidget->setItem(row, 1, afterTableWidgetItem); + m_tableWidget->setItem(row, 0, beforeTableWidgetItem); + m_tableWidget->setItem(row, 1, afterTableWidgetItem); } // enable the sorting - mTableWidget->setSortingEnabled(true); + m_tableWidget->setSortingEnabled(true); // resize before column - mTableWidget->resizeColumnToContents(0); + m_tableWidget->resizeColumnToContents(0); // reset the stats - mNumModifiedIDsLabel->setText("Number of modified IDs: 0"); - mNumDuplicateIDsLabel->setText("Number of duplicate IDs: 0"); + m_numModifiedIDsLabel->setText("Number of modified IDs: 0"); + m_numDuplicateIDsLabel->setText("Number of duplicate IDs: 0"); // apply button is disabled because nothing is changed - mApplyButton->setEnabled(false); + m_applyButton->setEnabled(false); } @@ -1904,10 +1898,10 @@ namespace EMStudio void MotionEditStringIDWindow::UpdateTableAndButton() { // get the number of motion IDs - const size_t numMotionIDs = mMotionIDs.size(); + const size_t numMotionIDs = m_motionIDs.size(); // Remember the selected motion IDs so we can restore selection after swapping the table items. - const QList selectedItems = mTableWidget->selectedItems(); + const QList selectedItems = m_tableWidget->selectedItems(); const int numSelectedItems = selectedItems.size(); QVector selectedMotionIds(numSelectedItems); for (int i = 0; i < numSelectedItems; ++i) @@ -1916,59 +1910,59 @@ namespace EMStudio } // special case where the string A and B are empty, nothing is replaced - if ((mStringALineEdit->text().isEmpty()) && (mStringBLineEdit->text().isEmpty())) + if ((m_stringALineEdit->text().isEmpty()) && (m_stringBLineEdit->text().isEmpty())) { // disable the sorting - mTableWidget->setSortingEnabled(false); + m_tableWidget->setSortingEnabled(false); // reset the table for (size_t i = 0; i < numMotionIDs; ++i) { // create the before and after table widget items - QTableWidgetItem* beforeTableWidgetItem = new QTableWidgetItem(mMotionIDs[i].c_str()); - QTableWidgetItem* afterTableWidgetItem = new QTableWidgetItem(mMotionIDs[i].c_str()); + QTableWidgetItem* beforeTableWidgetItem = new QTableWidgetItem(m_motionIDs[i].c_str()); + QTableWidgetItem* afterTableWidgetItem = new QTableWidgetItem(m_motionIDs[i].c_str()); // set the text of the row const int row = static_cast(i); - mTableWidget->setItem(row, 0, beforeTableWidgetItem); - mTableWidget->setItem(row, 1, afterTableWidgetItem); + m_tableWidget->setItem(row, 0, beforeTableWidgetItem); + m_tableWidget->setItem(row, 1, afterTableWidgetItem); } // enable the sorting - mTableWidget->setSortingEnabled(true); + m_tableWidget->setSortingEnabled(true); // reset the stats - mNumModifiedIDsLabel->setText("Number of modified IDs: 0"); - mNumDuplicateIDsLabel->setText("Number of duplicate IDs: 0"); + m_numModifiedIDsLabel->setText("Number of modified IDs: 0"); + m_numDuplicateIDsLabel->setText("Number of duplicate IDs: 0"); // apply button is disabled because nothing is changed - mApplyButton->setEnabled(false); + m_applyButton->setEnabled(false); // stop here return; } // Clear the arrays but keep the memory to avoid alloc. - mValids.clear(); - mModifiedMotionIDs.clear(); - mMotionToModifiedMap.clear(); + m_valids.clear(); + m_modifiedMotionIDs.clear(); + m_motionToModifiedMap.clear(); // Copy all motion IDs from the motion set in the modified array. - const EMotionFX::MotionSet::MotionEntries& motionEntries = mMotionSet->GetMotionEntries(); + const EMotionFX::MotionSet::MotionEntries& motionEntries = m_motionSet->GetMotionEntries(); for (const auto& item : motionEntries) { const EMotionFX::MotionSet::MotionEntry* motionEntry = item.second; - mModifiedMotionIDs.push_back(motionEntry->GetId().c_str()); + m_modifiedMotionIDs.push_back(motionEntry->GetId().c_str()); } // Modify each ID using the operation in the modified array. AZStd::string newMotionID; AZStd::string tempString; - for (const AZStd::string& motionID : mMotionIDs) + for (const AZStd::string& motionID : m_motionIDs) { // 0=Replace All, 1=Replace First, 2=Replace Last - const int operationMode = mComboBox->currentIndex(); + const int operationMode = m_comboBox->currentIndex(); // compute the new text switch (operationMode) @@ -1976,7 +1970,7 @@ namespace EMStudio case 0: { tempString = motionID.c_str(); - AzFramework::StringFunc::Replace(tempString, mStringALineEdit->text().toUtf8().data(), mStringBLineEdit->text().toUtf8().data(), true /* case sensitive */); + AzFramework::StringFunc::Replace(tempString, m_stringALineEdit->text().toUtf8().data(), m_stringBLineEdit->text().toUtf8().data(), true /* case sensitive */); newMotionID = tempString.c_str(); break; } @@ -1984,7 +1978,7 @@ namespace EMStudio case 1: { tempString = motionID.c_str(); - AzFramework::StringFunc::Replace(tempString, mStringALineEdit->text().toUtf8().data(), mStringBLineEdit->text().toUtf8().data(), true /* case sensitive */, true /* replace first */, false /* replace last */); + AzFramework::StringFunc::Replace(tempString, m_stringALineEdit->text().toUtf8().data(), m_stringBLineEdit->text().toUtf8().data(), true /* case sensitive */, true /* replace first */, false /* replace last */); newMotionID = tempString.c_str(); break; } @@ -1992,21 +1986,21 @@ namespace EMStudio case 2: { tempString = motionID.c_str(); - AzFramework::StringFunc::Replace(tempString, mStringALineEdit->text().toUtf8().data(), mStringBLineEdit->text().toUtf8().data(), true /* case sensitive */, false /* replace first */, true /* replace last */); + AzFramework::StringFunc::Replace(tempString, m_stringALineEdit->text().toUtf8().data(), m_stringBLineEdit->text().toUtf8().data(), true /* case sensitive */, false /* replace first */, true /* replace last */); newMotionID = tempString.c_str(); break; } } // change the value in the array and add the mapping motion to modified - auto iterator = AZStd::find(mModifiedMotionIDs.begin(), mModifiedMotionIDs.end(), motionID); - const size_t modifiedIndex = iterator - mModifiedMotionIDs.begin(); - mModifiedMotionIDs[modifiedIndex] = newMotionID; - mMotionToModifiedMap.push_back(modifiedIndex); + auto iterator = AZStd::find(m_modifiedMotionIDs.begin(), m_modifiedMotionIDs.end(), motionID); + const size_t modifiedIndex = iterator - m_modifiedMotionIDs.begin(); + m_modifiedMotionIDs[modifiedIndex] = newMotionID; + m_motionToModifiedMap.push_back(modifiedIndex); } // disable the sorting - mTableWidget->setSortingEnabled(false); + m_tableWidget->setSortingEnabled(false); // found flags size_t numDuplicateFound = 0; @@ -2015,18 +2009,18 @@ namespace EMStudio for (size_t i = 0; i < numMotionIDs; ++i) { // find the index in the motion set - const AZStd::string& modifiedID = mModifiedMotionIDs[mMotionToModifiedMap[i]]; + const AZStd::string& modifiedID = m_modifiedMotionIDs[m_motionToModifiedMap[i]]; // create the before and after table widget items - QTableWidgetItem* beforeTableWidgetItem = new QTableWidgetItem(mMotionIDs[i].c_str()); + QTableWidgetItem* beforeTableWidgetItem = new QTableWidgetItem(m_motionIDs[i].c_str()); QTableWidgetItem* afterTableWidgetItem = new QTableWidgetItem(modifiedID.c_str()); // find duplicate size_t itemFoundCounter = 0; - const size_t numMotionEntries = mMotionSet->GetNumMotionEntries(); + const size_t numMotionEntries = m_motionSet->GetNumMotionEntries(); for (size_t k = 0; k < numMotionEntries; ++k) { - if (mModifiedMotionIDs[k] == modifiedID) + if (m_modifiedMotionIDs[k] == modifiedID) { ++itemFoundCounter; if (itemFoundCounter > 1) @@ -2045,51 +2039,51 @@ namespace EMStudio } else { - if (modifiedID != mMotionIDs[i]) + if (modifiedID != m_motionIDs[i]) { // set the row green beforeTableWidgetItem->setForeground(Qt::green); afterTableWidgetItem->setForeground(Qt::green); // add a valid - mValids.push_back(i); + m_valids.push_back(i); } } // set the text of the row - mTableWidget->setItem(aznumeric_caster(i), 0, beforeTableWidgetItem); - mTableWidget->setItem(aznumeric_caster(i), 1, afterTableWidgetItem); + m_tableWidget->setItem(aznumeric_caster(i), 0, beforeTableWidgetItem); + m_tableWidget->setItem(aznumeric_caster(i), 1, afterTableWidgetItem); } // enable the sorting - mTableWidget->setSortingEnabled(true); + m_tableWidget->setSortingEnabled(true); // update the num modified label - mNumModifiedIDsLabel->setText(QString("Number of modified IDs: %1").arg(mValids.size())); + m_numModifiedIDsLabel->setText(QString("Number of modified IDs: %1").arg(m_valids.size())); // update the num duplicate label // the number is in red if at least one found if (numDuplicateFound > 0) { - mNumDuplicateIDsLabel->setText(QString("Number of duplicate IDs: %1").arg(numDuplicateFound)); + m_numDuplicateIDsLabel->setText(QString("Number of duplicate IDs: %1").arg(numDuplicateFound)); } else { - mNumDuplicateIDsLabel->setText("Number of duplicate IDs: 0"); + m_numDuplicateIDsLabel->setText("Number of duplicate IDs: 0"); } // enable or disable the apply button - mApplyButton->setEnabled((!mValids.empty()) && (numDuplicateFound == 0)); + m_applyButton->setEnabled((!m_valids.empty()) && (numDuplicateFound == 0)); // Reselect the remembered motions. - mTableWidget->clearSelection(); - const int rowCount = mTableWidget->rowCount(); + m_tableWidget->clearSelection(); + const int rowCount = m_tableWidget->rowCount(); for (int i = 0; i < rowCount; ++i) { - const QTableWidgetItem* item = mTableWidget->item(i, 0); + const QTableWidgetItem* item = m_tableWidget->item(i, 0); if (AZStd::find(selectedMotionIds.begin(), selectedMotionIds.end(), item->text()) != selectedMotionIds.end()) { - mTableWidget->selectRow(i); + m_tableWidget->selectRow(i); } } } @@ -2102,7 +2096,7 @@ namespace EMStudio return nullptr; } - const EMotionFX::MotionSet* motionSet = mPlugin->GetSelectedSet(); + const EMotionFX::MotionSet* motionSet = m_plugin->GetSelectedSet(); if (!motionSet) { return nullptr; diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionSetsWindow/MotionSetWindow.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionSetsWindow/MotionSetWindow.h index 33b3828e5a..8c1fe04662 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionSetsWindow/MotionSetWindow.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionSetsWindow/MotionSetWindow.h @@ -62,11 +62,11 @@ namespace EMStudio void Accepted(); private: - EMotionFX::MotionSet* mMotionSet; + EMotionFX::MotionSet* m_motionSet; AZStd::vector m_existingIds; AZStd::string m_motionId; - QLineEdit* mLineEdit; - QPushButton* mOKButton; + QLineEdit* m_lineEdit; + QPushButton* m_okButton; }; @@ -88,19 +88,19 @@ namespace EMStudio void UpdateTableAndButton(); private: - EMotionFX::MotionSet* mMotionSet; - AZStd::vector mMotionIDs; - AZStd::vector mModifiedMotionIDs; - AZStd::vector mMotionToModifiedMap; - AZStd::vector mValids; - QTableWidget* mTableWidget; - QLineEdit* mStringALineEdit; - QLineEdit* mStringBLineEdit; - QPushButton* mApplyButton; - QLabel* mNumMotionIDsLabel; - QLabel* mNumModifiedIDsLabel; - QLabel* mNumDuplicateIDsLabel; - QComboBox* mComboBox; + EMotionFX::MotionSet* m_motionSet; + AZStd::vector m_motionIDs; + AZStd::vector m_modifiedMotionIDs; + AZStd::vector m_motionToModifiedMap; + AZStd::vector m_valids; + QTableWidget* m_tableWidget; + QLineEdit* m_stringALineEdit; + QLineEdit* m_stringBLineEdit; + QPushButton* m_applyButton; + QLabel* m_numMotionIDsLabel; + QLabel* m_numModifiedIDsLabel; + QLabel* m_numDuplicateIDsLabel; + QComboBox* m_comboBox; }; @@ -124,7 +124,7 @@ namespace EMStudio void dragEnterEvent(QDragEnterEvent* event) override; void dragMoveEvent(QDragMoveEvent* event) override; - MotionSetsWindowPlugin* mPlugin; + MotionSetsWindowPlugin* m_plugin; }; @@ -187,7 +187,7 @@ namespace EMStudio size_t CalcNumMotionEntriesUsingMotionExcluding(const AZStd::string& motionFilename, EMotionFX::MotionSet* excludedMotionSet); private: - QVBoxLayout* mVLayout = nullptr; + QVBoxLayout* m_vLayout = nullptr; MotionSetTableWidget* m_tableWidget = nullptr; QAction* m_addAction = nullptr; @@ -196,6 +196,6 @@ namespace EMStudio AzQtComponents::FilteredSearchWidget* m_searchWidget = nullptr; AZStd::string m_searchWidgetText; - MotionSetsWindowPlugin* mPlugin = nullptr; + MotionSetsWindowPlugin* m_plugin = nullptr; }; } // namespace EMStudio diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionSetsWindow/MotionSetsWindowPlugin.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionSetsWindow/MotionSetsWindowPlugin.cpp index 3860edd009..bb84dee35d 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionSetsWindow/MotionSetsWindowPlugin.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionSetsWindow/MotionSetsWindowPlugin.cpp @@ -42,7 +42,7 @@ namespace EMStudio public: SaveDirtyMotionSetFilesCallback(MotionSetsWindowPlugin* plugin) - : SaveDirtyFilesCallback() { mPlugin = plugin; } + : SaveDirtyFilesCallback() { m_plugin = plugin; } ~SaveDirtyMotionSetFilesCallback() {} enum @@ -79,7 +79,7 @@ namespace EMStudio // add the link to the actual object ObjectPointer objPointer; - objPointer.mMotionSet = motionSet; + objPointer.m_motionSet = motionSet; outObjects->push_back(objPointer); } } @@ -94,13 +94,13 @@ namespace EMStudio { // get the current object pointer and skip directly if the type check fails ObjectPointer objPointer = objects[i]; - if (objPointer.mMotionSet == nullptr) + if (objPointer.m_motionSet == nullptr) { continue; } - EMotionFX::MotionSet* motionSet = objPointer.mMotionSet; - if (mPlugin->SaveDirtyMotionSet(motionSet, commandGroup, false) == DirtyFileManager::CANCELED) + EMotionFX::MotionSet* motionSet = objPointer.m_motionSet; + if (m_plugin->SaveDirtyMotionSet(motionSet, commandGroup, false) == DirtyFileManager::CANCELED) { return DirtyFileManager::CANCELED; } @@ -117,7 +117,7 @@ namespace EMStudio } private: - MotionSetsWindowPlugin* mPlugin; + MotionSetsWindowPlugin* m_plugin; }; @@ -125,43 +125,42 @@ namespace EMStudio MotionSetsWindowPlugin::MotionSetsWindowPlugin() : EMStudio::DockWidgetPlugin() { - mDialogStack = nullptr; - mSelectedSet = nullptr; - mCreateMotionSetCallback = nullptr; + m_dialogStack = nullptr; + m_selectedSet = nullptr; + m_createMotionSetCallback = nullptr; m_reinitCallback = nullptr; - mAdjustMotionSetCallback = nullptr; - mMotionSetAddMotionCallback = nullptr; - mMotionSetRemoveMotionCallback = nullptr; - mMotionSetAdjustMotionCallback = nullptr; - mLoadMotionSetCallback = nullptr; - //mStringIDWindow = nullptr; - mMotionSetManagementWindow = nullptr; - mMotionSetWindow = nullptr; - mDirtyFilesCallback = nullptr; + m_adjustMotionSetCallback = nullptr; + m_motionSetAddMotionCallback = nullptr; + m_motionSetRemoveMotionCallback = nullptr; + m_motionSetAdjustMotionCallback = nullptr; + m_loadMotionSetCallback = nullptr; + m_motionSetManagementWindow = nullptr; + m_motionSetWindow = nullptr; + m_dirtyFilesCallback = nullptr; } // destructor MotionSetsWindowPlugin::~MotionSetsWindowPlugin() { - GetCommandManager()->RemoveCommandCallback(mCreateMotionSetCallback, false); + GetCommandManager()->RemoveCommandCallback(m_createMotionSetCallback, false); GetCommandManager()->RemoveCommandCallback(m_reinitCallback, false); - GetCommandManager()->RemoveCommandCallback(mAdjustMotionSetCallback, false); - GetCommandManager()->RemoveCommandCallback(mMotionSetAddMotionCallback, false); - GetCommandManager()->RemoveCommandCallback(mMotionSetRemoveMotionCallback, false); - GetCommandManager()->RemoveCommandCallback(mMotionSetAdjustMotionCallback, false); - GetCommandManager()->RemoveCommandCallback(mLoadMotionSetCallback, false); + GetCommandManager()->RemoveCommandCallback(m_adjustMotionSetCallback, false); + GetCommandManager()->RemoveCommandCallback(m_motionSetAddMotionCallback, false); + GetCommandManager()->RemoveCommandCallback(m_motionSetRemoveMotionCallback, false); + GetCommandManager()->RemoveCommandCallback(m_motionSetAdjustMotionCallback, false); + GetCommandManager()->RemoveCommandCallback(m_loadMotionSetCallback, false); - delete mCreateMotionSetCallback; + delete m_createMotionSetCallback; delete m_reinitCallback; - delete mAdjustMotionSetCallback; - delete mMotionSetAddMotionCallback; - delete mMotionSetRemoveMotionCallback; - delete mMotionSetAdjustMotionCallback; - delete mLoadMotionSetCallback; + delete m_adjustMotionSetCallback; + delete m_motionSetAddMotionCallback; + delete m_motionSetRemoveMotionCallback; + delete m_motionSetAdjustMotionCallback; + delete m_loadMotionSetCallback; - GetMainWindow()->GetDirtyFileManager()->RemoveCallback(mDirtyFilesCallback, false); - delete mDirtyFilesCallback; + GetMainWindow()->GetDirtyFileManager()->RemoveCallback(m_dirtyFilesCallback, false); + delete m_dirtyFilesCallback; } @@ -176,49 +175,49 @@ namespace EMStudio // init after the parent dock window has been created bool MotionSetsWindowPlugin::Init() { - mCreateMotionSetCallback = new CommandCreateMotionSetCallback(false); + m_createMotionSetCallback = new CommandCreateMotionSetCallback(false); m_reinitCallback = new CommandReinitCallback(false); - mAdjustMotionSetCallback = new CommandAdjustMotionSetCallback(false); - mMotionSetAddMotionCallback = new CommandMotionSetAddMotionCallback(false); - mMotionSetRemoveMotionCallback = new CommandMotionSetRemoveMotionCallback(false); - mMotionSetAdjustMotionCallback = new CommandMotionSetAdjustMotionCallback(false); - mLoadMotionSetCallback = new CommandLoadMotionSetCallback(false); + m_adjustMotionSetCallback = new CommandAdjustMotionSetCallback(false); + m_motionSetAddMotionCallback = new CommandMotionSetAddMotionCallback(false); + m_motionSetRemoveMotionCallback = new CommandMotionSetRemoveMotionCallback(false); + m_motionSetAdjustMotionCallback = new CommandMotionSetAdjustMotionCallback(false); + m_loadMotionSetCallback = new CommandLoadMotionSetCallback(false); - GetCommandManager()->RegisterCommandCallback("CreateMotionSet", mCreateMotionSetCallback); + GetCommandManager()->RegisterCommandCallback("CreateMotionSet", m_createMotionSetCallback); GetCommandManager()->RegisterCommandCallback("RemoveMotionSet", m_reinitCallback); - GetCommandManager()->RegisterCommandCallback("AdjustMotionSet", mAdjustMotionSetCallback); + GetCommandManager()->RegisterCommandCallback("AdjustMotionSet", m_adjustMotionSetCallback); - GetCommandManager()->RegisterCommandCallback("MotionSetAddMotion", mMotionSetAddMotionCallback); - GetCommandManager()->RegisterCommandCallback("MotionSetRemoveMotion", mMotionSetRemoveMotionCallback); - GetCommandManager()->RegisterCommandCallback("MotionSetAdjustMotion", mMotionSetAdjustMotionCallback); - GetCommandManager()->RegisterCommandCallback("LoadMotionSet", mLoadMotionSetCallback); + GetCommandManager()->RegisterCommandCallback("MotionSetAddMotion", m_motionSetAddMotionCallback); + GetCommandManager()->RegisterCommandCallback("MotionSetRemoveMotion", m_motionSetRemoveMotionCallback); + GetCommandManager()->RegisterCommandCallback("MotionSetAdjustMotion", m_motionSetAdjustMotionCallback); + GetCommandManager()->RegisterCommandCallback("LoadMotionSet", m_loadMotionSetCallback); GetCommandManager()->RegisterCommandCallback("RemoveMotion", m_reinitCallback); // create the dialog stack - assert(mDialogStack == nullptr); - mDialogStack = new MysticQt::DialogStack(mDock); - mDock->setWidget(mDialogStack); + assert(m_dialogStack == nullptr); + m_dialogStack = new MysticQt::DialogStack(m_dock); + m_dock->setWidget(m_dialogStack); // connect the window activation signal to refresh if reactivated - connect(mDock, &QDockWidget::visibilityChanged, this, &MotionSetsWindowPlugin::WindowReInit); + connect(m_dock, &QDockWidget::visibilityChanged, this, &MotionSetsWindowPlugin::WindowReInit); // create the set management window - mMotionSetManagementWindow = new MotionSetManagementWindow(this, mDialogStack); - mMotionSetManagementWindow->Init(); - mDialogStack->Add(mMotionSetManagementWindow, "Motion Set Management", false, true, true, false); + m_motionSetManagementWindow = new MotionSetManagementWindow(this, m_dialogStack); + m_motionSetManagementWindow->Init(); + m_dialogStack->Add(m_motionSetManagementWindow, "Motion Set Management", false, true, true, false); // create the motion set properties window - mMotionSetWindow = new MotionSetWindow(this, mDialogStack); - mMotionSetWindow->Init(); - mDialogStack->Add(mMotionSetWindow, "Motion Set", false, true); + m_motionSetWindow = new MotionSetWindow(this, m_dialogStack); + m_motionSetWindow->Init(); + m_dialogStack->Add(m_motionSetWindow, "Motion Set", false, true); ReInit(); SetSelectedSet(nullptr); // initialize the dirty files callback - mDirtyFilesCallback = new SaveDirtyMotionSetFilesCallback(this); - GetMainWindow()->GetDirtyFileManager()->AddCallback(mDirtyFilesCallback); + m_dirtyFilesCallback = new SaveDirtyMotionSetFilesCallback(this); + GetMainWindow()->GetDirtyFileManager()->AddCallback(m_dirtyFilesCallback); return true; } @@ -226,26 +225,26 @@ namespace EMStudio EMotionFX::MotionSet* MotionSetsWindowPlugin::GetSelectedSet() const { - if (EMotionFX::GetMotionManager().FindMotionSetIndex(mSelectedSet) == InvalidIndex) + if (EMotionFX::GetMotionManager().FindMotionSetIndex(m_selectedSet) == InvalidIndex) { return nullptr; } - return mSelectedSet; + return m_selectedSet; } void MotionSetsWindowPlugin::ReInit() { // Validate existence of selected motion set and reset selection in case selection is invalid. - if (EMotionFX::GetMotionManager().FindMotionSetIndex(mSelectedSet) == InvalidIndex) + if (EMotionFX::GetMotionManager().FindMotionSetIndex(m_selectedSet) == InvalidIndex) { - mSelectedSet = nullptr; + m_selectedSet = nullptr; } - SetSelectedSet(mSelectedSet); - mMotionSetManagementWindow->ReInit(); - mMotionSetWindow->ReInit(); + SetSelectedSet(m_selectedSet); + m_motionSetManagementWindow->ReInit(); + m_motionSetWindow->ReInit(); } @@ -334,16 +333,16 @@ namespace EMStudio void MotionSetsWindowPlugin::SetSelectedSet(EMotionFX::MotionSet* motionSet) { - mSelectedSet = motionSet; + m_selectedSet = motionSet; if (motionSet) { - mMotionSetManagementWindow->SelectItemsById(motionSet->GetID()); + m_motionSetManagementWindow->SelectItemsById(motionSet->GetID()); } - mMotionSetManagementWindow->ReInit(); - mMotionSetManagementWindow->UpdateInterface(); - mMotionSetWindow->ReInit(); - mMotionSetWindow->UpdateInterface(); + m_motionSetManagementWindow->ReInit(); + m_motionSetManagementWindow->UpdateInterface(); + m_motionSetWindow->ReInit(); + m_motionSetWindow->UpdateInterface(); } diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionSetsWindow/MotionSetsWindowPlugin.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionSetsWindow/MotionSetsWindowPlugin.h index 4b7b16f5f5..459118c831 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionSetsWindow/MotionSetsWindowPlugin.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionSetsWindow/MotionSetsWindowPlugin.h @@ -72,8 +72,8 @@ namespace EMStudio void SetSelectedSet(EMotionFX::MotionSet* motionSet); int SaveDirtyMotionSet(EMotionFX::MotionSet* motionSet, MCore::CommandGroup* commandGroup, bool askBeforeSaving, bool showCancelButton = true); - MotionSetManagementWindow* GetManagementWindow() { return mMotionSetManagementWindow; } - MotionSetWindow* GetMotionSetWindow() { return mMotionSetWindow; } + MotionSetManagementWindow* GetManagementWindow() { return m_motionSetManagementWindow; } + MotionSetWindow* GetMotionSetWindow() { return m_motionSetWindow; } int OnSaveDirtyMotionSets(); void LoadMotionSet(AZStd::string filename); @@ -94,22 +94,21 @@ namespace EMStudio MCORE_DEFINECOMMANDCALLBACK(CommandMotionSetAdjustMotionCallback); MCORE_DEFINECOMMANDCALLBACK(CommandLoadMotionSetCallback); - CommandCreateMotionSetCallback* mCreateMotionSetCallback; + CommandCreateMotionSetCallback* m_createMotionSetCallback; CommandReinitCallback* m_reinitCallback; - CommandAdjustMotionSetCallback* mAdjustMotionSetCallback; - CommandMotionSetAddMotionCallback* mMotionSetAddMotionCallback; - CommandMotionSetRemoveMotionCallback* mMotionSetRemoveMotionCallback; - CommandMotionSetAdjustMotionCallback* mMotionSetAdjustMotionCallback; - CommandLoadMotionSetCallback* mLoadMotionSetCallback; + CommandAdjustMotionSetCallback* m_adjustMotionSetCallback; + CommandMotionSetAddMotionCallback* m_motionSetAddMotionCallback; + CommandMotionSetRemoveMotionCallback* m_motionSetRemoveMotionCallback; + CommandMotionSetAdjustMotionCallback* m_motionSetAdjustMotionCallback; + CommandLoadMotionSetCallback* m_loadMotionSetCallback; - MotionSetManagementWindow* mMotionSetManagementWindow; - MotionSetWindow* mMotionSetWindow; + MotionSetManagementWindow* m_motionSetManagementWindow; + MotionSetWindow* m_motionSetWindow; - MysticQt::DialogStack* mDialogStack; - //MotionSetStringIDWindow* mStringIDWindow; + MysticQt::DialogStack* m_dialogStack; - EMotionFX::MotionSet* mSelectedSet; + EMotionFX::MotionSet* m_selectedSet; - SaveDirtyMotionSetFilesCallback* mDirtyFilesCallback; + SaveDirtyMotionSetFilesCallback* m_dirtyFilesCallback; }; } // namespace EMStudio diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionWindow/MotionExtractionWindow.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionWindow/MotionExtractionWindow.cpp index 419535da81..de5eb31d92 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionWindow/MotionExtractionWindow.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionWindow/MotionExtractionWindow.cpp @@ -31,32 +31,32 @@ namespace EMStudio MotionExtractionWindow::MotionExtractionWindow(QWidget* parent, MotionWindowPlugin* motionWindowPlugin) : QWidget(parent) { - mMotionWindowPlugin = motionWindowPlugin; - mSelectCallback = nullptr; - mUnselectCallback = nullptr; - mClearSelectionCallback = nullptr; - mWarningWidget = nullptr; - mMainVerticalLayout = nullptr; - mChildVerticalLayout = nullptr; - mMotionExtractionNodeSelectionWindow= nullptr; - mWarningSelectNodeLink = nullptr; - mAdjustActorCallback = nullptr; - mCaptureHeight = nullptr; - mWarningShowed = false; + m_motionWindowPlugin = motionWindowPlugin; + m_selectCallback = nullptr; + m_unselectCallback = nullptr; + m_clearSelectionCallback = nullptr; + m_warningWidget = nullptr; + m_mainVerticalLayout = nullptr; + m_childVerticalLayout = nullptr; + m_motionExtractionNodeSelectionWindow= nullptr; + m_warningSelectNodeLink = nullptr; + m_adjustActorCallback = nullptr; + m_captureHeight = nullptr; + m_warningShowed = false; } // destructor MotionExtractionWindow::~MotionExtractionWindow() { - GetCommandManager()->RemoveCommandCallback(mSelectCallback, false); - GetCommandManager()->RemoveCommandCallback(mUnselectCallback, false); - GetCommandManager()->RemoveCommandCallback(mClearSelectionCallback, false); - GetCommandManager()->RemoveCommandCallback(mAdjustActorCallback, false); - delete mAdjustActorCallback; - delete mSelectCallback; - delete mUnselectCallback; - delete mClearSelectionCallback; + GetCommandManager()->RemoveCommandCallback(m_selectCallback, false); + GetCommandManager()->RemoveCommandCallback(m_unselectCallback, false); + GetCommandManager()->RemoveCommandCallback(m_clearSelectionCallback, false); + GetCommandManager()->RemoveCommandCallback(m_adjustActorCallback, false); + delete m_adjustActorCallback; + delete m_selectCallback; + delete m_unselectCallback; + delete m_clearSelectionCallback; } @@ -65,21 +65,21 @@ namespace EMStudio // Create the flags widget. void MotionExtractionWindow::CreateFlagsWidget() { - mFlagsWidget = new QWidget(); + m_flagsWidget = new QWidget(); - mCaptureHeight = new QCheckBox(); - AzQtComponents::CheckBox::applyToggleSwitchStyle(mCaptureHeight); - connect(mCaptureHeight, &QCheckBox::clicked, this, &MotionExtractionWindow::OnMotionExtractionFlagsUpdated); + m_captureHeight = new QCheckBox(); + AzQtComponents::CheckBox::applyToggleSwitchStyle(m_captureHeight); + connect(m_captureHeight, &QCheckBox::clicked, this, &MotionExtractionWindow::OnMotionExtractionFlagsUpdated); QGridLayout* layout = new QGridLayout(); layout->setAlignment(Qt::AlignTop); layout->setSpacing(3); layout->addWidget(new QLabel(tr("Capture Height Changes")), 0, 0); - layout->addWidget(mCaptureHeight, 0, 1); + layout->addWidget(m_captureHeight, 0, 1); layout->setContentsMargins(0, 0, 0, 0); - mFlagsWidget->setLayout(layout); + m_flagsWidget->setLayout(layout); - mChildVerticalLayout->addWidget(mFlagsWidget); + m_childVerticalLayout->addWidget(m_flagsWidget); } @@ -87,17 +87,17 @@ namespace EMStudio void MotionExtractionWindow::CreateWarningWidget() { // create the warning widget - mWarningWidget = new QWidget(); - mWarningWidget->setMinimumHeight(MOTIONEXTRACTIONWINDOW_HEIGHT); - mWarningWidget->setMaximumHeight(MOTIONEXTRACTIONWINDOW_HEIGHT); + m_warningWidget = new QWidget(); + m_warningWidget->setMinimumHeight(MOTIONEXTRACTIONWINDOW_HEIGHT); + m_warningWidget->setMaximumHeight(MOTIONEXTRACTIONWINDOW_HEIGHT); QLabel* warningLabel = new QLabel("No node has been selected yet to enable Motion Extraction."); warningLabel->setWordWrap(true); warningLabel->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed); - mWarningSelectNodeLink = new AzQtComponents::BrowseEdit(mWarningWidget); - mWarningSelectNodeLink->setPlaceholderText("Click here to setup the Motion Extraction node"); - connect(mWarningSelectNodeLink, &AzQtComponents::BrowseEdit::attachedButtonTriggered, this, &MotionExtractionWindow::OnSelectMotionExtractionNode); + m_warningSelectNodeLink = new AzQtComponents::BrowseEdit(m_warningWidget); + m_warningSelectNodeLink->setPlaceholderText("Click here to setup the Motion Extraction node"); + connect(m_warningSelectNodeLink, &AzQtComponents::BrowseEdit::attachedButtonTriggered, this, &MotionExtractionWindow::OnSelectMotionExtractionNode); // create and fill the layout QVBoxLayout* layout = new QVBoxLayout(); @@ -106,12 +106,12 @@ namespace EMStudio layout->setContentsMargins(0, 0, 0, 0); layout->addWidget(warningLabel); - layout->addWidget(mWarningSelectNodeLink); + layout->addWidget(m_warningSelectNodeLink); - mWarningWidget->setLayout(layout); + m_warningWidget->setLayout(layout); // add it to our main layout - mChildVerticalLayout->addWidget(mWarningWidget); + m_childVerticalLayout->addWidget(m_warningWidget); } @@ -119,23 +119,23 @@ namespace EMStudio void MotionExtractionWindow::Init() { // create and register the command callbacks - mSelectCallback = new CommandSelectCallback(false); - mUnselectCallback = new CommandUnselectCallback(false); - mClearSelectionCallback = new CommandClearSelectionCallback(false); - mAdjustActorCallback = new CommandAdjustActorCallback(false); - GetCommandManager()->RegisterCommandCallback("AdjustActor", mAdjustActorCallback); - GetCommandManager()->RegisterCommandCallback("Select", mSelectCallback); - GetCommandManager()->RegisterCommandCallback("Unselect", mUnselectCallback); - GetCommandManager()->RegisterCommandCallback("ClearSelection", mClearSelectionCallback); + m_selectCallback = new CommandSelectCallback(false); + m_unselectCallback = new CommandUnselectCallback(false); + m_clearSelectionCallback = new CommandClearSelectionCallback(false); + m_adjustActorCallback = new CommandAdjustActorCallback(false); + GetCommandManager()->RegisterCommandCallback("AdjustActor", m_adjustActorCallback); + GetCommandManager()->RegisterCommandCallback("Select", m_selectCallback); + GetCommandManager()->RegisterCommandCallback("Unselect", m_unselectCallback); + GetCommandManager()->RegisterCommandCallback("ClearSelection", m_clearSelectionCallback); // create the node selection windows - mMotionExtractionNodeSelectionWindow = new NodeSelectionWindow(this, true); - connect(mMotionExtractionNodeSelectionWindow->GetNodeHierarchyWidget(), &NodeHierarchyWidget::OnSelectionDone, this, &MotionExtractionWindow::OnMotionExtractionNodeSelected); + m_motionExtractionNodeSelectionWindow = new NodeSelectionWindow(this, true); + connect(m_motionExtractionNodeSelectionWindow->GetNodeHierarchyWidget(), &NodeHierarchyWidget::OnSelectionDone, this, &MotionExtractionWindow::OnMotionExtractionNodeSelected); // set some layout for our window - mMainVerticalLayout = new QVBoxLayout(); - mMainVerticalLayout->setSpacing(0); - setLayout(mMainVerticalLayout); + m_mainVerticalLayout = new QVBoxLayout(); + m_mainVerticalLayout->setSpacing(0); + setLayout(m_mainVerticalLayout); QCheckBox* checkBox = new QCheckBox(tr("Motion extraction")); checkBox->setChecked(true); @@ -160,17 +160,17 @@ namespace EMStudio {\ image: url(:/Cards/img/UI20/Cards/caret-right.svg);\ }"); - mMainVerticalLayout->addWidget(checkBox); + m_mainVerticalLayout->addWidget(checkBox); QWidget* childWidget = new QWidget(this); - mMainVerticalLayout->addWidget(childWidget); + m_mainVerticalLayout->addWidget(childWidget); - mChildVerticalLayout = new QVBoxLayout(childWidget); - mChildVerticalLayout->setContentsMargins(28,0,0,0); + m_childVerticalLayout = new QVBoxLayout(childWidget); + m_childVerticalLayout->setContentsMargins(28,0,0,0); connect(checkBox, &QCheckBox::toggled, childWidget, &QWidget::setVisible); // default create the warning widget (this is needed else we're getting a crash when switching layouts as the widget and the flag might be out of sync) CreateWarningWidget(); - mWarningShowed = true; + m_warningShowed = true; // update interface UpdateInterface(); @@ -191,9 +191,9 @@ namespace EMStudio EMotionFX::Actor* actor = nullptr; EMotionFX::Node* extractionNode = nullptr; - if (mCaptureHeight) + if (m_captureHeight) { - mCaptureHeight->setEnabled( isEnabled ); + m_captureHeight->setEnabled( isEnabled ); } if (actorInstance) @@ -205,51 +205,51 @@ namespace EMStudio if (extractionNode == nullptr) { // Check if we already show the warning widget, if yes, do nothing. - if (mWarningShowed == false) + if (m_warningShowed == false) { CreateWarningWidget(); - if (mFlagsWidget) + if (m_flagsWidget) { - mFlagsWidget->hide(); - mFlagsWidget->deleteLater(); - mFlagsWidget = nullptr; - mCaptureHeight = nullptr; + m_flagsWidget->hide(); + m_flagsWidget->deleteLater(); + m_flagsWidget = nullptr; + m_captureHeight = nullptr; } } // Disable the link in case no actor is selected. if (actorInstance == nullptr) { - mWarningSelectNodeLink->setEnabled(false); + m_warningSelectNodeLink->setEnabled(false); } else { - mWarningSelectNodeLink->setEnabled(true); + m_warningSelectNodeLink->setEnabled(true); } // Return directly in case we show the warning widget. - mWarningShowed = true; + m_warningShowed = true; return; } else { // Check if we already show the motion extraction flags widget, if yes, do nothing. - if (mWarningShowed) + if (m_warningShowed) { - if (mWarningWidget) + if (m_warningWidget) { - mWarningWidget->hide(); - mWarningWidget->deleteLater(); - mWarningWidget = nullptr; + m_warningWidget->hide(); + m_warningWidget->deleteLater(); + m_warningWidget = nullptr; } CreateFlagsWidget(); } - if (mCaptureHeight) + if (m_captureHeight) { - mCaptureHeight->setEnabled( isEnabled ); + m_captureHeight->setEnabled( isEnabled ); } // Figure out if all selected motions use the same settings. @@ -280,31 +280,31 @@ namespace EMStudio // Adjust the height capture checkbox, based on the selected motions. const bool triState = (numMotions > 1) && !allCaptureHeightEqual; - mCaptureHeight->setTristate( triState ); + m_captureHeight->setTristate( triState ); if (numMotions > 1) { if (!allCaptureHeightEqual) { - mCaptureHeight->setCheckState( Qt::CheckState::PartiallyChecked ); + m_captureHeight->setCheckState( Qt::CheckState::PartiallyChecked ); } else { - mCaptureHeight->setChecked( curCaptureHeight ); + m_captureHeight->setChecked( curCaptureHeight ); } } else { if (numCaptureHeight > 0) { - mCaptureHeight->setCheckState( Qt::CheckState::Checked ); + m_captureHeight->setCheckState( Qt::CheckState::Checked ); } else { - mCaptureHeight->setCheckState( Qt::CheckState::Unchecked ); + m_captureHeight->setCheckState( Qt::CheckState::Unchecked ); } } - mWarningShowed = false; + m_warningShowed = false; } } @@ -314,7 +314,7 @@ namespace EMStudio { int flags = 0; - if (mCaptureHeight->checkState() == Qt::CheckState::Checked) + if (m_captureHeight->checkState() == Qt::CheckState::Checked) flags |= EMotionFX::MOTIONEXTRACT_CAPTURE_Z; return static_cast(flags); @@ -388,8 +388,8 @@ namespace EMStudio return; } - mMotionExtractionNodeSelectionWindow->Update(actorInstance->GetID()); - mMotionExtractionNodeSelectionWindow->show(); + m_motionExtractionNodeSelectionWindow->Update(actorInstance->GetID()); + m_motionExtractionNodeSelectionWindow->show(); } diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionWindow/MotionExtractionWindow.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionWindow/MotionExtractionWindow.h index cb7371a74d..5e314df323 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionWindow/MotionExtractionWindow.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionWindow/MotionExtractionWindow.h @@ -61,28 +61,28 @@ namespace EMStudio MCORE_DEFINECOMMANDCALLBACK(CommandUnselectCallback); MCORE_DEFINECOMMANDCALLBACK(CommandClearSelectionCallback); MCORE_DEFINECOMMANDCALLBACK(CommandAdjustActorCallback); - CommandSelectCallback* mSelectCallback; - CommandUnselectCallback* mUnselectCallback; - CommandClearSelectionCallback* mClearSelectionCallback; - CommandAdjustActorCallback* mAdjustActorCallback; + CommandSelectCallback* m_selectCallback; + CommandUnselectCallback* m_unselectCallback; + CommandClearSelectionCallback* m_clearSelectionCallback; + CommandAdjustActorCallback* m_adjustActorCallback; // general - MotionWindowPlugin* mMotionWindowPlugin; - QCheckBox* mAutoMode; + MotionWindowPlugin* m_motionWindowPlugin; + QCheckBox* m_autoMode; // flags widget - QWidget* mFlagsWidget; - QCheckBox* mCaptureHeight; + QWidget* m_flagsWidget; + QCheckBox* m_captureHeight; // - QVBoxLayout* mMainVerticalLayout; - QVBoxLayout* mChildVerticalLayout; - QWidget* mWarningWidget; - bool mWarningShowed; + QVBoxLayout* m_mainVerticalLayout; + QVBoxLayout* m_childVerticalLayout; + QWidget* m_warningWidget; + bool m_warningShowed; // motion extraction node selection - NodeSelectionWindow* mMotionExtractionNodeSelectionWindow; - AzQtComponents::BrowseEdit* mWarningSelectNodeLink; + NodeSelectionWindow* m_motionExtractionNodeSelectionWindow; + AzQtComponents::BrowseEdit* m_warningSelectNodeLink; // helper functions void CreateFlagsWidget(); diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionWindow/MotionListWindow.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionWindow/MotionListWindow.cpp index c909098dae..0940a620e6 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionWindow/MotionListWindow.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionWindow/MotionListWindow.cpp @@ -124,8 +124,8 @@ namespace EMStudio : QWidget(parent) { setObjectName("MotionListWindow"); - mMotionTable = nullptr; - mMotionWindowPlugin = motionWindowPlugin; + m_motionTable = nullptr; + m_motionWindowPlugin = motionWindowPlugin; } @@ -137,77 +137,77 @@ namespace EMStudio void MotionListWindow::Init() { - mVLayout = new QVBoxLayout(); - mVLayout->setMargin(3); - mVLayout->setSpacing(2); - mMotionTable = new MotionTableWidget(mMotionWindowPlugin, this); - mMotionTable->setObjectName("EMFX.MotionListWindow.MotionTable"); - mMotionTable->setAlternatingRowColors(true); - connect(mMotionTable, &MotionTableWidget::cellDoubleClicked, this, &MotionListWindow::cellDoubleClicked); - connect(mMotionTable, &MotionTableWidget::itemSelectionChanged, this, &MotionListWindow::itemSelectionChanged); + m_vLayout = new QVBoxLayout(); + m_vLayout->setMargin(3); + m_vLayout->setSpacing(2); + m_motionTable = new MotionTableWidget(m_motionWindowPlugin, this); + m_motionTable->setObjectName("EMFX.MotionListWindow.MotionTable"); + m_motionTable->setAlternatingRowColors(true); + connect(m_motionTable, &MotionTableWidget::cellDoubleClicked, this, &MotionListWindow::cellDoubleClicked); + connect(m_motionTable, &MotionTableWidget::itemSelectionChanged, this, &MotionListWindow::itemSelectionChanged); // set the table to row single selection - mMotionTable->setSelectionBehavior(QAbstractItemView::SelectRows); - mMotionTable->setSelectionMode(QAbstractItemView::ExtendedSelection); + m_motionTable->setSelectionBehavior(QAbstractItemView::SelectRows); + m_motionTable->setSelectionMode(QAbstractItemView::ExtendedSelection); // make the table items read only - mMotionTable->setEditTriggers(QAbstractItemView::NoEditTriggers); + m_motionTable->setEditTriggers(QAbstractItemView::NoEditTriggers); // disable the corner button between the row and column selection thingies - mMotionTable->setCornerButtonEnabled(false); + m_motionTable->setCornerButtonEnabled(false); // enable the custom context menu for the motion table - mMotionTable->setContextMenuPolicy(Qt::DefaultContextMenu); + m_motionTable->setContextMenuPolicy(Qt::DefaultContextMenu); // set the column count - mMotionTable->setColumnCount(5); + m_motionTable->setColumnCount(5); // add the name column QTableWidgetItem* nameHeaderItem = new QTableWidgetItem("Name"); nameHeaderItem->setTextAlignment(Qt::AlignVCenter | Qt::AlignLeft); - mMotionTable->setHorizontalHeaderItem(0, nameHeaderItem); + m_motionTable->setHorizontalHeaderItem(0, nameHeaderItem); // add the length column QTableWidgetItem* lengthHeaderItem = new QTableWidgetItem("Duration"); lengthHeaderItem->setTextAlignment(Qt::AlignVCenter | Qt::AlignLeft); - mMotionTable->setHorizontalHeaderItem(1, lengthHeaderItem); + m_motionTable->setHorizontalHeaderItem(1, lengthHeaderItem); // add the sub column QTableWidgetItem* subHeaderItem = new QTableWidgetItem("Joints"); subHeaderItem->setToolTip("Number of joints inside the motion"); subHeaderItem->setTextAlignment(Qt::AlignVCenter | Qt::AlignLeft); - mMotionTable->setHorizontalHeaderItem(2, subHeaderItem); + m_motionTable->setHorizontalHeaderItem(2, subHeaderItem); // add the msub column QTableWidgetItem* msubHeaderItem = new QTableWidgetItem("Morphs"); msubHeaderItem->setToolTip("Number of morph targets inside the motion"); msubHeaderItem->setTextAlignment(Qt::AlignVCenter | Qt::AlignLeft); - mMotionTable->setHorizontalHeaderItem(3, msubHeaderItem); + m_motionTable->setHorizontalHeaderItem(3, msubHeaderItem); // add the type column QTableWidgetItem* typeHeaderItem = new QTableWidgetItem("Type"); typeHeaderItem->setTextAlignment(Qt::AlignVCenter | Qt::AlignLeft); - mMotionTable->setHorizontalHeaderItem(4, typeHeaderItem); + m_motionTable->setHorizontalHeaderItem(4, typeHeaderItem); // set the sorting order on the first column - mMotionTable->horizontalHeader()->setSortIndicator(0, Qt::AscendingOrder); + m_motionTable->horizontalHeader()->setSortIndicator(0, Qt::AscendingOrder); // hide the vertical columns - QHeaderView* verticalHeader = mMotionTable->verticalHeader(); + QHeaderView* verticalHeader = m_motionTable->verticalHeader(); verticalHeader->setVisible(false); // set the last column to take the whole available space - mMotionTable->horizontalHeader()->setStretchLastSection(true); + m_motionTable->horizontalHeader()->setStretchLastSection(true); // set the column width - mMotionTable->setColumnWidth(0, 300); - mMotionTable->setColumnWidth(1, 55); - mMotionTable->setColumnWidth(2, 50); - mMotionTable->setColumnWidth(3, 55); - mMotionTable->setColumnWidth(4, 105); + m_motionTable->setColumnWidth(0, 300); + m_motionTable->setColumnWidth(1, 55); + m_motionTable->setColumnWidth(2, 50); + m_motionTable->setColumnWidth(3, 55); + m_motionTable->setColumnWidth(4, 105); - mVLayout->addWidget(mMotionTable); - setLayout(mVLayout); + m_vLayout->addWidget(m_motionTable); + setLayout(m_vLayout); ReInit(); } @@ -224,7 +224,7 @@ namespace EMStudio bool MotionListWindow::AddMotionByID(uint32 motionID) { // find the motion entry based on the id - MotionWindowPlugin::MotionTableEntry* motionEntry = mMotionWindowPlugin->FindMotionEntryByID(motionID); + MotionWindowPlugin::MotionTableEntry* motionEntry = m_motionWindowPlugin->FindMotionEntryByID(motionID); if (motionEntry == nullptr) { return false; @@ -237,15 +237,15 @@ namespace EMStudio } // get the motion - EMotionFX::Motion* motion = motionEntry->mMotion; + EMotionFX::Motion* motion = motionEntry->m_motion; // disable the sorting - mMotionTable->setSortingEnabled(false); + m_motionTable->setSortingEnabled(false); // insert the new row const int rowIndex = 0; - mMotionTable->insertRow(rowIndex); - mMotionTable->setRowHeight(rowIndex, 21); + m_motionTable->insertRow(rowIndex); + m_motionTable->setRowHeight(rowIndex, 21); // create the name item QTableWidgetItem* nameTableItem = new QTableWidgetItem(motion->GetName()); @@ -257,7 +257,7 @@ namespace EMStudio nameTableItem->setToolTip(motion->GetFileName()); // set the item in the motion table - mMotionTable->setItem(rowIndex, 0, nameTableItem); + m_motionTable->setItem(rowIndex, 0, nameTableItem); // create the length item AZStd::string length; @@ -265,7 +265,7 @@ namespace EMStudio QTableWidgetItem* lengthTableItem = new QTableWidgetItem(length.c_str()); // set the item in the motion table - mMotionTable->setItem(rowIndex, 1, lengthTableItem); + m_motionTable->setItem(rowIndex, 1, lengthTableItem); // set the sub and msub text AZStd::string sub, msub; @@ -278,12 +278,12 @@ namespace EMStudio QTableWidgetItem* msubTableItem = new QTableWidgetItem(msub.c_str()); // set the items in the motion table - mMotionTable->setItem(rowIndex, 2, subTableItem); - mMotionTable->setItem(rowIndex, 3, msubTableItem); + m_motionTable->setItem(rowIndex, 2, subTableItem); + m_motionTable->setItem(rowIndex, 3, msubTableItem); // create and set the type item QTableWidgetItem* typeTableItem = new QTableWidgetItem(motionData->RTTI_GetTypeName()); - mMotionTable->setItem(rowIndex, 4, typeTableItem); + m_motionTable->setItem(rowIndex, 4, typeTableItem); // set the items italic if the motion is dirty if (motion->GetDirtyFlag()) @@ -301,7 +301,7 @@ namespace EMStudio } // enable the sorting - mMotionTable->setSortingEnabled(true); + m_motionTable->setSortingEnabled(true); // update the interface UpdateInterface(); @@ -314,7 +314,7 @@ namespace EMStudio uint32 MotionListWindow::FindRowByMotionID(uint32 motionID) { // iterate through the rows and compare the motion IDs - const int rowCount = mMotionTable->rowCount(); + const int rowCount = m_motionTable->rowCount(); for (int i = 0; i < rowCount; ++i) { if (GetMotionID(i) == motionID) @@ -338,7 +338,7 @@ namespace EMStudio } // remove the row - mMotionTable->removeRow(rowIndex); + m_motionTable->removeRow(rowIndex); // update the interface UpdateInterface(); @@ -350,12 +350,12 @@ namespace EMStudio bool MotionListWindow::CheckIfIsMotionVisible(MotionWindowPlugin::MotionTableEntry* entry) { - if (entry->mMotion->GetIsOwnedByRuntime()) + if (entry->m_motion->GetIsOwnedByRuntime()) { return false; } - AZStd::string motionNameLowered = entry->mMotion->GetNameString(); + AZStd::string motionNameLowered = entry->m_motion->GetNameString(); AZStd::to_lower(motionNameLowered.begin(), motionNameLowered.end()); if (m_searchWidgetText.empty() || motionNameLowered.find(m_searchWidgetText) != AZStd::string::npos) { @@ -369,33 +369,33 @@ namespace EMStudio { const CommandSystem::SelectionList selection = GetCommandManager()->GetCurrentSelection(); - size_t numMotions = mMotionWindowPlugin->GetNumMotionEntries(); - mShownMotionEntries.clear(); - mShownMotionEntries.reserve(numMotions); + size_t numMotions = m_motionWindowPlugin->GetNumMotionEntries(); + m_shownMotionEntries.clear(); + m_shownMotionEntries.reserve(numMotions); for (size_t i = 0; i < numMotions; ++i) { - MotionWindowPlugin::MotionTableEntry* entry = mMotionWindowPlugin->GetMotionEntry(i); + MotionWindowPlugin::MotionTableEntry* entry = m_motionWindowPlugin->GetMotionEntry(i); if (CheckIfIsMotionVisible(entry)) { - mShownMotionEntries.push_back(entry); + m_shownMotionEntries.push_back(entry); } } - numMotions = mShownMotionEntries.size(); + numMotions = m_shownMotionEntries.size(); // set the number of rows - mMotionTable->setRowCount(static_cast(numMotions)); + m_motionTable->setRowCount(static_cast(numMotions)); // set the sorting disabled - mMotionTable->setSortingEnabled(false); + m_motionTable->setSortingEnabled(false); // iterate through the motions and fill in the table for (int i = 0; i < numMotions; ++i) { - EMotionFX::Motion* motion = mShownMotionEntries[static_cast(i)]->mMotion; + EMotionFX::Motion* motion = m_shownMotionEntries[static_cast(i)]->m_motion; // set the row height - mMotionTable->setRowHeight(i, 21); + m_motionTable->setRowHeight(i, 21); // create the name item QTableWidgetItem* nameTableItem = new QTableWidgetItem(motion->GetName()); @@ -407,7 +407,7 @@ namespace EMStudio nameTableItem->setToolTip(motion->GetFileName()); // set the item in the motion table - mMotionTable->setItem(i, 0, nameTableItem); + m_motionTable->setItem(i, 0, nameTableItem); // create the length item AZStd::string length; @@ -415,7 +415,7 @@ namespace EMStudio QTableWidgetItem* lengthTableItem = new QTableWidgetItem(length.c_str()); // set the item in the motion table - mMotionTable->setItem(i, 1, lengthTableItem); + m_motionTable->setItem(i, 1, lengthTableItem); // set the sub and msub text AZStd::string sub, msub; @@ -428,12 +428,12 @@ namespace EMStudio QTableWidgetItem* msubTableItem = new QTableWidgetItem(msub.c_str()); // set the items in the motion table - mMotionTable->setItem(i, 2, subTableItem); - mMotionTable->setItem(i, 3, msubTableItem); + m_motionTable->setItem(i, 2, subTableItem); + m_motionTable->setItem(i, 3, msubTableItem); // create and set the type item QTableWidgetItem* typeTableItem = new QTableWidgetItem(motionData->RTTI_GetTypeName()); - mMotionTable->setItem(i, 4, typeTableItem); + m_motionTable->setItem(i, 4, typeTableItem); // set the items italic if the motion is dirty if (motion->GetDirtyFlag()) @@ -452,7 +452,7 @@ namespace EMStudio } // set the sorting enabled - mMotionTable->setSortingEnabled(true); + m_motionTable->setSortingEnabled(true); // set the old selection as before the reinit UpdateSelection(selection); @@ -463,10 +463,10 @@ namespace EMStudio void MotionListWindow::UpdateSelection(const CommandSystem::SelectionList& selectionList) { // block signals to not have the motion table events when selection changed - mMotionTable->blockSignals(true); + m_motionTable->blockSignals(true); // clear the selection - mMotionTable->clearSelection(); + m_motionTable->clearSelection(); // iterate through the selected motions and select the corresponding rows in the table widget const size_t numSelectedMotions = selectionList.GetNumSelectedMotions(); @@ -478,17 +478,17 @@ namespace EMStudio if (row != MCORE_INVALIDINDEX32) { // select the entire row - const int columnCount = mMotionTable->columnCount(); + const int columnCount = m_motionTable->columnCount(); for (int c = 0; c < columnCount; ++c) { - QTableWidgetItem* tableWidgetItem = mMotionTable->item(row, c); + QTableWidgetItem* tableWidgetItem = m_motionTable->item(row, c); tableWidgetItem->setSelected(true); } } } // enable the signals now all rows are selected - mMotionTable->blockSignals(false); + m_motionTable->blockSignals(false); // call the selection changed itemSelectionChanged(); @@ -502,7 +502,7 @@ namespace EMStudio uint32 MotionListWindow::GetMotionID(uint32 rowIndex) { - QTableWidgetItem* tableItem = mMotionTable->item(rowIndex, 0); + QTableWidgetItem* tableItem = m_motionTable->item(rowIndex, 0); if (tableItem) { return tableItem->data(Qt::UserRole).toInt(); @@ -520,7 +520,7 @@ namespace EMStudio if (motion) { - mMotionWindowPlugin->PlayMotion(motion); + m_motionWindowPlugin->PlayMotion(motion); } } @@ -528,7 +528,7 @@ namespace EMStudio void MotionListWindow::itemSelectionChanged() { // get the current selection - const QList selectedItems = mMotionTable->selectedItems(); + const QList selectedItems = m_motionTable->selectedItems(); // get the number of selected items const int numSelectedItems = selectedItems.count(); @@ -546,20 +546,20 @@ namespace EMStudio } // clear the selected motion IDs - mSelectedMotionIDs.clear(); + m_selectedMotionIDs.clear(); // get the number of selected items and iterate through them - mSelectedMotionIDs.reserve(rowIndices.size()); + m_selectedMotionIDs.reserve(rowIndices.size()); for (const int rowIndex : rowIndices) { - mSelectedMotionIDs.push_back(GetMotionID(rowIndex)); + m_selectedMotionIDs.push_back(GetMotionID(rowIndex)); } // unselect all motions GetCommandManager()->GetCurrentSelection().ClearMotionSelection(); // get the number of selected motions and iterate through them - for (uint32 selectedMotionID : mSelectedMotionIDs) + for (uint32 selectedMotionID : m_selectedMotionIDs) { // find the motion by name in the motion library and select it EMotionFX::Motion* motion = EMotionFX::GetMotionManager().FindMotionByID(selectedMotionID); @@ -570,7 +570,7 @@ namespace EMStudio } // update the interface - mMotionWindowPlugin->UpdateInterface(); + m_motionWindowPlugin->UpdateInterface(); // emit signal that tells other windows that the motion selection changed emit MotionSelectionChanged(); @@ -748,7 +748,7 @@ namespace EMStudio MotionTableWidget::MotionTableWidget(MotionWindowPlugin* parentPlugin, QWidget* parent) : QTableWidget(parent) { - mPlugin = parentPlugin; + m_plugin = parentPlugin; // enable dragging setDragEnabled(true); diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionWindow/MotionListWindow.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionWindow/MotionListWindow.h index 89f2dc8f8a..7308ce12e1 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionWindow/MotionListWindow.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionWindow/MotionListWindow.h @@ -62,7 +62,7 @@ namespace EMStudio QStringList mimeTypes() const override; Qt::DropActions supportedDropActions() const override; - MotionWindowPlugin* mPlugin; + MotionWindowPlugin* m_plugin; }; @@ -80,7 +80,7 @@ namespace EMStudio void ReInit(); void UpdateInterface(); - QTableWidget* GetMotionTable() { return mMotionTable; } + QTableWidget* GetMotionTable() { return m_motionTable; } bool AddMotionByID(uint32 motionID); bool RemoveMotionByID(uint32 motionID); @@ -108,11 +108,11 @@ namespace EMStudio void UpdateSelection(const CommandSystem::SelectionList& selectionList); private: - AZStd::vector mSelectedMotionIDs; - AZStd::vector mShownMotionEntries; - QVBoxLayout* mVLayout; - MotionTableWidget* mMotionTable; - MotionWindowPlugin* mMotionWindowPlugin; + AZStd::vector m_selectedMotionIDs; + AZStd::vector m_shownMotionEntries; + QVBoxLayout* m_vLayout; + MotionTableWidget* m_motionTable; + MotionWindowPlugin* m_motionWindowPlugin; AZStd::string m_searchWidgetText; }; diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionWindow/MotionRetargetingWindow.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionWindow/MotionRetargetingWindow.cpp index 6596a7c868..d6dbe2c4cc 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionWindow/MotionRetargetingWindow.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionWindow/MotionRetargetingWindow.cpp @@ -26,9 +26,8 @@ namespace EMStudio MotionRetargetingWindow::MotionRetargetingWindow(QWidget* parent, MotionWindowPlugin* motionWindowPlugin) : QWidget(parent) { - mMotionWindowPlugin = motionWindowPlugin; - mMotionRetargetingButton = nullptr; - //mRenderMotionBindPose = nullptr; + m_motionWindowPlugin = motionWindowPlugin; + m_motionRetargetingButton = nullptr; } @@ -44,18 +43,11 @@ namespace EMStudio QGridLayout* layout = new QGridLayout(); setLayout(layout); - mMotionRetargetingButton = new QCheckBox(); - AzQtComponents::CheckBox::applyToggleSwitchStyle(mMotionRetargetingButton); + m_motionRetargetingButton = new QCheckBox(); + AzQtComponents::CheckBox::applyToggleSwitchStyle(m_motionRetargetingButton); layout->addWidget(new QLabel(tr("Use Motion Retargeting")), 0, 0); - layout->addWidget(mMotionRetargetingButton, 0, 1); - connect(mMotionRetargetingButton, &QCheckBox::clicked, this, &MotionRetargetingWindow::UpdateMotions); - - //mRenderMotionBindPose = new QCheckBox(); - //AzQtComponents::CheckBox::applyToggleSwitchStyle(mRenderMotionBindPose); - //mRenderMotionBindPose->setToolTip("Render motion bind pose of the currently selected motion for the selected actor instances"); - //mRenderMotionBindPose->setChecked(false); - //layout->addWidget(new QLabel(tr("Render Motion Bind Pose")), 1, 0); - //layout->addWidget(mRenderMotionBindPose, 1, 1); + layout->addWidget(m_motionRetargetingButton, 0, 1); + connect(m_motionRetargetingButton, &QCheckBox::clicked, this, &MotionRetargetingWindow::UpdateMotions); } @@ -70,21 +62,21 @@ namespace EMStudio const size_t numMotions = selection.GetNumSelectedMotions(); for (size_t i = 0; i < numMotions; ++i) { - MotionWindowPlugin::MotionTableEntry* entry = mMotionWindowPlugin->FindMotionEntryByID(selection.GetMotion(i)->GetID()); + MotionWindowPlugin::MotionTableEntry* entry = m_motionWindowPlugin->FindMotionEntryByID(selection.GetMotion(i)->GetID()); if (entry == nullptr) { MCore::LogError("Cannot find motion table entry for the given motion."); continue; } - EMotionFX::Motion* motion = entry->mMotion; + EMotionFX::Motion* motion = entry->m_motion; EMotionFX::PlayBackInfo* playbackInfo = motion->GetDefaultPlayBackInfo(); AZStd::string commandParameters; - if (playbackInfo->mRetarget != mMotionRetargetingButton->isChecked()) + if (playbackInfo->m_retarget != m_motionRetargetingButton->isChecked()) { - commandParameters += AZStd::string::format("-retarget %s ", AZStd::to_string(mMotionRetargetingButton->isChecked()).c_str()); + commandParameters += AZStd::string::format("-retarget %s ", AZStd::to_string(m_motionRetargetingButton->isChecked()).c_str()); } // in case the command parameters are empty it means nothing changed, so we can skip this command @@ -111,8 +103,7 @@ namespace EMStudio const size_t numSelectedMotions = selection.GetNumSelectedMotions(); const bool isEnabled = (numSelectedMotions != 0); - mMotionRetargetingButton->setEnabled(isEnabled); - //mRenderMotionBindPose->setEnabled(isEnabled); + m_motionRetargetingButton->setEnabled(isEnabled); if (isEnabled == false) { @@ -122,17 +113,17 @@ namespace EMStudio // iterate through the selected motions for (size_t i = 0; i < numSelectedMotions; ++i) { - MotionWindowPlugin::MotionTableEntry* entry = mMotionWindowPlugin->FindMotionEntryByID(selection.GetMotion(i)->GetID()); + MotionWindowPlugin::MotionTableEntry* entry = m_motionWindowPlugin->FindMotionEntryByID(selection.GetMotion(i)->GetID()); if (entry == nullptr) { MCore::LogWarning("Cannot find motion table entry for the given motion."); continue; } - EMotionFX::Motion* motion = entry->mMotion; + EMotionFX::Motion* motion = entry->m_motion; EMotionFX::PlayBackInfo* defaultPlayBackInfo = motion->GetDefaultPlayBackInfo(); - mMotionRetargetingButton->setChecked(defaultPlayBackInfo->mRetarget); + m_motionRetargetingButton->setChecked(defaultPlayBackInfo->m_retarget); } } } // namespace EMStudio diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionWindow/MotionRetargetingWindow.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionWindow/MotionRetargetingWindow.h index 3c5d50bc36..a846982eca 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionWindow/MotionRetargetingWindow.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionWindow/MotionRetargetingWindow.h @@ -47,12 +47,11 @@ namespace EMStudio void UpdateMotions(); private: - MotionWindowPlugin* mMotionWindowPlugin; - QCheckBox* mMotionRetargetingButton; - //QCheckBox* mRenderMotionBindPose; - EMotionFX::ActorInstance* mSelectedActorInstance; - EMotionFX::Actor* mActor; - CommandSystem::SelectionList mSelectionList; + MotionWindowPlugin* m_motionWindowPlugin; + QCheckBox* m_motionRetargetingButton; + EMotionFX::ActorInstance* m_selectedActorInstance; + EMotionFX::Actor* m_actor; + CommandSystem::SelectionList m_selectionList; }; } // namespace EMStudio diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionWindow/MotionWindowPlugin.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionWindow/MotionWindowPlugin.cpp index 1452d0ac93..87c6a601aa 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionWindow/MotionWindowPlugin.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionWindow/MotionWindowPlugin.cpp @@ -40,7 +40,7 @@ namespace EMStudio public: SaveDirtyMotionFilesCallback(MotionWindowPlugin* plugin) - : SaveDirtyFilesCallback() { mPlugin = plugin; } + : SaveDirtyFilesCallback() { m_plugin = plugin; } ~SaveDirtyMotionFilesCallback() {} enum @@ -72,7 +72,7 @@ namespace EMStudio // add the link to the actual object ObjectPointer objPointer; - objPointer.mMotion = motion; + objPointer.m_motion = motion; outObjects->push_back(objPointer); } } @@ -87,13 +87,13 @@ namespace EMStudio { // get the current object pointer and skip directly if the type check fails ObjectPointer objPointer = objects[i]; - if (objPointer.mMotion == nullptr) + if (objPointer.m_motion == nullptr) { continue; } - EMotionFX::Motion* motion = objPointer.mMotion; - if (mPlugin->SaveDirtyMotion(motion, commandGroup, false) == DirtyFileManager::CANCELED) + EMotionFX::Motion* motion = objPointer.m_motion; + if (m_plugin->SaveDirtyMotion(motion, commandGroup, false) == DirtyFileManager::CANCELED) { return DirtyFileManager::CANCELED; } @@ -110,31 +110,31 @@ namespace EMStudio } private: - MotionWindowPlugin* mPlugin; + MotionWindowPlugin* m_plugin; }; - AZStd::vector MotionWindowPlugin::mInternalMotionInstanceSelection; + AZStd::vector MotionWindowPlugin::s_internalMotionInstanceSelection; MotionWindowPlugin::MotionWindowPlugin() : EMStudio::DockWidgetPlugin() { - mDialogStack = nullptr; - mMotionListWindow = nullptr; - mMotionPropertiesWindow = nullptr; - mMotionExtractionWindow = nullptr; - mMotionRetargetingWindow = nullptr; - mDirtyFilesCallback = nullptr; - mAddMotionsAction = nullptr; - mSaveAction = nullptr; - mMotionNameLabel = nullptr; + m_dialogStack = nullptr; + m_motionListWindow = nullptr; + m_motionPropertiesWindow = nullptr; + m_motionExtractionWindow = nullptr; + m_motionRetargetingWindow = nullptr; + m_dirtyFilesCallback = nullptr; + m_addMotionsAction = nullptr; + m_saveAction = nullptr; + m_motionNameLabel = nullptr; } MotionWindowPlugin::~MotionWindowPlugin() { - delete mDialogStack; + delete m_dialogStack; ClearMotionEntries(); // unregister the command callbacks and get rid of the memory @@ -144,19 +144,19 @@ namespace EMStudio } m_callbacks.clear(); - GetMainWindow()->GetDirtyFileManager()->RemoveCallback(mDirtyFilesCallback, false); - delete mDirtyFilesCallback; + GetMainWindow()->GetDirtyFileManager()->RemoveCallback(m_dirtyFilesCallback, false); + delete m_dirtyFilesCallback; } void MotionWindowPlugin::ClearMotionEntries() { - const size_t numEntries = mMotionEntries.size(); + const size_t numEntries = m_motionEntries.size(); for (size_t i = 0; i < numEntries; ++i) { - delete mMotionEntries[i]; + delete m_motionEntries[i]; } - mMotionEntries.clear(); + m_motionEntries.clear(); } @@ -180,9 +180,9 @@ namespace EMStudio GetCommandManager()->RegisterCommandCallback("ScaleMotionData", m_callbacks, false); GetCommandManager()->RegisterCommandCallback("Select", m_callbacks, false); - QWidget* container = new QWidget(mDock); + QWidget* container = new QWidget(m_dock); container->setLayout(new QVBoxLayout); - mDock->setWidget(container); + m_dock->setWidget(container); QToolBar* toolBar = new QToolBar(container); container->layout()->addWidget(toolBar); @@ -194,73 +194,73 @@ namespace EMStudio container->layout()->addWidget(splitterWidget); // create the motion list stack window - mMotionListWindow = new MotionListWindow(splitterWidget, this); - mMotionListWindow->Init(); - connect(mMotionListWindow, &MotionListWindow::SaveRequested, this, &MotionWindowPlugin::OnSave); - connect(mMotionListWindow, &MotionListWindow::RemoveMotionsRequested, this, &MotionWindowPlugin::OnRemoveMotions); - splitterWidget->addWidget(mMotionListWindow); + m_motionListWindow = new MotionListWindow(splitterWidget, this); + m_motionListWindow->Init(); + connect(m_motionListWindow, &MotionListWindow::SaveRequested, this, &MotionWindowPlugin::OnSave); + connect(m_motionListWindow, &MotionListWindow::RemoveMotionsRequested, this, &MotionWindowPlugin::OnRemoveMotions); + splitterWidget->addWidget(m_motionListWindow); // reinitialize the motion table entries ReInit(); - mAddMotionsAction = toolBar->addAction(MysticQt::GetMysticQt()->FindIcon("Images/Icons/Plus.svg"), tr("Load motions"), this, &MotionWindowPlugin::OnAddMotions); - mSaveAction = toolBar->addAction(MysticQt::GetMysticQt()->FindIcon("Images/Menu/FileSave.svg"), tr("Save selected motions"), this, &MotionWindowPlugin::OnSave); + m_addMotionsAction = toolBar->addAction(MysticQt::GetMysticQt()->FindIcon("Images/Icons/Plus.svg"), tr("Load motions"), this, &MotionWindowPlugin::OnAddMotions); + m_saveAction = toolBar->addAction(MysticQt::GetMysticQt()->FindIcon("Images/Menu/FileSave.svg"), tr("Save selected motions"), this, &MotionWindowPlugin::OnSave); toolBar->addSeparator(); AzQtComponents::FilteredSearchWidget* searchWidget = new AzQtComponents::FilteredSearchWidget(toolBar); - connect(searchWidget, &AzQtComponents::FilteredSearchWidget::TextFilterChanged, mMotionListWindow, &MotionListWindow::OnTextFilterChanged); + connect(searchWidget, &AzQtComponents::FilteredSearchWidget::TextFilterChanged, m_motionListWindow, &MotionListWindow::OnTextFilterChanged); toolBar->addWidget(searchWidget); // create the dialog stack - assert(mDialogStack == nullptr); - mDialogStack = new MysticQt::DialogStack(splitterWidget); - mDialogStack->setMinimumWidth(279); - splitterWidget->addWidget(mDialogStack); + assert(m_dialogStack == nullptr); + m_dialogStack = new MysticQt::DialogStack(splitterWidget); + m_dialogStack->setMinimumWidth(279); + splitterWidget->addWidget(m_dialogStack); // add the motion properties stack window - mMotionPropertiesWindow = new MotionPropertiesWindow(mDialogStack, this); - mMotionPropertiesWindow->Init(); - mDialogStack->Add(mMotionPropertiesWindow, "Motion Properties", false, true); + m_motionPropertiesWindow = new MotionPropertiesWindow(m_dialogStack, this); + m_motionPropertiesWindow->Init(); + m_dialogStack->Add(m_motionPropertiesWindow, "Motion Properties", false, true); // add the motion name label QWidget* motionName = new QWidget(); QBoxLayout* motionNameLayout = new QHBoxLayout(motionName); - mMotionNameLabel = new QLabel(); + m_motionNameLabel = new QLabel(); QLabel* label = new QLabel(tr("Motion name")); motionNameLayout->addWidget(label); - motionNameLayout->addWidget(mMotionNameLabel); + motionNameLayout->addWidget(m_motionNameLabel); motionNameLayout->setStretchFactor(label, 3); - motionNameLayout->setStretchFactor(mMotionNameLabel, 2); - mMotionPropertiesWindow->layout()->addWidget(motionName); + motionNameLayout->setStretchFactor(m_motionNameLabel, 2); + m_motionPropertiesWindow->layout()->addWidget(motionName); // add the motion extraction stack window - mMotionExtractionWindow = new MotionExtractionWindow(mDialogStack, this); - mMotionExtractionWindow->Init(); - mMotionPropertiesWindow->AddSubProperties(mMotionExtractionWindow); + m_motionExtractionWindow = new MotionExtractionWindow(m_dialogStack, this); + m_motionExtractionWindow->Init(); + m_motionPropertiesWindow->AddSubProperties(m_motionExtractionWindow); // add the motion retargeting stack window - mMotionRetargetingWindow = new MotionRetargetingWindow(mDialogStack, this); - mMotionRetargetingWindow->Init(); - mMotionPropertiesWindow->AddSubProperties(mMotionRetargetingWindow); + m_motionRetargetingWindow = new MotionRetargetingWindow(m_dialogStack, this); + m_motionRetargetingWindow->Init(); + m_motionPropertiesWindow->AddSubProperties(m_motionRetargetingWindow); - mMotionPropertiesWindow->FinalizeSubProperties(); + m_motionPropertiesWindow->FinalizeSubProperties(); // connect the window activation signal to refresh if reactivated - connect(mDock, &QDockWidget::visibilityChanged, this, &MotionWindowPlugin::VisibilityChanged); + connect(m_dock, &QDockWidget::visibilityChanged, this, &MotionWindowPlugin::VisibilityChanged); // update the new interface and return success UpdateInterface(); // initialize the dirty files callback - mDirtyFilesCallback = new SaveDirtyMotionFilesCallback(this); - GetMainWindow()->GetDirtyFileManager()->AddCallback(mDirtyFilesCallback); + m_dirtyFilesCallback = new SaveDirtyMotionFilesCallback(this); + GetMainWindow()->GetDirtyFileManager()->AddCallback(m_dirtyFilesCallback); return true; } void MotionWindowPlugin::OnAddMotions() { - const AZStd::vector filenames = GetMainWindow()->GetFileManager()->LoadMotionsFileDialog(mMotionListWindow); + const AZStd::vector filenames = GetMainWindow()->GetFileManager()->LoadMotionsFileDialog(m_motionListWindow); CommandSystem::LoadMotionsCommand(filenames); } @@ -294,7 +294,7 @@ namespace EMStudio // show the window if at least one failed remove motion if (!failedRemoveMotions.empty()) { - MotionListRemoveMotionsFailedWindow removeMotionsFailedWindow(mMotionListWindow, failedRemoveMotions); + MotionListRemoveMotionsFailedWindow removeMotionsFailedWindow(m_motionListWindow, failedRemoveMotions); removeMotionsFailedWindow.exec(); } } @@ -355,7 +355,7 @@ namespace EMStudio // find the lowest row selected int lowestRowSelected = AZStd::numeric_limits::max(); - const QList selectedItems = mMotionListWindow->GetMotionTable()->selectedItems(); + const QList selectedItems = m_motionListWindow->GetMotionTable()->selectedItems(); for (const QTableWidgetItem* selectedItem : selectedItems) { lowestRowSelected = AZStd::min(lowestRowSelected, selectedItem->row()); @@ -366,19 +366,19 @@ namespace EMStudio CommandSystem::RemoveMotions(motionsToRemove, &failedRemoveMotions); // selected the next row - if (lowestRowSelected > (mMotionListWindow->GetMotionTable()->rowCount() - 1)) + if (lowestRowSelected > (m_motionListWindow->GetMotionTable()->rowCount() - 1)) { - mMotionListWindow->GetMotionTable()->selectRow(lowestRowSelected - 1); + m_motionListWindow->GetMotionTable()->selectRow(lowestRowSelected - 1); } else { - mMotionListWindow->GetMotionTable()->selectRow(lowestRowSelected); + m_motionListWindow->GetMotionTable()->selectRow(lowestRowSelected); } // show the window if at least one failed remove motion if (!failedRemoveMotions.empty()) { - MotionListRemoveMotionsFailedWindow removeMotionsFailedWindow(mMotionListWindow, failedRemoveMotions); + MotionListRemoveMotionsFailedWindow removeMotionsFailedWindow(m_motionListWindow, failedRemoveMotions); removeMotionsFailedWindow.exec(); } } @@ -422,8 +422,8 @@ namespace EMStudio { if (!motion->GetIsOwnedByRuntime()) { - mMotionEntries.push_back(new MotionTableEntry(motion)); - return mMotionListWindow->AddMotionByID(motionID); + m_motionEntries.push_back(new MotionTableEntry(motion)); + return m_motionListWindow->AddMotionByID(motionID); } } } @@ -434,21 +434,21 @@ namespace EMStudio bool MotionWindowPlugin::RemoveMotionByIndex(size_t index) { - const uint32 motionID = mMotionEntries[index]->mMotionID; + const uint32 motionID = m_motionEntries[index]->m_motionId; - delete mMotionEntries[index]; - mMotionEntries.erase(mMotionEntries.begin() + index); + delete m_motionEntries[index]; + m_motionEntries.erase(m_motionEntries.begin() + index); - return mMotionListWindow->RemoveMotionByID(motionID); + return m_motionListWindow->RemoveMotionByID(motionID); } bool MotionWindowPlugin::RemoveMotionById(uint32 motionID) { - const size_t numMotionEntries = mMotionEntries.size(); + const size_t numMotionEntries = m_motionEntries.size(); for (size_t i = 0; i < numMotionEntries; ++i) { - if (mMotionEntries[i]->mMotionID == motionID) + if (m_motionEntries[i]->m_motionId == motionID) { return RemoveMotionByIndex(i); } @@ -471,15 +471,15 @@ namespace EMStudio } if (FindMotionEntryByID(motion->GetID()) == nullptr) { - mMotionEntries.push_back(new MotionTableEntry(motion)); + m_motionEntries.push_back(new MotionTableEntry(motion)); } } // iterate through all motions inside the motion window plugin - AZStd::erase_if(mMotionEntries, [](MotionTableEntry* entry) + AZStd::erase_if(m_motionEntries, [](MotionTableEntry* entry) { // check if the motion still is in the motion library, if not also remove it from the motion window plugin - if (EMotionFX::GetMotionManager().FindMotionIndexByID(entry->mMotionID) == InvalidIndex) + if (EMotionFX::GetMotionManager().FindMotionIndexByID(entry->m_motionId) == InvalidIndex) { delete entry; return true; @@ -488,13 +488,13 @@ namespace EMStudio }); // update the motion list window - mMotionListWindow->ReInit(); + m_motionListWindow->ReInit(); } void MotionWindowPlugin::UpdateMotions() { - mMotionRetargetingWindow->UpdateMotions(); + m_motionRetargetingWindow->UpdateMotions(); } @@ -518,30 +518,30 @@ namespace EMStudio const CommandSystem::SelectionList& selection = GetCommandManager()->GetCurrentSelection(); const bool hasSelectedMotions = selection.GetNumSelectedMotions() > 0; - if (mMotionNameLabel) + if (m_motionNameLabel) { MotionTableEntry* entry = hasSelectedMotions ? FindMotionEntryByID(selection.GetMotion(0)->GetID()) : nullptr; - EMotionFX::Motion* motion = entry ? entry->mMotion : nullptr; - mMotionNameLabel->setText(motion ? motion->GetName() : nullptr); + EMotionFX::Motion* motion = entry ? entry->m_motion : nullptr; + m_motionNameLabel->setText(motion ? motion->GetName() : nullptr); } - if (mSaveAction) + if (m_saveAction) { // related to the selected motions - mSaveAction->setEnabled(hasSelectedMotions); + m_saveAction->setEnabled(hasSelectedMotions); } - if (mMotionListWindow) + if (m_motionListWindow) { - mMotionListWindow->UpdateInterface(); + m_motionListWindow->UpdateInterface(); } - if (mMotionExtractionWindow) + if (m_motionExtractionWindow) { - mMotionExtractionWindow->UpdateInterface(); + m_motionExtractionWindow->UpdateInterface(); } - if (mMotionRetargetingWindow) + if (m_motionRetargetingWindow) { - mMotionRetargetingWindow->UpdateInterface(); + m_motionRetargetingWindow->UpdateInterface(); } } @@ -558,7 +558,7 @@ namespace EMStudio const size_t numSelectedActorInstances = selectionList.GetNumSelectedActorInstances(); const size_t numSelectedMotions = selectionList.GetNumSelectedMotions(); - mInternalMotionInstanceSelection.clear(); + s_internalMotionInstanceSelection.clear(); for (size_t i = 0; i < numSelectedActorInstances; ++i) { @@ -575,23 +575,23 @@ namespace EMStudio EMotionFX::MotionInstance* motionInstance = motionSystem->GetMotionInstance(k); if (motionInstance->GetMotion() == motion) { - mInternalMotionInstanceSelection.push_back(motionInstance); + s_internalMotionInstanceSelection.push_back(motionInstance); } } } } - return mInternalMotionInstanceSelection; + return s_internalMotionInstanceSelection; } MotionWindowPlugin::MotionTableEntry* MotionWindowPlugin::FindMotionEntryByID(uint32 motionID) { - const auto foundEntry = AZStd::find_if(begin(mMotionEntries), end(mMotionEntries), [motionID](const MotionTableEntry* entry) + const auto foundEntry = AZStd::find_if(begin(m_motionEntries), end(m_motionEntries), [motionID](const MotionTableEntry* entry) { - return entry->mMotionID == motionID; + return entry->m_motionId == motionID; }); - return foundEntry != end(mMotionEntries) ? *foundEntry : nullptr; + return foundEntry != end(m_motionEntries) ? *foundEntry : nullptr; } @@ -613,9 +613,9 @@ namespace EMStudio EMotionFX::PlayBackInfo* defaultPlayBackInfo = motion->GetDefaultPlayBackInfo(); // Don't blend in and out of the for previewing animations. We might only see a short bit of it for animations smaller than the blend in/out time. - defaultPlayBackInfo->mBlendInTime = 0.0f; - defaultPlayBackInfo->mBlendOutTime = 0.0f; - defaultPlayBackInfo->mFreezeAtLastFrame = (defaultPlayBackInfo->mNumLoops != EMFX_LOOPFOREVER); + defaultPlayBackInfo->m_blendInTime = 0.0f; + defaultPlayBackInfo->m_blendOutTime = 0.0f; + defaultPlayBackInfo->m_freezeAtLastFrame = (defaultPlayBackInfo->m_numLoops != EMFX_LOOPFOREVER); commandParameters = CommandSystem::CommandPlayMotion::PlayBackInfoToCommandParameters(defaultPlayBackInfo); @@ -655,7 +655,7 @@ namespace EMStudio continue; } - command = AZStd::string::format("StopMotionInstances -filename \"%s\"", entry->mMotion->GetFileName()); + command = AZStd::string::format("StopMotionInstances -filename \"%s\"", entry->m_motion->GetFileName()); commandGroup.AddCommandString(command); } @@ -669,7 +669,7 @@ namespace EMStudio void MotionWindowPlugin::Render(RenderPlugin* renderPlugin, EMStudioPlugin::RenderInfo* renderInfo) { - MCommon::RenderUtil* renderUtil = renderInfo->mRenderUtil; + MCommon::RenderUtil* renderUtil = renderInfo->m_renderUtil; // make sure the render objects are valid if (renderPlugin == nullptr || renderUtil == nullptr) @@ -682,8 +682,8 @@ namespace EMStudio // constructor MotionWindowPlugin::MotionTableEntry::MotionTableEntry(EMotionFX::Motion* motion) { - mMotionID = motion->GetID(); - mMotion = motion; + m_motionId = motion->GetID(); + m_motion = motion; } @@ -829,7 +829,7 @@ namespace EMStudio { MCORE_UNUSED(commandLine); CommandSystem::CommandImportMotion* importMotionCommand = static_cast(command); - return CallbackAddMotionByID(importMotionCommand->mOldMotionID); + return CallbackAddMotionByID(importMotionCommand->m_oldMotionId); } @@ -847,7 +847,7 @@ namespace EMStudio { MCORE_UNUSED(commandLine); CommandSystem::CommandRemoveMotion* removeMotionCommand = static_cast(command); - return CallbackRemoveMotion(removeMotionCommand->mOldMotionID); + return CallbackRemoveMotion(removeMotionCommand->m_oldMotionId); } diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionWindow/MotionWindowPlugin.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionWindow/MotionWindowPlugin.h index 0bd181e63b..7f4ebc3e78 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionWindow/MotionWindowPlugin.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/MotionWindow/MotionWindowPlugin.h @@ -71,22 +71,22 @@ namespace EMStudio MotionTableEntry(EMotionFX::Motion* motion); - EMotionFX::Motion* mMotion; - uint32 mMotionID; + EMotionFX::Motion* m_motion; + uint32 m_motionId; }; MotionTableEntry* FindMotionEntryByID(uint32 motionID); - MCORE_INLINE size_t GetNumMotionEntries() { return mMotionEntries.size(); } - MCORE_INLINE MotionTableEntry* GetMotionEntry(size_t index) { return mMotionEntries[index]; } + MCORE_INLINE size_t GetNumMotionEntries() { return m_motionEntries.size(); } + MCORE_INLINE MotionTableEntry* GetMotionEntry(size_t index) { return m_motionEntries[index]; } bool AddMotion(uint32 motionID); bool RemoveMotionByIndex(size_t index); bool RemoveMotionById(uint32 motionID); static AZStd::vector& GetSelectedMotionInstances(); - MCORE_INLINE MotionRetargetingWindow* GetMotionRetargetingWindow() { return mMotionRetargetingWindow; } - MCORE_INLINE MotionExtractionWindow* GetMotionExtractionWindow() { return mMotionExtractionWindow; } - MCORE_INLINE MotionListWindow* GetMotionListWindow() { return mMotionListWindow; } + MCORE_INLINE MotionRetargetingWindow* GetMotionRetargetingWindow() { return m_motionRetargetingWindow; } + MCORE_INLINE MotionExtractionWindow* GetMotionExtractionWindow() { return m_motionExtractionWindow; } + MCORE_INLINE MotionListWindow* GetMotionListWindow() { return m_motionListWindow; } MCORE_INLINE const char* GetDefaultNodeSelectionLabelText() { return "Click to select node"; } int OnSaveDirtyMotions(); @@ -121,21 +121,21 @@ namespace EMStudio AZStd::vector m_callbacks; - AZStd::vector mMotionEntries; + AZStd::vector m_motionEntries; - MysticQt::DialogStack* mDialogStack; - MotionListWindow* mMotionListWindow; - MotionPropertiesWindow* mMotionPropertiesWindow; - MotionExtractionWindow* mMotionExtractionWindow; - MotionRetargetingWindow* mMotionRetargetingWindow; + MysticQt::DialogStack* m_dialogStack; + MotionListWindow* m_motionListWindow; + MotionPropertiesWindow* m_motionPropertiesWindow; + MotionExtractionWindow* m_motionExtractionWindow; + MotionRetargetingWindow* m_motionRetargetingWindow; - SaveDirtyMotionFilesCallback* mDirtyFilesCallback; + SaveDirtyMotionFilesCallback* m_dirtyFilesCallback; - QAction* mAddMotionsAction; - QAction* mSaveAction; + QAction* m_addMotionsAction; + QAction* m_saveAction; - QLabel* mMotionNameLabel; + QLabel* m_motionNameLabel; - static AZStd::vector mInternalMotionInstanceSelection; + static AZStd::vector s_internalMotionInstanceSelection; }; } // namespace EMStudio diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/NodeGroups/NodeGroupManagementWidget.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/NodeGroups/NodeGroupManagementWidget.cpp index 84c281a18f..67aee6a5af 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/NodeGroups/NodeGroupManagementWidget.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/NodeGroups/NodeGroupManagementWidget.cpp @@ -32,8 +32,8 @@ namespace EMStudio : QDialog(parent) { // store the values - mActor = actor; - mNodeGroupName = nodeGroupName; + m_actor = actor; + m_nodeGroupName = nodeGroupName; // set the window title setWindowTitle("Rename Node Group"); @@ -48,23 +48,23 @@ namespace EMStudio layout->addWidget(new QLabel("Please enter the new node group name:")); // add the line edit - mLineEdit = new QLineEdit(); - connect(mLineEdit, &QLineEdit::textEdited, this, &NodeGroupManagementRenameWindow::TextEdited); - layout->addWidget(mLineEdit); + m_lineEdit = new QLineEdit(); + connect(m_lineEdit, &QLineEdit::textEdited, this, &NodeGroupManagementRenameWindow::TextEdited); + layout->addWidget(m_lineEdit); // set the current name and select all - mLineEdit->setText(nodeGroupName.c_str()); - mLineEdit->selectAll(); + m_lineEdit->setText(nodeGroupName.c_str()); + m_lineEdit->selectAll(); // create the button layout QHBoxLayout* buttonLayout = new QHBoxLayout(); - mOKButton = new QPushButton("OK"); + m_okButton = new QPushButton("OK"); QPushButton* cancelButton = new QPushButton("Cancel"); - buttonLayout->addWidget(mOKButton); + buttonLayout->addWidget(m_okButton); buttonLayout->addWidget(cancelButton); // connect the buttons - connect(mOKButton, &QPushButton::clicked, this, &NodeGroupManagementRenameWindow::Accepted); + connect(m_okButton, &QPushButton::clicked, this, &NodeGroupManagementRenameWindow::Accepted); connect(cancelButton, &QPushButton::clicked, this, &NodeGroupManagementRenameWindow::reject); // set the new layout @@ -78,44 +78,42 @@ namespace EMStudio const AZStd::string convertedNewName = text.toUtf8().data(); if (text.isEmpty()) { - //mErrorMsg->setVisible(false); - mOKButton->setEnabled(false); - GetManager()->SetWidgetAsInvalidInput(mLineEdit); + m_okButton->setEnabled(false); + GetManager()->SetWidgetAsInvalidInput(m_lineEdit); } - else if (mNodeGroupName == convertedNewName) + else if (m_nodeGroupName == convertedNewName) { - //mErrorMsg->setVisible(false); - mOKButton->setEnabled(true); - mLineEdit->setStyleSheet(""); + m_okButton->setEnabled(true); + m_lineEdit->setStyleSheet(""); } else { // find duplicate name, it can't be the same name because we already handle this case before - EMotionFX::NodeGroup* nodeGroup = mActor->FindNodeGroupByName(convertedNewName.c_str()); + EMotionFX::NodeGroup* nodeGroup = m_actor->FindNodeGroupByName(convertedNewName.c_str()); if (nodeGroup) { - mOKButton->setEnabled(false); - GetManager()->SetWidgetAsInvalidInput(mLineEdit); + m_okButton->setEnabled(false); + GetManager()->SetWidgetAsInvalidInput(m_lineEdit); return; } // no duplicate name found - mOKButton->setEnabled(true); - mLineEdit->setStyleSheet(""); + m_okButton->setEnabled(true); + m_lineEdit->setStyleSheet(""); } } void NodeGroupManagementRenameWindow::Accepted() { - const AZStd::string convertedNewName = mLineEdit->text().toUtf8().data(); + const AZStd::string convertedNewName = m_lineEdit->text().toUtf8().data(); // execute the command AZStd::string outResult; auto* command = aznew CommandSystem::CommandAdjustNodeGroup( GetCommandManager()->FindCommand(CommandSystem::CommandAdjustNodeGroup::s_commandName), - /*actorId=*/ mActor->GetID(), - /*name=*/ mNodeGroupName, + /*actorId=*/ m_actor->GetID(), + /*name=*/ m_nodeGroupName, /*newName=*/ convertedNewName ); if (GetCommandManager()->ExecuteCommand(command, outResult) == false) @@ -133,11 +131,11 @@ namespace EMStudio : QWidget(parent) { // init the button variables to nullptr - mAddButton = nullptr; - mRemoveButton = nullptr; - mClearButton = nullptr; - mNodeGroupsTable = nullptr; - mSelectedRow = MCORE_INVALIDINDEX32; + m_addButton = nullptr; + m_removeButton = nullptr; + m_clearButton = nullptr; + m_nodeGroupsTable = nullptr; + m_selectedRow = MCORE_INVALIDINDEX32; // set the node group widget SetNodeGroupWidget(nodeGroupWidget); @@ -157,20 +155,20 @@ namespace EMStudio void NodeGroupManagementWidget::Init() { // create the node groups table - mNodeGroupsTable = new QTableWidget(); + m_nodeGroupsTable = new QTableWidget(); // create the table widget - mNodeGroupsTable->setAlternatingRowColors(true); - mNodeGroupsTable->setCornerButtonEnabled(false); - mNodeGroupsTable->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); - mNodeGroupsTable->setContextMenuPolicy(Qt::DefaultContextMenu); + m_nodeGroupsTable->setAlternatingRowColors(true); + m_nodeGroupsTable->setCornerButtonEnabled(false); + m_nodeGroupsTable->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); + m_nodeGroupsTable->setContextMenuPolicy(Qt::DefaultContextMenu); // set the table to row single selection - mNodeGroupsTable->setSelectionBehavior(QAbstractItemView::SelectRows); - mNodeGroupsTable->setSelectionMode(QAbstractItemView::SingleSelection); + m_nodeGroupsTable->setSelectionBehavior(QAbstractItemView::SelectRows); + m_nodeGroupsTable->setSelectionMode(QAbstractItemView::SingleSelection); // set the column count - mNodeGroupsTable->setColumnCount(3); + m_nodeGroupsTable->setColumnCount(3); // set header items for the table QTableWidgetItem* enabledHeaderItem = new QTableWidgetItem(""); @@ -178,44 +176,44 @@ namespace EMStudio QTableWidgetItem* numNodesHeaderItem = new QTableWidgetItem("Num Nodes"); nameHeaderItem->setTextAlignment(Qt::AlignVCenter | Qt::AlignLeft); numNodesHeaderItem->setTextAlignment(Qt::AlignVCenter | Qt::AlignLeft); - mNodeGroupsTable->setHorizontalHeaderItem(0, enabledHeaderItem); - mNodeGroupsTable->setHorizontalHeaderItem(1, nameHeaderItem); - mNodeGroupsTable->setHorizontalHeaderItem(2, numNodesHeaderItem); + m_nodeGroupsTable->setHorizontalHeaderItem(0, enabledHeaderItem); + m_nodeGroupsTable->setHorizontalHeaderItem(1, nameHeaderItem); + m_nodeGroupsTable->setHorizontalHeaderItem(2, numNodesHeaderItem); // set the first column fixed - QHeaderView* horizontalHeader = mNodeGroupsTable->horizontalHeader(); - mNodeGroupsTable->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Fixed); - mNodeGroupsTable->setColumnWidth(0, 19); + QHeaderView* horizontalHeader = m_nodeGroupsTable->horizontalHeader(); + m_nodeGroupsTable->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Fixed); + m_nodeGroupsTable->setColumnWidth(0, 19); // set the name column width - mNodeGroupsTable->setColumnWidth(1, 150); + m_nodeGroupsTable->setColumnWidth(1, 150); // set the vertical columns not visible - QHeaderView* verticalHeader = mNodeGroupsTable->verticalHeader(); + QHeaderView* verticalHeader = m_nodeGroupsTable->verticalHeader(); verticalHeader->setVisible(false); // set the last column to take the whole space horizontalHeader->setStretchLastSection(true); // disable editing - mNodeGroupsTable->setEditTriggers(QAbstractItemView::NoEditTriggers); + m_nodeGroupsTable->setEditTriggers(QAbstractItemView::NoEditTriggers); // create buttons - mAddButton = new QPushButton(); - mRemoveButton = new QPushButton(); - mClearButton = new QPushButton(); + m_addButton = new QPushButton(); + m_removeButton = new QPushButton(); + m_clearButton = new QPushButton(); - EMStudioManager::MakeTransparentButton(mAddButton, "Images/Icons/Plus.svg", "Add a new node group"); - EMStudioManager::MakeTransparentButton(mRemoveButton, "Images/Icons/Minus.svg", "Remove selected node groups"); - EMStudioManager::MakeTransparentButton(mClearButton, "Images/Icons/Clear.svg", "Remove all node groups"); + EMStudioManager::MakeTransparentButton(m_addButton, "Images/Icons/Plus.svg", "Add a new node group"); + EMStudioManager::MakeTransparentButton(m_removeButton, "Images/Icons/Minus.svg", "Remove selected node groups"); + EMStudioManager::MakeTransparentButton(m_clearButton, "Images/Icons/Clear.svg", "Remove all node groups"); // add the buttons to the button layout QHBoxLayout* buttonLayout = new QHBoxLayout(); buttonLayout->setSpacing(0); buttonLayout->setAlignment(Qt::AlignLeft); - buttonLayout->addWidget(mAddButton); - buttonLayout->addWidget(mRemoveButton); - buttonLayout->addWidget(mClearButton); + buttonLayout->addWidget(m_addButton); + buttonLayout->addWidget(m_removeButton); + buttonLayout->addWidget(m_clearButton); // create the layouts QVBoxLayout* layout = new QVBoxLayout(); @@ -226,18 +224,16 @@ namespace EMStudio // add widgets to the main layout layout->addLayout(buttonLayout); - layout->addWidget(mNodeGroupsTable); + layout->addWidget(m_nodeGroupsTable); // set the main layout setLayout(layout); // connect controls to the slots - connect(mAddButton, &QPushButton::clicked, this, &NodeGroupManagementWidget::AddNodeGroup); - connect(mRemoveButton, &QPushButton::clicked, this, &NodeGroupManagementWidget::RemoveSelectedNodeGroup); - connect(mClearButton, &QPushButton::clicked, this, &NodeGroupManagementWidget::ClearNodeGroups); - connect(mNodeGroupsTable, &QTableWidget::itemSelectionChanged, this, &NodeGroupManagementWidget::UpdateNodeGroupWidget); - //connect( mNodeGroupsTable, SIGNAL(currentItemChanged(QTableWidgetItem*, QTableWidgetItem*)), this, SLOT(UpdateNodeGroupWidget(QTableWidgetItem*, QTableWidgetItem*)) ); - //connect( mNodeGroupsTable, SIGNAL(itemDoubleClicked(QTableWidgetItem*)), this, SLOT(NodeGroupeNameDoubleClicked(QTableWidgetItem*)) ); + connect(m_addButton, &QPushButton::clicked, this, &NodeGroupManagementWidget::AddNodeGroup); + connect(m_removeButton, &QPushButton::clicked, this, &NodeGroupManagementWidget::RemoveSelectedNodeGroup); + connect(m_clearButton, &QPushButton::clicked, this, &NodeGroupManagementWidget::ClearNodeGroups); + connect(m_nodeGroupsTable, &QTableWidget::itemSelectionChanged, this, &NodeGroupManagementWidget::UpdateNodeGroupWidget); } @@ -245,35 +241,35 @@ namespace EMStudio void NodeGroupManagementWidget::UpdateInterface() { // check if the current actor exists - if (mActor == nullptr) + if (m_actor == nullptr) { // remove all rows - mNodeGroupsTable->setRowCount(0); + m_nodeGroupsTable->setRowCount(0); // disable the controls - mAddButton->setDisabled(true); - mRemoveButton->setDisabled(true); - mClearButton->setDisabled(true); + m_addButton->setDisabled(true); + m_removeButton->setDisabled(true); + m_clearButton->setDisabled(true); // stop here return; } // enable/disable the controls - mAddButton->setDisabled(false); - const bool disableButtons = mActor->GetNumNodeGroups() == 0; - mRemoveButton->setDisabled(disableButtons); - mClearButton->setDisabled(disableButtons); + m_addButton->setDisabled(false); + const bool disableButtons = m_actor->GetNumNodeGroups() == 0; + m_removeButton->setDisabled(disableButtons); + m_clearButton->setDisabled(disableButtons); // set the row count - mNodeGroupsTable->setRowCount(mActor->GetNumNodeGroups()); + m_nodeGroupsTable->setRowCount(m_actor->GetNumNodeGroups()); // fill the table with the existing node groups - const uint32 numNodeGroups = mActor->GetNumNodeGroups(); + const uint32 numNodeGroups = m_actor->GetNumNodeGroups(); for (uint32 i = 0; i < numNodeGroups; ++i) { // get the nodegroup - EMotionFX::NodeGroup* nodeGroup = mActor->GetNodeGroup(i); + EMotionFX::NodeGroup* nodeGroup = m_actor->GetNodeGroup(i); // continue if node group does not exist if (nodeGroup == nullptr) @@ -295,18 +291,18 @@ namespace EMStudio QTableWidgetItem* tableItemNumNodes = new QTableWidgetItem(numGroupString.c_str()); // add items to the table - mNodeGroupsTable->setCellWidget(i, 0, checkbox); - mNodeGroupsTable->setItem(i, 1, tableItemGroupName); - mNodeGroupsTable->setItem(i, 2, tableItemNumNodes); + m_nodeGroupsTable->setCellWidget(i, 0, checkbox); + m_nodeGroupsTable->setItem(i, 1, tableItemGroupName); + m_nodeGroupsTable->setItem(i, 2, tableItemNumNodes); // set the row height - mNodeGroupsTable->setRowHeight(i, 21); + m_nodeGroupsTable->setRowHeight(i, 21); } // set the old selected row if any one - if (mSelectedRow != MCORE_INVALIDINDEX32) + if (m_selectedRow != MCORE_INVALIDINDEX32) { - mNodeGroupsTable->setCurrentCell(mSelectedRow, 0); + m_nodeGroupsTable->setCurrentCell(m_selectedRow, 0); } } @@ -315,7 +311,7 @@ namespace EMStudio void NodeGroupManagementWidget::SetActor(EMotionFX::Actor* actor) { // set the new actor - mActor = actor; + m_actor = actor; // update the interface UpdateInterface(); @@ -326,7 +322,7 @@ namespace EMStudio void NodeGroupManagementWidget::SetNodeGroupWidget(NodeGroupWidget* nodeGroupWidget) { // set the node group widget - mNodeGroupWidget = nodeGroupWidget; + m_nodeGroupWidget = nodeGroupWidget; } @@ -334,37 +330,37 @@ namespace EMStudio void NodeGroupManagementWidget::UpdateNodeGroupWidget() { // return if no node group widget is set - if (mNodeGroupWidget == nullptr) + if (m_nodeGroupWidget == nullptr) { return; } // set the node group widget to the actual selection - mNodeGroupWidget->SetActor(mActor); + m_nodeGroupWidget->SetActor(m_actor); // return if the actor is not valid - if (mActor == nullptr) + if (m_actor == nullptr) { return; } // get the current row - const int currentRow = mNodeGroupsTable->currentRow(); + const int currentRow = m_nodeGroupsTable->currentRow(); // check if the row is valid if (currentRow != -1) { // set the current row - mSelectedRow = currentRow; + m_selectedRow = currentRow; // set the node group - EMotionFX::NodeGroup* nodeGroup = mActor->FindNodeGroupByName(FromQtString(mNodeGroupsTable->item(mSelectedRow, 1)->text()).c_str()); - mNodeGroupWidget->SetNodeGroup(nodeGroup); + EMotionFX::NodeGroup* nodeGroup = m_actor->FindNodeGroupByName(FromQtString(m_nodeGroupsTable->item(m_selectedRow, 1)->text()).c_str()); + m_nodeGroupWidget->SetNodeGroup(nodeGroup); } else { - mNodeGroupWidget->SetNodeGroup(nullptr); - mSelectedRow = MCORE_INVALIDINDEX32; + m_nodeGroupWidget->SetNodeGroup(nullptr); + m_selectedRow = MCORE_INVALIDINDEX32; } } @@ -375,7 +371,7 @@ namespace EMStudio // find the node group index to add uint32 groupNumber = 0; AZStd::string groupName = AZStd::string::format("UnnamedNodeGroup%i", groupNumber); - while (SearchTableForString(mNodeGroupsTable, groupName.c_str(), true) >= 0) + while (SearchTableForString(m_nodeGroupsTable, groupName.c_str(), true) >= 0) { ++groupNumber; groupName = AZStd::string::format("UnnamedNodeGroup%i", groupNumber); @@ -383,20 +379,15 @@ namespace EMStudio // call command for adding a new node group AZStd::string outResult; - const AZStd::string command = AZStd::string::format("AddNodeGroup -actorID %i -name \"%s\"", mActor->GetID(), groupName.c_str()); + const AZStd::string command = AZStd::string::format("AddNodeGroup -actorID %i -name \"%s\"", m_actor->GetID(), groupName.c_str()); if (EMStudio::GetCommandManager()->ExecuteCommand(command.c_str(), outResult) == false) { AZ_Error("EMotionFX", false, outResult.c_str()); } // select the new added row - const int insertPosition = SearchTableForString(mNodeGroupsTable, groupName.c_str()); - mNodeGroupsTable->selectRow(insertPosition); - - // find insert position - /*int insertPosition = SearchTableForString( mNodeGroupsTable, groupName.c_str() ); - if (insertPosition >= 0) - NodeGroupeNameDoubleClicked( mNodeGroupsTable->item(insertPosition, 0) );*/ + const int insertPosition = SearchTableForString(m_nodeGroupsTable, groupName.c_str()); + m_nodeGroupsTable->selectRow(insertPosition); } @@ -404,38 +395,38 @@ namespace EMStudio void NodeGroupManagementWidget::RemoveSelectedNodeGroup() { // set the node group of the node group widget to nullptr - if (mNodeGroupWidget) + if (m_nodeGroupWidget) { - mNodeGroupWidget->SetNodeGroup(nullptr); + m_nodeGroupWidget->SetNodeGroup(nullptr); } // return if there is no entry to delete - const int currentRow = mNodeGroupsTable->currentRow(); + const int currentRow = m_nodeGroupsTable->currentRow(); if (currentRow < 0) { return; } // get the nodegroup - QTableWidgetItem* item = mNodeGroupsTable->item(currentRow, 1); - EMotionFX::NodeGroup* nodeGroup = mActor->FindNodeGroupByName(FromQtString(item->text()).c_str()); + QTableWidgetItem* item = m_nodeGroupsTable->item(currentRow, 1); + EMotionFX::NodeGroup* nodeGroup = m_actor->FindNodeGroupByName(FromQtString(item->text()).c_str()); // call command for removing a nodegroup AZStd::string outResult; - const AZStd::string command = AZStd::string::format("RemoveNodeGroup -actorID %i -name \"%s\"", mActor->GetID(), nodeGroup->GetName()); + const AZStd::string command = AZStd::string::format("RemoveNodeGroup -actorID %i -name \"%s\"", m_actor->GetID(), nodeGroup->GetName()); if (EMStudio::GetCommandManager()->ExecuteCommand(command.c_str(), outResult) == false) { AZ_Error("EMotionFX", false, outResult.c_str()); } // selected the next row - if (currentRow > (mNodeGroupsTable->rowCount() - 1)) + if (currentRow > (m_nodeGroupsTable->rowCount() - 1)) { - mNodeGroupsTable->selectRow(currentRow - 1); + m_nodeGroupsTable->selectRow(currentRow - 1); } else { - mNodeGroupsTable->selectRow(currentRow); + m_nodeGroupsTable->selectRow(currentRow); } } @@ -444,11 +435,11 @@ namespace EMStudio void NodeGroupManagementWidget::RenameSelectedNodeGroup() { // get the nodegroup - QTableWidgetItem* item = mNodeGroupsTable->item(mNodeGroupsTable->currentRow(), 1); - EMotionFX::NodeGroup* nodeGroup = mActor->FindNodeGroupByName(FromQtString(item->text()).c_str()); + QTableWidgetItem* item = m_nodeGroupsTable->item(m_nodeGroupsTable->currentRow(), 1); + EMotionFX::NodeGroup* nodeGroup = m_actor->FindNodeGroupByName(FromQtString(item->text()).c_str()); // show the rename window - NodeGroupManagementRenameWindow nodeGroupManagementRenameWindow(this, mActor, nodeGroup->GetName()); + NodeGroupManagementRenameWindow nodeGroupManagementRenameWindow(this, m_actor, nodeGroup->GetName()); nodeGroupManagementRenameWindow.exec(); } @@ -456,7 +447,7 @@ namespace EMStudio // function to clear the nodegroups void NodeGroupManagementWidget::ClearNodeGroups() { - CommandSystem::ClearNodeGroupsCommand(mActor); + CommandSystem::ClearNodeGroupsCommand(m_actor); } @@ -468,13 +459,13 @@ namespace EMStudio // find the checkbox row AZStd::string nodeGroupName; - const int rowCount = mNodeGroupsTable->rowCount(); + const int rowCount = m_nodeGroupsTable->rowCount(); for (int i = 0; i < rowCount; ++i) { - QCheckBox* rowChechbox = (QCheckBox*)mNodeGroupsTable->cellWidget(i, 0); + QCheckBox* rowChechbox = (QCheckBox*)m_nodeGroupsTable->cellWidget(i, 0); if (rowChechbox == senderCheckbox) { - nodeGroupName = mNodeGroupsTable->item(i, 1)->text().toUtf8().data(); + nodeGroupName = m_nodeGroupsTable->item(i, 1)->text().toUtf8().data(); break; } } @@ -483,7 +474,7 @@ namespace EMStudio AZStd::string outResult; auto* command = aznew CommandSystem::CommandAdjustNodeGroup( GetCommandManager()->FindCommand(CommandSystem::CommandAdjustNodeGroup::s_commandName), - /*actorId=*/ mActor->GetID(), + /*actorId=*/ m_actor->GetID(), /*name=*/ nodeGroupName, /*newName=*/ AZStd::nullopt, /*enabledOnDefault=*/ checked @@ -560,13 +551,13 @@ namespace EMStudio void NodeGroupManagementWidget::contextMenuEvent(QContextMenuEvent* event) { // if the actor is not valid, the node group management is disabled - if (mActor == nullptr) + if (m_actor == nullptr) { return; } // get the current selection - const QList selectedItems = mNodeGroupsTable->selectedItems(); + const QList selectedItems = m_nodeGroupsTable->selectedItems(); // get the number of selected items const uint32 numSelectedItems = selectedItems.count(); diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/NodeGroups/NodeGroupManagementWidget.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/NodeGroups/NodeGroupManagementWidget.h index a7a8616edc..37f92346e4 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/NodeGroups/NodeGroupManagementWidget.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/NodeGroups/NodeGroupManagementWidget.h @@ -39,10 +39,10 @@ namespace EMStudio void Accepted(); private: - EMotionFX::Actor* mActor; - AZStd::string mNodeGroupName; - QLineEdit* mLineEdit; - QPushButton* mOKButton; + EMotionFX::Actor* m_actor; + AZStd::string m_nodeGroupName; + QLineEdit* m_lineEdit; + QPushButton* m_okButton; }; @@ -91,21 +91,21 @@ namespace EMStudio private: // pointer to the nodegroup widget - NodeGroupWidget* mNodeGroupWidget; + NodeGroupWidget* m_nodeGroupWidget; // searches for the given text in the table int SearchTableForString(QTableWidget* tableWidget, const QString& text, bool ignoreCurrentSelection = false); // the actor - EMotionFX::Actor* mActor; + EMotionFX::Actor* m_actor; // the listbox - QTableWidget* mNodeGroupsTable; - uint32 mSelectedRow; + QTableWidget* m_nodeGroupsTable; + uint32 m_selectedRow; // the buttons - QPushButton* mAddButton; - QPushButton* mRemoveButton; - QPushButton* mClearButton; + QPushButton* m_addButton; + QPushButton* m_removeButton; + QPushButton* m_clearButton; }; } // namespace EMStudio diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/NodeGroups/NodeGroupWidget.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/NodeGroups/NodeGroupWidget.cpp index 1a95899c32..7ce09a55d7 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/NodeGroups/NodeGroupWidget.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/NodeGroups/NodeGroupWidget.cpp @@ -33,10 +33,9 @@ namespace EMStudio NodeGroupWidget::NodeGroupWidget(QWidget* parent) : QWidget(parent) { - //mEnabledOnDefaultCheckbox = nullptr; - mNodeTable = nullptr; - mSelectNodesButton = nullptr; - mNodeGroup = nullptr; + m_nodeTable = nullptr; + m_selectNodesButton = nullptr; + m_nodeGroup = nullptr; // init the widget Init(); @@ -52,60 +51,48 @@ namespace EMStudio // the init function void NodeGroupWidget::Init() { - // create the disable checkbox - //mEnabledOnDefaultCheckbox = new QCheckBox( "Enabled On Default" ); - - // edit field for the group name - //mNodeGroupNameEdit = new QLineEdit(); - // create the node groups table - mNodeTable = new QTableWidget(0, 1, 0); + m_nodeTable = new QTableWidget(0, 1, 0); // create the table widget - mNodeTable->setCornerButtonEnabled(false); - mNodeTable->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); - mNodeTable->setContextMenuPolicy(Qt::DefaultContextMenu); + m_nodeTable->setCornerButtonEnabled(false); + m_nodeTable->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); + m_nodeTable->setContextMenuPolicy(Qt::DefaultContextMenu); // set the table to row selection - mNodeTable->setSelectionBehavior(QAbstractItemView::SelectRows); + m_nodeTable->setSelectionBehavior(QAbstractItemView::SelectRows); // make the table items read only - mNodeTable->setEditTriggers(QAbstractItemView::NoEditTriggers); + m_nodeTable->setEditTriggers(QAbstractItemView::NoEditTriggers); // set header items for the table QTableWidgetItem* nameHeaderItem = new QTableWidgetItem("Nodes"); nameHeaderItem->setTextAlignment(Qt::AlignVCenter | Qt::AlignLeft); - mNodeTable->setHorizontalHeaderItem(0, nameHeaderItem); + m_nodeTable->setHorizontalHeaderItem(0, nameHeaderItem); - QHeaderView* horizontalHeader = mNodeTable->horizontalHeader(); + QHeaderView* horizontalHeader = m_nodeTable->horizontalHeader(); horizontalHeader->setStretchLastSection(true); // create the node selection window - mNodeSelectionWindow = new NodeSelectionWindow(this, false); + m_nodeSelectionWindow = new NodeSelectionWindow(this, false); // create the selection buttons - mSelectNodesButton = new QPushButton(); - mAddNodesButton = new QPushButton(); - mRemoveNodesButton = new QPushButton(); + m_selectNodesButton = new QPushButton(); + m_addNodesButton = new QPushButton(); + m_removeNodesButton = new QPushButton(); - EMStudioManager::MakeTransparentButton(mSelectNodesButton, "Images/Icons/Plus.svg", "Select nodes and replace the current selection"); - EMStudioManager::MakeTransparentButton(mAddNodesButton, "Images/Icons/Plus.svg", "Select nodes and add them to the current selection"); - EMStudioManager::MakeTransparentButton(mRemoveNodesButton, "Images/Icons/Minus.svg", "Remove selected nodes from the list"); + EMStudioManager::MakeTransparentButton(m_selectNodesButton, "Images/Icons/Plus.svg", "Select nodes and replace the current selection"); + EMStudioManager::MakeTransparentButton(m_addNodesButton, "Images/Icons/Plus.svg", "Select nodes and add them to the current selection"); + EMStudioManager::MakeTransparentButton(m_removeNodesButton, "Images/Icons/Minus.svg", "Remove selected nodes from the list"); // create the buttons layout QHBoxLayout* buttonLayout = new QHBoxLayout(); buttonLayout->setSpacing(0); buttonLayout->setAlignment(Qt::AlignLeft); - buttonLayout->addWidget(mSelectNodesButton); - buttonLayout->addWidget(mAddNodesButton); - buttonLayout->addWidget(mRemoveNodesButton); - - // create layout for the edit field - /*QHBoxLayout* editLayout = new QHBoxLayout(); - editLayout->addWidget( new QLabel("Name:") ); - editLayout->addWidget( mNodeGroupNameEdit ); - editLayout->addWidget( mEnabledOnDefaultCheckbox );*/ + buttonLayout->addWidget(m_selectNodesButton); + buttonLayout->addWidget(m_addNodesButton); + buttonLayout->addWidget(m_removeNodesButton); // create the layouts QVBoxLayout* layout = new QVBoxLayout(); @@ -116,7 +103,7 @@ namespace EMStudio tableLayout->setMargin(0); tableLayout->addLayout(buttonLayout); - tableLayout->addWidget(mNodeTable); + tableLayout->addWidget(m_nodeTable); layout->addLayout(tableLayout); //layout->addLayout( editLayout ); @@ -125,12 +112,12 @@ namespace EMStudio setLayout(layout); // connect controls to the slots - connect(mSelectNodesButton, &QPushButton::clicked, this, &NodeGroupWidget::SelectNodesButtonPressed); - connect(mAddNodesButton, &QPushButton::clicked, this, &NodeGroupWidget::SelectNodesButtonPressed); - connect(mRemoveNodesButton, &QPushButton::clicked, this, &NodeGroupWidget::RemoveNodesButtonPressed); - connect(mNodeTable, &QTableWidget::itemSelectionChanged, this, &NodeGroupWidget::OnItemSelectionChanged); - connect(mNodeSelectionWindow->GetNodeHierarchyWidget(), &NodeHierarchyWidget::OnSelectionDone, this, &NodeGroupWidget::NodeSelectionFinished); - connect(mNodeSelectionWindow->GetNodeHierarchyWidget(), &NodeHierarchyWidget::OnDoubleClicked, this, &NodeGroupWidget::NodeSelectionFinished); + connect(m_selectNodesButton, &QPushButton::clicked, this, &NodeGroupWidget::SelectNodesButtonPressed); + connect(m_addNodesButton, &QPushButton::clicked, this, &NodeGroupWidget::SelectNodesButtonPressed); + connect(m_removeNodesButton, &QPushButton::clicked, this, &NodeGroupWidget::RemoveNodesButtonPressed); + connect(m_nodeTable, &QTableWidget::itemSelectionChanged, this, &NodeGroupWidget::OnItemSelectionChanged); + connect(m_nodeSelectionWindow->GetNodeHierarchyWidget(), &NodeHierarchyWidget::OnSelectionDone, this, &NodeGroupWidget::NodeSelectionFinished); + connect(m_nodeSelectionWindow->GetNodeHierarchyWidget(), &NodeHierarchyWidget::OnDoubleClicked, this, &NodeGroupWidget::NodeSelectionFinished); } @@ -138,48 +125,45 @@ namespace EMStudio void NodeGroupWidget::UpdateInterface() { // clear the table widget - mNodeTable->clear(); + m_nodeTable->clear(); // check if the node group is not valid - if (mNodeGroup == nullptr) + if (m_nodeGroup == nullptr) { // set the column count - mNodeTable->setColumnCount(0); + m_nodeTable->setColumnCount(0); // disable the widgets SetWidgetEnabled(false); - // clear the edit field - //mNodeGroupNameEdit->setText( "" ); - // stop here return; } // set the column count - mNodeTable->setColumnCount(1); + m_nodeTable->setColumnCount(1); // enable the widget SetWidgetEnabled(true); // set the remove nodes button enabled or not based on selection - mRemoveNodesButton->setEnabled((mNodeTable->rowCount() != 0) && (mNodeTable->selectedItems().size() != 0)); + m_removeNodesButton->setEnabled((m_nodeTable->rowCount() != 0) && (m_nodeTable->selectedItems().size() != 0)); // clear the table widget - mNodeTable->setRowCount(mNodeGroup->GetNumNodes()); + m_nodeTable->setRowCount(m_nodeGroup->GetNumNodes()); // set header items for the table - AZStd::string headerText = AZStd::string::format("%s Nodes (%i / %zu)", ((mNodeGroup->GetIsEnabledOnDefault()) ? "Enabled" : "Disabled"), mNodeGroup->GetNumNodes(), mActor->GetNumNodes()); + AZStd::string headerText = AZStd::string::format("%s Nodes (%i / %zu)", ((m_nodeGroup->GetIsEnabledOnDefault()) ? "Enabled" : "Disabled"), m_nodeGroup->GetNumNodes(), m_actor->GetNumNodes()); QTableWidgetItem* nameHeaderItem = new QTableWidgetItem(headerText.c_str()); nameHeaderItem->setTextAlignment(Qt::AlignVCenter | Qt::AlignCenter); - mNodeTable->setHorizontalHeaderItem(0, nameHeaderItem); + m_nodeTable->setHorizontalHeaderItem(0, nameHeaderItem); // fill the table with content - const uint16 numNodes = mNodeGroup->GetNumNodes(); + const uint16 numNodes = m_nodeGroup->GetNumNodes(); for (uint16 i = 0; i < numNodes; ++i) { // get the nodegroup - EMotionFX::Node* node = mActor->GetSkeleton()->GetNode(mNodeGroup->GetNode(i)); + EMotionFX::Node* node = m_actor->GetSkeleton()->GetNode(m_nodeGroup->GetNode(i)); // continue if node does not exist if (node == nullptr) @@ -189,23 +173,23 @@ namespace EMStudio // create table items QTableWidgetItem* tableItemNodeName = new QTableWidgetItem(node->GetName()); - mNodeTable->setItem(i, 0, tableItemNodeName); + m_nodeTable->setItem(i, 0, tableItemNodeName); // set the row height - mNodeTable->setRowHeight(i, 21); + m_nodeTable->setRowHeight(i, 21); } // resize to contents and adjust header - QHeaderView* verticalHeader = mNodeTable->verticalHeader(); + QHeaderView* verticalHeader = m_nodeTable->verticalHeader(); verticalHeader->setVisible(false); - mNodeTable->resizeColumnsToContents(); - mNodeTable->horizontalHeader()->setStretchLastSection(true); + m_nodeTable->resizeColumnsToContents(); + m_nodeTable->horizontalHeader()->setStretchLastSection(true); // set table size - mNodeTable->setColumnWidth(0, 37); - mNodeTable->setColumnWidth(3, 0); - mNodeTable->setColumnHidden(3, true); - mNodeTable->sortItems(3); + m_nodeTable->setColumnWidth(0, 37); + m_nodeTable->setColumnWidth(3, 0); + m_nodeTable->setColumnHidden(3, true); + m_nodeTable->sortItems(3); } @@ -213,14 +197,14 @@ namespace EMStudio void NodeGroupWidget::SetNodeGroup(EMotionFX::NodeGroup* nodeGroup) { // check if the actor was set - if (mActor == nullptr) + if (m_actor == nullptr) { - mNodeGroup = nullptr; + m_nodeGroup = nullptr; return; } // set the node group - mNodeGroup = nodeGroup; + m_nodeGroup = nodeGroup; // update the interface UpdateInterface(); @@ -231,8 +215,8 @@ namespace EMStudio void NodeGroupWidget::SetActor(EMotionFX::Actor* actor) { // set the new actor - mActor = actor; - mNodeGroup = nullptr; + m_actor = actor; + m_nodeGroup = nullptr; // update the interface UpdateInterface(); @@ -243,20 +227,20 @@ namespace EMStudio void NodeGroupWidget::SelectNodesButtonPressed() { // check if node group is set - if (mNodeGroup == nullptr) + if (m_nodeGroup == nullptr) { return; } // set the action for the selected nodes QWidget* senderWidget = (QWidget*)sender(); - if (senderWidget == mAddNodesButton) + if (senderWidget == m_addNodesButton) { - mNodeAction = CommandSystem::CommandAdjustNodeGroup::NodeAction::Add; + m_nodeAction = CommandSystem::CommandAdjustNodeGroup::NodeAction::Add; } else { - mNodeAction = CommandSystem::CommandAdjustNodeGroup::NodeAction::Replace; + m_nodeAction = CommandSystem::CommandAdjustNodeGroup::NodeAction::Replace; } // get the selected actorinstance @@ -270,28 +254,28 @@ namespace EMStudio } // create selection list for the current nodes within the group - mNodeSelectionList.Clear(); - if (senderWidget == mSelectNodesButton) + m_nodeSelectionList.Clear(); + if (senderWidget == m_selectNodesButton) { - MCore::SmallArray& nodes = mNodeGroup->GetNodeArray(); + MCore::SmallArray& nodes = m_nodeGroup->GetNodeArray(); const uint16 numNodes = nodes.GetLength(); for (uint16 i = 0; i < numNodes; ++i) { - EMotionFX::Node* node = mActor->GetSkeleton()->GetNode(nodes[i]); - mNodeSelectionList.AddNode(node); + EMotionFX::Node* node = m_actor->GetSkeleton()->GetNode(nodes[i]); + m_nodeSelectionList.AddNode(node); } } // show the node selection window - mNodeSelectionWindow->Update(actorInstance->GetID(), &mNodeSelectionList); - mNodeSelectionWindow->show(); + m_nodeSelectionWindow->Update(actorInstance->GetID(), &m_nodeSelectionList); + m_nodeSelectionWindow->show(); } // remove nodes void NodeGroupWidget::RemoveNodesButtonPressed() { - if (mNodeTable->selectedItems().empty()) + if (m_nodeTable->selectedItems().empty()) { return; } @@ -299,7 +283,7 @@ namespace EMStudio // generate node list string AZStd::vector nodeList; int lowestSelectedRow = AZStd::numeric_limits::max(); - for (const QTableWidgetItem* item : mNodeTable->selectedItems()) + for (const QTableWidgetItem* item : m_nodeTable->selectedItems()) { nodeList.emplace_back(FromQtString(item->text())); lowestSelectedRow = AZStd::min(lowestSelectedRow, item->row()); @@ -308,8 +292,8 @@ namespace EMStudio AZStd::string outResult; auto* command = aznew CommandSystem::CommandAdjustNodeGroup( GetCommandManager()->FindCommand(CommandSystem::CommandAdjustNodeGroup::s_commandName), - /*actorId=*/ mActor->GetID(), - /*name=*/ mNodeGroup->GetName(), + /*actorId=*/ m_actor->GetID(), + /*name=*/ m_nodeGroup->GetName(), /*newName=*/ AZStd::nullopt, /*enabledOnDefault=*/ AZStd::nullopt, /*nodeNames=*/ AZStd::move(nodeList), @@ -321,13 +305,13 @@ namespace EMStudio } // selected the next row - if (lowestSelectedRow > (mNodeTable->rowCount() - 1)) + if (lowestSelectedRow > (m_nodeTable->rowCount() - 1)) { - mNodeTable->selectRow(lowestSelectedRow - 1); + m_nodeTable->selectRow(lowestSelectedRow - 1); } else { - mNodeTable->selectRow(lowestSelectedRow); + m_nodeTable->selectRow(lowestSelectedRow); } } @@ -352,12 +336,12 @@ namespace EMStudio AZStd::string outResult; auto* command = aznew CommandSystem::CommandAdjustNodeGroup( GetCommandManager()->FindCommand(CommandSystem::CommandAdjustNodeGroup::s_commandName), - /*actorId=*/ mActor->GetID(), - /*name=*/ mNodeGroup->GetName(), + /*actorId=*/ m_actor->GetID(), + /*name=*/ m_nodeGroup->GetName(), /*newName=*/ AZStd::nullopt, /*enabledOnDefault=*/ AZStd::nullopt, /*nodeNames=*/ AZStd::move(nodeList), - /*nodeAction=*/ mNodeAction + /*nodeAction=*/ m_nodeAction ); if (EMStudio::GetCommandManager()->ExecuteCommand(command, outResult) == false) { @@ -369,19 +353,17 @@ namespace EMStudio // handle item selection changes of the node table void NodeGroupWidget::OnItemSelectionChanged() { - mRemoveNodesButton->setEnabled((mNodeTable->rowCount() != 0) && (mNodeTable->selectedItems().size() != 0)); + m_removeNodesButton->setEnabled((m_nodeTable->rowCount() != 0) && (m_nodeTable->selectedItems().size() != 0)); } // enable/disable the dialog void NodeGroupWidget::SetWidgetEnabled(bool enabled) { - //mNodeGroupNameEdit->setDisabled( !enabled ); - //mEnabledOnDefaultCheckbox->setDisabled( !enabled ); - mNodeTable->setDisabled(!enabled); - mSelectNodesButton->setDisabled(!enabled); - mAddNodesButton->setDisabled(!enabled); - mRemoveNodesButton->setDisabled(!enabled); + m_nodeTable->setDisabled(!enabled); + m_selectNodesButton->setDisabled(!enabled); + m_addNodesButton->setDisabled(!enabled); + m_removeNodesButton->setDisabled(!enabled); } diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/NodeGroups/NodeGroupWidget.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/NodeGroups/NodeGroupWidget.h index 6861e77756..c96b972085 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/NodeGroups/NodeGroupWidget.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/NodeGroups/NodeGroupWidget.h @@ -53,18 +53,18 @@ namespace EMStudio void keyReleaseEvent(QKeyEvent* event) override; private: - EMotionFX::Actor* mActor; + EMotionFX::Actor* m_actor; - NodeSelectionWindow* mNodeSelectionWindow; - CommandSystem::SelectionList mNodeSelectionList; - EMotionFX::NodeGroup* mNodeGroup; - uint16 mNodeGroupIndex; - CommandSystem::CommandAdjustNodeGroup::NodeAction mNodeAction; + NodeSelectionWindow* m_nodeSelectionWindow; + CommandSystem::SelectionList m_nodeSelectionList; + EMotionFX::NodeGroup* m_nodeGroup; + uint16 m_nodeGroupIndex; + CommandSystem::CommandAdjustNodeGroup::NodeAction m_nodeAction; // widgets - QTableWidget* mNodeTable; - QPushButton* mSelectNodesButton; - QPushButton* mAddNodesButton; - QPushButton* mRemoveNodesButton; + QTableWidget* m_nodeTable; + QPushButton* m_selectNodesButton; + QPushButton* m_addNodesButton; + QPushButton* m_removeNodesButton; }; } // namespace EMStudio diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/NodeGroups/NodeGroupsPlugin.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/NodeGroups/NodeGroupsPlugin.cpp index 218035dc30..3fe5c589a7 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/NodeGroups/NodeGroupsPlugin.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/NodeGroups/NodeGroupsPlugin.cpp @@ -26,16 +26,16 @@ namespace EMStudio NodeGroupsPlugin::NodeGroupsPlugin() : EMStudio::DockWidgetPlugin() { - mDialogStack = nullptr; - mNodeGroupWidget = nullptr; - mNodeGroupManagementWidget = nullptr; - mSelectCallback = nullptr; - mUnselectCallback = nullptr; - mClearSelectionCallback = nullptr; - mAdjustNodeGroupCallback = nullptr; - mAddNodeGroupCallback = nullptr; - mRemoveNodeGroupCallback = nullptr; - mCurrentActor = nullptr; + m_dialogStack = nullptr; + m_nodeGroupWidget = nullptr; + m_nodeGroupManagementWidget = nullptr; + m_selectCallback = nullptr; + m_unselectCallback = nullptr; + m_clearSelectionCallback = nullptr; + m_adjustNodeGroupCallback = nullptr; + m_addNodeGroupCallback = nullptr; + m_removeNodeGroupCallback = nullptr; + m_currentActor = nullptr; } @@ -43,23 +43,23 @@ namespace EMStudio NodeGroupsPlugin::~NodeGroupsPlugin() { // unregister the command callbacks and get rid of the memory - GetCommandManager()->RemoveCommandCallback(mSelectCallback, false); - GetCommandManager()->RemoveCommandCallback(mUnselectCallback, false); - GetCommandManager()->RemoveCommandCallback(mClearSelectionCallback, false); - GetCommandManager()->RemoveCommandCallback(mAdjustNodeGroupCallback, false); - GetCommandManager()->RemoveCommandCallback(mAddNodeGroupCallback, false); - GetCommandManager()->RemoveCommandCallback(mRemoveNodeGroupCallback, false); + GetCommandManager()->RemoveCommandCallback(m_selectCallback, false); + GetCommandManager()->RemoveCommandCallback(m_unselectCallback, false); + GetCommandManager()->RemoveCommandCallback(m_clearSelectionCallback, false); + GetCommandManager()->RemoveCommandCallback(m_adjustNodeGroupCallback, false); + GetCommandManager()->RemoveCommandCallback(m_addNodeGroupCallback, false); + GetCommandManager()->RemoveCommandCallback(m_removeNodeGroupCallback, false); // remove the callback - delete mSelectCallback; - delete mUnselectCallback; - delete mClearSelectionCallback; - delete mAdjustNodeGroupCallback; - delete mAddNodeGroupCallback; - delete mRemoveNodeGroupCallback; + delete m_selectCallback; + delete m_unselectCallback; + delete m_clearSelectionCallback; + delete m_adjustNodeGroupCallback; + delete m_addNodeGroupCallback; + delete m_removeNodeGroupCallback; // clear dialogstack and delete afterwards - delete mDialogStack; + delete m_dialogStack; } @@ -75,40 +75,40 @@ namespace EMStudio bool NodeGroupsPlugin::Init() { // create the dialog stack - assert(mDialogStack == nullptr); - mDialogStack = new MysticQt::DialogStack(); - mDock->setMinimumWidth(300); - mDock->setMinimumHeight(100); - mDock->setWidget(mDialogStack); + assert(m_dialogStack == nullptr); + m_dialogStack = new MysticQt::DialogStack(); + m_dock->setMinimumWidth(300); + m_dock->setMinimumHeight(100); + m_dock->setWidget(m_dialogStack); // create the management and node group widgets - mNodeGroupWidget = new NodeGroupWidget(); - mNodeGroupManagementWidget = new NodeGroupManagementWidget(mNodeGroupWidget); + m_nodeGroupWidget = new NodeGroupWidget(); + m_nodeGroupManagementWidget = new NodeGroupManagementWidget(m_nodeGroupWidget); // add the widgets to the dialog stack - mDialogStack->Add(mNodeGroupManagementWidget, "Node Group Management", false, true, true, false); - mDialogStack->Add(mNodeGroupWidget, "Node Group", false, true, true); + m_dialogStack->Add(m_nodeGroupManagementWidget, "Node Group Management", false, true, true, false); + m_dialogStack->Add(m_nodeGroupWidget, "Node Group", false, true, true); // create and register the command callbacks only (only execute this code once for all plugins) - mSelectCallback = new CommandSelectCallback(false); - mUnselectCallback = new CommandUnselectCallback(false); - mClearSelectionCallback = new CommandClearSelectionCallback(false); - mAdjustNodeGroupCallback = new CommandAdjustNodeGroupCallback(false); - mAddNodeGroupCallback = new CommandAddNodeGroupCallback(false); - mRemoveNodeGroupCallback = new CommandRemoveNodeGroupCallback(false); + m_selectCallback = new CommandSelectCallback(false); + m_unselectCallback = new CommandUnselectCallback(false); + m_clearSelectionCallback = new CommandClearSelectionCallback(false); + m_adjustNodeGroupCallback = new CommandAdjustNodeGroupCallback(false); + m_addNodeGroupCallback = new CommandAddNodeGroupCallback(false); + m_removeNodeGroupCallback = new CommandRemoveNodeGroupCallback(false); - GetCommandManager()->RegisterCommandCallback("Select", mSelectCallback); - GetCommandManager()->RegisterCommandCallback("Unselect", mUnselectCallback); - GetCommandManager()->RegisterCommandCallback("ClearSelection", mClearSelectionCallback); - GetCommandManager()->RegisterCommandCallback(CommandSystem::CommandAdjustNodeGroup::s_commandName.data(), mAdjustNodeGroupCallback); - GetCommandManager()->RegisterCommandCallback("AddNodeGroup", mAddNodeGroupCallback); - GetCommandManager()->RegisterCommandCallback("RemoveNodeGroup", mRemoveNodeGroupCallback); + GetCommandManager()->RegisterCommandCallback("Select", m_selectCallback); + GetCommandManager()->RegisterCommandCallback("Unselect", m_unselectCallback); + GetCommandManager()->RegisterCommandCallback("ClearSelection", m_clearSelectionCallback); + GetCommandManager()->RegisterCommandCallback(CommandSystem::CommandAdjustNodeGroup::s_commandName.data(), m_adjustNodeGroupCallback); + GetCommandManager()->RegisterCommandCallback("AddNodeGroup", m_addNodeGroupCallback); + GetCommandManager()->RegisterCommandCallback("RemoveNodeGroup", m_removeNodeGroupCallback); // reinit the dialog ReInit(); // connect the window activation signal to refresh if reactivated - connect(mDock, &QDockWidget::visibilityChanged, this, &NodeGroupsPlugin::WindowReInit); + connect(m_dock, &QDockWidget::visibilityChanged, this, &NodeGroupsPlugin::WindowReInit); return true; } @@ -124,10 +124,10 @@ namespace EMStudio // show hint if no/multiple actor instances is/are selected if (actorInstance == nullptr) { - mCurrentActor = nullptr; - mNodeGroupWidget->SetActor(nullptr); - mNodeGroupWidget->SetNodeGroup(nullptr); - mNodeGroupManagementWidget->SetActor(nullptr); + m_currentActor = nullptr; + m_nodeGroupWidget->SetActor(nullptr); + m_nodeGroupWidget->SetNodeGroup(nullptr); + m_nodeGroupManagementWidget->SetActor(nullptr); return; } @@ -135,18 +135,18 @@ namespace EMStudio EMotionFX::Actor* actor = actorInstance->GetActor(); // only reinit the node groups window if actorinstance changed - if (mCurrentActor != actor) + if (m_currentActor != actor) { // set the new actor - mCurrentActor = actor; + m_currentActor = actor; // set the new actor on each widget - mNodeGroupWidget->SetActor(mCurrentActor); - mNodeGroupManagementWidget->SetActor(mCurrentActor); + m_nodeGroupWidget->SetActor(m_currentActor); + m_nodeGroupManagementWidget->SetActor(m_currentActor); } // set the dialog stack as main widget - mDock->setWidget(mDialogStack); + m_dock->setWidget(m_dialogStack); // update the interface UpdateInterface(); @@ -166,8 +166,8 @@ namespace EMStudio // update the interface void NodeGroupsPlugin::UpdateInterface() { - mNodeGroupManagementWidget->UpdateInterface(); - mNodeGroupWidget->UpdateInterface(); + m_nodeGroupManagementWidget->UpdateInterface(); + m_nodeGroupWidget->UpdateInterface(); } diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/NodeGroups/NodeGroupsPlugin.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/NodeGroups/NodeGroupsPlugin.h index 7704708571..613d2e3494 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/NodeGroups/NodeGroupsPlugin.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/NodeGroups/NodeGroupsPlugin.h @@ -74,22 +74,22 @@ namespace EMStudio MCORE_DEFINECOMMANDCALLBACK(CommandAddNodeGroupCallback); MCORE_DEFINECOMMANDCALLBACK(CommandRemoveNodeGroupCallback); - CommandSelectCallback* mSelectCallback; - CommandUnselectCallback* mUnselectCallback; - CommandClearSelectionCallback* mClearSelectionCallback; - CommandAdjustNodeGroupCallback* mAdjustNodeGroupCallback; - CommandAddNodeGroupCallback* mAddNodeGroupCallback; - CommandRemoveNodeGroupCallback* mRemoveNodeGroupCallback; + CommandSelectCallback* m_selectCallback; + CommandUnselectCallback* m_unselectCallback; + CommandClearSelectionCallback* m_clearSelectionCallback; + CommandAdjustNodeGroupCallback* m_adjustNodeGroupCallback; + CommandAddNodeGroupCallback* m_addNodeGroupCallback; + CommandRemoveNodeGroupCallback* m_removeNodeGroupCallback; // current selected actor - EMotionFX::Actor* mCurrentActor; + EMotionFX::Actor* m_currentActor; // the dialog stack widgets - NodeGroupWidget* mNodeGroupWidget; - NodeGroupManagementWidget* mNodeGroupManagementWidget; + NodeGroupWidget* m_nodeGroupWidget; + NodeGroupManagementWidget* m_nodeGroupManagementWidget; // some qt stuff - MysticQt::DialogStack* mDialogStack; - QLabel* mInfoText; + MysticQt::DialogStack* m_dialogStack; + QLabel* m_infoText; }; } // namespace EMStudio diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/NodeWindow/NodeInfo.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/NodeWindow/NodeInfo.cpp index a402dc869e..3bbf9a0731 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/NodeWindow/NodeInfo.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/NodeWindow/NodeInfo.cpp @@ -31,11 +31,11 @@ namespace EMStudio m_name = node->GetNameString(); // transform info - m_position = transformData->GetCurrentPose()->GetLocalSpaceTransform(nodeIndex).mPosition; - m_rotation = transformData->GetCurrentPose()->GetLocalSpaceTransform(nodeIndex).mRotation; + m_position = transformData->GetCurrentPose()->GetLocalSpaceTransform(nodeIndex).m_position; + m_rotation = transformData->GetCurrentPose()->GetLocalSpaceTransform(nodeIndex).m_rotation; #ifndef EMFX_SCALE_DISABLED - m_scale = transformData->GetCurrentPose()->GetLocalSpaceTransform(nodeIndex).mScale; + m_scale = transformData->GetCurrentPose()->GetLocalSpaceTransform(nodeIndex).m_scale; #else m_scale = AZ::Vector3::CreateOne(); #endif @@ -53,9 +53,9 @@ namespace EMStudio if (actor->GetHasMirrorInfo()) { const EMotionFX::Actor::NodeMirrorInfo& nodeMirrorInfo = actor->GetNodeMirrorInfo(nodeIndex); - if (nodeMirrorInfo.mSourceNode != MCORE_INVALIDINDEX16 && nodeMirrorInfo.mSourceNode != nodeIndex) + if (nodeMirrorInfo.m_sourceNode != MCORE_INVALIDINDEX16 && nodeMirrorInfo.m_sourceNode != nodeIndex) { - m_mirrorNodeName = actor->GetSkeleton()->GetNode(nodeMirrorInfo.mSourceNode)->GetNameString(); + m_mirrorNodeName = actor->GetSkeleton()->GetNode(nodeMirrorInfo.m_sourceNode)->GetNameString(); } } diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/NodeWindow/NodeWindowPlugin.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/NodeWindow/NodeWindowPlugin.cpp index 7b47b8cb43..6b7beb20de 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/NodeWindow/NodeWindowPlugin.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/NodeWindow/NodeWindowPlugin.cpp @@ -28,8 +28,8 @@ namespace EMStudio { NodeWindowPlugin::NodeWindowPlugin() : EMStudio::DockWidgetPlugin() - , mDialogStack(nullptr) - , mHierarchyWidget(nullptr) + , m_dialogStack(nullptr) + , m_hierarchyWidget(nullptr) , m_propertyWidget(nullptr) { } @@ -79,35 +79,35 @@ namespace EMStudio GetCommandManager()->RegisterCommandCallback("ClearSelection", m_callbacks.back()); // create the dialog stack - AZ_Assert(!mDialogStack, "Expected an unitialized mDialogStack, was this function called more than once?"); - mDialogStack = new MysticQt::DialogStack(); + AZ_Assert(!m_dialogStack, "Expected an unitialized m_dialogStack, was this function called more than once?"); + m_dialogStack = new MysticQt::DialogStack(); // add the node hierarchy - mHierarchyWidget = new NodeHierarchyWidget(mDock, false); - mHierarchyWidget->setObjectName("EMFX.NodeWindowPlugin.NodeHierarchyWidget.HierarchyWidget"); - mHierarchyWidget->GetTreeWidget()->setMinimumWidth(100); - mDialogStack->Add(mHierarchyWidget, "Hierarchy", false, true); + m_hierarchyWidget = new NodeHierarchyWidget(m_dock, false); + m_hierarchyWidget->setObjectName("EMFX.NodeWindowPlugin.NodeHierarchyWidget.HierarchyWidget"); + m_hierarchyWidget->GetTreeWidget()->setMinimumWidth(100); + m_dialogStack->Add(m_hierarchyWidget, "Hierarchy", false, true); // add the node attributes widget - m_propertyWidget = aznew AzToolsFramework::ReflectedPropertyEditor(mDialogStack); + m_propertyWidget = aznew AzToolsFramework::ReflectedPropertyEditor(m_dialogStack); m_propertyWidget->setObjectName("EMFX.NodeWindowPlugin.ReflectedPropertyEditor.PropertyWidget"); m_propertyWidget->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed); m_propertyWidget->SetAutoResizeLabels(true); - mDialogStack->Add(m_propertyWidget, "Node Attributes", false, true, true, false); + m_dialogStack->Add(m_propertyWidget, "Node Attributes", false, true, true, false); // prepare the dock window - mDock->setWidget(mDialogStack); - mDock->setMinimumWidth(100); - mDock->setMinimumHeight(100); + m_dock->setWidget(m_dialogStack); + m_dock->setMinimumWidth(100); + m_dock->setMinimumHeight(100); // add functionality to the controls - connect(mDock, &QDockWidget::visibilityChanged, this, &NodeWindowPlugin::VisibilityChanged); - connect(mHierarchyWidget->GetTreeWidget(), &QTreeWidget::itemSelectionChanged, this, &NodeWindowPlugin::OnNodeChanged); + connect(m_dock, &QDockWidget::visibilityChanged, this, &NodeWindowPlugin::VisibilityChanged); + connect(m_hierarchyWidget->GetTreeWidget(), &QTreeWidget::itemSelectionChanged, this, &NodeWindowPlugin::OnNodeChanged); - const AzQtComponents::FilteredSearchWidget* searchWidget = mHierarchyWidget->GetSearchWidget(); + const AzQtComponents::FilteredSearchWidget* searchWidget = m_hierarchyWidget->GetSearchWidget(); connect(searchWidget, &AzQtComponents::FilteredSearchWidget::TextFilterChanged, this, &NodeWindowPlugin::OnTextFilterChanged); - connect(mHierarchyWidget, &NodeHierarchyWidget::FilterStateChanged, this, &NodeWindowPlugin::UpdateVisibleNodeIndices); + connect(m_hierarchyWidget, &NodeHierarchyWidget::FilterStateChanged, this, &NodeWindowPlugin::UpdateVisibleNodeIndices); // reinit the dialog ReInit(); @@ -123,15 +123,15 @@ namespace EMStudio EMotionFX::ActorInstance* actorInstance = selection.GetSingleActorInstance(); // reset the node name filter - mHierarchyWidget->GetSearchWidget()->ClearTextFilter(); - mHierarchyWidget->GetTreeWidget()->clear(); + m_hierarchyWidget->GetSearchWidget()->ClearTextFilter(); + m_hierarchyWidget->GetTreeWidget()->clear(); m_propertyWidget->ClearInstances(); m_propertyWidget->InvalidateAll(); if (actorInstance) { - mHierarchyWidget->Update(actorInstance->GetID()); + m_hierarchyWidget->Update(actorInstance->GetID()); m_actorInfo.reset(aznew ActorInfo(actorInstance)); m_propertyWidget->AddInstance(m_actorInfo.get(), azrtti_typeid(m_actorInfo.get())); } @@ -158,14 +158,14 @@ namespace EMStudio selection.ClearNodeSelection(); m_selectedNodeIndices.clear(); - AZStd::vector& selectedItems = mHierarchyWidget->GetSelectedItems(); + AZStd::vector& selectedItems = m_hierarchyWidget->GetSelectedItems(); EMotionFX::ActorInstance* selectedInstance = nullptr; EMotionFX::Node* selectedNode = nullptr; for (const SelectionItem& selectedItem : selectedItems) { - const uint32 actorInstanceID = selectedItem.mActorInstanceID; + const uint32 actorInstanceID = selectedItem.m_actorInstanceId; const char* nodeName = selectedItem.GetNodeName(); EMotionFX::ActorInstance* actorInstance = EMotionFX::GetActorManager().FindActorInstanceByID(actorInstanceID); @@ -177,7 +177,7 @@ namespace EMStudio EMotionFX::Actor* actor = actorInstance->GetActor(); EMotionFX::Node* node = actor->GetSkeleton()->FindNodeByName(nodeName); - if (node && mHierarchyWidget->CheckIfNodeVisible(actorInstance, node)) + if (node && m_hierarchyWidget->CheckIfNodeVisible(actorInstance, node)) { if (selectedInstance == nullptr) { @@ -278,11 +278,11 @@ namespace EMStudio return; } - AZStd::string filterString = mHierarchyWidget->GetSearchWidgetText(); + AZStd::string filterString = m_hierarchyWidget->GetSearchWidgetText(); AZStd::to_lower(filterString.begin(), filterString.end()); - const bool showNodes = mHierarchyWidget->GetDisplayNodes(); - const bool showBones = mHierarchyWidget->GetDisplayBones(); - const bool showMeshes = mHierarchyWidget->GetDisplayMeshes(); + const bool showNodes = m_hierarchyWidget->GetDisplayNodes(); + const bool showBones = m_hierarchyWidget->GetDisplayBones(); + const bool showMeshes = m_hierarchyWidget->GetDisplayMeshes(); // get access to the actor and the number of nodes EMotionFX::Actor* actor = actorInstance->GetActor(); diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/NodeWindow/NodeWindowPlugin.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/NodeWindow/NodeWindowPlugin.h index 582e9e9eac..157486df10 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/NodeWindow/NodeWindowPlugin.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/NodeWindow/NodeWindowPlugin.h @@ -76,12 +76,12 @@ namespace EMStudio AZStd::vector m_callbacks; - MysticQt::DialogStack* mDialogStack; - NodeHierarchyWidget* mHierarchyWidget; + MysticQt::DialogStack* m_dialogStack; + NodeHierarchyWidget* m_hierarchyWidget; AzToolsFramework::ReflectedPropertyEditor* m_propertyWidget; - AZStd::string mString; - AZStd::string mTempGroupName; + AZStd::string m_string; + AZStd::string m_tempGroupName; AZStd::unordered_set m_visibleNodeIndices; AZStd::unordered_set m_selectedNodeIndices; diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/SceneManager/ActorPropertiesWindow.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/SceneManager/ActorPropertiesWindow.cpp index 4e8e51b601..c449f492b1 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/SceneManager/ActorPropertiesWindow.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/SceneManager/ActorPropertiesWindow.cpp @@ -24,7 +24,7 @@ namespace EMStudio ActorPropertiesWindow::ActorPropertiesWindow(QWidget* parent, SceneManagerPlugin* plugin) : QWidget(parent) { - mPlugin = plugin; + m_plugin = plugin; } // init after the parent dock window has been created @@ -44,9 +44,9 @@ namespace EMStudio // actor name rowNr = 0; layout->addWidget(new QLabel("Actor name"), rowNr, 0); - mNameEdit = new QLineEdit(); - connect(mNameEdit, &QLineEdit::editingFinished, this, &ActorPropertiesWindow::NameEditChanged); - layout->addWidget(mNameEdit, rowNr, 1); + m_nameEdit = new QLineEdit(); + connect(m_nameEdit, &QLineEdit::editingFinished, this, &ActorPropertiesWindow::NameEditChanged); + layout->addWidget(m_nameEdit, rowNr, 1); // Motion extraction joint. rowNr++; @@ -94,14 +94,14 @@ namespace EMStudio // mirror setup rowNr++; - mMirrorSetupWindow = new MirrorSetupWindow(mPlugin->GetDockWidget(), mPlugin); - mMirrorSetupLink = new AzQtComponents::BrowseEdit(); - mMirrorSetupLink->setClearButtonEnabled(true); - mMirrorSetupLink->setLineEditReadOnly(true); - mMirrorSetupLink->setPlaceholderText("Click folder to setup"); + m_mirrorSetupWindow = new MirrorSetupWindow(m_plugin->GetDockWidget(), m_plugin); + m_mirrorSetupLink = new AzQtComponents::BrowseEdit(); + m_mirrorSetupLink->setClearButtonEnabled(true); + m_mirrorSetupLink->setLineEditReadOnly(true); + m_mirrorSetupLink->setPlaceholderText("Click folder to setup"); layout->addWidget(new QLabel("Mirror setup"), rowNr, 0); - layout->addWidget(mMirrorSetupLink, rowNr, 1); - connect(mMirrorSetupLink, &AzQtComponents::BrowseEdit::attachedButtonTriggered, this, &ActorPropertiesWindow::OnMirrorSetup); + layout->addWidget(m_mirrorSetupLink, rowNr, 1); + connect(m_mirrorSetupLink, &AzQtComponents::BrowseEdit::attachedButtonTriggered, this, &ActorPropertiesWindow::OnMirrorSetup); UpdateInterface(); } @@ -109,8 +109,8 @@ namespace EMStudio void ActorPropertiesWindow::UpdateInterface() { - mActor = nullptr; - mActorInstance = nullptr; + m_actor = nullptr; + m_actorInstance = nullptr; EMotionFX::ActorInstance* actorInstance = GetCommandManager()->GetCurrentSelection().GetSingleActorInstance(); EMotionFX::Actor* actor = GetCommandManager()->GetCurrentSelection().GetSingleActor(); @@ -118,13 +118,13 @@ namespace EMStudio // in case we have selected a single actor instance if (actorInstance) { - mActorInstance = actorInstance; - mActor = actorInstance->GetActor(); + m_actorInstance = actorInstance; + m_actor = actorInstance->GetActor(); } // in case we have selected a single actor else if (actor) { - mActor = actor; + m_actor = actor; const size_t numActorInstances = EMotionFX::GetActorManager().GetNumActorInstances(); for (size_t i = 0; i < numActorInstances; ++i) @@ -132,15 +132,15 @@ namespace EMStudio EMotionFX::ActorInstance* currentInstance = EMotionFX::GetActorManager().GetActorInstance(i); if (currentInstance->GetActor() == actor) { - mActorInstance = currentInstance; + m_actorInstance = currentInstance; break; } } } - mMirrorSetupWindow->Reinit(); + m_mirrorSetupWindow->Reinit(); - if (mActorInstance == nullptr || mActor == nullptr) + if (m_actorInstance == nullptr || m_actor == nullptr) { // reset data and disable interface elements m_motionExtractionJointBrowseEdit->setEnabled(false); @@ -155,37 +155,37 @@ namespace EMStudio m_excludeFromBoundsBrowseEdit->SetSelectedJoints({}); // actor name - mNameEdit->setEnabled(false); - mNameEdit->setText(""); + m_nameEdit->setEnabled(false); + m_nameEdit->setText(""); - mMirrorSetupLink->setEnabled(false); + m_mirrorSetupLink->setEnabled(false); return; } - mMirrorSetupLink->setEnabled(true); + m_mirrorSetupLink->setEnabled(true); // Motion extraction node - EMotionFX::Node* extractionNode = mActor->GetMotionExtractionNode(); + EMotionFX::Node* extractionNode = m_actor->GetMotionExtractionNode(); m_motionExtractionJointBrowseEdit->setEnabled(true); if (extractionNode) { - m_motionExtractionJointBrowseEdit->SetSelectedJoints({SelectionItem(mActorInstance->GetID(), extractionNode->GetName())}); + m_motionExtractionJointBrowseEdit->SetSelectedJoints({SelectionItem(m_actorInstance->GetID(), extractionNode->GetName())}); } else { m_motionExtractionJointBrowseEdit->SetSelectedJoints({}); } - EMotionFX::Node* bestMatchingNode = mActor->FindBestMotionExtractionNode(); - m_findBestMatchButton->setVisible(bestMatchingNode && mActor->GetMotionExtractionNode() != bestMatchingNode); + EMotionFX::Node* bestMatchingNode = m_actor->FindBestMotionExtractionNode(); + m_findBestMatchButton->setVisible(bestMatchingNode && m_actor->GetMotionExtractionNode() != bestMatchingNode); // Retarget root node - EMotionFX::Node* retargetRootNode = mActor->GetRetargetRootNode(); + EMotionFX::Node* retargetRootNode = m_actor->GetRetargetRootNode(); m_retargetRootJointBrowseEdit->setEnabled(true); if (retargetRootNode) { - m_retargetRootJointBrowseEdit->SetSelectedJoints({SelectionItem(mActorInstance->GetID(), retargetRootNode->GetName())}); + m_retargetRootJointBrowseEdit->SetSelectedJoints({SelectionItem(m_actorInstance->GetID(), retargetRootNode->GetName())}); } else { @@ -196,23 +196,23 @@ namespace EMStudio m_excludeFromBoundsBrowseEdit->setEnabled(true); AZStd::vector jointsExcludedFromBounds; - if (mActorInstance) + if (m_actorInstance) { - const size_t numNodes = mActor->GetNumNodes(); + const size_t numNodes = m_actor->GetNumNodes(); for (size_t i = 0; i < numNodes; ++i) { - EMotionFX::Node* node = mActor->GetSkeleton()->GetNode(i); + EMotionFX::Node* node = m_actor->GetSkeleton()->GetNode(i); if (!node->GetIncludeInBoundsCalc()) { - jointsExcludedFromBounds.emplace_back(mActorInstance->GetID(), node->GetName()); + jointsExcludedFromBounds.emplace_back(m_actorInstance->GetID(), node->GetName()); } } } m_excludeFromBoundsBrowseEdit->SetSelectedJoints(jointsExcludedFromBounds); // actor name - mNameEdit->setEnabled(true); - mNameEdit->setText(mActor->GetName()); + m_nameEdit->setEnabled(true); + m_nameEdit->setText(m_actor->GetName()); } void ActorPropertiesWindow::GetNodeName(const AZStd::vector& joints, AZStd::string* outNodeName, uint32* outActorID) @@ -226,7 +226,7 @@ namespace EMStudio return; } - const uint32 actorInstanceID = joints[0].mActorInstanceID; + const uint32 actorInstanceID = joints[0].m_actorInstanceId; const char* nodeName = joints[0].GetNodeName(); EMotionFX::ActorInstance* actorInstance = EMotionFX::GetActorManager().FindActorInstanceByID(actorInstanceID); if (!actorInstance) @@ -299,13 +299,13 @@ namespace EMStudio void ActorPropertiesWindow::OnFindBestMatchingNode() { // check if the actor is invalid - if (mActor == nullptr) + if (m_actor == nullptr) { return; } // find the best motion extraction node - EMotionFX::Node* bestMatchingNode = mActor->FindBestMotionExtractionNode(); + EMotionFX::Node* bestMatchingNode = m_actor->FindBestMotionExtractionNode(); if (bestMatchingNode == nullptr) { return; @@ -315,7 +315,7 @@ namespace EMStudio MCore::CommandGroup commandGroup("Adjust motion extraction node"); // adjust the actor - const AZStd::string command = AZStd::string::format("AdjustActor -actorID %i -motionExtractionNodeName \"%s\"", mActor->GetID(), bestMatchingNode->GetName()); + const AZStd::string command = AZStd::string::format("AdjustActor -actorID %i -motionExtractionNodeName \"%s\"", m_actor->GetID(), bestMatchingNode->GetName()); commandGroup.AddCommandString(command); // execute the command group @@ -329,13 +329,13 @@ namespace EMStudio // actor name changed void ActorPropertiesWindow::NameEditChanged() { - if (mActor == nullptr) + if (m_actor == nullptr) { return; } // execute the command - const AZStd::string command = AZStd::string::format("AdjustActor -actorID %i -name \"%s\"", mActor->GetID(), mNameEdit->text().toUtf8().data()); + const AZStd::string command = AZStd::string::format("AdjustActor -actorID %i -name \"%s\"", m_actor->GetID(), m_nameEdit->text().toUtf8().data()); AZStd::string result; if (!EMStudio::GetCommandManager()->ExecuteCommand(command, result)) @@ -353,13 +353,13 @@ namespace EMStudio return; } - AZStd::string command = AZStd::string::format("AdjustActor -actorID %i -nodesExcludedFromBounds \"", mActor->GetID()); + AZStd::string command = AZStd::string::format("AdjustActor -actorID %i -nodesExcludedFromBounds \"", m_actor->GetID()); // prepare the nodes excluded from bounds string size_t addedItems = 0; for (const SelectionItem& selectedJoint : selectedJoints) { - EMotionFX::Node* node = mActor->GetSkeleton()->FindNodeByName(selectedJoint.GetNodeName()); + EMotionFX::Node* node = m_actor->GetSkeleton()->FindNodeByName(selectedJoint.GetNodeName()); if (node) { if (addedItems > 0) @@ -395,7 +395,7 @@ namespace EMStudio EMotionFX::Actor* actor = actorInstance->GetActor(); EMotionFX::Skeleton* skeleton = actor->GetSkeleton(); - const size_t numJoints = mActor->GetNumNodes(); + const size_t numJoints = m_actor->GetNumNodes(); // Include all joints first. for (size_t i = 0; i < numJoints; ++i) @@ -417,9 +417,9 @@ namespace EMStudio // open the mirror setup void ActorPropertiesWindow::OnMirrorSetup() { - if (mMirrorSetupWindow) + if (m_mirrorSetupWindow) { - mMirrorSetupWindow->exec(); + m_mirrorSetupWindow->exec(); } } } // namespace EMStudio diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/SceneManager/ActorPropertiesWindow.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/SceneManager/ActorPropertiesWindow.h index 67568d80b0..70af16ca17 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/SceneManager/ActorPropertiesWindow.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/SceneManager/ActorPropertiesWindow.h @@ -69,14 +69,14 @@ namespace EMStudio ActorJointBrowseEdit* m_retargetRootJointBrowseEdit = nullptr; ActorJointBrowseEdit* m_excludeFromBoundsBrowseEdit = nullptr; - AzQtComponents::BrowseEdit* mMirrorSetupLink = nullptr; - MirrorSetupWindow* mMirrorSetupWindow = nullptr; + AzQtComponents::BrowseEdit* m_mirrorSetupLink = nullptr; + MirrorSetupWindow* m_mirrorSetupWindow = nullptr; // actor name - QLineEdit* mNameEdit = nullptr; + QLineEdit* m_nameEdit = nullptr; - SceneManagerPlugin* mPlugin = nullptr; - EMotionFX::Actor* mActor = nullptr; - EMotionFX::ActorInstance* mActorInstance = nullptr; + SceneManagerPlugin* m_plugin = nullptr; + EMotionFX::Actor* m_actor = nullptr; + EMotionFX::ActorInstance* m_actorInstance = nullptr; }; } // namespace EMStudio diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/SceneManager/MirrorSetupWindow.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/SceneManager/MirrorSetupWindow.cpp index fc01f68efe..d1fd241a2f 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/SceneManager/MirrorSetupWindow.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/SceneManager/MirrorSetupWindow.cpp @@ -42,7 +42,7 @@ namespace EMStudio MirrorSetupWindow::MirrorSetupWindow(QWidget* parent, SceneManagerPlugin* plugin) : QDialog(parent) { - mPlugin = plugin; + m_plugin = plugin; // set the window title setWindowTitle("Mirror Setup"); @@ -53,10 +53,10 @@ namespace EMStudio // load some icons const QDir dataDir{ QString(MysticQt::GetDataDir().c_str()) }; - mBoneIcon = new QIcon(dataDir.filePath("Images/Icons/Bone.svg")); - mNodeIcon = new QIcon(dataDir.filePath("Images/Icons/Node.svg")); - mMeshIcon = new QIcon(dataDir.filePath("Images/Icons/Mesh.svg")); - mMappedIcon = new QIcon(dataDir.filePath("Images/Icons/Confirm.svg")); + m_boneIcon = new QIcon(dataDir.filePath("Images/Icons/Bone.svg")); + m_nodeIcon = new QIcon(dataDir.filePath("Images/Icons/Node.svg")); + m_meshIcon = new QIcon(dataDir.filePath("Images/Icons/Mesh.svg")); + m_mappedIcon = new QIcon(dataDir.filePath("Images/Icons/Confirm.svg")); // create the main layout QVBoxLayout* mainLayout = new QVBoxLayout(); @@ -72,36 +72,36 @@ namespace EMStudio toolBarLayout->setMargin(0); toolBarLayout->setSpacing(0); mainLayout->addLayout(toolBarLayout); - mButtonOpen = new QPushButton(); - EMStudioManager::MakeTransparentButton(mButtonOpen, "Images/Icons/Open.svg", "Load and apply a mapping template."); - connect(mButtonOpen, &QPushButton::clicked, this, &MirrorSetupWindow::OnLoadMapping); - mButtonSave = new QPushButton(); - EMStudioManager::MakeTransparentButton(mButtonSave, "Images/Menu/FileSave.svg", "Save the currently setup mapping as template."); - connect(mButtonSave, &QPushButton::clicked, this, &MirrorSetupWindow::OnSaveMapping); - mButtonClear = new QPushButton(); - EMStudioManager::MakeTransparentButton(mButtonClear, "Images/Icons/Clear.svg", "Clear the currently setup mapping entirely."); - connect(mButtonClear, &QPushButton::clicked, this, &MirrorSetupWindow::OnClearMapping); + m_buttonOpen = new QPushButton(); + EMStudioManager::MakeTransparentButton(m_buttonOpen, "Images/Icons/Open.svg", "Load and apply a mapping template."); + connect(m_buttonOpen, &QPushButton::clicked, this, &MirrorSetupWindow::OnLoadMapping); + m_buttonSave = new QPushButton(); + EMStudioManager::MakeTransparentButton(m_buttonSave, "Images/Menu/FileSave.svg", "Save the currently setup mapping as template."); + connect(m_buttonSave, &QPushButton::clicked, this, &MirrorSetupWindow::OnSaveMapping); + m_buttonClear = new QPushButton(); + EMStudioManager::MakeTransparentButton(m_buttonClear, "Images/Icons/Clear.svg", "Clear the currently setup mapping entirely."); + connect(m_buttonClear, &QPushButton::clicked, this, &MirrorSetupWindow::OnClearMapping); - mButtonGuess = new QPushButton(); - EMStudioManager::MakeTransparentButton(mButtonGuess, "Images/Icons/Character.svg", "Perform name based mapping."); - connect(mButtonGuess, &QPushButton::clicked, this, &MirrorSetupWindow::OnBestGuess); + m_buttonGuess = new QPushButton(); + EMStudioManager::MakeTransparentButton(m_buttonGuess, "Images/Icons/Character.svg", "Perform name based mapping."); + connect(m_buttonGuess, &QPushButton::clicked, this, &MirrorSetupWindow::OnBestGuess); - toolBarLayout->addWidget(mButtonOpen, 0, Qt::AlignLeft); - toolBarLayout->addWidget(mButtonSave, 0, Qt::AlignLeft); - toolBarLayout->addWidget(mButtonClear, 0, Qt::AlignLeft); + toolBarLayout->addWidget(m_buttonOpen, 0, Qt::AlignLeft); + toolBarLayout->addWidget(m_buttonSave, 0, Qt::AlignLeft); + toolBarLayout->addWidget(m_buttonClear, 0, Qt::AlignLeft); toolBarLayout->addSpacerItem(new QSpacerItem(100, 1, QSizePolicy::Expanding, QSizePolicy::Minimum)); QHBoxLayout* leftRightLayout = new QHBoxLayout(); leftRightLayout->addWidget(new QLabel("Left:"), 0, Qt::AlignRight); - mLeftEdit = new QLineEdit("Bip01 L"); - mLeftEdit->setMaximumWidth(75); - leftRightLayout->addWidget(mLeftEdit, 0, Qt::AlignRight); - mRightEdit = new QLineEdit("Bip01 R"); - mRightEdit->setMaximumWidth(75); + m_leftEdit = new QLineEdit("Bip01 L"); + m_leftEdit->setMaximumWidth(75); + leftRightLayout->addWidget(m_leftEdit, 0, Qt::AlignRight); + m_rightEdit = new QLineEdit("Bip01 R"); + m_rightEdit->setMaximumWidth(75); leftRightLayout->addWidget(new QLabel("Right:"), 0, Qt::AlignRight); - leftRightLayout->addWidget(mRightEdit, 0, Qt::AlignRight); - leftRightLayout->addWidget(mButtonGuess, 0, Qt::AlignRight); + leftRightLayout->addWidget(m_rightEdit, 0, Qt::AlignRight); + leftRightLayout->addWidget(m_buttonGuess, 0, Qt::AlignRight); leftRightLayout->setSpacing(6); leftRightLayout->setMargin(0); @@ -140,36 +140,35 @@ namespace EMStudio curSearchLayout->setSpacing(6); curSearchLayout->setMargin(0); - mCurrentList = new QTableWidget(); - mCurrentList->setAlternatingRowColors(true); - mCurrentList->setGridStyle(Qt::SolidLine); - mCurrentList->setSelectionBehavior(QAbstractItemView::SelectRows); - mCurrentList->setSelectionMode(QAbstractItemView::SingleSelection); - //mCurrentList->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); - mCurrentList->setCornerButtonEnabled(false); - mCurrentList->setEditTriggers(QAbstractItemView::NoEditTriggers); - mCurrentList->setContextMenuPolicy(Qt::DefaultContextMenu); - mCurrentList->setColumnCount(3); - mCurrentList->setColumnWidth(0, 20); - mCurrentList->setColumnWidth(1, 20); - mCurrentList->setSortingEnabled(true); - QHeaderView* verticalHeader = mCurrentList->verticalHeader(); + m_currentList = new QTableWidget(); + m_currentList->setAlternatingRowColors(true); + m_currentList->setGridStyle(Qt::SolidLine); + m_currentList->setSelectionBehavior(QAbstractItemView::SelectRows); + m_currentList->setSelectionMode(QAbstractItemView::SingleSelection); + m_currentList->setCornerButtonEnabled(false); + m_currentList->setEditTriggers(QAbstractItemView::NoEditTriggers); + m_currentList->setContextMenuPolicy(Qt::DefaultContextMenu); + m_currentList->setColumnCount(3); + m_currentList->setColumnWidth(0, 20); + m_currentList->setColumnWidth(1, 20); + m_currentList->setSortingEnabled(true); + QHeaderView* verticalHeader = m_currentList->verticalHeader(); verticalHeader->setVisible(false); QTableWidgetItem* headerItem = new QTableWidgetItem(""); headerItem->setTextAlignment(Qt::AlignVCenter | Qt::AlignLeft); - mCurrentList->setHorizontalHeaderItem(0, headerItem); + m_currentList->setHorizontalHeaderItem(0, headerItem); headerItem = new QTableWidgetItem(""); headerItem->setTextAlignment(Qt::AlignVCenter | Qt::AlignLeft); - mCurrentList->setHorizontalHeaderItem(1, headerItem); + m_currentList->setHorizontalHeaderItem(1, headerItem); headerItem = new QTableWidgetItem("Name"); headerItem->setTextAlignment(Qt::AlignVCenter | Qt::AlignLeft); - mCurrentList->setHorizontalHeaderItem(2, headerItem); - mCurrentList->horizontalHeader()->setStretchLastSection(true); - mCurrentList->horizontalHeader()->setSortIndicatorShown(false); - mCurrentList->horizontalHeader()->setSectionsClickable(false); - connect(mCurrentList, &QTableWidget::itemSelectionChanged, this, &MirrorSetupWindow::OnCurrentListSelectionChanged); - connect(mCurrentList, &QTableWidget::itemDoubleClicked, this, &MirrorSetupWindow::OnCurrentListDoubleClicked); - leftListLayout->addWidget(mCurrentList); + m_currentList->setHorizontalHeaderItem(2, headerItem); + m_currentList->horizontalHeader()->setStretchLastSection(true); + m_currentList->horizontalHeader()->setSortIndicatorShown(false); + m_currentList->horizontalHeader()->setSectionsClickable(false); + connect(m_currentList, &QTableWidget::itemSelectionChanged, this, &MirrorSetupWindow::OnCurrentListSelectionChanged); + connect(m_currentList, &QTableWidget::itemDoubleClicked, this, &MirrorSetupWindow::OnCurrentListDoubleClicked); + leftListLayout->addWidget(m_currentList); // add link button middle part QVBoxLayout* middleLayout = new QVBoxLayout(); @@ -204,35 +203,34 @@ namespace EMStudio sourceSearchLayout->setSpacing(6); sourceSearchLayout->setMargin(0); - mSourceList = new QTableWidget(); - mSourceList->setAlternatingRowColors(true); - mSourceList->setGridStyle(Qt::SolidLine); - mSourceList->setSelectionBehavior(QAbstractItemView::SelectRows); - mSourceList->setSelectionMode(QAbstractItemView::SingleSelection); - //mSourceList->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); - mSourceList->setCornerButtonEnabled(false); - mSourceList->setEditTriggers(QAbstractItemView::NoEditTriggers); - mSourceList->setContextMenuPolicy(Qt::DefaultContextMenu); - mSourceList->setColumnCount(3); - mSourceList->setColumnWidth(0, 20); - mSourceList->setColumnWidth(1, 20); - mSourceList->setSortingEnabled(true); - verticalHeader = mSourceList->verticalHeader(); + m_sourceList = new QTableWidget(); + m_sourceList->setAlternatingRowColors(true); + m_sourceList->setGridStyle(Qt::SolidLine); + m_sourceList->setSelectionBehavior(QAbstractItemView::SelectRows); + m_sourceList->setSelectionMode(QAbstractItemView::SingleSelection); + m_sourceList->setCornerButtonEnabled(false); + m_sourceList->setEditTriggers(QAbstractItemView::NoEditTriggers); + m_sourceList->setContextMenuPolicy(Qt::DefaultContextMenu); + m_sourceList->setColumnCount(3); + m_sourceList->setColumnWidth(0, 20); + m_sourceList->setColumnWidth(1, 20); + m_sourceList->setSortingEnabled(true); + verticalHeader = m_sourceList->verticalHeader(); verticalHeader->setVisible(false); headerItem = new QTableWidgetItem(""); headerItem->setTextAlignment(Qt::AlignVCenter | Qt::AlignLeft); - mSourceList->setHorizontalHeaderItem(0, headerItem); + m_sourceList->setHorizontalHeaderItem(0, headerItem); headerItem = new QTableWidgetItem(""); headerItem->setTextAlignment(Qt::AlignVCenter | Qt::AlignLeft); - mSourceList->setHorizontalHeaderItem(1, headerItem); + m_sourceList->setHorizontalHeaderItem(1, headerItem); headerItem = new QTableWidgetItem("Name"); headerItem->setTextAlignment(Qt::AlignVCenter | Qt::AlignLeft); - mSourceList->setHorizontalHeaderItem(2, headerItem); - mSourceList->horizontalHeader()->setStretchLastSection(true); - mSourceList->horizontalHeader()->setSortIndicatorShown(false); - mSourceList->horizontalHeader()->setSectionsClickable(false); - connect(mSourceList, &QTableWidget::itemSelectionChanged, this, &MirrorSetupWindow::OnSourceListSelectionChanged); - rightListLayout->addWidget(mSourceList); + m_sourceList->setHorizontalHeaderItem(2, headerItem); + m_sourceList->horizontalHeader()->setStretchLastSection(true); + m_sourceList->horizontalHeader()->setSortIndicatorShown(false); + m_sourceList->horizontalHeader()->setSectionsClickable(false); + connect(m_sourceList, &QTableWidget::itemSelectionChanged, this, &MirrorSetupWindow::OnSourceListSelectionChanged); + rightListLayout->addWidget(m_sourceList); // create the mapping table QVBoxLayout* lowerLayout = new QVBoxLayout(); @@ -244,53 +242,48 @@ namespace EMStudio mappingLayout->setMargin(0); lowerLayout->addLayout(mappingLayout); mappingLayout->addWidget(new QLabel("Mapping:"), 0, Qt::AlignLeft | Qt::AlignVCenter); - //mButtonGuess = new QPushButton(); - //EMStudioManager::MakeTransparentButton( mButtonGuess, "Images/Icons/Character.svg", "Best guess mapping" ); - //connect( mButtonGuess, SIGNAL(clicked()), this, SLOT(OnBestGuessGeometrical()) ); - //mappingLayout->addWidget( mButtonGuess, 0, Qt::AlignLeft ); spacerWidget = new QWidget(); spacerWidget->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum); mappingLayout->addWidget(spacerWidget); - mMappingTable = new QTableWidget(); - lowerLayout->addWidget(mMappingTable); - mMappingTable->setAlternatingRowColors(true); - mMappingTable->setGridStyle(Qt::SolidLine); - mMappingTable->setSelectionBehavior(QAbstractItemView::SelectRows); - mMappingTable->setSelectionMode(QAbstractItemView::SingleSelection); - //mMappingTable->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); - mMappingTable->setCornerButtonEnabled(false); - mMappingTable->setEditTriggers(QAbstractItemView::NoEditTriggers); - mMappingTable->setContextMenuPolicy(Qt::DefaultContextMenu); - mMappingTable->setContentsMargins(3, 1, 3, 1); - mMappingTable->setColumnCount(2); - mMappingTable->setColumnWidth(0, mMappingTable->width() / 2); - mMappingTable->setColumnWidth(1, mMappingTable->width() / 2); - verticalHeader = mMappingTable->verticalHeader(); + m_mappingTable = new QTableWidget(); + lowerLayout->addWidget(m_mappingTable); + m_mappingTable->setAlternatingRowColors(true); + m_mappingTable->setGridStyle(Qt::SolidLine); + m_mappingTable->setSelectionBehavior(QAbstractItemView::SelectRows); + m_mappingTable->setSelectionMode(QAbstractItemView::SingleSelection); + m_mappingTable->setCornerButtonEnabled(false); + m_mappingTable->setEditTriggers(QAbstractItemView::NoEditTriggers); + m_mappingTable->setContextMenuPolicy(Qt::DefaultContextMenu); + m_mappingTable->setContentsMargins(3, 1, 3, 1); + m_mappingTable->setColumnCount(2); + m_mappingTable->setColumnWidth(0, m_mappingTable->width() / 2); + m_mappingTable->setColumnWidth(1, m_mappingTable->width() / 2); + verticalHeader = m_mappingTable->verticalHeader(); verticalHeader->setVisible(false); // add the table headers headerItem = new QTableWidgetItem("Node"); headerItem->setTextAlignment(Qt::AlignVCenter | Qt::AlignLeft); - mMappingTable->setHorizontalHeaderItem(0, headerItem); + m_mappingTable->setHorizontalHeaderItem(0, headerItem); headerItem = new QTableWidgetItem("Mapped to"); headerItem->setTextAlignment(Qt::AlignVCenter | Qt::AlignLeft); - mMappingTable->setHorizontalHeaderItem(1, headerItem); - mMappingTable->horizontalHeader()->setStretchLastSection(true); - mMappingTable->horizontalHeader()->setSortIndicatorShown(false); - mMappingTable->horizontalHeader()->setSectionsClickable(false); - connect(mMappingTable, &QTableWidget::itemDoubleClicked, this, &MirrorSetupWindow::OnMappingTableDoubleClicked); - connect(mMappingTable, &QTableWidget::itemSelectionChanged, this, &MirrorSetupWindow::OnMappingTableSelectionChanged); + m_mappingTable->setHorizontalHeaderItem(1, headerItem); + m_mappingTable->horizontalHeader()->setStretchLastSection(true); + m_mappingTable->horizontalHeader()->setSortIndicatorShown(false); + m_mappingTable->horizontalHeader()->setSectionsClickable(false); + connect(m_mappingTable, &QTableWidget::itemDoubleClicked, this, &MirrorSetupWindow::OnMappingTableDoubleClicked); + connect(m_mappingTable, &QTableWidget::itemSelectionChanged, this, &MirrorSetupWindow::OnMappingTableSelectionChanged); } // destructor MirrorSetupWindow::~MirrorSetupWindow() { - delete mBoneIcon; - delete mNodeIcon; - delete mMeshIcon; - delete mMappedIcon; + delete m_boneIcon; + delete m_nodeIcon; + delete m_meshIcon; + delete m_mappedIcon; } @@ -298,7 +291,7 @@ namespace EMStudio void MirrorSetupWindow::OnMappingTableDoubleClicked(QTableWidgetItem* item) { MCORE_UNUSED(item); - // TODO: open a node hierarchy widget, where we can select a node from the mSourceActor + // TODO: open a node hierarchy widget, where we can select a node from the m_sourceActor // the problem is that the node hierarchy widget works with actor instances, which we don't have and do not really want to create either // I think the node hierarchy widget shouldn't use actor instances only, but should support actors as well } @@ -322,7 +315,7 @@ namespace EMStudio // get the node name const uint32 rowIndex = item->row(); - const AZStd::string nodeName = mCurrentList->item(rowIndex, 2)->text().toUtf8().data(); + const AZStd::string nodeName = m_currentList->item(rowIndex, 2)->text().toUtf8().data(); // find its index in the current actor, and remove its mapping EMotionFX::Node* node = currentActor->GetSkeleton()->FindNodeByName(nodeName.c_str()); @@ -336,12 +329,12 @@ namespace EMStudio // current list selection changed void MirrorSetupWindow::OnCurrentListSelectionChanged() { - QList items = mCurrentList->selectedItems(); + QList items = m_currentList->selectedItems(); if (items.count() > 0) { //const uint32 currentListRow = items[0]->row(); - QTableWidgetItem* nameItem = mCurrentList->item(items[0]->row(), 2); - QList mappingTableItems = mMappingTable->findItems(nameItem->text(), Qt::MatchExactly); + QTableWidgetItem* nameItem = m_currentList->item(items[0]->row(), 2); + QList mappingTableItems = m_mappingTable->findItems(nameItem->text(), Qt::MatchExactly); for (int32 i = 0; i < mappingTableItems.count(); ++i) { @@ -352,8 +345,8 @@ namespace EMStudio const uint32 rowIndex = mappingTableItems[i]->row(); - mMappingTable->selectRow(rowIndex); - mMappingTable->setCurrentItem(mappingTableItems[i]); + m_mappingTable->selectRow(rowIndex); + m_mappingTable->setCurrentItem(mappingTableItems[i]); } } } @@ -362,12 +355,12 @@ namespace EMStudio // source list selection changed void MirrorSetupWindow::OnSourceListSelectionChanged() { - QList items = mSourceList->selectedItems(); + QList items = m_sourceList->selectedItems(); if (items.count() > 0) { //const uint32 currentListRow = items[0]->row(); - QTableWidgetItem* nameItem = mSourceList->item(items[0]->row(), 2); - QList mappingTableItems = mMappingTable->findItems(nameItem->text(), Qt::MatchExactly); + QTableWidgetItem* nameItem = m_sourceList->item(items[0]->row(), 2); + QList mappingTableItems = m_mappingTable->findItems(nameItem->text(), Qt::MatchExactly); for (int32 i = 0; i < mappingTableItems.count(); ++i) { @@ -378,8 +371,8 @@ namespace EMStudio const uint32 rowIndex = mappingTableItems[i]->row(); - mMappingTable->selectRow(rowIndex); - mMappingTable->setCurrentItem(mappingTableItems[i]); + m_mappingTable->selectRow(rowIndex); + m_mappingTable->setCurrentItem(mappingTableItems[i]); } } } @@ -389,30 +382,30 @@ namespace EMStudio void MirrorSetupWindow::OnMappingTableSelectionChanged() { // select both items in the list widgets as well - QList items = mMappingTable->selectedItems(); + QList items = m_mappingTable->selectedItems(); if (items.count() > 0) { const uint32 rowIndex = items[0]->row(); - QTableWidgetItem* item = mMappingTable->item(rowIndex, 0); + QTableWidgetItem* item = m_mappingTable->item(rowIndex, 0); if (item) { - QList listItems = mCurrentList->findItems(item->text(), Qt::MatchExactly); + QList listItems = m_currentList->findItems(item->text(), Qt::MatchExactly); if (listItems.count() > 0) { - mCurrentList->selectRow(listItems[0]->row()); - mCurrentList->setCurrentItem(listItems[0]); + m_currentList->selectRow(listItems[0]->row()); + m_currentList->setCurrentItem(listItems[0]); } } - item = mMappingTable->item(rowIndex, 1); + item = m_mappingTable->item(rowIndex, 1); if (item) { - QList listItems = mSourceList->findItems(item->text(), Qt::MatchExactly); + QList listItems = m_sourceList->findItems(item->text(), Qt::MatchExactly); if (listItems.count() > 0) { - mSourceList->selectRow(listItems[0]->row()); - mSourceList->setCurrentItem(listItems[0]); + m_sourceList->selectRow(listItems[0]->row()); + m_sourceList->setCurrentItem(listItems[0]); } } } @@ -432,18 +425,18 @@ namespace EMStudio // extract the list of bones if (currentActor) { - currentActor->ExtractBoneList(0, &mCurrentBoneList); + currentActor->ExtractBoneList(0, &m_currentBoneList); } // clear the node map if (reInitMap) { - mMap.clear(); + m_map.clear(); if (currentActor) { const size_t numNodes = aznumeric_caster(currentActor->GetNumNodes()); - mMap.resize(numNodes); - AZStd::fill(mMap.begin(), mMap.end(), InvalidIndex); + m_map.resize(numNodes); + AZStd::fill(m_map.begin(), m_map.end(), InvalidIndex); } } @@ -481,7 +474,7 @@ namespace EMStudio { if (!actor) { - mCurrentList->setRowCount(0); + m_currentList->setRowCount(0); return; } @@ -499,7 +492,7 @@ namespace EMStudio numRows++; } } - mCurrentList->setRowCount(numRows); + m_currentList->setRowCount(numRows); // fill the rows int rowIndex = 0; @@ -510,34 +503,34 @@ namespace EMStudio if (currentName.contains(filterString, Qt::CaseInsensitive) || filterString.isEmpty()) { // mark if there is a mapping or not - const bool mapped = (mMap[node->GetNodeIndex()] != InvalidIndex); + const bool mapped = (m_map[node->GetNodeIndex()] != InvalidIndex); QTableWidgetItem* mappedItem = new QTableWidgetItem(); - mappedItem->setIcon(mapped ? *mMappedIcon : QIcon()); - mCurrentList->setItem(rowIndex, 0, mappedItem); + mappedItem->setIcon(mapped ? *m_mappedIcon : QIcon()); + m_currentList->setItem(rowIndex, 0, mappedItem); // pick the right icon for the type column QTableWidgetItem* typeItem = new QTableWidgetItem(); if (actor->GetMesh(0, node->GetNodeIndex())) { - typeItem->setIcon(*mMeshIcon); + typeItem->setIcon(*m_meshIcon); } - else if (AZStd::find(begin(mCurrentBoneList), end(mCurrentBoneList), node->GetNodeIndex()) != end(mCurrentBoneList)) + else if (AZStd::find(begin(m_currentBoneList), end(m_currentBoneList), node->GetNodeIndex()) != end(m_currentBoneList)) { - typeItem->setIcon(*mBoneIcon); + typeItem->setIcon(*m_boneIcon); } else { - typeItem->setIcon(*mNodeIcon); + typeItem->setIcon(*m_nodeIcon); } - mCurrentList->setItem(rowIndex, 1, typeItem); + m_currentList->setItem(rowIndex, 1, typeItem); // set the name QTableWidgetItem* currentTableItem = new QTableWidgetItem(currentName); - mCurrentList->setItem(rowIndex, 2, currentTableItem); + m_currentList->setItem(rowIndex, 2, currentTableItem); // set the row height and add one index - mCurrentList->setRowHeight(rowIndex, 21); + m_currentList->setRowHeight(rowIndex, 21); ++rowIndex; } } @@ -549,7 +542,7 @@ namespace EMStudio { if (!actor) { - mSourceList->setRowCount(0); + m_sourceList->setRowCount(0); return; } @@ -567,7 +560,7 @@ namespace EMStudio numRows++; } } - mSourceList->setRowCount(numRows); + m_sourceList->setRowCount(numRows); // fill the rows int rowIndex = 0; @@ -578,34 +571,34 @@ namespace EMStudio if (name.contains(filterString, Qt::CaseInsensitive) || filterString.isEmpty()) { // mark if there is a mapping or not - const bool mapped = AZStd::find(mMap.begin(), mMap.end(), i) != mMap.end(); + const bool mapped = AZStd::find(m_map.begin(), m_map.end(), i) != m_map.end(); QTableWidgetItem* mappedItem = new QTableWidgetItem(); - mappedItem->setIcon(mapped ? *mMappedIcon : QIcon()); - mSourceList->setItem(rowIndex, 0, mappedItem); + mappedItem->setIcon(mapped ? *m_mappedIcon : QIcon()); + m_sourceList->setItem(rowIndex, 0, mappedItem); // pick the right icon for the type column QTableWidgetItem* typeItem = new QTableWidgetItem(); if (actor->GetMesh(0, node->GetNodeIndex())) { - typeItem->setIcon(*mMeshIcon); + typeItem->setIcon(*m_meshIcon); } - else if (AZStd::find(mSourceBoneList.begin(), mSourceBoneList.end(), node->GetNodeIndex()) != mSourceBoneList.end()) + else if (AZStd::find(m_sourceBoneList.begin(), m_sourceBoneList.end(), node->GetNodeIndex()) != m_sourceBoneList.end()) { - typeItem->setIcon(*mBoneIcon); + typeItem->setIcon(*m_boneIcon); } else { - typeItem->setIcon(*mNodeIcon); + typeItem->setIcon(*m_nodeIcon); } - mSourceList->setItem(rowIndex, 1, typeItem); + m_sourceList->setItem(rowIndex, 1, typeItem); // set the name QTableWidgetItem* currentTableItem = new QTableWidgetItem(name); - mSourceList->setItem(rowIndex, 2, currentTableItem); + m_sourceList->setItem(rowIndex, 2, currentTableItem); // set the row height and add one index - mSourceList->setRowHeight(rowIndex, 21); + m_sourceList->setRowHeight(rowIndex, 21); ++rowIndex; } } @@ -617,7 +610,7 @@ namespace EMStudio { if (!currentActor) { - mMappingTable->setRowCount(0); + m_mappingTable->setRowCount(0); return; } @@ -625,24 +618,24 @@ namespace EMStudio QString currentName; QString sourceName; const int numNodes = aznumeric_caster(currentActor->GetNumNodes()); - mMappingTable->setRowCount(numNodes); + m_mappingTable->setRowCount(numNodes); for (int i = 0; i < numNodes; ++i) { currentName = currentActor->GetSkeleton()->GetNode(i)->GetName(); QTableWidgetItem* currentTableItem = new QTableWidgetItem(currentName); - mMappingTable->setItem(i, 0, currentTableItem); - mMappingTable->setRowHeight(i, 21); + m_mappingTable->setItem(i, 0, currentTableItem); + m_mappingTable->setRowHeight(i, 21); - if (mMap[i] != InvalidIndex) + if (m_map[i] != InvalidIndex) { - sourceName = sourceActor->GetSkeleton()->GetNode(mMap[i])->GetName(); + sourceName = sourceActor->GetSkeleton()->GetNode(m_map[i])->GetName(); currentTableItem = new QTableWidgetItem(sourceName); - mMappingTable->setItem(i, 1, currentTableItem); + m_mappingTable->setItem(i, 1, currentTableItem); } else { - mMappingTable->setItem(i, 1, new QTableWidgetItem()); + m_mappingTable->setItem(i, 1, new QTableWidgetItem()); } } } @@ -651,24 +644,24 @@ namespace EMStudio // pressing the link button void MirrorSetupWindow::OnLinkPressed() { - if (mCurrentList->currentRow() == -1 || mSourceList->currentRow() == -1) + if (m_currentList->currentRow() == -1 || m_sourceList->currentRow() == -1) { return; } // get the names - QTableWidgetItem* curItem = mCurrentList->currentItem(); - QTableWidgetItem* sourceItem = mSourceList->currentItem(); + QTableWidgetItem* curItem = m_currentList->currentItem(); + QTableWidgetItem* sourceItem = m_sourceList->currentItem(); if (!curItem || !sourceItem) { return; } - curItem = mCurrentList->item(curItem->row(), 2); - sourceItem = mSourceList->item(sourceItem->row(), 2); + curItem = m_currentList->item(curItem->row(), 2); + sourceItem = m_sourceList->item(sourceItem->row(), 2); const AZStd::string currentNodeName = curItem->text().toUtf8().data(); - const AZStd::string sourceNodeName = mSourceList->currentItem()->text().toUtf8().data(); + const AZStd::string sourceNodeName = m_sourceList->currentItem()->text().toUtf8().data(); if (sourceNodeName.empty() || currentNodeName.empty()) { return; @@ -692,21 +685,21 @@ namespace EMStudio EMotionFX::Actor* currentActor = GetSelectedActor(); // update the map - const size_t oldSourceIndex = mMap[currentNodeIndex]; - mMap[currentNodeIndex] = sourceNodeIndex; + const size_t oldSourceIndex = m_map[currentNodeIndex]; + m_map[currentNodeIndex] = sourceNodeIndex; // update the current table const QString curName = currentActor->GetSkeleton()->GetNode(currentNodeIndex)->GetName(); - const QList currentListItems = mCurrentList->findItems(curName, Qt::MatchExactly); + const QList currentListItems = m_currentList->findItems(curName, Qt::MatchExactly); for (int32 i = 0; i < currentListItems.count(); ++i) { const int rowIndex = currentListItems[i]->row(); - QTableWidgetItem* mappedItem = mCurrentList->item(rowIndex, 0); + QTableWidgetItem* mappedItem = m_currentList->item(rowIndex, 0); if (!mappedItem) { mappedItem = new QTableWidgetItem(); - mCurrentList->setItem(rowIndex, 0, mappedItem); + m_currentList->setItem(rowIndex, 0, mappedItem); } if (sourceNodeIndex == InvalidIndex) @@ -715,25 +708,25 @@ namespace EMStudio } else { - mappedItem->setIcon(*mMappedIcon); + mappedItem->setIcon(*m_mappedIcon); } } // update source table if (sourceNodeIndex != InvalidIndex) { - const bool stillUsed = AZStd::find(mMap.begin(), mMap.end(), sourceNodeIndex) != mMap.end(); + const bool stillUsed = AZStd::find(m_map.begin(), m_map.end(), sourceNodeIndex) != m_map.end(); const QString sourceName = currentActor->GetSkeleton()->GetNode(sourceNodeIndex)->GetName(); - const QList sourceListItems = mSourceList->findItems(sourceName, Qt::MatchExactly); + const QList sourceListItems = m_sourceList->findItems(sourceName, Qt::MatchExactly); for (int32 i = 0; i < sourceListItems.count(); ++i) { const int rowIndex = sourceListItems[i]->row(); - QTableWidgetItem* mappedItem = mSourceList->item(rowIndex, 0); + QTableWidgetItem* mappedItem = m_sourceList->item(rowIndex, 0); if (!mappedItem) { mappedItem = new QTableWidgetItem(); - mSourceList->setItem(rowIndex, 0, mappedItem); + m_sourceList->setItem(rowIndex, 0, mappedItem); } if (stillUsed == false) @@ -742,7 +735,7 @@ namespace EMStudio } else { - mappedItem->setIcon(*mMappedIcon); + mappedItem->setIcon(*m_mappedIcon); } } } @@ -750,18 +743,18 @@ namespace EMStudio { if (oldSourceIndex != InvalidIndex) { - const bool stillUsed = AZStd::find(mMap.begin(), mMap.end(), sourceNodeIndex) != mMap.end(); + const bool stillUsed = AZStd::find(m_map.begin(), m_map.end(), sourceNodeIndex) != m_map.end(); const QString sourceName = currentActor->GetSkeleton()->GetNode(oldSourceIndex)->GetName(); - const QList sourceListItems = mSourceList->findItems(sourceName, Qt::MatchExactly); + const QList sourceListItems = m_sourceList->findItems(sourceName, Qt::MatchExactly); for (int32 i = 0; i < sourceListItems.count(); ++i) { const int rowIndex = sourceListItems[i]->row(); - QTableWidgetItem* mappedItem = mSourceList->item(rowIndex, 0); + QTableWidgetItem* mappedItem = m_sourceList->item(rowIndex, 0); if (!mappedItem) { mappedItem = new QTableWidgetItem(); - mSourceList->setItem(rowIndex, 0, mappedItem); + m_sourceList->setItem(rowIndex, 0, mappedItem); } if (stillUsed == false) @@ -770,18 +763,18 @@ namespace EMStudio } else { - mappedItem->setIcon(*mMappedIcon); + mappedItem->setIcon(*m_mappedIcon); } } } } // update the mapping table - QTableWidgetItem* item = mMappingTable->item(aznumeric_caster(currentNodeIndex), 1); + QTableWidgetItem* item = m_mappingTable->item(aznumeric_caster(currentNodeIndex), 1); if (!item && sourceNodeIndex != InvalidIndex) { item = new QTableWidgetItem(); - mMappingTable->setItem(aznumeric_caster(currentNodeIndex), 1, item); + m_mappingTable->setItem(aznumeric_caster(currentNodeIndex), 1, item); } if (sourceNodeIndex == InvalidIndex) @@ -827,10 +820,10 @@ namespace EMStudio // remove the currently selected mapping void MirrorSetupWindow::RemoveCurrentSelectedMapping() { - QList items = mCurrentList->selectedItems(); + QList items = m_currentList->selectedItems(); if (items.count() > 0) { - QTableWidgetItem* item = mCurrentList->item(items[0]->row(), 0); + QTableWidgetItem* item = m_currentList->item(items[0]->row(), 0); if (item) { OnCurrentListDoubleClicked(item); @@ -881,7 +874,7 @@ namespace EMStudio // now update our mapping data const size_t numNodes = currentActor->GetNumNodes(); - AZStd::fill(mMap.begin(), AZStd::next(mMap.begin(), numNodes), InvalidIndex); + AZStd::fill(m_map.begin(), AZStd::next(m_map.begin(), numNodes), InvalidIndex); // now apply the map we loaded to the data we have here const size_t numEntries = nodeMap->GetNumEntries(); @@ -902,7 +895,7 @@ namespace EMStudio } // create the mapping - mMap[currentNode->GetNodeIndex()] = sourceNode->GetNodeIndex(); + m_map[currentNode->GetNodeIndex()] = sourceNode->GetNodeIndex(); } // apply the current map as command @@ -952,7 +945,7 @@ namespace EMStudio for (size_t i = 0; i < numNodes; ++i) { // skip unmapped entries - if (mMap[i] == InvalidIndex) + if (m_map[i] == InvalidIndex) { continue; } @@ -960,7 +953,7 @@ namespace EMStudio // add the entry to the map if it doesn't yet exist if (map->GetHasEntry(currentActor->GetSkeleton()->GetNode(i)->GetName()) == false) { - map->AddEntry(currentActor->GetSkeleton()->GetNode(i)->GetName(), currentActor->GetSkeleton()->GetNode(mMap[i])->GetName()); + map->AddEntry(currentActor->GetSkeleton()->GetNode(i)->GetName(), currentActor->GetSkeleton()->GetNode(m_map[i])->GetName()); } } @@ -1018,7 +1011,7 @@ namespace EMStudio } const size_t numNodes = currentActor->GetNumNodes(); - return AZStd::all_of(mMap.begin(), AZStd::next(mMap.begin(), numNodes), [](const size_t nodeIndex) + return AZStd::all_of(m_map.begin(), AZStd::next(m_map.begin(), numNodes), [](const size_t nodeIndex) { return nodeIndex != InvalidIndex; }); @@ -1037,10 +1030,10 @@ namespace EMStudio const bool canGuess = (currentActor); // enable or disable them - mButtonOpen->setEnabled(canOpen); - mButtonSave->setEnabled(canSave); - mButtonClear->setEnabled(canClear); - mButtonGuess->setEnabled(canGuess); + m_buttonOpen->setEnabled(canOpen); + m_buttonSave->setEnabled(canSave); + m_buttonClear->setEnabled(canClear); + m_buttonGuess->setEnabled(canGuess); } @@ -1054,7 +1047,7 @@ namespace EMStudio return; } - if (mLeftEdit->text().size() == 0 || mRightEdit->text().size() == 0) + if (m_leftEdit->text().size() == 0 || m_rightEdit->text().size() == 0) { QMessageBox::information(this, "Empty Left And Right Strings", "Please enter both a left and right sub-string.\nThis can be something like 'Left' and 'Right'.\nThis would map nodes like 'Left Arm' to 'Right Arm' nodes.", QMessageBox::Ok); return; @@ -1066,15 +1059,15 @@ namespace EMStudio for (size_t i = 0; i < numNodes; ++i) { // skip already setup mappings - if (mMap[i] != InvalidIndex) + if (m_map[i] != InvalidIndex) { continue; } - const uint16 matchIndex = currentActor->FindBestMatchForNode(currentActor->GetSkeleton()->GetNode(i)->GetName(), FromQtString(mLeftEdit->text()).c_str(), FromQtString(mRightEdit->text()).c_str()); + const uint16 matchIndex = currentActor->FindBestMatchForNode(currentActor->GetSkeleton()->GetNode(i)->GetName(), FromQtString(m_leftEdit->text()).c_str(), FromQtString(m_rightEdit->text()).c_str()); if (matchIndex != MCORE_INVALIDINDEX16) { - mMap[i] = matchIndex; + m_map[i] = matchIndex; numGuessed++; } } @@ -1117,19 +1110,19 @@ namespace EMStudio { if (actor->GetHasMirrorInfo()) { - uint16 motionSource = actor->GetNodeMirrorInfo(i).mSourceNode; + uint16 motionSource = actor->GetNodeMirrorInfo(i).m_sourceNode; if (motionSource != i) { - mMap[i] = motionSource; + m_map[i] = motionSource; } else { - mMap[i] = InvalidIndex; + m_map[i] = InvalidIndex; } } else { - mMap[i] = InvalidIndex; + m_map[i] = InvalidIndex; } } } @@ -1149,7 +1142,7 @@ namespace EMStudio AZStd::string commandString = AZStd::string::format("AdjustActor -actorID %d -mirrorSetup \"", currentActor->GetID()); for (size_t i = 0; i < currentActor->GetNumNodes(); ++i) { - size_t sourceNode = mMap[i]; + size_t sourceNode = m_map[i]; if (sourceNode != InvalidIndex && sourceNode != i) { commandString += currentActor->GetSkeleton()->GetNode(i)->GetName(); diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/SceneManager/MirrorSetupWindow.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/SceneManager/MirrorSetupWindow.h index 660359ba4a..6fc435025b 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/SceneManager/MirrorSetupWindow.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/SceneManager/MirrorSetupWindow.h @@ -63,25 +63,25 @@ namespace EMStudio private: - SceneManagerPlugin* mPlugin; - QTableWidget* mSourceList; - QTableWidget* mCurrentList; - QTableWidget* mMappingTable; - QPushButton* mButtonOpen; - QPushButton* mButtonSave; - QPushButton* mButtonClear; - QPushButton* mButtonGuess; - QLineEdit* mLeftEdit; - QLineEdit* mRightEdit; + SceneManagerPlugin* m_plugin; + QTableWidget* m_sourceList; + QTableWidget* m_currentList; + QTableWidget* m_mappingTable; + QPushButton* m_buttonOpen; + QPushButton* m_buttonSave; + QPushButton* m_buttonClear; + QPushButton* m_buttonGuess; + QLineEdit* m_leftEdit; + QLineEdit* m_rightEdit; AzQtComponents::FilteredSearchWidget* m_searchWidgetCurrent; AzQtComponents::FilteredSearchWidget* m_searchWidgetSource; - QIcon* mBoneIcon; - QIcon* mNodeIcon; - QIcon* mMeshIcon; - QIcon* mMappedIcon; - AZStd::vector mCurrentBoneList; - AZStd::vector mSourceBoneList; - AZStd::vector mMap; + QIcon* m_boneIcon; + QIcon* m_nodeIcon; + QIcon* m_meshIcon; + QIcon* m_mappedIcon; + AZStd::vector m_currentBoneList; + AZStd::vector m_sourceBoneList; + AZStd::vector m_map; void FillCurrentListWidget(EMotionFX::Actor* actor, const QString& filterString); void FillSourceListWidget(EMotionFX::Actor* actor, const QString& filterString); diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/SceneManager/SceneManagerPlugin.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/SceneManager/SceneManagerPlugin.cpp index 61b6c44dbb..3e498f6383 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/SceneManager/SceneManagerPlugin.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/SceneManager/SceneManagerPlugin.cpp @@ -38,7 +38,7 @@ namespace EMStudio // add the link to the actual object ObjectPointer objPointer; - objPointer.mActor = actor; + objPointer.m_actor = actor; outObjects->push_back(objPointer); } } @@ -52,13 +52,13 @@ namespace EMStudio for (const ObjectPointer& objPointer : objects) { // get the current object pointer and skip directly if the type check fails - if (objPointer.mActor == nullptr) + if (objPointer.m_actor == nullptr) { continue; } - EMotionFX::Actor* actor = objPointer.mActor; - if (mPlugin->SaveDirtyActor(actor, commandGroup, false) == DirtyFileManager::CANCELED) + EMotionFX::Actor* actor = objPointer.m_actor; + if (m_plugin->SaveDirtyActor(actor, commandGroup, false) == DirtyFileManager::CANCELED) { return DirtyFileManager::CANCELED; } @@ -72,20 +72,20 @@ namespace EMStudio SceneManagerPlugin::SceneManagerPlugin() : EMStudio::DockWidgetPlugin() { - mImportActorCallback = nullptr; - mCreateActorInstanceCallback = nullptr; - mSelectCallback = nullptr; - mUnselectCallback = nullptr; - mClearSelectionCallback = nullptr; - mRemoveActorCallback = nullptr; - mRemoveActorInstanceCallback = nullptr; - mSaveActorAssetInfoCallback = nullptr; - mScaleActorDataCallback = nullptr; - mActorPropsWindow = nullptr; - mAdjustActorCallback = nullptr; - mActorSetCollisionMeshesCallback = nullptr; - mAdjustActorInstanceCallback = nullptr; - mDirtyFilesCallback = nullptr; + m_importActorCallback = nullptr; + m_createActorInstanceCallback = nullptr; + m_selectCallback = nullptr; + m_unselectCallback = nullptr; + m_clearSelectionCallback = nullptr; + m_removeActorCallback = nullptr; + m_removeActorInstanceCallback = nullptr; + m_saveActorAssetInfoCallback = nullptr; + m_scaleActorDataCallback = nullptr; + m_actorPropsWindow = nullptr; + m_adjustActorCallback = nullptr; + m_actorSetCollisionMeshesCallback = nullptr; + m_adjustActorInstanceCallback = nullptr; + m_dirtyFilesCallback = nullptr; } @@ -177,33 +177,33 @@ namespace EMStudio SceneManagerPlugin::~SceneManagerPlugin() { // unregister the command callbacks and get rid of the memory - GetCommandManager()->RemoveCommandCallback(mImportActorCallback, false); - GetCommandManager()->RemoveCommandCallback(mCreateActorInstanceCallback, false); - GetCommandManager()->RemoveCommandCallback(mSelectCallback, false); - GetCommandManager()->RemoveCommandCallback(mUnselectCallback, false); - GetCommandManager()->RemoveCommandCallback(mClearSelectionCallback, false); - GetCommandManager()->RemoveCommandCallback(mRemoveActorCallback, false); - GetCommandManager()->RemoveCommandCallback(mRemoveActorInstanceCallback, false); - GetCommandManager()->RemoveCommandCallback(mSaveActorAssetInfoCallback, false); - GetCommandManager()->RemoveCommandCallback(mAdjustActorCallback, false); - GetCommandManager()->RemoveCommandCallback(mActorSetCollisionMeshesCallback, false); - GetCommandManager()->RemoveCommandCallback(mAdjustActorInstanceCallback, false); - GetCommandManager()->RemoveCommandCallback(mScaleActorDataCallback, false); - delete mImportActorCallback; - delete mCreateActorInstanceCallback; - delete mSelectCallback; - delete mUnselectCallback; - delete mClearSelectionCallback; - delete mRemoveActorCallback; - delete mRemoveActorInstanceCallback; - delete mSaveActorAssetInfoCallback; - delete mAdjustActorCallback; - delete mActorSetCollisionMeshesCallback; - delete mAdjustActorInstanceCallback; - delete mScaleActorDataCallback; + GetCommandManager()->RemoveCommandCallback(m_importActorCallback, false); + GetCommandManager()->RemoveCommandCallback(m_createActorInstanceCallback, false); + GetCommandManager()->RemoveCommandCallback(m_selectCallback, false); + GetCommandManager()->RemoveCommandCallback(m_unselectCallback, false); + GetCommandManager()->RemoveCommandCallback(m_clearSelectionCallback, false); + GetCommandManager()->RemoveCommandCallback(m_removeActorCallback, false); + GetCommandManager()->RemoveCommandCallback(m_removeActorInstanceCallback, false); + GetCommandManager()->RemoveCommandCallback(m_saveActorAssetInfoCallback, false); + GetCommandManager()->RemoveCommandCallback(m_adjustActorCallback, false); + GetCommandManager()->RemoveCommandCallback(m_actorSetCollisionMeshesCallback, false); + GetCommandManager()->RemoveCommandCallback(m_adjustActorInstanceCallback, false); + GetCommandManager()->RemoveCommandCallback(m_scaleActorDataCallback, false); + delete m_importActorCallback; + delete m_createActorInstanceCallback; + delete m_selectCallback; + delete m_unselectCallback; + delete m_clearSelectionCallback; + delete m_removeActorCallback; + delete m_removeActorInstanceCallback; + delete m_saveActorAssetInfoCallback; + delete m_adjustActorCallback; + delete m_actorSetCollisionMeshesCallback; + delete m_adjustActorInstanceCallback; + delete m_scaleActorDataCallback; - GetMainWindow()->GetDirtyFileManager()->RemoveCallback(mDirtyFilesCallback, false); - delete mDirtyFilesCallback; + GetMainWindow()->GetDirtyFileManager()->RemoveCallback(m_dirtyFilesCallback, false); + delete m_dirtyFilesCallback; } @@ -221,57 +221,57 @@ namespace EMStudio MysticQt::DialogStack* dialogStack = new MysticQt::DialogStack(); // create and register the command callbacks only (only execute this code once for all plugins) - mImportActorCallback = new ImportActorCallback(false); - mCreateActorInstanceCallback = new CreateActorInstanceCallback(false); - mSelectCallback = new CommandSelectCallback(false); - mUnselectCallback = new CommandUnselectCallback(false); - mClearSelectionCallback = new CommandClearSelectionCallback(false); - mRemoveActorCallback = new RemoveActorCallback(false); - mRemoveActorInstanceCallback = new RemoveActorInstanceCallback(false); - mSaveActorAssetInfoCallback = new SaveActorAssetInfoCallback(false); - mAdjustActorCallback = new CommandAdjustActorCallback(false); - mActorSetCollisionMeshesCallback = new CommandActorSetCollisionMeshesCallback(false); - mAdjustActorInstanceCallback = new CommandAdjustActorInstanceCallback(false); - mScaleActorDataCallback = new CommandScaleActorDataCallback(false); + m_importActorCallback = new ImportActorCallback(false); + m_createActorInstanceCallback = new CreateActorInstanceCallback(false); + m_selectCallback = new CommandSelectCallback(false); + m_unselectCallback = new CommandUnselectCallback(false); + m_clearSelectionCallback = new CommandClearSelectionCallback(false); + m_removeActorCallback = new RemoveActorCallback(false); + m_removeActorInstanceCallback = new RemoveActorInstanceCallback(false); + m_saveActorAssetInfoCallback = new SaveActorAssetInfoCallback(false); + m_adjustActorCallback = new CommandAdjustActorCallback(false); + m_actorSetCollisionMeshesCallback = new CommandActorSetCollisionMeshesCallback(false); + m_adjustActorInstanceCallback = new CommandAdjustActorInstanceCallback(false); + m_scaleActorDataCallback = new CommandScaleActorDataCallback(false); - GetCommandManager()->RegisterCommandCallback("ImportActor", mImportActorCallback); - GetCommandManager()->RegisterCommandCallback("CreateActorInstance", mCreateActorInstanceCallback); - GetCommandManager()->RegisterCommandCallback("Select", mSelectCallback); - GetCommandManager()->RegisterCommandCallback("Unselect", mUnselectCallback); - GetCommandManager()->RegisterCommandCallback("ClearSelection", mClearSelectionCallback); - GetCommandManager()->RegisterCommandCallback("RemoveActor", mRemoveActorCallback); - GetCommandManager()->RegisterCommandCallback("RemoveActorInstance", mRemoveActorInstanceCallback); - GetCommandManager()->RegisterCommandCallback("SaveActorAssetInfo", mSaveActorAssetInfoCallback); - GetCommandManager()->RegisterCommandCallback("AdjustActor", mAdjustActorCallback); - GetCommandManager()->RegisterCommandCallback("ActorSetCollisionMeshes", mActorSetCollisionMeshesCallback); - GetCommandManager()->RegisterCommandCallback("AdjustActorInstance", mAdjustActorInstanceCallback); - GetCommandManager()->RegisterCommandCallback("ScaleActorData", mScaleActorDataCallback); + GetCommandManager()->RegisterCommandCallback("ImportActor", m_importActorCallback); + GetCommandManager()->RegisterCommandCallback("CreateActorInstance", m_createActorInstanceCallback); + GetCommandManager()->RegisterCommandCallback("Select", m_selectCallback); + GetCommandManager()->RegisterCommandCallback("Unselect", m_unselectCallback); + GetCommandManager()->RegisterCommandCallback("ClearSelection", m_clearSelectionCallback); + GetCommandManager()->RegisterCommandCallback("RemoveActor", m_removeActorCallback); + GetCommandManager()->RegisterCommandCallback("RemoveActorInstance", m_removeActorInstanceCallback); + GetCommandManager()->RegisterCommandCallback("SaveActorAssetInfo", m_saveActorAssetInfoCallback); + GetCommandManager()->RegisterCommandCallback("AdjustActor", m_adjustActorCallback); + GetCommandManager()->RegisterCommandCallback("ActorSetCollisionMeshes", m_actorSetCollisionMeshesCallback); + GetCommandManager()->RegisterCommandCallback("AdjustActorInstance", m_adjustActorInstanceCallback); + GetCommandManager()->RegisterCommandCallback("ScaleActorData", m_scaleActorDataCallback); // create the actors window - mActorsWindow = new ActorsWindow(this); + m_actorsWindow = new ActorsWindow(this); // add in the dialog stack - dialogStack->Add(mActorsWindow, "Actors", false, true, true); + dialogStack->Add(m_actorsWindow, "Actors", false, true, true); // create the actor properties window - mActorPropsWindow = new ActorPropertiesWindow(mDock, this); - mActorPropsWindow->Init(); + m_actorPropsWindow = new ActorPropertiesWindow(m_dock, this); + m_actorPropsWindow->Init(); // add the actor properties window to the stack window - dialogStack->Add(mActorPropsWindow, "Actor Properties", false, false, true); + dialogStack->Add(m_actorPropsWindow, "Actor Properties", false, false, true); // set dialog stack as main widget of the dock - mDock->setWidget(dialogStack); + m_dock->setWidget(dialogStack); // connect - connect(mDock, &QDockWidget::visibilityChanged, this, &SceneManagerPlugin::WindowReInit); + connect(m_dock, &QDockWidget::visibilityChanged, this, &SceneManagerPlugin::WindowReInit); // reinit the dialog ReInit(); // initialize the dirty files callback - mDirtyFilesCallback = new SaveDirtyActorFilesCallback(this); - GetMainWindow()->GetDirtyFileManager()->AddCallback(mDirtyFilesCallback); + m_dirtyFilesCallback = new SaveDirtyActorFilesCallback(this); + GetMainWindow()->GetDirtyFileManager()->AddCallback(m_dirtyFilesCallback); return true; } @@ -281,7 +281,7 @@ namespace EMStudio void SceneManagerPlugin::ReInit() { // reinit the actors window - mActorsWindow->ReInit(); + m_actorsWindow->ReInit(); // update the interface UpdateInterface(); @@ -292,10 +292,10 @@ namespace EMStudio void SceneManagerPlugin::UpdateInterface() { // update interface of the actors window - mActorsWindow->UpdateInterface(); + m_actorsWindow->UpdateInterface(); // update interface of the actor properties window - mActorPropsWindow->UpdateInterface(); + m_actorPropsWindow->UpdateInterface(); } diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/SceneManager/SceneManagerPlugin.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/SceneManager/SceneManagerPlugin.h index 5d0bbb50b1..b6d2a55306 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/SceneManager/SceneManagerPlugin.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/SceneManager/SceneManagerPlugin.h @@ -37,7 +37,7 @@ namespace EMStudio public: SaveDirtyActorFilesCallback(SceneManagerPlugin* plugin) - : SaveDirtyFilesCallback() { mPlugin = plugin; } + : SaveDirtyFilesCallback() { m_plugin = plugin; } ~SaveDirtyActorFilesCallback() {} uint32 GetType() const override { return TYPE_ID; } @@ -54,7 +54,7 @@ namespace EMStudio int SaveDirtyFiles(const AZStd::vector& filenamesToSave, const AZStd::vector& objects, MCore::CommandGroup* commandGroup) override; private: - SceneManagerPlugin* mPlugin; + SceneManagerPlugin* m_plugin; }; class SceneManagerPlugin @@ -107,22 +107,22 @@ namespace EMStudio MCORE_DEFINECOMMANDCALLBACK(CommandAdjustActorInstanceCallback); MCORE_DEFINECOMMANDCALLBACK(CommandScaleActorDataCallback); - ImportActorCallback* mImportActorCallback; - CreateActorInstanceCallback* mCreateActorInstanceCallback; - CommandSelectCallback* mSelectCallback; - CommandUnselectCallback* mUnselectCallback; - CommandClearSelectionCallback* mClearSelectionCallback; - RemoveActorCallback* mRemoveActorCallback; - RemoveActorInstanceCallback* mRemoveActorInstanceCallback; - SaveActorAssetInfoCallback* mSaveActorAssetInfoCallback; - CommandAdjustActorCallback* mAdjustActorCallback; - CommandActorSetCollisionMeshesCallback* mActorSetCollisionMeshesCallback; - CommandAdjustActorInstanceCallback* mAdjustActorInstanceCallback; - CommandScaleActorDataCallback* mScaleActorDataCallback; + ImportActorCallback* m_importActorCallback; + CreateActorInstanceCallback* m_createActorInstanceCallback; + CommandSelectCallback* m_selectCallback; + CommandUnselectCallback* m_unselectCallback; + CommandClearSelectionCallback* m_clearSelectionCallback; + RemoveActorCallback* m_removeActorCallback; + RemoveActorInstanceCallback* m_removeActorInstanceCallback; + SaveActorAssetInfoCallback* m_saveActorAssetInfoCallback; + CommandAdjustActorCallback* m_adjustActorCallback; + CommandActorSetCollisionMeshesCallback* m_actorSetCollisionMeshesCallback; + CommandAdjustActorInstanceCallback* m_adjustActorInstanceCallback; + CommandScaleActorDataCallback* m_scaleActorDataCallback; - SaveDirtyActorFilesCallback* mDirtyFilesCallback; + SaveDirtyActorFilesCallback* m_dirtyFilesCallback; - ActorsWindow* mActorsWindow; - ActorPropertiesWindow* mActorPropsWindow; + ActorsWindow* m_actorsWindow; + ActorPropertiesWindow* m_actorPropsWindow; }; } // namespace EMStudio diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/TimeView/PlaybackOptionsGroup.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/TimeView/PlaybackOptionsGroup.cpp index 14e2c79b88..4a5cc3f3d5 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/TimeView/PlaybackOptionsGroup.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/TimeView/PlaybackOptionsGroup.cpp @@ -108,18 +108,18 @@ namespace EMStudio continue; } - EMotionFX::Motion* motion = entry->mMotion; + EMotionFX::Motion* motion = entry->m_motion; const EMotionFX::PlayBackInfo* defaultPlayBackInfo = motion->GetDefaultPlayBackInfo(); - m_loopForeverAction->setChecked(defaultPlayBackInfo->mNumLoops == EMFX_LOOPFOREVER); - m_mirrorAction->setChecked(defaultPlayBackInfo->mMirrorMotion); - m_inPlaceAction->setChecked(defaultPlayBackInfo->mInPlace); - m_retargetAction->setChecked(defaultPlayBackInfo->mRetarget); + m_loopForeverAction->setChecked(defaultPlayBackInfo->m_numLoops == EMFX_LOOPFOREVER); + m_mirrorAction->setChecked(defaultPlayBackInfo->m_mirrorMotion); + m_inPlaceAction->setChecked(defaultPlayBackInfo->m_inPlace); + m_retargetAction->setChecked(defaultPlayBackInfo->m_retarget); - const bool playBackward = (defaultPlayBackInfo->mPlayMode == EMotionFX::PLAYMODE_BACKWARD); + const bool playBackward = (defaultPlayBackInfo->m_playMode == EMotionFX::PLAYMODE_BACKWARD); m_backwardAction->setChecked(playBackward); - SetPlaySpeed(defaultPlayBackInfo->mPlaySpeed); + SetPlaySpeed(defaultPlayBackInfo->m_playSpeed); } } } diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/TimeView/TimeInfoWidget.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/TimeView/TimeInfoWidget.cpp index 3878f36885..defa8e4701 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/TimeView/TimeInfoWidget.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/TimeView/TimeInfoWidget.cpp @@ -23,20 +23,19 @@ namespace EMStudio { setObjectName("TimeInfoWidget"); - mPlugin = plugin; + m_plugin = plugin; // init font - mFont.setPixelSize(mShowOverwriteStartTime ? 22 : 18); - mOverwriteFont.setPixelSize(12); - //mFont.setBold( true ); + m_font.setPixelSize(m_showOverwriteStartTime ? 22 : 18); + m_overwriteFont.setPixelSize(12); - mOverwriteStartTime = 0; - mOverwriteEndTime = 0; - mOverwriteMode = false; + m_overwriteStartTime = 0; + m_overwriteEndTime = 0; + m_overwriteMode = false; // init brushes and pens - mPenText = QPen(QColor(200, 200, 200)); - mPenTextFocus = QPen(QColor(244, 156, 28)); + m_penText = QPen(QColor(200, 200, 200)); + m_penTextFocus = QPen(QColor(244, 156, 28)); setFocusPolicy(Qt::StrongFocus); } @@ -58,8 +57,8 @@ namespace EMStudio // set the overwrite time which will be displayed when the overwrite mode is active void TimeInfoWidget::SetOverwriteTime(double startTime, double endTime) { - mOverwriteStartTime = startTime; - mOverwriteEndTime = endTime; + m_overwriteStartTime = startTime; + m_overwriteEndTime = endTime; } @@ -75,91 +74,84 @@ namespace EMStudio QTextOption options; options.setAlignment(Qt::AlignCenter); - if (mPlugin->GetTrackDataWidget()->hasFocus()) + if (m_plugin->GetTrackDataWidget()->hasFocus()) { - painter.setPen(mPenTextFocus); + painter.setPen(m_penTextFocus); } else { - painter.setPen(mPenText); + painter.setPen(m_penText); } - painter.setFont(mFont); - - // use the time of the plugin in case we are not in overwrite mode, if we are use the overwrite time - //uint32 usedTime = mPlugin->mCurTimeX; - //if (mOverwriteMode) - // usedTime = mOverwriteTime; + painter.setFont(m_font); // calculate the time values for this pixel uint32 minutes; uint32 seconds; uint32 milSecs; uint32 frameNumber; - // mPlugin->CalcTime(mPlugin->mCurTimeX/mPlugin->mTimeScale, nullptr, &minutes, &seconds, &milSecs, &frameNumber, false); - mPlugin->DecomposeTime(mPlugin->mCurTime, &minutes, &seconds, &milSecs, &frameNumber); - mCurTimeString = AZStd::string::format("%.2d:%.2d:%.2d", minutes, seconds, milSecs); + m_plugin->DecomposeTime(m_plugin->m_curTime, &minutes, &seconds, &milSecs, &frameNumber); + m_curTimeString = AZStd::string::format("%.2d:%.2d:%.2d", minutes, seconds, milSecs); QRect upperTextRect = event->rect(); - if (mShowOverwriteStartTime) + if (m_showOverwriteStartTime) { upperTextRect.setTop(upperTextRect.top() + 1); upperTextRect.setHeight(upperTextRect.height() - 17); } else { - mPlugin->DecomposeTime(mOverwriteEndTime, &minutes, &seconds, &milSecs, &frameNumber); - mCurTimeString += AZStd::string::format(" / %.2d:%.2d:%.2d", minutes, seconds, milSecs); + m_plugin->DecomposeTime(m_overwriteEndTime, &minutes, &seconds, &milSecs, &frameNumber); + m_curTimeString += AZStd::string::format(" / %.2d:%.2d:%.2d", minutes, seconds, milSecs); } - painter.drawText(upperTextRect, mCurTimeString.c_str(), options); + painter.drawText(upperTextRect, m_curTimeString.c_str(), options); - if (!mShowOverwriteStartTime) + if (!m_showOverwriteStartTime) { return; } - if (mOverwriteStartTime < 0) + if (m_overwriteStartTime < 0) { - mOverwriteStartTime = 0; + m_overwriteStartTime = 0; } - if (mOverwriteEndTime < 0) + if (m_overwriteEndTime < 0) { - mOverwriteEndTime = 0; + m_overwriteEndTime = 0; } // calculate the time values for the overwrite time uint32 minutesStart, minutesEnd; uint32 secondsStart, secondsEnd; uint32 milSecsStart, milSecsEnd; - mPlugin->DecomposeTime(mOverwriteStartTime, &minutesStart, &secondsStart, &milSecsStart, &frameNumber); - mPlugin->DecomposeTime(mOverwriteEndTime, &minutesEnd, &secondsEnd, &milSecsEnd, &frameNumber); + m_plugin->DecomposeTime(m_overwriteStartTime, &minutesStart, &secondsStart, &milSecsStart, &frameNumber); + m_plugin->DecomposeTime(m_overwriteEndTime, &minutesEnd, &secondsEnd, &milSecsEnd, &frameNumber); // use the duration of the motion or recording if (minutesStart == minutesEnd && secondsStart == secondsEnd && milSecsStart == milSecsEnd) { - //mOverwriteTimeString = AZStd::string::format("%.2d:%.2d:%.2d", minutesStart, secondsStart, milSecsStart); uint32 dummyFrame; double duration; - mPlugin->GetDataTimes(&duration, nullptr, nullptr); - mPlugin->DecomposeTime(duration, &minutesEnd, &secondsEnd, &milSecsEnd, &dummyFrame); + m_plugin->GetDataTimes(&duration, nullptr, nullptr); + m_plugin->DecomposeTime(duration, &minutesEnd, &secondsEnd, &milSecsEnd, &dummyFrame); } - mOverwriteTimeString = AZStd::string::format("%.2d:%.2d:%.2d / %.2d:%.2d:%.2d", minutesStart, secondsStart, milSecsStart, minutesEnd, secondsEnd, milSecsEnd); + m_overwriteTimeString = AZStd::string::format("%.2d:%.2d:%.2d / %.2d:%.2d:%.2d", minutesStart, secondsStart, milSecsStart, minutesEnd, secondsEnd, milSecsEnd); QRect lowerTextRect = event->rect(); lowerTextRect.setTop(upperTextRect.height()); - painter.setFont(mOverwriteFont); - painter.drawText(lowerTextRect, mOverwriteTimeString.c_str(), options); + painter.setFont(m_overwriteFont); + painter.drawText(lowerTextRect, m_overwriteTimeString.c_str(), options); } // propagate key events to the plugin and let it handle by a shared function void TimeInfoWidget::keyPressEvent(QKeyEvent* event) { - if (mPlugin) + if (m_plugin) { - mPlugin->OnKeyPressEvent(event); + m_plugin->OnKeyPressEvent(event); } } @@ -167,9 +159,9 @@ namespace EMStudio // propagate key events to the plugin and let it handle by a shared function void TimeInfoWidget::keyReleaseEvent(QKeyEvent* event) { - if (mPlugin) + if (m_plugin) { - mPlugin->OnKeyReleaseEvent(event); + m_plugin->OnKeyReleaseEvent(event); } } } // namespace EMStudio diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/TimeView/TimeInfoWidget.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/TimeView/TimeInfoWidget.h index 3c1146ed5b..bc9ac258eb 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/TimeView/TimeInfoWidget.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/TimeView/TimeInfoWidget.h @@ -36,8 +36,8 @@ namespace EMStudio TimeInfoWidget(TimeViewPlugin* plugin, QWidget* parent = nullptr); ~TimeInfoWidget(); - bool GetIsOverwriteMode() { return mOverwriteMode; } - void SetIsOverwriteMode(bool active) { mOverwriteMode = active; } + bool GetIsOverwriteMode() { return m_overwriteMode; } + void SetIsOverwriteMode(bool active) { m_overwriteMode = active; } void SetOverwriteTime(double startTime, double endTime); protected: @@ -45,18 +45,18 @@ namespace EMStudio QSize sizeHint() const; private: - QFont mFont; - QFont mOverwriteFont; - QBrush mBrushBackground; - QPen mPenText; - QPen mPenTextFocus; - AZStd::string mCurTimeString; - AZStd::string mOverwriteTimeString; - TimeViewPlugin* mPlugin; - double mOverwriteStartTime; - double mOverwriteEndTime; - bool mOverwriteMode; - bool mShowOverwriteStartTime = false; + QFont m_font; + QFont m_overwriteFont; + QBrush m_brushBackground; + QPen m_penText; + QPen m_penTextFocus; + AZStd::string m_curTimeString; + AZStd::string m_overwriteTimeString; + TimeViewPlugin* m_plugin; + double m_overwriteStartTime; + double m_overwriteEndTime; + bool m_overwriteMode; + bool m_showOverwriteStartTime = false; void keyPressEvent(QKeyEvent* event); void keyReleaseEvent(QKeyEvent* event); diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/TimeView/TimeTrack.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/TimeView/TimeTrack.cpp index c1c440d0d8..550e95eeef 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/TimeView/TimeTrack.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/TimeView/TimeTrack.cpp @@ -19,24 +19,22 @@ namespace EMStudio // the constructor TimeTrack::TimeTrack(TimeViewPlugin* plugin) { - mPlugin = plugin; - mHeight = 20; - mStartY = 0; - mEnabled = false; - mIsHighlighted = false; - mVisible = false; - mDeletable = true; + m_plugin = plugin; + m_height = 20; + m_startY = 0; + m_enabled = false; + m_isHighlighted = false; + m_visible = false; + m_deletable = true; // init font - mFont.setPixelSize(14); - //mFont.setBold( true ); + m_font.setPixelSize(14); // init brushes and pens - mBrushDataBG = QColor(60, 65, 70); - //mBrushDataBG = QColor(50, 50, 50); - mBrushDataDisabledBG = QColor(50, 50, 50);// use the same color //QBrush( QColor(33, 33, 33) ); - mBrushHeaderBG = QBrush(QColor(30, 30, 30)); - mPenText = QPen(QColor(255, 255, 255)); + m_brushDataBg = QColor(60, 65, 70); + m_brushDataDisabledBg = QColor(50, 50, 50);// use the same color //QBrush( QColor(33, 33, 33) ); + m_brushHeaderBg = QBrush(QColor(30, 30, 30)); + m_penText = QPen(QColor(255, 255, 255)); } @@ -52,14 +50,14 @@ namespace EMStudio { MCORE_UNUSED(width); - if (mVisible == false) + if (m_visible == false) { return; } - int32 animEndPixel = aznumeric_cast(mPlugin->TimeToPixel(animationLength)); - int32 clipStartPixel = aznumeric_cast(mPlugin->TimeToPixel(clipStartTime)); - int32 clipEndPixel = aznumeric_cast(mPlugin->TimeToPixel(clipEndTime)); + int32 animEndPixel = aznumeric_cast(m_plugin->TimeToPixel(animationLength)); + int32 clipStartPixel = aznumeric_cast(m_plugin->TimeToPixel(clipStartTime)); + int32 clipEndPixel = aznumeric_cast(m_plugin->TimeToPixel(clipEndTime)); // fill the background uint32 height = GetHeight(); @@ -68,17 +66,17 @@ namespace EMStudio QRect clipStartRect(0, startY, clipStartPixel, height); QRect clipEndRect(clipEndPixel, startY, animEndPixel - clipEndPixel, height); - QColor disabledBGColor = mBrushDataDisabledBG; - QColor bgColor = mBrushDataBG; + QColor disabledBGColor = m_brushDataDisabledBg; + QColor bgColor = m_brushDataBg; // make the colors a bit lighter so that we see some highlighting effect - if (mIsHighlighted) + if (m_isHighlighted) { disabledBGColor = disabledBGColor.lighter(120); bgColor = bgColor.lighter(120); } - if (mEnabled) + if (m_enabled) { painter.setPen(Qt::NoPen); painter.setBrush(disabledBGColor); @@ -105,10 +103,10 @@ namespace EMStudio // render all elements //uint32 numRenderedElements = 0; - const size_t numElems = mElements.size(); + const size_t numElems = m_elements.size(); for (size_t i = 0; i < numElems; ++i) { - TimeTrackElement* element = mElements[i]; + TimeTrackElement* element = m_elements[i]; // skip rendering the element in case it is not inside the visible area in the widget if (element->GetEndTime() < startTime || @@ -117,7 +115,7 @@ namespace EMStudio continue; } - bool enabled = mEnabled; + bool enabled = m_enabled; // make sure we render the motion event as disabled as soon as it is in the clipped area if (element->GetEndTime() < clipStartTime || @@ -137,7 +135,7 @@ namespace EMStudio // render the track header void TimeTrack::RenderHeader(QPainter& painter, uint32 width, int32 startY) { - if (mVisible == false) + if (m_visible == false) { return; } @@ -147,14 +145,14 @@ namespace EMStudio QRect rect(0, startY, width, height); painter.setPen(Qt::NoPen); - painter.setBrush(mBrushHeaderBG); + painter.setBrush(m_brushHeaderBg); painter.drawRect(rect); // render the name QTextOption options; options.setAlignment(Qt::AlignCenter); - painter.setPen(mPenText); - painter.drawText(rect, mName.c_str(), options); + painter.setPen(m_penText); + painter.drawText(rect, m_name.c_str(), options); } @@ -163,26 +161,26 @@ namespace EMStudio { if (delFromMem) { - for (TimeTrackElement* element : mElements) + for (TimeTrackElement* element : m_elements) { delete element; } } - mElements.clear(); + m_elements.clear(); } // get the track element at a given pixel TimeTrackElement* TimeTrack::GetElementAt(int32 x, int32 y) const { - if (mVisible == false) + if (m_visible == false) { return nullptr; } // for all elements - for (TimeTrackElement* element : mElements) + for (TimeTrackElement* element : m_elements) { // check if its inside if (element->GetIsVisible() == false) @@ -203,12 +201,12 @@ namespace EMStudio // calculate the number of selected elements size_t TimeTrack::CalcNumSelectedElements() const { - if (mVisible == false) + if (m_visible == false) { return 0; } - return AZStd::accumulate(begin(mElements), end(mElements), size_t{0}, [](size_t total, const TimeTrackElement* element) + return AZStd::accumulate(begin(m_elements), end(m_elements), size_t{0}, [](size_t total, const TimeTrackElement* element) { return total + element->GetIsSelected(); }); @@ -218,16 +216,16 @@ namespace EMStudio // find and return the first of the selected elements TimeTrackElement* TimeTrack::GetFirstSelectedElement() const { - if (mVisible == false) + if (m_visible == false) { return nullptr; } - const auto foundElement = AZStd::find_if(begin(mElements), end(mElements), [](const TimeTrackElement* element) + const auto foundElement = AZStd::find_if(begin(m_elements), end(m_elements), [](const TimeTrackElement* element) { return element->GetIsSelected(); }); - return foundElement != end(mElements) ? *foundElement : nullptr; + return foundElement != end(m_elements) ? *foundElement : nullptr; } @@ -239,11 +237,11 @@ namespace EMStudio const size_t endNr = AZStd::max(elementStartNr, elementEndNr); // get the number of elements and iterate through them - const size_t numElems = mElements.size(); + const size_t numElems = m_elements.size(); for (size_t i = 0; i < numElems; ++i) { const size_t elementNr = i; - TimeTrackElement* element = mElements[i]; + TimeTrackElement* element = m_elements[i]; // check if the current element is in range if (elementNr >= startNr && elementNr <= endNr) @@ -262,7 +260,7 @@ namespace EMStudio void TimeTrack::SelectElementsInRect(const QRect& rect, bool overwriteCurSelection, bool select, bool toggleMode) { // get the number of elements and iterate through them - for (TimeTrackElement* element : mElements) + for (TimeTrackElement* element : m_elements) { // get the current element and the corresponding rect QRect elementRect = element->CalcRect(); diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/TimeView/TimeTrack.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/TimeView/TimeTrack.h index 55dcae73c3..2d6023844c 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/TimeView/TimeTrack.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/TimeView/TimeTrack.h @@ -37,20 +37,20 @@ namespace EMStudio TimeTrack(TimeViewPlugin* plugin); ~TimeTrack(); - void SetHeight(uint32 height) { mHeight = height; } - MCORE_INLINE uint32 GetHeight() const { return mHeight; } + void SetHeight(uint32 height) { m_height = height; } + MCORE_INLINE uint32 GetHeight() const { return m_height; } void RenderHeader(QPainter& painter, uint32 width, int32 startY); // @param startTime The time in seconds of the left border of the visible area in the widget. void RenderData(QPainter& painter, uint32 width, int32 startY, double startTime, double endTime, double animationLength, double clipStartTime, double clipEndTime); - MCORE_INLINE size_t GetNumElements() const { return mElements.size(); } - MCORE_INLINE TimeTrackElement* GetElement(size_t index) const { return mElements[index]; } - void AddElement(TimeTrackElement* elem) { elem->SetTrack(this); mElements.push_back(elem); } + MCORE_INLINE size_t GetNumElements() const { return m_elements.size(); } + MCORE_INLINE TimeTrackElement* GetElement(size_t index) const { return m_elements[index]; } + void AddElement(TimeTrackElement* elem) { elem->SetTrack(this); m_elements.push_back(elem); } void RemoveElement(TimeTrackElement* elem, bool delFromMem = true) { - mElements.erase(AZStd::remove(mElements.begin(), mElements.end(), elem), mElements.end()); + m_elements.erase(AZStd::remove(m_elements.begin(), m_elements.end(), elem), m_elements.end()); if (delFromMem) { delete elem; @@ -60,14 +60,14 @@ namespace EMStudio { if (delFromMem) { - delete mElements[index]; + delete m_elements[index]; } - mElements.erase(mElements.begin() + index); + m_elements.erase(m_elements.begin() + index); } void RemoveAllElements(bool delFromMem = true); void SetElementCount(size_t count) { - mElements.resize(count); + m_elements.resize(count); } size_t CalcNumSelectedElements() const; @@ -75,42 +75,42 @@ namespace EMStudio void RangeSelectElements(size_t elementStartNr, size_t elementEndNr); void SelectElementsInRect(const QRect& rect, bool overwriteCurSelection, bool select, bool toggleMode); - MCORE_INLINE TimeViewPlugin* GetPlugin() { return mPlugin; } - MCORE_INLINE void SetStartY(uint32 y) { mStartY = y; } - MCORE_INLINE uint32 GetStartY() const { return mStartY; } - bool GetIsInside(uint32 y) const { return (y >= mStartY) && (y <= (mStartY + mHeight)); } + MCORE_INLINE TimeViewPlugin* GetPlugin() { return m_plugin; } + MCORE_INLINE void SetStartY(uint32 y) { m_startY = y; } + MCORE_INLINE uint32 GetStartY() const { return m_startY; } + bool GetIsInside(uint32 y) const { return (y >= m_startY) && (y <= (m_startY + m_height)); } - void SetName(const char* name) { mName = name; } - const char* GetName() const { return mName.c_str(); } + void SetName(const char* name) { m_name = name; } + const char* GetName() const { return m_name.c_str(); } - bool GetIsEnabled() const { return mEnabled; } - void SetIsEnabled(bool enabled) { mEnabled = enabled; } + bool GetIsEnabled() const { return m_enabled; } + void SetIsEnabled(bool enabled) { m_enabled = enabled; } - bool GetIsDeletable() const { return mDeletable; } - void SetIsDeletable(bool isDeletable) { mDeletable = isDeletable; } + bool GetIsDeletable() const { return m_deletable; } + void SetIsDeletable(bool isDeletable) { m_deletable = isDeletable; } - bool GetIsVisible() const { return mVisible; } - void SetIsVisible(bool visible) { mVisible = visible; } + bool GetIsVisible() const { return m_visible; } + void SetIsVisible(bool visible) { m_visible = visible; } - MCORE_INLINE bool GetIsHighlighted() const { return mIsHighlighted; } - MCORE_INLINE void SetIsHighlighted(bool enabled) { mIsHighlighted = enabled; } + MCORE_INLINE bool GetIsHighlighted() const { return m_isHighlighted; } + MCORE_INLINE void SetIsHighlighted(bool enabled) { m_isHighlighted = enabled; } TimeTrackElement* GetElementAt(int32 x, int32 y) const; protected: - AZStd::string mName; - uint32 mHeight; - uint32 mStartY; - QFont mFont; - QBrush mBrushHeaderBG; - QColor mBrushDataBG; - QColor mBrushDataDisabledBG; - QPen mPenText; - TimeViewPlugin* mPlugin; - AZStd::vector mElements; - bool mEnabled; - bool mVisible; - bool mDeletable; - bool mIsHighlighted; + AZStd::string m_name; + uint32 m_height; + uint32 m_startY; + QFont m_font; + QBrush m_brushHeaderBg; + QColor m_brushDataBg; + QColor m_brushDataDisabledBg; + QPen m_penText; + TimeViewPlugin* m_plugin; + AZStd::vector m_elements; + bool m_enabled; + bool m_visible; + bool m_deletable; + bool m_isHighlighted; }; } // namespace EMStudio diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/TimeView/TimeTrackElement.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/TimeView/TimeTrackElement.cpp index 78e911eb0a..5bb6d842fc 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/TimeView/TimeTrackElement.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/TimeView/TimeTrackElement.cpp @@ -21,27 +21,27 @@ namespace EMStudio { // statics - QColor TimeTrackElement::mTextColor = QColor(30, 30, 30); - QColor TimeTrackElement::mHighlightedTextColor = QColor(0, 0, 0); - QColor TimeTrackElement::mHighlightedColor = QColor(255, 128, 0); - int32 TimeTrackElement::mTickHalfWidth = 7; + QColor TimeTrackElement::s_textColor = QColor(30, 30, 30); + QColor TimeTrackElement::s_highlightedTextColor = QColor(0, 0, 0); + QColor TimeTrackElement::s_highlightedColor = QColor(255, 128, 0); + int32 TimeTrackElement::s_tickHalfWidth = 7; // constructor TimeTrackElement::TimeTrackElement(const char* name, TimeTrack* timeTrack, size_t elementNumber, QColor color) { - mTrack = timeTrack; - mName = name; - mIsSelected = false; - mShowTimeHandles = false; - mIsHighlighted = false; - mStartTime = 0.0; - mEndTime = 0.0; - mColor = color; - mElementNumber = elementNumber; - mIsCut = false; + m_track = timeTrack; + m_name = name; + m_isSelected = false; + m_showTimeHandles = false; + m_isHighlighted = false; + m_startTime = 0.0; + m_endTime = 0.0; + m_color = color; + m_elementNumber = elementNumber; + m_isCut = false; // init font - mFont.setPixelSize(10); + m_font.setPixelSize(10); } @@ -54,13 +54,13 @@ namespace EMStudio // calculate the dimensions in pixels void TimeTrackElement::CalcDimensions(int32* outStartX, int32* outStartY, int32* outWidth, int32* outHeight) const { - TimeViewPlugin* plugin = mTrack->GetPlugin(); + TimeViewPlugin* plugin = m_track->GetPlugin(); - *outStartX = aznumeric_cast(plugin->TimeToPixel(mStartTime)); - int32 endX = aznumeric_cast(plugin->TimeToPixel(mEndTime)); - *outStartY = mTrack->GetStartY() + 1; + *outStartX = aznumeric_cast(plugin->TimeToPixel(m_startTime)); + int32 endX = aznumeric_cast(plugin->TimeToPixel(m_endTime)); + *outStartY = m_track->GetStartY() + 1; *outWidth = (endX - *outStartX); - *outHeight = mTrack->GetHeight() - 1; + *outHeight = m_track->GetHeight() - 1; } @@ -92,14 +92,14 @@ namespace EMStudio // create the rect QRect rect(startX, startY, width + 1, height); - QColor color = mColor; + QColor color = m_color; QColor borderColor(30, 30, 30); - QColor textColor = mTextColor; - if (mIsSelected) + QColor textColor = s_textColor; + if (m_isSelected) { - color = mHighlightedColor; - borderColor = mHighlightedColor; - textColor = mHighlightedTextColor; + color = s_highlightedColor; + borderColor = s_highlightedColor; + textColor = s_highlightedTextColor; } // in case the track is disabled @@ -111,14 +111,14 @@ namespace EMStudio } // make the colors a bit lighter so that we see some highlighting effect - if (mIsHighlighted) + if (m_isHighlighted) { borderColor = borderColor.lighter(130); color = color.lighter(130); } // in case the track is cutted - if (mIsCut) + if (m_isCut) { borderColor.setAlpha(90); color.setAlpha(90); @@ -149,32 +149,32 @@ namespace EMStudio options.setAlignment(Qt::AlignCenter); painter.setPen(textColor); - painter.setFont(mFont); + painter.setFont(m_font); painter.setRenderHint(QPainter::Antialiasing); - painter.drawText(rect, mName, options); + painter.drawText(rect, m_name, options); painter.setRenderHint(QPainter::Antialiasing, false); } else { height--; - mTickPoints[0] = QPoint(startX, startY); - mTickPoints[1] = QPoint(startX + mTickHalfWidth, startY + height / 2); - mTickPoints[2] = QPoint(startX + mTickHalfWidth, startY + height); - mTickPoints[3] = QPoint(startX - mTickHalfWidth, startY + height); - mTickPoints[4] = QPoint(startX - mTickHalfWidth, startY + height / 2); - mTickPoints[5] = QPoint(startX, startY); + m_tickPoints[0] = QPoint(startX, startY); + m_tickPoints[1] = QPoint(startX + s_tickHalfWidth, startY + height / 2); + m_tickPoints[2] = QPoint(startX + s_tickHalfWidth, startY + height); + m_tickPoints[3] = QPoint(startX - s_tickHalfWidth, startY + height); + m_tickPoints[4] = QPoint(startX - s_tickHalfWidth, startY + height / 2); + m_tickPoints[5] = QPoint(startX, startY); painter.setPen(Qt::NoPen); painter.setBrush(gradient); //painter.setBrush( color ); painter.setRenderHint(QPainter::Antialiasing); - painter.drawPolygon(mTickPoints, 5, Qt::WindingFill); + painter.drawPolygon(m_tickPoints, 5, Qt::WindingFill); painter.setRenderHint(QPainter::Antialiasing, false); painter.setBrush(Qt::NoBrush); painter.setPen(borderColor); painter.setRenderHint(QPainter::Antialiasing); - painter.drawPolyline(mTickPoints, 6); + painter.drawPolyline(m_tickPoints, 6); painter.setRenderHint(QPainter::Antialiasing, false); } } @@ -195,12 +195,12 @@ namespace EMStudio bool isTickElement = width < 1 ? true : false; if (isTickElement) { - startX -= mTickHalfWidth; - width += 2 * mTickHalfWidth; + startX -= s_tickHalfWidth; + width += 2 * s_tickHalfWidth; } // take scrolling into account - startX = aznumeric_cast(startX + mTrack->GetPlugin()->GetScrollX()); + startX = aznumeric_cast(startX + m_track->GetPlugin()->GetScrollX()); // check if we're inside the area of the element if (MCore::InRange(x, startX, startX + width) && MCore::InRange(y, startY, startY + height)) @@ -252,15 +252,15 @@ namespace EMStudio void TimeTrackElement::MoveRelative(double timeDelta) { // don't allow it to start before zero - if (mStartTime + timeDelta < 0.0) + if (m_startTime + timeDelta < 0.0) { - mStartTime -= mStartTime; - mEndTime -= mStartTime; + m_startTime -= m_startTime; + m_endTime -= m_startTime; } else { - mStartTime += timeDelta; - mEndTime += timeDelta; + m_startTime += timeDelta; + m_endTime += timeDelta; } } @@ -280,8 +280,8 @@ namespace EMStudio bool isTickElement = width < 1 ? true : false; if (isTickElement) { - startX -= mTickHalfWidth; - width += 2 * mTickHalfWidth; + startX -= s_tickHalfWidth; + width += 2 * s_tickHalfWidth; } int32 endX = startX + width; @@ -310,14 +310,14 @@ namespace EMStudio // resize the start point case RESIZEPOINT_START: { - double newStartTime = mStartTime + timeDelta; - mTrack->GetPlugin()->SnapTime(&newStartTime, this, snapThreshold); - mStartTime = newStartTime; + double newStartTime = m_startTime + timeDelta; + m_track->GetPlugin()->SnapTime(&newStartTime, this, snapThreshold); + m_startTime = newStartTime; - if (newStartTime > mEndTime) + if (newStartTime > m_endTime) { - mStartTime = mEndTime; - mEndTime = newStartTime; + m_startTime = m_endTime; + m_endTime = newStartTime; return RESIZEPOINT_END; } @@ -328,14 +328,14 @@ namespace EMStudio // resize the end point case RESIZEPOINT_END: { - double newEndTime = mEndTime + timeDelta; - mTrack->GetPlugin()->SnapTime(&newEndTime, this, snapThreshold); - mEndTime = newEndTime; + double newEndTime = m_endTime + timeDelta; + m_track->GetPlugin()->SnapTime(&newEndTime, this, snapThreshold); + m_endTime = newEndTime; - if (newEndTime < mStartTime) + if (newEndTime < m_startTime) { - mEndTime = mStartTime; - mStartTime = newEndTime; + m_endTime = m_startTime; + m_startTime = newEndTime; return RESIZEPOINT_START; } diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/TimeView/TimeTrackElement.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/TimeView/TimeTrackElement.h index 1e0d38486b..2bc4c5187b 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/TimeView/TimeTrackElement.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/TimeView/TimeTrackElement.h @@ -38,25 +38,25 @@ namespace EMStudio TimeTrackElement(const char* name, TimeTrack* timeTrack, size_t elementNumber = InvalidIndex, QColor color = QColor(0, 0, 0)); virtual ~TimeTrackElement(); - MCORE_INLINE double GetStartTime() const { return mStartTime; } - MCORE_INLINE double GetEndTime() const { return mEndTime; } - MCORE_INLINE bool GetIsSelected() const { return mIsSelected; } - MCORE_INLINE TimeTrack* GetTrack() { return mTrack; } - MCORE_INLINE size_t GetElementNumber() const { return mElementNumber; } - QColor GetColor() const { return mColor; } + MCORE_INLINE double GetStartTime() const { return m_startTime; } + MCORE_INLINE double GetEndTime() const { return m_endTime; } + MCORE_INLINE bool GetIsSelected() const { return m_isSelected; } + MCORE_INLINE TimeTrack* GetTrack() { return m_track; } + MCORE_INLINE size_t GetElementNumber() const { return m_elementNumber; } + QColor GetColor() const { return m_color; } - void SetIsSelected(bool selected) { mIsSelected = selected; } - void SetStartTime(double startTime) { mStartTime = startTime; } - void SetEndTime(double endTime) { mEndTime = endTime; } - void SetName(const char* name) { mName = name; } - void SetToolTip(const char* toolTip) { mToolTip = toolTip; } - void SetTrack(TimeTrack* track) { mTrack = track; } - void SetElementNumber(size_t elementNumber) { mElementNumber = elementNumber; } - void SetColor(QColor color) { mColor = color; } + void SetIsSelected(bool selected) { m_isSelected = selected; } + void SetStartTime(double startTime) { m_startTime = startTime; } + void SetEndTime(double endTime) { m_endTime = endTime; } + void SetName(const char* name) { m_name = name; } + void SetToolTip(const char* toolTip) { m_toolTip = toolTip; } + void SetTrack(TimeTrack* track) { m_track = track; } + void SetElementNumber(size_t elementNumber) { m_elementNumber = elementNumber; } + void SetColor(QColor color) { m_color = color; } - const QString& GetName() const { return mName; } - const QString& GetToolTip() const { return mToolTip; } - const QFont& GetFont() const { return mFont; } + const QString& GetName() const { return m_name; } + const QString& GetToolTip() const { return m_toolTip; } + const QFont& GetFont() const { return m_font; } virtual void Render(QPainter& painter, bool isTrackEnabled); virtual bool SnapTime(double* inOutTime, double snapTreshold) const; @@ -68,42 +68,42 @@ namespace EMStudio void CalcDimensions(int32* outStartX, int32* outStartY, int32* outWidth, int32* outHeight) const; QRect CalcRect(); - bool GetShowTimeHandles() const { return mShowTimeHandles; } - void SetShowTimeHandles(bool show) { mShowTimeHandles = show; } - void SetShowToolTip(bool show) { mShowToolTip = show; } - bool GetShowToolTip() const { return mShowToolTip; } + bool GetShowTimeHandles() const { return m_showTimeHandles; } + void SetShowTimeHandles(bool show) { m_showTimeHandles = show; } + void SetShowToolTip(bool show) { m_showToolTip = show; } + bool GetShowToolTip() const { return m_showToolTip; } - bool GetIsVisible() const { return mVisible; } - void SetIsVisible(bool visible) { mVisible = visible; } + bool GetIsVisible() const { return m_visible; } + void SetIsVisible(bool visible) { m_visible = visible; } - bool GetIsCut() const { return mIsCut; } - void SetIsCut(bool cut) { mIsCut = cut; } + bool GetIsCut() const { return m_isCut; } + void SetIsCut(bool cut) { m_isCut = cut; } - MCORE_INLINE bool GetIsHighlighted() const { return mIsHighlighted; } - MCORE_INLINE void SetIsHighlighted(bool enabled) { mIsHighlighted = enabled; } + MCORE_INLINE bool GetIsHighlighted() const { return m_isHighlighted; } + MCORE_INLINE void SetIsHighlighted(bool enabled) { m_isHighlighted = enabled; } protected: - QFont mFont; - QBrush mBrush; - TimeTrack* mTrack; - double mStartTime; - double mEndTime; - QString mName; - QString mToolTip; - QColor mColor; - size_t mElementNumber; - QPoint mTickPoints[6]; + QFont m_font; + QBrush m_brush; + TimeTrack* m_track; + double m_startTime; + double m_endTime; + QString m_name; + QString m_toolTip; + QColor m_color; + size_t m_elementNumber; + QPoint m_tickPoints[6]; - bool mVisible; - bool mIsCut; - bool mIsSelected; - bool mShowTimeHandles; - bool mShowToolTip; - bool mIsHighlighted; + bool m_visible; + bool m_isCut; + bool m_isSelected; + bool m_showTimeHandles; + bool m_showToolTip; + bool m_isHighlighted; - static QColor mHighlightedColor; - static QColor mTextColor; - static QColor mHighlightedTextColor; - static int32 mTickHalfWidth; + static QColor s_highlightedColor; + static QColor s_textColor; + static QColor s_highlightedTextColor; + static int32 s_tickHalfWidth; }; } // namespace EMStudio diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/TimeView/TimeViewPlugin.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/TimeView/TimeViewPlugin.cpp index 6f8ab95891..a87b7066b5 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/TimeView/TimeViewPlugin.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/TimeView/TimeViewPlugin.cpp @@ -47,46 +47,46 @@ namespace EMStudio TimeViewPlugin::TimeViewPlugin() : EMStudio::DockWidgetPlugin() { - mPixelsPerSecond = 60; - mCurTime = 0; - mFPS = 32; - mTimeScale = 1.0; - mTargetTimeScale = 1.0; - mScrollX = 0.0; - mTargetScrollX = 0.0; - mMaxTime = 0.0; - mMaxHeight = 0.0; - mMinScale = 0.25; - mMaxScale = 100.0; - mCurMouseX = 0; - mCurMouseY = 0; - mTotalTime = FLT_MAX; - mZoomInCursor = nullptr; - mZoomOutCursor = nullptr; - mIsAnimating = false; - mDirty = true; + m_pixelsPerSecond = 60; + m_curTime = 0; + m_fps = 32; + m_timeScale = 1.0; + m_targetTimeScale = 1.0; + m_scrollX = 0.0; + m_targetScrollX = 0.0; + m_maxTime = 0.0; + m_maxHeight = 0.0; + m_minScale = 0.25; + m_maxScale = 100.0; + m_curMouseX = 0; + m_curMouseY = 0; + m_totalTime = FLT_MAX; + m_zoomInCursor = nullptr; + m_zoomOutCursor = nullptr; + m_isAnimating = false; + m_dirty = true; - mTrackDataHeaderWidget = nullptr; - mTrackDataWidget = nullptr; - mTrackHeaderWidget = nullptr; - mTimeInfoWidget = nullptr; + m_trackDataHeaderWidget = nullptr; + m_trackDataWidget = nullptr; + m_trackHeaderWidget = nullptr; + m_timeInfoWidget = nullptr; - mNodeHistoryItem = nullptr; - mEventHistoryItem = nullptr; - mActorInstanceData = nullptr; - mEventEmitterNode = nullptr; + m_nodeHistoryItem = nullptr; + m_eventHistoryItem = nullptr; + m_actorInstanceData = nullptr; + m_eventEmitterNode = nullptr; - mMainWidget = nullptr; - mMotionWindowPlugin = nullptr; - mMotionEventsPlugin = nullptr; - mMotionListWindow = nullptr; + m_mainWidget = nullptr; + m_motionWindowPlugin = nullptr; + m_motionEventsPlugin = nullptr; + m_motionListWindow = nullptr; m_motionSetPlugin = nullptr; - mMotion = nullptr; + m_motion = nullptr; - mBrushCurTimeHandle = QBrush(QColor(255, 180, 0)); - mPenCurTimeHandle = QPen(QColor(255, 180, 0)); - mPenTimeHandles = QPen(QColor(150, 150, 150), 1, Qt::DotLine); - mPenCurTimeHelper = QPen(QColor(100, 100, 100), 1, Qt::DotLine); + m_brushCurTimeHandle = QBrush(QColor(255, 180, 0)); + m_penCurTimeHandle = QPen(QColor(255, 180, 0)); + m_penTimeHandles = QPen(QColor(150, 150, 150), 1, Qt::DotLine); + m_penCurTimeHelper = QPen(QColor(100, 100, 100), 1, Qt::DotLine); } TimeViewPlugin::~TimeViewPlugin() @@ -103,11 +103,11 @@ namespace EMStudio RemoveAllTracks(); // get rid of the cursors - delete mZoomInCursor; - delete mZoomOutCursor; + delete m_zoomInCursor; + delete m_zoomOutCursor; // get rid of the motion infos - for (MotionInfo* motionInfo : mMotionInfos) + for (MotionInfo* motionInfo : m_motionInfos) { delete motionInfo; } @@ -162,12 +162,12 @@ namespace EMStudio { if (classID == MotionWindowPlugin::CLASS_ID) { - mMotionWindowPlugin = nullptr; + m_motionWindowPlugin = nullptr; } if (classID == MotionEventsPlugin::CLASS_ID) { - mMotionEventsPlugin = nullptr; + m_motionEventsPlugin = nullptr; } } @@ -196,37 +196,37 @@ namespace EMStudio GetCommandManager()->RegisterCommandCallback("PlayMotion", m_commandCallbacks.back()); // load the cursors - mZoomInCursor = new QCursor(QPixmap(QDir{ QString(MysticQt::GetDataDir().c_str()) }.filePath("Images/Rendering/ZoomInCursor.png")).scaled(32, 32)); - mZoomOutCursor = new QCursor(QPixmap(QDir{ QString(MysticQt::GetDataDir().c_str()) }.filePath("Images/Rendering/ZoomOutCursor.png")).scaled(32, 32)); + m_zoomInCursor = new QCursor(QPixmap(QDir{ QString(MysticQt::GetDataDir().c_str()) }.filePath("Images/Rendering/ZoomInCursor.png")).scaled(32, 32)); + m_zoomOutCursor = new QCursor(QPixmap(QDir{ QString(MysticQt::GetDataDir().c_str()) }.filePath("Images/Rendering/ZoomOutCursor.png")).scaled(32, 32)); // create main widget - mMainWidget = new QWidget(mDock); - mDock->setWidget(mMainWidget); + m_mainWidget = new QWidget(m_dock); + m_dock->setWidget(m_mainWidget); QGridLayout* mainLayout = new QGridLayout(); mainLayout->setMargin(0); mainLayout->setSpacing(0); - mMainWidget->setLayout(mainLayout); + m_mainWidget->setLayout(mainLayout); // create widgets in the header QHBoxLayout* topLayout = new QHBoxLayout(); // Top - mTimeViewToolBar = new TimeViewToolBar(this); + m_timeViewToolBar = new TimeViewToolBar(this); // Top-left - mTimeInfoWidget = new TimeInfoWidget(this); - mTimeInfoWidget->setFixedWidth(175); - topLayout->addWidget(mTimeInfoWidget); - topLayout->addWidget(mTimeViewToolBar); + m_timeInfoWidget = new TimeInfoWidget(this); + m_timeInfoWidget->setFixedWidth(175); + topLayout->addWidget(m_timeInfoWidget); + topLayout->addWidget(m_timeViewToolBar); mainLayout->addLayout(topLayout, 0, 0, 1, 2); // Top-right - mTrackDataHeaderWidget = new TrackDataHeaderWidget(this, mDock); - mTrackDataHeaderWidget->setFixedHeight(40); + m_trackDataHeaderWidget = new TrackDataHeaderWidget(this, m_dock); + m_trackDataHeaderWidget->setFixedHeight(40); // create widgets in the body. For the body we are going to put a scroll area // so we can get a vertical scroll bar when we have more tracks than what the // view can show - QScrollArea* bodyWidget = new QScrollArea(mMainWidget); + QScrollArea* bodyWidget = new QScrollArea(m_mainWidget); bodyWidget->setFrameShape(QFrame::NoFrame); bodyWidget->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); bodyWidget->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); @@ -242,39 +242,39 @@ namespace EMStudio mainLayout->addWidget(bodyWidget, 2, 0, 1, 2); // Bottom-left - mTrackHeaderWidget = new TrackHeaderWidget(this, mDock); - mTrackHeaderWidget->setFixedWidth(175); - bodyLayout->addWidget(mTrackHeaderWidget); + m_trackHeaderWidget = new TrackHeaderWidget(this, m_dock); + m_trackHeaderWidget->setFixedWidth(175); + bodyLayout->addWidget(m_trackHeaderWidget); // Left QHBoxLayout* addTrackAndTrackDataLayout = new QHBoxLayout; - addTrackAndTrackDataLayout->addWidget(mTrackHeaderWidget->GetAddTrackWidget()); - mTrackHeaderWidget->GetAddTrackWidget()->setFixedWidth(175); - addTrackAndTrackDataLayout->addWidget(mTrackDataHeaderWidget); + addTrackAndTrackDataLayout->addWidget(m_trackHeaderWidget->GetAddTrackWidget()); + m_trackHeaderWidget->GetAddTrackWidget()->setFixedWidth(175); + addTrackAndTrackDataLayout->addWidget(m_trackDataHeaderWidget); mainLayout->addLayout(addTrackAndTrackDataLayout, 1, 0, 1, 2); // bottom-right - mTrackDataWidget = new TrackDataWidget(this, mDock); - bodyLayout->addWidget(mTrackDataWidget); + m_trackDataWidget = new TrackDataWidget(this, m_dock); + bodyLayout->addWidget(m_trackDataWidget); - connect(mTrackDataWidget, &TrackDataWidget::SelectionChanged, this, &TimeViewPlugin::OnSelectionChanged); + connect(m_trackDataWidget, &TrackDataWidget::SelectionChanged, this, &TimeViewPlugin::OnSelectionChanged); - connect(mTrackDataWidget, &TrackDataWidget::ElementTrackChanged, this, &TimeViewPlugin::MotionEventTrackChanged); - connect(mTrackDataWidget, &TrackDataWidget::MotionEventChanged, this, &TimeViewPlugin::MotionEventChanged); + connect(m_trackDataWidget, &TrackDataWidget::ElementTrackChanged, this, &TimeViewPlugin::MotionEventTrackChanged); + connect(m_trackDataWidget, &TrackDataWidget::MotionEventChanged, this, &TimeViewPlugin::MotionEventChanged); connect(this, &TimeViewPlugin::DeleteKeyPressed, this, &TimeViewPlugin::RemoveSelectedMotionEvents); - connect(mDock, &QDockWidget::visibilityChanged, this, &TimeViewPlugin::VisibilityChanged); + connect(m_dock, &QDockWidget::visibilityChanged, this, &TimeViewPlugin::VisibilityChanged); connect(this, &TimeViewPlugin::ManualTimeChange, this, &TimeViewPlugin::OnManualTimeChange); - connect(mTimeViewToolBar, &TimeViewToolBar::RecorderStateChanged, this, &TimeViewPlugin::RecorderStateChanged); + connect(m_timeViewToolBar, &TimeViewToolBar::RecorderStateChanged, this, &TimeViewPlugin::RecorderStateChanged); SetCurrentTime(0.0f); SetScale(1.0f); SetRedrawFlag(); - mTimeViewToolBar->UpdateInterface(); + m_timeViewToolBar->UpdateInterface(); EMotionFX::AnimGraphEditorNotificationBus::Handler::BusConnect(); return true; @@ -284,7 +284,7 @@ namespace EMStudio // add a new track void TimeViewPlugin::AddTrack(TimeTrack* track) { - mTracks.emplace_back(track); + m_tracks.emplace_back(track); SetRedrawFlag(); } @@ -293,18 +293,18 @@ namespace EMStudio void TimeViewPlugin::RemoveAllTracks() { // get the number of time tracks and iterate through them - for (TimeTrack* track : mTracks) + for (TimeTrack* track : m_tracks) { delete track; } - mTracks.clear(); + m_tracks.clear(); SetRedrawFlag(); } TimeTrack* TimeViewPlugin::FindTrackByElement(TimeTrackElement* element) const { - const auto foundTrack = AZStd::find_if(begin(mTracks), end(mTracks), [element](const TimeTrack* timeTrack) + const auto foundTrack = AZStd::find_if(begin(m_tracks), end(m_tracks), [element](const TimeTrack* timeTrack) { // get the number of time track elements and iterate through them const size_t numElements = timeTrack->GetNumElements(); @@ -317,15 +317,15 @@ namespace EMStudio } return false; }); - return foundTrack != end(mTracks) ? *foundTrack : nullptr; + return foundTrack != end(m_tracks) ? *foundTrack : nullptr; } AZ::Outcome TimeViewPlugin::FindTrackIndex(const TimeTrack* track) const { - const auto foundTrack = AZStd::find(begin(mTracks), end(mTracks), track); - if (foundTrack != end(mTracks)) + const auto foundTrack = AZStd::find(begin(m_tracks), end(m_tracks), track); + if (foundTrack != end(m_tracks)) { - return AZ::Success(static_cast(AZStd::distance(begin(mTracks), foundTrack))); + return AZ::Success(static_cast(AZStd::distance(begin(m_tracks), foundTrack))); } return AZ::Failure(); } @@ -378,7 +378,7 @@ namespace EMStudio } if (outFrameNr) { - *outFrameNr = aznumeric_cast(timeValue / (double)mFPS); + *outFrameNr = aznumeric_cast(timeValue / (double)m_fps); } } @@ -388,10 +388,10 @@ namespace EMStudio { if (scaleXPixel) { - xPixel *= mTimeScale; + xPixel *= m_timeScale; } - const double pixelTime = ((xPixel + mScrollX) / mPixelsPerSecond); + const double pixelTime = ((xPixel + m_scrollX) / m_pixelsPerSecond); if (outPixelTime) { @@ -411,7 +411,7 @@ namespace EMStudio } if (outFrameNr) { - *outFrameNr = aznumeric_cast(pixelTime / (double)mFPS); + *outFrameNr = aznumeric_cast(pixelTime / (double)m_fps); } } @@ -423,11 +423,11 @@ namespace EMStudio return; } - if (mMotion) + if (m_motion) { - MotionInfo* motionInfo = FindMotionInfo(mMotion->GetID()); - motionInfo->mScale = mTargetTimeScale; - motionInfo->mScrollX = mTargetScrollX; + MotionInfo* motionInfo = FindMotionInfo(m_motion->GetID()); + motionInfo->m_scale = m_targetTimeScale; + motionInfo->m_scrollX = m_targetScrollX; } } @@ -436,20 +436,19 @@ namespace EMStudio void TimeViewPlugin::UpdateVisualData() { ValidatePluginLinks(); - mTrackDataHeaderWidget->update(); - mTrackDataWidget->update(); - mTimeInfoWidget->update(); - mDirty = false; + m_trackDataHeaderWidget->update(); + m_trackDataWidget->update(); + m_timeInfoWidget->update(); + m_dirty = false; } // calc the time value to a pixel value (excluding scroll) double TimeViewPlugin::TimeToPixel(double timeInSeconds, bool scale) const { - // return ((timeInSeconds * mPixelsPerSecond)/* / mTimeScale*/) - mScrollX; - double result = ((timeInSeconds * mPixelsPerSecond)) - mScrollX; + double result = ((timeInSeconds * m_pixelsPerSecond)) - m_scrollX; if (scale) { - return (result * mTimeScale); + return (result * m_timeScale); } else { @@ -462,10 +461,10 @@ namespace EMStudio TimeTrackElement* TimeViewPlugin::GetElementAt(int32 x, int32 y) { // for all tracks - for (const TimeTrack* track : mTracks) + for (const TimeTrack* track : m_tracks) { // check if the absolute pixel is inside - TimeTrackElement* result = track->GetElementAt(aznumeric_cast(x + mScrollX), y); + TimeTrackElement* result = track->GetElementAt(aznumeric_cast(x + m_scrollX), y); if (result) { return result; @@ -480,11 +479,11 @@ namespace EMStudio TimeTrack* TimeViewPlugin::GetTrackAt(int32 y) { // for all tracks - const auto foundTrack = AZStd::find_if(begin(mTracks), end(mTracks), [y](const TimeTrack* track) + const auto foundTrack = AZStd::find_if(begin(m_tracks), end(m_tracks), [y](const TimeTrack* track) { return track->GetIsInside(y); }); - return foundTrack != end(mTracks) ? *foundTrack : nullptr; + return foundTrack != end(m_tracks) ? *foundTrack : nullptr; } @@ -492,7 +491,7 @@ namespace EMStudio void TimeViewPlugin::UnselectAllElements() { // for all tracks - for (TimeTrack* track : mTracks) + for (TimeTrack* track : m_tracks) { // for all elements, deselect it const size_t numElems = track->GetNumElements(); @@ -510,7 +509,7 @@ namespace EMStudio // return the time of the current time marker, in seconds double TimeViewPlugin::GetCurrentTime() const { - return mCurTime; + return m_curTime; } @@ -518,39 +517,39 @@ namespace EMStudio { if (isScaledPixel) { - xPixel /= mTimeScale; + xPixel /= m_timeScale; } - return ((xPixel + mScrollX) / mPixelsPerSecond); + return ((xPixel + m_scrollX) / m_pixelsPerSecond); } void TimeViewPlugin::DeltaScrollX(double deltaX, bool animate) { - double newTime = (mTargetScrollX + (deltaX / mTimeScale)) / mPixelsPerSecond; - if (newTime < mMaxTime - (1 / mTimeScale)) + double newTime = (m_targetScrollX + (deltaX / m_timeScale)) / m_pixelsPerSecond; + if (newTime < m_maxTime - (1 / m_timeScale)) { - SetScrollX(mTargetScrollX + (deltaX / mTimeScale), animate); + SetScrollX(m_targetScrollX + (deltaX / m_timeScale), animate); } else { - SetScrollX((mMaxTime - ((1 / mTimeScale))) * mPixelsPerSecond, animate); + SetScrollX((m_maxTime - ((1 / m_timeScale))) * m_pixelsPerSecond, animate); } SetRedrawFlag(); } void TimeViewPlugin::SetScrollX(double scrollX, bool animate) { - mTargetScrollX = scrollX; + m_targetScrollX = scrollX; - if (mTargetScrollX < 0) + if (m_targetScrollX < 0) { - mTargetScrollX = 0; + m_targetScrollX = 0; } if (animate == false) { - mScrollX = mTargetScrollX; + m_scrollX = m_targetScrollX; } // inform the motion info about the changes @@ -563,11 +562,11 @@ namespace EMStudio void TimeViewPlugin::SetCurrentTime(double timeInSeconds) { const double oneMs = 1.0 / 1000.0; - if (!AZ::IsClose(mCurTime, timeInSeconds, oneMs)) + if (!AZ::IsClose(m_curTime, timeInSeconds, oneMs)) { - mDirty = true; + m_dirty = true; } - mCurTime = timeInSeconds; + m_curTime = timeInSeconds; } @@ -583,7 +582,7 @@ namespace EMStudio } // for all tracks - for (TimeTrack* track : mTracks) + for (TimeTrack* track : m_tracks) { if (track->GetIsVisible() == false || track->GetIsEnabled() == false) { @@ -624,7 +623,7 @@ namespace EMStudio void TimeViewPlugin::RenderElementTimeHandles(QPainter& painter, uint32 dataWindowHeight, const QPen& pen) { // for all tracks - for (const TimeTrack* track : mTracks) + for (const TimeTrack* track : m_tracks) { if (track->GetIsVisible() == false) { @@ -658,7 +657,7 @@ namespace EMStudio void TimeViewPlugin::DisableAllToolTips() { // for all tracks - for (const TimeTrack* track : mTracks) + for (const TimeTrack* track : m_tracks) { // for all elements const size_t numElems = track->GetNumElements(); @@ -676,7 +675,7 @@ namespace EMStudio bool TimeViewPlugin::FindResizePoint(int32 x, int32 y, TimeTrackElement** outElement, uint32* outID) { // for all tracks - for (const TimeTrack* track : mTracks) + for (const TimeTrack* track : m_tracks) { if (track->GetIsVisible() == false) { @@ -720,95 +719,95 @@ namespace EMStudio // render the frame void TimeViewPlugin::ProcessFrame(float timePassedInSeconds) { - if (GetManager()->GetAvoidRendering() || mMainWidget->visibleRegion().isEmpty()) + if (GetManager()->GetAvoidRendering() || m_mainWidget->visibleRegion().isEmpty()) { return; } - mTotalTime += timePassedInSeconds; + m_totalTime += timePassedInSeconds; ValidatePluginLinks(); // animate the zoom - mScrollX += (mTargetScrollX - mScrollX) * 0.2; + m_scrollX += (m_targetScrollX - m_scrollX) * 0.2; - mIsAnimating = false; - if (mTargetTimeScale > mTimeScale) + m_isAnimating = false; + if (m_targetTimeScale > m_timeScale) { - if (MCore::Math::Abs(aznumeric_cast(mTargetScrollX - mScrollX)) <= 1) + if (MCore::Math::Abs(aznumeric_cast(m_targetScrollX - m_scrollX)) <= 1) { - mTimeScale += (mTargetTimeScale - mTimeScale) * 0.1; + m_timeScale += (m_targetTimeScale - m_timeScale) * 0.1; } } else { - mTimeScale += (mTargetTimeScale - mTimeScale) * 0.1; + m_timeScale += (m_targetTimeScale - m_timeScale) * 0.1; } - if (MCore::Math::Abs(aznumeric_cast(mTargetScrollX - mScrollX)) <= 1) + if (MCore::Math::Abs(aznumeric_cast(m_targetScrollX - m_scrollX)) <= 1) { - mScrollX = mTargetScrollX; + m_scrollX = m_targetScrollX; } else { - mIsAnimating = true; + m_isAnimating = true; } - if (MCore::Math::Abs(aznumeric_cast(mTargetTimeScale - mTimeScale)) <= 0.001) + if (MCore::Math::Abs(aznumeric_cast(m_targetTimeScale - m_timeScale)) <= 0.001) { - mTimeScale = mTargetTimeScale; + m_timeScale = m_targetTimeScale; } else { - mIsAnimating = true; + m_isAnimating = true; } // get the maximum time - GetDataTimes(&mMaxTime, nullptr, nullptr); + GetDataTimes(&m_maxTime, nullptr, nullptr); UpdateMaxHeight(); - mTrackDataWidget->UpdateRects(); + m_trackDataWidget->UpdateRects(); - if (MCore::Math::Abs(aznumeric_cast(mMaxHeight - mLastMaxHeight)) > 0.0001) + if (MCore::Math::Abs(aznumeric_cast(m_maxHeight - m_lastMaxHeight)) > 0.0001) { - mLastMaxHeight = mMaxHeight; + m_lastMaxHeight = m_maxHeight; } - if (mTrackDataWidget->mDragging == false && mTrackDataWidget->mResizing == false) + if (m_trackDataWidget->m_dragging == false && m_trackDataWidget->m_resizing == false) { - mTimeInfoWidget->SetOverwriteTime(PixelToTime(mCurMouseX), mMaxTime); + m_timeInfoWidget->SetOverwriteTime(PixelToTime(m_curMouseX), m_maxTime); } // update the hovering items - mEventEmitterNode = nullptr; - mActorInstanceData = mTrackDataWidget->FindActorInstanceData(); + m_eventEmitterNode = nullptr; + m_actorInstanceData = m_trackDataWidget->FindActorInstanceData(); if (EMotionFX::GetRecorder().GetRecordTime() > MCore::Math::epsilon) { - mEventHistoryItem = mTrackDataWidget->FindEventHistoryItem(mActorInstanceData, aznumeric_cast(mCurMouseX), aznumeric_cast(mCurMouseY)); - mNodeHistoryItem = mTrackDataWidget->FindNodeHistoryItem(mActorInstanceData, aznumeric_cast(mCurMouseX), aznumeric_cast(mCurMouseY)); + m_eventHistoryItem = m_trackDataWidget->FindEventHistoryItem(m_actorInstanceData, aznumeric_cast(m_curMouseX), aznumeric_cast(m_curMouseY)); + m_nodeHistoryItem = m_trackDataWidget->FindNodeHistoryItem(m_actorInstanceData, aznumeric_cast(m_curMouseX), aznumeric_cast(m_curMouseY)); - if (mEventHistoryItem) + if (m_eventHistoryItem) { - EMotionFX::AnimGraph* animGraph = EMotionFX::GetAnimGraphManager().FindAnimGraphByID(mEventHistoryItem->mAnimGraphID); + EMotionFX::AnimGraph* animGraph = EMotionFX::GetAnimGraphManager().FindAnimGraphByID(m_eventHistoryItem->m_animGraphId); if (animGraph) { - mEventEmitterNode = animGraph->RecursiveFindNodeById(mEventHistoryItem->mEmitterNodeId); + m_eventEmitterNode = animGraph->RecursiveFindNodeById(m_eventHistoryItem->m_emitterNodeId); } } } else { - mActorInstanceData = nullptr; - mNodeHistoryItem = nullptr; - mEventHistoryItem = nullptr; + m_actorInstanceData = nullptr; + m_nodeHistoryItem = nullptr; + m_eventHistoryItem = nullptr; } switch (m_mode) { case TimeViewMode::Motion: { - double newCurrentTime = mCurTime; + double newCurrentTime = m_curTime; - if (!mMotion) + if (!m_motion) { // Use the start time when either no motion is selected. newCurrentTime = 0.0f; @@ -817,17 +816,17 @@ namespace EMStudio { const AZStd::vector& motionInstances = MotionWindowPlugin::GetSelectedMotionInstances(); if (motionInstances.size() == 1 && - motionInstances[0]->GetMotion() == mMotion) + motionInstances[0]->GetMotion() == m_motion) { EMotionFX::MotionInstance* motionInstance = motionInstances[0]; - if (!AZ::IsClose(aznumeric_cast(mCurTime), motionInstance->GetCurrentTime(), MCore::Math::epsilon)) + if (!AZ::IsClose(aznumeric_cast(m_curTime), motionInstance->GetCurrentTime(), MCore::Math::epsilon)) { newCurrentTime = motionInstance->GetCurrentTime(); } } } - if (!mTrackDataWidget->mDragging && !mTrackDataWidget->mResizing) + if (!m_trackDataWidget->m_dragging && !m_trackDataWidget->m_resizing) { SetCurrentTime(newCurrentTime); } @@ -843,12 +842,12 @@ namespace EMStudio if (recorder.GetIsInPlayMode() && recorder.GetIsInAutoPlayMode()) { SetCurrentTime(recorder.GetCurrentPlayTime()); - MakeTimeVisible(mCurTime, 0.5, false); + MakeTimeVisible(m_curTime, 0.5, false); } if (recorder.GetIsRecording()) { - SetCurrentTime(mMaxTime); + SetCurrentTime(m_maxTime); MakeTimeVisible(recorder.GetRecordTime(), 0.95, false); } } @@ -867,15 +866,15 @@ namespace EMStudio } } - if (mIsAnimating) + if (m_isAnimating) { - mDirty = true; + m_dirty = true; } bool redraw = false; float fps = 15.0f; #ifndef MCORE_DEBUG - if (mIsAnimating) + if (m_isAnimating) { fps = 60.0f; } @@ -885,13 +884,13 @@ namespace EMStudio } #endif - if (mTotalTime >= 1.0f / fps) + if (m_totalTime >= 1.0f / fps) { redraw = true; - mTotalTime = 0.0f; + m_totalTime = 0.0f; } - if (redraw && mDirty) + if (redraw && m_dirty) { UpdateVisualData(); } @@ -900,34 +899,26 @@ namespace EMStudio void TimeViewPlugin::SetRedrawFlag() { - mDirty = true; + m_dirty = true; } void TimeViewPlugin::UpdateViewSettings() { - SetScale(mTimeScale); + SetScale(m_timeScale); } void TimeViewPlugin::SetScale(double scale, bool animate) { - // if (mMaxTime < centerTime) - /* double rangeStart = PixelToTime( 0.0 ); - double rangeEnd = PixelToTime( mTrackDataWidget->geometry().width() ); - if (rangeEnd > mMaxTime) - rangeEnd = mMaxTime; - - double centerTime = (rangeStart + rangeEnd) / 2.0; - */ double curTime = GetCurrentTime(); - mTargetTimeScale = scale; - mTargetTimeScale = MCore::Clamp(scale, mMinScale, mMaxScale); + m_targetTimeScale = scale; + m_targetTimeScale = MCore::Clamp(scale, m_minScale, m_maxScale); if (animate == false) { - mTimeScale = mTargetTimeScale; + m_timeScale = m_targetTimeScale; } UpdateCurrentMotionInfo(); @@ -937,44 +928,6 @@ namespace EMStudio // MakeTimeVisible( centerTime, 0.5 ); } - // set the maximum time value - /*void TimeViewPlugin::SetMaxTime(double maxTime) - { - mMaxTime = maxTime; - mMaxTimeInPixels = (maxTime * TIMEVIEW_PIXELSPERSECOND) / mTimeScale; - - double oldSliderMax = mHorizontalScroll->maximum(); - double oldNormalizedValue = (double)mHorizontalScroll->value() / oldSliderMax; - - mHorizontalScroll->setRange( 0, mMaxTimeInPixels ); - mHorizontalScroll->setValue( oldNormalizedValue * mMaxTimeInPixels ); - } - - - // set the time view scale and keep it in a reasonable range - void TimeViewPlugin::SetTimeScale(float scale) - { - mTimeScale = scale; - - const float minScale = 0.01f; - //const float maxScale = 100.0f; - - if (mTimeScale < minScale) - mTimeScale = minScale; - - if (mTimeScale > mMaxScale) - mTimeScale = mMaxScale; - - // adjust the maximum time - SetMaxTime(mMaxTime); - - // adjust the current play time - SetCurrentTime( GetCurrentTime() ); - - // inform the motion info about the changes - UpdateCurrentMotionInfo(); - }*/ - void TimeViewPlugin::OnKeyPressEvent(QKeyEvent* event) { @@ -988,30 +941,30 @@ namespace EMStudio if (event->key() == Qt::Key_Down) { - mTrackDataWidget->scroll(0, 20); + m_trackDataWidget->scroll(0, 20); event->accept(); return; } if (event->key() == Qt::Key_Up) { - mTrackDataWidget->scroll(0, -20); + m_trackDataWidget->scroll(0, -20); event->accept(); return; } if (event->key() == Qt::Key_Plus) { - double zoomDelta = 0.1 * 3 * MCore::Clamp(mTargetTimeScale / 2.0, 1.0, 22.0); - SetScale(mTargetTimeScale + zoomDelta); + double zoomDelta = 0.1 * 3 * MCore::Clamp(m_targetTimeScale / 2.0, 1.0, 22.0); + SetScale(m_targetTimeScale + zoomDelta); event->accept(); return; } if (event->key() == Qt::Key_Minus) { - double zoomDelta = 0.1 * 3 * MCore::Clamp(mTargetTimeScale / 2.0, 1.0, 22.0); - SetScale(mTargetTimeScale - zoomDelta); + double zoomDelta = 0.1 * 3 * MCore::Clamp(m_targetTimeScale / 2.0, 1.0, 22.0); + SetScale(m_targetTimeScale - zoomDelta); event->accept(); return; } @@ -1020,10 +973,10 @@ namespace EMStudio { if (event->key() == Qt::Key_Left) { - mTargetScrollX -= (mPixelsPerSecond * 3) / mTimeScale; - if (mTargetScrollX < 0) + m_targetScrollX -= (m_pixelsPerSecond * 3) / m_timeScale; + if (m_targetScrollX < 0) { - mTargetScrollX = 0; + m_targetScrollX = 0; } event->accept(); return; @@ -1031,10 +984,10 @@ namespace EMStudio if (event->key() == Qt::Key_Right) { - const double newTime = (mScrollX + ((mPixelsPerSecond * 3) / mTimeScale)) / mPixelsPerSecond; - if (newTime < mMaxTime) + const double newTime = (m_scrollX + ((m_pixelsPerSecond * 3) / m_timeScale)) / m_pixelsPerSecond; + if (newTime < m_maxTime) { - mTargetScrollX += ((mPixelsPerSecond * 3) / mTimeScale); + m_targetScrollX += ((m_pixelsPerSecond * 3) / m_timeScale); } event->accept(); @@ -1065,10 +1018,10 @@ namespace EMStudio if (event->key() == Qt::Key_PageUp) { - mTargetScrollX -= mTrackDataWidget->geometry().width() / mTimeScale; - if (mTargetScrollX < 0) + m_targetScrollX -= m_trackDataWidget->geometry().width() / m_timeScale; + if (m_targetScrollX < 0) { - mTargetScrollX = 0; + m_targetScrollX = 0; } event->accept(); return; @@ -1076,10 +1029,10 @@ namespace EMStudio if (event->key() == Qt::Key_PageDown) { - const double newTime = (mScrollX + (mTrackDataWidget->geometry().width() / mTimeScale)) / mPixelsPerSecond; - if (newTime < mMaxTime) + const double newTime = (m_scrollX + (m_trackDataWidget->geometry().width() / m_timeScale)) / m_pixelsPerSecond; + if (newTime < m_maxTime) { - mTargetScrollX += mTrackDataWidget->geometry().width() / mTimeScale; + m_targetScrollX += m_trackDataWidget->geometry().width() / m_timeScale; } event->accept(); @@ -1106,9 +1059,9 @@ namespace EMStudio void TimeViewPlugin::ValidatePluginLinks() { - mMotionWindowPlugin = nullptr; - mMotionListWindow = nullptr; - mMotionEventsPlugin = nullptr; + m_motionWindowPlugin = nullptr; + m_motionListWindow = nullptr; + m_motionEventsPlugin = nullptr; m_motionSetPlugin = nullptr; EMStudio::PluginManager* pluginManager = EMStudio::GetPluginManager(); @@ -1116,9 +1069,9 @@ namespace EMStudio EMStudioPlugin* motionBasePlugin = pluginManager->FindActivePlugin(MotionWindowPlugin::CLASS_ID); if (motionBasePlugin) { - mMotionWindowPlugin = static_cast(motionBasePlugin); - mMotionListWindow = mMotionWindowPlugin->GetMotionListWindow(); - connect(mMotionListWindow, &MotionListWindow::MotionSelectionChanged, this, &TimeViewPlugin::MotionSelectionChanged, Qt::UniqueConnection); // UniqueConnection as we could connect multiple times. + m_motionWindowPlugin = static_cast(motionBasePlugin); + m_motionListWindow = m_motionWindowPlugin->GetMotionListWindow(); + connect(m_motionListWindow, &MotionListWindow::MotionSelectionChanged, this, &TimeViewPlugin::MotionSelectionChanged, Qt::UniqueConnection); // UniqueConnection as we could connect multiple times. } EMStudioPlugin* motionSetBasePlugin = pluginManager->FindActivePlugin(MotionSetsWindowPlugin::CLASS_ID); @@ -1131,8 +1084,8 @@ namespace EMStudio EMStudioPlugin* motionEventsBasePlugin = pluginManager->FindActivePlugin(MotionEventsPlugin::CLASS_ID); if (motionEventsBasePlugin) { - mMotionEventsPlugin = static_cast(motionEventsBasePlugin); - mMotionEventsPlugin->ValidatePluginLinks(); + m_motionEventsPlugin = static_cast(motionEventsBasePlugin); + m_motionEventsPlugin->ValidatePluginLinks(); } } @@ -1140,7 +1093,7 @@ namespace EMStudio void TimeViewPlugin::MotionSelectionChanged() { ValidatePluginLinks(); - if ((mMotionListWindow && mMotionListWindow->isVisible()) || + if ((m_motionListWindow && m_motionListWindow->isVisible()) || (m_motionSetPlugin && m_motionSetPlugin->GetMotionSetWindow() && m_motionSetPlugin->GetMotionSetWindow()->isVisible())) { SetMode(TimeViewMode::Motion); @@ -1150,14 +1103,14 @@ namespace EMStudio void TimeViewPlugin::UpdateSelection() { - mSelectedEvents.clear(); - if (!mMotion) + m_selectedEvents.clear(); + if (!m_motion) { return; } // get the motion event table - const EMotionFX::MotionEventTable* eventTable = mMotion->GetEventTable(); + const EMotionFX::MotionEventTable* eventTable = m_motion->GetEventTable(); // get the number of tracks in the time view and iterate through them const size_t numTracks = GetNumTracks(); @@ -1189,10 +1142,10 @@ namespace EMStudio if (element->GetIsSelected()) { EventSelectionItem selectionItem; - selectionItem.mMotion = mMotion; - selectionItem.mTrackNr = trackNr.GetValue(); - selectionItem.mEventNr = element->GetElementNumber(); - mSelectedEvents.emplace_back(selectionItem); + selectionItem.m_motion = m_motion; + selectionItem.m_trackNr = trackNr.GetValue(); + selectionItem.m_eventNr = element->GetElementNumber(); + m_selectedEvents.emplace_back(selectionItem); } } } @@ -1201,10 +1154,10 @@ namespace EMStudio void TimeViewPlugin::ReInit() { - if (EMotionFX::GetMotionManager().FindMotionIndex(mMotion) == InvalidIndex) + if (EMotionFX::GetMotionManager().FindMotionIndex(m_motion) == InvalidIndex) { // set the motion first back to nullptr - mMotion = nullptr; + m_motion = nullptr; } // update the selection and save it @@ -1217,16 +1170,16 @@ namespace EMStudio (EMotionFX::GetRecorder().GetIsRecording() || EMotionFX::GetRecorder().GetRecordTime() > MCore::Math::epsilon || EMotionFX::GetRecorder().GetIsInPlayMode())) { SetScrollX(0); - mTrackHeaderWidget->ReInit(); + m_trackHeaderWidget->ReInit(); return; } - if (mMotion) + if (m_motion) { size_t trackIndex; AZStd::string text; - const EMotionFX::MotionEventTable* eventTable = mMotion->GetEventTable(); + const EMotionFX::MotionEventTable* eventTable = m_motion->GetEventTable(); RemoveAllTracks(); @@ -1268,14 +1221,14 @@ namespace EMStudio timeTrack->AddElement(element); } - // Select the element if in mSelectedEvents. - for (const EventSelectionItem& selectionItem : mSelectedEvents) + // Select the element if in m_selectedEvents. + for (const EventSelectionItem& selectionItem : m_selectedEvents) { - if (mMotion != selectionItem.mMotion) + if (m_motion != selectionItem.m_motion) { continue; } - if (selectionItem.mTrackNr == trackIndex && selectionItem.mEventNr == eventIndex) + if (selectionItem.m_trackNr == trackIndex && selectionItem.m_eventNr == eventIndex) { element->SetIsSelected(true); break; @@ -1367,7 +1320,7 @@ namespace EMStudio timeTrack->SetElementCount(numMotionEvents); } } - else // mMotion == nullptr + else // m_motion == nullptr { const size_t numEventTracks = GetNumTracks(); for (size_t trackIndex = 0; trackIndex < numEventTracks; ++trackIndex) @@ -1385,27 +1338,26 @@ namespace EMStudio } // update the time view plugin - mTrackHeaderWidget->ReInit(); + m_trackHeaderWidget->ReInit(); - if (mMotion) + if (m_motion) { - //animationLength = mMotion->GetMaxTime(); - MotionInfo* motionInfo = FindMotionInfo(mMotion->GetID()); + MotionInfo* motionInfo = FindMotionInfo(m_motion->GetID()); // if we already selected before, set the remembered settings - if (motionInfo->mInitialized) + if (motionInfo->m_initialized) { - const int32 tempScroll = aznumeric_cast(motionInfo->mScrollX); - SetScale(motionInfo->mScale); + const int32 tempScroll = aznumeric_cast(motionInfo->m_scrollX); + SetScale(motionInfo->m_scale); SetScrollX(tempScroll); } else { // selected the animation the first time - motionInfo->mInitialized = true; - mTargetTimeScale = CalcFitScale(mMinScale, mMaxScale) * 0.8; - motionInfo->mScale = mTargetTimeScale; - motionInfo->mScrollX = 0.0; + motionInfo->m_initialized = true; + m_targetTimeScale = CalcFitScale(m_minScale, m_maxScale) * 0.8; + motionInfo->m_scale = m_targetTimeScale; + motionInfo->m_scrollX = 0.0; } } @@ -1416,27 +1368,27 @@ namespace EMStudio // find the motion info for the given motion id TimeViewPlugin::MotionInfo* TimeViewPlugin::FindMotionInfo(uint32 motionID) { - const auto foundMotionInfo = AZStd::find_if(begin(mMotionInfos), end(mMotionInfos), [motionID](const MotionInfo* motionInfo) + const auto foundMotionInfo = AZStd::find_if(begin(m_motionInfos), end(m_motionInfos), [motionID](const MotionInfo* motionInfo) { - return motionInfo->mMotionID == motionID; + return motionInfo->m_motionId == motionID; }); - if (foundMotionInfo != end(mMotionInfos)) + if (foundMotionInfo != end(m_motionInfos)) { return *foundMotionInfo; } // we haven't found a motion info for the given id yet, so create a new one MotionInfo* motionInfo = new MotionInfo(); - motionInfo->mMotionID = motionID; - motionInfo->mInitialized = false; - mMotionInfos.emplace_back(motionInfo); + motionInfo->m_motionId = motionID; + motionInfo->m_initialized = false; + m_motionInfos.emplace_back(motionInfo); return motionInfo; } void TimeViewPlugin::Select(const AZStd::vector& selection) { - mSelectedEvents = selection; + m_selectedEvents = selection; // get the number of tracks in the time view and iterate through them const size_t numTracks = GetNumTracks(); @@ -1455,8 +1407,8 @@ namespace EMStudio for (const EventSelectionItem& selectionItem : selection) { - TimeTrack* track = GetTrack(selectionItem.mTrackNr); - TimeTrackElement* element = track->GetElement(selectionItem.mEventNr); + TimeTrack* track = GetTrack(selectionItem.m_trackNr); + TimeTrackElement* element = track->GetElement(selectionItem.m_eventNr); element->SetIsSelected(true); } @@ -1472,23 +1424,23 @@ namespace EMStudio return nullptr; } - if (mEventNr >= eventTrack->GetNumEvents()) + if (m_eventNr >= eventTrack->GetNumEvents()) { return nullptr; } - return &(eventTrack->GetEvent(mEventNr)); + return &(eventTrack->GetEvent(m_eventNr)); } EMotionFX::MotionEventTrack* EventSelectionItem::GetEventTrack() { - if (mTrackNr >= mMotion->GetEventTable()->GetNumTracks()) + if (m_trackNr >= m_motion->GetEventTable()->GetNumTracks()) { return nullptr; } - EMotionFX::MotionEventTrack* eventTrack = mMotion->GetEventTable()->GetTrack(mTrackNr); + EMotionFX::MotionEventTrack* eventTrack = m_motion->GetEventTable()->GetTrack(m_trackNr); return eventTrack; } @@ -1496,7 +1448,7 @@ namespace EMStudio void TimeViewPlugin::AddMotionEvent(int32 x, int32 y) { - if (mMotion == nullptr) + if (m_motion == nullptr) { return; } @@ -1560,7 +1512,7 @@ namespace EMStudio } // get the corresponding motion event track - EMotionFX::MotionEventTable* eventTable = mMotion->GetEventTable(); + EMotionFX::MotionEventTable* eventTable = m_motion->GetEventTable(); EMotionFX::MotionEventTrack* eventTrack = eventTable->FindTrackByName(timeTrack->GetName()); if (eventTrack == nullptr) { @@ -1575,7 +1527,7 @@ namespace EMStudio // adjust the motion event AZStd::string outResult, command; - command = AZStd::string::format("AdjustMotionEvent -motionID %i -eventTrackName \"%s\" -eventNr %zu -startTime %f -endTime %f", mMotion->GetID(), eventTrack->GetName(), motionEventNr, startTime, endTime); + command = AZStd::string::format("AdjustMotionEvent -motionID %i -eventTrackName \"%s\" -eventNr %zu -startTime %f -endTime %f", m_motion->GetID(), eventTrack->GetName(), motionEventNr, startTime, endTime); if (EMStudio::GetCommandManager()->ExecuteCommand(command.c_str(), outResult) == false) { MCore::LogError(outResult.c_str()); @@ -1589,23 +1541,23 @@ namespace EMStudio AZStd::string result; MCore::CommandGroup commandGroup("Remove motion events"); - if (mTrackDataWidget) + if (m_trackDataWidget) { - mTrackDataWidget->ClearState(); + m_trackDataWidget->ClearState(); } - if (mMotion == nullptr) + if (m_motion == nullptr) { return; } - if (EMotionFX::GetMotionManager().FindMotionIndex(mMotion) == InvalidIndex) + if (EMotionFX::GetMotionManager().FindMotionIndex(m_motion) == InvalidIndex) { return; } // get the motion event table - // MotionEventTable& eventTable = mMotion->GetEventTable(); + // MotionEventTable& eventTable = m_motion->GetEventTable(); AZStd::vector eventNumbers; // get the number of tracks in the time view and iterate through them @@ -1653,18 +1605,17 @@ namespace EMStudio AZStd::string result; MCore::CommandGroup commandGroup("Remove motion events"); - if (mMotion == nullptr) + if (m_motion == nullptr) { return; } - if (EMotionFX::GetMotionManager().FindMotionIndex(mMotion) == InvalidIndex) + if (EMotionFX::GetMotionManager().FindMotionIndex(m_motion) == InvalidIndex) { return; } // get the motion event table - // MotionEventTable& eventTable = mMotion->GetEventTable(); AZStd::vector eventNumbers; // get the number of tracks in the time view and iterate through them @@ -1732,11 +1683,11 @@ namespace EMStudio if (outClipStart) { - *outClipStart = playbackInfo->mClipStartTime; + *outClipStart = playbackInfo->m_clipStartTime; } if (outClipEnd) { - *outClipEnd = playbackInfo->mClipEndTime; + *outClipEnd = playbackInfo->m_clipEndTime; } if (outMaxTime) { @@ -1770,8 +1721,8 @@ namespace EMStudio // zoom to fit void TimeViewPlugin::ZoomToFit() { - mTargetScrollX = 0.0; - mTargetTimeScale = CalcFitScale(mMinScale, mMaxScale); + m_targetScrollX = 0.0; + m_targetTimeScale = CalcFitScale(m_minScale, m_maxScale); } @@ -1786,8 +1737,8 @@ namespace EMStudio double scale = 1.0; if (maxTime > 0.0) { - double width = mTrackDataWidget->geometry().width(); - scale = (width / mPixelsPerSecond) / maxTime; + double width = m_trackDataWidget->geometry().width(); + scale = (width / m_pixelsPerSecond) / maxTime; } if (scale < minScale) @@ -1808,7 +1759,7 @@ namespace EMStudio bool TimeViewPlugin::GetIsTimeVisible(double timeValue) const { const double pixel = TimeToPixel(timeValue); - return (pixel >= 0.0 && pixel < mTrackDataWidget->geometry().width()); + return (pixel >= 0.0 && pixel < m_trackDataWidget->geometry().width()); } @@ -1820,17 +1771,17 @@ namespace EMStudio const double pixel = TimeToPixel(timeValue, false); // if we need to scroll to the right - double width = mTrackDataWidget->geometry().width() / mTimeScale; - mTargetScrollX += (pixel - width) + width * (1.0 - offsetFactor); + double width = m_trackDataWidget->geometry().width() / m_timeScale; + m_targetScrollX += (pixel - width) + width * (1.0 - offsetFactor); - if (mTargetScrollX < 0) + if (m_targetScrollX < 0) { - mTargetScrollX = 0; + m_targetScrollX = 0; } if (animate == false) { - mScrollX = mTargetScrollX; + m_scrollX = m_targetScrollX; } } @@ -1838,7 +1789,7 @@ namespace EMStudio // update the maximum height void TimeViewPlugin::UpdateMaxHeight() { - mMaxHeight = 0.0; + m_maxHeight = 0.0; // find the selected actor instance EMotionFX::Recorder& recorder = EMotionFX::GetRecorder(); @@ -1851,7 +1802,7 @@ namespace EMStudio const size_t actorInstanceDataIndex = recorder.FindActorInstanceDataIndex(actorInstance); if (actorInstanceDataIndex != InvalidIndex) { - RecorderGroup* recorderGroup = mTimeViewToolBar->GetRecorderGroup(); + RecorderGroup* recorderGroup = m_timeViewToolBar->GetRecorderGroup(); const bool displayNodeActivity = recorderGroup->GetDisplayNodeActivity(); const bool displayEvents = recorderGroup->GetDisplayMotionEvents(); const bool displayRelativeGraph = recorderGroup->GetDisplayRelativeGraph(); @@ -1860,7 +1811,7 @@ namespace EMStudio const EMotionFX::Recorder::ActorInstanceData& actorInstanceData = recorder.GetActorInstanceData(actorInstanceDataIndex); if (displayNodeActivity) { - mMaxHeight += ((recorder.CalcMaxNodeHistoryTrackIndex(actorInstanceData) + 1) * (mTrackDataWidget->mNodeHistoryItemHeight + 3)); + m_maxHeight += ((recorder.CalcMaxNodeHistoryTrackIndex(actorInstanceData) + 1) * (m_trackDataWidget->m_nodeHistoryItemHeight + 3)); isTop = false; } @@ -1868,18 +1819,18 @@ namespace EMStudio { if (isTop == false) { - mMaxHeight += 10 + 10; + m_maxHeight += 10 + 10; } isTop = false; - mMaxHeight += mTrackDataWidget->mEventHistoryTotalHeight; + m_maxHeight += m_trackDataWidget->m_eventHistoryTotalHeight; } if (displayRelativeGraph) { if (isTop == false) { - mMaxHeight += 10; + m_maxHeight += 10; } isTop = false; @@ -1889,17 +1840,17 @@ namespace EMStudio } else { - if (mMotion) + if (m_motion) { - for (const TimeTrack* track : mTracks) + for (const TimeTrack* track : m_tracks) { if (track->GetIsVisible() == false) { continue; } - mMaxHeight += track->GetHeight(); - mMaxHeight += 1; + m_maxHeight += track->GetHeight(); + m_maxHeight += 1; } } } @@ -1910,39 +1861,37 @@ namespace EMStudio void TimeViewPlugin::OnZoomAll() { ZoomToFit(); - //if (mTargetTimeScale < 1.0) - //mTargetTimeScale = 1.0; } // goto time zero void TimeViewPlugin::OnGotoTimeZero() { - mTargetScrollX = 0; + m_targetScrollX = 0; } // reset timeline void TimeViewPlugin::OnResetTimeline() { - mTargetScrollX = 0; - mTargetTimeScale = 1.0; + m_targetScrollX = 0; + m_targetTimeScale = 1.0; } // center on current time void TimeViewPlugin::OnCenterOnCurTime() { - MakeTimeVisible(mCurTime, 0.5); + MakeTimeVisible(m_curTime, 0.5); } // center on current time void TimeViewPlugin::OnShowNodeHistoryNodeInGraph() { - if (mNodeHistoryItem && mActorInstanceData) + if (m_nodeHistoryItem && m_actorInstanceData) { - emit DoubleClickedRecorderNodeHistoryItem(mActorInstanceData, mNodeHistoryItem); + emit DoubleClickedRecorderNodeHistoryItem(m_actorInstanceData, m_nodeHistoryItem); } } @@ -1950,9 +1899,9 @@ namespace EMStudio // center on current time void TimeViewPlugin::OnClickNodeHistoryNode() { - if (mNodeHistoryItem && mActorInstanceData) + if (m_nodeHistoryItem && m_actorInstanceData) { - emit ClickedRecorderNodeHistoryItem(mActorInstanceData, mNodeHistoryItem); + emit ClickedRecorderNodeHistoryItem(m_actorInstanceData, m_nodeHistoryItem); } } @@ -1960,17 +1909,17 @@ namespace EMStudio // zooming on rect void TimeViewPlugin::ZoomRect(const QRect& rect) { - mTargetScrollX = mScrollX + (rect.left() / mTimeScale); - mTargetTimeScale = mTrackDataWidget->geometry().width() / (double)(rect.width() / mTimeScale); + m_targetScrollX = m_scrollX + (rect.left() / m_timeScale); + m_targetTimeScale = m_trackDataWidget->geometry().width() / (double)(rect.width() / m_timeScale); - if (mTargetTimeScale < 1.0) + if (m_targetTimeScale < 1.0) { - mTargetTimeScale = 1.0; + m_targetTimeScale = 1.0; } - if (mTargetTimeScale > mMaxScale) + if (m_targetTimeScale > m_maxScale) { - mTargetTimeScale = mMaxScale; + m_targetTimeScale = m_maxScale; } } @@ -2070,7 +2019,7 @@ namespace EMStudio // calculate the content heights uint32 TimeViewPlugin::CalcContentHeight() const { - RecorderGroup* recorderGroup = mTimeViewToolBar->GetRecorderGroup(); + RecorderGroup* recorderGroup = m_timeViewToolBar->GetRecorderGroup(); const bool displayNodeActivity = recorderGroup->GetDisplayNodeActivity(); const bool displayEvents = recorderGroup->GetDisplayMotionEvents(); const bool displayRelativeGraph = recorderGroup->GetDisplayRelativeGraph(); @@ -2078,12 +2027,12 @@ namespace EMStudio uint32 result = 0; if (displayNodeActivity) { - result += mTrackDataWidget->mNodeHistoryRect.bottom(); + result += m_trackDataWidget->m_nodeHistoryRect.bottom(); } if (displayEvents) { - result += mTrackDataWidget->mEventHistoryTotalHeight; + result += m_trackDataWidget->m_eventHistoryTotalHeight; } if (displayRelativeGraph) @@ -2120,15 +2069,15 @@ namespace EMStudio case TimeViewMode::Motion: { EMotionFX::Motion* motion = GetCommandManager()->GetCurrentSelection().GetSingleMotion(); - if ((mMotion != motion) || modeChanged) + if ((m_motion != motion) || modeChanged) { - mMotion = motion; + m_motion = motion; ReInit(); } - if (mTrackHeaderWidget) + if (m_trackHeaderWidget) { - mTrackHeaderWidget->GetAddTrackWidget()->setEnabled(motion != nullptr); + m_trackHeaderWidget->GetAddTrackWidget()->setEnabled(motion != nullptr); } break; @@ -2136,13 +2085,13 @@ namespace EMStudio default: { - mMotion = nullptr; + m_motion = nullptr; ReInit(); OnZoomAll(); SetCurrentTime(0.0f); } } - mTimeViewToolBar->UpdateInterface(); + m_timeViewToolBar->UpdateInterface(); } } // namespace EMStudio diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/TimeView/TimeViewPlugin.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/TimeView/TimeViewPlugin.h index e6af4e1ae1..1eed525c41 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/TimeView/TimeViewPlugin.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/TimeView/TimeViewPlugin.h @@ -39,9 +39,9 @@ namespace EMStudio EMotionFX::MotionEvent* GetMotionEvent(); EMotionFX::MotionEventTrack* GetEventTrack(); - size_t mEventNr;// the motion event index in its track - size_t mTrackNr;// the corresponding track in which the event is in - EMotionFX::Motion* mMotion;// the parent motion of the event track + size_t m_eventNr;// the motion event index in its track + size_t m_trackNr;// the corresponding track in which the event is in + EMotionFX::Motion* m_motion;// the parent motion of the event track }; class TimeViewPlugin @@ -88,7 +88,7 @@ namespace EMStudio void SetMode(TimeViewMode mode); TimeViewMode GetMode() const { return m_mode; } - double GetScrollX() const { return mScrollX; } + double GetScrollX() const { return m_scrollX; } void DeltaScrollX(double deltaX, bool animate = true); @@ -108,15 +108,15 @@ namespace EMStudio double CalcFitScale(double minScale = 1.0, double maxScale = 100.0) const; void MakeTimeVisible(double timeValue, double offsetFactor = 0.95, bool animate = true); bool GetIsTimeVisible(double timeValue) const; - float GetTimeScale() const { return aznumeric_cast(mTimeScale); } + float GetTimeScale() const { return aznumeric_cast(m_timeScale); } void RenderElementTimeHandles(QPainter& painter, uint32 dataWindowHeight, const QPen& pen); void DisableAllToolTips(); void AddTrack(TimeTrack* track); void RemoveAllTracks(); - TimeTrack* GetTrack(size_t index) { return mTracks[index]; } - size_t GetNumTracks() const { return mTracks.size(); } + TimeTrack* GetTrack(size_t index) { return m_tracks[index]; } + size_t GetNumTracks() const { return m_tracks.size(); } AZ::Outcome FindTrackIndex(const TimeTrack* track) const; TimeTrack* FindTrackByElement(TimeTrackElement* element) const; @@ -132,15 +132,15 @@ namespace EMStudio bool FindResizePoint(int32 x, int32 y, TimeTrackElement** outElement, uint32* outID); - QCursor* GetZoomInCursor() const { return mZoomInCursor; } - QCursor* GetZoomOutCursor() const { return mZoomOutCursor; } + QCursor* GetZoomInCursor() const { return m_zoomInCursor; } + QCursor* GetZoomOutCursor() const { return m_zoomOutCursor; } // some getters - TrackDataHeaderWidget* GetTrackDataHeaderWidget() { return mTrackDataHeaderWidget; } - TrackDataWidget* GetTrackDataWidget() { return mTrackDataWidget; } - TrackHeaderWidget* GetTrackHeaderWidget() { return mTrackHeaderWidget; } - TimeInfoWidget* GetTimeInfoWidget() { return mTimeInfoWidget; } - TimeViewToolBar* GetTimeViewToolBar() { return mTimeViewToolBar; } + TrackDataHeaderWidget* GetTrackDataHeaderWidget() { return m_trackDataHeaderWidget; } + TrackDataWidget* GetTrackDataWidget() { return m_trackDataWidget; } + TrackHeaderWidget* GetTrackHeaderWidget() { return m_trackHeaderWidget; } + TimeInfoWidget* GetTimeInfoWidget() { return m_timeInfoWidget; } + TimeViewToolBar* GetTimeViewToolBar() { return m_timeViewToolBar; } void OnKeyPressEvent(QKeyEvent* event); void OnKeyReleaseEvent(QKeyEvent* event); @@ -151,12 +151,12 @@ namespace EMStudio void ZoomRect(const QRect& rect); - size_t GetNumSelectedEvents() { return mSelectedEvents.size(); } - EventSelectionItem GetSelectedEvent(size_t index) const { return mSelectedEvents[index]; } + size_t GetNumSelectedEvents() { return m_selectedEvents.size(); } + EventSelectionItem GetSelectedEvent(size_t index) const { return m_selectedEvents[index]; } void Select(const AZStd::vector& selection); - MCORE_INLINE EMotionFX::Motion* GetMotion() const { return mMotion; } + MCORE_INLINE EMotionFX::Motion* GetMotion() const { return m_motion; } void SetRedrawFlag(); uint32 CalcContentHeight() const; @@ -205,66 +205,66 @@ namespace EMStudio MCORE_DEFINECOMMANDCALLBACK(UpdateInterfaceCallback); AZStd::vector m_commandCallbacks; - TrackDataHeaderWidget* mTrackDataHeaderWidget; - TrackDataWidget* mTrackDataWidget; - TrackHeaderWidget* mTrackHeaderWidget; - TimeInfoWidget* mTimeInfoWidget; - TimeViewToolBar* mTimeViewToolBar; - QWidget* mMainWidget; + TrackDataHeaderWidget* m_trackDataHeaderWidget; + TrackDataWidget* m_trackDataWidget; + TrackHeaderWidget* m_trackHeaderWidget; + TimeInfoWidget* m_timeInfoWidget; + TimeViewToolBar* m_timeViewToolBar; + QWidget* m_mainWidget; TimeViewMode m_mode = TimeViewMode::None; - EMotionFX::Motion* mMotion; - MotionWindowPlugin* mMotionWindowPlugin; - MotionEventsPlugin* mMotionEventsPlugin; - MotionListWindow* mMotionListWindow; + EMotionFX::Motion* m_motion; + MotionWindowPlugin* m_motionWindowPlugin; + MotionEventsPlugin* m_motionEventsPlugin; + MotionListWindow* m_motionListWindow; MotionSetsWindowPlugin* m_motionSetPlugin; - AZStd::vector mSelectedEvents; + AZStd::vector m_selectedEvents; - EMotionFX::Recorder::ActorInstanceData* mActorInstanceData; - EMotionFX::Recorder::NodeHistoryItem* mNodeHistoryItem; - EMotionFX::Recorder::EventHistoryItem* mEventHistoryItem; - EMotionFX::AnimGraphNode* mEventEmitterNode; + EMotionFX::Recorder::ActorInstanceData* m_actorInstanceData; + EMotionFX::Recorder::NodeHistoryItem* m_nodeHistoryItem; + EMotionFX::Recorder::EventHistoryItem* m_eventHistoryItem; + EMotionFX::AnimGraphNode* m_eventEmitterNode; struct MotionInfo { - uint32 mMotionID; - bool mInitialized; - double mScale; - double mScrollX; + uint32 m_motionId; + bool m_initialized; + double m_scale; + double m_scrollX; }; MotionInfo* FindMotionInfo(uint32 motionID); void UpdateCurrentMotionInfo(); - AZStd::vector mMotionInfos; - AZStd::vector mTracks; + AZStd::vector m_motionInfos; + AZStd::vector m_tracks; - double mPixelsPerSecond; // pixels per second - double mScrollX; // horizontal scroll offset - double mCurTime; // current time - double mFPS; // the frame rate, used to snap time values to and to calculate frame numbers - double mCurMouseX; - double mCurMouseY; - double mMaxTime; // the end time of the full time bar - double mMaxHeight; - double mLastMaxHeight; - double mTimeScale; // the time zoom scale factor - double mMaxScale; - double mMinScale; - float mTotalTime; + double m_pixelsPerSecond; // pixels per second + double m_scrollX; // horizontal scroll offset + double m_curTime; // current time + double m_fps; // the frame rate, used to snap time values to and to calculate frame numbers + double m_curMouseX; + double m_curMouseY; + double m_maxTime; // the end time of the full time bar + double m_maxHeight; + double m_lastMaxHeight; + double m_timeScale; // the time zoom scale factor + double m_maxScale; + double m_minScale; + float m_totalTime; - double mTargetTimeScale; - double mTargetScrollX; + double m_targetTimeScale; + double m_targetScrollX; - bool mIsAnimating; - bool mDirty; + bool m_isAnimating; + bool m_dirty; - QCursor* mZoomInCursor; - QCursor* mZoomOutCursor; + QCursor* m_zoomInCursor; + QCursor* m_zoomOutCursor; - QPen mPenCurTimeHandle; - QPen mPenTimeHandles; - QPen mPenCurTimeHelper; - QBrush mBrushCurTimeHandle; + QPen m_penCurTimeHandle; + QPen m_penTimeHandles; + QPen m_penCurTimeHelper; + QBrush m_brushCurTimeHandle; }; } // namespace EMStudio diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/TimeView/TimeViewToolBar.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/TimeView/TimeViewToolBar.cpp index 618d5f2bf5..d95b606b3f 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/TimeView/TimeViewToolBar.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/TimeView/TimeViewToolBar.cpp @@ -32,7 +32,7 @@ namespace EMStudio { setObjectName("TimeViewToolBar"); - mPlugin = plugin; + m_plugin = plugin; m_recorderGroup = new RecorderGroup(plugin, this); m_playbackControls = new PlaybackControlsGroup(this); @@ -75,7 +75,7 @@ namespace EMStudio void TimeViewToolBar::OnPlayForwardButton() { - switch (mPlugin->GetMode()) + switch (m_plugin->GetMode()) { case TimeViewMode::Motion: { @@ -179,11 +179,11 @@ namespace EMStudio const float newTime = MCore::Min(EMotionFX::GetRecorder().GetCurrentPlayTime() + (1.0f / 60.0f), EMotionFX::GetRecorder().GetRecordTime()); EMotionFX::GetRecorder().SetCurrentPlayTime(newTime); - if (mPlugin) + if (m_plugin) { - mPlugin->SetCurrentTime(newTime); - mPlugin->GetTimeInfoWidget()->update(); - mPlugin->SetRedrawFlag(); + m_plugin->SetCurrentTime(newTime); + m_plugin->GetTimeInfoWidget()->update(); + m_plugin->SetRedrawFlag(); } } @@ -195,11 +195,11 @@ namespace EMStudio const float newTime = MCore::Max(EMotionFX::GetRecorder().GetCurrentPlayTime() - (1.0f / 60.0f), 0.0f); EMotionFX::GetRecorder().SetCurrentPlayTime(newTime); - if (mPlugin) + if (m_plugin) { - mPlugin->SetCurrentTime(newTime); - mPlugin->GetTimeInfoWidget()->update(); - mPlugin->SetRedrawFlag(); + m_plugin->SetCurrentTime(newTime); + m_plugin->GetTimeInfoWidget()->update(); + m_plugin->SetRedrawFlag(); } emit RecorderStateChanged(); @@ -221,10 +221,10 @@ namespace EMStudio case RecorderGroup::PlaybackRecording: { EMotionFX::GetRecorder().SetCurrentPlayTime(EMotionFX::GetRecorder().GetRecordTime()); - if (mPlugin) + if (m_plugin) { - mPlugin->SetCurrentTime(EMotionFX::GetRecorder().GetCurrentPlayTime()); - mPlugin->SetRedrawFlag(); + m_plugin->SetCurrentTime(EMotionFX::GetRecorder().GetCurrentPlayTime()); + m_plugin->SetRedrawFlag(); } break; } @@ -251,10 +251,10 @@ namespace EMStudio case RecorderGroup::PlaybackRecording: { EMotionFX::GetRecorder().SetCurrentPlayTime(0.0f); - if (mPlugin) + if (m_plugin) { - mPlugin->SetCurrentTime(EMotionFX::GetRecorder().GetCurrentPlayTime()); - mPlugin->SetRedrawFlag(); + m_plugin->SetCurrentTime(EMotionFX::GetRecorder().GetCurrentPlayTime()); + m_plugin->SetRedrawFlag(); } break; } @@ -294,28 +294,28 @@ namespace EMStudio } EMotionFX::Recorder::RecordSettings settings; - settings.mFPS = 1000000; - settings.mRecordTransforms = true; - settings.mRecordAnimGraphStates = true; - settings.mRecordNodeHistory = true; - settings.mRecordScale = true; - settings.mInitialAnimGraphAnimBytes = 4 * 1024 * 1024; // 4 mb - settings.mHistoryStatesOnly = m_recorderGroup->GetRecordStatesOnly(); - settings.mRecordEvents = m_recorderGroup->GetRecordEvents(); + settings.m_fps = 1000000; + settings.m_recordTransforms = true; + settings.m_recordAnimGraphStates = true; + settings.m_recordNodeHistory = true; + settings.m_recordScale = true; + settings.m_initialAnimGraphAnimBytes = 4 * 1024 * 1024; // 4 mb + settings.m_historyStatesOnly = m_recorderGroup->GetRecordStatesOnly(); + settings.m_recordEvents = m_recorderGroup->GetRecordEvents(); if (m_recorderGroup->GetRecordMotionsOnly()) { - settings.mNodeHistoryTypes.insert(azrtti_typeid()); + settings.m_nodeHistoryTypes.insert(azrtti_typeid()); } EMotionFX::GetRecorder().StartRecording(settings); // reinit the time view plugin - if (mPlugin) + if (m_plugin) { - mPlugin->ReInit(); - mPlugin->SetScale(1.0); - mPlugin->SetScrollX(0); + m_plugin->ReInit(); + m_plugin->SetScale(1.0); + m_plugin->SetScrollX(0); } } else @@ -326,13 +326,13 @@ namespace EMStudio EMotionFX::GetRecorder().SetCurrentPlayTime(0.0f); // reinit the time view plugin - if (mPlugin) + if (m_plugin) { - mPlugin->ReInit(); - mPlugin->OnZoomAll(); - mPlugin->SetCurrentTime(0.0f); - mPlugin->GetTrackDataWidget()->setFocus(); - mPlugin->GetTrackDataHeaderWidget()->setFocus(); + m_plugin->ReInit(); + m_plugin->OnZoomAll(); + m_plugin->SetCurrentTime(0.0f); + m_plugin->GetTrackDataWidget()->setFocus(); + m_plugin->GetTrackDataHeaderWidget()->setFocus(); } } @@ -347,12 +347,12 @@ namespace EMStudio UpdateInterface(); // reinit the time view plugin - if (mPlugin) + if (m_plugin) { - mPlugin->ReInit(); - mPlugin->SetScale(1.0); - mPlugin->SetScrollX(0); - mPlugin->SetCurrentTime(0.0f); + m_plugin->ReInit(); + m_plugin->SetScale(1.0); + m_plugin->SetScrollX(0); + m_plugin->SetCurrentTime(0.0f); } emit RecorderStateChanged(); @@ -377,11 +377,11 @@ namespace EMStudio continue; } - EMotionFX::Motion* motion = entry->mMotion; + EMotionFX::Motion* motion = entry->m_motion; EMotionFX::PlayBackInfo* playbackInfo = motion->GetDefaultPlayBackInfo(); AZStd::string commandParameters; - if (MCore::Compare::CheckIfIsClose(playbackInfo->mPlaySpeed, m_playbackOptions->GetPlaySpeed(), 0.001f) == false) + if (MCore::Compare::CheckIfIsClose(playbackInfo->m_playSpeed, m_playbackOptions->GetPlaySpeed(), 0.001f) == false) { commandParameters += AZStd::string::format("-playSpeed %f ", m_playbackOptions->GetPlaySpeed()); } @@ -397,25 +397,25 @@ namespace EMStudio } const bool mirrorMotion = m_playbackOptions->GetMirrorMotion(); - if (playbackInfo->mMirrorMotion != mirrorMotion) + if (playbackInfo->m_mirrorMotion != mirrorMotion) { commandParameters += AZStd::string::format("-mirrorMotion %s ", AZStd::to_string(mirrorMotion).c_str()); } const EMotionFX::EPlayMode playMode = m_playbackOptions->GetPlayMode(); - if (playbackInfo->mPlayMode != playMode) + if (playbackInfo->m_playMode != playMode) { commandParameters += AZStd::string::format("-playMode %i ", static_cast(playMode)); } const bool inPlace = m_playbackOptions->GetInPlace(); - if (playbackInfo->mInPlace != inPlace) + if (playbackInfo->m_inPlace != inPlace) { commandParameters += AZStd::string::format("-inPlace %s ", AZStd::to_string(inPlace).c_str()); } const bool retarget = m_playbackOptions->GetRetarget(); - if (playbackInfo->mRetarget != retarget) + if (playbackInfo->m_retarget != retarget) { commandParameters += AZStd::string::format("-retarget %s ", AZStd::to_string(retarget).c_str()); } @@ -437,7 +437,7 @@ namespace EMStudio void TimeViewToolBar::UpdateInterface() { - const TimeViewMode mode = mPlugin->GetMode(); + const TimeViewMode mode = m_plugin->GetMode(); const bool playbackOptionsVisible = m_playbackOptions->UpdateInterface(mode, /*showRightSeparator=*/false); const bool playbackControlsVisible = m_playbackControls->UpdateInterface(mode, /*showRightSeparator=*/playbackOptionsVisible); @@ -446,15 +446,15 @@ namespace EMStudio void TimeViewToolBar::OnDetailedNodes() { - mPlugin->SetRedrawFlag(); + m_plugin->SetRedrawFlag(); if (!m_recorderGroup->GetDetailedNodes()) { - mPlugin->mTrackDataWidget->mNodeHistoryItemHeight = 20; + m_plugin->m_trackDataWidget->m_nodeHistoryItemHeight = 20; } else { - mPlugin->mTrackDataWidget->mNodeHistoryItemHeight = 35; + m_plugin->m_trackDataWidget->m_nodeHistoryItemHeight = 35; } } diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/TimeView/TimeViewToolBar.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/TimeView/TimeViewToolBar.h index 0e2abbc594..eda6337832 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/TimeView/TimeViewToolBar.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/TimeView/TimeViewToolBar.h @@ -63,7 +63,7 @@ namespace EMStudio RecorderGroup::RecordingMode GetCurrentRecordingMode() const; private: - TimeViewPlugin* mPlugin = nullptr; + TimeViewPlugin* m_plugin = nullptr; RecorderGroup* m_recorderGroup; PlaybackControlsGroup* m_playbackControls; diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/TimeView/TrackDataHeaderWidget.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/TimeView/TrackDataHeaderWidget.cpp index a70a12dbeb..0d1f55c172 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/TimeView/TrackDataHeaderWidget.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/TimeView/TrackDataHeaderWidget.cpp @@ -49,46 +49,46 @@ namespace EMStudio TrackDataHeaderWidget::TrackDataHeaderWidget(TimeViewPlugin* plugin, QWidget* parent) : QOpenGLWidget(parent) , QOpenGLFunctions() - , mPlugin(plugin) - , mLastMouseX(0) - , mLastMouseY(0) - , mMouseLeftClicked(false) - , mMouseRightClicked(false) - , mMouseMidClicked(false) - , mIsScrolling(false) - , mAllowContextMenu(true) + , m_plugin(plugin) + , m_lastMouseX(0) + , m_lastMouseY(0) + , m_mouseLeftClicked(false) + , m_mouseRightClicked(false) + , m_mouseMidClicked(false) + , m_isScrolling(false) + , m_allowContextMenu(true) { setObjectName("TrackDataHeaderWidget"); // init brushes and pens - mBrushBackgroundOutOfRange = QBrush(QColor(35, 35, 35), Qt::SolidPattern); + m_brushBackgroundOutOfRange = QBrush(QColor(35, 35, 35), Qt::SolidPattern); - mHeaderGradientActive = QLinearGradient(0, 0, 0, 35); - mHeaderGradientActive.setColorAt(1.0f, QColor(100, 105, 110)); - mHeaderGradientActive.setColorAt(0.5f, QColor(30, 35, 40)); - mHeaderGradientActive.setColorAt(0.0f, QColor(20, 20, 20)); + m_headerGradientActive = QLinearGradient(0, 0, 0, 35); + m_headerGradientActive.setColorAt(1.0f, QColor(100, 105, 110)); + m_headerGradientActive.setColorAt(0.5f, QColor(30, 35, 40)); + m_headerGradientActive.setColorAt(0.0f, QColor(20, 20, 20)); - mHeaderGradientActiveFocus = QLinearGradient(0, 0, 0, 35); - mHeaderGradientActiveFocus.setColorAt(1.0f, QColor(100, 105, 130)); - mHeaderGradientActiveFocus.setColorAt(0.5f, QColor(30, 35, 40)); - mHeaderGradientActiveFocus.setColorAt(0.0f, QColor(20, 20, 20)); + m_headerGradientActiveFocus = QLinearGradient(0, 0, 0, 35); + m_headerGradientActiveFocus.setColorAt(1.0f, QColor(100, 105, 130)); + m_headerGradientActiveFocus.setColorAt(0.5f, QColor(30, 35, 40)); + m_headerGradientActiveFocus.setColorAt(0.0f, QColor(20, 20, 20)); - mHeaderGradientInactive = QLinearGradient(0, 0, 0, 35); - mHeaderGradientInactive.setColorAt(1.0f, QColor(30, 30, 30)); - mHeaderGradientInactive.setColorAt(0.0f, QColor(20, 20, 20)); + m_headerGradientInactive = QLinearGradient(0, 0, 0, 35); + m_headerGradientInactive.setColorAt(1.0f, QColor(30, 30, 30)); + m_headerGradientInactive.setColorAt(0.0f, QColor(20, 20, 20)); - mHeaderGradientInactiveFocus = QLinearGradient(0, 0, 0, 35); - mHeaderGradientInactiveFocus.setColorAt(1.0f, QColor(30, 30, 30)); - mHeaderGradientInactiveFocus.setColorAt(0.0f, QColor(20, 20, 20)); + m_headerGradientInactiveFocus = QLinearGradient(0, 0, 0, 35); + m_headerGradientInactiveFocus.setColorAt(1.0f, QColor(30, 30, 30)); + m_headerGradientInactiveFocus.setColorAt(0.0f, QColor(20, 20, 20)); - mPenMainTimeStepLinesActive = QPen(QColor(110, 110, 110)); + m_penMainTimeStepLinesActive = QPen(QColor(110, 110, 110)); - mTimeLineFont.setPixelSize(12); - mDataFont.setPixelSize(13); + m_timeLineFont.setPixelSize(12); + m_dataFont.setPixelSize(13); // load the time handle top image QDir imageName{ QString(MysticQt::GetMysticQt()->GetDataDir().c_str()) }; - mTimeHandleTop = QPixmap(imageName.filePath("Images/Icons/TimeHandleTop.png")); + m_timeHandleTop = QPixmap(imageName.filePath("Images/Icons/TimeHandleTop.png")); setMouseTracking(true); setAcceptDrops(true); @@ -117,9 +117,9 @@ namespace EMStudio { MCORE_UNUSED(w); MCORE_UNUSED(h); - if (mPlugin) + if (m_plugin) { - mPlugin->SetRedrawFlag(); + m_plugin->SetRedrawFlag(); } } @@ -135,16 +135,16 @@ namespace EMStudio // draw a background rect painter.setPen(Qt::NoPen); - painter.setBrush(mBrushBackgroundOutOfRange); + painter.setBrush(m_brushBackgroundOutOfRange); painter.drawRect(rect); - painter.setFont(mDataFont); + painter.setFont(m_dataFont); // draw the timeline painter.setRenderHint(QPainter::Antialiasing, false); DrawTimeLine(painter, rect); const uint32 height = geometry().height(); - mPlugin->RenderElementTimeHandles(painter, height, mPlugin->mPenTimeHandles); + m_plugin->RenderElementTimeHandles(painter, height, m_plugin->m_penTimeHandles); DrawTimeMarker(painter, rect); } @@ -154,10 +154,10 @@ namespace EMStudio { // draw the current time marker float startHeight = 0.0f; - const float curTimeX = aznumeric_cast(mPlugin->TimeToPixel(mPlugin->mCurTime)); - painter.drawPixmap(aznumeric_cast(curTimeX - (mTimeHandleTop.width() / 2) - 1), 0, mTimeHandleTop); + const float curTimeX = aznumeric_cast(m_plugin->TimeToPixel(m_plugin->m_curTime)); + painter.drawPixmap(aznumeric_cast(curTimeX - (m_timeHandleTop.width() / 2) - 1), 0, m_timeHandleTop); - painter.setPen(mPlugin->mPenCurTimeHandle); + painter.setPen(m_plugin->m_penCurTimeHandle); painter.drawLine(QPointF(curTimeX, startHeight), QPointF(curTimeX, rect.bottom())); } @@ -169,52 +169,52 @@ namespace EMStudio } // if double clicked in the timeline - mPlugin->MakeTimeVisible(mPlugin->PixelToTime(event->x()), 0.5); + m_plugin->MakeTimeVisible(m_plugin->PixelToTime(event->x()), 0.5); } // when the mouse is moving, while a button is pressed void TrackDataHeaderWidget::mouseMoveEvent(QMouseEvent* event) { - mPlugin->SetRedrawFlag(); + m_plugin->SetRedrawFlag(); - const int32 deltaRelX = event->x() - mLastMouseX; - mLastMouseX = event->x(); - mPlugin->mCurMouseX = event->x(); - mPlugin->mCurMouseY = event->y(); + const int32 deltaRelX = event->x() - m_lastMouseX; + m_lastMouseX = event->x(); + m_plugin->m_curMouseX = event->x(); + m_plugin->m_curMouseY = event->y(); - const int32 deltaRelY = event->y() - mLastMouseY; - mLastMouseY = event->y(); + const int32 deltaRelY = event->y() - m_lastMouseY; + m_lastMouseY = event->y(); const bool altPressed = event->modifiers() & Qt::AltModifier; - const bool isZooming = mMouseLeftClicked == false && mMouseRightClicked && altPressed; - const bool isPanning = mMouseLeftClicked == false && isZooming == false && (mMouseMidClicked || mMouseRightClicked); + const bool isZooming = m_mouseLeftClicked == false && m_mouseRightClicked && altPressed; + const bool isPanning = m_mouseLeftClicked == false && isZooming == false && (m_mouseMidClicked || m_mouseRightClicked); if (deltaRelY != 0) { - mAllowContextMenu = false; + m_allowContextMenu = false; } - if (mMouseRightClicked) + if (m_mouseRightClicked) { - mIsScrolling = true; + m_isScrolling = true; } // if the mouse left button is pressed - if (mMouseLeftClicked) + if (m_mouseLeftClicked) { // update the current time marker int newX = event->x(); newX = AZ::GetClamp(newX, 0, geometry().width() - 1); - mPlugin->mCurTime = mPlugin->PixelToTime(newX); + m_plugin->m_curTime = m_plugin->PixelToTime(newX); EMotionFX::Recorder& recorder = EMotionFX::GetRecorder(); if (recorder.GetRecordTime() > AZ::Constants::FloatEpsilon) { if (recorder.GetIsInPlayMode()) { - recorder.SetCurrentPlayTime(aznumeric_cast(mPlugin->GetCurrentTime())); + recorder.SetCurrentPlayTime(aznumeric_cast(m_plugin->GetCurrentTime())); recorder.SetAutoPlay(false); - emit mPlugin->ManualTimeChange(aznumeric_cast(mPlugin->GetCurrentTime())); + emit m_plugin->ManualTimeChange(aznumeric_cast(m_plugin->GetCurrentTime())); } } else @@ -223,33 +223,33 @@ namespace EMStudio if (motionInstances.size() == 1) { EMotionFX::MotionInstance* motionInstance = motionInstances[0]; - motionInstance->SetCurrentTime(aznumeric_cast(mPlugin->GetCurrentTime()), false); + motionInstance->SetCurrentTime(aznumeric_cast(m_plugin->GetCurrentTime()), false); motionInstance->SetPause(true); - emit mPlugin->ManualTimeChange(aznumeric_cast(mPlugin->GetCurrentTime())); + emit m_plugin->ManualTimeChange(aznumeric_cast(m_plugin->GetCurrentTime())); } } - mIsScrolling = true; + m_isScrolling = true; } else if (isPanning) { if (EMotionFX::GetRecorder().GetIsRecording() == false) { - mPlugin->DeltaScrollX(-deltaRelX, false); + m_plugin->DeltaScrollX(-deltaRelX, false); } } else if (isZooming) { if (deltaRelY < 0) { - setCursor(*(mPlugin->GetZoomOutCursor())); + setCursor(*(m_plugin->GetZoomOutCursor())); } else { - setCursor(*(mPlugin->GetZoomInCursor())); + setCursor(*(m_plugin->GetZoomInCursor())); } - DoMouseYMoveZoom(deltaRelY, mPlugin); + DoMouseYMoveZoom(deltaRelY, m_plugin); } else // no left mouse button is pressed { @@ -275,43 +275,43 @@ namespace EMStudio void TrackDataHeaderWidget::UpdateMouseOverCursor() { // disable all tooltips - mPlugin->DisableAllToolTips(); + m_plugin->DisableAllToolTips(); } // when the mouse is pressed void TrackDataHeaderWidget::mousePressEvent(QMouseEvent* event) { - mPlugin->SetRedrawFlag(); + m_plugin->SetRedrawFlag(); const bool ctrlPressed = event->modifiers() & Qt::ControlModifier; const bool shiftPressed = event->modifiers() & Qt::ShiftModifier; const bool altPressed = event->modifiers() & Qt::AltModifier; // store the last clicked position - mAllowContextMenu = true; + m_allowContextMenu = true; if (event->button() == Qt::RightButton) { - mMouseRightClicked = true; + m_mouseRightClicked = true; } if (event->button() == Qt::MidButton) { - mMouseMidClicked = true; + m_mouseMidClicked = true; } if (event->button() == Qt::LeftButton) { - mMouseLeftClicked = true; + m_mouseLeftClicked = true; EMotionFX::Recorder& recorder = EMotionFX::GetRecorder(); - if (!mPlugin->mNodeHistoryItem && !altPressed) + if (!m_plugin->m_nodeHistoryItem && !altPressed) { // update the current time marker int newX = event->x(); newX = AZ::GetClamp(newX, 0, geometry().width() - 1); - mPlugin->mCurTime = mPlugin->PixelToTime(newX); + m_plugin->m_curTime = m_plugin->PixelToTime(newX); if (recorder.GetRecordTime() > AZ::Constants::FloatEpsilon) { @@ -320,10 +320,10 @@ namespace EMStudio recorder.StartPlayBack(); } - recorder.SetCurrentPlayTime(aznumeric_cast(mPlugin->GetCurrentTime())); + recorder.SetCurrentPlayTime(aznumeric_cast(m_plugin->GetCurrentTime())); recorder.SetAutoPlay(false); - emit mPlugin->ManualTimeChangeStart(aznumeric_cast(mPlugin->GetCurrentTime())); - emit mPlugin->ManualTimeChange(aznumeric_cast(mPlugin->GetCurrentTime())); + emit m_plugin->ManualTimeChangeStart(aznumeric_cast(m_plugin->GetCurrentTime())); + emit m_plugin->ManualTimeChange(aznumeric_cast(m_plugin->GetCurrentTime())); } else { @@ -331,19 +331,19 @@ namespace EMStudio if (motionInstances.size() == 1) { EMotionFX::MotionInstance* motionInstance = motionInstances[0]; - motionInstance->SetCurrentTime(aznumeric_cast(mPlugin->GetCurrentTime()), false); + motionInstance->SetCurrentTime(aznumeric_cast(m_plugin->GetCurrentTime()), false); motionInstance->SetPause(true); - mPlugin->GetTimeViewToolBar()->UpdateInterface(); - emit mPlugin->ManualTimeChangeStart(aznumeric_cast(mPlugin->GetCurrentTime())); - emit mPlugin->ManualTimeChange(aznumeric_cast(mPlugin->GetCurrentTime())); + m_plugin->GetTimeViewToolBar()->UpdateInterface(); + emit m_plugin->ManualTimeChangeStart(aznumeric_cast(m_plugin->GetCurrentTime())); + emit m_plugin->ManualTimeChange(aznumeric_cast(m_plugin->GetCurrentTime())); } } } } //const bool altPressed = event->modifiers() & Qt::AltModifier; - const bool isZooming = mMouseLeftClicked == false && mMouseRightClicked && altPressed; - const bool isPanning = mMouseLeftClicked == false && isZooming == false && (mMouseMidClicked || mMouseRightClicked); + const bool isZooming = m_mouseLeftClicked == false && m_mouseRightClicked && altPressed; + const bool isPanning = m_mouseLeftClicked == false && isZooming == false && (m_mouseMidClicked || m_mouseRightClicked); if (isPanning) { @@ -352,7 +352,7 @@ namespace EMStudio if (isZooming) { - setCursor(*(mPlugin->GetZoomInCursor())); + setCursor(*(m_plugin->GetZoomInCursor())); } } @@ -360,33 +360,33 @@ namespace EMStudio // when releasing the mouse button void TrackDataHeaderWidget::mouseReleaseEvent(QMouseEvent* event) { - mPlugin->SetRedrawFlag(); + m_plugin->SetRedrawFlag(); setCursor(Qt::ArrowCursor); // disable overwrite mode in any case when the mouse gets released so that we display the current time from the plugin again - if (mPlugin->GetTimeInfoWidget()) + if (m_plugin->GetTimeInfoWidget()) { - mPlugin->GetTimeInfoWidget()->SetIsOverwriteMode(false); + m_plugin->GetTimeInfoWidget()->SetIsOverwriteMode(false); } const bool ctrlPressed = event->modifiers() & Qt::ControlModifier; if (event->button() == Qt::RightButton) { - mMouseRightClicked = false; - mIsScrolling = false; + m_mouseRightClicked = false; + m_isScrolling = false; } if (event->button() == Qt::MidButton) { - mMouseMidClicked = false; + m_mouseMidClicked = false; } if (event->button() == Qt::LeftButton) { - mMouseLeftClicked = false; - mIsScrolling = false; + m_mouseLeftClicked = false; + m_isScrolling = false; return; } @@ -397,7 +397,7 @@ namespace EMStudio // drag & drop support void TrackDataHeaderWidget::dragEnterEvent(QDragEnterEvent* event) { - mPlugin->SetRedrawFlag(); + m_plugin->SetRedrawFlag(); // this is needed to actually reach the drop event function event->acceptProposedAction(); @@ -444,16 +444,16 @@ namespace EMStudio // handle mouse wheel event void TrackDataHeaderWidget::wheelEvent(QWheelEvent* event) { - DoWheelEvent(event, mPlugin); + DoWheelEvent(event, m_plugin); } void TrackDataHeaderWidget::dragMoveEvent(QDragMoveEvent* event) { - mPlugin->SetRedrawFlag(); + m_plugin->SetRedrawFlag(); QPoint mousePos = event->pos(); - double dropTime = mPlugin->PixelToTime(mousePos.x()); - mPlugin->SetCurrentTime(dropTime); + double dropTime = m_plugin->PixelToTime(mousePos.x()); + m_plugin->SetCurrentTime(dropTime); const AZStd::vector& motionInstances = MotionWindowPlugin::GetSelectedMotionInstances(); if (motionInstances.size() == 1) @@ -470,9 +470,9 @@ namespace EMStudio // propagate key events to the plugin and let it handle by a shared function void TrackDataHeaderWidget::keyPressEvent(QKeyEvent* event) { - if (mPlugin) + if (m_plugin) { - mPlugin->OnKeyPressEvent(event); + m_plugin->OnKeyPressEvent(event); } } @@ -480,9 +480,9 @@ namespace EMStudio // propagate key events to the plugin and let it handle by a shared function void TrackDataHeaderWidget::keyReleaseEvent(QKeyEvent* event) { - if (mPlugin) + if (m_plugin) { - mPlugin->OnKeyReleaseEvent(event); + m_plugin->OnKeyReleaseEvent(event); } } @@ -493,12 +493,11 @@ namespace EMStudio double animationLength = 0.0; double clipStart = 0.0; double clipEnd = 0.0; - mPlugin->GetDataTimes(&animationLength, &clipStart, &clipEnd); + m_plugin->GetDataTimes(&animationLength, &clipStart, &clipEnd); // calculate the pixel offsets - double animEndPixel = mPlugin->TimeToPixel(animationLength); - double clipStartPixel = mPlugin->TimeToPixel(clipStart); - //double clipEndPixel = mPlugin->TimeToPixel(clipEnd); + double animEndPixel = m_plugin->TimeToPixel(animationLength); + double clipStartPixel = m_plugin->TimeToPixel(clipStart); // fill with the background color QRect motionRect = rect; @@ -511,16 +510,16 @@ namespace EMStudio painter.setPen(Qt::NoPen); if (hasFocus() == false) { - painter.setBrush(mHeaderGradientActive); + painter.setBrush(m_headerGradientActive); painter.drawRect(motionRect); - painter.setBrush(mHeaderGradientInactive); + painter.setBrush(m_headerGradientInactive); painter.drawRect(outOfRangeRect); } else { - painter.setBrush(mHeaderGradientActiveFocus); + painter.setBrush(m_headerGradientActiveFocus); painter.drawRect(motionRect); - painter.setBrush(mHeaderGradientInactiveFocus); + painter.setBrush(m_headerGradientInactiveFocus); painter.drawRect(outOfRangeRect); } @@ -529,7 +528,7 @@ namespace EMStudio if (recorder.GetRecordTime() > MCore::Math::epsilon) { QRectF recorderRect = rect; - recorderRect.setRight(mPlugin->TimeToPixel(recorder.GetRecordTime())); + recorderRect.setRight(m_plugin->TimeToPixel(recorder.GetRecordTime())); recorderRect.setTop(height() - 3); recorderRect.setBottom(height()); @@ -542,7 +541,7 @@ namespace EMStudio if (animationLength > MCore::Math::epsilon) { QRectF rangeRect = rect; - rangeRect.setRight(mPlugin->TimeToPixel(animationLength)); + rangeRect.setRight(m_plugin->TimeToPixel(animationLength)); rangeRect.setTop(height() - 3); rangeRect.setBottom(height()); @@ -554,21 +553,16 @@ namespace EMStudio QTextOption options; options.setAlignment(Qt::AlignCenter); - painter.setFont(mTimeLineFont); + painter.setFont(m_timeLineFont); const uint32 width = rect.width(); //const uint32 height = rect.height(); float yOffset = 19.0f; - //const double pixelsPerSecond = mPlugin->mPixelsPerSecond; - - double timeOffset = mPlugin->PixelToTime(0.0) * 1000.0; + double timeOffset = m_plugin->PixelToTime(0.0) * 1000.0; timeOffset = (timeOffset - ((int32)timeOffset % 5000)) / 1000.0; - //if (rand() % 10 == 0) - //MCore::LogInfo("%f", mPlugin->mTimeScale); - uint32 minutes, seconds, milSecs, frameNumber; double pixelTime; @@ -578,35 +572,34 @@ namespace EMStudio //uint32 index = 0; while (curX <= width) { - curX = mPlugin->TimeToPixel(curTime, false); - mPlugin->CalcTime(curX, &pixelTime, &minutes, &seconds, &milSecs, &frameNumber, false); + curX = m_plugin->TimeToPixel(curTime, false); + m_plugin->CalcTime(curX, &pixelTime, &minutes, &seconds, &milSecs, &frameNumber, false); seconds += minutes * 60; - curX *= mPlugin->mTimeScale; + curX *= m_plugin->m_timeScale; curTime += 5.0; - painter.setPen(mPenMainTimeStepLinesActive); + painter.setPen(m_penMainTimeStepLinesActive); painter.drawLine(QPointF(curX, yOffset - 3.0f), QPointF(curX, yOffset + 10.0f)); - mTimeString = AZStd::string::format("%.2d:%.2d", seconds, milSecs); // will only do an allocation once, reuses the memory + m_timeString = AZStd::string::format("%.2d:%.2d", seconds, milSecs); // will only do an allocation once, reuses the memory - //painter.setPen( mPenText ); painter.setPen(QColor(175, 175, 175)); - painter.drawText(QRect(aznumeric_cast(curX - 25), aznumeric_cast(yOffset - 23), 52, 20), mTimeString.c_str(), options); + painter.drawText(QRect(aznumeric_cast(curX - 25), aznumeric_cast(yOffset - 23), 52, 20), m_timeString.c_str(), options); } // draw the seconds curTime = timeOffset; - if (mPlugin->mTimeScale >= 0.25) + if (m_plugin->m_timeScale >= 0.25) { uint32 index = 0; curX = 0.0; while (curX <= width) { - curX = mPlugin->TimeToPixel(curTime, false); - mPlugin->CalcTime(curX, &pixelTime, &minutes, &seconds, &milSecs, &frameNumber, false); + curX = m_plugin->TimeToPixel(curTime, false); + m_plugin->CalcTime(curX, &pixelTime, &minutes, &seconds, &milSecs, &frameNumber, false); seconds += minutes * 60; - curX *= mPlugin->mTimeScale; + curX *= m_plugin->m_timeScale; curTime += 1.0; if (index % 5 == 0) @@ -618,8 +611,8 @@ namespace EMStudio if (curX > -100 && curX < width + 100) { - painter.setPen(mPenMainTimeStepLinesActive); - if (mPlugin->mTimeScale < 0.9) + painter.setPen(m_penMainTimeStepLinesActive); + if (m_plugin->m_timeScale < 0.9) { painter.drawLine(QPointF(curX, yOffset - 1.0f), QPointF(curX, yOffset + 5.0f)); } @@ -628,11 +621,11 @@ namespace EMStudio painter.drawLine(QPointF(curX, yOffset - 3.0f), QPointF(curX, yOffset + 10.0f)); } - if (mPlugin->mTimeScale >= 0.48) + if (m_plugin->m_timeScale >= 0.48) { - mTimeString = AZStd::string::format("%.2d:%.2d", seconds, milSecs); // will only do an allocation once, reuses the memory + m_timeString = AZStd::string::format("%.2d:%.2d", seconds, milSecs); // will only do an allocation once, reuses the memory - float alpha = aznumeric_cast((mPlugin->mTimeScale - 0.48f) / 1.0f); + float alpha = aznumeric_cast((m_plugin->m_timeScale - 0.48f) / 1.0f); alpha *= 2; if (alpha > 1.0f) { @@ -640,7 +633,7 @@ namespace EMStudio } painter.setPen(QColor(200, 200, 200, aznumeric_cast(alpha * 255))); - painter.drawText(QRect(aznumeric_cast(curX - 25), aznumeric_cast(yOffset - 23), 52, 20), mTimeString.c_str(), options); + painter.drawText(QRect(aznumeric_cast(curX - 25), aznumeric_cast(yOffset - 23), 52, 20), m_timeString.c_str(), options); } } } @@ -648,16 +641,16 @@ namespace EMStudio // 500 ms curTime = timeOffset; - if (mPlugin->mTimeScale >= 0.1) + if (m_plugin->m_timeScale >= 0.1) { uint32 index = 0; curX = 0; while (curX <= width) { - curX = mPlugin->TimeToPixel(curTime, false); - mPlugin->CalcTime(curX, &pixelTime, &minutes, &seconds, &milSecs, &frameNumber, false); + curX = m_plugin->TimeToPixel(curTime, false); + m_plugin->CalcTime(curX, &pixelTime, &minutes, &seconds, &milSecs, &frameNumber, false); seconds += minutes * 60; - curX *= mPlugin->mTimeScale; + curX *= m_plugin->m_timeScale; curTime += 0.5; if (index % 2 == 0) @@ -669,10 +662,10 @@ namespace EMStudio if (curX > -100 && curX < width + 100) { - painter.setPen(mPenMainTimeStepLinesActive); - if (mPlugin->mTimeScale < 1.5) + painter.setPen(m_penMainTimeStepLinesActive); + if (m_plugin->m_timeScale < 1.5) { - if (mPlugin->mTimeScale < 1.0) + if (m_plugin->m_timeScale < 1.0) { painter.drawLine(QPointF(curX, yOffset - 1.0f), QPointF(curX, yOffset + 1.0f)); } @@ -686,19 +679,18 @@ namespace EMStudio painter.drawLine(QPointF(curX, yOffset - 3.0f), QPointF(curX, yOffset + 10.0f)); } - if (mPlugin->mTimeScale >= 2.0f) + if (m_plugin->m_timeScale >= 2.0f) { - mTimeString = AZStd::string::format("%.2d:%.2d", seconds, milSecs); // will only do an allocation once, reuses the memory + m_timeString = AZStd::string::format("%.2d:%.2d", seconds, milSecs); // will only do an allocation once, reuses the memory - float alpha = aznumeric_cast((mPlugin->mTimeScale - 2.0f) / 2.0f); + float alpha = aznumeric_cast((m_plugin->m_timeScale - 2.0f) / 2.0f); if (alpha > 1.0f) { alpha = 1.0; } - //painter.setPen( mPenText ); painter.setPen(QColor(175, 175, 175, aznumeric_cast(alpha * 255))); - painter.drawText(QRect(aznumeric_cast(curX - 25), aznumeric_cast(yOffset - 23), 52, 20), mTimeString.c_str(), options); + painter.drawText(QRect(aznumeric_cast(curX - 25), aznumeric_cast(yOffset - 23), 52, 20), m_timeString.c_str(), options); } } } @@ -706,7 +698,7 @@ namespace EMStudio // 100 ms curTime = timeOffset; - if (mPlugin->mTimeScale >= 0.95f) + if (m_plugin->m_timeScale >= 0.95f) { uint32 index = 0; curX = 0; @@ -717,10 +709,10 @@ namespace EMStudio index = 1; } - curX = mPlugin->TimeToPixel(curTime, false); - mPlugin->CalcTime(curX, &pixelTime, &minutes, &seconds, &milSecs, &frameNumber, false); + curX = m_plugin->TimeToPixel(curTime, false); + m_plugin->CalcTime(curX, &pixelTime, &minutes, &seconds, &milSecs, &frameNumber, false); seconds += minutes * 60; - curX *= mPlugin->mTimeScale; + curX *= m_plugin->m_timeScale; curTime += 0.1; if (index == 0 || index == 5 || index == 10) @@ -733,40 +725,40 @@ namespace EMStudio if (curX > -100 && curX < width + 100) { - painter.setPen(mPenMainTimeStepLinesActive); + painter.setPen(m_penMainTimeStepLinesActive); painter.drawLine(QPointF(curX, yOffset), QPointF(curX, yOffset + 3.0f)); - if (mPlugin->mTimeScale >= 11.0f) + if (m_plugin->m_timeScale >= 11.0f) { - float alpha = aznumeric_cast((mPlugin->mTimeScale - 11.0f) / 4.0f); + float alpha = aznumeric_cast((m_plugin->m_timeScale - 11.0f) / 4.0f); if (alpha > 1.0f) { alpha = 1.0; } - mTimeString = AZStd::string::format("%.2d:%.2d", seconds, milSecs); // will only do an allocation once, reuses the memory + m_timeString = AZStd::string::format("%.2d:%.2d", seconds, milSecs); // will only do an allocation once, reuses the memory painter.setPen(QColor(110, 110, 110, aznumeric_cast(alpha * 255))); - painter.drawText(QRect(aznumeric_cast(curX - 25), aznumeric_cast(yOffset - 23), 52, 20), mTimeString.c_str(), options); + painter.drawText(QRect(aznumeric_cast(curX - 25), aznumeric_cast(yOffset - 23), 52, 20), m_timeString.c_str(), options); } } } } - timeOffset = mPlugin->PixelToTime(0.0) * 1000.0; + timeOffset = m_plugin->PixelToTime(0.0) * 1000.0; timeOffset = (timeOffset - ((int32)timeOffset % 1000)) / 1000.0; // 50 ms curTime = timeOffset; - if (mPlugin->mTimeScale >= 1.9) + if (m_plugin->m_timeScale >= 1.9) { uint32 index = 0; curX = 0; while (curX <= width) { - curX = mPlugin->TimeToPixel(curTime, false); - mPlugin->CalcTime(curX, &pixelTime, &minutes, &seconds, &milSecs, &frameNumber, false); + curX = m_plugin->TimeToPixel(curTime, false); + m_plugin->CalcTime(curX, &pixelTime, &minutes, &seconds, &milSecs, &frameNumber, false); seconds += minutes * 60; - curX *= mPlugin->mTimeScale; + curX *= m_plugin->m_timeScale; curTime += 0.05; if (index % 2 == 0) @@ -779,21 +771,20 @@ namespace EMStudio if (curX > -100 && curX < width + 100) { - painter.setPen(mPenMainTimeStepLinesActive); + painter.setPen(m_penMainTimeStepLinesActive); painter.drawLine(QPointF(curX, yOffset), QPointF(curX, yOffset + 1.0f)); - if (mPlugin->mTimeScale >= 25.0f) + if (m_plugin->m_timeScale >= 25.0f) { - float alpha = aznumeric_cast((mPlugin->mTimeScale - 25.0f) / 6.0f); + float alpha = aznumeric_cast((m_plugin->m_timeScale - 25.0f) / 6.0f); if (alpha > 1.0f) { alpha = 1.0; } - mTimeString = AZStd::string::format("%.2d:%.2d", seconds, milSecs); // will only do an allocation once, reuses the memory - //painter.setPen( mPenText ); + m_timeString = AZStd::string::format("%.2d:%.2d", seconds, milSecs); // will only do an allocation once, reuses the memory painter.setPen(QColor(80, 80, 80, aznumeric_cast(alpha * 255))); - painter.drawText(QRect(aznumeric_cast(curX - 25), aznumeric_cast(yOffset - 23), 52, 20), mTimeString.c_str(), options); + painter.drawText(QRect(aznumeric_cast(curX - 25), aznumeric_cast(yOffset - 23), 52, 20), m_timeString.c_str(), options); } } } @@ -802,15 +793,15 @@ namespace EMStudio // 10 ms curTime = timeOffset; - if (mPlugin->mTimeScale >= 7.9) + if (m_plugin->m_timeScale >= 7.9) { uint32 index = 0; curX = 0; while (curX <= width) { - curX = mPlugin->TimeToPixel(curTime, false); - mPlugin->CalcTime(curX, &pixelTime, &minutes, &seconds, &milSecs, &frameNumber, false); - curX *= mPlugin->mTimeScale; + curX = m_plugin->TimeToPixel(curTime, false); + m_plugin->CalcTime(curX, &pixelTime, &minutes, &seconds, &milSecs, &frameNumber, false); + curX *= m_plugin->m_timeScale; curTime += 0.01; if (index % 5 == 0) @@ -824,21 +815,20 @@ namespace EMStudio if (curX > -100 && curX < width + 100) { //MCore::LogInfo("%f", curX); - painter.setPen(mPenMainTimeStepLinesActive); + painter.setPen(m_penMainTimeStepLinesActive); painter.drawLine(QPointF(curX, yOffset), QPointF(curX, yOffset + 1.0f)); - if (mPlugin->mTimeScale >= 65.0) + if (m_plugin->m_timeScale >= 65.0) { - float alpha = aznumeric_cast((mPlugin->mTimeScale - 65.0f) / 5.0f); + float alpha = aznumeric_cast((m_plugin->m_timeScale - 65.0f) / 5.0f); if (alpha > 1.0f) { alpha = 1.0; } - mTimeString = AZStd::string::format("%.2d:%.2d", seconds, milSecs); // will only do an allocation once, reuses the memory - //painter.setPen( mPenText ); + m_timeString = AZStd::string::format("%.2d:%.2d", seconds, milSecs); // will only do an allocation once, reuses the memory painter.setPen(QColor(60, 60, 60, aznumeric_cast(alpha * 255))); - painter.drawText(QRect(aznumeric_cast(curX - 25), aznumeric_cast(yOffset - 23), 52, 20), mTimeString.c_str(), options); + painter.drawText(QRect(aznumeric_cast(curX - 25), aznumeric_cast(yOffset - 23), 52, 20), m_timeString.c_str(), options); } } } @@ -855,10 +845,10 @@ namespace EMStudio // Timeline actions //--------------------- QAction* action = menu.addAction("Zoom To Fit All"); - connect(action, &QAction::triggered, mPlugin, &TimeViewPlugin::OnZoomAll); + connect(action, &QAction::triggered, m_plugin, &TimeViewPlugin::OnZoomAll); action = menu.addAction("Reset Timeline"); - connect(action, &QAction::triggered, mPlugin, &TimeViewPlugin::OnResetTimeline); + connect(action, &QAction::triggered, m_plugin, &TimeViewPlugin::OnResetTimeline); // show the menu at the given position menu.exec(event->globalPos()); diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/TimeView/TrackDataHeaderWidget.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/TimeView/TrackDataHeaderWidget.h index 30fa3a741e..16d6171e4b 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/TimeView/TrackDataHeaderWidget.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/TimeView/TrackDataHeaderWidget.h @@ -57,26 +57,26 @@ namespace EMStudio void keyReleaseEvent(QKeyEvent* event) override; private: - QBrush mBrushBackgroundOutOfRange; - TimeViewPlugin* mPlugin; - bool mMouseLeftClicked; - bool mMouseMidClicked; - bool mMouseRightClicked; - bool mIsScrolling; - int32 mLastMouseX; - int32 mLastMouseY; - bool mAllowContextMenu; + QBrush m_brushBackgroundOutOfRange; + TimeViewPlugin* m_plugin; + bool m_mouseLeftClicked; + bool m_mouseMidClicked; + bool m_mouseRightClicked; + bool m_isScrolling; + int32 m_lastMouseX; + int32 m_lastMouseY; + bool m_allowContextMenu; - QPixmap mTimeHandleTop; + QPixmap m_timeHandleTop; - QFont mTimeLineFont; - QFont mDataFont; - AZStd::string mTimeString; - QLinearGradient mHeaderGradientActive; - QLinearGradient mHeaderGradientInactive; - QLinearGradient mHeaderGradientActiveFocus; - QLinearGradient mHeaderGradientInactiveFocus; - QPen mPenMainTimeStepLinesActive; + QFont m_timeLineFont; + QFont m_dataFont; + AZStd::string m_timeString; + QLinearGradient m_headerGradientActive; + QLinearGradient m_headerGradientInactive; + QLinearGradient m_headerGradientActiveFocus; + QLinearGradient m_headerGradientInactiveFocus; + QPen m_penMainTimeStepLinesActive; void UpdateMouseOverCursor(); void DrawTimeLine(QPainter& painter, const QRect& rect); diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/TimeView/TrackDataWidget.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/TimeView/TrackDataWidget.cpp index 06569b3bf3..6c2ab60010 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/TimeView/TrackDataWidget.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/TimeView/TrackDataWidget.cpp @@ -55,37 +55,37 @@ namespace EMStudio TrackDataWidget::TrackDataWidget(TimeViewPlugin* plugin, QWidget* parent) : QOpenGLWidget(parent) , QOpenGLFunctions() - , mBrushBackground(QColor(40, 45, 50), Qt::SolidPattern) - , mBrushBackgroundClipped(QColor(40, 40, 40), Qt::SolidPattern) - , mBrushBackgroundOutOfRange(QColor(35, 35, 35), Qt::SolidPattern) - , mPlugin(plugin) - , mMouseLeftClicked(false) - , mMouseMidClicked(false) - , mMouseRightClicked(false) - , mDragging(false) - , mResizing(false) - , mRectZooming(false) - , mIsScrolling(false) - , mLastLeftClickedX(0) - , mLastMouseMoveX(0) - , mLastMouseX(0) - , mLastMouseY(0) - , mNodeHistoryItemHeight(20) - , mEventHistoryTotalHeight(0) - , mAllowContextMenu(true) - , mDraggingElement(nullptr) - , mDragElementTrack(nullptr) - , mResizeElement(nullptr) - , mGraphStartHeight(0) - , mEventsStartHeight(0) - , mNodeRectsStartHeight(0) - , mSelectStart(0, 0) - , mSelectEnd(0, 0) - , mRectSelecting(false) + , m_brushBackground(QColor(40, 45, 50), Qt::SolidPattern) + , m_brushBackgroundClipped(QColor(40, 40, 40), Qt::SolidPattern) + , m_brushBackgroundOutOfRange(QColor(35, 35, 35), Qt::SolidPattern) + , m_plugin(plugin) + , m_mouseLeftClicked(false) + , m_mouseMidClicked(false) + , m_mouseRightClicked(false) + , m_dragging(false) + , m_resizing(false) + , m_rectZooming(false) + , m_isScrolling(false) + , m_lastLeftClickedX(0) + , m_lastMouseMoveX(0) + , m_lastMouseX(0) + , m_lastMouseY(0) + , m_nodeHistoryItemHeight(20) + , m_eventHistoryTotalHeight(0) + , m_allowContextMenu(true) + , m_draggingElement(nullptr) + , m_dragElementTrack(nullptr) + , m_resizeElement(nullptr) + , m_graphStartHeight(0) + , m_eventsStartHeight(0) + , m_nodeRectsStartHeight(0) + , m_selectStart(0, 0) + , m_selectEnd(0, 0) + , m_rectSelecting(false) { setObjectName("TrackDataWidget"); - mDataFont.setPixelSize(13); + m_dataFont.setPixelSize(13); setMouseTracking(true); setAcceptDrops(true); @@ -114,9 +114,9 @@ namespace EMStudio { MCORE_UNUSED(w); MCORE_UNUSED(h); - if (mPlugin) + if (m_plugin) { - mPlugin->SetRedrawFlag(); + m_plugin->SetRedrawFlag(); } } @@ -124,10 +124,10 @@ namespace EMStudio // calculate the selection rect void TrackDataWidget::CalcSelectRect(QRect& outRect) { - const int32 startX = MCore::Min(mSelectStart.x(), mSelectEnd.x()); - const int32 startY = MCore::Min(mSelectStart.y(), mSelectEnd.y()); - const int32 width = abs(mSelectEnd.x() - mSelectStart.x()); - const int32 height = abs(mSelectEnd.y() - mSelectStart.y()); + const int32 startX = MCore::Min(m_selectStart.x(), m_selectEnd.x()); + const int32 startY = MCore::Min(m_selectStart.y(), m_selectEnd.y()); + const int32 width = abs(m_selectEnd.x() - m_selectStart.x()); + const int32 height = abs(m_selectEnd.y() - m_selectStart.y()); outRect = QRect(startX, startY, width, height); } @@ -145,12 +145,12 @@ namespace EMStudio // draw a background rect painter.setPen(Qt::NoPen); - painter.setBrush(mBrushBackgroundOutOfRange); + painter.setBrush(m_brushBackgroundOutOfRange); painter.drawRect(rect); - painter.setFont(mDataFont); + painter.setFont(m_dataFont); // if there is a recording show that, otherwise show motion tracks - switch (mPlugin->GetMode()) + switch (m_plugin->GetMode()) { case TimeViewMode::AnimGraph: { @@ -170,18 +170,18 @@ namespace EMStudio painter.setRenderHint(QPainter::Antialiasing, false); - mPlugin->RenderElementTimeHandles(painter, geometry().height(), mPlugin->mPenTimeHandles); + m_plugin->RenderElementTimeHandles(painter, geometry().height(), m_plugin->m_penTimeHandles); DrawTimeMarker(painter, rect); // render selection rect - if (mRectSelecting) + if (m_rectSelecting) { painter.resetTransform(); QRect selectRect; CalcSelectRect(selectRect); - if (mRectZooming) + if (m_rectZooming) { painter.setBrush(QColor(0, 100, 200, 75)); painter.setPen(QColor(0, 100, 255)); @@ -189,7 +189,7 @@ namespace EMStudio } else { - if (EMotionFX::GetRecorder().GetRecordTime() < MCore::Math::epsilon && mPlugin->mMotion) + if (EMotionFX::GetRecorder().GetRecordTime() < MCore::Math::epsilon && m_plugin->m_motion) { painter.setBrush(QColor(200, 120, 0, 75)); painter.setPen(QColor(255, 128, 0)); @@ -201,9 +201,9 @@ namespace EMStudio void TrackDataWidget::RemoveTrack(size_t trackIndex) { - mPlugin->SetRedrawFlag(); + m_plugin->SetRedrawFlag(); CommandSystem::CommandRemoveEventTrack(trackIndex); - mPlugin->UnselectAllElements(); + m_plugin->UnselectAllElements(); ClearState(); } @@ -212,8 +212,8 @@ namespace EMStudio { // draw the current time marker float startHeight = 0.0f; - const float curTimeX = aznumeric_cast(mPlugin->TimeToPixel(mPlugin->mCurTime)); - painter.setPen(mPlugin->mPenCurTimeHandle); + const float curTimeX = aznumeric_cast(m_plugin->TimeToPixel(m_plugin->m_curTime)); + painter.setPen(m_plugin->m_penCurTimeHandle); painter.drawLine(QPointF(curTimeX, startHeight), QPointF(curTimeX, rect.bottom())); } @@ -229,7 +229,7 @@ namespace EMStudio QRect motionRect = rect; const float animationLength = recorder.GetRecordTime(); - const double animEndPixel = mPlugin->TimeToPixel(animationLength); + const double animEndPixel = m_plugin->TimeToPixel(animationLength); backgroundRect.setLeft(aznumeric_cast(animEndPixel)); motionRect.setRight(aznumeric_cast(animEndPixel)); motionRect.setTop(0); @@ -237,9 +237,9 @@ namespace EMStudio // render the rects painter.setPen(Qt::NoPen); - painter.setBrush(mBrushBackground); + painter.setBrush(m_brushBackground); painter.drawRect(motionRect); - painter.setBrush(mBrushBackgroundOutOfRange); + painter.setBrush(m_brushBackgroundOutOfRange); painter.drawRect(backgroundRect); // find the selected actor instance @@ -259,7 +259,7 @@ namespace EMStudio // get the actor instance data for the first selected actor instance, and render the node history for that const EMotionFX::Recorder::ActorInstanceData* actorInstanceData = &recorder.GetActorInstanceData(actorInstanceDataIndex); - RecorderGroup* recorderGroup = mPlugin->GetTimeViewToolBar()->GetRecorderGroup(); + RecorderGroup* recorderGroup = m_plugin->GetTimeViewToolBar()->GetRecorderGroup(); const bool displayNodeActivity = recorderGroup->GetDisplayNodeActivity(); const bool displayEvents = recorderGroup->GetDisplayMotionEvents(); const bool displayRelativeGraph = recorderGroup->GetDisplayRelativeGraph(); @@ -270,31 +270,31 @@ namespace EMStudio if (displayNodeActivity) { - mNodeRectsStartHeight = startOffset; + m_nodeRectsStartHeight = startOffset; PaintRecorderNodeHistory(painter, rect, actorInstanceData); isTop = false; - startOffset = mNodeHistoryRect.bottom(); - requiredHeight = mNodeHistoryRect.bottom(); + startOffset = m_nodeHistoryRect.bottom(); + requiredHeight = m_nodeHistoryRect.bottom(); } if (displayEvents) { if (isTop == false) { - mEventsStartHeight = startOffset; - mEventsStartHeight += PaintSeparator(painter, mEventsStartHeight, animationLength); - mEventsStartHeight += 10; - startOffset = mEventsStartHeight; + m_eventsStartHeight = startOffset; + m_eventsStartHeight += PaintSeparator(painter, m_eventsStartHeight, animationLength); + m_eventsStartHeight += 10; + startOffset = m_eventsStartHeight; requiredHeight += 11; } else { startOffset += 3; - mEventsStartHeight = startOffset; + m_eventsStartHeight = startOffset; requiredHeight += 3; } - startOffset += mEventHistoryTotalHeight; + startOffset += m_eventHistoryTotalHeight; isTop = false; PaintRecorderEventHistory(painter, rect, actorInstanceData); @@ -304,15 +304,15 @@ namespace EMStudio { if (isTop == false) { - mGraphStartHeight = startOffset + 10; - mGraphStartHeight += PaintSeparator(painter, mGraphStartHeight, animationLength); - startOffset = mGraphStartHeight; + m_graphStartHeight = startOffset + 10; + m_graphStartHeight += PaintSeparator(painter, m_graphStartHeight, animationLength); + startOffset = m_graphStartHeight; requiredHeight += 11; } else { startOffset += 3; - mGraphStartHeight = startOffset; + m_graphStartHeight = startOffset; requiredHeight += 3; } @@ -341,17 +341,17 @@ namespace EMStudio painter.setRenderHint(QPainter::Antialiasing, true); // get the history items shortcut - const AZStd::vector& historyItems = actorInstanceData->mNodeHistoryItems; + const AZStd::vector& historyItems = actorInstanceData->m_nodeHistoryItems; int32 windowWidth = geometry().width(); - RecorderGroup* recorderGroup = mPlugin->GetTimeViewToolBar()->GetRecorderGroup(); + RecorderGroup* recorderGroup = m_plugin->GetTimeViewToolBar()->GetRecorderGroup(); const bool useNodeColors = recorderGroup->GetUseNodeTypeColors(); const bool limitGraphHeight = recorderGroup->GetLimitGraphHeight(); - const bool showNodeNames = mPlugin->mTrackHeaderWidget->mNodeNamesCheckBox->isChecked(); - const bool showMotionFiles = mPlugin->mTrackHeaderWidget->mMotionFilesCheckBox->isChecked(); - const bool interpolate = recorder.GetRecordSettings().mInterpolate; + const bool showNodeNames = m_plugin->m_trackHeaderWidget->m_nodeNamesCheckBox->isChecked(); + const bool showMotionFiles = m_plugin->m_trackHeaderWidget->m_motionFilesCheckBox->isChecked(); + const bool interpolate = recorder.GetRecordSettings().m_interpolate; - float graphHeight = aznumeric_cast(geometry().height() - mGraphStartHeight); + float graphHeight = aznumeric_cast(geometry().height() - m_graphStartHeight); float graphBottom; if (limitGraphHeight == false) { @@ -364,27 +364,27 @@ namespace EMStudio graphHeight = 200; } - graphBottom = mGraphStartHeight + graphHeight; + graphBottom = m_graphStartHeight + graphHeight; } - const uint32 graphContentsCode = mPlugin->mTrackHeaderWidget->mGraphContentsComboBox->currentIndex(); + const uint32 graphContentsCode = m_plugin->m_trackHeaderWidget->m_graphContentsComboBox->currentIndex(); for (EMotionFX::Recorder::NodeHistoryItem* curItem : historyItems) { - double startTimePixel = mPlugin->TimeToPixel(curItem->mStartTime); - double endTimePixel = mPlugin->TimeToPixel(curItem->mEndTime); + double startTimePixel = m_plugin->TimeToPixel(curItem->m_startTime); + double endTimePixel = m_plugin->TimeToPixel(curItem->m_endTime); - const QRect itemRect(QPoint(aznumeric_cast(startTimePixel), mGraphStartHeight), QPoint(aznumeric_cast(endTimePixel), geometry().height())); + const QRect itemRect(QPoint(aznumeric_cast(startTimePixel), m_graphStartHeight), QPoint(aznumeric_cast(endTimePixel), geometry().height())); if (rect.intersects(itemRect) == false) { continue; } - const AZ::Color colorCode = (useNodeColors) ? curItem->mTypeColor : curItem->mColor; + const AZ::Color colorCode = (useNodeColors) ? curItem->m_typeColor : curItem->m_color; QColor color; color.setRgbF(colorCode.GetR(), colorCode.GetG(), colorCode.GetB(), colorCode.GetA()); - if (mPlugin->mNodeHistoryItem != curItem || mIsScrolling || mPlugin->mIsAnimating) + if (m_plugin->m_nodeHistoryItem != curItem || m_isScrolling || m_plugin->m_isAnimating) { painter.setPen(color); color.setAlpha(64); @@ -402,20 +402,20 @@ namespace EMStudio int32 widthInPixels = aznumeric_cast(endTimePixel - startTimePixel); if (widthInPixels > 0) { - EMotionFX::KeyTrackLinearDynamic* keyTrack = &curItem->mGlobalWeights; // init on global weights + EMotionFX::KeyTrackLinearDynamic* keyTrack = &curItem->m_globalWeights; // init on global weights if (graphContentsCode == 1) { - keyTrack = &curItem->mLocalWeights; + keyTrack = &curItem->m_localWeights; } else if (graphContentsCode == 2) { - keyTrack = &curItem->mPlayTimes; + keyTrack = &curItem->m_playTimes; } - float lastWeight = keyTrack->GetValueAtTime(0.0f, &curItem->mCachedKey, nullptr, interpolate); - const float keyTimeStep = (curItem->mEndTime - curItem->mStartTime) / (float)widthInPixels; + float lastWeight = keyTrack->GetValueAtTime(0.0f, &curItem->m_cachedKey, nullptr, interpolate); + const float keyTimeStep = (curItem->m_endTime - curItem->m_startTime) / (float)widthInPixels; const int32 pixelStepSize = 1;//(widthInPixels / 300.0f) + 1; @@ -435,12 +435,12 @@ namespace EMStudio firstPixel = false; } - const float weight = keyTrack->GetValueAtTime(w * keyTimeStep, &curItem->mCachedKey, nullptr, interpolate); + const float weight = keyTrack->GetValueAtTime(w * keyTimeStep, &curItem->m_cachedKey, nullptr, interpolate); const float height = graphBottom - weight * graphHeight; path.lineTo(QPointF(startTimePixel + w + 1, height)); } - const float weight = keyTrack->GetValueAtTime(curItem->mEndTime, &curItem->mCachedKey, nullptr, interpolate); + const float weight = keyTrack->GetValueAtTime(curItem->m_endTime, &curItem->m_cachedKey, nullptr, interpolate); const float height = graphBottom - weight * graphHeight; path.lineTo(QPointF(startTimePixel + widthInPixels - 1, height)); path.lineTo(QPointF(startTimePixel + widthInPixels, graphBottom + 1)); @@ -449,13 +449,13 @@ namespace EMStudio } // calculate the remapped track list, based on sorted global weight, with the most influencing track on top - recorder.ExtractNodeHistoryItems(*actorInstanceData, aznumeric_cast(mPlugin->mCurTime), true, (EMotionFX::Recorder::EValueType)graphContentsCode, &mActiveItems, &mTrackRemap); + recorder.ExtractNodeHistoryItems(*actorInstanceData, aznumeric_cast(m_plugin->m_curTime), true, (EMotionFX::Recorder::EValueType)graphContentsCode, &m_activeItems, &m_trackRemap); // display the values and names int offset = 0; - for (const EMotionFX::Recorder::ExtractedNodeHistoryItem& activeItem : mActiveItems) + for (const EMotionFX::Recorder::ExtractedNodeHistoryItem& activeItem : m_activeItems) { - EMotionFX::Recorder::NodeHistoryItem* curItem = activeItem.mNodeHistoryItem; + EMotionFX::Recorder::NodeHistoryItem* curItem = activeItem.m_nodeHistoryItem; if (curItem == nullptr) { continue; @@ -463,39 +463,39 @@ namespace EMStudio offset += 15; - mTempString.clear(); + m_tempString.clear(); if (showNodeNames) { - mTempString += curItem->mName.c_str(); + m_tempString += curItem->m_name.c_str(); } - if (showMotionFiles && !curItem->mMotionFileName.empty()) + if (showMotionFiles && !curItem->m_motionFileName.empty()) { - if (!mTempString.empty()) + if (!m_tempString.empty()) { - mTempString += " - "; + m_tempString += " - "; } - mTempString += curItem->mMotionFileName.c_str(); + m_tempString += curItem->m_motionFileName.c_str(); } - if (!mTempString.empty()) + if (!m_tempString.empty()) { - mTempString += AZStd::string::format(" = %.4f", activeItem.mValue); + m_tempString += AZStd::string::format(" = %.4f", activeItem.m_value); } else { - mTempString = AZStd::string::format("%.4f", activeItem.mValue); + m_tempString = AZStd::string::format("%.4f", activeItem.m_value); } - const AZ::Color colorCode = (useNodeColors) ? activeItem.mNodeHistoryItem->mTypeColor : activeItem.mNodeHistoryItem->mColor; + const AZ::Color colorCode = (useNodeColors) ? activeItem.m_nodeHistoryItem->m_typeColor : activeItem.m_nodeHistoryItem->m_color; QColor color; color.setRgbF(colorCode.GetR(), colorCode.GetG(), colorCode.GetB(), colorCode.GetA()); painter.setPen(color); painter.setBrush(Qt::NoBrush); - painter.setFont(mDataFont); - painter.drawText(3, offset + mGraphStartHeight, mTempString.c_str()); + painter.setFont(m_dataFont); + painter.drawText(3, offset + m_graphStartHeight, m_tempString.c_str()); } } @@ -512,10 +512,10 @@ namespace EMStudio } // get the history items shortcut - const AZStd::vector& historyItems = actorInstanceData->mEventHistoryItems; + const AZStd::vector& historyItems = actorInstanceData->m_eventHistoryItems; QRect clipRect = rect; - clipRect.setRight(aznumeric_cast(mPlugin->TimeToPixel(animationLength))); + clipRect.setRight(aznumeric_cast(m_plugin->TimeToPixel(animationLength))); painter.setClipRect(clipRect); painter.setClipping(true); @@ -526,8 +526,8 @@ namespace EMStudio QPointF tickPoints[6]; for (const EMotionFX::Recorder::EventHistoryItem* curItem : historyItems) { - float height = aznumeric_cast((curItem->mTrackIndex * 20) + mEventsStartHeight); - double startTimePixel = mPlugin->TimeToPixel(curItem->mStartTime); + float height = aznumeric_cast((curItem->m_trackIndex * 20) + m_eventsStartHeight); + double startTimePixel = m_plugin->TimeToPixel(curItem->m_startTime); const QRect itemRect(QPoint(aznumeric_cast(startTimePixel - tickHalfWidth), aznumeric_cast(height)), QSize(aznumeric_cast(tickHalfWidth * 2), aznumeric_cast(tickHeight))); if (rect.intersects(itemRect) == false) @@ -537,17 +537,17 @@ namespace EMStudio // try to locate the node based on its unique ID QColor borderColor(30, 30, 30); - const AZ::Color& colorCode = curItem->mColor; + const AZ::Color& colorCode = curItem->m_color; QColor color; color.setRgbF(colorCode.GetR(), colorCode.GetG(), colorCode.GetB(), colorCode.GetA()); - if (mIsScrolling == false && mPlugin->mIsAnimating == false) + if (m_isScrolling == false && m_plugin->m_isAnimating == false) { - if (mPlugin->mNodeHistoryItem && mPlugin->mNodeHistoryItem->mNodeId == curItem->mEmitterNodeId) + if (m_plugin->m_nodeHistoryItem && m_plugin->m_nodeHistoryItem->m_nodeId == curItem->m_emitterNodeId) { - if (curItem->mStartTime >= mPlugin->mNodeHistoryItem->mStartTime && curItem->mStartTime <= mPlugin->mNodeHistoryItem->mEndTime) + if (curItem->m_startTime >= m_plugin->m_nodeHistoryItem->m_startTime && curItem->m_startTime <= m_plugin->m_nodeHistoryItem->m_endTime) { - RecorderGroup* recorderGroup = mPlugin->GetTimeViewToolBar()->GetRecorderGroup(); + RecorderGroup* recorderGroup = m_plugin->GetTimeViewToolBar()->GetRecorderGroup(); if (recorderGroup->GetDisplayNodeActivity()) { borderColor = QColor(255, 128, 0); @@ -556,7 +556,7 @@ namespace EMStudio } } - if (mPlugin->mEventHistoryItem == curItem) + if (m_plugin->m_eventHistoryItem == curItem) { borderColor = QColor(255, 128, 0); color = borderColor; @@ -607,64 +607,64 @@ namespace EMStudio } // skip the complete rendering of the node history data when its bounds are not inside view - if (!rect.intersects(mNodeHistoryRect)) + if (!rect.intersects(m_nodeHistoryRect)) { return; } // get the history items shortcut - const AZStd::vector& historyItems = actorInstanceData->mNodeHistoryItems; + const AZStd::vector& historyItems = actorInstanceData->m_nodeHistoryItems; int32 windowWidth = geometry().width(); // calculate the remapped track list, based on sorted global weight, with the most influencing track on top - RecorderGroup* recorderGroup = mPlugin->GetTimeViewToolBar()->GetRecorderGroup(); + RecorderGroup* recorderGroup = m_plugin->GetTimeViewToolBar()->GetRecorderGroup(); const bool sorted = recorderGroup->GetSortNodeActivity(); const bool useNodeColors = recorderGroup->GetUseNodeTypeColors(); - const int graphContentsCode = mPlugin->mTrackHeaderWidget->mNodeContentsComboBox->currentIndex(); - recorder.ExtractNodeHistoryItems(*actorInstanceData, aznumeric_cast(mPlugin->mCurTime), sorted, (EMotionFX::Recorder::EValueType)graphContentsCode, &mActiveItems, &mTrackRemap); + const int graphContentsCode = m_plugin->m_trackHeaderWidget->m_nodeContentsComboBox->currentIndex(); + recorder.ExtractNodeHistoryItems(*actorInstanceData, aznumeric_cast(m_plugin->m_curTime), sorted, (EMotionFX::Recorder::EValueType)graphContentsCode, &m_activeItems, &m_trackRemap); - const bool showNodeNames = mPlugin->mTrackHeaderWidget->mNodeNamesCheckBox->isChecked(); - const bool showMotionFiles = mPlugin->mTrackHeaderWidget->mMotionFilesCheckBox->isChecked(); - const bool interpolate = recorder.GetRecordSettings().mInterpolate; + const bool showNodeNames = m_plugin->m_trackHeaderWidget->m_nodeNamesCheckBox->isChecked(); + const bool showMotionFiles = m_plugin->m_trackHeaderWidget->m_motionFilesCheckBox->isChecked(); + const bool interpolate = recorder.GetRecordSettings().m_interpolate; - const int nodeContentsCode = mPlugin->mTrackHeaderWidget->mNodeContentsComboBox->currentIndex(); + const int nodeContentsCode = m_plugin->m_trackHeaderWidget->m_nodeContentsComboBox->currentIndex(); // for all history items QRectF itemRect; for (EMotionFX::Recorder::NodeHistoryItem* curItem : historyItems) { // draw the background rect - double startTimePixel = mPlugin->TimeToPixel(curItem->mStartTime); - double endTimePixel = mPlugin->TimeToPixel(curItem->mEndTime); + double startTimePixel = m_plugin->TimeToPixel(curItem->m_startTime); + double endTimePixel = m_plugin->TimeToPixel(curItem->m_endTime); - const size_t trackIndex = mTrackRemap[ curItem->mTrackIndex ]; + const size_t trackIndex = m_trackRemap[ curItem->m_trackIndex ]; itemRect.setLeft(startTimePixel); itemRect.setRight(endTimePixel - 1); - itemRect.setTop((mNodeRectsStartHeight + (aznumeric_cast(trackIndex) * (mNodeHistoryItemHeight + 3)) + 3)); - itemRect.setBottom(itemRect.top() + mNodeHistoryItemHeight); + itemRect.setTop((m_nodeRectsStartHeight + (aznumeric_cast(trackIndex) * (m_nodeHistoryItemHeight + 3)) + 3)); + itemRect.setBottom(itemRect.top() + m_nodeHistoryItemHeight); if (!rect.intersects(itemRect.toRect())) { continue; } - const AZ::Color colorCode = (useNodeColors) ? curItem->mTypeColor : curItem->mColor; + const AZ::Color colorCode = (useNodeColors) ? curItem->m_typeColor : curItem->m_color; QColor color; color.setRgbF(colorCode.GetR(), colorCode.GetG(), colorCode.GetB(), colorCode.GetA()); bool matchesEvent = false; - if (mIsScrolling == false && mPlugin->mIsAnimating == false) + if (m_isScrolling == false && m_plugin->m_isAnimating == false) { - if (mPlugin->mNodeHistoryItem == curItem) + if (m_plugin->m_nodeHistoryItem == curItem) { color = QColor(255, 128, 0); } - if (mPlugin->mEventEmitterNode && mPlugin->mEventEmitterNode->GetId() == curItem->mNodeId && mPlugin->mEventHistoryItem) + if (m_plugin->m_eventEmitterNode && m_plugin->m_eventEmitterNode->GetId() == curItem->m_nodeId && m_plugin->m_eventHistoryItem) { - if (mPlugin->mEventHistoryItem->mStartTime >= curItem->mStartTime && mPlugin->mEventHistoryItem->mStartTime <= curItem->mEndTime) + if (m_plugin->m_eventHistoryItem->m_startTime >= curItem->m_startTime && m_plugin->m_eventHistoryItem->m_startTime <= curItem->m_endTime) { color = QColor(255, 128, 0); matchesEvent = true; @@ -688,24 +688,24 @@ namespace EMStudio int32 widthInPixels = aznumeric_cast(endTimePixel - startTimePixel); if (widthInPixels > 0) { - const EMotionFX::KeyTrackLinearDynamic* keyTrack = &curItem->mGlobalWeights; // init on global weights + const EMotionFX::KeyTrackLinearDynamic* keyTrack = &curItem->m_globalWeights; // init on global weights if (nodeContentsCode == 1) { - keyTrack = &curItem->mLocalWeights; + keyTrack = &curItem->m_localWeights; } else if (nodeContentsCode == 2) { - keyTrack = &curItem->mPlayTimes; + keyTrack = &curItem->m_playTimes; } - float lastWeight = keyTrack->GetValueAtTime(0.0f, &curItem->mCachedKey, nullptr, interpolate); - const float keyTimeStep = (curItem->mEndTime - curItem->mStartTime) / (float)widthInPixels; + float lastWeight = keyTrack->GetValueAtTime(0.0f, &curItem->m_cachedKey, nullptr, interpolate); + const float keyTimeStep = (curItem->m_endTime - curItem->m_startTime) / (float)widthInPixels; const int32 pixelStepSize = 1;//(widthInPixels / 300.0f) + 1; path.moveTo(QPointF(startTimePixel - 1, itemRect.bottom() + 1)); - path.lineTo(QPointF(startTimePixel + 1, itemRect.bottom() - 1 - lastWeight * mNodeHistoryItemHeight)); + path.lineTo(QPointF(startTimePixel + 1, itemRect.bottom() - 1 - lastWeight * m_nodeHistoryItemHeight)); bool firstPixel = true; for (int32 w = 1; w < widthInPixels - 1; w += pixelStepSize) { @@ -720,13 +720,13 @@ namespace EMStudio firstPixel = false; } - const float weight = keyTrack->GetValueAtTime(w * keyTimeStep, &curItem->mCachedKey, nullptr, interpolate); - const float height = aznumeric_cast(itemRect.bottom() - weight * mNodeHistoryItemHeight); + const float weight = keyTrack->GetValueAtTime(w * keyTimeStep, &curItem->m_cachedKey, nullptr, interpolate); + const float height = aznumeric_cast(itemRect.bottom() - weight * m_nodeHistoryItemHeight); path.lineTo(QPointF(startTimePixel + w + 1, height)); } - const float weight = keyTrack->GetValueAtTime(curItem->mEndTime, &curItem->mCachedKey, nullptr, interpolate); - const float height = aznumeric_cast(itemRect.bottom() - weight * mNodeHistoryItemHeight); + const float weight = keyTrack->GetValueAtTime(curItem->m_endTime, &curItem->m_cachedKey, nullptr, interpolate); + const float height = aznumeric_cast(itemRect.bottom() - weight * m_nodeHistoryItemHeight); path.lineTo(QPointF(startTimePixel + widthInPixels - 1, height)); path.lineTo(QPointF(startTimePixel + widthInPixels, itemRect.bottom() + 1)); painter.drawPath(path); @@ -737,9 +737,9 @@ namespace EMStudio // draw the text if (matchesEvent != true) { - if (mIsScrolling == false && mPlugin->mIsAnimating == false) + if (m_isScrolling == false && m_plugin->m_isAnimating == false) { - if (mPlugin->mNodeHistoryItem != curItem) + if (m_plugin->m_nodeHistoryItem != curItem) { painter.setPen(QColor(255, 255, 255, 175)); } @@ -758,25 +758,25 @@ namespace EMStudio painter.setPen(Qt::black); } - mTempString.clear(); + m_tempString.clear(); if (showNodeNames) { - mTempString += curItem->mName.c_str(); + m_tempString += curItem->m_name.c_str(); } - if (showMotionFiles && !curItem->mMotionFileName.empty()) + if (showMotionFiles && !curItem->m_motionFileName.empty()) { - if (!mTempString.empty()) + if (!m_tempString.empty()) { - mTempString += " - "; + m_tempString += " - "; } - mTempString += curItem->mMotionFileName.c_str(); + m_tempString += curItem->m_motionFileName.c_str(); } - if (!mTempString.empty()) + if (!m_tempString.empty()) { - painter.drawText(aznumeric_cast(itemRect.left() + 3), aznumeric_cast(itemRect.bottom() - 2), mTempString.c_str()); + painter.drawText(aznumeric_cast(itemRect.left() + 3), aznumeric_cast(itemRect.bottom() - 2), m_tempString.c_str()); } painter.setClipping(false); @@ -793,17 +793,17 @@ namespace EMStudio // get the track over which the cursor is positioned QPoint localCursorPos = mapFromGlobal(QCursor::pos()); - TimeTrack* mouseCursorTrack = mPlugin->GetTrackAt(localCursorPos.y()); + TimeTrack* mouseCursorTrack = m_plugin->GetTrackAt(localCursorPos.y()); if (localCursorPos.x() < 0 || localCursorPos.x() > width()) { mouseCursorTrack = nullptr; } // handle highlighting - const size_t numTracks = mPlugin->GetNumTracks(); + const size_t numTracks = m_plugin->GetNumTracks(); for (size_t i = 0; i < numTracks; ++i) { - TimeTrack* track = mPlugin->GetTrack(i); + TimeTrack* track = m_plugin->GetTrack(i); // set the highlighting flag for the track if (track == mouseCursorTrack) @@ -812,7 +812,7 @@ namespace EMStudio track->SetIsHighlighted(true); // get the element over which the cursor is positioned - TimeTrackElement* mouseCursorElement = mPlugin->GetElementAt(localCursorPos.x(), localCursorPos.y()); + TimeTrackElement* mouseCursorElement = m_plugin->GetElementAt(localCursorPos.x(), localCursorPos.y()); // get the number of elements, iterate through them and disable the highlight flag const size_t numElements = track->GetNumElements(); @@ -844,7 +844,7 @@ namespace EMStudio } } - EMotionFX::Motion* motion = mPlugin->GetMotion(); + EMotionFX::Motion* motion = m_plugin->GetMotion(); if (motion) { // get the motion length @@ -852,8 +852,8 @@ namespace EMStudio // get the playback info and read out the clip start/end times EMotionFX::PlayBackInfo* playbackInfo = motion->GetDefaultPlayBackInfo(); - clipStart = playbackInfo->mClipStartTime; - clipEnd = playbackInfo->mClipEndTime; + clipStart = playbackInfo->m_clipStartTime; + clipEnd = playbackInfo->m_clipEndTime; // HACK: fix this later clipStart = 0.0; @@ -861,9 +861,9 @@ namespace EMStudio } // calculate the pixel index of where the animation ends and where it gets clipped - const double animEndPixel = mPlugin->TimeToPixel(animationLength); - const double clipStartPixel = mPlugin->TimeToPixel(clipStart); - const double clipEndPixel = mPlugin->TimeToPixel(clipEnd); + const double animEndPixel = m_plugin->TimeToPixel(animationLength); + const double clipStartPixel = m_plugin->TimeToPixel(clipStart); + const double clipEndPixel = m_plugin->TimeToPixel(clipEnd); // enable anti aliassing //painter.setRenderHint(QPainter::Antialiasing); @@ -888,13 +888,13 @@ namespace EMStudio // render the rects painter.setPen(Qt::NoPen); - painter.setBrush(mBrushBackgroundClipped); + painter.setBrush(m_brushBackgroundClipped); painter.drawRect(clipStartRect); - painter.setBrush(mBrushBackground); + painter.setBrush(m_brushBackground); painter.drawRect(motionRect); - painter.setBrush(mBrushBackgroundClipped); + painter.setBrush(m_brushBackgroundClipped); painter.drawRect(clipEndRect); - painter.setBrush(mBrushBackgroundOutOfRange); + painter.setBrush(m_brushBackgroundOutOfRange); painter.drawRect(outOfRangeRect); // render the tracks @@ -909,16 +909,16 @@ namespace EMStudio // calculate the start and end time range of the visible area double visibleStartTime, visibleEndTime; - visibleStartTime = mPlugin->PixelToTime(0); //mPlugin->CalcTime( 0, &visibleStartTime, nullptr, nullptr, nullptr, nullptr ); - visibleEndTime = mPlugin->PixelToTime(width); //mPlugin->CalcTime( width, &visibleEndTime, nullptr, nullptr, nullptr, nullptr ); + visibleStartTime = m_plugin->PixelToTime(0); + visibleEndTime = m_plugin->PixelToTime(width); // for all tracks - for (TimeTrack* track : mPlugin->mTracks) + for (TimeTrack* track : m_plugin->m_tracks) { track->SetStartY(yOffset); // path for making the cut elements a bit transparent - if (mCutMode) + if (m_cutMode) { // disable cut mode for all elements on default const size_t numElements = track->GetNumElements(); @@ -928,7 +928,7 @@ namespace EMStudio } // get the number of copy elements and check if ours is in - for (const CopyElement& copyElement : mCopyElements) + for (const CopyElement& copyElement : m_copyElements) { // get the copy element and make sure we're in the right track if (copyElement.m_trackName != track->GetName()) @@ -958,27 +958,27 @@ namespace EMStudio } // render the element time handles - mPlugin->RenderElementTimeHandles(painter, height, mPlugin->mPenTimeHandles); + m_plugin->RenderElementTimeHandles(painter, height, m_plugin->m_penTimeHandles); } // show the time of the currently dragging element in the time info view void TrackDataWidget::ShowElementTimeInfo(TimeTrackElement* element) { - if (mPlugin->GetTimeInfoWidget() == nullptr) + if (m_plugin->GetTimeInfoWidget() == nullptr) { return; } // enable overwrite mode so that the time info widget will show the custom time rather than the current time of the plugin - mPlugin->GetTimeInfoWidget()->SetIsOverwriteMode(true); + m_plugin->GetTimeInfoWidget()->SetIsOverwriteMode(true); // calculate the dimensions int32 startX, startY, width, height; element->CalcDimensions(&startX, &startY, &width, &height); // show the times of the element - mPlugin->GetTimeInfoWidget()->SetOverwriteTime(mPlugin->PixelToTime(startX), mPlugin->PixelToTime(startX + width)); + m_plugin->GetTimeInfoWidget()->SetOverwriteTime(m_plugin->PixelToTime(startX), m_plugin->PixelToTime(startX + width)); } @@ -990,21 +990,21 @@ namespace EMStudio } // if we clicked inside the node history area - RecorderGroup* recorderGroup = mPlugin->GetTimeViewToolBar()->GetRecorderGroup(); + RecorderGroup* recorderGroup = m_plugin->GetTimeViewToolBar()->GetRecorderGroup(); if (GetIsInsideNodeHistory(event->y()) && recorderGroup->GetDisplayNodeActivity()) { EMotionFX::Recorder::ActorInstanceData* actorInstanceData = FindActorInstanceData(); EMotionFX::Recorder::NodeHistoryItem* historyItem = FindNodeHistoryItem(actorInstanceData, event->x(), event->y()); if (historyItem) { - emit mPlugin->DoubleClickedRecorderNodeHistoryItem(actorInstanceData, historyItem); + emit m_plugin->DoubleClickedRecorderNodeHistoryItem(actorInstanceData, historyItem); } } } void TrackDataWidget::SetPausedTime(float timeValue, bool emitTimeChangeStart) { - mPlugin->mCurTime = timeValue; + m_plugin->m_curTime = timeValue; const AZStd::vector& motionInstances = MotionWindowPlugin::GetSelectedMotionInstances(); if (motionInstances.size() == 1) { @@ -1014,137 +1014,137 @@ namespace EMStudio } if (emitTimeChangeStart) { - emit mPlugin->ManualTimeChangeStart(timeValue); + emit m_plugin->ManualTimeChangeStart(timeValue); } - emit mPlugin->ManualTimeChange(timeValue); + emit m_plugin->ManualTimeChange(timeValue); } // when the mouse is moving, while a button is pressed void TrackDataWidget::mouseMoveEvent(QMouseEvent* event) { - mPlugin->SetRedrawFlag(); + m_plugin->SetRedrawFlag(); QPoint mousePos = event->pos(); - const int32 deltaRelX = event->x() - mLastMouseX; - mLastMouseX = event->x(); - mPlugin->mCurMouseX = event->x(); - mPlugin->mCurMouseY = event->y(); + const int32 deltaRelX = event->x() - m_lastMouseX; + m_lastMouseX = event->x(); + m_plugin->m_curMouseX = event->x(); + m_plugin->m_curMouseY = event->y(); - const int32 deltaRelY = event->y() - mLastMouseY; - mLastMouseY = event->y(); + const int32 deltaRelY = event->y() - m_lastMouseY; + m_lastMouseY = event->y(); const bool altPressed = event->modifiers() & Qt::AltModifier; - const bool isZooming = mMouseLeftClicked == false && mMouseRightClicked && altPressed; - const bool isPanning = mMouseLeftClicked == false && isZooming == false && (mMouseMidClicked || mMouseRightClicked); + const bool isZooming = m_mouseLeftClicked == false && m_mouseRightClicked && altPressed; + const bool isPanning = m_mouseLeftClicked == false && isZooming == false && (m_mouseMidClicked || m_mouseRightClicked); if (deltaRelY != 0) { - mAllowContextMenu = false; + m_allowContextMenu = false; } // get the track over which the cursor is positioned - TimeTrack* mouseCursorTrack = mPlugin->GetTrackAt(event->y()); + TimeTrack* mouseCursorTrack = m_plugin->GetTrackAt(event->y()); - if (mMouseRightClicked) + if (m_mouseRightClicked) { - mIsScrolling = true; + m_isScrolling = true; } // if the mouse left button is pressed - if (mMouseLeftClicked) + if (m_mouseLeftClicked) { if (altPressed) { - mRectZooming = true; + m_rectZooming = true; } else { - mRectZooming = false; + m_rectZooming = false; } // rect selection: update mouse position - if (mRectSelecting) + if (m_rectSelecting) { - mSelectEnd = mousePos; + m_selectEnd = mousePos; } - if (mDraggingElement == nullptr && mResizeElement == nullptr && mRectSelecting == false) + if (m_draggingElement == nullptr && m_resizeElement == nullptr && m_rectSelecting == false) { // update the current time marker int newX = event->x(); newX = MCore::Clamp(newX, 0, geometry().width() - 1); - mPlugin->mCurTime = mPlugin->PixelToTime(newX); + m_plugin->m_curTime = m_plugin->PixelToTime(newX); EMotionFX::Recorder& recorder = EMotionFX::GetRecorder(); if (recorder.GetRecordTime() > MCore::Math::epsilon) { if (recorder.GetIsInPlayMode()) { - recorder.SetCurrentPlayTime(aznumeric_cast(mPlugin->GetCurrentTime())); + recorder.SetCurrentPlayTime(aznumeric_cast(m_plugin->GetCurrentTime())); recorder.SetAutoPlay(false); - emit mPlugin->ManualTimeChange(aznumeric_cast(mPlugin->GetCurrentTime())); + emit m_plugin->ManualTimeChange(aznumeric_cast(m_plugin->GetCurrentTime())); } } else { - SetPausedTime(aznumeric_cast(mPlugin->mCurTime)); + SetPausedTime(aznumeric_cast(m_plugin->m_curTime)); } - mIsScrolling = true; + m_isScrolling = true; } TimeTrack* dragElementTrack = nullptr; - if (mDraggingElement) + if (m_draggingElement) { - dragElementTrack = mDraggingElement->GetTrack(); + dragElementTrack = m_draggingElement->GetTrack(); } // calculate the delta movement - const int32 deltaX = event->x() - mLastLeftClickedX; + const int32 deltaX = event->x() - m_lastLeftClickedX; const int32 movement = abs(deltaX); const bool elementTrackChanged = (mouseCursorTrack && dragElementTrack && mouseCursorTrack != dragElementTrack); - if ((movement > 1 && !mDragging) || elementTrackChanged) + if ((movement > 1 && !m_dragging) || elementTrackChanged) { - mDragging = true; + m_dragging = true; } // handle resizing - if (mResizing) + if (m_resizing) { - if (mPlugin->FindTrackByElement(mResizeElement) == nullptr) + if (m_plugin->FindTrackByElement(m_resizeElement) == nullptr) { - mResizeElement = nullptr; + m_resizeElement = nullptr; } - if (mResizeElement) + if (m_resizeElement) { - TimeTrack* resizeElementTrack = mResizeElement->GetTrack(); + TimeTrack* resizeElementTrack = m_resizeElement->GetTrack(); // only allow resizing on enabled time tracks if (resizeElementTrack->GetIsEnabled()) { - mResizeElement->SetShowTimeHandles(true); - mResizeElement->SetShowToolTip(false); + m_resizeElement->SetShowTimeHandles(true); + m_resizeElement->SetShowToolTip(false); - double resizeTime = (deltaRelX / mPlugin->mTimeScale) / mPlugin->mPixelsPerSecond; - mResizeID = mResizeElement->HandleResize(mResizeID, resizeTime, 0.02 / mPlugin->mTimeScale); + double resizeTime = (deltaRelX / m_plugin->m_timeScale) / m_plugin->m_pixelsPerSecond; + m_resizeId = m_resizeElement->HandleResize(m_resizeId, resizeTime, 0.02 / m_plugin->m_timeScale); // show the time of the currently resizing element in the time info view - ShowElementTimeInfo(mResizeElement); + ShowElementTimeInfo(m_resizeElement); // Move the current time marker along with the event resizing position. float timeValue = 0.0f; - switch (mResizeID) + switch (m_resizeId) { case TimeTrackElement::RESIZEPOINT_START: { - timeValue = aznumeric_cast(mResizeElement->GetStartTime()); + timeValue = aznumeric_cast(m_resizeElement->GetStartTime()); break; } case TimeTrackElement::RESIZEPOINT_END: { - timeValue = aznumeric_cast(mResizeElement->GetEndTime()); + timeValue = aznumeric_cast(m_resizeElement->GetEndTime()); break; } default: @@ -1162,7 +1162,7 @@ namespace EMStudio } // if we are not dragging or no element is being dragged, there is nothing to do - if (mDragging == false || mDraggingElement == nullptr) + if (m_dragging == false || m_draggingElement == nullptr) { return; } @@ -1171,79 +1171,79 @@ namespace EMStudio if (elementTrackChanged) { // if yes we need to remove the dragging element from the old time track - dragElementTrack->RemoveElement(mDraggingElement, false); + dragElementTrack->RemoveElement(m_draggingElement, false); // and add it to the new time track where the cursor now is over - mouseCursorTrack->AddElement(mDraggingElement); - mDraggingElement->SetTrack(mouseCursorTrack); + mouseCursorTrack->AddElement(m_draggingElement); + m_draggingElement->SetTrack(mouseCursorTrack); } // show the time of the currently dragging element in the time info view - ShowElementTimeInfo(mDraggingElement); + ShowElementTimeInfo(m_draggingElement); // adjust the cursor setCursor(Qt::ClosedHandCursor); - mDraggingElement->SetShowToolTip(false); + m_draggingElement->SetShowToolTip(false); // show the time handles - mDraggingElement->SetShowTimeHandles(true); + m_draggingElement->SetShowTimeHandles(true); - const double snapThreshold = 0.02 / mPlugin->mTimeScale; + const double snapThreshold = 0.02 / m_plugin->m_timeScale; // calculate how many pixels we moved with the mouse - const int32 deltaMovement = event->x() - mLastMouseMoveX; - mLastMouseMoveX = event->x(); + const int32 deltaMovement = event->x() - m_lastMouseMoveX; + m_lastMouseMoveX = event->x(); // snap the moved amount to a given time value - double snappedTime = mDraggingElement->GetStartTime() + ((deltaMovement / mPlugin->mPixelsPerSecond) / mPlugin->mTimeScale); + double snappedTime = m_draggingElement->GetStartTime() + ((deltaMovement / m_plugin->m_pixelsPerSecond) / m_plugin->m_timeScale); bool startSnapped = false; if (abs(deltaMovement) < 2 && abs(deltaMovement) > 0) // only snap when moving the mouse very slowly { - startSnapped = mPlugin->SnapTime(&snappedTime, mDraggingElement, snapThreshold); + startSnapped = m_plugin->SnapTime(&snappedTime, m_draggingElement, snapThreshold); } // in case the start time didn't snap to anything if (startSnapped == false) { // try to snap the end time - double snappedEndTime = mDraggingElement->GetEndTime() + ((deltaMovement / mPlugin->mPixelsPerSecond) / mPlugin->mTimeScale); - /*bool endSnapped = */ mPlugin->SnapTime(&snappedEndTime, mDraggingElement, snapThreshold); + double snappedEndTime = m_draggingElement->GetEndTime() + ((deltaMovement / m_plugin->m_pixelsPerSecond) / m_plugin->m_timeScale); + /*bool endSnapped = */ m_plugin->SnapTime(&snappedEndTime, m_draggingElement, snapThreshold); // apply the delta movement - const double deltaTime = snappedEndTime - mDraggingElement->GetEndTime(); - mDraggingElement->MoveRelative(deltaTime); + const double deltaTime = snappedEndTime - m_draggingElement->GetEndTime(); + m_draggingElement->MoveRelative(deltaTime); } else { // apply the snapped delta movement - const double deltaTime = snappedTime - mDraggingElement->GetStartTime(); - mDraggingElement->MoveRelative(deltaTime); + const double deltaTime = snappedTime - m_draggingElement->GetStartTime(); + m_draggingElement->MoveRelative(deltaTime); } - dragElementTrack = mDraggingElement->GetTrack(); - const float timeValue = aznumeric_cast(mDraggingElement->GetStartTime()); + dragElementTrack = m_draggingElement->GetTrack(); + const float timeValue = aznumeric_cast(m_draggingElement->GetStartTime()); SetPausedTime(timeValue); } else if (isPanning) { if (EMotionFX::GetRecorder().GetIsRecording() == false) { - mPlugin->DeltaScrollX(-deltaRelX, false); + m_plugin->DeltaScrollX(-deltaRelX, false); } } else if (isZooming) { if (deltaRelY < 0) { - setCursor(*(mPlugin->GetZoomOutCursor())); + setCursor(*(m_plugin->GetZoomOutCursor())); } else { - setCursor(*(mPlugin->GetZoomInCursor())); + setCursor(*(m_plugin->GetZoomInCursor())); } - DoMouseYMoveZoom(deltaRelY, mPlugin); + DoMouseYMoveZoom(deltaRelY, m_plugin); } else // no left mouse button is pressed { @@ -1271,10 +1271,10 @@ namespace EMStudio void TrackDataWidget::UpdateMouseOverCursor(int32 x, int32 y) { // disable all tooltips - mPlugin->DisableAllToolTips(); + m_plugin->DisableAllToolTips(); // get the time track and return directly if we are not over a valid track with the cursor - TimeTrack* timeTrack = mPlugin->GetTrackAt(y); + TimeTrack* timeTrack = m_plugin->GetTrackAt(y); if (timeTrack == nullptr) { setCursor(Qt::ArrowCursor); @@ -1282,7 +1282,7 @@ namespace EMStudio } // get the element over which the cursor is positioned - TimeTrackElement* element = mPlugin->GetElementAt(x, y); + TimeTrackElement* element = m_plugin->GetElementAt(x, y); // in case the cursor is over an element, show tool tips if (element) @@ -1291,7 +1291,7 @@ namespace EMStudio } else { - mPlugin->DisableAllToolTips(); + m_plugin->DisableAllToolTips(); } // do not allow any editing in case the track is not enabled @@ -1302,10 +1302,10 @@ namespace EMStudio } // check if we are hovering over a resize point - if (mPlugin->FindResizePoint(x, y, &mResizeElement, &mResizeID)) + if (m_plugin->FindResizePoint(x, y, &m_resizeElement, &m_resizeId)) { setCursor(Qt::SizeHorCursor); - mResizeElement->SetShowToolTip(true); + m_resizeElement->SetShowToolTip(true); } else // if we're not above a resize point { @@ -1324,7 +1324,7 @@ namespace EMStudio // when the mouse is pressed void TrackDataWidget::mousePressEvent(QMouseEvent* event) { - mPlugin->SetRedrawFlag(); + m_plugin->SetRedrawFlag(); QPoint mousePos = event->pos(); @@ -1333,35 +1333,35 @@ namespace EMStudio const bool altPressed = event->modifiers() & Qt::AltModifier; // store the last clicked position - mLastMouseMoveX = event->x(); - mAllowContextMenu = true; - mRectSelecting = false; + m_lastMouseMoveX = event->x(); + m_allowContextMenu = true; + m_rectSelecting = false; if (event->button() == Qt::RightButton) { - mMouseRightClicked = true; + m_mouseRightClicked = true; } if (event->button() == Qt::MidButton) { - mMouseMidClicked = true; + m_mouseMidClicked = true; } if (event->button() == Qt::LeftButton) { - mMouseLeftClicked = true; + m_mouseLeftClicked = true; EMotionFX::Recorder& recorder = EMotionFX::GetRecorder(); - if ((mPlugin->mNodeHistoryItem == nullptr) && altPressed == false && (recorder.GetRecordTime() >= MCore::Math::epsilon)) + if ((m_plugin->m_nodeHistoryItem == nullptr) && altPressed == false && (recorder.GetRecordTime() >= MCore::Math::epsilon)) { // update the current time marker int newX = event->x(); newX = MCore::Clamp(newX, 0, geometry().width() - 1); - mPlugin->mCurTime = mPlugin->PixelToTime(newX); + m_plugin->m_curTime = m_plugin->PixelToTime(newX); if (recorder.GetRecordTime() < MCore::Math::epsilon) { - SetPausedTime(aznumeric_cast(mPlugin->GetCurrentTime()), /*emitTimeChangeStart=*/true); + SetPausedTime(aznumeric_cast(m_plugin->GetCurrentTime()), /*emitTimeChangeStart=*/true); } else { @@ -1370,34 +1370,34 @@ namespace EMStudio recorder.StartPlayBack(); } - recorder.SetCurrentPlayTime(aznumeric_cast(mPlugin->GetCurrentTime())); + recorder.SetCurrentPlayTime(aznumeric_cast(m_plugin->GetCurrentTime())); recorder.SetAutoPlay(false); - emit mPlugin->ManualTimeChangeStart(aznumeric_cast(mPlugin->GetCurrentTime())); - emit mPlugin->ManualTimeChange(aznumeric_cast(mPlugin->GetCurrentTime())); + emit m_plugin->ManualTimeChangeStart(aznumeric_cast(m_plugin->GetCurrentTime())); + emit m_plugin->ManualTimeChange(aznumeric_cast(m_plugin->GetCurrentTime())); } } else // not inside timeline { // if we clicked inside the node history area - RecorderGroup* recorderGroup = mPlugin->GetTimeViewToolBar()->GetRecorderGroup(); + RecorderGroup* recorderGroup = m_plugin->GetTimeViewToolBar()->GetRecorderGroup(); if (GetIsInsideNodeHistory(event->y()) && recorderGroup->GetDisplayNodeActivity()) { EMotionFX::Recorder::ActorInstanceData* actorInstanceData = FindActorInstanceData(); EMotionFX::Recorder::NodeHistoryItem* historyItem = FindNodeHistoryItem(actorInstanceData, event->x(), event->y()); if (historyItem && altPressed == false) { - emit mPlugin->ClickedRecorderNodeHistoryItem(actorInstanceData, historyItem); + emit m_plugin->ClickedRecorderNodeHistoryItem(actorInstanceData, historyItem); } } { // unselect all elements if (ctrlPressed == false && shiftPressed == false) { - mPlugin->UnselectAllElements(); + m_plugin->UnselectAllElements(); } // find the element we're clicking in - TimeTrackElement* element = mPlugin->GetElementAt(event->x(), event->y()); + TimeTrackElement* element = m_plugin->GetElementAt(event->x(), event->y()); if (element) { // show the time of the currently dragging element in the time info view @@ -1407,15 +1407,15 @@ namespace EMStudio if (timeTrack->GetIsEnabled()) { - mDraggingElement = element; - mDragElementTrack = timeTrack; - mDraggingElement->SetShowTimeHandles(true); + m_draggingElement = element; + m_dragElementTrack = timeTrack; + m_draggingElement->SetShowTimeHandles(true); setCursor(Qt::ClosedHandCursor); } else { - mDraggingElement = nullptr; - mDragElementTrack = nullptr; + m_draggingElement = nullptr; + m_dragElementTrack = nullptr; } // shift select @@ -1443,28 +1443,28 @@ namespace EMStudio } else // no element clicked { - mDraggingElement = nullptr; - mDragElementTrack = nullptr; + m_draggingElement = nullptr; + m_dragElementTrack = nullptr; // rect selection - mRectSelecting = true; - mSelectStart = mousePos; - mSelectEnd = mSelectStart; + m_rectSelecting = true; + m_selectStart = mousePos; + m_selectEnd = m_selectStart; setCursor(Qt::ArrowCursor); } // if we're going to resize - mResizing = mResizeElement && mResizeID != InvalidIndex32; + m_resizing = m_resizeElement && m_resizeId != InvalidIndex32; // store the last clicked position - mMouseLeftClicked = true; - mLastLeftClickedX = event->x(); + m_mouseLeftClicked = true; + m_lastLeftClickedX = event->x(); } } } - const bool isZooming = mMouseLeftClicked == false && mMouseRightClicked && altPressed; - const bool isPanning = mMouseLeftClicked == false && isZooming == false && (mMouseMidClicked || mMouseRightClicked); + const bool isZooming = m_mouseLeftClicked == false && m_mouseRightClicked && altPressed; + const bool isPanning = m_mouseLeftClicked == false && isZooming == false && (m_mouseMidClicked || m_mouseRightClicked); if (isPanning) { @@ -1473,7 +1473,7 @@ namespace EMStudio if (isZooming) { - setCursor(*(mPlugin->GetZoomInCursor())); + setCursor(*(m_plugin->GetZoomInCursor())); } } @@ -1481,58 +1481,58 @@ namespace EMStudio // when releasing the mouse button void TrackDataWidget::mouseReleaseEvent(QMouseEvent* event) { - mPlugin->SetRedrawFlag(); + m_plugin->SetRedrawFlag(); setCursor(Qt::ArrowCursor); // disable overwrite mode in any case when the mouse gets released so that we display the current time from the plugin again - if (mPlugin->GetTimeInfoWidget()) + if (m_plugin->GetTimeInfoWidget()) { - mPlugin->GetTimeInfoWidget()->SetIsOverwriteMode(false); + m_plugin->GetTimeInfoWidget()->SetIsOverwriteMode(false); } - mLastMouseMoveX = event->x(); + m_lastMouseMoveX = event->x(); const bool ctrlPressed = event->modifiers() & Qt::ControlModifier; //const bool shiftPressed = event->modifiers() & Qt::ShiftModifier; if (event->button() == Qt::RightButton) { - mMouseRightClicked = false; - mIsScrolling = false; + m_mouseRightClicked = false; + m_isScrolling = false; } if (event->button() == Qt::MidButton) { - mMouseMidClicked = false; + m_mouseMidClicked = false; } if (event->button() == Qt::LeftButton) { - TimeTrack* mouseCursorTrack = mPlugin->GetTrackAt(event->y()); - const bool elementTrackChanged = (mouseCursorTrack && mDragElementTrack && mouseCursorTrack != mDragElementTrack); + TimeTrack* mouseCursorTrack = m_plugin->GetTrackAt(event->y()); + const bool elementTrackChanged = (mouseCursorTrack && m_dragElementTrack && mouseCursorTrack != m_dragElementTrack); - if (mDragging && mMouseLeftClicked && mDraggingElement && !mIsScrolling && !mResizing) + if (m_dragging && m_mouseLeftClicked && m_draggingElement && !m_isScrolling && !m_resizing) { - SetPausedTime(aznumeric_cast(mDraggingElement->GetStartTime())); + SetPausedTime(aznumeric_cast(m_draggingElement->GetStartTime())); } - if ((mResizing || mDragging) && elementTrackChanged == false && mDraggingElement) + if ((m_resizing || m_dragging) && elementTrackChanged == false && m_draggingElement) { - emit MotionEventChanged(mDraggingElement, mDraggingElement->GetStartTime(), mDraggingElement->GetEndTime()); + emit MotionEventChanged(m_draggingElement, m_draggingElement->GetStartTime(), m_draggingElement->GetEndTime()); } - mMouseLeftClicked = false; - mDragging = false; - mResizing = false; - mIsScrolling = false; + m_mouseLeftClicked = false; + m_dragging = false; + m_resizing = false; + m_isScrolling = false; // rect selection - if (mRectSelecting) + if (m_rectSelecting) { - if (mRectZooming) + if (m_rectZooming) { - mRectZooming = false; + m_rectZooming = false; // calc the selection rect QRect selectRect; @@ -1541,7 +1541,7 @@ namespace EMStudio // zoom in on the rect if (selectRect.isEmpty() == false) { - mPlugin->ZoomRect(selectRect); + m_plugin->ZoomRect(selectRect); } } else @@ -1553,8 +1553,6 @@ namespace EMStudio // select things inside it if (selectRect.isEmpty() == false) { - //selectRect = mActiveGraph->GetTransform().inverted().mapRect( selectRect ); - // rect select the elements const bool overwriteSelection = (ctrlPressed == false); SelectElementsInRect(selectRect, overwriteSelection, true, ctrlPressed); @@ -1563,37 +1561,37 @@ namespace EMStudio } // check if we moved an element to another track - if (elementTrackChanged && mDraggingElement) + if (elementTrackChanged && m_draggingElement) { // lastly fire a signal so that the data can change along with - emit ElementTrackChanged(mDraggingElement->GetElementNumber(), aznumeric_cast(mDraggingElement->GetStartTime()), aznumeric_cast(mDraggingElement->GetEndTime()), mDragElementTrack->GetName(), mouseCursorTrack->GetName()); + emit ElementTrackChanged(m_draggingElement->GetElementNumber(), aznumeric_cast(m_draggingElement->GetStartTime()), aznumeric_cast(m_draggingElement->GetEndTime()), m_dragElementTrack->GetName(), mouseCursorTrack->GetName()); } - mDragElementTrack = nullptr; + m_dragElementTrack = nullptr; - if (mDraggingElement) + if (m_draggingElement) { - mDraggingElement->SetShowTimeHandles(false); - mDraggingElement = nullptr; + m_draggingElement->SetShowTimeHandles(false); + m_draggingElement = nullptr; } // disable rect selection mode again - mRectSelecting = false; + m_rectSelecting = false; return; } // disable rect selection mode again - mRectSelecting = false; + m_rectSelecting = false; UpdateMouseOverCursor(event->x(), event->y()); } void TrackDataWidget::ClearState() { - mDragElementTrack = nullptr; - mDraggingElement = nullptr; - mDragging = false; - mResizing = false; - mResizeElement = nullptr; + m_dragElementTrack = nullptr; + m_draggingElement = nullptr; + m_dragging = false; + m_resizing = false; + m_resizeElement = nullptr; } // the mouse wheel is adjusted @@ -1637,15 +1635,15 @@ namespace EMStudio // handle mouse wheel event void TrackDataWidget::wheelEvent(QWheelEvent* event) { - DoWheelEvent(event, mPlugin); + DoWheelEvent(event, m_plugin); } // drag & drop support void TrackDataWidget::dragEnterEvent(QDragEnterEvent* event) { - mPlugin->SetRedrawFlag(); - mOldCurrentTime = mPlugin->GetCurrentTime(); + m_plugin->SetRedrawFlag(); + m_oldCurrentTime = m_plugin->GetCurrentTime(); // this is needed to actually reach the drop event function event->acceptProposedAction(); @@ -1654,11 +1652,11 @@ namespace EMStudio void TrackDataWidget::dragMoveEvent(QDragMoveEvent* event) { - mPlugin->SetRedrawFlag(); + m_plugin->SetRedrawFlag(); QPoint mousePos = event->pos(); - double dropTime = mPlugin->PixelToTime(mousePos.x()); - mPlugin->SetCurrentTime(dropTime); + double dropTime = m_plugin->PixelToTime(mousePos.x()); + m_plugin->SetCurrentTime(dropTime); SetPausedTime(aznumeric_cast(dropTime)); } @@ -1666,26 +1664,26 @@ namespace EMStudio void TrackDataWidget::dropEvent(QDropEvent* event) { - mPlugin->SetRedrawFlag(); + m_plugin->SetRedrawFlag(); // accept the drop event->acceptProposedAction(); // emit drop event emit MotionEventPresetsDropped(event->pos()); - mPlugin->SetCurrentTime(mOldCurrentTime); + m_plugin->SetCurrentTime(m_oldCurrentTime); } // the context menu event void TrackDataWidget::contextMenuEvent(QContextMenuEvent* event) { - if (mIsScrolling || mDragging || mResizing || !mAllowContextMenu) + if (m_isScrolling || m_dragging || m_resizing || !m_allowContextMenu) { return; } - mPlugin->SetRedrawFlag(); + m_plugin->SetRedrawFlag(); if (EMotionFX::GetRecorder().GetRecordTime() > MCore::Math::epsilon) { @@ -1693,26 +1691,26 @@ namespace EMStudio return; } - if (mPlugin->mMotion == nullptr) + if (m_plugin->m_motion == nullptr) { return; } QPoint point = event->pos(); - mContextMenuX = point.x(); - mContextMenuY = point.y(); + m_contextMenuX = point.x(); + m_contextMenuY = point.y(); - TimeTrack* timeTrack = mPlugin->GetTrackAt(mContextMenuY); + TimeTrack* timeTrack = m_plugin->GetTrackAt(m_contextMenuY); size_t numElements = 0; size_t numSelectedElements = 0; // calculate the number of selected and total events - const size_t numTracks = mPlugin->GetNumTracks(); + const size_t numTracks = m_plugin->GetNumTracks(); for (size_t i = 0; i < numTracks; ++i) { // get the current time view track - TimeTrack* track = mPlugin->GetTrack(i); + TimeTrack* track = m_plugin->GetTrack(i); if (track->GetIsVisible() == false) { continue; @@ -1751,7 +1749,7 @@ namespace EMStudio if (timeTrack) { - TimeTrackElement* element = mPlugin->GetElementAt(mContextMenuX, mContextMenuY); + TimeTrackElement* element = m_plugin->GetElementAt(m_contextMenuX, m_contextMenuY); if (element == nullptr) { QAction* action = menu.addAction("Add motion event"); @@ -1840,9 +1838,9 @@ namespace EMStudio // propagate key events to the plugin and let it handle by a shared function void TrackDataWidget::keyPressEvent(QKeyEvent* event) { - if (mPlugin) + if (m_plugin) { - mPlugin->OnKeyPressEvent(event); + m_plugin->OnKeyPressEvent(event); } } @@ -1850,31 +1848,31 @@ namespace EMStudio // propagate key events to the plugin and let it handle by a shared function void TrackDataWidget::keyReleaseEvent(QKeyEvent* event) { - if (mPlugin) + if (m_plugin) { - mPlugin->OnKeyReleaseEvent(event); + m_plugin->OnKeyReleaseEvent(event); } } void TrackDataWidget::AddMotionEvent(int32 x, int32 y) { - mPlugin->AddMotionEvent(x, y); + m_plugin->AddMotionEvent(x, y); } void TrackDataWidget::RemoveMotionEvent(int32 x, int32 y) { - mPlugin->SetRedrawFlag(); + m_plugin->SetRedrawFlag(); // get the time track on which we dropped the preset - TimeTrack* timeTrack = mPlugin->GetTrackAt(y); + TimeTrack* timeTrack = m_plugin->GetTrackAt(y); if (timeTrack == nullptr) { return; } // get the time track on which we dropped the preset - TimeTrackElement* element = mPlugin->GetElementAt(x, y); + TimeTrackElement* element = m_plugin->GetElementAt(x, y); if (element == nullptr) { return; @@ -1887,9 +1885,9 @@ namespace EMStudio // remove selected motion events in track void TrackDataWidget::RemoveSelectedMotionEventsInTrack() { - mPlugin->SetRedrawFlag(); + m_plugin->SetRedrawFlag(); // get the track where we are at the moment - TimeTrack* timeTrack = mPlugin->GetTrackAt(mLastMouseY); + TimeTrack* timeTrack = m_plugin->GetTrackAt(m_lastMouseY); if (timeTrack == nullptr) { return; @@ -1913,7 +1911,7 @@ namespace EMStudio // remove the motion events CommandSystem::CommandHelperRemoveMotionEvents(timeTrack->GetName(), eventNumbers); - mPlugin->UnselectAllElements(); + m_plugin->UnselectAllElements(); ClearState(); } @@ -1921,9 +1919,9 @@ namespace EMStudio // remove all motion events in track void TrackDataWidget::RemoveAllMotionEventsInTrack() { - mPlugin->SetRedrawFlag(); + m_plugin->SetRedrawFlag(); - TimeTrack* timeTrack = mPlugin->GetTrackAt(mLastMouseY); + TimeTrack* timeTrack = m_plugin->GetTrackAt(m_lastMouseY); if (timeTrack == nullptr) { return; @@ -1941,19 +1939,19 @@ namespace EMStudio // remove the motion events CommandSystem::CommandHelperRemoveMotionEvents(timeTrack->GetName(), eventNumbers); - mPlugin->UnselectAllElements(); + m_plugin->UnselectAllElements(); ClearState(); } void TrackDataWidget::OnRemoveEventTrack() { - const TimeTrack* timeTrack = mPlugin->GetTrackAt(mLastMouseY); + const TimeTrack* timeTrack = m_plugin->GetTrackAt(m_lastMouseY); if (!timeTrack) { return; } - const AZ::Outcome trackIndexOutcome = mPlugin->FindTrackIndex(timeTrack); + const AZ::Outcome trackIndexOutcome = m_plugin->FindTrackIndex(timeTrack); if (trackIndexOutcome.IsSuccess()) { RemoveTrack(trackIndexOutcome.GetValue()); @@ -1963,10 +1961,10 @@ namespace EMStudio void TrackDataWidget::FillCopyElements(bool selectedItemsOnly) { // clear the array before feeding it - mCopyElements.clear(); + m_copyElements.clear(); // get the time track name - const TimeTrack* timeTrack = mPlugin->GetTrackAt(mContextMenuY); + const TimeTrack* timeTrack = m_plugin->GetTrackAt(m_contextMenuY); if (timeTrack == nullptr) { return; @@ -1974,7 +1972,7 @@ namespace EMStudio const AZStd::string trackName = timeTrack->GetName(); // check if the motion is valid and return failure in case it is not - const EMotionFX::Motion* motion = mPlugin->GetMotion(); + const EMotionFX::Motion* motion = m_plugin->GetMotion(); if (motion == nullptr) { return; @@ -2004,7 +2002,7 @@ namespace EMStudio const EMotionFX::MotionEvent& motionEvent = eventTrack->GetEvent(i); // create the copy paste element and add it to the array - mCopyElements.emplace_back( + m_copyElements.emplace_back( motion->GetID(), eventTrack->GetNameString(), motionEvent.GetEventDatas(), @@ -2018,44 +2016,44 @@ namespace EMStudio // cut all events from a track void TrackDataWidget::OnCutTrack() { - mPlugin->SetRedrawFlag(); + m_plugin->SetRedrawFlag(); FillCopyElements(false); - mCutMode = true; + m_cutMode = true; } // copy all events from a track void TrackDataWidget::OnCopyTrack() { - mPlugin->SetRedrawFlag(); + m_plugin->SetRedrawFlag(); FillCopyElements(false); - mCutMode = false; + m_cutMode = false; } // cut motion event void TrackDataWidget::OnCutElement() { - mPlugin->SetRedrawFlag(); + m_plugin->SetRedrawFlag(); FillCopyElements(true); - mCutMode = true; + m_cutMode = true; } // copy motion event void TrackDataWidget::OnCopyElement() { - mPlugin->SetRedrawFlag(); + m_plugin->SetRedrawFlag(); FillCopyElements(true); - mCutMode = false; + m_cutMode = false; } @@ -2080,10 +2078,10 @@ namespace EMStudio // paste motion events void TrackDataWidget::DoPaste(bool useLocation) { - mPlugin->SetRedrawFlag(); + m_plugin->SetRedrawFlag(); // get the time track name where we are pasting - TimeTrack* timeTrack = mPlugin->GetTrackAt(mContextMenuY); + TimeTrack* timeTrack = m_plugin->GetTrackAt(m_contextMenuY); if (timeTrack == nullptr) { return; @@ -2091,23 +2089,23 @@ namespace EMStudio AZStd::string trackName = timeTrack->GetName(); // get the number of elements to copy - const size_t numElements = mCopyElements.size(); + const size_t numElements = m_copyElements.size(); // create the command group MCore::CommandGroup commandGroup("Paste motion events"); // find the min and maximum time values of the events to paste - auto [minEvent, maxEvent] = AZStd::minmax_element(begin(mCopyElements), end(mCopyElements), [](const CopyElement& left, const CopyElement& right) + auto [minEvent, maxEvent] = AZStd::minmax_element(begin(m_copyElements), end(m_copyElements), [](const CopyElement& left, const CopyElement& right) { return left.m_startTime < right.m_startTime; }); - if (mCutMode) + if (m_cutMode) { // iterate through the copy elements from back to front and delete the selected ones for (int32 i = static_cast(numElements) - 1; i >= 0; i--) { - const CopyElement& copyElement = mCopyElements[i]; + const CopyElement& copyElement = m_copyElements[i]; // get the motion to which the original element belongs to EMotionFX::Motion* motion = EMotionFX::GetMotionManager().FindMotionByID(copyElement.m_motionID); @@ -2146,10 +2144,10 @@ namespace EMStudio } } - const float offset = useLocation ? aznumeric_cast(mPlugin->PixelToTime(mContextMenuX, true)) - minEvent->m_startTime : 0.0f; + const float offset = useLocation ? aznumeric_cast(m_plugin->PixelToTime(m_contextMenuX, true)) - minEvent->m_startTime : 0.0f; // iterate through the elements to copy and add the new motion events - for (const CopyElement& copyElement : mCopyElements) + for (const CopyElement& copyElement : m_copyElements) { float startTime = copyElement.m_startTime + offset; float endTime = copyElement.m_endTime + offset; @@ -2171,16 +2169,16 @@ namespace EMStudio MCore::LogError(outResult.c_str()); } - if (mCutMode) + if (m_cutMode) { - mCopyElements.clear(); + m_copyElements.clear(); } } void TrackDataWidget::OnCreatePresetEvent() { - mPlugin->SetRedrawFlag(); + m_plugin->SetRedrawFlag(); EMStudioPlugin* plugin = EMStudio::GetPluginManager()->FindActivePlugin(MotionEventsPlugin::CLASS_ID); if (plugin == nullptr) { @@ -2189,13 +2187,13 @@ namespace EMStudio MotionEventsPlugin* eventsPlugin = static_cast(plugin); - QPoint mousePos(mContextMenuX, mContextMenuY); + QPoint mousePos(m_contextMenuX, m_contextMenuY); eventsPlugin->OnEventPresetDropped(mousePos); } void TrackDataWidget::OnAddTrack() { - mPlugin->SetRedrawFlag(); + m_plugin->SetRedrawFlag(); CommandSystem::CommandAddEventTrack(); } @@ -2203,11 +2201,11 @@ namespace EMStudio void TrackDataWidget::SelectElementsInRect(const QRect& rect, bool overwriteCurSelection, bool select, bool toggleMode) { // get the number of tracks and iterate through them - const size_t numTracks = mPlugin->GetNumTracks(); + const size_t numTracks = m_plugin->GetNumTracks(); for (size_t i = 0; i < numTracks; ++i) { // get the current time track - TimeTrack* track = mPlugin->GetTrack(i); + TimeTrack* track = m_plugin->GetTrack(i); if (track->GetIsVisible() == false) { continue; @@ -2262,7 +2260,7 @@ namespace EMStudio else { // get the hovered element and track - TimeTrackElement* element = mPlugin->GetElementAt(localPos.x(), localPos.y()); + TimeTrackElement* element = m_plugin->GetElementAt(localPos.x(), localPos.y()); if (element == nullptr) { return QOpenGLWidget::event(event); @@ -2291,20 +2289,20 @@ namespace EMStudio const EMotionFX::Recorder::ActorInstanceData* actorInstanceData = FindActorInstanceData(); // if we recorded node history - mNodeHistoryRect = QRect(); - if (actorInstanceData && !actorInstanceData->mNodeHistoryItems.empty()) + m_nodeHistoryRect = QRect(); + if (actorInstanceData && !actorInstanceData->m_nodeHistoryItems.empty()) { - const int height = aznumeric_caster((recorder.CalcMaxNodeHistoryTrackIndex(*actorInstanceData) + 1) * (mNodeHistoryItemHeight + 3) + mNodeRectsStartHeight); - mNodeHistoryRect.setTop(mNodeRectsStartHeight); - mNodeHistoryRect.setBottom(height); - mNodeHistoryRect.setLeft(0); - mNodeHistoryRect.setRight(geometry().width()); + const int height = aznumeric_caster((recorder.CalcMaxNodeHistoryTrackIndex(*actorInstanceData) + 1) * (m_nodeHistoryItemHeight + 3) + m_nodeRectsStartHeight); + m_nodeHistoryRect.setTop(m_nodeRectsStartHeight); + m_nodeHistoryRect.setBottom(height); + m_nodeHistoryRect.setLeft(0); + m_nodeHistoryRect.setRight(geometry().width()); } - mEventHistoryTotalHeight = 0; - if (actorInstanceData && !actorInstanceData->mEventHistoryItems.empty()) + m_eventHistoryTotalHeight = 0; + if (actorInstanceData && !actorInstanceData->m_eventHistoryItems.empty()) { - mEventHistoryTotalHeight = aznumeric_caster((recorder.CalcMaxEventHistoryTrackIndex(*actorInstanceData) + 1) * 20); + m_eventHistoryTotalHeight = aznumeric_caster((recorder.CalcMaxEventHistoryTrackIndex(*actorInstanceData) + 1) * 20); } } @@ -2322,22 +2320,22 @@ namespace EMStudio return nullptr; } - // make sure the mTrackRemap array is up to date - RecorderGroup* recorderGroup = mPlugin->GetTimeViewToolBar()->GetRecorderGroup(); + // make sure the m_trackRemap array is up to date + RecorderGroup* recorderGroup = m_plugin->GetTimeViewToolBar()->GetRecorderGroup(); const bool sorted = recorderGroup->GetSortNodeActivity(); - const int graphContentsCode = mPlugin->mTrackHeaderWidget->mNodeContentsComboBox->currentIndex(); - EMotionFX::GetRecorder().ExtractNodeHistoryItems(*actorInstanceData, aznumeric_cast(mPlugin->mCurTime), sorted, (EMotionFX::Recorder::EValueType)graphContentsCode, &mActiveItems, &mTrackRemap); + const int graphContentsCode = m_plugin->m_trackHeaderWidget->m_nodeContentsComboBox->currentIndex(); + EMotionFX::GetRecorder().ExtractNodeHistoryItems(*actorInstanceData, aznumeric_cast(m_plugin->m_curTime), sorted, (EMotionFX::Recorder::EValueType)graphContentsCode, &m_activeItems, &m_trackRemap); // get the history items shortcut - const AZStd::vector& historyItems = actorInstanceData->mNodeHistoryItems; + const AZStd::vector& historyItems = actorInstanceData->m_nodeHistoryItems; QRect rect; for (EMotionFX::Recorder::NodeHistoryItem* curItem : historyItems) { // draw the background rect - double startTimePixel = mPlugin->TimeToPixel(curItem->mStartTime); - double endTimePixel = mPlugin->TimeToPixel(curItem->mEndTime); + double startTimePixel = m_plugin->TimeToPixel(curItem->m_startTime); + double endTimePixel = m_plugin->TimeToPixel(curItem->m_endTime); if (startTimePixel > x || endTimePixel < x) { @@ -2346,8 +2344,8 @@ namespace EMStudio rect.setLeft(aznumeric_cast(startTimePixel)); rect.setRight(aznumeric_cast(endTimePixel)); - rect.setTop((mNodeRectsStartHeight + (aznumeric_cast(mTrackRemap[curItem->mTrackIndex]) * (mNodeHistoryItemHeight + 3)) + 3)); - rect.setBottom(rect.top() + mNodeHistoryItemHeight); + rect.setTop((m_nodeRectsStartHeight + (aznumeric_cast(m_trackRemap[curItem->m_trackIndex]) * (m_nodeHistoryItemHeight + 3)) + 3)); + rect.setBottom(rect.top() + m_nodeHistoryItemHeight); if (rect.contains(x, y)) { @@ -2387,8 +2385,8 @@ namespace EMStudio void TrackDataWidget::DoRecorderContextMenuEvent(QContextMenuEvent* event) { QPoint point = event->pos(); - mContextMenuX = point.x(); - mContextMenuY = point.y(); + m_contextMenuX = point.x(); + m_contextMenuY = point.y(); // create the context menu QMenu menu(this); @@ -2397,10 +2395,10 @@ namespace EMStudio // Timeline actions //--------------------- QAction* action = menu.addAction("Zoom To Fit All"); - connect(action, &QAction::triggered, mPlugin, &TimeViewPlugin::OnZoomAll); + connect(action, &QAction::triggered, m_plugin, &TimeViewPlugin::OnZoomAll); action = menu.addAction("Reset Timeline"); - connect(action, &QAction::triggered, mPlugin, &TimeViewPlugin::OnResetTimeline); + connect(action, &QAction::triggered, m_plugin, &TimeViewPlugin::OnResetTimeline); //--------------------- // Right-clicked on a motion item @@ -2411,7 +2409,7 @@ namespace EMStudio menu.addSeparator(); action = menu.addAction("Show Node In Graph"); - connect(action, &QAction::triggered, mPlugin, &TimeViewPlugin::OnShowNodeHistoryNodeInGraph); + connect(action, &QAction::triggered, m_plugin, &TimeViewPlugin::OnShowNodeHistoryNodeInGraph); } // show the menu at the given position @@ -2425,15 +2423,15 @@ namespace EMStudio // node name outString += AZStd::string::format("

Node Name: 

"); - outString += AZStd::string::format("

%s

", item->mName.c_str()); + outString += AZStd::string::format("

%s

", item->m_name.c_str()); // build the node path string - EMotionFX::ActorInstance* actorInstance = FindActorInstanceData()->mActorInstance; + EMotionFX::ActorInstance* actorInstance = FindActorInstanceData()->m_actorInstance; EMotionFX::AnimGraphInstance* animGraphInstance = actorInstance->GetAnimGraphInstance(); if (animGraphInstance) { EMotionFX::AnimGraph* animGraph = animGraphInstance->GetAnimGraph(); - EMotionFX::AnimGraphNode* node = animGraph->RecursiveFindNodeById(item->mNodeId); + EMotionFX::AnimGraphNode* node = animGraph->RecursiveFindNodeById(item->m_nodeId); if (node) { AZStd::vector nodePath; @@ -2476,13 +2474,13 @@ namespace EMStudio } // motion name - if (item->mMotionID != InvalidIndex32 && !item->mMotionFileName.empty()) + if (item->m_motionId != InvalidIndex32 && !item->m_motionFileName.empty()) { outString += AZStd::string::format("

Motion FileName: 

"); - outString += AZStd::string::format("

%s

", item->mMotionFileName.c_str()); + outString += AZStd::string::format("

%s

", item->m_motionFileName.c_str()); // show motion info - EMotionFX::Motion* motion = EMotionFX::GetMotionManager().FindMotionByID(item->mMotionID); + EMotionFX::Motion* motion = EMotionFX::GetMotionManager().FindMotionByID(item->m_motionId); if (motion) { AZStd::string path; @@ -2525,14 +2523,14 @@ namespace EMStudio return nullptr; } - const AZStd::vector& historyItems = actorInstanceData->mEventHistoryItems; + const AZStd::vector& historyItems = actorInstanceData->m_eventHistoryItems; const float tickHalfWidth = 7; const float tickHeight = 16; for (EMotionFX::Recorder::EventHistoryItem* curItem : historyItems) { - float height = aznumeric_caster((curItem->mTrackIndex * 20) + mEventsStartHeight); - double startTimePixel = mPlugin->TimeToPixel(curItem->mStartTime); + float height = aznumeric_caster((curItem->m_trackIndex * 20) + m_eventsStartHeight); + double startTimePixel = m_plugin->TimeToPixel(curItem->m_startTime); const QRect rect(QPoint(aznumeric_cast(startTimePixel - tickHalfWidth), aznumeric_cast(height)), QSize(aznumeric_cast(tickHalfWidth * 2), aznumeric_cast(tickHeight))); if (rect.contains(QPoint(x, y))) @@ -2550,7 +2548,7 @@ namespace EMStudio { outString = ""; - const EMotionFX::MotionEvent* motionEvent = item->mEventInfo.mEvent; + const EMotionFX::MotionEvent* motionEvent = item->m_eventInfo.m_event; for (const EMotionFX::EventDataPtr& eventData : motionEvent->GetEventDatas()) { if (eventData) @@ -2574,25 +2572,25 @@ namespace EMStudio outString += AZStd::string::format(""); outString += AZStd::string::format(""); - outString += AZStd::string::format("", item->mEventInfo.mTimeValue); + outString += AZStd::string::format("", item->m_eventInfo.m_timeValue); outString += AZStd::string::format(""); - outString += AZStd::string::format("", item->mStartTime); + outString += AZStd::string::format("", item->m_startTime); outString += AZStd::string::format(""); - outString += AZStd::string::format("", (item->mIsTickEvent == false) ? "Yes" : "No"); + outString += AZStd::string::format("", (item->m_isTickEvent == false) ? "Yes" : "No"); - if (item->mIsTickEvent == false) + if (item->m_isTickEvent == false) { const static AZStd::string eventStartText = "Event Start"; const static AZStd::string eventActiveText = "Event Active"; const static AZStd::string eventEndText = "Event End"; const AZStd::string* outputEventStateText = &eventStartText; - if (item->mEventInfo.m_eventState == EMotionFX::EventInfo::EventState::ACTIVE) + if (item->m_eventInfo.m_eventState == EMotionFX::EventInfo::EventState::ACTIVE) { outputEventStateText = &eventActiveText; } - else if (item->mEventInfo.m_eventState == EMotionFX::EventInfo::EventState::END) + else if (item->m_eventInfo.m_eventState == EMotionFX::EventInfo::EventState::END) { outputEventStateText = &eventEndText; } @@ -2601,18 +2599,18 @@ namespace EMStudio } outString += AZStd::string::format(""); - outString += AZStd::string::format("", item->mEventInfo.mGlobalWeight); + outString += AZStd::string::format("", item->m_eventInfo.m_globalWeight); outString += AZStd::string::format(""); - outString += AZStd::string::format("", item->mEventInfo.mLocalWeight); + outString += AZStd::string::format("", item->m_eventInfo.m_localWeight); // build the node path string - EMotionFX::ActorInstance* actorInstance = FindActorInstanceData()->mActorInstance; + EMotionFX::ActorInstance* actorInstance = FindActorInstanceData()->m_actorInstance; EMotionFX::AnimGraphInstance* animGraphInstance = actorInstance->GetAnimGraphInstance(); if (animGraphInstance) { - EMotionFX::AnimGraph* animGraph = EMotionFX::GetAnimGraphManager().FindAnimGraphByID(item->mAnimGraphID);//animGraphInstance->GetAnimGraph(); - EMotionFX::AnimGraphNode* node = animGraph->RecursiveFindNodeById(item->mEmitterNodeId); + EMotionFX::AnimGraph* animGraph = EMotionFX::GetAnimGraphManager().FindAnimGraphByID(item->m_animGraphId);//animGraphInstance->GetAnimGraph(); + EMotionFX::AnimGraphNode* node = animGraph->RecursiveFindNodeById(item->m_emitterNodeId); if (node) { outString += AZStd::string::format(""); @@ -2696,7 +2694,7 @@ namespace EMStudio { painter.setPen(QColor(60, 70, 80)); painter.setBrush(Qt::NoBrush); - painter.drawLine(QPoint(0, heightOffset), QPoint(aznumeric_cast(mPlugin->TimeToPixel(animationLength)), heightOffset)); + painter.drawLine(QPoint(0, heightOffset), QPoint(aznumeric_cast(m_plugin->TimeToPixel(animationLength)), heightOffset)); return 1; } } // namespace EMStudio diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/TimeView/TrackDataWidget.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/TimeView/TrackDataWidget.h index 48effb92d0..d0cbf8f032 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/TimeView/TrackDataWidget.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/TimeView/TrackDataWidget.h @@ -73,8 +73,8 @@ namespace EMStudio void ElementTrackChanged(size_t eventNr, float startTime, float endTime, const char* oldTrackName, const char* newTrackName); private slots: - void OnRemoveElement() { RemoveMotionEvent(mContextMenuX, mContextMenuY); } - void OnAddElement() { AddMotionEvent(mContextMenuX, mContextMenuY); } + void OnRemoveElement() { RemoveMotionEvent(m_contextMenuX, m_contextMenuY); } + void OnAddElement() { AddMotionEvent(m_contextMenuX, m_contextMenuY); } void OnAddTrack(); void OnCreatePresetEvent(); void RemoveSelectedMotionEventsInTrack(); @@ -106,38 +106,38 @@ namespace EMStudio void PaintRelativeGraph(QPainter& painter, const QRect& rect, const EMotionFX::Recorder::ActorInstanceData* actorInstanceData); uint32 PaintSeparator(QPainter& painter, int32 heightOffset, float animationLength); - QBrush mBrushBackground; - QBrush mBrushBackgroundClipped; - QBrush mBrushBackgroundOutOfRange; - TimeViewPlugin* mPlugin; - bool mMouseLeftClicked; - bool mMouseMidClicked; - bool mMouseRightClicked; - bool mDragging; - bool mResizing; - bool mRectZooming; - bool mIsScrolling; - int32 mLastLeftClickedX; - int32 mLastMouseMoveX; - int32 mLastMouseX; - int32 mLastMouseY; - uint32 mNodeHistoryItemHeight; - uint32 mEventHistoryTotalHeight; - bool mAllowContextMenu; + QBrush m_brushBackground; + QBrush m_brushBackgroundClipped; + QBrush m_brushBackgroundOutOfRange; + TimeViewPlugin* m_plugin; + bool m_mouseLeftClicked; + bool m_mouseMidClicked; + bool m_mouseRightClicked; + bool m_dragging; + bool m_resizing; + bool m_rectZooming; + bool m_isScrolling; + int32 m_lastLeftClickedX; + int32 m_lastMouseMoveX; + int32 m_lastMouseX; + int32 m_lastMouseY; + uint32 m_nodeHistoryItemHeight; + uint32 m_eventHistoryTotalHeight; + bool m_allowContextMenu; - TimeTrackElement* mDraggingElement; - TimeTrack* mDragElementTrack; - TimeTrackElement* mResizeElement; - uint32 mResizeID; - int32 mContextMenuX; - int32 mContextMenuY; - uint32 mGraphStartHeight; - uint32 mEventsStartHeight; - uint32 mNodeRectsStartHeight; - double mOldCurrentTime; + TimeTrackElement* m_draggingElement; + TimeTrack* m_dragElementTrack; + TimeTrackElement* m_resizeElement; + uint32 m_resizeId; + int32 m_contextMenuX; + int32 m_contextMenuY; + uint32 m_graphStartHeight; + uint32 m_eventsStartHeight; + uint32 m_nodeRectsStartHeight; + double m_oldCurrentTime; - AZStd::vector mActiveItems; - AZStd::vector mTrackRemap; + AZStd::vector m_activeItems; + AZStd::vector m_trackRemap; // copy and paste struct CopyElement @@ -158,21 +158,21 @@ namespace EMStudio } }; - bool GetIsReadyForPaste() const { return mCopyElements.empty() == false; } + bool GetIsReadyForPaste() const { return m_copyElements.empty() == false; } void FillCopyElements(bool selectedItemsOnly); - AZStd::vector mCopyElements; - bool mCutMode; + AZStd::vector m_copyElements; + bool m_cutMode; - QFont mDataFont; - AZStd::string mTempString; + QFont m_dataFont; + AZStd::string m_tempString; // rect selection - QPoint mSelectStart; - QPoint mSelectEnd; - bool mRectSelecting; + QPoint m_selectStart; + QPoint m_selectEnd; + bool m_rectSelecting; - QRect mNodeHistoryRect; + QRect m_nodeHistoryRect; void CalcSelectRect(QRect& outRect); void SelectElementsInRect(const QRect& rect, bool overwriteCurSelection, bool select, bool toggleMode); @@ -181,7 +181,7 @@ namespace EMStudio void UpdateMouseOverCursor(int32 x, int32 y); void DrawTimeMarker(QPainter& painter, const QRect& rect); - bool GetIsInsideNodeHistory(int32 y) const { return mNodeHistoryRect.contains(1, y); } + bool GetIsInsideNodeHistory(int32 y) const { return m_nodeHistoryRect.contains(1, y); } void DoRecorderContextMenuEvent(QContextMenuEvent* event); void UpdateRects(); diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/TimeView/TrackHeaderWidget.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/TimeView/TrackHeaderWidget.cpp index 5b21d8c7b5..bbdaf6e4a7 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/TimeView/TrackHeaderWidget.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/TimeView/TrackHeaderWidget.cpp @@ -33,18 +33,18 @@ namespace EMStudio TrackHeaderWidget::TrackHeaderWidget(TimeViewPlugin* plugin, QWidget* parent) : QWidget(parent) { - mPlugin = plugin; - mTrackLayout = nullptr; - mTrackWidget = nullptr; - mStackWidget = nullptr; - mNodeNamesCheckBox = nullptr; - mMotionFilesCheckBox = nullptr; + m_plugin = plugin; + m_trackLayout = nullptr; + m_trackWidget = nullptr; + m_stackWidget = nullptr; + m_nodeNamesCheckBox = nullptr; + m_motionFilesCheckBox = nullptr; // create the main layout - mMainLayout = new QVBoxLayout(); - mMainLayout->setMargin(2); - mMainLayout->setSpacing(0); - mMainLayout->setAlignment(Qt::AlignTop); + m_mainLayout = new QVBoxLayout(); + m_mainLayout->setMargin(2); + m_mainLayout->setSpacing(0); + m_mainLayout->setAlignment(Qt::AlignTop); //////////////////////////////// // Create the add event button @@ -65,12 +65,12 @@ namespace EMStudio mainAddWidget->setFixedSize(175, 40); mainAddWidget->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); - mMainLayout->addWidget(mainAddWidget); - mAddTrackWidget = mainAddWidget; + m_mainLayout->addWidget(mainAddWidget); + m_addTrackWidget = mainAddWidget; //////////////////////////////// // recorder settings - mStackWidget = new MysticQt::DialogStack(); + m_stackWidget = new MysticQt::DialogStack(); //----------- @@ -80,51 +80,51 @@ namespace EMStudio contentsLayout->setMargin(0); contentsWidget->setLayout(contentsLayout); - mNodeNamesCheckBox = new QCheckBox("Show Node Names"); - mNodeNamesCheckBox->setChecked(true); - mNodeNamesCheckBox->setCheckable(true); - AzQtComponents::CheckBox::applyToggleSwitchStyle(mNodeNamesCheckBox); - connect(mNodeNamesCheckBox, &QCheckBox::stateChanged, this, &TrackHeaderWidget::OnCheckBox); - contentsLayout->addWidget(mNodeNamesCheckBox); + m_nodeNamesCheckBox = new QCheckBox("Show Node Names"); + m_nodeNamesCheckBox->setChecked(true); + m_nodeNamesCheckBox->setCheckable(true); + AzQtComponents::CheckBox::applyToggleSwitchStyle(m_nodeNamesCheckBox); + connect(m_nodeNamesCheckBox, &QCheckBox::stateChanged, this, &TrackHeaderWidget::OnCheckBox); + contentsLayout->addWidget(m_nodeNamesCheckBox); - mMotionFilesCheckBox = new QCheckBox("Show Motion Files"); - mMotionFilesCheckBox->setChecked(false); - mMotionFilesCheckBox->setCheckable(true); - AzQtComponents::CheckBox::applyToggleSwitchStyle(mMotionFilesCheckBox); - connect(mMotionFilesCheckBox, &QCheckBox::stateChanged, this, &TrackHeaderWidget::OnCheckBox); - contentsLayout->addWidget(mMotionFilesCheckBox); + m_motionFilesCheckBox = new QCheckBox("Show Motion Files"); + m_motionFilesCheckBox->setChecked(false); + m_motionFilesCheckBox->setCheckable(true); + AzQtComponents::CheckBox::applyToggleSwitchStyle(m_motionFilesCheckBox); + connect(m_motionFilesCheckBox, &QCheckBox::stateChanged, this, &TrackHeaderWidget::OnCheckBox); + contentsLayout->addWidget(m_motionFilesCheckBox); QHBoxLayout* comboLayout = new QHBoxLayout(); comboLayout->addWidget(new QLabel("Nodes:")); - mNodeContentsComboBox = new QComboBox(); - mNodeContentsComboBox->setEditable(false); - mNodeContentsComboBox->addItem("Global Weights"); - mNodeContentsComboBox->addItem("Local Weights"); - mNodeContentsComboBox->addItem("Local Time"); - mNodeContentsComboBox->setCurrentIndex(0); - connect(mNodeContentsComboBox, static_cast(&QComboBox::currentIndexChanged), this, &TrackHeaderWidget::OnComboBoxIndexChanged); - comboLayout->addWidget(mNodeContentsComboBox); + m_nodeContentsComboBox = new QComboBox(); + m_nodeContentsComboBox->setEditable(false); + m_nodeContentsComboBox->addItem("Global Weights"); + m_nodeContentsComboBox->addItem("Local Weights"); + m_nodeContentsComboBox->addItem("Local Time"); + m_nodeContentsComboBox->setCurrentIndex(0); + connect(m_nodeContentsComboBox, static_cast(&QComboBox::currentIndexChanged), this, &TrackHeaderWidget::OnComboBoxIndexChanged); + comboLayout->addWidget(m_nodeContentsComboBox); contentsLayout->addLayout(comboLayout); comboLayout = new QHBoxLayout(); comboLayout->addWidget(new QLabel("Graph:")); - mGraphContentsComboBox = new QComboBox(); - mGraphContentsComboBox->setEditable(false); - mGraphContentsComboBox->addItem("Global Weights"); - mGraphContentsComboBox->addItem("Local Weights"); - mGraphContentsComboBox->addItem("Local Time"); - mGraphContentsComboBox->setCurrentIndex(0); - connect(mGraphContentsComboBox, static_cast(&QComboBox::currentIndexChanged), this, &TrackHeaderWidget::OnComboBoxIndexChanged); - comboLayout->addWidget(mGraphContentsComboBox); + m_graphContentsComboBox = new QComboBox(); + m_graphContentsComboBox->setEditable(false); + m_graphContentsComboBox->addItem("Global Weights"); + m_graphContentsComboBox->addItem("Local Weights"); + m_graphContentsComboBox->addItem("Local Time"); + m_graphContentsComboBox->setCurrentIndex(0); + connect(m_graphContentsComboBox, static_cast(&QComboBox::currentIndexChanged), this, &TrackHeaderWidget::OnComboBoxIndexChanged); + comboLayout->addWidget(m_graphContentsComboBox); contentsLayout->addLayout(comboLayout); - mStackWidget->Add(contentsWidget, "Contents", false, false, true); + m_stackWidget->Add(contentsWidget, "Contents", false, false, true); //----------- - mMainLayout->addWidget(mStackWidget); + m_mainLayout->addWidget(m_stackWidget); setFocusPolicy(Qt::StrongFocus); - setLayout(mMainLayout); + setLayout(m_mainLayout); ReInit(); } @@ -138,119 +138,119 @@ namespace EMStudio void TrackHeaderWidget::ReInit() { - mPlugin->SetRedrawFlag(); + m_plugin->SetRedrawFlag(); - if (mTrackWidget) + if (m_trackWidget) { - mTrackWidget->hide(); - mMainLayout->removeWidget(mTrackWidget); - mTrackWidget->deleteLater(); // TODO: this causes flickering, but normal deletion will make it crash + m_trackWidget->hide(); + m_mainLayout->removeWidget(m_trackWidget); + m_trackWidget->deleteLater(); // TODO: this causes flickering, but normal deletion will make it crash } - mTrackWidget = nullptr; + m_trackWidget = nullptr; // If we are in anim graph mode and have a recording, don't init for the motions. - if ((mPlugin->GetMode() != TimeViewMode::Motion) && - (EMotionFX::GetRecorder().GetIsRecording() || EMotionFX::GetRecorder().GetRecordTime() > MCore::Math::epsilon || EMotionFX::GetRecorder().GetIsInPlayMode() || !mPlugin->mMotion)) + if ((m_plugin->GetMode() != TimeViewMode::Motion) && + (EMotionFX::GetRecorder().GetIsRecording() || EMotionFX::GetRecorder().GetRecordTime() > MCore::Math::epsilon || EMotionFX::GetRecorder().GetIsInPlayMode() || !m_plugin->m_motion)) { - mAddTrackWidget->setVisible(false); + m_addTrackWidget->setVisible(false); setVisible(false); - if ((mPlugin->GetMode() != TimeViewMode::Motion) && + if ((m_plugin->GetMode() != TimeViewMode::Motion) && (EMotionFX::GetRecorder().GetIsRecording() || EMotionFX::GetRecorder().GetRecordTime() > MCore::Math::epsilon)) { - mStackWidget->setVisible(true); + m_stackWidget->setVisible(true); } else { - mStackWidget->setVisible(false); + m_stackWidget->setVisible(false); } return; } - mAddTrackWidget->setVisible(true); + m_addTrackWidget->setVisible(true); setVisible(true); - mStackWidget->setVisible(false); + m_stackWidget->setVisible(false); - if (mPlugin->mTracks.empty()) + if (m_plugin->m_tracks.empty()) { return; } - mTrackWidget = new QWidget(); - mTrackLayout = new QVBoxLayout(); - mTrackLayout->setMargin(0); - mTrackLayout->setSpacing(1); + m_trackWidget = new QWidget(); + m_trackLayout = new QVBoxLayout(); + m_trackLayout->setMargin(0); + m_trackLayout->setSpacing(1); - const size_t numTracks = mPlugin->mTracks.size(); + const size_t numTracks = m_plugin->m_tracks.size(); for (size_t i = 0; i < numTracks; ++i) { - TimeTrack* track = mPlugin->mTracks[i]; + TimeTrack* track = m_plugin->m_tracks[i]; if (track->GetIsVisible() == false) { continue; } - HeaderTrackWidget* widget = new HeaderTrackWidget(mTrackWidget, mPlugin, this, track, i); + HeaderTrackWidget* widget = new HeaderTrackWidget(m_trackWidget, m_plugin, this, track, i); connect(widget, &HeaderTrackWidget::TrackNameChanged, this, &TrackHeaderWidget::OnTrackNameChanged); connect(widget, &HeaderTrackWidget::EnabledStateChanged, this, &TrackHeaderWidget::OnTrackEnabledStateChanged); - mTrackLayout->addWidget(widget); + m_trackLayout->addWidget(widget); } - mTrackWidget->setLayout(mTrackLayout); - mMainLayout->addWidget(mTrackWidget); + m_trackWidget->setLayout(m_trackLayout); + m_mainLayout->addWidget(m_trackWidget); } HeaderTrackWidget::HeaderTrackWidget(QWidget* parent, TimeViewPlugin* parentPlugin, TrackHeaderWidget* trackHeaderWidget, TimeTrack* timeTrack, size_t trackIndex) : QWidget(parent) { - mPlugin = parentPlugin; + m_plugin = parentPlugin; QHBoxLayout* mainLayout = new QHBoxLayout(); mainLayout->setMargin(0); mainLayout->setSpacing(0); - mHeaderTrackWidget = trackHeaderWidget; - mEnabledCheckbox = new QCheckBox(); - mNameLabel = new QLabel(timeTrack->GetName()); - mNameEdit = new QLineEdit(timeTrack->GetName()); - mTrack = timeTrack; - mTrackIndex = trackIndex; + m_headerTrackWidget = trackHeaderWidget; + m_enabledCheckbox = new QCheckBox(); + m_nameLabel = new QLabel(timeTrack->GetName()); + m_nameEdit = new QLineEdit(timeTrack->GetName()); + m_track = timeTrack; + m_trackIndex = trackIndex; - mNameEdit->setVisible(false); - mNameEdit->setFrame(false); + m_nameEdit->setVisible(false); + m_nameEdit->setFrame(false); - mEnabledCheckbox->setFixedWidth(36); - AzQtComponents::CheckBox::applyToggleSwitchStyle(mEnabledCheckbox); + m_enabledCheckbox->setFixedWidth(36); + AzQtComponents::CheckBox::applyToggleSwitchStyle(m_enabledCheckbox); if (timeTrack->GetIsEnabled()) { - mEnabledCheckbox->setCheckState(Qt::Checked); + m_enabledCheckbox->setCheckState(Qt::Checked); } else { - mNameEdit->setStyleSheet("background-color: rgb(70, 70, 70);"); - mEnabledCheckbox->setCheckState(Qt::Unchecked); + m_nameEdit->setStyleSheet("background-color: rgb(70, 70, 70);"); + m_enabledCheckbox->setCheckState(Qt::Unchecked); } if (timeTrack->GetIsDeletable() == false) { - mNameEdit->setReadOnly(true); - mEnabledCheckbox->setEnabled(false); + m_nameEdit->setReadOnly(true); + m_enabledCheckbox->setEnabled(false); } else { - mNameLabel->installEventFilter(this); + m_nameLabel->installEventFilter(this); } - connect(mNameEdit, &QLineEdit::editingFinished, this, &HeaderTrackWidget::NameChanged); - connect(mNameEdit, &QLineEdit::textEdited, this, &HeaderTrackWidget::NameEdited); - connect(mEnabledCheckbox, &QCheckBox::stateChanged, this, &HeaderTrackWidget::EnabledCheckBoxChanged); + connect(m_nameEdit, &QLineEdit::editingFinished, this, &HeaderTrackWidget::NameChanged); + connect(m_nameEdit, &QLineEdit::textEdited, this, &HeaderTrackWidget::NameEdited); + connect(m_enabledCheckbox, &QCheckBox::stateChanged, this, &HeaderTrackWidget::EnabledCheckBoxChanged); setContextMenuPolicy(Qt::CustomContextMenu); connect(this, &QWidget::customContextMenuRequested, this, [this](const QPoint& pos) @@ -258,20 +258,18 @@ namespace EMStudio QMenu m; auto action = m.addAction(tr("Remove track"), this, [=] { - mPlugin->GetTrackDataWidget()->RemoveTrack(mTrackIndex); + m_plugin->GetTrackDataWidget()->RemoveTrack(m_trackIndex); }); - action->setEnabled(mTrack->GetIsDeletable()); + action->setEnabled(m_track->GetIsDeletable()); m.exec(mapToGlobal(pos)); }); mainLayout->insertSpacing(0, 4); - mainLayout->addWidget(mNameLabel); - mainLayout->addWidget(mNameEdit); - mainLayout->addWidget(mEnabledCheckbox); + mainLayout->addWidget(m_nameLabel); + mainLayout->addWidget(m_nameEdit); + mainLayout->addWidget(m_enabledCheckbox); mainLayout->insertSpacing(5, 2); - //mainLayout->setAlignment(mEnabledCheckbox, Qt::AlignLeft); - setLayout(mainLayout); setMinimumHeight(20); @@ -280,12 +278,12 @@ namespace EMStudio bool HeaderTrackWidget::eventFilter(QObject* object, QEvent* event) { - if (object == mNameLabel && event->type() == QEvent::MouseButtonDblClick) + if (object == m_nameLabel && event->type() == QEvent::MouseButtonDblClick) { - mNameLabel->setVisible(false); - mNameEdit->setVisible(true); - mNameEdit->selectAll(); - mNameEdit->setFocus(); + m_nameLabel->setVisible(false); + m_nameEdit->setVisible(true); + m_nameEdit->selectAll(); + m_nameEdit->setFocus(); } return QWidget::eventFilter(object, event); } @@ -293,28 +291,28 @@ namespace EMStudio void HeaderTrackWidget::NameChanged() { MCORE_ASSERT(sender()->inherits("QLineEdit")); - mPlugin->SetRedrawFlag(); + m_plugin->SetRedrawFlag(); QLineEdit* widget = qobject_cast(sender()); - mNameLabel->setVisible(true); - mNameEdit->setVisible(false); + m_nameLabel->setVisible(true); + m_nameEdit->setVisible(false); if (ValidateName()) { - mNameLabel->setText(widget->text()); - emit TrackNameChanged(widget->text(), mTrackIndex); + m_nameLabel->setText(widget->text()); + emit TrackNameChanged(widget->text(), m_trackIndex); } } bool HeaderTrackWidget::ValidateName() { - AZStd::string name = mNameEdit->text().toUtf8().data(); + AZStd::string name = m_nameEdit->text().toUtf8().data(); bool nameUnique = true; - const size_t numTracks = mPlugin->GetNumTracks(); + const size_t numTracks = m_plugin->GetNumTracks(); for (size_t i = 0; i < numTracks; ++i) { - TimeTrack* track = mPlugin->GetTrack(i); + TimeTrack* track = m_plugin->GetTrack(i); - if (mTrack != track) + if (m_track != track) { if (name == track->GetName()) { @@ -331,21 +329,21 @@ namespace EMStudio void HeaderTrackWidget::NameEdited(const QString& text) { MCORE_UNUSED(text); - mPlugin->SetRedrawFlag(); + m_plugin->SetRedrawFlag(); if (ValidateName() == false) { - GetManager()->SetWidgetAsInvalidInput(mNameEdit); + GetManager()->SetWidgetAsInvalidInput(m_nameEdit); } else { - mNameEdit->setStyleSheet(""); + m_nameEdit->setStyleSheet(""); } } void HeaderTrackWidget::EnabledCheckBoxChanged(int state) { - mPlugin->SetRedrawFlag(); + m_plugin->SetRedrawFlag(); bool enabled = false; if (state == Qt::Checked) @@ -353,16 +351,16 @@ namespace EMStudio enabled = true; } - emit EnabledStateChanged(enabled, mTrackIndex); + emit EnabledStateChanged(enabled, m_trackIndex); } // propagate key events to the plugin and let it handle by a shared function void HeaderTrackWidget::keyPressEvent(QKeyEvent* event) { - if (mPlugin) + if (m_plugin) { - mPlugin->OnKeyPressEvent(event); + m_plugin->OnKeyPressEvent(event); } } @@ -370,9 +368,9 @@ namespace EMStudio // propagate key events to the plugin and let it handle by a shared function void HeaderTrackWidget::keyReleaseEvent(QKeyEvent* event) { - if (mPlugin) + if (m_plugin) { - mPlugin->OnKeyReleaseEvent(event); + m_plugin->OnKeyReleaseEvent(event); } } @@ -380,9 +378,9 @@ namespace EMStudio // propagate key events to the plugin and let it handle by a shared function void TrackHeaderWidget::keyPressEvent(QKeyEvent* event) { - if (mPlugin) + if (m_plugin) { - mPlugin->OnKeyPressEvent(event); + m_plugin->OnKeyPressEvent(event); } } @@ -390,9 +388,9 @@ namespace EMStudio // propagate key events to the plugin and let it handle by a shared function void TrackHeaderWidget::keyReleaseEvent(QKeyEvent* event) { - if (mPlugin) + if (m_plugin) { - mPlugin->OnKeyReleaseEvent(event); + m_plugin->OnKeyReleaseEvent(event); } } @@ -401,16 +399,16 @@ namespace EMStudio void TrackHeaderWidget::OnDetailedNodesCheckBox(int state) { MCORE_UNUSED(state); - mPlugin->SetRedrawFlag(); + m_plugin->SetRedrawFlag(); - RecorderGroup* recorderGroup = mPlugin->GetTimeViewToolBar()->GetRecorderGroup(); + RecorderGroup* recorderGroup = m_plugin->GetTimeViewToolBar()->GetRecorderGroup(); if (!recorderGroup->GetDetailedNodes()) { - mPlugin->mTrackDataWidget->mNodeHistoryItemHeight = 20; + m_plugin->m_trackDataWidget->m_nodeHistoryItemHeight = 20; } else { - mPlugin->mTrackDataWidget->mNodeHistoryItemHeight = 35; + m_plugin->m_trackDataWidget->m_nodeHistoryItemHeight = 35; } } @@ -419,7 +417,7 @@ namespace EMStudio void TrackHeaderWidget::OnCheckBox(int state) { MCORE_UNUSED(state); - mPlugin->SetRedrawFlag(); + m_plugin->SetRedrawFlag(); } @@ -427,6 +425,6 @@ namespace EMStudio void TrackHeaderWidget::OnComboBoxIndexChanged(int state) { MCORE_UNUSED(state); - mPlugin->SetRedrawFlag(); + m_plugin->SetRedrawFlag(); } } // namespace EMStudio diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/TimeView/TrackHeaderWidget.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/TimeView/TrackHeaderWidget.h index dae551d2bb..b794f248f6 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/TimeView/TrackHeaderWidget.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/TimeView/TrackHeaderWidget.h @@ -48,14 +48,14 @@ namespace EMStudio public: HeaderTrackWidget(QWidget* parent, TimeViewPlugin* parentPlugin, TrackHeaderWidget* trackHeaderWidget, TimeTrack* timeTrack, size_t trackIndex); - QCheckBox* mEnabledCheckbox; - QLabel* mNameLabel; - QLineEdit* mNameEdit; - QPushButton* mRemoveButton; - TimeTrack* mTrack; - size_t mTrackIndex; - TrackHeaderWidget* mHeaderTrackWidget; - TimeViewPlugin* mPlugin; + QCheckBox* m_enabledCheckbox; + QLabel* m_nameLabel; + QLineEdit* m_nameEdit; + QPushButton* m_removeButton; + TimeTrack* m_track; + size_t m_trackIndex; + TrackHeaderWidget* m_headerTrackWidget; + TimeViewPlugin* m_plugin; bool ValidateName(); @@ -93,7 +93,7 @@ namespace EMStudio void ReInit(); void UpdateDataContents(); - QWidget* GetAddTrackWidget() { return mAddTrackWidget; } + QWidget* GetAddTrackWidget() { return m_addTrackWidget; } public slots: void OnAddTrackButtonClicked() { CommandSystem::CommandAddEventTrack(); } @@ -104,17 +104,17 @@ namespace EMStudio void OnComboBoxIndexChanged(int state); private: - TimeViewPlugin* mPlugin; - QVBoxLayout* mMainLayout; - QWidget* mTrackWidget; - QVBoxLayout* mTrackLayout; - QWidget* mAddTrackWidget; - QPushButton* mAddTrackButton; - MysticQt::DialogStack* mStackWidget; - QComboBox* mGraphContentsComboBox; - QComboBox* mNodeContentsComboBox; - QCheckBox* mNodeNamesCheckBox; - QCheckBox* mMotionFilesCheckBox; + TimeViewPlugin* m_plugin; + QVBoxLayout* m_mainLayout; + QWidget* m_trackWidget; + QVBoxLayout* m_trackLayout; + QWidget* m_addTrackWidget; + QPushButton* m_addTrackButton; + MysticQt::DialogStack* m_stackWidget; + QComboBox* m_graphContentsComboBox; + QComboBox* m_nodeContentsComboBox; + QCheckBox* m_nodeNamesCheckBox; + QCheckBox* m_motionFilesCheckBox; void keyPressEvent(QKeyEvent* event); void keyReleaseEvent(QKeyEvent* event); diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/standardplugins_files.cmake b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/standardplugins_files.cmake index ae5a633c7f..65af4d50ee 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/standardplugins_files.cmake +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/standardplugins_files.cmake @@ -133,8 +133,6 @@ set(FILES Source/AnimGraph/ParameterEditor/Vector4ParameterEditor.h Source/CommandBar/CommandBarPlugin.cpp Source/CommandBar/CommandBarPlugin.h - Source/CommandBrowser/CommandBrowserPlugin.cpp - Source/CommandBrowser/CommandBrowserPlugin.h Source/LogWindow/LogWindowCallback.cpp Source/LogWindow/LogWindowCallback.h Source/LogWindow/LogWindowPlugin.cpp diff --git a/Gems/EMotionFX/Code/Editor/Platform/Windows/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/MainWindowEventFilter_Windows.cpp b/Gems/EMotionFX/Code/Editor/Platform/Windows/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/MainWindowEventFilter_Windows.cpp index 05bb9a5773..01ad023bd1 100644 --- a/Gems/EMotionFX/Code/Editor/Platform/Windows/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/MainWindowEventFilter_Windows.cpp +++ b/Gems/EMotionFX/Code/Editor/Platform/Windows/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/MainWindowEventFilter_Windows.cpp @@ -22,7 +22,7 @@ namespace EMStudio { // The reason why there are multiple of such messages is because it emits messages for all related hardware nodes. // But we do not know the name of the hardware to look for here either, so we can't filter that. - emit m_MainWindow->HardwareChangeDetected(); + emit m_mainWindow->HardwareChangeDetected(); } } diff --git a/Gems/EMotionFX/Code/MCore/Source/AABB.h b/Gems/EMotionFX/Code/MCore/Source/AABB.h index 04df59f453..3e6af3bc96 100644 --- a/Gems/EMotionFX/Code/MCore/Source/AABB.h +++ b/Gems/EMotionFX/Code/MCore/Source/AABB.h @@ -38,8 +38,8 @@ namespace MCore * @param maxPnt The maximum point. */ MCORE_INLINE AABB(const AZ::Vector3& minPnt, const AZ::Vector3& maxPnt) - : mMin(minPnt) - , mMax(maxPnt) {} + : m_min(minPnt) + , m_max(maxPnt) {} /** * Initialize the box minimum and maximum points. @@ -47,7 +47,7 @@ namespace MCore * Note, that the default constructor already calls this method. So you should only call it when you want to 'reset' the minimum and * maximum points of the box. */ - MCORE_INLINE void Init() { mMin.Set(FLT_MAX, FLT_MAX, FLT_MAX); mMax.Set(-FLT_MAX, -FLT_MAX, -FLT_MAX); } + MCORE_INLINE void Init() { m_min.Set(FLT_MAX, FLT_MAX, FLT_MAX); m_max.Set(-FLT_MAX, -FLT_MAX, -FLT_MAX); } /** * Check if this is a valid AABB or not. @@ -56,15 +56,15 @@ namespace MCore */ MCORE_INLINE bool CheckIfIsValid() const { - if (mMin.GetX() > mMax.GetX()) + if (m_min.GetX() > m_max.GetX()) { return false; } - if (mMin.GetY() > mMax.GetY()) + if (m_min.GetY() > m_max.GetY()) { return false; } - if (mMin.GetZ() > mMax.GetZ()) + if (m_min.GetZ() > m_max.GetZ()) { return false; } @@ -83,7 +83,7 @@ namespace MCore * This method automatically adjusts the minimum and maximum point of the box after 'adding' the given AABB to this box. * @param box The AABB to 'add' to this box. */ - MCORE_INLINE void Encapsulate(const AABB& box) { Encapsulate(box.mMin); Encapsulate(box.mMax); } + MCORE_INLINE void Encapsulate(const AABB& box) { Encapsulate(box.m_min); Encapsulate(box.m_max); } /** * Widen the box in all dimensions with a given number of units. @@ -91,12 +91,12 @@ namespace MCore */ MCORE_INLINE void Widen(float delta) { - mMin.SetX(mMin.GetX() - delta); - mMin.SetY(mMin.GetY() - delta); - mMin.SetZ(mMin.GetZ() - delta); - mMax.SetX(mMax.GetX() + delta); - mMax.SetY(mMax.GetY() + delta); - mMax.SetZ(mMax.GetZ() + delta); + m_min.SetX(m_min.GetX() - delta); + m_min.SetY(m_min.GetY() - delta); + m_min.SetZ(m_min.GetZ() - delta); + m_max.SetX(m_max.GetX() + delta); + m_max.SetY(m_max.GetY() + delta); + m_max.SetZ(m_max.GetZ() + delta); } /** @@ -104,7 +104,7 @@ namespace MCore * This means the middle of the box will be moved by the given vector. * @param offset The offset vector to translate (move) the box with. */ - MCORE_INLINE void Translate(const AZ::Vector3& offset) { mMin += offset; mMax += offset; } + MCORE_INLINE void Translate(const AZ::Vector3& offset) { m_min += offset; m_max += offset; } /** * Checks if a given point is inside this box or not. @@ -112,7 +112,7 @@ namespace MCore * @param v The vector (3D point) to perform the test with. * @result Returns true when the given point is inside the box, otherwise false is returned. */ - MCORE_INLINE bool Contains(const AZ::Vector3& v) const { return (InRange(v.GetX(), mMin.GetX(), mMax.GetX()) && InRange(v.GetZ(), mMin.GetZ(), mMax.GetZ()) && InRange(v.GetY(), mMin.GetY(), mMax.GetY())); } + MCORE_INLINE bool Contains(const AZ::Vector3& v) const { return (InRange(v.GetX(), m_min.GetX(), m_max.GetX()) && InRange(v.GetZ(), m_min.GetZ(), m_max.GetZ()) && InRange(v.GetY(), m_min.GetY(), m_max.GetY())); } /** * Checks if a given AABB is COMPLETELY inside this box or not. @@ -120,7 +120,7 @@ namespace MCore * @param box The AABB to perform the test with. * @result Returns true when the AABB 'b' is COMPLETELY inside this box. If it's completely or partially outside, false will be returned. */ - MCORE_INLINE bool Contains(const AABB& box) const { return (Contains(box.mMin) && Contains(box.mMax)); } + MCORE_INLINE bool Contains(const AABB& box) const { return (Contains(box.m_min) && Contains(box.m_max)); } /** * Checks if a given AABB partially or completely contains, so intersects, this box or not. @@ -128,35 +128,35 @@ namespace MCore * @param box The AABB to perform the test with. * @result Returns true when the given AABB 'b' is completely or partially inside this box. Only false will be returned when the given AABB 'b' is COMPLETELY outside this box. */ - MCORE_INLINE bool Intersects(const AABB& box) const { return !(mMin.GetX() > box.mMax.GetX() || mMax.GetX() < box.mMin.GetX() || mMin.GetY() > box.mMax.GetY() || mMax.GetY() < box.mMin.GetY() || mMin.GetZ() > box.mMax.GetZ() || mMax.GetZ() < box.mMin.GetZ()); } + MCORE_INLINE bool Intersects(const AABB& box) const { return !(m_min.GetX() > box.m_max.GetX() || m_max.GetX() < box.m_min.GetX() || m_min.GetY() > box.m_max.GetY() || m_max.GetY() < box.m_min.GetY() || m_min.GetZ() > box.m_max.GetZ() || m_max.GetZ() < box.m_min.GetZ()); } /** * Calculates and returns the width of the box. * The width is the distance between the minimum and maximum point, along the X-axis. * @result The width of the box. */ - MCORE_INLINE float CalcWidth() const { return mMax.GetX() - mMin.GetX(); } + MCORE_INLINE float CalcWidth() const { return m_max.GetX() - m_min.GetX(); } /** * Calculates and returns the height of the box. * The height is the distance between the minimum and maximum point, along the Z-axis. * @result The height of the box. */ - MCORE_INLINE float CalcHeight() const { return mMax.GetZ() - mMin.GetZ(); } + MCORE_INLINE float CalcHeight() const { return m_max.GetZ() - m_min.GetZ(); } /** * Calculates and returns the depth of the box. * The depth is the distance between the minimum and maximum point, along the Y-axis. * @result The depth of the box. */ - MCORE_INLINE float CalcDepth() const { return mMax.GetY() - mMin.GetY(); } + MCORE_INLINE float CalcDepth() const { return m_max.GetY() - m_min.GetY(); } /** * Calculate the volume of the box. * This equals width x height x depth. * @result The volume of the box. */ - MCORE_INLINE float CalcVolume() const { return (mMax.GetX() - mMin.GetX()) * (mMax.GetY() - mMin.GetY()) * (mMax.GetZ() - mMin.GetZ()); } + MCORE_INLINE float CalcVolume() const { return (m_max.GetX() - m_min.GetX()) * (m_max.GetY() - m_min.GetY()) * (m_max.GetZ() - m_min.GetZ()); } /** * Calculate the surface area of the box. @@ -164,9 +164,9 @@ namespace MCore */ MCORE_INLINE float CalcSurfaceArea() const { - const float width = mMax.GetX() - mMin.GetX(); - const float height = mMax.GetY() - mMin.GetY(); - const float depth = mMax.GetZ() - mMin.GetZ(); + const float width = m_max.GetX() - m_min.GetX(); + const float height = m_max.GetY() - m_min.GetY(); + const float depth = m_max.GetZ() - m_min.GetZ(); return (2.0f * height * width) + (2.0f * height * depth) + (2.0f * width * depth); } @@ -175,14 +175,14 @@ namespace MCore * This is simply done by taking the average of the minimum and maximum point along each axis. * @result The center (or middle) point of this box. */ - MCORE_INLINE AZ::Vector3 CalcMiddle() const { return (mMin + mMax) * 0.5f; } + MCORE_INLINE AZ::Vector3 CalcMiddle() const { return (m_min + m_max) * 0.5f; } /** * Calculates the extents of the box. * This is the vector from the center to a corner of the box. * @result The vector containing the extents. */ - MCORE_INLINE AZ::Vector3 CalcExtents() const { return (mMax - mMin) * 0.5f; } + MCORE_INLINE AZ::Vector3 CalcExtents() const { return (m_max - m_min) * 0.5f; } /** * Calculates the radius of this box. @@ -191,60 +191,60 @@ namespace MCore * get the minimum sphere which exactly contains this box. * @result The length of the center of the box to one of the extreme points. So the minimum radius of the bounding sphere containing this box. */ - MCORE_INLINE float CalcRadius() const { return SafeLength(mMax - mMin) * 0.5f; } + MCORE_INLINE float CalcRadius() const { return SafeLength(m_max - m_min) * 0.5f; } /** * Get the minimum point of the box. * @result The minimum point of the box. */ - MCORE_INLINE const AZ::Vector3& GetMin() const { return mMin; } + MCORE_INLINE const AZ::Vector3& GetMin() const { return m_min; } /** * Get the maximum point of the box. * @result The maximum point of the box. */ - MCORE_INLINE const AZ::Vector3& GetMax() const { return mMax; } + MCORE_INLINE const AZ::Vector3& GetMax() const { return m_max; } /** * Set the minimum point of the box. * @param minVec The vector representing the minimum point of the box. */ - MCORE_INLINE void SetMin(const AZ::Vector3& minVec) { mMin = minVec; } + MCORE_INLINE void SetMin(const AZ::Vector3& minVec) { m_min = minVec; } /** * Set the maximum point of the box. * @param maxVec The vector representing the maximum point of the box. */ - MCORE_INLINE void SetMax(const AZ::Vector3& maxVec) { mMax = maxVec; } + MCORE_INLINE void SetMax(const AZ::Vector3& maxVec) { m_max = maxVec; } void CalcCornerPoints(AZ::Vector3* outPoints) const { - outPoints[0].Set(mMin.GetX(), mMin.GetY(), mMax.GetZ()); // 4-------------5 - outPoints[1].Set(mMax.GetX(), mMin.GetY(), mMax.GetZ()); // /| / | - outPoints[2].Set(mMax.GetX(), mMin.GetY(), mMin.GetZ()); // 0------------1 | - outPoints[3].Set(mMin.GetX(), mMin.GetY(), mMin.GetZ()); // | | | | - outPoints[4].Set(mMin.GetX(), mMax.GetY(), mMax.GetZ()); // | 7----------|--6 - outPoints[5].Set(mMax.GetX(), mMax.GetY(), mMax.GetZ()); // | / | / - outPoints[6].Set(mMax.GetX(), mMax.GetY(), mMin.GetZ()); // |/ |/ - outPoints[7].Set(mMin.GetX(), mMax.GetY(), mMin.GetZ()); // 3------------2 + outPoints[0].Set(m_min.GetX(), m_min.GetY(), m_max.GetZ()); // 4-------------5 + outPoints[1].Set(m_max.GetX(), m_min.GetY(), m_max.GetZ()); // /| / | + outPoints[2].Set(m_max.GetX(), m_min.GetY(), m_min.GetZ()); // 0------------1 | + outPoints[3].Set(m_min.GetX(), m_min.GetY(), m_min.GetZ()); // | | | | + outPoints[4].Set(m_min.GetX(), m_max.GetY(), m_max.GetZ()); // | 7----------|--6 + outPoints[5].Set(m_max.GetX(), m_max.GetY(), m_max.GetZ()); // | / | / + outPoints[6].Set(m_max.GetX(), m_max.GetY(), m_min.GetZ()); // |/ |/ + outPoints[7].Set(m_min.GetX(), m_max.GetY(), m_min.GetZ()); // 3------------2 } private: - AZ::Vector3 mMin; /**< The minimum point. */ - AZ::Vector3 mMax; /**< The maximum point. */ + AZ::Vector3 m_min; /**< The minimum point. */ + AZ::Vector3 m_max; /**< The maximum point. */ }; // encapsulate a point in the box MCORE_INLINE void AABB::Encapsulate(const AZ::Vector3& v) { - mMin.SetX(Min(mMin.GetX(), v.GetX())); - mMin.SetY(Min(mMin.GetY(), v.GetY())); - mMin.SetZ(Min(mMin.GetZ(), v.GetZ())); + m_min.SetX(Min(m_min.GetX(), v.GetX())); + m_min.SetY(Min(m_min.GetY(), v.GetY())); + m_min.SetZ(Min(m_min.GetZ(), v.GetZ())); - mMax.SetX(Max(mMax.GetX(), v.GetX())); - mMax.SetY(Max(mMax.GetY(), v.GetY())); - mMax.SetZ(Max(mMax.GetZ(), v.GetZ())); + m_max.SetX(Max(m_max.GetX(), v.GetX())); + m_max.SetY(Max(m_max.GetY(), v.GetY())); + m_max.SetZ(Max(m_max.GetZ(), v.GetZ())); } } // namespace MCore diff --git a/Gems/EMotionFX/Code/MCore/Source/AlignedArray.h b/Gems/EMotionFX/Code/MCore/Source/AlignedArray.h index ef1d157e03..5ffaac2e40 100644 --- a/Gems/EMotionFX/Code/MCore/Source/AlignedArray.h +++ b/Gems/EMotionFX/Code/MCore/Source/AlignedArray.h @@ -40,10 +40,10 @@ namespace MCore * Initializes the array so it's empty and has no memory allocated. */ MCORE_INLINE AlignedArray() - : mData(nullptr) - , mLength(0) - , mMaxLength(0) - , mMemCategory(MCORE_MEMCATEGORY_ARRAY) {} + : m_data(nullptr) + , m_length(0) + , m_maxLength(0) + , m_memCategory(MCORE_MEMCATEGORY_ARRAY) {} /** * Constructor which creates a given number of elements. @@ -52,12 +52,12 @@ namespace MCore * @param memCategory The memory category the array is in. */ MCORE_INLINE explicit AlignedArray(T* elems, size_t num, uint16 memCategory = MCORE_MEMCATEGORY_ARRAY) - : mLength(num) - , mMaxLength(AllocSize(num)) - , mMemCategory(memCategory) + : m_length(num) + , m_maxLength(AllocSize(num)) + , m_memCategory(memCategory) { - mData = (T*)AlignedAllocate(mMaxLength * sizeof(T), alignment, mMemCategory, MEMORYBLOCK_ID, MCORE_FILE, MCORE_LINE); - for (size_t i = 0; i < mLength; ++i) + m_data = (T*)AlignedAllocate(m_maxLength * sizeof(T), alignment, m_memCategory, MEMORYBLOCK_ID, MCORE_FILE, MCORE_LINE); + for (size_t i = 0; i < m_length; ++i) { Construct(i, elems[i]); } @@ -69,15 +69,15 @@ namespace MCore * @param memCategory The memory category the array is in. */ MCORE_INLINE explicit AlignedArray(size_t initSize, uint16 memCategory = MCORE_MEMCATEGORY_ARRAY) - : mData(nullptr) - , mLength(initSize) - , mMaxLength(initSize) - , mMemCategory(memCategory) + : m_data(nullptr) + , m_length(initSize) + , m_maxLength(initSize) + , m_memCategory(memCategory) { - if (mMaxLength > 0) + if (m_maxLength > 0) { - mData = (T*)AlignedAllocate(mMaxLength * sizeof(T), alignment, mMemCategory, MEMORYBLOCK_ID, MCORE_FILE, MCORE_LINE); - for (size_t i = 0; i < mLength; ++i) + m_data = (T*)AlignedAllocate(m_maxLength * sizeof(T), alignment, m_memCategory, MEMORYBLOCK_ID, MCORE_FILE, MCORE_LINE); + for (size_t i = 0; i < m_length; ++i) { Construct(i); } @@ -89,16 +89,16 @@ namespace MCore * @param other The other array to copy the data from. */ AlignedArray(const AlignedArray& other) - : mData(nullptr) - , mLength(0) - , mMaxLength(0) - , mMemCategory(MCORE_MEMCATEGORY_ARRAY) { *this = other; } + : m_data(nullptr) + , m_length(0) + , m_maxLength(0) + , m_memCategory(MCORE_MEMCATEGORY_ARRAY) { *this = other; } /** * Move constructor. * @param other The array to move the data from. */ - AlignedArray(AlignedArray&& other) { mData = other.mData; mLength = other.mLength; mMaxLength = other.mMaxLength; mMemCategory = other.mMemCategory; other.mData = nullptr; other.mLength = 0; other.mMaxLength = 0; } + AlignedArray(AlignedArray&& other) { m_data = other.m_data; m_length = other.m_length; m_maxLength = other.m_maxLength; m_memCategory = other.m_memCategory; other.m_data = nullptr; other.m_length = 0; other.m_maxLength = 0; } /** * Destructor. Deletes all entry data. @@ -119,13 +119,13 @@ namespace MCore */ ~AlignedArray() { - for (size_t i = 0; i < mLength; ++i) + for (size_t i = 0; i < m_length; ++i) { Destruct(i); } - if (mData) + if (m_data) { - AlignedFree(mData); + AlignedFree(m_data); } } @@ -134,89 +134,89 @@ namespace MCore * On default the memory category is 0, which means unknown. * @result The memory category ID. */ - MCORE_INLINE uint16 GetMemoryCategory() const { return mMemCategory; } + MCORE_INLINE uint16 GetMemoryCategory() const { return m_memCategory; } /** * Set the memory category ID, where allocations made by this array will belong to. * On default, after construction of the array, the category ID is 0, which means it is unknown. * @param categoryID The memory category ID where this arrays allocations belong to. */ - MCORE_INLINE void SetMemoryCategory(uint16 categoryID) { mMemCategory = categoryID; } + MCORE_INLINE void SetMemoryCategory(uint16 categoryID) { m_memCategory = categoryID; } /** * Get a pointer to the first element. * @result A pointer to the first element. */ - MCORE_INLINE T* GetPtr() { return mData; } + MCORE_INLINE T* GetPtr() { return m_data; } /** * Get a pointer to the first element. * @result A pointer to the first element. */ - MCORE_INLINE T* GetPtr() const { return mData; } + MCORE_INLINE T* GetPtr() const { return m_data; } /** * Get a given item/element. * @param pos The item/element number. * @result A reference to the element. */ - MCORE_INLINE T& GetItem(size_t pos) { return mData[pos]; } + MCORE_INLINE T& GetItem(size_t pos) { return m_data[pos]; } /** * Get the first element. * @result A reference to the first element. */ - MCORE_INLINE T& GetFirst() { return mData[0]; } + MCORE_INLINE T& GetFirst() { return m_data[0]; } /** * Get the last element. * @result A reference to the last element. */ - MCORE_INLINE T& GetLast() { return mData[mLength - 1]; } + MCORE_INLINE T& GetLast() { return m_data[m_length - 1]; } /** * Get a read-only pointer to the first element. * @result A read-only pointer to the first element. */ - MCORE_INLINE const T* GetReadPtr() const { return mData; } + MCORE_INLINE const T* GetReadPtr() const { return m_data; } /** * Get a read-only reference to a given element number. * @param pos The element number. * @result A read-only reference to the given element. */ - MCORE_INLINE const T& GetItem(size_t pos) const { return mData[pos]; } + MCORE_INLINE const T& GetItem(size_t pos) const { return m_data[pos]; } /** * Get a read-only reference to the first element. * @result A read-only reference to the first element. */ - MCORE_INLINE const T& GetFirst() const { return mData[0]; } + MCORE_INLINE const T& GetFirst() const { return m_data[0]; } /** * Get a read-only reference to the last element. * @result A read-only reference to the last element. */ - MCORE_INLINE const T& GetLast() const { return mData[mLength - 1]; } + MCORE_INLINE const T& GetLast() const { return m_data[m_length - 1]; } /** * Check if the array is empty or not. * @result Returns true when there are no elements in the array, otherwise false is returned. */ - MCORE_INLINE bool GetIsEmpty() const { return (mLength == 0); } + MCORE_INLINE bool GetIsEmpty() const { return (m_length == 0); } /** * Checks if the passed index is in the array's range. * @param index The index to check. * @return True if the passed index is valid, false if not. */ - MCORE_INLINE bool GetIsValidIndex(size_t index) const { return (index < mLength); } + MCORE_INLINE bool GetIsValidIndex(size_t index) const { return (index < m_length); } /** * Get the number of elements in the array. * @result The number of elements in the array. */ - MCORE_INLINE size_t GetLength() const { return mLength; } + MCORE_INLINE size_t GetLength() const { return m_length; } /** * Get the maximum number of elements. This is the number of elements there currently is space for to store. @@ -224,7 +224,7 @@ namespace MCore * This purely has to do with pre-allocating, to reduce the number of reallocs. * @result The maximum array length. */ - MCORE_INLINE size_t GetMaxLength() const { return mMaxLength; } + MCORE_INLINE size_t GetMaxLength() const { return m_maxLength; } /** * Calculates the memory usage used by this array. @@ -233,7 +233,7 @@ namespace MCore */ MCORE_INLINE size_t CalcMemoryUsage(bool includeMembers = true) const { - size_t result = mMaxLength * sizeof(T); + size_t result = m_maxLength * sizeof(T); if (includeMembers) { result += sizeof(AlignedArray); @@ -246,19 +246,19 @@ namespace MCore * @param pos The element number. * @param value The value to store at that element number. */ - MCORE_INLINE void SetElem(size_t pos, const T& value) { mData[pos] = value; } + MCORE_INLINE void SetElem(size_t pos, const T& value) { m_data[pos] = value; } /** * Add a given element to the back of the array. * @param x The element to add. */ - MCORE_INLINE void Add(const T& x) { Grow(++mLength); Construct(mLength - 1, x); } + MCORE_INLINE void Add(const T& x) { Grow(++m_length); Construct(m_length - 1, x); } /** * Add a given element to the back of the array, but without pre-allocation caching. * @param x The element to add. */ - MCORE_INLINE void AddExact(const T& x) { GrowExact(++mLength); Construct(mLength - 1, x); } + MCORE_INLINE void AddExact(const T& x) { GrowExact(++m_length); Construct(m_length - 1, x); } /** * Add a given array to the back of this array. @@ -266,8 +266,8 @@ namespace MCore */ MCORE_INLINE void Add(const AlignedArray& a) { - size_t l = mLength; - Grow(mLength + a.mLength); + size_t l = m_length; + Grow(m_length + a.m_length); for (size_t i = 0; i < a.GetLength(); ++i) { Construct(l + i, a[i]); @@ -277,19 +277,19 @@ namespace MCore /** * Add an empty (default constructed) element to the back of the array. */ - MCORE_INLINE void AddEmpty() { Grow(++mLength); Construct(mLength - 1); } + MCORE_INLINE void AddEmpty() { Grow(++m_length); Construct(m_length - 1); } /** * Add an empty (default constructed) element to the back of the array, but without pre-allocation caching. */ - MCORE_INLINE void AddEmptyExact() { GrowExact(++mLength); Construct(mLength - 1); } + MCORE_INLINE void AddEmptyExact() { GrowExact(++m_length); Construct(m_length - 1); } /** * Remove the first array element. */ MCORE_INLINE void RemoveFirst() { - if (mLength > 0) + if (m_length > 0) { Remove(0); } @@ -300,9 +300,9 @@ namespace MCore */ MCORE_INLINE void RemoveLast() { - if (mLength > 0) + if (m_length > 0) { - Destruct(--mLength); + Destruct(--m_length); } } @@ -310,14 +310,14 @@ namespace MCore * Insert an empty element (default constructed) at a given position in the array. * @param pos The position to create the empty element. */ - MCORE_INLINE void Insert(size_t pos) { Grow(mLength + 1); MoveElements(pos + 1, pos, mLength - pos - 1); Construct(pos); } + MCORE_INLINE void Insert(size_t pos) { Grow(m_length + 1); MoveElements(pos + 1, pos, m_length - pos - 1); Construct(pos); } /** * Insert a given element at a given position in the array. * @param pos The position to insert the empty element. * @param x The element to store at this position. */ - MCORE_INLINE void Insert(size_t pos, const T& x) { Grow(mLength + 1); MoveElements(pos + 1, pos, mLength - pos - 1); Construct(pos, x); } + MCORE_INLINE void Insert(size_t pos, const T& x) { Grow(m_length + 1); MoveElements(pos + 1, pos, m_length - pos - 1); Construct(pos, x); } /** * Remove an element at a given position. @@ -326,11 +326,11 @@ namespace MCore MCORE_INLINE void Remove(size_t pos) { Destruct(pos); - if (mLength > 1) + if (m_length > 1) { - MoveElements(pos, pos + 1, mLength - pos - 1); + MoveElements(pos, pos + 1, m_length - pos - 1); } - mLength--; + m_length--; } /** @@ -344,8 +344,8 @@ namespace MCore { Destruct(i); } - MoveElements(pos, pos + num, mLength - pos - num); - mLength -= num; + MoveElements(pos, pos + num, m_length - pos - num); + m_length -= num; } /** @@ -375,12 +375,12 @@ namespace MCore MCORE_INLINE void SwapRemove(size_t pos) { Destruct(pos); - if (pos != mLength - 1) + if (pos != m_length - 1) { - Construct(pos, mData[mLength - 1]); - Destruct(mLength - 1); + Construct(pos, m_data[m_length - 1]); + Destruct(m_length - 1); } - mLength--; + m_length--; } // remove element at and place the last element of the array in that position /** @@ -403,11 +403,11 @@ namespace MCore */ MCORE_INLINE void Clear(bool clearMem = true) { - for (size_t i = 0; i < mLength; ++i) + for (size_t i = 0; i < m_length; ++i) { Destruct(i); } - mLength = 0; + m_length = 0; if (clearMem) { this->Free(); @@ -420,11 +420,11 @@ namespace MCore */ MCORE_INLINE void AssureSize(size_t newLength) { - if (mLength >= newLength) + if (m_length >= newLength) { return; } - size_t oldLen = mLength; + size_t oldLen = m_length; Grow(newLength); for (size_t i = oldLen; i < newLength; ++i) { @@ -438,7 +438,7 @@ namespace MCore */ MCORE_INLINE void Reserve(size_t minLength) { - if (mMaxLength < minLength) + if (m_maxLength < minLength) { Realloc(minLength); } @@ -449,12 +449,12 @@ namespace MCore */ MCORE_INLINE void Shrink() { - if (mLength == mMaxLength) + if (m_length == m_maxLength) { return; } - MCORE_ASSERT(mMaxLength >= mLength); - Realloc(mLength); + MCORE_ASSERT(m_maxLength >= m_length); + Realloc(m_length); } /** @@ -471,9 +471,9 @@ namespace MCore */ MCORE_INLINE size_t Find(const T& x) const { - for (size_t i = 0; i < mLength; ++i) + for (size_t i = 0; i < m_length; ++i) { - if (mData[i] == x) + if (m_data[i] == x) { return i; } @@ -487,7 +487,7 @@ namespace MCore * This resizes this array to be the exact length of the array we will copy the data from. * @param other The array to copy the data from. */ - MCORE_INLINE void MemCopyContentsFrom(const AlignedArray& other) { Resize(other.GetLength()); MemCopy((uint8*)mData, (uint8*)other.mData, sizeof(T) * other.mLength); } + MCORE_INLINE void MemCopyContentsFrom(const AlignedArray& other) { Resize(other.GetLength()); MemCopy((uint8*)m_data, (uint8*)other.m_data, sizeof(T) * other.m_length); } // sort function and standard sort function typedef int32 (MCORE_CDECL * CmpFunc)(const T& itemA, const T& itemB); @@ -526,7 +526,7 @@ namespace MCore * Sort the complete array using a given sort function. * @param cmp The sort function to use. */ - MCORE_INLINE void Sort(CmpFunc cmp) { InnerSort(0, mLength - 1, cmp); } + MCORE_INLINE void Sort(CmpFunc cmp) { InnerSort(0, m_length - 1, cmp); } /** * Sort a given part of the array using a given sort function. @@ -540,7 +540,7 @@ namespace MCore { if (last == InvalidIndex) { - last = mLength - 1; + last = m_length - 1; } InnerSort(first, last, cmp); } @@ -565,17 +565,17 @@ namespace MCore // resize in a fast way that doesn't call constructors or destructors void ResizeFast(size_t newLength) { - if (mLength == newLength) + if (m_length == newLength) { return; } - if (newLength > mLength) + if (newLength > m_length) { GrowExact(newLength); } - mLength = newLength; + m_length = newLength; } /** @@ -585,16 +585,16 @@ namespace MCore */ void Resize(size_t newLength) { - if (mLength == newLength) + if (m_length == newLength) { return; } // check for growing or shrinking array - if (newLength > mLength) + if (newLength > m_length) { // growing array, construct empty elements at end of array - const size_t oldLen = mLength; + const size_t oldLen = m_length; GrowExact(newLength); for (size_t i = oldLen; i < newLength; ++i) { @@ -604,12 +604,12 @@ namespace MCore else { // shrinking array, destruct elements at end of array - for (size_t i = newLength; i < mLength; ++i) + for (size_t i = newLength; i < m_length; ++i) { Destruct(i); } - mLength = newLength; + m_length = newLength; } } @@ -624,20 +624,20 @@ namespace MCore { if (numElements > 0) { - MemMove(mData + destIndex, mData + sourceIndex, numElements * sizeof(T)); + MemMove(m_data + destIndex, m_data + sourceIndex, numElements * sizeof(T)); } } // operators bool operator==(const AlignedArray& other) const { - if (mLength != other.mLength) + if (m_length != other.m_length) { return false; } - for (size_t i = 0; i < mLength; ++i) + for (size_t i = 0; i < m_length; ++i) { - if (mData[i] != other.mData[i]) + if (m_data[i] != other.m_data[i]) { return false; } @@ -649,11 +649,11 @@ namespace MCore if (&other != this) { Clear(false); - mMemCategory = other.mMemCategory; - Grow(other.mLength); - for (size_t i = 0; i < mLength; ++i) + m_memCategory = other.m_memCategory; + Grow(other.m_length); + for (size_t i = 0; i < m_length; ++i) { - Construct(i, other.mData[i]); + Construct(i, other.m_data[i]); } } return *this; @@ -661,35 +661,35 @@ namespace MCore AlignedArray& operator= (AlignedArray&& other) { MCORE_ASSERT(&other != this); - if (mData) + if (m_data) { - AlignedFree(mData); + AlignedFree(m_data); } - mData = other.mData; - mMemCategory = other.mMemCategory; - mLength = other.mLength; - mMaxLength = other.mMaxLength; - other.mData = nullptr; - other.mLength = 0; - other.mMaxLength = 0; + m_data = other.m_data; + m_memCategory = other.m_memCategory; + m_length = other.m_length; + m_maxLength = other.m_maxLength; + other.m_data = nullptr; + other.m_length = 0; + other.m_maxLength = 0; return *this; } AlignedArray& operator+=(const T& other) { Add(other); return *this; } AlignedArray& operator+=(const AlignedArray& other) { Add(other); return *this; } - MCORE_INLINE T& operator[](size_t index) { MCORE_ASSERT(index < mLength); return mData[index]; } - MCORE_INLINE const T& operator[](size_t index) const { MCORE_ASSERT(index < mLength); return mData[index]; } + MCORE_INLINE T& operator[](size_t index) { MCORE_ASSERT(index < m_length); return m_data[index]; } + MCORE_INLINE const T& operator[](size_t index) const { MCORE_ASSERT(index < m_length); return m_data[index]; } private: - T* mData; /**< The element data. */ - size_t mLength; /**< The number of used elements in the array. */ - size_t mMaxLength; /**< The number of elements that we have allocated memory for. */ - uint16 mMemCategory; /**< The memory category ID. */ + T* m_data; /**< The element data. */ + size_t m_length; /**< The number of used elements in the array. */ + size_t m_maxLength; /**< The number of elements that we have allocated memory for. */ + uint16 m_memCategory; /**< The memory category ID. */ // private functions MCORE_INLINE void Grow(size_t newLength) { - mLength = newLength; - if (mMaxLength >= newLength) + m_length = newLength; + if (m_maxLength >= newLength) { return; } @@ -697,14 +697,14 @@ namespace MCore } MCORE_INLINE void GrowExact(size_t newLength) { - mLength = newLength; - if (mMaxLength < newLength) + m_length = newLength; + if (m_maxLength < newLength) { Realloc(newLength); } } MCORE_INLINE size_t AllocSize(size_t num) { return 1 + num /*+num/8*/; } - MCORE_INLINE void Alloc(size_t num) { mData = (T*)AlignedAllocate(num * sizeof(T), alignment, mMemCategory, MEMORYBLOCK_ID, MCORE_FILE, MCORE_LINE); } + MCORE_INLINE void Alloc(size_t num) { m_data = (T*)AlignedAllocate(num * sizeof(T), alignment, m_memCategory, MEMORYBLOCK_ID, MCORE_FILE, MCORE_LINE); } MCORE_INLINE void Realloc(size_t newSize) { if (newSize == 0) @@ -712,43 +712,43 @@ namespace MCore this->Free(); return; } - if (mData) + if (m_data) { - mData = (T*)AlignedRealloc(mData, newSize * sizeof(T), mMaxLength * sizeof(T), alignment, mMemCategory, MEMORYBLOCK_ID, MCORE_FILE, MCORE_LINE); + m_data = (T*)AlignedRealloc(m_data, newSize * sizeof(T), m_maxLength * sizeof(T), alignment, m_memCategory, MEMORYBLOCK_ID, MCORE_FILE, MCORE_LINE); } else { - mData = (T*)AlignedAllocate(newSize * sizeof(T), alignment, mMemCategory, MEMORYBLOCK_ID, MCORE_FILE, MCORE_LINE); + m_data = (T*)AlignedAllocate(newSize * sizeof(T), alignment, m_memCategory, MEMORYBLOCK_ID, MCORE_FILE, MCORE_LINE); } - mMaxLength = newSize; + m_maxLength = newSize; } void Free() { - mLength = 0; - mMaxLength = 0; - if (mData) + m_length = 0; + m_maxLength = 0; + if (m_data) { - AlignedFree(mData); - mData = nullptr; + AlignedFree(m_data); + m_data = nullptr; } } - MCORE_INLINE void Construct(size_t index, const T& original) { ::new(mData + index)T(original); } // copy-construct an element at which is a copy of - MCORE_INLINE void Construct(size_t index) { ::new(mData + index)T; } // construct an element at place + MCORE_INLINE void Construct(size_t index, const T& original) { ::new(m_data + index)T(original); } // copy-construct an element at which is a copy of + MCORE_INLINE void Construct(size_t index) { ::new(m_data + index)T; } // construct an element at place MCORE_INLINE void Destruct(size_t index) { #if (MCORE_COMPILER == MCORE_COMPILER_MSVC) MCORE_UNUSED(index); // work around an MSVC compiler bug, where it triggers a warning that parameter 'index' is unused #endif - (mData + index)->~T(); + (m_data + index)->~T(); } // partition part of array (for sorting) int32 Partition(int32 left, int32 right, CmpFunc cmp) { - ::MCore::Swap(mData[left], mData[ (left + right) >> 1 ]); + ::MCore::Swap(m_data[left], m_data[ (left + right) >> 1 ]); - T& target = mData[right]; + T& target = m_data[right]; int32 i = left - 1; int32 j = right; @@ -757,14 +757,14 @@ namespace MCore { while (i < j) { - if (cmp(mData[++i], target) >= 0) + if (cmp(m_data[++i], target) >= 0) { break; } } while (j > i) { - if (cmp(mData[--j], target) <= 0) + if (cmp(m_data[--j], target) <= 0) { break; } @@ -773,10 +773,10 @@ namespace MCore { break; } - ::MCore::Swap(mData[i], mData[j]); + ::MCore::Swap(m_data[i], m_data[j]); } - ::MCore::Swap(mData[i], mData[right]); + ::MCore::Swap(m_data[i], m_data[right]); return i; } }; diff --git a/Gems/EMotionFX/Code/MCore/Source/Array2D.h b/Gems/EMotionFX/Code/MCore/Source/Array2D.h index a2bad5a5c2..f6c9234067 100644 --- a/Gems/EMotionFX/Code/MCore/Source/Array2D.h +++ b/Gems/EMotionFX/Code/MCore/Source/Array2D.h @@ -45,8 +45,8 @@ namespace MCore */ struct TableEntry { - size_t mStartIndex; /**< The index offset where the data for this row starts. */ - size_t mNumElements; /**< The number of elements to follow. */ + size_t m_startIndex; /**< The index offset where the data for this row starts. */ + size_t m_numElements; /**< The number of elements to follow. */ }; /** @@ -67,7 +67,7 @@ namespace MCore * */ Array2D(size_t numRows, size_t numPreAllocatedElemsPerRow = 2) - : mNumPreCachedElements(numPreAllocatedElemsPerRow) { Resize(numRows); } + : m_numPreCachedElements(numPreAllocatedElemsPerRow) { Resize(numRows); } /** * Resize the array in one dimension (the number of rows). @@ -126,7 +126,7 @@ namespace MCore * speedup adding of new elements and prevent memory reallocs. The default value is set to 2 when creating an array, unless specified differently. * @param numElemsPerRow The number of elements per row that should be pre-allocated. */ - void SetNumPreCachedElements(size_t numElemsPerRow) { mNumPreCachedElements = numElemsPerRow; } + void SetNumPreCachedElements(size_t numElemsPerRow) { m_numPreCachedElements = numElemsPerRow; } /** * Get the number of pre-cached/allocated elements per row, when creating new rows. @@ -134,14 +134,14 @@ namespace MCore * @result The number of elements per row that will be pre-allocated/cached when adding a new row. * @see SetNumPreCachedElements. */ - size_t GetNumPreCachedElements() const { return mNumPreCachedElements; } + size_t GetNumPreCachedElements() const { return m_numPreCachedElements; } /** * Get the number of stored elements inside a given row. * @param rowIndex The row number. * @result The number of elements stored inside this row. */ - size_t GetNumElements(size_t rowIndex) const { return mIndexTable[rowIndex].mNumElements; } + size_t GetNumElements(size_t rowIndex) const { return m_indexTable[rowIndex].m_numElements; } /** * Get a pointer to the element data stored in a given row. @@ -152,7 +152,7 @@ namespace MCore * @param rowIndex the row number. * @result A pointer to the element data for the given row. */ - T* GetElements(size_t rowIndex) { return &mData[ mIndexTable[rowIndex].mStartIndex ]; } + T* GetElements(size_t rowIndex) { return &m_data[ m_indexTable[rowIndex].m_startIndex ]; } /** * Get the data of a given element. @@ -160,7 +160,7 @@ namespace MCore * @param elementNr The element number inside this row to retrieve. * @result A reference to the element data. */ - T& GetElement(size_t rowIndex, size_t elementNr) { return mData[ mIndexTable[rowIndex].mStartIndex + elementNr ]; } + T& GetElement(size_t rowIndex, size_t elementNr) { return m_data[ m_indexTable[rowIndex].m_startIndex + elementNr ]; } /** * Get the data of a given element. @@ -168,7 +168,7 @@ namespace MCore * @param elementNr The element number inside this row to retrieve. * @result A const reference to the element data. */ - const T& GetElement(size_t rowIndex, size_t elementNr) const { return mData[ mIndexTable[rowIndex].mStartIndex + elementNr ]; } + const T& GetElement(size_t rowIndex, size_t elementNr) const { return m_data[ m_indexTable[rowIndex].m_startIndex + elementNr ]; } /** * Set the value for a given element in the array. @@ -176,13 +176,13 @@ namespace MCore * @param elementNr The element number to set the value for. * @param value The value to set the element to. */ - void SetElement(size_t rowIndex, size_t elementNr, const T& value) { MCORE_ASSERT(rowIndex < mIndexTable.GetLength()); MCORE_ASSERT(elementNr < mIndexTable[rowIndex].mNumElements); mData[ mIndexTable[rowIndex].mStartIndex + elementNr ] = value; } + void SetElement(size_t rowIndex, size_t elementNr, const T& value) { MCORE_ASSERT(rowIndex < m_indexTable.GetLength()); MCORE_ASSERT(elementNr < m_indexTable[rowIndex].m_numElements); m_data[ m_indexTable[rowIndex].m_startIndex + elementNr ] = value; } /** * Get the number of rows in the 2D array. * @result The number of rows. */ - size_t GetNumRows() const { return mIndexTable.size(); } + size_t GetNumRows() const { return m_indexTable.size(); } /** * Calculate the percentage of memory that is filled with element data. @@ -192,7 +192,7 @@ namespace MCore * would be most optimal. * @result The percentage (in range of 0..100) of used element memory. */ - float CalcUsedElementMemoryPercentage() const { return (mData.GetLength() ? (CalcTotalNumElements() / (float)mData.GetLength()) * 100.0f : 0); } + float CalcUsedElementMemoryPercentage() const { return (m_data.GetLength() ? (CalcTotalNumElements() / (float)m_data.GetLength()) * 100.0f : 0); } /** * Swap the element data of two rows. @@ -220,12 +220,12 @@ namespace MCore */ void Clear(bool freeMem = true) { - mIndexTable.clear(); - mData.clear(); + m_indexTable.clear(); + m_data.clear(); if (freeMem) { - mIndexTable.shrink_to_fit(); - mData.shrink_to_fit(); + m_indexTable.shrink_to_fit(); + m_data.shrink_to_fit(); } } @@ -242,7 +242,7 @@ namespace MCore * The length of the array equals the value returned by GetNumRows(). * @result The array of index table entries, which specify the start indices and number of entries per row. */ - AZStd::vector& GetIndexTable() { return mIndexTable; } + AZStd::vector& GetIndexTable() { return m_indexTable; } /** * Get the data array. @@ -250,12 +250,12 @@ namespace MCore * Normally you shouldn't be using this method. However it is useful in some specific cases. * @result The data array that contains all elements. */ - AZStd::vector& GetData() { return mData; } + AZStd::vector& GetData() { return m_data; } private: - AZStd::vector mData; /**< The element data. */ - AZStd::vector mIndexTable; /**< The index table that let's us know where what data is inside the element data array. */ - size_t mNumPreCachedElements = 2; /**< The number of elements per row to pre-allocate when resizing this array. This prevents some re-allocs. */ + AZStd::vector m_data; /**< The element data. */ + AZStd::vector m_indexTable; /**< The index table that let's us know where what data is inside the element data array. */ + size_t m_numPreCachedElements = 2; /**< The number of elements per row to pre-allocate when resizing this array. This prevents some re-allocs. */ }; diff --git a/Gems/EMotionFX/Code/MCore/Source/Array2D.inl b/Gems/EMotionFX/Code/MCore/Source/Array2D.inl index 47a3fd7015..5682ab54b0 100644 --- a/Gems/EMotionFX/Code/MCore/Source/Array2D.inl +++ b/Gems/EMotionFX/Code/MCore/Source/Array2D.inl @@ -11,7 +11,7 @@ template void Array2D::Resize(size_t numRows, bool autoShrink) { // get the current (old) number of rows - const size_t oldNumRows = mIndexTable.size(); + const size_t oldNumRows = m_indexTable.size(); // don't do anything when we don't need to if (numRows == oldNumRows) @@ -20,7 +20,7 @@ void Array2D::Resize(size_t numRows, bool autoShrink) } // resize the index table - mIndexTable.resize(numRows); + m_indexTable.resize(numRows); // check if we decreased the number of rows or not if (numRows < oldNumRows) @@ -36,13 +36,13 @@ void Array2D::Resize(size_t numRows, bool autoShrink) // init the new table entries for (size_t i = oldNumRows; i < numRows; ++i) { - mIndexTable[i].mStartIndex = mData.size() + (i * mNumPreCachedElements); - mIndexTable[i].mNumElements = 0; + m_indexTable[i].m_startIndex = m_data.size() + (i * m_numPreCachedElements); + m_indexTable[i].m_numElements = 0; } // grow the data array const size_t numNewRows = numRows - oldNumRows; - mData.resize(mData.size() + numNewRows * mNumPreCachedElements); + m_data.resize(m_data.size() + numNewRows * m_numPreCachedElements); } } @@ -51,20 +51,20 @@ void Array2D::Resize(size_t numRows, bool autoShrink) template void Array2D::Add(size_t rowIndex, const T& element) { - AZ_Assert(rowIndex < mIndexTable.size(), "Array index out of bounds"); + AZ_Assert(rowIndex < m_indexTable.size(), "Array index out of bounds"); // find the insert location inside the data array - size_t insertPos = mIndexTable[rowIndex].mStartIndex + mIndexTable[rowIndex].mNumElements; - if (insertPos >= mData.size()) + size_t insertPos = m_indexTable[rowIndex].m_startIndex + m_indexTable[rowIndex].m_numElements; + if (insertPos >= m_data.size()) { - mData.resize(insertPos + 1); + m_data.resize(insertPos + 1); } // check if we need to insert for real bool needRealInsert = true; - if (rowIndex < mIndexTable.size() - 1) // if there are still entries coming after the one we have to add to + if (rowIndex < m_indexTable.size() - 1) // if there are still entries coming after the one we have to add to { - if (insertPos < mIndexTable[rowIndex + 1].mStartIndex) // if basically there are empty unused element we can use + if (insertPos < m_indexTable[rowIndex + 1].m_startIndex) // if basically there are empty unused element we can use { needRealInsert = false; // then we don't need to do any reallocs } @@ -72,9 +72,9 @@ void Array2D::Add(size_t rowIndex, const T& element) else { // if we're dealing with the last row - if (rowIndex == mIndexTable.size() - 1) + if (rowIndex == m_indexTable.size() - 1) { - if (insertPos < mData.size()) // if basically there are empty unused element we can use + if (insertPos < m_data.size()) // if basically there are empty unused element we can use { needRealInsert = false; } @@ -85,22 +85,22 @@ void Array2D::Add(size_t rowIndex, const T& element) if (needRealInsert) { // insert the element inside the data array - mData.insert(AZStd::next(begin(mData), insertPos), element); + m_data.insert(AZStd::next(begin(m_data), insertPos), element); // adjust the index table entries - const size_t numRows = mIndexTable.size(); + const size_t numRows = m_indexTable.size(); for (size_t i = rowIndex + 1; i < numRows; ++i) { - mIndexTable[i].mStartIndex++; + m_indexTable[i].m_startIndex++; } } else { - mData[insertPos] = element; + m_data[insertPos] = element; } // increase the number of elements in the index table - mIndexTable[rowIndex].mNumElements++; + m_indexTable[rowIndex].m_numElements++; } @@ -108,21 +108,21 @@ void Array2D::Add(size_t rowIndex, const T& element) template void Array2D::Remove(size_t rowIndex, size_t elementIndex) { - AZ_Assert(rowIndex < mIndexTable.size(), "Array2D<>::Remove: array index out of bounds"); - AZ_Assert(elementIndex < mIndexTable[rowIndex].mNumElements, "Array2D<>::Remove: element index out of bounds"); - AZ_Assert(mIndexTable[rowIndex].mNumElements > 0, "Array2D<>::Remove: array index out of bounds"); + AZ_Assert(rowIndex < m_indexTable.size(), "Array2D<>::Remove: array index out of bounds"); + AZ_Assert(elementIndex < m_indexTable[rowIndex].m_numElements, "Array2D<>::Remove: element index out of bounds"); + AZ_Assert(m_indexTable[rowIndex].m_numElements > 0, "Array2D<>::Remove: array index out of bounds"); - const size_t startIndex = mIndexTable[rowIndex].mStartIndex; - const size_t maxElementIndex = mIndexTable[rowIndex].mNumElements - 1; + const size_t startIndex = m_indexTable[rowIndex].m_startIndex; + const size_t maxElementIndex = m_indexTable[rowIndex].m_numElements - 1; // swap the last element with the one to be removed if (elementIndex != maxElementIndex) { - mData[startIndex + elementIndex] = mData[startIndex + maxElementIndex]; + m_data[startIndex + elementIndex] = m_data[startIndex + maxElementIndex]; } // decrease the number of elements - mIndexTable[rowIndex].mNumElements--; + m_indexTable[rowIndex].m_numElements--; } @@ -130,8 +130,8 @@ void Array2D::Remove(size_t rowIndex, size_t elementIndex) template void Array2D::RemoveRow(size_t rowIndex, bool autoShrink) { - AZ_Assert(rowIndex < mIndexTable.GetLength(), "Array2D<>::RemoveRow: rowIndex out of bounds"); - mIndexTable.Remove(rowIndex); + AZ_Assert(rowIndex < m_indexTable.GetLength(), "Array2D<>::RemoveRow: rowIndex out of bounds"); + m_indexTable.Remove(rowIndex); // optimize memory usage when desired if (autoShrink) @@ -145,19 +145,19 @@ void Array2D::RemoveRow(size_t rowIndex, bool autoShrink) template void Array2D::RemoveRows(size_t startRow, size_t endRow, bool autoShrink) { - AZ_Assert(startRow < mIndexTable.size(), "Array2D<>::RemoveRows: startRow out of bounds"); - AZ_Assert(endRow < mIndexTable.size(), "Array2D<>::RemoveRows: endRow out of bounds"); + AZ_Assert(startRow < m_indexTable.size(), "Array2D<>::RemoveRows: startRow out of bounds"); + AZ_Assert(endRow < m_indexTable.size(), "Array2D<>::RemoveRows: endRow out of bounds"); // check if the start row is smaller than the end row if (startRow < endRow) { const size_t numToRemove = (endRow - startRow) + 1; - mIndexTable.erase(AZStd::next(begin(mIndexTable), startRow), AZStd::next(AZStd::next(begin(mIndexTable), startRow), numToRemove)); + m_indexTable.erase(AZStd::next(begin(m_indexTable), startRow), AZStd::next(AZStd::next(begin(m_indexTable), startRow), numToRemove)); } else // if the end row is smaller than the start row { const size_t numToRemove = (startRow - endRow) + 1; - mIndexTable.erase(AZStd::next(begin(mIndexTable), endRow), AZStd::next(AZStd::next(begin(mIndexTable), endRow), numToRemove)); + m_indexTable.erase(AZStd::next(begin(m_indexTable), endRow), AZStd::next(AZStd::next(begin(m_indexTable), endRow), numToRemove)); } // optimize memory usage when desired @@ -173,7 +173,7 @@ template void Array2D::Shrink() { // for all attributes, except for the last one - const size_t numRows = mIndexTable.size(); + const size_t numRows = m_indexTable.size(); if (numRows == 0) { return; @@ -183,20 +183,20 @@ void Array2D::Shrink() const size_t numRowsMinusOne = numRows - 1; for (size_t a = 0; a < numRowsMinusOne; ++a) { - const size_t firstUnusedIndex = mIndexTable[a ].mStartIndex + mIndexTable[a].mNumElements; - const size_t numUnusedElements = mIndexTable[a + 1].mStartIndex - firstUnusedIndex; + const size_t firstUnusedIndex = m_indexTable[a ].m_startIndex + m_indexTable[a].m_numElements; + const size_t numUnusedElements = m_indexTable[a + 1].m_startIndex - firstUnusedIndex; // if we have pre-cached/unused elements, remove those by moving memory to remove the "holes" if (numUnusedElements > 0) { // remove the unused elements from the array - mData.erase(AZStd::next(begin(mData), firstUnusedIndex), AZStd::next(AZStd::next(begin(mData), firstUnusedIndex), numUnusedElements)); + m_data.erase(AZStd::next(begin(m_data), firstUnusedIndex), AZStd::next(AZStd::next(begin(m_data), firstUnusedIndex), numUnusedElements)); // change the start indices for all the rows coming after the current one - const size_t numTotalRows = mIndexTable.size(); + const size_t numTotalRows = m_indexTable.size(); for (size_t i = a + 1; i < numTotalRows; ++i) { - mIndexTable[i].mStartIndex -= numUnusedElements; + m_indexTable[i].m_startIndex -= numUnusedElements; } } } @@ -207,25 +207,25 @@ void Array2D::Shrink() for (size_t row = 0; row < numRows; ++row) { // if the data starts after the place where it could start, move it to the place where it could start - if (mIndexTable[row].mStartIndex > dataPos) + if (m_indexTable[row].m_startIndex > dataPos) { - AZStd::move(AZStd::next(begin(mData), this->mIndexTable[row].mStartIndex), AZStd::next(AZStd::next(begin(mData), this->mIndexTable[row].mStartIndex), this->mIndexTable[row].mNumElements), AZStd::next(begin(mData), dataPos)); - mIndexTable[row].mStartIndex = dataPos; + AZStd::move(AZStd::next(begin(m_data), this->m_indexTable[row].m_startIndex), AZStd::next(AZStd::next(begin(m_data), this->m_indexTable[row].m_startIndex), this->m_indexTable[row].m_numElements), AZStd::next(begin(m_data), dataPos)); + m_indexTable[row].m_startIndex = dataPos; } // increase the data pos - dataPos += mIndexTable[row].mNumElements; + dataPos += m_indexTable[row].m_numElements; } // remove all unused data items - if (dataPos < mData.size()) + if (dataPos < m_data.size()) { - mData.erase(AZStd::next(begin(mData), dataPos), end(mData)); + m_data.erase(AZStd::next(begin(m_data), dataPos), end(m_data)); } // shrink the arrays - mData.shrink_to_fit(); - mIndexTable.shrink_to_fit(); + m_data.shrink_to_fit(); + m_indexTable.shrink_to_fit(); } @@ -236,10 +236,10 @@ size_t Array2D::CalcTotalNumElements() const size_t totalElements = 0; // add all number of row elements together - const size_t numRows = mIndexTable.size(); + const size_t numRows = m_indexTable.size(); for (size_t i = 0; i < numRows; ++i) { - totalElements += mIndexTable[i].mNumElements; + totalElements += m_indexTable[i].m_numElements; } return totalElements; @@ -251,14 +251,14 @@ template void Array2D::Swap(size_t rowA, size_t rowB) { // get the original number of elements from both rows - const size_t numElementsA = mIndexTable[rowA].mNumElements; - const size_t numElementsB = mIndexTable[rowB].mNumElements; + const size_t numElementsA = m_indexTable[rowA].m_numElements; + const size_t numElementsB = m_indexTable[rowB].m_numElements; // move the element data of rowA into a temp buffer AZStd::vector tempData(numElementsA); AZStd::move( - AZStd::next(mData.begin(), mIndexTable[rowA].mStartIndex), - AZStd::next(mData.begin(), mIndexTable[rowA].mStartIndex + numElementsA), + AZStd::next(m_data.begin(), m_indexTable[rowA].m_startIndex), + AZStd::next(m_data.begin(), m_indexTable[rowA].m_startIndex + numElementsA), tempData.begin() ); diff --git a/Gems/EMotionFX/Code/MCore/Source/Attribute.cpp b/Gems/EMotionFX/Code/MCore/Source/Attribute.cpp index 416d493453..ac6772e44e 100644 --- a/Gems/EMotionFX/Code/MCore/Source/Attribute.cpp +++ b/Gems/EMotionFX/Code/MCore/Source/Attribute.cpp @@ -13,7 +13,7 @@ namespace MCore { Attribute::Attribute(AZ::u32 typeID) { - mTypeID = typeID; + m_typeId = typeID; } Attribute::~Attribute() diff --git a/Gems/EMotionFX/Code/MCore/Source/Attribute.h b/Gems/EMotionFX/Code/MCore/Source/Attribute.h index 3b9b4459aa..e1ea970044 100644 --- a/Gems/EMotionFX/Code/MCore/Source/Attribute.h +++ b/Gems/EMotionFX/Code/MCore/Source/Attribute.h @@ -55,7 +55,7 @@ namespace MCore virtual Attribute* Clone() const = 0; virtual const char* GetTypeString() const = 0; - MCORE_INLINE AZ::u32 GetType() const { return mTypeID; } + MCORE_INLINE AZ::u32 GetType() const { return m_typeId; } virtual bool InitFromString(const AZStd::string& valueString) = 0; virtual bool ConvertToString(AZStd::string& outString) const = 0; virtual bool InitFrom(const Attribute* other) = 0; @@ -67,7 +67,7 @@ namespace MCore virtual void NetworkSerialize(EMotionFX::Network::AnimGraphSnapshotChunkSerializer&) {}; protected: - AZ::u32 mTypeID; /**< The unique type ID of the attribute class. */ + AZ::u32 m_typeId; /**< The unique type ID of the attribute class. */ Attribute(AZ::u32 typeID); }; diff --git a/Gems/EMotionFX/Code/MCore/Source/AttributeBool.cpp b/Gems/EMotionFX/Code/MCore/Source/AttributeBool.cpp index d91e188aae..cc9a7f88b7 100644 --- a/Gems/EMotionFX/Code/MCore/Source/AttributeBool.cpp +++ b/Gems/EMotionFX/Code/MCore/Source/AttributeBool.cpp @@ -20,13 +20,13 @@ namespace MCore switch (other->GetType()) { case TYPE_ID: - mValue = static_cast(other)->GetValue(); + m_value = static_cast(other)->GetValue(); return true; case MCore::AttributeFloat::TYPE_ID: - mValue = !MCore::Math::IsFloatZero(static_cast(other)->GetValue()); + m_value = !MCore::Math::IsFloatZero(static_cast(other)->GetValue()); return true; case MCore::AttributeInt32::TYPE_ID: - mValue = static_cast(other)->GetValue() != 0; + m_value = static_cast(other)->GetValue() != 0; return true; default: return false; diff --git a/Gems/EMotionFX/Code/MCore/Source/AttributeBool.h b/Gems/EMotionFX/Code/MCore/Source/AttributeBool.h index 3be04c3ce1..bf5d13d8fe 100644 --- a/Gems/EMotionFX/Code/MCore/Source/AttributeBool.h +++ b/Gems/EMotionFX/Code/MCore/Source/AttributeBool.h @@ -35,33 +35,33 @@ namespace MCore static AttributeBool* Create(bool value = false); // adjust values - MCORE_INLINE bool GetValue() const { return mValue; } - MCORE_INLINE void SetValue(bool value) { mValue = value; } + MCORE_INLINE bool GetValue() const { return m_value; } + MCORE_INLINE void SetValue(bool value) { m_value = value; } - MCORE_INLINE uint8* GetRawDataPointer() { return reinterpret_cast(&mValue); } + MCORE_INLINE uint8* GetRawDataPointer() { return reinterpret_cast(&m_value); } MCORE_INLINE size_t GetRawDataSize() const { return sizeof(bool); } // overloaded from the attribute base class - Attribute* Clone() const override { return AttributeBool::Create(mValue); } + Attribute* Clone() const override { return AttributeBool::Create(m_value); } const char* GetTypeString() const override { return "AttributeBool"; } bool InitFrom(const Attribute* other); bool InitFromString(const AZStd::string& valueString) override { - return AzFramework::StringFunc::LooksLikeBool(valueString.c_str(), &mValue); + return AzFramework::StringFunc::LooksLikeBool(valueString.c_str(), &m_value); } - bool ConvertToString(AZStd::string& outString) const override { outString = AZStd::string::format("%d", (mValue) ? 1 : 0); return true; } + bool ConvertToString(AZStd::string& outString) const override { outString = AZStd::string::format("%d", (m_value) ? 1 : 0); return true; } size_t GetClassSize() const override { return sizeof(AttributeBool); } AZ::u32 GetDefaultInterfaceType() const override { return ATTRIBUTE_INTERFACETYPE_CHECKBOX; } private: - bool mValue; /**< The boolean value, false on default. */ + bool m_value; /**< The boolean value, false on default. */ AttributeBool() : Attribute(TYPE_ID) - , mValue(false) {} + , m_value(false) {} AttributeBool(bool value) : Attribute(TYPE_ID) - , mValue(value) {} + , m_value(value) {} ~AttributeBool() {} }; } // namespace MCore diff --git a/Gems/EMotionFX/Code/MCore/Source/AttributeColor.h b/Gems/EMotionFX/Code/MCore/Source/AttributeColor.h index 4ad488af47..31205a088e 100644 --- a/Gems/EMotionFX/Code/MCore/Source/AttributeColor.h +++ b/Gems/EMotionFX/Code/MCore/Source/AttributeColor.h @@ -38,14 +38,14 @@ namespace MCore static AttributeColor* Create(const RGBAColor& value); // adjust values - MCORE_INLINE const RGBAColor& GetValue() const { return mValue; } - MCORE_INLINE void SetValue(const RGBAColor& value) { mValue = value; } + MCORE_INLINE const RGBAColor& GetValue() const { return m_value; } + MCORE_INLINE void SetValue(const RGBAColor& value) { m_value = value; } - MCORE_INLINE uint8* GetRawDataPointer() { return reinterpret_cast(&mValue); } + MCORE_INLINE uint8* GetRawDataPointer() { return reinterpret_cast(&m_value); } MCORE_INLINE size_t GetRawDataSize() const { return sizeof(RGBAColor); } // overloaded from the attribute base class - Attribute* Clone() const override { return AttributeColor::Create(mValue); } + Attribute* Clone() const override { return AttributeColor::Create(m_value); } const char* GetTypeString() const override { return "AttributeColor"; } bool InitFrom(const Attribute* other) override { @@ -53,7 +53,7 @@ namespace MCore { return false; } - mValue = static_cast(other)->GetValue(); + m_value = static_cast(other)->GetValue(); return true; } bool InitFromString(const AZStd::string& valueString) override @@ -63,21 +63,21 @@ namespace MCore { return false; } - mValue.Set(vec4.GetX(), vec4.GetY(), vec4.GetZ(), vec4.GetW()); + m_value.Set(vec4.GetX(), vec4.GetY(), vec4.GetZ(), vec4.GetW()); return true; } - bool ConvertToString(AZStd::string& outString) const override { AZStd::to_string(outString, AZ::Vector4(mValue.r, mValue.g, mValue.b, mValue.a)); return true; } + bool ConvertToString(AZStd::string& outString) const override { AZStd::to_string(outString, AZ::Vector4(m_value.m_r, m_value.m_g, m_value.m_b, m_value.m_a)); return true; } size_t GetClassSize() const override { return sizeof(AttributeColor); } AZ::u32 GetDefaultInterfaceType() const override { return ATTRIBUTE_INTERFACETYPE_COLOR; } private: - RGBAColor mValue; /**< The color value. */ + RGBAColor m_value; /**< The color value. */ AttributeColor() - : Attribute(TYPE_ID) { mValue.Set(0.0f, 0.0f, 0.0f, 1.0f); } + : Attribute(TYPE_ID) { m_value.Set(0.0f, 0.0f, 0.0f, 1.0f); } AttributeColor(const RGBAColor& value) : Attribute(TYPE_ID) - , mValue(value) { } + , m_value(value) { } ~AttributeColor() {} }; } // namespace MCore diff --git a/Gems/EMotionFX/Code/MCore/Source/AttributeFactory.cpp b/Gems/EMotionFX/Code/MCore/Source/AttributeFactory.cpp index 53b91dbb98..860d067671 100644 --- a/Gems/EMotionFX/Code/MCore/Source/AttributeFactory.cpp +++ b/Gems/EMotionFX/Code/MCore/Source/AttributeFactory.cpp @@ -41,13 +41,13 @@ namespace MCore { if (delFromMem) { - for (Attribute* attribute : mRegistered) + for (Attribute* attribute : m_registered) { delete attribute; } } - mRegistered.clear(); + m_registered.clear(); } @@ -57,11 +57,11 @@ namespace MCore const size_t attribIndex = FindAttributeIndexByType(attribute->GetType()); if (attribIndex != InvalidIndex) { - MCore::LogWarning("MCore::AttributeFactory::RegisterAttribute() - There is already an attribute of the same type registered (typeID %d vs %d - typeString '%s' vs '%s')", attribute->GetType(), mRegistered[attribIndex]->GetType(), attribute->GetTypeString(), mRegistered[attribIndex]->GetTypeString()); + MCore::LogWarning("MCore::AttributeFactory::RegisterAttribute() - There is already an attribute of the same type registered (typeID %d vs %d - typeString '%s' vs '%s')", attribute->GetType(), m_registered[attribIndex]->GetType(), attribute->GetTypeString(), m_registered[attribIndex]->GetTypeString()); return; } - mRegistered.emplace_back(attribute); + m_registered.emplace_back(attribute); } @@ -77,21 +77,21 @@ namespace MCore if (delFromMem) { - delete mRegistered[attribIndex]; + delete m_registered[attribIndex]; } - mRegistered.erase(mRegistered.begin() + attribIndex); + m_registered.erase(m_registered.begin() + attribIndex); } size_t AttributeFactory::FindAttributeIndexByType(size_t typeID) const { - const auto foundAttribute = AZStd::find_if(begin(mRegistered), end(mRegistered), [typeID](const Attribute* registeredAttribute) + const auto foundAttribute = AZStd::find_if(begin(m_registered), end(m_registered), [typeID](const Attribute* registeredAttribute) { return registeredAttribute->GetType() == typeID; }); - return foundAttribute != end(mRegistered) ? AZStd::distance(begin(mRegistered), foundAttribute) : InvalidIndex; + return foundAttribute != end(m_registered) ? AZStd::distance(begin(m_registered), foundAttribute) : InvalidIndex; } @@ -103,13 +103,13 @@ namespace MCore return nullptr; } - return mRegistered[attribIndex]->Clone(); + return m_registered[attribIndex]->Clone(); } void AttributeFactory::RegisterStandardTypes() { - mRegistered.reserve(10); + m_registered.reserve(10); RegisterAttribute(aznew AttributeFloat()); RegisterAttribute(aznew AttributeInt32()); RegisterAttribute(aznew AttributeString()); diff --git a/Gems/EMotionFX/Code/MCore/Source/AttributeFactory.h b/Gems/EMotionFX/Code/MCore/Source/AttributeFactory.h index 02bd5b0e1b..cb4c234267 100644 --- a/Gems/EMotionFX/Code/MCore/Source/AttributeFactory.h +++ b/Gems/EMotionFX/Code/MCore/Source/AttributeFactory.h @@ -30,13 +30,13 @@ namespace MCore void UnregisterAttribute(Attribute* attribute, bool delFromMem = true); void RegisterStandardTypes(); - size_t GetNumRegisteredAttributes() const { return mRegistered.size(); } - Attribute* GetRegisteredAttribute(size_t index) const { return mRegistered[index]; } + size_t GetNumRegisteredAttributes() const { return m_registered.size(); } + Attribute* GetRegisteredAttribute(size_t index) const { return m_registered[index]; } size_t FindAttributeIndexByType(size_t typeID) const; Attribute* CreateAttributeByType(size_t typeID) const; private: - AZStd::vector mRegistered; + AZStd::vector m_registered; }; } // namespace MCore diff --git a/Gems/EMotionFX/Code/MCore/Source/AttributeFloat.cpp b/Gems/EMotionFX/Code/MCore/Source/AttributeFloat.cpp index d8310d0744..fdfdc8a03b 100644 --- a/Gems/EMotionFX/Code/MCore/Source/AttributeFloat.cpp +++ b/Gems/EMotionFX/Code/MCore/Source/AttributeFloat.cpp @@ -21,13 +21,13 @@ namespace MCore switch (other->GetType()) { case TYPE_ID: - mValue = static_cast(other)->GetValue(); + m_value = static_cast(other)->GetValue(); return true; case MCore::AttributeBool::TYPE_ID: - mValue = static_cast(other)->GetValue(); + m_value = static_cast(other)->GetValue(); return true; case MCore::AttributeInt32::TYPE_ID: - mValue = static_cast(static_cast(other)->GetValue()); + m_value = static_cast(static_cast(other)->GetValue()); return true; default: return false; diff --git a/Gems/EMotionFX/Code/MCore/Source/AttributeFloat.h b/Gems/EMotionFX/Code/MCore/Source/AttributeFloat.h index fee4494ba5..97a68a9673 100644 --- a/Gems/EMotionFX/Code/MCore/Source/AttributeFloat.h +++ b/Gems/EMotionFX/Code/MCore/Source/AttributeFloat.h @@ -36,33 +36,33 @@ namespace MCore static AttributeFloat* Create(float value = 0.0f); // adjust values - MCORE_INLINE float GetValue() const { return mValue; } - MCORE_INLINE void SetValue(float value) { mValue = value; } + MCORE_INLINE float GetValue() const { return m_value; } + MCORE_INLINE void SetValue(float value) { m_value = value; } - MCORE_INLINE uint8* GetRawDataPointer() { return reinterpret_cast(&mValue); } + MCORE_INLINE uint8* GetRawDataPointer() { return reinterpret_cast(&m_value); } MCORE_INLINE size_t GetRawDataSize() const { return sizeof(float); } // overloaded from the attribute base class - Attribute* Clone() const override { return AttributeFloat::Create(mValue); } + Attribute* Clone() const override { return AttributeFloat::Create(m_value); } const char* GetTypeString() const override { return "AttributeFloat"; } bool InitFrom(const Attribute* other) override; bool InitFromString(const AZStd::string& valueString) override { - return AzFramework::StringFunc::LooksLikeFloat(valueString.c_str(), &mValue); + return AzFramework::StringFunc::LooksLikeFloat(valueString.c_str(), &m_value); } - bool ConvertToString(AZStd::string& outString) const override { outString = AZStd::string::format("%.8f", mValue); return true; } + bool ConvertToString(AZStd::string& outString) const override { outString = AZStd::string::format("%.8f", m_value); return true; } size_t GetClassSize() const override { return sizeof(AttributeFloat); } AZ::u32 GetDefaultInterfaceType() const override { return ATTRIBUTE_INTERFACETYPE_FLOATSPINNER; } private: - float mValue; /**< The float value. */ + float m_value; /**< The float value. */ AttributeFloat() : Attribute(TYPE_ID) - , mValue(0.0f) {} + , m_value(0.0f) {} AttributeFloat(float value) : Attribute(TYPE_ID) - , mValue(value) {} + , m_value(value) {} ~AttributeFloat() {} }; } // namespace MCore diff --git a/Gems/EMotionFX/Code/MCore/Source/AttributeInt32.cpp b/Gems/EMotionFX/Code/MCore/Source/AttributeInt32.cpp index d932c98a43..2297aca522 100644 --- a/Gems/EMotionFX/Code/MCore/Source/AttributeInt32.cpp +++ b/Gems/EMotionFX/Code/MCore/Source/AttributeInt32.cpp @@ -21,13 +21,13 @@ namespace MCore switch (other->GetType()) { case TYPE_ID: - mValue = static_cast(other)->GetValue(); + m_value = static_cast(other)->GetValue(); return true; case MCore::AttributeBool::TYPE_ID: - mValue = static_cast(other)->GetValue(); + m_value = static_cast(other)->GetValue(); return true; case MCore::AttributeFloat::TYPE_ID: - mValue = static_cast(static_cast(other)->GetValue()); + m_value = static_cast(static_cast(other)->GetValue()); return true; default: return false; diff --git a/Gems/EMotionFX/Code/MCore/Source/AttributeInt32.h b/Gems/EMotionFX/Code/MCore/Source/AttributeInt32.h index b1fd1da686..e195d584a5 100644 --- a/Gems/EMotionFX/Code/MCore/Source/AttributeInt32.h +++ b/Gems/EMotionFX/Code/MCore/Source/AttributeInt32.h @@ -36,33 +36,33 @@ namespace MCore static AttributeInt32* Create(int32 value = 0); // adjust values - MCORE_INLINE int32 GetValue() const { return mValue; } - MCORE_INLINE void SetValue(int32 value) { mValue = value; } + MCORE_INLINE int32 GetValue() const { return m_value; } + MCORE_INLINE void SetValue(int32 value) { m_value = value; } - MCORE_INLINE uint8* GetRawDataPointer() { return reinterpret_cast(&mValue); } + MCORE_INLINE uint8* GetRawDataPointer() { return reinterpret_cast(&m_value); } MCORE_INLINE size_t GetRawDataSize() const { return sizeof(int32); } // overloaded from the attribute base class - Attribute* Clone() const override { return AttributeInt32::Create(mValue); } + Attribute* Clone() const override { return AttributeInt32::Create(m_value); } const char* GetTypeString() const override { return "AttributeInt32"; } bool InitFrom(const Attribute* other); bool InitFromString(const AZStd::string& valueString) override { - return AzFramework::StringFunc::LooksLikeInt(valueString.c_str(), &mValue); + return AzFramework::StringFunc::LooksLikeInt(valueString.c_str(), &m_value); } - bool ConvertToString(AZStd::string& outString) const override { outString = AZStd::string::format("%d", mValue); return true; } + bool ConvertToString(AZStd::string& outString) const override { outString = AZStd::string::format("%d", m_value); return true; } size_t GetClassSize() const override { return sizeof(AttributeInt32); } AZ::u32 GetDefaultInterfaceType() const override { return ATTRIBUTE_INTERFACETYPE_INTSPINNER; } private: - int32 mValue; /**< The signed integer value. */ + int32 m_value; /**< The signed integer value. */ AttributeInt32() : Attribute(TYPE_ID) - , mValue(0) {} + , m_value(0) {} AttributeInt32(int32 value) : Attribute(TYPE_ID) - , mValue(value) {} + , m_value(value) {} ~AttributeInt32() {} }; } // namespace MCore diff --git a/Gems/EMotionFX/Code/MCore/Source/AttributePointer.h b/Gems/EMotionFX/Code/MCore/Source/AttributePointer.h index 98eb5f602b..d0cf2d5194 100644 --- a/Gems/EMotionFX/Code/MCore/Source/AttributePointer.h +++ b/Gems/EMotionFX/Code/MCore/Source/AttributePointer.h @@ -36,11 +36,11 @@ namespace MCore static AttributePointer* Create(void* value = nullptr); // adjust values - MCORE_INLINE void* GetValue() const { return mValue; } - MCORE_INLINE void SetValue(void* value) { mValue = value; } + MCORE_INLINE void* GetValue() const { return m_value; } + MCORE_INLINE void SetValue(void* value) { m_value = value; } // overloaded from the attribute base class - Attribute* Clone() const override { return AttributePointer::Create(mValue); } + Attribute* Clone() const override { return AttributePointer::Create(m_value); } const char* GetTypeString() const override { return "AttributePointer"; } bool InitFrom(const Attribute* other) override { @@ -48,7 +48,7 @@ namespace MCore { return false; } - mValue = static_cast(other)->GetValue(); + m_value = static_cast(other)->GetValue(); return true; } bool InitFromString(const AZStd::string& valueString) override { MCORE_UNUSED(valueString); MCORE_ASSERT(false); return false; } // currently unsupported @@ -57,14 +57,14 @@ namespace MCore AZ::u32 GetDefaultInterfaceType() const override { return ATTRIBUTE_INTERFACETYPE_DEFAULT; } private: - void* mValue; /**< The pointer value. */ + void* m_value; /**< The pointer value. */ AttributePointer() : Attribute(TYPE_ID) - , mValue(nullptr) { } + , m_value(nullptr) { } AttributePointer(void* pointer) : Attribute(TYPE_ID) - , mValue(pointer) { } + , m_value(pointer) { } ~AttributePointer() {} }; } // namespace MCore diff --git a/Gems/EMotionFX/Code/MCore/Source/AttributeQuaternion.h b/Gems/EMotionFX/Code/MCore/Source/AttributeQuaternion.h index 39d9243197..1efbe7f690 100644 --- a/Gems/EMotionFX/Code/MCore/Source/AttributeQuaternion.h +++ b/Gems/EMotionFX/Code/MCore/Source/AttributeQuaternion.h @@ -38,15 +38,15 @@ namespace MCore static AttributeQuaternion* Create(float x, float y, float z, float w); static AttributeQuaternion* Create(const AZ::Quaternion& value); - MCORE_INLINE uint8* GetRawDataPointer() { return reinterpret_cast(&mValue); } + MCORE_INLINE uint8* GetRawDataPointer() { return reinterpret_cast(&m_value); } MCORE_INLINE size_t GetRawDataSize() const { return sizeof(AZ::Quaternion); } // adjust values - MCORE_INLINE const AZ::Quaternion& GetValue() const { return mValue; } - MCORE_INLINE void SetValue(const AZ::Quaternion& value) { mValue = value; } + MCORE_INLINE const AZ::Quaternion& GetValue() const { return m_value; } + MCORE_INLINE void SetValue(const AZ::Quaternion& value) { m_value = value; } // overloaded from the attribute base class - Attribute* Clone() const override { return AttributeQuaternion::Create(mValue); } + Attribute* Clone() const override { return AttributeQuaternion::Create(m_value); } const char* GetTypeString() const override { return "AttributeQuaternion"; } bool InitFrom(const Attribute* other) override { @@ -54,7 +54,7 @@ namespace MCore { return false; } - mValue = static_cast(other)->GetValue(); + m_value = static_cast(other)->GetValue(); return true; } bool InitFromString(const AZStd::string& valueString) override @@ -64,23 +64,23 @@ namespace MCore { return false; } - mValue.Set(vec4.GetX(), vec4.GetY(), vec4.GetZ(), vec4.GetW()); + m_value.Set(vec4.GetX(), vec4.GetY(), vec4.GetZ(), vec4.GetW()); return true; } - bool ConvertToString(AZStd::string& outString) const override { AZStd::to_string(outString, mValue); return true; } + bool ConvertToString(AZStd::string& outString) const override { AZStd::to_string(outString, m_value); return true; } size_t GetClassSize() const override { return sizeof(AttributeQuaternion); } AZ::u32 GetDefaultInterfaceType() const override { return ATTRIBUTE_INTERFACETYPE_DEFAULT; } private: - AZ::Quaternion mValue; /**< The Quaternion value. */ + AZ::Quaternion m_value; /**< The Quaternion value. */ AttributeQuaternion() : Attribute(TYPE_ID) - , mValue(AZ::Quaternion::CreateIdentity()) + , m_value(AZ::Quaternion::CreateIdentity()) {} AttributeQuaternion(const AZ::Quaternion& value) : Attribute(TYPE_ID) - , mValue(value) {} + , m_value(value) {} ~AttributeQuaternion() { } }; } // namespace MCore diff --git a/Gems/EMotionFX/Code/MCore/Source/AttributeString.h b/Gems/EMotionFX/Code/MCore/Source/AttributeString.h index a05c057023..916b9ad2fd 100644 --- a/Gems/EMotionFX/Code/MCore/Source/AttributeString.h +++ b/Gems/EMotionFX/Code/MCore/Source/AttributeString.h @@ -35,16 +35,16 @@ namespace MCore static AttributeString* Create(const AZStd::string& value); static AttributeString* Create(const char* value = ""); - MCORE_INLINE uint8* GetRawDataPointer() { return reinterpret_cast(mValue.data()); } - MCORE_INLINE size_t GetRawDataSize() const { return mValue.size(); } + MCORE_INLINE uint8* GetRawDataPointer() { return reinterpret_cast(m_value.data()); } + MCORE_INLINE size_t GetRawDataSize() const { return m_value.size(); } // adjust values - MCORE_INLINE const char* AsChar() const { return mValue.c_str(); } - MCORE_INLINE const AZStd::string& GetValue() const { return mValue; } - MCORE_INLINE void SetValue(const AZStd::string& value) { mValue = value; } + MCORE_INLINE const char* AsChar() const { return m_value.c_str(); } + MCORE_INLINE const AZStd::string& GetValue() const { return m_value; } + MCORE_INLINE void SetValue(const AZStd::string& value) { m_value = value; } // overloaded from the attribute base class - Attribute* Clone() const override { return AttributeString::Create(mValue); } + Attribute* Clone() const override { return AttributeString::Create(m_value); } const char* GetTypeString() const override { return "AttributeString"; } bool InitFrom(const Attribute* other) override { @@ -52,25 +52,25 @@ namespace MCore { return false; } - mValue = static_cast(other)->GetValue(); + m_value = static_cast(other)->GetValue(); return true; } - bool InitFromString(const AZStd::string& valueString) override { mValue = valueString; return true; } - bool ConvertToString(AZStd::string& outString) const override { outString = mValue; return true; } + bool InitFromString(const AZStd::string& valueString) override { m_value = valueString; return true; } + bool ConvertToString(AZStd::string& outString) const override { outString = m_value; return true; } size_t GetClassSize() const override { return sizeof(AttributeString); } uint32 GetDefaultInterfaceType() const override { return ATTRIBUTE_INTERFACETYPE_STRING; } private: - AZStd::string mValue; /**< The string value. */ + AZStd::string m_value; /**< The string value. */ AttributeString() : Attribute(TYPE_ID) { } AttributeString(const AZStd::string& value) : Attribute(TYPE_ID) - , mValue(value) { } + , m_value(value) { } AttributeString(const char* value) : Attribute(TYPE_ID) - , mValue(value) { } - ~AttributeString() { mValue.clear(); } + , m_value(value) { } + ~AttributeString() { m_value.clear(); } }; } // namespace MCore diff --git a/Gems/EMotionFX/Code/MCore/Source/AttributeVector2.h b/Gems/EMotionFX/Code/MCore/Source/AttributeVector2.h index 826899186a..2d12e7a268 100644 --- a/Gems/EMotionFX/Code/MCore/Source/AttributeVector2.h +++ b/Gems/EMotionFX/Code/MCore/Source/AttributeVector2.h @@ -42,15 +42,15 @@ namespace MCore static AttributeVector2* Create(const AZ::Vector2& value); static AttributeVector2* Create(float x, float y); - MCORE_INLINE uint8* GetRawDataPointer() { return reinterpret_cast(&mValue); } + MCORE_INLINE uint8* GetRawDataPointer() { return reinterpret_cast(&m_value); } MCORE_INLINE size_t GetRawDataSize() const { return sizeofVector2; } // adjust values - MCORE_INLINE const AZ::Vector2& GetValue() const { return mValue; } - MCORE_INLINE void SetValue(const AZ::Vector2& value) { mValue = value; } + MCORE_INLINE const AZ::Vector2& GetValue() const { return m_value; } + MCORE_INLINE void SetValue(const AZ::Vector2& value) { m_value = value; } // overloaded from the attribute base class - Attribute* Clone() const override { return AttributeVector2::Create(mValue); } + Attribute* Clone() const override { return AttributeVector2::Create(m_value); } const char* GetTypeString() const override { return "AttributeVector2"; } bool InitFrom(const Attribute* other) override { @@ -58,25 +58,25 @@ namespace MCore { return false; } - mValue = static_cast(other)->GetValue(); + m_value = static_cast(other)->GetValue(); return true; } bool InitFromString(const AZStd::string& valueString) override { - return AzFramework::StringFunc::LooksLikeVector2(valueString.c_str(), &mValue); + return AzFramework::StringFunc::LooksLikeVector2(valueString.c_str(), &m_value); } - bool ConvertToString(AZStd::string& outString) const override { AZStd::to_string(outString, mValue); return true; } + bool ConvertToString(AZStd::string& outString) const override { AZStd::to_string(outString, m_value); return true; } size_t GetClassSize() const override { return sizeof(AttributeVector2); } AZ::u32 GetDefaultInterfaceType() const override { return ATTRIBUTE_INTERFACETYPE_VECTOR2; } private: - AZ::Vector2 mValue; /**< The Vector2 value. */ + AZ::Vector2 m_value; /**< The Vector2 value. */ AttributeVector2() - : Attribute(TYPE_ID) { mValue.Set(0.0f, 0.0f); } + : Attribute(TYPE_ID) { m_value.Set(0.0f, 0.0f); } AttributeVector2(const AZ::Vector2& value) : Attribute(TYPE_ID) - , mValue(value) { } + , m_value(value) { } ~AttributeVector2() { } }; } // namespace MCore diff --git a/Gems/EMotionFX/Code/MCore/Source/AttributeVector3.h b/Gems/EMotionFX/Code/MCore/Source/AttributeVector3.h index 066962fb8f..481a4e4665 100644 --- a/Gems/EMotionFX/Code/MCore/Source/AttributeVector3.h +++ b/Gems/EMotionFX/Code/MCore/Source/AttributeVector3.h @@ -37,15 +37,15 @@ namespace MCore static AttributeVector3* Create(const AZ::Vector3& value); static AttributeVector3* Create(float x, float y, float z); - MCORE_INLINE uint8* GetRawDataPointer() { return reinterpret_cast(&mValue); } + MCORE_INLINE uint8* GetRawDataPointer() { return reinterpret_cast(&m_value); } MCORE_INLINE size_t GetRawDataSize() const { return sizeof(AZ::Vector3); } // adjust values - MCORE_INLINE const AZ::Vector3& GetValue() const { return mValue; } - MCORE_INLINE void SetValue(const AZ::Vector3& value) { mValue = value; } + MCORE_INLINE const AZ::Vector3& GetValue() const { return m_value; } + MCORE_INLINE void SetValue(const AZ::Vector3& value) { m_value = value; } // overloaded from the attribute base class - Attribute* Clone() const override { return AttributeVector3::Create(mValue); } + Attribute* Clone() const override { return AttributeVector3::Create(m_value); } const char* GetTypeString() const override { return "AttributeVector3"; } bool InitFrom(const Attribute* other) override { @@ -53,7 +53,7 @@ namespace MCore { return false; } - mValue = static_cast(other)->GetValue(); + m_value = static_cast(other)->GetValue(); return true; } bool InitFromString(const AZStd::string& valueString) override @@ -63,21 +63,21 @@ namespace MCore { return false; } - mValue.Set(vec3.GetX(), vec3.GetY(), vec3.GetZ()); + m_value.Set(vec3.GetX(), vec3.GetY(), vec3.GetZ()); return true; } - bool ConvertToString(AZStd::string& outString) const override { AZStd::to_string(outString, mValue); return true; } + bool ConvertToString(AZStd::string& outString) const override { AZStd::to_string(outString, m_value); return true; } size_t GetClassSize() const override { return sizeof(AttributeVector3); } AZ::u32 GetDefaultInterfaceType() const override { return ATTRIBUTE_INTERFACETYPE_VECTOR3; } private: - AZ::Vector3 mValue; /**< The Vector3 value. */ + AZ::Vector3 m_value; /**< The Vector3 value. */ AttributeVector3() - : Attribute(TYPE_ID) { mValue.Set(0.0f, 0.0f, 0.0f); } + : Attribute(TYPE_ID) { m_value.Set(0.0f, 0.0f, 0.0f); } AttributeVector3(const AZ::Vector3& value) : Attribute(TYPE_ID) - , mValue(value) { } + , m_value(value) { } ~AttributeVector3() { } }; } // namespace MCore diff --git a/Gems/EMotionFX/Code/MCore/Source/AttributeVector4.h b/Gems/EMotionFX/Code/MCore/Source/AttributeVector4.h index 7b20e92a6b..cc38fb92ab 100644 --- a/Gems/EMotionFX/Code/MCore/Source/AttributeVector4.h +++ b/Gems/EMotionFX/Code/MCore/Source/AttributeVector4.h @@ -38,15 +38,15 @@ namespace MCore static AttributeVector4* Create(const AZ::Vector4& value); static AttributeVector4* Create(float x, float y, float z, float w); - MCORE_INLINE uint8* GetRawDataPointer() { return reinterpret_cast(&mValue); } + MCORE_INLINE uint8* GetRawDataPointer() { return reinterpret_cast(&m_value); } MCORE_INLINE size_t GetRawDataSize() const { return sizeof(AZ::Vector4); } // adjust values - MCORE_INLINE const AZ::Vector4& GetValue() const { return mValue; } - MCORE_INLINE void SetValue(const AZ::Vector4& value) { mValue = value; } + MCORE_INLINE const AZ::Vector4& GetValue() const { return m_value; } + MCORE_INLINE void SetValue(const AZ::Vector4& value) { m_value = value; } // overloaded from the attribute base class - Attribute* Clone() const override { return AttributeVector4::Create(mValue); } + Attribute* Clone() const override { return AttributeVector4::Create(m_value); } const char* GetTypeString() const override { return "AttributeVector4"; } bool InitFrom(const Attribute* other) override { @@ -54,26 +54,25 @@ namespace MCore { return false; } - mValue = static_cast(other)->GetValue(); + m_value = static_cast(other)->GetValue(); return true; } bool InitFromString(const AZStd::string& valueString) override { - return AzFramework::StringFunc::LooksLikeVector4(valueString.c_str(), &mValue); + return AzFramework::StringFunc::LooksLikeVector4(valueString.c_str(), &m_value); } - bool ConvertToString(AZStd::string& outString) const override { AZStd::to_string(outString, mValue); return true; } - // void ConvertCoordinateSystem() { GetCoordinateSystem().ConvertVector4(&mValue); } + bool ConvertToString(AZStd::string& outString) const override { AZStd::to_string(outString, m_value); return true; } size_t GetClassSize() const override { return sizeof(AttributeVector4); } AZ::u32 GetDefaultInterfaceType() const override { return ATTRIBUTE_INTERFACETYPE_VECTOR4; } private: - AZ::Vector4 mValue; /**< The Vector4 value. */ + AZ::Vector4 m_value; /**< The Vector4 value. */ AttributeVector4() - : Attribute(TYPE_ID) { mValue.Set(0.0f, 0.0f, 0.0f, 0.0f); } + : Attribute(TYPE_ID) { m_value.Set(0.0f, 0.0f, 0.0f, 0.0f); } AttributeVector4(const AZ::Vector4& value) : Attribute(TYPE_ID) - , mValue(value) { } + , m_value(value) { } ~AttributeVector4() { } }; } // namespace MCore diff --git a/Gems/EMotionFX/Code/MCore/Source/AzCoreConversions.h b/Gems/EMotionFX/Code/MCore/Source/AzCoreConversions.h index d185a804b8..bbc874dfdd 100644 --- a/Gems/EMotionFX/Code/MCore/Source/AzCoreConversions.h +++ b/Gems/EMotionFX/Code/MCore/Source/AzCoreConversions.h @@ -29,7 +29,7 @@ namespace MCore { AZ_FORCE_INLINE AZ::Color EmfxColorToAzColor(const RGBAColor& emfxColor) { - return AZ::Color(emfxColor.r, emfxColor.g, emfxColor.b, emfxColor.a); + return AZ::Color(emfxColor.m_r, emfxColor.m_g, emfxColor.m_b, emfxColor.m_a); } AZ_FORCE_INLINE RGBAColor AzColorToEmfxColor(const AZ::Color& azColor) @@ -39,10 +39,10 @@ namespace MCore AZ_FORCE_INLINE AZ::Transform EmfxTransformToAzTransform(const EMotionFX::Transform& emfxTransform) { - AZ::Transform transform = AZ::Transform::CreateFromQuaternionAndTranslation(emfxTransform.mRotation, emfxTransform.mPosition); + AZ::Transform transform = AZ::Transform::CreateFromQuaternionAndTranslation(emfxTransform.m_rotation, emfxTransform.m_position); EMFX_SCALECODE ( - transform.MultiplyByUniformScale(emfxTransform.mScale.GetMaxElement()); + transform.MultiplyByUniformScale(emfxTransform.m_scale.GetMaxElement()); ) return transform; } diff --git a/Gems/EMotionFX/Code/MCore/Source/BoundingSphere.cpp b/Gems/EMotionFX/Code/MCore/Source/BoundingSphere.cpp index 959cebe16d..376052563f 100644 --- a/Gems/EMotionFX/Code/MCore/Source/BoundingSphere.cpp +++ b/Gems/EMotionFX/Code/MCore/Source/BoundingSphere.cpp @@ -17,26 +17,26 @@ namespace MCore void BoundingSphere::Encapsulate(const AZ::Vector3& v) { // calculate the squared distance from the center to the point - const AZ::Vector3 diff = v - mCenter; + const AZ::Vector3 diff = v - m_center; const float dist = diff.Dot(diff); // if the current sphere doesn't contain the point, grow the sphere so that it contains the point - if (dist > mRadiusSq) + if (dist > m_radiusSq) { - const AZ::Vector3 diff2 = diff.GetNormalized() * mRadius; + const AZ::Vector3 diff2 = diff.GetNormalized() * m_radius; const AZ::Vector3 delta = 0.5f * (diff - diff2); - mCenter += delta; + m_center += delta; // TODO: KB- Was a 'safe' function, is there an AZ equivalent? float length = delta.GetLengthSq(); if (length >= FLT_EPSILON) { - mRadius += sqrtf(length); + m_radius += sqrtf(length); } else { - mRadius = 0.0f; + m_radius = 0.0f; } - mRadiusSq = mRadius * mRadius; + m_radiusSq = m_radius * m_radius; } } @@ -49,10 +49,10 @@ namespace MCore for (int32_t t = 0; t < 3; ++t) { const AZ::Vector3& minVec = b.GetMin(); - if (mCenter.GetElement(t) < minVec.GetElement(t)) + if (m_center.GetElement(t) < minVec.GetElement(t)) { - distance += (mCenter.GetElement(t) - minVec.GetElement(t)) * (mCenter.GetElement(t) - minVec.GetElement(t)); - if (distance > mRadiusSq) + distance += (m_center.GetElement(t) - minVec.GetElement(t)) * (m_center.GetElement(t) - minVec.GetElement(t)); + if (distance > m_radiusSq) { return false; } @@ -60,10 +60,10 @@ namespace MCore else { const AZ::Vector3& maxVec = b.GetMax(); - if (mCenter.GetElement(t) > maxVec.GetElement(t)) + if (m_center.GetElement(t) > maxVec.GetElement(t)) { - distance += (mCenter.GetElement(t) - maxVec.GetElement(t)) * (mCenter.GetElement(t) - maxVec.GetElement(t)); - if (distance > mRadiusSq) + distance += (m_center.GetElement(t) - maxVec.GetElement(t)) * (m_center.GetElement(t) - maxVec.GetElement(t)); + if (distance > m_radiusSq) { return false; } @@ -82,20 +82,20 @@ namespace MCore for (int32_t t = 0; t < 3; ++t) { const AZ::Vector3& maxVec = b.GetMax(); - if (mCenter.GetElement(t) < maxVec.GetElement(t)) + if (m_center.GetElement(t) < maxVec.GetElement(t)) { - distance += (mCenter.GetElement(t) - maxVec.GetElement(t)) * (mCenter.GetElement(t) - maxVec.GetElement(t)); + distance += (m_center.GetElement(t) - maxVec.GetElement(t)) * (m_center.GetElement(t) - maxVec.GetElement(t)); } else { const AZ::Vector3& minVec = b.GetMin(); - if (mCenter.GetElement(t) > minVec.GetElement(t)) + if (m_center.GetElement(t) > minVec.GetElement(t)) { - distance += (mCenter.GetElement(t) - minVec.GetElement(t)) * (mCenter.GetElement(t) - minVec.GetElement(t)); + distance += (m_center.GetElement(t) - minVec.GetElement(t)) * (m_center.GetElement(t) - minVec.GetElement(t)); } } - if (distance > mRadiusSq) + if (distance > m_radiusSq) { return false; } diff --git a/Gems/EMotionFX/Code/MCore/Source/BoundingSphere.h b/Gems/EMotionFX/Code/MCore/Source/BoundingSphere.h index db8aee70cc..1687f72799 100644 --- a/Gems/EMotionFX/Code/MCore/Source/BoundingSphere.h +++ b/Gems/EMotionFX/Code/MCore/Source/BoundingSphere.h @@ -32,9 +32,9 @@ namespace MCore * Sets the sphere center to (0,0,0) and makes the radius 0. */ MCORE_INLINE BoundingSphere() - : mCenter(AZ::Vector3::CreateZero()) - , mRadius(0.0f) - , mRadiusSq(0.0f) {} + : m_center(AZ::Vector3::CreateZero()) + , m_radius(0.0f) + , m_radiusSq(0.0f) {} /** * Constructor which sets the center of the sphere and it's radius. @@ -43,9 +43,9 @@ namespace MCore * @param rad The radius of the sphere. */ MCORE_INLINE BoundingSphere(const AZ::Vector3& pos, float rad) - : mCenter(pos) - , mRadius(rad) - , mRadiusSq(rad * rad) {} + : m_center(pos) + , m_radius(rad) + , m_radiusSq(rad * rad) {} /** * Constructor which sets the center, radius and squared radius. @@ -55,16 +55,16 @@ namespace MCore * @param radSq The squared radius of the sphere (rad*rad). */ MCORE_INLINE BoundingSphere(const AZ::Vector3& pos, float rad, float radSq) - : mCenter(pos) - , mRadius(rad) - , mRadiusSq(radSq) {} + : m_center(pos) + , m_radius(rad) + , m_radiusSq(radSq) {} /** * Initialize the spheres center, radius and square radius. * This will set the center position to (0,0,0) and both the radius and squared radius to 0. * Call this method when you want to reset the sphere. Note that this is already done by the default constructor. */ - MCORE_INLINE void Init() { mCenter = AZ::Vector3::CreateZero(); mRadius = mRadiusSq = 0.0f; } + MCORE_INLINE void Init() { m_center = AZ::Vector3::CreateZero(); m_radius = m_radiusSq = 0.0f; } /** * Encapsulate a 3D point to the sphere. @@ -75,12 +75,12 @@ namespace MCore */ MCORE_INLINE void EncapsulateFast(const AZ::Vector3& v) { - AZ::Vector3 diff = (mCenter - v); + AZ::Vector3 diff = (m_center - v); const float dist = diff.Dot(diff); - if (dist > mRadiusSq) + if (dist > m_radiusSq) { - mRadiusSq = dist; - mRadius = Math::Sqrt(dist); + m_radiusSq = dist; + m_radius = Math::Sqrt(dist); } } @@ -90,7 +90,7 @@ namespace MCore * @param v The vector representing the 3D point to perform the test with. * @result Returns true when 'v' is inside the spheres volume, otherwise false is returned. */ - MCORE_INLINE bool Contains(const AZ::Vector3& v) { return ((mCenter - v).GetLengthSq() <= mRadiusSq); } + MCORE_INLINE bool Contains(const AZ::Vector3& v) { return ((m_center - v).GetLengthSq() <= m_radiusSq); } /** * Check if the sphere COMPLETELY contains a given other sphere. @@ -98,7 +98,7 @@ namespace MCore * @param s The sphere to perform the test with. * @result Returns true when 's' is completely inside this sphere. False is returned in any other case. */ - MCORE_INLINE bool Contains(const BoundingSphere& s) const { return ((mCenter - s.mCenter).GetLengthSq() <= (mRadiusSq - s.mRadiusSq)); } + MCORE_INLINE bool Contains(const BoundingSphere& s) const { return ((m_center - s.m_center).GetLengthSq() <= (m_radiusSq - s.m_radiusSq)); } /** * Check if a given sphere intersects with this sphere. @@ -106,7 +106,7 @@ namespace MCore * @param s The sphere to perform the intersection test with. * @result Returns true when 's' intersects this sphere. So if it's partially or completely inside this sphere or if the borders overlap. */ - MCORE_INLINE bool Intersects(const BoundingSphere& s) const { return ((mCenter - s.mCenter).GetLengthSq() <= (mRadiusSq + s.mRadiusSq)); } + MCORE_INLINE bool Intersects(const BoundingSphere& s) const { return ((m_center - s.m_center).GetLengthSq() <= (m_radiusSq + s.m_radiusSq)); } /** * Encapsulate a given 3D point with this sphere. @@ -138,36 +138,36 @@ namespace MCore * Get the radius of the sphere. * @result Returns the radius of the sphere. */ - MCORE_INLINE float GetRadius() const { return mRadius; } + MCORE_INLINE float GetRadius() const { return m_radius; } /** * Get the squared radius of the sphere. * @result Returns the squared radius of the sphere (no calculations done for this), since it's already known. */ - MCORE_INLINE float GetRadiusSquared() const { return mRadiusSq; } + MCORE_INLINE float GetRadiusSquared() const { return m_radiusSq; } /** * Get the center of the sphere. So the position of the sphere. * @result Returns the center position of the sphere. */ - MCORE_INLINE const AZ::Vector3& GetCenter() const { return mCenter; } + MCORE_INLINE const AZ::Vector3& GetCenter() const { return m_center; } /** * Set the center of the sphere. * @param center The center position of the sphere. */ - MCORE_INLINE void SetCenter(const AZ::Vector3& center) { mCenter = center; } + MCORE_INLINE void SetCenter(const AZ::Vector3& center) { m_center = center; } /** * Set the radius of the sphere. * The squared radius will automatically be updated inside this method. * @param radius The radius of the sphere. */ - MCORE_INLINE void SetRadius(float radius) { mRadius = radius; mRadiusSq = radius * radius; } + MCORE_INLINE void SetRadius(float radius) { m_radius = radius; m_radiusSq = radius * radius; } private: - AZ::Vector3 mCenter; /**< The center of the sphere. */ - float mRadius; /**< The radius of the sphere. */ - float mRadiusSq; /**< The squared radius of the sphere (mRadius*mRadius).*/ + AZ::Vector3 m_center; /**< The center of the sphere. */ + float m_radius; /**< The radius of the sphere. */ + float m_radiusSq; /**< The squared radius of the sphere (m_radius*m_radius).*/ }; } // namespace MCore diff --git a/Gems/EMotionFX/Code/MCore/Source/Color.cpp b/Gems/EMotionFX/Code/MCore/Source/Color.cpp index 77249bddfb..504142528c 100644 --- a/Gems/EMotionFX/Code/MCore/Source/Color.cpp +++ b/Gems/EMotionFX/Code/MCore/Source/Color.cpp @@ -13,7 +13,7 @@ namespace MCore { // the color table - uint32 RGBAColor::mColorTable[128] = + uint32 RGBAColor::s_colorTable[128] = { 0xFF000080, 0xFF00008B, diff --git a/Gems/EMotionFX/Code/MCore/Source/Color.h b/Gems/EMotionFX/Code/MCore/Source/Color.h index 8845d1f41b..ee8b88cc47 100644 --- a/Gems/EMotionFX/Code/MCore/Source/Color.h +++ b/Gems/EMotionFX/Code/MCore/Source/Color.h @@ -48,20 +48,20 @@ namespace MCore * Default constructor. Color will be set to black (0,0,0,0). */ MCORE_INLINE RGBAColor() - : r(0.0f) - , g(0.0f) - , b(0.0f) - , a(1.0f) {} + : m_r(0.0f) + , m_g(0.0f) + , m_b(0.0f) + , m_a(1.0f) {} /** * Constructor which sets all components to the same given value. * @param value The value to put in all components (r,g,b,a). */ MCORE_INLINE RGBAColor(float value) - : r(value) - , g(value) - , b(value) - , a(value) {} + : m_r(value) + , m_g(value) + , m_b(value) + , m_a(value) {} /** * Constructor which sets each color component. @@ -71,40 +71,40 @@ namespace MCore * @param cA The value for alpha [default=1.0] */ MCORE_INLINE RGBAColor(float cR, float cG, float cB, float cA = 1.0f) - : r(cR) - , g(cG) - , b(cB) - , a(cA) {} + : m_r(cR) + , m_g(cG) + , m_b(cB) + , m_a(cA) {} /** * Copy constructor. * @param col The color to copy the component values from. */ MCORE_INLINE RGBAColor(const RGBAColor& col) - : r(col.r) - , g(col.g) - , b(col.b) - , a(col.a) {} + : m_r(col.m_r) + , m_g(col.m_g) + , m_b(col.m_b) + , m_a(col.m_a) {} /** * Constructor to convert a 32-bits DWORD to a high precision color. * @param col The 32-bits DWORD, for example constructed using the MCore::RGBA(...) function. */ RGBAColor(uint32 col) - : r(ExtractRed(col) / 255.0f) - , g(ExtractGreen(col) / 255.0f) - , b(ExtractBlue(col) / 255.0f) - , a(ExtractAlpha(col) / 255.0f) {} + : m_r(ExtractRed(col) / 255.0f) + , m_g(ExtractGreen(col) / 255.0f) + , m_b(ExtractBlue(col) / 255.0f) + , m_a(ExtractAlpha(col) / 255.0f) {} /** * Constructor to convert from AZ::Color. This constructor is convenient until we replace the usage of this class with AZ::Color * @param color The AZ::Color to construct from */ RGBAColor(const AZ::Color& color) - : r(color.GetR()) - , g(color.GetG()) - , b(color.GetB()) - , a(color.GetA()) + : m_r(color.GetR()) + , m_g(color.GetG()) + , m_b(color.GetB()) + , m_a(color.GetA()) {} /** @@ -112,7 +112,7 @@ namespace MCore */ operator AZ::Color() const { - return AZ::Color(r, g, b, a); + return AZ::Color(m_r, m_g, m_b, m_a); } /** @@ -122,18 +122,18 @@ namespace MCore * @param cB The value for blue. * @param cA The value for alpha. */ - MCORE_INLINE void Set(float cR, float cG, float cB, float cA) { r = cR; g = cG; b = cB; a = cA; } + MCORE_INLINE void Set(float cR, float cG, float cB, float cA) { m_r = cR; m_g = cG; m_b = cB; m_a = cA; } /** * Set the color component values. * @param color The color to set. */ - MCORE_INLINE void Set(const RGBAColor& color) { r = color.r; g = color.g; b = color.b; a = color.a; } + MCORE_INLINE void Set(const RGBAColor& color) { m_r = color.m_r; m_g = color.m_g; m_b = color.m_b; m_a = color.m_a; } /** * Clear the color component values. Set them all to zero, so the color turns into black. */ - MCORE_INLINE void Zero() { r = g = b = a = 0.0f; } + MCORE_INLINE void Zero() { m_r = m_g = m_b = m_a = 0.0f; } /** * Clamp all color component values in a range of 0..1 @@ -141,20 +141,20 @@ namespace MCore * the Exposure method for exposure control or the Normalize method. * @result The clamped color. */ - MCORE_INLINE RGBAColor& Clamp() { r = MCore::Clamp(r, 0.0f, 1.0f); g = MCore::Clamp(g, 0.0f, 1.0f); b = MCore::Clamp(b, 0.0f, 1.0f); a = MCore::Clamp(a, 0.0f, 1.0f); return *this; } + MCORE_INLINE RGBAColor& Clamp() { m_r = MCore::Clamp(m_r, 0.0f, 1.0f); m_g = MCore::Clamp(m_g, 0.0f, 1.0f); m_b = MCore::Clamp(m_b, 0.0f, 1.0f); m_a = MCore::Clamp(m_a, 0.0f, 1.0f); return *this; } /** * Returns the length of the color components (r, g, b), just like you calculate the length of a vector. * The higher the length value, the more bright the color will be. * @result The length of the vector constructed by the r, g and b components. */ - MCORE_INLINE float CalcLength() const { return Math::Sqrt(r * r + g * g + b * b); } + MCORE_INLINE float CalcLength() const { return Math::Sqrt(m_r * m_r + m_g * m_g + m_b * m_b); } /** * Calculates and returns the intensity of the color. This gives an idea of how bright the color would be on the screen. * @result The intensity. */ - MCORE_INLINE float CalcIntensity() const { return r * 0.212671f + g * 0.715160f + b * 0.072169f; } + MCORE_INLINE float CalcIntensity() const { return m_r * 0.212671f + m_g * 0.715160f + m_b * 0.072169f; } /** * Checks if this color is close to another given color. @@ -164,25 +164,25 @@ namespace MCore */ MCORE_INLINE bool CheckIfIsClose(const RGBAColor& col, float distSq = 0.0001f) const { - float cR = (r - col.r); + float cR = (m_r - col.m_r); cR *= cR; if (cR > distSq) { return false; } - float cG = (g - col.g); + float cG = (m_g - col.m_g); cR += cG * cG; if (cR > distSq) { return false; } - float cB = (b - col.b); + float cB = (m_b - col.m_b); cR += cB * cB; if (cR > distSq) { return false; } - float cA = (a - col.a); + float cA = (m_a - col.m_a); cR += cA * cA; return (cR < distSq); } @@ -192,7 +192,7 @@ namespace MCore * In order to work correctly, the color component values must be in range of 0..1. So they have to be clamped, normalized or exposure controlled before calling this method. * @result The 32-bit integer value where each byte is a color component. */ - MCORE_INLINE uint32 ToInt() const { return MCore::RGBA((uint8)(r * 255), (uint8)(g * 255), (uint8)(b * 255), (uint8)(a * 255)); } + MCORE_INLINE uint32 ToInt() const { return MCore::RGBA((uint8)(m_r * 255), (uint8)(m_g * 255), (uint8)(m_b * 255), (uint8)(m_a * 255)); } /** * Perform exposure control on the color components. @@ -202,9 +202,9 @@ namespace MCore */ MCORE_INLINE RGBAColor& Exposure(float exposure = 1.5f) { - r = 1.0f - Math::Exp(-r * exposure); - g = 1.0f - Math::Exp(-g * exposure); - b = 1.0f - Math::Exp(-b * exposure); + m_r = 1.0f - Math::Exp(-m_r * exposure); + m_g = 1.0f - Math::Exp(-m_g * exposure); + m_b = 1.0f - Math::Exp(-m_b * exposure); return *this; } @@ -220,67 +220,67 @@ namespace MCore { float maxVal = 1.0f; - if (r > maxVal) + if (m_r > maxVal) { - maxVal = r; + maxVal = m_r; } - if (g > maxVal) + if (m_g > maxVal) { - maxVal = g; + maxVal = m_g; } - if (b > maxVal) + if (m_b > maxVal) { - maxVal = b; + maxVal = m_b; } float mul = 1.0f / maxVal; - r *= mul; - g *= mul; - b *= mul; + m_r *= mul; + m_g *= mul; + m_b *= mul; return *this; } // operators - MCORE_INLINE bool operator==(const RGBAColor& col) const { return ((r == col.r) && (g == col.g) && (b == col.b) && (a == col.a)); } - MCORE_INLINE const RGBAColor& operator*=(const RGBAColor& col) { r *= col.r; g *= col.g; b *= col.b; a *= col.a; return *this; } - MCORE_INLINE const RGBAColor& operator+=(const RGBAColor& col) { r += col.r; g += col.g; b += col.b; a += col.a; return *this; } - MCORE_INLINE const RGBAColor& operator-=(const RGBAColor& col) { r -= col.r; g -= col.g; b -= col.b; a -= col.a; return *this; } - MCORE_INLINE const RGBAColor& operator*=(float m) { r *= m; g *= m; b *= m; a *= m; return *this; } + MCORE_INLINE bool operator==(const RGBAColor& col) const { return ((m_r == col.m_r) && (m_g == col.m_g) && (m_b == col.m_b) && (m_a == col.m_a)); } + MCORE_INLINE const RGBAColor& operator*=(const RGBAColor& col) { m_r *= col.m_r; m_g *= col.m_g; m_b *= col.m_b; m_a *= col.m_a; return *this; } + MCORE_INLINE const RGBAColor& operator+=(const RGBAColor& col) { m_r += col.m_r; m_g += col.m_g; m_b += col.m_b; m_a += col.m_a; return *this; } + MCORE_INLINE const RGBAColor& operator-=(const RGBAColor& col) { m_r -= col.m_r; m_g -= col.m_g; m_b -= col.m_b; m_a -= col.m_a; return *this; } + MCORE_INLINE const RGBAColor& operator*=(float m) { m_r *= m; m_g *= m; m_b *= m; m_a *= m; return *this; } //MCORE_INLINE const RGBAColor& operator*=(double m) { r*=m; g*=m; b*=m; a*=m; return *this; } - MCORE_INLINE const RGBAColor& operator/=(float d) { float ooD = 1.0f / d; r *= ooD; g *= ooD; b *= ooD; a *= ooD; return *this; } + MCORE_INLINE const RGBAColor& operator/=(float d) { float ooD = 1.0f / d; m_r *= ooD; m_g *= ooD; m_b *= ooD; m_a *= ooD; return *this; } //MCORE_INLINE const RGBAColor& operator/=(double d) { float ooD=1.0f/d; r*=ooD; g*=ooD; b*=ooD; a*=ooD; return *this; } - MCORE_INLINE const RGBAColor& operator= (const RGBAColor& col) { r = col.r; g = col.g; b = col.b; a = col.a; return *this; } - MCORE_INLINE const RGBAColor& operator= (float colorValue) { r = colorValue; g = colorValue; b = colorValue; a = colorValue; return *this; } + MCORE_INLINE const RGBAColor& operator= (const RGBAColor& col) { m_r = col.m_r; m_g = col.m_g; m_b = col.m_b; m_a = col.m_a; return *this; } + MCORE_INLINE const RGBAColor& operator= (float colorValue) { m_r = colorValue; m_g = colorValue; m_b = colorValue; m_a = colorValue; return *this; } - MCORE_INLINE float& operator[](int32 row) { return ((float*)&r)[row]; } - MCORE_INLINE operator float*() { return (float*)&r; } - MCORE_INLINE operator const float*() const { return (const float*)&r; } + MCORE_INLINE float& operator[](int32 row) { return ((float*)&m_r)[row]; } + MCORE_INLINE operator float*() { return (float*)&m_r; } + MCORE_INLINE operator const float*() const { return (const float*)&m_r; } - static uint32 mColorTable[128]; + static uint32 s_colorTable[128]; // attributes - float r; /**< Red component. */ - float g; /**< Green component. */ - float b; /**< Blue component. */ - float a; /**< Alpha component. */ + float m_r; /**< Red component. */ + float m_g; /**< Green component. */ + float m_b; /**< Blue component. */ + float m_a; /**< Alpha component. */ }; /** * Picks a random color from a table of 128 different colors. * @result The generated color. */ - MCORE_INLINE uint32 GenerateColor() { return RGBAColor::mColorTable[rand() % 128]; } + MCORE_INLINE uint32 GenerateColor() { return RGBAColor::s_colorTable[rand() % 128]; } // operators - MCORE_INLINE RGBAColor operator*(const RGBAColor& colA, const RGBAColor& colB) { return RGBAColor(colA.r * colB.r, colA.g * colB.g, colA.b * colB.b, colA.a * colB.a); } - MCORE_INLINE RGBAColor operator+(const RGBAColor& colA, const RGBAColor& colB) { return RGBAColor(colA.r + colB.r, colA.g + colB.g, colA.b + colB.b, colA.a + colB.a); } - MCORE_INLINE RGBAColor operator-(const RGBAColor& colA, const RGBAColor& colB) { return RGBAColor(colA.r - colB.r, colA.g - colB.g, colA.b - colB.b, colA.b - colB.b); } - MCORE_INLINE RGBAColor operator*(const RGBAColor& colA, float m) { return RGBAColor(colA.r * m, colA.g * m, colA.b * m, colA.a * m); } + MCORE_INLINE RGBAColor operator*(const RGBAColor& colA, const RGBAColor& colB) { return RGBAColor(colA.m_r * colB.m_r, colA.m_g * colB.m_g, colA.m_b * colB.m_b, colA.m_a * colB.m_a); } + MCORE_INLINE RGBAColor operator+(const RGBAColor& colA, const RGBAColor& colB) { return RGBAColor(colA.m_r + colB.m_r, colA.m_g + colB.m_g, colA.m_b + colB.m_b, colA.m_a + colB.m_a); } + MCORE_INLINE RGBAColor operator-(const RGBAColor& colA, const RGBAColor& colB) { return RGBAColor(colA.m_r - colB.m_r, colA.m_g - colB.m_g, colA.m_b - colB.m_b, colA.m_b - colB.m_b); } + MCORE_INLINE RGBAColor operator*(const RGBAColor& colA, float m) { return RGBAColor(colA.m_r * m, colA.m_g * m, colA.m_b * m, colA.m_a * m); } //MCORE_INLINE RGBAColor operator*(const RGBAColor& colA, double m) { return RGBAColor(colA.r*m, colA.g*m, colA.b*m, colA.a*m); } - MCORE_INLINE RGBAColor operator*(float m, const RGBAColor& colB) { return RGBAColor(m * colB.r, m * colB.g, m * colB.b, m * colB.a); } + MCORE_INLINE RGBAColor operator*(float m, const RGBAColor& colB) { return RGBAColor(m * colB.m_r, m * colB.m_g, m * colB.m_b, m * colB.m_a); } //MCORE_INLINE RGBAColor operator*(double m, const RGBAColor& colB) { return RGBAColor(m*colB.r, m*colB.g, m*colB.b, m*colB.a); } - MCORE_INLINE RGBAColor operator/(const RGBAColor& colA, float d) { float ooD = 1.0f / d; return RGBAColor(colA.r * ooD, colA.g * ooD, colA.b * ooD, colA.a * ooD); } + MCORE_INLINE RGBAColor operator/(const RGBAColor& colA, float d) { float ooD = 1.0f / d; return RGBAColor(colA.m_r * ooD, colA.m_g * ooD, colA.m_b * ooD, colA.m_a * ooD); } //MCORE_INLINE RGBAColor operator/(const RGBAColor& colA, double d) { float ooD=1.0f/d; return RGBAColor(colA.r*ooD, colA.g*ooD, colA.b*ooD, colA.a*ooD); } } // namespace MCore diff --git a/Gems/EMotionFX/Code/MCore/Source/Command.cpp b/Gems/EMotionFX/Code/MCore/Source/Command.cpp index 8845e7c278..d53477b1e1 100644 --- a/Gems/EMotionFX/Code/MCore/Source/Command.cpp +++ b/Gems/EMotionFX/Code/MCore/Source/Command.cpp @@ -17,8 +17,8 @@ namespace MCore // constructor Command::Callback::Callback(bool executePreUndo, bool executePreCommand) { - mPreUndoExecute = executePreUndo; - mPreCommandExecute = executePreCommand; + m_preUndoExecute = executePreUndo; + m_preCommandExecute = executePreCommand; } @@ -30,8 +30,8 @@ namespace MCore // constructor Command::Command(AZStd::string commandName, Command* originalCommand) - : mOrgCommand(originalCommand) - , mCommandName(AZStd::move(commandName)) + : m_orgCommand(originalCommand) + , m_commandName(AZStd::move(commandName)) { } @@ -59,13 +59,13 @@ namespace MCore const char* Command::GetName() const { - return mCommandName.c_str(); + return m_commandName.c_str(); } const AZStd::string& Command::GetNameString() const { - return mCommandName; + return m_commandName; } @@ -84,25 +84,25 @@ namespace MCore size_t Command::GetNumCallbacks() const { - return mCallbacks.size(); + return m_callbacks.size(); } void Command::AddCallback(Command::Callback* callback) { - mCallbacks.push_back(callback); + m_callbacks.push_back(callback); } bool Command::CheckIfHasCallback(Command::Callback* callback) const { - return (AZStd::find(mCallbacks.begin(), mCallbacks.end(), callback) != mCallbacks.end()); + return (AZStd::find(m_callbacks.begin(), m_callbacks.end(), callback) != m_callbacks.end()); } void Command::RemoveCallback(Command::Callback* callback, bool delFromMem) { - mCallbacks.erase(AZStd::remove(mCallbacks.begin(), mCallbacks.end(), callback), mCallbacks.end()); + m_callbacks.erase(AZStd::remove(m_callbacks.begin(), m_callbacks.end(), callback), m_callbacks.end()); if (delFromMem) { delete callback; @@ -112,21 +112,21 @@ namespace MCore void Command::RemoveAllCallbacks() { - const size_t numCallbacks = mCallbacks.size(); + const size_t numCallbacks = m_callbacks.size(); for (size_t i = 0; i < numCallbacks; ++i) { // If it crashes here, you probably created your callback in another dll and didn't remove it from memory there as well. - delete mCallbacks[i]; + delete m_callbacks[i]; } - mCallbacks.clear(); + m_callbacks.clear(); } // calculate the number of registered pre-execute callbacks size_t Command::CalcNumPreCommandCallbacks() const { - return AZStd::accumulate(begin(mCallbacks), end(mCallbacks), size_t{0}, [](size_t total, const Callback* callback) + return AZStd::accumulate(begin(m_callbacks), end(m_callbacks), size_t{0}, [](size_t total, const Callback* callback) { return callback->GetExecutePreCommand() ? total + 1 : total; }); @@ -136,6 +136,6 @@ namespace MCore // calculate the number of registered post-execute callbacks size_t Command::CalcNumPostCommandCallbacks() const { - return mCallbacks.size() - CalcNumPreCommandCallbacks(); + return m_callbacks.size() - CalcNumPreCommandCallbacks(); } } // namespace MCore diff --git a/Gems/EMotionFX/Code/MCore/Source/Command.h b/Gems/EMotionFX/Code/MCore/Source/Command.h index d6bfb3a0d7..615156223d 100644 --- a/Gems/EMotionFX/Code/MCore/Source/Command.h +++ b/Gems/EMotionFX/Code/MCore/Source/Command.h @@ -68,9 +68,9 @@ namespace MCore const char* GetHistoryName() const { return HISTORYNAME; } \ const char* GetDescription() const; \ MCore::Command* Create() { return new CLASSNAME(this); } \ - OLDVALUETYPE& GetData() { return mData; } \ + OLDVALUETYPE& GetData() { return m_data; } \ protected: \ - OLDVALUETYPE mData; \ + OLDVALUETYPE m_data; \ #define MCORE_DEFINECOMMAND_1_END }; @@ -167,17 +167,17 @@ namespace MCore * Get the flag which controls if the callback gets executed before the command or after it. * @return True in case the callback gets called before the command, false when it gets called afterwards. */ - MCORE_INLINE bool GetExecutePreCommand() const { return mPreCommandExecute; } + MCORE_INLINE bool GetExecutePreCommand() const { return m_preCommandExecute; } /** * Get the flag which controls if the callback gets executed before undo or after it. * @return True in case the callback gets called before undo, false when it gets called afterwards. */ - MCORE_INLINE bool GetExecutePreUndo() const { return mPreUndoExecute; } + MCORE_INLINE bool GetExecutePreUndo() const { return m_preUndoExecute; } private: - bool mPreCommandExecute; /**< Flag which controls if the callback gets executed before the command (true) or after it (false). */ - bool mPreUndoExecute; /**< Flag which controls if the callback gets executed before the undo (true) or after it (false). */ + bool m_preCommandExecute; /**< Flag which controls if the callback gets executed before the command (true) or after it (false). */ + bool m_preUndoExecute; /**< Flag which controls if the callback gets executed before the undo (true) or after it (false). */ }; /** @@ -273,7 +273,7 @@ namespace MCore * Also it can verify and show info about these parameters. * @result The syntax object. */ - MCORE_INLINE CommandSyntax& GetSyntax() { return mSyntax; } + MCORE_INLINE CommandSyntax& GetSyntax() { return m_syntax; } /** * Get the number of registered/added command callbacks. @@ -298,7 +298,7 @@ namespace MCore * @param index The callback number, which must be in range of [0..GetNumCallbacks()-1]. * @result A pointer to the command callback object. */ - MCORE_INLINE Command::Callback* GetCallback(size_t index) { return mCallbacks[index]; } + MCORE_INLINE Command::Callback* GetCallback(size_t index) { return m_callbacks[index]; } /** * Add (register) a command callback. @@ -325,7 +325,7 @@ namespace MCore */ void RemoveAllCallbacks(); - void SetOriginalCommand(Command* orgCommand) { mOrgCommand = orgCommand; } + void SetOriginalCommand(Command* orgCommand) { m_orgCommand = orgCommand; } /** * Get the original command where this command has been cloned from. @@ -335,9 +335,9 @@ namespace MCore */ MCORE_INLINE Command* GetOriginalCommand() { - if (mOrgCommand) + if (m_orgCommand) { - return mOrgCommand; + return m_orgCommand; } else { @@ -359,9 +359,9 @@ namespace MCore } private: - Command* mOrgCommand; /**< The original command, or nullptr when this is the original. */ - AZStd::string mCommandName; /**< The unique command name used to identify the command. */ - CommandSyntax mSyntax; /**< The command syntax, which contains info about the possible parameters etc. */ - AZStd::vector mCallbacks; /**< The command callbacks. */ + Command* m_orgCommand; /**< The original command, or nullptr when this is the original. */ + AZStd::string m_commandName; /**< The unique command name used to identify the command. */ + CommandSyntax m_syntax; /**< The command syntax, which contains info about the possible parameters etc. */ + AZStd::vector m_callbacks; /**< The command callbacks. */ }; } // namespace MCore diff --git a/Gems/EMotionFX/Code/MCore/Source/CommandGroup.cpp b/Gems/EMotionFX/Code/MCore/Source/CommandGroup.cpp index e69b91278d..e12b2b5ed8 100644 --- a/Gems/EMotionFX/Code/MCore/Source/CommandGroup.cpp +++ b/Gems/EMotionFX/Code/MCore/Source/CommandGroup.cpp @@ -35,144 +35,144 @@ namespace MCore { if (numToReserve > 0) { - mCommands.reserve(numToReserve); + m_commands.reserve(numToReserve); } } void CommandGroup::AddCommandString(const char* commandString) { - mCommands.emplace_back(CommandEntry()); - mCommands.back().mCommandString = commandString; + m_commands.emplace_back(CommandEntry()); + m_commands.back().m_commandString = commandString; } void CommandGroup::AddCommandString(const AZStd::string& commandString) { - mCommands.emplace_back(CommandEntry()); - mCommands.back().mCommandString = commandString; + m_commands.emplace_back(CommandEntry()); + m_commands.back().m_commandString = commandString; } void CommandGroup::AddCommand(MCore::Command* command) { - mCommands.emplace_back(CommandEntry()); - mCommands.back().mCommand = command; + m_commands.emplace_back(CommandEntry()); + m_commands.back().m_command = command; } const char* CommandGroup::GetCommandString(size_t index) const { - return mCommands[index].mCommandString.c_str(); + return m_commands[index].m_commandString.c_str(); } const AZStd::string& CommandGroup::GetCommandStringAsString(size_t index) const { - return mCommands[index].mCommandString; + return m_commands[index].m_commandString; } Command* CommandGroup::GetCommand(size_t index) { - return mCommands[index].mCommand; + return m_commands[index].m_command; } const CommandLine& CommandGroup::GetParameters(size_t index) const { - return mCommands[index].mCommandLine; + return m_commands[index].m_commandLine; } const char* CommandGroup::GetGroupName() const { - return mGroupName.c_str(); + return m_groupName.c_str(); } const AZStd::string& CommandGroup::GetGroupNameString() const { - return mGroupName; + return m_groupName; } void CommandGroup::SetGroupName(const char* groupName) { - mGroupName = groupName; + m_groupName = groupName; } void CommandGroup::SetGroupName(const AZStd::string& groupName) { - mGroupName = groupName; + m_groupName = groupName; } void CommandGroup::SetCommandString(size_t index, const char* commandString) { - mCommands[index].mCommandString = commandString; + m_commands[index].m_commandString = commandString; } void CommandGroup::SetParameters(size_t index, const CommandLine& params) { - mCommands[index].mCommandLine = params; + m_commands[index].m_commandLine = params; } void CommandGroup::SetCommand(size_t index, Command* command) { - mCommands[index].mCommand = command; + m_commands[index].m_command = command; } size_t CommandGroup::GetNumCommands() const { - return mCommands.size(); + return m_commands.size(); } void CommandGroup::RemoveAllCommands(bool delFromMem) { if (delFromMem) { - for (CommandEntry& commandEntry : mCommands) + for (CommandEntry& commandEntry : m_commands) { - delete commandEntry.mCommand; + delete commandEntry.m_command; } } - mCommands.clear(); + m_commands.clear(); } CommandGroup* CommandGroup::Clone() const { - CommandGroup* newGroup = new CommandGroup(mGroupName, 0); - newGroup->mCommands = mCommands; - newGroup->mHistoryAfterError = mHistoryAfterError; - newGroup->mContinueAfterError = mContinueAfterError; - newGroup->mReturnFalseAfterError = mReturnFalseAfterError; + CommandGroup* newGroup = new CommandGroup(m_groupName, 0); + newGroup->m_commands = m_commands; + newGroup->m_historyAfterError = m_historyAfterError; + newGroup->m_continueAfterError = m_continueAfterError; + newGroup->m_returnFalseAfterError = m_returnFalseAfterError; return newGroup; } // continue execution of the remaining commands after one fails to execute? void CommandGroup::SetContinueAfterError(bool continueAfter) { - mContinueAfterError = continueAfter; + m_continueAfterError = continueAfter; } // add group to the history even when one internal command failed to execute? void CommandGroup::SetAddToHistoryAfterError(bool addAfterError) { - mHistoryAfterError = addAfterError; + m_historyAfterError = addAfterError; } // check to see if we continue executing internal commands even if one failed bool CommandGroup::GetContinueAfterError() const { - return mContinueAfterError; + return m_continueAfterError; } // check if we add this group to the history, even if one internal command failed bool CommandGroup::GetAddToHistoryAfterError() const { - return mHistoryAfterError; + return m_historyAfterError; } // set if the command group shall return false after an error occurred or not void CommandGroup::SetReturnFalseAfterError(bool returnAfterError) { - mReturnFalseAfterError = returnAfterError; + m_returnFalseAfterError = returnAfterError; } // returns true in case the group returns false when executing it bool CommandGroup::GetReturnFalseAfterError() const { - return mReturnFalseAfterError; + return m_returnFalseAfterError; } } // namespace MCore diff --git a/Gems/EMotionFX/Code/MCore/Source/CommandGroup.h b/Gems/EMotionFX/Code/MCore/Source/CommandGroup.h index 5a4ef0a201..0d7b8683b1 100644 --- a/Gems/EMotionFX/Code/MCore/Source/CommandGroup.h +++ b/Gems/EMotionFX/Code/MCore/Source/CommandGroup.h @@ -219,15 +219,15 @@ namespace MCore */ struct MCORE_API CommandEntry { - MCore::Command* mCommand = nullptr; /**< The command object, which gets set when you execute the group inside the command manager. */ - MCore::CommandLine mCommandLine{}; /**< The command line that was used when executing this command. */ - AZStd::string mCommandString{}; /**< The command string that we will execute. */ + MCore::Command* m_command = nullptr; /**< The command object, which gets set when you execute the group inside the command manager. */ + MCore::CommandLine m_commandLine{}; /**< The command line that was used when executing this command. */ + AZStd::string m_commandString{}; /**< The command string that we will execute. */ }; - AZStd::vector mCommands; /**< The set of commands inside the group. */ - AZStd::string mGroupName; /**< The name of the group as it will appear inside the command history. */ - bool mContinueAfterError; /**< */ - bool mHistoryAfterError; /**< */ - bool mReturnFalseAfterError; + AZStd::vector m_commands; /**< The set of commands inside the group. */ + AZStd::string m_groupName; /**< The name of the group as it will appear inside the command history. */ + bool m_continueAfterError; /**< */ + bool m_historyAfterError; /**< */ + bool m_returnFalseAfterError; }; } // namespace MCore diff --git a/Gems/EMotionFX/Code/MCore/Source/CommandLine.cpp b/Gems/EMotionFX/Code/MCore/Source/CommandLine.cpp index ae536101e6..a55d066cdc 100644 --- a/Gems/EMotionFX/Code/MCore/Source/CommandLine.cpp +++ b/Gems/EMotionFX/Code/MCore/Source/CommandLine.cpp @@ -34,14 +34,14 @@ namespace MCore } // return the default value if the parameter value is empty - if (m_parameters[paramIndex].mValue.empty()) + if (m_parameters[paramIndex].m_value.empty()) { *outResult = defaultValue; return; } // return the parameter value - *outResult = m_parameters[paramIndex].mValue; + *outResult = m_parameters[paramIndex].m_value; } @@ -57,14 +57,14 @@ namespace MCore } // Return the default value if the parameter value is empty. - if (m_parameters[paramIndex].mValue.empty()) + if (m_parameters[paramIndex].m_value.empty()) { outResult = defaultValue; return; } // Return the actual parameter value. - outResult = m_parameters[paramIndex].mValue.c_str(); + outResult = m_parameters[paramIndex].m_value.c_str(); } @@ -79,13 +79,13 @@ namespace MCore } // return the default value if the parameter value is empty - if (m_parameters[paramIndex].mValue.empty()) + if (m_parameters[paramIndex].m_value.empty()) { return defaultValue; } // return the parameter value - return AzFramework::StringFunc::ToInt(m_parameters[paramIndex].mValue.c_str()); + return AzFramework::StringFunc::ToInt(m_parameters[paramIndex].m_value.c_str()); } @@ -100,13 +100,13 @@ namespace MCore } // return the default value if the parameter value is empty - if (m_parameters[paramIndex].mValue.empty()) + if (m_parameters[paramIndex].m_value.empty()) { return defaultValue; } // return the parameter value - return AzFramework::StringFunc::ToFloat(m_parameters[paramIndex].mValue.c_str()); + return AzFramework::StringFunc::ToFloat(m_parameters[paramIndex].m_value.c_str()); } @@ -121,13 +121,13 @@ namespace MCore } // return the default value if the parameter value is empty - if (m_parameters[paramIndex].mValue.empty()) + if (m_parameters[paramIndex].m_value.empty()) { return true; } // return the parameter value - return AzFramework::StringFunc::ToBool(m_parameters[paramIndex].mValue.c_str()); + return AzFramework::StringFunc::ToBool(m_parameters[paramIndex].m_value.c_str()); } @@ -142,14 +142,14 @@ namespace MCore } // return the default value if the parameter value is empty - if (m_parameters[paramIndex].mValue.empty()) + if (m_parameters[paramIndex].m_value.empty()) { return defaultValue; } // return the parameter value - return AzFramework::StringFunc::ToVector3(m_parameters[paramIndex].mValue.c_str()); + return AzFramework::StringFunc::ToVector3(m_parameters[paramIndex].m_value.c_str()); } @@ -164,13 +164,13 @@ namespace MCore } // return the default value if the parameter value is empty - if (m_parameters[paramIndex].mValue.empty()) + if (m_parameters[paramIndex].m_value.empty()) { return defaultValue; } // return the parameter value - return AzFramework::StringFunc::ToVector4(m_parameters[paramIndex].mValue.c_str()); + return AzFramework::StringFunc::ToVector4(m_parameters[paramIndex].m_value.c_str()); } @@ -186,7 +186,7 @@ namespace MCore } // return the parameter value - *outResult = m_parameters[paramIndex].mValue; + *outResult = m_parameters[paramIndex].m_value; } @@ -201,7 +201,7 @@ namespace MCore const size_t paramIndex = FindParameterIndex(paramName); if (paramIndex != InvalidIndex) { - return AZ::Success(m_parameters[paramIndex].mValue); + return AZ::Success(m_parameters[paramIndex].m_value); } return AZ::Failure(); @@ -218,7 +218,7 @@ namespace MCore } // return the parameter value - return m_parameters[paramIndex].mValue; + return m_parameters[paramIndex].m_value; } @@ -241,7 +241,7 @@ namespace MCore } // return the parameter value - return AzFramework::StringFunc::ToInt(m_parameters[paramIndex].mValue.c_str()); + return AzFramework::StringFunc::ToInt(m_parameters[paramIndex].m_value.c_str()); } // get the value as float @@ -263,7 +263,7 @@ namespace MCore } // return the parameter value - return AzFramework::StringFunc::ToFloat(m_parameters[paramIndex].mValue.c_str()); + return AzFramework::StringFunc::ToFloat(m_parameters[paramIndex].m_value.c_str()); } @@ -286,7 +286,7 @@ namespace MCore } // return the parameter value - return AzFramework::StringFunc::ToBool(m_parameters[paramIndex].mValue.c_str()); + return AzFramework::StringFunc::ToBool(m_parameters[paramIndex].m_value.c_str()); } @@ -309,7 +309,7 @@ namespace MCore } // return the parameter value - return AzFramework::StringFunc::ToVector3(m_parameters[paramIndex].mValue.c_str()); + return AzFramework::StringFunc::ToVector3(m_parameters[paramIndex].m_value.c_str()); } @@ -332,7 +332,7 @@ namespace MCore } // return the parameter value - return AzFramework::StringFunc::ToVector4(m_parameters[paramIndex].mValue.c_str()); + return AzFramework::StringFunc::ToVector4(m_parameters[paramIndex].m_value.c_str()); } @@ -346,14 +346,14 @@ namespace MCore // get the parameter name for a given parameter const AZStd::string& CommandLine::GetParameterName(size_t nr) const { - return m_parameters[nr].mName; + return m_parameters[nr].m_name; } // get the parameter value for a given parameter number const AZStd::string& CommandLine::GetParameterValue(size_t nr) const { - return m_parameters[nr].mValue; + return m_parameters[nr].m_value; } @@ -368,7 +368,7 @@ namespace MCore } // return true the parameter has a value that is not empty - return (m_parameters[paramIndex].mValue.empty() == false); + return (m_parameters[paramIndex].m_value.empty() == false); } @@ -378,7 +378,7 @@ namespace MCore // compare all parameter names on a non-case sensitive way const auto foundParameter = AZStd::find_if(begin(m_parameters), end(m_parameters), [paramName](const Parameter& parameter) { - return AzFramework::StringFunc::Equal(parameter.mName, paramName, false /* no case */); + return AzFramework::StringFunc::Equal(parameter.m_name, paramName, false /* no case */); }); return foundParameter != end(m_parameters) ? AZStd::distance(begin(m_parameters), foundParameter) : InvalidIndex; @@ -542,7 +542,7 @@ namespace MCore LogInfo("Command line '%s' has %d parameters", debugName, numParameters); for (size_t i = 0; i < numParameters; ++i) { - LogInfo("Param %d (name='%s' value='%s'", i, m_parameters[i].mName.c_str(), m_parameters[i].mValue.c_str()); + LogInfo("Param %d (name='%s' value='%s'", i, m_parameters[i].m_name.c_str(), m_parameters[i].m_value.c_str()); } } } // namespace MCore diff --git a/Gems/EMotionFX/Code/MCore/Source/CommandLine.h b/Gems/EMotionFX/Code/MCore/Source/CommandLine.h index 8a4e5172e8..07b22ce9e5 100644 --- a/Gems/EMotionFX/Code/MCore/Source/CommandLine.h +++ b/Gems/EMotionFX/Code/MCore/Source/CommandLine.h @@ -271,8 +271,8 @@ namespace MCore */ struct MCORE_API Parameter { - AZStd::string mName; /**< The parameter name, for example "XRES". */ - AZStd::string mValue; /**< The parameter value, for example "1024". */ + AZStd::string m_name; /**< The parameter name, for example "XRES". */ + AZStd::string m_value; /**< The parameter value, for example "1024". */ }; AZStd::vector m_parameters; /**< The parameters that have been detected in the command line string. */ diff --git a/Gems/EMotionFX/Code/MCore/Source/CommandSyntax.cpp b/Gems/EMotionFX/Code/MCore/Source/CommandSyntax.cpp index fb10da4eb4..0bc228898c 100644 --- a/Gems/EMotionFX/Code/MCore/Source/CommandSyntax.cpp +++ b/Gems/EMotionFX/Code/MCore/Source/CommandSyntax.cpp @@ -68,21 +68,21 @@ namespace MCore // check if this param is a required one or not bool CommandSyntax::GetParamRequired(size_t index) const { - return m_parameters[index].mRequired; + return m_parameters[index].m_required; } // get the parameter name const char* CommandSyntax::GetParamName(size_t index) const { - return m_parameters[index].mName.c_str(); + return m_parameters[index].m_name.c_str(); } // get the parameter description const char* CommandSyntax::GetParamDescription(size_t index) const { - return m_parameters[index].mDescription.c_str(); + return m_parameters[index].m_description.c_str(); } @@ -95,7 +95,7 @@ namespace MCore const char* CommandSyntax::GetParamTypeString(const Parameter& parameter) const { // check the type - switch (parameter.mParamType) + switch (parameter.m_paramType) { case PARAMTYPE_STRING: return "String"; @@ -129,7 +129,7 @@ namespace MCore // get the parameter type CommandSyntax::EParamType CommandSyntax::GetParamType(size_t index) const { - return m_parameters[index].mParamType; + return m_parameters[index].m_paramType; } @@ -145,7 +145,7 @@ namespace MCore { const auto foundParameter = AZStd::find_if(begin(m_parameters), end(m_parameters), [parameter](const Parameter& p) { - return AzFramework::StringFunc::Equal(p.mName, parameter, false /* no case */); + return AzFramework::StringFunc::Equal(p.m_name, parameter, false /* no case */); }); return foundParameter != end(m_parameters) ? AZStd::distance(begin(m_parameters), foundParameter) : InvalidIndex; } @@ -154,7 +154,7 @@ namespace MCore // get the default value for a given parameter const AZStd::string& CommandSyntax::GetDefaultValue(size_t index) const { - return m_parameters[index].mDefaultValue; + return m_parameters[index].m_defaultValue; } @@ -163,7 +163,7 @@ namespace MCore const size_t index = FindParameterIndex(paramName); if (index != InvalidIndex) { - return m_parameters[index].mDefaultValue; + return m_parameters[index].m_defaultValue; } static const AZStd::string empty; @@ -180,7 +180,7 @@ namespace MCore return false; } - outDefaultValue = m_parameters[index].mDefaultValue; + outDefaultValue = m_parameters[index].m_defaultValue; return true; } @@ -203,28 +203,28 @@ namespace MCore for (const Parameter& parameter : m_parameters) { // if the required parameter hasn't been specified - if (parameter.mRequired && commandLine.CheckIfHasParameter(parameter.mName) == false) + if (parameter.m_required && commandLine.CheckIfHasParameter(parameter.m_name) == false) { - outResult += AZStd::string::format("Required parameter '%s' has not been specified.\n", parameter.mName.c_str()); + outResult += AZStd::string::format("Required parameter '%s' has not been specified.\n", parameter.m_name.c_str()); } else { // find the parameter index - const size_t paramIndex = commandLine.FindParameterIndex(parameter.mName.c_str()); + const size_t paramIndex = commandLine.FindParameterIndex(parameter.m_name.c_str()); if (paramIndex != InvalidIndex) { const AZStd::string& value = commandLine.GetParameterValue(paramIndex); - const AZStd::string& paramName = parameter.mName; + const AZStd::string& paramName = parameter.m_name; // if the parameter value has not been specified and it is not a boolean parameter - if ((value.empty()) && parameter.mParamType != PARAMTYPE_BOOLEAN && parameter.mParamType != PARAMTYPE_STRING) + if ((value.empty()) && parameter.m_paramType != PARAMTYPE_BOOLEAN && parameter.m_paramType != PARAMTYPE_STRING) { outResult += AZStd::string::format("Parameter '%s' has no value specified.\n", paramName.c_str()); } else { // check if we specified a valid int - if (parameter.mParamType == PARAMTYPE_INT) + if (parameter.m_paramType == PARAMTYPE_INT) { if (!AzFramework::StringFunc::LooksLikeInt(value.c_str())) { @@ -233,7 +233,7 @@ namespace MCore } // check if the specified float is valid - if (parameter.mParamType == PARAMTYPE_FLOAT) + if (parameter.m_paramType == PARAMTYPE_FLOAT) { if (!AzFramework::StringFunc::LooksLikeFloat(value.c_str())) { @@ -242,7 +242,7 @@ namespace MCore } // check if this is a valid boolean - if (parameter.mParamType == PARAMTYPE_BOOLEAN) + if (parameter.m_paramType == PARAMTYPE_BOOLEAN) { if (!value.empty() && !AzFramework::StringFunc::LooksLikeBool(value.c_str())) { @@ -251,7 +251,7 @@ namespace MCore } // check if this is a valid boolean - if (parameter.mParamType == PARAMTYPE_CHAR) + if (parameter.m_paramType == PARAMTYPE_CHAR) { if (value.size() > 1) { @@ -260,7 +260,7 @@ namespace MCore } // check if the specified vector3 is valid - if (parameter.mParamType == PARAMTYPE_VECTOR3) + if (parameter.m_paramType == PARAMTYPE_VECTOR3) { if (!AzFramework::StringFunc::LooksLikeVector3(value.c_str())) { @@ -269,7 +269,7 @@ namespace MCore } // check if the specified vector3 is valid - if (parameter.mParamType == PARAMTYPE_VECTOR4) + if (parameter.m_paramType == PARAMTYPE_VECTOR4) { if (!AzFramework::StringFunc::LooksLikeVector4(value.c_str())) { @@ -302,8 +302,8 @@ namespace MCore // find the longest command name size_t offset = AZStd::minmax_element(begin(m_parameters), end(m_parameters), [](const Parameter& left, const Parameter& right) { - return left.mName.size() < right.mName.size(); - }).second->mName.size(); + return left.m_name.size() < right.m_name.size(); + }).second->m_name.size(); size_t offset2 = offset; size_t offset3 = offset; @@ -330,19 +330,19 @@ namespace MCore for (const Parameter& parameter : m_parameters) { offset2 = offset3; - final = parameter.mName; + final = parameter.m_name; offset2 += 5; final.append(offset2 - final.size(), MCore::CharacterConstants::space); final += GetParamTypeString(parameter); offset2 += 15; final.append(offset2 - final.size(), MCore::CharacterConstants::space); - final += parameter.mRequired ? "Yes" : "No"; + final += parameter.m_required ? "Yes" : "No"; offset2 += 10; final.append(offset2 - final.size(), MCore::CharacterConstants::space); - final += parameter.mDefaultValue; + final += parameter.m_defaultValue; offset2 += 20; final.append(offset2 - final.size(), MCore::CharacterConstants::space); - final += parameter.mDescription; + final += parameter.m_description; MCore::LogInfo(final.c_str()); } diff --git a/Gems/EMotionFX/Code/MCore/Source/CommandSyntax.h b/Gems/EMotionFX/Code/MCore/Source/CommandSyntax.h index 730dd9047a..ded4c1ee02 100644 --- a/Gems/EMotionFX/Code/MCore/Source/CommandSyntax.h +++ b/Gems/EMotionFX/Code/MCore/Source/CommandSyntax.h @@ -47,15 +47,15 @@ namespace MCore struct MCORE_API Parameter { Parameter(AZStd::string name, AZStd::string description, AZStd::string defaultValue, EParamType paramType, bool required) - : mName(AZStd::move(name)), mDescription(AZStd::move(description)), mDefaultValue(AZStd::move(defaultValue)), mParamType(paramType), mRequired(required) + : m_name(AZStd::move(name)), m_description(AZStd::move(description)), m_defaultValue(AZStd::move(defaultValue)), m_paramType(paramType), m_required(required) { } - AZStd::string mName; /**< The name of the parameter. */ - AZStd::string mDescription; /**< The description of the parameter. */ - AZStd::string mDefaultValue; /**< The default value. */ - EParamType mParamType; /**< The parameter type. */ - bool mRequired; /**< Is this parameter required or optional? */ + AZStd::string m_name; /**< The name of the parameter. */ + AZStd::string m_description; /**< The description of the parameter. */ + AZStd::string m_defaultValue; /**< The default value. */ + EParamType m_paramType; /**< The parameter type. */ + bool m_required; /**< Is this parameter required or optional? */ }; public: diff --git a/Gems/EMotionFX/Code/MCore/Source/CompressedFloat.h b/Gems/EMotionFX/Code/MCore/Source/CompressedFloat.h index 0ad5d2c5fd..99ef631e39 100644 --- a/Gems/EMotionFX/Code/MCore/Source/CompressedFloat.h +++ b/Gems/EMotionFX/Code/MCore/Source/CompressedFloat.h @@ -82,7 +82,7 @@ namespace MCore MCORE_INLINE float ToFloat(float minValue, float maxValue) const; public: - StorageType mValue; /**< The compressed/packed value. */ + StorageType m_value; /**< The compressed/packed value. */ // the number of steps within the specified range enum diff --git a/Gems/EMotionFX/Code/MCore/Source/CompressedFloat.inl b/Gems/EMotionFX/Code/MCore/Source/CompressedFloat.inl index 54bb5ec3ea..61b971b2aa 100644 --- a/Gems/EMotionFX/Code/MCore/Source/CompressedFloat.inl +++ b/Gems/EMotionFX/Code/MCore/Source/CompressedFloat.inl @@ -19,7 +19,7 @@ MCORE_INLINE TCompressedFloat::TCompressedFloat(float value, float { // TODO: make sure due to rounding/floating point errors the result is not negative? const StorageType f = (1.0f / (maxValue - minValue)) * CONVERT_VALUE; - mValue = (value - minValue) * f; + m_value = (value - minValue) * f; } @@ -27,7 +27,7 @@ MCORE_INLINE TCompressedFloat::TCompressedFloat(float value, float template MCORE_INLINE TCompressedFloat::TCompressedFloat(StorageType value) { - mValue = value; + m_value = value; } @@ -37,7 +37,7 @@ MCORE_INLINE void TCompressedFloat::FromFloat(float value, float mi { // TODO: make sure due to rounding/floating point errors the result is not negative? const StorageType f = (StorageType)(1.0f / (maxValue - minValue)) * CONVERT_VALUE; - mValue = (StorageType)((value - minValue) * f); + m_value = (StorageType)((value - minValue) * f); } @@ -47,7 +47,7 @@ MCORE_INLINE void TCompressedFloat::UnCompress(float* output, float { // unpack and normalize const float f = (1.0f / (float)CONVERT_VALUE) * (maxValue - minValue); - *output = ((float)mValue * f) + minValue; + *output = ((float)m_value * f) + minValue; } @@ -56,5 +56,5 @@ template MCORE_INLINE float TCompressedFloat::ToFloat(float minValue, float maxValue) const { const float f = (1.0f / (float)CONVERT_VALUE) * (maxValue - minValue); - return ((mValue * f) + minValue); + return ((m_value * f) + minValue); } diff --git a/Gems/EMotionFX/Code/MCore/Source/CompressedQuaternion.h b/Gems/EMotionFX/Code/MCore/Source/CompressedQuaternion.h index ce3304dd8f..0b25283410 100644 --- a/Gems/EMotionFX/Code/MCore/Source/CompressedQuaternion.h +++ b/Gems/EMotionFX/Code/MCore/Source/CompressedQuaternion.h @@ -73,7 +73,7 @@ namespace MCore AZ_INLINE operator AZ::Quaternion() const { return ToQuaternion(); } public: - StorageType mX, mY, mZ, mW; /**< The compressed/packed quaternion components values. */ + StorageType m_x, m_y, m_z, m_w; /**< The compressed/packed quaternion components values. */ // the number of steps within the specified range enum diff --git a/Gems/EMotionFX/Code/MCore/Source/CompressedQuaternion.inl b/Gems/EMotionFX/Code/MCore/Source/CompressedQuaternion.inl index 4dc1c2d867..2f8499b6ba 100644 --- a/Gems/EMotionFX/Code/MCore/Source/CompressedQuaternion.inl +++ b/Gems/EMotionFX/Code/MCore/Source/CompressedQuaternion.inl @@ -9,10 +9,10 @@ // constructor template MCORE_INLINE TCompressedQuaternion::TCompressedQuaternion() - : mX(0) - , mY(0) - , mZ(0) - , mW(CONVERT_VALUE) + : m_x(0) + , m_y(0) + , m_z(0) + , m_w(CONVERT_VALUE) { } @@ -20,10 +20,10 @@ MCORE_INLINE TCompressedQuaternion::TCompressedQuaternion() // constructor template MCORE_INLINE TCompressedQuaternion::TCompressedQuaternion(float xVal, float yVal, float zVal, float wVal) - : mX((StorageType)xVal) - , mY((StorageType)yVal) - , mZ((StorageType)zVal) - , mW((StorageType)wVal) + : m_x((StorageType)xVal) + , m_y((StorageType)yVal) + , m_z((StorageType)zVal) + , m_w((StorageType)wVal) { } @@ -31,10 +31,10 @@ MCORE_INLINE TCompressedQuaternion::TCompressedQuaternion(float xVa // constructor template MCORE_INLINE TCompressedQuaternion::TCompressedQuaternion(const AZ::Quaternion& quat) - : mX((StorageType)(static_cast(quat.GetX()) * CONVERT_VALUE)) - , mY((StorageType)(static_cast(quat.GetY()) * CONVERT_VALUE)) - , mZ((StorageType)(static_cast(quat.GetZ()) * CONVERT_VALUE)) - , mW((StorageType)(static_cast(quat.GetW()) * CONVERT_VALUE)) + : m_x((StorageType)(static_cast(quat.GetX()) * CONVERT_VALUE)) + , m_y((StorageType)(static_cast(quat.GetY()) * CONVERT_VALUE)) + , m_z((StorageType)(static_cast(quat.GetZ()) * CONVERT_VALUE)) + , m_w((StorageType)(static_cast(quat.GetW()) * CONVERT_VALUE)) { } @@ -44,10 +44,10 @@ template MCORE_INLINE void TCompressedQuaternion::FromQuaternion(const AZ::Quaternion& quat) { // pack it - mX = (StorageType)(static_cast(quat.GetX()) * CONVERT_VALUE); - mY = (StorageType)(static_cast(quat.GetY()) * CONVERT_VALUE); - mZ = (StorageType)(static_cast(quat.GetZ()) * CONVERT_VALUE); - mW = (StorageType)(static_cast(quat.GetW()) * CONVERT_VALUE); + m_x = (StorageType)(static_cast(quat.GetX()) * CONVERT_VALUE); + m_y = (StorageType)(static_cast(quat.GetY()) * CONVERT_VALUE); + m_z = (StorageType)(static_cast(quat.GetZ()) * CONVERT_VALUE); + m_w = (StorageType)(static_cast(quat.GetW()) * CONVERT_VALUE); } // uncompress into a quaternion @@ -55,7 +55,7 @@ template MCORE_INLINE void TCompressedQuaternion::UnCompress(AZ::Quaternion* output) const { const float f = 1.0f / (float)CONVERT_VALUE; - output->Set(mX * f, mY * f, mZ * f, mW * f); + output->Set(m_x * f, m_y * f, m_z * f, m_w * f); } @@ -63,7 +63,7 @@ MCORE_INLINE void TCompressedQuaternion::UnCompress(AZ::Quaternion* template <> MCORE_INLINE void TCompressedQuaternion::UnCompress(AZ::Quaternion* output) const { - output->Set(mX * 0.000030518509448f, mY * 0.000030518509448f, mZ * 0.000030518509448f, mW * 0.000030518509448f); + output->Set(m_x * 0.000030518509448f, m_y * 0.000030518509448f, m_z * 0.000030518509448f, m_w * 0.000030518509448f); } @@ -72,7 +72,7 @@ template MCORE_INLINE AZ::Quaternion TCompressedQuaternion::ToQuaternion() const { const float f = 1.0f / (float)CONVERT_VALUE; - return AZ::Quaternion(mX * f, mY * f, mZ * f, mW * f); + return AZ::Quaternion(m_x * f, m_y * f, m_z * f, m_w * f); } @@ -80,5 +80,5 @@ MCORE_INLINE AZ::Quaternion TCompressedQuaternion::ToQuaternion() c template <> MCORE_INLINE AZ::Quaternion TCompressedQuaternion::ToQuaternion() const { - return AZ::Quaternion(mX * 0.000030518509448f, mY * 0.000030518509448f, mZ * 0.000030518509448f, mW * 0.000030518509448f); + return AZ::Quaternion(m_x * 0.000030518509448f, m_y * 0.000030518509448f, m_z * 0.000030518509448f, m_w * 0.000030518509448f); } diff --git a/Gems/EMotionFX/Code/MCore/Source/CompressedVector.h b/Gems/EMotionFX/Code/MCore/Source/CompressedVector.h index 32fc2d71f7..d38a0a1862 100644 --- a/Gems/EMotionFX/Code/MCore/Source/CompressedVector.h +++ b/Gems/EMotionFX/Code/MCore/Source/CompressedVector.h @@ -46,9 +46,9 @@ namespace MCore * @param z The compressed z component. */ MCORE_INLINE TCompressedVector3(StorageType x, StorageType y, StorageType z) - : mX(x) - , mY(y) - , mZ(z) {} + : m_x(x) + , m_y(y) + , m_z(z) {} /** * Create a compressed vector from an uncompressed one. @@ -78,7 +78,7 @@ namespace MCore public: - StorageType mX, mY, mZ; /**< The compressed/packed vector components. */ + StorageType m_x, m_y, m_z; /**< The compressed/packed vector components. */ // the number of steps within the specified range enum diff --git a/Gems/EMotionFX/Code/MCore/Source/CompressedVector.inl b/Gems/EMotionFX/Code/MCore/Source/CompressedVector.inl index 693e2ac832..ce9adc60c9 100644 --- a/Gems/EMotionFX/Code/MCore/Source/CompressedVector.inl +++ b/Gems/EMotionFX/Code/MCore/Source/CompressedVector.inl @@ -19,9 +19,9 @@ MCORE_INLINE TCompressedVector3::TCompressedVector3(const AZ::Vecto { // TODO: make sure due to rounding/floating point errors the result is not negative? const float f = static_cast(CONVERT_VALUE) / (maxValue - minValue); - mX = static_cast((vec.GetX() - minValue) * f); - mY = static_cast((vec.GetY() - minValue) * f); - mZ = static_cast((vec.GetZ() - minValue) * f); + m_x = static_cast((vec.GetX() - minValue) * f); + m_y = static_cast((vec.GetY() - minValue) * f); + m_z = static_cast((vec.GetZ() - minValue) * f); } @@ -31,9 +31,9 @@ MCORE_INLINE void TCompressedVector3::FromVector3(const AZ::Vector3 { // TODO: make sure due to rounding/floating point errors the result is not negative? const float f = static_cast(CONVERT_VALUE) / (maxValue - minValue); - mX = static_cast((vec.GetX() - minValue) * f); - mY = static_cast((vec.GetY() - minValue) * f); - mZ = static_cast((vec.GetZ() - minValue) * f); + m_x = static_cast((vec.GetX() - minValue) * f); + m_y = static_cast((vec.GetY() - minValue) * f); + m_z = static_cast((vec.GetZ() - minValue) * f); } @@ -42,6 +42,6 @@ template MCORE_INLINE AZ::Vector3 TCompressedVector3::ToVector3(float minValue, float maxValue) const { const float f = (maxValue - minValue) / static_cast(CONVERT_VALUE); - return AZ::Vector3(static_cast(mX) * f + minValue, static_cast(mY) * f + minValue, static_cast(mZ) * f + minValue); + return AZ::Vector3(static_cast(m_x) * f + minValue, static_cast(m_y) * f + minValue, static_cast(m_z) * f + minValue); } diff --git a/Gems/EMotionFX/Code/MCore/Source/DiskFile.cpp b/Gems/EMotionFX/Code/MCore/Source/DiskFile.cpp index 27e94489e6..6fd0c59085 100644 --- a/Gems/EMotionFX/Code/MCore/Source/DiskFile.cpp +++ b/Gems/EMotionFX/Code/MCore/Source/DiskFile.cpp @@ -15,7 +15,7 @@ namespace MCore // constructor DiskFile::DiskFile() : File() - , mFile(nullptr) + , m_file(nullptr) { } @@ -38,7 +38,7 @@ namespace MCore bool DiskFile::Open(const char* fileName, EMode mode) { // if the file already is open, close it first - if (mFile) + if (m_file) { Close(); } @@ -65,27 +65,27 @@ namespace MCore }(); // set the file mode we used - mFileMode = mode; + m_fileMode = mode; // set the filename - mFileName = fileName; + m_fileName = fileName; // try to open the file - mFile = nullptr; - azfopen(&mFile, fileName, fileMode); + m_file = nullptr; + azfopen(&m_file, fileName, fileMode); // check on success - return (mFile != nullptr); + return (m_file != nullptr); } // close the file void DiskFile::Close() { - if (mFile) + if (m_file) { - fclose(mFile); - mFile = nullptr; + fclose(m_file); + m_file = nullptr; } } @@ -93,41 +93,41 @@ namespace MCore // flush the file void DiskFile::Flush() { - MCORE_ASSERT(mFile); - fflush(mFile); + MCORE_ASSERT(m_file); + fflush(m_file); } bool DiskFile::GetIsOpen() const { - return (mFile != nullptr); + return (m_file != nullptr); } // return true when we have reached the end of the file bool DiskFile::GetIsEOF() const { - MCORE_ASSERT(mFile); - return (feof(mFile) != 0); + MCORE_ASSERT(m_file); + return (feof(m_file) != 0); } // returns the next byte in the file uint8 DiskFile::GetNextByte() { - MCORE_ASSERT(mFile); - MCORE_ASSERT((mFileMode == READ) || (mFileMode == READWRITE) || (mFileMode == READWRITEAPPEND) || (mFileMode == APPEND) || (mFileMode == READWRITECREATE)); // make sure we opened the file in read mode - return static_cast(fgetc(mFile)); + MCORE_ASSERT(m_file); + MCORE_ASSERT((m_fileMode == READ) || (m_fileMode == READWRITE) || (m_fileMode == READWRITEAPPEND) || (m_fileMode == APPEND) || (m_fileMode == READWRITECREATE)); // make sure we opened the file in read mode + return static_cast(fgetc(m_file)); } // write a given byte to the file bool DiskFile::WriteByte(uint8 value) { - MCORE_ASSERT(mFile); - MCORE_ASSERT((mFileMode == WRITE) || (mFileMode == READWRITE) || (mFileMode == READWRITEAPPEND) || (mFileMode == READWRITECREATE)); // make sure we opened the file in write mode + MCORE_ASSERT(m_file); + MCORE_ASSERT((m_fileMode == WRITE) || (m_fileMode == READWRITE) || (m_fileMode == READWRITEAPPEND) || (m_fileMode == READWRITECREATE)); // make sure we opened the file in write mode - if (fputc(value, mFile) == EOF) + if (fputc(value, m_file) == EOF) { return false; } @@ -139,10 +139,10 @@ namespace MCore // write data to the file size_t DiskFile::Write(const void* data, size_t length) { - MCORE_ASSERT(mFile); - MCORE_ASSERT((mFileMode == WRITE) || (mFileMode == READWRITE) || (mFileMode == READWRITEAPPEND) || (mFileMode == READWRITECREATE)); // make sure we opened the file in write mode + MCORE_ASSERT(m_file); + MCORE_ASSERT((m_fileMode == WRITE) || (m_fileMode == READWRITE) || (m_fileMode == READWRITEAPPEND) || (m_fileMode == READWRITECREATE)); // make sure we opened the file in write mode - if (fwrite(data, length, 1, mFile) == 0) + if (fwrite(data, length, 1, m_file) == 0) { return 0; } @@ -154,10 +154,10 @@ namespace MCore // read data from the file size_t DiskFile::Read(void* data, size_t length) { - MCORE_ASSERT(mFile); - MCORE_ASSERT((mFileMode == READ) || (mFileMode == READWRITE) || (mFileMode == READWRITEAPPEND) || (mFileMode == APPEND) || (mFileMode == READWRITECREATE)); // make sure we opened the file in read mode + MCORE_ASSERT(m_file); + MCORE_ASSERT((m_fileMode == READ) || (m_fileMode == READWRITE) || (m_fileMode == READWRITEAPPEND) || (m_fileMode == APPEND) || (m_fileMode == READWRITECREATE)); // make sure we opened the file in read mode - if (fread(data, length, 1, mFile) == 0) + if (fread(data, length, 1, m_file) == 0) { return 0; } @@ -169,13 +169,13 @@ namespace MCore // get the file mode DiskFile::EMode DiskFile::GetFileMode() const { - return mFileMode; + return m_fileMode; } // get the file name const AZStd::string& DiskFile::GetFileName() const { - return mFileName; + return m_fileName; } } // namespace MCore diff --git a/Gems/EMotionFX/Code/MCore/Source/DiskFile.h b/Gems/EMotionFX/Code/MCore/Source/DiskFile.h index d17ff7f1f8..4f09a73f3b 100644 --- a/Gems/EMotionFX/Code/MCore/Source/DiskFile.h +++ b/Gems/EMotionFX/Code/MCore/Source/DiskFile.h @@ -162,8 +162,8 @@ namespace MCore const AZStd::string& GetFileName() const; protected: - AZStd::string mFileName; /**< The filename */ - FILE* mFile; /**< The file handle. */ - EMode mFileMode; /**< The mode we opened the file with. */ + AZStd::string m_fileName; /**< The filename */ + FILE* m_file; /**< The file handle. */ + EMode m_fileMode; /**< The mode we opened the file with. */ }; } // namespace MCore diff --git a/Gems/EMotionFX/Code/MCore/Source/Distance.cpp b/Gems/EMotionFX/Code/MCore/Source/Distance.cpp index e2a966b370..d73a4db601 100644 --- a/Gems/EMotionFX/Code/MCore/Source/Distance.cpp +++ b/Gems/EMotionFX/Code/MCore/Source/Distance.cpp @@ -16,8 +16,8 @@ namespace MCore // convert it into another unit type const MCore::Distance& Distance::ConvertTo(EUnitType targetUnitType) { - mDistance = mDistanceMeters * GetConversionFactorFromMeters(targetUnitType); - mUnitType = targetUnitType; + m_distance = m_distanceMeters * GetConversionFactorFromMeters(targetUnitType); + m_unitType = targetUnitType; return *this; } @@ -166,7 +166,7 @@ namespace MCore // update the distance in meters void Distance::UpdateDistanceMeters() { - mDistanceMeters = mDistance * GetConversionFactorToMeters(mUnitType); + m_distanceMeters = m_distance * GetConversionFactorToMeters(m_unitType); } diff --git a/Gems/EMotionFX/Code/MCore/Source/Distance.h b/Gems/EMotionFX/Code/MCore/Source/Distance.h index 3f26295201..6548fc251d 100644 --- a/Gems/EMotionFX/Code/MCore/Source/Distance.h +++ b/Gems/EMotionFX/Code/MCore/Source/Distance.h @@ -38,21 +38,21 @@ namespace MCore }; MCORE_INLINE Distance() - : mDistance(0.0) - , mDistanceMeters(0.0) - , mUnitType(UNITTYPE_METERS) { } + : m_distance(0.0) + , m_distanceMeters(0.0) + , m_unitType(UNITTYPE_METERS) { } MCORE_INLINE Distance(double units, EUnitType unitType) - : mDistance(units) - , mDistanceMeters(0.0) - , mUnitType(unitType) { UpdateDistanceMeters(); } + : m_distance(units) + , m_distanceMeters(0.0) + , m_unitType(unitType) { UpdateDistanceMeters(); } MCORE_INLINE Distance(float units, EUnitType unitType) - : mDistance(units) - , mDistanceMeters(0.0) - , mUnitType(unitType) { UpdateDistanceMeters(); } + : m_distance(units) + , m_distanceMeters(0.0) + , m_unitType(unitType) { UpdateDistanceMeters(); } MCORE_INLINE Distance(const Distance& other) - : mDistance(other.mDistance) - , mDistanceMeters(other.mDistanceMeters) - , mUnitType(other.mUnitType) {} + : m_distance(other.m_distance) + , m_distanceMeters(other.m_distanceMeters) + , m_unitType(other.m_unitType) {} const Distance& ConvertTo(EUnitType targetUnitType); MCORE_INLINE Distance ConvertedTo(EUnitType targetUnitType) const { Distance result(*this); result.ConvertTo(targetUnitType); return result; } @@ -65,46 +65,46 @@ namespace MCore static const char* UnitTypeToString(EUnitType unitType); static bool StringToUnitType(const AZStd::string& str, EUnitType* outUnitType); - MCORE_INLINE double GetDistance() const { return mDistance; } - MCORE_INLINE EUnitType GetUnitType() const { return mUnitType; } + MCORE_INLINE double GetDistance() const { return m_distance; } + MCORE_INLINE EUnitType GetUnitType() const { return m_unitType; } - MCORE_INLINE void Set(double dist, EUnitType unitType) { mDistance = dist; mUnitType = unitType; UpdateDistanceMeters(); } - MCORE_INLINE void SetDistance(double dist) { mDistance = dist; UpdateDistanceMeters(); } - MCORE_INLINE void SetUnitType(EUnitType unitType) { mUnitType = unitType; UpdateDistanceMeters(); } + MCORE_INLINE void Set(double dist, EUnitType unitType) { m_distance = dist; m_unitType = unitType; UpdateDistanceMeters(); } + MCORE_INLINE void SetDistance(double dist) { m_distance = dist; UpdateDistanceMeters(); } + MCORE_INLINE void SetUnitType(EUnitType unitType) { m_unitType = unitType; UpdateDistanceMeters(); } - MCORE_INLINE double CalcDistanceInUnitType(EUnitType targetUnitType) const { return mDistanceMeters * GetConversionFactorFromMeters(targetUnitType); } - MCORE_INLINE double CalcNumMillimeters() const { return mDistanceMeters * 1000.0; } - MCORE_INLINE double CalcNumCentimeters() const { return mDistanceMeters * 100.0; } - MCORE_INLINE double CalcNumDecimeters() const { return mDistanceMeters * 10.0; } - MCORE_INLINE double CalcNumMeters() const { return mDistanceMeters; } - MCORE_INLINE double CalcNumKilometers() const { return mDistanceMeters * 0.001; } - MCORE_INLINE double CalcNumInches() const { return mDistanceMeters * 39.370078740157; } - MCORE_INLINE double CalcNumFeet() const { return mDistanceMeters * 3.2808398950131; } - MCORE_INLINE double CalcNumYards() const { return mDistanceMeters * 1.0936132983377; } - MCORE_INLINE double CalcNumMiles() const { return mDistanceMeters * 0.00062137119223733; } + MCORE_INLINE double CalcDistanceInUnitType(EUnitType targetUnitType) const { return m_distanceMeters * GetConversionFactorFromMeters(targetUnitType); } + MCORE_INLINE double CalcNumMillimeters() const { return m_distanceMeters * 1000.0; } + MCORE_INLINE double CalcNumCentimeters() const { return m_distanceMeters * 100.0; } + MCORE_INLINE double CalcNumDecimeters() const { return m_distanceMeters * 10.0; } + MCORE_INLINE double CalcNumMeters() const { return m_distanceMeters; } + MCORE_INLINE double CalcNumKilometers() const { return m_distanceMeters * 0.001; } + MCORE_INLINE double CalcNumInches() const { return m_distanceMeters * 39.370078740157; } + MCORE_INLINE double CalcNumFeet() const { return m_distanceMeters * 3.2808398950131; } + MCORE_INLINE double CalcNumYards() const { return m_distanceMeters * 1.0936132983377; } + MCORE_INLINE double CalcNumMiles() const { return m_distanceMeters * 0.00062137119223733; } - MCORE_INLINE Distance operator - () const { return Distance(-mDistance, mUnitType); } - MCORE_INLINE const Distance& operator = (const Distance& other) { mDistance = other.mDistance; mDistanceMeters = other.mDistanceMeters; mUnitType = other.mUnitType; return *this; } + MCORE_INLINE Distance operator - () const { return Distance(-m_distance, m_unitType); } + MCORE_INLINE const Distance& operator = (const Distance& other) { m_distance = other.m_distance; m_distanceMeters = other.m_distanceMeters; m_unitType = other.m_unitType; return *this; } - MCORE_INLINE const Distance& operator *= (double f) { mDistance *= f; UpdateDistanceMeters(); return *this; } - MCORE_INLINE const Distance& operator /= (double f) { mDistance /= f; UpdateDistanceMeters(); return *this; } - MCORE_INLINE const Distance& operator += (double f) { mDistance += f; UpdateDistanceMeters(); return *this; } - MCORE_INLINE const Distance& operator -= (double f) { mDistance -= f; UpdateDistanceMeters(); return *this; } + MCORE_INLINE const Distance& operator *= (double f) { m_distance *= f; UpdateDistanceMeters(); return *this; } + MCORE_INLINE const Distance& operator /= (double f) { m_distance /= f; UpdateDistanceMeters(); return *this; } + MCORE_INLINE const Distance& operator += (double f) { m_distance += f; UpdateDistanceMeters(); return *this; } + MCORE_INLINE const Distance& operator -= (double f) { m_distance -= f; UpdateDistanceMeters(); return *this; } - MCORE_INLINE const Distance& operator *= (float f) { mDistance *= f; UpdateDistanceMeters(); return *this; } - MCORE_INLINE const Distance& operator /= (float f) { mDistance /= f; UpdateDistanceMeters(); return *this; } - MCORE_INLINE const Distance& operator += (float f) { mDistance += f; UpdateDistanceMeters(); return *this; } - MCORE_INLINE const Distance& operator -= (float f) { mDistance -= f; UpdateDistanceMeters(); return *this; } + MCORE_INLINE const Distance& operator *= (float f) { m_distance *= f; UpdateDistanceMeters(); return *this; } + MCORE_INLINE const Distance& operator /= (float f) { m_distance /= f; UpdateDistanceMeters(); return *this; } + MCORE_INLINE const Distance& operator += (float f) { m_distance += f; UpdateDistanceMeters(); return *this; } + MCORE_INLINE const Distance& operator -= (float f) { m_distance -= f; UpdateDistanceMeters(); return *this; } - MCORE_INLINE const Distance& operator *= (const Distance& other) { mDistance *= other.ConvertedTo(mUnitType).GetDistance(); UpdateDistanceMeters(); return *this; } - MCORE_INLINE const Distance& operator /= (const Distance& other) { mDistance /= other.ConvertedTo(mUnitType).GetDistance(); UpdateDistanceMeters(); return *this; } - MCORE_INLINE const Distance& operator += (const Distance& other) { mDistance += other.ConvertedTo(mUnitType).GetDistance(); UpdateDistanceMeters(); return *this; } - MCORE_INLINE const Distance& operator -= (const Distance& other) { mDistance -= other.ConvertedTo(mUnitType).GetDistance(); UpdateDistanceMeters(); return *this; } + MCORE_INLINE const Distance& operator *= (const Distance& other) { m_distance *= other.ConvertedTo(m_unitType).GetDistance(); UpdateDistanceMeters(); return *this; } + MCORE_INLINE const Distance& operator /= (const Distance& other) { m_distance /= other.ConvertedTo(m_unitType).GetDistance(); UpdateDistanceMeters(); return *this; } + MCORE_INLINE const Distance& operator += (const Distance& other) { m_distance += other.ConvertedTo(m_unitType).GetDistance(); UpdateDistanceMeters(); return *this; } + MCORE_INLINE const Distance& operator -= (const Distance& other) { m_distance -= other.ConvertedTo(m_unitType).GetDistance(); UpdateDistanceMeters(); return *this; } private: - double mDistance; /**< The actual distance in the current unit type. */ - double mDistanceMeters; /**< The distance in meters. */ - EUnitType mUnitType; /**< The actual unit type. */ + double m_distance; /**< The actual distance in the current unit type. */ + double m_distanceMeters; /**< The distance in meters. */ + EUnitType m_unitType; /**< The actual unit type. */ void UpdateDistanceMeters(); }; diff --git a/Gems/EMotionFX/Code/MCore/Source/DualQuaternion.cpp b/Gems/EMotionFX/Code/MCore/Source/DualQuaternion.cpp index bf4d249472..43c33b1a08 100644 --- a/Gems/EMotionFX/Code/MCore/Source/DualQuaternion.cpp +++ b/Gems/EMotionFX/Code/MCore/Source/DualQuaternion.cpp @@ -16,12 +16,12 @@ namespace MCore // calculate the inverse DualQuaternion& DualQuaternion::Inverse() { - const float realLength = mReal.GetLength(); - const float dotProduct = mReal.Dot(mDual); + const float realLength = m_real.GetLength(); + const float dotProduct = m_real.Dot(m_dual); const float dualFactor = realLength - 2.0f * dotProduct; - mReal.Set(-mReal.GetX() * realLength, -mReal.GetY() * realLength, -mReal.GetZ() * realLength, mReal.GetW() * realLength); - mDual.Set(-mDual.GetX() * dualFactor, -mDual.GetY() * dualFactor, -mDual.GetZ() * dualFactor, mDual.GetW() * dualFactor); + m_real.Set(-m_real.GetX() * realLength, -m_real.GetY() * realLength, -m_real.GetZ() * realLength, m_real.GetW() * realLength); + m_dual.Set(-m_dual.GetX() * dualFactor, -m_dual.GetY() * dualFactor, -m_dual.GetZ() * dualFactor, m_dual.GetW() * dualFactor); return *this; } @@ -30,26 +30,26 @@ namespace MCore // calculate the inversed version DualQuaternion DualQuaternion::Inversed() const { - const float realLength = mReal.GetLength(); - const float dotProduct = mReal.Dot(mDual); + const float realLength = m_real.GetLength(); + const float dotProduct = m_real.Dot(m_dual); const float dualFactor = realLength - 2.0f * dotProduct; - return DualQuaternion(AZ::Quaternion(-mReal.GetX() * realLength, -mReal.GetY() * realLength, -mReal.GetZ() * realLength, mReal.GetW() * realLength), - AZ::Quaternion(-mDual.GetX() * dualFactor, -mDual.GetY() * dualFactor, -mDual.GetZ() * dualFactor, mDual.GetW() * dualFactor)); + return DualQuaternion(AZ::Quaternion(-m_real.GetX() * realLength, -m_real.GetY() * realLength, -m_real.GetZ() * realLength, m_real.GetW() * realLength), + AZ::Quaternion(-m_dual.GetX() * dualFactor, -m_dual.GetY() * dualFactor, -m_dual.GetZ() * dualFactor, m_dual.GetW() * dualFactor)); } // convert the dual quaternion to a matrix AZ::Transform DualQuaternion::ToTransform() const { - const float sqLen = mReal.Dot(mReal); - const float x = mReal.GetX(); - const float y = mReal.GetY(); - const float z = mReal.GetZ(); - const float w = mReal.GetW(); - const float t0 = mDual.GetW(); - const float t1 = mDual.GetX(); - const float t2 = mDual.GetY(); - const float t3 = mDual.GetZ(); + const float sqLen = m_real.Dot(m_real); + const float x = m_real.GetX(); + const float y = m_real.GetY(); + const float z = m_real.GetZ(); + const float w = m_real.GetW(); + const float t0 = m_dual.GetW(); + const float t1 = m_dual.GetX(); + const float t2 = m_dual.GetY(); + const float t3 = m_dual.GetZ(); AZ::Matrix3x3 matrix3x3; matrix3x3.SetElement(0, 0, w * w + x * x - y * y - z * z); @@ -85,12 +85,12 @@ namespace MCore // normalizes the dual quaternion DualQuaternion& DualQuaternion::Normalize() { - const float length = mReal.GetLength(); + const float length = m_real.GetLength(); const float invLength = 1.0f / length; - mReal.Set(mReal.GetX() * invLength, mReal.GetY() * invLength, mReal.GetZ() * invLength, mReal.GetW() * invLength); - mDual.Set(mDual.GetX() * invLength, mDual.GetY() * invLength, mDual.GetZ() * invLength, mDual.GetW() * invLength); - mDual += mReal * (mReal.Dot(mDual) * -1.0f); + m_real.Set(m_real.GetX() * invLength, m_real.GetY() * invLength, m_real.GetZ() * invLength, m_real.GetW() * invLength); + m_dual.Set(m_dual.GetX() * invLength, m_dual.GetY() * invLength, m_dual.GetZ() * invLength, m_dual.GetW() * invLength); + m_dual += m_real * (m_real.Dot(m_dual) * -1.0f); return *this; } @@ -98,11 +98,11 @@ namespace MCore // convert back into rotation and translation void DualQuaternion::ToRotationTranslation(AZ::Quaternion* outRot, AZ::Vector3* outPos) const { - const float invLength = 1.0f / mReal.GetLength(); - *outRot = mReal * invLength; - outPos->Set(2.0f * (-mDual.GetW() * mReal.GetX() + mDual.GetX() * mReal.GetW() - mDual.GetY() * mReal.GetZ() + mDual.GetZ() * mReal.GetY()) * invLength, - 2.0f * (-mDual.GetW() * mReal.GetY() + mDual.GetX() * mReal.GetZ() + mDual.GetY() * mReal.GetW() - mDual.GetZ() * mReal.GetX()) * invLength, - 2.0f * (-mDual.GetW() * mReal.GetZ() - mDual.GetX() * mReal.GetY() + mDual.GetY() * mReal.GetX() + mDual.GetZ() * mReal.GetW()) * invLength); + const float invLength = 1.0f / m_real.GetLength(); + *outRot = m_real * invLength; + outPos->Set(2.0f * (-m_dual.GetW() * m_real.GetX() + m_dual.GetX() * m_real.GetW() - m_dual.GetY() * m_real.GetZ() + m_dual.GetZ() * m_real.GetY()) * invLength, + 2.0f * (-m_dual.GetW() * m_real.GetY() + m_dual.GetX() * m_real.GetZ() + m_dual.GetY() * m_real.GetW() - m_dual.GetZ() * m_real.GetX()) * invLength, + 2.0f * (-m_dual.GetW() * m_real.GetZ() - m_dual.GetX() * m_real.GetY() + m_dual.GetY() * m_real.GetX() + m_dual.GetZ() * m_real.GetW()) * invLength); } @@ -110,10 +110,10 @@ namespace MCore // only works with normalized dual quaternions void DualQuaternion::NormalizedToRotationTranslation(AZ::Quaternion* outRot, AZ::Vector3* outPos) const { - *outRot = mReal; - outPos->Set(2.0f * (-mDual.GetW() * mReal.GetX() + mDual.GetX() * mReal.GetW() - mDual.GetY() * mReal.GetZ() + mDual.GetZ() * mReal.GetY()), - 2.0f * (-mDual.GetW() * mReal.GetY() + mDual.GetX() * mReal.GetZ() + mDual.GetY() * mReal.GetW() - mDual.GetZ() * mReal.GetX()), - 2.0f * (-mDual.GetW() * mReal.GetZ() - mDual.GetX() * mReal.GetY() + mDual.GetY() * mReal.GetX() + mDual.GetZ() * mReal.GetW())); + *outRot = m_real; + outPos->Set(2.0f * (-m_dual.GetW() * m_real.GetX() + m_dual.GetX() * m_real.GetW() - m_dual.GetY() * m_real.GetZ() + m_dual.GetZ() * m_real.GetY()), + 2.0f * (-m_dual.GetW() * m_real.GetY() + m_dual.GetX() * m_real.GetZ() + m_dual.GetY() * m_real.GetW() - m_dual.GetZ() * m_real.GetX()), + 2.0f * (-m_dual.GetW() * m_real.GetZ() - m_dual.GetX() * m_real.GetY() + m_dual.GetY() * m_real.GetX() + m_dual.GetZ() * m_real.GetW())); } diff --git a/Gems/EMotionFX/Code/MCore/Source/DualQuaternion.h b/Gems/EMotionFX/Code/MCore/Source/DualQuaternion.h index af16713363..74caa715e5 100644 --- a/Gems/EMotionFX/Code/MCore/Source/DualQuaternion.h +++ b/Gems/EMotionFX/Code/MCore/Source/DualQuaternion.h @@ -37,16 +37,16 @@ namespace MCore * This automatically initializes the dual quaternion to identity. */ MCORE_INLINE DualQuaternion() - : mReal(0.0f, 0.0f, 0.0f, 1.0f) - , mDual(0.0f, 0.0f, 0.0f, 0.0f) {} + : m_real(0.0f, 0.0f, 0.0f, 1.0f) + , m_dual(0.0f, 0.0f, 0.0f, 0.0f) {} /** * Copy constructor. * @param other The dual quaternion to copy the data from. */ MCORE_INLINE DualQuaternion(const DualQuaternion& other) - : mReal(other.mReal) - , mDual(other.mDual) {} + : m_real(other.m_real) + , m_dual(other.m_dual) {} /** * Extended constructor. @@ -56,8 +56,8 @@ namespace MCore * or use the FromRotationTranslation method. */ MCORE_INLINE DualQuaternion(const AZ::Quaternion& real, const AZ::Quaternion& dual) - : mReal(real) - , mDual(dual) {} + : m_real(real) + , m_dual(dual) {} /** * Constructor which takes a matrix as input parameter. @@ -81,7 +81,7 @@ namespace MCore * @note Please keep in mind that you should not set the translation directly into the dual part. If you want to initialize the dual quaternion from * a rotation and translation, please use the special constructor for this, or the FromRotationTranslation method. */ - MCORE_INLINE void Set(const AZ::Quaternion& real, const AZ::Quaternion& dual) { mReal = real; mDual = dual; } + MCORE_INLINE void Set(const AZ::Quaternion& real, const AZ::Quaternion& dual) { m_real = real; m_dual = dual; } /** * Normalize the dual quaternion. @@ -102,7 +102,7 @@ namespace MCore * The default constructor already puts the dual quaternion in its identity transform. * @result A reference to this quaternion, but now having an identity transform. */ - MCORE_INLINE DualQuaternion& Identity() { mReal = AZ::Quaternion::CreateIdentity(); mDual.Set(0.0f, 0.0f, 0.0f, 0.0f); return *this; } + MCORE_INLINE DualQuaternion& Identity() { m_real = AZ::Quaternion::CreateIdentity(); m_dual.Set(0.0f, 0.0f, 0.0f, 0.0f); return *this; } /** * Get the dot product between the two dual quaternions. @@ -112,7 +112,7 @@ namespace MCore * @result A 2D vector containing the result of the dot products. The x component contains the result of the dot between the real part and the y component * contains the result of the dot product between the dual parts. */ - MCORE_INLINE AZ::Vector2 Dot(const DualQuaternion& other) const { return AZ::Vector2(mReal.Dot(other.mReal), mDual.Dot(other.mDual)); } + MCORE_INLINE AZ::Vector2 Dot(const DualQuaternion& other) const { return AZ::Vector2(m_real.Dot(other.m_real), m_dual.Dot(other.m_dual)); } /** * Calculate the length of the dual quaternion. @@ -120,7 +120,7 @@ namespace MCore * The result of the real part will be stored in the x component of the 2D vector, and the result of the dual part will be stored in the y component. * @result The 2D vector containing the length of the real and dual part. */ - MCORE_INLINE AZ::Vector2 Length() const { const float realLen = mReal.GetLength(); return AZ::Vector2(realLen, mReal.Dot(mDual) / realLen); } + MCORE_INLINE AZ::Vector2 Length() const { const float realLen = m_real.GetLength(); return AZ::Vector2(realLen, m_real.Dot(m_dual) / realLen); } /** * Inverse this dual quaternion. @@ -139,14 +139,14 @@ namespace MCore * @result A reference to this dual quaternion, but now conjugaged. * @note If you want to inverse a unit quaternion, you can use the conjugate instead, as that gives the same result, but is much faster to calculate. */ - MCORE_INLINE DualQuaternion& Conjugate() { mReal = mReal.GetConjugate(); mDual = mDual.GetConjugate(); return *this; } + MCORE_INLINE DualQuaternion& Conjugate() { m_real = m_real.GetConjugate(); m_dual = m_dual.GetConjugate(); return *this; } /** * Calculate a conjugated version of this dual quaternion. * @result A copy of this dual quaternion, but conjugated. * @note If you want to inverse a unit quaternion, you can use the conjugate instead, as that gives the same result, but is much faster to calculate. */ - MCORE_INLINE DualQuaternion Conjugated() const { return DualQuaternion(mReal.GetConjugate(), mDual.GetConjugate()); } + MCORE_INLINE DualQuaternion Conjugated() const { return DualQuaternion(m_real.GetConjugate(), m_dual.GetConjugate()); } /** * Initialize the current quaternion from a specified matrix. @@ -228,28 +228,27 @@ namespace MCore // operators MCORE_INLINE const DualQuaternion& operator=(const AZ::Transform& transform) { FromTransform(transform); return *this; } - MCORE_INLINE const DualQuaternion& operator=(const DualQuaternion& other) { mReal = other.mReal; mDual = other.mDual; return *this; } - MCORE_INLINE DualQuaternion operator-() const { return DualQuaternion(-mReal, -mDual); } - MCORE_INLINE const DualQuaternion& operator+=(const DualQuaternion& q) { mReal += q.mReal; mDual += q.mDual; return *this; } - MCORE_INLINE const DualQuaternion& operator-=(const DualQuaternion& q) { mReal -= q.mReal; mDual -= q.mDual; return *this; } - MCORE_INLINE const DualQuaternion& operator*=(const DualQuaternion& q) { const AZ::Quaternion orgReal(mReal); mReal *= q.mReal; mDual = orgReal * q.mDual + q.mReal * mDual; return *this; } - MCORE_INLINE const DualQuaternion& operator*=(float f) { mReal *= f; mDual *= f; return *this; } - //MCORE_INLINE const DualQuaternion& operator*=(double f) { mReal*=f; mDual*=f; return *this; } + MCORE_INLINE const DualQuaternion& operator=(const DualQuaternion& other) { m_real = other.m_real; m_dual = other.m_dual; return *this; } + MCORE_INLINE DualQuaternion operator-() const { return DualQuaternion(-m_real, -m_dual); } + MCORE_INLINE const DualQuaternion& operator+=(const DualQuaternion& q) { m_real += q.m_real; m_dual += q.m_dual; return *this; } + MCORE_INLINE const DualQuaternion& operator-=(const DualQuaternion& q) { m_real -= q.m_real; m_dual -= q.m_dual; return *this; } + MCORE_INLINE const DualQuaternion& operator*=(const DualQuaternion& q) { const AZ::Quaternion orgReal(m_real); m_real *= q.m_real; m_dual = orgReal * q.m_dual + q.m_real * m_dual; return *this; } + MCORE_INLINE const DualQuaternion& operator*=(float f) { m_real *= f; m_dual *= f; return *this; } // attributes - AZ::Quaternion mReal; /**< The real value, which you can see as the regular rotation quaternion. */ - AZ::Quaternion mDual; /**< The dual part, which you can see as the translation part. */ + AZ::Quaternion m_real; /**< The real value, which you can see as the regular rotation quaternion. */ + AZ::Quaternion m_dual; /**< The dual part, which you can see as the translation part. */ }; // operators - MCORE_INLINE DualQuaternion operator*(const DualQuaternion& a, float f) { return DualQuaternion(a.mReal * f, a.mDual * f); } - MCORE_INLINE DualQuaternion operator*(float f, const DualQuaternion& b) { return DualQuaternion(b.mReal * f, b.mDual * f); } - MCORE_INLINE DualQuaternion operator+(const DualQuaternion& a, const DualQuaternion& b) { return DualQuaternion(a.mReal + b.mReal, a.mDual + b.mDual); } - MCORE_INLINE DualQuaternion operator-(const DualQuaternion& a, const DualQuaternion& b) { return DualQuaternion(a.mReal - b.mReal, a.mDual - b.mDual); } + MCORE_INLINE DualQuaternion operator*(const DualQuaternion& a, float f) { return DualQuaternion(a.m_real * f, a.m_dual * f); } + MCORE_INLINE DualQuaternion operator*(float f, const DualQuaternion& b) { return DualQuaternion(b.m_real * f, b.m_dual * f); } + MCORE_INLINE DualQuaternion operator+(const DualQuaternion& a, const DualQuaternion& b) { return DualQuaternion(a.m_real + b.m_real, a.m_dual + b.m_dual); } + MCORE_INLINE DualQuaternion operator-(const DualQuaternion& a, const DualQuaternion& b) { return DualQuaternion(a.m_real - b.m_real, a.m_dual - b.m_dual); } MCORE_INLINE DualQuaternion operator*(const DualQuaternion& a, const DualQuaternion& b) { - return DualQuaternion(a.mReal * b.mReal, a.mReal * b.mDual + b.mReal * a.mDual); + return DualQuaternion(a.m_real * b.m_real, a.m_real * b.m_dual + b.m_real * a.m_dual); } // include the inline code diff --git a/Gems/EMotionFX/Code/MCore/Source/DualQuaternion.inl b/Gems/EMotionFX/Code/MCore/Source/DualQuaternion.inl index d928bae6d9..1c0c378852 100644 --- a/Gems/EMotionFX/Code/MCore/Source/DualQuaternion.inl +++ b/Gems/EMotionFX/Code/MCore/Source/DualQuaternion.inl @@ -8,9 +8,9 @@ // extended constructor MCORE_INLINE DualQuaternion::DualQuaternion(const AZ::Quaternion& rotation, const AZ::Vector3& translation) - : mReal(rotation) + : m_real(rotation) { - mDual = 0.5f * (AZ::Quaternion(translation.GetX(), translation.GetY(), translation.GetZ(), 0.0f) * rotation); + m_dual = 0.5f * (AZ::Quaternion(translation.GetX(), translation.GetY(), translation.GetZ(), 0.0f) * rotation); } @@ -18,10 +18,10 @@ MCORE_INLINE DualQuaternion::DualQuaternion(const AZ::Quaternion& rotation, cons // transform a 3D point with the dual quaternion MCORE_INLINE AZ::Vector3 DualQuaternion::TransformPoint(const AZ::Vector3& point) const { - const AZ::Vector3 realVector(mReal.GetX(), mReal.GetY(), mReal.GetZ()); - const AZ::Vector3 dualVector(mDual.GetX(), mDual.GetY(), mDual.GetZ()); - const AZ::Vector3 position = point + 2.0f * (realVector.Cross(realVector.Cross(point) + (mReal.GetW() * point))); - const AZ::Vector3 displacement = 2.0f * (mReal.GetW() * dualVector - mDual.GetW() * realVector + realVector.Cross(dualVector)); + const AZ::Vector3 realVector(m_real.GetX(), m_real.GetY(), m_real.GetZ()); + const AZ::Vector3 dualVector(m_dual.GetX(), m_dual.GetY(), m_dual.GetZ()); + const AZ::Vector3 position = point + 2.0f * (realVector.Cross(realVector.Cross(point) + (m_real.GetW() * point))); + const AZ::Vector3 displacement = 2.0f * (m_real.GetW() * dualVector - m_dual.GetW() * realVector + realVector.Cross(dualVector)); return position + displacement; } @@ -29,8 +29,8 @@ MCORE_INLINE AZ::Vector3 DualQuaternion::TransformPoint(const AZ::Vector3& point // transform a vector with this dual quaternion MCORE_INLINE AZ::Vector3 DualQuaternion::TransformVector(const AZ::Vector3& v) const { - const AZ::Vector3 realVector(mReal.GetX(), mReal.GetY(), mReal.GetZ()); - const AZ::Vector3 dualVector(mDual.GetX(), mDual.GetY(), mDual.GetZ()); - return v + 2.0f * (realVector.Cross(realVector.Cross(v) + mReal.GetW() * v)); + const AZ::Vector3 realVector(m_real.GetX(), m_real.GetY(), m_real.GetZ()); + const AZ::Vector3 dualVector(m_dual.GetX(), m_dual.GetY(), m_dual.GetZ()); + return v + 2.0f * (realVector.Cross(realVector.Cross(v) + m_real.GetW() * v)); } diff --git a/Gems/EMotionFX/Code/MCore/Source/FileSystem.cpp b/Gems/EMotionFX/Code/MCore/Source/FileSystem.cpp index 71b426e532..d97cd7c9a9 100644 --- a/Gems/EMotionFX/Code/MCore/Source/FileSystem.cpp +++ b/Gems/EMotionFX/Code/MCore/Source/FileSystem.cpp @@ -18,13 +18,13 @@ namespace MCore { // The folder path used to keep a backup in SaveToFileSecured. - StaticString FileSystem::mSecureSavePath; + StaticString FileSystem::s_secureSavePath; // Save to file secured by a backup file. bool FileSystem::SaveToFileSecured(const char* filename, const AZStd::function& saveFunction, CommandManager* commandManager) { // If the secure save path is not set, simply call the save function. - if (mSecureSavePath.empty()) + if (s_secureSavePath.empty()) { return saveFunction(); } @@ -45,12 +45,12 @@ namespace MCore // Find a unique backup filename. AZ::u32 backupFileIndex = 0; AZStd::string backupFileIndexString; - AZStd::string backupFilename = mSecureSavePath.c_str() + baseFilename + '.' + extension; + AZStd::string backupFilename = s_secureSavePath.c_str() + baseFilename + '.' + extension; while (fileIo->Exists(backupFilename.c_str())) { AZStd::to_string(backupFileIndexString, ++backupFileIndex); - backupFilename = mSecureSavePath.c_str() + baseFilename + backupFileIndexString + '.' + extension; + backupFilename = s_secureSavePath.c_str() + baseFilename + backupFileIndexString + '.' + extension; } // Copy the file to the backup filename. diff --git a/Gems/EMotionFX/Code/MCore/Source/FileSystem.h b/Gems/EMotionFX/Code/MCore/Source/FileSystem.h index 2fdf74ff46..3bf86577e5 100644 --- a/Gems/EMotionFX/Code/MCore/Source/FileSystem.h +++ b/Gems/EMotionFX/Code/MCore/Source/FileSystem.h @@ -34,6 +34,6 @@ namespace MCore */ static bool SaveToFileSecured(const char* filename, const AZStd::function& saveFunction, CommandManager* commandManager = nullptr); - static StaticString mSecureSavePath; /**< The folder path used to keep a backup in SaveToFileSecured. */ + static StaticString s_secureSavePath; /**< The folder path used to keep a backup in SaveToFileSecured. */ }; } // namespace MCore diff --git a/Gems/EMotionFX/Code/MCore/Source/IDGenerator.cpp b/Gems/EMotionFX/Code/MCore/Source/IDGenerator.cpp index 7e4ff9b16e..dc25288c19 100644 --- a/Gems/EMotionFX/Code/MCore/Source/IDGenerator.cpp +++ b/Gems/EMotionFX/Code/MCore/Source/IDGenerator.cpp @@ -15,7 +15,7 @@ namespace MCore { // constructor IDGenerator::IDGenerator() - : mNextID{0} + : m_nextId{0} { } @@ -29,7 +29,7 @@ namespace MCore // get a unique id size_t IDGenerator::GenerateID() { - const size_t result = mNextID++; + const size_t result = m_nextId++; MCORE_ASSERT(result != InvalidIndex); // reached the limit return result; } diff --git a/Gems/EMotionFX/Code/MCore/Source/IDGenerator.h b/Gems/EMotionFX/Code/MCore/Source/IDGenerator.h index 1418b7d3d1..5c392e45b1 100644 --- a/Gems/EMotionFX/Code/MCore/Source/IDGenerator.h +++ b/Gems/EMotionFX/Code/MCore/Source/IDGenerator.h @@ -31,7 +31,7 @@ namespace MCore size_t GenerateID(); private: - AZStd::atomic mNextID; /**< The id used for the next GenerateID() call. */ + AZStd::atomic m_nextId; /**< The id used for the next GenerateID() call. */ /** * Default constructor. diff --git a/Gems/EMotionFX/Code/MCore/Source/LogManager.cpp b/Gems/EMotionFX/Code/MCore/Source/LogManager.cpp index ecf4eb9168..0621926fb2 100644 --- a/Gems/EMotionFX/Code/MCore/Source/LogManager.cpp +++ b/Gems/EMotionFX/Code/MCore/Source/LogManager.cpp @@ -13,21 +13,21 @@ namespace MCore { // static mutex - Mutex LogManager::mGlobalMutex; + Mutex LogManager::s_globalMutex; //-------------------------------------------------------------------------------------------- // constructor LogCallback::LogCallback() { - mLogLevels = LOGLEVEL_DEFAULT; + m_logLevels = LOGLEVEL_DEFAULT; } // set the log levels this callback will accept and pass through void LogCallback::SetLogLevels(ELogLevel logLevels) { - mLogLevels = logLevels; + m_logLevels = logLevels; GetLogManager().InitLogLevels(); } @@ -75,10 +75,10 @@ namespace MCore void LogManager::AddLogCallback(LogCallback* callback) { MCORE_ASSERT(callback); - LockGuard lock(mMutex); + LockGuard lock(m_mutex); // add the callback to the stack - mLogCallbacks.emplace_back(callback); + m_logCallbacks.emplace_back(callback); // collect the enabled log levels InitLogLevels(); @@ -88,14 +88,14 @@ namespace MCore // remove a specific log callback from the stack void LogManager::RemoveLogCallback(size_t index) { - MCORE_ASSERT(index < mLogCallbacks.size()); - LockGuard lock(mMutex); + MCORE_ASSERT(index < m_logCallbacks.size()); + LockGuard lock(m_mutex); // delete it from memory - delete mLogCallbacks[index]; + delete m_logCallbacks[index]; // remove the callback from the stack - mLogCallbacks.erase(AZStd::next(begin(mLogCallbacks), index)); + m_logCallbacks.erase(AZStd::next(begin(m_logCallbacks), index)); // collect the enabled log levels InitLogLevels(); @@ -104,10 +104,10 @@ namespace MCore // remove all given log callbacks by type void LogManager::RemoveAllByType(uint32 type) { - LockGuard lock(mMutex); + LockGuard lock(m_mutex); // Put all the callbacks of the type to be removed at the end of the vector - mLogCallbacks.erase(AZStd::remove_if(begin(mLogCallbacks), end(mLogCallbacks), [type](const LogCallback* callback) + m_logCallbacks.erase(AZStd::remove_if(begin(m_logCallbacks), end(m_logCallbacks), [type](const LogCallback* callback) { if (callback->GetType() == type) { @@ -125,15 +125,15 @@ namespace MCore // remove all log callbacks from the stack void LogManager::ClearLogCallbacks() { - LockGuard lock(mMutex); + LockGuard lock(m_mutex); // get rid of the callbacks - for (auto* logCallback : mLogCallbacks) + for (auto* logCallback : m_logCallbacks) { delete logCallback; } - mLogCallbacks.clear(); + m_logCallbacks.clear(); // collect the enabled log levels InitLogLevels(); @@ -143,13 +143,13 @@ namespace MCore // retrieve a pointer to the given log callback LogCallback* LogManager::GetLogCallback(size_t index) { - return mLogCallbacks[index]; + return m_logCallbacks[index]; } // return number of log callbacks in the stack size_t LogManager::GetNumLogCallbacks() const { - return mLogCallbacks.size(); + return m_logCallbacks.size(); } // collect all enabled log levels @@ -159,12 +159,12 @@ namespace MCore int32 logLevels = LogCallback::LOGLEVEL_NONE; // enable all log levels that are enabled by any of the callbacks - for (auto* logCallback : mLogCallbacks) + for (auto* logCallback : m_logCallbacks) { logLevels |= (int32)logCallback->GetLogLevels(); } - mLogLevels = (LogCallback::ELogLevel)logLevels; + m_logLevels = (LogCallback::ELogLevel)logLevels; } @@ -172,23 +172,23 @@ namespace MCore void LogManager::SetLogLevels(LogCallback::ELogLevel logLevels) { // iterate through all log callbacks and set it to the given log levels - for (auto* logCallback : mLogCallbacks) + for (auto* logCallback : m_logCallbacks) { logCallback->SetLogLevels(logLevels); } // force set the log manager's log levels to the given one as well - mLogLevels = logLevels; + m_logLevels = logLevels; } // the main logging method void LogManager::LogMessage(const char* message, LogCallback::ELogLevel logLevel) { - LockGuard lock(mMutex); + LockGuard lock(m_mutex); // iterate through all callbacks - for (auto* logCallback : mLogCallbacks) + for (auto* logCallback : m_logCallbacks) { if (logCallback->GetLogLevels() & logLevel) { @@ -202,9 +202,9 @@ namespace MCore size_t LogManager::FindLogCallback(LogCallback* callback) const { // iterate through all callbacks - for (size_t i = 0; i < mLogCallbacks.size(); ++i) + for (size_t i = 0; i < m_logCallbacks.size(); ++i) { - if (mLogCallbacks[i] == callback) + if (m_logCallbacks[i] == callback) { return i; } @@ -216,7 +216,7 @@ namespace MCore void LogFatalError(const char* what, ...) { - LockGuard lock(LogManager::mGlobalMutex); + LockGuard lock(LogManager::s_globalMutex); // skip the va list construction in case that the message won't be logged by any of the callbacks if (GetLogManager().GetLogLevels() & LogCallback::LOGLEVEL_FATAL) @@ -236,7 +236,7 @@ namespace MCore void LogError(const char* what, ...) { - LockGuard lock(LogManager::mGlobalMutex); + LockGuard lock(LogManager::s_globalMutex); // skip the va list construction in case that the message won't be logged by any of the callbacks if (GetLogManager().GetLogLevels() & LogCallback::LOGLEVEL_ERROR) @@ -256,7 +256,7 @@ namespace MCore void LogWarning(const char* what, ...) { - LockGuard lock(LogManager::mGlobalMutex); + LockGuard lock(LogManager::s_globalMutex); // skip the va list construction in case that the message won't be logged by any of the callbacks if (GetLogManager().GetLogLevels() & LogCallback::LOGLEVEL_WARNING) @@ -276,7 +276,7 @@ namespace MCore void LogInfo(const char* what, ...) { - LockGuard lock(LogManager::mGlobalMutex); + LockGuard lock(LogManager::s_globalMutex); // skip the va list construction in case that the message won't be logged by any of the callbacks if (GetLogManager().GetLogLevels() & LogCallback::LOGLEVEL_INFO) @@ -296,7 +296,7 @@ namespace MCore void LogDetailedInfo(const char* what, ...) { - LockGuard lock(LogManager::mGlobalMutex); + LockGuard lock(LogManager::s_globalMutex); // skip the va list construction in case that the message won't be logged by any of the callbacks if (GetLogManager().GetLogLevels() & LogCallback::LOGLEVEL_DETAILEDINFO) @@ -316,7 +316,7 @@ namespace MCore void LogDebug(const char* what, ...) { - LockGuard lock(LogManager::mGlobalMutex); + LockGuard lock(LogManager::s_globalMutex); // skip the va list construction in case that the message won't be logged by any of the callbacks if (GetLogManager().GetLogLevels() & LogCallback::LOGLEVEL_DEBUG) @@ -335,7 +335,7 @@ namespace MCore void LogDebugMsg(const char* msg) { - LockGuard lock(LogManager::mGlobalMutex); + LockGuard lock(LogManager::s_globalMutex); // skip the va list construction in case that the message won't be logged by any of the callbacks if (GetLogManager().GetLogLevels() & LogCallback::LOGLEVEL_DEBUG) diff --git a/Gems/EMotionFX/Code/MCore/Source/LogManager.h b/Gems/EMotionFX/Code/MCore/Source/LogManager.h index d5e2316436..864aa50219 100644 --- a/Gems/EMotionFX/Code/MCore/Source/LogManager.h +++ b/Gems/EMotionFX/Code/MCore/Source/LogManager.h @@ -75,7 +75,7 @@ namespace MCore * To check if a log level is enabled use logical bitwise and comparison, example: if (GetLogLevels() & LOGLEVEL_EXAMPLE). * @result The log levels packed as bit flags which are enabled on the callback. */ - MCORE_INLINE ELogLevel GetLogLevels() const { return mLogLevels; } + MCORE_INLINE ELogLevel GetLogLevels() const { return m_logLevels; } /** * Set the log levels this callback will accept and pass through. @@ -86,7 +86,7 @@ namespace MCore void SetLogLevels(ELogLevel logLevels); protected: - ELogLevel mLogLevels; /**< The log levels that will pass the callback. All messages from log flags which are disabled won't be logged. The default value of the log level will be LOGLEVEL_DEFAULT. */ + ELogLevel m_logLevels; /**< The log levels that will pass the callback. All messages from log flags which are disabled won't be logged. The default value of the log level will be LOGLEVEL_DEFAULT. */ }; //---------------------------------------------------------------------------- @@ -232,7 +232,7 @@ namespace MCore * To check if a log level is enabled by one of the callbacks use logical bitwise and comparison, example: if (GetLogLevels() & LOGLEVEL_EXAMPLE). * @result The log levels packed as bit flags which are enabled on the callback. */ - MCORE_INLINE LogCallback::ELogLevel GetLogLevels() const { return mLogLevels; } + MCORE_INLINE LogCallback::ELogLevel GetLogLevels() const { return m_logLevels; } /** * Iterate over all callbacks and collect the enabled log levels. @@ -249,11 +249,11 @@ namespace MCore void LogMessage(const char* message, LogCallback::ELogLevel logLevel = LogCallback::LOGLEVEL_INFO); public: - static Mutex mGlobalMutex; /**< The multithread mutex, used by some global Log functions. */ + static Mutex s_globalMutex; /**< The multithread mutex, used by some global Log functions. */ private: - AZStd::vector mLogCallbacks; /**< A collection of log callback instances. */ - LogCallback::ELogLevel mLogLevels; /**< The log levels that will pass one of the callbacks. All messages from log flags which are disabled won't be logged. */ - Mutex mMutex; /**< The mutex for logging locally. */ + AZStd::vector m_logCallbacks; /**< A collection of log callback instances. */ + LogCallback::ELogLevel m_logLevels; /**< The log levels that will pass one of the callbacks. All messages from log flags which are disabled won't be logged. */ + Mutex m_mutex; /**< The mutex for logging locally. */ }; } // namespace MCore diff --git a/Gems/EMotionFX/Code/MCore/Source/MCoreCommandManager.cpp b/Gems/EMotionFX/Code/MCore/Source/MCoreCommandManager.cpp index 657c5e0303..5cdd9c2600 100644 --- a/Gems/EMotionFX/Code/MCore/Source/MCoreCommandManager.cpp +++ b/Gems/EMotionFX/Code/MCore/Source/MCoreCommandManager.cpp @@ -17,15 +17,14 @@ namespace MCore { CommandManager::CommandHistoryEntry::CommandHistoryEntry(CommandGroup* group, Command* command, const CommandLine& parameters, size_t historyItemNr) { - mCommandGroup = group; - mExecutedCommand = command; - mParameters = parameters; + m_commandGroup = group; + m_executedCommand = command; + m_parameters = parameters; m_historyItemNr = historyItemNr; } CommandManager::CommandHistoryEntry::~CommandHistoryEntry() { - // remark: the mCommand and mCommandGroup are automatically deleted after popping from the history } AZStd::string CommandManager::CommandHistoryEntry::ToString(CommandGroup* group, Command* command, size_t historyItemNr) @@ -44,38 +43,38 @@ namespace MCore AZStd::string CommandManager::CommandHistoryEntry::ToString() const { - return ToString(mCommandGroup, mExecutedCommand, m_historyItemNr); + return ToString(m_commandGroup, m_executedCommand, m_historyItemNr); } CommandManager::CommandManager() { - mCommands.reserve(128); + m_commands.reserve(128); // set default values - mMaxHistoryEntries = 100; - mHistoryIndex = -1; + m_maxHistoryEntries = 100; + m_historyIndex = -1; m_totalNumHistoryItems = 0; // preallocate history entries - mCommandHistory.reserve(mMaxHistoryEntries); + m_commandHistory.reserve(m_maxHistoryEntries); m_commandsInExecution = 0; } CommandManager::~CommandManager() { - for (auto element : mRegisteredCommands) + for (auto element : m_registeredCommands) { Command* command = element.second; delete command; } - mRegisteredCommands.clear(); + m_registeredCommands.clear(); // remove all callbacks RemoveCallbacks(); // destroy the command history - while (!mCommandHistory.empty()) + while (!m_commandHistory.empty()) { PopCommandHistory(); } @@ -85,93 +84,93 @@ namespace MCore void CommandManager::PushCommandHistory(CommandGroup* commandGroup) { // if we reached the maximum number of history entries remove the oldest one - if (mCommandHistory.size() >= mMaxHistoryEntries) + if (m_commandHistory.size() >= m_maxHistoryEntries) { PopCommandHistory(); - mHistoryIndex = static_cast(mCommandHistory.size()) - 1; + m_historyIndex = static_cast(m_commandHistory.size()) - 1; } - if (!mCommandHistory.empty()) + if (!m_commandHistory.empty()) { // remove unneeded commandsnumToRemove - const size_t numToRemove = mCommandHistory.size() - mHistoryIndex - 1; - for (CommandManagerCallback* managerCallback : mCallbacks) + const size_t numToRemove = m_commandHistory.size() - m_historyIndex - 1; + for (CommandManagerCallback* managerCallback : m_callbacks) { for (size_t a = 0; a < numToRemove; ++a) { - managerCallback->OnRemoveCommand(mHistoryIndex + 1); + managerCallback->OnRemoveCommand(m_historyIndex + 1); } } for (size_t a = 0; a < numToRemove; ++a) { - delete mCommandHistory[mHistoryIndex + 1].mExecutedCommand; - delete mCommandHistory[mHistoryIndex + 1].mCommandGroup; - mCommandHistory.erase(mCommandHistory.begin() + mHistoryIndex + 1); + delete m_commandHistory[m_historyIndex + 1].m_executedCommand; + delete m_commandHistory[m_historyIndex + 1].m_commandGroup; + m_commandHistory.erase(m_commandHistory.begin() + m_historyIndex + 1); } } // resize the command history - mCommandHistory.resize(mHistoryIndex + 1); + m_commandHistory.resize(m_historyIndex + 1); // add a command history entry m_totalNumHistoryItems++; - mCommandHistory.push_back(CommandHistoryEntry(commandGroup, nullptr, CommandLine(), m_totalNumHistoryItems)); + m_commandHistory.push_back(CommandHistoryEntry(commandGroup, nullptr, CommandLine(), m_totalNumHistoryItems)); // increase the history index - mHistoryIndex++; + m_historyIndex++; // perform callbacks - for (CommandManagerCallback* managerCallback : mCallbacks) + for (CommandManagerCallback* managerCallback : m_callbacks) { - managerCallback->OnAddCommandToHistory(mHistoryIndex, commandGroup, nullptr, CommandLine()); + managerCallback->OnAddCommandToHistory(m_historyIndex, commandGroup, nullptr, CommandLine()); } } // save command in the history void CommandManager::PushCommandHistory(Command* command, const CommandLine& parameters) { - if (!mCommandHistory.empty()) + if (!m_commandHistory.empty()) { // if we reached the maximum number of history entries remove the oldest one - if (mCommandHistory.size() >= mMaxHistoryEntries) + if (m_commandHistory.size() >= m_maxHistoryEntries) { PopCommandHistory(); - mHistoryIndex = static_cast(mCommandHistory.size()) - 1; + m_historyIndex = static_cast(m_commandHistory.size()) - 1; } // remove unneeded commands - const size_t numToRemove = mCommandHistory.size() - mHistoryIndex - 1; - for (CommandManagerCallback* managerCallback : mCallbacks) + const size_t numToRemove = m_commandHistory.size() - m_historyIndex - 1; + for (CommandManagerCallback* managerCallback : m_callbacks) { for (size_t a = 0; a < numToRemove; ++a) { - managerCallback->OnRemoveCommand(mHistoryIndex + 1); + managerCallback->OnRemoveCommand(m_historyIndex + 1); } } for (size_t a = 0; a < numToRemove; ++a) { - delete mCommandHistory[mHistoryIndex + 1].mExecutedCommand; - delete mCommandHistory[mHistoryIndex + 1].mCommandGroup; - mCommandHistory.erase(mCommandHistory.begin() + mHistoryIndex + 1); + delete m_commandHistory[m_historyIndex + 1].m_executedCommand; + delete m_commandHistory[m_historyIndex + 1].m_commandGroup; + m_commandHistory.erase(m_commandHistory.begin() + m_historyIndex + 1); } } // resize the command history - mCommandHistory.resize(mHistoryIndex + 1); + m_commandHistory.resize(m_historyIndex + 1); // add a command history entry m_totalNumHistoryItems++; - mCommandHistory.push_back(CommandHistoryEntry(nullptr, command, parameters, m_totalNumHistoryItems)); + m_commandHistory.push_back(CommandHistoryEntry(nullptr, command, parameters, m_totalNumHistoryItems)); // increase the history index - mHistoryIndex++; + m_historyIndex++; // perform callbacks - for (CommandManagerCallback* managerCallback : mCallbacks) + for (CommandManagerCallback* managerCallback : m_callbacks) { - managerCallback->OnAddCommandToHistory(mHistoryIndex, nullptr, command, parameters); + managerCallback->OnAddCommandToHistory(m_historyIndex, nullptr, command, parameters); } } @@ -179,23 +178,23 @@ namespace MCore void CommandManager::PopCommandHistory() { // perform callbacks - for (CommandManagerCallback* managerCallback : mCallbacks) + for (CommandManagerCallback* managerCallback : m_callbacks) { managerCallback->OnRemoveCommand(0); } // destroy the command and remove it from the command history - Command* command = mCommandHistory.front().mExecutedCommand; + Command* command = m_commandHistory.front().m_executedCommand; if (command) { delete command; } else { - delete mCommandHistory.front().mCommandGroup; + delete m_commandHistory.front().m_commandGroup; } - mCommandHistory.erase(mCommandHistory.begin()); + m_commandHistory.erase(m_commandHistory.begin()); } bool CommandManager::ExecuteCommand(const AZStd::string& command, AZStd::string& outCommandResult, bool addToHistory, Command** outExecutedCommand, CommandLine* outExecutedParameters, bool callFromCommandGroup, bool clearErrors, bool handleErrors) @@ -456,7 +455,7 @@ namespace MCore ++m_commandsInExecution; // execute command manager callbacks - for (CommandManagerCallback* managerCallback : mCallbacks) + for (CommandManagerCallback* managerCallback : m_callbacks) { managerCallback->OnPreExecuteCommandGroup(&commandGroup, false); } @@ -581,25 +580,25 @@ namespace MCore delete newGroup; // execute command manager callbacks - for (CommandManagerCallback* managerCallback : mCallbacks) + for (CommandManagerCallback* managerCallback : m_callbacks) { managerCallback->OnPostExecuteCommandGroup(&commandGroup, false); } // Let the callbacks handle error reporting (e.g. show an error report window). - if (handleErrors && !mErrors.empty()) + if (handleErrors && !m_errors.empty()) { // Execute error report callbacks. - for (CommandManagerCallback* managerCallback : mCallbacks) + for (CommandManagerCallback* managerCallback : m_callbacks) { - managerCallback->OnShowErrorReport(mErrors); + managerCallback->OnShowErrorReport(m_errors); } } // Clear errors after reporting if specified. if (clearErrors) { - mErrors.clear(); + m_errors.clear(); } --m_commandsInExecution; @@ -642,19 +641,19 @@ namespace MCore } // execute command manager callbacks - for (CommandManagerCallback* managerCallback : mCallbacks) + for (CommandManagerCallback* managerCallback : m_callbacks) { managerCallback->OnPostExecuteCommandGroup(&commandGroup, true); } // Let the callbacks handle error reporting (e.g. show an error report window). - const bool errorsOccured = !mErrors.empty(); + const bool errorsOccured = !m_errors.empty(); if (handleErrors && errorsOccured) { // Execute error report callbacks. - for (CommandManagerCallback* managerCallback : mCallbacks) + for (CommandManagerCallback* managerCallback : m_callbacks) { - managerCallback->OnShowErrorReport(mErrors); + managerCallback->OnShowErrorReport(m_errors); } } @@ -665,7 +664,7 @@ namespace MCore // Clear errors after reporting if specified. if (clearErrors) { - mErrors.clear(); + m_errors.clear(); } --m_commandsInExecution; @@ -700,7 +699,7 @@ namespace MCore if (preUndo) { - for (CommandManagerCallback* managerCallback : mCallbacks) + for (CommandManagerCallback* managerCallback : m_callbacks) { managerCallback->OnPreUndoCommand(command, parameters); } @@ -717,7 +716,7 @@ namespace MCore if (!preUndo) { - for (CommandManagerCallback* managerCallback : mCallbacks) + for (CommandManagerCallback* managerCallback : m_callbacks) { managerCallback->OnPostUndoCommand(command, parameters); } @@ -762,15 +761,15 @@ namespace MCore bool CommandManager::Undo(AZStd::string& outCommandResult) { // check if we can undo - if (mCommandHistory.empty() && mHistoryIndex >= 0) + if (m_commandHistory.empty() && m_historyIndex >= 0) { outCommandResult = "Cannot undo command. The command history is empty"; return false; } // get the last called command from the command history - const CommandHistoryEntry& lastEntry = mCommandHistory[mHistoryIndex]; - Command* command = lastEntry.mExecutedCommand; + const CommandHistoryEntry& lastEntry = m_commandHistory[m_historyIndex]; + Command* command = lastEntry.m_executedCommand; ++m_commandsInExecution; @@ -779,22 +778,22 @@ namespace MCore if (command) { // execute pre-undo callbacks - ExecuteUndoCallbacks(command, lastEntry.mParameters, true); + ExecuteUndoCallbacks(command, lastEntry.m_parameters, true); // undo the command, get the result and reset it - result = command->Undo(lastEntry.mParameters, outCommandResult); + result = command->Undo(lastEntry.m_parameters, outCommandResult); // execute post-undo callbacks - ExecuteUndoCallbacks(command, lastEntry.mParameters, false); + ExecuteUndoCallbacks(command, lastEntry.m_parameters, false); } // we are dealing with a command group else { - CommandGroup* group = lastEntry.mCommandGroup; + CommandGroup* group = lastEntry.m_commandGroup; MCORE_ASSERT(group); // perform callbacks - for (CommandManagerCallback* managerCallback : mCallbacks) + for (CommandManagerCallback* managerCallback : m_callbacks) { managerCallback->OnPreExecuteCommandGroup(group, true); } @@ -827,29 +826,29 @@ namespace MCore } // perform callbacks - for (CommandManagerCallback* managerCallback : mCallbacks) + for (CommandManagerCallback* managerCallback : m_callbacks) { managerCallback->OnPostExecuteCommandGroup(group, result); } } // go one step back in the command history - mHistoryIndex--; + m_historyIndex--; // perform callbacks - for (CommandManagerCallback* managerCallback : mCallbacks) + for (CommandManagerCallback* managerCallback : m_callbacks) { - managerCallback->OnSetCurrentCommand(mHistoryIndex); + managerCallback->OnSetCurrentCommand(m_historyIndex); } // Let the callbacks handle error reporting (e.g. show an error report window). - if (!mErrors.empty()) + if (!m_errors.empty()) { - for (CommandManagerCallback* managerCallback : mCallbacks) + for (CommandManagerCallback* managerCallback : m_callbacks) { - managerCallback->OnShowErrorReport(mErrors); + managerCallback->OnShowErrorReport(m_errors); } - mErrors.clear(); + m_errors.clear(); } --m_commandsInExecution; @@ -860,23 +859,16 @@ namespace MCore // redo the last undoed command bool CommandManager::Redo(AZStd::string& outCommandResult) { - /* // check if there are still commands to undo in the history - if (mHistoryIndex >= mCommandHistory.GetLength()) - { - outCommandResult = "Cannot redo command. Either the history is empty or the history index is out of range."; - return false; - }*/ - // get the last called command from the command history - const CommandHistoryEntry& lastEntry = mCommandHistory[mHistoryIndex + 1]; + const CommandHistoryEntry& lastEntry = m_commandHistory[m_historyIndex + 1]; // if we just redo one single command bool result = true; - if (lastEntry.mExecutedCommand) + if (lastEntry.m_executedCommand) { // redo the command, get the result and reset it - result = ExecuteCommand(lastEntry.mExecutedCommand, - lastEntry.mParameters, + result = ExecuteCommand(lastEntry.m_executedCommand, + lastEntry.m_parameters, outCommandResult, /*addToHistory=*/false, /*callFromCommandGroup=*/false, @@ -888,10 +880,10 @@ namespace MCore else { ++m_commandsInExecution; - CommandGroup* group = lastEntry.mCommandGroup; + CommandGroup* group = lastEntry.m_commandGroup; AZ_Assert(group, "Cannot redo. Command group is not valid."); - for (CommandManagerCallback* managerCallback : mCallbacks) + for (CommandManagerCallback* managerCallback : m_callbacks) { managerCallback->OnPreExecuteCommandGroup(group, false); } @@ -917,29 +909,29 @@ namespace MCore } --m_commandsInExecution; - for (CommandManagerCallback* managerCallback : mCallbacks) + for (CommandManagerCallback* managerCallback : m_callbacks) { managerCallback->OnPostExecuteCommandGroup(group, result); } } // go one step forward in the command history - mHistoryIndex++; + m_historyIndex++; // perform callbacks - for (CommandManagerCallback* managerCallback : mCallbacks) + for (CommandManagerCallback* managerCallback : m_callbacks) { - managerCallback->OnSetCurrentCommand(mHistoryIndex); + managerCallback->OnSetCurrentCommand(m_historyIndex); } // Let the callbacks handle error reporting (e.g. show an error report window). - if (!mErrors.empty()) + if (!m_errors.empty()) { - for (CommandManagerCallback* managerCallback : mCallbacks) + for (CommandManagerCallback* managerCallback : m_callbacks) { - managerCallback->OnShowErrorReport(mErrors); + managerCallback->OnShowErrorReport(m_errors); } - mErrors.clear(); + m_errors.clear(); } return result; @@ -970,17 +962,17 @@ namespace MCore } // add the command to the hash table - mRegisteredCommands.insert(AZStd::make_pair(command->GetNameString(), command)); + m_registeredCommands.insert(AZStd::make_pair(command->GetNameString(), command)); // we're going to insert the command in a sorted way now bool found = false; - const size_t numCommands = mCommands.size(); + const size_t numCommands = m_commands.size(); for (size_t i = 0; i < numCommands; ++i) { - if (azstricmp(mCommands[i]->GetName(), command->GetName()) > 0) + if (azstricmp(m_commands[i]->GetName(), command->GetName()) > 0) { found = true; - mCommands.insert(mCommands.begin() + i, command); + m_commands.insert(m_commands.begin() + i, command); break; } } @@ -988,7 +980,7 @@ namespace MCore // if no insert location has been found, add it to the back of the array if (!found) { - mCommands.push_back(command); + m_commands.push_back(command); } // initialize the command syntax @@ -1000,8 +992,8 @@ namespace MCore Command* CommandManager::FindCommand(const AZStd::string& commandName) { - auto iterator = mRegisteredCommands.find(commandName); - if (iterator == mRegisteredCommands.end()) + auto iterator = m_registeredCommands.find(commandName); + if (iterator == m_registeredCommands.end()) { return nullptr; } @@ -1046,7 +1038,7 @@ namespace MCore } // execute command manager callbacks - for (CommandManagerCallback* managerCallback : mCallbacks) + for (CommandManagerCallback* managerCallback : m_callbacks) { managerCallback->OnPreExecuteCommand(nullptr, command, commandLine); } @@ -1081,25 +1073,25 @@ namespace MCore } // execute all post execute callbacks - for (CommandManagerCallback* managerCallback : mCallbacks) + for (CommandManagerCallback* managerCallback : m_callbacks) { managerCallback->OnPostExecuteCommand(nullptr, command, commandLine, result, outCommandResult); } // Let the callbacks handle error reporting (e.g. show an error report window). - if (handleErrors && !mErrors.empty()) + if (handleErrors && !m_errors.empty()) { // Execute error report callbacks. - for (CommandManagerCallback* managerCallback : mCallbacks) + for (CommandManagerCallback* managerCallback : m_callbacks) { - managerCallback->OnShowErrorReport(mErrors); + managerCallback->OnShowErrorReport(m_errors); } } // Clear errors after reporting if specified. if (clearErrors) { - mErrors.clear(); + m_errors.clear(); } #ifdef MCORE_COMMANDMANAGER_PERFORMANCE @@ -1124,14 +1116,14 @@ namespace MCore LogDetailedInfo("----------------------------------"); // get the number of entries in the command history - const size_t numHistoryEntries = mCommandHistory.size(); + const size_t numHistoryEntries = m_commandHistory.size(); LogDetailedInfo("Command History (%d entries) - oldest (top entry) to newest (bottom entry):", numHistoryEntries); // print the command history entries for (size_t i = 0; i < numHistoryEntries; ++i) { - AZStd::string text = AZStd::string::format("%.3zu: name='%s', num parameters=%zu", i, mCommandHistory[i].mExecutedCommand->GetName(), mCommandHistory[i].mParameters.GetNumParameters()); - if (i == mHistoryIndex) + AZStd::string text = AZStd::string::format("%.3zu: name='%s', num parameters=%zu", i, m_commandHistory[i].m_executedCommand->GetName(), m_commandHistory[i].m_parameters.GetNumParameters()); + if (i == m_historyIndex) { LogDetailedInfo("-> %s", text.c_str()); } @@ -1146,22 +1138,22 @@ namespace MCore void CommandManager::RemoveCallbacks() { - for (CommandManagerCallback* managerCallback : mCallbacks) + for (CommandManagerCallback* managerCallback : m_callbacks) { delete managerCallback; } - mCallbacks.clear(); + m_callbacks.clear(); } void CommandManager::RegisterCallback(CommandManagerCallback* callback) { - mCallbacks.push_back(callback); + m_callbacks.push_back(callback); } void CommandManager::RemoveCallback(CommandManagerCallback* callback, bool delFromMem) { - mCallbacks.erase(AZStd::remove(mCallbacks.begin(), mCallbacks.end(), callback), mCallbacks.end()); + m_callbacks.erase(AZStd::remove(m_callbacks.begin(), m_callbacks.end(), callback), m_callbacks.end()); if (delFromMem) { @@ -1171,83 +1163,83 @@ namespace MCore size_t CommandManager::GetNumCallbacks() const { - return mCallbacks.size(); + return m_callbacks.size(); } CommandManagerCallback* CommandManager::GetCallback(size_t index) { - return mCallbacks[index]; + return m_callbacks[index]; } // set the max num history items void CommandManager::SetMaxHistoryItems(size_t maxItems) { maxItems = AZStd::max(size_t{1}, maxItems); - mMaxHistoryEntries = maxItems; + m_maxHistoryEntries = maxItems; - while (mCommandHistory.size() > mMaxHistoryEntries) + while (m_commandHistory.size() > m_maxHistoryEntries) { PopCommandHistory(); - mHistoryIndex = static_cast(mCommandHistory.size()) - 1; + m_historyIndex = static_cast(m_commandHistory.size()) - 1; } } size_t CommandManager::GetMaxHistoryItems() const { - return mMaxHistoryEntries; + return m_maxHistoryEntries; } ptrdiff_t CommandManager::GetHistoryIndex() const { - return mHistoryIndex; + return m_historyIndex; } size_t CommandManager::GetNumHistoryItems() const { - return mCommandHistory.size(); + return m_commandHistory.size(); } const CommandManager::CommandHistoryEntry& CommandManager::GetHistoryItem(size_t index) const { - return mCommandHistory[index]; + return m_commandHistory[index]; } Command* CommandManager::GetHistoryCommand(size_t historyIndex) { - return mCommandHistory[historyIndex].mExecutedCommand; + return m_commandHistory[historyIndex].m_executedCommand; } void CommandManager::ClearHistory() { // clear the command history - while (!mCommandHistory.empty()) + while (!m_commandHistory.empty()) { PopCommandHistory(); } // reset the history index - mHistoryIndex = -1; + m_historyIndex = -1; } const CommandLine& CommandManager::GetHistoryCommandLine(size_t historyIndex) const { - return mCommandHistory[historyIndex].mParameters; + return m_commandHistory[historyIndex].m_parameters; } size_t CommandManager::GetNumRegisteredCommands() const { - return mCommands.size(); + return m_commands.size(); } Command* CommandManager::GetCommand(size_t index) { - return mCommands[index]; + return m_commands[index]; } // delete the given callback from all commands void CommandManager::RemoveCommandCallback(Command::Callback* callback, bool delFromMem) { - for (Command* command : mCommands) + for (Command* command : m_commands) { command->RemoveCallback(callback, false); // false = don't delete from memory } @@ -1297,18 +1289,18 @@ namespace MCore bool CommandManager::ShowErrorReport() { // Let the callbacks handle error reporting (e.g. show an error report window). - const bool errorsOccured = !mErrors.empty(); + const bool errorsOccured = !m_errors.empty(); if (errorsOccured) { // Execute error report callbacks. - for (CommandManagerCallback* managerCallback : mCallbacks) + for (CommandManagerCallback* managerCallback : m_callbacks) { - managerCallback->OnShowErrorReport(mErrors); + managerCallback->OnShowErrorReport(m_errors); } } // clear errors after reporting - mErrors.clear(); + m_errors.clear(); return errorsOccured; } diff --git a/Gems/EMotionFX/Code/MCore/Source/MCoreCommandManager.h b/Gems/EMotionFX/Code/MCore/Source/MCoreCommandManager.h index 566c3d17fd..d59639dee5 100644 --- a/Gems/EMotionFX/Code/MCore/Source/MCoreCommandManager.h +++ b/Gems/EMotionFX/Code/MCore/Source/MCoreCommandManager.h @@ -38,9 +38,9 @@ namespace MCore struct MCORE_API CommandHistoryEntry { CommandHistoryEntry() - : mCommandGroup(nullptr) - , mExecutedCommand(nullptr) - , mParameters(nullptr) {} + : m_commandGroup(nullptr) + , m_executedCommand(nullptr) + , m_parameters(nullptr) {} /** * Extended Constructor. @@ -55,9 +55,9 @@ namespace MCore static AZStd::string ToString(CommandGroup* group, Command* command, size_t historyItemNr); AZStd::string ToString() const; - CommandGroup* mCommandGroup; /**< A pointer to the command group, or nullptr when no group is used (in that case it uses a single command). */ - Command* mExecutedCommand; /**< A pointer to the command object, or nullptr when no command is used (in that case it uses a group). */ - CommandLine mParameters; /**< The used command arguments, unused in case no command is used (in that case it uses a group). */ + CommandGroup* m_commandGroup; /**< A pointer to the command group, or nullptr when no group is used (in that case it uses a single command). */ + Command* m_executedCommand; /**< A pointer to the command object, or nullptr when no command is used (in that case it uses a group). */ + CommandLine m_parameters; /**< The used command arguments, unused in case no command is used (in that case it uses a group). */ size_t m_historyItemNr; /**< The global history item number. This number will neither change depending on the size of the history queue nor with undo/redo. */ }; @@ -280,8 +280,8 @@ namespace MCore * Add error message to the internal callback based error handling system. * @param[in] errorLine The error line to add to the internal error handler. */ - MCORE_INLINE void AddError(const char* errorLine) { mErrors.push_back(errorLine); } - MCORE_INLINE void AddError(const AZStd::string& errorLine) { mErrors.push_back(errorLine); } + MCORE_INLINE void AddError(const char* errorLine) { m_errors.push_back(errorLine); } + MCORE_INLINE void AddError(const AZStd::string& errorLine) { m_errors.push_back(errorLine); } /** * Checks if an error occurred and calls the error handling callbacks. @@ -296,13 +296,13 @@ namespace MCore bool IsExecuting() const { return m_commandsInExecution > 0; } protected: - AZStd::unordered_map mRegisteredCommands; /**< A hash table storing the command objects for fast command object access. */ - AZStd::vector mCommandHistory; /**< The command history stack for undo/redo functionality. */ - AZStd::vector mCallbacks; /**< The command manager callbacks. */ - AZStd::vector mErrors; /**< List of errors that happened during command execution. */ - AZStd::vector mCommands; /**< A flat array of registered commands, for easy traversal. */ - size_t mMaxHistoryEntries; /**< The maximum remembered commands in the command history. */ - ptrdiff_t mHistoryIndex; /**< The command history iterator. The current position in the undo/redo history. */ + AZStd::unordered_map m_registeredCommands; /**< A hash table storing the command objects for fast command object access. */ + AZStd::vector m_commandHistory; /**< The command history stack for undo/redo functionality. */ + AZStd::vector m_callbacks; /**< The command manager callbacks. */ + AZStd::vector m_errors; /**< List of errors that happened during command execution. */ + AZStd::vector m_commands; /**< A flat array of registered commands, for easy traversal. */ + size_t m_maxHistoryEntries; /**< The maximum remembered commands in the command history. */ + ptrdiff_t m_historyIndex; /**< The command history iterator. The current position in the undo/redo history. */ size_t m_totalNumHistoryItems; /**< The number of history items since the application start. This number will neither change depending on the size of the history queue nor with undo/redo. */ int m_commandsInExecution; /**< The number of commands currently in execution. */ diff --git a/Gems/EMotionFX/Code/MCore/Source/MCoreSystem.cpp b/Gems/EMotionFX/Code/MCore/Source/MCoreSystem.cpp index f981a825c4..e84c7a9ff7 100644 --- a/Gems/EMotionFX/Code/MCore/Source/MCoreSystem.cpp +++ b/Gems/EMotionFX/Code/MCore/Source/MCoreSystem.cpp @@ -27,10 +27,10 @@ namespace MCore Initializer::InitSettings::InitSettings() { - mMemAllocFunction = StandardAllocate; - mMemReallocFunction = StandardRealloc; - mMemFreeFunction = StandardFree; - mTrackMemoryUsage = false; // do not track memory usage on default, for maximum performance and pretty much zero tracking overhead + m_memAllocFunction = StandardAllocate; + m_memReallocFunction = StandardRealloc; + m_memFreeFunction = StandardFree; + m_trackMemoryUsage = false; // do not track memory usage on default, for maximum performance and pretty much zero tracking overhead } // static main init method @@ -47,7 +47,7 @@ namespace MCore { // create the main core object using placement new gMCore = AZ::Environment::CreateVariable(kMCoreInstanceVarName); - gMCore.Set(new(realSettings->mMemAllocFunction(sizeof(MCoreSystem), MCORE_MEMCATEGORY_MCORESYSTEM, 0, MCORE_FILE, MCORE_LINE))MCoreSystem()); + gMCore.Set(new(realSettings->m_memAllocFunction(sizeof(MCoreSystem), MCORE_MEMCATEGORY_MCORESYSTEM, 0, MCORE_FILE, MCORE_LINE))MCoreSystem()); } else { @@ -81,19 +81,19 @@ namespace MCore // constructor MCoreSystem::MCoreSystem() - : mAllocateFunction(StandardAllocate) - , mReallocFunction(StandardRealloc) - , mFreeFunction(StandardFree) + : m_allocateFunction(StandardAllocate) + , m_reallocFunction(StandardRealloc) + , m_freeFunction(StandardFree) { - mLogManager = nullptr; - mIDGenerator = nullptr; - mStringIdPool = nullptr; - mAttributeFactory = nullptr; - mMemoryTracker = nullptr; - mMemTempBuffer = nullptr; - mMemTempBufferSize = 0; - mTrackMemory = true; - mMemoryMutex = new Mutex(); + m_logManager = nullptr; + m_idGenerator = nullptr; + m_stringIdPool = nullptr; + m_attributeFactory = nullptr; + m_memoryTracker = nullptr; + m_memTempBuffer = nullptr; + m_memTempBufferSize = 0; + m_trackMemory = true; + m_memoryMutex = new Mutex(); } @@ -107,45 +107,45 @@ namespace MCore // init the mcore system bool MCoreSystem::Init(const MCore::Initializer::InitSettings& settings) { - if (settings.mMemAllocFunction) + if (settings.m_memAllocFunction) { - mAllocateFunction = settings.mMemAllocFunction; + m_allocateFunction = settings.m_memAllocFunction; } else { - mAllocateFunction = StandardAllocate; + m_allocateFunction = StandardAllocate; } - if (settings.mMemReallocFunction) + if (settings.m_memReallocFunction) { - mReallocFunction = settings.mMemReallocFunction; + m_reallocFunction = settings.m_memReallocFunction; } else { - mReallocFunction = StandardRealloc; + m_reallocFunction = StandardRealloc; } - if (settings.mMemFreeFunction) + if (settings.m_memFreeFunction) { - mFreeFunction = settings.mMemFreeFunction; + m_freeFunction = settings.m_memFreeFunction; } else { - mFreeFunction = StandardFree; + m_freeFunction = StandardFree; } // allocate new objects - mMemoryTracker = new MemoryTracker(); - mTrackMemory = settings.mTrackMemoryUsage; - mLogManager = new LogManager(); - mIDGenerator = new IDGenerator(); - mStringIdPool = new StringIdPool(); - mAttributeFactory = new AttributeFactory(); - mMemTempBufferSize = 256 * 1024; - mMemTempBuffer = Allocate(mMemTempBufferSize, MCORE_MEMCATEGORY_SYSTEM);// 256 kb - MCORE_ASSERT(mMemTempBuffer); + m_memoryTracker = new MemoryTracker(); + m_trackMemory = settings.m_trackMemoryUsage; + m_logManager = new LogManager(); + m_idGenerator = new IDGenerator(); + m_stringIdPool = new StringIdPool(); + m_attributeFactory = new AttributeFactory(); + m_memTempBufferSize = 256 * 1024; + m_memTempBuffer = Allocate(m_memTempBufferSize, MCORE_MEMCATEGORY_SYSTEM);// 256 kb + MCORE_ASSERT(m_memTempBuffer); - if (mTrackMemory) + if (m_trackMemory) { - RegisterMemoryCategories(*mMemoryTracker); + RegisterMemoryCategories(*m_memoryTracker); } return true; @@ -156,41 +156,41 @@ namespace MCore void MCoreSystem::Shutdown() { // free any mem temp buffer - MCore::Free(mMemTempBuffer); - mMemTempBuffer = nullptr; - mMemTempBufferSize = 0; + MCore::Free(m_memTempBuffer); + m_memTempBuffer = nullptr; + m_memTempBufferSize = 0; // shutdown the log manager - delete mLogManager; - mLogManager = nullptr; + delete m_logManager; + m_logManager = nullptr; // delete the ID generator - delete mIDGenerator; - mIDGenerator = nullptr; + delete m_idGenerator; + m_idGenerator = nullptr; // Delete the string based ID generator. - delete mStringIdPool; - mStringIdPool = nullptr; + delete m_stringIdPool; + m_stringIdPool = nullptr; // delete the attribute factory - delete mAttributeFactory; - mAttributeFactory = nullptr; + delete m_attributeFactory; + m_attributeFactory = nullptr; // Clear the memory of the file system secure save path. - FileSystem::mSecureSavePath.clear(); + FileSystem::s_secureSavePath.clear(); // log memory leaks - if (mTrackMemory) + if (m_trackMemory) { - mMemoryTracker->LogLeaks(); + m_memoryTracker->LogLeaks(); } // delete the memory tracker - delete mMemoryTracker; - mMemoryTracker = nullptr; + delete m_memoryTracker; + m_memoryTracker = nullptr; - delete mMemoryMutex; - mMemoryMutex = nullptr; + delete m_memoryMutex; + m_memoryMutex = nullptr; } @@ -198,25 +198,25 @@ namespace MCore void MCoreSystem::MemTempBufferAssureSize(size_t numBytes) { // if the buffer is already big enough, we can just return - if (mMemTempBufferSize >= numBytes) + if (m_memTempBufferSize >= numBytes) { return; } // resize the buffer (make it bigger) - mMemTempBuffer = Realloc(mMemTempBuffer, numBytes, MCORE_MEMCATEGORY_SYSTEM); - MCORE_ASSERT(mMemTempBuffer); + m_memTempBuffer = Realloc(m_memTempBuffer, numBytes, MCORE_MEMCATEGORY_SYSTEM); + MCORE_ASSERT(m_memTempBuffer); - mMemTempBufferSize = numBytes; + m_memTempBufferSize = numBytes; } // free the temp buffer void MCoreSystem::MemTempBufferFree() { - MCore::Free(mMemTempBuffer); - mMemTempBuffer = nullptr; - mMemTempBufferSize = 0; + MCore::Free(m_memTempBuffer); + m_memTempBuffer = nullptr; + m_memTempBufferSize = 0; } diff --git a/Gems/EMotionFX/Code/MCore/Source/MCoreSystem.h b/Gems/EMotionFX/Code/MCore/Source/MCoreSystem.h index 11fdc79988..496198c430 100644 --- a/Gems/EMotionFX/Code/MCore/Source/MCoreSystem.h +++ b/Gems/EMotionFX/Code/MCore/Source/MCoreSystem.h @@ -38,10 +38,10 @@ namespace MCore public: struct MCORE_API InitSettings { - AllocateCallback mMemAllocFunction; /**< The memory allocation function, defaults to nullptr, which means the standard malloc function will be used. */ - ReallocCallback mMemReallocFunction; /**< The memory reallocation function, defaults to nullptr, which means the standard realloc function will be used. */ - FreeCallback mMemFreeFunction; /**< The memory free function, defaults to nullptr, which means the standard free function will be used. */ - bool mTrackMemoryUsage; /**< Enable this to track memory usage statistics. This has a bit of an impact on memory allocation and release speed and memory usage though. You should really only use this in debug mode. On default it is disabled. */ + AllocateCallback m_memAllocFunction; /**< The memory allocation function, defaults to nullptr, which means the standard malloc function will be used. */ + ReallocCallback m_memReallocFunction; /**< The memory reallocation function, defaults to nullptr, which means the standard realloc function will be used. */ + FreeCallback m_memFreeFunction; /**< The memory free function, defaults to nullptr, which means the standard free function will be used. */ + bool m_trackMemoryUsage; /**< Enable this to track memory usage statistics. This has a bit of an impact on memory allocation and release speed and memory usage though. You should really only use this in debug mode. On default it is disabled. */ InitSettings(); }; @@ -80,59 +80,59 @@ namespace MCore * Get the log manager. * @result A reference to the log manager. */ - MCORE_INLINE LogManager& GetLogManager() { return *mLogManager; } + MCORE_INLINE LogManager& GetLogManager() { return *m_logManager; } /** * Get the ID generator. * @result A reference to the ID generator. */ - MCORE_INLINE IDGenerator& GetIDGenerator() { return *mIDGenerator; } + MCORE_INLINE IDGenerator& GetIDGenerator() { return *m_idGenerator; } /** * Get the string based ID generator. * @result A reference to the string based ID generator. */ - MCORE_INLINE StringIdPool& GetStringIdPool() { return *mStringIdPool; } + MCORE_INLINE StringIdPool& GetStringIdPool() { return *m_stringIdPool; } /** * Get the attribute factory. * @result A reference to the attribute factory, which is used to create attributes of a certain type. */ - MCORE_INLINE AttributeFactory& GetAttributeFactory() { return *mAttributeFactory; } + MCORE_INLINE AttributeFactory& GetAttributeFactory() { return *m_attributeFactory; } /** * Get the memory tracker. * @result A reference to the memory tracker, which can be used to track memory allocations and usage. */ - MCORE_INLINE MemoryTracker& GetMemoryTracker() { return *mMemoryTracker; } - MCORE_INLINE bool GetIsTrackingMemory() const { return mTrackMemory; } + MCORE_INLINE MemoryTracker& GetMemoryTracker() { return *m_memoryTracker; } + MCORE_INLINE bool GetIsTrackingMemory() const { return m_trackMemory; } - MCORE_INLINE void* GetMemTempBuffer() { return mMemTempBuffer; } - MCORE_INLINE size_t GetMemTempBufferSize() const { return mMemTempBufferSize; } + MCORE_INLINE void* GetMemTempBuffer() { return m_memTempBuffer; } + MCORE_INLINE size_t GetMemTempBufferSize() const { return m_memTempBufferSize; } void MemTempBufferAssureSize(size_t numBytes); void MemTempBufferFree(); void RegisterMemoryCategories(MemoryTracker& memTracker); - MCORE_INLINE Mutex& GetMemoryMutex() { return *mMemoryMutex; } + MCORE_INLINE Mutex& GetMemoryMutex() { return *m_memoryMutex; } - MCORE_INLINE AllocateCallback GetAllocateFunction() { return mAllocateFunction; } - MCORE_INLINE ReallocCallback GetReallocFunction() { return mReallocFunction; } - MCORE_INLINE FreeCallback GetFreeFunction() { return mFreeFunction; } + MCORE_INLINE AllocateCallback GetAllocateFunction() { return m_allocateFunction; } + MCORE_INLINE ReallocCallback GetReallocFunction() { return m_reallocFunction; } + MCORE_INLINE FreeCallback GetFreeFunction() { return m_freeFunction; } private: - LogManager* mLogManager; /**< The log manager. */ - IDGenerator* mIDGenerator; /**< The ID generator. */ - StringIdPool* mStringIdPool; /**< The string based ID generator. */ - AttributeFactory* mAttributeFactory; /**< The attribute factory. */ - MemoryTracker* mMemoryTracker; /**< The memory tracker. */ - Mutex* mMemoryMutex; - AllocateCallback mAllocateFunction; - ReallocCallback mReallocFunction; - FreeCallback mFreeFunction; - void* mMemTempBuffer; /**< A buffer with temp memory, used by the MCore::AlignedRealloc, to assure data integrity after reallocating memory. */ - size_t mMemTempBufferSize; /**< The size in bytes, of the MemTempBuffer. */ - bool mTrackMemory; /**< Check if we want to track memory or not. */ + LogManager* m_logManager; /**< The log manager. */ + IDGenerator* m_idGenerator; /**< The ID generator. */ + StringIdPool* m_stringIdPool; /**< The string based ID generator. */ + AttributeFactory* m_attributeFactory; /**< The attribute factory. */ + MemoryTracker* m_memoryTracker; /**< The memory tracker. */ + Mutex* m_memoryMutex; + AllocateCallback m_allocateFunction; + ReallocCallback m_reallocFunction; + FreeCallback m_freeFunction; + void* m_memTempBuffer; /**< A buffer with temp memory, used by the MCore::AlignedRealloc, to assure data integrity after reallocating memory. */ + size_t m_memTempBufferSize; /**< The size in bytes, of the MemTempBuffer. */ + bool m_trackMemory; /**< Check if we want to track memory or not. */ /** * The constructor. diff --git a/Gems/EMotionFX/Code/MCore/Source/Matrix4.cpp b/Gems/EMotionFX/Code/MCore/Source/Matrix4.cpp index 229f67ec0c..f454df04ab 100644 --- a/Gems/EMotionFX/Code/MCore/Source/Matrix4.cpp +++ b/Gems/EMotionFX/Code/MCore/Source/Matrix4.cpp @@ -86,9 +86,9 @@ namespace MCore Matrix r; #if (AZ_TRAIT_USE_PLATFORM_SIMD_SSE && defined(MCORE_MATRIX_ROWMAJOR)) - const float* m = right.m16; - const float* n = m16; - float* t = r.m16; + const float* m = right.m_m16; + const float* n = m_m16; + float* t = r.m_m16; __m128 x0; __m128 x1; @@ -211,9 +211,9 @@ namespace MCore Matrix& Matrix::operator *= (const Matrix& right) { #if (AZ_TRAIT_USE_PLATFORM_SIMD_SSE && defined(MCORE_MATRIX_ROWMAJOR)) - const float* m = right.m16; - const float* n = m16; - float* t = this->m16; + const float* m = right.m_m16; + const float* n = m_m16; + float* t = this->m_m16; __m128 x0; __m128 x1; @@ -687,9 +687,9 @@ namespace MCore void Matrix::MultMatrix(const Matrix& right) { #if (AZ_TRAIT_USE_PLATFORM_SIMD_SSE && defined(MCORE_MATRIX_ROWMAJOR)) - const float* m = right.m16; - const float* n = m16; - float* t = this->m16; + const float* m = right.m_m16; + const float* n = m_m16; + float* t = this->m_m16; __m128 x0; __m128 x1; @@ -1246,9 +1246,9 @@ namespace MCore void Matrix::MultMatrix4x3(const Matrix& right) { #if (AZ_TRAIT_USE_PLATFORM_SIMD_SSE && defined(MCORE_MATRIX_ROWMAJOR)) - const float* m = right.m16; - const float* n = m16; - float* t = this->m16; + const float* m = right.m_m16; + const float* n = m_m16; + float* t = this->m_m16; __m128 x0; __m128 x1; @@ -1336,9 +1336,9 @@ namespace MCore void Matrix::MultMatrix(const Matrix& left, const Matrix& right) { #if (AZ_TRAIT_USE_PLATFORM_SIMD_SSE && defined(MCORE_MATRIX_ROWMAJOR)) - const float* m = right.m16; - const float* n = left.m16; - float* t = this->m16; + const float* m = right.m_m16; + const float* n = left.m_m16; + float* t = this->m_m16; __m128 x0; __m128 x1; @@ -1423,9 +1423,9 @@ namespace MCore void Matrix::MultMatrix4x3(const Matrix& left, const Matrix& right) { #if (AZ_TRAIT_USE_PLATFORM_SIMD_SSE && defined(MCORE_MATRIX_ROWMAJOR)) - const float* m = right.m16; - const float* n = left.m16; - float* t = this->m16; + const float* m = right.m_m16; + const float* n = left.m_m16; + float* t = this->m_m16; __m128 x0; __m128 x1; @@ -2052,10 +2052,10 @@ namespace MCore void Matrix::Log() const { MCore::LogDetailedInfo(""); - MCore::LogDetailedInfo("(%.8f, %.8f, %.8f, %.8f)", m16[0], m16[1], m16[2], m16[3]); - MCore::LogDetailedInfo("(%.8f, %.8f, %.8f, %.8f)", m16[4], m16[5], m16[6], m16[7]); - MCore::LogDetailedInfo("(%.8f, %.8f, %.8f, %.8f)", m16[8], m16[9], m16[10], m16[11]); - MCore::LogDetailedInfo("(%.8f, %.8f, %.8f, %.8f)", m16[12], m16[13], m16[14], m16[15]); + MCore::LogDetailedInfo("(%.8f, %.8f, %.8f, %.8f)", m_m16[0], m_m16[1], m_m16[2], m_m16[3]); + MCore::LogDetailedInfo("(%.8f, %.8f, %.8f, %.8f)", m_m16[4], m_m16[5], m_m16[6], m_m16[7]); + MCore::LogDetailedInfo("(%.8f, %.8f, %.8f, %.8f)", m_m16[8], m_m16[9], m_m16[10], m_m16[11]); + MCore::LogDetailedInfo("(%.8f, %.8f, %.8f, %.8f)", m_m16[12], m_m16[13], m_m16[14], m_m16[15]); MCore::LogDetailedInfo(""); } diff --git a/Gems/EMotionFX/Code/MCore/Source/Matrix4.h b/Gems/EMotionFX/Code/MCore/Source/Matrix4.h index 4be819bcc1..c136aa824e 100644 --- a/Gems/EMotionFX/Code/MCore/Source/Matrix4.h +++ b/Gems/EMotionFX/Code/MCore/Source/Matrix4.h @@ -84,7 +84,7 @@ namespace MCore * The number of elements stored at the float pointer location that is used as parameter must be at least 16 floats in size. * @param elementData A pointer to the matrix float data, which must be 16 floats in size, or more, although only the first 16 floats are used. */ - MCORE_INLINE explicit Matrix(const float* elementData) { MCore::MemCopy(m16, elementData, sizeof(float) * 16); } + MCORE_INLINE explicit Matrix(const float* elementData) { MCore::MemCopy(m_m16, elementData, sizeof(float) * 16); } /** * Copy constructor. @@ -779,7 +779,7 @@ namespace MCore AZ::Matrix4x4 ToAzMatrix() const { #ifdef MCORE_MATRIX_ROWMAJOR - return AZ::Matrix4x4::CreateFromRowMajorFloat16(m16); + return AZ::Matrix4x4::CreateFromRowMajorFloat16(m_m16); #else return AZ::Matrix4x4::CreateFromColumnMajorFloat16(m16); #endif @@ -907,7 +907,7 @@ namespace MCore // attributes union { - float m16[16]; // 16 floats as 1D array + float m_m16[16]; // 16 floats as 1D array float m44[4][4]; // as 2D array }; } MCORE_ALIGN_POST(16); diff --git a/Gems/EMotionFX/Code/MCore/Source/Matrix4.inl b/Gems/EMotionFX/Code/MCore/Source/Matrix4.inl index 67f550c2d5..99900abcee 100644 --- a/Gems/EMotionFX/Code/MCore/Source/Matrix4.inl +++ b/Gems/EMotionFX/Code/MCore/Source/Matrix4.inl @@ -8,13 +8,13 @@ MCORE_INLINE Matrix::Matrix(const Matrix& m) { - MCore::MemCopy(m16, m.m16, sizeof(Matrix)); + MCore::MemCopy(m_m16, m.m_m16, sizeof(Matrix)); } MCORE_INLINE void Matrix::operator = (const Matrix& right) { - MCore::MemCopy(m16, right.m16, sizeof(Matrix)); + MCore::MemCopy(m_m16, right.m_m16, sizeof(Matrix)); } @@ -301,7 +301,7 @@ MCORE_INLINE Matrix& Matrix::operator *= (float value) { for (uint32 i = 0; i < 16; ++i) { - m16[i] *= value; + m_m16[i] *= value; } return *this; diff --git a/Gems/EMotionFX/Code/MCore/Source/MemoryFile.cpp b/Gems/EMotionFX/Code/MCore/Source/MemoryFile.cpp index 09021a105a..f90336ea5d 100644 --- a/Gems/EMotionFX/Code/MCore/Source/MemoryFile.cpp +++ b/Gems/EMotionFX/Code/MCore/Source/MemoryFile.cpp @@ -24,25 +24,25 @@ namespace MCore // try to open the memory location bool MemoryFile::Open(uint8* memoryStart, size_t length) { - mMemoryStart = memoryStart; - mCurrentPos = memoryStart; - mLength = length; - mUsedLength = length; - mPreAllocSize = 1024; // pre-allocate 1 extra KB + m_memoryStart = memoryStart; + m_currentPos = memoryStart; + m_length = length; + m_usedLength = length; + m_preAllocSize = 1024; // pre-allocate 1 extra KB // if we need to create a new memory block if (memoryStart == nullptr) { - mAllocate = true; + m_allocate = true; if (length > 0) { - mMemoryStart = (uint8*)MCore::Allocate(length, MCORE_MEMCATEGORY_MEMORYFILE); - mCurrentPos = mMemoryStart; + m_memoryStart = (uint8*)MCore::Allocate(length, MCORE_MEMCATEGORY_MEMORYFILE); + m_currentPos = m_memoryStart; } } else { - mAllocate = false; + m_allocate = false; } return true; @@ -53,15 +53,15 @@ namespace MCore void MemoryFile::Close() { // get rid of the allocated memory - if (mAllocate) + if (m_allocate) { - MCore::Free(mMemoryStart); + MCore::Free(m_memoryStart); } - mMemoryStart = nullptr; - mCurrentPos = nullptr; - mLength = 0; - mUsedLength = 0; + m_memoryStart = nullptr; + m_currentPos = nullptr; + m_length = 0; + m_usedLength = 0; } @@ -73,7 +73,7 @@ namespace MCore bool MemoryFile::GetIsOpen() const { - return (mMemoryStart != nullptr); + return (m_memoryStart != nullptr); } @@ -87,8 +87,8 @@ namespace MCore // returns the next byte in the file uint8 MemoryFile::GetNextByte() { - uint8 value = *mCurrentPos; - mCurrentPos++; + uint8 value = *m_currentPos; + m_currentPos++; return value; } @@ -96,7 +96,7 @@ namespace MCore // returns the position (offset) in the file in bytes size_t MemoryFile::GetPos() const { - return (size_t)(mCurrentPos - mMemoryStart); + return (size_t)(m_currentPos - m_memoryStart); } @@ -111,13 +111,13 @@ namespace MCore // seek a given number of bytes ahead from it's current position bool MemoryFile::Forward(size_t numBytes) { - uint8* newPos = mCurrentPos + numBytes; - if (newPos > (mMemoryStart + mLength)) + uint8* newPos = m_currentPos + numBytes; + if (newPos > (m_memoryStart + m_length)) { return false; } - mCurrentPos = newPos; + m_currentPos = newPos; return true; } @@ -125,12 +125,12 @@ namespace MCore // seek to an absolute position in the file (offset in bytes) bool MemoryFile::Seek(size_t offset) { - if (offset > mLength) + if (offset > m_length) { return false; } - mCurrentPos = mMemoryStart + offset; + m_currentPos = m_memoryStart + offset; return true; } @@ -139,25 +139,25 @@ namespace MCore size_t MemoryFile::Write(const void* data, size_t length) { // if it won't fit in our allocated buffer, we have to enlarge it - if ((mCurrentPos + length > mMemoryStart + mLength) && mAllocate) + if ((m_currentPos + length > m_memoryStart + m_length) && m_allocate) { - size_t offset = mCurrentPos - mMemoryStart; - size_t numBytesExtra = mCurrentPos + length - mMemoryStart; - numBytesExtra += mPreAllocSize; - mMemoryStart = (uint8*)MCore::Realloc((uint8*)mMemoryStart, mLength + numBytesExtra, MCORE_MEMCATEGORY_MEMORYFILE); - mLength += numBytesExtra; - mCurrentPos = mMemoryStart + offset; + size_t offset = m_currentPos - m_memoryStart; + size_t numBytesExtra = m_currentPos + length - m_memoryStart; + numBytesExtra += m_preAllocSize; + m_memoryStart = (uint8*)MCore::Realloc((uint8*)m_memoryStart, m_length + numBytesExtra, MCORE_MEMCATEGORY_MEMORYFILE); + m_length += numBytesExtra; + m_currentPos = m_memoryStart + offset; } // memcopy over the data - MCORE_ASSERT((mCurrentPos + length) <= (mMemoryStart + mLength)); // make sure we don't write past the end of our buffer - MCore::MemCopy(mCurrentPos, data, length); + MCORE_ASSERT((m_currentPos + length) <= (m_memoryStart + m_length)); // make sure we don't write past the end of our buffer + MCore::MemCopy(m_currentPos, data, length); Forward(length); // only overwrite the used length in case we reached the boundary (don't do it in case we modify some data in the middle etc.) - if (mUsedLength < GetPos()) + if (m_usedLength < GetPos()) { - mUsedLength = GetPos(); + m_usedLength = GetPos(); } return length; @@ -167,17 +167,16 @@ namespace MCore // read data from the file size_t MemoryFile::Read(void* data, size_t length) { - // MCORE_ASSERT(mCurrentPos + length <= (uint8*)mMemoryStart + mLength); // make sure we don't read past the end of the memory block - if (mCurrentPos + length > (uint8*)mMemoryStart + mLength) + if (m_currentPos + length > (uint8*)m_memoryStart + m_length) { - const size_t numRead = length - ((mCurrentPos + length) - ((uint8*)mMemoryStart + mLength)); - MCore::MemCopy(data, mCurrentPos, numRead); + const size_t numRead = length - ((m_currentPos + length) - ((uint8*)m_memoryStart + m_length)); + MCore::MemCopy(data, m_currentPos, numRead); Forward(numRead); MCore::LogWarning("MCore::MemoryFile::Read() - We can only read %d bytes of the %d bytes requested, as we are reading past the end of the memory file!", numRead, length); return numRead; } - MCore::MemCopy(data, mCurrentPos, length); + MCore::MemCopy(data, m_currentPos, length); Forward(length); return length; } @@ -186,28 +185,28 @@ namespace MCore // returns the filesize in bytes size_t MemoryFile::GetFileSize() const { - return mUsedLength; + return m_usedLength; } // get the memory start address uint8* MemoryFile::GetMemoryStart() const { - return mMemoryStart; + return m_memoryStart; } // get the pre-alloc size size_t MemoryFile::GetPreAllocSize() const { - return mPreAllocSize; + return m_preAllocSize; } // set the pre-alloc size void MemoryFile::SetPreAllocSize(size_t newSizeInBytes) { - mPreAllocSize = newSizeInBytes; + m_preAllocSize = newSizeInBytes; } diff --git a/Gems/EMotionFX/Code/MCore/Source/MemoryFile.h b/Gems/EMotionFX/Code/MCore/Source/MemoryFile.h index eba9580043..ea2855fd08 100644 --- a/Gems/EMotionFX/Code/MCore/Source/MemoryFile.h +++ b/Gems/EMotionFX/Code/MCore/Source/MemoryFile.h @@ -39,12 +39,12 @@ namespace MCore */ MemoryFile() : File() - , mMemoryStart(nullptr) - , mCurrentPos(nullptr) - , mLength(0) - , mUsedLength(0) - , mPreAllocSize(1024) - , mAllocate(false) {} + , m_memoryStart(nullptr) + , m_currentPos(nullptr) + , m_length(0) + , m_usedLength(0) + , m_preAllocSize(1024) + , m_allocate(false) {} /** * Destructor. Automatically closes the file. @@ -187,11 +187,11 @@ namespace MCore bool SaveToDiskFile(const char* fileName); private: - uint8* mMemoryStart; /**< The location of the file */ - uint8* mCurrentPos; /**< The current location */ - size_t mLength; /**< The total length of the file. */ - size_t mUsedLength; /**< The actual used length of the memory file. */ - size_t mPreAllocSize; /**< The pre-allocation size (in bytes) when we have to reallocate memory. This prevents many allocations. The default=1024, which is 1kb.*/ - bool mAllocate; /**< Can we reallocate or not? */ + uint8* m_memoryStart; /**< The location of the file */ + uint8* m_currentPos; /**< The current location */ + size_t m_length; /**< The total length of the file. */ + size_t m_usedLength; /**< The actual used length of the memory file. */ + size_t m_preAllocSize; /**< The pre-allocation size (in bytes) when we have to reallocate memory. This prevents many allocations. The default=1024, which is 1kb.*/ + bool m_allocate; /**< Can we reallocate or not? */ }; } // namespace MCore diff --git a/Gems/EMotionFX/Code/MCore/Source/MemoryObject.cpp b/Gems/EMotionFX/Code/MCore/Source/MemoryObject.cpp index 017ef3f2e1..9afad03a39 100644 --- a/Gems/EMotionFX/Code/MCore/Source/MemoryObject.cpp +++ b/Gems/EMotionFX/Code/MCore/Source/MemoryObject.cpp @@ -25,37 +25,37 @@ namespace MCore // constructor MemoryObject::MemoryObject() { - mReferenceCount.SetValue(1); + m_referenceCount.SetValue(1); } // destructor MemoryObject::~MemoryObject() { - MCORE_ASSERT(mReferenceCount.GetValue() == 0); + MCORE_ASSERT(m_referenceCount.GetValue() == 0); } // increase the reference count void MemoryObject::IncreaseReferenceCount() { - mReferenceCount.Increment(); + m_referenceCount.Increment(); } // decrease the reference count void MemoryObject::DecreaseReferenceCount() { - MCORE_ASSERT(mReferenceCount.GetValue() > 0); - mReferenceCount.Decrement(); + MCORE_ASSERT(m_referenceCount.GetValue() > 0); + m_referenceCount.Decrement(); } // destroy the object void MemoryObject::Destroy() { - MCORE_ASSERT(mReferenceCount.GetValue() > 0); - if (mReferenceCount.Decrement() == 1) + MCORE_ASSERT(m_referenceCount.GetValue() > 0); + if (m_referenceCount.Decrement() == 1) { Delete(); } @@ -65,7 +65,7 @@ namespace MCore // get the reference count uint32 MemoryObject::GetReferenceCount() const { - return mReferenceCount.GetValue(); + return m_referenceCount.GetValue(); } diff --git a/Gems/EMotionFX/Code/MCore/Source/MemoryObject.h b/Gems/EMotionFX/Code/MCore/Source/MemoryObject.h index 9dfa48284f..cf872da865 100644 --- a/Gems/EMotionFX/Code/MCore/Source/MemoryObject.h +++ b/Gems/EMotionFX/Code/MCore/Source/MemoryObject.h @@ -61,7 +61,7 @@ namespace MCore virtual void Delete(); private: - AtomicUInt32 mReferenceCount; + AtomicUInt32 m_referenceCount; }; diff --git a/Gems/EMotionFX/Code/MCore/Source/MemoryTracker.cpp b/Gems/EMotionFX/Code/MCore/Source/MemoryTracker.cpp index 2cecb43a69..d2f5b9efd8 100644 --- a/Gems/EMotionFX/Code/MCore/Source/MemoryTracker.cpp +++ b/Gems/EMotionFX/Code/MCore/Source/MemoryTracker.cpp @@ -16,33 +16,33 @@ namespace MCore // global stats constructor MemoryTracker::GlobalStats::GlobalStats() { - mCurrentNumBytes = 0; - mCurrentNumAllocs = 0; - mTotalNumAllocs = 0; - mTotalNumReallocs = 0; - mTotalNumFrees = 0; + m_currentNumBytes = 0; + m_currentNumAllocs = 0; + m_totalNumAllocs = 0; + m_totalNumReallocs = 0; + m_totalNumFrees = 0; } // category stats constructor MemoryTracker::CategoryStats::CategoryStats() { - mCurrentNumBytes = 0; - mCurrentNumAllocs = 0; - mTotalNumAllocs = 0; - mTotalNumReallocs = 0; - mTotalNumFrees = 0; + m_currentNumBytes = 0; + m_currentNumAllocs = 0; + m_totalNumAllocs = 0; + m_totalNumReallocs = 0; + m_totalNumFrees = 0; } // group statistics MemoryTracker::GroupStats::GroupStats() { - mCurrentNumBytes = 0; - mCurrentNumAllocs = 0; - mTotalNumAllocs = 0; - mTotalNumReallocs = 0; - mTotalNumFrees = 0; + m_currentNumBytes = 0; + m_currentNumAllocs = 0; + m_totalNumAllocs = 0; + m_totalNumReallocs = 0; + m_totalNumFrees = 0; } @@ -63,7 +63,7 @@ namespace MCore void MemoryTracker::RegisterAlloc(void* memAddress, size_t numBytes, uint32 categoryID) { - LockGuard lock(mMutex); + LockGuard lock(m_mutex); RegisterAllocNoLock(memAddress, numBytes, categoryID); } @@ -73,40 +73,40 @@ namespace MCore { // insert the new allocation Allocation newAlloc; - newAlloc.mMemAddress = memAddress; - newAlloc.mNumBytes = numBytes; - newAlloc.mCategoryID = categoryID; - mAllocs.insert(std::make_pair(memAddress, newAlloc)); + newAlloc.m_memAddress = memAddress; + newAlloc.m_numBytes = numBytes; + newAlloc.m_categoryId = categoryID; + m_allocs.insert(std::make_pair(memAddress, newAlloc)); // update global stats - mGlobalStats.mTotalNumAllocs++; - mGlobalStats.mCurrentNumAllocs++; - mGlobalStats.mCurrentNumBytes += numBytes; + m_globalStats.m_totalNumAllocs++; + m_globalStats.m_currentNumAllocs++; + m_globalStats.m_currentNumBytes += numBytes; // update the category stats - auto categoryItem = mCategories.find(categoryID); - if (categoryItem != mCategories.end()) + auto categoryItem = m_categories.find(categoryID); + if (categoryItem != m_categories.end()) { CategoryStats& catStats = categoryItem->second; - catStats.mTotalNumAllocs++; - catStats.mCurrentNumAllocs++; - catStats.mCurrentNumBytes += numBytes; + catStats.m_totalNumAllocs++; + catStats.m_currentNumAllocs++; + catStats.m_currentNumBytes += numBytes; } else { // auto register the new category CategoryStats catStats; - catStats.mTotalNumAllocs++; - catStats.mCurrentNumAllocs++; - catStats.mCurrentNumBytes += numBytes; - mCategories.insert(std::make_pair(categoryID, catStats)); + catStats.m_totalNumAllocs++; + catStats.m_currentNumAllocs++; + catStats.m_currentNumBytes += numBytes; + m_categories.insert(std::make_pair(categoryID, catStats)); } } void MemoryTracker::RegisterRealloc(void* oldAddress, void* newAddress, size_t numBytes, uint32 categoryID) { - LockGuard lock(mMutex); + LockGuard lock(m_mutex); RegisterReallocNoLock(oldAddress, newAddress, numBytes, categoryID); } @@ -122,52 +122,52 @@ namespace MCore } // try to locate the allocation - auto item = mAllocs.find(oldAddress); + auto item = m_allocs.find(oldAddress); // if we found the item - if (item != mAllocs.end()) + if (item != m_allocs.end()) { const Allocation& allocation = item->second; - const size_t oldNumBytes = allocation.mNumBytes; + const size_t oldNumBytes = allocation.m_numBytes; // update the global stats - mGlobalStats.mCurrentNumBytes += (numBytes - oldNumBytes); - mGlobalStats.mTotalNumReallocs++; + m_globalStats.m_currentNumBytes += (numBytes - oldNumBytes); + m_globalStats.m_totalNumReallocs++; // the category got updated, unregister it from the old category - const bool categoryChanged = (categoryID != allocation.mCategoryID); + const bool categoryChanged = (categoryID != allocation.m_categoryId); if (categoryChanged) { - auto oldCategoryItem = mCategories.find(allocation.mCategoryID); - MCORE_ASSERT(oldCategoryItem != mCategories.end()); - oldCategoryItem->second.mCurrentNumBytes -= oldNumBytes; - oldCategoryItem->second.mCurrentNumAllocs--; + auto oldCategoryItem = m_categories.find(allocation.m_categoryId); + MCORE_ASSERT(oldCategoryItem != m_categories.end()); + oldCategoryItem->second.m_currentNumBytes -= oldNumBytes; + oldCategoryItem->second.m_currentNumAllocs--; } // remove the allocation - mAllocs.erase(item); + m_allocs.erase(item); // re-insert it using the new address (new key) Allocation newAlloc; - newAlloc.mCategoryID = categoryID; - newAlloc.mMemAddress = newAddress; - newAlloc.mNumBytes = numBytes; - mAllocs.insert(std::make_pair(newAddress, newAlloc)); + newAlloc.m_categoryId = categoryID; + newAlloc.m_memAddress = newAddress; + newAlloc.m_numBytes = numBytes; + m_allocs.insert(std::make_pair(newAddress, newAlloc)); // update the category stats - auto categoryItem = mCategories.find(categoryID); - MCORE_ASSERT(categoryItem != mCategories.end()); + auto categoryItem = m_categories.find(categoryID); + MCORE_ASSERT(categoryItem != m_categories.end()); CategoryStats& catStats = categoryItem->second; - catStats.mTotalNumReallocs++; + catStats.m_totalNumReallocs++; if (categoryChanged == false) { - catStats.mCurrentNumBytes += (numBytes - oldNumBytes); + catStats.m_currentNumBytes += (numBytes - oldNumBytes); } else { - catStats.mCurrentNumBytes += numBytes; - catStats.mCurrentNumAllocs++; + catStats.m_currentNumBytes += numBytes; + catStats.m_currentNumAllocs++; } } else // not found, we must just register this as a regular allocation @@ -179,7 +179,7 @@ namespace MCore void MemoryTracker::RegisterFree(void* memAddress) { - LockGuard lock(mMutex); + LockGuard lock(m_mutex); RegisterFreeNoLock(memAddress); } @@ -193,27 +193,27 @@ namespace MCore } // find the allocation using this address - auto item = mAllocs.find(memAddress); - if (item != mAllocs.end()) + auto item = m_allocs.find(memAddress); + if (item != m_allocs.end()) { Allocation& allocation = item->second; // update global stats - mGlobalStats.mCurrentNumBytes -= allocation.mNumBytes; - mGlobalStats.mTotalNumFrees++; - mGlobalStats.mCurrentNumAllocs--; + m_globalStats.m_currentNumBytes -= allocation.m_numBytes; + m_globalStats.m_totalNumFrees++; + m_globalStats.m_currentNumAllocs--; // update the category stats - auto categoryItem = mCategories.find(allocation.mCategoryID); - MCORE_ASSERT(categoryItem != mCategories.end()); // this should be impossible + auto categoryItem = m_categories.find(allocation.m_categoryId); + MCORE_ASSERT(categoryItem != m_categories.end()); // this should be impossible CategoryStats& catStats = categoryItem->second; - catStats.mCurrentNumAllocs--; - catStats.mTotalNumFrees++; - catStats.mCurrentNumBytes -= allocation.mNumBytes; + catStats.m_currentNumAllocs--; + catStats.m_totalNumFrees++; + catStats.m_currentNumBytes -= allocation.m_numBytes; // remove the allocation - mAllocs.erase(item); + m_allocs.erase(item); } else { @@ -227,25 +227,25 @@ namespace MCore // clear all stored allocations void MemoryTracker::Clear() { - LockGuard lock(mMutex); - mAllocs.clear(); - mCategories.clear(); - mGroups.clear(); - mGlobalStats = GlobalStats(); + LockGuard lock(m_mutex); + m_allocs.clear(); + m_categories.clear(); + m_groups.clear(); + m_globalStats = GlobalStats(); } // get the global stats const MemoryTracker::GlobalStats& MemoryTracker::GetGlobalStats() const { - return mGlobalStats; + return m_globalStats; } // get category statistics bool MemoryTracker::GetCategoryStatistics(uint32 categoryID, CategoryStats* outStats) { - LockGuard lock(mMutex); + LockGuard lock(m_mutex); return GetCategoryStatisticsNoLock(categoryID, outStats); } @@ -253,8 +253,8 @@ namespace MCore // get category statistics, without lock bool MemoryTracker::GetCategoryStatisticsNoLock(uint32 categoryID, CategoryStats* outStats) { - auto item = mCategories.find(categoryID); - if (item != mCategories.end()) + auto item = m_categories.find(categoryID); + if (item != m_categories.end()) { *outStats = item->second; return true; @@ -267,20 +267,20 @@ namespace MCore // register the name to a given category void MemoryTracker::RegisterCategory(uint32 categoryID, const char* name) { - LockGuard lock(mMutex); + LockGuard lock(m_mutex); // try to see if the category exists already - auto item = mCategories.find(categoryID); - if (item == mCategories.end()) + auto item = m_categories.find(categoryID); + if (item == m_categories.end()) { // register the new category CategoryStats catStats; - catStats.mName = name; - mCategories.insert(std::make_pair(categoryID, catStats)); + catStats.m_name = name; + m_categories.insert(std::make_pair(categoryID, catStats)); } else { - item->second.mName = name; + item->second.m_name = name; } } @@ -288,30 +288,30 @@ namespace MCore // register a given group void MemoryTracker::RegisterGroup(uint32 groupID, const char* name, const std::vector& categories) { - LockGuard lock(mMutex); + LockGuard lock(m_mutex); - auto item = mGroups.find(groupID); - if (item == mGroups.end()) + auto item = m_groups.find(groupID); + if (item == m_groups.end()) { // create a new group Group newGroup; - newGroup.mName = name; + newGroup.m_name = name; for (auto& cat : categories) { - newGroup.mCategories.insert(cat); + newGroup.m_categories.insert(cat); } - mGroups.insert(std::make_pair(groupID, newGroup)); + m_groups.insert(std::make_pair(groupID, newGroup)); } else { // update the existing group by inserting categories that don't exist yet inside the group Group& group = item->second; - group.mName = name; + group.m_name = name; for (auto& cat : categories) { - if (group.mCategories.find(cat) == group.mCategories.end()) + if (group.m_categories.find(cat) == group.m_categories.end()) { - group.mCategories.insert(cat); + group.m_categories.insert(cat); } } } @@ -321,7 +321,7 @@ namespace MCore // update the statistics for all groups void MemoryTracker::UpdateGroupStatistics() { - LockGuard lock(mMutex); + LockGuard lock(m_mutex); UpdateGroupStatisticsNoLock(); } @@ -330,24 +330,24 @@ namespace MCore void MemoryTracker::UpdateGroupStatisticsNoLock() { // for all registered groups - for (auto& item : mGroups) + for (auto& item : m_groups) { Group& group = item.second; // reset the totals - group.mStats = GroupStats(); + group.m_stats = GroupStats(); // for all categories - for (auto categoryID : group.mCategories) + for (auto categoryID : group.m_categories) { CategoryStats categoryStats; GetCategoryStatisticsNoLock(categoryID, &categoryStats); - group.mStats.mCurrentNumAllocs += categoryStats.mCurrentNumAllocs; - group.mStats.mCurrentNumBytes += categoryStats.mCurrentNumBytes; - group.mStats.mTotalNumAllocs += categoryStats.mTotalNumAllocs; - group.mStats.mTotalNumFrees += categoryStats.mTotalNumFrees; - group.mStats.mTotalNumReallocs += categoryStats.mTotalNumReallocs; + group.m_stats.m_currentNumAllocs += categoryStats.m_currentNumAllocs; + group.m_stats.m_currentNumBytes += categoryStats.m_currentNumBytes; + group.m_stats.m_totalNumAllocs += categoryStats.m_totalNumAllocs; + group.m_stats.m_totalNumFrees += categoryStats.m_totalNumFrees; + group.m_stats.m_totalNumReallocs += categoryStats.m_totalNumReallocs; } } } @@ -355,15 +355,15 @@ namespace MCore // get group statistics bool MemoryTracker::GetGroupStatistics(uint32 groupID, GroupStats* outGroupStats) { - LockGuard lock(mMutex); + LockGuard lock(m_mutex); - auto item = mGroups.find(groupID); - if (item == mGroups.end()) + auto item = m_groups.find(groupID); + if (item == m_groups.end()) { return false; } - const GroupStats& groupStats = item->second.mStats; + const GroupStats& groupStats = item->second.m_stats; *outGroupStats = groupStats; return true; @@ -373,67 +373,67 @@ namespace MCore // get the allocations const std::unordered_map& MemoryTracker::GetAllocations() const { - return mAllocs; + return m_allocs; } // get the groups const std::unordered_map& MemoryTracker::GetGroups() const { - return mGroups; + return m_groups; } // get the categories const std::map& MemoryTracker::GetCategories() const { - return mCategories; + return m_categories; } // multithread lock void MemoryTracker::Lock() { - mMutex.Lock(); + m_mutex.Lock(); } // multithread unlock void MemoryTracker::Unlock() { - mMutex.Unlock(); + m_mutex.Unlock(); } // log the stats void MemoryTracker::LogStatistics(bool currentlyAllocatedOnly) { - LockGuard lock(mMutex); + LockGuard lock(m_mutex); // update the group statistics (thread safe also) UpdateGroupStatisticsNoLock(); Print("--[ Memory Global Statistics ]-----------------------------------------------------------------------"); - Print(FormatStdString("Current Num Bytes Used = %d bytes (%d k or %.2f mb)", mGlobalStats.mCurrentNumBytes, mGlobalStats.mCurrentNumBytes / 1000, mGlobalStats.mCurrentNumBytes / 1000000.0f).c_str()); - Print(FormatStdString("Current Num Allocs = %d", mGlobalStats.mCurrentNumAllocs).c_str()); - Print(FormatStdString("Total Num Allocs = %d", mGlobalStats.mTotalNumAllocs).c_str()); - Print(FormatStdString("Total Num Reallocs = %d", mGlobalStats.mTotalNumReallocs).c_str()); - Print(FormatStdString("Total Num Frees = %d", mGlobalStats.mTotalNumFrees).c_str()); + Print(FormatStdString("Current Num Bytes Used = %d bytes (%d k or %.2f mb)", m_globalStats.m_currentNumBytes, m_globalStats.m_currentNumBytes / 1000, m_globalStats.m_currentNumBytes / 1000000.0f).c_str()); + Print(FormatStdString("Current Num Allocs = %d", m_globalStats.m_currentNumAllocs).c_str()); + Print(FormatStdString("Total Num Allocs = %d", m_globalStats.m_totalNumAllocs).c_str()); + Print(FormatStdString("Total Num Reallocs = %d", m_globalStats.m_totalNumReallocs).c_str()); + Print(FormatStdString("Total Num Frees = %d", m_globalStats.m_totalNumFrees).c_str()); - if (mCategories.empty() == false) + if (m_categories.empty() == false) { Print(""); Print("--[ Memory Category Statistics ]---------------------------------------------------------------------"); - for (auto& item : mCategories) + for (auto& item : m_categories) { const uint32 categoryID = item.first; const CategoryStats& stats = item.second; - if (stats.mTotalNumAllocs > 0) + if (stats.m_totalNumAllocs > 0) { bool display = true; if (currentlyAllocatedOnly) { - if (stats.mCurrentNumAllocs == 0) + if (stats.m_currentNumAllocs == 0) { display = false; } @@ -441,26 +441,26 @@ namespace MCore if (display) { - Print(FormatStdString("[Cat %4d] - %8d bytes (%6d k) in %5d allocs [%6d / %6d / %6d] --> %s", categoryID, stats.mCurrentNumBytes, stats.mCurrentNumBytes / 1000, stats.mCurrentNumAllocs, stats.mTotalNumAllocs, stats.mTotalNumReallocs, stats.mTotalNumFrees, stats.mName.c_str()).c_str()); + Print(FormatStdString("[Cat %4d] - %8d bytes (%6d k) in %5d allocs [%6d / %6d / %6d] --> %s", categoryID, stats.m_currentNumBytes, stats.m_currentNumBytes / 1000, stats.m_currentNumAllocs, stats.m_totalNumAllocs, stats.m_totalNumReallocs, stats.m_totalNumFrees, stats.m_name.c_str()).c_str()); } } } } - if (mGroups.empty() == false) + if (m_groups.empty() == false) { Print(""); Print("--[ Group Statistics ]-------------------------------------------------------------------------------"); - for (auto& item : mGroups) + for (auto& item : m_groups) { const uint32 groupID = item.first; const Group& group = item.second; - if (group.mStats.mTotalNumAllocs > 0) + if (group.m_stats.m_totalNumAllocs > 0) { bool display = true; if (currentlyAllocatedOnly) { - if (group.mStats.mCurrentNumAllocs == 0) + if (group.m_stats.m_currentNumAllocs == 0) { display = false; } @@ -468,7 +468,7 @@ namespace MCore if (display) { - Print(FormatStdString("[Group %4d] - %8d bytes (%6d k) in %5d allocs [%6d / %6d / %6d] --> %s", groupID, group.mStats.mCurrentNumBytes, group.mStats.mCurrentNumBytes / 1000, group.mStats.mCurrentNumAllocs, group.mStats.mTotalNumAllocs, group.mStats.mTotalNumReallocs, group.mStats.mTotalNumFrees, group.mName.c_str()).c_str()); + Print(FormatStdString("[Group %4d] - %8d bytes (%6d k) in %5d allocs [%6d / %6d / %6d] --> %s", groupID, group.m_stats.m_currentNumBytes, group.m_stats.m_currentNumBytes / 1000, group.m_stats.m_currentNumAllocs, group.m_stats.m_totalNumAllocs, group.m_stats.m_totalNumReallocs, group.m_stats.m_totalNumFrees, group.m_name.c_str()).c_str()); } } } @@ -479,12 +479,12 @@ namespace MCore // log the stats void MemoryTracker::LogLeaks() { - LockGuard lock(mMutex); + LockGuard lock(m_mutex); // update the group statistics (thread safe also) UpdateGroupStatisticsNoLock(); - if (mAllocs.size() == 0) + if (m_allocs.size() == 0) { Print("MCore::MemoryTracker::LogLeaks() - No memory leaks have been detected."); return; @@ -492,34 +492,34 @@ namespace MCore // log globals Print("--[ Memory Leak Global Statistics ]-----------------------------------------------------------------------"); - Print(FormatStdString("Leaking Num Bytes = %d bytes (%d k or %.2f mb)", mGlobalStats.mCurrentNumBytes, mGlobalStats.mCurrentNumBytes / 1000, mGlobalStats.mCurrentNumBytes / 1000000.0f).c_str()); - Print(FormatStdString("Leaking Num Allocs = %d", mGlobalStats.mCurrentNumAllocs).c_str()); + Print(FormatStdString("Leaking Num Bytes = %d bytes (%d k or %.2f mb)", m_globalStats.m_currentNumBytes, m_globalStats.m_currentNumBytes / 1000, m_globalStats.m_currentNumBytes / 1000000.0f).c_str()); + Print(FormatStdString("Leaking Num Allocs = %d", m_globalStats.m_currentNumAllocs).c_str()); Print(""); // log category totals Print("--[ Memory Category Leak Statistics ]---------------------------------------------------------------------"); - for (auto& item : mCategories) + for (auto& item : m_categories) { const uint32 categoryID = item.first; const CategoryStats& stats = item.second; - if (stats.mCurrentNumAllocs > 0) + if (stats.m_currentNumAllocs > 0) { - Print(FormatStdString("[Cat %4d] - %8d bytes (%6d k) in %5d allocs [%6d / %6d / %6d] --> %s", categoryID, stats.mCurrentNumBytes, stats.mCurrentNumBytes / 1000, stats.mCurrentNumAllocs, stats.mTotalNumAllocs, stats.mTotalNumReallocs, stats.mTotalNumFrees, stats.mName.c_str()).c_str()); + Print(FormatStdString("[Cat %4d] - %8d bytes (%6d k) in %5d allocs [%6d / %6d / %6d] --> %s", categoryID, stats.m_currentNumBytes, stats.m_currentNumBytes / 1000, stats.m_currentNumAllocs, stats.m_totalNumAllocs, stats.m_totalNumReallocs, stats.m_totalNumFrees, stats.m_name.c_str()).c_str()); } } Print(""); - if (mGroups.empty() == false) + if (m_groups.empty() == false) { Print(""); Print("--[ Group Statistics ]-------------------------------------------------------------------------------"); - for (auto& item : mGroups) + for (auto& item : m_groups) { const uint32 groupID = item.first; const Group& group = item.second; - if (group.mStats.mCurrentNumAllocs > 0) + if (group.m_stats.m_currentNumAllocs > 0) { - Print(FormatStdString("[Group %4d] - %8d bytes (%6d k) in %5d allocs [%6d / %6d / %6d] --> %s", groupID, group.mStats.mCurrentNumBytes, group.mStats.mCurrentNumBytes / 1000, group.mStats.mCurrentNumAllocs, group.mStats.mTotalNumAllocs, group.mStats.mTotalNumReallocs, group.mStats.mTotalNumFrees, group.mName.c_str()).c_str()); + Print(FormatStdString("[Group %4d] - %8d bytes (%6d k) in %5d allocs [%6d / %6d / %6d] --> %s", groupID, group.m_stats.m_currentNumBytes, group.m_stats.m_currentNumBytes / 1000, group.m_stats.m_currentNumAllocs, group.m_stats.m_totalNumAllocs, group.m_stats.m_totalNumReallocs, group.m_stats.m_totalNumFrees, group.m_name.c_str()).c_str()); } } Print(""); @@ -528,7 +528,7 @@ namespace MCore // log individual leaks Print("--[ Memory Allocations ]----------------------------------------------------------------------------------"); uint32 allocNumber = 0; - for (auto& item : mAllocs) + for (auto& item : m_allocs) { const char* data = static_cast(item.first); const Allocation& allocation = item.second; @@ -536,7 +536,7 @@ namespace MCore char buffer[64]; memset(buffer, 0, 64); - const size_t numBytes = (allocation.mNumBytes >= 64) ? 63 : allocation.mNumBytes; + const size_t numBytes = (allocation.m_numBytes >= 64) ? 63 : allocation.m_numBytes; for (uint32 i = 0; i < numBytes; ++i) { char c = data[i]; @@ -547,9 +547,9 @@ namespace MCore buffer[i] = c; } - auto catItem = mCategories.find(allocation.mCategoryID); - MCORE_ASSERT(catItem != mCategories.end()); - Print(FormatStdString("#%-4d - %6d bytes (cat=%4d) - [%-66s] --> %s", allocNumber, allocation.mNumBytes, allocation.mCategoryID, buffer, catItem->second.mName.c_str()).c_str()); + auto catItem = m_categories.find(allocation.m_categoryId); + MCORE_ASSERT(catItem != m_categories.end()); + Print(FormatStdString("#%-4d - %6d bytes (cat=%4d) - [%-66s] --> %s", allocNumber, allocation.m_numBytes, allocation.m_categoryId, buffer, catItem->second.m_name.c_str()).c_str()); allocNumber++; } diff --git a/Gems/EMotionFX/Code/MCore/Source/MemoryTracker.h b/Gems/EMotionFX/Code/MCore/Source/MemoryTracker.h index 6a387ed508..e944306c14 100644 --- a/Gems/EMotionFX/Code/MCore/Source/MemoryTracker.h +++ b/Gems/EMotionFX/Code/MCore/Source/MemoryTracker.h @@ -41,9 +41,9 @@ namespace MCore */ struct MCORE_API Allocation { - void* mMemAddress; /**< The memory address of the allocation. */ - size_t mNumBytes; /**< The number of bytes allocated at this address. */ - uint32 mCategoryID; /**< The memory category of this allocation. */ + void* m_memAddress; /**< The memory address of the allocation. */ + size_t m_numBytes; /**< The number of bytes allocated at this address. */ + uint32 m_categoryId; /**< The memory category of this allocation. */ }; /** @@ -51,11 +51,11 @@ namespace MCore */ struct MCORE_API GlobalStats { - size_t mCurrentNumBytes; /**< Current number of bytes allocated. */ - uint32 mCurrentNumAllocs; /**< The current number of allocations. */ - uint32 mTotalNumAllocs; /**< Total number of allocations ever made. */ - uint32 mTotalNumReallocs; /**< Total number of reallocations ever made. */ - uint32 mTotalNumFrees; /**< Total number of frees ever made. */ + size_t m_currentNumBytes; /**< Current number of bytes allocated. */ + uint32 m_currentNumAllocs; /**< The current number of allocations. */ + uint32 m_totalNumAllocs; /**< Total number of allocations ever made. */ + uint32 m_totalNumReallocs; /**< Total number of reallocations ever made. */ + uint32 m_totalNumFrees; /**< Total number of frees ever made. */ GlobalStats(); }; @@ -65,12 +65,12 @@ namespace MCore */ struct MCORE_API CategoryStats { - size_t mCurrentNumBytes; /**< Current number of bytes allocated. */ - uint32 mCurrentNumAllocs; /**< Current number of allocations active. */ - uint32 mTotalNumAllocs; /**< Total number of allocations ever made in this category. */ - uint32 mTotalNumReallocs; /**< Total number of reallocations ever made in this category. */ - uint32 mTotalNumFrees; /**< Total number of frees ever made in this category. */ - std::string mName; /**< The name of the category, can be empty if not registered with RegisterCategory. */ + size_t m_currentNumBytes; /**< Current number of bytes allocated. */ + uint32 m_currentNumAllocs; /**< Current number of allocations active. */ + uint32 m_totalNumAllocs; /**< Total number of allocations ever made in this category. */ + uint32 m_totalNumReallocs; /**< Total number of reallocations ever made in this category. */ + uint32 m_totalNumFrees; /**< Total number of frees ever made in this category. */ + std::string m_name; /**< The name of the category, can be empty if not registered with RegisterCategory. */ CategoryStats(); }; @@ -80,11 +80,11 @@ namespace MCore */ struct MCORE_API GroupStats { - size_t mCurrentNumBytes; - uint32 mCurrentNumAllocs; - uint32 mTotalNumAllocs; /**< Total number of allocations ever made in this category. */ - uint32 mTotalNumReallocs; /**< Total number of reallocations ever made in this category. */ - uint32 mTotalNumFrees; /**< Total number of frees ever made in this category. */ + size_t m_currentNumBytes; + uint32 m_currentNumAllocs; + uint32 m_totalNumAllocs; /**< Total number of allocations ever made in this category. */ + uint32 m_totalNumReallocs; /**< Total number of reallocations ever made in this category. */ + uint32 m_totalNumFrees; /**< Total number of frees ever made in this category. */ GroupStats(); }; @@ -94,9 +94,9 @@ namespace MCore */ struct MCORE_API Group { - std::set mCategories; /**< The ID values of the categories that are part of this group. */ - std::string mName; /**< The name of the category. */ - GroupStats mStats; /**< The statistics. */ + std::set m_categories; /**< The ID values of the categories that are part of this group. */ + std::string m_name; /**< The name of the category. */ + GroupStats m_stats; /**< The statistics. */ }; //-------------------------------- @@ -254,11 +254,11 @@ namespace MCore void Unlock(); private: - std::unordered_map mAllocs; /**< The unordered map of allocations, with the memory address as key. */ - std::unordered_map mGroups; /**< The groups, with the group ID as key.*/ - std::map mCategories; /**< The ordered map of categories, with the category ID as key. */ - GlobalStats mGlobalStats; /**< The global memory statistics. */ - mutable Mutex mMutex; /**< The multithread mutex used to lock and unlock. */ + std::unordered_map m_allocs; /**< The unordered map of allocations, with the memory address as key. */ + std::unordered_map m_groups; /**< The groups, with the group ID as key.*/ + std::map m_categories; /**< The ordered map of categories, with the category ID as key. */ + GlobalStats m_globalStats; /**< The global memory statistics. */ + mutable Mutex m_mutex; /**< The multithread mutex used to lock and unlock. */ /** * Register a given memory allocation. diff --git a/Gems/EMotionFX/Code/MCore/Source/MultiThreadManager.h b/Gems/EMotionFX/Code/MCore/Source/MultiThreadManager.h index a4fe6eaa10..eccfa9f5f3 100644 --- a/Gems/EMotionFX/Code/MCore/Source/MultiThreadManager.h +++ b/Gems/EMotionFX/Code/MCore/Source/MultiThreadManager.h @@ -29,12 +29,12 @@ namespace MCore MCORE_INLINE Mutex() {} MCORE_INLINE ~Mutex() {} - MCORE_INLINE void Lock() { mMutex.lock(); } - MCORE_INLINE void Unlock() { mMutex.unlock(); } - MCORE_INLINE bool TryLock() { return mMutex.try_lock(); } + MCORE_INLINE void Lock() { m_mutex.lock(); } + MCORE_INLINE void Unlock() { m_mutex.unlock(); } + MCORE_INLINE bool TryLock() { return m_mutex.try_lock(); } private: - AZStd::mutex mMutex; + AZStd::mutex m_mutex; }; @@ -44,12 +44,12 @@ namespace MCore MCORE_INLINE MutexRecursive() {} MCORE_INLINE ~MutexRecursive() {} - MCORE_INLINE void Lock() { mMutex.lock(); } - MCORE_INLINE void Unlock() { mMutex.unlock(); } - MCORE_INLINE bool TryLock() { return mMutex.try_lock(); } + MCORE_INLINE void Lock() { m_mutex.lock(); } + MCORE_INLINE void Unlock() { m_mutex.unlock(); } + MCORE_INLINE bool TryLock() { return m_mutex.try_lock(); } private: - AZStd::recursive_mutex mMutex; + AZStd::recursive_mutex m_mutex; }; @@ -59,13 +59,13 @@ namespace MCore MCORE_INLINE ConditionVariable() {} MCORE_INLINE ~ConditionVariable() {} - MCORE_INLINE void Wait(Mutex& mtx, const AZStd::function& predicate) { AZStd::unique_lock lock(mtx.mMutex); mVariable.wait(lock, predicate); } - MCORE_INLINE void WaitWithTimeout(Mutex& mtx, uint32 microseconds, const AZStd::function& predicate) { AZStd::unique_lock lock(mtx.mMutex); mVariable.wait_for(lock, AZStd::chrono::microseconds(microseconds), predicate); } - MCORE_INLINE void NotifyOne() { mVariable.notify_one(); } - MCORE_INLINE void NotifyAll() { mVariable.notify_all(); } + MCORE_INLINE void Wait(Mutex& mtx, const AZStd::function& predicate) { AZStd::unique_lock lock(mtx.m_mutex); m_variable.wait(lock, predicate); } + MCORE_INLINE void WaitWithTimeout(Mutex& mtx, uint32 microseconds, const AZStd::function& predicate) { AZStd::unique_lock lock(mtx.m_mutex); m_variable.wait_for(lock, AZStd::chrono::microseconds(microseconds), predicate); } + MCORE_INLINE void NotifyOne() { m_variable.notify_one(); } + MCORE_INLINE void NotifyAll() { m_variable.notify_all(); } private: - AZStd::condition_variable mVariable; + AZStd::condition_variable m_variable; }; @@ -75,14 +75,14 @@ namespace MCore MCORE_INLINE AtomicInt32() { SetValue(0); } MCORE_INLINE ~AtomicInt32() {} - MCORE_INLINE void SetValue(int32 value) { mAtomic.store(value); } - MCORE_INLINE int32 GetValue() const { int32 value = mAtomic.load(); return value; } + MCORE_INLINE void SetValue(int32 value) { m_atomic.store(value); } + MCORE_INLINE int32 GetValue() const { int32 value = m_atomic.load(); return value; } - MCORE_INLINE int32 Increment() { return mAtomic++; } - MCORE_INLINE int32 Decrement() { return mAtomic--; } + MCORE_INLINE int32 Increment() { return m_atomic++; } + MCORE_INLINE int32 Decrement() { return m_atomic--; } private: - AZStd::atomic mAtomic; + AZStd::atomic m_atomic; }; @@ -93,14 +93,14 @@ namespace MCore MCORE_INLINE AtomicUInt32() { SetValue(0); } MCORE_INLINE ~AtomicUInt32() {} - MCORE_INLINE void SetValue(uint32 value) { mAtomic.store(value); } - MCORE_INLINE uint32 GetValue() const { uint32 value = mAtomic.load(); return value; } + MCORE_INLINE void SetValue(uint32 value) { m_atomic.store(value); } + MCORE_INLINE uint32 GetValue() const { uint32 value = m_atomic.load(); return value; } - MCORE_INLINE uint32 Increment() { return mAtomic++; } - MCORE_INLINE uint32 Decrement() { return mAtomic--; } + MCORE_INLINE uint32 Increment() { return m_atomic++; } + MCORE_INLINE uint32 Decrement() { return m_atomic--; } private: - AZStd::atomic mAtomic; + AZStd::atomic m_atomic; }; @@ -109,14 +109,14 @@ namespace MCore public: MCORE_INLINE AtomicSizeT() { SetValue(0); } - MCORE_INLINE void SetValue(size_t value) { mAtomic.store(value); } - MCORE_INLINE size_t GetValue() const { size_t value = mAtomic.load(); return value; } + MCORE_INLINE void SetValue(size_t value) { m_atomic.store(value); } + MCORE_INLINE size_t GetValue() const { size_t value = m_atomic.load(); return value; } - MCORE_INLINE size_t Increment() { return mAtomic++; } - MCORE_INLINE size_t Decrement() { return mAtomic--; } + MCORE_INLINE size_t Increment() { return m_atomic++; } + MCORE_INLINE size_t Decrement() { return m_atomic--; } private: - AZStd::atomic mAtomic; + AZStd::atomic m_atomic; }; @@ -127,58 +127,58 @@ namespace MCore Thread(const AZStd::function& threadFunction) { Init(threadFunction); } ~Thread() {} - void Init(const AZStd::function& threadFunction) { mThread = AZStd::thread(threadFunction); } - void Join() { mThread.join(); } + void Init(const AZStd::function& threadFunction) { m_thread = AZStd::thread(threadFunction); } + void Join() { m_thread.join(); } private: - AZStd::thread mThread; + AZStd::thread m_thread; }; class MCORE_API LockGuard { public: - MCORE_INLINE LockGuard(Mutex& mutex) { mMutex = &mutex; mutex.Lock(); } - MCORE_INLINE ~LockGuard() { mMutex->Unlock(); } + MCORE_INLINE LockGuard(Mutex& mutex) { m_mutex = &mutex; mutex.Lock(); } + MCORE_INLINE ~LockGuard() { m_mutex->Unlock(); } private: - Mutex* mMutex; + Mutex* m_mutex; }; class MCORE_API LockGuardRecursive { public: - MCORE_INLINE LockGuardRecursive(MutexRecursive& mutex) { mMutex = &mutex; mutex.Lock(); } - MCORE_INLINE ~LockGuardRecursive() { mMutex->Unlock(); } + MCORE_INLINE LockGuardRecursive(MutexRecursive& mutex) { m_mutex = &mutex; mutex.Lock(); } + MCORE_INLINE ~LockGuardRecursive() { m_mutex->Unlock(); } private: - MutexRecursive* mMutex; + MutexRecursive* m_mutex; }; class MCORE_API ConditionEvent { public: - ConditionEvent() { mConditionValue = false; } + ConditionEvent() { m_conditionValue = false; } ~ConditionEvent() { } - void Reset() { mConditionValue = false; } + void Reset() { m_conditionValue = false; } void Wait() { - mCV.Wait(mMutex, [this] { return mConditionValue; }); + m_cv.Wait(m_mutex, [this] { return m_conditionValue; }); } void WaitWithTimeout(uint32 microseconds) { - mCV.WaitWithTimeout(mMutex, microseconds, [this] { return mConditionValue; }); + m_cv.WaitWithTimeout(m_mutex, microseconds, [this] { return m_conditionValue; }); } - void NotifyAll() { { LockGuard lockMutex(mMutex); mConditionValue = true; } mCV.NotifyAll(); } - void NotifyOne() { { LockGuard lockMutex(mMutex); mConditionValue = true; } mCV.NotifyOne(); } + void NotifyAll() { { LockGuard lockMutex(m_mutex); m_conditionValue = true; } m_cv.NotifyAll(); } + void NotifyOne() { { LockGuard lockMutex(m_mutex); m_conditionValue = true; } m_cv.NotifyOne(); } private: - Mutex mMutex; - ConditionVariable mCV; - bool mConditionValue; + Mutex m_mutex; + ConditionVariable m_cv; + bool m_conditionValue; }; } // namespace MCore diff --git a/Gems/EMotionFX/Code/MCore/Source/PlaneEq.h b/Gems/EMotionFX/Code/MCore/Source/PlaneEq.h index 402de4a12c..df8738a1ee 100644 --- a/Gems/EMotionFX/Code/MCore/Source/PlaneEq.h +++ b/Gems/EMotionFX/Code/MCore/Source/PlaneEq.h @@ -54,8 +54,8 @@ namespace MCore * @param pnt A point on the plane. */ MCORE_INLINE PlaneEq(const AZ::Vector3& norm, const AZ::Vector3& pnt) - : mNormal(norm) - , mDist(-((norm.GetX() * pnt.GetX()) + (norm.GetY() * pnt.GetY()) + (norm.GetZ() * pnt.GetZ()))) {} + : m_normal(norm) + , m_dist(-((norm.GetX() * pnt.GetX()) + (norm.GetY() * pnt.GetY()) + (norm.GetZ() * pnt.GetZ()))) {} /** * Constructor when you know the normal and the value of d out of the plane equation (Ax + By + Cz + d = 0) @@ -63,8 +63,8 @@ namespace MCore * @param d The value of 'd' out of the plane equation. */ MCORE_INLINE PlaneEq(const AZ::Vector3& norm, float d) - : mNormal(norm) - , mDist(d) {} + : m_normal(norm) + , m_dist(d) {} /** * Constructor when you know 3 points on the plane (the winding matters here (clockwise vs counter-clockwise) @@ -74,8 +74,8 @@ namespace MCore * @param v3 The third point on the plane. */ MCORE_INLINE PlaneEq(const AZ::Vector3& v1, const AZ::Vector3& v2, const AZ::Vector3& v3) - : mNormal((v2 - v1).Cross(v3 - v1).GetNormalized()) - , mDist(-(mNormal.Dot(v1))) {} + : m_normal((v2 - v1).Cross(v3 - v1).GetNormalized()) + , m_dist(-(m_normal.Dot(v1))) {} /** * Calculates and returns the dominant plane. @@ -86,9 +86,9 @@ namespace MCore */ MCORE_INLINE EPlane CalcDominantPlane() const { - return (Math::Abs(mNormal.GetY()) > Math::Abs(mNormal.GetX()) - ? (Math::Abs(mNormal.GetZ()) > Math::Abs(mNormal.GetY()) - ? PLANE_XY : PLANE_XZ) : (Math::Abs(mNormal.GetZ()) > Math::Abs(mNormal.GetX()) + return (Math::Abs(m_normal.GetY()) > Math::Abs(m_normal.GetX()) + ? (Math::Abs(m_normal.GetZ()) > Math::Abs(m_normal.GetY()) + ? PLANE_XY : PLANE_XZ) : (Math::Abs(m_normal.GetZ()) > Math::Abs(m_normal.GetX()) ? PLANE_XY : PLANE_YZ)); } @@ -98,7 +98,7 @@ namespace MCore * @param v The vector representing the 3D point to use for the calculation. * @result The distance from 'v' to this plane, along the normal of this plane. */ - MCORE_INLINE float CalcDistanceTo(const AZ::Vector3& v) const { return mNormal.Dot(v) + mDist; } + MCORE_INLINE float CalcDistanceTo(const AZ::Vector3& v) const { return m_normal.Dot(v) + m_dist; } /** * Construct the plane when the normal of the plane and a point on the plane are known. @@ -107,8 +107,8 @@ namespace MCore */ MCORE_INLINE void Construct(const AZ::Vector3& normal, const AZ::Vector3& pointOnPlane) { - mNormal = normal; - mDist = -((normal.GetX() * pointOnPlane.GetX()) + (normal.GetY() * pointOnPlane.GetY()) + (normal.GetZ() * pointOnPlane.GetZ())); + m_normal = normal; + m_dist = -((normal.GetX() * pointOnPlane.GetX()) + (normal.GetY() * pointOnPlane.GetY()) + (normal.GetZ() * pointOnPlane.GetZ())); } /** @@ -118,8 +118,8 @@ namespace MCore */ MCORE_INLINE void Construct(const AZ::Vector3& normal, float d) { - mNormal = normal; - mDist = d; + m_normal = normal; + m_dist = d; } /** @@ -131,21 +131,21 @@ namespace MCore */ MCORE_INLINE void Construct(const AZ::Vector3& v1, const AZ::Vector3& v2, const AZ::Vector3& v3) { - mNormal = (v2 - v1).Cross(v3 - v1).GetNormalized(); - mDist = -(mNormal.Dot(v1)); + m_normal = (v2 - v1).Cross(v3 - v1).GetNormalized(); + m_dist = -(m_normal.Dot(v1)); } /** * Get the normal of the plane. * @result Returns the normal of the plane. */ - MCORE_INLINE const AZ::Vector3& GetNormal() const { return mNormal; } + MCORE_INLINE const AZ::Vector3& GetNormal() const { return m_normal; } /** * Get the 'd' out of the plane equation (Ax + By + Cz + d = 0). * @result Returns the 'd' from the plane equation. */ - MCORE_INLINE float GetDist() const { return mDist; } + MCORE_INLINE float GetDist() const { return m_dist; } /** * Checks if a given axis aligned bounding box (AABB) is partially above (aka in front) this plane or not. @@ -189,12 +189,12 @@ namespace MCore * @param vectorToProject The vector you wish to project onto the plane. * @result The projected vector. */ - MCORE_INLINE AZ::Vector3 Project(const AZ::Vector3& vectorToProject) { return vectorToProject - vectorToProject.Dot(mNormal) * mNormal; } + MCORE_INLINE AZ::Vector3 Project(const AZ::Vector3& vectorToProject) { return vectorToProject - vectorToProject.Dot(m_normal) * m_normal; } private: - AZ::Vector3 mNormal; /**< The normal of the plane. */ - float mDist; /**< The D in the plane equation (Ax + By + Cz + D = 0). */ + AZ::Vector3 m_normal; /**< The normal of the plane. */ + float m_dist; /**< The D in the plane equation (Ax + By + Cz + D = 0). */ }; // include the inline code diff --git a/Gems/EMotionFX/Code/MCore/Source/PlaneEq.inl b/Gems/EMotionFX/Code/MCore/Source/PlaneEq.inl index f59fcbc2ca..62ccb19551 100644 --- a/Gems/EMotionFX/Code/MCore/Source/PlaneEq.inl +++ b/Gems/EMotionFX/Code/MCore/Source/PlaneEq.inl @@ -12,11 +12,11 @@ MCORE_INLINE bool PlaneEq::PartiallyAbove(const AABB& box) const { const AZ::Vector3 minVec = box.GetMin(); const AZ::Vector3 maxVec = box.GetMax(); - const AZ::Vector3 testPoint(IsNegative(float(mNormal.GetX())) ? minVec.GetX() : maxVec.GetX(), - IsNegative(static_cast(mNormal.GetY())) ? minVec.GetY() : maxVec.GetY(), - IsNegative(static_cast(mNormal.GetZ())) ? minVec.GetZ() : maxVec.GetZ()); + const AZ::Vector3 testPoint(IsNegative(float(m_normal.GetX())) ? minVec.GetX() : maxVec.GetX(), + IsNegative(static_cast(m_normal.GetY())) ? minVec.GetY() : maxVec.GetY(), + IsNegative(static_cast(m_normal.GetZ())) ? minVec.GetZ() : maxVec.GetZ()); - return IsPositive(mNormal.Dot(testPoint) + mDist); + return IsPositive(m_normal.Dot(testPoint) + m_dist); } @@ -25,9 +25,9 @@ MCORE_INLINE bool PlaneEq::CompletelyAbove(const AABB& box) const { const AZ::Vector3 minVec = box.GetMin(); const AZ::Vector3 maxVec = box.GetMax(); - const AZ::Vector3 testPoint(IsPositive(mNormal.GetX()) ? minVec.GetX() : maxVec.GetX(), - IsPositive(mNormal.GetY()) ? minVec.GetY() : maxVec.GetY(), - IsPositive(mNormal.GetZ()) ? minVec.GetZ() : maxVec.GetZ()); + const AZ::Vector3 testPoint(IsPositive(m_normal.GetX()) ? minVec.GetX() : maxVec.GetX(), + IsPositive(m_normal.GetY()) ? minVec.GetY() : maxVec.GetY(), + IsPositive(m_normal.GetZ()) ? minVec.GetZ() : maxVec.GetZ()); - return IsPositive(mNormal.Dot(testPoint) + mDist); + return IsPositive(m_normal.Dot(testPoint) + m_dist); } diff --git a/Gems/EMotionFX/Code/MCore/Source/Random.cpp b/Gems/EMotionFX/Code/MCore/Source/Random.cpp index 393a8f36ed..2a21abc6ae 100644 --- a/Gems/EMotionFX/Code/MCore/Source/Random.cpp +++ b/Gems/EMotionFX/Code/MCore/Source/Random.cpp @@ -24,11 +24,11 @@ namespace MCore r |= 0x3f800000; //result is in [1,2), uniformly distributed union { - float f; - unsigned int i; + float m_f; + unsigned int m_i; } u; - u.i = r; - return u.f - 1.0f; + u.m_i = r; + return u.m_f - 1.0f; } // returns a random direction vector @@ -690,15 +690,15 @@ namespace MCore HaltonSequence::HaltonSequence() { // init members - mDimensions = 0; - mNextDim = 0; - mMemory = 0; - mN = 0; - mN0 = 0; - mX = nullptr; - mRadical = nullptr; - mBase = nullptr; - mOwnBase = false; + m_dimensions = 0; + m_nextDim = 0; + m_memory = 0; + m_n = 0; + m_n0 = 0; + m_x = nullptr; + m_radical = nullptr; + m_base = nullptr; + m_ownBase = false; } @@ -706,15 +706,15 @@ namespace MCore HaltonSequence::HaltonSequence(uint32 dimensions, uint32 offset, uint32* primes) { // init members - mDimensions = 0; - mNextDim = 0; - mMemory = 0; - mN = 0; - mN0 = 0; - mX = nullptr; - mRadical = nullptr; - mBase = nullptr; - mOwnBase = false; + m_dimensions = 0; + m_nextDim = 0; + m_memory = 0; + m_n = 0; + m_n0 = 0; + m_x = nullptr; + m_radical = nullptr; + m_base = nullptr; + m_ownBase = false; // initialize Init(dimensions, offset, primes); @@ -726,33 +726,33 @@ namespace MCore { MCORE_ASSERT(dimensions > 0); - mNextDim = 0; - mDimensions = dimensions; - mX = (double*)MCore::Allocate(dimensions * sizeof(double), MCORE_MEMCATEGORY_HALTONSEQ); - mMemory = sizeof(HaltonSequence) + dimensions * sizeof(double); + m_nextDim = 0; + m_dimensions = dimensions; + m_x = (double*)MCore::Allocate(dimensions * sizeof(double), MCORE_MEMCATEGORY_HALTONSEQ); + m_memory = sizeof(HaltonSequence) + dimensions * sizeof(double); - mN = offset; - mN0 = offset; - mRadical = (double*)MCore::Allocate(dimensions * sizeof(double), MCORE_MEMCATEGORY_HALTONSEQ); + m_n = offset; + m_n0 = offset; + m_radical = (double*)MCore::Allocate(dimensions * sizeof(double), MCORE_MEMCATEGORY_HALTONSEQ); - mOwnBase = (!primes); + m_ownBase = (!primes); - if (mOwnBase) + if (m_ownBase) { - mBase = FirstPrimes((uint32)dimensions); + m_base = FirstPrimes((uint32)dimensions); } else { - mBase = primes; + m_base = primes; } for (uint32 j = 0; j < dimensions; ++j) { - mRadical[j] = 1.0 / (double)mBase[j]; - mX[j] = 0.0; + m_radical[j] = 1.0 / (double)m_base[j]; + m_x[j] = 0.0; } - SetInstance(mN0); + SetInstance(m_n0); } @@ -765,23 +765,23 @@ namespace MCore void HaltonSequence::Release() { - if (mOwnBase && mBase) + if (m_ownBase && m_base) { - MCore::Free(mBase); + MCore::Free(m_base); } - mBase = nullptr; + m_base = nullptr; - if (mRadical) + if (m_radical) { - MCore::Free(mRadical); + MCore::Free(m_radical); } - mRadical = nullptr; + m_radical = nullptr; - if (mX) + if (m_x) { - MCore::Free(mX); + MCore::Free(m_x); } - mX = nullptr; + m_x = nullptr; } @@ -791,49 +791,49 @@ namespace MCore const double one = 1.0 - 1e-10; double h, hh, remainder; - mN++; + m_n++; - if (mN & 8191) + if (m_n & 8191) { - for (uint32 j = 0; j < mDimensions; ++j) + for (uint32 j = 0; j < m_dimensions; ++j) { - remainder = one - mX[j]; + remainder = one - m_x[j]; if (remainder < 0.0) { - mX[j] = 0.0; + m_x[j] = 0.0; } else { - if (mRadical[j] < remainder) + if (m_radical[j] < remainder) { - mX[j] += mRadical[j]; + m_x[j] += m_radical[j]; } else { - h = mRadical[j]; + h = m_radical[j]; do { hh = h; - h *= mRadical[j]; + h *= m_radical[j]; } while (h >= remainder); - mX[j] += hh + h - 1.0; + m_x[j] += hh + h - 1.0; } } } } else { - if (mN >= 1073741824) // 2^30 + if (m_n >= 1073741824) // 2^30 { SetInstance(0); } else { - SetInstance(mN); + SetInstance(m_n); } } } @@ -847,16 +847,16 @@ namespace MCore uint32 b; double fac; - mN = instance; - for (uint32 j = 0; j < mDimensions; ++j) + m_n = instance; + for (uint32 j = 0; j < m_dimensions; ++j) { - mX[j] = 0.0; - fac = mRadical[j]; - b = mBase[j]; + m_x[j] = 0.0; + fac = m_radical[j]; + b = m_base[j]; - for (im = mN; im > 0; im /= b, fac *= mRadical[j]) + for (im = m_n; im > 0; im /= b, fac *= m_radical[j]) { - mX[j] += fac * (double)(im % b); + m_x[j] += fac * (double)(im % b); } } } diff --git a/Gems/EMotionFX/Code/MCore/Source/Random.h b/Gems/EMotionFX/Code/MCore/Source/Random.h index 6e1a51fbb2..55576bb958 100644 --- a/Gems/EMotionFX/Code/MCore/Source/Random.h +++ b/Gems/EMotionFX/Code/MCore/Source/Random.h @@ -299,35 +299,35 @@ namespace MCore * Returns the number of dimensions in the sequence. * @result The number of dimensions. */ - uint32 GetNumDimensions() const { return mDimensions; } + uint32 GetNumDimensions() const { return m_dimensions; } /** * Get the memory usage in bytes by this sequence. * @result The memory usage in bytes by this sequence. */ - uint32 GetMemoryUsage() const { return mMemory; } + uint32 GetMemoryUsage() const { return m_memory; } /** * Get the current vector number. * @result The vector number. */ - uint32 GetVectorNumber() const { return (mN - mN0); } + uint32 GetVectorNumber() const { return (m_n - m_n0); } /** * Get the value of current dimension, and go to the next dimension. * @result The value of the current dimension, and step to the next dimension. */ - double GetNextDimension() { MCORE_ASSERT(mNextDim != mDimensions); return mX[mNextDim++]; } + double GetNextDimension() { MCORE_ASSERT(m_nextDim != m_dimensions); return m_x[m_nextDim++]; } /** * Reset the dimension stepping (by GetNextDimension()) and go to the first dimension again. */ - void ResetNextDimension() { mNextDim = 0; } + void ResetNextDimension() { m_nextDim = 0; } /** * Restart the sequence. */ - void Restart() { SetInstance(mN0); } + void Restart() { SetInstance(m_n0); } /** * Get the next values in the sequence. So update the dimension values. @@ -348,19 +348,19 @@ namespace MCore /** * Get a value for a given dimension. (*sequence[0]) would be the value of the first dimension and (*sequence[1]) would be the value of the second dimension, etc. */ - double operator[](uint32 j) const { MCORE_ASSERT(j < mDimensions); return mX[j]; } + double operator[](uint32 j) const { MCORE_ASSERT(j < m_dimensions); return m_x[j]; } private: - uint32 mDimensions; /**< The number of dimensions to generate random numbers for. */ - uint32 mNextDim; /**< The next dimension. */ - uint32 mMemory; /**< */ - uint32 mN; /**< */ - uint32 mN0; /**< */ - double* mX; /**< */ - double* mRadical; /**< */ - uint32* mBase; /**< Prime numbers. */ - bool mOwnBase; /**< Specifies whether we use our own primes or user specified. */ + uint32 m_dimensions; /**< The number of dimensions to generate random numbers for. */ + uint32 m_nextDim; /**< The next dimension. */ + uint32 m_memory; /**< */ + uint32 m_n; /**< */ + uint32 m_n0; /**< */ + double* m_x; /**< */ + double* m_radical; /**< */ + uint32* m_base; /**< Prime numbers. */ + bool m_ownBase; /**< Specifies whether we use our own primes or user specified. */ /** * Generates the first n number of primes. diff --git a/Gems/EMotionFX/Code/MCore/Source/Ray.cpp b/Gems/EMotionFX/Code/MCore/Source/Ray.cpp index 9498635c3f..7df1188e77 100644 --- a/Gems/EMotionFX/Code/MCore/Source/Ray.cpp +++ b/Gems/EMotionFX/Code/MCore/Source/Ray.cpp @@ -20,23 +20,23 @@ namespace MCore // ray-boundingsphere bool Ray::Intersects(const BoundingSphere& s, AZ::Vector3* intersectA, AZ::Vector3* intersectB) const { - const AZ::Vector3 rayOrg = mOrigin - s.GetCenter(); // ray in space of the sphere + const AZ::Vector3 rayOrg = m_origin - s.GetCenter(); // ray in space of the sphere // The Intersection can be solved by finding the solutions of the quadratic equation: - // (mOrigin + t * mDirection)^2 - s.GetRadiusSquared() = 0 - // Where t is a value that makes (mOrigin + t * mDirection) intersect the sphere + // (m_origin + t * m_direction)^2 - s.GetRadiusSquared() = 0 + // Where t is a value that makes (m_origin + t * m_direction) intersect the sphere // Expanding the above equation we have to find t1 and t2: - // t1 = (-2 * mOrigin * mDirection + sqrt(delta)) / (2 * mDirection^2) - // t2 = (-2 * mOrigin * mDirection - sqrt(delta)) / (2 * mDirection^2) - // where delta = (2 * mOrigin * mDirection) ^ 2 - 4 * mDirection^2 * (mOrigin^2 - s.GetRadiusSquared()) + // t1 = (-2 * m_origin * m_direction + sqrt(delta)) / (2 * m_direction^2) + // t2 = (-2 * m_origin * m_direction - sqrt(delta)) / (2 * m_direction^2) + // where delta = (2 * m_origin * m_direction) ^ 2 - 4 * m_direction^2 * (m_origin^2 - s.GetRadiusSquared()) // The two intersection points will be: - // mOrigin + mDirection * t1 - // mOrigin + mDirection * t2 + // m_origin + m_direction * t1 + // m_origin + m_direction * t2 // If delta < 0, then there is no intersection // If delta == 0, it intersects int he same point // - const float a = mDirection.GetLengthSq(); - const float b = 2.0f * mDirection.Dot(rayOrg); + const float a = m_direction.GetLengthSq(); + const float b = 2.0f * m_direction.Dot(rayOrg); const float c = rayOrg.GetLengthSq() - s.GetRadiusSquared(); const float delta = ((b * b) - 4.0f * a * c); @@ -63,22 +63,22 @@ namespace MCore { if (intersectA) { - (*intersectA) = mOrigin + mDirection * t1; + (*intersectA) = m_origin + m_direction * t1; } if (intersectB) { - (*intersectB) = mOrigin + mDirection * t2; + (*intersectB) = m_origin + m_direction * t2; } } else { if (intersectA) { - (*intersectA) = mOrigin + mDirection * t2; + (*intersectA) = m_origin + m_direction * t2; } if (intersectB) { - (*intersectB) = mOrigin + mDirection * t1; + (*intersectB) = m_origin + m_direction * t1; } } } @@ -88,11 +88,11 @@ namespace MCore const float t = -0.5f * b / a; if (intersectA) { - (*intersectA) = mOrigin + mDirection * t; + (*intersectA) = m_origin + m_direction * t; } if (intersectB) { - (*intersectB) = mOrigin + mDirection * t; + (*intersectB) = m_origin + m_direction * t; } } @@ -104,11 +104,11 @@ namespace MCore bool Ray::Intersects(const PlaneEq& p, AZ::Vector3* intersect) const { // check if ray is parallel to plane (no intersection) or ray pointing away from plane (no intersection) - float dot1 = p.GetNormal().Dot(mDirection); + float dot1 = p.GetNormal().Dot(m_direction); //if (dot1 >= 0) return false; // backface cull // calc second dot product - float dot2 = -(p.GetNormal().Dot(mOrigin) + p.GetDist()); + float dot2 = -(p.GetNormal().Dot(m_origin) + p.GetDist()); // calc t value float t = dot2 / dot1; @@ -127,9 +127,9 @@ namespace MCore // calc intersection point if (intersect) { - intersect->SetX(mOrigin.GetX() + (mDirection.GetX() * t)); - intersect->SetY(mOrigin.GetY() + (mDirection.GetY() * t)); - intersect->SetZ(mOrigin.GetZ() + (mDirection.GetZ() * t)); + intersect->SetX(m_origin.GetX() + (m_direction.GetX() * t)); + intersect->SetY(m_origin.GetY() + (m_direction.GetY() * t)); + intersect->SetZ(m_origin.GetZ() + (m_direction.GetZ() * t)); } return true; @@ -144,7 +144,7 @@ namespace MCore const AZ::Vector3 edge2 = p3 - p1; // begin calculating determinant - also used to calculate U parameter - const AZ::Vector3 dir = mDest - mOrigin; + const AZ::Vector3 dir = m_dest - m_origin; const AZ::Vector3 pvec = dir.Cross(edge2); // if determinant is near zero, ray lies in plane of triangle @@ -155,7 +155,7 @@ namespace MCore } // calculate distance from vert0 to ray origin - const AZ::Vector3 tvec = mOrigin - p1; + const AZ::Vector3 tvec = m_origin - p1; // calculate U parameter and test bounds const float inv_det = 1.0f / det; @@ -193,7 +193,7 @@ namespace MCore } if (intersect) { - *intersect = mOrigin + t * dir; + *intersect = m_origin + t * dir; } // yes, there was an intersection @@ -212,10 +212,10 @@ namespace MCore // For all three axes, check the near and far intersection point on the two slabs for (int32 i = 0; i < 3; i++) { - if (Math::Abs(mDirection.GetElement(i)) < Math::epsilon) + if (Math::Abs(m_direction.GetElement(i)) < Math::epsilon) { // direction is parallel to this plane, check if we're somewhere between min and max - if ((mOrigin.GetElement(i) < minVec.GetElement(i)) || (mOrigin.GetElement(i) > maxVec.GetElement(i))) + if ((m_origin.GetElement(i) < minVec.GetElement(i)) || (m_origin.GetElement(i) > maxVec.GetElement(i))) { return false; } @@ -223,8 +223,8 @@ namespace MCore else { // calculate t's at the near and far slab, see if these are min or max t's - float t1 = (minVec.GetElement(i) - mOrigin.GetElement(i)) / mDirection.GetElement(i); - float t2 = (maxVec.GetElement(i) - mOrigin.GetElement(i)) / mDirection.GetElement(i); + float t1 = (minVec.GetElement(i) - m_origin.GetElement(i)) / m_direction.GetElement(i); + float t2 = (maxVec.GetElement(i) - m_origin.GetElement(i)) / m_direction.GetElement(i); if (t1 > t2) { float temp = t1; @@ -248,12 +248,12 @@ namespace MCore if (intersectA) { - *intersectA = mOrigin + mDirection * tNear; + *intersectA = m_origin + m_direction * tNear; } if (intersectB) { - *intersectB = mOrigin + mDirection * tFar; + *intersectB = m_origin + m_direction * tFar; } return true; diff --git a/Gems/EMotionFX/Code/MCore/Source/Ray.h b/Gems/EMotionFX/Code/MCore/Source/Ray.h index f5fa779bd2..1d5bec0f43 100644 --- a/Gems/EMotionFX/Code/MCore/Source/Ray.h +++ b/Gems/EMotionFX/Code/MCore/Source/Ray.h @@ -46,9 +46,9 @@ namespace MCore * @param endPoint The end (destination) point of the ray. */ MCORE_INLINE Ray(const AZ::Vector3& org, const AZ::Vector3& endPoint) - : mOrigin(org) - , mDest(endPoint) - , mDirection((endPoint - org).GetNormalized()) {} + : m_origin(org) + , m_dest(endPoint) + , m_direction((endPoint - org).GetNormalized()) {} /** * Constructor which sets the origin, destination point and direction. @@ -57,9 +57,9 @@ namespace MCore * @param dir The normalized direction vector of the ray, which should be (endPoint - startPoint).Normalize() */ MCORE_INLINE Ray(const AZ::Vector3& org, const AZ::Vector3& endPoint, const AZ::Vector3& dir) - : mOrigin(org) - , mDest(endPoint) - , mDirection(dir) {} + : m_origin(org) + , m_dest(endPoint) + , m_direction(dir) {} /** * Set the origin and destination point (end point) of the ray. @@ -67,37 +67,37 @@ namespace MCore * @param org The origin of the ray, so the start point. * @param endPoint The destination of the ray, so the end point. */ - MCORE_INLINE void Set(const AZ::Vector3& org, const AZ::Vector3& endPoint) { mOrigin = org; mDest = endPoint; mDirection = (mDest - mOrigin).GetNormalized(); } + MCORE_INLINE void Set(const AZ::Vector3& org, const AZ::Vector3& endPoint) { m_origin = org; m_dest = endPoint; m_direction = (m_dest - m_origin).GetNormalized(); } /** * Set the origin of the ray, so the start point. The direction will automatically be updated as well. * @param org The origin. */ - MCORE_INLINE void SetOrigin(const AZ::Vector3& org) { mOrigin = org; mDirection = (mDest - mOrigin).GetNormalized(); } + MCORE_INLINE void SetOrigin(const AZ::Vector3& org) { m_origin = org; m_direction = (m_dest - m_origin).GetNormalized(); } /** * Set the destination point of the ray. * @param dest The destination of the ray. */ - MCORE_INLINE void SetDest(const AZ::Vector3& dest) { mDest = dest; mDirection = (mDest - mOrigin).GetNormalized(); } + MCORE_INLINE void SetDest(const AZ::Vector3& dest) { m_dest = dest; m_direction = (m_dest - m_origin).GetNormalized(); } /** * Get the origin of the ray. * @result The origin of the ray, so where it starts. */ - MCORE_INLINE const AZ::Vector3& GetOrigin() const { return mOrigin; } + MCORE_INLINE const AZ::Vector3& GetOrigin() const { return m_origin; } /** * Get the destination of the ray. * @result The destination point of the ray, so where it ends. */ - MCORE_INLINE const AZ::Vector3& GetDest() const { return mDest; } + MCORE_INLINE const AZ::Vector3& GetDest() const { return m_dest; } /** * Get the direction of the ray. * @result The normalized direction vector of the ray, so the direction its heading to. */ - MCORE_INLINE const AZ::Vector3& GetDirection() const { return mDirection; } + MCORE_INLINE const AZ::Vector3& GetDirection() const { return m_direction; } /** * Perform a ray/sphere intersection test. @@ -161,11 +161,11 @@ namespace MCore * Calculates the length of the ray. * @result The length of the ray. */ - MCORE_INLINE float Length() const { return SafeLength(mDest - mOrigin); } + MCORE_INLINE float Length() const { return SafeLength(m_dest - m_origin); } private: - AZ::Vector3 mOrigin; /**< The origin of the ray. */ - AZ::Vector3 mDest; /**< The destination of the ray. */ - AZ::Vector3 mDirection; /**< The normalized direction vector of the ray. */ + AZ::Vector3 m_origin; /**< The origin of the ray. */ + AZ::Vector3 m_dest; /**< The destination of the ray. */ + AZ::Vector3 m_direction; /**< The normalized direction vector of the ray. */ }; } // namespace MCore diff --git a/Gems/EMotionFX/Code/MCore/Source/SmallArray.h b/Gems/EMotionFX/Code/MCore/Source/SmallArray.h index 69e3219b7f..ab94cabbfe 100644 --- a/Gems/EMotionFX/Code/MCore/Source/SmallArray.h +++ b/Gems/EMotionFX/Code/MCore/Source/SmallArray.h @@ -36,32 +36,32 @@ class SmallArray * Default constructor. * Initializes the array so it's empty and has no memory allocated. */ - MCORE_INLINE SmallArray() : mData(nullptr), mLength(0) {} + MCORE_INLINE SmallArray() : m_data(nullptr), m_length(0) {} /** * Constructor which creates a given number of elements. * @param elems The element data. * @param num The number of elements in 'elems'. */ - MCORE_INLINE explicit SmallArray(T* elems, uint32 num) : mLength(num) { mData = (T*)MCore::Allocate(mLength * sizeof(T), MCORE_MEMCATEGORY_SMALLARRAY, MEMORYBLOCK_ID, MCORE_FILE, MCORE_LINE); for (uint32 i=0; i 0) { mData = (T*)MCore::Allocate(mLength * sizeof(T), MCORE_MEMCATEGORY_SMALLARRAY, MEMORYBLOCK_ID, MCORE_FILE, MCORE_LINE); for (uint32 i=0; i 0) { m_data = (T*)MCore::Allocate(m_length * sizeof(T), MCORE_MEMCATEGORY_SMALLARRAY, MEMORYBLOCK_ID, MCORE_FILE, MCORE_LINE); for (uint32 i=0; i& other) : mData(nullptr), mLength(0) { *this = other; } + SmallArray(const SmallArray& other) : m_data(nullptr), m_length(0) { *this = other; } /** * Move constructor. * @param other The array to move the data from. */ - SmallArray(SmallArray&& other) { mData=other.mData; mLength=other.mLength; other.mData=nullptr; other.mLength=0; } + SmallArray(SmallArray&& other) { m_data=other.m_data; m_length=other.m_length; other.m_data=nullptr; other.m_length=0; } /** * Destructor. Deletes all entry data. @@ -80,143 +80,143 @@ class SmallArray * data.Clear(); * */ - ~SmallArray() { for (uint32 i=0; i); return result; } + MCORE_INLINE uint32 CalcMemoryUsage(bool includeMembers=true) const { uint32 result = m_length*sizeof(T); if (includeMembers) result+=sizeof(MCore::SmallArray); return result; } /** * Set a given element to a given value. * @param pos The element number. * @param value The value to store at that element number. */ - MCORE_INLINE void SetElem(uint32 pos, const T& value) { mData[pos] = value; } + MCORE_INLINE void SetElem(uint32 pos, const T& value) { m_data[pos] = value; } /** * Add a given element to the back of the array. * @param x The element to add. */ - MCORE_INLINE void Add(const T& x) { Grow(++mLength); Construct(mLength-1, x); } + MCORE_INLINE void Add(const T& x) { Grow(++m_length); Construct(m_length-1, x); } /** * Add a given array to the back of this array. * @param a The array to add. */ - MCORE_INLINE void Add(const SmallArray& a) { uint32 l=mLength; Grow(mLength+a.mLength); for (uint32 i=0; i& a) { uint32 l=m_length; Grow(m_length+a.m_length); for (uint32 i=0; i 0) Remove((uint32)0); } + MCORE_INLINE void RemoveFirst() { if (m_length > 0) Remove((uint32)0); } /** * Remove the last array element. */ - MCORE_INLINE void RemoveLast() { if (mLength > 0) Destruct(--mLength); } + MCORE_INLINE void RemoveLast() { if (m_length > 0) Destruct(--m_length); } /** * Insert an empty element (default constructed) at a given position in the array. * @param pos The position to create the empty element. */ - MCORE_INLINE void Insert(uint32 pos) { Grow(mLength+1); MoveElements(pos+1, pos, mLength-pos-1); Construct(pos); } + MCORE_INLINE void Insert(uint32 pos) { Grow(m_length+1); MoveElements(pos+1, pos, m_length-pos-1); Construct(pos); } /** * Insert a given element at a given position in the array. * @param pos The position to insert the empty element. * @param x The element to store at this position. */ - MCORE_INLINE void Insert(uint32 pos, const T& x) { Grow(mLength+1); MoveElements(pos+1, pos, mLength-pos-1); Construct(pos, x); } + MCORE_INLINE void Insert(uint32 pos, const T& x) { Grow(m_length+1); MoveElements(pos+1, pos, m_length-pos-1); Construct(pos, x); } /** * Remove an element at a given position. * @param pos The element number to remove. */ - MCORE_INLINE void Remove(uint32 pos) { Destruct(pos); MoveElements(pos, pos+1, mLength-pos-1); mLength--; } + MCORE_INLINE void Remove(uint32 pos) { Destruct(pos); MoveElements(pos, pos+1, m_length-pos-1); m_length--; } /** * Remove a given number of elements starting at a given position in the array. * @param pos The start element, so to start removing from. * @param num The number of elements to remove from this position. */ - MCORE_INLINE void Remove(uint32 pos, uint32 num) { for (uint32 i=pos; i * ABGDEF [this is the result. G has been moved to the empty position]. */ - MCORE_INLINE void SwapRemove(uint32 pos) { Destruct(pos); if (pos != mLength-1) { Construct(pos, mData[mLength-1]); Destruct(mLength-1); } mLength--; } // remove element at and place the last element of the array in that position + MCORE_INLINE void SwapRemove(uint32 pos) { Destruct(pos); if (pos != m_length-1) { Construct(pos, m_data[m_length-1]); Destruct(m_length-1); } m_length--; } // remove element at and place the last element of the array in that position /** * Swap two elements. @@ -247,19 +247,19 @@ class SmallArray * @param clearMem If set to true (default) the allocated memory will also be released. If set to false, GetMaxLength() will still return the number of elements * which the array contained before calling the Clear() method. */ - MCORE_INLINE void Clear(bool clearMem=true) { for (uint32 i=0; i= newLength) return; uint32 oldLen=mLength; Grow(newLength); for (uint32 i=oldLen; i= newLength) return; uint32 oldLen=m_length; Grow(newLength); for (uint32 i=oldLen; i mLength) + if (newLength > m_length) { // growing array, construct empty elements at end of array - uint32 oldLen = mLength; + uint32 oldLen = m_length; GrowExact(newLength); - if (mData == nullptr) + if (m_data == nullptr) { return false; } @@ -329,10 +329,10 @@ class SmallArray else { // shrinking array, destruct elements at end of array - for (uint32 i=newLength; i 0) - MCore::MemMove(mData+destIndex, mData+sourceIndex, numElements * sizeof(T)); + MCore::MemMove(m_data+destIndex, m_data+sourceIndex, numElements * sizeof(T)); } // operators - bool operator==(const SmallArray& other) const { if (mLength != other.mLength) return false; for (uint32 i=0; i& operator= (const SmallArray& other) { if (&other != this) { Clear(); Grow(other.mLength); for (uint32 i=0; i& operator= (SmallArray&& other) { MCORE_ASSERT(&other != this); if (mData!=nullptr) MCore::Free(mData); mData=other.mData; mLength=other.mLength; other.mData=nullptr; other.mLength=0; return *this; } - //SmallArray& operator+ (const SmallArray& other) const { SmallArray newArray; newArray.Grow(mLength+other.mLength); uint32 i; for (i=0; i& other) const { if (m_length != other.m_length) return false; for (uint32 i=0; i& operator= (const SmallArray& other) { if (&other != this) { Clear(); Grow(other.m_length); for (uint32 i=0; i& operator= (SmallArray&& other) { MCORE_ASSERT(&other != this); if (m_data!=nullptr) MCore::Free(m_data); m_data=other.m_data; m_length=other.m_length; other.m_data=nullptr; other.m_length=0; return *this; } SmallArray& operator+=(const T& other) { Add(other); return *this; } SmallArray& operator+=(const SmallArray& other) { Add(other); return *this; } - MCORE_INLINE T& operator[](const uint32 index) { MCORE_ASSERT(indexFree(); return; } - if (mData) - mData = (T*)MCore::Realloc(mData, newSize * sizeof(T), MCORE_MEMCATEGORY_SMALLARRAY, MEMORYBLOCK_ID, MCORE_FILE, MCORE_LINE); + if (m_data) + m_data = (T*)MCore::Realloc(m_data, newSize * sizeof(T), MCORE_MEMCATEGORY_SMALLARRAY, MEMORYBLOCK_ID, MCORE_FILE, MCORE_LINE); else - mData = (T*)MCore::Allocate(newSize * sizeof(T), MCORE_MEMCATEGORY_SMALLARRAY, MEMORYBLOCK_ID, MCORE_FILE, MCORE_LINE); + m_data = (T*)MCore::Allocate(newSize * sizeof(T), MCORE_MEMCATEGORY_SMALLARRAY, MEMORYBLOCK_ID, MCORE_FILE, MCORE_LINE); } - MCORE_INLINE void Free() { mLength=0; if (mData) MCore::Free(mData); mData=nullptr; } - MCORE_INLINE void Construct(uint32 index, const T& original) { ::new(mData+index) T(original); } // copy-construct an element at which is a copy of - MCORE_INLINE void Construct(uint32 index) { ::new(mData+index) T; } // construct an element at place + MCORE_INLINE void Free() { m_length=0; if (m_data) MCore::Free(m_data); m_data=nullptr; } + MCORE_INLINE void Construct(uint32 index, const T& original) { ::new(m_data+index) T(original); } // copy-construct an element at which is a copy of + MCORE_INLINE void Construct(uint32 index) { ::new(m_data+index) T; } // construct an element at place MCORE_INLINE void Destruct(uint32 index) { #if (MCORE_COMPILER == MCORE_COMPILER_MSVC) // work around a compiler bug, marking this index parameter as unused MCORE_UNUSED(index); #endif - (mData+index)->~T(); + (m_data+index)->~T(); } // destruct an element at // partition part of array (for sorting) int32 Partition(int32 left, int32 right, CmpFunc cmp) { - ::MCore::Swap(mData[left], mData[ (left+right)>>1 ]); + ::MCore::Swap(m_data[left], m_data[ (left+right)>>1 ]); - T& target = mData[right]; + T& target = m_data[right]; int32 i = left-1; int32 j = right; bool neverQuit = true; // workaround to disable a "warning C4127: conditional expression is constant" while (neverQuit) { - while (i < j) { if (cmp(mData[++i], target) >= 0) break; } - while (j > i) { if (cmp(mData[--j], target) <= 0) break; } + while (i < j) { if (cmp(m_data[++i], target) >= 0) break; } + while (j > i) { if (cmp(m_data[--j], target) <= 0) break; } if (i >= j) break; - ::MCore::Swap(mData[i], mData[j]); + ::MCore::Swap(m_data[i], m_data[j]); } - ::MCore::Swap(mData[i], mData[right]); + ::MCore::Swap(m_data[i], m_data[right]); return i; } }; diff --git a/Gems/EMotionFX/Code/MCore/Source/StringIdPool.cpp b/Gems/EMotionFX/Code/MCore/Source/StringIdPool.cpp index dc08f628fe..643258373b 100644 --- a/Gems/EMotionFX/Code/MCore/Source/StringIdPool.cpp +++ b/Gems/EMotionFX/Code/MCore/Source/StringIdPool.cpp @@ -29,13 +29,13 @@ namespace MCore { Lock(); - for (AZStd::basic_string*& string : mStrings) + for (AZStd::basic_string*& string : m_strings) { delete string; } - mStrings.clear(); + m_strings.clear(); - mStringToIndex.clear(); + m_stringToIndex.clear(); Unlock(); } @@ -43,7 +43,7 @@ namespace MCore AZ::u32 StringIdPool::GenerateIdForStringWithoutLock(const AZStd::string& objectName) { // Try to insert it, if we hit a collision, we have the element. - auto iterator = mStringToIndex.emplace(objectName, aznumeric_caster(mStrings.size())); + auto iterator = m_stringToIndex.emplace(objectName, aznumeric_caster(m_strings.size())); if (!iterator.second) { // could not insert, we have the element @@ -52,7 +52,7 @@ namespace MCore // Create the new string object and push it to the string list. AZStd::string* newString = new AZStd::string(objectName); - mStrings.push_back(newString); + m_strings.push_back(newString); // The string was already added to the hashmap return iterator.first->second; @@ -72,7 +72,7 @@ namespace MCore { Lock(); MCORE_ASSERT(id != InvalidIndex32); - const AZStd::string* stringAddress = mStrings[id]; + const AZStd::string* stringAddress = m_strings[id]; Unlock(); return *stringAddress; } @@ -81,7 +81,7 @@ namespace MCore void StringIdPool::Reserve(size_t numStrings) { Lock(); - mStrings.reserve(numStrings); + m_strings.reserve(numStrings); Unlock(); } @@ -89,27 +89,27 @@ namespace MCore // Wait with execution until we can set the lock. void StringIdPool::Lock() { - mMutex.Lock(); + m_mutex.Lock(); } // Release the lock again. void StringIdPool::Unlock() { - mMutex.Unlock(); + m_mutex.Unlock(); } void StringIdPool::Log(bool includeEntries) { - AZ_Printf("EMotionFX", "StringIdPool: NumEntries=%d\n", mStrings.size()); + AZ_Printf("EMotionFX", "StringIdPool: NumEntries=%d\n", m_strings.size()); if (includeEntries) { - const size_t numStrings = mStrings.size(); + const size_t numStrings = m_strings.size(); for (size_t i = 0; i < numStrings; ++i) { - AZ_Printf("EMotionFX", " #%d: String='%s', Id=%d\n", i, mStrings[i]->c_str(), GenerateIdForString(mStrings[i]->c_str())); + AZ_Printf("EMotionFX", " #%d: String='%s', Id=%d\n", i, m_strings[i]->c_str(), GenerateIdForString(m_strings[i]->c_str())); } } } diff --git a/Gems/EMotionFX/Code/MCore/Source/StringIdPool.h b/Gems/EMotionFX/Code/MCore/Source/StringIdPool.h index 9f58adf028..75bbc1b010 100644 --- a/Gems/EMotionFX/Code/MCore/Source/StringIdPool.h +++ b/Gems/EMotionFX/Code/MCore/Source/StringIdPool.h @@ -66,9 +66,9 @@ namespace MCore private: - AZStd::vector mStrings; - AZStd::unordered_map mStringToIndex; /**< The string to index table, where the index maps into mNames array and is directly the ID. */ - Mutex mMutex; /**< The multithread lock. */ + AZStd::vector m_strings; + AZStd::unordered_map m_stringToIndex; /**< The string to index table, where the index maps into m_names array and is directly the ID. */ + Mutex m_mutex; /**< The multithread lock. */ StringIdPool(); ~StringIdPool(); diff --git a/Gems/EMotionFX/Code/MysticQt/Source/DialogStack.cpp b/Gems/EMotionFX/Code/MysticQt/Source/DialogStack.cpp index 6a6d540519..27f83b07a3 100644 --- a/Gems/EMotionFX/Code/MysticQt/Source/DialogStack.cpp +++ b/Gems/EMotionFX/Code/MysticQt/Source/DialogStack.cpp @@ -60,15 +60,15 @@ namespace MysticQt setObjectName("DialogStack"); // create the root splitter - mRootSplitter = new DialogStackSplitter(); - mRootSplitter->setOrientation(Qt::Vertical); - mRootSplitter->setChildrenCollapsible(false); + m_rootSplitter = new DialogStackSplitter(); + m_rootSplitter->setOrientation(Qt::Vertical); + m_rootSplitter->setChildrenCollapsible(false); // set the widget resizable to have the scrollarea resizing it setWidgetResizable(true); // set the scrollarea widget - setWidget(mRootSplitter); + setWidget(m_rootSplitter); } @@ -82,7 +82,7 @@ namespace MysticQt void DialogStack::Clear() { // destroy the dialogs - mDialogs.clear(); + m_dialogs.clear(); // update the scroll bars UpdateScrollBars(); @@ -103,10 +103,10 @@ namespace MysticQt // add the dialog widget // the splitter is hierarchical : {a, {b, c}} DialogStackSplitter* dialogSplitter; - if (mDialogs.empty()) + if (m_dialogs.empty()) { // add the dialog widget - dialogSplitter = mRootSplitter; + dialogSplitter = m_rootSplitter; dialogSplitter->addWidget(dialogWidget); // stretch if needed @@ -118,10 +118,10 @@ namespace MysticQt else { // check if one space is free on the last splitter - if (mDialogs.back().mSplitter->count() == 1) + if (m_dialogs.back().m_splitter->count() == 1) { // add the dialog widget - dialogSplitter = mDialogs.back().mSplitter; + dialogSplitter = m_dialogs.back().m_splitter; dialogSplitter->addWidget(dialogWidget); // stretch if needed @@ -131,16 +131,16 @@ namespace MysticQt } // less space used by the splitter when the last dialog is closed - if (mDialogs.back().mFrame->isHidden()) + if (m_dialogs.back().m_frame->isHidden()) { - mDialogs.back().mSplitter->handle(1)->setFixedHeight(1); - mDialogs.back().mSplitter->setStyleSheet("QSplitter::handle{ height: 1px; background: transparent; }"); + m_dialogs.back().m_splitter->handle(1)->setFixedHeight(1); + m_dialogs.back().m_splitter->setStyleSheet("QSplitter::handle{ height: 1px; background: transparent; }"); } // disable the splitter - if (mDialogs.back().mFrame->isHidden()) + if (m_dialogs.back().m_frame->isHidden()) { - mDialogs.back().mSplitter->handle(1)->setDisabled(true); + m_dialogs.back().m_splitter->handle(1)->setDisabled(true); } } else // already two dialogs in the splitter @@ -151,24 +151,24 @@ namespace MysticQt dialogSplitter->setChildrenCollapsible(false); // add the current last dialog and the new dialog after - dialogSplitter->addWidget(mDialogs.back().mDialogWidget); + dialogSplitter->addWidget(m_dialogs.back().m_dialogWidget); dialogSplitter->addWidget(dialogWidget); // stretch if needed - if (mDialogs.back().mMaximizeSize && mDialogs.back().mStretchWhenMaximize) + if (m_dialogs.back().m_maximizeSize && m_dialogs.back().m_stretchWhenMaximize) { dialogSplitter->setStretchFactor(0, 1); } // less space used by the splitter when the last dialog is closed - if (mDialogs.back().mFrame->isHidden()) + if (m_dialogs.back().m_frame->isHidden()) { dialogSplitter->handle(1)->setFixedHeight(1); dialogSplitter->setStyleSheet("QSplitter::handle{ height: 1px; background: transparent; }"); } // disable the splitter - if (mDialogs.back().mFrame->isHidden()) + if (m_dialogs.back().m_frame->isHidden()) { dialogSplitter->handle(1)->setDisabled(true); } @@ -180,27 +180,27 @@ namespace MysticQt } // replace the last dialog by the new splitter - mDialogs.back().mSplitter->addWidget(dialogSplitter); + m_dialogs.back().m_splitter->addWidget(dialogSplitter); // disable the splitter - if (mDialogs.size() > 1) + if (m_dialogs.size() > 1) { - const auto previousDialogIt = mDialogs.end() - 2; - if (previousDialogIt->mFrame->isHidden()) + const auto previousDialogIt = m_dialogs.end() - 2; + if (previousDialogIt->m_frame->isHidden()) { - mDialogs.back().mSplitter->handle(1)->setDisabled(true); + m_dialogs.back().m_splitter->handle(1)->setDisabled(true); } // stretch the splitter if needed // the correct behavior is found after experimentations - if ((mDialogs.back().mMaximizeSize && mDialogs.back().mStretchWhenMaximize) || (previousDialogIt->mMaximizeSize && previousDialogIt->mStretchWhenMaximize == false)) + if ((m_dialogs.back().m_maximizeSize && m_dialogs.back().m_stretchWhenMaximize) || (previousDialogIt->m_maximizeSize && previousDialogIt->m_stretchWhenMaximize == false)) { - mDialogs.back().mSplitter->setStretchFactor(1, 1); + m_dialogs.back().m_splitter->setStretchFactor(1, 1); } } // set the new splitter of the last dialog - mDialogs.back().mSplitter = dialogSplitter; + m_dialogs.back().m_splitter = dialogSplitter; } } @@ -263,19 +263,19 @@ namespace MysticQt dialogWidget->adjustSize(); // register it, so that we know which frame is linked to which header button - mDialogs.emplace_back(Dialog{ - /*.mButton =*/ headerButton, - /*.mFrame =*/ frame, - /*.mWidget =*/ widget, - /*.mDialogWidget =*/ dialogWidget, - /*.mSplitter =*/ dialogSplitter, - /*.mClosable =*/ closable, - /*.mMaximizeSize =*/ maximizeSize, - /*.mStretchWhenMaximize =*/ stretchWhenMaximize, - /*.mMinimumHeightBeforeClose =*/ 0, - /*.mMaximumHeightBeforeClose =*/ 0, - /*.mLayout =*/ layout, - /*.mDialogLayout =*/ dialogLayout, + m_dialogs.emplace_back(Dialog{ + /*.m_button =*/ headerButton, + /*.m_frame =*/ frame, + /*.m_widget =*/ widget, + /*.m_dialogWidget =*/ dialogWidget, + /*.m_splitter =*/ dialogSplitter, + /*.m_closable =*/ closable, + /*.m_maximizeSize =*/ maximizeSize, + /*.m_stretchWhenMaximize =*/ stretchWhenMaximize, + /*.m_minimumHeightBeforeClose =*/ 0, + /*.m_maximumHeightBeforeClose =*/ 0, + /*.m_layout =*/ layout, + /*.m_dialogLayout =*/ dialogLayout, }); // check if the dialog is closed @@ -305,12 +305,12 @@ namespace MysticQt bool DialogStack::Remove(QWidget* widget) { - const auto foundDialog = AZStd::find_if(begin(mDialogs), end(mDialogs), [widget](const Dialog& dialog) + const auto foundDialog = AZStd::find_if(begin(m_dialogs), end(m_dialogs), [widget](const Dialog& dialog) { - return dialog.mFrame->layout()->indexOf(widget) != -1; + return dialog.m_frame->layout()->indexOf(widget) != -1; }); - if (foundDialog == end(mDialogs)) + if (foundDialog == end(m_dialogs)) { return false; } @@ -318,9 +318,9 @@ namespace MysticQt // if the widget is located in the current layout, remove it // all next dialogs has to be moved to the previous splitter and delete if the last splitter is empty // TODO : shift all dialogs needed as explained on the previous comment - foundDialog->mDialogWidget->hide(); - foundDialog->mDialogWidget->deleteLater(); - mDialogs.erase(foundDialog); + foundDialog->m_dialogWidget->hide(); + foundDialog->m_dialogWidget->deleteLater(); + m_dialogs.erase(foundDialog); // update the scroll bars UpdateScrollBars(); @@ -334,7 +334,7 @@ namespace MysticQt { QPushButton* button = (QPushButton*)sender(); const size_t dialogIndex = FindDialog(button); - if (mDialogs[dialogIndex].mFrame->isHidden()) + if (m_dialogs[dialogIndex].m_frame->isHidden()) { Open(button); } @@ -348,83 +348,83 @@ namespace MysticQt // find the dialog that goes with the given button size_t DialogStack::FindDialog(QPushButton* pushButton) { - const auto foundDialog = AZStd::find_if(begin(mDialogs), end(mDialogs), [pushButton](const Dialog& dialog) + const auto foundDialog = AZStd::find_if(begin(m_dialogs), end(m_dialogs), [pushButton](const Dialog& dialog) { - return dialog.mButton == pushButton; + return dialog.m_button == pushButton; }); - return foundDialog != end(mDialogs) ? AZStd::distance(begin(mDialogs), foundDialog) : MCore::InvalidIndex; + return foundDialog != end(m_dialogs) ? AZStd::distance(begin(m_dialogs), foundDialog) : MCore::InvalidIndex; } // open the dialog void DialogStack::Open(QPushButton* button) { - const auto dialog = AZStd::find_if(begin(mDialogs), end(mDialogs), [button](const Dialog& dialog) + const auto dialog = AZStd::find_if(begin(m_dialogs), end(m_dialogs), [button](const Dialog& dialog) { - return dialog.mButton == button; + return dialog.m_button == button; }); - if (dialog == end(mDialogs)) + if (dialog == end(m_dialogs)) { return; } // show the widget inside the dialog - dialog->mFrame->show(); + dialog->m_frame->show(); // set the previous minimum and maximum height before closed - dialog->mDialogWidget->setMinimumHeight(dialog->mMinimumHeightBeforeClose); - dialog->mDialogWidget->setMaximumHeight(dialog->mMaximumHeightBeforeClose); + dialog->m_dialogWidget->setMinimumHeight(dialog->m_minimumHeightBeforeClose); + dialog->m_dialogWidget->setMaximumHeight(dialog->m_maximumHeightBeforeClose); // change the stylesheet and the icon button->setStyleSheet(""); button->setIcon(GetMysticQt()->FindIcon("Images/Icons/ArrowDownGray.png")); // more space used by the splitter when the dialog is open - if (dialog != mDialogs.end() - 1) + if (dialog != m_dialogs.end() - 1) { - dialog->mSplitter->handle(1)->setFixedHeight(4); - dialog->mSplitter->setStyleSheet("QSplitter::handle{ height: 4px; background: transparent; }"); + dialog->m_splitter->handle(1)->setFixedHeight(4); + dialog->m_splitter->setStyleSheet("QSplitter::handle{ height: 4px; background: transparent; }"); } // enable the splitter - if (dialog != mDialogs.end() - 1) + if (dialog != m_dialogs.end() - 1) { - dialog->mSplitter->handle(1)->setEnabled(true); + dialog->m_splitter->handle(1)->setEnabled(true); } // maximize the size if it's needed - if (mDialogs.size() > 1) + if (m_dialogs.size() > 1) { - if (dialog->mMaximizeSize) + if (dialog->m_maximizeSize) { // special case if it's the first dialog - if (dialog == mDialogs.begin()) + if (dialog == m_dialogs.begin()) { // if it's the first dialog and stretching is enabled, it expand to the max, all others expand to the min - if (dialog->mStretchWhenMaximize == false && (dialog + 1)->mMaximizeSize && (dialog + 1)->mFrame->isHidden() == false) + if (dialog->m_stretchWhenMaximize == false && (dialog + 1)->m_maximizeSize && (dialog + 1)->m_frame->isHidden() == false) { - static_cast(dialog->mSplitter)->MoveFirstSplitterToMin(); + static_cast(dialog->m_splitter)->MoveFirstSplitterToMin(); } else { - static_cast(dialog->mSplitter)->MoveFirstSplitterToMax(); + static_cast(dialog->m_splitter)->MoveFirstSplitterToMax(); } } else // not the first dialog { // set the previous dialog to the min to have this dialog expanded to the top - if ((dialog - 1)->mFrame->isHidden() || (dialog - 1)->mMaximizeSize == false || ((dialog - 1)->mMaximizeSize && (dialog - 1)->mStretchWhenMaximize == false)) + if ((dialog - 1)->m_frame->isHidden() || (dialog - 1)->m_maximizeSize == false || ((dialog - 1)->m_maximizeSize && (dialog - 1)->m_stretchWhenMaximize == false)) { - static_cast((dialog - 1)->mSplitter)->MoveFirstSplitterToMin(); + static_cast((dialog - 1)->m_splitter)->MoveFirstSplitterToMin(); } // special case if it's not the last dialog - if (dialog != mDialogs.end() - 1) + if (dialog != m_dialogs.end() - 1) { // if the next dialog is closed, it's needed to expand to the max too - if ((dialog + 1)->mFrame->isHidden()) + if ((dialog + 1)->m_frame->isHidden()) { - static_cast(dialog->mSplitter)->MoveFirstSplitterToMax(); + static_cast(dialog->m_splitter)->MoveFirstSplitterToMax(); } } } @@ -439,58 +439,58 @@ namespace MysticQt // close the dialog void DialogStack::Close(QPushButton* button) { - const auto dialog = AZStd::find_if(begin(mDialogs), end(mDialogs), [button](const Dialog& dialog) + const auto dialog = AZStd::find_if(begin(m_dialogs), end(m_dialogs), [button](const Dialog& dialog) { - return dialog.mButton == button; + return dialog.m_button == button; }); - if (dialog == end(mDialogs)) + if (dialog == end(m_dialogs)) { return; } // only closable dialog can be closed - if (dialog->mClosable == false) + if (dialog->m_closable == false) { return; } // keep the min and max height before close - dialog->mMinimumHeightBeforeClose = dialog->mDialogWidget->minimumHeight(); - dialog->mMaximumHeightBeforeClose = dialog->mDialogWidget->maximumHeight(); + dialog->m_minimumHeightBeforeClose = dialog->m_dialogWidget->minimumHeight(); + dialog->m_maximumHeightBeforeClose = dialog->m_dialogWidget->maximumHeight(); // hide the widget inside the dialog - dialog->mFrame->hide(); + dialog->m_frame->hide(); // set the widget to fixed size to not have it possible to resize - dialog->mDialogWidget->setMinimumHeight(dialog->mButton->height()); - dialog->mDialogWidget->setMaximumHeight(dialog->mButton->height()); + dialog->m_dialogWidget->setMinimumHeight(dialog->m_button->height()); + dialog->m_dialogWidget->setMaximumHeight(dialog->m_button->height()); // change the stylesheet and the icon button->setStyleSheet("border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border: 1px solid rgb(40,40,40);"); // TODO: link to the real style sheets button->setIcon(GetMysticQt()->FindIcon("Images/Icons/ArrowRightGray.png")); // less space used by the splitter when the dialog is closed - if (dialog < mDialogs.end() - 1) + if (dialog < m_dialogs.end() - 1) { - dialog->mSplitter->handle(1)->setFixedHeight(1); - dialog->mSplitter->setStyleSheet("QSplitter::handle{ height: 1px; background: transparent; }"); - dialog->mSplitter->handle(1)->setDisabled(true); - static_cast(dialog->mSplitter)->MoveFirstSplitterToMin(); + dialog->m_splitter->handle(1)->setFixedHeight(1); + dialog->m_splitter->setStyleSheet("QSplitter::handle{ height: 1px; background: transparent; }"); + dialog->m_splitter->handle(1)->setDisabled(true); + static_cast(dialog->m_splitter)->MoveFirstSplitterToMin(); } // maximize the first needed to avoid empty space bool findPreviousMaximizedDialogNeeded = true; - for (auto curDialog = dialog + 1; curDialog != mDialogs.end(); ++curDialog) + for (auto curDialog = dialog + 1; curDialog != m_dialogs.end(); ++curDialog) { - if (curDialog->mMaximizeSize && curDialog->mFrame->isHidden() == false) + if (curDialog->m_maximizeSize && curDialog->m_frame->isHidden() == false) { - if (curDialog != (mDialogs.end() - 1) && (curDialog + 1)->mFrame->isHidden()) + if (curDialog != (m_dialogs.end() - 1) && (curDialog + 1)->m_frame->isHidden()) { - static_cast(curDialog->mSplitter)->MoveFirstSplitterToMax(); + static_cast(curDialog->m_splitter)->MoveFirstSplitterToMax(); } else { - static_cast((curDialog - 1)->mSplitter)->MoveFirstSplitterToMin(); + static_cast((curDialog - 1)->m_splitter)->MoveFirstSplitterToMin(); } findPreviousMaximizedDialogNeeded = false; break; @@ -498,11 +498,11 @@ namespace MysticQt } if (findPreviousMaximizedDialogNeeded) { - for (auto curDialog = AZStd::make_reverse_iterator(dialog) + 1; curDialog != mDialogs.rend(); ++curDialog) + for (auto curDialog = AZStd::make_reverse_iterator(dialog) + 1; curDialog != m_dialogs.rend(); ++curDialog) { - if (curDialog->mMaximizeSize && curDialog->mFrame->isHidden() == false) + if (curDialog->m_maximizeSize && curDialog->m_frame->isHidden() == false) { - static_cast(curDialog->mSplitter)->MoveFirstSplitterToMax(); + static_cast(curDialog->m_splitter)->MoveFirstSplitterToMax(); break; } } @@ -519,8 +519,8 @@ namespace MysticQt if (event->buttons() & Qt::LeftButton) { // keep the mouse pos - mPrevMouseX = event->globalX(); - mPrevMouseY = event->globalY(); + m_prevMouseX = event->globalX(); + m_prevMouseY = event->globalY(); // set the cursor if the scrollbar is visible if ((horizontalScrollBar()->maximum() > 0) || (verticalScrollBar()->maximum() > 0)) @@ -566,8 +566,8 @@ namespace MysticQt } // calculate the delta mouse movement - const int32 deltaX = event->globalX() - mPrevMouseX; - const int32 deltaY = event->globalY() - mPrevMouseY; + const int32 deltaX = event->globalX() - m_prevMouseX; + const int32 deltaY = event->globalY() - m_prevMouseY; // now apply this delta movement to the scroller int32 newX = horizontalScrollBar()->value() - deltaX; @@ -576,8 +576,8 @@ namespace MysticQt verticalScrollBar()->setSliderPosition(newY); // store the current value as previous value - mPrevMouseX = event->globalX(); - mPrevMouseY = event->globalY(); + m_prevMouseX = event->globalX(); + m_prevMouseY = event->globalY(); } @@ -606,15 +606,15 @@ namespace MysticQt QScrollArea::resizeEvent(event); // maximize the first dialog needed - if (mDialogs.empty() || mDialogs.size() == 1) + if (m_dialogs.empty() || m_dialogs.size() == 1) { return; } - for (auto dialog = mDialogs.rbegin() + 1; dialog != mDialogs.rend(); ++dialog) + for (auto dialog = m_dialogs.rbegin() + 1; dialog != m_dialogs.rend(); ++dialog) { - if (dialog->mMaximizeSize && dialog->mFrame->isHidden() == false) + if (dialog->m_maximizeSize && dialog->m_frame->isHidden() == false) { - static_cast(dialog->mSplitter)->MoveFirstSplitterToMax(); + static_cast(dialog->m_splitter)->MoveFirstSplitterToMax(); break; } } @@ -624,54 +624,54 @@ namespace MysticQt // replace an internal widget void DialogStack::ReplaceWidget(QWidget* oldWidget, QWidget* newWidget) { - for (auto dialog = mDialogs.begin(); dialog != mDialogs.end(); ++dialog) + for (auto dialog = m_dialogs.begin(); dialog != m_dialogs.end(); ++dialog) { // go next if the widget is not the same - if (dialog->mWidget != oldWidget) + if (dialog->m_widget != oldWidget) { continue; } // replace the widget - dialog->mFrame->layout()->replaceWidget(oldWidget, newWidget); - dialog->mWidget = newWidget; + dialog->m_frame->layout()->replaceWidget(oldWidget, newWidget); + dialog->m_widget = newWidget; // adjust size of the new widget newWidget->adjustSize(); // set the constraints - if (dialog->mMaximizeSize == false) + if (dialog->m_maximizeSize == false) { // get margins - const QMargins frameMargins = dialog->mLayout->contentsMargins(); - const QMargins dialogMargins = dialog->mDialogLayout->contentsMargins(); + const QMargins frameMargins = dialog->m_layout->contentsMargins(); + const QMargins dialogMargins = dialog->m_dialogLayout->contentsMargins(); const int frameMarginTopBottom = frameMargins.top() + frameMargins.bottom(); const int dialogMarginTopBottom = dialogMargins.top() + dialogMargins.bottom(); const int allMarginsTopBottom = frameMarginTopBottom + dialogMarginTopBottom; // set the frame height - dialog->mFrame->setFixedHeight(newWidget->height() + frameMarginTopBottom); + dialog->m_frame->setFixedHeight(newWidget->height() + frameMarginTopBottom); // compute the dialog height - const int dialogHeight = newWidget->height() + allMarginsTopBottom + dialog->mButton->height(); + const int dialogHeight = newWidget->height() + allMarginsTopBottom + dialog->m_button->height(); // set the maximum height in case the dialog is not closed, if it's closed update the stored height - if (dialog->mFrame->isHidden() == false) + if (dialog->m_frame->isHidden() == false) { // set the dialog height - dialog->mDialogWidget->setFixedHeight(dialogHeight); + dialog->m_dialogWidget->setFixedHeight(dialogHeight); // set the first splitter to the min if needed - if (dialog != mDialogs.end() - 1) + if (dialog != m_dialogs.end() - 1) { - static_cast(dialog->mSplitter)->MoveFirstSplitterToMin(); + static_cast(dialog->m_splitter)->MoveFirstSplitterToMin(); } } else // dialog closed { // update the minimum and maximum stored height - dialog->mMinimumHeightBeforeClose = dialogHeight; - dialog->mMaximumHeightBeforeClose = dialogHeight; + dialog->m_minimumHeightBeforeClose = dialogHeight; + dialog->m_maximumHeightBeforeClose = dialogHeight; } } diff --git a/Gems/EMotionFX/Code/MysticQt/Source/DialogStack.h b/Gems/EMotionFX/Code/MysticQt/Source/DialogStack.h index 6bf810b281..bf93b5d23f 100644 --- a/Gems/EMotionFX/Code/MysticQt/Source/DialogStack.h +++ b/Gems/EMotionFX/Code/MysticQt/Source/DialogStack.h @@ -62,18 +62,18 @@ namespace MysticQt private: struct Dialog { - QPushButton* mButton = nullptr; - QWidget* mFrame = nullptr; - QWidget* mWidget = nullptr; - QWidget* mDialogWidget = nullptr; - DialogStackSplitter* mSplitter = nullptr; - bool mClosable = true; - bool mMaximizeSize = false; - bool mStretchWhenMaximize = false; - int mMinimumHeightBeforeClose = 0; - int mMaximumHeightBeforeClose = 0; - QLayout* mLayout = nullptr; - QLayout* mDialogLayout = nullptr; + QPushButton* m_button = nullptr; + QWidget* m_frame = nullptr; + QWidget* m_widget = nullptr; + QWidget* m_dialogWidget = nullptr; + DialogStackSplitter* m_splitter = nullptr; + bool m_closable = true; + bool m_maximizeSize = false; + bool m_stretchWhenMaximize = false; + int m_minimumHeightBeforeClose = 0; + int m_maximumHeightBeforeClose = 0; + QLayout* m_layout = nullptr; + QLayout* m_dialogLayout = nullptr; }; private: @@ -83,10 +83,10 @@ namespace MysticQt void UpdateScrollBars(); private: - DialogStackSplitter* mRootSplitter; - AZStd::vector mDialogs; - int32 mPrevMouseX; - int32 mPrevMouseY; + DialogStackSplitter* m_rootSplitter; + AZStd::vector m_dialogs; + int32 m_prevMouseX; + int32 m_prevMouseY; }; } // namespace MysticQt diff --git a/Gems/EMotionFX/Code/MysticQt/Source/MysticQtManager.cpp b/Gems/EMotionFX/Code/MysticQt/Source/MysticQtManager.cpp index 3386e1a0d2..537ad6bedd 100644 --- a/Gems/EMotionFX/Code/MysticQt/Source/MysticQtManager.cpp +++ b/Gems/EMotionFX/Code/MysticQt/Source/MysticQtManager.cpp @@ -22,7 +22,7 @@ namespace MysticQt // constructor MysticQtManager::MysticQtManager() { - mMainWindow = nullptr; + m_mainWindow = nullptr; } @@ -30,11 +30,11 @@ namespace MysticQt MysticQtManager::~MysticQtManager() { // get the number of icons and destroy them - for (IconData* icon : mIcons) + for (IconData* icon : m_icons) { delete icon; } - mIcons.clear(); + m_icons.clear(); } @@ -42,33 +42,33 @@ namespace MysticQt // constructor MysticQtManager::IconData::IconData(const char* filename) { - mFileName = filename; - mIcon = new QIcon(QDir{ QString(GetMysticQt()->GetDataDir().c_str()) }.filePath(filename)); + m_fileName = filename; + m_icon = new QIcon(QDir{ QString(GetMysticQt()->GetDataDir().c_str()) }.filePath(filename)); } // destructor MysticQtManager::IconData::~IconData() { - delete mIcon; + delete m_icon; } const QIcon& MysticQtManager::FindIcon(const char* filename) { // get the number of icons and iterate through them - for (IconData* icon : mIcons) + for (IconData* icon : m_icons) { - if (AzFramework::StringFunc::Equal(icon->mFileName.c_str(), filename, false /* no case */)) + if (AzFramework::StringFunc::Equal(icon->m_fileName.c_str(), filename, false /* no case */)) { - return *(icon->mIcon); + return *(icon->m_icon); } } // we haven't found it IconData* iconData = new IconData(filename); - mIcons.emplace_back(iconData); - return *(iconData->mIcon); + m_icons.emplace_back(iconData); + return *(iconData->m_icon); } diff --git a/Gems/EMotionFX/Code/MysticQt/Source/MysticQtManager.h b/Gems/EMotionFX/Code/MysticQt/Source/MysticQtManager.h index e0be07796e..9c8a73b92f 100644 --- a/Gems/EMotionFX/Code/MysticQt/Source/MysticQtManager.h +++ b/Gems/EMotionFX/Code/MysticQt/Source/MysticQtManager.h @@ -36,28 +36,28 @@ namespace MysticQt MCORE_MEMORYOBJECTCATEGORY(MysticQtManager, MCore::MCORE_DEFAULT_ALIGNMENT, MEMCATEGORY_MYSTICQT); public: - MCORE_INLINE QWidget* GetMainWindow() const { return mMainWindow; } - MCORE_INLINE void SetMainWindow(QWidget* mainWindow) { mMainWindow = mainWindow; } + MCORE_INLINE QWidget* GetMainWindow() const { return m_mainWindow; } + MCORE_INLINE void SetMainWindow(QWidget* mainWindow) { m_mainWindow = mainWindow; } MCORE_INLINE void SetAppDir(const char* appDir) { - mAppDir = appDir; - if (mDataDir.size() == 0) + m_appDir = appDir; + if (m_dataDir.size() == 0) { - mDataDir = appDir; + m_dataDir = appDir; } } - MCORE_INLINE const AZStd::string& GetAppDir() const { return mAppDir; } + MCORE_INLINE const AZStd::string& GetAppDir() const { return m_appDir; } MCORE_INLINE void SetDataDir(const char* dataDir) { - mDataDir = dataDir; - if (mAppDir.size() == 0) + m_dataDir = dataDir; + if (m_appDir.size() == 0) { - mAppDir = dataDir; + m_appDir = dataDir; } } - MCORE_INLINE const AZStd::string& GetDataDir() const { return mDataDir; } + MCORE_INLINE const AZStd::string& GetDataDir() const { return m_dataDir; } const QIcon& FindIcon(const char* filename); @@ -69,14 +69,14 @@ namespace MysticQt IconData(const char* filename); ~IconData(); - QIcon* mIcon; - AZStd::string mFileName; + QIcon* m_icon; + AZStd::string m_fileName; }; - QWidget* mMainWindow; - AZStd::vector mIcons; - AZStd::string mAppDir; - AZStd::string mDataDir; + QWidget* m_mainWindow; + AZStd::vector m_icons; + AZStd::string m_appDir; + AZStd::string m_dataDir; MysticQtManager(); ~MysticQtManager(); diff --git a/Gems/EMotionFX/Code/MysticQt/Source/RecentFiles.cpp b/Gems/EMotionFX/Code/MysticQt/Source/RecentFiles.cpp index 78490a3b13..b5dfd2ead1 100644 --- a/Gems/EMotionFX/Code/MysticQt/Source/RecentFiles.cpp +++ b/Gems/EMotionFX/Code/MysticQt/Source/RecentFiles.cpp @@ -27,7 +27,7 @@ namespace MysticQt ToolTipMenu(const QString title, QWidget* parent) : QMenu(title, parent) { - mParent = parent; + m_parent = parent; } bool event(QEvent* e) override @@ -40,7 +40,7 @@ namespace MysticQt QAction* action = activeAction(); if (action) { - QToolTip::showText(helpEvent->globalPos(), action->toolTip(), mParent); + QToolTip::showText(helpEvent->globalPos(), action->toolTip(), m_parent); } } else @@ -52,7 +52,7 @@ namespace MysticQt } private: - QWidget* mParent; + QWidget* m_parent; }; diff --git a/Gems/EMotionFX/Code/Platform/Common/FileOffsetType/MCore/Source/DiskFile_FileOffsetType.cpp b/Gems/EMotionFX/Code/Platform/Common/FileOffsetType/MCore/Source/DiskFile_FileOffsetType.cpp index e041afb417..1603f6326e 100644 --- a/Gems/EMotionFX/Code/Platform/Common/FileOffsetType/MCore/Source/DiskFile_FileOffsetType.cpp +++ b/Gems/EMotionFX/Code/Platform/Common/FileOffsetType/MCore/Source/DiskFile_FileOffsetType.cpp @@ -14,18 +14,18 @@ namespace MCore // returns the position (offset) in the file in bytes size_t DiskFile::GetPos() const { - MCORE_ASSERT(mFile); + MCORE_ASSERT(m_file); - return ftello(mFile); + return ftello(m_file); } // seek a given number of bytes ahead from it's current position bool DiskFile::Forward(size_t numBytes) { - MCORE_ASSERT(mFile); + MCORE_ASSERT(m_file); - if (fseeko(mFile, numBytes, SEEK_CUR) != 0) + if (fseeko(m_file, numBytes, SEEK_CUR) != 0) { return false; } @@ -36,9 +36,9 @@ namespace MCore // seek to an absolute position in the file (offset in bytes) bool DiskFile::Seek(size_t offset) { - MCORE_ASSERT(mFile); + MCORE_ASSERT(m_file); - if (fseeko(mFile, offset, SEEK_SET) != 0) + if (fseeko(m_file, offset, SEEK_SET) != 0) { return false; } @@ -49,8 +49,8 @@ namespace MCore // returns the filesize in bytes size_t DiskFile::GetFileSize() const { - MCORE_ASSERT(mFile); - if (mFile == nullptr) + MCORE_ASSERT(m_file); + if (m_file == nullptr) { return 0; } @@ -59,13 +59,13 @@ namespace MCore size_t curPos = GetPos(); // seek to the end of the file - fseeko(mFile, 0, SEEK_END); + fseeko(m_file, 0, SEEK_END); // get the position, whis is the size of the file size_t fileSize = GetPos(); // seek back to the original position - fseeko(mFile, curPos, SEEK_SET); + fseeko(m_file, curPos, SEEK_SET); // return the size of the file return fileSize; diff --git a/Gems/EMotionFX/Code/Platform/Common/WinAPI/MCore/Source/DiskFile_WinAPI.cpp b/Gems/EMotionFX/Code/Platform/Common/WinAPI/MCore/Source/DiskFile_WinAPI.cpp index 14a73bf3f5..6cafebeff5 100644 --- a/Gems/EMotionFX/Code/Platform/Common/WinAPI/MCore/Source/DiskFile_WinAPI.cpp +++ b/Gems/EMotionFX/Code/Platform/Common/WinAPI/MCore/Source/DiskFile_WinAPI.cpp @@ -14,18 +14,18 @@ namespace MCore // returns the position (offset) in the file in bytes size_t DiskFile::GetPos() const { - MCORE_ASSERT(mFile); + MCORE_ASSERT(m_file); - return _ftelli64(mFile); + return _ftelli64(m_file); } // seek a given number of bytes ahead from it's current position bool DiskFile::Forward(size_t numBytes) { - MCORE_ASSERT(mFile); + MCORE_ASSERT(m_file); - if (_fseeki64(mFile, numBytes, SEEK_CUR) != 0) + if (_fseeki64(m_file, numBytes, SEEK_CUR) != 0) { return false; } @@ -36,9 +36,9 @@ namespace MCore // seek to an absolute position in the file (offset in bytes) bool DiskFile::Seek(size_t offset) { - MCORE_ASSERT(mFile); + MCORE_ASSERT(m_file); - if (_fseeki64(mFile, offset, SEEK_SET) != 0) + if (_fseeki64(m_file, offset, SEEK_SET) != 0) { return false; } @@ -49,8 +49,8 @@ namespace MCore // returns the filesize in bytes size_t DiskFile::GetFileSize() const { - MCORE_ASSERT(mFile); - if (mFile == nullptr) + MCORE_ASSERT(m_file); + if (m_file == nullptr) { return 0; } @@ -59,13 +59,13 @@ namespace MCore size_t curPos = GetPos(); // seek to the end of the file - _fseeki64(mFile, 0, SEEK_END); + _fseeki64(m_file, 0, SEEK_END); // get the position, whis is the size of the file size_t fileSize = GetPos(); // seek back to the original position - _fseeki64(mFile, curPos, SEEK_SET); + _fseeki64(m_file, curPos, SEEK_SET); // return the size of the file return fileSize; diff --git a/Gems/EMotionFX/Code/Source/Editor/ColliderContainerWidget.cpp b/Gems/EMotionFX/Code/Source/Editor/ColliderContainerWidget.cpp index ef76629780..fea4f23c6a 100644 --- a/Gems/EMotionFX/Code/Source/Editor/ColliderContainerWidget.cpp +++ b/Gems/EMotionFX/Code/Source/Editor/ColliderContainerWidget.cpp @@ -617,12 +617,12 @@ namespace EMotionFX const MCore::RGBAColor& colliderColor) { const size_t nodeIndex = node->GetNodeIndex(); - MCommon::RenderUtil* renderUtil = renderInfo->mRenderUtil; + MCommon::RenderUtil* renderUtil = renderInfo->m_renderUtil; for (const auto& collider : colliders) { #ifndef EMFX_SCALE_DISABLED - const AZ::Vector3& worldScale = actorInstance->GetTransformData()->GetCurrentPose()->GetModelSpaceTransform(nodeIndex).mScale; + const AZ::Vector3& worldScale = actorInstance->GetTransformData()->GetCurrentPose()->GetModelSpaceTransform(nodeIndex).m_scale; #else const AZ::Vector3 worldScale = AZ::Vector3::CreateOne(); #endif @@ -677,7 +677,7 @@ namespace EMotionFX return; } - MCommon::RenderUtil* renderUtil = renderInfo->mRenderUtil; + MCommon::RenderUtil* renderUtil = renderInfo->m_renderUtil; const bool oldLightingEnabled = renderUtil->GetLightingEnabled(); renderUtil->EnableLighting(false); diff --git a/Gems/EMotionFX/Code/Source/Editor/ObjectEditor.cpp b/Gems/EMotionFX/Code/Source/Editor/ObjectEditor.cpp index b8cf69f2cb..b5db607c50 100644 --- a/Gems/EMotionFX/Code/Source/Editor/ObjectEditor.cpp +++ b/Gems/EMotionFX/Code/Source/Editor/ObjectEditor.cpp @@ -13,7 +13,7 @@ namespace EMotionFX { - const int ObjectEditor::m_propertyLabelWidth = 160; + const int ObjectEditor::s_propertyLabelWidth = 160; ObjectEditor::ObjectEditor(AZ::SerializeContext* serializeContext, QWidget* parent) : ObjectEditor(serializeContext, nullptr, parent) @@ -30,7 +30,7 @@ namespace EMotionFX m_propertyEditor = aznew AzToolsFramework::ReflectedPropertyEditor(this); m_propertyEditor->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum); m_propertyEditor->setObjectName("PropertyEditor"); - m_propertyEditor->Setup(serializeContext, notify, false/*enableScrollbars*/, m_propertyLabelWidth); + m_propertyEditor->Setup(serializeContext, notify, false/*enableScrollbars*/, s_propertyLabelWidth); QVBoxLayout* mainLayout = new QVBoxLayout(this); mainLayout->setSizeConstraint(QLayout::SetMinimumSize); diff --git a/Gems/EMotionFX/Code/Source/Editor/ObjectEditor.h b/Gems/EMotionFX/Code/Source/Editor/ObjectEditor.h index a726170b98..c76dc3b88f 100644 --- a/Gems/EMotionFX/Code/Source/Editor/ObjectEditor.h +++ b/Gems/EMotionFX/Code/Source/Editor/ObjectEditor.h @@ -47,6 +47,6 @@ namespace EMotionFX private: void* m_object; AzToolsFramework::ReflectedPropertyEditor* m_propertyEditor; - static const int m_propertyLabelWidth; + static const int s_propertyLabelWidth; }; } // namespace EMotionFX diff --git a/Gems/EMotionFX/Code/Source/Editor/Plugins/Cloth/ClothJointInspectorPlugin.cpp b/Gems/EMotionFX/Code/Source/Editor/Plugins/Cloth/ClothJointInspectorPlugin.cpp index 0b806ebc00..861100b073 100644 --- a/Gems/EMotionFX/Code/Source/Editor/Plugins/Cloth/ClothJointInspectorPlugin.cpp +++ b/Gems/EMotionFX/Code/Source/Editor/Plugins/Cloth/ClothJointInspectorPlugin.cpp @@ -65,13 +65,13 @@ namespace EMotionFX scrollArea->setWidget(m_jointWidget); scrollArea->setWidgetResizable(true); - mDock->setWidget(scrollArea); + m_dock->setWidget(scrollArea); EMotionFX::SkeletonOutlinerNotificationBus::Handler::BusConnect(); } else { - mDock->setWidget(CreateErrorContentWidget("Cloth collider editor depends on the NVIDIA Cloth gem. Please enable it in the project configurator.")); + m_dock->setWidget(CreateErrorContentWidget("Cloth collider editor depends on the NVIDIA Cloth gem. Please enable it in the project configurator.")); } return true; diff --git a/Gems/EMotionFX/Code/Source/Editor/Plugins/HitDetection/HitDetectionJointInspectorPlugin.cpp b/Gems/EMotionFX/Code/Source/Editor/Plugins/HitDetection/HitDetectionJointInspectorPlugin.cpp index d0578306ab..c69fdd9393 100644 --- a/Gems/EMotionFX/Code/Source/Editor/Plugins/HitDetection/HitDetectionJointInspectorPlugin.cpp +++ b/Gems/EMotionFX/Code/Source/Editor/Plugins/HitDetection/HitDetectionJointInspectorPlugin.cpp @@ -51,13 +51,13 @@ namespace EMotionFX scrollArea->setWidget(m_nodeWidget); scrollArea->setWidgetResizable(true); - mDock->setWidget(scrollArea); + m_dock->setWidget(scrollArea); EMotionFX::SkeletonOutlinerNotificationBus::Handler::BusConnect(); } else { - mDock->setWidget(CreateErrorContentWidget("Hit detection collider editor depends on the PhysX gem. Please enable it in the project configurator.")); + m_dock->setWidget(CreateErrorContentWidget("Hit detection collider editor depends on the PhysX gem. Please enable it in the project configurator.")); } return true; diff --git a/Gems/EMotionFX/Code/Source/Editor/Plugins/Ragdoll/RagdollNodeInspectorPlugin.cpp b/Gems/EMotionFX/Code/Source/Editor/Plugins/Ragdoll/RagdollNodeInspectorPlugin.cpp index 93c4e2cb67..5324950c82 100644 --- a/Gems/EMotionFX/Code/Source/Editor/Plugins/Ragdoll/RagdollNodeInspectorPlugin.cpp +++ b/Gems/EMotionFX/Code/Source/Editor/Plugins/Ragdoll/RagdollNodeInspectorPlugin.cpp @@ -80,13 +80,13 @@ namespace EMotionFX scrollArea->setWidget(m_nodeWidget); scrollArea->setWidgetResizable(true); - mDock->setWidget(scrollArea); + m_dock->setWidget(scrollArea); EMotionFX::SkeletonOutlinerNotificationBus::Handler::BusConnect(); } else { - mDock->setWidget(CreateErrorContentWidget("Ragdoll editor depends on the PhysX gem. Please enable it in the project configurator.")); + m_dock->setWidget(CreateErrorContentWidget("Ragdoll editor depends on the PhysX gem. Please enable it in the project configurator.")); } return true; @@ -432,7 +432,7 @@ namespace EMotionFX return; } - MCommon::RenderUtil* renderUtil = renderInfo->mRenderUtil; + MCommon::RenderUtil* renderUtil = renderInfo->m_renderUtil; const bool oldLightingEnabled = renderUtil->GetLightingEnabled(); renderUtil->EnableLighting(false); @@ -539,8 +539,8 @@ namespace EMotionFX const size_t parentNodeIndex = parentNode->GetNodeIndex(); const Transform& actorInstanceWorldTransform = actorInstance->GetWorldSpaceTransform(); const Pose* currentPose = actorInstance->GetTransformData()->GetCurrentPose(); - const AZ::Quaternion& parentOrientation = currentPose->GetModelSpaceTransform(parentNodeIndex).mRotation; - const AZ::Quaternion& childOrientation = currentPose->GetModelSpaceTransform(nodeIndex).mRotation; + const AZ::Quaternion& parentOrientation = currentPose->GetModelSpaceTransform(parentNodeIndex).m_rotation; + const AZ::Quaternion& childOrientation = currentPose->GetModelSpaceTransform(nodeIndex).m_rotation; m_vertexBuffer.clear(); m_indexBuffer.clear(); @@ -554,10 +554,10 @@ namespace EMotionFX } Transform jointModelSpaceTransform = currentPose->GetModelSpaceTransform(parentNodeIndex); - jointModelSpaceTransform.mPosition = currentPose->GetModelSpaceTransform(nodeIndex).mPosition; + jointModelSpaceTransform.m_position = currentPose->GetModelSpaceTransform(nodeIndex).m_position; const Transform jointGlobalTransformNoScale = jointModelSpaceTransform * actorInstanceWorldTransform; - MCommon::RenderUtil* renderUtil = renderInfo->mRenderUtil; + MCommon::RenderUtil* renderUtil = renderInfo->m_renderUtil; const size_t numLineBufferEntries = m_lineBuffer.size(); if (m_lineValidityBuffer.size() * 2 != numLineBufferEntries) { @@ -588,6 +588,6 @@ namespace EMotionFX const Transform childModelSpaceTransform = childJointLocalSpaceTransform * currentPose->GetModelSpaceTransform(node->GetNodeIndex()); const Transform jointChildWorldSpaceTransformNoScale = (childModelSpaceTransform * actorInstanceWorldSpaceTransform); - renderInfo->mRenderUtil->RenderArrow(0.1f, jointChildWorldSpaceTransformNoScale.mPosition, MCore::GetRight(jointChildWorldSpaceTransformNoScale.ToAZTransform()), color); + renderInfo->m_renderUtil->RenderArrow(0.1f, jointChildWorldSpaceTransformNoScale.m_position, MCore::GetRight(jointChildWorldSpaceTransformNoScale.ToAZTransform()), color); } } // namespace EMotionFX diff --git a/Gems/EMotionFX/Code/Source/Editor/Plugins/SimulatedObject/SimulatedObjectSelectionWindow.cpp b/Gems/EMotionFX/Code/Source/Editor/Plugins/SimulatedObject/SimulatedObjectSelectionWindow.cpp index 978ee0a298..681008d979 100644 --- a/Gems/EMotionFX/Code/Source/Editor/Plugins/SimulatedObject/SimulatedObjectSelectionWindow.cpp +++ b/Gems/EMotionFX/Code/Source/Editor/Plugins/SimulatedObject/SimulatedObjectSelectionWindow.cpp @@ -26,11 +26,11 @@ namespace EMStudio { setWindowTitle("SimulatedObject Selection Window"); - m_OKButton = new QPushButton("OK"); + m_okButton = new QPushButton("OK"); m_cancelButton = new QPushButton("Cancel"); QHBoxLayout* buttonLayout = new QHBoxLayout(); - buttonLayout->addWidget(m_OKButton); + buttonLayout->addWidget(m_okButton); buttonLayout->addWidget(m_cancelButton); QVBoxLayout* layout = new QVBoxLayout(this); @@ -38,7 +38,7 @@ namespace EMStudio layout->addWidget(m_simulatedObjectSelectionWidget); layout->addLayout(buttonLayout); - connect(m_OKButton, &QPushButton::clicked, this, &SimulatedObjectSelectionWindow::accept); + connect(m_okButton, &QPushButton::clicked, this, &SimulatedObjectSelectionWindow::accept); connect(m_cancelButton, &QPushButton::clicked, this, &SimulatedObjectSelectionWindow::reject); connect(m_simulatedObjectSelectionWidget, &SimulatedObjectSelectionWidget::OnDoubleClicked, this, &SimulatedObjectSelectionWindow::accept); } diff --git a/Gems/EMotionFX/Code/Source/Editor/Plugins/SimulatedObject/SimulatedObjectSelectionWindow.h b/Gems/EMotionFX/Code/Source/Editor/Plugins/SimulatedObject/SimulatedObjectSelectionWindow.h index 6411be5c98..d5bebb7abd 100644 --- a/Gems/EMotionFX/Code/Source/Editor/Plugins/SimulatedObject/SimulatedObjectSelectionWindow.h +++ b/Gems/EMotionFX/Code/Source/Editor/Plugins/SimulatedObject/SimulatedObjectSelectionWindow.h @@ -33,7 +33,7 @@ namespace EMStudio private: SimulatedObjectSelectionWidget* m_simulatedObjectSelectionWidget = nullptr; - QPushButton* m_OKButton = nullptr; + QPushButton* m_okButton = nullptr; QPushButton* m_cancelButton = nullptr; bool m_accepted = false; }; diff --git a/Gems/EMotionFX/Code/Source/Editor/Plugins/SimulatedObject/SimulatedObjectWidget.cpp b/Gems/EMotionFX/Code/Source/Editor/Plugins/SimulatedObject/SimulatedObjectWidget.cpp index bd57e24d08..a2b23e3268 100644 --- a/Gems/EMotionFX/Code/Source/Editor/Plugins/SimulatedObject/SimulatedObjectWidget.cpp +++ b/Gems/EMotionFX/Code/Source/Editor/Plugins/SimulatedObject/SimulatedObjectWidget.cpp @@ -113,7 +113,7 @@ namespace EMotionFX connect(m_addSimulatedObjectButton, &QPushButton::clicked, this, [this]() { - m_actionManager->OnAddNewObjectAndAddJoints(m_actor, /*selectedJoints=*/{}, /*addChildJoints=*/false, mDock); + m_actionManager->OnAddNewObjectAndAddJoints(m_actor, /*selectedJoints=*/{}, /*addChildJoints=*/false, m_dock); }); AZ::SerializeContext* serializeContext; @@ -130,9 +130,9 @@ namespace EMotionFX mainLayout->addWidget(m_selectionWidget, /*stretch=*/1); mainLayout->addStretch(); - mDock->setWidget(m_mainWidget); + m_dock->setWidget(m_mainWidget); - m_simulatedObjectInspectorDock = new AzQtComponents::StyledDockWidget("Simulated Object Inspector", mDock); + m_simulatedObjectInspectorDock = new AzQtComponents::StyledDockWidget("Simulated Object Inspector", m_dock); m_simulatedObjectInspectorDock->setFeatures(QDockWidget::DockWidgetFloatable | QDockWidget::DockWidgetMovable); m_simulatedObjectInspectorDock->setObjectName("EMFX.SimulatedObjectWidget.SimulatedObjectInspectorDock"); m_simulatedJointWidget = new SimulatedJointWidget(this); @@ -361,7 +361,7 @@ namespace EMotionFX connect(addToSimulatedObjectMenu->addAction("New simulated object..."), &QAction::triggered, this, [this, selectedRowIndices]() { const bool addChildren = (QMessageBox::question(this->GetDockWidget(), "Add children of joints?", "Add all children of selected joints to the simulated object?") == QMessageBox::Yes); - m_actionManager->OnAddNewObjectAndAddJoints(m_actor, selectedRowIndices, addChildren, mDock); + m_actionManager->OnAddNewObjectAndAddJoints(m_actor, selectedRowIndices, addChildren, m_dock); }); menu->addSeparator(); @@ -536,7 +536,7 @@ namespace EMotionFX void SimulatedObjectWidget::RenderJointRadius(const SimulatedJoint* joint, ActorInstance* actorInstance, const AZ::Color& color) { #ifndef EMFX_SCALE_DISABLED - const float scale = actorInstance->GetWorldSpaceTransform().mScale.GetX(); + const float scale = actorInstance->GetWorldSpaceTransform().m_scale.GetX(); #else const float scale = 1.0f; #endif @@ -553,7 +553,7 @@ namespace EMotionFX DebugDraw& debugDraw = GetDebugDraw(); DebugDraw::ActorInstanceData* drawData = debugDraw.GetActorInstanceData(actorInstance); drawData->Lock(); - drawData->DrawWireframeSphere(jointTransform.mPosition, radius, color, jointTransform.mRotation, 12, 12); + drawData->DrawWireframeSphere(jointTransform.m_position, radius, color, jointTransform.m_rotation, 12, 12); drawData->Unlock(); } } // namespace EMotionFX diff --git a/Gems/EMotionFX/Code/Source/Editor/Plugins/SkeletonOutliner/SkeletonOutlinerPlugin.cpp b/Gems/EMotionFX/Code/Source/Editor/Plugins/SkeletonOutliner/SkeletonOutlinerPlugin.cpp index 949325f101..f8ca291d55 100644 --- a/Gems/EMotionFX/Code/Source/Editor/Plugins/SkeletonOutliner/SkeletonOutlinerPlugin.cpp +++ b/Gems/EMotionFX/Code/Source/Editor/Plugins/SkeletonOutliner/SkeletonOutlinerPlugin.cpp @@ -42,7 +42,7 @@ namespace EMotionFX bool SkeletonOutlinerPlugin::Init() { - m_mainWidget = new QWidget(mDock); + m_mainWidget = new QWidget(m_dock); QVBoxLayout* mainLayout = new QVBoxLayout(); m_mainWidget->setLayout(mainLayout); @@ -112,7 +112,7 @@ namespace EMotionFX connect(m_searchWidget, &AzQtComponents::FilteredSearchWidget::TypeFilterChanged, this, &SkeletonOutlinerPlugin::OnTypeFilterChanged); mainLayout->addWidget(m_treeView); - mDock->setWidget(m_mainWidget); + m_dock->setWidget(m_mainWidget); EMotionFX::SkeletonOutlinerRequestBus::Handler::BusConnect(); Reinit(); diff --git a/Gems/EMotionFX/Code/Source/Editor/PropertyWidgets/ActorGoalNodeHandler.cpp b/Gems/EMotionFX/Code/Source/Editor/PropertyWidgets/ActorGoalNodeHandler.cpp index 8cbee5924b..9883b06e23 100644 --- a/Gems/EMotionFX/Code/Source/Editor/PropertyWidgets/ActorGoalNodeHandler.cpp +++ b/Gems/EMotionFX/Code/Source/Editor/PropertyWidgets/ActorGoalNodeHandler.cpp @@ -131,7 +131,7 @@ namespace EMotionFX if (newSelection.size() == 1) { AZStd::string selectedNodeName = newSelection[0].GetNodeName(); - AZ::u32 selectedActorInstanceId = newSelection[0].mActorInstanceID; + AZ::u32 selectedActorInstanceId = newSelection[0].m_actorInstanceId; const auto parentDepth = AZStd::find(begin(actorInstanceIDs), end(actorInstanceIDs), selectedActorInstanceId); AZ_Assert(parentDepth != end(actorInstanceIDs), "Cannot get parent depth. The selected actor instance was not shown in the selection window."); diff --git a/Gems/EMotionFX/Code/Source/Editor/PropertyWidgets/AnimGraphNodeHandler.cpp b/Gems/EMotionFX/Code/Source/Editor/PropertyWidgets/AnimGraphNodeHandler.cpp index 06542e5fef..81c15d2f98 100644 --- a/Gems/EMotionFX/Code/Source/Editor/PropertyWidgets/AnimGraphNodeHandler.cpp +++ b/Gems/EMotionFX/Code/Source/Editor/PropertyWidgets/AnimGraphNodeHandler.cpp @@ -113,7 +113,7 @@ namespace EMotionFX const AZStd::vector& selectedNodes = dialog.GetAnimGraphHierarchyWidget().GetSelectedItems(); if (!selectedNodes.empty()) { - AnimGraphNode* selectedNode = m_animGraph->RecursiveFindNodeByName(selectedNodes[0].mNodeName.c_str()); + AnimGraphNode* selectedNode = m_animGraph->RecursiveFindNodeByName(selectedNodes[0].m_nodeName.c_str()); if (selectedNode) { m_nodeId = selectedNode->GetId(); diff --git a/Gems/EMotionFX/Code/Source/Editor/PropertyWidgets/BlendNParamWeightsHandler.cpp b/Gems/EMotionFX/Code/Source/Editor/PropertyWidgets/BlendNParamWeightsHandler.cpp index 62b1af5250..7b615c22ce 100644 --- a/Gems/EMotionFX/Code/Source/Editor/PropertyWidgets/BlendNParamWeightsHandler.cpp +++ b/Gems/EMotionFX/Code/Source/Editor/PropertyWidgets/BlendNParamWeightsHandler.cpp @@ -238,11 +238,11 @@ namespace EMotionFX const char* sourceNodeName = ""; for (const AnimGraphNode::Port& port : inputPorts) { - if (port.mConnection) + if (port.m_connection) { - if (port.mPortID == paramWeights[i].GetPortId()) + if (port.m_portId == paramWeights[i].GetPortId()) { - sourceNodeName = port.mConnection->GetSourceNode()->GetName(); + sourceNodeName = port.m_connection->GetSourceNode()->GetName(); } } } diff --git a/Gems/EMotionFX/Code/Source/Editor/PropertyWidgets/LODSceneGraphWidget.h b/Gems/EMotionFX/Code/Source/Editor/PropertyWidgets/LODSceneGraphWidget.h index 1ed9a8f67d..4905f8612d 100644 --- a/Gems/EMotionFX/Code/Source/Editor/PropertyWidgets/LODSceneGraphWidget.h +++ b/Gems/EMotionFX/Code/Source/Editor/PropertyWidgets/LODSceneGraphWidget.h @@ -40,7 +40,7 @@ namespace EMotionFX private: bool m_hideUncheckableItem; - Data::LodNodeSelectionList m_LODSelectionList; + Data::LodNodeSelectionList m_lodSelectionList; }; } } diff --git a/Gems/EMotionFX/Code/Source/Integration/Assets/ActorAsset.cpp b/Gems/EMotionFX/Code/Source/Integration/Assets/ActorAsset.cpp index bfee6b582c..5082d4b739 100644 --- a/Gems/EMotionFX/Code/Source/Integration/Assets/ActorAsset.cpp +++ b/Gems/EMotionFX/Code/Source/Integration/Assets/ActorAsset.cpp @@ -55,7 +55,7 @@ namespace EMotionFX Importer::ActorSettings actorSettings; if (GetEMotionFX().GetEnableServerOptimization()) { - actorSettings.mOptimizeForServer = true; + actorSettings.m_optimizeForServer = true; } assetData->m_emfxActor = EMotionFX::GetImporter().LoadActor( diff --git a/Gems/EMotionFX/Code/Source/Integration/Components/ActorComponent.cpp b/Gems/EMotionFX/Code/Source/Integration/Components/ActorComponent.cpp index 9f996f46fd..303a7e118b 100644 --- a/Gems/EMotionFX/Code/Source/Integration/Components/ActorComponent.cpp +++ b/Gems/EMotionFX/Code/Source/Integration/Components/ActorComponent.cpp @@ -526,14 +526,14 @@ namespace EMotionFX if (m_actorInstance) { const Transform localTransform = m_actorInstance->GetParentWorldSpaceTransform().Inversed() * Transform(world); - m_actorInstance->SetLocalSpacePosition(localTransform.mPosition); - m_actorInstance->SetLocalSpaceRotation(localTransform.mRotation); + m_actorInstance->SetLocalSpacePosition(localTransform.m_position); + m_actorInstance->SetLocalSpaceRotation(localTransform.m_rotation); // Disable updating the scale to prevent feedback from adding up. // We need to find a better way to handle this or to prevent this feedback loop. EMFX_SCALECODE ( - m_actorInstance->SetLocalSpaceScale(localTransform.mScale); + m_actorInstance->SetLocalSpaceScale(localTransform.m_scale); ) } } @@ -663,8 +663,8 @@ namespace EMotionFX if (emfxNode) { const Transform& nodeTransform = emfxPose->GetModelSpaceTransform(emfxNode->GetNodeIndex()); - physicsPose[nodeIndex].m_position = nodeTransform.mPosition; - physicsPose[nodeIndex].m_orientation = nodeTransform.mRotation; + physicsPose[nodeIndex].m_position = nodeTransform.m_position; + physicsPose[nodeIndex].m_orientation = nodeTransform.m_rotation; } } @@ -780,11 +780,11 @@ namespace EMotionFX case Space::LocalSpace: { const Transform& localTransform = currentPose->GetLocalSpaceTransform(index); - outPosition = localTransform.mPosition; - outRotation = localTransform.mRotation; + outPosition = localTransform.m_position; + outRotation = localTransform.m_rotation; EMFX_SCALECODE ( - outScale = localTransform.mScale; + outScale = localTransform.m_scale; ) return; } @@ -792,11 +792,11 @@ namespace EMotionFX case Space::ModelSpace: { const Transform& modelTransform = currentPose->GetModelSpaceTransform(index); - outPosition = modelTransform.mPosition; - outRotation = modelTransform.mRotation; + outPosition = modelTransform.m_position; + outRotation = modelTransform.m_rotation; EMFX_SCALECODE ( - outScale = modelTransform.mScale; + outScale = modelTransform.m_scale; ) return; } @@ -804,11 +804,11 @@ namespace EMotionFX case Space::WorldSpace: { const Transform worldTransform = currentPose->GetWorldSpaceTransform(index); - outPosition = worldTransform.mPosition; - outRotation = worldTransform.mRotation; + outPosition = worldTransform.m_position; + outRotation = worldTransform.m_rotation; EMFX_SCALECODE ( - outScale = worldTransform.mScale; + outScale = worldTransform.m_scale; ) return; } diff --git a/Gems/EMotionFX/Code/Source/Integration/Components/SimpleMotionComponent.cpp b/Gems/EMotionFX/Code/Source/Integration/Components/SimpleMotionComponent.cpp index fa7ea7f2a7..dd7fdeea50 100644 --- a/Gems/EMotionFX/Code/Source/Integration/Components/SimpleMotionComponent.cpp +++ b/Gems/EMotionFX/Code/Source/Integration/Components/SimpleMotionComponent.cpp @@ -444,18 +444,18 @@ namespace EMotionFX } //init the PlaybackInfo based on our config EMotionFX::PlayBackInfo info; - info.mNumLoops = cfg.m_loop ? EMFX_LOOPFOREVER : 1; - info.mRetarget = cfg.m_retarget; - info.mPlayMode = cfg.m_reverse ? EMotionFX::EPlayMode::PLAYMODE_BACKWARD : EMotionFX::EPlayMode::PLAYMODE_FORWARD; - info.mFreezeAtLastFrame = info.mNumLoops == 1; - info.mMirrorMotion = cfg.m_mirror; - info.mPlaySpeed = cfg.m_playspeed; - info.mPlayNow = true; - info.mDeleteOnZeroWeight = deleteOnZeroWeight; - info.mCanOverwrite = false; - info.mBlendInTime = cfg.m_blendInTime; - info.mBlendOutTime = cfg.m_blendOutTime; - info.mInPlace = cfg.m_inPlace; + info.m_numLoops = cfg.m_loop ? EMFX_LOOPFOREVER : 1; + info.m_retarget = cfg.m_retarget; + info.m_playMode = cfg.m_reverse ? EMotionFX::EPlayMode::PLAYMODE_BACKWARD : EMotionFX::EPlayMode::PLAYMODE_FORWARD; + info.m_freezeAtLastFrame = info.m_numLoops == 1; + info.m_mirrorMotion = cfg.m_mirror; + info.m_playSpeed = cfg.m_playspeed; + info.m_playNow = true; + info.m_deleteOnZeroWeight = deleteOnZeroWeight; + info.m_canOverwrite = false; + info.m_blendInTime = cfg.m_blendInTime; + info.m_blendOutTime = cfg.m_blendOutTime; + info.m_inPlace = cfg.m_inPlace; return actorInstance->GetMotionSystem()->PlayMotion(motionAsset->m_emfxMotion.get(), &info); } diff --git a/Gems/EMotionFX/Code/Source/Integration/System/PipelineComponent.cpp b/Gems/EMotionFX/Code/Source/Integration/System/PipelineComponent.cpp index 6536241465..8946a435b6 100644 --- a/Gems/EMotionFX/Code/Source/Integration/System/PipelineComponent.cpp +++ b/Gems/EMotionFX/Code/Source/Integration/System/PipelineComponent.cpp @@ -21,14 +21,14 @@ namespace EMotionFX AZ::EnvironmentVariable PipelineComponent::s_eMotionFXAllocatorInitializer = nullptr; PipelineComponent::PipelineComponent() - : m_EMotionFXInited(false) + : m_eMotionFxInited(false) { } void PipelineComponent::Activate() { - if (!m_EMotionFXInited) + if (!m_eMotionFxInited) { // Start EMotionFX allocator or increase the reference counting s_eMotionFXAllocatorInitializer = AZ::Environment::CreateVariable(EMotionFXAllocatorInitializer::EMotionFXAllocatorInitializerTag); @@ -42,7 +42,7 @@ namespace EMotionFX // Initialize EMotion FX runtime. EMotionFX::Initializer::InitSettings emfxSettings; - emfxSettings.mUnitType = MCore::Distance::UNITTYPE_METERS; + emfxSettings.m_unitType = MCore::Distance::UNITTYPE_METERS; if (!EMotionFX::Initializer::Init(&emfxSettings)) { @@ -52,15 +52,15 @@ namespace EMotionFX // Initialize the EMotionFX command system. m_commandManager = AZStd::make_unique(); - m_EMotionFXInited = true; + m_eMotionFxInited = true; } } void PipelineComponent::Deactivate() { - if (m_EMotionFXInited) + if (m_eMotionFxInited) { - m_EMotionFXInited = false; + m_eMotionFxInited = false; m_commandManager.reset(); EMotionFX::Initializer::Shutdown(); MCore::Initializer::Shutdown(); diff --git a/Gems/EMotionFX/Code/Source/Integration/System/PipelineComponent.h b/Gems/EMotionFX/Code/Source/Integration/System/PipelineComponent.h index d89d1a33a0..392af36fd5 100644 --- a/Gems/EMotionFX/Code/Source/Integration/System/PipelineComponent.h +++ b/Gems/EMotionFX/Code/Source/Integration/System/PipelineComponent.h @@ -33,7 +33,7 @@ namespace EMotionFX static void Reflect(AZ::ReflectContext* context); private: - bool m_EMotionFXInited; + bool m_eMotionFxInited; AZStd::unique_ptr m_commandManager; // Creates a static shared pointer using the AZ EnvironmentVariable system. diff --git a/Gems/EMotionFX/Code/Source/Integration/System/SystemComponent.cpp b/Gems/EMotionFX/Code/Source/Integration/System/SystemComponent.cpp index 78aa3b4426..b5a252e293 100644 --- a/Gems/EMotionFX/Code/Source/Integration/System/SystemComponent.cpp +++ b/Gems/EMotionFX/Code/Source/Integration/System/SystemComponent.cpp @@ -132,7 +132,7 @@ namespace EMotionFX /// Dispatch motion events to listeners via ActorNotificationBus::OnMotionEvent. void OnEvent(const EMotionFX::EventInfo& emfxInfo) override { - const ActorInstance* actorInstance = emfxInfo.mActorInstance; + const ActorInstance* actorInstance = emfxInfo.m_actorInstance; if (actorInstance) { const AZ::EntityId owningEntityId = actorInstance->GetEntityId(); @@ -140,11 +140,11 @@ namespace EMotionFX // Fill engine-compatible structure to dispatch to game code. MotionEvent motionEvent; motionEvent.m_entityId = owningEntityId; - motionEvent.m_actorInstance = emfxInfo.mActorInstance; - motionEvent.m_motionInstance = emfxInfo.mMotionInstance; - motionEvent.m_time = emfxInfo.mTimeValue; + motionEvent.m_actorInstance = emfxInfo.m_actorInstance; + motionEvent.m_motionInstance = emfxInfo.m_motionInstance; + motionEvent.m_time = emfxInfo.m_timeValue; // TODO - for (const auto& eventData : emfxInfo.mEvent->GetEventDatas()) + for (const auto& eventData : emfxInfo.m_event->GetEventDatas()) { if (const EMotionFX::TwoStringEventData* twoStringEventData = azrtti_cast(eventData.get())) { @@ -153,8 +153,8 @@ namespace EMotionFX break; } } - motionEvent.m_globalWeight = emfxInfo.mGlobalWeight; - motionEvent.m_localWeight = emfxInfo.mLocalWeight; + motionEvent.m_globalWeight = emfxInfo.m_globalWeight; + motionEvent.m_localWeight = emfxInfo.m_localWeight; motionEvent.m_isEventStart = emfxInfo.IsEventStart(); // Queue the event to flush on the main thread. @@ -469,9 +469,9 @@ namespace EMotionFX // Initialize MCore, which is EMotionFX's standard library of containers and systems. MCore::Initializer::InitSettings coreSettings; - coreSettings.mMemAllocFunction = &EMotionFXAlloc; - coreSettings.mMemReallocFunction = &EMotionFXRealloc; - coreSettings.mMemFreeFunction = &EMotionFXFree; + coreSettings.m_memAllocFunction = &EMotionFXAlloc; + coreSettings.m_memReallocFunction = &EMotionFXRealloc; + coreSettings.m_memFreeFunction = &EMotionFXFree; if (!MCore::Initializer::Init(&coreSettings)) { AZ_Error("EMotion FX Animation", false, "Failed to initialize EMotion FX SDK Core"); @@ -480,7 +480,7 @@ namespace EMotionFX // Initialize EMotionFX runtime. EMotionFX::Initializer::InitSettings emfxSettings; - emfxSettings.mUnitType = MCore::Distance::UNITTYPE_METERS; + emfxSettings.m_unitType = MCore::Distance::UNITTYPE_METERS; if (!EMotionFX::Initializer::Init(&emfxSettings)) { @@ -709,7 +709,7 @@ namespace EMotionFX AZ::Transform currentTransform = AZ::Transform::CreateIdentity(); AZ::TransformBus::EventResult(currentTransform, entityId, &AZ::TransformBus::Events::GetWorldTM); - const AZ::Vector3 actorInstancePosition = actorInstance->GetWorldSpaceTransform().mPosition; + const AZ::Vector3 actorInstancePosition = actorInstance->GetWorldSpaceTransform().m_position; const AZ::Vector3 positionDelta = actorInstancePosition - currentTransform.GetTranslation(); if (hasPhysicsController) @@ -724,7 +724,7 @@ namespace EMotionFX } // Update the entity rotation. - const AZ::Quaternion actorInstanceRotation = actorInstance->GetWorldSpaceTransform().mRotation; + const AZ::Quaternion actorInstanceRotation = actorInstance->GetWorldSpaceTransform().m_rotation; const AZ::Quaternion currentRotation = currentTransform.GetRotation(); if (!currentRotation.IsClose(actorInstanceRotation, AZ::Constants::FloatEpsilon)) { diff --git a/Gems/EMotionFX/Code/Tests/AnimGraphDeferredInitTests.cpp b/Gems/EMotionFX/Code/Tests/AnimGraphDeferredInitTests.cpp index e05e5f3245..aa1bde295a 100644 --- a/Gems/EMotionFX/Code/Tests/AnimGraphDeferredInitTests.cpp +++ b/Gems/EMotionFX/Code/Tests/AnimGraphDeferredInitTests.cpp @@ -36,7 +36,7 @@ namespace EMotionFX m_blendTree->AddChildNode(paramNode); paramNode->InitAfterLoading(m_animGraph.get()); paramNode->InvalidateUniqueData(m_animGraphInstance); - m_blend2Node->AddConnection(paramNode, paramNode->FindOutputPortByName("weightParam")->mPortID, BlendTreeBlend2Node::PORTID_INPUT_WEIGHT); + m_blend2Node->AddConnection(paramNode, paramNode->FindOutputPortByName("weightParam")->m_portId, BlendTreeBlend2Node::PORTID_INPUT_WEIGHT); } void ConstructGraph() diff --git a/Gems/EMotionFX/Code/Tests/AnimGraphMotionNodeTests.cpp b/Gems/EMotionFX/Code/Tests/AnimGraphMotionNodeTests.cpp index 2a199f5e8b..121f438d82 100644 --- a/Gems/EMotionFX/Code/Tests/AnimGraphMotionNodeTests.cpp +++ b/Gems/EMotionFX/Code/Tests/AnimGraphMotionNodeTests.cpp @@ -118,16 +118,16 @@ namespace EMotionFX } protected: - size_t m_l_handIndex = InvalidIndex; - size_t m_l_loArmIndex = InvalidIndex; - size_t m_l_loLegIndex = InvalidIndex; - size_t m_l_ankleIndex = InvalidIndex; - size_t m_r_handIndex = InvalidIndex; - size_t m_r_loArmIndex = InvalidIndex; - size_t m_r_loLegIndex = InvalidIndex; - size_t m_r_ankleIndex = InvalidIndex; - size_t m_jack_rootIndex = InvalidIndex; - size_t m_bip01__pelvisIndex = InvalidIndex; + size_t m_lHandIndex = InvalidIndex; + size_t m_lLoArmIndex = InvalidIndex; + size_t m_lLoLegIndex = InvalidIndex; + size_t m_lAnkleIndex = InvalidIndex; + size_t m_rHandIndex = InvalidIndex; + size_t m_rLoArmIndex = InvalidIndex; + size_t m_rLoLegIndex = InvalidIndex; + size_t m_rAnkleIndex = InvalidIndex; + size_t m_jackRootIndex = InvalidIndex; + size_t m_bip01PelvisIndex = InvalidIndex; AnimGraphMotionNode* m_motionNode = nullptr; BlendTree* m_blendTree = nullptr; BlendTreeFloatConstantNode* m_fltConstNode = nullptr; @@ -147,16 +147,16 @@ namespace EMotionFX void SetupIndices() { - Node* rootNode = m_jackSkeleton->FindNodeAndIndexByName("jack_root", m_jack_rootIndex); - Node* pelvisNode = m_jackSkeleton->FindNodeAndIndexByName("Bip01__pelvis", m_bip01__pelvisIndex); - Node* lHandNode = m_jackSkeleton->FindNodeAndIndexByName("l_hand", m_l_handIndex); - Node* lLoArmNode = m_jackSkeleton->FindNodeAndIndexByName("l_loArm", m_l_loArmIndex); - Node* lLoLegNode = m_jackSkeleton->FindNodeAndIndexByName("l_loLeg", m_l_loLegIndex); - Node* lAnkleNode = m_jackSkeleton->FindNodeAndIndexByName("l_ankle", m_l_ankleIndex); - Node* rHandNode = m_jackSkeleton->FindNodeAndIndexByName("r_hand", m_r_handIndex); - Node* rLoArmNode = m_jackSkeleton->FindNodeAndIndexByName("r_loArm", m_r_loArmIndex); - Node* rLoLegNode = m_jackSkeleton->FindNodeAndIndexByName("r_loLeg", m_r_loLegIndex); - Node* rAnkleNode = m_jackSkeleton->FindNodeAndIndexByName("r_ankle", m_r_ankleIndex); + Node* rootNode = m_jackSkeleton->FindNodeAndIndexByName("jack_root", m_jackRootIndex); + Node* pelvisNode = m_jackSkeleton->FindNodeAndIndexByName("Bip01__pelvis", m_bip01PelvisIndex); + Node* lHandNode = m_jackSkeleton->FindNodeAndIndexByName("l_hand", m_lHandIndex); + Node* lLoArmNode = m_jackSkeleton->FindNodeAndIndexByName("l_loArm", m_lLoArmIndex); + Node* lLoLegNode = m_jackSkeleton->FindNodeAndIndexByName("l_loLeg", m_lLoLegIndex); + Node* lAnkleNode = m_jackSkeleton->FindNodeAndIndexByName("l_ankle", m_lAnkleIndex); + Node* rHandNode = m_jackSkeleton->FindNodeAndIndexByName("r_hand", m_rHandIndex); + Node* rLoArmNode = m_jackSkeleton->FindNodeAndIndexByName("r_loArm", m_rLoArmIndex); + Node* rLoLegNode = m_jackSkeleton->FindNodeAndIndexByName("r_loLeg", m_rLoLegIndex); + Node* rAnkleNode = m_jackSkeleton->FindNodeAndIndexByName("r_ankle", m_rAnkleIndex); // Make sure all nodes exist. ASSERT_TRUE(rootNode && pelvisNode && lHandNode && lLoArmNode && lLoLegNode && lAnkleNode && @@ -166,14 +166,14 @@ namespace EMotionFX void SetupMirrorNodes() { m_actor->AllocateNodeMirrorInfos(); - m_actor->GetNodeMirrorInfo(m_l_handIndex).mSourceNode = static_cast(m_r_handIndex); - m_actor->GetNodeMirrorInfo(m_r_handIndex).mSourceNode = static_cast(m_l_handIndex); - m_actor->GetNodeMirrorInfo(m_l_loArmIndex).mSourceNode = static_cast(m_r_loArmIndex); - m_actor->GetNodeMirrorInfo(m_r_loArmIndex).mSourceNode = static_cast(m_l_loArmIndex); - m_actor->GetNodeMirrorInfo(m_l_loLegIndex).mSourceNode = static_cast(m_r_loLegIndex); - m_actor->GetNodeMirrorInfo(m_r_loLegIndex).mSourceNode = static_cast(m_l_loLegIndex); - m_actor->GetNodeMirrorInfo(m_l_ankleIndex).mSourceNode = static_cast(m_r_ankleIndex); - m_actor->GetNodeMirrorInfo(m_r_ankleIndex).mSourceNode = static_cast(m_l_ankleIndex); + m_actor->GetNodeMirrorInfo(m_lHandIndex).m_sourceNode = static_cast(m_rHandIndex); + m_actor->GetNodeMirrorInfo(m_rHandIndex).m_sourceNode = static_cast(m_lHandIndex); + m_actor->GetNodeMirrorInfo(m_lLoArmIndex).m_sourceNode = static_cast(m_rLoArmIndex); + m_actor->GetNodeMirrorInfo(m_rLoArmIndex).m_sourceNode = static_cast(m_lLoArmIndex); + m_actor->GetNodeMirrorInfo(m_lLoLegIndex).m_sourceNode = static_cast(m_rLoLegIndex); + m_actor->GetNodeMirrorInfo(m_rLoLegIndex).m_sourceNode = static_cast(m_lLoLegIndex); + m_actor->GetNodeMirrorInfo(m_lAnkleIndex).m_sourceNode = static_cast(m_rAnkleIndex); + m_actor->GetNodeMirrorInfo(m_rAnkleIndex).m_sourceNode = static_cast(m_lAnkleIndex); m_actor->AutoDetectMirrorAxes(); } }; @@ -186,11 +186,11 @@ namespace EMotionFX // Follow-through during the duration(~1.06666672 seconds) of the motion. for (float i = 0.1f; i < 1.2f; i += 0.1f) { - const AZ::Vector3 rootCurrentPos = m_jackPose->GetModelSpaceTransform(m_jack_rootIndex).mPosition; - const AZ::Vector3 pelvisCurrentPos = m_jackPose->GetModelSpaceTransform(m_bip01__pelvisIndex).mPosition; + const AZ::Vector3 rootCurrentPos = m_jackPose->GetModelSpaceTransform(m_jackRootIndex).m_position; + const AZ::Vector3 pelvisCurrentPos = m_jackPose->GetModelSpaceTransform(m_bip01PelvisIndex).m_position; GetEMotionFX().Update(1.0f / 10.0f); - const AZ::Vector3 rootUpdatedPos = m_jackPose->GetModelSpaceTransform(m_jack_rootIndex).mPosition; - const AZ::Vector3 pelvisUpdatedPos = m_jackPose->GetModelSpaceTransform(m_bip01__pelvisIndex).mPosition; + const AZ::Vector3 rootUpdatedPos = m_jackPose->GetModelSpaceTransform(m_jackRootIndex).m_position; + const AZ::Vector3 pelvisUpdatedPos = m_jackPose->GetModelSpaceTransform(m_bip01PelvisIndex).m_position; const float rootDifference = rootUpdatedPos.GetY() - rootCurrentPos.GetY(); const float pelvisDifference = pelvisUpdatedPos.GetY() - pelvisCurrentPos.GetY(); @@ -203,7 +203,7 @@ namespace EMotionFX TEST_F(AnimGraphMotionNodeFixture, NoInputAndLoopOutputsCorrectMotionAndPose) { AnimGraphMotionNode::UniqueData* uniqueData = static_cast(m_animGraphInstance->FindOrCreateUniqueNodeData(m_motionNode)); - uniqueData->mReload = true; + uniqueData->m_reload = true; m_motionNode->SetLoop(true); m_motionNode->InvalidateUniqueData(m_animGraphInstance); m_actorInstance->SetMotionExtractionEnabled(false); @@ -211,14 +211,14 @@ namespace EMotionFX GetEMotionFX().Update(0.0f); // Needed to trigger a refresh of motion node internals. // Update to half the motion's duration. - AZ::Vector3 rootStartPos = m_jackPose->GetModelSpaceTransform(m_jack_rootIndex).mPosition; - AZ::Vector3 pelvisStartPos = m_jackPose->GetModelSpaceTransform(m_bip01__pelvisIndex).mPosition; + AZ::Vector3 rootStartPos = m_jackPose->GetModelSpaceTransform(m_jackRootIndex).m_position; + AZ::Vector3 pelvisStartPos = m_jackPose->GetModelSpaceTransform(m_bip01PelvisIndex).m_position; const float duration = m_motionNode->GetDuration(m_animGraphInstance); const float offset = duration * 0.5f; GetEMotionFX().Update(offset); EXPECT_FLOAT_EQ(uniqueData->GetCurrentPlayTime(), offset); - AZ::Vector3 rootCurrentPos = m_jackPose->GetModelSpaceTransform(m_jack_rootIndex).mPosition; - AZ::Vector3 pelvisCurrentPos = m_jackPose->GetModelSpaceTransform(m_bip01__pelvisIndex).mPosition; + AZ::Vector3 rootCurrentPos = m_jackPose->GetModelSpaceTransform(m_jackRootIndex).m_position; + AZ::Vector3 pelvisCurrentPos = m_jackPose->GetModelSpaceTransform(m_bip01PelvisIndex).m_position; EXPECT_TRUE(rootCurrentPos.GetY() > rootStartPos.GetY()) << "Y-axis position of root should increase."; EXPECT_TRUE(pelvisCurrentPos.GetY() > pelvisStartPos.GetY()) << "Y-axis position of pelvis should increase."; @@ -227,8 +227,8 @@ namespace EMotionFX pelvisStartPos = pelvisCurrentPos; GetEMotionFX().Update(duration * 0.6f); EXPECT_FLOAT_EQ(uniqueData->GetCurrentPlayTime(), duration * 0.1f); - rootCurrentPos = m_jackPose->GetModelSpaceTransform(m_jack_rootIndex).mPosition; - pelvisCurrentPos = m_jackPose->GetModelSpaceTransform(m_bip01__pelvisIndex).mPosition; + rootCurrentPos = m_jackPose->GetModelSpaceTransform(m_jackRootIndex).m_position; + pelvisCurrentPos = m_jackPose->GetModelSpaceTransform(m_bip01PelvisIndex).m_position; EXPECT_TRUE(rootCurrentPos.GetY() < rootStartPos.GetY()) << "Y-axis position of root should increase."; EXPECT_TRUE(pelvisCurrentPos.GetY() < pelvisStartPos.GetY()) << "Y-axis position of pelvis should increase."; }; @@ -237,7 +237,7 @@ namespace EMotionFX { m_motionNode->SetReverse(true); AnimGraphMotionNode::UniqueData* uniqueData = static_cast(m_animGraphInstance->FindOrCreateUniqueNodeData(m_motionNode)); - uniqueData->mReload = true; + uniqueData->m_reload = true; GetEMotionFX().Update(1.1f); EXPECT_TRUE(m_motionNode->GetIsReversed()) << "Reverse effect should be on."; @@ -246,11 +246,11 @@ namespace EMotionFX // Follow-through during the duration(~1.06666672 seconds) of the motion. for (float i = 0.1f; i < 1.2f; i += 0.1f) { - const AZ::Vector3 rootCurrentPos = m_jackPose->GetModelSpaceTransform(m_jack_rootIndex).mPosition; - const AZ::Vector3 pelvisCurrentPos = m_jackPose->GetModelSpaceTransform(m_bip01__pelvisIndex).mPosition; + const AZ::Vector3 rootCurrentPos = m_jackPose->GetModelSpaceTransform(m_jackRootIndex).m_position; + const AZ::Vector3 pelvisCurrentPos = m_jackPose->GetModelSpaceTransform(m_bip01PelvisIndex).m_position; GetEMotionFX().Update(1.0f / 10.0f); - const AZ::Vector3 rootUpdatedPos = m_jackPose->GetModelSpaceTransform(m_jack_rootIndex).mPosition; - const AZ::Vector3 pelvisUpdatedPos = m_jackPose->GetModelSpaceTransform(m_bip01__pelvisIndex).mPosition; + const AZ::Vector3 rootUpdatedPos = m_jackPose->GetModelSpaceTransform(m_jackRootIndex).m_position; + const AZ::Vector3 pelvisUpdatedPos = m_jackPose->GetModelSpaceTransform(m_bip01PelvisIndex).m_position; const float rootDifference = rootCurrentPos.GetY() - rootUpdatedPos.GetY(); const float pelvisDifference = pelvisCurrentPos.GetY() - pelvisUpdatedPos.GetY(); @@ -263,33 +263,33 @@ namespace EMotionFX TEST_F(AnimGraphMotionNodeFixture, DISABLED_NoInputAndMirrorMotionOutputsCorrectMotionAndPose) { AnimGraphMotionNode::UniqueData* uniqueData = static_cast(m_animGraphInstance->FindOrCreateUniqueNodeData(m_motionNode)); - uniqueData->mReload = true; + uniqueData->m_reload = true; GetEMotionFX().Update(1.0f); // Get positions before mirroring to compare with mirrored positions later. - const AZ::Vector3 l_handCurrentPos = m_jackPose->GetModelSpaceTransform(m_l_handIndex).mPosition; - const AZ::Vector3 l_loArmCurrentPos = m_jackPose->GetModelSpaceTransform(m_l_loArmIndex).mPosition; - const AZ::Vector3 l_loLegCurrentPos = m_jackPose->GetModelSpaceTransform(m_l_loLegIndex).mPosition; - const AZ::Vector3 l_ankleCurrentPos = m_jackPose->GetModelSpaceTransform(m_l_ankleIndex).mPosition; - const AZ::Vector3 r_handCurrentPos = m_jackPose->GetModelSpaceTransform(m_r_handIndex).mPosition; - const AZ::Vector3 r_loArmCurrentPos = m_jackPose->GetModelSpaceTransform(m_r_loArmIndex).mPosition; - const AZ::Vector3 r_loLegCurrentPos = m_jackPose->GetModelSpaceTransform(m_r_loLegIndex).mPosition; - const AZ::Vector3 r_ankleCurrentPos = m_jackPose->GetModelSpaceTransform(m_r_ankleIndex).mPosition; + const AZ::Vector3 l_handCurrentPos = m_jackPose->GetModelSpaceTransform(m_lHandIndex).m_position; + const AZ::Vector3 l_loArmCurrentPos = m_jackPose->GetModelSpaceTransform(m_lLoArmIndex).m_position; + const AZ::Vector3 l_loLegCurrentPos = m_jackPose->GetModelSpaceTransform(m_lLoLegIndex).m_position; + const AZ::Vector3 l_ankleCurrentPos = m_jackPose->GetModelSpaceTransform(m_lAnkleIndex).m_position; + const AZ::Vector3 r_handCurrentPos = m_jackPose->GetModelSpaceTransform(m_rHandIndex).m_position; + const AZ::Vector3 r_loArmCurrentPos = m_jackPose->GetModelSpaceTransform(m_rLoArmIndex).m_position; + const AZ::Vector3 r_loLegCurrentPos = m_jackPose->GetModelSpaceTransform(m_rLoLegIndex).m_position; + const AZ::Vector3 r_ankleCurrentPos = m_jackPose->GetModelSpaceTransform(m_rAnkleIndex).m_position; m_motionNode->SetMirrorMotion(true); - uniqueData->mReload = true; + uniqueData->m_reload = true; GetEMotionFX().Update(0.0001f); EXPECT_TRUE(m_motionNode->GetMirrorMotion()) << "Mirror motion effect should be on."; - const AZ::Vector3 l_handMirroredPos = m_jackPose->GetModelSpaceTransform(m_l_handIndex).mPosition; - const AZ::Vector3 l_loArmMirroredPos = m_jackPose->GetModelSpaceTransform(m_l_loArmIndex).mPosition; - const AZ::Vector3 l_loLegMirroredPos = m_jackPose->GetModelSpaceTransform(m_l_loLegIndex).mPosition; - const AZ::Vector3 l_ankleMirroredPos = m_jackPose->GetModelSpaceTransform(m_l_ankleIndex).mPosition; - const AZ::Vector3 r_handMirroredPos = m_jackPose->GetModelSpaceTransform(m_r_handIndex).mPosition; - const AZ::Vector3 r_loArmMirroredPos = m_jackPose->GetModelSpaceTransform(m_r_loArmIndex).mPosition; - const AZ::Vector3 r_loLegMirroredPos = m_jackPose->GetModelSpaceTransform(m_r_loLegIndex).mPosition; - const AZ::Vector3 r_ankleMirroredPos = m_jackPose->GetModelSpaceTransform(m_r_ankleIndex).mPosition; + const AZ::Vector3 l_handMirroredPos = m_jackPose->GetModelSpaceTransform(m_lHandIndex).m_position; + const AZ::Vector3 l_loArmMirroredPos = m_jackPose->GetModelSpaceTransform(m_lLoArmIndex).m_position; + const AZ::Vector3 l_loLegMirroredPos = m_jackPose->GetModelSpaceTransform(m_lLoLegIndex).m_position; + const AZ::Vector3 l_ankleMirroredPos = m_jackPose->GetModelSpaceTransform(m_lAnkleIndex).m_position; + const AZ::Vector3 r_handMirroredPos = m_jackPose->GetModelSpaceTransform(m_rHandIndex).m_position; + const AZ::Vector3 r_loArmMirroredPos = m_jackPose->GetModelSpaceTransform(m_rLoArmIndex).m_position; + const AZ::Vector3 r_loLegMirroredPos = m_jackPose->GetModelSpaceTransform(m_rLoLegIndex).m_position; + const AZ::Vector3 r_ankleMirroredPos = m_jackPose->GetModelSpaceTransform(m_rAnkleIndex).m_position; EXPECT_TRUE(PositionsAreMirrored(l_handCurrentPos, r_handMirroredPos, 0.001f)) << "Actor's left hand should be mirrored to right hand."; EXPECT_TRUE(PositionsAreMirrored(l_handMirroredPos, r_handCurrentPos, 0.001f)) << "Actor's right hand should be mirrored to left hand."; @@ -303,7 +303,7 @@ namespace EMotionFX TEST_F(AnimGraphMotionNodeFixture, InPlaceInputAndNoEffectOutputsCorrectMotionAndPose) { - m_motionNode->AddConnection(m_paramNode, m_paramNode->FindOutputPortByName("InPlace")->mPortID, AnimGraphMotionNode::INPUTPORT_INPLACE); + m_motionNode->AddConnection(m_paramNode, m_paramNode->FindOutputPortByName("InPlace")->m_portId, AnimGraphMotionNode::INPUTPORT_INPLACE); ParamSetValue("InPlace", true); m_animGraphInstance->FindOrCreateUniqueNodeData(m_motionNode); @@ -315,15 +315,15 @@ namespace EMotionFX // Follow-through during the duration(~1.06666672 seconds) of the motion. for (float i = 0.1f; i < 1.2f; i += 0.1f) { - const AZ::Vector3 rootCurrentPos = m_jackPose->GetModelSpaceTransform(m_jack_rootIndex).mPosition; - const AZ::Vector3 pelvisCurrentPos = m_jackPose->GetModelSpaceTransform(m_bip01__pelvisIndex).mPosition; - const AZ::Vector3 lankleCurrentPos = m_jackPose->GetModelSpaceTransform(m_l_ankleIndex).mPosition; - const AZ::Vector3 rankleCurrentPos = m_jackPose->GetModelSpaceTransform(m_r_ankleIndex).mPosition; + const AZ::Vector3 rootCurrentPos = m_jackPose->GetModelSpaceTransform(m_jackRootIndex).m_position; + const AZ::Vector3 pelvisCurrentPos = m_jackPose->GetModelSpaceTransform(m_bip01PelvisIndex).m_position; + const AZ::Vector3 lankleCurrentPos = m_jackPose->GetModelSpaceTransform(m_lAnkleIndex).m_position; + const AZ::Vector3 rankleCurrentPos = m_jackPose->GetModelSpaceTransform(m_rAnkleIndex).m_position; GetEMotionFX().Update(1.0f / 10.0f); - const AZ::Vector3 rootUpdatedPos = m_jackPose->GetModelSpaceTransform(m_jack_rootIndex).mPosition; - const AZ::Vector3 pelvisUpdatedPos = m_jackPose->GetModelSpaceTransform(m_bip01__pelvisIndex).mPosition; - const AZ::Vector3 lankleUpdatedPos = m_jackPose->GetModelSpaceTransform(m_l_ankleIndex).mPosition; - const AZ::Vector3 rankleUpdatedPos = m_jackPose->GetModelSpaceTransform(m_r_ankleIndex).mPosition; + const AZ::Vector3 rootUpdatedPos = m_jackPose->GetModelSpaceTransform(m_jackRootIndex).m_position; + const AZ::Vector3 pelvisUpdatedPos = m_jackPose->GetModelSpaceTransform(m_bip01PelvisIndex).m_position; + const AZ::Vector3 lankleUpdatedPos = m_jackPose->GetModelSpaceTransform(m_lAnkleIndex).m_position; + const AZ::Vector3 rankleUpdatedPos = m_jackPose->GetModelSpaceTransform(m_rAnkleIndex).m_position; EXPECT_TRUE(m_motionNode->GetIsInPlace(m_animGraphInstance)) << "InPlace flag of the motion node should be true."; EXPECT_TRUE(rootUpdatedPos.IsClose(rootCurrentPos, 0.0f)) << "Position of root should not change."; EXPECT_TRUE(pelvisCurrentPos != pelvisUpdatedPos) << "Position of pelvis should change."; @@ -343,12 +343,12 @@ namespace EMotionFX GetEMotionFX().Update(1.0f / 60.0f); // Root node's initial position under the first speed factor. - AZ::Vector3 rootInitialPosUnderSpeed1 = m_jackPose->GetModelSpaceTransform(m_jack_rootIndex).mPosition; - uniqueData->mReload = true; + AZ::Vector3 rootInitialPosUnderSpeed1 = m_jackPose->GetModelSpaceTransform(m_jackRootIndex).m_position; + uniqueData->m_reload = true; GetEMotionFX().Update(1.1f); // Root node's final position under the first speed factor. - AZ::Vector3 rootFinalPosUnderSpeed1 = m_jackPose->GetModelSpaceTransform(m_jack_rootIndex).mPosition; + AZ::Vector3 rootFinalPosUnderSpeed1 = m_jackPose->GetModelSpaceTransform(m_jackRootIndex).m_position; std::vector speedFactors = { 2.0f, 3.0f, 10.0f, 100.0f }; std::vector playTimes = { 0.6f, 0.4f, 0.11f, 0.011f }; for (size_t i = 0; i < 4; i++) @@ -357,12 +357,12 @@ namespace EMotionFX m_fltConstNode->SetValue(speedFactors[i]); GetEMotionFX().Update(1.0f / 60.0f); - uniqueData->mReload = true; - const AZ::Vector3 rootInitialPosUnderSpeed2 = m_jackPose->GetModelSpaceTransform(m_jack_rootIndex).mPosition; + uniqueData->m_reload = true; + const AZ::Vector3 rootInitialPosUnderSpeed2 = m_jackPose->GetModelSpaceTransform(m_jackRootIndex).m_position; // Faster play speed requires less play time to reach its final pose. GetEMotionFX().Update(playTimes[i]); - const AZ::Vector3 rootFinalPosUnderSpeed2 = m_jackPose->GetModelSpaceTransform(m_jack_rootIndex).mPosition; + const AZ::Vector3 rootFinalPosUnderSpeed2 = m_jackPose->GetModelSpaceTransform(m_jackRootIndex).m_position; EXPECT_TRUE(rootInitialPosUnderSpeed1.IsClose(rootInitialPosUnderSpeed2, 0.0f)) << "Root initial position should be same in different motion speeds."; EXPECT_TRUE(rootFinalPosUnderSpeed1.IsClose(rootFinalPosUnderSpeed2, 0.0f)) << "Root final position should be same in different motion speeds."; @@ -379,10 +379,10 @@ namespace EMotionFX m_motionNode->SetMotionPlaySpeed(1.0f); GetEMotionFX().Update(1.0f / 60.0f); - rootInitialPosUnderSpeed1 = m_jackPose->GetModelSpaceTransform(m_jack_rootIndex).mPosition; - uniqueData->mReload = true; + rootInitialPosUnderSpeed1 = m_jackPose->GetModelSpaceTransform(m_jackRootIndex).m_position; + uniqueData->m_reload = true; GetEMotionFX().Update(1.1f); - rootFinalPosUnderSpeed1 = m_jackPose->GetModelSpaceTransform(m_jack_rootIndex).mPosition; + rootFinalPosUnderSpeed1 = m_jackPose->GetModelSpaceTransform(m_jackRootIndex).m_position; // Similar test to using the InPlace input port. for (size_t i = 0; i < 4; i++) @@ -391,11 +391,11 @@ namespace EMotionFX m_motionNode->SetMotionPlaySpeed(speedFactors[i]); GetEMotionFX().Update(1.0f / 60.0f); - uniqueData->mReload = true; - const AZ::Vector3 rootInitialPosUnderSpeed2 = m_jackPose->GetModelSpaceTransform(m_jack_rootIndex).mPosition; + uniqueData->m_reload = true; + const AZ::Vector3 rootInitialPosUnderSpeed2 = m_jackPose->GetModelSpaceTransform(m_jackRootIndex).m_position; GetEMotionFX().Update(playTimes[i]); - const AZ::Vector3 rootFinalPosUnderSpeed2 = m_jackPose->GetModelSpaceTransform(m_jack_rootIndex).mPosition; + const AZ::Vector3 rootFinalPosUnderSpeed2 = m_jackPose->GetModelSpaceTransform(m_jackRootIndex).m_position; EXPECT_TRUE(rootInitialPosUnderSpeed1.IsClose(rootInitialPosUnderSpeed2, 0.0f)); EXPECT_TRUE(rootFinalPosUnderSpeed1.IsClose(rootFinalPosUnderSpeed2, 0.0f)); @@ -412,7 +412,7 @@ namespace EMotionFX AddMotionData(TestMotionAssets::GetJackDie(), "jack_death_fall_back_zup"); m_motionNode->AddMotionId("jack_death_fall_back_zup"); AnimGraphMotionNode::UniqueData* uniqueData = static_cast(m_animGraphInstance->FindOrCreateUniqueNodeData(m_motionNode)); - uniqueData->mReload = true; + uniqueData->m_reload = true; m_motionNode->Reinit(); m_motionNode->SetIndexMode(AnimGraphMotionNode::INDEXMODE_RANDOMIZE); @@ -429,11 +429,11 @@ namespace EMotionFX for (size_t i = 0; i < 20; i++) { // Run the test loop multiple times to make sure all the motion index is picked. - uniqueData->mReload = true; + uniqueData->m_reload = true; m_motionNode->Reinit(); GetEMotionFX().Update(2.0f); - const uint32 motionIndex = uniqueData->mActiveMotionIndex; + const uint32 motionIndex = uniqueData->m_activeMotionIndex; if (motionIndex == 0) { motion1Displayed = true; @@ -457,18 +457,18 @@ namespace EMotionFX uniqueData->Reset(); m_motionNode->Reinit(); uniqueData->Update(); - uint32 currentMotionIndex = uniqueData->mActiveMotionIndex; + uint32 currentMotionIndex = uniqueData->m_activeMotionIndex; // In randomized no repeat index mode, motions should change in each loop. for (size_t i = 0; i < 10; i++) { - uniqueData->mReload = true; + uniqueData->m_reload = true; m_motionNode->Reinit(); // As we keep and use the cached version of the unique data, we need to manually update it. uniqueData->Update(); - const AZ::u32 updatedMotionIndex = uniqueData->mActiveMotionIndex; + const AZ::u32 updatedMotionIndex = uniqueData->m_activeMotionIndex; EXPECT_TRUE(updatedMotionIndex != currentMotionIndex) << "Updated motion index should be different from its previous motion index."; currentMotionIndex = updatedMotionIndex; } @@ -478,11 +478,11 @@ namespace EMotionFX // In sequential index mode, motions should increase its index each time and wrap around. Basically iterating over the list of motions. for (size_t i = 0; i < 10; i++) { - uniqueData->mReload = true; + uniqueData->m_reload = true; m_motionNode->Reinit(); uniqueData->Update(); - EXPECT_NE(currentMotionIndex, uniqueData->mActiveMotionIndex) << "Updated motion index should match the expected motion index."; - currentMotionIndex = uniqueData->mActiveMotionIndex; + EXPECT_NE(currentMotionIndex, uniqueData->m_activeMotionIndex) << "Updated motion index should match the expected motion index."; + currentMotionIndex = uniqueData->m_activeMotionIndex; } }; } // end namespace EMotionFX diff --git a/Gems/EMotionFX/Code/Tests/AnimGraphNodeEventFilterTests.cpp b/Gems/EMotionFX/Code/Tests/AnimGraphNodeEventFilterTests.cpp index eb1da8f0a3..7509f03ede 100644 --- a/Gems/EMotionFX/Code/Tests/AnimGraphNodeEventFilterTests.cpp +++ b/Gems/EMotionFX/Code/Tests/AnimGraphNodeEventFilterTests.cpp @@ -26,12 +26,12 @@ namespace EMotionFX { struct EventFilteringTestParam { - AnimGraphObject::EEventMode eventMode; - float motionTime; - float testDuration; // Maximum of time this test will be run. - AZStd::pair eventTimeRange; - float blendWeight; - int eventTriggerTimes; + AnimGraphObject::EEventMode m_eventMode; + float m_motionTime; + float m_testDuration; // Maximum of time this test will be run. + AZStd::pair m_eventTimeRange; + float m_blendWeight; + int m_eventTriggerTimes; }; // Use this event handler to test if the on event is called. @@ -111,7 +111,7 @@ namespace EMotionFX const AZStd::string motionId = AZStd::string::format("Motion%zu", i); Motion* motion = aznew Motion(motionId.c_str()); motion->SetMotionData(aznew NonUniformMotionData()); - motion->GetMotionData()->SetDuration(param.motionTime); + motion->GetMotionData()->SetDuration(param.m_motionTime); m_motions.emplace_back(motion); MotionSet::MotionEntry* motionEntry = aznew MotionSet::MotionEntry(motion->GetName(), motion->GetName(), motion); m_motionSet->AddMotionEntry(motionEntry); @@ -124,7 +124,7 @@ namespace EMotionFX motion->GetEventTable()->AutoCreateSyncTrack(motion); AnimGraphSyncTrack* syncTrack = motion->GetEventTable()->GetSyncTrack(); AZStd::shared_ptr data = GetEMotionFX().GetEventManager()->FindOrCreateEventData(motionId.c_str(), "params"); - syncTrack->AddEvent(param.eventTimeRange.first, param.eventTimeRange.second, data); + syncTrack->AddEvent(param.m_eventTimeRange.first, param.m_eventTimeRange.second, data); } m_eventHandler = aznew EventFilteringEventHandler(); @@ -151,20 +151,20 @@ namespace EMotionFX TEST_P(AnimGraphNodeEventFilterTestFixture, EventFilterTests) { const EventFilteringTestParam& param = GetParam(); - m_floatNode->SetValue(param.blendWeight); - m_blend2Node->SetEventMode(param.eventMode); + m_floatNode->SetValue(param.m_blendWeight); + m_blend2Node->SetEventMode(param.m_eventMode); // Calling update first to make sure unique data is created. GetEMotionFX().Update(0.0f); // Expect the event handler will call different number of times based on the filtering mode, motion event range and test duration. EXPECT_CALL(*m_eventHandler, OnEvent(testing::_)) - .Times(param.eventTriggerTimes); + .Times(param.m_eventTriggerTimes); // Update emfx to trigger the event firing. float totalTime = 0.0f; const float deltaTime = 0.1f; - while (totalTime <= param.testDuration) + while (totalTime <= param.m_testDuration) { GetEMotionFX().Update(deltaTime); totalTime += deltaTime; diff --git a/Gems/EMotionFX/Code/Tests/AnimGraphStateMachineInterruptionTests.cpp b/Gems/EMotionFX/Code/Tests/AnimGraphStateMachineInterruptionTests.cpp index 38acdd68ee..1f700129c0 100644 --- a/Gems/EMotionFX/Code/Tests/AnimGraphStateMachineInterruptionTests.cpp +++ b/Gems/EMotionFX/Code/Tests/AnimGraphStateMachineInterruptionTests.cpp @@ -21,34 +21,34 @@ namespace EMotionFX struct AnimGraphStateMachine_InterruptionTestData { // Graph construction data. - float transitionLeftBlendTime; - float transitionLeftCountDownTime; - float transitionMiddleBlendTime; - float transitionMiddleCountDownTime; - float transitionRightBlendTime; - float transitionRightCountDownTime; + float m_transitionLeftBlendTime; + float m_transitionLeftCountDownTime; + float m_transitionMiddleBlendTime; + float m_transitionMiddleCountDownTime; + float m_transitionRightBlendTime; + float m_transitionRightCountDownTime; // Per frame checks. struct ActiveObjectsAtFrame { - AZ::u32 frameNr; + AZ::u32 m_frameNr; - bool stateA; - bool stateB; - bool stateC; - bool transitionLeft; - bool transitionMiddle; - bool transitionRight; + bool m_stateA; + bool m_stateB; + bool m_stateC; + bool m_transitionLeft; + bool m_transitionMiddle; + bool m_transitionRight; - AZ::u32 numStatesEntering; - AZ::u32 numStatesEntered; - AZ::u32 numStatesExited; - AZ::u32 numStatesEnded; - AZ::u32 numTransitionsStarted; - AZ::u32 numTransitionsEnded; + AZ::u32 m_numStatesEntering; + AZ::u32 m_numStatesEntered; + AZ::u32 m_numStatesExited; + AZ::u32 m_numStatesEnded; + AZ::u32 m_numTransitionsStarted; + AZ::u32 m_numTransitionsEnded; }; - std::vector activeObjectsAtFrame; + std::vector m_activeObjectsAtFrame; }; class AnimGraphStateMachine_InterruptionFixture @@ -86,21 +86,21 @@ namespace EMotionFX AnimGraphStateTransition* transitionLeft = AddTransitionWithTimeCondition(stateStart, stateA, - param.transitionLeftBlendTime/*blendTime*/, - param.transitionLeftCountDownTime)/*countDownTime*/; + param.m_transitionLeftBlendTime/*blendTime*/, + param.m_transitionLeftCountDownTime)/*countDownTime*/; transitionLeft->SetCanBeInterrupted(true); AnimGraphStateTransition* transitionMiddle = AddTransitionWithTimeCondition(stateStart, stateB, - param.transitionMiddleBlendTime, - param.transitionMiddleCountDownTime); + param.m_transitionMiddleBlendTime, + param.m_transitionMiddleCountDownTime); transitionMiddle->SetCanBeInterrupted(true); transitionMiddle->SetCanInterruptOtherTransitions(true); AnimGraphStateTransition* transitionRight = AddTransitionWithTimeCondition(stateStart, stateC, - param.transitionRightBlendTime, - param.transitionRightCountDownTime); + param.m_transitionRightBlendTime, + param.m_transitionRightCountDownTime); transitionRight->SetCanInterruptOtherTransitions(true); m_motionNodeAnimGraph->InitAfterLoading(); @@ -142,58 +142,58 @@ namespace EMotionFX /*preUpdateCallback*/[this](AnimGraphInstance*, float, float, int) {}, /*postUpdateCallback*/[this](AnimGraphInstance* animGraphInstance, [[maybe_unused]] float time, [[maybe_unused]] float timeDelta, int frame) { - const std::vector& activeObjectsAtFrame = GetParam().activeObjectsAtFrame; + const std::vector& activeObjectsAtFrame = GetParam().m_activeObjectsAtFrame; const AnimGraphStateMachine* stateMachine = this->m_rootStateMachine; const AZStd::vector& activeStates = stateMachine->GetActiveStates(animGraphInstance); const AZStd::vector& activeTransitions = stateMachine->GetActiveTransitions(animGraphInstance); AnimGraphStateMachine_InterruptionTestData::ActiveObjectsAtFrame compareAgainst; - compareAgainst.stateA = AZStd::find_if(activeStates.begin(), activeStates.end(), + compareAgainst.m_stateA = AZStd::find_if(activeStates.begin(), activeStates.end(), [](AnimGraphNode* element) -> bool { return element->GetNameString() == "A"; }) != activeStates.end(); - compareAgainst.stateB = AZStd::find_if(activeStates.begin(), activeStates.end(), + compareAgainst.m_stateB = AZStd::find_if(activeStates.begin(), activeStates.end(), [](AnimGraphNode* element) -> bool { return element->GetNameString() == "B"; }) != activeStates.end(); - compareAgainst.stateC = AZStd::find_if(activeStates.begin(), activeStates.end(), + compareAgainst.m_stateC = AZStd::find_if(activeStates.begin(), activeStates.end(), [](AnimGraphNode* element) -> bool { return element->GetNameString() == "C"; }) != activeStates.end(); - compareAgainst.transitionLeft = AZStd::find_if(activeTransitions.begin(), activeTransitions.end(), + compareAgainst.m_transitionLeft = AZStd::find_if(activeTransitions.begin(), activeTransitions.end(), [](AnimGraphStateTransition* element) -> bool { return element->GetTargetNode()->GetNameString() == "A"; }) != activeTransitions.end(); - compareAgainst.transitionMiddle = AZStd::find_if(activeTransitions.begin(), activeTransitions.end(), + compareAgainst.m_transitionMiddle = AZStd::find_if(activeTransitions.begin(), activeTransitions.end(), [](AnimGraphStateTransition* element) -> bool { return element->GetTargetNode()->GetNameString() == "B"; }) != activeTransitions.end(); - compareAgainst.transitionRight = AZStd::find_if(activeTransitions.begin(), activeTransitions.end(), + compareAgainst.m_transitionRight = AZStd::find_if(activeTransitions.begin(), activeTransitions.end(), [](AnimGraphStateTransition* element) -> bool { return element->GetTargetNode()->GetNameString() == "C"; }) != activeTransitions.end(); for (const auto& activeObjects : activeObjectsAtFrame) { - if (activeObjects.frameNr == frame) + if (activeObjects.m_frameNr == frame) { // Check which states and transitions are active and compare it to the expected ones. - EXPECT_EQ(activeObjects.stateA, compareAgainst.stateA) - << "State A expected to be " << (activeObjects.stateA ? "active." : "inactive."); - EXPECT_EQ(activeObjects.stateB, compareAgainst.stateB) - << "State B expected to be " << (activeObjects.stateB ? "active." : "inactive."); - EXPECT_EQ(activeObjects.stateC, compareAgainst.stateC) - << "State C expected to be " << (activeObjects.stateB ? "active." : "inactive."); - EXPECT_EQ(activeObjects.transitionLeft, compareAgainst.transitionLeft) - << "Transition Start->A expected to be " << (activeObjects.transitionLeft ? "active." : "inactive."); - EXPECT_EQ(activeObjects.transitionMiddle, compareAgainst.transitionMiddle) - << "Transition Start->B expected to be " << (activeObjects.transitionMiddle ? "active." : "inactive."); - EXPECT_EQ(activeObjects.transitionRight, compareAgainst.transitionRight) - << "Transition Start->C expected to be " << (activeObjects.transitionRight ? "active." : "inactive."); + EXPECT_EQ(activeObjects.m_stateA, compareAgainst.m_stateA) + << "State A expected to be " << (activeObjects.m_stateA ? "active." : "inactive."); + EXPECT_EQ(activeObjects.m_stateB, compareAgainst.m_stateB) + << "State B expected to be " << (activeObjects.m_stateB ? "active." : "inactive."); + EXPECT_EQ(activeObjects.m_stateC, compareAgainst.m_stateC) + << "State C expected to be " << (activeObjects.m_stateB ? "active." : "inactive."); + EXPECT_EQ(activeObjects.m_transitionLeft, compareAgainst.m_transitionLeft) + << "Transition Start->A expected to be " << (activeObjects.m_transitionLeft ? "active." : "inactive."); + EXPECT_EQ(activeObjects.m_transitionMiddle, compareAgainst.m_transitionMiddle) + << "Transition Start->B expected to be " << (activeObjects.m_transitionMiddle ? "active." : "inactive."); + EXPECT_EQ(activeObjects.m_transitionRight, compareAgainst.m_transitionRight) + << "Transition Start->C expected to be " << (activeObjects.m_transitionRight ? "active." : "inactive."); // Check anim graph events. - EXPECT_EQ(this->m_eventHandler->m_numStatesEntering, activeObjects.numStatesEntering) - << this->m_eventHandler->m_numStatesEntering << " states entering while " << activeObjects.numStatesEntering << " are expected."; - EXPECT_EQ(this->m_eventHandler->m_numStatesEntered, activeObjects.numStatesEntered) - << this->m_eventHandler->m_numStatesEntered << " states entered while " << activeObjects.numStatesEntered << " are expected."; - EXPECT_EQ(this->m_eventHandler->m_numStatesExited, activeObjects.numStatesExited) - << this->m_eventHandler->m_numStatesExited << " states exited while " << activeObjects.numStatesExited << " are expected."; - EXPECT_EQ(this->m_eventHandler->m_numStatesEnded, activeObjects.numStatesEnded) - << this->m_eventHandler->m_numStatesEnded << " states ended while " << activeObjects.numStatesEnded << " are expected."; - EXPECT_EQ(this->m_eventHandler->m_numTransitionsStarted, activeObjects.numTransitionsStarted) - << this->m_eventHandler->m_numTransitionsStarted << " transitions started while " << activeObjects.numTransitionsStarted << " are expected."; - EXPECT_EQ(this->m_eventHandler->m_numTransitionsEnded, activeObjects.numTransitionsEnded) - << this->m_eventHandler->m_numTransitionsEnded << " transitions ended while " << activeObjects.numTransitionsEnded << " are expected."; + EXPECT_EQ(this->m_eventHandler->m_numStatesEntering, activeObjects.m_numStatesEntering) + << this->m_eventHandler->m_numStatesEntering << " states entering while " << activeObjects.m_numStatesEntering << " are expected."; + EXPECT_EQ(this->m_eventHandler->m_numStatesEntered, activeObjects.m_numStatesEntered) + << this->m_eventHandler->m_numStatesEntered << " states entered while " << activeObjects.m_numStatesEntered << " are expected."; + EXPECT_EQ(this->m_eventHandler->m_numStatesExited, activeObjects.m_numStatesExited) + << this->m_eventHandler->m_numStatesExited << " states exited while " << activeObjects.m_numStatesExited << " are expected."; + EXPECT_EQ(this->m_eventHandler->m_numStatesEnded, activeObjects.m_numStatesEnded) + << this->m_eventHandler->m_numStatesEnded << " states ended while " << activeObjects.m_numStatesEnded << " are expected."; + EXPECT_EQ(this->m_eventHandler->m_numTransitionsStarted, activeObjects.m_numTransitionsStarted) + << this->m_eventHandler->m_numTransitionsStarted << " transitions started while " << activeObjects.m_numTransitionsStarted << " are expected."; + EXPECT_EQ(this->m_eventHandler->m_numTransitionsEnded, activeObjects.m_numTransitionsEnded) + << this->m_eventHandler->m_numTransitionsEnded << " transitions ended while " << activeObjects.m_numTransitionsEnded << " are expected."; } } } @@ -381,13 +381,13 @@ namespace EMotionFX struct AnimGraphStateMachine_InterruptionPropertiesTestData { - float transitionLeftBlendTime; - float transitionLeftCountDownTime; - float transitionRightBlendTime; - float transitionRightCountDownTime; - AnimGraphStateTransition::EInterruptionMode interruptionMode; - float maxBlendWeight; - AnimGraphStateTransition::EInterruptionBlendBehavior interruptionBlendBehavior; + float m_transitionLeftBlendTime; + float m_transitionLeftCountDownTime; + float m_transitionRightBlendTime; + float m_transitionRightCountDownTime; + AnimGraphStateTransition::EInterruptionMode m_interruptionMode; + float m_maxBlendWeight; + AnimGraphStateTransition::EInterruptionBlendBehavior m_interruptionBlendBehavior; }; class AnimGraphStateMachine_InterruptionPropertiesFixture @@ -422,18 +422,18 @@ namespace EMotionFX // Start->A (can be interrupted) m_transitionLeft = AddTransitionWithTimeCondition(stateStart, stateA, - param.transitionLeftBlendTime, - param.transitionLeftCountDownTime); + param.m_transitionLeftBlendTime, + param.m_transitionLeftCountDownTime); m_transitionLeft->SetCanBeInterrupted(true); - m_transitionLeft->SetInterruptionMode(param.interruptionMode); - m_transitionLeft->SetMaxInterruptionBlendWeight(param.maxBlendWeight); - m_transitionLeft->SetInterruptionBlendBehavior(param.interruptionBlendBehavior); + m_transitionLeft->SetInterruptionMode(param.m_interruptionMode); + m_transitionLeft->SetMaxInterruptionBlendWeight(param.m_maxBlendWeight); + m_transitionLeft->SetInterruptionBlendBehavior(param.m_interruptionBlendBehavior); // Start->B (interrupting transition) m_transitionRight = AddTransitionWithTimeCondition(stateStart, stateB, - param.transitionRightBlendTime, - param.transitionRightCountDownTime); + param.m_transitionRightBlendTime, + param.m_transitionRightCountDownTime); m_transitionRight->SetCanInterruptOtherTransitions(true); m_motionNodeAnimGraph->InitAfterLoading(); diff --git a/Gems/EMotionFX/Code/Tests/AnimGraphStateMachineSyncTests.cpp b/Gems/EMotionFX/Code/Tests/AnimGraphStateMachineSyncTests.cpp index 1d341dd753..37996abbd8 100644 --- a/Gems/EMotionFX/Code/Tests/AnimGraphStateMachineSyncTests.cpp +++ b/Gems/EMotionFX/Code/Tests/AnimGraphStateMachineSyncTests.cpp @@ -20,11 +20,11 @@ namespace EMotionFX { struct AnimGraphStateMachineSyncParam { - float playSpeedA; - float durationA; - float playSpeedB; - float durationB; - bool syncEnabled; + float m_playSpeedA; + float m_durationA; + float m_playSpeedB; + float m_durationB; + bool m_syncEnabled; }; class AnimGraphStateMachineSyncFixture @@ -51,7 +51,7 @@ namespace EMotionFX 1.0f/*blendTime*/, 0.0f/*countDownTime*/); - if (param.syncEnabled) + if (param.m_syncEnabled) { m_transition->SetSyncMode(AnimGraphObject::SYNCMODE_CLIPBASED); } @@ -85,8 +85,8 @@ namespace EMotionFX m_animGraphInstance->Destroy(); m_animGraphInstance = m_motionNodeAnimGraph->GetAnimGraphInstance(m_actorInstance, m_motionSet); - SetUpMotionNode("testMotionA", param.playSpeedA, param.durationA, m_stateA); - SetUpMotionNode("testMotionB", param.playSpeedB, param.durationB, m_stateB); + SetUpMotionNode("testMotionA", param.m_playSpeedA, param.m_durationA, m_stateA); + SetUpMotionNode("testMotionB", param.m_playSpeedB, param.m_durationB, m_stateB); GetEMotionFX().Update(0.0f); } diff --git a/Gems/EMotionFX/Code/Tests/AnimGraphSyncTrackTests.cpp b/Gems/EMotionFX/Code/Tests/AnimGraphSyncTrackTests.cpp index d23638c9ea..bb0c4e47b8 100644 --- a/Gems/EMotionFX/Code/Tests/AnimGraphSyncTrackTests.cpp +++ b/Gems/EMotionFX/Code/Tests/AnimGraphSyncTrackTests.cpp @@ -19,27 +19,27 @@ namespace EMotionFX { struct FindEventIndicesParams { - void (*eventFactory)(MotionEventTrack* track); - float timeValue; - size_t expectedLeft; - size_t expectedRight; + void (*m_eventFactory)(MotionEventTrack* track); + float m_timeValue; + size_t m_expectedLeft; + size_t m_expectedRight; }; void PrintTo(FindEventIndicesParams const object, ::std::ostream* os) { - if (object.eventFactory == &MakeNoEvents) + if (object.m_eventFactory == &MakeNoEvents) { *os << "Events: 0"; } - else if (object.eventFactory == &MakeOneEvent) + else if (object.m_eventFactory == &MakeOneEvent) { *os << "Events: 1"; } - else if (object.eventFactory == &MakeTwoEvents) + else if (object.m_eventFactory == &MakeTwoEvents) { *os << "Events: 2"; } - else if (object.eventFactory == &MakeThreeEvents) + else if (object.m_eventFactory == &MakeThreeEvents) { *os << "Events: 3"; } @@ -47,9 +47,9 @@ namespace EMotionFX { *os << "Events: Unknown"; } - *os << " Time value: " << object.timeValue - << " Expected left: " << object.expectedLeft - << " Expected right: " << object.expectedRight + *os << " Time value: " << object.m_timeValue + << " Expected left: " << object.m_expectedLeft + << " Expected right: " << object.m_expectedRight ; } @@ -67,7 +67,7 @@ namespace EMotionFX m_syncTrack = m_motion->GetEventTable()->GetSyncTrack(); const FindEventIndicesParams& params = GetParam(); - params.eventFactory(m_syncTrack); + params.m_eventFactory(m_syncTrack); } void TearDown() override @@ -85,9 +85,9 @@ namespace EMotionFX { const FindEventIndicesParams& params = GetParam(); size_t indexLeft, indexRight; - m_syncTrack->FindEventIndices(params.timeValue, &indexLeft, &indexRight); - EXPECT_EQ(indexLeft, params.expectedLeft); - EXPECT_EQ(indexRight, params.expectedRight); + m_syncTrack->FindEventIndices(params.m_timeValue, &indexLeft, &indexRight); + EXPECT_EQ(indexLeft, params.m_expectedLeft); + EXPECT_EQ(indexRight, params.m_expectedRight); } INSTANTIATE_TEST_CASE_P(TestFindEventIndices, TestFindEventIndicesFixture, @@ -167,28 +167,28 @@ namespace EMotionFX struct FindMatchingEventsParams { - void (*eventFactory)(MotionEventTrack* track); - size_t startingIndex; - size_t inEventAIndex; - size_t inEventBIndex; - size_t expectedEventA; - size_t expectedEventB; - bool mirrorInput; - bool mirrorOutput; - bool forward; + void (*m_eventFactory)(MotionEventTrack* track); + size_t m_startingIndex; + size_t m_inEventAIndex; + size_t m_inEventBIndex; + size_t m_expectedEventA; + size_t m_expectedEventB; + bool m_mirrorInput; + bool m_mirrorOutput; + bool m_forward; }; void PrintTo(FindMatchingEventsParams const object, ::std::ostream* os) { - if (object.eventFactory == &MakeNoEvents) + if (object.m_eventFactory == &MakeNoEvents) { *os << "Events: 0"; } - else if (object.eventFactory == &MakeOneEvent) + else if (object.m_eventFactory == &MakeOneEvent) { *os << "Events: 1"; } - else if (object.eventFactory == &MakeTwoLeftRightEvents) + else if (object.m_eventFactory == &MakeTwoLeftRightEvents) { *os << "Events: LRLR"; } @@ -196,14 +196,14 @@ namespace EMotionFX { *os << "Events: Unknown"; } - *os << " Start index: " << object.startingIndex - << " In Event A: " << object.inEventAIndex - << " In Event B: " << object.inEventBIndex - << " Expected Event A: " << object.expectedEventA - << " Expected Event B: " << object.expectedEventB - << " Mirror Input: " << object.mirrorInput - << " Mirror Output: " << object.mirrorOutput - << " Play direction: " << (object.forward ? "Forward" : "Backward") + *os << " Start index: " << object.m_startingIndex + << " In Event A: " << object.m_inEventAIndex + << " In Event B: " << object.m_inEventBIndex + << " Expected Event A: " << object.m_expectedEventA + << " Expected Event B: " << object.m_expectedEventB + << " Mirror Input: " << object.m_mirrorInput + << " Mirror Output: " << object.m_mirrorOutput + << " Play direction: " << (object.m_forward ? "Forward" : "Backward") ; } @@ -221,7 +221,7 @@ namespace EMotionFX m_syncTrack = m_motion->GetEventTable()->GetSyncTrack(); const FindMatchingEventsParams& params = GetParam(); - params.eventFactory(m_syncTrack); + params.m_eventFactory(m_syncTrack); } void TearDown() override @@ -241,21 +241,21 @@ namespace EMotionFX // Make sure we have an event to get the id of const size_t eventCount = m_syncTrack->GetNumEvents(); - const size_t eventAID = eventCount ? m_syncTrack->GetEvent(params.inEventAIndex).HashForSyncing(params.mirrorInput) : 0; - const size_t eventBID = eventCount ? m_syncTrack->GetEvent(params.inEventBIndex).HashForSyncing(params.mirrorInput) : 0; + const size_t eventAID = eventCount ? m_syncTrack->GetEvent(params.m_inEventAIndex).HashForSyncing(params.m_mirrorInput) : 0; + const size_t eventBID = eventCount ? m_syncTrack->GetEvent(params.m_inEventBIndex).HashForSyncing(params.m_mirrorInput) : 0; size_t outLeft, outRight; m_syncTrack->FindMatchingEvents( - params.startingIndex, + params.m_startingIndex, eventAID, eventBID, &outLeft, &outRight, - params.forward, - params.mirrorOutput + params.m_forward, + params.m_mirrorOutput ); - EXPECT_EQ(outLeft, params.expectedEventA); - EXPECT_EQ(outRight, params.expectedEventB); + EXPECT_EQ(outLeft, params.m_expectedEventA); + EXPECT_EQ(outRight, params.m_expectedEventB); } INSTANTIATE_TEST_CASE_P(TestFindMatchingEvents, TestFindMatchingEventsFixture, diff --git a/Gems/EMotionFX/Code/Tests/AnimGraphTransitionConditionTests.cpp b/Gems/EMotionFX/Code/Tests/AnimGraphTransitionConditionTests.cpp index 67f7421509..8e72ea1e8a 100644 --- a/Gems/EMotionFX/Code/Tests/AnimGraphTransitionConditionTests.cpp +++ b/Gems/EMotionFX/Code/Tests/AnimGraphTransitionConditionTests.cpp @@ -72,7 +72,7 @@ namespace EMotionFX const ConditionSetUpFunc& func, const ActiveNodesMap& activeNodesMap, const FrameCallback& frameCallback = [] (AnimGraphInstance*, int) {} - ) : m_setUpFunction(func), activeNodes(activeNodesMap), callback(frameCallback) + ) : m_setUpFunction(func), m_activeNodes(activeNodesMap), m_callback(frameCallback) { } @@ -80,9 +80,9 @@ namespace EMotionFX const ConditionSetUpFunc m_setUpFunction; // List of nodes that are active on each frame - const ActiveNodesMap activeNodes; + const ActiveNodesMap m_activeNodes; - const FrameCallback callback; + const FrameCallback m_callback; }; template @@ -90,14 +90,14 @@ namespace EMotionFX public ::testing::WithParamInterface> { public: - const float fps; - const float updateInterval; - const int numUpdates; + const float m_fps; + const float m_updateInterval; + const int m_numUpdates; TransitionConditionFixtureP() - : fps(60.0f) - , updateInterval(1.0f / fps) - , numUpdates(static_cast(3.0f * fps)) + : m_fps(60.0f) + , m_updateInterval(1.0f / m_fps) + , m_numUpdates(static_cast(3.0f * m_fps)) { } @@ -130,14 +130,14 @@ namespace EMotionFX protected: void RunEMotionFXUpdateLoop() { - const ActiveNodesMap& activeNodes = this->GetParam().activeNodes; - const FrameCallback& callback = this->GetParam().callback; + const ActiveNodesMap& activeNodes = this->GetParam().m_activeNodes; + const FrameCallback& callback = this->GetParam().m_callback; // Allow tests to set starting values for parameters callback(m_animGraphInstance, -1); // Run the EMotionFX update loop for 3 seconds at 60 fps - for (int frameNum = 0; frameNum < numUpdates; ++frameNum) + for (int frameNum = 0; frameNum < m_numUpdates; ++frameNum) { // Allow for test-data defined updates to the graph state callback(m_animGraphInstance, frameNum); @@ -154,7 +154,7 @@ namespace EMotionFX } else { - GetEMotionFX().Update(updateInterval); + GetEMotionFX().Update(m_updateInterval); } // Check the state for the current frame @@ -168,7 +168,7 @@ namespace EMotionFX const AZStd::vector& gotActiveNodes = m_stateMachine->GetActiveStates(m_animGraphInstance); - EXPECT_EQ(gotActiveNodes, expectedActiveNodes) << "on frame " << frameNum << ", time " << frameNum * updateInterval; + EXPECT_EQ(gotActiveNodes, expectedActiveNodes) << "on frame " << frameNum << ", time " << frameNum * m_updateInterval; } } { @@ -237,28 +237,28 @@ namespace EMotionFX motionToExitTransition->SetBlendTime(0.0f); motionToExitTransition->AddCondition(motionToExitCondition); - mChildState = aznew AnimGraphStateMachine(); - mChildState->SetName("ChildStateMachine"); - mChildState->AddChildNode(childMotionNode); - mChildState->AddChildNode(childExitNode); - mChildState->SetEntryState(childMotionNode); - mChildState->AddTransition(motionToExitTransition); + m_childState = aznew AnimGraphStateMachine(); + m_childState->SetName("ChildStateMachine"); + m_childState->AddChildNode(childMotionNode); + m_childState->AddChildNode(childExitNode); + m_childState->SetEntryState(childMotionNode); + m_childState->AddTransition(motionToExitTransition); AnimGraphTimeCondition* motion0ToChildStateCondition = aznew AnimGraphTimeCondition(); motion0ToChildStateCondition->SetCountDownTime(0.5f); AnimGraphStateTransition* motion0ToChildStateTransition = aznew AnimGraphStateTransition(); motion0ToChildStateTransition->SetSourceNode(m_motionNodeA); - motion0ToChildStateTransition->SetTargetNode(mChildState); + motion0ToChildStateTransition->SetTargetNode(m_childState); motion0ToChildStateTransition->SetBlendTime(0.5f); motion0ToChildStateTransition->AddCondition(motion0ToChildStateCondition); AnimGraphStateTransition* childStateToMotion1Transition = aznew AnimGraphStateTransition(); - childStateToMotion1Transition->SetSourceNode(mChildState); + childStateToMotion1Transition->SetSourceNode(m_childState); childStateToMotion1Transition->SetTargetNode(m_motionNodeB); childStateToMotion1Transition->SetBlendTime(0.5f); - m_stateMachine->AddChildNode(mChildState); + m_stateMachine->AddChildNode(m_childState); m_stateMachine->AddTransition(motion0ToChildStateTransition); m_stateMachine->AddTransition(childStateToMotion1Transition); @@ -272,7 +272,7 @@ namespace EMotionFX } protected: - AnimGraphStateMachine* mChildState; + AnimGraphStateMachine* m_childState; }; class RangedMotionEventConditionFixture diff --git a/Gems/EMotionFX/Code/Tests/BlendTreeFloatMath1NodeTests.cpp b/Gems/EMotionFX/Code/Tests/BlendTreeFloatMath1NodeTests.cpp index 522cbf194e..3ece046845 100644 --- a/Gems/EMotionFX/Code/Tests/BlendTreeFloatMath1NodeTests.cpp +++ b/Gems/EMotionFX/Code/Tests/BlendTreeFloatMath1NodeTests.cpp @@ -98,7 +98,7 @@ namespace EMotionFX void TestInput(const AZStd::string& paramName, std::vector xInputs) { BlendTreeConnection* connection = m_floatMath1Node->AddConnection(m_paramNode, - m_paramNode->FindOutputPortByName(paramName)->mPortID, BlendTreeFloatMath1Node::PORTID_INPUT_X); + m_paramNode->FindOutputPortByName(paramName)->m_portId, BlendTreeFloatMath1Node::PORTID_INPUT_X); for (inputType i : xInputs) { diff --git a/Gems/EMotionFX/Code/Tests/BlendTreeFootIKNodeTests.cpp b/Gems/EMotionFX/Code/Tests/BlendTreeFootIKNodeTests.cpp index 609d291800..2f62365dd8 100644 --- a/Gems/EMotionFX/Code/Tests/BlendTreeFootIKNodeTests.cpp +++ b/Gems/EMotionFX/Code/Tests/BlendTreeFootIKNodeTests.cpp @@ -142,8 +142,8 @@ namespace EMotionFX ASSERT_NE(footIndex, InvalidIndex); EMotionFX::Transform transform = m_actorInstance->GetTransformData()->GetCurrentPose()->GetWorldSpaceTransform(footIndex); const BlendTreeFootIKNode::UniqueData* uniqueData = static_cast(m_animGraphInstance->FindOrCreateUniqueNodeData(m_ikNode)); - const float correction = (m_actorInstance->GetWorldSpaceTransform().mRotation.TransformVector(AZ::Vector3(0.0f, 0.0f, uniqueData->m_legs[legId].m_footHeight))).GetZ(); - const float pos = transform.mPosition.GetZ() - correction; + const float correction = (m_actorInstance->GetWorldSpaceTransform().m_rotation.TransformVector(AZ::Vector3(0.0f, 0.0f, uniqueData->m_legs[legId].m_footHeight))).GetZ(); + const float pos = transform.m_position.GetZ() - correction; EXPECT_NEAR(pos, height, tolerance); } @@ -325,7 +325,7 @@ namespace EMotionFX // Rotate the actor instance 180 degrees over the X axis as well. EMotionFX::Transform transform; transform.Identity(); - transform.mRotation = AZ::Quaternion::CreateFromAxisAngle(AZ::Vector3(1.0f, 0.0f, 0.0f), MCore::Math::pi); + transform.m_rotation = AZ::Quaternion::CreateFromAxisAngle(AZ::Vector3(1.0f, 0.0f, 0.0f), MCore::Math::pi); m_actorInstance->SetLocalSpaceTransform(transform); // Tests where the leg can reach the target position just fine, make sure the hip adjustment doesn't break it. diff --git a/Gems/EMotionFX/Code/Tests/BlendTreeMaskNodeTests.cpp b/Gems/EMotionFX/Code/Tests/BlendTreeMaskNodeTests.cpp index e63fd2c2c7..b86041c7aa 100644 --- a/Gems/EMotionFX/Code/Tests/BlendTreeMaskNodeTests.cpp +++ b/Gems/EMotionFX/Code/Tests/BlendTreeMaskNodeTests.cpp @@ -72,7 +72,7 @@ namespace EMotionFX for (size_t i = 0; i < numJoints; ++i) { Transform transform = outputPose.GetLocalSpaceTransform(i); - transform.mPosition = AZ::Vector3(m_identificationValue, m_identificationValue, m_identificationValue); + transform.m_position = AZ::Vector3(m_identificationValue, m_identificationValue, m_identificationValue); outputPose.SetLocalSpaceTransform(i, transform); } } @@ -230,7 +230,7 @@ namespace EMotionFX // The components of the position embed the origin. // If the compareValue equals m_basePosePosValue, it originates from the base pose input. // In case the joint is part of any of the masks and got overwriten by them, the compareValue represents the mask index. - const size_t compareValue = static_cast(transform.mPosition.GetX()); + const size_t compareValue = static_cast(transform.m_position.GetX()); AZ::Outcome maskIndex = FindMaskIndexForJoint(jointIndex); if (maskIndex.IsSuccess()) diff --git a/Gems/EMotionFX/Code/Tests/BlendTreeMirrorPoseNodeTests.cpp b/Gems/EMotionFX/Code/Tests/BlendTreeMirrorPoseNodeTests.cpp index 9851409a94..ee61e25370 100644 --- a/Gems/EMotionFX/Code/Tests/BlendTreeMirrorPoseNodeTests.cpp +++ b/Gems/EMotionFX/Code/Tests/BlendTreeMirrorPoseNodeTests.cpp @@ -32,8 +32,8 @@ namespace EMotionFX public: void SetupMirrorNodes(const Node* leftNode, const Node* rightNode) { - m_actor->GetNodeMirrorInfo(leftNode->GetNodeIndex()).mSourceNode = static_cast(rightNode->GetNodeIndex()); - m_actor->GetNodeMirrorInfo(rightNode->GetNodeIndex()).mSourceNode = static_cast(leftNode->GetNodeIndex()); + m_actor->GetNodeMirrorInfo(leftNode->GetNodeIndex()).m_sourceNode = static_cast(rightNode->GetNodeIndex()); + m_actor->GetNodeMirrorInfo(rightNode->GetNodeIndex()).m_sourceNode = static_cast(leftNode->GetNodeIndex()); } void ConstructGraph() override @@ -129,13 +129,13 @@ namespace EMotionFX // Remember the original position for comparison later Pose * jackPose = m_actorInstance->GetTransformData()->GetCurrentPose(); - const AZ::Vector3 l_upArmOriginalPos = jackPose->GetModelSpaceTransform(l_upArmIndex).mPosition; - const AZ::Vector3 r_upArmOriginalPos = jackPose->GetModelSpaceTransform(r_upArmIndex).mPosition; + const AZ::Vector3 l_upArmOriginalPos = jackPose->GetModelSpaceTransform(l_upArmIndex).m_position; + const AZ::Vector3 r_upArmOriginalPos = jackPose->GetModelSpaceTransform(r_upArmIndex).m_position; GetEMotionFX().Update(1.0f / 60.0f); // Remember mirrored position - const AZ::Vector3 l_upArmMirroredPos = jackPose->GetModelSpaceTransform(l_upArmIndex).mPosition; - const AZ::Vector3 r_upArmMirroredPos = jackPose->GetModelSpaceTransform(r_upArmIndex).mPosition; + const AZ::Vector3 l_upArmMirroredPos = jackPose->GetModelSpaceTransform(l_upArmIndex).m_position; + const AZ::Vector3 r_upArmMirroredPos = jackPose->GetModelSpaceTransform(r_upArmIndex).m_position; // Expect poses to be at the same position because mirror pose node is off EXPECT_FALSE(m_mirrorPoseNode->GetIsMirroringEnabled(m_animGraphInstance)); @@ -144,19 +144,19 @@ namespace EMotionFX // Mirror Pose Node enabled m_floatConstantNode->SetValue(1.0f); - const AZ::Vector3 l_upArmPos = jackPose->GetModelSpaceTransform(l_upArmIndex).mPosition; - const AZ::Vector3 r_upArmPos = jackPose->GetModelSpaceTransform(r_upArmIndex).mPosition; - const AZ::Vector3 l_loArmPos = jackPose->GetModelSpaceTransform(l_loArmIndex).mPosition; - const AZ::Vector3 r_loArmPos = jackPose->GetModelSpaceTransform(r_loArmIndex).mPosition; - const AZ::Vector3 l_handPos = jackPose->GetModelSpaceTransform(l_handIndex).mPosition; - const AZ::Vector3 r_handPos = jackPose->GetModelSpaceTransform(r_handIndex).mPosition; + const AZ::Vector3 l_upArmPos = jackPose->GetModelSpaceTransform(l_upArmIndex).m_position; + const AZ::Vector3 r_upArmPos = jackPose->GetModelSpaceTransform(r_upArmIndex).m_position; + const AZ::Vector3 l_loArmPos = jackPose->GetModelSpaceTransform(l_loArmIndex).m_position; + const AZ::Vector3 r_loArmPos = jackPose->GetModelSpaceTransform(r_loArmIndex).m_position; + const AZ::Vector3 l_handPos = jackPose->GetModelSpaceTransform(l_handIndex).m_position; + const AZ::Vector3 r_handPos = jackPose->GetModelSpaceTransform(r_handIndex).m_position; GetEMotionFX().Update(1.0f / 60.0f); - const AZ::Vector3 mirroredl_upArmPos = jackPose->GetModelSpaceTransform(l_upArmIndex).mPosition; - const AZ::Vector3 mirroredr_upArmPos = jackPose->GetModelSpaceTransform(r_upArmIndex).mPosition; - const AZ::Vector3 mirroredl_loArmPos = jackPose->GetModelSpaceTransform(l_loArmIndex).mPosition; - const AZ::Vector3 mirroredr_loArmPos = jackPose->GetModelSpaceTransform(r_loArmIndex).mPosition; - const AZ::Vector3 mirroredl_handPos = jackPose->GetModelSpaceTransform(l_handIndex).mPosition; - const AZ::Vector3 mirroredr_handPos = jackPose->GetModelSpaceTransform(r_handIndex).mPosition; + const AZ::Vector3 mirroredl_upArmPos = jackPose->GetModelSpaceTransform(l_upArmIndex).m_position; + const AZ::Vector3 mirroredr_upArmPos = jackPose->GetModelSpaceTransform(r_upArmIndex).m_position; + const AZ::Vector3 mirroredl_loArmPos = jackPose->GetModelSpaceTransform(l_loArmIndex).m_position; + const AZ::Vector3 mirroredr_loArmPos = jackPose->GetModelSpaceTransform(r_loArmIndex).m_position; + const AZ::Vector3 mirroredl_handPos = jackPose->GetModelSpaceTransform(l_handIndex).m_position; + const AZ::Vector3 mirroredr_handPos = jackPose->GetModelSpaceTransform(r_handIndex).m_position; EXPECT_TRUE(m_mirrorPoseNode->GetIsMirroringEnabled(m_animGraphInstance)); diff --git a/Gems/EMotionFX/Code/Tests/BlendTreeMotionFrameNodeTests.cpp b/Gems/EMotionFX/Code/Tests/BlendTreeMotionFrameNodeTests.cpp index 49938c121e..947b10f16e 100644 --- a/Gems/EMotionFX/Code/Tests/BlendTreeMotionFrameNodeTests.cpp +++ b/Gems/EMotionFX/Code/Tests/BlendTreeMotionFrameNodeTests.cpp @@ -73,7 +73,7 @@ namespace EMotionFX void SetAndTestTimeValue(BlendTreeMotionFrameNode::UniqueData* uniqueData, float newNormalizedTime, bool rewind = false) { - const float prevNewTime = uniqueData->mNewTime; + const float prevNewTime = uniqueData->m_newTime; m_motionFrameNode->SetNormalizedTimeValue(newNormalizedTime); if (rewind) @@ -96,9 +96,9 @@ namespace EMotionFX expectedOldTime = newNormalizedTime * m_motionDuration; } } - EXPECT_EQ(uniqueData->mOldTime, expectedOldTime); + EXPECT_EQ(uniqueData->m_oldTime, expectedOldTime); - EXPECT_EQ(uniqueData->mNewTime, newNormalizedTime * m_motionDuration); + EXPECT_EQ(uniqueData->m_newTime, newNormalizedTime * m_motionDuration); } public: diff --git a/Gems/EMotionFX/Code/Tests/BlendTreeRotationLimitNodeTests.cpp b/Gems/EMotionFX/Code/Tests/BlendTreeRotationLimitNodeTests.cpp index 31e0d696d0..b6d5e0b04d 100644 --- a/Gems/EMotionFX/Code/Tests/BlendTreeRotationLimitNodeTests.cpp +++ b/Gems/EMotionFX/Code/Tests/BlendTreeRotationLimitNodeTests.cpp @@ -101,10 +101,10 @@ namespace EMotionFX Transform expected = Transform::CreateIdentity(); expected.Set(AZ::Vector3::CreateZero(), expectedRotation); - bool success = AZ::IsClose(expected.mRotation.GetW(), outputRoot.mRotation.GetW(), 0.0001f); - success = success && AZ::IsClose(expected.mRotation.GetX(), outputRoot.mRotation.GetX(), 0.0001f); - success = success && AZ::IsClose(expected.mRotation.GetY(), outputRoot.mRotation.GetY(), 0.0001f); - success = success && AZ::IsClose(expected.mRotation.GetZ(), outputRoot.mRotation.GetZ(), 0.0001f); + bool success = AZ::IsClose(expected.m_rotation.GetW(), outputRoot.m_rotation.GetW(), 0.0001f); + success = success && AZ::IsClose(expected.m_rotation.GetX(), outputRoot.m_rotation.GetX(), 0.0001f); + success = success && AZ::IsClose(expected.m_rotation.GetY(), outputRoot.m_rotation.GetY(), 0.0001f); + success = success && AZ::IsClose(expected.m_rotation.GetZ(), outputRoot.m_rotation.GetZ(), 0.0001f); ASSERT_TRUE(success); } diff --git a/Gems/EMotionFX/Code/Tests/BlendTreeRotationMath2NodeTests.cpp b/Gems/EMotionFX/Code/Tests/BlendTreeRotationMath2NodeTests.cpp index a59d91fa8c..ef0a2aa959 100644 --- a/Gems/EMotionFX/Code/Tests/BlendTreeRotationMath2NodeTests.cpp +++ b/Gems/EMotionFX/Code/Tests/BlendTreeRotationMath2NodeTests.cpp @@ -87,10 +87,10 @@ namespace EMotionFX Transform outputRoot = GetOutputTransform(); Transform expected = Transform::CreateIdentity(); expected.Set(AZ::Vector3::CreateZero(), expectedRotation); - bool success = AZ::IsClose(expected.mRotation.GetW(), outputRoot.mRotation.GetW(), 0.0001f); - success = success && AZ::IsClose(expected.mRotation.GetX(), outputRoot.mRotation.GetX(), 0.0001f); - success = success && AZ::IsClose(expected.mRotation.GetY(), outputRoot.mRotation.GetY(), 0.0001f); - success = success && AZ::IsClose(expected.mRotation.GetZ(), outputRoot.mRotation.GetZ(), 0.0001f); + bool success = AZ::IsClose(expected.m_rotation.GetW(), outputRoot.m_rotation.GetW(), 0.0001f); + success = success && AZ::IsClose(expected.m_rotation.GetX(), outputRoot.m_rotation.GetX(), 0.0001f); + success = success && AZ::IsClose(expected.m_rotation.GetY(), outputRoot.m_rotation.GetY(), 0.0001f); + success = success && AZ::IsClose(expected.m_rotation.GetZ(), outputRoot.m_rotation.GetZ(), 0.0001f); m_rotationMathNode->SetMathFunction(EMotionFX::BlendTreeRotationMath2Node::MATHFUNCTION_INVERSE_MULTIPLY); @@ -99,10 +99,10 @@ namespace EMotionFX outputRoot = GetOutputTransform(); expected.Identity(); expected.Set(AZ::Vector3::CreateZero(), expectedRotation); - success = success && AZ::IsClose(expected.mRotation.GetW(), outputRoot.mRotation.GetW(), 0.0001f); - success = success && AZ::IsClose(expected.mRotation.GetX(), outputRoot.mRotation.GetX(), 0.0001f); - success = success && AZ::IsClose(expected.mRotation.GetY(), outputRoot.mRotation.GetY(), 0.0001f); - success = success && AZ::IsClose(expected.mRotation.GetZ(), outputRoot.mRotation.GetZ(), 0.0001f); + success = success && AZ::IsClose(expected.m_rotation.GetW(), outputRoot.m_rotation.GetW(), 0.0001f); + success = success && AZ::IsClose(expected.m_rotation.GetX(), outputRoot.m_rotation.GetX(), 0.0001f); + success = success && AZ::IsClose(expected.m_rotation.GetY(), outputRoot.m_rotation.GetY(), 0.0001f); + success = success && AZ::IsClose(expected.m_rotation.GetZ(), outputRoot.m_rotation.GetZ(), 0.0001f); ASSERT_TRUE(success); diff --git a/Gems/EMotionFX/Code/Tests/BlendTreeSimulatedObjectNodeTests.cpp b/Gems/EMotionFX/Code/Tests/BlendTreeSimulatedObjectNodeTests.cpp index df2f644eb4..a4ec05746a 100644 --- a/Gems/EMotionFX/Code/Tests/BlendTreeSimulatedObjectNodeTests.cpp +++ b/Gems/EMotionFX/Code/Tests/BlendTreeSimulatedObjectNodeTests.cpp @@ -135,10 +135,10 @@ namespace EMotionFX for (size_t joint = 0; joint < 3; ++joint) { - const AZ::Vector3& jointPos = currentPose.GetWorldSpaceTransform(m_jointIndices[joint]).mPosition; - const AZ::Vector3& jointBindPos = bindPose.GetWorldSpaceTransform(m_jointIndices[joint]).mPosition; + const AZ::Vector3& jointPos = currentPose.GetWorldSpaceTransform(m_jointIndices[joint]).m_position; + const AZ::Vector3& jointBindPos = bindPose.GetWorldSpaceTransform(m_jointIndices[joint]).m_position; ASSERT_TRUE((jointPos - jointBindPos).GetLength() <= 0.01f); // Make sure we didn't move too far from the bind pose. - ASSERT_TRUE(AZ::IsClose(currentPose.GetWorldSpaceTransform(m_jointIndices[joint]).mRotation.GetLength(), 1.0f, 0.001f)); // Make sure we have a unit quaternion. + ASSERT_TRUE(AZ::IsClose(currentPose.GetWorldSpaceTransform(m_jointIndices[joint]).m_rotation.GetLength(), 1.0f, 0.001f)); // Make sure we have a unit quaternion. } } } diff --git a/Gems/EMotionFX/Code/Tests/BlendTreeTransformNodeTests.cpp b/Gems/EMotionFX/Code/Tests/BlendTreeTransformNodeTests.cpp index 13baa72d09..80e6c81bb3 100644 --- a/Gems/EMotionFX/Code/Tests/BlendTreeTransformNodeTests.cpp +++ b/Gems/EMotionFX/Code/Tests/BlendTreeTransformNodeTests.cpp @@ -89,13 +89,13 @@ namespace EMotionFX translate_amount->SetValue(0.5f); Evaluate(); - expected.mPosition = AZ::Vector3(5.0f, 0.0f, 0.0f); + expected.m_position = AZ::Vector3(5.0f, 0.0f, 0.0f); outputRoot = GetOutputTransform(); ASSERT_EQ(expected, outputRoot); translate_amount->SetValue(1.0f); Evaluate(); - expected.mPosition = AZ::Vector3(10.0f, 0.0f, 0.0f); + expected.m_position = AZ::Vector3(10.0f, 0.0f, 0.0f); outputRoot = GetOutputTransform(); ASSERT_EQ(expected, outputRoot); } diff --git a/Gems/EMotionFX/Code/Tests/BlendTreeTwoLinkIKNodeTests.cpp b/Gems/EMotionFX/Code/Tests/BlendTreeTwoLinkIKNodeTests.cpp index 820e6d9fa4..d68bf9db83 100644 --- a/Gems/EMotionFX/Code/Tests/BlendTreeTwoLinkIKNodeTests.cpp +++ b/Gems/EMotionFX/Code/Tests/BlendTreeTwoLinkIKNodeTests.cpp @@ -28,13 +28,13 @@ namespace EMotionFX { struct BlendTreeTwoLinkIKNodeTestsData { - AZStd::string testJointName; - std::vector linkedJointNames; - std::vector> reachablePositions; - std::vector> unreachablePositions; - std::vector> rotations; - std::vector bendDirPosition; - std::vector alignToNodeNames; + AZStd::string m_testJointName; + std::vector m_linkedJointNames; + std::vector> m_reachablePositions; + std::vector> m_unreachablePositions; + std::vector> m_rotations; + std::vector m_bendDirPosition; + std::vector m_alignToNodeNames; }; class BlendTreeTwoLinkIKNodeFixture @@ -70,7 +70,7 @@ namespace EMotionFX m_paramNode = aznew BlendTreeParameterNode(); m_twoLinkIKNode = aznew BlendTreeTwoLinkIKNode(); - m_twoLinkIKNode->SetEndNodeName(m_param.testJointName); + m_twoLinkIKNode->SetEndNodeName(m_param.m_testJointName); m_blendTree = aznew BlendTree(); m_blendTree->AddChildNode(bindPoseNode); @@ -137,9 +137,9 @@ namespace EMotionFX TEST_P(BlendTreeTwoLinkIKNodeFixture, ReachablePositionsOutputCorrectPose) { // Set values for vector3 and twoLinkIKNode weight parameter - m_twoLinkIKNode->AddConnection(m_paramNode, m_paramNode->FindOutputPortByName("WeightParam")->mPortID, BlendTreeTwoLinkIKNode::INPUTPORT_WEIGHT); + m_twoLinkIKNode->AddConnection(m_paramNode, m_paramNode->FindOutputPortByName("WeightParam")->m_portId, BlendTreeTwoLinkIKNode::INPUTPORT_WEIGHT); m_twoLinkIKNode->AddConnection(m_paramNode, - m_paramNode->FindOutputPortByName("GoalPosParam")->mPortID, BlendTreeTwoLinkIKNode::INPUTPORT_GOALPOS); + m_paramNode->FindOutputPortByName("GoalPosParam")->m_portId, BlendTreeTwoLinkIKNode::INPUTPORT_GOALPOS); GetEMotionFX().Update(1.0f / 60.0f); const float weight = testing::get<0>(GetParam()); @@ -148,10 +148,10 @@ namespace EMotionFX // Remeber specific joint's original position to compare with its new position later const Pose* jackPose = m_actorInstance->GetTransformData()->GetCurrentPose(); size_t testJointIndex; - m_jackSkeleton->FindNodeAndIndexByName(m_param.testJointName, testJointIndex); - const AZ::Vector3& testJointPos = jackPose->GetModelSpaceTransform(testJointIndex).mPosition; + m_jackSkeleton->FindNodeAndIndexByName(m_param.m_testJointName, testJointIndex); + const AZ::Vector3& testJointPos = jackPose->GetModelSpaceTransform(testJointIndex).m_position; - for (std::vector goalPosXYZ : m_param.reachablePositions) + for (std::vector goalPosXYZ : m_param.m_reachablePositions) { const float goalX = goalPosXYZ[0]; const float goalY = goalPosXYZ[1]; @@ -159,7 +159,7 @@ namespace EMotionFX ParamSetValue("GoalPosParam", AZ::Vector3(goalX, goalY, goalZ)); GetEMotionFX().Update(5.0f / 60.0f); - const AZ::Vector3& testJointNewPos = jackPose->GetModelSpaceTransform(testJointIndex).mPosition; + const AZ::Vector3& testJointNewPos = jackPose->GetModelSpaceTransform(testJointIndex).m_position; // Based on weight, check if position of node changes to reachable goal position if (weight) @@ -179,7 +179,7 @@ namespace EMotionFX TEST_P(BlendTreeTwoLinkIKNodeFixture, ReachableAlignToNodeOutputCorrectPose) { - m_twoLinkIKNode->AddConnection(m_paramNode, m_paramNode->FindOutputPortByName("WeightParam")->mPortID, + m_twoLinkIKNode->AddConnection(m_paramNode, m_paramNode->FindOutputPortByName("WeightParam")->m_portId, BlendTreeTwoLinkIKNode::INPUTPORT_WEIGHT); GetEMotionFX().Update(1.0f / 60.0f); @@ -188,26 +188,26 @@ namespace EMotionFX const Pose* jackPose = m_actorInstance->GetTransformData()->GetCurrentPose(); size_t testJointIndex; - m_jackSkeleton->FindNodeAndIndexByName(m_param.testJointName, testJointIndex); - const AZ::Vector3& testJointPos = jackPose->GetModelSpaceTransform(testJointIndex).mPosition; + m_jackSkeleton->FindNodeAndIndexByName(m_param.m_testJointName, testJointIndex); + const AZ::Vector3& testJointPos = jackPose->GetModelSpaceTransform(testJointIndex).m_position; - for (AZStd::string& nodeName : m_param.alignToNodeNames) + for (AZStd::string& nodeName : m_param.m_alignToNodeNames) { NodeAlignmentData alignToNode; alignToNode.first = nodeName; alignToNode.second = 0; m_twoLinkIKNode->SetAlignToNode(alignToNode); - // Update will set uniqueData->mMustUpdate to false for efficiency purposes - // Unique data only updates once unless reset mMustUpdate to true again + // Update will set uniqueData->m_mustUpdate to false for efficiency purposes + // Unique data only updates once unless reset m_mustUpdate to true again BlendTreeTwoLinkIKNode::UniqueData* uniqueData = static_cast(m_animGraphInstance->FindOrCreateUniqueNodeData(m_twoLinkIKNode)); uniqueData->Invalidate(); size_t alignToNodeIndex; m_jackSkeleton->FindNodeAndIndexByName(nodeName, alignToNodeIndex); GetEMotionFX().Update(1.0f / 60.0f); - const AZ::Vector3& alignToNodePos = jackPose->GetModelSpaceTransform(alignToNodeIndex).mPosition; - const AZ::Vector3& testJointNewPos = jackPose->GetModelSpaceTransform(testJointIndex).mPosition; + const AZ::Vector3& alignToNodePos = jackPose->GetModelSpaceTransform(alignToNodeIndex).m_position; + const AZ::Vector3& testJointNewPos = jackPose->GetModelSpaceTransform(testJointIndex).m_position; // Based on weight, check if position of node changes to alignToNode position if (weight) @@ -224,10 +224,10 @@ namespace EMotionFX TEST_P(BlendTreeTwoLinkIKNodeFixture, UnreachablePositionsOutputCorrectPose) { - m_twoLinkIKNode->AddConnection(m_paramNode, m_paramNode->FindOutputPortByName("WeightParam")->mPortID, + m_twoLinkIKNode->AddConnection(m_paramNode, m_paramNode->FindOutputPortByName("WeightParam")->m_portId, BlendTreeTwoLinkIKNode::INPUTPORT_WEIGHT); m_twoLinkIKNode->AddConnection(m_paramNode, - m_paramNode->FindOutputPortByName("GoalPosParam")->mPortID, BlendTreeTwoLinkIKNode::INPUTPORT_GOALPOS); + m_paramNode->FindOutputPortByName("GoalPosParam")->m_portId, BlendTreeTwoLinkIKNode::INPUTPORT_GOALPOS); GetEMotionFX().Update(1.0f / 60.0f); const float weight = testing::get<0>(GetParam()); @@ -237,12 +237,12 @@ namespace EMotionFX size_t testJointIndex; size_t linkedJoint0Index; size_t linkedJoint1Index; - m_jackSkeleton->FindNodeAndIndexByName(m_param.testJointName, testJointIndex); - m_jackSkeleton->FindNodeAndIndexByName(m_param.linkedJointNames[0], linkedJoint0Index); - m_jackSkeleton->FindNodeAndIndexByName(m_param.linkedJointNames[1], linkedJoint1Index); - const AZ::Vector3& testJointPos = jackPose->GetModelSpaceTransform(testJointIndex).mPosition; + m_jackSkeleton->FindNodeAndIndexByName(m_param.m_testJointName, testJointIndex); + m_jackSkeleton->FindNodeAndIndexByName(m_param.m_linkedJointNames[0], linkedJoint0Index); + m_jackSkeleton->FindNodeAndIndexByName(m_param.m_linkedJointNames[1], linkedJoint1Index); + const AZ::Vector3& testJointPos = jackPose->GetModelSpaceTransform(testJointIndex).m_position; - for (std::vector goalPosXYZ : m_param.unreachablePositions) + for (std::vector goalPosXYZ : m_param.m_unreachablePositions) { const float goalX = goalPosXYZ[0]; const float goalY = goalPosXYZ[1]; @@ -250,9 +250,9 @@ namespace EMotionFX ParamSetValue("GoalPosParam", AZ::Vector3(goalX, goalY, goalZ)); GetEMotionFX().Update(1.0f / 60.0f); - const AZ::Vector3& testJointNewPos = jackPose->GetModelSpaceTransform(testJointIndex).mPosition; - const AZ::Vector3& linkedJoint0Pos = jackPose->GetModelSpaceTransform(linkedJoint0Index).mPosition; - const AZ::Vector3& linkedJoint1Pos = jackPose->GetModelSpaceTransform(linkedJoint1Index).mPosition; + const AZ::Vector3& testJointNewPos = jackPose->GetModelSpaceTransform(testJointIndex).m_position; + const AZ::Vector3& linkedJoint0Pos = jackPose->GetModelSpaceTransform(linkedJoint0Index).m_position; + const AZ::Vector3& linkedJoint1Pos = jackPose->GetModelSpaceTransform(linkedJoint1Index).m_position; // Based on weight, check if position of the test node // And its linked nodes are pointing towards the unreachable position @@ -272,12 +272,12 @@ namespace EMotionFX TEST_P(BlendTreeTwoLinkIKNodeFixture, RotatedPositionsOutputCorrectPose) { - m_twoLinkIKNode->AddConnection(m_paramNode, m_paramNode->FindOutputPortByName("WeightParam")->mPortID, + m_twoLinkIKNode->AddConnection(m_paramNode, m_paramNode->FindOutputPortByName("WeightParam")->m_portId, BlendTreeTwoLinkIKNode::INPUTPORT_WEIGHT); m_twoLinkIKNode->AddConnection(m_paramNode, - m_paramNode->FindOutputPortByName("GoalPosParam")->mPortID, BlendTreeTwoLinkIKNode::INPUTPORT_GOALPOS); + m_paramNode->FindOutputPortByName("GoalPosParam")->m_portId, BlendTreeTwoLinkIKNode::INPUTPORT_GOALPOS); m_twoLinkIKNode->AddConnection(m_paramNode, - m_paramNode->FindOutputPortByName("RotationParam")->mPortID, BlendTreeTwoLinkIKNode::INPUTPORT_GOALROT); + m_paramNode->FindOutputPortByName("RotationParam")->m_portId, BlendTreeTwoLinkIKNode::INPUTPORT_GOALROT); m_twoLinkIKNode->SetRotationEnabled(true); GetEMotionFX().Update(1.0f / 60.0f); @@ -288,10 +288,10 @@ namespace EMotionFX const Pose* jackPose = m_actorInstance->GetTransformData()->GetCurrentPose(); size_t testJointIndex; - m_jackSkeleton->FindNodeAndIndexByName(m_param.testJointName, testJointIndex); - const AZ::Quaternion testJointRotation = jackPose->GetModelSpaceTransform(testJointIndex).mRotation; + m_jackSkeleton->FindNodeAndIndexByName(m_param.m_testJointName, testJointIndex); + const AZ::Quaternion testJointRotation = jackPose->GetModelSpaceTransform(testJointIndex).m_rotation; - for (std::vector rotateXYZ : m_param.rotations) + for (std::vector rotateXYZ : m_param.m_rotations) { const float rotateX = rotateXYZ[0]; const float rotateY = rotateXYZ[1]; @@ -299,7 +299,7 @@ namespace EMotionFX ParamSetValue("RotationParam", AZ::Quaternion(rotateX, rotateY, rotateZ, 1.0f)); GetEMotionFX().Update(1.0f / 60.0f); - const AZ::Quaternion testJointNewRotation = jackPose->GetModelSpaceTransform(testJointIndex).mRotation; + const AZ::Quaternion testJointNewRotation = jackPose->GetModelSpaceTransform(testJointIndex).m_rotation; if (weight) { @@ -315,20 +315,20 @@ namespace EMotionFX TEST_P(BlendTreeTwoLinkIKNodeFixture, BendDirectionOutputCorrectPose) { - m_twoLinkIKNode->AddConnection(m_paramNode, m_paramNode->FindOutputPortByName("WeightParam")->mPortID, + m_twoLinkIKNode->AddConnection(m_paramNode, m_paramNode->FindOutputPortByName("WeightParam")->m_portId, BlendTreeTwoLinkIKNode::INPUTPORT_WEIGHT); m_twoLinkIKNode->AddConnection(m_paramNode, - m_paramNode->FindOutputPortByName("GoalPosParam")->mPortID, BlendTreeTwoLinkIKNode::INPUTPORT_GOALPOS); + m_paramNode->FindOutputPortByName("GoalPosParam")->m_portId, BlendTreeTwoLinkIKNode::INPUTPORT_GOALPOS); m_twoLinkIKNode->AddConnection(m_paramNode, - m_paramNode->FindOutputPortByName("BendDirParam")->mPortID, BlendTreeTwoLinkIKNode::INPUTPORT_BENDDIR); + m_paramNode->FindOutputPortByName("BendDirParam")->m_portId, BlendTreeTwoLinkIKNode::INPUTPORT_BENDDIR); m_twoLinkIKNode->SetRelativeBendDir(true); GetEMotionFX().Update(1.0f / 60.0f); // Set up Jack's arm to specific position for testing const float weight = testing::get<0>(GetParam()); - const float x = m_param.bendDirPosition[0]; - const float y = m_param.bendDirPosition[1]; - const float z = m_param.bendDirPosition[2]; + const float x = m_param.m_bendDirPosition[0]; + const float y = m_param.m_bendDirPosition[1]; + const float z = m_param.m_bendDirPosition[2]; ParamSetValue("WeightParam", weight); ParamSetValue("GoalPosParam", AZ::Vector3(x, y, z)); GetEMotionFX().Update(1.0f / 60.0f); @@ -336,28 +336,28 @@ namespace EMotionFX Pose* jackPose = m_actorInstance->GetTransformData()->GetCurrentPose(); size_t testBendJointIndex; size_t testJointIndex; - AZStd::string& bendLoArm = m_param.linkedJointNames[0]; + AZStd::string& bendLoArm = m_param.m_linkedJointNames[0]; m_jackSkeleton->FindNodeAndIndexByName(bendLoArm, testBendJointIndex); - m_jackSkeleton->FindNodeAndIndexByName(m_param.testJointName, testJointIndex); + m_jackSkeleton->FindNodeAndIndexByName(m_param.m_testJointName, testJointIndex); - const AZ::Vector3 testJointBendPos = jackPose->GetModelSpaceTransform(testBendJointIndex).mPosition; + const AZ::Vector3 testJointBendPos = jackPose->GetModelSpaceTransform(testBendJointIndex).m_position; // Bend the test joint to opposite positions and check positions are opposite ParamSetValue("BendDirParam", AZ::Vector3(1.0f, 0.0f, 0.0f)); GetEMotionFX().Update(1.0f / 60.0f); - const AZ::Vector3 testJointBendRightPos = jackPose->GetModelSpaceTransform(testBendJointIndex).mPosition; + const AZ::Vector3 testJointBendRightPos = jackPose->GetModelSpaceTransform(testBendJointIndex).m_position; ParamSetValue("BendDirParam", AZ::Vector3(-1.0f, 0.0f, 0.0f)); GetEMotionFX().Update(1.0f / 60.0f); - const AZ::Vector3 testJointBendLeftPos = jackPose->GetModelSpaceTransform(testBendJointIndex).mPosition; + const AZ::Vector3 testJointBendLeftPos = jackPose->GetModelSpaceTransform(testBendJointIndex).m_position; ParamSetValue("BendDirParam", AZ::Vector3(0.0f, 1.0f, 0.0f)); GetEMotionFX().Update(1.0f / 60.0f); - const AZ::Vector3 testJointBendDownPos = jackPose->GetModelSpaceTransform(testBendJointIndex).mPosition; + const AZ::Vector3 testJointBendDownPos = jackPose->GetModelSpaceTransform(testBendJointIndex).m_position; ParamSetValue("BendDirParam", AZ::Vector3(0.0f, -1.0f, 0.0f)); GetEMotionFX().Update(1.0f / 60.0f); - const AZ::Vector3 testJointBendUpPos = jackPose->GetModelSpaceTransform(testBendJointIndex).mPosition; + const AZ::Vector3 testJointBendUpPos = jackPose->GetModelSpaceTransform(testBendJointIndex).m_position; if (weight) { @@ -382,14 +382,14 @@ namespace EMotionFX TEST_P(BlendTreeTwoLinkIKNodeFixture, CombinedFunctionsOutputCorrectPose) { // Two Link IK Node should not break when using all of its functions at the same time - m_twoLinkIKNode->AddConnection(m_paramNode, m_paramNode->FindOutputPortByName("WeightParam")->mPortID, + m_twoLinkIKNode->AddConnection(m_paramNode, m_paramNode->FindOutputPortByName("WeightParam")->m_portId, BlendTreeTwoLinkIKNode::INPUTPORT_WEIGHT); m_twoLinkIKNode->AddConnection(m_paramNode, - m_paramNode->FindOutputPortByName("GoalPosParam")->mPortID, BlendTreeTwoLinkIKNode::INPUTPORT_GOALPOS); + m_paramNode->FindOutputPortByName("GoalPosParam")->m_portId, BlendTreeTwoLinkIKNode::INPUTPORT_GOALPOS); m_twoLinkIKNode->AddConnection(m_paramNode, - m_paramNode->FindOutputPortByName("RotationParam")->mPortID, BlendTreeTwoLinkIKNode::INPUTPORT_GOALROT); + m_paramNode->FindOutputPortByName("RotationParam")->m_portId, BlendTreeTwoLinkIKNode::INPUTPORT_GOALROT); m_twoLinkIKNode->AddConnection(m_paramNode, - m_paramNode->FindOutputPortByName("BendDirParam")->mPortID, BlendTreeTwoLinkIKNode::INPUTPORT_BENDDIR); + m_paramNode->FindOutputPortByName("BendDirParam")->m_portId, BlendTreeTwoLinkIKNode::INPUTPORT_BENDDIR); m_twoLinkIKNode->SetRotationEnabled(true); m_twoLinkIKNode->SetRelativeBendDir(true); GetEMotionFX().Update(1.0f / 60.0f); @@ -397,48 +397,48 @@ namespace EMotionFX const Pose* jackPose = m_actorInstance->GetTransformData()->GetCurrentPose(); size_t testJointIndex; size_t testBendJointIndex; - AZStd::string& bendLoArm = m_param.linkedJointNames[0]; - m_jackSkeleton->FindNodeAndIndexByName(m_param.testJointName, testJointIndex); + AZStd::string& bendLoArm = m_param.m_linkedJointNames[0]; + m_jackSkeleton->FindNodeAndIndexByName(m_param.m_testJointName, testJointIndex); m_jackSkeleton->FindNodeAndIndexByName(bendLoArm, testBendJointIndex); // Adding weight and goal position const float weight = testing::get<0>(GetParam()); - const float posX = m_param.bendDirPosition[0]; - const float posY = m_param.bendDirPosition[1]; - const float posZ = m_param.bendDirPosition[2]; + const float posX = m_param.m_bendDirPosition[0]; + const float posY = m_param.m_bendDirPosition[1]; + const float posZ = m_param.m_bendDirPosition[2]; ParamSetValue("WeightParam", weight); ParamSetValue("GoalPosParam", AZ::Vector3(posX, posY, posZ)); GetEMotionFX().Update(1.0f / 60.0f); // Add bend direction - const AZ::Vector3 testJointBendPos = jackPose->GetModelSpaceTransform(testBendJointIndex).mPosition; + const AZ::Vector3 testJointBendPos = jackPose->GetModelSpaceTransform(testBendJointIndex).m_position; ParamSetValue("BendDirParam", AZ::Vector3(1.0f, 0.0f, 0.0f)); GetEMotionFX().Update(1.0f / 60.0f); - const AZ::Vector3 testJointBendRightPos = jackPose->GetModelSpaceTransform(testBendJointIndex).mPosition; + const AZ::Vector3 testJointBendRightPos = jackPose->GetModelSpaceTransform(testBendJointIndex).m_position; ParamSetValue("BendDirParam", AZ::Vector3(-1.0f, 0.0f, 0.0f)); GetEMotionFX().Update(1.0f / 60.0f); - const AZ::Vector3 testJointBendLeftPos = jackPose->GetModelSpaceTransform(testBendJointIndex).mPosition; + const AZ::Vector3 testJointBendLeftPos = jackPose->GetModelSpaceTransform(testBendJointIndex).m_position; ParamSetValue("BendDirParam", AZ::Vector3(0.0f, 1.0f, 0.0f)); GetEMotionFX().Update(1.0f / 60.0f); - const AZ::Vector3 testJointBendDownPos = jackPose->GetModelSpaceTransform(testBendJointIndex).mPosition; + const AZ::Vector3 testJointBendDownPos = jackPose->GetModelSpaceTransform(testBendJointIndex).m_position; ParamSetValue("BendDirParam", AZ::Vector3(0.0f, -1.0f, 0.0f)); GetEMotionFX().Update(1.0f / 60.0f); - const AZ::Vector3 testJointBendUpPos = jackPose->GetModelSpaceTransform(testBendJointIndex).mPosition; + const AZ::Vector3 testJointBendUpPos = jackPose->GetModelSpaceTransform(testBendJointIndex).m_position; // Rotations with bent joint - const AZ::Quaternion testJointOriginalRotation = jackPose->GetModelSpaceTransform(testJointIndex).mRotation; - for (std::vector rotateXYZ : m_param.rotations) + const AZ::Quaternion testJointOriginalRotation = jackPose->GetModelSpaceTransform(testJointIndex).m_rotation; + for (std::vector rotateXYZ : m_param.m_rotations) { const float rotateX = rotateXYZ[0]; const float rotateY = rotateXYZ[1]; const float rotateZ = rotateXYZ[2]; ParamSetValue("RotationParam", AZ::Quaternion(rotateX, rotateY, rotateZ, 1.0f)); GetEMotionFX().Update(1.0f / 60.0f); - const AZ::Quaternion testJointNewRotation = jackPose->GetModelSpaceTransform(testJointIndex).mRotation; + const AZ::Quaternion testJointNewRotation = jackPose->GetModelSpaceTransform(testJointIndex).m_rotation; if (weight) { diff --git a/Gems/EMotionFX/Code/Tests/BoolLogicNodeTests.cpp b/Gems/EMotionFX/Code/Tests/BoolLogicNodeTests.cpp index 9d2e1a11c6..6214005a71 100644 --- a/Gems/EMotionFX/Code/Tests/BoolLogicNodeTests.cpp +++ b/Gems/EMotionFX/Code/Tests/BoolLogicNodeTests.cpp @@ -168,15 +168,15 @@ namespace EMotionFX const AZStd::vector& parameterNodeOutputPorts = parameterNode->GetOutputPorts(); for (const EMotionFX::AnimGraphNode::Port& port : parameterNodeOutputPorts) { - uint32 paramIndex = parameterNode->GetParameterIndex(port.mPortID); + uint32 paramIndex = parameterNode->GetParameterIndex(port.m_portId); if (paramIndex == boolXParamIndexOutcome.GetValue()) { - boolXOutputPortIndex = port.mPortID; + boolXOutputPortIndex = port.m_portId; portIndicesFound++; } else if (paramIndex == boolYParamIndexOutcome.GetValue()) { - boolYOutputPortIndex = port.mPortID; + boolYOutputPortIndex = port.m_portId; portIndicesFound++; } } diff --git a/Gems/EMotionFX/Code/Tests/Bugs/CanUndoParameterDeletionAndRestoreBlendTreeConnections.cpp b/Gems/EMotionFX/Code/Tests/Bugs/CanUndoParameterDeletionAndRestoreBlendTreeConnections.cpp index 9da4f0fdb8..88ca19b277 100644 --- a/Gems/EMotionFX/Code/Tests/Bugs/CanUndoParameterDeletionAndRestoreBlendTreeConnections.cpp +++ b/Gems/EMotionFX/Code/Tests/Bugs/CanUndoParameterDeletionAndRestoreBlendTreeConnections.cpp @@ -142,7 +142,7 @@ namespace EMotionFX for (const AnimGraphNode::Port& outputPort : outputPorts) { - ASSERT_TRUE(outputPort.mConnection) << "Expected a valid connection at the output port."; + ASSERT_TRUE(outputPort.m_connection) << "Expected a valid connection at the output port."; } } @@ -173,7 +173,7 @@ namespace EMotionFX for (const AnimGraphNode::Port& outputPort : outputPorts) { - ASSERT_TRUE(outputPort.mConnection) << "Expected a valid connection at the output port."; + ASSERT_TRUE(outputPort.m_connection) << "Expected a valid connection at the output port."; } } } diff --git a/Gems/EMotionFX/Code/Tests/EmotionFXMathLibTests.cpp b/Gems/EMotionFX/Code/Tests/EmotionFXMathLibTests.cpp index 041cc9e862..e4d532928c 100644 --- a/Gems/EMotionFX/Code/Tests/EmotionFXMathLibTests.cpp +++ b/Gems/EMotionFX/Code/Tests/EmotionFXMathLibTests.cpp @@ -22,9 +22,9 @@ protected: void SetUp() override { - m_azNormalizedVector3_a = AZ::Vector3(s_x1, s_y1, s_z1); - m_azNormalizedVector3_a.Normalize(); - m_azQuaternion_a = AZ::Quaternion::CreateFromAxisAngle(m_azNormalizedVector3_a, s_angle_a); + m_azNormalizedVector3A = AZ::Vector3(s_x1, s_y1, s_z1); + m_azNormalizedVector3A.Normalize(); + m_azQuaternionA = AZ::Quaternion::CreateFromAxisAngle(m_azNormalizedVector3A, s_angle_a); } void TearDown() override @@ -117,8 +117,8 @@ protected: static const float s_y1; static const float s_z1; static const float s_angle_a; - AZ::Vector3 m_azNormalizedVector3_a; - AZ::Quaternion m_azQuaternion_a; + AZ::Vector3 m_azNormalizedVector3A; + AZ::Quaternion m_azQuaternionA; }; const float EmotionFXMathLibTests::s_toleranceHigh = 0.00001f; diff --git a/Gems/EMotionFX/Code/Tests/Integration/PoseComparisonFixture.h b/Gems/EMotionFX/Code/Tests/Integration/PoseComparisonFixture.h index 16d9fb2389..d354153f9b 100644 --- a/Gems/EMotionFX/Code/Tests/Integration/PoseComparisonFixture.h +++ b/Gems/EMotionFX/Code/Tests/Integration/PoseComparisonFixture.h @@ -18,12 +18,12 @@ namespace EMotionFX struct PoseComparisonFixtureParams { - const char* actorFile = nullptr; - const char* animGraphFile = nullptr; - const char* motionSetFile = nullptr; - const char* recordingFile = nullptr; + const char* m_actorFile = nullptr; + const char* m_animGraphFile = nullptr; + const char* m_motionSetFile = nullptr; + const char* m_recordingFile = nullptr; PoseComparisonFixtureParams(const char* actorFile, const char* animGraphFile, const char* motionSetFile, const char* recordingFile) - : actorFile(actorFile), animGraphFile(animGraphFile), motionSetFile(motionSetFile), recordingFile(recordingFile) + : m_actorFile(actorFile), m_animGraphFile(animGraphFile), m_motionSetFile(motionSetFile), m_recordingFile(recordingFile) {} }; diff --git a/Gems/EMotionFX/Code/Tests/Integration/PoseComparisonTests.cpp b/Gems/EMotionFX/Code/Tests/Integration/PoseComparisonTests.cpp index d50b72cb4d..cccf744cfc 100644 --- a/Gems/EMotionFX/Code/Tests/Integration/PoseComparisonTests.cpp +++ b/Gems/EMotionFX/Code/Tests/Integration/PoseComparisonTests.cpp @@ -23,7 +23,7 @@ namespace EMotionFX { void PrintTo(const Recorder::ActorInstanceData& actorInstanceData, ::std::ostream* os) { - *os << actorInstanceData.mActorInstance->GetActor()->GetName(); + *os << actorInstanceData.m_actorInstance->GetActor()->GetName(); } template @@ -42,8 +42,8 @@ namespace EMotionFX void PrintTo(const Recorder::TransformTracks& tracks, ::std::ostream* os) { - PrintTo(tracks.mPositions, os); - PrintTo(tracks.mRotations, os); + PrintTo(tracks.m_positions, os); + PrintTo(tracks.m_rotations, os); } AZ_PUSH_DISABLE_WARNING(4100, "-Wmissing-declarations") // 'result_listener': unreferenced formal parameter @@ -178,15 +178,15 @@ namespace EMotionFX void INTEG_PoseComparisonFixture::LoadAssets() { - const AZStd::string actorPath = ResolvePath(GetParam().actorFile); + const AZStd::string actorPath = ResolvePath(GetParam().m_actorFile); m_actor = EMotionFX::GetImporter().LoadActor(actorPath); ASSERT_TRUE(m_actor) << "Failed to load actor"; - const AZStd::string animGraphPath = ResolvePath(GetParam().animGraphFile); + const AZStd::string animGraphPath = ResolvePath(GetParam().m_animGraphFile); m_animGraph = EMotionFX::GetImporter().LoadAnimGraph(animGraphPath); ASSERT_TRUE(m_animGraph) << "Failed to load anim graph"; - const AZStd::string motionSetPath = ResolvePath(GetParam().motionSetFile); + const AZStd::string motionSetPath = ResolvePath(GetParam().m_motionSetFile); m_motionSet = EMotionFX::GetImporter().LoadMotionSet(motionSetPath); ASSERT_TRUE(m_motionSet) << "Failed to load motion set"; m_motionSet->Preload(); @@ -197,7 +197,7 @@ namespace EMotionFX TEST_P(INTEG_PoseComparisonFixture, Integ_TestPoses) { - const AZStd::string recordingPath = ResolvePath(GetParam().recordingFile); + const AZStd::string recordingPath = ResolvePath(GetParam().m_recordingFile); Recorder* recording = EMotionFX::Recorder::LoadFromFile(recordingPath.c_str()); const EMotionFX::Recorder::ActorInstanceData& expectedActorInstanceData = recording->GetActorInstanceData(0); @@ -222,10 +222,10 @@ namespace EMotionFX { const Recorder::TransformTracks& gotTrack = gotTracks[trackNum]; const Recorder::TransformTracks& expectedTrack = expectedTracks[trackNum]; - const char* nodeName = gotActorInstanceData.mActorInstance->GetActor()->GetSkeleton()->GetNode(trackNum)->GetName(); + const char* nodeName = gotActorInstanceData.m_actorInstance->GetActor()->GetSkeleton()->GetNode(trackNum)->GetName(); - EXPECT_THAT(gotTrack.mPositions, MatchesKeyTrack(expectedTrack.mPositions, nodeName)); - EXPECT_THAT(gotTrack.mRotations, MatchesKeyTrack(expectedTrack.mRotations, nodeName)); + EXPECT_THAT(gotTrack.m_positions, MatchesKeyTrack(expectedTrack.m_positions, nodeName)); + EXPECT_THAT(gotTrack.m_rotations, MatchesKeyTrack(expectedTrack.m_rotations, nodeName)); } recording->Destroy(); @@ -235,14 +235,14 @@ namespace EMotionFX { // Make one recording, 10 seconds at 60 fps Recorder::RecordSettings settings; - settings.mFPS = 1000000; - settings.mRecordTransforms = true; - settings.mRecordAnimGraphStates = false; - settings.mRecordNodeHistory = false; - settings.mRecordScale = false; - settings.mInitialAnimGraphAnimBytes = 4 * 1024 * 1024; // 4 mb - settings.mHistoryStatesOnly = false; - settings.mRecordEvents = false; + settings.m_fps = 1000000; + settings.m_recordTransforms = true; + settings.m_recordAnimGraphStates = false; + settings.m_recordNodeHistory = false; + settings.m_recordScale = false; + settings.m_initialAnimGraphAnimBytes = 4 * 1024 * 1024; // 4 mb + settings.m_historyStatesOnly = false; + settings.m_recordEvents = false; EMotionFX::GetRecorder().StartRecording(settings); @@ -285,10 +285,10 @@ namespace EMotionFX { const Recorder::TransformTracks& gotTrack = gotTracks[trackNum]; const Recorder::TransformTracks& expectedTrack = expectedTracks[trackNum]; - const char* nodeName = gotActorInstanceData.mActorInstance->GetActor()->GetSkeleton()->GetNode(trackNum)->GetName(); + const char* nodeName = gotActorInstanceData.m_actorInstance->GetActor()->GetSkeleton()->GetNode(trackNum)->GetName(); - EXPECT_THAT(gotTrack.mPositions, MatchesKeyTrack(expectedTrack.mPositions, nodeName)); - EXPECT_THAT(gotTrack.mRotations, MatchesKeyTrack(expectedTrack.mRotations, nodeName)); + EXPECT_THAT(gotTrack.m_positions, MatchesKeyTrack(expectedTrack.m_positions, nodeName)); + EXPECT_THAT(gotTrack.m_rotations, MatchesKeyTrack(expectedTrack.m_rotations, nodeName)); } recording->Destroy(); diff --git a/Gems/EMotionFX/Code/Tests/Matchers.h b/Gems/EMotionFX/Code/Tests/Matchers.h index ad3c204f72..9f7b9017ba 100644 --- a/Gems/EMotionFX/Code/Tests/Matchers.h +++ b/Gems/EMotionFX/Code/Tests/Matchers.h @@ -81,12 +81,12 @@ template<> inline bool IsCloseMatcherP::gmock_Impl::MatchAndExplain(const EMotionFX::Transform& arg, ::testing::MatchResultListener* result_listener) const { #ifndef EMFX_SCALE_DISABLED - return ::testing::ExplainMatchResult(IsClose(expected.mPosition), arg.mPosition, result_listener) - && ::testing::ExplainMatchResult(IsClose(expected.mRotation), arg.mRotation, result_listener) - && ::testing::ExplainMatchResult(IsClose(expected.mScale), arg.mScale, result_listener); + return ::testing::ExplainMatchResult(IsClose(expected.m_position), arg.m_position, result_listener) + && ::testing::ExplainMatchResult(IsClose(expected.m_rotation), arg.m_rotation, result_listener) + && ::testing::ExplainMatchResult(IsClose(expected.m_scale), arg.m_scale, result_listener); #else - return ::testing::ExplainMatchResult(IsClose(expected.mPosition), arg.mPosition, result_listener) - && ::testing::ExplainMatchResult(IsClose(expected.mRotation), arg.mRotation, result_listener); + return ::testing::ExplainMatchResult(IsClose(expected.m_position), arg.m_position, result_listener) + && ::testing::ExplainMatchResult(IsClose(expected.m_rotation), arg.m_rotation, result_listener); #endif } @@ -96,20 +96,20 @@ inline bool IsCloseMatcherP::gmock_Impl::Ma { using ::testing::FloatEq; using ::testing::ExplainMatchResult; - return ExplainMatchResult(FloatEq(expected.m16[0]), arg.m16[0], result_listener) - && ExplainMatchResult(FloatEq(expected.m16[1]), arg.m16[1], result_listener) - && ExplainMatchResult(FloatEq(expected.m16[2]), arg.m16[2], result_listener) - && ExplainMatchResult(FloatEq(expected.m16[3]), arg.m16[3], result_listener) - && ExplainMatchResult(FloatEq(expected.m16[4]), arg.m16[4], result_listener) - && ExplainMatchResult(FloatEq(expected.m16[5]), arg.m16[5], result_listener) - && ExplainMatchResult(FloatEq(expected.m16[6]), arg.m16[6], result_listener) - && ExplainMatchResult(FloatEq(expected.m16[7]), arg.m16[7], result_listener) - && ExplainMatchResult(FloatEq(expected.m16[8]), arg.m16[8], result_listener) - && ExplainMatchResult(FloatEq(expected.m16[9]), arg.m16[9], result_listener) - && ExplainMatchResult(FloatEq(expected.m16[10]), arg.m16[10], result_listener) - && ExplainMatchResult(FloatEq(expected.m16[11]), arg.m16[11], result_listener) - && ExplainMatchResult(FloatEq(expected.m16[12]), arg.m16[12], result_listener) - && ExplainMatchResult(FloatEq(expected.m16[13]), arg.m16[13], result_listener) - && ExplainMatchResult(FloatEq(expected.m16[14]), arg.m16[14], result_listener) - && ExplainMatchResult(FloatEq(expected.m16[15]), arg.m16[15], result_listener); + return ExplainMatchResult(FloatEq(expected.m_m16[0]), arg.m_m16[0], result_listener) + && ExplainMatchResult(FloatEq(expected.m_m16[1]), arg.m_m16[1], result_listener) + && ExplainMatchResult(FloatEq(expected.m_m16[2]), arg.m_m16[2], result_listener) + && ExplainMatchResult(FloatEq(expected.m_m16[3]), arg.m_m16[3], result_listener) + && ExplainMatchResult(FloatEq(expected.m_m16[4]), arg.m_m16[4], result_listener) + && ExplainMatchResult(FloatEq(expected.m_m16[5]), arg.m_m16[5], result_listener) + && ExplainMatchResult(FloatEq(expected.m_m16[6]), arg.m_m16[6], result_listener) + && ExplainMatchResult(FloatEq(expected.m_m16[7]), arg.m_m16[7], result_listener) + && ExplainMatchResult(FloatEq(expected.m_m16[8]), arg.m_m16[8], result_listener) + && ExplainMatchResult(FloatEq(expected.m_m16[9]), arg.m_m16[9], result_listener) + && ExplainMatchResult(FloatEq(expected.m_m16[10]), arg.m_m16[10], result_listener) + && ExplainMatchResult(FloatEq(expected.m_m16[11]), arg.m_m16[11], result_listener) + && ExplainMatchResult(FloatEq(expected.m_m16[12]), arg.m_m16[12], result_listener) + && ExplainMatchResult(FloatEq(expected.m_m16[13]), arg.m_m16[13], result_listener) + && ExplainMatchResult(FloatEq(expected.m_m16[14]), arg.m_m16[14], result_listener) + && ExplainMatchResult(FloatEq(expected.m_m16[15]), arg.m_m16[15], result_listener); } diff --git a/Gems/EMotionFX/Code/Tests/MorphTargetRuntimeTests.cpp b/Gems/EMotionFX/Code/Tests/MorphTargetRuntimeTests.cpp index 10f735ca24..02c17702a2 100644 --- a/Gems/EMotionFX/Code/Tests/MorphTargetRuntimeTests.cpp +++ b/Gems/EMotionFX/Code/Tests/MorphTargetRuntimeTests.cpp @@ -82,7 +82,7 @@ namespace EMotionFX m_morphSetup->AddMorphTarget(morphTarget); // Without this call, the bind pose does not know about newly added - // morph target (mMorphWeights.GetLength() == 0) + // morph target (m_morphWeights.size() == 0) m_actor->ResizeTransformData(); m_actor->PostCreateInit(/*makeGeomLodsCompatibleWithSkeletalLODs=*/false, /*convertUnitType=*/false); diff --git a/Gems/EMotionFX/Code/Tests/MotionEventTrackTests.cpp b/Gems/EMotionFX/Code/Tests/MotionEventTrackTests.cpp index a857efb2ca..30ab36e35a 100644 --- a/Gems/EMotionFX/Code/Tests/MotionEventTrackTests.cpp +++ b/Gems/EMotionFX/Code/Tests/MotionEventTrackTests.cpp @@ -27,11 +27,11 @@ namespace EMotionFX { struct ExtractEventsParams { - void (*eventFactory)(MotionEventTrack* track); - float startTime; - float endTime; - EPlayMode playMode; - std::vector expectedEvents; + void (*m_eventFactory)(MotionEventTrack* track); + float m_startTime; + float m_endTime; + EPlayMode m_playMode; + std::vector m_expectedEvents; }; void PrintTo(const EMotionFX::EventInfo::EventState& state, ::std::ostream* os) @@ -52,7 +52,7 @@ namespace EMotionFX void PrintTo(const EMotionFX::EventInfo& event, ::std::ostream* os) { - *os << "Time: " << event.mTimeValue + *os << "Time: " << event.m_timeValue << " State: " ; PrintTo(event.m_eventState, os); @@ -60,23 +60,23 @@ namespace EMotionFX void PrintTo(const ExtractEventsParams& object, ::std::ostream* os) { - if (object.eventFactory == &MakeNoEvents) + if (object.m_eventFactory == &MakeNoEvents) { *os << "Events: 0"; } - else if (object.eventFactory == &MakeOneEvent) + else if (object.m_eventFactory == &MakeOneEvent) { *os << "Events: 1"; } - else if (object.eventFactory == &MakeTwoEvents) + else if (object.m_eventFactory == &MakeTwoEvents) { *os << "Events: 2"; } - else if (object.eventFactory == &MakeThreeEvents) + else if (object.m_eventFactory == &MakeThreeEvents) { *os << "Events: 3"; } - else if (object.eventFactory == &MakeThreeRangedEvents) + else if (object.m_eventFactory == &MakeThreeRangedEvents) { *os << "Events: 3 (ranged)"; } @@ -84,15 +84,15 @@ namespace EMotionFX { *os << "Events: Unknown"; } - *os << " Start time: " << object.startTime - << " End time: " << object.endTime - << " Play mode: " << ((object.playMode == EPlayMode::PLAYMODE_FORWARD) ? "Forward" : "Backward") + *os << " Start time: " << object.m_startTime + << " End time: " << object.m_endTime + << " Play mode: " << ((object.m_playMode == EPlayMode::PLAYMODE_FORWARD) ? "Forward" : "Backward") << " Expected events: [" ; - for (const auto& entry : object.expectedEvents) + for (const auto& entry : object.m_expectedEvents) { PrintTo(entry, os); - if (&entry != &(*(object.expectedEvents.end() - 1))) + if (&entry != &(*(object.m_expectedEvents.end() - 1))) { *os << ", "; } @@ -148,7 +148,7 @@ namespace EMotionFX m_motion->GetEventTable()->AutoCreateSyncTrack(m_motion); m_track = m_motion->GetEventTable()->GetSyncTrack(); - GetParam().eventFactory(m_track); + GetParam().m_eventFactory(m_track); m_actor = ActorFactory::CreateAndInit(5); @@ -178,11 +178,11 @@ namespace EMotionFX const ExtractEventsParams& params = GetParam(); // Call the function being tested - func(params.startTime, params.endTime, params.playMode, m_motionInstance); + func(params.m_startTime, params.m_endTime, params.m_playMode, m_motionInstance); // ProcessEvents filters out the ACTIVE events, remove those from our expected results AZStd::vector expectedEvents; - for (const EventInfo& event : params.expectedEvents) + for (const EventInfo& event : params.m_expectedEvents) { if (event.m_eventState != EventInfo::ACTIVE || m_shouldContainActiveEvents) { @@ -195,7 +195,7 @@ namespace EMotionFX { const EventInfo& gotEvent = m_buffer->GetEvent(i); const EventInfo& expectedEvent = expectedEvents[i]; - EXPECT_EQ(gotEvent.mTimeValue, expectedEvent.mTimeValue); + EXPECT_EQ(gotEvent.m_timeValue, expectedEvent.m_timeValue); EXPECT_EQ(gotEvent.m_eventState, expectedEvent.m_eventState); } } diff --git a/Gems/EMotionFX/Code/Tests/MotionExtractionBusTests.cpp b/Gems/EMotionFX/Code/Tests/MotionExtractionBusTests.cpp index 5c823c153f..d8b8a2a430 100644 --- a/Gems/EMotionFX/Code/Tests/MotionExtractionBusTests.cpp +++ b/Gems/EMotionFX/Code/Tests/MotionExtractionBusTests.cpp @@ -137,7 +137,7 @@ namespace EMotionFX AZ::Transform currentTransform = AZ::Transform::CreateIdentity(); AZ::TransformBus::EventResult(currentTransform, m_entityId, &AZ::TransformBus::Events::GetWorldTM); - const AZ::Vector3 actorInstancePosition = actorInstance->GetWorldSpaceTransform().mPosition; + const AZ::Vector3 actorInstancePosition = actorInstance->GetWorldSpaceTransform().m_position; const AZ::Vector3 positionDelta = actorInstancePosition - currentTransform.GetTranslation(); EXPECT_CALL(testBus, ExtractMotion(testing::_, testing::_)); diff --git a/Gems/EMotionFX/Code/Tests/MotionExtractionTests.cpp b/Gems/EMotionFX/Code/Tests/MotionExtractionTests.cpp index 85c0e4201f..35f1b96cce 100644 --- a/Gems/EMotionFX/Code/Tests/MotionExtractionTests.cpp +++ b/Gems/EMotionFX/Code/Tests/MotionExtractionTests.cpp @@ -36,8 +36,8 @@ namespace EMotionFX { struct MotionExtractionTestsData { - std::vector durationMultipliers; - std::vector numOfLoops; + std::vector m_durationMultipliers; + std::vector m_numOfLoops; }; std::vector motionExtractionTestData @@ -59,8 +59,8 @@ namespace EMotionFX m_actorInstance->SetMotionExtractionEnabled(true); m_actor->AutoSetMotionExtractionNode(); - rootNode = m_jackSkeleton->FindNodeAndIndexByName("jack_root", m_jack_rootIndex); - hipNode = m_jackSkeleton->FindNodeAndIndexByName("Bip01__pelvis", m_jack_hipIndex); + m_rootNode = m_jackSkeleton->FindNodeAndIndexByName("jack_root", m_jackRootIndex); + m_hipNode = m_jackSkeleton->FindNodeAndIndexByName("Bip01__pelvis", m_jackHipIndex); m_jackPose = m_actorInstance->GetTransformData()->GetCurrentPose(); AddMotionEntry(TestMotionAssets::GetJackWalkForward(), "jack_walk_forward_aim_zup"); @@ -119,13 +119,13 @@ namespace EMotionFX } protected: - size_t m_jack_rootIndex = InvalidIndex; - size_t m_jack_hipIndex = InvalidIndex; + size_t m_jackRootIndex = InvalidIndex; + size_t m_jackHipIndex = InvalidIndex; AnimGraphMotionNode* m_motionNode = nullptr; BlendTree* m_blendTree = nullptr; Motion* m_motion = nullptr; - Node* rootNode = nullptr; - Node* hipNode = nullptr; + Node* m_rootNode = nullptr; + Node* m_hipNode = nullptr; Pose* m_jackPose = nullptr; Skeleton* m_jackSkeleton = nullptr; }; @@ -227,7 +227,7 @@ namespace EMotionFX // Make sure we also really end where we expect. // Motion extraction will introduce some small inaccuracies, so we can't use AZ::g_fltEps here, but need a slightly larger value in our AZ::IsClose(). - const float yPos = m_actorInstance->GetWorldSpaceTransform().mPosition.GetY(); + const float yPos = m_actorInstance->GetWorldSpaceTransform().m_position.GetY(); EXPECT_TRUE(AZ::IsClose(yPos, expectedY, 0.01f)); } #endif @@ -243,16 +243,16 @@ namespace EMotionFX // The expected delta used is the distance of the jack walk forward motion will move in 1 complete duration const float expectedDelta = ExtractLastFramePos().GetY(); - for (size_t paramIndex = 0; paramIndex < m_param.durationMultipliers.size(); paramIndex++) + for (size_t paramIndex = 0; paramIndex < m_param.m_durationMultipliers.size(); paramIndex++) { // Test motion extraction under different durations/time deltas - const float motionDuration = 1.066f * m_param.durationMultipliers[paramIndex]; - const float originalPositionY = m_actorInstance->GetWorldSpaceTransform().mPosition.GetY(); - for (AZ::u32 i = 0; i < m_param.numOfLoops[paramIndex]; i++) + const float motionDuration = 1.066f * m_param.m_durationMultipliers[paramIndex]; + const float originalPositionY = m_actorInstance->GetWorldSpaceTransform().m_position.GetY(); + for (AZ::u32 i = 0; i < m_param.m_numOfLoops[paramIndex]; i++) { GetEMotionFX().Update(motionDuration); } - const float updatedPositionY = m_actorInstance->GetWorldSpaceTransform().mPosition.GetY(); + const float updatedPositionY = m_actorInstance->GetWorldSpaceTransform().m_position.GetY(); const float actualDeltaY = AZ::GetAbs(updatedPositionY - originalPositionY); EXPECT_TRUE(AZ::GetAbs(actualDeltaY - expectedDelta) < 0.002f) << "The absolute difference between actual delta and expected delta of Y-axis should be less than 0.002f."; @@ -262,15 +262,15 @@ namespace EMotionFX const AZ::Quaternion actorRotation(0.0f, 0.0f, -1.0f, 1.0f); m_actorInstance->SetLocalSpaceRotation(actorRotation.GetNormalized()); GetEMotionFX().Update(0.0f); - for (size_t paramIndex = 0; paramIndex < m_param.durationMultipliers.size(); paramIndex++) + for (size_t paramIndex = 0; paramIndex < m_param.m_durationMultipliers.size(); paramIndex++) { - const float motionDuration = 1.066f * m_param.durationMultipliers[paramIndex]; - const float originalPositionX = m_actorInstance->GetWorldSpaceTransform().mPosition.GetX(); - for (AZ::u32 i = 0; i < m_param.numOfLoops[paramIndex]; i++) + const float motionDuration = 1.066f * m_param.m_durationMultipliers[paramIndex]; + const float originalPositionX = m_actorInstance->GetWorldSpaceTransform().m_position.GetX(); + for (AZ::u32 i = 0; i < m_param.m_numOfLoops[paramIndex]; i++) { GetEMotionFX().Update(motionDuration); } - const float updatedPositionX = m_actorInstance->GetWorldSpaceTransform().mPosition.GetX(); + const float updatedPositionX = m_actorInstance->GetWorldSpaceTransform().m_position.GetX(); const float actualDeltaX = AZ::GetAbs(updatedPositionX - originalPositionX); EXPECT_TRUE(AZ::GetAbs(actualDeltaX - expectedDelta) < 0.002f) << "The absolute difference between actual delta and expected delta of X-axis should be less than 0.002f."; @@ -290,17 +290,17 @@ namespace EMotionFX const AZ::Quaternion diagonalRotation = m_reverse ? AZ::Quaternion(0.0f, 0.0f, 0.5f, 1.0f) : AZ::Quaternion(0.0f, 0.0f, -0.5f, 1.0f); m_actorInstance->SetLocalSpaceRotation(diagonalRotation.GetNormalized()); GetEMotionFX().Update(0.0f); - for (size_t paramIndex = 0; paramIndex < m_param.durationMultipliers.size(); paramIndex++) + for (size_t paramIndex = 0; paramIndex < m_param.m_durationMultipliers.size(); paramIndex++) { - const float originalPositionX = m_actorInstance->GetWorldSpaceTransform().mPosition.GetX(); - const float originalPositionY = m_actorInstance->GetWorldSpaceTransform().mPosition.GetY(); - const float motionDuration = 1.066f * m_param.durationMultipliers[paramIndex]; - for (AZ::u32 i = 0; i < m_param.numOfLoops[paramIndex]; i++) + const float originalPositionX = m_actorInstance->GetWorldSpaceTransform().m_position.GetX(); + const float originalPositionY = m_actorInstance->GetWorldSpaceTransform().m_position.GetY(); + const float motionDuration = 1.066f * m_param.m_durationMultipliers[paramIndex]; + for (AZ::u32 i = 0; i < m_param.m_numOfLoops[paramIndex]; i++) { GetEMotionFX().Update(motionDuration); } - const float updatedPositionX = m_actorInstance->GetWorldSpaceTransform().mPosition.GetX(); - const float updatedPositionY = m_actorInstance->GetWorldSpaceTransform().mPosition.GetY(); + const float updatedPositionX = m_actorInstance->GetWorldSpaceTransform().m_position.GetX(); + const float updatedPositionY = m_actorInstance->GetWorldSpaceTransform().m_position.GetY(); const float actualDeltaX = AZ::GetAbs(updatedPositionX - originalPositionX); const float actualDeltaY = AZ::GetAbs(updatedPositionY - originalPositionY); EXPECT_NEAR(actualDeltaX, expectedDeltaX, 0.001f) @@ -327,14 +327,14 @@ namespace EMotionFX // This is because the presync time value of the second motion node is from the unsynced playback. // When we improve our syncing system we can handle this differently and we won't expect a zero trajectory delta anymore. GetEMotionFX().Update(0.15f); - EXPECT_FLOAT_EQ(m_actorInstance->GetTrajectoryDeltaTransform().mPosition.GetLength(), 0.0f); + EXPECT_FLOAT_EQ(m_actorInstance->GetTrajectoryDeltaTransform().m_position.GetLength(), 0.0f); EXPECT_FLOAT_EQ(m_motionNode1->GetCurrentPlayTime(m_animGraphInstance), m_motionNode2->GetCurrentPlayTime(m_animGraphInstance)); EXPECT_EQ(m_animGraphInstance->GetEventBuffer().GetNumEvents(), 0); // The second frame should be as normal. GetEMotionFX().Update(0.15f); - EXPECT_GT(m_actorInstance->GetTrajectoryDeltaTransform().mPosition.GetLength(), 0.0f); - EXPECT_LE(m_actorInstance->GetTrajectoryDeltaTransform().mPosition.GetLength(), 0.3f); + EXPECT_GT(m_actorInstance->GetTrajectoryDeltaTransform().m_position.GetLength(), 0.0f); + EXPECT_LE(m_actorInstance->GetTrajectoryDeltaTransform().m_position.GetLength(), 0.3f); EXPECT_FLOAT_EQ(m_motionNode1->GetCurrentPlayTime(m_animGraphInstance), m_motionNode2->GetCurrentPlayTime(m_animGraphInstance)); EXPECT_EQ(m_animGraphInstance->GetEventBuffer().GetNumEvents(), 0); } diff --git a/Gems/EMotionFX/Code/Tests/MotionLayerSystemTests.cpp b/Gems/EMotionFX/Code/Tests/MotionLayerSystemTests.cpp index dd3661a366..de0c37f5b2 100644 --- a/Gems/EMotionFX/Code/Tests/MotionLayerSystemTests.cpp +++ b/Gems/EMotionFX/Code/Tests/MotionLayerSystemTests.cpp @@ -35,11 +35,11 @@ namespace EMotionFX MotionSystem* motionSystem = actorInstance->GetMotionSystem(); PlayBackInfo playBackInfo; - playBackInfo.mBlendInTime = 1.0f; - playBackInfo.mBlendOutTime = 1.0f; - playBackInfo.mNumLoops = 1; - playBackInfo.mPlayNow = false; - playBackInfo.mFreezeAtLastFrame = false; + playBackInfo.m_blendInTime = 1.0f; + playBackInfo.m_blendOutTime = 1.0f; + playBackInfo.m_numLoops = 1; + playBackInfo.m_playNow = false; + playBackInfo.m_freezeAtLastFrame = false; // Add 2 motions to the queue const MotionInstance* motionInstance1 = motionSystem->PlayMotion(motion1, &playBackInfo); @@ -106,10 +106,10 @@ namespace EMotionFX MotionSystem* motionSystem = actorInstance->GetMotionSystem(); PlayBackInfo playBackInfo; - playBackInfo.mBlendInTime = 1.0f; - playBackInfo.mBlendOutTime = 1.0f; - playBackInfo.mNumLoops = EMFX_LOOPFOREVER; - playBackInfo.mPlayNow = true; + playBackInfo.m_blendInTime = 1.0f; + playBackInfo.m_blendOutTime = 1.0f; + playBackInfo.m_numLoops = EMFX_LOOPFOREVER; + playBackInfo.m_playNow = true; const MotionInstance* walkInstance = motionSystem->PlayMotion(walk, &playBackInfo); @@ -163,11 +163,11 @@ namespace EMotionFX MotionSystem* motionSystem = actorInstance->GetMotionSystem(); PlayBackInfo playBackInfo; - playBackInfo.mBlendInTime = 1.0f; - playBackInfo.mBlendOutTime = 1.0f; - playBackInfo.mNumLoops = 1; - playBackInfo.mPlayNow = false; - playBackInfo.mFreezeAtLastFrame = false; + playBackInfo.m_blendInTime = 1.0f; + playBackInfo.m_blendOutTime = 1.0f; + playBackInfo.m_numLoops = 1; + playBackInfo.m_playNow = false; + playBackInfo.m_freezeAtLastFrame = false; // Add 2 motions to the queue const MotionInstance* motionInstance1 = motionSystem->PlayMotion(motion1, &playBackInfo); diff --git a/Gems/EMotionFX/Code/Tests/MultiThreadSchedulerTests.cpp b/Gems/EMotionFX/Code/Tests/MultiThreadSchedulerTests.cpp index f3d6d44e1d..180da46746 100644 --- a/Gems/EMotionFX/Code/Tests/MultiThreadSchedulerTests.cpp +++ b/Gems/EMotionFX/Code/Tests/MultiThreadSchedulerTests.cpp @@ -31,14 +31,14 @@ namespace EMotionFX // Create an actor instance and make sure it is in the scheduler. ActorInstance* actorInstance = ActorInstance::Create(actor.get()); EXPECT_EQ(scheduler->GetNumScheduleSteps(), 1) << "The actor instance should be part of the scheduler."; - EXPECT_EQ(scheduler->GetScheduleStep(0).mActorInstances.size(), 1) << "The step should hold exactly one actor instance."; - EXPECT_EQ(scheduler->GetScheduleStep(0).mActorInstances[0], actorInstance) << "The actor instance should be part of the step."; + EXPECT_EQ(scheduler->GetScheduleStep(0).m_actorInstances.size(), 1) << "The step should hold exactly one actor instance."; + EXPECT_EQ(scheduler->GetScheduleStep(0).m_actorInstances[0], actorInstance) << "The actor instance should be part of the step."; // Insert the actor instance manually again and make sure there is no duplicate. scheduler->RecursiveInsertActorInstance(actorInstance); EXPECT_EQ(scheduler->GetNumScheduleSteps(), 1) << "The actor instance should be part of the scheduler."; - EXPECT_EQ(scheduler->GetScheduleStep(0).mActorInstances.size(), 1) << "The step should hold exactly one actor instance."; - EXPECT_EQ(scheduler->GetScheduleStep(0).mActorInstances[0], actorInstance) << "The actor instance should be part of the step."; + EXPECT_EQ(scheduler->GetScheduleStep(0).m_actorInstances.size(), 1) << "The step should hold exactly one actor instance."; + EXPECT_EQ(scheduler->GetScheduleStep(0).m_actorInstances[0], actorInstance) << "The actor instance should be part of the step."; actorInstance->Destroy(); } diff --git a/Gems/EMotionFX/Code/Tests/NonUniformMotionDataTests.cpp b/Gems/EMotionFX/Code/Tests/NonUniformMotionDataTests.cpp index 02256e1e12..09a4e46b84 100644 --- a/Gems/EMotionFX/Code/Tests/NonUniformMotionDataTests.cpp +++ b/Gems/EMotionFX/Code/Tests/NonUniformMotionDataTests.cpp @@ -745,15 +745,15 @@ namespace EMotionFX EXPECT_FALSE(motionData.IsJointAnimated(3)); EXPECT_STREQ(motionData.GetJointName(3).c_str(), "Joint4"); - EXPECT_THAT(motionData.GetJointPoseTransform(3).mPosition, IsClose(poseTransform.mPosition)); - EXPECT_THAT(motionData.GetJointPoseTransform(3).mRotation, IsClose(poseTransform.mRotation)); + EXPECT_THAT(motionData.GetJointPoseTransform(3).m_position, IsClose(poseTransform.m_position)); + EXPECT_THAT(motionData.GetJointPoseTransform(3).m_rotation, IsClose(poseTransform.m_rotation)); #ifndef EMFX_SCALE_DISABLED - EXPECT_THAT(motionData.GetJointPoseTransform(3).mScale, IsClose(poseTransform.mScale)); + EXPECT_THAT(motionData.GetJointPoseTransform(3).m_scale, IsClose(poseTransform.m_scale)); #endif - EXPECT_THAT(motionData.GetJointBindPoseTransform(3).mPosition, IsClose(bindTransform.mPosition)); - EXPECT_THAT(motionData.GetJointBindPoseTransform(3).mRotation, IsClose(bindTransform.mRotation)); + EXPECT_THAT(motionData.GetJointBindPoseTransform(3).m_position, IsClose(bindTransform.m_position)); + EXPECT_THAT(motionData.GetJointBindPoseTransform(3).m_rotation, IsClose(bindTransform.m_rotation)); #ifndef EMFX_SCALE_DISABLED - EXPECT_THAT(motionData.GetJointBindPoseTransform(3).mScale, IsClose(bindTransform.mScale)); + EXPECT_THAT(motionData.GetJointBindPoseTransform(3).m_scale, IsClose(bindTransform.m_scale)); #endif // Test adding a morph. @@ -888,19 +888,19 @@ namespace EMotionFX sampleSettings.m_actorInstance = m_actorInstance; sampleSettings.m_sampleTime = expectation.first; const Transform sampledResult = motionData.SampleJointTransform(sampleSettings, 0); - EXPECT_THAT(sampledResult.mPosition, IsClose(expectation.second.mPosition)); - EXPECT_THAT(sampledResult.mRotation, IsClose(expectation.second.mRotation)); + EXPECT_THAT(sampledResult.m_position, IsClose(expectation.second.m_position)); + EXPECT_THAT(sampledResult.m_rotation, IsClose(expectation.second.m_rotation)); #ifndef EMFX_SCALE_DISABLED - EXPECT_THAT(sampledResult.mScale, IsClose(expectation.second.mScale)); + EXPECT_THAT(sampledResult.m_scale, IsClose(expectation.second.m_scale)); #endif // Fourth joint has no motion data to apply to our actor, so expect a bind pose. // It has motion data, but there is no joint in the skeleton that matches its name, so it is like motion data for a joint that doesn't exist in our actor. const Transform fourthJointTransform = motionData.SampleJointTransform(sampleSettings, 3); - EXPECT_THAT(fourthJointTransform.mPosition, IsClose(expectedBindTransform.mPosition)); - EXPECT_THAT(fourthJointTransform.mRotation, IsClose(expectedBindTransform.mRotation)); + EXPECT_THAT(fourthJointTransform.m_position, IsClose(expectedBindTransform.m_position)); + EXPECT_THAT(fourthJointTransform.m_rotation, IsClose(expectedBindTransform.m_rotation)); #ifndef EMFX_SCALE_DISABLED - EXPECT_THAT(fourthJointTransform.mScale, IsClose(expectedBindTransform.mScale)); + EXPECT_THAT(fourthJointTransform.m_scale, IsClose(expectedBindTransform.m_scale)); #endif } @@ -917,19 +917,19 @@ namespace EMotionFX // We only verify the first joint, to see if it interpolated fine. const Transform sampledResult = pose.GetLocalSpaceTransform(0); - EXPECT_THAT(sampledResult.mPosition, IsClose(expectation.second.mPosition)); - EXPECT_THAT(sampledResult.mRotation, IsClose(expectation.second.mRotation)); + EXPECT_THAT(sampledResult.m_position, IsClose(expectation.second.m_position)); + EXPECT_THAT(sampledResult.m_rotation, IsClose(expectation.second.m_rotation)); #ifndef EMFX_SCALE_DISABLED - EXPECT_THAT(sampledResult.mScale, IsClose(expectation.second.mScale)); + EXPECT_THAT(sampledResult.m_scale, IsClose(expectation.second.m_scale)); #endif // Fourth joint has no motion data to apply to our actor, so expect a bind pose. // It has motion data, but there is no joint in the skeleton that matches its name, so it is like motion data for a joint that doesn't exist in our actor. const Transform fourthJointTransform = pose.GetLocalSpaceTransform(3); - EXPECT_THAT(fourthJointTransform.mPosition, IsClose(expectedBindTransform.mPosition)); - EXPECT_THAT(fourthJointTransform.mRotation, IsClose(expectedBindTransform.mRotation)); + EXPECT_THAT(fourthJointTransform.m_position, IsClose(expectedBindTransform.m_position)); + EXPECT_THAT(fourthJointTransform.m_rotation, IsClose(expectedBindTransform.m_rotation)); #ifndef EMFX_SCALE_DISABLED - EXPECT_THAT(fourthJointTransform.mScale, IsClose(expectedBindTransform.mScale)); + EXPECT_THAT(fourthJointTransform.m_scale, IsClose(expectedBindTransform.m_scale)); #endif } } diff --git a/Gems/EMotionFX/Code/Tests/PoseTests.cpp b/Gems/EMotionFX/Code/Tests/PoseTests.cpp index 0dd592cda7..ed14da5354 100644 --- a/Gems/EMotionFX/Code/Tests/PoseTests.cpp +++ b/Gems/EMotionFX/Code/Tests/PoseTests.cpp @@ -729,7 +729,7 @@ namespace EMotionFX const Transform transformResult = pose.CalcTrajectoryTransform(); const Transform expectedResult = pose.GetWorldSpaceTransform(motionExtractionJointIndex).ProjectedToGroundPlane(); EXPECT_THAT(transformResult, IsClose(expectedResult)); - EXPECT_EQ(transformResult.mPosition, AZ::Vector3(1.0f, 1.0f, 0.0f)); + EXPECT_EQ(transformResult.m_position, AZ::Vector3(1.0f, 1.0f, 0.0f)); } /////////////////////////////////////////////////////////////////////////// @@ -747,16 +747,16 @@ namespace EMotionFX ASSERT_NE(joint, nullptr) << "Can't find the joint named 'joint4'."; const Transform jointTransform = pose.GetWorldSpaceTransform(jointIndex); - EXPECT_THAT(jointTransform.mScale, IsClose(AZ::Vector3::CreateOne())); + EXPECT_THAT(jointTransform.m_scale, IsClose(AZ::Vector3::CreateOne())); AZ::Vector3 scale(2.0f); m_actorInstance->SetLocalSpaceScale(scale); m_actorInstance->UpdateWorldTransform(); const Transform jointTransform2 = pose.GetWorldSpaceTransform(jointIndex); - EXPECT_THAT(jointTransform2.mScale, IsClose(scale)); + EXPECT_THAT(jointTransform2.m_scale, IsClose(scale)); - const float distToOrigin = jointTransform.mPosition.GetLength(); - const float distToOrigin2= jointTransform2.mPosition.GetLength(); + const float distToOrigin = jointTransform.m_position.GetLength(); + const float distToOrigin2= jointTransform2.m_position.GetLength(); EXPECT_FLOAT_EQ(distToOrigin2 / distToOrigin, 2.0f) << "Expecting the scaled joint to be twice as far from the origin as the unscaled joint."; ) } @@ -786,7 +786,7 @@ namespace EMotionFX AZ::Quaternion::CreateFromAxisAngle(AZ::Vector3(0.0f, 1.0f, 0.0f), floatI)); EMFX_SCALECODE ( - transform.mScale = AZ::Vector3(floatI, floatI, floatI); + transform.m_scale = AZ::Vector3(floatI, floatI, floatI); ) destPose.SetLocalSpaceTransform(i, transform); } @@ -807,7 +807,7 @@ namespace EMotionFX Transform expectedResult = sourceTransform; expectedResult.Blend(destTransform, blendWeight); EXPECT_THAT(transformResult, IsClose(expectedResult)); - CheckIfRotationIsNormalized(destTransform.mRotation); + CheckIfRotationIsNormalized(destTransform.m_rotation); } } @@ -827,7 +827,7 @@ namespace EMotionFX AZ::Quaternion::CreateFromAxisAngle(AZ::Vector3(0.0f, 1.0f, 0.0f), floatI)); EMFX_SCALECODE ( - transform.mScale = AZ::Vector3(floatI, floatI, floatI); + transform.m_scale = AZ::Vector3(floatI, floatI, floatI); ) sourcePose.SetLocalSpaceTransform(i, transform); @@ -844,7 +844,7 @@ namespace EMotionFX AZ::Quaternion::CreateFromAxisAngle(AZ::Vector3(1.0f, 0.0f, 0.0f), floatI)); EMFX_SCALECODE ( - transform.mScale = AZ::Vector3(floatI, floatI, floatI); + transform.m_scale = AZ::Vector3(floatI, floatI, floatI); ) destPose.SetLocalSpaceTransform(i, transform); @@ -866,7 +866,7 @@ namespace EMotionFX Transform expectedResult = sourceTransform; expectedResult.BlendAdditive(destTransform, bindPoseTransform, blendWeight); EXPECT_THAT(transformResult, IsClose(expectedResult)); - CheckIfRotationIsNormalized(destTransform.mRotation); + CheckIfRotationIsNormalized(destTransform.m_rotation); } } @@ -1030,7 +1030,7 @@ namespace EMotionFX { const Transform& transformRel = poseRel.GetLocalSpaceTransform(i); - const AZ::Vector3& result = transformRel.mPosition; + const AZ::Vector3& result = transformRel.m_position; EXPECT_TRUE(result.IsClose(AZ::Vector3::CreateOne())); } } @@ -1142,22 +1142,22 @@ namespace EMotionFX Transform expectedResult = Transform::CreateIdentity(); if (additiveFunction == MakeAdditive) { - expectedResult.mPosition = transformA.mPosition - transformB.mPosition; - expectedResult.mRotation = transformB.mRotation.GetConjugate() * transformA.mRotation; + expectedResult.m_position = transformA.m_position - transformB.m_position; + expectedResult.m_rotation = transformB.m_rotation.GetConjugate() * transformA.m_rotation; EMFX_SCALECODE ( - expectedResult.mScale = transformA.mScale * transformB.mScale; + expectedResult.m_scale = transformA.m_scale * transformB.m_scale; ) } else if (additiveFunction == ApplyAdditive || weight > 1.0f - MCore::Math::epsilon) { - expectedResult.mPosition = transformA.mPosition + transformB.mPosition; - expectedResult.mRotation = transformA.mRotation * transformB.mRotation; - expectedResult.mRotation.Normalize(); + expectedResult.m_position = transformA.m_position + transformB.m_position; + expectedResult.m_rotation = transformA.m_rotation * transformB.m_rotation; + expectedResult.m_rotation.Normalize(); EMFX_SCALECODE ( - expectedResult.mScale = transformA.mScale * transformB.mScale; + expectedResult.m_scale = transformA.m_scale * transformB.m_scale; ) } else if (weight < MCore::Math::epsilon ) @@ -1166,13 +1166,13 @@ namespace EMotionFX } else { - expectedResult.mPosition = transformA.mPosition + transformB.mPosition * weight; - expectedResult.mRotation = transformA.mRotation.NLerp(transformB.mRotation * transformA.mRotation, weight); - expectedResult.mRotation.Normalize(); + expectedResult.m_position = transformA.m_position + transformB.m_position * weight; + expectedResult.m_rotation = transformA.m_rotation.NLerp(transformB.m_rotation * transformA.m_rotation, weight); + expectedResult.m_rotation.Normalize(); EMFX_SCALECODE ( - expectedResult.mScale = transformA.mScale * AZ::Vector3::CreateOne().Lerp(transformB.mScale, weight); + expectedResult.m_scale = transformA.m_scale * AZ::Vector3::CreateOne().Lerp(transformB.m_scale, weight); ) } @@ -1257,7 +1257,7 @@ namespace EMotionFX for (size_t i = 0; i < m_actor->GetSkeleton()->GetNumNodes(); ++i) { - CheckIfRotationIsNormalized(pose.GetLocalSpaceTransform(i).mRotation); + CheckIfRotationIsNormalized(pose.GetLocalSpaceTransform(i).m_rotation); } } diff --git a/Gems/EMotionFX/Code/Tests/Printers.cpp b/Gems/EMotionFX/Code/Tests/Printers.cpp index ebf5167508..eb909a7aca 100644 --- a/Gems/EMotionFX/Code/Tests/Printers.cpp +++ b/Gems/EMotionFX/Code/Tests/Printers.cpp @@ -39,12 +39,12 @@ namespace EMotionFX void PrintTo(const Transform& transform, ::std::ostream* os) { *os << "(pos: "; - PrintTo(transform.mPosition, os); + PrintTo(transform.m_position, os); *os << ", rot: "; - PrintTo(transform.mRotation, os); + PrintTo(transform.m_rotation, os); #if !defined(EMFX_SCALE_DISABLED) *os << ", scale: "; - PrintTo(transform.mScale, os); + PrintTo(transform.m_scale, os); #endif *os << ")"; } diff --git a/Gems/EMotionFX/Code/Tests/RandomMotionSelectionTests.cpp b/Gems/EMotionFX/Code/Tests/RandomMotionSelectionTests.cpp index 3a0b7f4959..556166e240 100644 --- a/Gems/EMotionFX/Code/Tests/RandomMotionSelectionTests.cpp +++ b/Gems/EMotionFX/Code/Tests/RandomMotionSelectionTests.cpp @@ -73,14 +73,14 @@ namespace EMotionFX for (int i = 0; i < iterationCount; ++i) { m_motionNode->PickNewActiveMotion(m_animGraphInstance, nodeUniqueData); - auto mapIterator = m_selectedMotionCount->find(nodeUniqueData->mActiveMotionIndex); + auto mapIterator = m_selectedMotionCount->find(nodeUniqueData->m_activeMotionIndex); if (mapIterator != m_selectedMotionCount->end()) { mapIterator->second++; } else { - m_selectedMotionCount->emplace(nodeUniqueData->mActiveMotionIndex, 1); + m_selectedMotionCount->emplace(nodeUniqueData->m_activeMotionIndex, 1); } } diff --git a/Gems/EMotionFX/Code/Tests/SimulatedObjectSetupTests.cpp b/Gems/EMotionFX/Code/Tests/SimulatedObjectSetupTests.cpp index c8bb4fe6df..f37f571982 100644 --- a/Gems/EMotionFX/Code/Tests/SimulatedObjectSetupTests.cpp +++ b/Gems/EMotionFX/Code/Tests/SimulatedObjectSetupTests.cpp @@ -156,8 +156,8 @@ namespace SimulatedObjectSetupTests struct AddSimulatedJointAndChildrenParams { - AZ::u32 jointIndex; - size_t expectedSimulatedJointCount; + AZ::u32 m_jointIndex; + size_t m_expectedSimulatedJointCount; }; class AddSimulatedJointAndChildrenFixture @@ -177,8 +177,8 @@ namespace SimulatedObjectSetupTests SimulatedObjectSetup setup(&actor); SimulatedObject* object = setup.AddSimulatedObject(); - object->AddSimulatedJointAndChildren(GetParam().jointIndex); - EXPECT_EQ(object->GetSimulatedJoints().size(), GetParam().expectedSimulatedJointCount); + object->AddSimulatedJointAndChildren(GetParam().m_jointIndex); + EXPECT_EQ(object->GetSimulatedJoints().size(), GetParam().m_expectedSimulatedJointCount); } INSTANTIATE_TEST_CASE_P(Test, AddSimulatedJointAndChildrenFixture, diff --git a/Gems/EMotionFX/Code/Tests/SyncingSystemTests.cpp b/Gems/EMotionFX/Code/Tests/SyncingSystemTests.cpp index 985b2eb6c1..a4a89da3ba 100644 --- a/Gems/EMotionFX/Code/Tests/SyncingSystemTests.cpp +++ b/Gems/EMotionFX/Code/Tests/SyncingSystemTests.cpp @@ -24,17 +24,17 @@ namespace EMotionFX { struct SyncParam { - void (*eventFactoryA)(MotionEventTrack* track) = MakeNoEvents; - void (*eventFactoryB)(MotionEventTrack* track) = MakeNoEvents; + void (*m_eventFactoryA)(MotionEventTrack* track) = MakeNoEvents; + void (*m_eventFactoryB)(MotionEventTrack* track) = MakeNoEvents; // 2.0 seconds of simulation, 0.1 increments, 21 playtimes - AZStd::array expectedPlayTimeA {}; - AZStd::array expectedPlayTimeB {}; + AZStd::array m_expectedPlayTimeA {}; + AZStd::array m_expectedPlayTimeB {}; // Expected play times will be calculated based on motion event and duration from AnimGraphNode::SyncUsingSyncTracks(). - AnimGraphObject::ESyncMode syncMode = AnimGraphObject::ESyncMode::SYNCMODE_DISABLED; - float weightParam = 0.0f; - bool reverseMotion = false; + AnimGraphObject::ESyncMode m_syncMode = AnimGraphObject::ESyncMode::SYNCMODE_DISABLED; + float m_weightParam = 0.0f; + bool m_reverseMotion = false; }; class SyncingSystemFixture @@ -45,7 +45,7 @@ namespace EMotionFX void ConstructGraph() override { const SyncParam param = GetParam(); - m_syncMode = param.syncMode; + m_syncMode = param.m_syncMode; AnimGraphFixture::ConstructGraph(); m_blendTreeAnimGraph = AnimGraphFactory::Create(); m_rootStateMachine = m_blendTreeAnimGraph->GetRootStateMachine(); @@ -143,16 +143,16 @@ namespace EMotionFX TEST_P(SyncingSystemFixture, SyncingSystemPlaySpeedTests) { const SyncParam param = GetParam(); - param.eventFactoryA(m_syncTrackA); - param.eventFactoryB(m_syncTrackB); + param.m_eventFactoryA(m_syncTrackA); + param.m_eventFactoryB(m_syncTrackB); GetEMotionFX().Update(0.0f); MCore::AttributeFloat* weightParam = m_animGraphInstance->GetParameterValueChecked(0); - weightParam->SetValue(param.weightParam); + weightParam->SetValue(param.m_weightParam); // Test reverse motion - m_motionNodeA->SetReverse(param.reverseMotion); - m_motionNodeB->SetReverse(param.reverseMotion); + m_motionNodeA->SetReverse(param.m_reverseMotion); + m_motionNodeB->SetReverse(param.m_reverseMotion); uint32 playTimeIndex = 0; const float tolerance = 0.00001f; Simulate(2.0f/*simulationTime*/, 10.0f/*expectedFps*/, 0.0f/*fpsVariance*/, @@ -180,7 +180,7 @@ namespace EMotionFX float factorB; float interpolatedSpeedA; AZStd::tie(interpolatedSpeedA, factorA, factorB) = AnimGraphNode::SyncPlaySpeeds( - motionPlaySpeedA, durationA, motionPlaySpeedB, durationB, param.weightParam); + motionPlaySpeedA, durationA, motionPlaySpeedB, durationB, param.m_weightParam); EXPECT_FLOAT_EQ(statePlaySpeedA, interpolatedSpeedA * factorA) << "Motion playspeeds should match the set playspeed in the motion node throughout blending."; } else if(m_blend2Node->GetSyncMode() == AnimGraphObject::SYNCMODE_TRACKBASED) @@ -188,8 +188,8 @@ namespace EMotionFX const float motionPlayTimeA = m_motionNodeA->GetCurrentPlayTime(animGraphInstance); const float motionPlayTimeB = m_motionNodeB->GetCurrentPlayTime(animGraphInstance); - EXPECT_NEAR(motionPlayTimeA, param.expectedPlayTimeA[playTimeIndex], tolerance) << "Motion node A playtime should match the expected playtime."; - EXPECT_NEAR(motionPlayTimeB, param.expectedPlayTimeB[playTimeIndex], tolerance) << "Motion node B playtime should match the expected playtime."; + EXPECT_NEAR(motionPlayTimeA, param.m_expectedPlayTimeA[playTimeIndex], tolerance) << "Motion node A playtime should match the expected playtime."; + EXPECT_NEAR(motionPlayTimeB, param.m_expectedPlayTimeB[playTimeIndex], tolerance) << "Motion node B playtime should match the expected playtime."; playTimeIndex++; } } diff --git a/Gems/EMotionFX/Code/Tests/TestAssetCode/SimpleActors.cpp b/Gems/EMotionFX/Code/Tests/TestAssetCode/SimpleActors.cpp index 45e9ad8649..3e1dac41c2 100644 --- a/Gems/EMotionFX/Code/Tests/TestAssetCode/SimpleActors.cpp +++ b/Gems/EMotionFX/Code/Tests/TestAssetCode/SimpleActors.cpp @@ -31,7 +31,7 @@ namespace EMotionFX AddNode(i, ("joint" + AZStd::to_string(i)).c_str(), i - 1); Transform transform = Transform::CreateIdentity(); - transform.mPosition = AZ::Vector3(static_cast(i), 0.0f, 0.0f); + transform.m_position = AZ::Vector3(static_cast(i), 0.0f, 0.0f); GetBindPose()->SetLocalSpaceTransform(i, transform); } } @@ -44,7 +44,7 @@ namespace EMotionFX AddNode(i, ("rootJoint" + AZStd::to_string(i)).c_str()); Transform transform = Transform::CreateIdentity(); - transform.mPosition = AZ::Vector3(static_cast(i), 0.0f, 0.0f); + transform.m_position = AZ::Vector3(static_cast(i), 0.0f, 0.0f); GetBindPose()->SetLocalSpaceTransform(i, transform); } } @@ -87,7 +87,7 @@ namespace EMotionFX AddNode(i, ("joint" + AZStd::to_string(i)).c_str(), i - 1); Transform transform = Transform::CreateIdentity(); - transform.mPosition = AZ::Vector3(static_cast(i), 0.0f, 0.0f); + transform.m_position = AZ::Vector3(static_cast(i), 0.0f, 0.0f); GetBindPose()->SetLocalSpaceTransform(i, transform); } } diff --git a/Gems/EMotionFX/Code/Tests/TransformUnitTests.cpp b/Gems/EMotionFX/Code/Tests/TransformUnitTests.cpp index 89cbddfb4d..b5f98bc5e8 100644 --- a/Gems/EMotionFX/Code/Tests/TransformUnitTests.cpp +++ b/Gems/EMotionFX/Code/Tests/TransformUnitTests.cpp @@ -52,33 +52,33 @@ namespace EMotionFX TEST(TransformFixture, CreateIdentity) { const Transform transform = Transform::CreateIdentity(); - EXPECT_TRUE(transform.mPosition.IsZero()); - EXPECT_EQ(transform.mRotation, AZ::Quaternion::CreateIdentity()); + EXPECT_TRUE(transform.m_position.IsZero()); + EXPECT_EQ(transform.m_rotation, AZ::Quaternion::CreateIdentity()); EMFX_SCALECODE ( - EXPECT_EQ(transform.mScale, AZ::Vector3::CreateOne()); + EXPECT_EQ(transform.m_scale, AZ::Vector3::CreateOne()); ) } TEST(TransformFixture, CreateIdentityWithZeroScale) { const Transform transform = Transform::CreateIdentityWithZeroScale(); - EXPECT_TRUE(transform.mPosition.IsZero()); - EXPECT_EQ(transform.mRotation, AZ::Quaternion::CreateIdentity()); + EXPECT_TRUE(transform.m_position.IsZero()); + EXPECT_EQ(transform.m_rotation, AZ::Quaternion::CreateIdentity()); EMFX_SCALECODE ( - EXPECT_EQ(transform.mScale, AZ::Vector3::CreateZero()); + EXPECT_EQ(transform.m_scale, AZ::Vector3::CreateZero()); ) } TEST(TransformFixture, CreateZero) { const Transform transform = Transform::CreateZero(); - EXPECT_TRUE(transform.mPosition.IsZero()); - EXPECT_EQ(transform.mRotation, AZ::Quaternion::CreateZero()); + EXPECT_TRUE(transform.m_position.IsZero()); + EXPECT_EQ(transform.m_rotation, AZ::Quaternion::CreateZero()); EMFX_SCALECODE ( - EXPECT_EQ(transform.mScale, AZ::Vector3::CreateZero()); + EXPECT_EQ(transform.m_scale, AZ::Vector3::CreateZero()); ) } @@ -86,11 +86,11 @@ namespace EMotionFX TEST(TransformFixture, ConstructFromVec3Quat) { const Transform transform(AZ::Vector3(6.0f, 7.0f, 8.0f), AZ::Quaternion::CreateRotationX(AZ::Constants::HalfPi)); - EXPECT_EQ(transform.mPosition, AZ::Vector3(6.0f, 7.0f, 8.0f)); - EXPECT_THAT(transform.mRotation, IsClose(AZ::Quaternion(sqrt2over2, 0.0f, 0.0f, sqrt2over2))); + EXPECT_EQ(transform.m_position, AZ::Vector3(6.0f, 7.0f, 8.0f)); + EXPECT_THAT(transform.m_rotation, IsClose(AZ::Quaternion(sqrt2over2, 0.0f, 0.0f, sqrt2over2))); EMFX_SCALECODE ( - EXPECT_EQ(transform.mScale, AZ::Vector3::CreateOne()); + EXPECT_EQ(transform.m_scale, AZ::Vector3::CreateOne()); ) } @@ -148,11 +148,11 @@ namespace EMotionFX TEST_P(TransformConstructFromVec3QuatVec3Fixture, ConstructFromVec3QuatVec3) { const Transform transform(ExpectedPosition(), ExpectedRotation(), ExpectedScale()); - EXPECT_THAT(transform.mPosition, IsClose(ExpectedPosition())); - EXPECT_THAT(transform.mRotation, IsClose(ExpectedRotation())); + EXPECT_THAT(transform.m_position, IsClose(ExpectedPosition())); + EXPECT_THAT(transform.m_rotation, IsClose(ExpectedRotation())); EMFX_SCALECODE ( - EXPECT_THAT(transform.mScale, IsClose(ExpectedScale())); + EXPECT_THAT(transform.m_scale, IsClose(ExpectedScale())); ) } @@ -160,11 +160,11 @@ namespace EMotionFX { Transform transform(AZ::Vector3(5.0f, 6.0f, 7.0f), AZ::Quaternion(0.1f, 0.2f, 0.3f, 0.4f), AZ::Vector3(8.0f, 9.0f, 10.0f)); transform.Set(ExpectedPosition(), ExpectedRotation(), ExpectedScale()); - EXPECT_THAT(transform.mPosition, IsClose(ExpectedPosition())); - EXPECT_THAT(transform.mRotation, IsClose(ExpectedRotation())); + EXPECT_THAT(transform.m_position, IsClose(ExpectedPosition())); + EXPECT_THAT(transform.m_rotation, IsClose(ExpectedRotation())); EMFX_SCALECODE ( - EXPECT_THAT(transform.mScale, IsClose(ExpectedScale())); + EXPECT_THAT(transform.m_scale, IsClose(ExpectedScale())); ) } @@ -191,11 +191,11 @@ namespace EMotionFX { Transform transform(AZ::Vector3(5.0f, 6.0f, 7.0f), AZ::Quaternion(0.1f, 0.2f, 0.3f, 0.4f), AZ::Vector3(8.0f, 9.0f, 10.0f)); transform.Set(AZ::Vector3(1.0f, 2.0f, 3.0f), AZ::Quaternion::CreateRotationX(AZ::Constants::QuarterPi)); - EXPECT_EQ(transform.mPosition, AZ::Vector3(1.0f, 2.0f, 3.0f)); - EXPECT_THAT(transform.mRotation, IsClose(AZ::Quaternion::CreateRotationX(AZ::Constants::QuarterPi))); + EXPECT_EQ(transform.m_position, AZ::Vector3(1.0f, 2.0f, 3.0f)); + EXPECT_THAT(transform.m_rotation, IsClose(AZ::Quaternion::CreateRotationX(AZ::Constants::QuarterPi))); EMFX_SCALECODE ( - EXPECT_EQ(transform.mScale, AZ::Vector3::CreateOne()); + EXPECT_EQ(transform.m_scale, AZ::Vector3::CreateOne()); ) } @@ -203,11 +203,11 @@ namespace EMotionFX { Transform transform(AZ::Vector3(1.0f, 2.0f, 3.0f), AZ::Quaternion(0.1f, 0.2f, 0.3f, 0.4f), AZ::Vector3(4.0f, 5.0f, 6.0f)); transform.Identity(); - EXPECT_EQ(transform.mPosition, AZ::Vector3::CreateZero()); - EXPECT_EQ(transform.mRotation, AZ::Quaternion::CreateIdentity()); + EXPECT_EQ(transform.m_position, AZ::Vector3::CreateZero()); + EXPECT_EQ(transform.m_rotation, AZ::Quaternion::CreateIdentity()); EMFX_SCALECODE ( - EXPECT_EQ(transform.mScale, AZ::Vector3::CreateOne()); + EXPECT_EQ(transform.m_scale, AZ::Vector3::CreateOne()); ) } @@ -215,11 +215,11 @@ namespace EMotionFX { Transform transform(AZ::Vector3(1.0f, 2.0f, 3.0f), AZ::Quaternion(0.1f, 0.2f, 0.3f, 0.4f), AZ::Vector3(4.0f, 5.0f, 6.0f)); transform.Zero(); - EXPECT_EQ(transform.mPosition, AZ::Vector3::CreateZero()); - EXPECT_EQ(transform.mRotation, AZ::Quaternion::CreateZero()); + EXPECT_EQ(transform.m_position, AZ::Vector3::CreateZero()); + EXPECT_EQ(transform.m_rotation, AZ::Quaternion::CreateZero()); EMFX_SCALECODE ( - EXPECT_EQ(transform.mScale, AZ::Vector3::CreateZero()); + EXPECT_EQ(transform.m_scale, AZ::Vector3::CreateZero()); ) } @@ -227,11 +227,11 @@ namespace EMotionFX { Transform transform(AZ::Vector3(1.0f, 2.0f, 3.0f), AZ::Quaternion(0.1f, 0.2f, 0.3f, 0.4f), AZ::Vector3(4.0f, 5.0f, 6.0f)); transform.IdentityWithZeroScale(); - EXPECT_EQ(transform.mPosition, AZ::Vector3::CreateZero()); - EXPECT_EQ(transform.mRotation, AZ::Quaternion::CreateIdentity()); + EXPECT_EQ(transform.m_position, AZ::Vector3::CreateZero()); + EXPECT_EQ(transform.m_rotation, AZ::Quaternion::CreateIdentity()); EMFX_SCALECODE ( - EXPECT_EQ(transform.mScale, AZ::Vector3::CreateZero()); + EXPECT_EQ(transform.m_scale, AZ::Vector3::CreateZero()); ) } @@ -662,54 +662,54 @@ namespace EMotionFX struct ApplyDeltaParams { - const Transform initial; - const Transform a; - const Transform b; - const Transform expected; - const float weight; + const Transform m_initial; + const Transform m_a; + const Transform m_b; + const Transform m_expected; + const float m_weight; }; using TransformApplyDeltaFixture = ::testing::TestWithParam; TEST_P(TransformApplyDeltaFixture, ApplyDelta) { - if (GetParam().weight != 1.0f) + if (GetParam().m_weight != 1.0f) { return; } - Transform transform = GetParam().initial; - transform.ApplyDelta(GetParam().a, GetParam().b); + Transform transform = GetParam().m_initial; + transform.ApplyDelta(GetParam().m_a, GetParam().m_b); EXPECT_THAT( transform, - IsClose(GetParam().expected) + IsClose(GetParam().m_expected) ); } TEST_P(TransformApplyDeltaFixture, ApplyDeltaMirrored) { - if (GetParam().weight != 1.0f) + if (GetParam().m_weight != 1.0f) { return; } const AZ::Vector3 mirrorAxis = AZ::Vector3::CreateAxisX(); - Transform transform = GetParam().initial; - transform.ApplyDeltaMirrored(GetParam().a, GetParam().b, mirrorAxis); + Transform transform = GetParam().m_initial; + transform.ApplyDeltaMirrored(GetParam().m_a, GetParam().m_b, mirrorAxis); EXPECT_THAT( transform, - IsClose(GetParam().expected.Mirrored(mirrorAxis)) + IsClose(GetParam().m_expected.Mirrored(mirrorAxis)) ); } TEST_P(TransformApplyDeltaFixture, ApplyDeltaWithWeight) { - Transform transform = GetParam().initial; - transform.ApplyDeltaWithWeight(GetParam().a, GetParam().b, GetParam().weight); + Transform transform = GetParam().m_initial; + transform.ApplyDeltaWithWeight(GetParam().m_a, GetParam().m_b, GetParam().m_weight); EXPECT_THAT( transform, - IsClose(GetParam().expected) + IsClose(GetParam().m_expected) ); } @@ -774,7 +774,7 @@ namespace EMotionFX AZ::Quaternion(2.0f, 0.0f, 0.0f, 2.0f), AZ::Vector3::CreateOne() ).Normalize(); - EXPECT_FLOAT_EQ(transform.mRotation.GetLength(), 1.0f); + EXPECT_FLOAT_EQ(transform.m_rotation.GetLength(), 1.0f); } TEST(TransformFixture, Normalized) @@ -784,7 +784,7 @@ namespace EMotionFX AZ::Quaternion(2.0f, 0.0f, 0.0f, 2.0f), AZ::Vector3::CreateOne() ).Normalized(); - EXPECT_FLOAT_EQ(transform.mRotation.GetLength(), 1.0f); + EXPECT_FLOAT_EQ(transform.m_rotation.GetLength(), 1.0f); } TEST(TransformFixture, BlendAdditive) @@ -808,39 +808,39 @@ namespace EMotionFX : public ::testing::Test { protected: - const AZ::Vector3 translationA{5.0f, 6.0f, 7.0f}; - const AZ::Quaternion rotationA = AZ::Quaternion::CreateFromAxisAngle(AZ::Vector3::CreateAxisX(), AZ::Constants::QuarterPi); - const AZ::Vector3 scaleA = AZ::Vector3::CreateOne(); + const AZ::Vector3 m_translationA{5.0f, 6.0f, 7.0f}; + const AZ::Quaternion m_rotationA = AZ::Quaternion::CreateFromAxisAngle(AZ::Vector3::CreateAxisX(), AZ::Constants::QuarterPi); + const AZ::Vector3 m_scaleA = AZ::Vector3::CreateOne(); - const AZ::Vector3 translationB{11.0f, 12.0f, 13.0f}; - const AZ::Quaternion rotationB = AZ::Quaternion::CreateFromAxisAngle(AZ::Vector3::CreateAxisX(), AZ::Constants::HalfPi); - const AZ::Vector3 scaleB{3.0f, 4.0f, 5.0f}; + const AZ::Vector3 m_translationB{11.0f, 12.0f, 13.0f}; + const AZ::Quaternion m_rotationB = AZ::Quaternion::CreateFromAxisAngle(AZ::Vector3::CreateAxisX(), AZ::Constants::HalfPi); + const AZ::Vector3 m_scaleB{3.0f, 4.0f, 5.0f}; }; TEST_F(TwoTransformsFixture, Blend) { - const Transform transformA(translationA, rotationA, scaleA); - const Transform transformB(translationB, rotationB, scaleB); + const Transform transformA(m_translationA, m_rotationA, m_scaleA); + const Transform transformB(m_translationB, m_rotationB, m_scaleB); EXPECT_THAT( - Transform(translationA, rotationA, scaleA).Blend(transformB, 0.0f), + Transform(m_translationA, m_rotationA, m_scaleA).Blend(transformB, 0.0f), IsClose(transformA) ); EXPECT_THAT( - Transform(translationA, rotationA, scaleA).Blend(transformB, 0.25f), + Transform(m_translationA, m_rotationA, m_scaleA).Blend(transformB, 0.25f), IsClose(Transform(AZ::Vector3(6.5f, 7.5f, 8.5f), AZ::Quaternion::CreateFromAxisAngle(AZ::Vector3::CreateAxisX(), AZ::Constants::Pi * 5.0f / 16.0f), AZ::Vector3(1.5f, 1.75f, 2.0f))) ); EXPECT_THAT( - Transform(translationA, rotationA, scaleA).Blend(transformB, 0.5f), + Transform(m_translationA, m_rotationA, m_scaleA).Blend(transformB, 0.5f), IsClose(Transform(AZ::Vector3(8.0f, 9.0f, 10.0f), AZ::Quaternion::CreateFromAxisAngle(AZ::Vector3::CreateAxisX(), AZ::Constants::Pi * 3.0f / 8.0f), AZ::Vector3(2.0f, 2.5f, 3.0f))) ); EXPECT_THAT( - Transform(translationA, rotationA, scaleA).Blend(transformB, 0.75f), + Transform(m_translationA, m_rotationA, m_scaleA).Blend(transformB, 0.75f), IsClose(Transform(AZ::Vector3(9.5f, 10.5f, 11.5f), AZ::Quaternion::CreateFromAxisAngle(AZ::Vector3::CreateAxisX(), AZ::Constants::Pi * 7.0f / 16.0f), AZ::Vector3(2.5f, 3.25f, 4.0f))) ); EXPECT_THAT( - Transform(translationA, rotationA, scaleA).Blend(transformB, 1.0f), + Transform(m_translationA, m_rotationA, m_scaleA).Blend(transformB, 1.0f), IsClose(transformB) ); } @@ -848,8 +848,8 @@ namespace EMotionFX TEST_F(TwoTransformsFixture, ApplyAdditiveTransform) { EXPECT_THAT( - Transform(translationA, rotationA, scaleA).ApplyAdditive(Transform(translationB, rotationB, scaleB)), - IsClose(Transform(translationA + translationB, rotationA * rotationB, scaleA * scaleB)) + Transform(m_translationA, m_rotationA, m_scaleA).ApplyAdditive(Transform(m_translationB, m_rotationB, m_scaleB)), + IsClose(Transform(m_translationA + m_translationB, m_rotationA * m_rotationB, m_scaleA * m_scaleB)) ); } @@ -857,16 +857,16 @@ namespace EMotionFX { const float factor = 0.5f; EXPECT_THAT( - Transform(translationA, rotationA, scaleA).ApplyAdditive(Transform(translationB, rotationB, scaleB), factor), - IsClose(Transform(translationA + translationB * factor, rotationA.NLerp(rotationA * rotationB, factor), scaleA * AZ::Vector3::CreateOne().Lerp(scaleB, factor))) + Transform(m_translationA, m_rotationA, m_scaleA).ApplyAdditive(Transform(m_translationB, m_rotationB, m_scaleB), factor), + IsClose(Transform(m_translationA + m_translationB * factor, m_rotationA.NLerp(m_rotationA * m_rotationB, factor), m_scaleA * AZ::Vector3::CreateOne().Lerp(m_scaleB, factor))) ); } TEST_F(TwoTransformsFixture, AddTransform) { EXPECT_THAT( - Transform(translationA, rotationA, scaleA).Add(Transform(translationB, rotationB, scaleB)), - IsClose(Transform(translationA + translationB, rotationA + rotationB, scaleA + scaleB)) + Transform(m_translationA, m_rotationA, m_scaleA).Add(Transform(m_translationB, m_rotationB, m_scaleB)), + IsClose(Transform(m_translationA + m_translationB, m_rotationA + m_rotationB, m_scaleA + m_scaleB)) ); } @@ -874,16 +874,16 @@ namespace EMotionFX { const float factor = 0.5f; EXPECT_THAT( - Transform(translationA, rotationA, scaleA).Add(Transform(translationB, rotationB, scaleB), factor), - IsClose(Transform(translationA + translationB * factor, rotationA + rotationB * factor, scaleA + scaleB * factor)) + Transform(m_translationA, m_rotationA, m_scaleA).Add(Transform(m_translationB, m_rotationB, m_scaleB), factor), + IsClose(Transform(m_translationA + m_translationB * factor, m_rotationA + m_rotationB * factor, m_scaleA + m_scaleB * factor)) ); } TEST_F(TwoTransformsFixture, Subtract) { EXPECT_THAT( - Transform(translationA, rotationA, scaleA).Subtract(Transform(translationB, rotationB, scaleB)), - IsClose(Transform(translationA - translationB, rotationA - rotationB, scaleA - scaleB)) + Transform(m_translationA, m_rotationA, m_scaleA).Subtract(Transform(m_translationB, m_rotationB, m_scaleB)), + IsClose(Transform(m_translationA - m_translationB, m_rotationA - m_rotationB, m_scaleA - m_scaleB)) ); } diff --git a/Gems/EMotionFX/Code/Tests/UI/CanMorphManyShapes.cpp b/Gems/EMotionFX/Code/Tests/UI/CanMorphManyShapes.cpp index 2ed0407d53..f47ad20d23 100644 --- a/Gems/EMotionFX/Code/Tests/UI/CanMorphManyShapes.cpp +++ b/Gems/EMotionFX/Code/Tests/UI/CanMorphManyShapes.cpp @@ -66,7 +66,7 @@ namespace EMotionFX ); m_morphSetup->AddMorphTarget(morphTarget); - // Without this call, the bind pose does not know about newly added morph target (mMorphWeights.GetLength() == 0) + // Without this call, the bind pose does not know about newly added morph target (m_morphWeights.size() == 0) m_actor->ResizeTransformData(); m_actor->PostCreateInit(/*makeGeomLodsCompatibleWithSkeletalLODs=*/false, /*convertUnitType=*/false); @@ -161,13 +161,13 @@ namespace EMotionFX EXPECT_TRUE(morphTarget) << "Cannot access MorphTarget"; // Switch the morphTarget to manual mode - morphTarget->mManualMode->click(); + morphTarget->m_manualMode->click(); // Set the slider to 0.5f; - morphTarget->mSliderWeight->slider()->setValue(0.5f); + morphTarget->m_sliderWeight->slider()->setValue(0.5f); // Get the instance of the MorphTargetInstance - EMotionFX::MorphSetupInstance::MorphTarget* morphTargetInstance = morphTarget->mMorphTargetInstance; + EMotionFX::MorphSetupInstance::MorphTarget* morphTargetInstance = morphTarget->m_morphTargetInstance; ASSERT_TRUE(morphTargetInstance) << "Cannot get Instance of Morph Target"; EXPECT_EQ(morphTargetInstance->GetWeight(), 0.5f) << "Morph Taget Instance is not set to the correct value"; } diff --git a/Gems/EMotionFX/Code/Tests/UI/ModalPopupHandler.cpp b/Gems/EMotionFX/Code/Tests/UI/ModalPopupHandler.cpp index 4e00a2998c..cecd865515 100644 --- a/Gems/EMotionFX/Code/Tests/UI/ModalPopupHandler.cpp +++ b/Gems/EMotionFX/Code/Tests/UI/ModalPopupHandler.cpp @@ -44,7 +44,7 @@ namespace EMotionFX m_totalTime = 0; m_actionCompletionCallback = completionCallback; - m_MenuActiveCallback = menuCallback; + m_menuActiveCallback = menuCallback; m_timeout = timeout; // Kick a timer off to check whether the menu is open. @@ -84,7 +84,7 @@ namespace EMotionFX } // The menu is now active, inform the calling object. - m_MenuActiveCallback(menu); + m_menuActiveCallback(menu); } void ModalPopupHandler::CheckForPopupWidget() diff --git a/Gems/EMotionFX/Code/Tests/UI/ModalPopupHandler.h b/Gems/EMotionFX/Code/Tests/UI/ModalPopupHandler.h index 2ebe5ed2ce..95b3c2c233 100644 --- a/Gems/EMotionFX/Code/Tests/UI/ModalPopupHandler.h +++ b/Gems/EMotionFX/Code/Tests/UI/ModalPopupHandler.h @@ -162,7 +162,7 @@ namespace EMotionFX void CheckForPopupWidget(); private: - MenuActiveCallback m_MenuActiveCallback = nullptr; + MenuActiveCallback m_menuActiveCallback = nullptr; WidgetActiveCallback m_widgetActiveCallback = nullptr; ActionCompletionCallback m_actionCompletionCallback = nullptr; diff --git a/Gems/EMotionFX/Code/Tests/UniformMotionDataTests.cpp b/Gems/EMotionFX/Code/Tests/UniformMotionDataTests.cpp index 7433a403e1..e82d10097b 100644 --- a/Gems/EMotionFX/Code/Tests/UniformMotionDataTests.cpp +++ b/Gems/EMotionFX/Code/Tests/UniformMotionDataTests.cpp @@ -406,15 +406,15 @@ namespace EMotionFX EXPECT_FALSE(motionData.IsJointAnimated(3)); EXPECT_STREQ(motionData.GetJointName(3).c_str(), "Joint4"); - EXPECT_THAT(motionData.GetJointPoseTransform(3).mPosition, IsClose(poseTransform.mPosition)); - EXPECT_THAT(motionData.GetJointPoseTransform(3).mRotation, IsClose(poseTransform.mRotation)); + EXPECT_THAT(motionData.GetJointPoseTransform(3).m_position, IsClose(poseTransform.m_position)); + EXPECT_THAT(motionData.GetJointPoseTransform(3).m_rotation, IsClose(poseTransform.m_rotation)); #ifndef EMFX_SCALE_DISABLED - EXPECT_THAT(motionData.GetJointPoseTransform(3).mScale, IsClose(poseTransform.mScale)); + EXPECT_THAT(motionData.GetJointPoseTransform(3).m_scale, IsClose(poseTransform.m_scale)); #endif - EXPECT_THAT(motionData.GetJointBindPoseTransform(3).mPosition, IsClose(bindTransform.mPosition)); - EXPECT_THAT(motionData.GetJointBindPoseTransform(3).mRotation, IsClose(bindTransform.mRotation)); + EXPECT_THAT(motionData.GetJointBindPoseTransform(3).m_position, IsClose(bindTransform.m_position)); + EXPECT_THAT(motionData.GetJointBindPoseTransform(3).m_rotation, IsClose(bindTransform.m_rotation)); #ifndef EMFX_SCALE_DISABLED - EXPECT_THAT(motionData.GetJointBindPoseTransform(3).mScale, IsClose(bindTransform.mScale)); + EXPECT_THAT(motionData.GetJointBindPoseTransform(3).m_scale, IsClose(bindTransform.m_scale)); #endif // Test adding a morph. @@ -549,19 +549,19 @@ namespace EMotionFX sampleSettings.m_actorInstance = m_actorInstance; sampleSettings.m_sampleTime = expectation.first; const Transform sampledResult = motionData.SampleJointTransform(sampleSettings, 0); - EXPECT_THAT(sampledResult.mPosition, IsClose(expectation.second.mPosition)); - EXPECT_THAT(sampledResult.mRotation, IsClose(expectation.second.mRotation)); + EXPECT_THAT(sampledResult.m_position, IsClose(expectation.second.m_position)); + EXPECT_THAT(sampledResult.m_rotation, IsClose(expectation.second.m_rotation)); #ifndef EMFX_SCALE_DISABLED - EXPECT_THAT(sampledResult.mScale, IsClose(expectation.second.mScale)); + EXPECT_THAT(sampledResult.m_scale, IsClose(expectation.second.m_scale)); #endif // Fourth joint has no motion data to apply to our actor, so expect a bind pose. // It has motion data, but there is no joint in the skeleton that matches its name, so it is like motion data for a joint that doesn't exist in our actor. const Transform fourthJointTransform = motionData.SampleJointTransform(sampleSettings, 3); - EXPECT_THAT(fourthJointTransform.mPosition, IsClose(expectedBindTransform.mPosition)); - EXPECT_THAT(fourthJointTransform.mRotation, IsClose(expectedBindTransform.mRotation)); + EXPECT_THAT(fourthJointTransform.m_position, IsClose(expectedBindTransform.m_position)); + EXPECT_THAT(fourthJointTransform.m_rotation, IsClose(expectedBindTransform.m_rotation)); #ifndef EMFX_SCALE_DISABLED - EXPECT_THAT(fourthJointTransform.mScale, IsClose(expectedBindTransform.mScale)); + EXPECT_THAT(fourthJointTransform.m_scale, IsClose(expectedBindTransform.m_scale)); #endif } @@ -578,19 +578,19 @@ namespace EMotionFX // We only verify the first joint, to see if it interpolated fine. const Transform sampledResult = pose.GetLocalSpaceTransform(0); - EXPECT_THAT(sampledResult.mPosition, IsClose(expectation.second.mPosition)); - EXPECT_THAT(sampledResult.mRotation, IsClose(expectation.second.mRotation)); + EXPECT_THAT(sampledResult.m_position, IsClose(expectation.second.m_position)); + EXPECT_THAT(sampledResult.m_rotation, IsClose(expectation.second.m_rotation)); #ifndef EMFX_SCALE_DISABLED - EXPECT_THAT(sampledResult.mScale, IsClose(expectation.second.mScale)); + EXPECT_THAT(sampledResult.m_scale, IsClose(expectation.second.m_scale)); #endif // Fourth joint has no motion data to apply to our actor, so expect a bind pose. // It has motion data, but there is no joint in the skeleton that matches its name, so it is like motion data for a joint that doesn't exist in our actor. const Transform fourthJointTransform = pose.GetLocalSpaceTransform(3); - EXPECT_THAT(fourthJointTransform.mPosition, IsClose(expectedBindTransform.mPosition)); - EXPECT_THAT(fourthJointTransform.mRotation, IsClose(expectedBindTransform.mRotation)); + EXPECT_THAT(fourthJointTransform.m_position, IsClose(expectedBindTransform.m_position)); + EXPECT_THAT(fourthJointTransform.m_rotation, IsClose(expectedBindTransform.m_rotation)); #ifndef EMFX_SCALE_DISABLED - EXPECT_THAT(fourthJointTransform.mScale, IsClose(expectedBindTransform.mScale)); + EXPECT_THAT(fourthJointTransform.m_scale, IsClose(expectedBindTransform.m_scale)); #endif } } diff --git a/Gems/NvCloth/Code/Source/Components/ClothComponentMesh/ActorClothSkinning.cpp b/Gems/NvCloth/Code/Source/Components/ClothComponentMesh/ActorClothSkinning.cpp index 5359ed6ad5..8baea091a2 100644 --- a/Gems/NvCloth/Code/Source/Components/ClothComponentMesh/ActorClothSkinning.cpp +++ b/Gems/NvCloth/Code/Source/Components/ClothComponentMesh/ActorClothSkinning.cpp @@ -415,7 +415,7 @@ namespace NvCloth const MCore::DualQuaternion& skinningDualQuaternion = m_skinningDualQuaternions.at(jointIndex); - float flip = AZ::GetSign(vertexSkinningTransform.mReal.Dot(skinningDualQuaternion.mReal)); + float flip = AZ::GetSign(vertexSkinningTransform.m_real.Dot(skinningDualQuaternion.m_real)); vertexSkinningTransform += skinningDualQuaternion * jointWeight * flip; } // Normalizing the dual quaternion as the GPU shaders do. This will remove the scale from the transform.

Event ID: 

Local Event Time: 

%.3f seconds

%.3f seconds

Event Trigger Time: 

%.3f seconds

%.3f seconds

Is Ranged Event: 

%s

%s

Global Weight: 

%.3f

%.3f

Local Weight: 

%.3f

%.3f

Emitted By: