Convert EMotionFX editor uint32 -> size_t
Signed-off-by: Chris Burel <burelc@amazon.com>
This commit is contained in:
@@ -163,10 +163,10 @@ namespace EMotionFX
|
||||
createMotionEventCommand->SetStartTime(commandLine.GetValueAsFloat("startTime", 0.0f));
|
||||
createMotionEventCommand->SetEndTime(commandLine.GetValueAsFloat("endTime", 0.0f));
|
||||
|
||||
const AZ::u32 eventTypeIndex = commandLine.FindParameterIndex("eventType");
|
||||
const AZ::u32 parametersIndex = commandLine.FindParameterIndex("parameters");
|
||||
const AZ::u32 mirrorTypeIndex = commandLine.FindParameterIndex("mirrorType");
|
||||
if (eventTypeIndex == MCORE_INVALIDINDEX32 || parametersIndex == MCORE_INVALIDINDEX32 || mirrorTypeIndex == MCORE_INVALIDINDEX32)
|
||||
const size_t eventTypeIndex = commandLine.FindParameterIndex("eventType");
|
||||
const size_t parametersIndex = commandLine.FindParameterIndex("parameters");
|
||||
const size_t mirrorTypeIndex = commandLine.FindParameterIndex("mirrorType");
|
||||
if (eventTypeIndex == InvalidIndex || parametersIndex == InvalidIndex || mirrorTypeIndex == InvalidIndex)
|
||||
{
|
||||
// Note: We have noticed some bad data issue in internal assets. The parameters could contain \r\n inside of the parameter string, which would result in the mirror type missing.
|
||||
// Those are already been fixed in the command line object code, but we don't want to support the bad data in here by creating another loophole. Instead, we want the user to fix
|
||||
|
||||
@@ -314,7 +314,7 @@ namespace MCommon
|
||||
// render the given types of AABBs of a actor instance
|
||||
void RenderUtil::RenderAabbs(EMotionFX::ActorInstance* actorInstance, const AABBRenderSettings& renderSettings, bool directlyRender)
|
||||
{
|
||||
const uint32 lodLevel = actorInstance->GetLODLevel();
|
||||
const size_t lodLevel = actorInstance->GetLODLevel();
|
||||
|
||||
// handle the node based AABB
|
||||
if (renderSettings.mNodeBasedAABB)
|
||||
@@ -365,19 +365,19 @@ namespace MCommon
|
||||
|
||||
|
||||
// render a simple line based skeleton
|
||||
void RenderUtil::RenderSimpleSkeleton(EMotionFX::ActorInstance* actorInstance, const AZStd::unordered_set<AZ::u32>* visibleJointIndices,
|
||||
const AZStd::unordered_set<AZ::u32>* selectedJointIndices, const MCore::RGBAColor& color, const MCore::RGBAColor& selectedColor,
|
||||
void RenderUtil::RenderSimpleSkeleton(EMotionFX::ActorInstance* actorInstance, const AZStd::unordered_set<size_t>* visibleJointIndices,
|
||||
const AZStd::unordered_set<size_t>* selectedJointIndices, const MCore::RGBAColor& color, const MCore::RGBAColor& selectedColor,
|
||||
float jointSphereRadius, bool directlyRender)
|
||||
{
|
||||
const EMotionFX::Actor* actor = actorInstance->GetActor();
|
||||
const EMotionFX::Skeleton* skeleton = actor->GetSkeleton();
|
||||
const EMotionFX::Pose* pose = actorInstance->GetTransformData()->GetCurrentPose();
|
||||
|
||||
const uint32 numNodes = actorInstance->GetNumEnabledNodes();
|
||||
for (uint32 n = 0; n < numNodes; ++n)
|
||||
const size_t numNodes = actorInstance->GetNumEnabledNodes();
|
||||
for (size_t n = 0; n < numNodes; ++n)
|
||||
{
|
||||
const EMotionFX::Node* joint = skeleton->GetNode(actorInstance->GetEnabledNode(n));
|
||||
const AZ::u32 jointIndex = joint->GetNodeIndex();
|
||||
const size_t jointIndex = joint->GetNodeIndex();
|
||||
|
||||
if (!visibleJointIndices || visibleJointIndices->empty() ||
|
||||
(visibleJointIndices->find(jointIndex) != visibleJointIndices->end()))
|
||||
@@ -385,8 +385,8 @@ namespace MCommon
|
||||
const AZ::Vector3 currentJointPos = pose->GetWorldSpaceTransform(jointIndex).mPosition;
|
||||
const bool jointSelected = selectedJointIndices->find(jointIndex) != selectedJointIndices->end();
|
||||
|
||||
const AZ::u32 parentIndex = joint->GetParentIndex();
|
||||
if (parentIndex != MCORE_INVALIDINDEX32)
|
||||
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;
|
||||
@@ -419,7 +419,7 @@ namespace MCommon
|
||||
AZ::Vector3* normals = (AZ::Vector3*)mesh->FindVertexData(EMotionFX::Mesh::ATTRIB_NORMALS);
|
||||
MCore::RGBAColor* vertexColors = (MCore::RGBAColor*)mesh->FindVertexData(EMotionFX::Mesh::ATTRIB_COLORS128);
|
||||
|
||||
const uint32 numSubMeshes = mesh->GetNumSubMeshes();
|
||||
const size_t numSubMeshes = mesh->GetNumSubMeshes();
|
||||
for (uint32 subMeshIndex = 0; subMeshIndex < numSubMeshes; ++subMeshIndex)
|
||||
{
|
||||
EMotionFX::SubMesh* subMesh = mesh->GetSubMesh(subMeshIndex);
|
||||
@@ -481,7 +481,7 @@ namespace MCommon
|
||||
// render face normals
|
||||
if (faceNormals)
|
||||
{
|
||||
const uint32 numSubMeshes = mesh->GetNumSubMeshes();
|
||||
const size_t numSubMeshes = mesh->GetNumSubMeshes();
|
||||
for (uint32 subMeshIndex = 0; subMeshIndex < numSubMeshes; ++subMeshIndex)
|
||||
{
|
||||
EMotionFX::SubMesh* subMesh = mesh->GetSubMesh(subMeshIndex);
|
||||
@@ -513,7 +513,7 @@ namespace MCommon
|
||||
// render vertex normals
|
||||
if (vertexNormals)
|
||||
{
|
||||
const uint32 numSubMeshes = mesh->GetNumSubMeshes();
|
||||
const size_t numSubMeshes = mesh->GetNumSubMeshes();
|
||||
for (uint32 subMeshIndex = 0; subMeshIndex < numSubMeshes; ++subMeshIndex)
|
||||
{
|
||||
EMotionFX::SubMesh* subMesh = mesh->GetSubMesh(subMeshIndex);
|
||||
@@ -634,11 +634,11 @@ namespace MCommon
|
||||
EMotionFX::TransformData* transformData = actorInstance->GetTransformData();
|
||||
const EMotionFX::Pose* pose = transformData->GetCurrentPose();
|
||||
|
||||
const uint32 nodeIndex = node->GetNodeIndex();
|
||||
const uint32 parentIndex = node->GetParentIndex();
|
||||
const size_t nodeIndex = node->GetNodeIndex();
|
||||
const size_t parentIndex = node->GetParentIndex();
|
||||
const AZ::Vector3 nodeWorldPos = pose->GetWorldSpaceTransform(nodeIndex).mPosition;
|
||||
|
||||
if (parentIndex != MCORE_INVALIDINDEX32)
|
||||
if (parentIndex != InvalidIndex)
|
||||
{
|
||||
const AZ::Vector3 parentWorldPos = pose->GetWorldSpaceTransform(parentIndex).mPosition;
|
||||
const AZ::Vector3 bone = parentWorldPos - nodeWorldPos;
|
||||
@@ -653,7 +653,7 @@ namespace MCommon
|
||||
|
||||
|
||||
// render the advanced skeleton
|
||||
void RenderUtil::RenderSkeleton(EMotionFX::ActorInstance* actorInstance, const AZStd::vector<size_t>& boneList, const AZStd::unordered_set<AZ::u32>* visibleJointIndices, const AZStd::unordered_set<AZ::u32>* selectedJointIndices, const MCore::RGBAColor& color, const MCore::RGBAColor& selectedColor)
|
||||
void RenderUtil::RenderSkeleton(EMotionFX::ActorInstance* actorInstance, const AZStd::vector<size_t>& boneList, const AZStd::unordered_set<size_t>* visibleJointIndices, const AZStd::unordered_set<size_t>* selectedJointIndices, const MCore::RGBAColor& color, const MCore::RGBAColor& selectedColor)
|
||||
{
|
||||
// check if our render util supports rendering meshes, if not render the fallback skeleton using lines only
|
||||
if (GetIsMeshRenderingSupported() == false)
|
||||
@@ -715,7 +715,7 @@ namespace MCommon
|
||||
|
||||
|
||||
// render node orientations
|
||||
void RenderUtil::RenderNodeOrientations(EMotionFX::ActorInstance* actorInstance, const AZStd::vector<size_t>& boneList, const AZStd::unordered_set<AZ::u32>* visibleJointIndices, const AZStd::unordered_set<AZ::u32>* selectedJointIndices, float scale, bool scaleBonesOnLength)
|
||||
void RenderUtil::RenderNodeOrientations(EMotionFX::ActorInstance* actorInstance, const AZStd::vector<size_t>& boneList, const AZStd::unordered_set<size_t>* visibleJointIndices, const AZStd::unordered_set<size_t>* selectedJointIndices, float scale, bool scaleBonesOnLength)
|
||||
{
|
||||
// get the actor and the transform data
|
||||
const float unitScale = 1.0f / (float)MCore::Distance::ConvertValue(1.0f, MCore::Distance::UNITTYPE_METERS, EMotionFX::GetEMotionFX().GetUnitType());
|
||||
@@ -775,11 +775,11 @@ namespace MCommon
|
||||
AxisRenderingSettings axisRenderingSettings;
|
||||
|
||||
// iterate through all enabled nodes
|
||||
const uint32 numEnabled = actorInstance->GetNumEnabledNodes();
|
||||
for (uint32 i = 0; i < numEnabled; ++i)
|
||||
const size_t numEnabled = actorInstance->GetNumEnabledNodes();
|
||||
for (size_t i = 0; i < numEnabled; ++i)
|
||||
{
|
||||
EMotionFX::Node* node = skeleton->GetNode(actorInstance->GetEnabledNode(i));
|
||||
const uint32 nodeIndex = node->GetNodeIndex();
|
||||
const size_t nodeIndex = node->GetNodeIndex();
|
||||
|
||||
// render node orientation
|
||||
const EMotionFX::Transform worldTransform = pose->GetWorldSpaceTransform(nodeIndex);
|
||||
@@ -789,8 +789,8 @@ namespace MCommon
|
||||
|
||||
// skip root nodes for the line based skeleton rendering, you could also use curNode->IsRootNode()
|
||||
// but we use the parent index here, as we will reuse it
|
||||
uint32 parentIndex = node->GetParentIndex();
|
||||
if (parentIndex != MCORE_INVALIDINDEX32)
|
||||
size_t parentIndex = node->GetParentIndex();
|
||||
if (parentIndex != InvalidIndex)
|
||||
{
|
||||
const AZ::Vector3 endPos = pose->GetWorldSpaceTransform(parentIndex).mPosition;
|
||||
RenderLine(worldTransform.mPosition, endPos, color);
|
||||
@@ -1582,8 +1582,8 @@ namespace MCommon
|
||||
AZ::Aabb finalAABB = AZ::Aabb::CreateNull();
|
||||
|
||||
// get the number of actor instances and iterate through them
|
||||
const uint32 numActorInstances = EMotionFX::GetActorManager().GetNumActorInstances();
|
||||
for (uint32 i = 0; i < numActorInstances; ++i)
|
||||
const size_t numActorInstances = EMotionFX::GetActorManager().GetNumActorInstances();
|
||||
for (size_t i = 0; i < numActorInstances; ++i)
|
||||
{
|
||||
// get the actor instance and update its transformations and meshes
|
||||
EMotionFX::ActorInstance* actorInstance = EMotionFX::GetActorManager().GetActorInstance(i);
|
||||
@@ -1673,10 +1673,10 @@ namespace MCommon
|
||||
void RenderUtil::RenderTrajectory(EMotionFX::ActorInstance* actorInstance, const MCore::RGBAColor& innerColor, const MCore::RGBAColor& borderColor, float scale)
|
||||
{
|
||||
EMotionFX::Actor* actor = actorInstance->GetActor();
|
||||
const uint32 nodeIndex = actor->GetMotionExtractionNodeIndex();
|
||||
const size_t nodeIndex = actor->GetMotionExtractionNodeIndex();
|
||||
|
||||
// in case the motion extraction node is not set, return directly
|
||||
if (nodeIndex == MCORE_INVALIDINDEX32)
|
||||
if (nodeIndex == InvalidIndex)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -1710,7 +1710,7 @@ namespace MCommon
|
||||
|
||||
// fast access to the trajectory trace particles
|
||||
const AZStd::vector<MCommon::RenderUtil::TrajectoryPathParticle>& traceParticles = trajectoryPath->mTraceParticles;
|
||||
const int32 numTraceParticles = traceParticles.size();
|
||||
const size_t numTraceParticles = traceParticles.size();
|
||||
if (traceParticles.empty())
|
||||
{
|
||||
return;
|
||||
@@ -1781,7 +1781,7 @@ namespace MCommon
|
||||
MCore::RGBAColor color = innerColor;
|
||||
|
||||
// render the path from the arrow head towards the tail
|
||||
for (int32 i = numTraceParticles - 1; i > 0; i--)
|
||||
for (size_t i = numTraceParticles - 1; i > 0; i--)
|
||||
{
|
||||
// calculate the normalized distance to the head, this value also represents the alpha value as it fades away while getting closer to the end
|
||||
float normalizedDistance = (float)i / numTraceParticles;
|
||||
@@ -1883,18 +1883,18 @@ namespace MCommon
|
||||
|
||||
|
||||
// render node names for all enabled nodes
|
||||
void RenderUtil::RenderNodeNames(EMotionFX::ActorInstance* actorInstance, Camera* camera, uint32 screenWidth, uint32 screenHeight, const MCore::RGBAColor& color, const MCore::RGBAColor& selectedColor, const AZStd::unordered_set<AZ::u32>& visibleJointIndices, const AZStd::unordered_set<AZ::u32>& selectedJointIndices)
|
||||
void RenderUtil::RenderNodeNames(EMotionFX::ActorInstance* actorInstance, Camera* camera, uint32 screenWidth, uint32 screenHeight, const MCore::RGBAColor& color, const MCore::RGBAColor& selectedColor, const AZStd::unordered_set<size_t>& visibleJointIndices, const AZStd::unordered_set<size_t>& selectedJointIndices)
|
||||
{
|
||||
const EMotionFX::Actor* actor = actorInstance->GetActor();
|
||||
const EMotionFX::Skeleton* skeleton = actor->GetSkeleton();
|
||||
const EMotionFX::TransformData* transformData = actorInstance->GetTransformData();
|
||||
const EMotionFX::Pose* pose = transformData->GetCurrentPose();
|
||||
const AZ::u32 numEnabledNodes = actorInstance->GetNumEnabledNodes();
|
||||
const size_t numEnabledNodes = actorInstance->GetNumEnabledNodes();
|
||||
|
||||
for (uint32 i = 0; i < numEnabledNodes; ++i)
|
||||
for (size_t i = 0; i < numEnabledNodes; ++i)
|
||||
{
|
||||
const EMotionFX::Node* joint = skeleton->GetNode(actorInstance->GetEnabledNode(i));
|
||||
const AZ::u32 jointIndex = joint->GetNodeIndex();
|
||||
const size_t jointIndex = joint->GetNodeIndex();
|
||||
const AZ::Vector3 worldPos = pose->GetWorldSpaceTransform(jointIndex).mPosition;
|
||||
|
||||
// check if the current enabled node is along the visible nodes and render it if that is the case
|
||||
|
||||
@@ -177,7 +177,7 @@ namespace MCommon
|
||||
* @param[in] directlyRender Will call the RenderLines() function internally in case it is set to true. If false
|
||||
* you have to make sure to call RenderLines() manually at the end of your custom render frame function.
|
||||
*/
|
||||
void RenderSimpleSkeleton(EMotionFX::ActorInstance* actorInstance, const AZStd::unordered_set<AZ::u32>* visibleJointIndices = nullptr, const AZStd::unordered_set<AZ::u32>* selectedJointIndices = nullptr,
|
||||
void RenderSimpleSkeleton(EMotionFX::ActorInstance* actorInstance, const AZStd::unordered_set<size_t>* visibleJointIndices = nullptr, const AZStd::unordered_set<size_t>* selectedJointIndices = nullptr,
|
||||
const MCore::RGBAColor& color = MCore::RGBAColor(1.0f, 1.0f, 0.0f, 1.0f), const MCore::RGBAColor& selectedColor = MCore::RGBAColor(1.0f, 0.647f, 0.0f),
|
||||
float jointSphereRadius = 0.1f, bool directlyRender = false);
|
||||
|
||||
@@ -191,7 +191,7 @@ namespace MCommon
|
||||
* @param[in] color The desired skeleton color.
|
||||
* @param[in] selectedColor The color of the selected bones.
|
||||
*/
|
||||
void RenderSkeleton(EMotionFX::ActorInstance* actorInstance, const AZStd::vector<size_t>& boneList, const AZStd::unordered_set<AZ::u32>* visibleJointIndices = nullptr, const AZStd::unordered_set<AZ::u32>* selectedJointIndices = nullptr, const MCore::RGBAColor& color = MCore::RGBAColor(1.0f, 0.0f, 0.0f, 1.0f), const MCore::RGBAColor& selectedColor = MCore::RGBAColor(1.0f, 0.647f, 0.0f));
|
||||
void RenderSkeleton(EMotionFX::ActorInstance* actorInstance, const AZStd::vector<size_t>& boneList, const AZStd::unordered_set<size_t>* visibleJointIndices = nullptr, const AZStd::unordered_set<size_t>* selectedJointIndices = nullptr, const MCore::RGBAColor& color = MCore::RGBAColor(1.0f, 0.0f, 0.0f, 1.0f), const MCore::RGBAColor& selectedColor = MCore::RGBAColor(1.0f, 0.647f, 0.0f));
|
||||
|
||||
/**
|
||||
* Render node orientations.
|
||||
@@ -202,7 +202,7 @@ namespace MCommon
|
||||
* @param[in] scale The scaling value in units. Axes of normal nodes will use the scaling value as unit length, skinned bones will use the scaling value as multiplier.
|
||||
* @param[in] scaleBonesOnLength Automatically scales the bone orientations based on the bone length. This means finger node orientations will be rendered smaller than foot bones as the bone length is a lot smaller as well.
|
||||
*/
|
||||
void RenderNodeOrientations(EMotionFX::ActorInstance* actorInstance, const AZStd::vector<size_t>& boneList, const AZStd::unordered_set<AZ::u32>* visibleJointIndices = nullptr, const AZStd::unordered_set<AZ::u32>* selectedJointIndices = nullptr, float scale = 1.0f, bool scaleBonesOnLength = true);
|
||||
void RenderNodeOrientations(EMotionFX::ActorInstance* actorInstance, const AZStd::vector<size_t>& boneList, const AZStd::unordered_set<size_t>* visibleJointIndices = nullptr, const AZStd::unordered_set<size_t>* selectedJointIndices = nullptr, float scale = 1.0f, bool scaleBonesOnLength = true);
|
||||
|
||||
/**
|
||||
* Render the bind pose of the given actor.
|
||||
@@ -224,7 +224,7 @@ namespace MCommon
|
||||
* @param[in] visibleJointIndices List of visible joint indices. nullptr in case all joints should be rendered.
|
||||
* @param[in] selectedJointIndices List of selected joint indices. nullptr in case selection should not be considered.
|
||||
*/
|
||||
void RenderNodeNames(EMotionFX::ActorInstance* actorInstance, MCommon::Camera* camera, uint32 screenWidth, uint32 screenHeight, const MCore::RGBAColor& color, const MCore::RGBAColor& selectedColor, const AZStd::unordered_set<AZ::u32>& visibleJointIndices, const AZStd::unordered_set<AZ::u32>& selectedJointIndices);
|
||||
void RenderNodeNames(EMotionFX::ActorInstance* actorInstance, MCommon::Camera* camera, uint32 screenWidth, uint32 screenHeight, const MCore::RGBAColor& color, const MCore::RGBAColor& selectedColor, const AZStd::unordered_set<size_t>& visibleJointIndices, const AZStd::unordered_set<size_t>& selectedJointIndices);
|
||||
|
||||
/**
|
||||
* Render a sphere.
|
||||
|
||||
@@ -56,42 +56,36 @@ namespace RenderGL
|
||||
// get rid of the allocated memory
|
||||
void GLActor::Cleanup()
|
||||
{
|
||||
uint32 i;
|
||||
|
||||
// get rid of all index and vertex buffers
|
||||
for (uint32 a = 0; a < 3; ++a)
|
||||
for (AZStd::vector<VertexBuffer*>& vertexBuffers : mVertexBuffers)
|
||||
{
|
||||
// get rid of the given vertex buffers
|
||||
const uint32 numVertexBuffers = mVertexBuffers[a].size();
|
||||
for (i = 0; i < numVertexBuffers; ++i)
|
||||
for (VertexBuffer* vertexBuffer : vertexBuffers)
|
||||
{
|
||||
delete mVertexBuffers[a][i];
|
||||
delete vertexBuffer;
|
||||
}
|
||||
|
||||
// get rid of the given index buffers
|
||||
const uint32 numIndexBuffers = mIndexBuffers[a].size();
|
||||
for (i = 0; i < numIndexBuffers; ++i)
|
||||
}
|
||||
for (AZStd::vector<IndexBuffer*>& indexBuffers : mIndexBuffers)
|
||||
{
|
||||
for (IndexBuffer* indexBuffer : indexBuffers)
|
||||
{
|
||||
delete mIndexBuffers[a][i];
|
||||
delete indexBuffer;
|
||||
}
|
||||
}
|
||||
|
||||
// delete all materials
|
||||
const uint32 numLOD = mMaterials.size();
|
||||
for (uint32 l = 0; l < numLOD; l++)
|
||||
for (AZStd::vector<MaterialPrimitives*>& materialsPerLod : mMaterials)
|
||||
{
|
||||
const uint32 numMaterials = mMaterials[l].size();
|
||||
for (uint32 n = 0; n < numMaterials; n++)
|
||||
for (MaterialPrimitives* materialPrimitives : materialsPerLod)
|
||||
{
|
||||
delete mMaterials[l][n]->mMaterial;
|
||||
delete mMaterials[l][n];
|
||||
delete materialPrimitives->mMaterial;
|
||||
delete materialPrimitives;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// customize the classify mesh type function
|
||||
EMotionFX::Mesh::EMeshType GLActor::ClassifyMeshType(EMotionFX::Node* node, EMotionFX::Mesh* mesh, uint32 lodLevel)
|
||||
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);
|
||||
@@ -120,18 +114,19 @@ namespace RenderGL
|
||||
mMaterials.resize(numGeometryLODLevels);
|
||||
|
||||
// resize the vertex and index buffers
|
||||
for (uint32 a = 0; a < 3; ++a)
|
||||
for (AZStd::vector<VertexBuffer*>& vertexBuffers : mVertexBuffers)
|
||||
{
|
||||
mVertexBuffers[a].resize(numGeometryLODLevels);
|
||||
mIndexBuffers[a].resize(numGeometryLODLevels);
|
||||
mPrimitives[a].Resize(numGeometryLODLevels);
|
||||
|
||||
// reset the vertex and index buffers
|
||||
for (uint32 n = 0; n < numGeometryLODLevels; ++n)
|
||||
{
|
||||
mVertexBuffers[a][n] = nullptr;
|
||||
mIndexBuffers [a][n] = nullptr;
|
||||
}
|
||||
vertexBuffers.resize(numGeometryLODLevels);
|
||||
AZStd::fill(begin(vertexBuffers), end(vertexBuffers), nullptr);
|
||||
}
|
||||
for (AZStd::vector<IndexBuffer*>& indexBuffers : mIndexBuffers)
|
||||
{
|
||||
indexBuffers.resize(numGeometryLODLevels);
|
||||
AZStd::fill(begin(indexBuffers), end(indexBuffers), nullptr);
|
||||
}
|
||||
for (MCore::Array2D<Primitive>& primitives : mPrimitives)
|
||||
{
|
||||
primitives.Resize(numGeometryLODLevels);
|
||||
}
|
||||
|
||||
mHomoMaterials.resize(numGeometryLODLevels);
|
||||
@@ -140,7 +135,7 @@ namespace RenderGL
|
||||
EMotionFX::Skeleton* skeleton = actor->GetSkeleton();
|
||||
|
||||
// iterate through the lod levels
|
||||
for (uint32 lodLevel = 0; lodLevel < numGeometryLODLevels; ++lodLevel)
|
||||
for (size_t lodLevel = 0; lodLevel < numGeometryLODLevels; ++lodLevel)
|
||||
{
|
||||
InitMaterials(lodLevel);
|
||||
|
||||
@@ -172,7 +167,7 @@ namespace RenderGL
|
||||
|
||||
// get the number of submeshes and iterate through them
|
||||
const size_t numSubMeshes = mesh->GetNumSubMeshes();
|
||||
for (uint32 s = 0; s < numSubMeshes; ++s)
|
||||
for (size_t s = 0; s < numSubMeshes; ++s)
|
||||
{
|
||||
// get the current submesh
|
||||
EMotionFX::SubMesh* subMesh = mesh->GetSubMesh(s);
|
||||
@@ -212,7 +207,7 @@ namespace RenderGL
|
||||
}
|
||||
|
||||
// create the dynamic vertex buffers
|
||||
const uint32 numDynamicBytes = sizeof(StandardVertex) * totalNumVerts[EMotionFX::Mesh::MESHTYPE_CPU_DEFORMED];
|
||||
const size_t numDynamicBytes = sizeof(StandardVertex) * totalNumVerts[EMotionFX::Mesh::MESHTYPE_CPU_DEFORMED];
|
||||
if (numDynamicBytes > 0)
|
||||
{
|
||||
mVertexBuffers[EMotionFX::Mesh::MESHTYPE_CPU_DEFORMED][lodLevel] = new VertexBuffer();
|
||||
@@ -230,7 +225,7 @@ namespace RenderGL
|
||||
}
|
||||
|
||||
// create the static vertex buffers
|
||||
const uint32 numStaticBytes = sizeof(StandardVertex) * totalNumVerts[EMotionFX::Mesh::MESHTYPE_STATIC];
|
||||
const size_t numStaticBytes = sizeof(StandardVertex) * totalNumVerts[EMotionFX::Mesh::MESHTYPE_STATIC];
|
||||
if (numStaticBytes > 0)
|
||||
{
|
||||
mVertexBuffers[EMotionFX::Mesh::MESHTYPE_STATIC][lodLevel] = new VertexBuffer();
|
||||
@@ -248,7 +243,7 @@ namespace RenderGL
|
||||
}
|
||||
|
||||
// create the skinned vertex buffers
|
||||
const uint32 numSkinnedBytes = sizeof(SkinnedVertex) * totalNumVerts[EMotionFX::Mesh::MESHTYPE_GPU_DEFORMED];
|
||||
const size_t numSkinnedBytes = sizeof(SkinnedVertex) * totalNumVerts[EMotionFX::Mesh::MESHTYPE_GPU_DEFORMED];
|
||||
if (numSkinnedBytes > 0)
|
||||
{
|
||||
mVertexBuffers[EMotionFX::Mesh::MESHTYPE_GPU_DEFORMED][lodLevel] = new VertexBuffer();
|
||||
@@ -275,7 +270,7 @@ namespace RenderGL
|
||||
if (gpuSkinning)
|
||||
{
|
||||
// iterate through all geometry LOD levels
|
||||
for (uint32 lodLevel = 0; lodLevel < numGeometryLODLevels; ++lodLevel)
|
||||
for (size_t lodLevel = 0; lodLevel < numGeometryLODLevels; ++lodLevel)
|
||||
{
|
||||
// iterate through all nodes
|
||||
for (size_t n = 0; n < numNodes; ++n)
|
||||
@@ -312,8 +307,8 @@ namespace RenderGL
|
||||
EMotionFX::MeshDeformerStack* stack = actor->GetMeshDeformerStack(lodLevel, n);
|
||||
if (stack)
|
||||
{
|
||||
const uint32 numDeformers = stack->GetNumDeformers();
|
||||
for (uint32 d=0; d<numDeformers; ++d)
|
||||
const size_t numDeformers = stack->GetNumDeformers();
|
||||
for (size_t d=0; d<numDeformers; ++d)
|
||||
{
|
||||
EMotionFX::MeshDeformer* deformer = stack->GetDeformer(d);
|
||||
deformer->SetIsEnabled(false);
|
||||
@@ -356,11 +351,11 @@ namespace RenderGL
|
||||
|
||||
|
||||
// initialize materials
|
||||
void GLActor::InitMaterials(uint32 lodLevel)
|
||||
void GLActor::InitMaterials(size_t lodLevel)
|
||||
{
|
||||
// get the number of materials and iterate through them
|
||||
const uint32 numMaterials = mActor->GetNumMaterials(lodLevel);
|
||||
for (uint32 m = 0; m < numMaterials; ++m)
|
||||
const size_t numMaterials = mActor->GetNumMaterials(lodLevel);
|
||||
for (size_t m = 0; m < numMaterials; ++m)
|
||||
{
|
||||
EMotionFX::Material* emfxMaterial = mActor->GetMaterial(lodLevel, m);
|
||||
Material* material = InitMaterial(emfxMaterial);
|
||||
@@ -402,8 +397,8 @@ namespace RenderGL
|
||||
// render meshes of the given type
|
||||
void GLActor::RenderMeshes(EMotionFX::ActorInstance* actorInstance, EMotionFX::Mesh::EMeshType meshType, uint32 renderFlags)
|
||||
{
|
||||
const uint32 lodLevel = actorInstance->GetLODLevel();
|
||||
const uint32 numMaterials = mMaterials[lodLevel].size();
|
||||
const size_t lodLevel = actorInstance->GetLODLevel();
|
||||
const size_t numMaterials = mMaterials[lodLevel].size();
|
||||
|
||||
if (numMaterials == 0)
|
||||
{
|
||||
@@ -425,11 +420,9 @@ namespace RenderGL
|
||||
mIndexBuffers[meshType][lodLevel]->Activate();
|
||||
|
||||
// render all the primitives in each material
|
||||
for (uint32 n = 0; n < numMaterials; n++)
|
||||
for (const MaterialPrimitives* materialPrims : mMaterials[lodLevel])
|
||||
{
|
||||
const MaterialPrimitives* materialPrims = mMaterials[lodLevel][n];
|
||||
const uint32 numPrimitives = materialPrims->mPrimitives[meshType].size();
|
||||
if (numPrimitives == 0)
|
||||
if (materialPrims->mPrimitives[meshType].empty())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -450,9 +443,9 @@ namespace RenderGL
|
||||
material->Activate(activationFlags);
|
||||
|
||||
// render all primitives
|
||||
for (uint32 i = 0; i < numPrimitives; ++i)
|
||||
for (const Primitive& primitive : materialPrims->mPrimitives[meshType])
|
||||
{
|
||||
material->Render(actorInstance, &materialPrims->mPrimitives[meshType][i]);
|
||||
material->Render(actorInstance, &primitive);
|
||||
}
|
||||
|
||||
material->Deactivate();
|
||||
@@ -464,7 +457,7 @@ namespace RenderGL
|
||||
void GLActor::UpdateDynamicVertices(EMotionFX::ActorInstance* actorInstance)
|
||||
{
|
||||
// get the number of dynamic nodes
|
||||
const uint32 lodLevel = actorInstance->GetLODLevel();
|
||||
const size_t lodLevel = actorInstance->GetLODLevel();
|
||||
const size_t numNodes = mDynamicNodes.GetNumElements(lodLevel);
|
||||
if (numNodes == 0)
|
||||
{
|
||||
@@ -491,7 +484,7 @@ namespace RenderGL
|
||||
{
|
||||
// get the node and its mesh
|
||||
const size_t nodeIndex = mDynamicNodes.GetElement(lodLevel, n);
|
||||
EMotionFX::Mesh* mesh = mActor->GetMesh(lodLevel, aznumeric_cast<uint32>(nodeIndex));
|
||||
EMotionFX::Mesh* mesh = mActor->GetMesh(lodLevel, nodeIndex);
|
||||
|
||||
// is the mesh valid?
|
||||
if (mesh == nullptr)
|
||||
@@ -536,7 +529,7 @@ namespace RenderGL
|
||||
|
||||
|
||||
// fill the index buffers with data
|
||||
void GLActor::FillIndexBuffers(uint32 lodLevel)
|
||||
void GLActor::FillIndexBuffers(size_t lodLevel)
|
||||
{
|
||||
// initialize the index buffers
|
||||
uint32* staticIndices = nullptr;
|
||||
@@ -597,7 +590,6 @@ namespace RenderGL
|
||||
}
|
||||
|
||||
// get the mesh type and the indices
|
||||
//const uint32 numIndices = mesh->GetNumIndices();
|
||||
uint32* indices = mesh->GetIndices();
|
||||
uint8* vertCounts = mesh->GetPolygonVertexCounts();
|
||||
EMotionFX::Mesh::EMeshType meshType = ClassifyMeshType(node, mesh, lodLevel);
|
||||
@@ -621,9 +613,6 @@ namespace RenderGL
|
||||
polyStartIndex += numPolyVerts;
|
||||
}
|
||||
|
||||
//for (uint32 i=0; i<numIndices; ++i)
|
||||
//dynamicIndices[totalNumDynamicIndices++] = indices[i] + dynamicOffset;
|
||||
|
||||
dynamicOffset += mesh->GetNumVertices();
|
||||
break;
|
||||
}
|
||||
@@ -644,10 +633,6 @@ namespace RenderGL
|
||||
polyStartIndex += numPolyVerts;
|
||||
}
|
||||
|
||||
// fill in static index buffers
|
||||
//for (uint32 i=0; i<numIndices; ++i)
|
||||
//staticIndices[totalNumStaticIndices++] = indices[i] + staticOffset;
|
||||
|
||||
staticOffset += mesh->GetNumVertices();
|
||||
break;
|
||||
}
|
||||
@@ -668,10 +653,6 @@ namespace RenderGL
|
||||
polyStartIndex += numPolyVerts;
|
||||
}
|
||||
|
||||
// fill in gpu skinned index buffers
|
||||
//for (uint32 i=0; i<numIndices; ++i)
|
||||
//skinnedIndices[totalNumSkinnedIndices++] = indices[i] + gpuSkinnedOffset;
|
||||
|
||||
gpuSkinnedOffset += mesh->GetNumVertices();
|
||||
break;
|
||||
}
|
||||
@@ -695,7 +676,7 @@ namespace RenderGL
|
||||
|
||||
|
||||
// fill the static vertex buffer
|
||||
void GLActor::FillStaticVertexBuffers(uint32 lodLevel)
|
||||
void GLActor::FillStaticVertexBuffers(size_t lodLevel)
|
||||
{
|
||||
if (mVertexBuffers[EMotionFX::Mesh::MESHTYPE_STATIC][lodLevel] == nullptr)
|
||||
{
|
||||
@@ -785,7 +766,7 @@ namespace RenderGL
|
||||
|
||||
|
||||
// fill the GPU skinned vertex buffer
|
||||
void GLActor::FillGPUSkinnedVertexBuffers(uint32 lodLevel)
|
||||
void GLActor::FillGPUSkinnedVertexBuffers(size_t lodLevel)
|
||||
{
|
||||
if (mVertexBuffers[EMotionFX::Mesh::MESHTYPE_GPU_DEFORMED][lodLevel] == nullptr)
|
||||
{
|
||||
@@ -849,8 +830,8 @@ namespace RenderGL
|
||||
assert(skinningInfo);
|
||||
|
||||
// get the number of submeshes and iterate through them
|
||||
const uint32 numSubMeshes = mesh->GetNumSubMeshes();
|
||||
for (uint32 s = 0; s < numSubMeshes; ++s)
|
||||
const size_t numSubMeshes = mesh->GetNumSubMeshes();
|
||||
for (size_t s = 0; s < numSubMeshes; ++s)
|
||||
{
|
||||
// get the current submesh and the start vertex
|
||||
EMotionFX::SubMesh* subMesh = mesh->GetSubMesh(s);
|
||||
@@ -877,9 +858,9 @@ 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();
|
||||
const uint32 boneIndex = subMesh->FindBoneIndex(influence->GetNodeNr());
|
||||
const size_t boneIndex = subMesh->FindBoneIndex(influence->GetNodeNr());
|
||||
skinnedVertices[globalVert].mBoneIndices[i] = static_cast<float>(boneIndex);
|
||||
MCORE_ASSERT(boneIndex != MCORE_INVALIDINDEX32);
|
||||
MCORE_ASSERT(boneIndex != InvalidIndex);
|
||||
}
|
||||
|
||||
// reset remaining weights and offsets
|
||||
|
||||
@@ -37,16 +37,11 @@ namespace RenderGL
|
||||
|
||||
mCurrentLineVB = 0;
|
||||
|
||||
for (uint32 i = 0; i < MAX_LINE_VERTEXBUFFERS; ++i)
|
||||
{
|
||||
mLineVertexBuffers[i] = nullptr;
|
||||
}
|
||||
|
||||
// initialize the vertex buffers and the shader used for line rendering
|
||||
for (uint32 i = 0; i < MAX_LINE_VERTEXBUFFERS; ++i)
|
||||
for (VertexBuffer*& lineVertexBuffer : mLineVertexBuffers)
|
||||
{
|
||||
mLineVertexBuffers[i] = new VertexBuffer();
|
||||
if (mLineVertexBuffers[i]->Init(sizeof(LineVertex), mNumMaxLineVertices, USAGE_DYNAMIC) == false)
|
||||
lineVertexBuffer = new VertexBuffer();
|
||||
if (lineVertexBuffer->Init(sizeof(LineVertex), mNumMaxLineVertices, USAGE_DYNAMIC) == false)
|
||||
{
|
||||
MCore::LogError("[OpenGL] Failed to create render utility line vertex buffer.");
|
||||
CleanUp();
|
||||
@@ -139,10 +134,10 @@ namespace RenderGL
|
||||
// destroy the allocated memory
|
||||
void GLRenderUtil::CleanUp()
|
||||
{
|
||||
for (uint32 i = 0; i < MAX_LINE_VERTEXBUFFERS; ++i)
|
||||
for (VertexBuffer*& lineVertexBuffer : mLineVertexBuffers)
|
||||
{
|
||||
delete mLineVertexBuffers[i];
|
||||
mLineVertexBuffers[i] = nullptr;
|
||||
delete lineVertexBuffer;
|
||||
lineVertexBuffer = nullptr;
|
||||
}
|
||||
|
||||
delete mMeshVertexBuffer;
|
||||
@@ -163,10 +158,9 @@ namespace RenderGL
|
||||
delete[] mTextures;
|
||||
|
||||
// get rid of texture entries
|
||||
const uint32 numTextEntries = mTextEntries.size();
|
||||
for (uint32 i = 0; i < numTextEntries; ++i)
|
||||
for (TextEntry* mTextEntrie : mTextEntries)
|
||||
{
|
||||
delete mTextEntries[i];
|
||||
delete mTextEntrie;
|
||||
}
|
||||
mTextEntries.clear();
|
||||
}
|
||||
@@ -244,9 +238,6 @@ namespace RenderGL
|
||||
|
||||
glPopAttrib();
|
||||
|
||||
//const float renderTime = time.GetTime();
|
||||
//LOG("numTextures=%i, renderTime=%.3fms", mNumTextures, renderTime*1000);
|
||||
|
||||
mNumTextures = 0;
|
||||
}
|
||||
|
||||
@@ -491,7 +482,7 @@ namespace RenderGL
|
||||
glDisable(GL_CULL_FACE);
|
||||
|
||||
// get the number of vertices to render
|
||||
const uint32 numVertices = triangleVertices.size();
|
||||
const uint32 numVertices = aznumeric_caster(triangleVertices.size());
|
||||
MCORE_ASSERT(numVertices <= mNumMaxTriangleVertices);
|
||||
|
||||
// lock the vertex buffer
|
||||
|
||||
@@ -74,7 +74,7 @@ namespace RenderGL
|
||||
|
||||
#define MAX_LINE_VERTEXBUFFERS 2
|
||||
GraphicsManager* mGraphicsManager;
|
||||
VertexBuffer* mLineVertexBuffers[MAX_LINE_VERTEXBUFFERS];
|
||||
VertexBuffer* mLineVertexBuffers[MAX_LINE_VERTEXBUFFERS]{};
|
||||
uint16 mCurrentLineVB;
|
||||
GLSLShader* mLineShader;
|
||||
GLSLShader* mMeshShader;
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <AzCore/std/numeric.h>
|
||||
#include <MCore/Source/Config.h>
|
||||
#include <MCore/Source/LogManager.h>
|
||||
#include "GLSLShader.h"
|
||||
@@ -65,17 +66,13 @@ namespace RenderGL
|
||||
// Deactivate
|
||||
void GLSLShader::Deactivate()
|
||||
{
|
||||
const uint32 numAttribs = mActivatedAttribs.size();
|
||||
for (uint32 i = 0; i < numAttribs; ++i)
|
||||
for (const size_t index : mActivatedAttribs)
|
||||
{
|
||||
const uint32 index = mActivatedAttribs[i];
|
||||
glDisableVertexAttribArray(mAttributes[index].mLocation);
|
||||
}
|
||||
|
||||
const uint32 numTextures = mActivatedTextures.size();
|
||||
for (uint32 i = 0; i < numTextures; ++i)
|
||||
for (const size_t index : mActivatedTextures)
|
||||
{
|
||||
const uint32 index = mActivatedTextures[i];
|
||||
assert(mUniforms[index].mType == GL_SAMPLER_2D);
|
||||
glActiveTexture(GL_TEXTURE0 + mUniforms[index].mTextureUnit);
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
@@ -124,10 +121,9 @@ namespace RenderGL
|
||||
text = "#version 120\n";
|
||||
|
||||
// build define string
|
||||
const uint32 numDefines = mDefines.size();
|
||||
for (uint32 n = 0; n < numDefines; ++n)
|
||||
for (const AZStd::string& define : mDefines)
|
||||
{
|
||||
text += AZStd::string::format("#define %s\n", mDefines[n].c_str());
|
||||
text += AZStd::string::format("#define %s\n", define.c_str());
|
||||
}
|
||||
|
||||
// read file into a big string
|
||||
@@ -175,20 +171,16 @@ namespace RenderGL
|
||||
AZStd::invoke(func, static_cast<QOpenGLExtraFunctions*>(this), object, logLen, &logWritten, text.data());
|
||||
|
||||
// if there are any defines, print that out too
|
||||
if (mDefines.size() > 0)
|
||||
if (!mDefines.empty())
|
||||
{
|
||||
AZStd::string dStr;
|
||||
const uint32 numDefines = mDefines.size();
|
||||
for (uint32 n = 0; n < numDefines; ++n)
|
||||
for (const AZStd::string& define : mDefines)
|
||||
{
|
||||
if (n < numDefines - 1)
|
||||
if (!dStr.empty())
|
||||
{
|
||||
dStr += mDefines[n] + " ";
|
||||
}
|
||||
else
|
||||
{
|
||||
dStr += mDefines[n];
|
||||
dStr.append(" ");
|
||||
}
|
||||
dStr.append(define);
|
||||
}
|
||||
|
||||
MCore::LogDetailedInfo("[GLSL] Compiling shader '%s', with defines %s", mFileName.c_str(), dStr.c_str());
|
||||
@@ -260,8 +252,8 @@ namespace RenderGL
|
||||
// FindAttribute
|
||||
GLSLShader::ShaderParameter* GLSLShader::FindAttribute(const char* name)
|
||||
{
|
||||
const uint32 index = FindAttributeIndex(name);
|
||||
if (index == MCORE_INVALIDINDEX32)
|
||||
const size_t index = FindAttributeIndex(name);
|
||||
if (index == InvalidIndex)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
@@ -273,20 +265,16 @@ namespace RenderGL
|
||||
// FindAttributeIndex
|
||||
size_t GLSLShader::FindAttributeIndex(const char* name)
|
||||
{
|
||||
const uint32 numAttribs = mAttributes.size();
|
||||
for (uint32 i = 0; i < numAttribs; ++i)
|
||||
const auto foundAttribute = AZStd::find_if(begin(mAttributes), end(mAttributes), [name](const auto& attribute)
|
||||
{
|
||||
if (AzFramework::StringFunc::Equal(mAttributes[i].mName.c_str(), name, false /* no case */))
|
||||
{
|
||||
return AzFramework::StringFunc::Equal(attribute.mName.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
|
||||
if (mAttributes[i].mLocation >= 0)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
|
||||
return MCORE_INVALIDINDEX32;
|
||||
}
|
||||
attribute.mLocation >= 0;
|
||||
});
|
||||
if (foundAttribute != end(mAttributes))
|
||||
{
|
||||
return AZStd::distance(begin(mAttributes), foundAttribute);
|
||||
}
|
||||
|
||||
// the parameter wasn't cached, try to retrieve it
|
||||
@@ -295,7 +283,7 @@ namespace RenderGL
|
||||
|
||||
if (loc < 0)
|
||||
{
|
||||
return MCORE_INVALIDINDEX32;
|
||||
return InvalidIndex;
|
||||
}
|
||||
|
||||
return mAttributes.size() - 1;
|
||||
@@ -303,12 +291,12 @@ namespace RenderGL
|
||||
|
||||
|
||||
// FindAttributeLocation
|
||||
uint32 GLSLShader::FindAttributeLocation(const char* name)
|
||||
size_t GLSLShader::FindAttributeLocation(const char* name)
|
||||
{
|
||||
ShaderParameter* p = FindAttribute(name);
|
||||
if (p == nullptr)
|
||||
{
|
||||
return MCORE_INVALIDINDEX32;
|
||||
return InvalidIndex;
|
||||
}
|
||||
|
||||
return p->mLocation;
|
||||
@@ -318,8 +306,8 @@ namespace RenderGL
|
||||
// FindUniform
|
||||
GLSLShader::ShaderParameter* GLSLShader::FindUniform(const char* name)
|
||||
{
|
||||
const uint32 index = FindUniformIndex(name);
|
||||
if (index == MCORE_INVALIDINDEX32)
|
||||
const size_t index = FindUniformIndex(name);
|
||||
if (index == InvalidIndex)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
@@ -331,18 +319,14 @@ namespace RenderGL
|
||||
// FindUniformIndex
|
||||
size_t GLSLShader::FindUniformIndex(const char* name)
|
||||
{
|
||||
const uint32 numUniforms = mUniforms.size();
|
||||
for (uint32 i = 0; i < numUniforms; ++i)
|
||||
const auto foundUniform = AZStd::find_if(begin(mUniforms), end(mUniforms), [name](const auto& uniform)
|
||||
{
|
||||
if (AzFramework::StringFunc::Equal(mUniforms[i].mName.c_str(), name, false /* no case */))
|
||||
{
|
||||
if (mUniforms[i].mLocation >= 0)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
|
||||
return MCORE_INVALIDINDEX32;
|
||||
}
|
||||
return AzFramework::StringFunc::Equal(uniform.mName.c_str(), name, false /* no case */) &&
|
||||
uniform.mLocation >= 0;
|
||||
});
|
||||
if (foundUniform != end(mUniforms))
|
||||
{
|
||||
return AZStd::distance(begin(mUniforms), foundUniform);
|
||||
}
|
||||
|
||||
// the parameter wasn't cached, try to retrieve it
|
||||
@@ -351,7 +335,7 @@ namespace RenderGL
|
||||
|
||||
if (loc < 0)
|
||||
{
|
||||
return MCORE_INVALIDINDEX32;
|
||||
return InvalidIndex;
|
||||
}
|
||||
|
||||
return mUniforms.size() - 1;
|
||||
@@ -361,8 +345,8 @@ namespace RenderGL
|
||||
// SetAttribute
|
||||
void GLSLShader::SetAttribute(const char* name, uint32 dim, uint32 type, uint32 stride, size_t offset)
|
||||
{
|
||||
const uint32 index = FindAttributeIndex(name);
|
||||
if (index == MCORE_INVALIDINDEX32)
|
||||
const size_t index = FindAttributeIndex(name);
|
||||
if (index == InvalidIndex)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -503,8 +487,8 @@ namespace RenderGL
|
||||
// SetUniform
|
||||
void GLSLShader::SetUniform(const char* name, Texture* texture)
|
||||
{
|
||||
const uint32 index = FindUniformIndex(name);
|
||||
if (index == MCORE_INVALIDINDEX32)
|
||||
const size_t index = FindUniformIndex(name);
|
||||
if (index == InvalidIndex)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -534,8 +518,8 @@ namespace RenderGL
|
||||
// link a texture to a given uniform
|
||||
void GLSLShader::SetUniformTextureID(const char* name, uint32 textureID)
|
||||
{
|
||||
const uint32 index = FindUniformIndex(name);
|
||||
if (index == MCORE_INVALIDINDEX32)
|
||||
const size_t index = FindUniformIndex(name);
|
||||
if (index == InvalidIndex)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -563,20 +547,12 @@ namespace RenderGL
|
||||
|
||||
|
||||
// check if the given attribute string is defined in the shader
|
||||
bool GLSLShader::CheckIfIsDefined(const char* attributeName)
|
||||
bool GLSLShader::CheckIfIsDefined(const char* attributeName) const
|
||||
{
|
||||
// get the number of defines and iterate through them
|
||||
const uint32 numDefines = mDefines.size();
|
||||
for (uint32 i = 0; i < numDefines; ++i)
|
||||
return AZStd::any_of(begin(mDefines), end(mDefines), [attributeName](const AZStd::string& define)
|
||||
{
|
||||
// compare the given attribute with the current define and return if they are equal
|
||||
if (AzFramework::StringFunc::Equal(mDefines[i].c_str(), attributeName, false /* no case */))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// we haven't found the attribute, return failure
|
||||
return false;
|
||||
return AzFramework::StringFunc::Equal(define.c_str(), attributeName, false /* no case */);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,11 +36,11 @@ namespace RenderGL
|
||||
void Deactivate() override;
|
||||
bool Validate() override;
|
||||
|
||||
uint32 FindAttributeLocation(const char* name);
|
||||
size_t FindAttributeLocation(const char* name);
|
||||
uint32 GetType() const override;
|
||||
|
||||
MCORE_INLINE unsigned int GetProgram() const { return mProgram; }
|
||||
bool CheckIfIsDefined(const char* attributeName);
|
||||
bool CheckIfIsDefined(const char* attributeName) const;
|
||||
|
||||
bool Init(AZ::IO::PathView vertexFileName, AZ::IO::PathView pixelFileName, AZStd::vector<AZStd::string>& defines);
|
||||
void SetAttribute(const char* name, uint32 dim, uint32 type, uint32 stride, size_t offset) override;
|
||||
@@ -84,8 +84,8 @@ namespace RenderGL
|
||||
|
||||
AZ::IO::Path mFileName;
|
||||
|
||||
AZStd::vector<uint32> mActivatedAttribs;
|
||||
AZStd::vector<uint32> mActivatedTextures;
|
||||
AZStd::vector<size_t> mActivatedAttribs;
|
||||
AZStd::vector<size_t> mActivatedTextures;
|
||||
AZStd::vector<ShaderParameter> mUniforms;
|
||||
AZStd::vector<ShaderParameter> mAttributes;
|
||||
AZStd::vector<AZStd::string> mDefines;
|
||||
|
||||
@@ -416,10 +416,9 @@ namespace RenderGL
|
||||
|
||||
// construct the lookup string for the shader cache
|
||||
AZStd::string cacheLookupStr = vertexPath.Native() + pixelPath.Native();
|
||||
const uint32 numDefines = defines.size();
|
||||
for (uint32 n = 0; n < numDefines; n++)
|
||||
for (const AZStd::string& define : defines)
|
||||
{
|
||||
cacheLookupStr += AZStd::string::format("#%s", defines[n].c_str());
|
||||
cacheLookupStr += AZStd::string::format("#%s", define.c_str());
|
||||
}
|
||||
|
||||
// check if the shader is already in the cache
|
||||
|
||||
@@ -30,11 +30,10 @@ namespace RenderGL
|
||||
void ShaderCache::Release()
|
||||
{
|
||||
// delete all shaders
|
||||
const uint32 numEntries = mEntries.size();
|
||||
for (uint32 i = 0; i < numEntries; ++i)
|
||||
for (Entry& entry : mEntries)
|
||||
{
|
||||
mEntries[i].mName.clear();
|
||||
delete mEntries[i].mShader;
|
||||
entry.mName.clear();
|
||||
delete entry.mShader;
|
||||
}
|
||||
|
||||
// clear all entries
|
||||
@@ -52,32 +51,20 @@ namespace RenderGL
|
||||
// try to locate a shader based on its name
|
||||
Shader* ShaderCache::FindShader(AZStd::string_view filename) const
|
||||
{
|
||||
const uint32 numEntries = mEntries.size();
|
||||
for (uint32 i = 0; i < numEntries; ++i)
|
||||
const auto foundShader = AZStd::find_if(begin(mEntries), end(mEntries), [filename](const Entry& entry)
|
||||
{
|
||||
if (AzFramework::StringFunc::Equal(mEntries[i].mName, filename, false /* no case */)) // non-case-sensitive name compare
|
||||
{
|
||||
return mEntries[i].mShader;
|
||||
}
|
||||
}
|
||||
|
||||
// not found
|
||||
return nullptr;
|
||||
return AzFramework::StringFunc::Equal(entry.mName, filename, false /* no case */);
|
||||
});
|
||||
return foundShader != end(mEntries) ? foundShader->mShader : nullptr;
|
||||
}
|
||||
|
||||
|
||||
// check if we have a given shader in the cache
|
||||
bool ShaderCache::CheckIfHasShader(Shader* shader) const
|
||||
{
|
||||
const uint32 numEntries = mEntries.size();
|
||||
for (uint32 i = 0; i < numEntries; ++i)
|
||||
return AZStd::any_of(begin(mEntries), end(mEntries), [shader](const Entry& entry)
|
||||
{
|
||||
if (mEntries[i].mShader == shader)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return entry.mShader == shader;
|
||||
});
|
||||
}
|
||||
} // namespace RenderGL
|
||||
|
||||
@@ -183,8 +183,8 @@ namespace RenderGL
|
||||
EMotionFX::StandardMaterial* stdMaterial = static_cast<EMotionFX::StandardMaterial*>(material);
|
||||
|
||||
// get the number of material layers and iterate through them
|
||||
const uint32 numLayers = stdMaterial->GetNumLayers();
|
||||
for (uint32 i = 0; i < numLayers; ++i)
|
||||
const size_t numLayers = stdMaterial->GetNumLayers();
|
||||
for (size_t i = 0; i < numLayers; ++i)
|
||||
{
|
||||
EMotionFX::StandardMaterialLayer* layer = stdMaterial->GetLayer(i);
|
||||
switch (layer->GetType())
|
||||
@@ -232,11 +232,9 @@ namespace RenderGL
|
||||
//
|
||||
void StandardMaterial::SetAttribute(EAttribute attribute, bool enabled)
|
||||
{
|
||||
const uint32 index = (uint32)attribute;
|
||||
|
||||
if (mAttributes[index] != enabled)
|
||||
if (mAttributes[attribute] != enabled)
|
||||
{
|
||||
mAttributes[index] = enabled;
|
||||
mAttributes[attribute] = enabled;
|
||||
mAttributesUpdated = true;
|
||||
}
|
||||
}
|
||||
@@ -264,15 +262,15 @@ namespace RenderGL
|
||||
const AZ::Matrix3x4* skinningMatrices = transformData->GetSkinningMatrices();
|
||||
|
||||
// multiple each transform by its inverse bind pose
|
||||
const uint32 numBones = primitive->mBoneNodeIndices.size();
|
||||
for (uint32 i = 0; i < numBones; ++i)
|
||||
const size_t numBones = primitive->mBoneNodeIndices.size();
|
||||
for (size_t i = 0; i < numBones; ++i)
|
||||
{
|
||||
const uint32 nodeNr = primitive->mBoneNodeIndices[i];
|
||||
const size_t nodeNr = primitive->mBoneNodeIndices[i];
|
||||
const AZ::Matrix3x4& skinTransform = skinningMatrices[nodeNr];
|
||||
mBoneMatrices[i] = AZ::Matrix4x4::CreateFromMatrix3x4(skinTransform);
|
||||
}
|
||||
|
||||
mActiveShader->SetUniform("matBones", mBoneMatrices, numBones);
|
||||
mActiveShader->SetUniform("matBones", mBoneMatrices, aznumeric_caster(numBones));
|
||||
}
|
||||
|
||||
const MCommon::Camera* camera = GetGraphicsManager()->GetCamera();
|
||||
@@ -305,10 +303,9 @@ namespace RenderGL
|
||||
mActiveShader = nullptr;
|
||||
|
||||
// get the number of shaders and iterate through them
|
||||
const uint32 numShaders = mShaders.size();
|
||||
for (uint32 i = 0; i < numShaders; ++i)
|
||||
for (GLSLShader* shader : mShaders)
|
||||
{
|
||||
if (mShaders[i] == nullptr)
|
||||
if (shader == nullptr)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -319,7 +316,7 @@ namespace RenderGL
|
||||
{
|
||||
if (mAttributes[n])
|
||||
{
|
||||
if (mShaders[i]->CheckIfIsDefined(AttributeToString((EAttribute)n)) == false)
|
||||
if (shader->CheckIfIsDefined(AttributeToString((EAttribute)n)) == false)
|
||||
{
|
||||
match = false;
|
||||
break;
|
||||
@@ -327,7 +324,7 @@ namespace RenderGL
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mShaders[i]->CheckIfIsDefined(AttributeToString((EAttribute)n)))
|
||||
if (shader->CheckIfIsDefined(AttributeToString((EAttribute)n)))
|
||||
{
|
||||
match = false;
|
||||
break;
|
||||
@@ -338,7 +335,7 @@ namespace RenderGL
|
||||
// in case we have found a matching shader update the active shader
|
||||
if (match)
|
||||
{
|
||||
mActiveShader = mShaders[i];
|
||||
mActiveShader = shader;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,10 +73,9 @@ namespace RenderGL
|
||||
void TextureCache::Release()
|
||||
{
|
||||
// delete all textures
|
||||
const uint32 numEntries = mEntries.size();
|
||||
for (uint32 i = 0; i < numEntries; ++i)
|
||||
for (Entry& entry : mEntries)
|
||||
{
|
||||
delete mEntries[i].mTexture;
|
||||
delete entry.mTexture;
|
||||
}
|
||||
|
||||
// clear all entries
|
||||
@@ -102,17 +101,11 @@ namespace RenderGL
|
||||
Texture* TextureCache::FindTexture(const char* filename) const
|
||||
{
|
||||
// get the number of entries and iterate through them
|
||||
const uint32 numEntries = mEntries.size();
|
||||
for (uint32 i = 0; i < numEntries; ++i)
|
||||
const auto foundEntry = AZStd::find_if(begin(mEntries), end(mEntries), [filename](const Entry& entry)
|
||||
{
|
||||
if (AzFramework::StringFunc::Equal(mEntries[i].mName.c_str(), filename, false /* no case */)) // non-case-sensitive name compare
|
||||
{
|
||||
return mEntries[i].mTexture;
|
||||
}
|
||||
}
|
||||
|
||||
// not found
|
||||
return nullptr;
|
||||
return AzFramework::StringFunc::Equal(entry.mName.c_str(), filename, false /* no case */);
|
||||
});
|
||||
return foundEntry != end(mEntries) ? foundEntry->mTexture : nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -120,31 +113,25 @@ namespace RenderGL
|
||||
bool TextureCache::CheckIfHasTexture(Texture* texture) const
|
||||
{
|
||||
// get the number of entries and iterate through them
|
||||
const uint32 numEntries = mEntries.size();
|
||||
for (uint32 i = 0; i < numEntries; ++i)
|
||||
return AZStd::any_of(begin(mEntries), end(mEntries), [texture](const Entry& entry)
|
||||
{
|
||||
if (mEntries[i].mTexture == texture)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return entry.mTexture == texture;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// remove an item from the cache
|
||||
void TextureCache::RemoveTexture(Texture* texture)
|
||||
{
|
||||
const uint32 numEntries = mEntries.size();
|
||||
for (uint32 i = 0; i < numEntries; ++i)
|
||||
const auto foundEntry = AZStd::find_if(begin(mEntries), end(mEntries), [texture](const Entry& entry)
|
||||
{
|
||||
if (mEntries[i].mTexture == texture)
|
||||
{
|
||||
delete mEntries[i].mTexture;
|
||||
mEntries.erase(AZStd::next(begin(mEntries), i));
|
||||
return;
|
||||
}
|
||||
return entry.mTexture == texture;
|
||||
});
|
||||
|
||||
if (foundEntry != end(mEntries))
|
||||
{
|
||||
delete foundEntry->mTexture;
|
||||
mEntries.erase(foundEntry);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -154,12 +141,12 @@ namespace RenderGL
|
||||
GLuint textureID;
|
||||
glGenTextures(1, &textureID);
|
||||
|
||||
uint32 width = 2;
|
||||
uint32 height = 2;
|
||||
constexpr GLsizei width = 2;
|
||||
constexpr GLsizei height = 2;
|
||||
uint32 imageBuffer[4];
|
||||
for (uint32 i = 0; i < 4; ++i)
|
||||
{
|
||||
imageBuffer[i] = MCore::RGBA(255, 255, 255, 255); // actually abgr
|
||||
using AZStd::begin, AZStd::end;
|
||||
AZStd::fill(begin(imageBuffer), end(imageBuffer), MCore::RGBA(255, 255, 255, 255)); // actually abgr
|
||||
}
|
||||
glBindTexture(GL_TEXTURE_2D, textureID);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
@@ -180,12 +167,12 @@ namespace RenderGL
|
||||
GLuint textureID;
|
||||
glGenTextures(1, &textureID);
|
||||
|
||||
uint32 width = 2;
|
||||
uint32 height = 2;
|
||||
constexpr GLsizei width = 2;
|
||||
constexpr GLsizei height = 2;
|
||||
uint32 imageBuffer[4];
|
||||
for (uint32 i = 0; i < 4; ++i)
|
||||
{
|
||||
imageBuffer[i] = MCore::RGBA(255, 128, 128, 255); // opengl wants abgr
|
||||
using AZStd::begin, AZStd::end;
|
||||
AZStd::fill(begin(imageBuffer), end(imageBuffer), MCore::RGBA(255, 128, 128, 255)); // opengl wants abgr
|
||||
}
|
||||
glBindTexture(GL_TEXTURE_2D, textureID);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
|
||||
@@ -75,18 +75,18 @@ namespace RenderGL
|
||||
|
||||
void RenderMeshes(EMotionFX::ActorInstance* actorInstance, EMotionFX::Mesh::EMeshType meshType, uint32 renderFlags);
|
||||
void RenderShadowMap(EMotionFX::Mesh::EMeshType meshType);
|
||||
void InitMaterials(uint32 lodLevel);
|
||||
void InitMaterials(size_t lodLevel);
|
||||
Material* InitMaterial(EMotionFX::Material* emfxMaterial);
|
||||
void FillIndexBuffers(uint32 lodLevel);
|
||||
void FillStaticVertexBuffers(uint32 lodLevel);
|
||||
void FillGPUSkinnedVertexBuffers(uint32 lodLevel);
|
||||
void FillIndexBuffers(size_t lodLevel);
|
||||
void FillStaticVertexBuffers(size_t lodLevel);
|
||||
void FillGPUSkinnedVertexBuffers(size_t lodLevel);
|
||||
|
||||
void UpdateDynamicVertices(EMotionFX::ActorInstance* actorInstance);
|
||||
|
||||
EMotionFX::Mesh::EMeshType ClassifyMeshType(EMotionFX::Node* node, EMotionFX::Mesh* mesh, uint32 lodLevel);
|
||||
EMotionFX::Mesh::EMeshType ClassifyMeshType(EMotionFX::Node* node, EMotionFX::Mesh* mesh, size_t lodLevel);
|
||||
|
||||
AZStd::vector< AZStd::vector<MaterialPrimitives*> > mMaterials;
|
||||
MCore::Array2D<uint32> mDynamicNodes;
|
||||
MCore::Array2D<size_t> mDynamicNodes;
|
||||
MCore::Array2D<Primitive> mPrimitives[3];
|
||||
AZStd::vector<bool> mHomoMaterials;
|
||||
AZStd::vector<VertexBuffer*> mVertexBuffers[3];
|
||||
|
||||
@@ -230,50 +230,35 @@ namespace EMotionFX
|
||||
|
||||
size_t AnimGraphGameControllerSettings::FindPresetIndexByName(const char* presetName) const
|
||||
{
|
||||
const size_t presetCount = m_presets.size();
|
||||
for (size_t i = 0; i < presetCount; ++i)
|
||||
const auto foundPreset = AZStd::find_if(begin(m_presets), end(m_presets), [presetName](const Preset* preset)
|
||||
{
|
||||
if (m_presets[i]->GetNameString() == presetName)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
// return failure
|
||||
return MCORE_INVALIDINDEX32;
|
||||
return preset->GetNameString() == presetName;
|
||||
});
|
||||
return foundPreset != end(m_presets) ? AZStd::distance(begin(m_presets), foundPreset) : InvalidIndex;
|
||||
}
|
||||
|
||||
|
||||
size_t AnimGraphGameControllerSettings::FindPresetIndex(Preset* preset) const
|
||||
{
|
||||
const size_t presetCount = m_presets.size();
|
||||
for (size_t i = 0; i < presetCount; ++i)
|
||||
{
|
||||
if (m_presets[i] == preset)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
// return failure
|
||||
return MCORE_INVALIDINDEX32;
|
||||
const auto foundPreset = AZStd::find(begin(m_presets), end(m_presets), preset);
|
||||
return foundPreset != end(m_presets) ? AZStd::distance(begin(m_presets), foundPreset) : InvalidIndex;
|
||||
}
|
||||
|
||||
|
||||
void AnimGraphGameControllerSettings::SetActivePreset(Preset* preset)
|
||||
{
|
||||
m_activePresetIndex = static_cast<AZ::u32>(FindPresetIndex(preset));
|
||||
m_activePresetIndex = FindPresetIndex(preset);
|
||||
}
|
||||
|
||||
|
||||
uint32 AnimGraphGameControllerSettings::GetActivePresetIndex() const
|
||||
size_t AnimGraphGameControllerSettings::GetActivePresetIndex() const
|
||||
{
|
||||
if (m_activePresetIndex < m_presets.size())
|
||||
{
|
||||
return m_activePresetIndex;
|
||||
}
|
||||
|
||||
return MCORE_INVALIDINDEX32;
|
||||
return InvalidIndex;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -153,7 +153,7 @@ namespace EMotionFX
|
||||
Preset* GetPreset(size_t index) const;
|
||||
size_t GetNumPresets() const;
|
||||
|
||||
uint32 GetActivePresetIndex() const;
|
||||
size_t GetActivePresetIndex() const;
|
||||
Preset* GetActivePreset() const;
|
||||
void SetActivePreset(Preset* preset);
|
||||
|
||||
@@ -164,6 +164,6 @@ namespace EMotionFX
|
||||
|
||||
private:
|
||||
AZStd::vector<Preset*> m_presets;
|
||||
AZ::u32 m_activePresetIndex;
|
||||
size_t m_activePresetIndex;
|
||||
};
|
||||
} // namespace EMotionFX
|
||||
|
||||
@@ -550,7 +550,7 @@ namespace EMotionFX
|
||||
{
|
||||
const size_t currentSize = mOutputPorts.size();
|
||||
mOutputPorts.emplace_back();
|
||||
return static_cast<uint32>(currentSize);
|
||||
return currentSize;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -330,7 +330,7 @@ namespace EMotionFX
|
||||
virtual void OnStateEnd(AnimGraphInstance* animGraphInstance, AnimGraphNode* state) { MCORE_UNUSED(animGraphInstance); MCORE_UNUSED(state); }
|
||||
virtual void OnStartTransition(AnimGraphInstance* animGraphInstance, AnimGraphStateTransition* transition) { MCORE_UNUSED(animGraphInstance); MCORE_UNUSED(transition); }
|
||||
virtual void OnEndTransition(AnimGraphInstance* animGraphInstance, AnimGraphStateTransition* transition) { MCORE_UNUSED(animGraphInstance); MCORE_UNUSED(transition); }
|
||||
virtual void OnSetVisualManipulatorOffset(AnimGraphInstance* animGraphInstance, uint32 paramIndex, const AZ::Vector3& offset) { MCORE_UNUSED(animGraphInstance); MCORE_UNUSED(paramIndex); MCORE_UNUSED(offset); }
|
||||
virtual void OnSetVisualManipulatorOffset(AnimGraphInstance* animGraphInstance, size_t paramIndex, const AZ::Vector3& offset) { MCORE_UNUSED(animGraphInstance); MCORE_UNUSED(paramIndex); MCORE_UNUSED(offset); }
|
||||
|
||||
virtual void OnInputPortsChanged(AnimGraphNode* node, const AZStd::vector<AZStd::string>& newInputPorts, const AZStd::string& memberName, const AZStd::vector<AZStd::string>& memberValue) { AZ_UNUSED(node); AZ_UNUSED(newInputPorts); AZ_UNUSED(memberName); AZ_UNUSED(memberValue); }
|
||||
virtual void OnOutputPortsChanged(AnimGraphNode* node, const AZStd::vector<AZStd::string>& newOutputPorts, const AZStd::string& memberName, const AZStd::vector<AZStd::string>& memberValue) { AZ_UNUSED(node); AZ_UNUSED(newOutputPorts); AZ_UNUSED(memberName); AZ_UNUSED(memberValue); }
|
||||
|
||||
@@ -1474,7 +1474,7 @@ namespace EMotionFX
|
||||
|
||||
|
||||
// check for a given mesh how we categorize it
|
||||
Mesh::EMeshType Mesh::ClassifyMeshType(uint32 lodLevel, Actor* actor, uint32 nodeIndex, bool forceCPUSkinning, uint32 maxInfluences, uint32 maxBonesPerSubMesh) const
|
||||
Mesh::EMeshType Mesh::ClassifyMeshType(size_t lodLevel, Actor* actor, size_t nodeIndex, bool forceCPUSkinning, uint32 maxInfluences, uint32 maxBonesPerSubMesh) const
|
||||
{
|
||||
// get the mesh deformer stack for the given node at the given detail level
|
||||
MeshDeformerStack* deformerStack = actor->GetMeshDeformerStack(lodLevel, nodeIndex);
|
||||
|
||||
@@ -596,7 +596,7 @@ namespace EMotionFX
|
||||
* @param maxBonesPerSubMesh The maximum number of bones per submesh can be processed on hardware. If there will be more bones per submesh the mesh will be processed in software which will be very slow.
|
||||
* @return The mesh type meaning if the given mesh is static like a cube or building or if is deformed by the GPU or CPU.
|
||||
*/
|
||||
EMeshType ClassifyMeshType(uint32 lodLevel, Actor* actor, uint32 nodeIndex, bool forceCPUSkinning, uint32 maxInfluences, uint32 maxBonesPerSubMesh) const;
|
||||
EMeshType ClassifyMeshType(size_t lodLevel, Actor* actor, size_t nodeIndex, bool forceCPUSkinning, uint32 maxInfluences, uint32 maxBonesPerSubMesh) const;
|
||||
|
||||
/**
|
||||
* Debug log information.
|
||||
|
||||
@@ -131,7 +131,7 @@ namespace EMotionFX
|
||||
KeyTrackLinearDynamic<float, float> 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
|
||||
uint32 mCachedKey; // a cached key
|
||||
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
|
||||
@@ -147,7 +147,7 @@ namespace EMotionFX
|
||||
mEndTime = 0.0f;
|
||||
mMotionID = MCORE_INVALIDINDEX32;
|
||||
mTrackIndex = InvalidIndex;
|
||||
mCachedKey = MCORE_INVALIDINDEX32;
|
||||
mCachedKey = InvalidIndex;
|
||||
mNodeId = AnimGraphNodeId();
|
||||
mAnimGraphInstance = nullptr;
|
||||
mAnimGraphID = MCORE_INVALIDINDEX32;
|
||||
|
||||
@@ -396,8 +396,8 @@ namespace EMStudio
|
||||
{
|
||||
motionSet->SetDirtyFlag(dirtyFlag);
|
||||
|
||||
const uint32 numChildSets = motionSet->GetNumChildSets();
|
||||
for (uint32 i = 0; i < numChildSets; ++i)
|
||||
const size_t numChildSets = motionSet->GetNumChildSets();
|
||||
for (size_t i = 0; i < numChildSets; ++i)
|
||||
{
|
||||
EMotionFX::MotionSet* childSet = motionSet->GetChildSet(i);
|
||||
RecursiveSetDirtyFlag(childSet, dirtyFlag);
|
||||
|
||||
+4
-4
@@ -177,7 +177,7 @@ namespace EMStudio
|
||||
#endif // EMFX_EMSTUDIOLYEMBEDDED
|
||||
|
||||
// Give a chance to every plugin to reflect data
|
||||
const uint32 numPlugins = mPluginManager->GetNumPlugins();
|
||||
const size_t numPlugins = mPluginManager->GetNumPlugins();
|
||||
if (numPlugins)
|
||||
{
|
||||
AZ::SerializeContext* serializeContext = nullptr;
|
||||
@@ -188,7 +188,7 @@ namespace EMStudio
|
||||
}
|
||||
else
|
||||
{
|
||||
for (uint32 i = 0; i < numPlugins; ++i)
|
||||
for (size_t i = 0; i < numPlugins; ++i)
|
||||
{
|
||||
EMStudioPlugin* plugin = mPluginManager->GetPlugin(i);
|
||||
plugin->Reflect(serializeContext);
|
||||
@@ -320,12 +320,12 @@ namespace EMStudio
|
||||
}
|
||||
|
||||
|
||||
void EMStudioManager::SetVisibleJointIndices(const AZStd::unordered_set<AZ::u32>& visibleJointIndices)
|
||||
void EMStudioManager::SetVisibleJointIndices(const AZStd::unordered_set<size_t>& visibleJointIndices)
|
||||
{
|
||||
m_visibleJointIndices = visibleJointIndices;
|
||||
}
|
||||
|
||||
void EMStudioManager::SetSelectedJointIndices(const AZStd::unordered_set<AZ::u32>& selectedJointIndices)
|
||||
void EMStudioManager::SetSelectedJointIndices(const AZStd::unordered_set<size_t>& selectedJointIndices)
|
||||
{
|
||||
m_selectedJointIndices = selectedJointIndices;
|
||||
}
|
||||
|
||||
+6
-6
@@ -93,11 +93,11 @@ namespace EMStudio
|
||||
void LogInfo();
|
||||
|
||||
// in case the array is empty, all nodes are shown
|
||||
void SetVisibleJointIndices(const AZStd::unordered_set<AZ::u32>& visibleJointIndices);
|
||||
const AZStd::unordered_set<AZ::u32>& GetVisibleJointIndices() const { return m_visibleJointIndices; }
|
||||
void SetVisibleJointIndices(const AZStd::unordered_set<size_t>& visibleJointIndices);
|
||||
const AZStd::unordered_set<size_t>& GetVisibleJointIndices() const { return m_visibleJointIndices; }
|
||||
|
||||
void SetSelectedJointIndices(const AZStd::unordered_set<AZ::u32>& selectedJointIndices);
|
||||
const AZStd::unordered_set<AZ::u32>& GetSelectedJointIndices() const { return m_selectedJointIndices; }
|
||||
void SetSelectedJointIndices(const AZStd::unordered_set<size_t>& selectedJointIndices);
|
||||
const AZStd::unordered_set<size_t>& GetSelectedJointIndices() const { return m_selectedJointIndices; }
|
||||
|
||||
Workspace* GetWorkspace() { return &mWorkspace; }
|
||||
|
||||
@@ -123,8 +123,8 @@ namespace EMStudio
|
||||
NotificationWindowManager* mNotificationWindowManager;
|
||||
CommandSystem::CommandManager* mCommandManager;
|
||||
AZStd::string mCompileDate;
|
||||
AZStd::unordered_set<AZ::u32> m_visibleJointIndices;
|
||||
AZStd::unordered_set<AZ::u32> m_selectedJointIndices;
|
||||
AZStd::unordered_set<size_t> m_visibleJointIndices;
|
||||
AZStd::unordered_set<size_t> m_selectedJointIndices;
|
||||
Workspace mWorkspace;
|
||||
bool mAutoLoadLastWorkspace;
|
||||
AZStd::string mHTMLLinkString;
|
||||
|
||||
+10
-10
@@ -89,8 +89,8 @@ namespace EMStudio
|
||||
|
||||
if (AzFramework::StringFunc::Equal(extension.c_str(), "motion"))
|
||||
{
|
||||
const AZ::u32 motionCount = EMotionFX::GetMotionManager().GetNumMotions();
|
||||
for (AZ::u32 i = 0; i < motionCount; ++i)
|
||||
const size_t motionCount = EMotionFX::GetMotionManager().GetNumMotions();
|
||||
for (size_t i = 0; i < motionCount; ++i)
|
||||
{
|
||||
EMotionFX::Motion* motion = EMotionFX::GetMotionManager().GetMotion(i);
|
||||
if (motion->GetIsOwnedByRuntime())
|
||||
@@ -107,8 +107,8 @@ namespace EMStudio
|
||||
|
||||
if (AzFramework::StringFunc::Equal(extension.c_str(), "actor"))
|
||||
{
|
||||
const AZ::u32 actorCount = EMotionFX::GetActorManager().GetNumActors();
|
||||
for (AZ::u32 i = 0; i < actorCount; ++i)
|
||||
const size_t actorCount = EMotionFX::GetActorManager().GetNumActors();
|
||||
for (size_t i = 0; i < actorCount; ++i)
|
||||
{
|
||||
EMotionFX::Actor* actor = EMotionFX::GetActorManager().GetActor(i);
|
||||
if (actor->GetIsOwnedByRuntime())
|
||||
@@ -202,8 +202,8 @@ namespace EMStudio
|
||||
|
||||
if (AzFramework::StringFunc::Equal(extension.c_str(), "motionset"))
|
||||
{
|
||||
const AZ::u32 motionSetCount = EMotionFX::GetMotionManager().GetNumMotionSets();
|
||||
for (AZ::u32 i = 0; i < motionSetCount; ++i)
|
||||
const size_t motionSetCount = EMotionFX::GetMotionManager().GetNumMotionSets();
|
||||
for (size_t i = 0; i < motionSetCount; ++i)
|
||||
{
|
||||
EMotionFX::MotionSet* motionSet = EMotionFX::GetMotionManager().GetMotionSet(i);
|
||||
if (motionSet->GetIsOwnedByRuntime())
|
||||
@@ -220,8 +220,8 @@ namespace EMStudio
|
||||
|
||||
if (AzFramework::StringFunc::Equal(extension.c_str(), "animgraph"))
|
||||
{
|
||||
const AZ::u32 animGraphCount = EMotionFX::GetAnimGraphManager().GetNumAnimGraphs();
|
||||
for (AZ::u32 i = 0; i < animGraphCount; ++i)
|
||||
const size_t animGraphCount = EMotionFX::GetAnimGraphManager().GetNumAnimGraphs();
|
||||
for (size_t i = 0; i < animGraphCount; ++i)
|
||||
{
|
||||
EMotionFX::AnimGraph* animGraph = EMotionFX::GetAnimGraphManager().GetAnimGraph(i);
|
||||
if (animGraph->GetIsOwnedByRuntime())
|
||||
@@ -570,7 +570,7 @@ namespace EMStudio
|
||||
}
|
||||
|
||||
|
||||
void FileManager::SaveMotionSet(const char* filename, EMotionFX::MotionSet* motionSet, MCore::CommandGroup* commandGroup)
|
||||
void FileManager::SaveMotionSet(const char* filename, const EMotionFX::MotionSet* motionSet, MCore::CommandGroup* commandGroup)
|
||||
{
|
||||
const AZStd::string command = AZStd::string::format("SaveMotionSet -motionSetID %i -filename \"%s\"", motionSet->GetID(), filename);
|
||||
|
||||
@@ -595,7 +595,7 @@ namespace EMStudio
|
||||
}
|
||||
|
||||
|
||||
void FileManager::SaveMotionSet(QWidget* parent, EMotionFX::MotionSet* motionSet, MCore::CommandGroup* commandGroup)
|
||||
void FileManager::SaveMotionSet(QWidget* parent, const EMotionFX::MotionSet* motionSet, MCore::CommandGroup* commandGroup)
|
||||
{
|
||||
AZStd::string filename = motionSet->GetFilename();
|
||||
|
||||
|
||||
@@ -82,8 +82,8 @@ namespace EMStudio
|
||||
// motion set file dialogs
|
||||
AZStd::string LoadMotionSetFileDialog(QWidget* parent);
|
||||
AZStd::string SaveMotionSetFileDialog(QWidget* parent);
|
||||
void SaveMotionSet(QWidget* parent, EMotionFX::MotionSet* motionSet, MCore::CommandGroup* commandGroup = nullptr);
|
||||
void SaveMotionSet(const char* filename, EMotionFX::MotionSet* motionSet, MCore::CommandGroup* commandGroup = nullptr);
|
||||
void SaveMotionSet(QWidget* parent, const EMotionFX::MotionSet* motionSet, MCore::CommandGroup* commandGroup = nullptr);
|
||||
void SaveMotionSet(const char* filename, const EMotionFX::MotionSet* motionSet, MCore::CommandGroup* commandGroup = nullptr);
|
||||
|
||||
// motion file dialogs
|
||||
AZStd::string LoadMotionFileDialog(QWidget* parent);
|
||||
|
||||
+3
-3
@@ -127,7 +127,7 @@ namespace EMStudio
|
||||
|
||||
header.mLayoutVersionHigh = 0;
|
||||
header.mLayoutVersionLow = 1;
|
||||
header.mNumPlugins = GetPluginManager()->GetNumActivePlugins();
|
||||
header.mNumPlugins = aznumeric_caster(GetPluginManager()->GetNumActivePlugins());
|
||||
if (file.write((char*)&header, sizeof(LayoutHeader)) == -1)
|
||||
{
|
||||
MCore::LogWarning("Failed to write layout header to layout file '%s'", filename);
|
||||
@@ -339,8 +339,8 @@ namespace EMStudio
|
||||
GetMainWindow()->UpdateCreateWindowMenu(); // update Window->Create menu
|
||||
|
||||
// Trigger the OnAfterLoadLayout callbacks.
|
||||
const uint32 numActivePlugins = pluginManager->GetNumActivePlugins();
|
||||
for (uint32 p = 0; p < numActivePlugins; ++p)
|
||||
const size_t numActivePlugins = pluginManager->GetNumActivePlugins();
|
||||
for (size_t p = 0; p < numActivePlugins; ++p)
|
||||
{
|
||||
GetPluginManager()->GetActivePlugin(p)->OnAfterLoadLayout();
|
||||
}
|
||||
|
||||
+33
-34
@@ -1037,8 +1037,8 @@ namespace EMStudio
|
||||
// enable the actor save selected menu only if one actor or actor instance is selected
|
||||
// it's needed to check here because if one actor is removed it's not selected anymore
|
||||
const CommandSystem::SelectionList& selectionList = GetCommandManager()->GetCurrentSelection();
|
||||
const uint32 numSelectedActors = selectionList.GetNumSelectedActors();
|
||||
const uint32 numSelectedActorInstances = selectionList.GetNumSelectedActorInstances();
|
||||
const size_t numSelectedActors = selectionList.GetNumSelectedActors();
|
||||
const size_t numSelectedActorInstances = selectionList.GetNumSelectedActorInstances();
|
||||
if ((numSelectedActors > 0) || (numSelectedActorInstances > 0))
|
||||
{
|
||||
EnableSaveSelectedActorsMenu();
|
||||
@@ -1087,12 +1087,12 @@ namespace EMStudio
|
||||
PluginManager* pluginManager = GetPluginManager();
|
||||
|
||||
// get the number of plugins
|
||||
const uint32 numPlugins = pluginManager->GetNumPlugins();
|
||||
const size_t numPlugins = pluginManager->GetNumPlugins();
|
||||
|
||||
// add each plugin name in an array to sort them
|
||||
AZStd::vector<AZStd::string> sortedPlugins;
|
||||
sortedPlugins.reserve(numPlugins);
|
||||
for (uint32 p = 0; p < numPlugins; ++p)
|
||||
for (size_t p = 0; p < numPlugins; ++p)
|
||||
{
|
||||
EMStudioPlugin* plugin = pluginManager->GetPlugin(p);
|
||||
sortedPlugins.emplace_back(plugin->GetName());
|
||||
@@ -1103,10 +1103,10 @@ namespace EMStudio
|
||||
mCreateWindowMenu->clear();
|
||||
|
||||
// for all registered plugins, create a menu items
|
||||
for (uint32 p = 0; p < numPlugins; ++p)
|
||||
for (size_t p = 0; p < numPlugins; ++p)
|
||||
{
|
||||
// get the plugin
|
||||
const uint32 pluginIndex = pluginManager->FindPluginByTypeString(sortedPlugins[p].c_str());
|
||||
const size_t pluginIndex = pluginManager->FindPluginByTypeString(sortedPlugins[p].c_str());
|
||||
EMStudioPlugin* plugin = pluginManager->GetPlugin(pluginIndex);
|
||||
|
||||
// don't add invisible plugins to the list
|
||||
@@ -1222,8 +1222,8 @@ namespace EMStudio
|
||||
generalPropertyWidget->AddInstance(&mOptions, azrtti_typeid(mOptions));
|
||||
|
||||
PluginManager* pluginManager = GetPluginManager();
|
||||
const uint32 numPlugins = pluginManager->GetNumActivePlugins();
|
||||
for (uint32 i = 0; i < numPlugins; ++i)
|
||||
const size_t numPlugins = pluginManager->GetNumActivePlugins();
|
||||
for (size_t i = 0; i < numPlugins; ++i)
|
||||
{
|
||||
EMStudioPlugin* currentPlugin = pluginManager->GetActivePlugin(i);
|
||||
PluginOptions* pluginOptions = currentPlugin->GetOptions();
|
||||
@@ -1769,21 +1769,21 @@ namespace EMStudio
|
||||
{
|
||||
// get the current selection list
|
||||
const CommandSystem::SelectionList& selectionList = GetCommandManager()->GetCurrentSelection();
|
||||
const uint32 numSelectedActors = selectionList.GetNumSelectedActors();
|
||||
const uint32 numSelectedActorInstances = selectionList.GetNumSelectedActorInstances();
|
||||
const size_t numSelectedActors = selectionList.GetNumSelectedActors();
|
||||
const size_t numSelectedActorInstances = selectionList.GetNumSelectedActorInstances();
|
||||
|
||||
// create the saving actor array
|
||||
AZStd::vector<EMotionFX::Actor*> savingActors;
|
||||
savingActors.reserve(numSelectedActors + numSelectedActorInstances);
|
||||
|
||||
// add all selected actors to the list
|
||||
for (uint32 i = 0; i < numSelectedActors; ++i)
|
||||
for (size_t i = 0; i < numSelectedActors; ++i)
|
||||
{
|
||||
savingActors.push_back(selectionList.GetActor(i));
|
||||
}
|
||||
|
||||
// check all actors of all selected actor instances and put them in the list if they are not in yet
|
||||
for (uint32 i = 0; i < numSelectedActorInstances; ++i)
|
||||
for (size_t i = 0; i < numSelectedActorInstances; ++i)
|
||||
{
|
||||
EMotionFX::Actor* actor = selectionList.GetActorInstance(i)->GetActor();
|
||||
|
||||
@@ -1862,15 +1862,14 @@ namespace EMStudio
|
||||
}
|
||||
|
||||
// add each menu
|
||||
const uint32 numLayoutNames = mLayoutNames.size();
|
||||
for (uint32 i = 0; i < numLayoutNames; ++i)
|
||||
for (const AZStd::string& layoutName : mLayoutNames)
|
||||
{
|
||||
QAction* action = mLayoutsMenu->addAction(mLayoutNames[i].c_str());
|
||||
QAction* action = mLayoutsMenu->addAction(layoutName.c_str());
|
||||
connect(action, &QAction::triggered, this, &MainWindow::OnLoadLayout);
|
||||
}
|
||||
|
||||
// add the separator only if at least one layout
|
||||
if (numLayoutNames > 0)
|
||||
if (!mLayoutNames.empty())
|
||||
{
|
||||
mLayoutsMenu->addSeparator();
|
||||
}
|
||||
@@ -1880,22 +1879,22 @@ namespace EMStudio
|
||||
connect(saveCurrentAction, &QAction::triggered, this, &MainWindow::OnLayoutSaveAs);
|
||||
|
||||
// remove menu is needed only if at least one layout
|
||||
if (numLayoutNames > 0)
|
||||
if (!mLayoutNames.empty())
|
||||
{
|
||||
// add the remove menu
|
||||
QMenu* removeMenu = mLayoutsMenu->addMenu("Remove");
|
||||
removeMenu->setObjectName("RemoveMenu");
|
||||
|
||||
// add each layout in the remove menu
|
||||
for (uint32 i = 0; i < numLayoutNames; ++i)
|
||||
for (const AZStd::string& layoutName : mLayoutNames)
|
||||
{
|
||||
// User cannot remove the default layout. This layout is referenced in the qrc file, removing it will
|
||||
// cause compiling issue too.
|
||||
if (mLayoutNames[i] == "AnimGraph")
|
||||
if (layoutName == "AnimGraph")
|
||||
{
|
||||
continue;
|
||||
}
|
||||
QAction* action = removeMenu->addAction(mLayoutNames[i].c_str());
|
||||
QAction* action = removeMenu->addAction(layoutName.c_str());
|
||||
connect(action, &QAction::triggered, this, &MainWindow::OnRemoveLayout);
|
||||
}
|
||||
}
|
||||
@@ -1905,9 +1904,9 @@ namespace EMStudio
|
||||
|
||||
// update the combo box
|
||||
mApplicationMode->clear();
|
||||
for (uint32 i = 0; i < numLayoutNames; ++i)
|
||||
for (const AZStd::string& layoutName : mLayoutNames)
|
||||
{
|
||||
mApplicationMode->addItem(mLayoutNames[i].c_str());
|
||||
mApplicationMode->addItem(layoutName.c_str());
|
||||
}
|
||||
|
||||
// update the current selection of combo box
|
||||
@@ -2055,7 +2054,7 @@ namespace EMStudio
|
||||
const bool result = GetCommandManager()->Undo(outResult);
|
||||
|
||||
// log the results if there are any
|
||||
if (outResult.size() > 0)
|
||||
if (!outResult.empty())
|
||||
{
|
||||
if (result == false)
|
||||
{
|
||||
@@ -2080,7 +2079,7 @@ namespace EMStudio
|
||||
const bool result = GetCommandManager()->Redo(outResult);
|
||||
|
||||
// log the results if there are any
|
||||
if (outResult.size() > 0)
|
||||
if (!outResult.empty())
|
||||
{
|
||||
if (result == false)
|
||||
{
|
||||
@@ -2279,8 +2278,8 @@ namespace EMStudio
|
||||
|
||||
// for all registered plugins, call the after load workspace callback
|
||||
PluginManager* pluginManager = GetPluginManager();
|
||||
const uint32 numPlugins = pluginManager->GetNumActivePlugins();
|
||||
for (uint32 p = 0; p < numPlugins; ++p)
|
||||
const size_t numPlugins = pluginManager->GetNumActivePlugins();
|
||||
for (size_t p = 0; p < numPlugins; ++p)
|
||||
{
|
||||
EMStudioPlugin* plugin = pluginManager->GetActivePlugin(p);
|
||||
plugin->OnAfterLoadProject();
|
||||
@@ -2320,8 +2319,8 @@ namespace EMStudio
|
||||
MCore::CommandGroup commandGroup("Animgraph and motion set activation");
|
||||
AZStd::string commandString;
|
||||
|
||||
const uint32 numActorInstances = EMotionFX::GetActorManager().GetNumActorInstances();
|
||||
for (uint32 i = 0; i < numActorInstances; ++i)
|
||||
const size_t numActorInstances = EMotionFX::GetActorManager().GetNumActorInstances();
|
||||
for (size_t i = 0; i < numActorInstances; ++i)
|
||||
{
|
||||
EMotionFX::ActorInstance* actorInstance = EMotionFX::GetActorManager().GetActorInstance(i);
|
||||
if (!actorInstance || actorFilename != actorInstance->GetActor()->GetFileName())
|
||||
@@ -2465,8 +2464,8 @@ namespace EMStudio
|
||||
|
||||
// for all registered plugins, call the after load actors callback
|
||||
PluginManager* pluginManager = GetPluginManager();
|
||||
const uint32 numPlugins = pluginManager->GetNumActivePlugins();
|
||||
for (uint32 p = 0; p < numPlugins; ++p)
|
||||
const size_t numPlugins = pluginManager->GetNumActivePlugins();
|
||||
for (size_t p = 0; p < numPlugins; ++p)
|
||||
{
|
||||
EMStudioPlugin* plugin = pluginManager->GetActivePlugin(p);
|
||||
plugin->OnAfterLoadActors();
|
||||
@@ -2757,8 +2756,8 @@ namespace EMStudio
|
||||
}
|
||||
else if (dirtyObjects[i].mAnimGraph)
|
||||
{
|
||||
const uint32 animGraphIndex = EMotionFX::GetAnimGraphManager().FindAnimGraphIndex(dirtyObjects[i].mAnimGraph);
|
||||
command = AZStd::string::format("SaveAnimGraph -index %i -filename \"%s\" -updateFilename false -updateDirtyFlag false -sourceControl false", animGraphIndex, newFileFilename.c_str());
|
||||
const size_t animGraphIndex = EMotionFX::GetAnimGraphManager().FindAnimGraphIndex(dirtyObjects[i].mAnimGraph);
|
||||
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)
|
||||
@@ -2803,8 +2802,8 @@ namespace EMStudio
|
||||
PluginManager* pluginManager = GetPluginManager();
|
||||
|
||||
// get the number of active plugins, iterate through them and call the process frame method
|
||||
const uint32 numPlugins = pluginManager->GetNumActivePlugins();
|
||||
for (uint32 p = 0; p < numPlugins; ++p)
|
||||
const size_t numPlugins = pluginManager->GetNumActivePlugins();
|
||||
for (size_t p = 0; p < numPlugins; ++p)
|
||||
{
|
||||
EMStudioPlugin* plugin = pluginManager->GetActivePlugin(p);
|
||||
if (plugin->GetPluginType() == EMStudioPlugin::PLUGINTYPE_RENDERING)
|
||||
|
||||
+2
-2
@@ -90,8 +90,8 @@ namespace EMStudio
|
||||
|
||||
mSelection = selection;
|
||||
|
||||
const uint32 numMorphTargets = morphSetup->GetNumMorphTargets();
|
||||
for (uint32 i = 0; i < numMorphTargets; ++i)
|
||||
const size_t numMorphTargets = morphSetup->GetNumMorphTargets();
|
||||
for (size_t i = 0; i < numMorphTargets; ++i)
|
||||
{
|
||||
EMotionFX::MorphTarget* morphTarget = morphSetup->GetMorphTarget(i);
|
||||
const uint32 morphTargetID = morphTarget->GetID();
|
||||
|
||||
+8
-10
@@ -116,8 +116,8 @@ namespace EMStudio
|
||||
else
|
||||
{
|
||||
// add all root motion sets
|
||||
const uint32 numMotionSets = EMotionFX::GetMotionManager().GetNumMotionSets();
|
||||
for (uint32 i = 0; i < numMotionSets; ++i)
|
||||
const size_t numMotionSets = EMotionFX::GetMotionManager().GetNumMotionSets();
|
||||
for (size_t i = 0; i < numMotionSets; ++i)
|
||||
{
|
||||
EMotionFX::MotionSet* motionSet = EMotionFX::GetMotionManager().GetMotionSet(i);
|
||||
|
||||
@@ -185,8 +185,8 @@ namespace EMStudio
|
||||
}
|
||||
|
||||
// add all child sets
|
||||
const uint32 numChildSets = motionSet->GetNumChildSets();
|
||||
for (uint32 i = 0; i < numChildSets; ++i)
|
||||
const size_t numChildSets = motionSet->GetNumChildSets();
|
||||
for (size_t i = 0; i < numChildSets; ++i)
|
||||
{
|
||||
RecursiveAddMotionSet(motionSetItem, motionSet->GetChildSet(i), selectionList);
|
||||
}
|
||||
@@ -303,21 +303,19 @@ namespace EMStudio
|
||||
{
|
||||
// Get the selected items in the tree widget.
|
||||
QList<QTreeWidgetItem*> selectedItems = mHierarchy->selectedItems();
|
||||
const uint32 numSelectedItems = selectedItems.count();
|
||||
|
||||
// Reset the selection.
|
||||
mSelected.clear();
|
||||
mSelected.reserve(numSelectedItems);
|
||||
mSelected.reserve(selectedItems.size());
|
||||
|
||||
AZStd::string motionId;
|
||||
for (uint32 i = 0; i < numSelectedItems; ++i)
|
||||
for (const QTreeWidgetItem* item : selectedItems)
|
||||
{
|
||||
QTreeWidgetItem* item = selectedItems[i];
|
||||
motionId = item->text(0).toUtf8().data();
|
||||
motionId = item->text(0).toUtf8().data();
|
||||
|
||||
// Extract the motion set id.
|
||||
QString motionSetIdAsString = item->whatsThis(0);
|
||||
const AZ::u32 motionSetId = AzFramework::StringFunc::ToInt(motionSetIdAsString.toUtf8().data());
|
||||
const uint32 motionSetId = AzFramework::StringFunc::ToInt(motionSetIdAsString.toUtf8().data());
|
||||
|
||||
// Find the motion set based on the id.
|
||||
EMotionFX::MotionSet* motionSet = EMotionFX::GetMotionManager().FindMotionSetByID(motionSetId);
|
||||
|
||||
+22
-57
@@ -156,8 +156,8 @@ namespace EMStudio
|
||||
if (actorInstanceID == MCORE_INVALIDINDEX32)
|
||||
{
|
||||
// get the number actor instances and iterate over them
|
||||
const uint32 numActorInstances = EMotionFX::GetActorManager().GetNumActorInstances();
|
||||
for (uint32 i = 0; i < numActorInstances; ++i)
|
||||
const size_t numActorInstances = EMotionFX::GetActorManager().GetNumActorInstances();
|
||||
for (size_t i = 0; i < numActorInstances; ++i)
|
||||
{
|
||||
// add the actor to the node hierarchy widget
|
||||
EMotionFX::ActorInstance* actorInstance = EMotionFX::GetActorManager().GetActorInstance(i);
|
||||
@@ -187,11 +187,10 @@ namespace EMStudio
|
||||
mHierarchy->clear();
|
||||
|
||||
// get the number actor instances and iterate over them
|
||||
const uint32 numActorInstances = mActorInstanceIDs.size();
|
||||
for (uint32 i = 0; i < numActorInstances; ++i)
|
||||
for (const uint32 mActorInstanceID : mActorInstanceIDs)
|
||||
{
|
||||
// get the actor instance by its id
|
||||
EMotionFX::ActorInstance* actorInstance = EMotionFX::GetActorManager().FindActorInstanceByID(mActorInstanceIDs[i]);
|
||||
EMotionFX::ActorInstance* actorInstance = EMotionFX::GetActorManager().FindActorInstanceByID(mActorInstanceID);
|
||||
if (actorInstance)
|
||||
{
|
||||
AddActorInstance(actorInstance);
|
||||
@@ -241,7 +240,7 @@ namespace EMStudio
|
||||
|
||||
// get the number of root nodes and iterate through them
|
||||
const size_t numRootNodes = actor->GetSkeleton()->GetNumRootNodes();
|
||||
for (uint32 i = 0; i < numRootNodes; ++i)
|
||||
for (size_t i = 0; i < numRootNodes; ++i)
|
||||
{
|
||||
// get the root node index and the corresponding node
|
||||
const size_t rootNodeIndex = actor->GetSkeleton()->GetRootNodeIndex(i);
|
||||
@@ -349,7 +348,7 @@ namespace EMStudio
|
||||
parent->addChild(item);
|
||||
|
||||
// iterate through all children
|
||||
for (uint32 i = 0; i < numChildren; ++i)
|
||||
for (size_t i = 0; i < numChildren; ++i)
|
||||
{
|
||||
// get the node index and the corresponding node
|
||||
const size_t childIndex = node->GetChildIndex(i);
|
||||
@@ -362,7 +361,7 @@ namespace EMStudio
|
||||
else
|
||||
{
|
||||
// iterate through all children
|
||||
for (uint32 i = 0; i < numChildren; ++i)
|
||||
for (size_t i = 0; i < numChildren; ++i)
|
||||
{
|
||||
// get the node index and the corresponding node
|
||||
const size_t childIndex = node->GetChildIndex(i);
|
||||
@@ -470,8 +469,8 @@ namespace EMStudio
|
||||
}
|
||||
|
||||
// get the number of children and iterate through them
|
||||
const uint32 numChilds = item->childCount();
|
||||
for (uint32 i = 0; i < numChilds; ++i)
|
||||
const int numChilds = item->childCount();
|
||||
for (int i = 0; i < numChilds; ++i)
|
||||
{
|
||||
RecursiveRemoveUnselectedItems(item->child(i));
|
||||
}
|
||||
@@ -480,33 +479,20 @@ namespace EMStudio
|
||||
|
||||
void NodeHierarchyWidget::UpdateSelection()
|
||||
{
|
||||
uint32 i;
|
||||
|
||||
//LOG("================================Update Selection!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
||||
//LOG("NumSelectedNodes=%i", mSelectedNodes.GetLength());
|
||||
//String debugString;
|
||||
//debugString.Reserve(10000);
|
||||
//for (uint32 s=0; s<mSelectedNodes.GetLength(); ++s)
|
||||
// debugString += AZStd::string::format("%s,", mSelectedNodes[s].GetNodeName());
|
||||
//LOG(debugString.AsChar());
|
||||
|
||||
// get the selected items and the number of them
|
||||
QList<QTreeWidgetItem*> selectedItems = mHierarchy->selectedItems();
|
||||
const uint32 numSelectedItems = selectedItems.count();
|
||||
|
||||
// remove the unselected tree widget items from the selected nodes
|
||||
const uint32 numTopLevelItems = mHierarchy->topLevelItemCount();
|
||||
for (i = 0; i < numTopLevelItems; ++i)
|
||||
const int numTopLevelItems = mHierarchy->topLevelItemCount();
|
||||
for (int i = 0; i < numTopLevelItems; ++i)
|
||||
{
|
||||
RecursiveRemoveUnselectedItems(mHierarchy->topLevelItem(i));
|
||||
}
|
||||
|
||||
// iterate through all selected items
|
||||
for (i = 0; i < numSelectedItems; ++i)
|
||||
for (const QTreeWidgetItem* item : selectedItems)
|
||||
{
|
||||
QTreeWidgetItem* item = selectedItems[i];
|
||||
|
||||
// get the item name
|
||||
// get the item name
|
||||
FromQtString(item->text(0), &mItemName);
|
||||
FromQtString(item->whatsThis(0), &mActorInstanceIDString);
|
||||
|
||||
@@ -644,32 +630,20 @@ namespace EMStudio
|
||||
// check if the node with the given name is selected in the window
|
||||
bool NodeHierarchyWidget::CheckIfNodeSelected(const char* nodeName, uint32 actorInstanceID)
|
||||
{
|
||||
for (const SelectionItem& selectedItem : m_selectedNodes)
|
||||
return AZStd::any_of(begin(m_selectedNodes), end(m_selectedNodes), [nodeName, actorInstanceID](const SelectionItem& selectedItem)
|
||||
{
|
||||
if (selectedItem.mActorInstanceID == actorInstanceID && selectedItem.GetNodeNameString() == nodeName)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// failure, not found in the selected nodes array
|
||||
return false;
|
||||
return selectedItem.mActorInstanceID == actorInstanceID && selectedItem.GetNodeNameString() == nodeName;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// check if the actor instance with the given id is selected in the window
|
||||
bool NodeHierarchyWidget::CheckIfActorInstanceSelected(uint32 actorInstanceID)
|
||||
{
|
||||
for (const SelectionItem& selectedItem : m_selectedNodes)
|
||||
return AZStd::any_of(begin(m_selectedNodes), end(m_selectedNodes), [actorInstanceID](const SelectionItem& selectedItem)
|
||||
{
|
||||
if (selectedItem.mActorInstanceID == actorInstanceID && selectedItem.GetNodeNameString().empty())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// failure, not found in the selected nodes array
|
||||
return false;
|
||||
return selectedItem.mActorInstanceID == actorInstanceID && selectedItem.GetNodeNameString().empty();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -685,15 +659,12 @@ namespace EMStudio
|
||||
m_selectedNodes.clear();
|
||||
|
||||
// get the number actor instances and iterate over them
|
||||
const uint32 numActorInstances = mActorInstanceIDs.size();
|
||||
for (uint32 i = 0; i < numActorInstances; ++i)
|
||||
for (const uint32 actorInstanceID : mActorInstanceIDs)
|
||||
{
|
||||
// add the actor to the node hierarchy widget
|
||||
const uint32 actorInstanceID = mActorInstanceIDs[i];
|
||||
|
||||
// get the number of selected nodes and iterate through them
|
||||
const uint32 numSelectedNodes = selectionList->GetNumSelectedNodes();
|
||||
for (uint32 n = 0; n < numSelectedNodes; ++n)
|
||||
const size_t numSelectedNodes = selectionList->GetNumSelectedNodes();
|
||||
for (size_t n = 0; n < numSelectedNodes; ++n)
|
||||
{
|
||||
const EMotionFX::Node* joint = selectionList->GetNode(n);
|
||||
if (joint)
|
||||
@@ -725,12 +696,6 @@ namespace EMStudio
|
||||
return mFilterState.testFlag(FilterType::Bones);
|
||||
}
|
||||
|
||||
/*
|
||||
void NodeHierarchyWidget::OnVisibilityChanged(bool isVisible)
|
||||
{
|
||||
if (isVisible)
|
||||
Update();
|
||||
}*/
|
||||
} // namespace EMStudio
|
||||
|
||||
#include <EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/moc_NodeHierarchyWidget.cpp>
|
||||
|
||||
+6
-8
@@ -33,10 +33,9 @@ namespace EMStudio
|
||||
|
||||
// compute the height of all notification windows with the spacing
|
||||
int allNotificationWindowsHeight = 0;
|
||||
const uint32 numNotificationWindows = mNotificationWindows.size();
|
||||
for (uint32 i = 0; i < numNotificationWindows; ++i)
|
||||
for (const NotificationWindow* mNotificationWindow : mNotificationWindows)
|
||||
{
|
||||
allNotificationWindowsHeight += mNotificationWindows[i]->geometry().height() + notificationWindowSpacing;
|
||||
allNotificationWindowsHeight += mNotificationWindow->geometry().height() + notificationWindowSpacing;
|
||||
}
|
||||
|
||||
// move the notification window
|
||||
@@ -82,16 +81,15 @@ namespace EMStudio
|
||||
|
||||
// move each notification window
|
||||
int currentNotificationWindowHeight = notificationWindowMainWindowPadding;
|
||||
const uint32 numNotificationWindows = mNotificationWindows.size();
|
||||
for (uint32 i = 0; i < numNotificationWindows; ++i)
|
||||
for (NotificationWindow* mNotificationWindow : mNotificationWindows)
|
||||
{
|
||||
// add the height of the notification window
|
||||
currentNotificationWindowHeight += mNotificationWindows[i]->geometry().height();
|
||||
currentNotificationWindowHeight += mNotificationWindow->geometry().height();
|
||||
|
||||
// move the notification window
|
||||
const QPoint mainWindowBottomRight = mainWindow->geometry().bottomRight();
|
||||
const QRect& notificationWindowGeometry = mNotificationWindows[i]->geometry();
|
||||
mNotificationWindows[i]->move(mainWindowBottomRight.x() - notificationWindowGeometry.width() - notificationWindowMainWindowPadding, mainWindowBottomRight.y() - currentNotificationWindowHeight);
|
||||
const QRect& notificationWindowGeometry = mNotificationWindow->geometry();
|
||||
mNotificationWindow->move(mainWindowBottomRight.x() - notificationWindowGeometry.width() - notificationWindowMainWindowPadding, mainWindowBottomRight.y() - currentNotificationWindowHeight);
|
||||
|
||||
// spacing is added after to avoid spacing on the bottom of the first notification window
|
||||
currentNotificationWindowHeight += notificationWindowSpacing;
|
||||
|
||||
+14
-14
@@ -21,8 +21,8 @@ namespace EMStudio
|
||||
ManipulatorCallback::Update(value);
|
||||
|
||||
// update the position, if actorinstance is still valid
|
||||
uint32 actorInstanceID = EMotionFX::GetActorManager().FindActorInstanceIndex(mActorInstance);
|
||||
if (actorInstanceID != MCORE_INVALIDINDEX32)
|
||||
size_t actorInstanceID = EMotionFX::GetActorManager().FindActorInstanceIndex(mActorInstance);
|
||||
if (actorInstanceID != InvalidIndex)
|
||||
{
|
||||
mActorInstance->SetLocalSpacePosition(value);
|
||||
}
|
||||
@@ -31,8 +31,8 @@ namespace EMStudio
|
||||
void TranslateManipulatorCallback::UpdateOldValues()
|
||||
{
|
||||
// update the rotation, if actorinstance is still valid
|
||||
uint32 actorInstanceID = EMotionFX::GetActorManager().FindActorInstanceIndex(mActorInstance);
|
||||
if (actorInstanceID != MCORE_INVALIDINDEX32)
|
||||
size_t actorInstanceID = EMotionFX::GetActorManager().FindActorInstanceIndex(mActorInstance);
|
||||
if (actorInstanceID != InvalidIndex)
|
||||
{
|
||||
mOldValueVec = mActorInstance->GetLocalSpaceTransform().mPosition;
|
||||
}
|
||||
@@ -66,8 +66,8 @@ namespace EMStudio
|
||||
void RotateManipulatorCallback::Update(const AZ::Quaternion& value)
|
||||
{
|
||||
// update the rotation, if actorinstance is still valid
|
||||
uint32 actorInstanceID = EMotionFX::GetActorManager().FindActorInstanceIndex(mActorInstance);
|
||||
if (actorInstanceID != MCORE_INVALIDINDEX32)
|
||||
size_t actorInstanceID = EMotionFX::GetActorManager().FindActorInstanceIndex(mActorInstance);
|
||||
if (actorInstanceID != InvalidIndex)
|
||||
{
|
||||
// temporarily update the actor instance
|
||||
mActorInstance->SetLocalSpaceRotation(value * mActorInstance->GetLocalSpaceTransform().mRotation.GetNormalized());
|
||||
@@ -80,8 +80,8 @@ namespace EMStudio
|
||||
void RotateManipulatorCallback::UpdateOldValues()
|
||||
{
|
||||
// update the rotation, if actorinstance is still valid
|
||||
uint32 actorInstanceID = EMotionFX::GetActorManager().FindActorInstanceIndex(mActorInstance);
|
||||
if (actorInstanceID != MCORE_INVALIDINDEX32)
|
||||
size_t actorInstanceID = EMotionFX::GetActorManager().FindActorInstanceIndex(mActorInstance);
|
||||
if (actorInstanceID != InvalidIndex)
|
||||
{
|
||||
mOldValueQuat = mActorInstance->GetLocalSpaceTransform().mRotation;
|
||||
}
|
||||
@@ -117,8 +117,8 @@ namespace EMStudio
|
||||
|
||||
AZ::Vector3 ScaleManipulatorCallback::GetCurrValueVec()
|
||||
{
|
||||
uint32 actorInstanceID = EMotionFX::GetActorManager().FindActorInstanceIndex(mActorInstance);
|
||||
if (actorInstanceID != MCORE_INVALIDINDEX32)
|
||||
size_t actorInstanceID = EMotionFX::GetActorManager().FindActorInstanceIndex(mActorInstance);
|
||||
if (actorInstanceID != InvalidIndex)
|
||||
{
|
||||
#ifndef EMFX_SCALE_DISABLED
|
||||
return mActorInstance->GetLocalSpaceTransform().mScale;
|
||||
@@ -137,8 +137,8 @@ namespace EMStudio
|
||||
EMFX_SCALECODE
|
||||
(
|
||||
// update the position, if actorinstance is still valid
|
||||
uint32 actorInstanceID = EMotionFX::GetActorManager().FindActorInstanceIndex(mActorInstance);
|
||||
if (actorInstanceID != MCORE_INVALIDINDEX32)
|
||||
size_t actorInstanceID = EMotionFX::GetActorManager().FindActorInstanceIndex(mActorInstance);
|
||||
if (actorInstanceID != InvalidIndex)
|
||||
{
|
||||
float minScale = 0.001f;
|
||||
const AZ::Vector3 scale = AZ::Vector3(
|
||||
@@ -159,8 +159,8 @@ namespace EMStudio
|
||||
EMFX_SCALECODE
|
||||
(
|
||||
// update the rotation, if actorinstance is still valid
|
||||
uint32 actorInstanceID = EMotionFX::GetActorManager().FindActorInstanceIndex(mActorInstance);
|
||||
if (actorInstanceID != MCORE_INVALIDINDEX32)
|
||||
size_t actorInstanceID = EMotionFX::GetActorManager().FindActorInstanceIndex(mActorInstance);
|
||||
if (actorInstanceID != InvalidIndex)
|
||||
{
|
||||
mOldValueVec = mActorInstance->GetLocalSpaceTransform().mScale;
|
||||
}
|
||||
|
||||
+51
-93
@@ -128,12 +128,11 @@ namespace EMStudio
|
||||
void RenderPlugin::CleanEMStudioActors()
|
||||
{
|
||||
// get rid of the actors
|
||||
const uint32 numActors = mActors.size();
|
||||
for (uint32 i = 0; i < numActors; ++i)
|
||||
for (EMStudioRenderActor* mActor : mActors)
|
||||
{
|
||||
if (mActors[i])
|
||||
if (mActor)
|
||||
{
|
||||
delete mActors[i];
|
||||
delete mActor;
|
||||
}
|
||||
}
|
||||
mActors.clear();
|
||||
@@ -152,8 +151,8 @@ namespace EMStudio
|
||||
}
|
||||
|
||||
// get the index of the emstudio actor, we can be sure it is valid as else the emstudioActor pointer would be nullptr already
|
||||
const uint32 index = FindEMStudioActorIndex(emstudioActor);
|
||||
MCORE_ASSERT(index != MCORE_INVALIDINDEX32);
|
||||
const size_t index = FindEMStudioActorIndex(emstudioActor);
|
||||
MCORE_ASSERT(index != InvalidIndex);
|
||||
|
||||
// get rid of the emstudio actor
|
||||
delete emstudioActor;
|
||||
@@ -167,7 +166,6 @@ namespace EMStudio
|
||||
{
|
||||
// get the current manipulator
|
||||
AZStd::vector<MCommon::TransformationManipulator*>* transformationManipulators = GetManager()->GetTransformationManipulators();
|
||||
const uint32 numGizmos = transformationManipulators->size();
|
||||
|
||||
// init the active manipulator to nullptr
|
||||
MCommon::TransformationManipulator* activeManipulator = nullptr;
|
||||
@@ -175,10 +173,9 @@ namespace EMStudio
|
||||
bool activeManipulatorFound = false;
|
||||
|
||||
// iterate over all gizmos and search for the hit one that is closest to the camera
|
||||
for (uint32 i = 0; i < numGizmos; ++i)
|
||||
for (MCommon::TransformationManipulator* currentManipulator : *transformationManipulators)
|
||||
{
|
||||
// get the current manipulator and check if it exists
|
||||
MCommon::TransformationManipulator* currentManipulator = transformationManipulators->at(i);
|
||||
if (currentManipulator == nullptr || currentManipulator->GetIsVisible() == false)
|
||||
{
|
||||
continue;
|
||||
@@ -275,8 +272,8 @@ namespace EMStudio
|
||||
const AZ::Vector3 jointPosition = pose->GetWorldSpaceTransform(joint->GetNodeIndex()).mPosition;
|
||||
aabb.AddPoint(jointPosition);
|
||||
|
||||
const AZ::u32 childCount = joint->GetNumChildNodes();
|
||||
for (AZ::u32 i = 0; i < childCount; ++i)
|
||||
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;
|
||||
@@ -314,80 +311,49 @@ namespace EMStudio
|
||||
}
|
||||
|
||||
// try to locate the helper actor for a given instance
|
||||
RenderPlugin::EMStudioRenderActor* RenderPlugin::FindEMStudioActor(EMotionFX::ActorInstance* actorInstance, bool doubleCheckInstance)
|
||||
RenderPlugin::EMStudioRenderActor* RenderPlugin::FindEMStudioActor(const EMotionFX::ActorInstance* actorInstance, bool doubleCheckInstance) const
|
||||
{
|
||||
// get the number of emstudio actors and iterate through them
|
||||
const uint32 numEMStudioRenderActors = mActors.size();
|
||||
for (uint32 i = 0; i < numEMStudioRenderActors; ++i)
|
||||
const auto foundActor = AZStd::find_if(begin(mActors), end(mActors), [actorInstance, doubleCheckInstance](const EMStudioRenderActor* renderActor)
|
||||
{
|
||||
EMStudioRenderActor* EMStudioRenderActor = mActors[i];
|
||||
|
||||
// is the parent actor of the instance the same as the one in the emstudio actor?
|
||||
if (EMStudioRenderActor->mActor == actorInstance->GetActor())
|
||||
if (renderActor->mActor == 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 uint32 numActorInstances = EMStudioRenderActor->mActorInstances.size();
|
||||
for (uint32 a = 0; a < numActorInstances; ++a)
|
||||
{
|
||||
if (EMStudioRenderActor->mActorInstances[a] == actorInstance)
|
||||
{
|
||||
return EMStudioRenderActor;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return EMStudioRenderActor;
|
||||
const auto foundActorInstance = AZStd::find(begin(renderActor->mActorInstances), end(renderActor->mActorInstances), actorInstance);
|
||||
return foundActorInstance != end(renderActor->mActorInstances);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
return false;
|
||||
});
|
||||
return foundActor != end(mActors) ? *foundActor : nullptr;
|
||||
}
|
||||
|
||||
|
||||
// try to locate the helper actor for a given one
|
||||
RenderPlugin::EMStudioRenderActor* RenderPlugin::FindEMStudioActor(EMotionFX::Actor* actor)
|
||||
RenderPlugin::EMStudioRenderActor* RenderPlugin::FindEMStudioActor(const EMotionFX::Actor* actor) const
|
||||
{
|
||||
if (!actor)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const uint32 numEMStudioRenderActors = mActors.size();
|
||||
for (uint32 i = 0; i < numEMStudioRenderActors; ++i)
|
||||
const auto foundActor = AZStd::find_if(begin(mActors), end(mActors), [match = actor](const EMStudioRenderActor* actor)
|
||||
{
|
||||
EMStudioRenderActor* EMStudioRenderActor = mActors[i];
|
||||
|
||||
if (EMStudioRenderActor->mActor == actor)
|
||||
{
|
||||
return EMStudioRenderActor;
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
return actor->mActor == match;
|
||||
});
|
||||
return foundActor != end(mActors) ? *foundActor : nullptr;
|
||||
}
|
||||
|
||||
|
||||
// get the index of the given emstudio actor
|
||||
uint32 RenderPlugin::FindEMStudioActorIndex(EMStudioRenderActor* EMStudioRenderActor)
|
||||
size_t RenderPlugin::FindEMStudioActorIndex(const EMStudioRenderActor* EMStudioRenderActor) const
|
||||
{
|
||||
// get the number of emstudio actors and iterate through them
|
||||
const uint32 numEMStudioRenderActors = mActors.size();
|
||||
for (uint32 i = 0; i < numEMStudioRenderActors; ++i)
|
||||
{
|
||||
// compare the two emstudio actors and return the current index in case of success
|
||||
if (EMStudioRenderActor == mActors[i])
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
// the emstudio actor has not been found
|
||||
return MCORE_INVALIDINDEX32;
|
||||
const auto foundActor = AZStd::find(begin(mActors), end(mActors), EMStudioRenderActor);
|
||||
return foundActor != end(mActors) ? AZStd::distance(begin(mActors), foundActor) : InvalidIndex;
|
||||
}
|
||||
|
||||
|
||||
@@ -417,8 +383,8 @@ namespace EMStudio
|
||||
}
|
||||
|
||||
// 1. Create new emstudio actors
|
||||
uint32 numActors = EMotionFX::GetActorManager().GetNumActors();
|
||||
for (uint32 i = 0; i < numActors; ++i)
|
||||
size_t numActors = EMotionFX::GetActorManager().GetNumActors();
|
||||
for (size_t i = 0; i < numActors; ++i)
|
||||
{
|
||||
// get the current actor and the number of clones
|
||||
EMotionFX::Actor* actor = EMotionFX::GetActorManager().GetActor(i);
|
||||
@@ -438,13 +404,13 @@ namespace EMStudio
|
||||
}
|
||||
}
|
||||
|
||||
for (uint32 i = 0; i < mActors.size(); ++i)
|
||||
for (size_t i = 0; i < mActors.size(); ++i)
|
||||
{
|
||||
EMStudioRenderActor* emstudioActor = mActors[i];
|
||||
EMotionFX::Actor* actor = emstudioActor->mActor;
|
||||
|
||||
bool found = false;
|
||||
for (uint32 j = 0; j < numActors; ++j)
|
||||
for (size_t j = 0; j < numActors; ++j)
|
||||
{
|
||||
EMotionFX::Actor* curActor = EMotionFX::GetActorManager().GetActor(j);
|
||||
if (actor == curActor)
|
||||
@@ -462,8 +428,8 @@ namespace EMStudio
|
||||
}
|
||||
|
||||
// 3. Relink the actor instances with the emstudio actors
|
||||
const uint32 numActorInstances = EMotionFX::GetActorManager().GetNumActorInstances();
|
||||
for (uint32 i = 0; i < numActorInstances; ++i)
|
||||
const size_t numActorInstances = EMotionFX::GetActorManager().GetNumActorInstances();
|
||||
for (size_t i = 0; i < numActorInstances; ++i)
|
||||
{
|
||||
EMotionFX::ActorInstance* actorInstance = EMotionFX::GetActorManager().GetActorInstance(i);
|
||||
EMotionFX::Actor* actor = actorInstance->GetActor();
|
||||
@@ -476,9 +442,8 @@ namespace EMStudio
|
||||
|
||||
if (!emstudioActor)
|
||||
{
|
||||
for (uint32 j = 0; j < mActors.size(); ++j)
|
||||
for (EMStudioRenderActor* currentEMStudioActor : mActors)
|
||||
{
|
||||
EMStudioRenderActor* currentEMStudioActor = mActors[j];
|
||||
if (actor == currentEMStudioActor->mActor)
|
||||
{
|
||||
emstudioActor = currentEMStudioActor;
|
||||
@@ -503,12 +468,12 @@ namespace EMStudio
|
||||
// 4. Unlink invalid actor instances from the emstudio actors
|
||||
for (EMStudioRenderActor* emstudioActor : mActors)
|
||||
{
|
||||
for (uint32 j = 0; j < emstudioActor->mActorInstances.size();)
|
||||
for (size_t j = 0; j < emstudioActor->mActorInstances.size();)
|
||||
{
|
||||
EMotionFX::ActorInstance* emstudioActorInstance = emstudioActor->mActorInstances[j];
|
||||
bool found = false;
|
||||
|
||||
for (uint32 k = 0; k < numActorInstances; ++k)
|
||||
for (size_t k = 0; k < numActorInstances; ++k)
|
||||
{
|
||||
if (emstudioActorInstance == EMotionFX::GetActorManager().GetActorInstance(k))
|
||||
{
|
||||
@@ -566,14 +531,11 @@ namespace EMStudio
|
||||
RenderPlugin::EMStudioRenderActor::~EMStudioRenderActor()
|
||||
{
|
||||
// get the number of actor instances and iterate through them
|
||||
const uint32 numActorInstances = mActorInstances.size();
|
||||
for (uint32 i = 0; i < numActorInstances; ++i)
|
||||
for (EMotionFX::ActorInstance* actorInstance : mActorInstances)
|
||||
{
|
||||
EMotionFX::ActorInstance* actorInstance = mActorInstances[i];
|
||||
|
||||
// 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
|
||||
if (EMotionFX::GetActorManager().FindActorInstanceIndex(actorInstance) != MCORE_INVALIDINDEX32)
|
||||
if (EMotionFX::GetActorManager().FindActorInstanceIndex(actorInstance) != InvalidIndex)
|
||||
{
|
||||
//actorInstance->Destroy();
|
||||
}
|
||||
@@ -587,13 +549,9 @@ 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) != MCORE_INVALIDINDEX32)
|
||||
{
|
||||
//mActor->Destroy();
|
||||
}
|
||||
// in case the actor is not valid anymore make sure to unselect it to avoid bad pointers
|
||||
else
|
||||
if (EMotionFX::GetActorManager().FindActorIndex(mActor) == 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);
|
||||
}
|
||||
@@ -810,8 +768,8 @@ namespace EMStudio
|
||||
|
||||
void RenderPlugin::UpdateActorInstances(float timePassedInSeconds)
|
||||
{
|
||||
const uint32 numActorInstances = EMotionFX::GetActorManager().GetNumActorInstances();
|
||||
for (uint32 i = 0; i < numActorInstances; ++i)
|
||||
const size_t numActorInstances = EMotionFX::GetActorManager().GetNumActorInstances();
|
||||
for (size_t i = 0; i < numActorInstances; ++i)
|
||||
{
|
||||
EMotionFX::ActorInstance* actorInstance = EMotionFX::GetActorManager().GetActorInstance(i);
|
||||
|
||||
@@ -889,8 +847,8 @@ namespace EMStudio
|
||||
}
|
||||
|
||||
// get the number of actor instances and iterate through them
|
||||
const uint32 numActorInstances = EMotionFX::GetActorManager().GetNumActorInstances();
|
||||
for (uint32 i = 0; i < numActorInstances; ++i)
|
||||
const size_t numActorInstances = EMotionFX::GetActorManager().GetNumActorInstances();
|
||||
for (size_t i = 0; i < numActorInstances; ++i)
|
||||
{
|
||||
// get the actor instance and update its transformations and meshes
|
||||
EMotionFX::ActorInstance* actorInstance = EMotionFX::GetActorManager().GetActorInstance(i);
|
||||
@@ -1045,10 +1003,10 @@ namespace EMStudio
|
||||
{
|
||||
// get the current selection
|
||||
CommandSystem::SelectionList& selectionList = GetCommandManager()->GetCurrentSelection();
|
||||
const uint32 numSelectedActorInstances = selectionList.GetNumSelectedActorInstances();
|
||||
const size_t numSelectedActorInstances = selectionList.GetNumSelectedActorInstances();
|
||||
|
||||
// iterate through the actor instances and reset their trajectory path
|
||||
for (uint32 i = 0; i < numSelectedActorInstances; ++i)
|
||||
for (size_t i = 0; i < numSelectedActorInstances; ++i)
|
||||
{
|
||||
// get the actor instance and find the corresponding trajectory path
|
||||
EMotionFX::ActorInstance* actorInstance = selectionList.GetActorInstance(i);
|
||||
@@ -1080,7 +1038,7 @@ namespace EMStudio
|
||||
}
|
||||
else
|
||||
{
|
||||
const uint32 numParticles = trajectoryPath->mTraceParticles.size();
|
||||
const size_t numParticles = trajectoryPath->mTraceParticles.size();
|
||||
const EMotionFX::Transform& oldWorldTM = trajectoryPath->mTraceParticles[numParticles - 1].mWorldTM;
|
||||
|
||||
const AZ::Vector3& oldPos = oldWorldTM.mPosition;
|
||||
@@ -1141,8 +1099,8 @@ namespace EMStudio
|
||||
RenderViewWidget* widget = GetActiveViewWidget();
|
||||
RenderOptions* renderOptions = GetRenderOptions();
|
||||
|
||||
const AZStd::unordered_set<AZ::u32>& visibleJointIndices = GetManager()->GetVisibleJointIndices();
|
||||
const AZStd::unordered_set<AZ::u32>& selectedJointIndices = GetManager()->GetSelectedJointIndices();
|
||||
const AZStd::unordered_set<size_t>& visibleJointIndices = GetManager()->GetVisibleJointIndices();
|
||||
const AZStd::unordered_set<size_t>& selectedJointIndices = GetManager()->GetSelectedJointIndices();
|
||||
|
||||
// render the AABBs
|
||||
if (widget->GetRenderFlag(RenderViewWidget::RENDER_AABB))
|
||||
@@ -1219,12 +1177,12 @@ namespace EMStudio
|
||||
// iterate through all enabled nodes
|
||||
const EMotionFX::Pose* pose = actorInstance->GetTransformData()->GetCurrentPose();
|
||||
|
||||
const uint32 geomLODLevel = actorInstance->GetLODLevel();
|
||||
const uint32 numEnabled = actorInstance->GetNumEnabledNodes();
|
||||
for (uint32 i = 0; i < numEnabled; ++i)
|
||||
const size_t geomLODLevel = actorInstance->GetLODLevel();
|
||||
const size_t numEnabled = actorInstance->GetNumEnabledNodes();
|
||||
for (size_t i = 0; i < numEnabled; ++i)
|
||||
{
|
||||
EMotionFX::Node* node = emstudioActor->mActor->GetSkeleton()->GetNode(actorInstance->GetEnabledNode(i));
|
||||
const AZ::u32 nodeIndex = node->GetNodeIndex();
|
||||
const size_t nodeIndex = node->GetNodeIndex();
|
||||
EMotionFX::Mesh* mesh = emstudioActor->mActor->GetMesh(geomLODLevel, nodeIndex);
|
||||
|
||||
renderUtil->ResetCurrentMesh();
|
||||
|
||||
+3
-3
@@ -106,9 +106,9 @@ namespace EMStudio
|
||||
PluginOptions* GetOptions() override { return &mRenderOptions; }
|
||||
|
||||
// render actors
|
||||
EMStudioRenderActor* FindEMStudioActor(EMotionFX::ActorInstance* actorInstance, bool doubleCheckInstance = true);
|
||||
EMStudioRenderActor* FindEMStudioActor(EMotionFX::Actor* actor);
|
||||
uint32 FindEMStudioActorIndex(EMStudioRenderActor* EMStudioRenderActor);
|
||||
EMStudioRenderActor* FindEMStudioActor(const EMotionFX::ActorInstance* actorInstance, bool doubleCheckInstance = true) const;
|
||||
EMStudioRenderActor* FindEMStudioActor(const EMotionFX::Actor* actor) const;
|
||||
size_t FindEMStudioActorIndex(const EMStudioRenderActor* EMStudioRenderActor) const;
|
||||
|
||||
void AddEMStudioActor(EMStudioRenderActor* emstudioActor);
|
||||
bool DestroyEMStudioActor(EMotionFX::Actor* actor);
|
||||
|
||||
+6
-6
@@ -90,7 +90,7 @@ namespace EMStudio
|
||||
}
|
||||
else
|
||||
{
|
||||
const uint32 numParticles = trajectoryPath->mTraceParticles.size();
|
||||
const size_t numParticles = trajectoryPath->mTraceParticles.size();
|
||||
const EMotionFX::Transform& oldGlobalTM = trajectoryPath->mTraceParticles[numParticles - 1].mWorldTM;
|
||||
|
||||
const AZ::Vector3& oldPos = oldGlobalTM.mPosition;
|
||||
@@ -160,8 +160,8 @@ namespace EMStudio
|
||||
RenderViewWidget* widget = mPlugin->GetActiveViewWidget();
|
||||
RenderOptions* renderOptions = mPlugin->GetRenderOptions();
|
||||
|
||||
const AZStd::unordered_set<AZ::u32>& visibleJointIndices = GetManager()->GetVisibleJointIndices();
|
||||
const AZStd::unordered_set<AZ::u32>& selectedJointIndices = GetManager()->GetSelectedJointIndices();
|
||||
const AZStd::unordered_set<size_t>& visibleJointIndices = GetManager()->GetVisibleJointIndices();
|
||||
const AZStd::unordered_set<size_t>& selectedJointIndices = GetManager()->GetSelectedJointIndices();
|
||||
|
||||
// render the AABBs
|
||||
if (widget->GetRenderFlag(RenderViewWidget::RENDER_AABB))
|
||||
@@ -216,9 +216,9 @@ namespace EMStudio
|
||||
{
|
||||
// iterate through all enabled nodes
|
||||
const EMotionFX::Pose* pose = actorInstance->GetTransformData()->GetCurrentPose();
|
||||
const uint32 geomLODLevel = actorInstance->GetLODLevel();
|
||||
const uint32 numEnabled = actorInstance->GetNumEnabledNodes();
|
||||
for (uint32 i = 0; i < numEnabled; ++i)
|
||||
const size_t geomLODLevel = actorInstance->GetLODLevel();
|
||||
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());
|
||||
|
||||
+17
-25
@@ -256,10 +256,8 @@ namespace EMStudio
|
||||
const AZStd::vector<MCommon::TransformationManipulator*>* transformationManipulators = GetManager()->GetTransformationManipulators();
|
||||
|
||||
// render all visible gizmos
|
||||
const uint32 numGizmos = transformationManipulators->size();
|
||||
for (uint32 i = 0; i < numGizmos; ++i)
|
||||
for (MCommon::TransformationManipulator* activeManipulator : *transformationManipulators)
|
||||
{
|
||||
MCommon::TransformationManipulator* activeManipulator = transformationManipulators->at(i);
|
||||
if (activeManipulator == nullptr)
|
||||
{
|
||||
continue;
|
||||
@@ -527,10 +525,10 @@ namespace EMStudio
|
||||
// handle visual mouse selection
|
||||
if (EMStudio::GetCommandManager()->GetLockSelection() == false && gizmoHit == false) // avoid selection operations when there is only one actor instance
|
||||
{
|
||||
AZ::u32 editorActorInstanceCount = 0;
|
||||
size_t editorActorInstanceCount = 0;
|
||||
const EMotionFX::ActorManager& actorManager = EMotionFX::GetActorManager();
|
||||
const AZ::u32 totalActorInstanceCount = actorManager.GetNumActorInstances();
|
||||
for (AZ::u32 i = 0; i < totalActorInstanceCount; ++i)
|
||||
const size_t totalActorInstanceCount = actorManager.GetNumActorInstances();
|
||||
for (size_t i = 0; i < totalActorInstanceCount; ++i)
|
||||
{
|
||||
const EMotionFX::ActorInstance* actorInstance = actorManager.GetActorInstance(i);
|
||||
if (!actorInstance->GetIsOwnedByRuntime())
|
||||
@@ -557,8 +555,8 @@ namespace EMStudio
|
||||
const MCore::Ray ray = mCamera->Unproject(mousePosX, mousePosY);
|
||||
|
||||
// get the number of actor instances and iterate through them
|
||||
const uint32 numActorInstances = EMotionFX::GetActorManager().GetNumActorInstances();
|
||||
for (uint32 i = 0; i < numActorInstances; ++i)
|
||||
const size_t numActorInstances = EMotionFX::GetActorManager().GetNumActorInstances();
|
||||
for (size_t i = 0; i < numActorInstances; ++i)
|
||||
{
|
||||
EMotionFX::ActorInstance* actorInstance = EMotionFX::GetActorManager().GetActorInstance(i);
|
||||
if (actorInstance->GetIsVisible() == false || actorInstance->GetRender() == false || actorInstance->GetIsUsedForVisualization() || actorInstance->GetIsOwnedByRuntime())
|
||||
@@ -622,8 +620,8 @@ namespace EMStudio
|
||||
if (ctrlPressed)
|
||||
{
|
||||
// add the old selection to the selected actor instances (selection mode = add)
|
||||
const uint32 numSelectedActorInstances = selection.GetNumSelectedActorInstances();
|
||||
for (uint32 i = 0; i < numSelectedActorInstances; ++i)
|
||||
const size_t numSelectedActorInstances = selection.GetNumSelectedActorInstances();
|
||||
for (size_t i = 0; i < numSelectedActorInstances; ++i)
|
||||
{
|
||||
mSelectedActorInstances.emplace_back(selection.GetActorInstance(i));
|
||||
}
|
||||
@@ -922,8 +920,8 @@ namespace EMStudio
|
||||
AZ::Vector3 actorInstancePos;
|
||||
|
||||
EMotionFX::Actor* followActor = followInstance->GetActor();
|
||||
const uint32 motionExtractionNodeIndex = followActor->GetMotionExtractionNodeIndex();
|
||||
if (motionExtractionNodeIndex != MCORE_INVALIDINDEX32)
|
||||
const size_t motionExtractionNodeIndex = followActor->GetMotionExtractionNodeIndex();
|
||||
if (motionExtractionNodeIndex != InvalidIndex)
|
||||
{
|
||||
actorInstancePos = followInstance->GetWorldSpaceTransform().mPosition;
|
||||
RenderPlugin::EMStudioRenderActor* emstudioActor = mPlugin->FindEMStudioActor(followActor);
|
||||
@@ -1007,14 +1005,10 @@ namespace EMStudio
|
||||
}
|
||||
|
||||
AZStd::vector<MCommon::TransformationManipulator*>* transformationManipulators = GetManager()->GetTransformationManipulators();
|
||||
const uint32 numGizmos = transformationManipulators->size();
|
||||
|
||||
// render all visible gizmos
|
||||
for (uint32 i = 0; i < numGizmos; ++i)
|
||||
for (MCommon::TransformationManipulator* activeManipulator : *transformationManipulators)
|
||||
{
|
||||
// update the gizmos
|
||||
MCommon::TransformationManipulator* activeManipulator = transformationManipulators->at(i);
|
||||
|
||||
// update the gizmos if there is an active manipulator
|
||||
if (activeManipulator == nullptr)
|
||||
{
|
||||
@@ -1046,11 +1040,9 @@ namespace EMStudio
|
||||
}
|
||||
|
||||
// render custom triangles
|
||||
const uint32 numTriangles = mTriangles.size();
|
||||
for (uint32 i = 0; i < numTriangles; ++i)
|
||||
for (const Triangle& curTri : mTriangles)
|
||||
{
|
||||
const Triangle& curTri = mTriangles[i];
|
||||
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.mPosA, curTri.mPosB, curTri.mPosC, curTri.mNormalA, curTri.mNormalB, curTri.mNormalC, curTri.mColor); // TODO: make renderutil use uint32 colors instead
|
||||
}
|
||||
|
||||
ClearTriangles();
|
||||
@@ -1068,8 +1060,8 @@ namespace EMStudio
|
||||
}
|
||||
|
||||
// render all custom plugin visuals
|
||||
const uint32 numPlugins = GetPluginManager()->GetNumActivePlugins();
|
||||
for (uint32 i = 0; i < numPlugins; ++i)
|
||||
const size_t numPlugins = GetPluginManager()->GetNumActivePlugins();
|
||||
for (size_t i = 0; i < numPlugins; ++i)
|
||||
{
|
||||
EMStudioPlugin* plugin = GetPluginManager()->GetActivePlugin(i);
|
||||
EMStudioPlugin::RenderInfo renderInfo(renderUtil, mCamera, mWidth, mHeight);
|
||||
@@ -1131,8 +1123,8 @@ namespace EMStudio
|
||||
///// EMotionFX::GetEMotionFX().Update(0.0f);
|
||||
|
||||
// render
|
||||
const uint32 numActorInstances = EMotionFX::GetActorManager().GetNumActorInstances();
|
||||
for (uint32 i = 0; i < numActorInstances; ++i)
|
||||
const size_t numActorInstances = EMotionFX::GetActorManager().GetNumActorInstances();
|
||||
for (size_t i = 0; i < numActorInstances; ++i)
|
||||
{
|
||||
EMotionFX::ActorInstance* actorInstance = EMotionFX::GetActorManager().GetActorInstance(i);
|
||||
if (actorInstance->GetRender() && actorInstance->GetIsVisible() && actorInstance->GetIsOwnedByRuntime() == false)
|
||||
|
||||
+2
-2
@@ -29,8 +29,8 @@ namespace EMStudio
|
||||
template<class ManagerType, typename GetNumFunc, typename GetEntityFunc>
|
||||
bool HasEntityInEditor(const ManagerType& manager, const GetNumFunc& getNumEntitiesFunc, const GetEntityFunc& getEntityFunc)
|
||||
{
|
||||
const uint32 numEntities = (manager.*getNumEntitiesFunc)();
|
||||
for (uint32 i = 0; i < numEntities; ++i)
|
||||
const size_t numEntities = (manager.*getNumEntitiesFunc)();
|
||||
for (size_t i = 0; i < numEntities; ++i)
|
||||
{
|
||||
const auto& entity = (manager.*getEntityFunc)(i);
|
||||
if (!entity->GetIsOwnedByRuntime())
|
||||
|
||||
+17
-17
@@ -139,15 +139,15 @@ namespace EMStudio
|
||||
ActivationIndicesByActorInstance activationIndicesByActorInstance;
|
||||
int32 commandIndex = 0;
|
||||
|
||||
const uint32 numActorInstances = EMotionFX::GetActorManager().GetNumActorInstances();
|
||||
const size_t numActorInstances = EMotionFX::GetActorManager().GetNumActorInstances();
|
||||
|
||||
// actors
|
||||
const uint32 numActors = EMotionFX::GetActorManager().GetNumActors();
|
||||
for (uint32 i = 0; i < numActors; ++i)
|
||||
const size_t numActors = EMotionFX::GetActorManager().GetNumActors();
|
||||
for (size_t i = 0; i < numActors; ++i)
|
||||
{
|
||||
EMotionFX::Actor* actor = EMotionFX::GetActorManager().GetActor(i);
|
||||
|
||||
for (uint32 j = 0; j < numActorInstances; ++j)
|
||||
for (size_t j = 0; j < numActorInstances; ++j)
|
||||
{
|
||||
EMotionFX::ActorInstance* actorInstance = EMotionFX::GetActorManager().GetActorInstance(j);
|
||||
if (actorInstance->GetActor() != actor)
|
||||
@@ -184,7 +184,7 @@ namespace EMStudio
|
||||
}
|
||||
|
||||
// attachments
|
||||
for (uint32 i = 0; i < numActorInstances; ++i)
|
||||
for (size_t i = 0; i < numActorInstances; ++i)
|
||||
{
|
||||
EMotionFX::ActorInstance* actorInstance = EMotionFX::GetActorManager().GetActorInstance(i);
|
||||
|
||||
@@ -197,23 +197,23 @@ namespace EMStudio
|
||||
{
|
||||
EMotionFX::Attachment* attachment = actorInstance->GetSelfAttachment();
|
||||
EMotionFX::ActorInstance* attachedToActorInstance = attachment->GetAttachToActorInstance();
|
||||
const uint32 attachedToInstanceIndex = EMotionFX::GetActorManager().FindActorInstanceIndex(attachedToActorInstance);
|
||||
const uint32 attachtmentInstanceIndex = EMotionFX::GetActorManager().FindActorInstanceIndex(actorInstance);
|
||||
const size_t attachedToInstanceIndex = EMotionFX::GetActorManager().FindActorInstanceIndex(attachedToActorInstance);
|
||||
const size_t attachtmentInstanceIndex = EMotionFX::GetActorManager().FindActorInstanceIndex(actorInstance);
|
||||
|
||||
if (actorInstance->GetIsSkinAttachment())
|
||||
{
|
||||
commandString = AZStd::string::format("AddDeformableAttachment -attachmentIndex %d -attachToIndex %d\n", attachtmentInstanceIndex, attachedToInstanceIndex);
|
||||
commandString = AZStd::string::format("AddDeformableAttachment -attachmentIndex %zu -attachToIndex %zu\n", attachtmentInstanceIndex, attachedToInstanceIndex);
|
||||
commands += commandString;
|
||||
++commandIndex;
|
||||
}
|
||||
else
|
||||
{
|
||||
EMotionFX::AttachmentNode* attachmentSingleNode = static_cast<EMotionFX::AttachmentNode*>(attachment);
|
||||
const uint32 attachedToNodeIndex = attachmentSingleNode->GetAttachToNodeIndex();
|
||||
const size_t attachedToNodeIndex = attachmentSingleNode->GetAttachToNodeIndex();
|
||||
EMotionFX::Actor* attachedToActor = attachedToActorInstance->GetActor();
|
||||
EMotionFX::Node* attachedToNode = attachedToActor->GetSkeleton()->GetNode(attachedToNodeIndex);
|
||||
|
||||
commandString = AZStd::string::format("AddAttachment -attachmentIndex %d -attachToIndex %d -attachToNode \"%s\"\n", attachtmentInstanceIndex, attachedToInstanceIndex, attachedToNode->GetName());
|
||||
commandString = AZStd::string::format("AddAttachment -attachmentIndex %zu -attachToIndex %zu -attachToNode \"%s\"\n", attachtmentInstanceIndex, attachedToInstanceIndex, attachedToNode->GetName());
|
||||
commands += commandString;
|
||||
++commandIndex;
|
||||
}
|
||||
@@ -221,9 +221,9 @@ namespace EMStudio
|
||||
}
|
||||
|
||||
// motion sets
|
||||
const uint32 numRootMotionSets = EMotionFX::GetMotionManager().CalcNumRootMotionSets();
|
||||
const size_t numRootMotionSets = EMotionFX::GetMotionManager().CalcNumRootMotionSets();
|
||||
AZStd::unordered_set<EMotionFX::Motion*> motionsInMotionSets;
|
||||
for (uint32 i = 0; i < numRootMotionSets; ++i)
|
||||
for (size_t i = 0; i < numRootMotionSets; ++i)
|
||||
{
|
||||
EMotionFX::MotionSet* motionSet = EMotionFX::GetMotionManager().FindRootMotionSet(i);
|
||||
|
||||
@@ -255,8 +255,8 @@ namespace EMStudio
|
||||
}
|
||||
|
||||
// motions that are not in the above motion sets
|
||||
const uint32 numMotions = EMotionFX::GetMotionManager().GetNumMotions();
|
||||
for (uint32 i = 0; i < numMotions; ++i)
|
||||
const size_t numMotions = EMotionFX::GetMotionManager().GetNumMotions();
|
||||
for (size_t i = 0; i < numMotions; ++i)
|
||||
{
|
||||
EMotionFX::Motion* motion = EMotionFX::GetMotionManager().GetMotion(i);
|
||||
|
||||
@@ -277,8 +277,8 @@ namespace EMStudio
|
||||
// We need to avoid storing two times the same anim graph. This could happen if the anim graph was loaded from a reference
|
||||
// node. We need to integrate the asset system into the AnimGraphManager
|
||||
AZStd::unordered_set<AZStd::string> animGraphFilenames;
|
||||
const uint32 numAnimGraphs = EMotionFX::GetAnimGraphManager().GetNumAnimGraphs();
|
||||
for (uint32 i = 0; i < numAnimGraphs; ++i)
|
||||
const size_t numAnimGraphs = EMotionFX::GetAnimGraphManager().GetNumAnimGraphs();
|
||||
for (size_t i = 0; i < numAnimGraphs; ++i)
|
||||
{
|
||||
EMotionFX::AnimGraph* animGraph = EMotionFX::GetAnimGraphManager().GetAnimGraph(i);
|
||||
|
||||
@@ -317,7 +317,7 @@ namespace EMStudio
|
||||
}
|
||||
|
||||
// activate anim graph for each actor instance
|
||||
for (uint32 i = 0; i < numActorInstances; ++i)
|
||||
for (size_t i = 0; i < numActorInstances; ++i)
|
||||
{
|
||||
EMotionFX::ActorInstance* actorInstance = EMotionFX::GetActorManager().GetActorInstance(i);
|
||||
|
||||
|
||||
+10
-10
@@ -42,8 +42,8 @@ namespace EMStudio
|
||||
if (MCore::GetLogManager().GetLogLevels() & MCore::LogCallback::LOGLEVEL_DEBUG)
|
||||
{
|
||||
mTempString = command->GetName();
|
||||
const uint32 numParameters = commandLine.GetNumParameters();
|
||||
for (uint32 i = 0; i < numParameters; ++i)
|
||||
const size_t numParameters = commandLine.GetNumParameters();
|
||||
for (size_t i = 0; i < numParameters; ++i)
|
||||
{
|
||||
mTempString += " -";
|
||||
mTempString += commandLine.GetParameterName(i);
|
||||
@@ -130,8 +130,8 @@ namespace EMStudio
|
||||
MCORE_UNUSED(commandLine);
|
||||
mTempString = MCore::CommandManager::CommandHistoryEntry::ToString(group, command, mIndex++).c_str();
|
||||
|
||||
mList->insertItem(historyIndex, new QListWidgetItem(mTempString.c_str(), mList));
|
||||
mList->setCurrentRow(historyIndex);
|
||||
mList->insertItem(aznumeric_caster(historyIndex), new QListWidgetItem(mTempString.c_str(), mList));
|
||||
mList->setCurrentRow(aznumeric_caster(historyIndex));
|
||||
}
|
||||
|
||||
// Remove an item from the history.
|
||||
@@ -168,7 +168,7 @@ namespace EMStudio
|
||||
mList->setCurrentRow(aznumeric_caster(index));
|
||||
|
||||
// Get the current history index.
|
||||
const uint32 historyIndex = GetCommandManager()->GetHistoryIndex();
|
||||
const size_t historyIndex = GetCommandManager()->GetHistoryIndex();
|
||||
if (historyIndex == InvalidIndex)
|
||||
{
|
||||
AZStd::string outResult;
|
||||
@@ -189,8 +189,8 @@ namespace EMStudio
|
||||
else if (historyIndex > index) // if we need to perform undo's
|
||||
{
|
||||
AZStd::string outResult;
|
||||
const int32 numUndos = historyIndex - index;
|
||||
for (int32 i = 0; i < numUndos; ++i)
|
||||
const ptrdiff_t numUndos = historyIndex - index;
|
||||
for (ptrdiff_t i = 0; i < numUndos; ++i)
|
||||
{
|
||||
// try to undo
|
||||
outResult.clear();
|
||||
@@ -207,8 +207,8 @@ namespace EMStudio
|
||||
else if (historyIndex < index) // if we need to redo commands
|
||||
{
|
||||
AZStd::string outResult;
|
||||
const int32 numRedos = index - historyIndex;
|
||||
for (int32 i = 0; i < numRedos; ++i)
|
||||
const ptrdiff_t numRedos = index - historyIndex;
|
||||
for (ptrdiff_t i = 0; i < numRedos; ++i)
|
||||
{
|
||||
outResult.clear();
|
||||
const bool result = GetCommandManager()->Redo(outResult);
|
||||
@@ -223,7 +223,7 @@ namespace EMStudio
|
||||
}
|
||||
|
||||
const int numCommands = static_cast<int>(GetCommandManager()->GetNumHistoryItems());
|
||||
for (int i = index; i < numCommands; ++i)
|
||||
for (int i = aznumeric_caster(index); i < numCommands; ++i)
|
||||
{
|
||||
mList->item(i)->setForeground(m_darkenedBrush);
|
||||
}
|
||||
|
||||
+6
-6
@@ -210,8 +210,8 @@ namespace EMStudio
|
||||
defaultPlayBackInfo->mBlendOutTime = 0.0f;
|
||||
commandParameters = CommandSystem::CommandPlayMotion::PlayBackInfoToCommandParameters(defaultPlayBackInfo);
|
||||
|
||||
const AZ::u32 motionIndex = EMotionFX::GetMotionManager().FindMotionIndexByName(motion->GetName());
|
||||
commandString = AZStd::string::format("Select -motionIndex %d", motionIndex);
|
||||
const size_t motionIndex = EMotionFX::GetMotionManager().FindMotionIndexByName(motion->GetName());
|
||||
commandString = AZStd::string::format("Select -motionIndex %zu", motionIndex);
|
||||
commandGroup.AddCommandString(commandString);
|
||||
|
||||
commandString = AZStd::string::format("PlayMotion -filename \"%s\" %s", motion->GetFileName(), commandParameters.c_str());
|
||||
@@ -472,8 +472,8 @@ namespace EMStudio
|
||||
const EMotionFX::MotionManager& motionManager = EMotionFX::GetMotionManager();
|
||||
|
||||
// In case no motion set was selected yet, use the first available. The activate graph callback will update the UI.
|
||||
const AZ::u32 numMotionSets = motionManager.GetNumMotionSets();
|
||||
for (AZ::u32 i = 0; i < numMotionSets; ++i)
|
||||
const size_t numMotionSets = motionManager.GetNumMotionSets();
|
||||
for (size_t i = 0; i < numMotionSets; ++i)
|
||||
{
|
||||
EMotionFX::MotionSet* currentMotionSet = motionManager.GetMotionSet(i);
|
||||
if (!currentMotionSet->GetIsOwnedByRuntime())
|
||||
@@ -494,7 +494,7 @@ namespace EMStudio
|
||||
void AnimGraphActionManager::ActivateGraphForSelectedActors(EMotionFX::AnimGraph* animGraph, EMotionFX::MotionSet* motionSet)
|
||||
{
|
||||
const CommandSystem::SelectionList& selectionList = GetCommandManager()->GetCurrentSelection();
|
||||
const uint32 numActorInstances = selectionList.GetNumSelectedActorInstances();
|
||||
const size_t numActorInstances = selectionList.GetNumSelectedActorInstances();
|
||||
|
||||
if (numActorInstances == 0)
|
||||
{
|
||||
@@ -507,7 +507,7 @@ namespace EMStudio
|
||||
commandGroup.AddCommandString("RecorderClear -force true");
|
||||
|
||||
// Activate the anim graph each selected actor instance.
|
||||
for (uint32 i = 0; i < numActorInstances; ++i)
|
||||
for (size_t i = 0; i < numActorInstances; ++i)
|
||||
{
|
||||
EMotionFX::ActorInstance* actorInstance = selectionList.GetActorInstance(i);
|
||||
if (actorInstance->GetIsOwnedByRuntime())
|
||||
|
||||
+13
-13
@@ -125,7 +125,7 @@ namespace EMotionFX
|
||||
|
||||
EMotionFX::MotionSet* AnimGraphEditor::GetSelectedMotionSet()
|
||||
{
|
||||
const AZ::Outcome<uint32> motionSetIndex = GetMotionSetIndex(m_motionSetComboBox->currentIndex());
|
||||
const AZ::Outcome<size_t> motionSetIndex = GetMotionSetIndex(m_motionSetComboBox->currentIndex());
|
||||
if (motionSetIndex.IsSuccess())
|
||||
{
|
||||
return EMotionFX::GetMotionManager().GetMotionSet(motionSetIndex.GetValue());
|
||||
@@ -149,8 +149,8 @@ namespace EMotionFX
|
||||
m_motionSetComboBox->clear();
|
||||
|
||||
// add each motion set name
|
||||
const uint32 numMotionSets = EMotionFX::GetMotionManager().GetNumMotionSets();
|
||||
for (uint32 i = 0; i < numMotionSets; ++i)
|
||||
const size_t numMotionSets = EMotionFX::GetMotionManager().GetNumMotionSets();
|
||||
for (size_t i = 0; i < numMotionSets; ++i)
|
||||
{
|
||||
EMotionFX::MotionSet* motionSet = EMotionFX::GetMotionManager().GetMotionSet(i);
|
||||
if (motionSet->GetIsOwnedByRuntime())
|
||||
@@ -163,7 +163,7 @@ namespace EMotionFX
|
||||
|
||||
// get the current selection list and the number of actor instances selected
|
||||
const CommandSystem::SelectionList& selectionList = CommandSystem::GetCommandManager()->GetCurrentSelection();
|
||||
const uint32 numActorInstances = selectionList.GetNumSelectedActorInstances();
|
||||
const size_t numActorInstances = selectionList.GetNumSelectedActorInstances();
|
||||
|
||||
// if actor instances are selected, set the used motion set
|
||||
if (numActorInstances > 0)
|
||||
@@ -172,7 +172,7 @@ namespace EMotionFX
|
||||
// this is used to check if multiple motion sets are used
|
||||
AZStd::vector<EMotionFX::MotionSet*> usedMotionSets;
|
||||
AZStd::vector<EMotionFX::AnimGraphInstance*> usedAnimGraphs;
|
||||
for (uint32 i = 0; i < numActorInstances; ++i)
|
||||
for (size_t i = 0; i < numActorInstances; ++i)
|
||||
{
|
||||
EMotionFX::ActorInstance* actorInstance = selectionList.GetActorInstance(i);
|
||||
if (actorInstance->GetIsOwnedByRuntime())
|
||||
@@ -301,7 +301,7 @@ namespace EMotionFX
|
||||
{
|
||||
// get the current selection list and the number of actor instances selected
|
||||
const CommandSystem::SelectionList& selectionList = CommandSystem::GetCommandManager()->GetCurrentSelection();
|
||||
const uint32 numActorInstances = selectionList.GetNumSelectedActorInstances();
|
||||
const size_t numActorInstances = selectionList.GetNumSelectedActorInstances();
|
||||
|
||||
AnimGraphEditor::m_lastMotionSetText = m_motionSetComboBox->itemText(index);
|
||||
// if no one actor instance is selected, the combo box has no effect
|
||||
@@ -310,7 +310,7 @@ namespace EMotionFX
|
||||
return;
|
||||
}
|
||||
|
||||
const AZ::Outcome<uint32> motionSetIndex = GetMotionSetIndex(index);
|
||||
const AZ::Outcome<size_t> motionSetIndex = GetMotionSetIndex(index);
|
||||
|
||||
EMotionFX::MotionSet* motionSet = nullptr;
|
||||
if (motionSetIndex.IsSuccess())
|
||||
@@ -323,7 +323,7 @@ namespace EMotionFX
|
||||
|
||||
// update the motion set on each actor instance if one anim graph is activated
|
||||
AZStd::string commandString;
|
||||
for (uint32 i = 0; i < numActorInstances; ++i)
|
||||
for (size_t i = 0; i < numActorInstances; ++i)
|
||||
{
|
||||
// get the actor instance from the selection list and the anim graph instance
|
||||
EMotionFX::ActorInstance* actorInstance = selectionList.GetActorInstance(i);
|
||||
@@ -401,12 +401,12 @@ namespace EMotionFX
|
||||
}
|
||||
}
|
||||
|
||||
AZ::Outcome<uint32> AnimGraphEditor::GetMotionSetIndex(int comboBoxIndex) const
|
||||
AZ::Outcome<size_t> AnimGraphEditor::GetMotionSetIndex(int comboBoxIndex) const
|
||||
{
|
||||
const uint32 targetEditorMotionSetIndex = comboBoxIndex;
|
||||
uint32 currentEditorMotionSet = 0;
|
||||
const uint32 numMotionSets = EMotionFX::GetMotionManager().GetNumMotionSets();
|
||||
for (uint32 i = 0; i < numMotionSets; ++i)
|
||||
const size_t targetEditorMotionSetIndex = comboBoxIndex;
|
||||
size_t currentEditorMotionSet = 0;
|
||||
const size_t numMotionSets = EMotionFX::GetMotionManager().GetNumMotionSets();
|
||||
for (size_t i = 0; i < numMotionSets; ++i)
|
||||
{
|
||||
const EMotionFX::MotionSet* motionSet = EMotionFX::GetMotionManager().GetMotionSet(i);
|
||||
|
||||
|
||||
+1
-1
@@ -51,7 +51,7 @@ namespace EMotionFX
|
||||
void OnMotionSetChanged(int index);
|
||||
|
||||
private:
|
||||
AZ::Outcome<uint32> GetMotionSetIndex(int comboBoxIndex) const;
|
||||
AZ::Outcome<size_t> GetMotionSetIndex(int comboBoxIndex) const;
|
||||
|
||||
MCORE_DEFINECOMMANDCALLBACK(UpdateMotionSetComboBoxCallback)
|
||||
|
||||
|
||||
+21
-21
@@ -152,8 +152,8 @@ namespace EMStudio
|
||||
|
||||
// Since the UI could be loaded after anim graphs are added to the manager, we need to pull all the current ones
|
||||
// and add them to the model
|
||||
const uint32 numAnimGraphs = EMotionFX::GetAnimGraphManager().GetNumAnimGraphs();
|
||||
for (uint32 i = 0; i < numAnimGraphs; ++i)
|
||||
const size_t numAnimGraphs = EMotionFX::GetAnimGraphManager().GetNumAnimGraphs();
|
||||
for (size_t i = 0; i < numAnimGraphs; ++i)
|
||||
{
|
||||
EMotionFX::AnimGraph* animGraph = EMotionFX::GetAnimGraphManager().GetAnimGraph(i);
|
||||
if (!animGraph->GetIsOwnedByRuntime() && !animGraph->GetIsOwnedByAsset())
|
||||
@@ -906,7 +906,7 @@ namespace EMStudio
|
||||
EMotionFX::AnimGraphInstance* animGraphInstance = modelItemData->m_animGraphInstance;
|
||||
EMotionFX::AnimGraphStateMachine* rootStateMachine = referencedAnimGraph->GetRootStateMachine();
|
||||
|
||||
const uint32 rowCount = rootStateMachine->GetNumConnections() + rootStateMachine->GetNumChildNodes() + static_cast<uint32>(rootStateMachine->GetNumTransitions());
|
||||
const int rowCount = aznumeric_caster(rootStateMachine->GetNumConnections() + rootStateMachine->GetNumChildNodes() + rootStateMachine->GetNumTransitions());
|
||||
if (rowCount > 0)
|
||||
{
|
||||
const QModelIndex referenceNodeModelIndex = createIndex(modelItemData->m_row, 0, modelItemData);
|
||||
@@ -977,15 +977,15 @@ namespace EMStudio
|
||||
}
|
||||
|
||||
int childRow = 0;
|
||||
const uint32 connectionCount = node->GetNumConnections();
|
||||
for (uint32 i = 0; i < connectionCount; ++i)
|
||||
const int connectionCount = aznumeric_caster(node->GetNumConnections());
|
||||
for (int i = 0; i < connectionCount; ++i)
|
||||
{
|
||||
m_modelItemDataSet.emplace(new ModelItemData(node->GetConnection(i), animGraphInstance, currentModelItemData, childRow + i));
|
||||
}
|
||||
childRow += connectionCount;
|
||||
|
||||
const uint32 childNodeCount = node->GetNumChildNodes();
|
||||
for (uint32 i = 0; i < childNodeCount; ++i)
|
||||
const int childNodeCount = aznumeric_caster(node->GetNumChildNodes());
|
||||
for (int i = 0; i < childNodeCount; ++i)
|
||||
{
|
||||
RecursivelyAddNode(animGraphInstance, node->GetChildNode(i), currentModelItemData, childRow + i);
|
||||
}
|
||||
@@ -995,12 +995,12 @@ namespace EMStudio
|
||||
if (nodeTypeId == azrtti_typeid<EMotionFX::AnimGraphStateMachine>())
|
||||
{
|
||||
EMotionFX::AnimGraphStateMachine* stateMachine = static_cast<EMotionFX::AnimGraphStateMachine*>(node);
|
||||
const size_t childTransitionCount = stateMachine->GetNumTransitions();
|
||||
for (size_t i = 0; i < childTransitionCount; ++i)
|
||||
const int childTransitionCount = aznumeric_caster(stateMachine->GetNumTransitions());
|
||||
for (int i = 0; i < childTransitionCount; ++i)
|
||||
{
|
||||
AddTransition(animGraphInstance, stateMachine->GetTransition(i), currentModelItemData, childRow + static_cast<int>(i));
|
||||
AddTransition(animGraphInstance, stateMachine->GetTransition(i), currentModelItemData, childRow + i);
|
||||
}
|
||||
childRow += static_cast<int>(childTransitionCount);
|
||||
childRow += childTransitionCount;
|
||||
}
|
||||
else if (nodeTypeId == azrtti_typeid<EMotionFX::AnimGraphReferenceNode>())
|
||||
{
|
||||
@@ -1023,26 +1023,26 @@ namespace EMStudio
|
||||
EMotionFX::AnimGraphStateMachine* rootStateMachine = referencedAnimGraph->GetRootStateMachine();
|
||||
EMotionFX::AnimGraphInstance* referencedAnimGraphInstance = referenceNode->GetReferencedAnimGraphInstance(animGraphInstance);
|
||||
|
||||
const uint32 rootConnectionCount = rootStateMachine->GetNumConnections();
|
||||
for (uint32 i = 0; i < rootConnectionCount; ++i)
|
||||
const int rootConnectionCount = aznumeric_caster(rootStateMachine->GetNumConnections());
|
||||
for (int i = 0; i < rootConnectionCount; ++i)
|
||||
{
|
||||
m_modelItemDataSet.emplace(new ModelItemData(rootStateMachine->GetConnection(i), referencedAnimGraphInstance, referenceNodeModelItemData, row + i));
|
||||
}
|
||||
row += rootConnectionCount;
|
||||
|
||||
const uint32 rootChildNodeCount = rootStateMachine->GetNumChildNodes();
|
||||
for (uint32 i = 0; i < rootChildNodeCount; ++i)
|
||||
const int rootChildNodeCount = aznumeric_caster(rootStateMachine->GetNumChildNodes());
|
||||
for (int i = 0; i < rootChildNodeCount; ++i)
|
||||
{
|
||||
RecursivelyAddNode(referencedAnimGraphInstance, rootStateMachine->GetChildNode(i), referenceNodeModelItemData, row + i);
|
||||
}
|
||||
row += rootChildNodeCount;
|
||||
|
||||
const size_t rootChildTransitionCount = rootStateMachine->GetNumTransitions();
|
||||
for (size_t i = 0; i < rootChildTransitionCount; ++i)
|
||||
const int rootChildTransitionCount = aznumeric_caster(rootStateMachine->GetNumTransitions());
|
||||
for (int i = 0; i < rootChildTransitionCount; ++i)
|
||||
{
|
||||
AddTransition(referencedAnimGraphInstance, rootStateMachine->GetTransition(i), referenceNodeModelItemData, row + static_cast<int>(i));
|
||||
AddTransition(referencedAnimGraphInstance, rootStateMachine->GetTransition(i), referenceNodeModelItemData, row + i);
|
||||
}
|
||||
row += static_cast<int>(rootChildTransitionCount);
|
||||
row += rootChildTransitionCount;
|
||||
|
||||
// Now we add the "alias" item
|
||||
ModelItemData* rootStateMachineItem = new ModelItemData(rootStateMachine, referencedAnimGraphInstance, nullptr, referenceNodeModelItemData->m_row);
|
||||
@@ -1424,8 +1424,8 @@ namespace EMStudio
|
||||
{
|
||||
AZStd::vector<EMotionFX::AnimGraphNode*> motionNodes;
|
||||
|
||||
const uint32 numAnimGraphs = EMotionFX::GetAnimGraphManager().GetNumAnimGraphs();
|
||||
for (uint32 i = 0; i < numAnimGraphs; ++i)
|
||||
const size_t numAnimGraphs = EMotionFX::GetAnimGraphManager().GetNumAnimGraphs();
|
||||
for (size_t i = 0; i < numAnimGraphs; ++i)
|
||||
{
|
||||
EMotionFX::AnimGraph* animGraph = EMotionFX::GetAnimGraphManager().GetAnimGraph(i);
|
||||
|
||||
|
||||
+1
-1
@@ -393,7 +393,7 @@ namespace EMStudio
|
||||
{
|
||||
// In this case is a BlendTreeConnection, we dont keep items in the model for it. We just
|
||||
// need to mark the target node as changed
|
||||
EMotionFX::BlendTreeConnection* connection = targetNode->FindConnection(commandCreateConnection->GetTargetPort());
|
||||
EMotionFX::BlendTreeConnection* connection = targetNode->FindConnection(aznumeric_caster(commandCreateConnection->GetTargetPort()));
|
||||
return m_animGraphModel.ConnectionAdded(targetNode, connection);
|
||||
}
|
||||
else
|
||||
|
||||
+33
-48
@@ -112,8 +112,8 @@ namespace EMStudio
|
||||
void GetDirtyFileNames(AZStd::vector<AZStd::string>* outFileNames, AZStd::vector<ObjectPointer>* outObjects) override
|
||||
{
|
||||
// get the number of anim graphs and iterate through them
|
||||
const uint32 numAnimGraphs = EMotionFX::GetAnimGraphManager().GetNumAnimGraphs();
|
||||
for (uint32 i = 0; i < numAnimGraphs; ++i)
|
||||
const size_t numAnimGraphs = EMotionFX::GetAnimGraphManager().GetNumAnimGraphs();
|
||||
for (size_t i = 0; i < numAnimGraphs; ++i)
|
||||
{
|
||||
// return in case we found a dirty file
|
||||
EMotionFX::AnimGraph* animGraph = EMotionFX::GetAnimGraphManager().GetAnimGraph(i);
|
||||
@@ -147,11 +147,9 @@ namespace EMStudio
|
||||
return DirtyFileManager::FINISHED;
|
||||
}
|
||||
|
||||
const size_t numObjects = objects.size();
|
||||
for (size_t i = 0; i < numObjects; ++i)
|
||||
for (const SaveDirtyFilesCallback::ObjectPointer objPointer : objects)
|
||||
{
|
||||
// get the current object pointer and skip directly if the type check fails
|
||||
ObjectPointer objPointer = objects[i];
|
||||
if (objPointer.mAnimGraph == nullptr)
|
||||
{
|
||||
continue;
|
||||
@@ -429,19 +427,17 @@ namespace EMStudio
|
||||
|
||||
void AnimGraphPlugin::SetOptionFlag(EDockWindowOptionFlag option, bool isEnabled)
|
||||
{
|
||||
const uint32 optionIndex = (uint32)option;
|
||||
if (mDockWindowActions[optionIndex])
|
||||
if (mDockWindowActions[option])
|
||||
{
|
||||
mDockWindowActions[optionIndex]->setChecked(isEnabled);
|
||||
mDockWindowActions[option]->setChecked(isEnabled);
|
||||
}
|
||||
}
|
||||
|
||||
void AnimGraphPlugin::SetOptionEnabled(EDockWindowOptionFlag option, bool isEnabled)
|
||||
{
|
||||
const uint32 optionIndex = (uint32)option;
|
||||
if (mDockWindowActions[optionIndex])
|
||||
if (mDockWindowActions[option])
|
||||
{
|
||||
mDockWindowActions[optionIndex]->setEnabled(isEnabled);
|
||||
mDockWindowActions[option]->setEnabled(isEnabled);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -739,8 +735,8 @@ namespace EMStudio
|
||||
|
||||
MCore::Ray ray(start, end);
|
||||
|
||||
const uint32 numActorInstances = EMotionFX::GetActorManager().GetNumActorInstances();
|
||||
for (uint32 i = 0; i < numActorInstances; ++i)
|
||||
const size_t numActorInstances = EMotionFX::GetActorManager().GetNumActorInstances();
|
||||
for (size_t i = 0; i < numActorInstances; ++i)
|
||||
{
|
||||
EMotionFX::ActorInstance* actorInstance = EMotionFX::GetActorManager().GetActorInstance(i);
|
||||
|
||||
@@ -787,20 +783,12 @@ namespace EMStudio
|
||||
result = true;
|
||||
}
|
||||
|
||||
/*
|
||||
// collide with ground plane
|
||||
MCore::Vector3 groundNormal(0.0f, 0.0f, 0.0f);
|
||||
groundNormal[MCore::GetCoordinateSystem().GetUpIndex()] = 1.0f;
|
||||
MCore::PlaneEq groundPlane( groundNormal, Vector3(0.0f, 0.0f, 0.0f) );
|
||||
bool result = MCore::Ray(start, end).Intersects( groundPlane, &(outIntersectInfo->mPosition) );
|
||||
outIntersectInfo->mNormal = groundNormal;
|
||||
*/
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
// set the gizmo offsets
|
||||
void AnimGraphEventHandler::OnSetVisualManipulatorOffset(EMotionFX::AnimGraphInstance* animGraphInstance, uint32 paramIndex, const AZ::Vector3& offset)
|
||||
void AnimGraphEventHandler::OnSetVisualManipulatorOffset(EMotionFX::AnimGraphInstance* animGraphInstance, size_t paramIndex, const AZ::Vector3& offset)
|
||||
{
|
||||
EMStudioManager* manager = GetManager();
|
||||
|
||||
@@ -808,13 +796,10 @@ namespace EMStudio
|
||||
const AZStd::string& paramName = animGraphInstance->GetAnimGraph()->FindParameter(paramIndex)->GetName();
|
||||
|
||||
// iterate over all gizmos that are active
|
||||
AZStd::vector<MCommon::TransformationManipulator*>* gizmos = manager->GetTransformationManipulators();
|
||||
const uint32 numGizmos = gizmos->size();
|
||||
for (uint32 i = 0; i < numGizmos; ++i)
|
||||
const AZStd::vector<MCommon::TransformationManipulator*>* gizmos = manager->GetTransformationManipulators();
|
||||
for (MCommon::TransformationManipulator* gizmo : *gizmos)
|
||||
{
|
||||
MCommon::TransformationManipulator* gizmo = gizmos->at(i);
|
||||
|
||||
// check the gizmo name
|
||||
// check the gizmo name
|
||||
if (paramName == gizmo->GetName())
|
||||
{
|
||||
gizmo->SetRenderOffset(offset);
|
||||
@@ -835,8 +820,8 @@ namespace EMStudio
|
||||
AZStd::vector<AZStd::unique_ptr<EMotionFX::BlendTreeConnection> > newConnections;
|
||||
|
||||
// get the number of incoming connections and iterate through them
|
||||
const uint32 numConnections = node->GetNumConnections();
|
||||
for (uint32 c = 0; c < numConnections; ++c)
|
||||
const size_t numConnections = node->GetNumConnections();
|
||||
for (size_t c = 0; c < numConnections; ++c)
|
||||
{
|
||||
// get the connection and check if it is plugged into the node
|
||||
EMotionFX::BlendTreeConnection* connection = node->GetConnection(c);
|
||||
@@ -927,8 +912,8 @@ namespace EMStudio
|
||||
AZStd::vector<AZStd::pair<AZStd::unique_ptr<EMotionFX::BlendTreeConnection>, EMotionFX::AnimGraphNode*> > newConnections;
|
||||
|
||||
// iterate through all nodes in the parent and check if any of these has a connection from our node
|
||||
const uint32 numNodes = parentNode->GetNumChildNodes();
|
||||
for (uint32 i = 0; i < numNodes; ++i)
|
||||
const size_t numNodes = parentNode->GetNumChildNodes();
|
||||
for (size_t i = 0; i < numNodes; ++i)
|
||||
{
|
||||
// get the child node and skip it in case it is the parameter node itself
|
||||
EMotionFX::AnimGraphNode* childNode = parentNode->GetChildNode(i);
|
||||
@@ -938,8 +923,8 @@ namespace EMStudio
|
||||
}
|
||||
|
||||
// get the number of outgoing connections and iterate through them
|
||||
const uint32 numConnections = childNode->GetNumConnections();
|
||||
for (uint32 c = 0; c < numConnections; ++c)
|
||||
const size_t numConnections = childNode->GetNumConnections();
|
||||
for (size_t c = 0; c < numConnections; ++c)
|
||||
{
|
||||
// get the connection and check if it is plugged into the parameter node
|
||||
EMotionFX::BlendTreeConnection* connection = childNode->GetConnection(c);
|
||||
@@ -1059,8 +1044,8 @@ namespace EMStudio
|
||||
bool AnimGraphPlugin::IsAnimGraphActive(EMotionFX::AnimGraph* animGraph) const
|
||||
{
|
||||
const CommandSystem::SelectionList& selectionList = GetCommandManager()->GetCurrentSelection();
|
||||
const uint32 numActorInstances = selectionList.GetNumSelectedActorInstances();
|
||||
for (uint32 i = 0; i < numActorInstances; ++i)
|
||||
const size_t numActorInstances = selectionList.GetNumSelectedActorInstances();
|
||||
for (size_t i = 0; i < numActorInstances; ++i)
|
||||
{
|
||||
const EMotionFX::ActorInstance* actorInstance = selectionList.GetActorInstance(i);
|
||||
const EMotionFX::AnimGraphInstance* animGraphInstance = actorInstance->GetAnimGraphInstance();
|
||||
@@ -1074,9 +1059,9 @@ namespace EMStudio
|
||||
}
|
||||
|
||||
|
||||
void AnimGraphPlugin::SaveAnimGraph(const char* filename, uint32 animGraphIndex, MCore::CommandGroup* commandGroup)
|
||||
void AnimGraphPlugin::SaveAnimGraph(const char* filename, size_t animGraphIndex, MCore::CommandGroup* commandGroup)
|
||||
{
|
||||
const AZStd::string command = AZStd::string::format("SaveAnimGraph -index %i -filename \"%s\"", animGraphIndex, filename);
|
||||
const AZStd::string command = AZStd::string::format("SaveAnimGraph -index %zu -filename \"%s\"", animGraphIndex, filename);
|
||||
|
||||
if (commandGroup == nullptr)
|
||||
{
|
||||
@@ -1101,8 +1086,8 @@ namespace EMStudio
|
||||
|
||||
void AnimGraphPlugin::SaveAnimGraph(EMotionFX::AnimGraph* animGraph, MCore::CommandGroup* commandGroup)
|
||||
{
|
||||
const uint32 animGraphIndex = EMotionFX::GetAnimGraphManager().FindAnimGraphIndex(animGraph);
|
||||
if (animGraphIndex == MCORE_INVALIDINDEX32)
|
||||
const size_t animGraphIndex = EMotionFX::GetAnimGraphManager().FindAnimGraphIndex(animGraph);
|
||||
if (animGraphIndex == InvalidIndex)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -1146,8 +1131,8 @@ namespace EMStudio
|
||||
return;
|
||||
}
|
||||
|
||||
const uint32 animGraphIndex = EMotionFX::GetAnimGraphManager().FindAnimGraphIndex(animGraph);
|
||||
if (animGraphIndex == MCORE_INVALIDINDEX32)
|
||||
const size_t animGraphIndex = EMotionFX::GetAnimGraphManager().FindAnimGraphIndex(animGraph);
|
||||
if (animGraphIndex == InvalidIndex)
|
||||
{
|
||||
MCore::LogError("Cannot save anim graph. Anim graph index invalid.");
|
||||
return;
|
||||
@@ -1176,7 +1161,7 @@ namespace EMStudio
|
||||
}
|
||||
|
||||
const CommandSystem::SelectionList& selectionList = GetCommandManager()->GetCurrentSelection();
|
||||
const uint32 numActorInstances = selectionList.GetNumSelectedActorInstances();
|
||||
const size_t numActorInstances = selectionList.GetNumSelectedActorInstances();
|
||||
|
||||
MCore::CommandGroup commandGroup("Load anim graph");
|
||||
AZStd::string command;
|
||||
@@ -1202,10 +1187,10 @@ namespace EMStudio
|
||||
}
|
||||
else
|
||||
{
|
||||
const uint32 numMotionSets = EMotionFX::GetMotionManager().GetNumMotionSets();
|
||||
const size_t numMotionSets = EMotionFX::GetMotionManager().GetNumMotionSets();
|
||||
if (numMotionSets > 0)
|
||||
{
|
||||
for (uint32 i = 0; i < numMotionSets; ++i)
|
||||
for (size_t i = 0; i < numMotionSets; ++i)
|
||||
{
|
||||
EMotionFX::MotionSet* candidate = EMotionFX::GetMotionManager().GetMotionSet(i);
|
||||
if (candidate->GetIsOwnedByRuntime())
|
||||
@@ -1222,7 +1207,7 @@ namespace EMStudio
|
||||
|
||||
if (motionSet)
|
||||
{
|
||||
for (uint32 i = 0; i < numActorInstances; ++i)
|
||||
for (size_t i = 0; i < numActorInstances; ++i)
|
||||
{
|
||||
EMotionFX::ActorInstance* actorInstance = selectionList.GetActorInstance(i);
|
||||
if (actorInstance->GetIsOwnedByRuntime())
|
||||
@@ -1254,8 +1239,8 @@ namespace EMStudio
|
||||
return;
|
||||
}
|
||||
|
||||
const uint32 animGraphIndex = EMotionFX::GetAnimGraphManager().FindAnimGraphIndex(animGraph);
|
||||
assert(animGraphIndex != MCORE_INVALIDINDEX32);
|
||||
const size_t animGraphIndex = EMotionFX::GetAnimGraphManager().FindAnimGraphIndex(animGraph);
|
||||
assert(animGraphIndex != InvalidIndex);
|
||||
|
||||
const AZStd::string filename = animGraph->GetFileName();
|
||||
if (filename.empty())
|
||||
|
||||
+2
-2
@@ -76,7 +76,7 @@ namespace EMStudio
|
||||
AnimGraphEventHandler(AnimGraphPlugin* plugin);
|
||||
|
||||
const AZStd::vector<EMotionFX::EventTypes> GetHandledEventTypes() const override { return { EMotionFX::EVENT_TYPE_ON_SET_VISUAL_MANIPULATOR_OFFSET, EMotionFX::EVENT_TYPE_ON_INPUT_PORTS_CHANGED, EMotionFX::EVENT_TYPE_ON_OUTPUT_PORTS_CHANGED, EMotionFX::EVENT_TYPE_ON_RAY_INTERSECTION_TEST, EMotionFX::EVENT_TYPE_ON_DELETE_ANIM_GRAPH, EMotionFX::EVENT_TYPE_ON_DELETE_ANIM_GRAPH_INSTANCE }; }
|
||||
void OnSetVisualManipulatorOffset(EMotionFX::AnimGraphInstance* animGraphInstance, uint32 paramIndex, const AZ::Vector3& offset) override;
|
||||
void OnSetVisualManipulatorOffset(EMotionFX::AnimGraphInstance* animGraphInstance, size_t paramIndex, const AZ::Vector3& offset) override;
|
||||
void OnInputPortsChanged(EMotionFX::AnimGraphNode* node, const AZStd::vector<AZStd::string>& newInputPorts, const AZStd::string& memberName, const AZStd::vector<AZStd::string>& memberValue) override;
|
||||
void OnOutputPortsChanged(EMotionFX::AnimGraphNode* node, const AZStd::vector<AZStd::string>& newOutputPorts, const AZStd::string& memberName, const AZStd::vector<AZStd::string>& memberValue) override;
|
||||
bool OnRayIntersectionTest(const AZ::Vector3& start, const AZ::Vector3& end, EMotionFX::IntersectionInfo* outIntersectInfo) override;
|
||||
@@ -135,7 +135,7 @@ namespace EMStudio
|
||||
void SetActiveAnimGraph(EMotionFX::AnimGraph* animGraph);
|
||||
EMotionFX::AnimGraph* GetActiveAnimGraph() { return mActiveAnimGraph; }
|
||||
|
||||
void SaveAnimGraph(const char* filename, uint32 animGraphIndex, MCore::CommandGroup* commandGroup = nullptr);
|
||||
void SaveAnimGraph(const char* filename, size_t animGraphIndex, MCore::CommandGroup* commandGroup = nullptr);
|
||||
void SaveAnimGraph(EMotionFX::AnimGraph* animGraph, MCore::CommandGroup* commandGroup = nullptr);
|
||||
void SaveAnimGraphAs(EMotionFX::AnimGraph* animGraph, MCore::CommandGroup* commandGroup = nullptr);
|
||||
int SaveDirtyAnimGraph(EMotionFX::AnimGraph* animGraph, MCore::CommandGroup* commandGroup, bool askBeforeSaving, bool showCancelButton = true);
|
||||
|
||||
+4
-4
@@ -580,11 +580,11 @@ namespace EMStudio
|
||||
|
||||
m_openMenu->addAction(m_actions[FILE_OPEN]);
|
||||
|
||||
const uint32 numAnimGraphs = EMotionFX::GetAnimGraphManager().GetNumAnimGraphs();
|
||||
const size_t numAnimGraphs = EMotionFX::GetAnimGraphManager().GetNumAnimGraphs();
|
||||
if (numAnimGraphs > 0)
|
||||
{
|
||||
m_openMenu->addSeparator();
|
||||
for (uint32 i = 0; i < numAnimGraphs; ++i)
|
||||
for (size_t i = 0; i < numAnimGraphs; ++i)
|
||||
{
|
||||
EMotionFX::AnimGraph* animGraph = EMotionFX::GetAnimGraphManager().GetAnimGraph(i);
|
||||
if (animGraph->GetIsOwnedByRuntime() == false)
|
||||
@@ -627,7 +627,7 @@ namespace EMStudio
|
||||
{
|
||||
// get the current selection list and the number of actor instances selected
|
||||
const CommandSystem::SelectionList& selectionList = GetCommandManager()->GetCurrentSelection();
|
||||
const uint32 numActorInstances = selectionList.GetNumSelectedActorInstances();
|
||||
const size_t numActorInstances = selectionList.GetNumSelectedActorInstances();
|
||||
|
||||
// Activate the new anim graph automatically (The shown anim graph should always be the activated one).
|
||||
if (numActorInstances > 0)
|
||||
@@ -656,7 +656,7 @@ namespace EMStudio
|
||||
if (motionSet)
|
||||
{
|
||||
// Activate anim graph on all actor instances in case there is a motion set.
|
||||
for (uint32 i = 0; i < numActorInstances; ++i)
|
||||
for (size_t i = 0; i < numActorInstances; ++i)
|
||||
{
|
||||
EMotionFX::ActorInstance* actorInstance = selectionList.GetActorInstance(i);
|
||||
commandGroup.AddCommandString(AZStd::string::format("ActivateAnimGraph -actorInstanceID %d -animGraphID %%LASTRESULT%% -motionSetID %d", actorInstance->GetID(), motionSet->GetID()));
|
||||
|
||||
+8
-8
@@ -810,7 +810,7 @@ namespace EMStudio
|
||||
|
||||
|
||||
// check if a connection is valid or not
|
||||
bool BlendGraphWidget::CheckIfIsCreateConnectionValid(uint32 portNr, GraphNode* portNode, NodePort* port, bool isInputPort)
|
||||
bool BlendGraphWidget::CheckIfIsCreateConnectionValid(AZ::u16 portNr, GraphNode* portNode, NodePort* port, bool isInputPort)
|
||||
{
|
||||
MCORE_UNUSED(port);
|
||||
MCORE_ASSERT(mActiveGraph);
|
||||
@@ -845,8 +845,8 @@ namespace EMStudio
|
||||
MCORE_ASSERT(sourceNode->GetType() == BlendTreeVisualNode::TYPE_ID);
|
||||
BlendTreeVisualNode* targetBlendNode;
|
||||
BlendTreeVisualNode* sourceBlendNode;
|
||||
uint32 sourcePortNr;
|
||||
uint32 targetPortNr;
|
||||
AZ::u16 sourcePortNr;
|
||||
AZ::u16 targetPortNr;
|
||||
|
||||
// make sure the input always comes from the source node
|
||||
if (isInputPort)
|
||||
@@ -933,15 +933,15 @@ namespace EMStudio
|
||||
|
||||
|
||||
// create the connection
|
||||
void BlendGraphWidget::OnCreateConnection(uint32 sourcePortNr, GraphNode* sourceNode, bool sourceIsInputPort, uint32 targetPortNr, GraphNode* targetNode, bool targetIsInputPort, const QPoint& startOffset, const QPoint& endOffset)
|
||||
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);
|
||||
|
||||
GraphNode* realSourceNode;
|
||||
GraphNode* realTargetNode;
|
||||
uint32 realInputPortNr;
|
||||
uint32 realOutputPortNr;
|
||||
AZ::u16 realInputPortNr;
|
||||
AZ::u16 realOutputPortNr;
|
||||
|
||||
if (sourceIsInputPort)
|
||||
{
|
||||
@@ -1357,8 +1357,8 @@ namespace EMStudio
|
||||
}
|
||||
|
||||
// get the output and the input port numbers
|
||||
const uint32 outputPortNr = connection->GetOutputPortNr();
|
||||
const uint32 inputPortNr = connection->GetInputPortNr();
|
||||
const AZ::u16 outputPortNr = connection->GetOutputPortNr();
|
||||
const AZ::u16 inputPortNr = connection->GetInputPortNr();
|
||||
|
||||
// show connection or state transition tooltip
|
||||
if (conditionFound == false)
|
||||
|
||||
+2
-2
@@ -43,7 +43,7 @@ namespace EMStudio
|
||||
BlendGraphWidget(AnimGraphPlugin* plugin, QWidget* parent);
|
||||
|
||||
// overloaded
|
||||
bool CheckIfIsCreateConnectionValid(uint32 portNr, GraphNode* portNode, NodePort* port, bool isInputPort) override;
|
||||
bool CheckIfIsCreateConnectionValid(AZ::u16 portNr, GraphNode* portNode, NodePort* port, bool isInputPort) override;
|
||||
bool CheckIfIsValidTransition(GraphNode* sourceState, GraphNode* targetState) override;
|
||||
bool CheckIfIsValidTransitionSource(GraphNode* sourceState) override;
|
||||
bool CreateConnectionMustBeCurved() override;
|
||||
@@ -60,7 +60,7 @@ namespace EMStudio
|
||||
void OnSetupVisualizeOptions(GraphNode* node) override;
|
||||
void ReplaceTransition(NodeConnection* connection, QPoint oldStartOffset, QPoint oldEndOffset, GraphNode* oldSourceNode, GraphNode* oldTargetNode, GraphNode* newSourceNode, GraphNode* newTargetNode) override;
|
||||
|
||||
void OnCreateConnection(uint32 sourcePortNr, GraphNode* sourceNode, bool sourceIsInputPort, uint32 targetPortNr, GraphNode* targetNode, bool targetIsInputPort, const QPoint& startOffset, const QPoint& endOffset) override;
|
||||
void OnCreateConnection(AZ::u16 sourcePortNr, GraphNode* sourceNode, bool sourceIsInputPort, AZ::u16 targetPortNr, GraphNode* targetNode, bool targetIsInputPort, const QPoint& startOffset, const QPoint& endOffset) override;
|
||||
|
||||
void DeleteSelectedItems(NodeGraph* nodeGraph);
|
||||
|
||||
|
||||
+14
-14
@@ -39,9 +39,9 @@ namespace EMStudio
|
||||
|
||||
// add all input ports
|
||||
const AZStd::vector<EMotionFX::AnimGraphNode::Port>& inPorts = mEMFXNode->GetInputPorts();
|
||||
const uint32 numInputs = static_cast<uint32>(inPorts.size());
|
||||
const AZ::u16 numInputs = aznumeric_caster(inPorts.size());
|
||||
mInputPorts.reserve(numInputs);
|
||||
for (uint32 i = 0; i < numInputs; ++i)
|
||||
for (AZ::u16 i = 0; i < numInputs; ++i)
|
||||
{
|
||||
NodePort* port = AddInputPort(false);
|
||||
port->SetNameID(inPorts[i].mNameID);
|
||||
@@ -52,9 +52,9 @@ namespace EMStudio
|
||||
{
|
||||
// add all output ports
|
||||
const AZStd::vector<EMotionFX::AnimGraphNode::Port>& outPorts = mEMFXNode->GetOutputPorts();
|
||||
const uint32 numOutputs = static_cast<uint32>(outPorts.size());
|
||||
const AZ::u16 numOutputs = aznumeric_caster(outPorts.size());
|
||||
mOutputPorts.reserve(numOutputs);
|
||||
for (uint32 i = 0; i < numOutputs; ++i)
|
||||
for (AZ::u16 i = 0; i < numOutputs; ++i)
|
||||
{
|
||||
NodePort* port = AddOutputPort(false);
|
||||
port->SetNameID(outPorts[i].mNameID);
|
||||
@@ -73,8 +73,8 @@ namespace EMStudio
|
||||
|
||||
GraphNode* source = mParentGraph->FindGraphNode(connection->GetSourceNode());
|
||||
GraphNode* target = this;
|
||||
const uint32 sourcePort = connection->GetSourcePort();
|
||||
const uint32 targetPort = connection->GetTargetPort();
|
||||
const AZ::u16 sourcePort = connection->GetSourcePort();
|
||||
const AZ::u16 targetPort = connection->GetTargetPort();
|
||||
|
||||
NodeConnection* visualConnection = new NodeConnection(mParentGraph, childIndex, target, targetPort, source, sourcePort);
|
||||
target->AddConnection(visualConnection);
|
||||
@@ -302,8 +302,8 @@ namespace EMStudio
|
||||
{
|
||||
// draw the input ports
|
||||
QColor portBrushColor, portPenColor;
|
||||
const uint32 numInputs = mInputPorts.size();
|
||||
for (uint32 i = 0; i < numInputs; ++i)
|
||||
const AZ::u16 numInputs = aznumeric_caster(mInputPorts.size());
|
||||
for (AZ::u16 i = 0; i < numInputs; ++i)
|
||||
{
|
||||
// get the input port and the corresponding rect
|
||||
NodePort* inputPort = &mInputPorts[i];
|
||||
@@ -321,8 +321,8 @@ namespace EMStudio
|
||||
if (GetHasVisualOutputPorts())
|
||||
{
|
||||
// draw the output ports
|
||||
const uint32 numOutputs = mOutputPorts.size();
|
||||
for (uint32 i = 0; i < numOutputs; ++i)
|
||||
const AZ::u16 numOutputs = aznumeric_caster(mOutputPorts.size());
|
||||
for (AZ::u16 i = 0; i < numOutputs; ++i)
|
||||
{
|
||||
// get the output port and the corresponding rect
|
||||
NodePort* outputPort = &mOutputPorts[i];
|
||||
@@ -455,8 +455,8 @@ namespace EMStudio
|
||||
painter.setFont(mPortNameFont);
|
||||
|
||||
// draw input port text
|
||||
const uint32 numInputs = mInputPorts.size();
|
||||
for (uint32 i = 0; i < numInputs; ++i)
|
||||
const AZ::u16 numInputs = aznumeric_caster(mInputPorts.size());
|
||||
for (AZ::u16 i = 0; i < numInputs; ++i)
|
||||
{
|
||||
NodePort* inputPort = &mInputPorts[i];
|
||||
const QRect& portRect = inputPort->GetRect();
|
||||
@@ -468,8 +468,8 @@ namespace EMStudio
|
||||
}
|
||||
|
||||
// draw output port text
|
||||
const uint32 numOutputs = mOutputPorts.size();
|
||||
for (uint32 i = 0; i < numOutputs; ++i)
|
||||
const AZ::u16 numOutputs = aznumeric_caster(mOutputPorts.size());
|
||||
for (AZ::u16 i = 0; i < numOutputs; ++i)
|
||||
{
|
||||
NodePort* outputPort = &mOutputPorts[i];
|
||||
const QRect& portRect = outputPort->GetRect();
|
||||
|
||||
+5
-5
@@ -72,17 +72,17 @@ namespace EMStudio
|
||||
QMenu* nodeGroupMenu = new QMenu("Node Group", menu);
|
||||
bool isNodeInNoneGroup = true;
|
||||
QAction* noneNodeGroupAction = nodeGroupMenu->addAction("None");
|
||||
noneNodeGroupAction->setData(0); // this index is there to know it's the real none action in case one node group is also called like that
|
||||
noneNodeGroupAction->setData(qulonglong(0)); // this index is there to know it's the real none action in case one node group is also called like that
|
||||
connect(noneNodeGroupAction, &QAction::triggered, this, &BlendGraphWidget::OnNodeGroupSelected);
|
||||
noneNodeGroupAction->setCheckable(true);
|
||||
|
||||
const uint32 numNodeGroups = animGraph->GetNumNodeGroups();
|
||||
for (uint32 i = 0; i < numNodeGroups; ++i)
|
||||
const size_t numNodeGroups = animGraph->GetNumNodeGroups();
|
||||
for (size_t i = 0; i < numNodeGroups; ++i)
|
||||
{
|
||||
EMotionFX::AnimGraphNodeGroup* nodeGroup = animGraph->GetNodeGroup(i);
|
||||
|
||||
QAction* nodeGroupAction = nodeGroupMenu->addAction(nodeGroup->GetName());
|
||||
nodeGroupAction->setData(i + 1); // index of the menu added, not used
|
||||
nodeGroupAction->setData(qulonglong(i + 1)); // index of the menu added, not used
|
||||
connect(nodeGroupAction, &QAction::triggered, this, &BlendGraphWidget::OnNodeGroupSelected);
|
||||
nodeGroupAction->setCheckable(true);
|
||||
|
||||
@@ -144,7 +144,7 @@ namespace EMStudio
|
||||
else
|
||||
{
|
||||
QMenu* previewMotionMenu = new QMenu("Preview Motions", menu);
|
||||
for (uint32 i = 0; i < numMotions; ++i)
|
||||
for (size_t i = 0; i < numMotions; ++i)
|
||||
{
|
||||
const char* motionId = motionNode->GetMotionId(i);
|
||||
QAction* previewMotionAction = previewMotionMenu->addAction(motionId);
|
||||
|
||||
+1
-1
@@ -559,7 +559,7 @@ const char* GameController::GetElementEnumName(uint32 index)
|
||||
}
|
||||
|
||||
|
||||
uint32 GameController::FindElemendIDByName(const AZStd::string& elementEnumName)
|
||||
uint32 GameController::FindElementIDByName(const AZStd::string& elementEnumName)
|
||||
{
|
||||
if (elementEnumName == "Pos X")
|
||||
{
|
||||
|
||||
+1
-1
@@ -78,7 +78,7 @@ public:
|
||||
void SetDeadZone(float deadZone) { mDeadZone = deadZone; }
|
||||
MCORE_INLINE float GetDeadZone() const { return mDeadZone; }
|
||||
const char* GetElementEnumName(uint32 index);
|
||||
uint32 FindElemendIDByName(const AZStd::string& elementEnumName);
|
||||
uint32 FindElementIDByName(const AZStd::string& elementEnumName);
|
||||
|
||||
MCORE_INLINE bool GetIsPresent(uint32 elementID) const { return mDeviceElements[elementID].mPresent; }
|
||||
MCORE_INLINE bool GetIsButtonPressed(uint8 buttonIndex) const
|
||||
|
||||
+38
-71
@@ -327,7 +327,7 @@ namespace EMStudio
|
||||
EMotionFX::AnimGraphGameControllerSettings& gameControllerSettings = animGraph->GetGameControllerSettings();
|
||||
|
||||
// in case there is no preset yet create a default one
|
||||
uint32 numPresets = static_cast<uint32>(gameControllerSettings.GetNumPresets());
|
||||
size_t numPresets = gameControllerSettings.GetNumPresets();
|
||||
if (numPresets == 0)
|
||||
{
|
||||
EMotionFX::AnimGraphGameControllerSettings::Preset* preset = aznew EMotionFX::AnimGraphGameControllerSettings::Preset("Default");
|
||||
@@ -345,14 +345,13 @@ namespace EMStudio
|
||||
mParameterGridLayout->setMargin(0);
|
||||
|
||||
// add all parameters
|
||||
// uint32 startRow = 0;
|
||||
mParameterInfos.clear();
|
||||
|
||||
const EMotionFX::ValueParameterVector& parameters = animGraph->RecursivelyGetValueParameters();
|
||||
const size_t numParameters = parameters.size();
|
||||
mParameterInfos.reserve(static_cast<uint32>(numParameters));
|
||||
const int numParameters = aznumeric_caster(parameters.size());
|
||||
mParameterInfos.reserve(numParameters);
|
||||
|
||||
for (size_t parameterIndex = 0; parameterIndex < numParameters; ++parameterIndex)
|
||||
for (int parameterIndex = 0; parameterIndex < numParameters; ++parameterIndex)
|
||||
{
|
||||
const EMotionFX::ValueParameter* parameter = parameters[parameterIndex];
|
||||
|
||||
@@ -599,16 +598,16 @@ namespace EMStudio
|
||||
mPresetComboBox->blockSignals(true);
|
||||
mPresetComboBox->clear();
|
||||
// add the presets to the combo box
|
||||
for (uint32 i = 0; i < numPresets; ++i)
|
||||
for (size_t i = 0; i < numPresets; ++i)
|
||||
{
|
||||
mPresetComboBox->addItem(gameControllerSettings.GetPreset(i)->GetName());
|
||||
}
|
||||
|
||||
// select the active preset
|
||||
const uint32 activePresetIndex = gameControllerSettings.GetActivePresetIndex();
|
||||
if (activePresetIndex != MCORE_INVALIDINDEX32)
|
||||
const size_t activePresetIndex = gameControllerSettings.GetActivePresetIndex();
|
||||
if (activePresetIndex != InvalidIndex)
|
||||
{
|
||||
mPresetComboBox->setCurrentIndex(activePresetIndex);
|
||||
mPresetComboBox->setCurrentIndex(aznumeric_caster(activePresetIndex));
|
||||
}
|
||||
mPresetComboBox->blockSignals(false);
|
||||
|
||||
@@ -701,34 +700,22 @@ namespace EMStudio
|
||||
GameControllerWindow::ButtonInfo* GameControllerWindow::FindButtonInfo(QWidget* widget)
|
||||
{
|
||||
// get the number of button infos and iterate through them
|
||||
const uint32 numButtonInfos = mButtonInfos.size();
|
||||
for (uint32 i = 0; i < numButtonInfos; ++i)
|
||||
const auto foundButtonInfo = AZStd::find_if(begin(mButtonInfos), end(mButtonInfos), [widget](const ButtonInfo& buttonInfo)
|
||||
{
|
||||
if (mButtonInfos[i].mWidget == widget)
|
||||
{
|
||||
return &mButtonInfos[i];
|
||||
}
|
||||
}
|
||||
|
||||
// return failure
|
||||
return nullptr;
|
||||
return buttonInfo.mWidget == widget;
|
||||
});
|
||||
return foundButtonInfo != end(mButtonInfos) ? &(*foundButtonInfo) : nullptr;
|
||||
}
|
||||
|
||||
|
||||
GameControllerWindow::ParameterInfo* GameControllerWindow::FindParamInfoByModeComboBox(QComboBox* comboBox)
|
||||
{
|
||||
// get the number of parameter infos and iterate through them
|
||||
const uint32 numParamInfos = mParameterInfos.size();
|
||||
for (uint32 i = 0; i < numParamInfos; ++i)
|
||||
const auto foundParameterInfo = AZStd::find_if(begin(mParameterInfos), end(mParameterInfos), [comboBox](const ParameterInfo& parameterInfo)
|
||||
{
|
||||
if (mParameterInfos[i].mMode == comboBox)
|
||||
{
|
||||
return &mParameterInfos[i];
|
||||
}
|
||||
}
|
||||
|
||||
// return failure
|
||||
return nullptr;
|
||||
return parameterInfo.mMode == comboBox;
|
||||
});
|
||||
return foundParameterInfo != end(mParameterInfos) ? &(*foundParameterInfo) : nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -736,17 +723,11 @@ namespace EMStudio
|
||||
GameControllerWindow::ParameterInfo* GameControllerWindow::FindButtonInfoByAttributeInfo(const EMotionFX::Parameter* parameter)
|
||||
{
|
||||
// get the number of parameter infos and iterate through them
|
||||
const uint32 numParamInfos = mParameterInfos.size();
|
||||
for (uint32 i = 0; i < numParamInfos; ++i)
|
||||
const auto foundParameterInfo = AZStd::find_if(begin(mParameterInfos), end(mParameterInfos), [parameter](const ParameterInfo& parameterInfo)
|
||||
{
|
||||
if (mParameterInfos[i].mParameter == parameter)
|
||||
{
|
||||
return &mParameterInfos[i];
|
||||
}
|
||||
}
|
||||
|
||||
// return failure
|
||||
return nullptr;
|
||||
return parameterInfo.mParameter == parameter;
|
||||
});
|
||||
return foundParameterInfo != end(mParameterInfos) ? &(*foundParameterInfo) : nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -1053,12 +1034,12 @@ namespace EMStudio
|
||||
// get the game controller settings from the current anim graph
|
||||
EMotionFX::AnimGraphGameControllerSettings& gameControllerSettings = mAnimGraph->GetGameControllerSettings();
|
||||
|
||||
uint32 presetNumber = static_cast<uint32>(gameControllerSettings.GetNumPresets());
|
||||
mString = AZStd::string::format("Preset %d", presetNumber);
|
||||
while (gameControllerSettings.FindPresetIndexByName(mString.c_str()) != MCORE_INVALIDINDEX32)
|
||||
size_t presetNumber = gameControllerSettings.GetNumPresets();
|
||||
mString = AZStd::string::format("Preset %zu", presetNumber);
|
||||
while (gameControllerSettings.FindPresetIndexByName(mString.c_str()) != InvalidIndex)
|
||||
{
|
||||
presetNumber++;
|
||||
mString = AZStd::string::format("Preset %d", presetNumber);
|
||||
mString = AZStd::string::format("Preset %zu", presetNumber);
|
||||
}
|
||||
|
||||
EMotionFX::AnimGraphGameControllerSettings::Preset* preset = aznew EMotionFX::AnimGraphGameControllerSettings::Preset(mString.c_str());
|
||||
@@ -1123,8 +1104,8 @@ namespace EMStudio
|
||||
// get the currently selected preset
|
||||
uint32 presetIndex = mPresetComboBox->currentIndex();
|
||||
|
||||
uint32 newValueIndex = static_cast<uint32>(gameControllerSettings.FindPresetIndexByName(newValue.c_str()));
|
||||
if (newValueIndex == MCORE_INVALIDINDEX32)
|
||||
size_t newValueIndex = gameControllerSettings.FindPresetIndexByName(newValue.c_str());
|
||||
if (newValueIndex == InvalidIndex)
|
||||
{
|
||||
EMotionFX::AnimGraphGameControllerSettings::Preset* preset = gameControllerSettings.GetPreset(presetIndex);
|
||||
preset->SetName(newValue.c_str());
|
||||
@@ -1139,8 +1120,8 @@ namespace EMStudio
|
||||
EMotionFX::AnimGraphGameControllerSettings& gameControllerSettings = mAnimGraph->GetGameControllerSettings();
|
||||
|
||||
// check if there already is a preset with the currently entered name
|
||||
uint32 presetIndex = static_cast<uint32>(gameControllerSettings.FindPresetIndexByName(FromQtString(text).c_str()));
|
||||
if (presetIndex != MCORE_INVALIDINDEX32 && presetIndex != gameControllerSettings.GetActivePresetIndex())
|
||||
size_t presetIndex = gameControllerSettings.FindPresetIndexByName(FromQtString(text).c_str());
|
||||
if (presetIndex != InvalidIndex && presetIndex != gameControllerSettings.GetActivePresetIndex())
|
||||
{
|
||||
GetManager()->SetWidgetAsInvalidInput(mPresetNameLineEdit);
|
||||
}
|
||||
@@ -1153,18 +1134,11 @@ namespace EMStudio
|
||||
|
||||
GameControllerWindow::ParameterInfo* GameControllerWindow::FindParamInfoByAxisComboBox(QComboBox* comboBox)
|
||||
{
|
||||
// get the number of parameter infos and iterate through them
|
||||
const uint32 numParamInfos = mParameterInfos.size();
|
||||
for (uint32 i = 0; i < numParamInfos; ++i)
|
||||
const auto foundParameterInfo = AZStd::find_if(begin(mParameterInfos), end(mParameterInfos), [comboBox](const ParameterInfo& parameterInfo)
|
||||
{
|
||||
if (mParameterInfos[i].mAxis == comboBox)
|
||||
{
|
||||
return &mParameterInfos[i];
|
||||
}
|
||||
}
|
||||
|
||||
// return failure
|
||||
return nullptr;
|
||||
return parameterInfo.mAxis == comboBox;
|
||||
});
|
||||
return foundParameterInfo != end(mParameterInfos) ? &(*foundParameterInfo) : nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -1195,7 +1169,7 @@ namespace EMStudio
|
||||
#if AZ_TRAIT_EMOTIONFX_HAS_GAME_CONTROLLER
|
||||
if (azrtti_istypeof<EMotionFX::FloatParameter>(paramInfo->mParameter))
|
||||
{
|
||||
const uint32 elementID = mGameController->FindElemendIDByName(FromQtString(combo->currentText()).c_str());
|
||||
const uint32 elementID = mGameController->FindElementIDByName(FromQtString(combo->currentText()).c_str());
|
||||
if (elementID >= MCORE_INVALIDINDEX8)
|
||||
{
|
||||
settingsInfo->m_axis = MCORE_INVALIDINDEX8;
|
||||
@@ -1231,18 +1205,11 @@ namespace EMStudio
|
||||
|
||||
GameControllerWindow::ParameterInfo* GameControllerWindow::FindParamInfoByCheckBox(QCheckBox* checkBox)
|
||||
{
|
||||
// get the number of parameter infos and iterate through them
|
||||
const uint32 numParamInfos = mParameterInfos.size();
|
||||
for (uint32 i = 0; i < numParamInfos; ++i)
|
||||
const auto foundParameterInfo = AZStd::find_if(begin(mParameterInfos), end(mParameterInfos), [checkBox](const ParameterInfo& parameterInfo)
|
||||
{
|
||||
if (mParameterInfos[i].mInvert == checkBox)
|
||||
{
|
||||
return &mParameterInfos[i];
|
||||
}
|
||||
}
|
||||
|
||||
// return failure
|
||||
return nullptr;
|
||||
return parameterInfo.mInvert == checkBox;
|
||||
});
|
||||
return foundParameterInfo != end(mParameterInfos) ? &(*foundParameterInfo) : nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -1675,7 +1642,7 @@ namespace EMStudio
|
||||
MCore::AttributeBool* boolAttribute = nullptr;
|
||||
if (parameterIndex.IsSuccess())
|
||||
{
|
||||
MCore::Attribute* attribute = animGraphInstance->GetParameterValue(static_cast<uint32>(parameterIndex.GetValue()));
|
||||
MCore::Attribute* attribute = animGraphInstance->GetParameterValue(parameterIndex.GetValue());
|
||||
|
||||
if (attribute->GetType() == MCore::AttributeBool::TYPE_ID)
|
||||
{
|
||||
|
||||
+61
-175
@@ -22,7 +22,7 @@ namespace EMStudio
|
||||
|
||||
|
||||
// constructor
|
||||
GraphNode::GraphNode(const QModelIndex& modelIndex, const char* name, uint32 numInputs, uint32 numOutputs)
|
||||
GraphNode::GraphNode(const QModelIndex& modelIndex, const char* name, AZ::u16 numInputs, AZ::u16 numOutputs)
|
||||
: m_modelIndex(modelIndex)
|
||||
{
|
||||
mRect = QRect(0, 0, 200, 128);
|
||||
@@ -119,9 +119,9 @@ namespace EMStudio
|
||||
mInfoText.prepare(QTransform(), mSubTitleFont);
|
||||
|
||||
// input ports
|
||||
const uint32 numInputs = mInputPorts.size();
|
||||
const size_t numInputs = mInputPorts.size();
|
||||
mInputPortText.resize(numInputs);
|
||||
for (uint32 i = 0; i < numInputs; ++i)
|
||||
for (size_t i = 0; i < numInputs; ++i)
|
||||
{
|
||||
QStaticText& staticText = mInputPortText[i];
|
||||
staticText.setTextFormat(Qt::PlainText);
|
||||
@@ -132,9 +132,9 @@ namespace EMStudio
|
||||
}
|
||||
|
||||
// output ports
|
||||
const uint32 numOutputs = mOutputPorts.size();
|
||||
const size_t numOutputs = mOutputPorts.size();
|
||||
mOutputPortText.resize(numOutputs);
|
||||
for (uint32 i = 0; i < numOutputs; ++i)
|
||||
for (size_t i = 0; i < numOutputs; ++i)
|
||||
{
|
||||
QStaticText& staticText = mOutputPortText[i];
|
||||
staticText.setTextFormat(Qt::PlainText);
|
||||
@@ -143,104 +143,15 @@ namespace EMStudio
|
||||
staticText.setText(mOutputPorts[i].GetName());
|
||||
staticText.prepare(QTransform(), mPortNameFont);
|
||||
}
|
||||
|
||||
//-------------------------------------------
|
||||
/*
|
||||
// create a new pixmap with the new and correct resolution
|
||||
const uint32 nodeWidth = mRect.width();
|
||||
const uint32 nodeHeight = mRect.height();
|
||||
mTextPixmap = QPixmap(nodeWidth, nodeHeight);
|
||||
|
||||
// make the pixmap fully transparent
|
||||
mTextPixmap.fill(Qt::transparent);
|
||||
|
||||
mTextPainter.begin( &mTextPixmap );
|
||||
|
||||
// setup colors
|
||||
QColor textColor;
|
||||
if (!GetIsSelected())
|
||||
{
|
||||
if (mIsEnabled)
|
||||
textColor = Qt::white;
|
||||
else
|
||||
textColor = QColor( 100, 100, 100 );
|
||||
}
|
||||
else
|
||||
textColor = QColor(255,128,0);
|
||||
|
||||
// some rects we need for the text
|
||||
QRect fullHeaderRect( 0, 0, mRect.width(), 25 );
|
||||
QRect headerRect( 0, 0, mRect.width(), 15 );
|
||||
QRect subHeaderRect( 0, 13, mRect.width(), 10 );
|
||||
|
||||
// draw header text
|
||||
mTextPainter.setBrush( Qt::NoBrush );
|
||||
mTextPainter.setPen( textColor );
|
||||
mTextPainter.setFont( mHeaderFont );
|
||||
mTextPainter.drawText( headerRect, mElidedName, mTextOptionsCenter );
|
||||
|
||||
mTextPainter.setFont( mSubTitleFont );
|
||||
mTextPainter.drawText( subHeaderRect, mElidedSubTitle, mTextOptionsCenter );
|
||||
|
||||
if (mIsCollapsed == false)
|
||||
{
|
||||
// draw the info text
|
||||
QRect textRect;
|
||||
CalcInfoTextRect( textRect, true );
|
||||
mTextPainter.setPen( QColor(255,128,0) );
|
||||
mTextPainter.setFont( mInfoTextFont );
|
||||
mTextPainter.drawText( textRect, mElidedNodeInfo, mTextOptionsCenterHV );
|
||||
|
||||
mTextPainter.setPen( textColor );
|
||||
|
||||
// draw the input ports
|
||||
mTextPainter.setPen( textColor );
|
||||
mTextPainter.setFont( mPortNameFont );
|
||||
const uint32 numInputs = mInputPorts.GetLength();
|
||||
for (uint32 i=0; i<numInputs; ++i)
|
||||
{
|
||||
// get the input port and the corresponding rect
|
||||
NodePort* inputPort = &mInputPorts[i];
|
||||
const QRect& portRect = inputPort->GetRect();
|
||||
|
||||
if (inputPort->GetNameID() == MCORE_INVALIDINDEX32)
|
||||
continue;
|
||||
|
||||
// draw the text
|
||||
CalcInputPortTextRect(i, textRect, true);
|
||||
mTextPainter.drawText( textRect, inputPort->GetName(), mTextOptionsAlignLeft );
|
||||
}
|
||||
|
||||
// draw the output ports
|
||||
const uint32 numOutputs = mOutputPorts.GetLength();
|
||||
for (uint32 i=0; i<numOutputs; ++i)
|
||||
{
|
||||
// get the output port and the corresponding rect
|
||||
NodePort* outputPort = &mOutputPorts[i];
|
||||
|
||||
if (outputPort->GetNameID() == MCORE_INVALIDINDEX32)
|
||||
continue;
|
||||
|
||||
const QRect& portRect = outputPort->GetRect();
|
||||
|
||||
// draw the text
|
||||
CalcOutputPortTextRect(i, textRect, true);
|
||||
mTextPainter.drawText( textRect, outputPort->GetName(), mTextOptionsAlignRight );
|
||||
}
|
||||
}
|
||||
|
||||
mTextPainter.end();
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
// remove all node connections
|
||||
void GraphNode::RemoveAllConnections()
|
||||
{
|
||||
const uint32 numConnections = mConnections.size();
|
||||
for (uint32 i = 0; i < numConnections; ++i)
|
||||
for (NodeConnection* mConnection : mConnections)
|
||||
{
|
||||
delete mConnections[i];
|
||||
delete mConnection;
|
||||
}
|
||||
|
||||
mConnections.clear();
|
||||
@@ -333,17 +244,16 @@ namespace EMStudio
|
||||
mVisualizeRect.setCoords(mRect.right() - 13, mRect.top() + 6, mRect.right() - 5, mRect.top() + 14);
|
||||
|
||||
// update the input ports and reset the port highlight flags
|
||||
uint32 i;
|
||||
const uint32 numInputPorts = mInputPorts.size();
|
||||
for (i = 0; i < numInputPorts; ++i)
|
||||
const AZ::u16 numInputPorts = aznumeric_caster(mInputPorts.size());
|
||||
for (AZ::u16 i = 0; i < numInputPorts; ++i)
|
||||
{
|
||||
mInputPorts[i].SetRect(CalcInputPortRect(i));
|
||||
mInputPorts[i].SetIsHighlighted(false);
|
||||
}
|
||||
|
||||
// update the output ports and reset the port highlight flags
|
||||
const uint32 numOutputPorts = mOutputPorts.size();
|
||||
for (i = 0; i < numOutputPorts; ++i)
|
||||
const AZ::u16 numOutputPorts = aznumeric_caster(mOutputPorts.size());
|
||||
for (AZ::u16 i = 0; i < numOutputPorts; ++i)
|
||||
{
|
||||
mOutputPorts[i].SetRect(CalcOutputPortRect(i));
|
||||
mOutputPorts[i].SetIsHighlighted(false);
|
||||
@@ -367,16 +277,15 @@ namespace EMStudio
|
||||
{
|
||||
// set the set highlight flags for the input ports
|
||||
bool highlightedPortFound = false;
|
||||
for (i = 0; i < numInputPorts; ++i)
|
||||
for (NodePort& inputPort : mInputPorts)
|
||||
{
|
||||
// get the input port and the corresponding rect
|
||||
NodePort* inputPort = &mInputPorts[i];
|
||||
const QRect& portRect = inputPort->GetRect();
|
||||
const QRect& portRect = inputPort.GetRect();
|
||||
|
||||
// check if the mouse position is inside the port rect and break the loop in this case, as the mouse can be only over one port at the time
|
||||
if (portRect.contains(mousePos))
|
||||
{
|
||||
inputPort->SetIsHighlighted(true);
|
||||
inputPort.SetIsHighlighted(true);
|
||||
highlightedPortFound = true;
|
||||
break;
|
||||
}
|
||||
@@ -386,16 +295,15 @@ namespace EMStudio
|
||||
if (highlightedPortFound == false)
|
||||
{
|
||||
// set the set highlight flags for the output ports
|
||||
for (i = 0; i < numOutputPorts; ++i)
|
||||
for (NodePort& outputPort : mOutputPorts)
|
||||
{
|
||||
// get the output port and the corresponding rect
|
||||
NodePort* outputPort = &mOutputPorts[i];
|
||||
const QRect& portRect = outputPort->GetRect();
|
||||
const QRect& portRect = outputPort.GetRect();
|
||||
|
||||
// check if the mouse position is inside the port rect and break the loop in this case, as the mouse can be only over one port at the time
|
||||
if (portRect.contains(mousePos))
|
||||
{
|
||||
outputPort->SetIsHighlighted(true);
|
||||
outputPort.SetIsHighlighted(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -403,8 +311,8 @@ namespace EMStudio
|
||||
}
|
||||
|
||||
// Update the connections
|
||||
const uint32 numConnections = GetNumConnections();
|
||||
for (uint32 c = 0; c < numConnections; ++c)
|
||||
const size_t numConnections = GetNumConnections();
|
||||
for (size_t c = 0; c < numConnections; ++c)
|
||||
{
|
||||
GetConnection(c)->Update(visibleRect, mousePos);
|
||||
}
|
||||
@@ -570,8 +478,8 @@ namespace EMStudio
|
||||
|
||||
// draw the input ports
|
||||
QColor portBrushColor, portPenColor;
|
||||
const uint32 numInputs = mInputPorts.size();
|
||||
for (uint32 i = 0; i < numInputs; ++i)
|
||||
const AZ::u16 numInputs = aznumeric_caster(mInputPorts.size());
|
||||
for (AZ::u16 i = 0; i < numInputs; ++i)
|
||||
{
|
||||
// get the input port and the corresponding rect
|
||||
NodePort* inputPort = &mInputPorts[i];
|
||||
@@ -595,8 +503,8 @@ namespace EMStudio
|
||||
if (GetHasVisualOutputPorts())
|
||||
{
|
||||
// draw the output ports
|
||||
const uint32 numOutputs = mOutputPorts.size();
|
||||
for (uint32 i = 0; i < numOutputs; ++i)
|
||||
const AZ::u16 numOutputs = aznumeric_caster(mOutputPorts.size());
|
||||
for (AZ::u16 i = 0; i < numOutputs; ++i)
|
||||
{
|
||||
// get the output port and the corresponding rect
|
||||
NodePort* outputPort = &mOutputPorts[i];
|
||||
@@ -823,10 +731,8 @@ namespace EMStudio
|
||||
const bool alwaysColor = GetAlwaysColor();
|
||||
|
||||
// for all connections
|
||||
const uint32 numConnections = mConnections.size();
|
||||
for (uint32 c = 0; c < numConnections; ++c)
|
||||
for (NodeConnection* nodeConnection : mConnections)
|
||||
{
|
||||
NodeConnection* nodeConnection = mConnections[c];
|
||||
if (nodeConnection->GetIsVisible())
|
||||
{
|
||||
float opacity = 1.0f;
|
||||
@@ -982,14 +888,14 @@ namespace EMStudio
|
||||
}
|
||||
|
||||
// get the rect for a given input port
|
||||
QRect GraphNode::CalcInputPortRect(uint32 portNr)
|
||||
QRect GraphNode::CalcInputPortRect(AZ::u16 portNr)
|
||||
{
|
||||
return QRect(mRect.left() - 5, mRect.top() + 35 + portNr * 15, 8, 8);
|
||||
}
|
||||
|
||||
|
||||
// get the rect for a given output port
|
||||
QRect GraphNode::CalcOutputPortRect(uint32 portNr)
|
||||
QRect GraphNode::CalcOutputPortRect(AZ::u16 portNr)
|
||||
{
|
||||
return QRect(mRect.right() - 5, mRect.top() + 35 + portNr * 15, 8, 8);
|
||||
}
|
||||
@@ -1010,7 +916,7 @@ namespace EMStudio
|
||||
|
||||
|
||||
// calculate the text rect for the input port
|
||||
void GraphNode::CalcInputPortTextRect(uint32 portNr, QRect& outRect, bool local)
|
||||
void GraphNode::CalcInputPortTextRect(AZ::u16 portNr, QRect& outRect, bool local)
|
||||
{
|
||||
if (local == false)
|
||||
{
|
||||
@@ -1024,7 +930,7 @@ namespace EMStudio
|
||||
|
||||
|
||||
// calculate the text rect for the input port
|
||||
void GraphNode::CalcOutputPortTextRect(uint32 portNr, QRect& outRect, bool local)
|
||||
void GraphNode::CalcOutputPortTextRect(AZ::u16 portNr, QRect& outRect, bool local)
|
||||
{
|
||||
if (local == false)
|
||||
{
|
||||
@@ -1076,32 +982,10 @@ namespace EMStudio
|
||||
return &mOutputPorts.back();
|
||||
}
|
||||
|
||||
/*
|
||||
// update port text path
|
||||
void GraphNode::UpdatePortTextPath()
|
||||
{
|
||||
mPortTextPath = QPainterPath();
|
||||
|
||||
QRect textRect;
|
||||
const uint32 numInputs = mInputPorts.GetLength();
|
||||
for (uint32 i=0; i<numInputs; ++i)
|
||||
{
|
||||
// get the input port and the corresponding rect
|
||||
NodePort* inputPort = &mInputPorts[i];
|
||||
|
||||
// add the text
|
||||
CalcInputPortTextRect( i, textRect );
|
||||
//painter.drawText( textRect, QString::fromWCharArray(inputPort->GetName()), mTextOptionsAlignLeft );
|
||||
mPortTextPath.addText( textRect.left(), textRect.center().y(), mPortNameFont, QString::fromWCharArray(inputPort->GetName()));
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
// remove all input ports
|
||||
NodePort* GraphNode::FindPort(int32 x, int32 y, uint32* outPortNr, bool* outIsInputPort, bool includeInputPorts)
|
||||
NodePort* GraphNode::FindPort(int32 x, int32 y, AZ::u16* outPortNr, bool* outIsInputPort, bool includeInputPorts)
|
||||
{
|
||||
uint32 i;
|
||||
|
||||
// if the node is not visible at all skip directly
|
||||
if (mIsVisible == false)
|
||||
{
|
||||
@@ -1117,8 +1001,8 @@ namespace EMStudio
|
||||
// check the input ports
|
||||
if (includeInputPorts)
|
||||
{
|
||||
const uint32 numInputPorts = mInputPorts.size();
|
||||
for (i = 0; i < numInputPorts; ++i)
|
||||
const AZ::u16 numInputPorts = aznumeric_caster(mInputPorts.size());
|
||||
for (AZ::u16 i = 0; i < numInputPorts; ++i)
|
||||
{
|
||||
QRect rect = CalcInputPortRect(i);
|
||||
if (rect.contains(QPoint(x, y)))
|
||||
@@ -1131,8 +1015,8 @@ namespace EMStudio
|
||||
}
|
||||
|
||||
// check the output ports
|
||||
const uint32 numOutputPorts = mOutputPorts.size();
|
||||
for (i = 0; i < numOutputPorts; ++i)
|
||||
const AZ::u16 numOutputPorts = aznumeric_caster(mOutputPorts.size());
|
||||
for (AZ::u16 i = 0; i < numOutputPorts; ++i)
|
||||
{
|
||||
QRect rect = CalcOutputPortRect(i);
|
||||
if (rect.contains(QPoint(x, y)))
|
||||
@@ -1149,42 +1033,44 @@ namespace EMStudio
|
||||
// remove a given connection
|
||||
bool GraphNode::RemoveConnection(const void* connection, bool removeFromMemory)
|
||||
{
|
||||
const uint32 numConnections = mConnections.size();
|
||||
for (uint32 i = 0; i < numConnections; ++i)
|
||||
const auto foundConnection = AZStd::find_if(begin(mConnections), end(mConnections), [match = connection](const NodeConnection* connection)
|
||||
{
|
||||
// if this is the connection we're searching for
|
||||
if (mConnections[i]->GetModelIndex().data(AnimGraphModel::ROLE_POINTER).value<void*>() == connection)
|
||||
{
|
||||
if (removeFromMemory)
|
||||
{
|
||||
delete mConnections[i];
|
||||
}
|
||||
mConnections.erase(AZStd::next(begin(mConnections), i));
|
||||
return true;
|
||||
}
|
||||
return connection->GetModelIndex().data(AnimGraphModel::ROLE_POINTER).value<void*>() == match;
|
||||
});
|
||||
|
||||
if (foundConnection == end(mConnections))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
|
||||
if (removeFromMemory)
|
||||
{
|
||||
delete *foundConnection;
|
||||
}
|
||||
mConnections.erase(foundConnection);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// Remove a given connection by model index
|
||||
bool GraphNode::RemoveConnection(const QModelIndex& modelIndex, bool removeFromMemory)
|
||||
{
|
||||
const uint32 numConnections = mConnections.size();
|
||||
for (uint32 i = 0; i < numConnections; ++i)
|
||||
const auto foundConnection = AZStd::find_if(begin(mConnections), end(mConnections), [match = modelIndex](const NodeConnection* connection)
|
||||
{
|
||||
// if this is the connection we're searching for
|
||||
if (mConnections[i]->GetModelIndex() == modelIndex)
|
||||
{
|
||||
if (removeFromMemory)
|
||||
{
|
||||
delete mConnections[i];
|
||||
}
|
||||
mConnections.erase(AZStd::next(begin(mConnections), i));
|
||||
return true;
|
||||
}
|
||||
return connection->GetModelIndex() == match;
|
||||
});
|
||||
|
||||
if (foundConnection == end(mConnections))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
|
||||
if (removeFromMemory)
|
||||
{
|
||||
delete *foundConnection;
|
||||
}
|
||||
mConnections.erase(foundConnection);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
+11
-11
@@ -78,7 +78,7 @@ namespace EMStudio
|
||||
TYPE_ID = 0x00000001
|
||||
};
|
||||
|
||||
GraphNode(const QModelIndex& modelIndex, const char* name, uint32 numInputs = 0, uint32 numOutputs = 0);
|
||||
GraphNode(const QModelIndex& modelIndex, const char* name, AZ::u16 numInputs = 0, AZ::u16 numOutputs = 0);
|
||||
virtual ~GraphNode();
|
||||
|
||||
const QModelIndex& GetModelIndex() const { return m_modelIndex; }
|
||||
@@ -86,12 +86,12 @@ namespace EMStudio
|
||||
MCORE_INLINE void UpdateNameAndPorts() { mNameAndPortsUpdated = false; }
|
||||
MCORE_INLINE AZStd::vector<NodeConnection*>& GetConnections() { return mConnections; }
|
||||
MCORE_INLINE size_t GetNumConnections() { return mConnections.size(); }
|
||||
MCORE_INLINE NodeConnection* GetConnection(uint32 index) { return mConnections[index]; }
|
||||
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(uint32 index) { return &mInputPorts[index]; }
|
||||
MCORE_INLINE NodePort* GetOutputPort(uint32 index) { return &mOutputPorts[index]; }
|
||||
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; }
|
||||
@@ -134,8 +134,8 @@ namespace EMStudio
|
||||
MCORE_INLINE float GetOpacity() const { return mOpacity; }
|
||||
MCORE_INLINE void SetOpacity(float opacity) { mOpacity = opacity; }
|
||||
|
||||
size_t GetNumInputPorts() const { return mInputPorts.size(); }
|
||||
size_t GetNumOutputPorts() const { return mOutputPorts.size(); }
|
||||
AZ::u16 GetNumInputPorts() const { return aznumeric_caster(mInputPorts.size()); }
|
||||
AZ::u16 GetNumOutputPorts() const { return aznumeric_caster(mOutputPorts.size()); }
|
||||
|
||||
NodePort* AddInputPort(bool updateTextPixMap);
|
||||
NodePort* AddOutputPort(bool updateTextPixMap);
|
||||
@@ -173,9 +173,9 @@ namespace EMStudio
|
||||
virtual void RenderHasChildsIndicator(QPainter& painter, QPen* pen, QColor borderColor, QColor bgColor);
|
||||
virtual void RenderVisualizeRect(QPainter& painter, const QColor& bgColor, const QColor& bgColor2);
|
||||
|
||||
virtual QRect CalcInputPortRect(uint32 portNr);
|
||||
virtual QRect CalcOutputPortRect(uint32 portNr);
|
||||
virtual NodePort* FindPort(int32 x, int32 y, uint32* outPortNr, bool* outIsInputPort, bool includeInputPorts);
|
||||
virtual QRect CalcInputPortRect(AZ::u16 portNr);
|
||||
virtual QRect CalcOutputPortRect(AZ::u16 portNr);
|
||||
virtual NodePort* FindPort(int32 x, int32 y, AZ::u16* outPortNr, bool* outIsInputPort, bool includeInputPorts);
|
||||
|
||||
virtual bool GetAlwaysColor() const { return true; }
|
||||
virtual bool GetHasError() const { return true; }
|
||||
@@ -188,8 +188,8 @@ namespace EMStudio
|
||||
|
||||
virtual void Sync() {}
|
||||
|
||||
void CalcOutputPortTextRect(uint32 portNr, QRect& outRect, bool local = false);
|
||||
void CalcInputPortTextRect(uint32 portNr, QRect& outRect, bool local = false);
|
||||
void CalcOutputPortTextRect(AZ::u16 portNr, QRect& outRect, bool local = false);
|
||||
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; }
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@
|
||||
namespace EMStudio
|
||||
{
|
||||
// constructor
|
||||
NodeConnection::NodeConnection(NodeGraph* parentGraph, const QModelIndex& modelIndex, GraphNode* targetNode, uint32 portNr, GraphNode* sourceNode, uint32 sourceOutputPortNr)
|
||||
NodeConnection::NodeConnection(NodeGraph* parentGraph, const QModelIndex& modelIndex, GraphNode* targetNode, AZ::u16 portNr, GraphNode* sourceNode, AZ::u16 sourceOutputPortNr)
|
||||
: m_modelIndex(modelIndex)
|
||||
, m_parentGraph(parentGraph)
|
||||
{
|
||||
|
||||
+7
-7
@@ -37,7 +37,7 @@ namespace EMStudio
|
||||
TYPE_ID = 0x00000001
|
||||
};
|
||||
|
||||
NodeConnection(NodeGraph* parentGraph, const QModelIndex& modelIndex, GraphNode* targetNode, uint32 portNr, GraphNode* sourceNode, uint32 sourceOutputPortNr);
|
||||
NodeConnection(NodeGraph* parentGraph, const QModelIndex& modelIndex, GraphNode* targetNode, AZ::u16 portNr, GraphNode* sourceNode, AZ::u16 sourceOutputPortNr);
|
||||
virtual ~NodeConnection();
|
||||
|
||||
const QModelIndex& GetModelIndex() const { return m_modelIndex; }
|
||||
@@ -49,7 +49,7 @@ namespace EMStudio
|
||||
void UpdatePainterPath();
|
||||
|
||||
virtual void Update(const QRect& visibleRect, const QPoint& mousePos);
|
||||
virtual uint32 GetType() { return TYPE_ID; }
|
||||
virtual uint32 GetType() const { return TYPE_ID; }
|
||||
|
||||
QRect CalcRect() const;
|
||||
QRect CalcFinalRect() const;
|
||||
@@ -62,8 +62,8 @@ namespace EMStudio
|
||||
|
||||
MCORE_INLINE bool GetIsVisible() { return mIsVisible; }
|
||||
|
||||
MCORE_INLINE uint32 GetInputPortNr() const { return mPortNr; }
|
||||
MCORE_INLINE uint32 GetOutputPortNr() const { return mSourcePortNr; }
|
||||
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; }
|
||||
|
||||
@@ -103,7 +103,7 @@ namespace EMStudio
|
||||
void SetSourceNode(GraphNode* node) { mSourceNode = node; }
|
||||
void SetTargetNode(GraphNode* node) { mTargetNode = node; }
|
||||
|
||||
void SetTargetPort(uint32 portIndex) { mPortNr = portIndex; }
|
||||
void SetTargetPort(AZ::u16 portIndex) { mPortNr = portIndex; }
|
||||
|
||||
|
||||
protected:
|
||||
@@ -115,8 +115,8 @@ namespace EMStudio
|
||||
GraphNode* mSourceNode; // source node from which the connection comes
|
||||
GraphNode* mTargetNode; // the target node
|
||||
QPainterPath mPainterPath;
|
||||
uint32 mPortNr; // input port where this is connected to
|
||||
uint32 mSourcePortNr; // source output port number
|
||||
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;
|
||||
|
||||
+72
-107
@@ -6,6 +6,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "AzCore/std/numeric.h"
|
||||
#include <AzQtComponents/Utilities/Conversions.h>
|
||||
#include <EMotionFX/Source/AnimGraphNodeGroup.h>
|
||||
#include <EMotionFX/Source/AnimGraphReferenceNode.h>
|
||||
@@ -54,7 +55,7 @@ namespace EMStudio
|
||||
// init connection creation
|
||||
mConStartOffset = QPoint(0, 0);
|
||||
mConEndOffset = QPoint(0, 0);
|
||||
mConPortNr = MCORE_INVALIDINDEX32;
|
||||
mConPortNr = InvalidIndex16;
|
||||
mConIsInputPort = true;
|
||||
mConNode = nullptr; // nullptr when no connection is being created
|
||||
mConPort = nullptr;
|
||||
@@ -137,8 +138,8 @@ namespace EMStudio
|
||||
GraphNode* graphNode = indexAndGraphNode.second.get();
|
||||
|
||||
// get the number of connections and iterate through them
|
||||
const uint32 numConnections = graphNode->GetNumConnections();
|
||||
for (uint32 c = 0; c < numConnections; ++c)
|
||||
const size_t numConnections = graphNode->GetNumConnections();
|
||||
for (size_t c = 0; c < numConnections; ++c)
|
||||
{
|
||||
NodeConnection* connection = graphNode->GetConnection(c);
|
||||
if (connection->GetIsSelected())
|
||||
@@ -271,8 +272,8 @@ namespace EMStudio
|
||||
EMotionFX::AnimGraphNode* emfxTargetNode = indexAndGraphNode.first.data(AnimGraphModel::ROLE_NODE_POINTER).value<EMotionFX::AnimGraphNode*>();
|
||||
|
||||
// iterate through all connections connected to this node
|
||||
const uint32 numConnections = graphNode->GetNumConnections();
|
||||
for (uint32 c = 0; c < numConnections; ++c)
|
||||
const size_t numConnections = graphNode->GetNumConnections();
|
||||
for (size_t c = 0; c < numConnections; ++c)
|
||||
{
|
||||
NodeConnection* visualConnection = graphNode->GetConnection(c);
|
||||
|
||||
@@ -286,8 +287,8 @@ namespace EMStudio
|
||||
continue;
|
||||
}
|
||||
|
||||
const uint32 inputPortNr = visualConnection->GetInputPortNr();
|
||||
const uint32 outputPortNr = visualConnection->GetOutputPortNr();
|
||||
const AZ::u16 inputPortNr = visualConnection->GetInputPortNr();
|
||||
const AZ::u16 outputPortNr = visualConnection->GetOutputPortNr();
|
||||
MCore::Attribute* attribute = emfxSourceNode->GetOutputValue(animGraphInstance, outputPortNr);
|
||||
|
||||
// fill the string with data
|
||||
@@ -606,8 +607,8 @@ namespace EMStudio
|
||||
GraphNode* graphNode = indexAndGraphNode.second.get();
|
||||
|
||||
// iterate over all connections
|
||||
const uint32 numConnections = graphNode->GetNumConnections();
|
||||
for (uint32 c = 0; c < numConnections; ++c)
|
||||
const size_t numConnections = graphNode->GetNumConnections();
|
||||
for (size_t c = 0; c < numConnections; ++c)
|
||||
{
|
||||
NodeConnection* connection = graphNode->GetConnection(c);
|
||||
if (connection->CheckIfIsCloseTo(mousePos))
|
||||
@@ -632,8 +633,8 @@ namespace EMStudio
|
||||
GraphNode* graphNode = indexAndGraphNode.second.get();
|
||||
|
||||
// iterate over all connections
|
||||
const uint32 numConnections = graphNode->GetNumConnections();
|
||||
for (uint32 c = 0; c < numConnections; ++c)
|
||||
const size_t numConnections = graphNode->GetNumConnections();
|
||||
for (size_t c = 0; c < numConnections; ++c)
|
||||
{
|
||||
NodeConnection* connection = graphNode->GetConnection(c);
|
||||
GraphNode* sourceNode = connection->GetSourceNode();
|
||||
@@ -797,28 +798,6 @@ namespace EMStudio
|
||||
#endif
|
||||
|
||||
RenderTitlebar(painter, width);
|
||||
|
||||
// render FPS counter
|
||||
//#ifdef GRAPH_PERFORMANCE_FRAMEDURATION
|
||||
/* static MCore::AnsiString tempFPSString;
|
||||
static MCore::Timer fpsTimer;
|
||||
static double fpsTimeElapsed = 0.0;
|
||||
static uint32 fpsNumFrames = 0;
|
||||
static uint32 lastFPS = 0;
|
||||
fpsTimeElapsed += fpsTimer.GetTimeDelta();
|
||||
fpsNumFrames++;
|
||||
if (fpsTimeElapsed > 1.0f)
|
||||
{
|
||||
lastFPS = fpsNumFrames;
|
||||
fpsTimeElapsed = 0.0;
|
||||
fpsNumFrames = 0;
|
||||
}
|
||||
tempFPSString.Format( "%i FPS", lastFPS );
|
||||
painter.setPen( QColor(255, 255, 255) );
|
||||
painter.resetTransform();
|
||||
painter.drawText( 5, 20, tempFPSString.c_str() );
|
||||
*/
|
||||
//#endif
|
||||
}
|
||||
|
||||
void NodeGraph::RenderTitlebar(QPainter& painter, const QString& text, int32 width)
|
||||
@@ -898,8 +877,8 @@ namespace EMStudio
|
||||
|
||||
AnimGraphModel::AddToItemSelection(newSelection, modelIndex, nodePreviouslySelected, nodeNewlySelected, toggleMode, overwriteCurSelection);
|
||||
|
||||
const uint32 numConnections = node->GetNumConnections();
|
||||
for (uint32 c = 0; c < numConnections; ++c)
|
||||
const size_t numConnections = node->GetNumConnections();
|
||||
for (size_t c = 0; c < numConnections; ++c)
|
||||
{
|
||||
NodeConnection* connection = node->GetConnection(c);
|
||||
const bool connectionPreviouslySelected = std::find(oldSelectionModelIndices.begin(), oldSelectionModelIndices.end(), connection->GetModelIndex()) != oldSelectionModelIndices.end();
|
||||
@@ -970,8 +949,8 @@ namespace EMStudio
|
||||
{
|
||||
GraphNode* node = indexAndGraphNode.second.get();
|
||||
|
||||
const uint32 numConnections = node->GetNumConnections();
|
||||
for (uint32 c = 0; c < numConnections; ++c)
|
||||
const size_t numConnections = node->GetNumConnections();
|
||||
for (size_t c = 0; c < numConnections; ++c)
|
||||
{
|
||||
NodeConnection* connection = node->GetConnection(c);
|
||||
const bool isNewlySelected = connection->CheckIfIsCloseTo(point);
|
||||
@@ -1217,20 +1196,12 @@ namespace EMStudio
|
||||
|
||||
|
||||
// calc the number of selected nodes
|
||||
uint32 NodeGraph::CalcNumSelectedNodes() const
|
||||
size_t NodeGraph::CalcNumSelectedNodes() const
|
||||
{
|
||||
uint32 result = 0;
|
||||
|
||||
for (const GraphNodeByModelIndex::value_type& indexAndGraphNode : m_graphNodeByModelIndex)
|
||||
return AZStd::accumulate(begin(m_graphNodeByModelIndex), end(m_graphNodeByModelIndex), size_t{0}, [](size_t total, const auto& indexAndGraphNode)
|
||||
{
|
||||
GraphNode* node = indexAndGraphNode.second.get();
|
||||
if (node->GetIsSelected())
|
||||
{
|
||||
result++;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
return total + indexAndGraphNode.second->GetIsSelected();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -1254,8 +1225,8 @@ namespace EMStudio
|
||||
if (includeConnections)
|
||||
{
|
||||
// for all connections
|
||||
const uint32 numConnections = node->GetNumConnections();
|
||||
for (uint32 c = 0; c < numConnections; ++c)
|
||||
const size_t numConnections = node->GetNumConnections();
|
||||
for (size_t c = 0; c < numConnections; ++c)
|
||||
{
|
||||
if (node->GetConnection(c)->GetIsSelected())
|
||||
{
|
||||
@@ -1283,8 +1254,8 @@ namespace EMStudio
|
||||
result |= graphNode->GetRect();
|
||||
|
||||
// for all connections
|
||||
const uint32 numConnections = graphNode->GetNumConnections();
|
||||
for (uint32 c = 0; c < numConnections; ++c)
|
||||
const size_t numConnections = graphNode->GetNumConnections();
|
||||
for (size_t c = 0; c < numConnections; ++c)
|
||||
{
|
||||
result |= graphNode->GetConnection(c)->CalcRect();
|
||||
}
|
||||
@@ -1499,7 +1470,7 @@ namespace EMStudio
|
||||
|
||||
|
||||
// find the port at a given location
|
||||
NodePort* NodeGraph::FindPort(int32 x, int32 y, GraphNode** outNode, uint32* outPortNr, bool* outIsInputPort, bool includeInputPorts)
|
||||
NodePort* NodeGraph::FindPort(int32 x, int32 y, GraphNode** outNode, AZ::u16* outPortNr, bool* outIsInputPort, bool includeInputPorts)
|
||||
{
|
||||
// get the number of nodes in the graph and iterate through them
|
||||
for (const GraphNodeByModelIndex::value_type& indexAndGraphNode : m_graphNodeByModelIndex)
|
||||
@@ -1527,7 +1498,7 @@ namespace EMStudio
|
||||
|
||||
|
||||
// start creating a connection
|
||||
void NodeGraph::StartCreateConnection(uint32 portNr, bool isInputPort, GraphNode* portNode, NodePort* port, const QPoint& startOffset)
|
||||
void NodeGraph::StartCreateConnection(AZ::u16 portNr, bool isInputPort, GraphNode* portNode, NodePort* port, const QPoint& startOffset)
|
||||
{
|
||||
mConPortNr = portNr;
|
||||
mConIsInputPort = isInputPort;
|
||||
@@ -1538,7 +1509,7 @@ namespace EMStudio
|
||||
|
||||
|
||||
// start relinking a connection
|
||||
void NodeGraph::StartRelinkConnection(NodeConnection* connection, uint32 portNr, GraphNode* node)
|
||||
void NodeGraph::StartRelinkConnection(NodeConnection* connection, AZ::u16 portNr, GraphNode* node)
|
||||
{
|
||||
mConPortNr = portNr;
|
||||
mConNode = node;
|
||||
@@ -1604,7 +1575,7 @@ namespace EMStudio
|
||||
// reset members
|
||||
void NodeGraph::StopRelinkConnection()
|
||||
{
|
||||
mConPortNr = MCORE_INVALIDINDEX32;
|
||||
mConPortNr = InvalidIndex16;
|
||||
mConNode = nullptr;
|
||||
mRelinkConnection = nullptr;
|
||||
mConIsValid = false;
|
||||
@@ -1616,7 +1587,7 @@ namespace EMStudio
|
||||
// reset members
|
||||
void NodeGraph::StopCreateConnection()
|
||||
{
|
||||
mConPortNr = MCORE_INVALIDINDEX32;
|
||||
mConPortNr = InvalidIndex16;
|
||||
mConIsInputPort = true;
|
||||
mConNode = nullptr; // nullptr when no connection is being created
|
||||
mConPort = nullptr;
|
||||
@@ -1640,8 +1611,8 @@ namespace EMStudio
|
||||
GraphNode* graphNode = indexAndGraphNode.second.get();
|
||||
|
||||
// get the number of connections and iterate through them
|
||||
const uint32 numConnections = graphNode->GetNumConnections();
|
||||
for (uint32 j = 0; j < numConnections; ++j)
|
||||
const size_t numConnections = graphNode->GetNumConnections();
|
||||
for (size_t j = 0; j < numConnections; ++j)
|
||||
{
|
||||
NodeConnection* connection = graphNode->GetConnection(j);
|
||||
|
||||
@@ -1672,9 +1643,6 @@ namespace EMStudio
|
||||
{
|
||||
// gather some information from the connection
|
||||
NodeConnection* connection = GetRelinkConnection();
|
||||
//GraphNode* sourceNode = connection->GetSourceNode();
|
||||
//uint32 sourcePortNr = connection->GetOutputPortNr();
|
||||
//NodePort* port = sourceNode->GetOutputPort( connection->GetOutputPortNr() );
|
||||
QPoint start = connection->GetSourceRect().center();
|
||||
QPoint end = m_graphWidget->GetMousePos();
|
||||
|
||||
@@ -1701,8 +1669,8 @@ namespace EMStudio
|
||||
}
|
||||
|
||||
// now check all ports to see if they would be valid
|
||||
const uint32 numInputPorts = node->GetNumInputPorts();
|
||||
for (uint32 i = 0; i < numInputPorts; ++i)
|
||||
const AZ::u16 numInputPorts = node->GetNumInputPorts();
|
||||
for (AZ::u16 i = 0; i < numInputPorts; ++i)
|
||||
{
|
||||
if (CheckIfIsRelinkConnectionValid(mRelinkConnection, node, i, true))
|
||||
{
|
||||
@@ -1778,8 +1746,8 @@ namespace EMStudio
|
||||
}
|
||||
|
||||
// now check all ports to see if they would be valid
|
||||
const uint32 numInputPorts = node->GetNumInputPorts();
|
||||
for (uint32 i = 0; i < numInputPorts; ++i)
|
||||
const AZ::u16 numInputPorts = node->GetNumInputPorts();
|
||||
for (AZ::u16 i = 0; i < numInputPorts; ++i)
|
||||
{
|
||||
if (m_graphWidget->CheckIfIsCreateConnectionValid(i, node, node->GetInputPort(i), true))
|
||||
{
|
||||
@@ -1793,8 +1761,8 @@ namespace EMStudio
|
||||
}
|
||||
|
||||
// now check all ports to see if they would be valid
|
||||
const uint32 numOutputPorts = node->GetNumOutputPorts();
|
||||
for (uint32 a = 0; a < numOutputPorts; ++a)
|
||||
const AZ::u16 numOutputPorts = node->GetNumOutputPorts();
|
||||
for (AZ::u16 a = 0; a < numOutputPorts; ++a)
|
||||
{
|
||||
if (m_graphWidget->CheckIfIsCreateConnectionValid(a, node, node->GetOutputPort(a), false))
|
||||
{
|
||||
@@ -1864,10 +1832,10 @@ namespace EMStudio
|
||||
|
||||
|
||||
// check if this connection already exists
|
||||
bool NodeGraph::CheckIfHasConnection(GraphNode* sourceNode, uint32 outputPortNr, GraphNode* targetNode, uint32 inputPortNr) const
|
||||
bool NodeGraph::CheckIfHasConnection(GraphNode* sourceNode, AZ::u16 outputPortNr, GraphNode* targetNode, AZ::u16 inputPortNr) const
|
||||
{
|
||||
const uint32 numConnections = targetNode->GetNumConnections();
|
||||
for (uint32 i = 0; i < numConnections; ++i)
|
||||
const size_t numConnections = targetNode->GetNumConnections();
|
||||
for (size_t i = 0; i < numConnections; ++i)
|
||||
{
|
||||
NodeConnection* connection = targetNode->GetConnection(i);
|
||||
|
||||
@@ -1888,15 +1856,15 @@ namespace EMStudio
|
||||
}
|
||||
|
||||
|
||||
NodeConnection* NodeGraph::FindInputConnection(GraphNode* targetNode, uint32 targetPortNr) const
|
||||
NodeConnection* NodeGraph::FindInputConnection(GraphNode* targetNode, AZ::u16 targetPortNr) const
|
||||
{
|
||||
if (targetNode == nullptr || targetPortNr == MCORE_INVALIDINDEX32)
|
||||
if (targetNode == nullptr || targetPortNr == InvalidIndex16)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const uint32 numConnections = targetNode->GetNumConnections();
|
||||
for (uint32 i = 0; i < numConnections; ++i)
|
||||
const size_t numConnections = targetNode->GetNumConnections();
|
||||
for (size_t i = 0; i < numConnections; ++i)
|
||||
{
|
||||
NodeConnection* connection = targetNode->GetConnection(i);
|
||||
|
||||
@@ -1967,8 +1935,8 @@ namespace EMStudio
|
||||
const QModelIndex parentModelIndex = modelIndex.model()->parent(modelIndex);
|
||||
EMotionFX::AnimGraphNode* parentNode = parentModelIndex.data(AnimGraphModel::ROLE_NODE_POINTER).value<EMotionFX::AnimGraphNode*>();
|
||||
GraphNode* target = FindGraphNode(parentNode);
|
||||
const uint32 sourcePort = connection->GetSourcePort();
|
||||
const uint32 targetPort = connection->GetTargetPort();
|
||||
const AZ::u16 sourcePort = connection->GetSourcePort();
|
||||
const AZ::u16 targetPort = connection->GetTargetPort();
|
||||
NodeConnection* visualConnection = new NodeConnection(this, modelIndex, target, targetPort, source, sourcePort);
|
||||
target->AddConnection(visualConnection);
|
||||
break;
|
||||
@@ -2014,8 +1982,8 @@ namespace EMStudio
|
||||
for (const GraphNodeByModelIndex::value_type& target : m_graphNodeByModelIndex)
|
||||
{
|
||||
AZStd::vector<NodeConnection*>& connections = target.second->GetConnections();
|
||||
const uint32 connectionsCount = connections.size();
|
||||
for (uint32 i = 0; i < connectionsCount; ++i)
|
||||
const size_t connectionsCount = connections.size();
|
||||
for (size_t i = 0; i < connectionsCount; ++i)
|
||||
{
|
||||
if (connections[i]->GetType() == StateConnection::TYPE_ID)
|
||||
{
|
||||
@@ -2087,12 +2055,11 @@ namespace EMStudio
|
||||
|
||||
bool foundConnection = false;
|
||||
AZStd::vector<NodeConnection*>& connections = targetGraphNode->GetConnections();
|
||||
const uint32 connectionsCount = connections.size();
|
||||
for (uint32 i = 0; i < connectionsCount; ++i)
|
||||
for (NodeConnection* connection : connections)
|
||||
{
|
||||
if (connections[i]->GetType() == StateConnection::TYPE_ID)
|
||||
if (connection->GetType() == StateConnection::TYPE_ID)
|
||||
{
|
||||
StateConnection* visualStateConnection = static_cast<StateConnection*>(connections[i]);
|
||||
StateConnection* visualStateConnection = static_cast<StateConnection*>(connection);
|
||||
if (visualStateConnection->GetModelIndex() == modelIndex)
|
||||
{
|
||||
SyncTransition(visualStateConnection, transition, targetGraphNode);
|
||||
@@ -2175,12 +2142,11 @@ namespace EMStudio
|
||||
for (const GraphNodeByModelIndex::value_type& target : m_graphNodeByModelIndex)
|
||||
{
|
||||
AZStd::vector<NodeConnection*>& connections = target.second->GetConnections();
|
||||
const uint32 connectionsCount = connections.size();
|
||||
for (uint32 i = 0; i < connectionsCount; ++i)
|
||||
for (NodeConnection* connection : connections)
|
||||
{
|
||||
if (connections[i]->GetType() == StateConnection::TYPE_ID)
|
||||
if (connection->GetType() == StateConnection::TYPE_ID)
|
||||
{
|
||||
StateConnection* visualStateConnection = static_cast<StateConnection*>(connections[i]);
|
||||
StateConnection* visualStateConnection = static_cast<StateConnection*>(connection);
|
||||
if (visualStateConnection->GetModelIndex() == modelIndex)
|
||||
{
|
||||
return visualStateConnection;
|
||||
@@ -2204,12 +2170,11 @@ namespace EMStudio
|
||||
if (target)
|
||||
{
|
||||
AZStd::vector<NodeConnection*>& connections = target->GetConnections();
|
||||
const uint32 connectionsCount = connections.size();
|
||||
for (uint32 i = 0; i < connectionsCount; ++i)
|
||||
for (NodeConnection* connection : connections)
|
||||
{
|
||||
if (connections[i]->GetType() == NodeConnection::TYPE_ID)
|
||||
if (connection->GetType() == NodeConnection::TYPE_ID)
|
||||
{
|
||||
NodeConnection* visualNodeConnection = static_cast<NodeConnection*>(connections[i]);
|
||||
NodeConnection* visualNodeConnection = static_cast<NodeConnection*>(connection);
|
||||
if (visualNodeConnection->GetModelIndex() == modelIndex)
|
||||
{
|
||||
return visualNodeConnection;
|
||||
@@ -2237,8 +2202,8 @@ namespace EMStudio
|
||||
graphNode->SetIsProcessed(graphNodeAnimGraphInstance->GetIsOutputReady(emfxNode->GetObjectIndex()));
|
||||
graphNode->SetIsUpdated(graphNodeAnimGraphInstance->GetIsUpdateReady(emfxNode->GetObjectIndex()));
|
||||
|
||||
const uint32 numConnections = graphNode->GetNumConnections();
|
||||
for (uint32 c = 0; c < numConnections; ++c)
|
||||
const size_t numConnections = graphNode->GetNumConnections();
|
||||
for (size_t c = 0; c < numConnections; ++c)
|
||||
{
|
||||
NodeConnection* connection = graphNode->GetConnection(c);
|
||||
if (connection->GetType() == NodeConnection::TYPE_ID)
|
||||
@@ -2253,8 +2218,8 @@ namespace EMStudio
|
||||
graphNode->SetIsProcessed(false);
|
||||
graphNode->SetIsUpdated(false);
|
||||
|
||||
const uint32 numConnections = graphNode->GetNumConnections();
|
||||
for (uint32 c = 0; c < numConnections; ++c)
|
||||
const size_t numConnections = graphNode->GetNumConnections();
|
||||
for (size_t c = 0; c < numConnections; ++c)
|
||||
{
|
||||
NodeConnection* connection = graphNode->GetConnection(c);
|
||||
if (connection->GetType() == NodeConnection::TYPE_ID)
|
||||
@@ -2264,8 +2229,8 @@ namespace EMStudio
|
||||
}
|
||||
}
|
||||
|
||||
const uint32 numConnections = graphNode->GetNumConnections();
|
||||
for (uint32 c = 0; c < numConnections; ++c)
|
||||
const size_t numConnections = graphNode->GetNumConnections();
|
||||
for (size_t c = 0; c < numConnections; ++c)
|
||||
{
|
||||
NodeConnection* connection = graphNode->GetConnection(c);
|
||||
if (connection->GetType() == NodeConnection::TYPE_ID)
|
||||
@@ -2285,12 +2250,12 @@ namespace EMStudio
|
||||
}
|
||||
|
||||
// check if a connection is valid or not
|
||||
bool NodeGraph::CheckIfIsRelinkConnectionValid(NodeConnection* connection, GraphNode* newTargetNode, uint32 newTargetPortNr, bool isTargetInput)
|
||||
bool NodeGraph::CheckIfIsRelinkConnectionValid(NodeConnection* connection, GraphNode* newTargetNode, AZ::u16 newTargetPortNr, bool isTargetInput)
|
||||
{
|
||||
GraphNode* targetNode = connection->GetSourceNode();
|
||||
GraphNode* sourceNode = newTargetNode;
|
||||
uint32 sourcePortNr = connection->GetOutputPortNr();
|
||||
uint32 targetPortNr = newTargetPortNr;
|
||||
AZ::u16 sourcePortNr = connection->GetOutputPortNr();
|
||||
AZ::u16 targetPortNr = newTargetPortNr;
|
||||
|
||||
// don't allow connection to itself
|
||||
if (sourceNode == targetNode)
|
||||
@@ -2341,8 +2306,8 @@ namespace EMStudio
|
||||
graphNode->ResetBorderColor();
|
||||
|
||||
// recurse through the inputs
|
||||
const uint32 numConnections = startNode->GetNumConnections();
|
||||
for (uint32 i = 0; i < numConnections; ++i)
|
||||
const size_t numConnections = startNode->GetNumConnections();
|
||||
for (size_t i = 0; i < numConnections; ++i)
|
||||
{
|
||||
EMotionFX::BlendTreeConnection* connection = startNode->GetConnection(i);
|
||||
RecursiveSetOpacity(connection->GetSourceNode(), opacity);
|
||||
@@ -2458,8 +2423,8 @@ namespace EMStudio
|
||||
// get the number of node groups and iterate through them
|
||||
QRect nodeRect;
|
||||
QRect groupRect;
|
||||
const uint32 numNodeGroups = animGraph->GetNumNodeGroups();
|
||||
for (uint32 i = 0; i < numNodeGroups; ++i)
|
||||
const size_t numNodeGroups = animGraph->GetNumNodeGroups();
|
||||
for (size_t i = 0; i < numNodeGroups; ++i)
|
||||
{
|
||||
// get the current node group
|
||||
EMotionFX::AnimGraphNodeGroup* nodeGroup = animGraph->GetNodeGroup(i);
|
||||
@@ -2471,7 +2436,7 @@ namespace EMStudio
|
||||
}
|
||||
|
||||
// get the number of nodes inside the node group and skip the group in case there are no nodes in
|
||||
const uint32 numNodes = nodeGroup->GetNumNodes();
|
||||
const size_t numNodes = nodeGroup->GetNumNodes();
|
||||
if (numNodes == 0)
|
||||
{
|
||||
continue;
|
||||
@@ -2483,7 +2448,7 @@ namespace EMStudio
|
||||
int32 right = std::numeric_limits<int32>::lowest();
|
||||
|
||||
bool nodesInGroupDisplayed = false;
|
||||
for (uint32 j = 0; j < numNodes; ++j)
|
||||
for (size_t j = 0; j < numNodes; ++j)
|
||||
{
|
||||
// get the graph node by the id and skip it if the node is not inside the currently visible node graph
|
||||
const EMotionFX::AnimGraphNodeId nodeId = nodeGroup->GetNode(j);
|
||||
|
||||
+9
-9
@@ -81,24 +81,24 @@ namespace EMStudio
|
||||
|
||||
GraphNode* GetCreateConnectionNode() { return mConNode; }
|
||||
NodeConnection* GetRelinkConnection() { return mRelinkConnection; }
|
||||
uint32 GetCreateConnectionPortNr() const { return mConPortNr; }
|
||||
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; }
|
||||
|
||||
bool CheckIfHasConnection(GraphNode* sourceNode, uint32 outputPortNr, GraphNode* targetNode, uint32 inputPortNr) const;
|
||||
NodeConnection* FindInputConnection(GraphNode* targetNode, uint32 targetPortNr) const;
|
||||
bool CheckIfHasConnection(GraphNode* sourceNode, AZ::u16 outputPortNr, GraphNode* targetNode, AZ::u16 inputPortNr) const;
|
||||
NodeConnection* FindInputConnection(GraphNode* targetNode, AZ::u16 targetPortNr) const;
|
||||
NodeConnection* FindConnection(const QPoint& mousePos);
|
||||
|
||||
void SelectAllNodes();
|
||||
void UnselectAllNodes();
|
||||
|
||||
uint32 CalcNumSelectedNodes() const;
|
||||
size_t CalcNumSelectedNodes() const;
|
||||
|
||||
GraphNode* FindNode(const QPoint& globalPoint);
|
||||
void StartCreateConnection(uint32 portNr, bool isInputPort, GraphNode* portNode, NodePort* port, const QPoint& startOffset);
|
||||
void StartRelinkConnection(NodeConnection* connection, uint32 portNr, GraphNode* node);
|
||||
void StartCreateConnection(AZ::u16 portNr, bool isInputPort, GraphNode* portNode, NodePort* port, const QPoint& startOffset);
|
||||
void StartRelinkConnection(NodeConnection* connection, AZ::u16 portNr, GraphNode* node);
|
||||
void StopCreateConnection();
|
||||
void StopRelinkConnection();
|
||||
|
||||
@@ -118,7 +118,7 @@ namespace EMStudio
|
||||
void SelectConnectionCloseTo(const QPoint& point, bool overwriteCurSelection = true, bool toggle = false);
|
||||
QRect CalcRectFromSelection(bool includeConnections = true) const;
|
||||
QRect CalcRectFromGraph() const;
|
||||
NodePort* FindPort(int32 x, int32 y, GraphNode** outNode, uint32* outPortNr, bool* outIsInputPort, bool includeInputPorts = true);
|
||||
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; }
|
||||
@@ -157,7 +157,7 @@ namespace EMStudio
|
||||
|
||||
void UpdateVisualGraphFlags();
|
||||
|
||||
static bool CheckIfIsRelinkConnectionValid(NodeConnection* connection, GraphNode* newTargetNode, uint32 newTargetPortNr, bool isTargetInput);
|
||||
static bool CheckIfIsRelinkConnectionValid(NodeConnection* connection, GraphNode* newTargetNode, AZ::u16 newTargetPortNr, bool isTargetInput);
|
||||
|
||||
void RecursiveSetOpacity(EMotionFX::AnimGraphNode* startNode, float opacity);
|
||||
|
||||
@@ -197,7 +197,7 @@ namespace EMStudio
|
||||
// connection info
|
||||
QPoint mConStartOffset;
|
||||
QPoint mConEndOffset;
|
||||
uint32 mConPortNr;
|
||||
AZ::u16 mConPortNr;
|
||||
bool mConIsInputPort;
|
||||
GraphNode* mConNode; // nullptr when no connection is being created
|
||||
NodeConnection* mRelinkConnection; // nullptr when not relinking a connection
|
||||
|
||||
+14
-25
@@ -406,7 +406,7 @@ namespace EMStudio
|
||||
// check if we are clicking on a port
|
||||
GraphNode* portNode = nullptr;
|
||||
NodePort* port = nullptr;
|
||||
uint32 portNr = MCORE_INVALIDINDEX32;
|
||||
AZ::u16 portNr = InvalidIndex16;
|
||||
bool isInputPort = true;
|
||||
port = mActiveGraph->FindPort(globalPos.x(), globalPos.y(), &portNode, &portNr, &isInputPort);
|
||||
|
||||
@@ -767,8 +767,8 @@ namespace EMStudio
|
||||
if (motionEntry && motionEntry->GetMotion())
|
||||
{
|
||||
EMotionFX::Motion* motion = motionEntry->GetMotion();
|
||||
uint32 motionIndex = motionManager.FindMotionIndexByName(motion->GetName());
|
||||
commandString = AZStd::string::format("Select -motionIndex %d", motionIndex);
|
||||
size_t motionIndex = motionManager.FindMotionIndexByName(motion->GetName());
|
||||
commandString = AZStd::string::format("Select -motionIndex %zu", motionIndex);
|
||||
commandGroup.AddCommandString(commandString);
|
||||
}
|
||||
}
|
||||
@@ -810,7 +810,7 @@ namespace EMStudio
|
||||
// check if we are clicking on an input port
|
||||
GraphNode* portNode = nullptr;
|
||||
NodePort* port = nullptr;
|
||||
uint32 portNr = MCORE_INVALIDINDEX32;
|
||||
AZ::u16 portNr = InvalidIndex16;
|
||||
bool isInputPort = true;
|
||||
port = mActiveGraph->FindPort(globalPos.x(), globalPos.y(), &portNode, &portNr, &isInputPort);
|
||||
if (port)
|
||||
@@ -824,18 +824,10 @@ namespace EMStudio
|
||||
if (actionFilter.m_editConnections &&
|
||||
isInputPort && connection && portNode->GetType() != StateGraphNode::TYPE_ID)
|
||||
{
|
||||
//connection->SetColor();
|
||||
//MCore::LOG("%s(%i)->%s(%i)", connection->GetSourceNode()->GetName(), connection->GetOutputPortNr(), connection->GetTargetNode()->GetName(), connection->GetInputPortNr());
|
||||
//GraphNode* createConNode = connection->GetSourceNode();
|
||||
//uint32 createConPortNr = connection->GetOutputPortNr();
|
||||
//NodePort* createConPort = createConNode->GetOutputPort( createConPortNr );
|
||||
//QPoint createConOffset = QPoint(0,0);//globalPos - createConNode->GetRect().topLeft();
|
||||
connection->SetIsDashed(true);
|
||||
|
||||
UpdateMouseCursor(mousePos, globalPos);
|
||||
//mActiveGraph->StartCreateConnection( createConPortNr, !isInputPort, createConNode, createConPort, createConOffset );
|
||||
mActiveGraph->StartRelinkConnection(connection, portNr, portNode);
|
||||
//update();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1054,7 +1046,7 @@ namespace EMStudio
|
||||
{
|
||||
if (mActiveGraph->GetIsCreateConnectionValid())
|
||||
{
|
||||
uint32 targetPortNr;
|
||||
AZ::u16 targetPortNr;
|
||||
bool targetIsInputPort;
|
||||
GraphNode* targetNode;
|
||||
|
||||
@@ -1096,7 +1088,7 @@ namespace EMStudio
|
||||
AZ_Assert(!mActiveGraph->IsInReferencedGraph(), "Expected to not be in a referenced graph");
|
||||
|
||||
// get the information from the current mouse position
|
||||
uint32 newTargetPortNr;
|
||||
AZ::u16 newTargetPortNr;
|
||||
bool newTargetIsInputPort;
|
||||
GraphNode* newTargetNode;
|
||||
NodePort* newTargetPort = mActiveGraph->FindPort(globalPos.x(), globalPos.y(), &newTargetNode, &newTargetPortNr, &newTargetIsInputPort);
|
||||
@@ -1119,10 +1111,10 @@ namespace EMStudio
|
||||
// get the information from the old connection which we want to relink
|
||||
GraphNode* sourceNode = relinkedConnection->GetSourceNode();
|
||||
AZStd::string sourceNodeName = sourceNode->GetName();
|
||||
uint32 sourcePortNr = relinkedConnection->GetOutputPortNr();
|
||||
AZ::u16 sourcePortNr = relinkedConnection->GetOutputPortNr();
|
||||
GraphNode* oldTargetNode = relinkedConnection->GetTargetNode();
|
||||
AZStd::string oldTargetNodeName = oldTargetNode->GetName();
|
||||
uint32 oldTargetPortNr = relinkedConnection->GetInputPortNr();
|
||||
AZ::u16 oldTargetPortNr = relinkedConnection->GetInputPortNr();
|
||||
|
||||
if (NodeGraph::CheckIfIsRelinkConnectionValid(relinkedConnection, newTargetNode, newTargetPortNr, newTargetIsInputPort))
|
||||
{
|
||||
@@ -1412,7 +1404,7 @@ namespace EMStudio
|
||||
}
|
||||
|
||||
// check if we're hovering over a port
|
||||
uint32 portNr;
|
||||
AZ::u16 portNr;
|
||||
GraphNode* portNode;
|
||||
bool isInputPort;
|
||||
NodePort* nodePort = mActiveGraph->FindPort(globalMousePos.x(), globalMousePos.y(), &portNode, &portNr, &isInputPort);
|
||||
@@ -1432,7 +1424,7 @@ namespace EMStudio
|
||||
else // not hovering a node, simply check for ports
|
||||
{
|
||||
// check if we're hovering over a port
|
||||
uint32 portNr;
|
||||
AZ::u16 portNr;
|
||||
GraphNode* portNode;
|
||||
bool isInputPort;
|
||||
NodePort* nodePort = mActiveGraph->FindPort(globalMousePos.x(), globalMousePos.y(), &portNode, &portNr, &isInputPort);
|
||||
@@ -1551,21 +1543,18 @@ namespace EMStudio
|
||||
|
||||
|
||||
// return the number of selected nodes
|
||||
uint32 NodeGraphWidget::CalcNumSelectedNodes() const
|
||||
size_t NodeGraphWidget::CalcNumSelectedNodes() const
|
||||
{
|
||||
if (mActiveGraph)
|
||||
{
|
||||
return mActiveGraph->CalcNumSelectedNodes();
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// is the given connection valid
|
||||
bool NodeGraphWidget::CheckIfIsCreateConnectionValid(uint32 portNr, GraphNode* portNode, NodePort* port, bool isInputPort)
|
||||
bool NodeGraphWidget::CheckIfIsCreateConnectionValid(AZ::u16 portNr, GraphNode* portNode, NodePort* port, bool isInputPort)
|
||||
{
|
||||
MCORE_UNUSED(portNr);
|
||||
MCORE_UNUSED(port);
|
||||
@@ -1608,7 +1597,7 @@ namespace EMStudio
|
||||
return true;
|
||||
}
|
||||
|
||||
void NodeGraphWidget::OnCreateConnection(uint32 sourcePortNr, GraphNode* sourceNode, bool sourceIsInputPort, uint32 targetPortNr, GraphNode* targetNode, bool targetIsInputPort, const QPoint& startOffset, const QPoint& endOffset)
|
||||
void NodeGraphWidget::OnCreateConnection(AZ::u16 sourcePortNr, GraphNode* sourceNode, bool sourceIsInputPort, AZ::u16 targetPortNr, GraphNode* targetNode, bool targetIsInputPort, const QPoint& startOffset, const QPoint& endOffset)
|
||||
{
|
||||
AZ_UNUSED(sourcePortNr);
|
||||
AZ_UNUSED(sourceNode);
|
||||
|
||||
+3
-3
@@ -59,7 +59,7 @@ namespace EMStudio
|
||||
MCORE_INLINE void SetMousePos(const QPoint& pos) { mMousePos = pos; }
|
||||
MCORE_INLINE void SetShowFPS(bool showFPS) { mShowFPS = showFPS; }
|
||||
|
||||
uint32 CalcNumSelectedNodes() const;
|
||||
size_t CalcNumSelectedNodes() const;
|
||||
|
||||
QPoint LocalToGlobal(const QPoint& inPoint) const;
|
||||
QPoint GlobalToLocal(const QPoint& inPoint) const;
|
||||
@@ -69,7 +69,7 @@ namespace EMStudio
|
||||
|
||||
virtual bool PreparePainting() { return true; }
|
||||
|
||||
virtual bool CheckIfIsCreateConnectionValid(uint32 portNr, GraphNode* portNode, NodePort* port, bool isInputPort);
|
||||
virtual bool CheckIfIsCreateConnectionValid(AZ::u16 portNr, GraphNode* portNode, NodePort* port, bool isInputPort);
|
||||
virtual bool CheckIfIsValidTransition(GraphNode* sourceState, GraphNode* targetState);
|
||||
virtual bool CheckIfIsValidTransitionSource(GraphNode* sourceState);
|
||||
virtual bool CreateConnectionMustBeCurved() { return true; }
|
||||
@@ -80,7 +80,7 @@ namespace EMStudio
|
||||
virtual void OnMoveStart() {}
|
||||
virtual void OnMoveNode(GraphNode* node, int32 x, int32 y) { MCORE_UNUSED(node); MCORE_UNUSED(x); MCORE_UNUSED(y); }
|
||||
virtual void OnMoveEnd() {}
|
||||
virtual void OnCreateConnection(uint32 sourcePortNr, GraphNode* sourceNode, bool sourceIsInputPort, uint32 targetPortNr, GraphNode* targetNode, bool targetIsInputPort, const QPoint& startOffset, const QPoint& endOffset);
|
||||
virtual void OnCreateConnection(AZ::u16 sourcePortNr, GraphNode* sourceNode, bool sourceIsInputPort, AZ::u16 targetPortNr, GraphNode* targetNode, bool targetIsInputPort, const QPoint& startOffset, const QPoint& endOffset);
|
||||
virtual void OnNodeCollapsed(GraphNode* node, bool isCollapsed) { MCORE_UNUSED(node); MCORE_UNUSED(isCollapsed); }
|
||||
virtual void OnShiftClickedNode(GraphNode* node) { MCORE_UNUSED(node); }
|
||||
virtual void OnVisualizeToggle(GraphNode* node, bool visualizeEnabled) { MCORE_UNUSED(node); MCORE_UNUSED(visualizeEnabled); }
|
||||
|
||||
+32
-37
@@ -12,6 +12,7 @@
|
||||
#include <AzQtComponents/Components/FilteredSearchWidget.h>
|
||||
#include <AzQtComponents/Components/Widgets/ColorLabel.h>
|
||||
#include <AzQtComponents/Components/Widgets/CheckBox.h>
|
||||
#include "MCore/Source/Config.h"
|
||||
#include "NodeGroupWindow.h"
|
||||
#include "AnimGraphPlugin.h"
|
||||
#include "GraphNode.h"
|
||||
@@ -111,8 +112,8 @@ namespace EMStudio
|
||||
else
|
||||
{
|
||||
// find duplicate name in the anim graph other than this node group
|
||||
const uint32 numNodeGroups = mAnimGraph->GetNumNodeGroups();
|
||||
for (uint32 i = 0; i < numNodeGroups; ++i)
|
||||
const size_t numNodeGroups = mAnimGraph->GetNumNodeGroups();
|
||||
for (size_t i = 0; i < numNodeGroups; ++i)
|
||||
{
|
||||
EMotionFX::AnimGraphNodeGroup* nodeGroup = mAnimGraph->GetNodeGroup(i);
|
||||
if (nodeGroup->GetNameString() == convertedNewName)
|
||||
@@ -285,13 +286,13 @@ namespace EMStudio
|
||||
const QList<QTableWidgetItem*> selectedItems = mTableWidget->selectedItems();
|
||||
|
||||
// get the number of selected items
|
||||
const uint32 numSelectedItems = selectedItems.count();
|
||||
const int numSelectedItems = selectedItems.count();
|
||||
|
||||
// filter the items
|
||||
selectedNodeGroups.reserve(numSelectedItems);
|
||||
for (uint32 i = 0; i < numSelectedItems; ++i)
|
||||
for (int i = 0; i < numSelectedItems; ++i)
|
||||
{
|
||||
const uint32 rowIndex = selectedItems[i]->row();
|
||||
const int rowIndex = selectedItems[i]->row();
|
||||
const AZStd::string nodeGroupName = FromQtString(mTableWidget->item(rowIndex, 2)->text());
|
||||
if (AZStd::find(begin(selectedNodeGroups), end(selectedNodeGroups), nodeGroupName) == end(selectedNodeGroups))
|
||||
{
|
||||
@@ -315,7 +316,7 @@ namespace EMStudio
|
||||
mTableWidget->blockSignals(true);
|
||||
|
||||
// get the number of node groups
|
||||
const uint32 numNodeGroups = animGraph->GetNumNodeGroups();
|
||||
const int numNodeGroups = aznumeric_caster(animGraph->GetNumNodeGroups());
|
||||
|
||||
// set table size and add header items
|
||||
mTableWidget->setRowCount(numNodeGroups);
|
||||
@@ -324,7 +325,7 @@ namespace EMStudio
|
||||
mTableWidget->setSortingEnabled(false);
|
||||
|
||||
// add each node group
|
||||
for (uint32 i = 0; i < numNodeGroups; ++i)
|
||||
for (int i = 0; i < numNodeGroups; ++i)
|
||||
{
|
||||
// get a pointer to the node group
|
||||
EMotionFX::AnimGraphNodeGroup* nodeGroup = animGraph->GetNodeGroup(i);
|
||||
@@ -452,19 +453,13 @@ namespace EMStudio
|
||||
|
||||
|
||||
// find the index for the given widget
|
||||
uint32 NodeGroupWindow::FindGroupIndexByWidget(QObject* widget) const
|
||||
int NodeGroupWindow::FindGroupIndexByWidget(QObject* widget) const
|
||||
{
|
||||
// for all table entries
|
||||
const uint32 numWidgets = mWidgetTable.size();
|
||||
for (uint32 i = 0; i < numWidgets; ++i)
|
||||
const auto foundGroup = AZStd::find_if(begin(mWidgetTable), end(mWidgetTable), [widget](const auto& tableEntry)
|
||||
{
|
||||
if (mWidgetTable[i].mWidget == widget) // this is button we search for
|
||||
{
|
||||
return mWidgetTable[i].mGroupIndex;
|
||||
}
|
||||
}
|
||||
|
||||
return MCORE_INVALIDINDEX32;
|
||||
return tableEntry.mWidget == widget;
|
||||
});
|
||||
return foundGroup != end(mWidgetTable) ? foundGroup->mGroupIndex : MCore::InvalidIndexT<int>;
|
||||
}
|
||||
|
||||
|
||||
@@ -478,8 +473,8 @@ namespace EMStudio
|
||||
}
|
||||
|
||||
// get the node group index by checking the widget lookup table
|
||||
const uint32 groupIndex = row;
|
||||
assert(groupIndex != MCORE_INVALIDINDEX32);
|
||||
const int groupIndex = row;
|
||||
assert(groupIndex != MCore::InvalidIndexT<int>);
|
||||
|
||||
// get a pointer to the node group
|
||||
EMotionFX::AnimGraphNodeGroup* nodeGroup = animGraph->GetNodeGroup(groupIndex);
|
||||
@@ -516,8 +511,8 @@ namespace EMStudio
|
||||
}
|
||||
|
||||
// get the node group index by checking the widget lookup table
|
||||
const uint32 groupIndex = FindGroupIndexByWidget(sender());
|
||||
assert(groupIndex != MCORE_INVALIDINDEX32);
|
||||
const int groupIndex = FindGroupIndexByWidget(sender());
|
||||
assert(groupIndex != MCore::InvalidIndexT<int>);
|
||||
|
||||
// get a pointer to the node group
|
||||
EMotionFX::AnimGraphNodeGroup* nodeGroup = animGraph->GetNodeGroup(groupIndex);
|
||||
@@ -574,18 +569,18 @@ namespace EMStudio
|
||||
const QList<QTableWidgetItem*> selectedItems = mTableWidget->selectedItems();
|
||||
|
||||
// get the number of selected items
|
||||
const uint32 numSelectedItems = selectedItems.count();
|
||||
if (numSelectedItems == 0)
|
||||
const int numSelectedItems = selectedItems.count();
|
||||
if (selectedItems.empty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// filter the items
|
||||
AZStd::vector<uint32> rowIndices;
|
||||
AZStd::vector<int> rowIndices;
|
||||
rowIndices.reserve(numSelectedItems);
|
||||
for (uint32 i = 0; i < numSelectedItems; ++i)
|
||||
for (int i = 0; i < numSelectedItems; ++i)
|
||||
{
|
||||
const uint32 rowIndex = selectedItems[i]->row();
|
||||
const int rowIndex = selectedItems[i]->row();
|
||||
if (AZStd::find(begin(rowIndices), end(rowIndices), rowIndex) == end(rowIndices))
|
||||
{
|
||||
rowIndices.emplace_back(rowIndex);
|
||||
@@ -597,7 +592,7 @@ namespace EMStudio
|
||||
AZStd::sort(begin(rowIndices), end(rowIndices));
|
||||
|
||||
// get the number of selected rows
|
||||
const uint32 numRowIndices = rowIndices.size();
|
||||
const size_t numRowIndices = rowIndices.size();
|
||||
|
||||
// set the command group name
|
||||
AZStd::string commandGroupName;
|
||||
@@ -607,7 +602,7 @@ namespace EMStudio
|
||||
}
|
||||
else
|
||||
{
|
||||
commandGroupName = AZStd::string::format("Remove %d node groups", numRowIndices);
|
||||
commandGroupName = AZStd::string::format("Remove %zu node groups", numRowIndices);
|
||||
}
|
||||
|
||||
// create the command group
|
||||
@@ -615,7 +610,7 @@ namespace EMStudio
|
||||
|
||||
// Add each command
|
||||
AZStd::string tempString;
|
||||
for (uint32 i = 0; i < numRowIndices; ++i)
|
||||
for (size_t i = 0; i < numRowIndices; ++i)
|
||||
{
|
||||
const AZStd::string nodeGroupName = FromQtString(mTableWidget->item(rowIndices[i], 2)->text());
|
||||
if (i == 0 || i == numRowIndices - 1)
|
||||
@@ -636,7 +631,7 @@ namespace EMStudio
|
||||
}
|
||||
|
||||
// selected the next row
|
||||
if (rowIndices[0] > ((uint32)mTableWidget->rowCount() - 1))
|
||||
if (rowIndices[0] > (mTableWidget->rowCount() - 1))
|
||||
{
|
||||
mTableWidget->selectRow(rowIndices[0] - 1);
|
||||
}
|
||||
@@ -723,18 +718,18 @@ namespace EMStudio
|
||||
const QList<QTableWidgetItem*> selectedItems = mTableWidget->selectedItems();
|
||||
|
||||
// get the number of selected items
|
||||
const uint32 numSelectedItems = selectedItems.count();
|
||||
if (numSelectedItems == 0)
|
||||
const int numSelectedItems = selectedItems.count();
|
||||
if (selectedItems.empty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// filter the items
|
||||
AZStd::vector<uint32> rowIndices;
|
||||
AZStd::vector<int> rowIndices;
|
||||
rowIndices.reserve(numSelectedItems);
|
||||
for (uint32 i = 0; i < numSelectedItems; ++i)
|
||||
for (int i = 0; i < numSelectedItems; ++i)
|
||||
{
|
||||
const uint32 rowIndex = selectedItems[i]->row();
|
||||
const int rowIndex = selectedItems[i]->row();
|
||||
if (AZStd::find(begin(rowIndices), end(rowIndices), rowIndex) == end(rowIndices))
|
||||
{
|
||||
rowIndices.emplace_back(rowIndex);
|
||||
@@ -752,7 +747,7 @@ namespace EMStudio
|
||||
}
|
||||
|
||||
// at least one selected, remove action is possible
|
||||
if (rowIndices.size() > 0)
|
||||
if (!rowIndices.empty())
|
||||
{
|
||||
menu.addSeparator();
|
||||
QAction* removeAction = menu.addAction("Remove Selected Node Groups");
|
||||
|
||||
+2
-2
@@ -91,7 +91,7 @@ namespace EMStudio
|
||||
|
||||
void contextMenuEvent(QContextMenuEvent* event) override;
|
||||
|
||||
uint32 FindGroupIndexByWidget(QObject* widget) const;
|
||||
int FindGroupIndexByWidget(QObject* widget) const;
|
||||
//bool ValidateName(EMotionFX::AnimGraphNodeGroup* nodeGroup, const char* newName) const;
|
||||
|
||||
MCORE_DEFINECOMMANDCALLBACK(CommandAnimGraphAddNodeGroupCallback);
|
||||
@@ -105,7 +105,7 @@ namespace EMStudio
|
||||
struct WidgetLookup
|
||||
{
|
||||
QObject* mWidget;
|
||||
uint32 mGroupIndex;
|
||||
int mGroupIndex;
|
||||
};
|
||||
|
||||
AnimGraphPlugin* mPlugin;
|
||||
|
||||
+8
-8
@@ -865,14 +865,14 @@ namespace EMStudio
|
||||
AZStd::vector<MCore::Attribute*> result;
|
||||
|
||||
const CommandSystem::SelectionList& selectionList = GetCommandManager()->GetCurrentSelection();
|
||||
const uint32 numActorInstances = selectionList.GetNumSelectedActorInstances();
|
||||
for (uint32 i = 0; i < numActorInstances; ++i)
|
||||
const size_t numActorInstances = selectionList.GetNumSelectedActorInstances();
|
||||
for (size_t i = 0; i < numActorInstances; ++i)
|
||||
{
|
||||
const EMotionFX::ActorInstance* actorInstance = selectionList.GetActorInstance(i);
|
||||
const EMotionFX::AnimGraphInstance* animGraphInstance = actorInstance->GetAnimGraphInstance();
|
||||
if (animGraphInstance && animGraphInstance->GetAnimGraph() == m_animGraph)
|
||||
{
|
||||
result.emplace_back(animGraphInstance->GetParameterValue(static_cast<uint32>(parameterIndex)));
|
||||
result.emplace_back(animGraphInstance->GetParameterValue(parameterIndex));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -930,7 +930,7 @@ namespace EMStudio
|
||||
// Construct the create parameter command and add it to the command group.
|
||||
const AZStd::unique_ptr<EMotionFX::Parameter>& parameter = createEditParameterDialog->GetParameter();
|
||||
|
||||
CommandSystem::ConstructCreateParameterCommand(commandString, m_animGraph, parameter.get(), MCORE_INVALIDINDEX32);
|
||||
CommandSystem::ConstructCreateParameterCommand(commandString, m_animGraph, parameter.get());
|
||||
commandGroup.AddCommandString(commandString);
|
||||
|
||||
const EMotionFX::GroupParameter* parentGroup = nullptr;
|
||||
@@ -1033,7 +1033,7 @@ namespace EMStudio
|
||||
{
|
||||
// Get the list of connections from the port whose type is
|
||||
// being changed
|
||||
const uint32 sourcePortIndex = parameterNode->FindOutputPortIndex(parameter->GetName().c_str());
|
||||
const size_t sourcePortIndex = parameterNode->FindOutputPortIndex(parameter->GetName().c_str());
|
||||
|
||||
AZStd::vector<AZStd::pair<EMotionFX::BlendTreeConnection*, EMotionFX::AnimGraphNode*>> outgoingConnectionsFromThisPort;
|
||||
parameterNode->CollectOutgoingConnections(outgoingConnectionsFromThisPort, sourcePortIndex);
|
||||
@@ -1167,8 +1167,8 @@ namespace EMStudio
|
||||
}
|
||||
const EMotionFX::GroupParameterVector groupParameters = m_animGraph->RecursivelyGetGroupParameters();
|
||||
const size_t logNumGroups = groupParameters.size();
|
||||
MCore::LogInfo("Group parameters: (%i)", logNumGroups);
|
||||
for (uint32 g = 0; g < logNumGroups; ++g)
|
||||
MCore::LogInfo("Group parameters: (%zu)", logNumGroups);
|
||||
for (size_t g = 0; g < logNumGroups; ++g)
|
||||
{
|
||||
const EMotionFX::GroupParameter* groupParam = groupParameters[g];
|
||||
MCore::LogInfo("Group parameter #%i: Name='%s'", g, groupParam->GetName().c_str());
|
||||
@@ -1426,7 +1426,7 @@ namespace EMStudio
|
||||
const AZ::Outcome<size_t> valueParameterIndex = m_animGraph->FindValueParameterIndex(valueParameter);
|
||||
if (valueParameterIndex.IsSuccess())
|
||||
{
|
||||
MCore::Attribute* instanceValue = animGraphInstance->GetParameterValue(static_cast<uint32>(valueParameterIndex.GetValue()));
|
||||
MCore::Attribute* instanceValue = animGraphInstance->GetParameterValue(valueParameterIndex.GetValue());
|
||||
valueParameter->SetDefaultValueFromAttribute(instanceValue);
|
||||
|
||||
m_animGraph->SetDirtyFlag(true);
|
||||
|
||||
+3
-3
@@ -98,9 +98,9 @@ namespace EMStudio
|
||||
const EMotionFX::AnimGraph* animGraph = m_stateMachine->GetAnimGraph();
|
||||
|
||||
// get the number of nodes inside the active node, the number node groups and set table size and add header items
|
||||
const uint32 numNodeGroups = animGraph->GetNumNodeGroups();
|
||||
const uint32 numNodes = m_stateMachine->GetNumChildNodes();
|
||||
const uint32 numRows = numNodeGroups + numNodes;
|
||||
const size_t numNodeGroups = animGraph->GetNumNodeGroups();
|
||||
const size_t numNodes = m_stateMachine->GetNumChildNodes();
|
||||
const int numRows = aznumeric_caster(numNodeGroups + numNodes);
|
||||
mTableWidget->setRowCount(numRows);
|
||||
|
||||
// Block signals for the table widget to not reach OnSelectionChanged() when adding rows as that
|
||||
|
||||
+2
-2
@@ -830,13 +830,13 @@ namespace EMStudio
|
||||
return MCore::Max<uint32>(headerWidth, 100);
|
||||
}
|
||||
|
||||
QRect StateGraphNode::CalcInputPortRect(uint32 portNr)
|
||||
QRect StateGraphNode::CalcInputPortRect(AZ::u16 portNr)
|
||||
{
|
||||
MCORE_UNUSED(portNr);
|
||||
return mRect.adjusted(10, 10, -10, -10);
|
||||
}
|
||||
|
||||
QRect StateGraphNode::CalcOutputPortRect(uint32 portNr)
|
||||
QRect StateGraphNode::CalcOutputPortRect(AZ::u16 portNr)
|
||||
{
|
||||
switch (portNr)
|
||||
{
|
||||
|
||||
+3
-3
@@ -54,7 +54,7 @@ namespace EMStudio
|
||||
bool CheckIfIsCloseToHead(const QPoint& point) const override;
|
||||
bool CheckIfIsCloseToTail(const QPoint& point) const override;
|
||||
|
||||
uint32 GetType() override { return TYPE_ID; }
|
||||
uint32 GetType() const override { return TYPE_ID; }
|
||||
|
||||
EMotionFX::AnimGraphTransitionCondition* FindCondition(const QPoint& mousePos);
|
||||
|
||||
@@ -98,8 +98,8 @@ namespace EMStudio
|
||||
int32 CalcRequiredHeight() const override;
|
||||
int32 CalcRequiredWidth() override;
|
||||
|
||||
QRect CalcInputPortRect(uint32 portNr) override;
|
||||
QRect CalcOutputPortRect(uint32 portNr) override;
|
||||
QRect CalcInputPortRect(AZ::u16 portNr) override;
|
||||
QRect CalcOutputPortRect(AZ::u16 portNr) override;
|
||||
|
||||
void UpdateTextPixmap() override;
|
||||
|
||||
|
||||
+17
-18
@@ -9,6 +9,7 @@
|
||||
// inlude required headers
|
||||
#include "AttachmentNodesWindow.h"
|
||||
#include "../../../../EMStudioSDK/Source/EMStudioManager.h"
|
||||
#include "AzCore/std/limits.h"
|
||||
#include <MCore/Source/LogManager.h>
|
||||
#include <MCore/Source/StringConversions.h>
|
||||
|
||||
@@ -144,11 +145,11 @@ namespace EMStudio
|
||||
mRemoveNodesButton->setEnabled((mNodeTable->rowCount() != 0) && (mNodeTable->selectedItems().size() != 0));
|
||||
|
||||
// counter for attachment nodes
|
||||
size_t numAttachmentNodes = 0;
|
||||
int numAttachmentNodes = 0;
|
||||
|
||||
// set the row count
|
||||
const size_t numNodes = mActor->GetNumNodes();
|
||||
for (size_t i = 0; i < numNodes; ++i)
|
||||
const int numNodes = aznumeric_caster(mActor->GetNumNodes());
|
||||
for (int i = 0; i < numNodes; ++i)
|
||||
{
|
||||
// get the nodegroup
|
||||
EMotionFX::Node* node = mActor->GetSkeleton()->GetNode(i);
|
||||
@@ -162,7 +163,7 @@ namespace EMStudio
|
||||
mNodeTable->setRowCount(numAttachmentNodes);
|
||||
|
||||
// set header items for the table
|
||||
QTableWidgetItem* nameHeaderItem = new QTableWidgetItem(AZStd::string::format("Attachment Nodes (%zu / %zu)", numAttachmentNodes, mActor->GetNumNodes()).c_str());
|
||||
QTableWidgetItem* nameHeaderItem = new QTableWidgetItem(AZStd::string::format("Attachment Nodes (%d / %zu)", numAttachmentNodes, mActor->GetNumNodes()).c_str());
|
||||
nameHeaderItem->setTextAlignment(Qt::AlignVCenter | Qt::AlignCenter);
|
||||
mNodeTable->setHorizontalHeaderItem(0, nameHeaderItem);
|
||||
|
||||
@@ -250,8 +251,8 @@ namespace EMStudio
|
||||
mNodeSelectionList.Clear();
|
||||
if (senderWidget == mSelectNodesButton)
|
||||
{
|
||||
const uint32 numNodes = mActor->GetNumNodes();
|
||||
for (uint32 i = 0; i < numNodes; ++i)
|
||||
const size_t numNodes = mActor->GetNumNodes();
|
||||
for (size_t i = 0; i < numNodes; ++i)
|
||||
{
|
||||
EMotionFX::Node* node = mActor->GetSkeleton()->GetNode(i);
|
||||
if (node->GetIsAttachmentNode())
|
||||
@@ -272,9 +273,9 @@ namespace EMStudio
|
||||
{
|
||||
// generate node list string
|
||||
AZStd::string nodeList;
|
||||
uint32 lowestSelectedRow = MCORE_INVALIDINDEX32;
|
||||
const uint32 numTableRows = mNodeTable->rowCount();
|
||||
for (uint32 i = 0; i < numTableRows; ++i)
|
||||
int lowestSelectedRow = AZStd::numeric_limits<int>::max();
|
||||
const int numTableRows = mNodeTable->rowCount();
|
||||
for (int i = 0; i < numTableRows; ++i)
|
||||
{
|
||||
// get the current table item
|
||||
QTableWidgetItem* item = mNodeTable->item(i, 0);
|
||||
@@ -287,9 +288,9 @@ namespace EMStudio
|
||||
if (item->isSelected())
|
||||
{
|
||||
nodeList += AZStd::string::format("%s;", FromQtString(item->text()).c_str());
|
||||
if ((uint32)item->row() < lowestSelectedRow)
|
||||
if (item->row() < lowestSelectedRow)
|
||||
{
|
||||
lowestSelectedRow = (uint32)item->row();
|
||||
lowestSelectedRow = item->row();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -310,7 +311,7 @@ namespace EMStudio
|
||||
}
|
||||
|
||||
// selected the next row
|
||||
if (lowestSelectedRow > ((uint32)mNodeTable->rowCount() - 1))
|
||||
if (lowestSelectedRow > mNodeTable->rowCount() - 1)
|
||||
{
|
||||
mNodeTable->selectRow(lowestSelectedRow - 1);
|
||||
}
|
||||
@@ -324,8 +325,7 @@ namespace EMStudio
|
||||
// add / select nodes
|
||||
void AttachmentNodesWindow::NodeSelectionFinished(AZStd::vector<SelectionItem> selectionList)
|
||||
{
|
||||
// return if no nodes are selected
|
||||
if (selectionList.size() == 0)
|
||||
if (selectionList.empty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -333,10 +333,9 @@ namespace EMStudio
|
||||
// generate node list string
|
||||
AZStd::string nodeList;
|
||||
nodeList.reserve(16384);
|
||||
const uint32 numSelectedNodes = selectionList.size();
|
||||
for (uint32 i = 0; i < numSelectedNodes; ++i)
|
||||
for (const SelectionItem& i : selectionList)
|
||||
{
|
||||
nodeList += AZStd::string::format("%s;", selectionList[i].GetNodeName());
|
||||
nodeList += AZStd::string::format("%s;", i.GetNodeName());
|
||||
}
|
||||
AzFramework::StringFunc::Strip(nodeList, MCore::CharacterConstants::semiColon, true /* case sensitive */, false /* beginning */, true /* ending */);
|
||||
|
||||
@@ -364,7 +363,7 @@ namespace EMStudio
|
||||
// handle item selection changes of the node table
|
||||
void AttachmentNodesWindow::OnItemSelectionChanged()
|
||||
{
|
||||
mRemoveNodesButton->setEnabled((mNodeTable->rowCount() != 0) && (mNodeTable->selectedItems().size() != 0));
|
||||
mRemoveNodesButton->setEnabled((mNodeTable->rowCount() != 0) && (!mNodeTable->selectedItems().empty()));
|
||||
}
|
||||
|
||||
|
||||
|
||||
+6
-6
@@ -72,8 +72,8 @@ namespace EMStudio
|
||||
mHierarchy->clear();
|
||||
|
||||
// get the number of actor instances and iterate through them
|
||||
const uint32 numActorInstances = EMotionFX::GetActorManager().GetNumActorInstances();
|
||||
for (uint32 i = 0; i < numActorInstances; ++i)
|
||||
const size_t numActorInstances = EMotionFX::GetActorManager().GetNumActorInstances();
|
||||
for (size_t i = 0; i < numActorInstances; ++i)
|
||||
{
|
||||
EMotionFX::ActorInstance* actorInstance = EMotionFX::GetActorManager().GetActorInstance(i);
|
||||
|
||||
@@ -96,8 +96,8 @@ namespace EMStudio
|
||||
mHierarchy->addTopLevelItem(item);
|
||||
|
||||
// get the number of attachments and iterate through them
|
||||
const uint32 numAttachments = actorInstance->GetNumAttachments();
|
||||
for (uint32 j = 0; j < numAttachments; ++j)
|
||||
const size_t numAttachments = actorInstance->GetNumAttachments();
|
||||
for (size_t j = 0; j < numAttachments; ++j)
|
||||
{
|
||||
EMotionFX::Attachment* attachment = actorInstance->GetAttachment(j);
|
||||
MCORE_ASSERT(actorInstance == attachment->GetAttachToActorInstance());
|
||||
@@ -124,8 +124,8 @@ namespace EMStudio
|
||||
parent->addChild(item);
|
||||
|
||||
// get the number of attachments and iterate through them
|
||||
const uint32 numAttachments = actorInstance->GetNumAttachments();
|
||||
for (uint32 i = 0; i < numAttachments; ++i)
|
||||
const size_t numAttachments = actorInstance->GetNumAttachments();
|
||||
for (size_t i = 0; i < numAttachments; ++i)
|
||||
{
|
||||
EMotionFX::Attachment* attachment = actorInstance->GetAttachment(i);
|
||||
MCORE_ASSERT(actorInstance == attachment->GetAttachToActorInstance());
|
||||
|
||||
+26
-34
@@ -8,6 +8,8 @@
|
||||
|
||||
// include required headers
|
||||
#include "AttachmentsWindow.h"
|
||||
#include "AzCore/std/limits.h"
|
||||
#include "MCore/Source/Config.h"
|
||||
#include <AzFramework/API/ApplicationAPI.h>
|
||||
#include <EMotionFX/Source/ActorManager.h>
|
||||
#include <EMotionFX/Source/AttachmentNode.h>
|
||||
@@ -236,13 +238,13 @@ namespace EMStudio
|
||||
}
|
||||
|
||||
// the number of existing attachments
|
||||
const uint32 numAttachments = mActorInstance->GetNumAttachments();
|
||||
const int numAttachments = aznumeric_caster(mActorInstance->GetNumAttachments());
|
||||
|
||||
// set table size and add header items
|
||||
mTableWidget->setRowCount(numAttachments);
|
||||
|
||||
// loop trough all attachments and add them to the table
|
||||
for (uint32 i = 0; i < numAttachments; ++i)
|
||||
for (int i = 0; i < numAttachments; ++i)
|
||||
{
|
||||
EMotionFX::Attachment* attachment = mActorInstance->GetAttachment(i);
|
||||
if (attachment == nullptr)
|
||||
@@ -253,18 +255,11 @@ namespace EMStudio
|
||||
EMotionFX::ActorInstance* attachmentInstance = attachment->GetAttachmentActorInstance();
|
||||
EMotionFX::Actor* attachmentActor = attachmentInstance->GetActor();
|
||||
EMotionFX::Actor* attachedToActor = mActorInstance->GetActor();
|
||||
uint32 attachedToNodeIndex = MCORE_INVALIDINDEX32;
|
||||
EMotionFX::Node* attachedToNode = nullptr;
|
||||
|
||||
if (!attachment->GetIsInfluencedByMultipleJoints())
|
||||
{
|
||||
attachedToNodeIndex = static_cast<EMotionFX::AttachmentNode*>(attachment)->GetAttachToNodeIndex();
|
||||
}
|
||||
|
||||
if (attachedToNodeIndex != MCORE_INVALIDINDEX32)
|
||||
{
|
||||
attachedToNode = attachedToActor->GetSkeleton()->GetNode(attachedToNodeIndex);
|
||||
}
|
||||
EMotionFX::Node* attachedToNode =
|
||||
!attachment->GetIsInfluencedByMultipleJoints()
|
||||
? attachedToNode = attachedToActor->GetSkeleton()->GetNode(
|
||||
static_cast<EMotionFX::AttachmentNode*>(attachment)->GetAttachToNodeIndex())
|
||||
: nullptr;
|
||||
|
||||
// create table items
|
||||
mTempString = AZStd::string::format("%i", attachmentInstance->GetID());
|
||||
@@ -436,10 +431,10 @@ namespace EMStudio
|
||||
{
|
||||
EBUS_EVENT(AzFramework::ApplicationRequests::Bus, NormalizePathKeepCase, filename);
|
||||
|
||||
const uint32 actorIndex = EMotionFX::GetActorManager().FindActorIndexByFileName(filename.c_str());
|
||||
const size_t actorIndex = EMotionFX::GetActorManager().FindActorIndexByFileName(filename.c_str());
|
||||
|
||||
// create instance for the attachment
|
||||
if (actorIndex == MCORE_INVALIDINDEX32)
|
||||
if (actorIndex == InvalidIndex)
|
||||
{
|
||||
commandGroup.AddCommandString(AZStd::string::format("ImportActor -filename \"%s\"", filename.c_str()).c_str());
|
||||
commandGroup.AddCommandString("CreateActorInstance -actorID %LASTRESULT%");
|
||||
@@ -479,20 +474,18 @@ namespace EMStudio
|
||||
MCore::CommandGroup group(AZStd::string("Remove Attachment Actor").c_str());
|
||||
|
||||
// iterate trough all selected items
|
||||
const uint32 numItems = items.length();
|
||||
for (uint32 i = 0; i < numItems; ++i)
|
||||
for (const QTableWidgetItem* item : items)
|
||||
{
|
||||
QTableWidgetItem* item = items[i];
|
||||
if (item == nullptr || item->column() != 1)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// the attachment id
|
||||
const uint32 id = GetIDFromTableRow(item->row());
|
||||
const int id = GetIDFromTableRow(item->row());
|
||||
const AZStd::string nodeName = GetNodeNameFromTableRow(item->row());
|
||||
|
||||
group.AddCommandString(AZStd::string::format("RemoveAttachment -attachmentID %i -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, mActorInstance->GetID(), nodeName.c_str()).c_str());
|
||||
}
|
||||
|
||||
// execute the group command
|
||||
@@ -708,20 +701,19 @@ namespace EMStudio
|
||||
// remove selected attachments
|
||||
void AttachmentsWindow::OnRemoveButtonClicked()
|
||||
{
|
||||
uint32 lowestSelectedRow = MCORE_INVALIDINDEX32;
|
||||
int lowestSelectedRow = AZStd::numeric_limits<int>::max();
|
||||
const QList<QTableWidgetItem*> selectedItems = mTableWidget->selectedItems();
|
||||
const int numSelectedItems = selectedItems.size();
|
||||
for (int i = 0; i < numSelectedItems; ++i)
|
||||
for (const QTableWidgetItem* selectedItem : selectedItems)
|
||||
{
|
||||
if ((uint32)selectedItems[i]->row() < lowestSelectedRow)
|
||||
if (selectedItem->row() < lowestSelectedRow)
|
||||
{
|
||||
lowestSelectedRow = (uint32)selectedItems[i]->row();
|
||||
lowestSelectedRow = selectedItem->row();
|
||||
}
|
||||
}
|
||||
|
||||
RemoveTableItems(selectedItems);
|
||||
|
||||
if (lowestSelectedRow > ((uint32)mTableWidget->rowCount() - 1))
|
||||
if (lowestSelectedRow > (mTableWidget->rowCount() - 1))
|
||||
{
|
||||
mTableWidget->selectRow(lowestSelectedRow - 1);
|
||||
}
|
||||
@@ -808,7 +800,7 @@ namespace EMStudio
|
||||
AZStd::string AttachmentsWindow::GetSelectedNodeName()
|
||||
{
|
||||
const QList<QTableWidgetItem*> items = mTableWidget->selectedItems();
|
||||
const uint32 numItems = items.length();
|
||||
const size_t numItems = items.length();
|
||||
if (numItems < 1)
|
||||
{
|
||||
return AZStd::string();
|
||||
@@ -845,7 +837,7 @@ namespace EMStudio
|
||||
QTableWidgetItem* item = mTableWidget->item(row, 1);
|
||||
if (item == nullptr)
|
||||
{
|
||||
return MCORE_INVALIDINDEX32;
|
||||
return MCore::InvalidIndexT<int>;
|
||||
}
|
||||
|
||||
AZStd::string id;
|
||||
@@ -861,7 +853,7 @@ namespace EMStudio
|
||||
QTableWidgetItem* item = mTableWidget->item(row, 4);
|
||||
if (item == nullptr)
|
||||
{
|
||||
return AZStd::string();
|
||||
return {};
|
||||
}
|
||||
|
||||
return FromQtString(item->whatsThis());
|
||||
@@ -872,11 +864,11 @@ namespace EMStudio
|
||||
int AttachmentsWindow::GetRowContainingWidget(const QWidget* widget)
|
||||
{
|
||||
// loop trough the table items and search for widget
|
||||
const uint32 numRows = mTableWidget->rowCount();
|
||||
const uint32 numCols = mTableWidget->columnCount();
|
||||
for (uint32 i = 0; i < numRows; ++i)
|
||||
const int numRows = mTableWidget->rowCount();
|
||||
const int numCols = mTableWidget->columnCount();
|
||||
for (int i = 0; i < numRows; ++i)
|
||||
{
|
||||
for (uint32 j = 0; j < numCols; ++j)
|
||||
for (int j = 0; j < numCols; ++j)
|
||||
{
|
||||
if (mTableWidget->cellWidget(i, j) == widget)
|
||||
{
|
||||
|
||||
+9
-9
@@ -281,7 +281,7 @@ namespace EMStudio
|
||||
const QList<QTableWidgetItem*> items = selectedItems();
|
||||
|
||||
// get the number of selected items
|
||||
const uint32 numSelectedItems = items.count();
|
||||
const int numSelectedItems = items.count();
|
||||
|
||||
// check if nothing needed to be copied
|
||||
if (numSelectedItems == 0)
|
||||
@@ -290,11 +290,11 @@ namespace EMStudio
|
||||
}
|
||||
|
||||
// filter the items
|
||||
AZStd::vector<uint32> rowIndices;
|
||||
AZStd::vector<int> rowIndices;
|
||||
rowIndices.reserve(numSelectedItems);
|
||||
for (uint32 i = 0; i < numSelectedItems; ++i)
|
||||
for (int i = 0; i < numSelectedItems; ++i)
|
||||
{
|
||||
const uint32 rowIndex = items[i]->row();
|
||||
const int rowIndex = items[i]->row();
|
||||
if (AZStd::find(begin(rowIndices), end(rowIndices), rowIndex) == end(rowIndices))
|
||||
{
|
||||
rowIndices.emplace_back(rowIndex);
|
||||
@@ -305,12 +305,12 @@ namespace EMStudio
|
||||
AZStd::sort(begin(rowIndices), end(rowIndices));
|
||||
|
||||
// get the number of selected rows
|
||||
const uint32 numSelectedRows = rowIndices.size();
|
||||
const size_t numSelectedRows = rowIndices.size();
|
||||
|
||||
// genereate the clipboard text
|
||||
QString clipboardText;
|
||||
const uint32 lastIndex = numSelectedRows - 1;
|
||||
for (uint32 i = 0; i < numSelectedRows; ++i)
|
||||
const size_t lastIndex = numSelectedRows - 1;
|
||||
for (size_t i = 0; i < numSelectedRows; ++i)
|
||||
{
|
||||
const QString time = item(rowIndices[i], 0)->text();
|
||||
const QString message = item(rowIndices[i], 1)->text();
|
||||
@@ -360,7 +360,7 @@ namespace EMStudio
|
||||
QMenu menu(this);
|
||||
|
||||
// add actions
|
||||
if (items.size() > 0)
|
||||
if (!items.empty())
|
||||
{
|
||||
QAction* copyAction = menu.addAction("Copy");
|
||||
connect(copyAction, &QAction::triggered, this, &LogWindowCallback::Copy);
|
||||
@@ -370,7 +370,7 @@ namespace EMStudio
|
||||
QAction* selectAllAction = menu.addAction("Select All");
|
||||
connect(selectAllAction, &QAction::triggered, this, &LogWindowCallback::SelectAll);
|
||||
}
|
||||
if (items.size() > 0)
|
||||
if (!items.empty())
|
||||
{
|
||||
QAction* UnselectAllAction = menu.addAction("Unselect All");
|
||||
connect(UnselectAllAction, &QAction::triggered, this, &LogWindowCallback::UnselectAll);
|
||||
|
||||
+2
-2
@@ -28,8 +28,8 @@ namespace EMStudio
|
||||
LogWindowPlugin::~LogWindowPlugin()
|
||||
{
|
||||
// remove the callback from the log manager (automatically deletes from memory as well)
|
||||
const uint32 index = MCore::GetLogManager().FindLogCallback(mLogCallback);
|
||||
if (index != MCORE_INVALIDINDEX32)
|
||||
const size_t index = MCore::GetLogManager().FindLogCallback(mLogCallback);
|
||||
if (index != InvalidIndex)
|
||||
{
|
||||
MCore::GetLogManager().RemoveLogCallback(index);
|
||||
}
|
||||
|
||||
+18
-20
@@ -133,7 +133,7 @@ namespace EMStudio
|
||||
|
||||
|
||||
// constructor
|
||||
PhonemeSelectionWindow::PhonemeSelectionWindow(EMotionFX::Actor* actor, uint32 lodLevel, EMotionFX::MorphTarget* morphTarget, QWidget* parent)
|
||||
PhonemeSelectionWindow::PhonemeSelectionWindow(EMotionFX::Actor* actor, size_t lodLevel, EMotionFX::MorphTarget* morphTarget, QWidget* parent)
|
||||
: QDialog(parent)
|
||||
{
|
||||
// set the initial size
|
||||
@@ -327,14 +327,14 @@ namespace EMStudio
|
||||
mSelectedPhonemeSetsTable->clear();
|
||||
|
||||
// get number of morph targets
|
||||
const uint32 numMorphTargets = mMorphSetup->GetNumMorphTargets();
|
||||
const size_t numMorphTargets = mMorphSetup->GetNumMorphTargets();
|
||||
const uint32 numPhonemeSets = mMorphTarget->GetNumAvailablePhonemeSets();
|
||||
uint32 insertPosition = 0;
|
||||
for (uint32 i = 1; i < numPhonemeSets; ++i)
|
||||
int insertPosition = 0;
|
||||
for (int i = 1; i < numPhonemeSets; ++i)
|
||||
{
|
||||
// check if another morph target already has this phoneme set.
|
||||
bool phonemeSetFound = false;
|
||||
for (uint32 j = 0; j < numMorphTargets; ++j)
|
||||
for (size_t j = 0; j < numMorphTargets; ++j)
|
||||
{
|
||||
EMotionFX::MorphTarget* morphTarget = mMorphSetup->GetMorphTarget(j);
|
||||
if (morphTarget->GetIsPhonemeSetEnabled((EMotionFX::MorphTarget::EPhonemeSet)(1 << i)))
|
||||
@@ -381,9 +381,9 @@ namespace EMStudio
|
||||
AzFramework::StringFunc::Tokenize(selectedPhonemeSets.c_str(), splittedPhonemeSets, MCore::CharacterConstants::comma, true /* keep empty strings */, true /* keep space strings */);
|
||||
|
||||
|
||||
const uint32 numSelectedPhonemeSets = static_cast<uint32>(splittedPhonemeSets.size());
|
||||
const int numSelectedPhonemeSets = aznumeric_caster(splittedPhonemeSets.size());
|
||||
mSelectedPhonemeSetsTable->setRowCount(numSelectedPhonemeSets);
|
||||
for (uint32 i = 0; i < numSelectedPhonemeSets; ++i)
|
||||
for (int i = 0; i < numSelectedPhonemeSets; ++i)
|
||||
{
|
||||
// create dummy table widget item.
|
||||
const EMotionFX::MorphTarget::EPhonemeSet phonemeSet = mMorphTarget->FindPhonemeSet(splittedPhonemeSets[i].c_str());
|
||||
@@ -425,7 +425,7 @@ namespace EMStudio
|
||||
QTableWidget* table = (QTableWidget*)sender();
|
||||
|
||||
// disable/enable buttons
|
||||
bool selected = (table->selectedItems().size() > 0);
|
||||
bool selected = !table->selectedItems().empty();
|
||||
if (table == mPossiblePhonemeSetsTable)
|
||||
{
|
||||
mAddPhonemesButton->setDisabled(!selected);
|
||||
@@ -438,8 +438,8 @@ namespace EMStudio
|
||||
}
|
||||
|
||||
// adjust selection state of the cell widgetsmActor
|
||||
const uint32 numRows = table->rowCount();
|
||||
for (uint32 i = 0; i < numRows; ++i)
|
||||
const int numRows = table->rowCount();
|
||||
for (int i = 0; i < numRows; ++i)
|
||||
{
|
||||
// get the table widget item and check if it exists
|
||||
QTableWidgetItem* item = table->item(i, 0);
|
||||
@@ -462,21 +462,20 @@ namespace EMStudio
|
||||
void PhonemeSelectionWindow::RemoveSelectedPhonemeSets()
|
||||
{
|
||||
QList<QTableWidgetItem*> selectedItems = mSelectedPhonemeSetsTable->selectedItems();
|
||||
const uint32 numSelectedItems = selectedItems.size();
|
||||
if (numSelectedItems == 0)
|
||||
if (selectedItems.empty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// create phoneme sets string from the selected phoneme sets
|
||||
AZStd::string phonemeSets;
|
||||
for (uint32 i = 0; i < numSelectedItems; ++i)
|
||||
for (const QTableWidgetItem* selectedItem : selectedItems)
|
||||
{
|
||||
phonemeSets += AZStd::string::format("%s,", selectedItems[i]->text().toUtf8().data());
|
||||
phonemeSets += AZStd::string::format("%s,", selectedItem->text().toUtf8().data());
|
||||
}
|
||||
|
||||
// call command to remove selected the phoneme sets
|
||||
const AZStd::string command = AZStd::string::format("AdjustMorphTarget -actorID %i -lodLevel %i -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\"", mActor->GetID(), mLODLevel, mMorphTarget->GetName(), phonemeSets.c_str());
|
||||
|
||||
AZStd::string result;
|
||||
if (!EMStudio::GetCommandManager()->ExecuteCommand(command, result))
|
||||
@@ -494,21 +493,20 @@ namespace EMStudio
|
||||
void PhonemeSelectionWindow::AddSelectedPhonemeSets()
|
||||
{
|
||||
QList<QTableWidgetItem*> selectedItems = mSelectedPhonemeSetsTable->selectedItems();
|
||||
const uint32 numSelectedItems = selectedItems.size();
|
||||
if (numSelectedItems == 0)
|
||||
if (selectedItems.empty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// create phoneme sets string from the selected phoneme sets
|
||||
AZStd::string phonemeSets;
|
||||
for (uint32 i = 0; i < numSelectedItems; ++i)
|
||||
for (const QTableWidgetItem* selectedItem : selectedItems)
|
||||
{
|
||||
phonemeSets += AZStd::string::format("%s,", selectedItems[i]->text().toUtf8().data());
|
||||
phonemeSets += AZStd::string::format("%s,", selectedItem->text().toUtf8().data());
|
||||
}
|
||||
|
||||
// call command to add the selected phoneme sets
|
||||
const AZStd::string command = AZStd::string::format("AdjustMorphTarget -actorID %i -lodLevel %i -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\"", mActor->GetID(), mLODLevel, mMorphTarget->GetName(), phonemeSets.c_str());
|
||||
|
||||
AZStd::string result;
|
||||
if (!EMStudio::GetCommandManager()->ExecuteCommand(command, result))
|
||||
|
||||
+2
-2
@@ -117,7 +117,7 @@ namespace EMStudio
|
||||
MCORE_MEMORYOBJECTCATEGORY(PhonemeSelectionWindow, MCore::MCORE_DEFAULT_ALIGNMENT, MEMCATEGORY_EMSTUDIOSDK)
|
||||
|
||||
public:
|
||||
PhonemeSelectionWindow(EMotionFX::Actor* actor, uint32 lodLevel, EMotionFX::MorphTarget* morphTarget, QWidget* parent = nullptr);
|
||||
PhonemeSelectionWindow(EMotionFX::Actor* actor, size_t lodLevel, EMotionFX::MorphTarget* morphTarget, QWidget* parent = nullptr);
|
||||
virtual ~PhonemeSelectionWindow();
|
||||
|
||||
void Init();
|
||||
@@ -140,7 +140,7 @@ namespace EMStudio
|
||||
// the morph target
|
||||
EMotionFX::Actor* mActor;
|
||||
EMotionFX::MorphTarget* mMorphTarget;
|
||||
uint32 mLODLevel;
|
||||
size_t mLODLevel;
|
||||
EMotionFX::MorphSetup* mMorphSetup;
|
||||
|
||||
// the dialogstacks
|
||||
|
||||
+46
-53
@@ -6,6 +6,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "AzCore/std/algorithm.h"
|
||||
#include "AzCore/std/iterator.h"
|
||||
#include <AzQtComponents/Components/FilteredSearchWidget.h>
|
||||
#include <EMotionFX/Source/MotionManager.h>
|
||||
#include <EMotionStudio/EMStudioSDK/Source/EMStudioCore.h>
|
||||
@@ -70,11 +72,11 @@ namespace EMStudio
|
||||
tableWidget->verticalHeader()->setVisible(false);
|
||||
|
||||
// set the number of rows
|
||||
const uint32 numMotions = motions.size();
|
||||
const int numMotions = aznumeric_caster(motions.size());
|
||||
tableWidget->setRowCount(numMotions);
|
||||
|
||||
// add each motion in the table
|
||||
for (uint32 i = 0; i < numMotions; ++i)
|
||||
for (int i = 0; i < numMotions; ++i)
|
||||
{
|
||||
// get the motion
|
||||
EMotionFX::Motion* motion = motions[i];
|
||||
@@ -182,8 +184,8 @@ namespace EMStudio
|
||||
else
|
||||
{
|
||||
// find duplicate name in all motion sets other than this motion set
|
||||
const uint32 numMotionSets = EMotionFX::GetMotionManager().GetNumMotionSets();
|
||||
for (uint32 i = 0; i < numMotionSets; ++i)
|
||||
const size_t numMotionSets = EMotionFX::GetMotionManager().GetNumMotionSets();
|
||||
for (size_t i = 0; i < numMotionSets; ++i)
|
||||
{
|
||||
EMotionFX::MotionSet* motionSet = EMotionFX::GetMotionManager().GetMotionSet(i);
|
||||
|
||||
@@ -359,8 +361,8 @@ namespace EMStudio
|
||||
}
|
||||
|
||||
// Recursively add all child sets.
|
||||
const uint32 numChildSets = motionSet->GetNumChildSets();
|
||||
for (uint32 i = 0; i < numChildSets; ++i)
|
||||
const size_t numChildSets = motionSet->GetNumChildSets();
|
||||
for (size_t i = 0; i < numChildSets; ++i)
|
||||
{
|
||||
EMotionFX::MotionSet* childSet = motionSet->GetChildSet(i);
|
||||
RecursivelyAddSets(item, childSet, selectedSetIDs);
|
||||
@@ -372,16 +374,15 @@ namespace EMStudio
|
||||
{
|
||||
// Get the selected items in the motion set tree widget..
|
||||
const QList<QTreeWidgetItem*> selectedItems = mMotionSetsTree->selectedItems();
|
||||
const int numSelectedItems = selectedItems.count();
|
||||
const int numSelectedItems = selectedItems.size();
|
||||
|
||||
// Create and fill an array containing ids of all selected motion sets.
|
||||
AZStd::vector<uint32> selectedMotionSetIDs;
|
||||
selectedMotionSetIDs.resize(numSelectedItems);
|
||||
for (int32 i = 0; i < numSelectedItems; ++i)
|
||||
selectedMotionSetIDs.reserve(numSelectedItems);
|
||||
AZStd::transform(selectedItems.begin(), selectedItems.end(), AZStd::back_inserter(selectedMotionSetIDs), [](const QTreeWidgetItem* selectedItem)
|
||||
{
|
||||
const int motionSetId = AzFramework::StringFunc::ToInt(selectedItems[i]->whatsThis(0).toUtf8().data());
|
||||
selectedMotionSetIDs[i] = motionSetId;
|
||||
}
|
||||
return selectedItem->whatsThis(0).toUInt();
|
||||
});
|
||||
|
||||
// Set the sorting disabled to avoid index issues.
|
||||
mMotionSetsTree->setSortingEnabled(false);
|
||||
@@ -392,8 +393,8 @@ namespace EMStudio
|
||||
|
||||
// Iterate through root motion sets and fill in the table recursively.
|
||||
AZStd::string tempString;
|
||||
const uint32 numMotionSets = EMotionFX::GetMotionManager().GetNumMotionSets();
|
||||
for (uint32 i = 0; i < numMotionSets; ++i)
|
||||
const size_t numMotionSets = EMotionFX::GetMotionManager().GetNumMotionSets();
|
||||
for (size_t i = 0; i < numMotionSets; ++i)
|
||||
{
|
||||
// Only process root motion sets.
|
||||
EMotionFX::MotionSet* motionSet = EMotionFX::GetMotionManager().GetMotionSet(i);
|
||||
@@ -446,8 +447,8 @@ namespace EMStudio
|
||||
}
|
||||
|
||||
// get the number of children and iterate through them
|
||||
const uint32 numChildSets = motionSet->GetNumChildSets();
|
||||
for (uint32 j = 0; j < numChildSets; ++j)
|
||||
const size_t numChildSets = motionSet->GetNumChildSets();
|
||||
for (size_t j = 0; j < numChildSets; ++j)
|
||||
{
|
||||
// get the child set
|
||||
EMotionFX::MotionSet* childSet = motionSet->GetChildSet(j);
|
||||
@@ -468,7 +469,7 @@ namespace EMStudio
|
||||
void MotionSetManagementWindow::OnSelectionChanged()
|
||||
{
|
||||
const QList<QTreeWidgetItem*> selectedItems = mMotionSetsTree->selectedItems();
|
||||
const uint32 numSelected = selectedItems.count();
|
||||
const size_t numSelected = selectedItems.count();
|
||||
if (numSelected != 1)
|
||||
{
|
||||
mPlugin->SetSelectedSet(nullptr);
|
||||
@@ -547,7 +548,7 @@ namespace EMStudio
|
||||
const AZStd::string uniqueMotionSetName = MCore::GenerateUniqueString("MotionSet",
|
||||
[&](const AZStd::string& value)
|
||||
{
|
||||
return (EMotionFX::GetMotionManager().FindMotionSetIndexByName(value.c_str()) == MCORE_INVALIDINDEX32);
|
||||
return (EMotionFX::GetMotionManager().FindMotionSetIndexByName(value.c_str()) == InvalidIndex);
|
||||
});
|
||||
|
||||
// Construct the command string.
|
||||
@@ -585,7 +586,7 @@ namespace EMStudio
|
||||
uniqueMotionSetName = MCore::GenerateUniqueString("MotionSet",
|
||||
[&](const AZStd::string& value)
|
||||
{
|
||||
return (EMotionFX::GetMotionManager().FindMotionSetIndexByName(value.c_str()) == MCORE_INVALIDINDEX32) &&
|
||||
return (EMotionFX::GetMotionManager().FindMotionSetIndexByName(value.c_str()) == InvalidIndex) &&
|
||||
(parentMotionSetByName.find(value) == parentMotionSetByName.end());
|
||||
});
|
||||
|
||||
@@ -649,16 +650,15 @@ namespace EMStudio
|
||||
{
|
||||
// Get the selected items from the motion set tree widget.
|
||||
const QList<QTreeWidgetItem*> selectedItems = mMotionSetsTree->selectedItems();
|
||||
const int numSelectedItems = selectedItems.count();
|
||||
|
||||
outSelectedMotionSets.resize(numSelectedItems);
|
||||
outSelectedMotionSets.resize(selectedItems.size());
|
||||
|
||||
// Find the corresponding motion sets and add them to the array.
|
||||
for (int32 i = 0; i < numSelectedItems; ++i)
|
||||
AZStd::transform(selectedItems.begin(), selectedItems.end(), outSelectedMotionSets.begin(), [](const QTreeWidgetItem* selectedItem)
|
||||
{
|
||||
const int motionSetId = AzFramework::StringFunc::ToInt(selectedItems[i]->whatsThis(0).toUtf8().data());
|
||||
outSelectedMotionSets[i] = EMotionFX::GetMotionManager().FindMotionSetByID(motionSetId);
|
||||
}
|
||||
const uint32 motionSetId = selectedItem->whatsThis(0).toUInt();
|
||||
return EMotionFX::GetMotionManager().FindMotionSetByID(motionSetId);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -681,8 +681,8 @@ namespace EMStudio
|
||||
}
|
||||
|
||||
// Do the same for all child motion sets recursively.
|
||||
const uint32 numChildSets = motionSet->GetNumChildSets();
|
||||
for (uint32 i = 0; i < numChildSets; ++i)
|
||||
const size_t numChildSets = motionSet->GetNumChildSets();
|
||||
for (size_t i = 0; i < numChildSets; ++i)
|
||||
{
|
||||
EMotionFX::MotionSet* childSet = motionSet->GetChildSet(i);
|
||||
RecursiveIncreaseMotionsReferenceCount(childSet);
|
||||
@@ -693,8 +693,8 @@ namespace EMStudio
|
||||
void MotionSetManagementWindow::RecursiveRemoveMotionsFromSet(EMotionFX::MotionSet* motionSet, MCore::CommandGroup& commandGroup, AZStd::vector<EMotionFX::Motion*>& failedRemoveMotions)
|
||||
{
|
||||
// Recursively remove motions from the all entries in the child motion sets.
|
||||
const uint32 numChildSets = motionSet->GetNumChildSets();
|
||||
for (uint32 i = 0; i < numChildSets; ++i)
|
||||
const size_t numChildSets = motionSet->GetNumChildSets();
|
||||
for (size_t i = 0; i < numChildSets; ++i)
|
||||
{
|
||||
EMotionFX::MotionSet* childSet = motionSet->GetChildSet(i);
|
||||
RecursiveRemoveMotionsFromSet(childSet, commandGroup, failedRemoveMotions);
|
||||
@@ -722,22 +722,18 @@ namespace EMStudio
|
||||
void MotionSetManagementWindow::OnRemoveSelectedMotionSets()
|
||||
{
|
||||
const QList<QTreeWidgetItem*> selectedItems = mMotionSetsTree->selectedItems();
|
||||
const uint32 numSelected = selectedItems.count();
|
||||
if (numSelected <= 0)
|
||||
if (selectedItems.empty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// ask to remove motions
|
||||
bool removeMotions;
|
||||
if (QMessageBox::question(this, "Remove Motions From Project?", "Remove the motions from the project entirely? This would also remove them from the motion list. Pressing no will remove them from the motion set but keep them inside the motion list inside the motions window.", QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes) == QMessageBox::Yes)
|
||||
{
|
||||
removeMotions = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
removeMotions = false;
|
||||
}
|
||||
const bool removeMotions = QMessageBox::question(
|
||||
this,
|
||||
"Remove Motions From Project?",
|
||||
"Remove the motions from the project entirely? This would also remove them from the motion list. Pressing no will remove them from the motion set but keep them inside the motion list inside the motions window.",
|
||||
QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes
|
||||
) == QMessageBox::Yes;
|
||||
|
||||
// create our command group
|
||||
MCore::CommandGroup commandGroup("Remove motion sets");
|
||||
@@ -747,10 +743,10 @@ namespace EMStudio
|
||||
|
||||
// get the number of selected motion sets and iterate through them
|
||||
AZStd::set<AZ::u32> toBeRemoved;
|
||||
for (int32 i = numSelected - 1; i >= 0; --i)
|
||||
for (auto selectedItem = selectedItems.crbegin(); selectedItem != selectedItems.crend(); ++selectedItem)
|
||||
{
|
||||
// get the motion set ID
|
||||
const uint32 motionSetID = AzFramework::StringFunc::ToInt(FromQtString(selectedItems[i]->whatsThis(0)).c_str());
|
||||
const uint32 motionSetID = (*selectedItem)->whatsThis(0).toInt();
|
||||
|
||||
// get the current motion set and only process the root sets
|
||||
EMotionFX::MotionSet* motionSet = EMotionFX::GetMotionManager().FindMotionSetByID(motionSetID);
|
||||
@@ -817,8 +813,8 @@ namespace EMStudio
|
||||
|
||||
// Increase the reference counter if needed for each motion.
|
||||
AZStd::string commandString;
|
||||
const uint32 numMotionSets = EMotionFX::GetMotionManager().GetNumMotionSets();
|
||||
for (uint32 i = 0; i < numMotionSets; ++i)
|
||||
const size_t numMotionSets = EMotionFX::GetMotionManager().GetNumMotionSets();
|
||||
for (size_t i = 0; i < numMotionSets; ++i)
|
||||
{
|
||||
EMotionFX::MotionSet* motionSet = EMotionFX::GetMotionManager().GetMotionSet(i);
|
||||
|
||||
@@ -850,7 +846,7 @@ namespace EMStudio
|
||||
if (removeMotions)
|
||||
{
|
||||
AZStd::string motionFileName;
|
||||
for (uint32 i = 0; i < numMotionSets; ++i)
|
||||
for (size_t i = 0; i < numMotionSets; ++i)
|
||||
{
|
||||
EMotionFX::MotionSet* motionSet = EMotionFX::GetMotionManager().GetMotionSet(i);
|
||||
|
||||
@@ -902,7 +898,7 @@ namespace EMStudio
|
||||
rootItem = rootItem->parent();
|
||||
}
|
||||
|
||||
const uint32 motionSetID = AzFramework::StringFunc::ToInt(FromQtString(rootItem->whatsThis(0)).c_str());
|
||||
const uint32 motionSetID = rootItem->whatsThis(0).toUInt();
|
||||
EMotionFX::MotionSet* motionSet = EMotionFX::GetMotionManager().FindMotionSetByID(motionSetID);
|
||||
if (AZStd::find(selectedRootMotionSets.begin(), selectedRootMotionSets.end(), motionSet) == selectedRootMotionSets.end())
|
||||
{
|
||||
@@ -948,7 +944,7 @@ namespace EMStudio
|
||||
}
|
||||
|
||||
// Add the root motion set in the array if not already added.
|
||||
const uint32 motionSetID = AzFramework::StringFunc::ToInt(FromQtString(rootItem->whatsThis(0)).c_str());
|
||||
const uint32 motionSetID = rootItem->whatsThis(0).toUInt();
|
||||
EMotionFX::MotionSet* motionSet = EMotionFX::GetMotionManager().FindMotionSetByID(motionSetID);
|
||||
if (AZStd::find(selectedRootMotionSets.begin(), selectedRootMotionSets.end(), motionSet) == selectedRootMotionSets.end())
|
||||
{
|
||||
@@ -961,12 +957,9 @@ namespace EMStudio
|
||||
commandGroup.SetReturnFalseAfterError(true);
|
||||
|
||||
// Add each command.
|
||||
const size_t numSelectedRootMotionSets = selectedRootMotionSets.size();
|
||||
for (size_t i = 0; i < numSelectedRootMotionSets; ++i)
|
||||
for (const EMotionFX::MotionSet* motionSet : selectedRootMotionSets)
|
||||
{
|
||||
EMotionFX::MotionSet* motionSet = selectedRootMotionSets[i];
|
||||
|
||||
// Show a file dialog in case the motion set hasn't been saved yet.
|
||||
// Show a file dialog in case the motion set hasn't been saved yet.
|
||||
AZStd::string filename = motionSet->GetFilename();
|
||||
if (filename.empty())
|
||||
{
|
||||
@@ -1019,7 +1012,7 @@ namespace EMStudio
|
||||
}
|
||||
|
||||
// Add the root motion set in the array if not already added.
|
||||
const uint32 motionSetID = AzFramework::StringFunc::ToInt(FromQtString(rootItem->whatsThis(0)).c_str());
|
||||
const uint32 motionSetID = rootItem->whatsThis(0).toUInt();
|
||||
EMotionFX::MotionSet* motionSet = EMotionFX::GetMotionManager().FindMotionSetByID(motionSetID);
|
||||
if (AZStd::find(selectedRootMotionSets.begin(), selectedRootMotionSets.end(), motionSet) == selectedRootMotionSets.end())
|
||||
{
|
||||
|
||||
+47
-53
@@ -6,6 +6,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "AzCore/std/algorithm.h"
|
||||
#include "MotionSetsWindowPlugin.h"
|
||||
#include <AzQtComponents/Components/FilteredSearchWidget.h>
|
||||
#include <AzCore/IO/FileIO.h>
|
||||
@@ -328,8 +329,8 @@ namespace EMStudio
|
||||
void MotionSetWindow::ReInit()
|
||||
{
|
||||
EMotionFX::MotionSet* selectedSet = mPlugin->GetSelectedSet();
|
||||
const uint32 selectedSetIndex = EMotionFX::GetMotionManager().FindMotionSetIndex(selectedSet);
|
||||
if (selectedSetIndex != MCORE_INVALIDINDEX32)
|
||||
const size_t selectedSetIndex = EMotionFX::GetMotionManager().FindMotionSetIndex(selectedSet);
|
||||
if (selectedSetIndex != InvalidIndex)
|
||||
{
|
||||
UpdateMotionSetTable(m_tableWidget, mPlugin->GetSelectedSet());
|
||||
}
|
||||
@@ -824,7 +825,7 @@ namespace EMStudio
|
||||
}
|
||||
|
||||
const QList<QTableWidgetItem*> selectedItems = m_tableWidget->selectedItems();
|
||||
const uint32 numSelectedItems = selectedItems.count();
|
||||
const size_t numSelectedItems = selectedItems.count();
|
||||
|
||||
// Get the row indices from the selected items.
|
||||
AZStd::vector<int> rowIndices;
|
||||
@@ -835,7 +836,7 @@ namespace EMStudio
|
||||
m_editAction->setEnabled(hasMotions);
|
||||
|
||||
// Inform the time view plugin about the motion selection change.
|
||||
const bool hasSelectedRows = rowIndices.size() > 0;
|
||||
const bool hasSelectedRows = !rowIndices.empty();
|
||||
if (hasSelectedRows)
|
||||
{
|
||||
QTableWidgetItem* firstSelectedItem = selectedItems[0];
|
||||
@@ -847,8 +848,8 @@ namespace EMStudio
|
||||
{
|
||||
MCore::CommandGroup commandGroup("Select motion");
|
||||
commandGroup.AddCommandString("Unselect -motionIndex SELECT_ALL");
|
||||
const AZ::u32 motionIndex = EMotionFX::GetMotionManager().FindMotionIndexByFileName(motion->GetFileName());
|
||||
commandGroup.AddCommandString(AZStd::string::format("Select -motionIndex %d", motionIndex));
|
||||
const size_t motionIndex = EMotionFX::GetMotionManager().FindMotionIndexByFileName(motion->GetFileName());
|
||||
commandGroup.AddCommandString(AZStd::string::format("Select -motionIndex %zu", motionIndex));
|
||||
|
||||
AZStd::string result;
|
||||
if (!EMStudio::GetCommandManager()->ExecuteCommandGroup(commandGroup, result, false))
|
||||
@@ -913,7 +914,7 @@ namespace EMStudio
|
||||
|
||||
// Build a list of unique string id values from all motion set entries.
|
||||
AZStd::vector<AZStd::string> idStrings;
|
||||
idStrings.reserve(selectedSet->GetNumMotionEntries() + (uint32)numFileNames);
|
||||
idStrings.reserve(selectedSet->GetNumMotionEntries() + numFileNames);
|
||||
selectedSet->BuildIdStringList(idStrings);
|
||||
|
||||
AZStd::string parameterString;
|
||||
@@ -1133,16 +1134,16 @@ namespace EMStudio
|
||||
return;
|
||||
}
|
||||
|
||||
for (uint32 i = 0; i < numRowIndices; ++i)
|
||||
for (const int rowIndex : rowIndices)
|
||||
{
|
||||
QTableWidgetItem* idItem = m_tableWidget->item(rowIndices[i], 1);
|
||||
QTableWidgetItem* idItem = m_tableWidget->item(rowIndex, 1);
|
||||
EMotionFX::MotionSet::MotionEntry* motionEntry = motionSet->FindMotionEntryById(idItem->text().toUtf8().data());
|
||||
|
||||
// Check if the motion exists in multiple motion sets.
|
||||
const AZ::u32 numMotionSets = EMotionFX::GetMotionManager().GetNumMotionSets();
|
||||
AZ::u32 numMotionSetContainsMotion = 0;
|
||||
const size_t numMotionSets = EMotionFX::GetMotionManager().GetNumMotionSets();
|
||||
size_t numMotionSetContainsMotion = 0;
|
||||
|
||||
for (AZ::u32 motionSetId = 0; motionSetId < numMotionSets; motionSetId++)
|
||||
for (size_t motionSetId = 0; motionSetId < numMotionSets; motionSetId++)
|
||||
{
|
||||
EMotionFX::MotionSet* motionSet2 = EMotionFX::GetMotionManager().GetMotionSet(motionSetId);
|
||||
if (motionSet2->FindMotionEntryById(motionEntry->GetId()))
|
||||
@@ -1181,7 +1182,7 @@ namespace EMStudio
|
||||
if (removeMotion && motionEntry->GetMotion())
|
||||
{
|
||||
// Calculcate how many motion sets except than the provided one use the given motion.
|
||||
uint32 numExternalUses = CalcNumMotionEntriesUsingMotionExcluding(motionEntry->GetFilename(), motionSet);
|
||||
size_t numExternalUses = CalcNumMotionEntriesUsingMotionExcluding(motionEntry->GetFilename(), motionSet);
|
||||
|
||||
// Remove the motion in case it was only used by the given motion set.
|
||||
if (numExternalUses == 0)
|
||||
@@ -1199,15 +1200,14 @@ namespace EMStudio
|
||||
|
||||
// Find the lowest row selected.
|
||||
int lowestRowSelected = -1;
|
||||
for (uint32 i = 0; i < numRowIndices; ++i)
|
||||
for (int selectedRowIndex : rowIndices)
|
||||
{
|
||||
if (rowIndices[i] < lowestRowSelected)
|
||||
if (selectedRowIndex < lowestRowSelected)
|
||||
{
|
||||
lowestRowSelected = rowIndices[i];
|
||||
lowestRowSelected = selectedRowIndex;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
MCore::CommandGroup commandGroup("Motion set remove motions");
|
||||
|
||||
// 1. Remove motion entries from the motion set.
|
||||
@@ -1371,7 +1371,7 @@ namespace EMStudio
|
||||
}
|
||||
|
||||
// Calculcate how many motion sets except than the provided one use the given motion.
|
||||
uint32 numExternalUses = CalcNumMotionEntriesUsingMotionExcluding(motionEntry->GetFilename(), motionSet);
|
||||
size_t numExternalUses = CalcNumMotionEntriesUsingMotionExcluding(motionEntry->GetFilename(), motionSet);
|
||||
|
||||
// Remove the motion in case it was only used by the given motion set.
|
||||
if (numExternalUses == 0)
|
||||
@@ -1407,9 +1407,6 @@ namespace EMStudio
|
||||
// get the current selection
|
||||
const QList<QTableWidgetItem*> selectedItems = m_tableWidget->selectedItems();
|
||||
|
||||
// get the number of selected items
|
||||
const uint32 numSelectedItems = selectedItems.count();
|
||||
|
||||
// Get the row indices from the selected items.
|
||||
AZStd::vector<int> rowIndices;
|
||||
GetRowIndices(selectedItems, rowIndices);
|
||||
@@ -1419,12 +1416,11 @@ namespace EMStudio
|
||||
|
||||
// generate the motions IDs array
|
||||
AZStd::vector<AZStd::string> motionIDs;
|
||||
const size_t numSelectedRows = rowIndices.size();
|
||||
if (numSelectedRows > 0)
|
||||
if (!rowIndices.empty())
|
||||
{
|
||||
for (int i = 0; i < numSelectedRows; ++i)
|
||||
for (const int rowIndex : rowIndices)
|
||||
{
|
||||
QTableWidgetItem* item = m_tableWidget->item(rowIndices[i], 1);
|
||||
QTableWidgetItem* item = m_tableWidget->item(rowIndex, 1);
|
||||
motionIDs.push_back(item->text().toUtf8().data());
|
||||
}
|
||||
}
|
||||
@@ -1556,8 +1552,7 @@ namespace EMStudio
|
||||
const QList<QTableWidgetItem*> selectedItems = m_tableWidget->selectedItems();
|
||||
|
||||
// get the number of selected items
|
||||
const uint32 numSelectedItems = selectedItems.count();
|
||||
if (numSelectedItems == 0)
|
||||
if (selectedItems.empty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -1828,12 +1823,11 @@ namespace EMStudio
|
||||
|
||||
// add each command
|
||||
AZStd::string commandString;
|
||||
const size_t numValid = mValids.size();
|
||||
for (size_t i = 0; i < numValid; ++i)
|
||||
for (size_t validID : mValids)
|
||||
{
|
||||
// get the motion ID and the modified ID
|
||||
AZStd::string& motionID = mMotionIDs[mValids[i]];
|
||||
const AZStd::string& modifiedID = mModifiedMotionIDs[mMotionToModifiedMap[mValids[i]]];
|
||||
AZStd::string& motionID = mMotionIDs[validID];
|
||||
const AZStd::string& modifiedID = mModifiedMotionIDs[mMotionToModifiedMap[validID]];
|
||||
|
||||
commandString = AZStd::string::format("MotionSetAdjustMotion -motionSetID %i -idString \"%s\" -newIDString \"%s\" -updateMotionNodeStringIDs true", mMotionSet->GetID(), motionID.c_str(), modifiedID.c_str());
|
||||
motionID = modifiedID;
|
||||
@@ -1954,9 +1948,6 @@ namespace EMStudio
|
||||
return;
|
||||
}
|
||||
|
||||
// found flags
|
||||
uint32 numDuplicateFound = 0;
|
||||
|
||||
// Clear the arrays but keep the memory to avoid alloc.
|
||||
mValids.clear();
|
||||
mModifiedMotionIDs.clear();
|
||||
@@ -1974,7 +1965,7 @@ namespace EMStudio
|
||||
// Modify each ID using the operation in the modified array.
|
||||
AZStd::string newMotionID;
|
||||
AZStd::string tempString;
|
||||
for (uint32 i = 0; i < numMotionIDs; ++i)
|
||||
for (const AZStd::string& mMotionID : mMotionIDs)
|
||||
{
|
||||
// 0=Replace All, 1=Replace First, 2=Replace Last
|
||||
const int operationMode = mComboBox->currentIndex();
|
||||
@@ -1984,7 +1975,7 @@ namespace EMStudio
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
tempString = mMotionIDs[i].c_str();
|
||||
tempString = mMotionID.c_str();
|
||||
AzFramework::StringFunc::Replace(tempString, mStringALineEdit->text().toUtf8().data(), mStringBLineEdit->text().toUtf8().data(), true /* case sensitive */);
|
||||
newMotionID = tempString.c_str();
|
||||
break;
|
||||
@@ -1992,7 +1983,7 @@ namespace EMStudio
|
||||
|
||||
case 1:
|
||||
{
|
||||
tempString = mMotionIDs[i].c_str();
|
||||
tempString = mMotionID.c_str();
|
||||
AzFramework::StringFunc::Replace(tempString, mStringALineEdit->text().toUtf8().data(), mStringBLineEdit->text().toUtf8().data(), true /* case sensitive */, true /* replace first */, false /* replace last */);
|
||||
newMotionID = tempString.c_str();
|
||||
break;
|
||||
@@ -2000,7 +1991,7 @@ namespace EMStudio
|
||||
|
||||
case 2:
|
||||
{
|
||||
tempString = mMotionIDs[i].c_str();
|
||||
tempString = mMotionID.c_str();
|
||||
AzFramework::StringFunc::Replace(tempString, mStringALineEdit->text().toUtf8().data(), mStringBLineEdit->text().toUtf8().data(), true /* case sensitive */, false /* replace first */, true /* replace last */);
|
||||
newMotionID = tempString.c_str();
|
||||
break;
|
||||
@@ -2008,17 +1999,20 @@ namespace EMStudio
|
||||
}
|
||||
|
||||
// change the value in the array and add the mapping motion to modified
|
||||
auto iterator = AZStd::find(mModifiedMotionIDs.begin(), mModifiedMotionIDs.end(), mMotionIDs[i]);
|
||||
auto iterator = AZStd::find(mModifiedMotionIDs.begin(), mModifiedMotionIDs.end(), mMotionID);
|
||||
const size_t modifiedIndex = iterator - mModifiedMotionIDs.begin();
|
||||
mModifiedMotionIDs[modifiedIndex] = newMotionID;
|
||||
mMotionToModifiedMap.push_back(static_cast<uint32>(modifiedIndex));
|
||||
mMotionToModifiedMap.push_back(modifiedIndex);
|
||||
}
|
||||
|
||||
// disable the sorting
|
||||
mTableWidget->setSortingEnabled(false);
|
||||
|
||||
// found flags
|
||||
size_t numDuplicateFound = 0;
|
||||
|
||||
// update each row
|
||||
for (uint32 i = 0; i < numMotionIDs; ++i)
|
||||
for (size_t i = 0; i < numMotionIDs; ++i)
|
||||
{
|
||||
// find the index in the motion set
|
||||
const AZStd::string& modifiedID = mModifiedMotionIDs[mMotionToModifiedMap[i]];
|
||||
@@ -2028,9 +2022,9 @@ namespace EMStudio
|
||||
QTableWidgetItem* afterTableWidgetItem = new QTableWidgetItem(modifiedID.c_str());
|
||||
|
||||
// find duplicate
|
||||
uint32 itemFoundCounter = 0;
|
||||
const AZ::u32 numMotionEntries = static_cast<AZ::u32>(mMotionSet->GetNumMotionEntries());
|
||||
for (uint32 k = 0; k < numMotionEntries; ++k)
|
||||
size_t itemFoundCounter = 0;
|
||||
const size_t numMotionEntries = mMotionSet->GetNumMotionEntries();
|
||||
for (size_t k = 0; k < numMotionEntries; ++k)
|
||||
{
|
||||
if (mModifiedMotionIDs[k] == modifiedID)
|
||||
{
|
||||
@@ -2063,8 +2057,8 @@ namespace EMStudio
|
||||
}
|
||||
|
||||
// set the text of the row
|
||||
mTableWidget->setItem(i, 0, beforeTableWidgetItem);
|
||||
mTableWidget->setItem(i, 1, afterTableWidgetItem);
|
||||
mTableWidget->setItem(aznumeric_caster(i), 0, beforeTableWidgetItem);
|
||||
mTableWidget->setItem(aznumeric_caster(i), 1, afterTableWidgetItem);
|
||||
}
|
||||
|
||||
// enable the sorting
|
||||
@@ -2085,7 +2079,7 @@ namespace EMStudio
|
||||
}
|
||||
|
||||
// enable or disable the apply button
|
||||
mApplyButton->setEnabled((mValids.size() > 0) && (numDuplicateFound == 0));
|
||||
mApplyButton->setEnabled((!mValids.empty()) && (numDuplicateFound == 0));
|
||||
|
||||
// Reselect the remembered motions.
|
||||
mTableWidget->clearSelection();
|
||||
@@ -2130,9 +2124,9 @@ namespace EMStudio
|
||||
const int numItems = items.size();
|
||||
outRowIndices.reserve(numItems);
|
||||
|
||||
for (int i = 0; i < numItems; ++i)
|
||||
for (const QTableWidgetItem* item : items)
|
||||
{
|
||||
const int rowIndex = items[i]->row();
|
||||
const int rowIndex = item->row();
|
||||
if (AZStd::find(outRowIndices.begin(), outRowIndices.end(), rowIndex) == outRowIndices.end())
|
||||
{
|
||||
outRowIndices.push_back(rowIndex);
|
||||
@@ -2141,7 +2135,7 @@ namespace EMStudio
|
||||
}
|
||||
|
||||
|
||||
uint32 MotionSetWindow::CalcNumMotionEntriesUsingMotionExcluding(const AZStd::string& motionFilename, EMotionFX::MotionSet* excludedMotionSet)
|
||||
size_t MotionSetWindow::CalcNumMotionEntriesUsingMotionExcluding(const AZStd::string& motionFilename, EMotionFX::MotionSet* excludedMotionSet)
|
||||
{
|
||||
if (motionFilename.empty())
|
||||
{
|
||||
@@ -2149,9 +2143,9 @@ namespace EMStudio
|
||||
}
|
||||
|
||||
// Iterate through all available motion sets and count how many entries are refering to the given motion file.
|
||||
AZ::u32 counter = 0;
|
||||
const uint32 numMotionSets = EMotionFX::GetMotionManager().GetNumMotionSets();
|
||||
for (uint32 i = 0; i < numMotionSets; ++i)
|
||||
size_t counter = 0;
|
||||
const size_t numMotionSets = EMotionFX::GetMotionManager().GetNumMotionSets();
|
||||
for (size_t i = 0; i < numMotionSets; ++i)
|
||||
{
|
||||
EMotionFX::MotionSet* motionSet = EMotionFX::GetMotionManager().GetMotionSet(i);
|
||||
if (motionSet->GetIsOwnedByRuntime())
|
||||
|
||||
+3
-3
@@ -91,8 +91,8 @@ namespace EMStudio
|
||||
EMotionFX::MotionSet* mMotionSet;
|
||||
AZStd::vector<AZStd::string> mMotionIDs;
|
||||
AZStd::vector<AZStd::string> mModifiedMotionIDs;
|
||||
AZStd::vector<uint32> mMotionToModifiedMap;
|
||||
AZStd::vector<uint32> mValids;
|
||||
AZStd::vector<size_t> mMotionToModifiedMap;
|
||||
AZStd::vector<size_t> mValids;
|
||||
QTableWidget* mTableWidget;
|
||||
QLineEdit* mStringALineEdit;
|
||||
QLineEdit* mStringBLineEdit;
|
||||
@@ -184,7 +184,7 @@ namespace EMStudio
|
||||
EMotionFX::MotionSet::MotionEntry* FindMotionEntry(QTableWidgetItem* item) const;
|
||||
|
||||
void GetRowIndices(const QList<QTableWidgetItem*>& items, AZStd::vector<int>& outRowIndices);
|
||||
uint32 CalcNumMotionEntriesUsingMotionExcluding(const AZStd::string& motionFilename, EMotionFX::MotionSet* excludedMotionSet);
|
||||
size_t CalcNumMotionEntriesUsingMotionExcluding(const AZStd::string& motionFilename, EMotionFX::MotionSet* excludedMotionSet);
|
||||
|
||||
private:
|
||||
QVBoxLayout* mVLayout = nullptr;
|
||||
|
||||
+7
-7
@@ -55,8 +55,8 @@ namespace EMStudio
|
||||
|
||||
void GetDirtyFileNames(AZStd::vector<AZStd::string>* outFileNames, AZStd::vector<ObjectPointer>* outObjects) override
|
||||
{
|
||||
const uint32 numMotionSets = EMotionFX::GetMotionManager().GetNumMotionSets();
|
||||
for (uint32 i = 0; i < numMotionSets; ++i)
|
||||
const size_t numMotionSets = EMotionFX::GetMotionManager().GetNumMotionSets();
|
||||
for (size_t i = 0; i < numMotionSets; ++i)
|
||||
{
|
||||
EMotionFX::MotionSet* motionSet = EMotionFX::GetMotionManager().GetMotionSet(i);
|
||||
|
||||
@@ -226,7 +226,7 @@ namespace EMStudio
|
||||
|
||||
EMotionFX::MotionSet* MotionSetsWindowPlugin::GetSelectedSet() const
|
||||
{
|
||||
if (EMotionFX::GetMotionManager().FindMotionSetIndex(mSelectedSet) == MCORE_INVALIDINDEX32)
|
||||
if (EMotionFX::GetMotionManager().FindMotionSetIndex(mSelectedSet) == InvalidIndex)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
@@ -238,7 +238,7 @@ namespace EMStudio
|
||||
void MotionSetsWindowPlugin::ReInit()
|
||||
{
|
||||
// Validate existence of selected motion set and reset selection in case selection is invalid.
|
||||
if (EMotionFX::GetMotionManager().FindMotionSetIndex(mSelectedSet) == MCORE_INVALIDINDEX32)
|
||||
if (EMotionFX::GetMotionManager().FindMotionSetIndex(mSelectedSet) == InvalidIndex)
|
||||
{
|
||||
mSelectedSet = nullptr;
|
||||
}
|
||||
@@ -488,7 +488,7 @@ namespace EMStudio
|
||||
|
||||
// If motion entry is still not found, look through all motion sets not owned by runtime.
|
||||
const EMotionFX::MotionManager& motionManager = EMotionFX::GetMotionManager();
|
||||
for(AZ::u32 i = 0; i < motionManager.GetNumMotionSets(); ++i)
|
||||
for(size_t i = 0; i < motionManager.GetNumMotionSets(); ++i)
|
||||
{
|
||||
motionSet = motionManager.GetMotionSet(i);
|
||||
if (motionSet->GetIsOwnedByRuntime())
|
||||
@@ -680,9 +680,9 @@ namespace EMStudio
|
||||
// select the first motion set
|
||||
if (EMotionFX::GetMotionManager().GetNumMotionSets() > 0)
|
||||
{
|
||||
const uint32 numMotionSets = EMotionFX::GetMotionManager().GetNumMotionSets();
|
||||
const size_t numMotionSets = EMotionFX::GetMotionManager().GetNumMotionSets();
|
||||
|
||||
for (uint32 i = 0; i < numMotionSets; ++i)
|
||||
for (size_t i = 0; i < numMotionSets; ++i)
|
||||
{
|
||||
EMotionFX::MotionSet* motionSet2 = EMotionFX::GetMotionManager().GetMotionSet(0);
|
||||
|
||||
|
||||
+6
-6
@@ -182,7 +182,7 @@ namespace EMStudio
|
||||
const CommandSystem::SelectionList& selectionList = GetCommandManager()->GetCurrentSelection();
|
||||
|
||||
// Check if there actually is any motion selected.
|
||||
const uint32 numSelectedMotions = selectionList.GetNumSelectedMotions();
|
||||
const size_t numSelectedMotions = selectionList.GetNumSelectedMotions();
|
||||
const bool isEnabled = (numSelectedMotions != 0);
|
||||
|
||||
EMotionFX::ActorInstance* actorInstance = GetCommandManager()->GetCurrentSelection().GetSingleActorInstance();
|
||||
@@ -254,11 +254,11 @@ namespace EMStudio
|
||||
|
||||
// Figure out if all selected motions use the same settings.
|
||||
bool allCaptureHeightEqual = true;
|
||||
uint32 numCaptureHeight = 0;
|
||||
const uint32 numMotions = selectionList.GetNumSelectedMotions();
|
||||
size_t numCaptureHeight = 0;
|
||||
const size_t numMotions = selectionList.GetNumSelectedMotions();
|
||||
bool curCaptureHeight = false;
|
||||
|
||||
for (uint32 i = 0; i < numMotions; ++i)
|
||||
for (size_t i = 0; i < numMotions; ++i)
|
||||
{
|
||||
EMotionFX::Motion* curMotion = selectionList.GetMotion(i);
|
||||
EMotionFX::Motion* prevMotion = (i>0) ? selectionList.GetMotion(i-1) : nullptr;
|
||||
@@ -325,7 +325,7 @@ namespace EMStudio
|
||||
void MotionExtractionWindow::OnMotionExtractionFlagsUpdated()
|
||||
{
|
||||
const CommandSystem::SelectionList& selectionList = GetCommandManager()->GetCurrentSelection();
|
||||
const uint32 numSelectedMotions = selectionList.GetNumSelectedMotions();
|
||||
const size_t numSelectedMotions = selectionList.GetNumSelectedMotions();
|
||||
EMotionFX::ActorInstance* actorInstance = selectionList.GetSingleActorInstance();
|
||||
|
||||
// Check if there is at least one motion selected and exactly one actor instance.
|
||||
@@ -353,7 +353,7 @@ namespace EMStudio
|
||||
|
||||
// Iterate through all selected motions.
|
||||
AZStd::string command;
|
||||
for (uint32 i = 0; i < numSelectedMotions; ++i)
|
||||
for (size_t i = 0; i < numSelectedMotions; ++i)
|
||||
{
|
||||
// Get the current selected motion, check if it is a skeletal motion, skip directly elsewise.
|
||||
EMotionFX::Motion* motion = selectionList.GetMotion(i);
|
||||
|
||||
+19
-24
@@ -243,7 +243,7 @@ namespace EMStudio
|
||||
mMotionTable->setSortingEnabled(false);
|
||||
|
||||
// insert the new row
|
||||
const uint32 rowIndex = 0;
|
||||
const int rowIndex = 0;
|
||||
mMotionTable->insertRow(rowIndex);
|
||||
mMotionTable->setRowHeight(rowIndex, 21);
|
||||
|
||||
@@ -314,8 +314,8 @@ namespace EMStudio
|
||||
uint32 MotionListWindow::FindRowByMotionID(uint32 motionID)
|
||||
{
|
||||
// iterate through the rows and compare the motion IDs
|
||||
const uint32 rowCount = mMotionTable->rowCount();
|
||||
for (uint32 i = 0; i < rowCount; ++i)
|
||||
const int rowCount = mMotionTable->rowCount();
|
||||
for (int i = 0; i < rowCount; ++i)
|
||||
{
|
||||
if (GetMotionID(i) == motionID)
|
||||
{
|
||||
@@ -469,7 +469,7 @@ namespace EMStudio
|
||||
mMotionTable->clearSelection();
|
||||
|
||||
// iterate through the selected motions and select the corresponding rows in the table widget
|
||||
const uint32 numSelectedMotions = selectionList.GetNumSelectedMotions();
|
||||
const size_t numSelectedMotions = selectionList.GetNumSelectedMotions();
|
||||
for (uint32 i = 0; i < numSelectedMotions; ++i)
|
||||
{
|
||||
// get the index of the motion inside the motion manager (which is equal to the row in the motion table) and select the row at the motion index
|
||||
@@ -531,14 +531,14 @@ namespace EMStudio
|
||||
const QList<QTableWidgetItem*> selectedItems = mMotionTable->selectedItems();
|
||||
|
||||
// get the number of selected items
|
||||
const uint32 numSelectedItems = selectedItems.count();
|
||||
const int numSelectedItems = selectedItems.count();
|
||||
|
||||
// filter the items
|
||||
AZStd::vector<uint32> rowIndices;
|
||||
AZStd::vector<int> rowIndices;
|
||||
rowIndices.reserve(numSelectedItems);
|
||||
for (size_t i = 0; i < numSelectedItems; ++i)
|
||||
for (int i = 0; i < numSelectedItems; ++i)
|
||||
{
|
||||
const uint32 rowIndex = selectedItems[static_cast<uint32>(i)]->row();
|
||||
const int rowIndex = selectedItems[i]->row();
|
||||
if (AZStd::find(rowIndices.begin(), rowIndices.end(), rowIndex) == rowIndices.end())
|
||||
{
|
||||
rowIndices.push_back(rowIndex);
|
||||
@@ -549,22 +549,20 @@ namespace EMStudio
|
||||
mSelectedMotionIDs.clear();
|
||||
|
||||
// get the number of selected items and iterate through them
|
||||
const size_t numSelectedRows = rowIndices.size();
|
||||
mSelectedMotionIDs.reserve(numSelectedRows);
|
||||
for (size_t i = 0; i < numSelectedRows; ++i)
|
||||
mSelectedMotionIDs.reserve(rowIndices.size());
|
||||
for (const int rowIndex : rowIndices)
|
||||
{
|
||||
mSelectedMotionIDs.push_back(GetMotionID(rowIndices[i]));
|
||||
mSelectedMotionIDs.push_back(GetMotionID(rowIndex));
|
||||
}
|
||||
|
||||
// unselect all motions
|
||||
GetCommandManager()->GetCurrentSelection().ClearMotionSelection();
|
||||
|
||||
// get the number of selected motions and iterate through them
|
||||
const size_t numSelectedMotions = mSelectedMotionIDs.size();
|
||||
for (size_t i = 0; i < numSelectedMotions; ++i)
|
||||
for (uint32 selectedMotionID : mSelectedMotionIDs)
|
||||
{
|
||||
// find the motion by name in the motion library and select it
|
||||
EMotionFX::Motion* motion = EMotionFX::GetMotionManager().FindMotionByID(mSelectedMotionIDs[i]);
|
||||
EMotionFX::Motion* motion = EMotionFX::GetMotionManager().FindMotionByID(selectedMotionID);
|
||||
if (motion)
|
||||
{
|
||||
GetCommandManager()->GetCurrentSelection().AddMotion(motion);
|
||||
@@ -583,7 +581,7 @@ namespace EMStudio
|
||||
{
|
||||
// get the current selection
|
||||
const CommandSystem::SelectionList& selection = GetCommandManager()->GetCurrentSelection();
|
||||
const uint32 numSelectedMotions = selection.GetNumSelectedMotions();
|
||||
const size_t numSelectedMotions = selection.GetNumSelectedMotions();
|
||||
if (numSelectedMotions == 0)
|
||||
{
|
||||
return;
|
||||
@@ -607,7 +605,6 @@ namespace EMStudio
|
||||
|
||||
// Set the command group name based on the number of motions to add.
|
||||
AZStd::string groupName;
|
||||
const size_t numSelectedMotionSets = selectedMotionSets.size();
|
||||
if (numSelectedMotions > 1)
|
||||
{
|
||||
groupName = "Add motions in motion sets";
|
||||
@@ -621,16 +618,14 @@ namespace EMStudio
|
||||
|
||||
// add in each selected motion set
|
||||
AZStd::string motionName;
|
||||
for (uint32 m = 0; m < numSelectedMotionSets; ++m)
|
||||
for (const EMotionFX::MotionSet* motionSet : selectedMotionSets)
|
||||
{
|
||||
EMotionFX::MotionSet* motionSet = selectedMotionSets[m];
|
||||
|
||||
// Build a list of unique string id values from all motion set entries.
|
||||
AZStd::vector<AZStd::string> idStrings;
|
||||
motionSet->BuildIdStringList(idStrings);
|
||||
|
||||
// add each selected motion in the motion set
|
||||
for (uint32 i = 0; i < numSelectedMotions; ++i)
|
||||
for (size_t i = 0; i < numSelectedMotions; ++i)
|
||||
{
|
||||
// remove the media root folder from the absolute motion filename so that we get the relative one to the media root folder
|
||||
motionName = selection.GetMotion(i)->GetFileName();
|
||||
@@ -654,7 +649,7 @@ namespace EMStudio
|
||||
const CommandSystem::SelectionList& selection = GetCommandManager()->GetCurrentSelection();
|
||||
|
||||
// iterate through the selected motions and show them
|
||||
for (uint32 i = 0; i < selection.GetNumSelectedMotions(); ++i)
|
||||
for (size_t i = 0; i < selection.GetNumSelectedMotions(); ++i)
|
||||
{
|
||||
EMotionFX::Motion* motion = selection.GetMotion(i);
|
||||
AzQtComponents::ShowFileOnDesktop(motion->GetFileName());
|
||||
@@ -777,8 +772,8 @@ namespace EMStudio
|
||||
|
||||
// get the number of selected motions and return directly if there are no motions selected
|
||||
AZStd::string textData, command;
|
||||
const uint32 numMotions = selectionList.GetNumSelectedMotions();
|
||||
for (uint32 i = 0; i < numMotions; ++i)
|
||||
const size_t numMotions = selectionList.GetNumSelectedMotions();
|
||||
for (size_t i = 0; i < numMotions; ++i)
|
||||
{
|
||||
EMotionFX::Motion* motion = selectionList.GetMotion(i);
|
||||
|
||||
|
||||
+4
-4
@@ -67,8 +67,8 @@ namespace EMStudio
|
||||
MCore::CommandGroup commandGroup("Adjust default motion instances");
|
||||
|
||||
// get the number of selected motions and iterate through them
|
||||
const uint32 numMotions = selection.GetNumSelectedMotions();
|
||||
for (uint32 i = 0; i < numMotions; ++i)
|
||||
const size_t numMotions = selection.GetNumSelectedMotions();
|
||||
for (size_t i = 0; i < numMotions; ++i)
|
||||
{
|
||||
MotionWindowPlugin::MotionTableEntry* entry = mMotionWindowPlugin->FindMotionEntryByID(selection.GetMotion(i)->GetID());
|
||||
if (entry == nullptr)
|
||||
@@ -108,7 +108,7 @@ namespace EMStudio
|
||||
const CommandSystem::SelectionList& selection = CommandSystem::GetCommandManager()->GetCurrentSelection();
|
||||
|
||||
// check if there actually is any motion selected
|
||||
const uint32 numSelectedMotions = selection.GetNumSelectedMotions();
|
||||
const size_t numSelectedMotions = selection.GetNumSelectedMotions();
|
||||
const bool isEnabled = (numSelectedMotions != 0);
|
||||
|
||||
mMotionRetargetingButton->setEnabled(isEnabled);
|
||||
@@ -120,7 +120,7 @@ namespace EMStudio
|
||||
}
|
||||
|
||||
// iterate through the selected motions
|
||||
for (uint32 i = 0; i < numSelectedMotions; ++i)
|
||||
for (size_t i = 0; i < numSelectedMotions; ++i)
|
||||
{
|
||||
MotionWindowPlugin::MotionTableEntry* entry = mMotionWindowPlugin->FindMotionEntryByID(selection.GetMotion(i)->GetID());
|
||||
if (entry == nullptr)
|
||||
|
||||
+37
-119
@@ -6,6 +6,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "AzCore/std/limits.h"
|
||||
#include <EMotionFX/CommandSystem/Source/CommandManager.h>
|
||||
#include <EMotionFX/CommandSystem/Source/MotionCommands.h>
|
||||
#include <EMotionFX/Source/MotionManager.h>
|
||||
@@ -53,8 +54,8 @@ namespace EMStudio
|
||||
void GetDirtyFileNames(AZStd::vector<AZStd::string>* outFileNames, AZStd::vector<ObjectPointer>* outObjects) override
|
||||
{
|
||||
// get the number of motions and iterate through them
|
||||
const uint32 numMotions = EMotionFX::GetMotionManager().GetNumMotions();
|
||||
for (uint32 i = 0; i < numMotions; ++i)
|
||||
const size_t numMotions = EMotionFX::GetMotionManager().GetNumMotions();
|
||||
for (size_t i = 0; i < numMotions; ++i)
|
||||
{
|
||||
EMotionFX::Motion* motion = EMotionFX::GetMotionManager().GetMotion(i);
|
||||
|
||||
@@ -272,11 +273,11 @@ namespace EMStudio
|
||||
}
|
||||
|
||||
// iterate through the motions and put them into some array
|
||||
const uint32 numMotions = EMotionFX::GetMotionManager().GetNumMotions();
|
||||
const size_t numMotions = EMotionFX::GetMotionManager().GetNumMotions();
|
||||
AZStd::vector<EMotionFX::Motion*> motionsToRemove;
|
||||
motionsToRemove.reserve(numMotions);
|
||||
|
||||
for (uint32 i = 0; i < numMotions; ++i)
|
||||
for (size_t i = 0; i < numMotions; ++i)
|
||||
{
|
||||
EMotionFX::Motion* motion = EMotionFX::GetMotionManager().GetMotion(i);
|
||||
if (motion->GetIsOwnedByRuntime())
|
||||
@@ -303,7 +304,7 @@ namespace EMStudio
|
||||
const CommandSystem::SelectionList& selection = GetCommandManager()->GetCurrentSelection();
|
||||
|
||||
// get the number of selected motions
|
||||
const uint32 numMotions = selection.GetNumSelectedMotions();
|
||||
const size_t numMotions = selection.GetNumSelectedMotions();
|
||||
if (numMotions == 0)
|
||||
{
|
||||
return;
|
||||
@@ -327,7 +328,7 @@ namespace EMStudio
|
||||
|
||||
// Save all dirty motion files.
|
||||
EMotionFX::MotionManager& motionManager = EMotionFX::GetMotionManager();
|
||||
for (uint32 i = 0; i < numMotions; ++i)
|
||||
for (size_t i = 0; i < numMotions; ++i)
|
||||
{
|
||||
// Look up the motion by ID, using our backup seleciton list.
|
||||
// So even if our selection list in EMotion FX gets modified, we still iterate over the original selection now.
|
||||
@@ -353,15 +354,11 @@ namespace EMStudio
|
||||
}
|
||||
|
||||
// find the lowest row selected
|
||||
uint32 lowestRowSelected = MCORE_INVALIDINDEX32;
|
||||
int lowestRowSelected = AZStd::numeric_limits<int>::max();
|
||||
const QList<QTableWidgetItem*> selectedItems = mMotionListWindow->GetMotionTable()->selectedItems();
|
||||
const int numSelectedItems = selectedItems.size();
|
||||
for (int i = 0; i < numSelectedItems; ++i)
|
||||
for (const QTableWidgetItem* selectedItem : selectedItems)
|
||||
{
|
||||
if ((uint32)selectedItems[i]->row() < lowestRowSelected)
|
||||
{
|
||||
lowestRowSelected = (uint32)selectedItems[i]->row();
|
||||
}
|
||||
lowestRowSelected = AZStd::min(lowestRowSelected, selectedItem->row());
|
||||
}
|
||||
|
||||
// construct the command group and remove the selected motions
|
||||
@@ -369,7 +366,7 @@ namespace EMStudio
|
||||
CommandSystem::RemoveMotions(motionsToRemove, &failedRemoveMotions);
|
||||
|
||||
// selected the next row
|
||||
if (lowestRowSelected > ((uint32)mMotionListWindow->GetMotionTable()->rowCount() - 1))
|
||||
if (lowestRowSelected > (mMotionListWindow->GetMotionTable()->rowCount() - 1))
|
||||
{
|
||||
mMotionListWindow->GetMotionTable()->selectRow(lowestRowSelected - 1);
|
||||
}
|
||||
@@ -389,7 +386,7 @@ namespace EMStudio
|
||||
void MotionWindowPlugin::OnSave()
|
||||
{
|
||||
const CommandSystem::SelectionList& selectionList = GetCommandManager()->GetCurrentSelection();
|
||||
const AZ::u32 numMotions = selectionList.GetNumSelectedMotions();
|
||||
const size_t numMotions = selectionList.GetNumSelectedMotions();
|
||||
if (numMotions == 0)
|
||||
{
|
||||
return;
|
||||
@@ -398,7 +395,7 @@ namespace EMStudio
|
||||
// Collect motion ids of the motion to be saved.
|
||||
AZStd::vector<AZ::u32> motionIds;
|
||||
motionIds.reserve(numMotions);
|
||||
for (AZ::u32 i = 0; i < numMotions; ++i)
|
||||
for (size_t i = 0; i < numMotions; ++i)
|
||||
{
|
||||
const EMotionFX::Motion* motion = selectionList.GetMotion(i);
|
||||
motionIds.push_back(motion->GetID());
|
||||
@@ -462,11 +459,9 @@ namespace EMStudio
|
||||
|
||||
void MotionWindowPlugin::ReInit()
|
||||
{
|
||||
uint32 i;
|
||||
|
||||
// get the number of motions in the motion library and iterate through them
|
||||
const uint32 numLibraryMotions = EMotionFX::GetMotionManager().GetNumMotions();
|
||||
for (i = 0; i < numLibraryMotions; ++i)
|
||||
const size_t numLibraryMotions = EMotionFX::GetMotionManager().GetNumMotions();
|
||||
for (size_t i = 0; i < numLibraryMotions; ++i)
|
||||
{
|
||||
// check if we have already added this motion, if not add it
|
||||
EMotionFX::Motion* motion = EMotionFX::GetMotionManager().GetMotion(i);
|
||||
@@ -481,21 +476,16 @@ namespace EMStudio
|
||||
}
|
||||
|
||||
// iterate through all motions inside the motion window plugin
|
||||
i = 0;
|
||||
while (i < mMotionEntries.size())
|
||||
AZStd::erase_if(mMotionEntries, [](MotionTableEntry* entry)
|
||||
{
|
||||
MotionTableEntry* entry = mMotionEntries[i];
|
||||
// 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) == MCORE_INVALIDINDEX32)
|
||||
if (EMotionFX::GetMotionManager().FindMotionIndexByID(entry->mMotionID) == InvalidIndex)
|
||||
{
|
||||
delete mMotionEntries[i];
|
||||
mMotionEntries.erase(mMotionEntries.begin() + i);
|
||||
delete entry;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
i++;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
// update the motion list window
|
||||
mMotionListWindow->ReInit();
|
||||
@@ -511,10 +501,8 @@ namespace EMStudio
|
||||
void MotionWindowPlugin::UpdateInterface()
|
||||
{
|
||||
AZStd::vector<EMotionFX::MotionInstance*>& motionInstances = GetSelectedMotionInstances();
|
||||
const size_t numMotionInstances = motionInstances.size();
|
||||
for (size_t i = 0; i < numMotionInstances; ++i)
|
||||
for (EMotionFX::MotionInstance* motionInstance : motionInstances)
|
||||
{
|
||||
EMotionFX::MotionInstance* motionInstance = motionInstances[i];
|
||||
EMotionFX::Motion* motion = motionInstance->GetMotion();
|
||||
motionInstance->InitFromPlayBackInfo(*motion->GetDefaultPlayBackInfo(), false);
|
||||
|
||||
@@ -537,8 +525,6 @@ namespace EMStudio
|
||||
mMotionNameLabel->setText(motion ? motion->GetName() : nullptr);
|
||||
}
|
||||
|
||||
const uint32 numMotions = EMotionFX::GetMotionManager().GetNumMotions();
|
||||
|
||||
if (mSaveAction)
|
||||
{
|
||||
// related to the selected motions
|
||||
@@ -561,35 +547,30 @@ namespace EMStudio
|
||||
|
||||
|
||||
|
||||
void MotionWindowPlugin::VisibilityChanged(bool visible)
|
||||
void MotionWindowPlugin::VisibilityChanged([[maybe_unused]] bool visible)
|
||||
{
|
||||
if (visible)
|
||||
{
|
||||
//mMotionRetargetingWindow->UpdateSelection();
|
||||
//mMotionExtractionWindow->UpdateExtractionNodeLabel();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
AZStd::vector<EMotionFX::MotionInstance*>& MotionWindowPlugin::GetSelectedMotionInstances()
|
||||
{
|
||||
const CommandSystem::SelectionList& selectionList = CommandSystem::GetCommandManager()->GetCurrentSelection();
|
||||
const uint32 numSelectedActorInstances = selectionList.GetNumSelectedActorInstances();
|
||||
const uint32 numSelectedMotions = selectionList.GetNumSelectedMotions();
|
||||
const size_t numSelectedActorInstances = selectionList.GetNumSelectedActorInstances();
|
||||
const size_t numSelectedMotions = selectionList.GetNumSelectedMotions();
|
||||
|
||||
mInternalMotionInstanceSelection.clear();
|
||||
|
||||
for (uint32 i = 0; i < numSelectedActorInstances; ++i)
|
||||
for (size_t i = 0; i < numSelectedActorInstances; ++i)
|
||||
{
|
||||
EMotionFX::ActorInstance* actorInstance = selectionList.GetActorInstance(i);
|
||||
EMotionFX::MotionSystem* motionSystem = actorInstance->GetMotionSystem();
|
||||
const uint32 numMotionInstances = motionSystem->GetNumMotionInstances();
|
||||
const size_t numMotionInstances = motionSystem->GetNumMotionInstances();
|
||||
|
||||
for (uint32 j = 0; j < numSelectedMotions; ++j)
|
||||
for (size_t j = 0; j < numSelectedMotions; ++j)
|
||||
{
|
||||
EMotionFX::Motion* motion = selectionList.GetMotion(j);
|
||||
|
||||
for (uint32 k = 0; k < numMotionInstances; ++k)
|
||||
for (size_t k = 0; k < numMotionInstances; ++k)
|
||||
{
|
||||
EMotionFX::MotionInstance* motionInstance = motionSystem->GetMotionInstance(k);
|
||||
if (motionInstance->GetMotion() == motion)
|
||||
@@ -606,17 +587,11 @@ namespace EMStudio
|
||||
|
||||
MotionWindowPlugin::MotionTableEntry* MotionWindowPlugin::FindMotionEntryByID(uint32 motionID)
|
||||
{
|
||||
const size_t numMotionEntries = mMotionEntries.size();
|
||||
for (size_t i = 0; i < numMotionEntries; ++i)
|
||||
const auto foundEntry = AZStd::find_if(begin(mMotionEntries), end(mMotionEntries), [motionID](const MotionTableEntry* entry)
|
||||
{
|
||||
MotionTableEntry* entry = mMotionEntries[i];
|
||||
if (entry->mMotionID == motionID)
|
||||
{
|
||||
return entry;
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
return entry->mMotionID == motionID;
|
||||
});
|
||||
return foundEntry != end(mMotionEntries) ? *foundEntry : nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -633,10 +608,8 @@ namespace EMStudio
|
||||
AZStd::string command, commandParameters;
|
||||
MCore::CommandGroup commandGroup("Play motions");
|
||||
|
||||
const size_t numMotions = motions.size();
|
||||
for (size_t i = 0; i < numMotions; ++i)
|
||||
for (EMotionFX::Motion* motion : motions)
|
||||
{
|
||||
EMotionFX::Motion* motion = motions[i];
|
||||
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.
|
||||
@@ -663,17 +636,17 @@ namespace EMStudio
|
||||
const CommandSystem::SelectionList& selection = CommandSystem::GetCommandManager()->GetCurrentSelection();
|
||||
|
||||
// get the number of selected motions
|
||||
const uint32 numMotions = selection.GetNumSelectedMotions();
|
||||
const size_t numMotions = selection.GetNumSelectedMotions();
|
||||
if (numMotions == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// create our remove motion command group
|
||||
MCore::CommandGroup commandGroup(AZStd::string::format("Stop %u motion instances", numMotions).c_str());
|
||||
MCore::CommandGroup commandGroup(AZStd::string::format("Stop %zu motion instances", numMotions).c_str());
|
||||
|
||||
AZStd::string command;
|
||||
for (uint32 i = 0; i < numMotions; ++i)
|
||||
for (size_t i = 0; i < numMotions; ++i)
|
||||
{
|
||||
MotionWindowPlugin::MotionTableEntry* entry = FindMotionEntryByID(selection.GetMotion(i)->GetID());
|
||||
if (entry == nullptr)
|
||||
@@ -703,61 +676,6 @@ namespace EMStudio
|
||||
{
|
||||
return;
|
||||
}
|
||||
/*
|
||||
if (mMotionRetargetingWindow->GetRenderMotionBindPose())
|
||||
{
|
||||
const CommandSystem::SelectionList& selection = CommandSystem::GetCommandManager()->GetCurrentSelection();
|
||||
|
||||
// get the number of selected actor instances and iterate through them
|
||||
const uint32 numActorInstances = selection.GetNumSelectedActorInstances();
|
||||
for (uint32 j = 0; j < numActorInstances; ++j)
|
||||
{
|
||||
EMotionFX::ActorInstance* actorInstance = selection.GetActorInstance(j);
|
||||
EMotionFX::Actor* actor = actorInstance->GetActor();
|
||||
|
||||
// get the number of selected motions and iterate through them
|
||||
const uint32 numMotions = selection.GetNumSelectedMotions();
|
||||
for (uint32 i = 0; i < numMotions; ++i)
|
||||
{
|
||||
EMotionFX::Motion* motion = selection.GetMotion(i);
|
||||
if (motion->GetType() == EMotionFX::SkeletalMotion::TYPE_ID)
|
||||
{
|
||||
EMotionFX::SkeletalMotion* skeletalMotion = (EMotionFX::SkeletalMotion*)motion;
|
||||
|
||||
EMotionFX::AnimGraphPosePool& posePool = EMotionFX::GetEMotionFX().GetThreadData(0)->GetPosePool();
|
||||
EMotionFX::AnimGraphPose* pose = posePool.RequestPose(m_actorInstance);
|
||||
|
||||
skeletalMotion->CalcMotionBindPose(actor, pose->GetPose());
|
||||
|
||||
// for all nodes in the actor
|
||||
const uint32 numNodes = actorInstance->GetNumEnabledNodes();
|
||||
for (uint32 n = 0; n < numNodes; ++n)
|
||||
{
|
||||
EMotionFX::Node* curNode = actor->GetSkeleton()->GetNode(actorInstance->GetEnabledNode(n));
|
||||
|
||||
// skip root nodes, you could also use curNode->IsRootNode()
|
||||
// but we use the parent index here, as we will reuse it
|
||||
uint32 parentIndex = curNode->GetParentIndex();
|
||||
if (parentIndex == MCORE_INVALIDINDEX32)
|
||||
{
|
||||
AZ::Vector3 startPos = mGlobalMatrices[curNode->GetNodeIndex()].GetTranslation();
|
||||
AZ::Vector3 endPos = startPos + AZ::Vector3(0.0f, 3.0f, 0.0f);
|
||||
renderUtil->RenderLine(startPos, endPos, MCore::RGBAColor(0.0f, 1.0f, 1.0f));
|
||||
}
|
||||
else
|
||||
{
|
||||
AZ::Vector3 startPos = mGlobalMatrices[curNode->GetNodeIndex()].GetTranslation();
|
||||
AZ::Vector3 endPos = mGlobalMatrices[parentIndex].GetTranslation();
|
||||
renderUtil->RenderLine(startPos, endPos, MCore::RGBAColor(0.0f, 1.0f, 1.0f));
|
||||
}
|
||||
}
|
||||
|
||||
posePool.FreePose(pose);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
||||
+4
-3
@@ -9,7 +9,8 @@
|
||||
// inlude required headers
|
||||
#include "NodeGroupWidget.h"
|
||||
#include "../../../../EMStudioSDK/Source/EMStudioManager.h"
|
||||
#include "AzCore/std/iterator.h"
|
||||
#include <AzCore/std/iterator.h>
|
||||
#include <AzCore/std/limits.h>
|
||||
#include <EMotionFX/Source/NodeGroup.h>
|
||||
#include <MCore/Source/StringConversions.h>
|
||||
|
||||
@@ -332,10 +333,10 @@ namespace EMStudio
|
||||
|
||||
|
||||
// add / select nodes
|
||||
void NodeGroupWidget::NodeSelectionFinished(AZStd::vector<SelectionItem> selectionList)
|
||||
void NodeGroupWidget::NodeSelectionFinished(const AZStd::vector<SelectionItem>& selectionList)
|
||||
{
|
||||
// return if no nodes are selected
|
||||
if (selectionList.size() == 0)
|
||||
if (selectionList.empty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
+1
-1
@@ -45,7 +45,7 @@ namespace EMStudio
|
||||
public slots:
|
||||
void SelectNodesButtonPressed();
|
||||
void RemoveNodesButtonPressed();
|
||||
void NodeSelectionFinished(AZStd::vector<SelectionItem> selectionList);
|
||||
void NodeSelectionFinished(const AZStd::vector<SelectionItem>& selectionList);
|
||||
void OnItemSelectionChanged();
|
||||
|
||||
private:
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@ namespace EMStudio
|
||||
}
|
||||
|
||||
// global mesh information
|
||||
const uint32 lodLevel = actorInstance->GetLODLevel();
|
||||
const size_t lodLevel = actorInstance->GetLODLevel();
|
||||
uint32 numPolygons;
|
||||
actor->CalcMeshTotals(lodLevel, &numPolygons, &m_totalVertices, &m_totalIndices);
|
||||
}
|
||||
|
||||
+1
-1
@@ -35,7 +35,7 @@ namespace EMStudio
|
||||
private:
|
||||
AZStd::string m_name;
|
||||
AZStd::string m_unitType;
|
||||
int m_nodeCount;
|
||||
AZ::u64 m_nodeCount;
|
||||
AZStd::vector<NodeGroupInfo> m_nodeGroups;
|
||||
unsigned int m_totalVertices;
|
||||
unsigned int m_totalIndices;
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ namespace EMStudio
|
||||
{
|
||||
AZ_CLASS_ALLOCATOR_IMPL(MeshInfo, EMStudio::UIAllocator, 0)
|
||||
|
||||
MeshInfo::MeshInfo(EMotionFX::Actor* actor, [[maybe_unused]] EMotionFX::Node* node, unsigned int lodLevel, EMotionFX::Mesh* mesh)
|
||||
MeshInfo::MeshInfo(EMotionFX::Actor* actor, [[maybe_unused]] EMotionFX::Node* node, size_t lodLevel, EMotionFX::Mesh* mesh)
|
||||
: m_lod(lodLevel)
|
||||
{
|
||||
// vertices, indices and polygons etc.
|
||||
|
||||
+2
-2
@@ -30,13 +30,13 @@ namespace EMStudio
|
||||
AZ_CLASS_ALLOCATOR_DECL
|
||||
|
||||
MeshInfo() {}
|
||||
MeshInfo(EMotionFX::Actor* actor, EMotionFX::Node* node, unsigned int lodLevel, EMotionFX::Mesh* mesh);
|
||||
MeshInfo(EMotionFX::Actor* actor, EMotionFX::Node* node, size_t lodLevel, EMotionFX::Mesh* mesh);
|
||||
~MeshInfo() = default;
|
||||
|
||||
static void Reflect(AZ::ReflectContext* context);
|
||||
|
||||
private:
|
||||
unsigned int m_lod;
|
||||
AZ::u64 m_lod;
|
||||
unsigned int m_verticesCount;
|
||||
unsigned int m_indicesCount;
|
||||
unsigned int m_polygonsCount;
|
||||
|
||||
+7
-7
@@ -23,7 +23,7 @@ namespace EMStudio
|
||||
|
||||
NodeInfo::NodeInfo(EMotionFX::ActorInstance* actorInstance, EMotionFX::Node* node)
|
||||
{
|
||||
const uint32 nodeIndex = node->GetNodeIndex();
|
||||
const size_t nodeIndex = node->GetNodeIndex();
|
||||
|
||||
EMotionFX::Actor* actor = actorInstance->GetActor();
|
||||
EMotionFX::TransformData* transformData = actorInstance->GetTransformData();
|
||||
@@ -60,24 +60,24 @@ namespace EMStudio
|
||||
}
|
||||
|
||||
// children
|
||||
const uint32 numChildren = node->GetNumChildNodes();
|
||||
for (uint32 i = 0; i < numChildren; ++i)
|
||||
const size_t numChildren = node->GetNumChildNodes();
|
||||
for (size_t i = 0; i < numChildren; ++i)
|
||||
{
|
||||
EMotionFX::Node* child = actor->GetSkeleton()->GetNode(node->GetChildIndex(i));
|
||||
m_childNodeNames.emplace_back(child->GetNameString());
|
||||
}
|
||||
|
||||
// attributes
|
||||
const uint32 numAttributes = node->GetNumAttributes();
|
||||
for (uint32 i = 0; i < numAttributes; ++i)
|
||||
const size_t numAttributes = node->GetNumAttributes();
|
||||
for (size_t i = 0; i < numAttributes; ++i)
|
||||
{
|
||||
EMotionFX::NodeAttribute* nodeAttribute = node->GetAttribute(i);
|
||||
m_attributeTypes.emplace_back(nodeAttribute->GetTypeString());
|
||||
}
|
||||
|
||||
// meshes
|
||||
const uint32 numLODLevels = actor->GetNumLODLevels();
|
||||
for (uint32 i = 0; i < numLODLevels; ++i)
|
||||
const size_t numLODLevels = actor->GetNumLODLevels();
|
||||
for (size_t i = 0; i < numLODLevels; ++i)
|
||||
{
|
||||
EMotionFX::Mesh* mesh = actor->GetMesh(i, node->GetNodeIndex());
|
||||
if (mesh)
|
||||
|
||||
+2
-2
@@ -82,8 +82,8 @@ namespace EMStudio
|
||||
|
||||
AZStd::string mString;
|
||||
AZStd::string mTempGroupName;
|
||||
AZStd::unordered_set<AZ::u32> m_visibleNodeIndices;
|
||||
AZStd::unordered_set<AZ::u32> m_selectedNodeIndices;
|
||||
AZStd::unordered_set<size_t> m_visibleNodeIndices;
|
||||
AZStd::unordered_set<size_t> m_selectedNodeIndices;
|
||||
|
||||
AZStd::unique_ptr<ActorInfo> m_actorInfo;
|
||||
AZStd::unique_ptr<NodeInfo> m_nodeInfo;
|
||||
|
||||
+6
-6
@@ -126,8 +126,8 @@ namespace EMStudio
|
||||
{
|
||||
mActor = actor;
|
||||
|
||||
const uint32 numActorInstances = EMotionFX::GetActorManager().GetNumActorInstances();
|
||||
for (uint32 i = 0; i < numActorInstances; ++i)
|
||||
const size_t numActorInstances = EMotionFX::GetActorManager().GetNumActorInstances();
|
||||
for (size_t i = 0; i < numActorInstances; ++i)
|
||||
{
|
||||
EMotionFX::ActorInstance* currentInstance = EMotionFX::GetActorManager().GetActorInstance(i);
|
||||
if (currentInstance->GetActor() == actor)
|
||||
@@ -198,8 +198,8 @@ namespace EMStudio
|
||||
AZStd::vector<SelectionItem> jointsExcludedFromBounds;
|
||||
if (mActorInstance)
|
||||
{
|
||||
const uint32 numNodes = mActor->GetNumNodes();
|
||||
for (uint32 i = 0; i < numNodes; ++i)
|
||||
const size_t numNodes = mActor->GetNumNodes();
|
||||
for (size_t i = 0; i < numNodes; ++i)
|
||||
{
|
||||
EMotionFX::Node* node = mActor->GetSkeleton()->GetNode(i);
|
||||
if (!node->GetIncludeInBoundsCalc())
|
||||
@@ -395,10 +395,10 @@ namespace EMStudio
|
||||
|
||||
EMotionFX::Actor* actor = actorInstance->GetActor();
|
||||
EMotionFX::Skeleton* skeleton = actor->GetSkeleton();
|
||||
const uint32 numJoints = mActor->GetNumNodes();
|
||||
const size_t numJoints = mActor->GetNumNodes();
|
||||
|
||||
// Include all joints first.
|
||||
for (uint32 i = 0; i < numJoints; ++i)
|
||||
for (size_t i = 0; i < numJoints; ++i)
|
||||
{
|
||||
skeleton->GetNode(i)->SetIncludeInBoundsCalc(true);
|
||||
}
|
||||
|
||||
+28
-47
@@ -111,9 +111,9 @@ namespace EMStudio
|
||||
m_treeWidget->clear();
|
||||
|
||||
// iterate trough all actors and add them to the tree including their instances
|
||||
const uint32 numActors = EMotionFX::GetActorManager().GetNumActors();
|
||||
const uint32 numActorInstances = EMotionFX::GetActorManager().GetNumActorInstances();
|
||||
for (uint32 i = 0; i < numActors; ++i)
|
||||
const size_t numActors = EMotionFX::GetActorManager().GetNumActors();
|
||||
const size_t numActorInstances = EMotionFX::GetActorManager().GetNumActorInstances();
|
||||
for (size_t i = 0; i < numActors; ++i)
|
||||
{
|
||||
EMotionFX::Actor* actor = EMotionFX::GetActorManager().GetActor(i);
|
||||
|
||||
@@ -153,7 +153,7 @@ namespace EMStudio
|
||||
// add as top level item
|
||||
m_treeWidget->addTopLevelItem(newItem);
|
||||
|
||||
for (uint32 k = 0; k < numActorInstances; ++k)
|
||||
for (size_t k = 0; k < numActorInstances; ++k)
|
||||
{
|
||||
EMotionFX::ActorInstance* actorInstance = EMotionFX::GetActorManager().GetActorInstance(k);
|
||||
if (actorInstance->GetActor() == actor && !actorInstance->GetIsOwnedByRuntime())
|
||||
@@ -188,8 +188,8 @@ namespace EMStudio
|
||||
// disable signals
|
||||
m_treeWidget->blockSignals(true);
|
||||
|
||||
const uint32 numTopLevelItems = m_treeWidget->topLevelItemCount();
|
||||
for (uint32 i = 0; i < numTopLevelItems; ++i)
|
||||
const int numTopLevelItems = m_treeWidget->topLevelItemCount();
|
||||
for (int i = 0; i < numTopLevelItems; ++i)
|
||||
{
|
||||
bool atLeastOneInstanceVisible = false;
|
||||
QTreeWidgetItem* item = m_treeWidget->topLevelItem(i);
|
||||
@@ -199,8 +199,8 @@ namespace EMStudio
|
||||
|
||||
item->setSelected(actorSelected);
|
||||
|
||||
const uint32 numChildren = item->childCount();
|
||||
for (uint32 j = 0; j < numChildren; ++j)
|
||||
const int numChildren = item->childCount();
|
||||
for (int j = 0; j < numChildren; ++j)
|
||||
{
|
||||
QTreeWidgetItem* child = item->child(j);
|
||||
EMotionFX::ActorInstance* actorInstance = EMotionFX::GetActorManager().FindActorInstanceByID(GetIDFromTreeItem(child));
|
||||
@@ -236,10 +236,8 @@ namespace EMStudio
|
||||
AZStd::vector<EMotionFX::Actor*> toBeRemovedActors;
|
||||
|
||||
const QList<QTreeWidgetItem*> items = m_treeWidget->selectedItems();
|
||||
const uint32 numItems = items.length();
|
||||
for (uint32 i = 0; i < numItems; ++i)
|
||||
for (const QTreeWidgetItem* item : items)
|
||||
{
|
||||
QTreeWidgetItem* item = items[i];
|
||||
if (!item)
|
||||
{
|
||||
continue;
|
||||
@@ -254,8 +252,8 @@ namespace EMStudio
|
||||
if (actor)
|
||||
{
|
||||
// remove actor instances
|
||||
const uint32 numChildren = item->childCount();
|
||||
for (uint32 j = 0; j < numChildren; ++j)
|
||||
const int numChildren = item->childCount();
|
||||
for (int j = 0; j < numChildren; ++j)
|
||||
{
|
||||
QTreeWidgetItem* child = item->child(j);
|
||||
|
||||
@@ -326,11 +324,9 @@ namespace EMStudio
|
||||
|
||||
// filter the list to keep the actor items only
|
||||
const QList<QTreeWidgetItem*> items = m_treeWidget->selectedItems();
|
||||
const uint32 numItems = items.length();
|
||||
for (uint32 i = 0; i < numItems; ++i)
|
||||
for (const QTreeWidgetItem* item : items)
|
||||
{
|
||||
// get the item and check if the item is valid
|
||||
QTreeWidgetItem* item = items[i];
|
||||
if (item == nullptr)
|
||||
{
|
||||
continue;
|
||||
@@ -384,8 +380,8 @@ namespace EMStudio
|
||||
|
||||
if (!item->parent())
|
||||
{
|
||||
const uint32 numChildren = item->childCount();
|
||||
for (uint32 i = 0; i < numChildren; ++i)
|
||||
const int numChildren = item->childCount();
|
||||
for (int i = 0; i < numChildren; ++i)
|
||||
{
|
||||
QTreeWidgetItem* child = item->child(i);
|
||||
|
||||
@@ -422,8 +418,8 @@ namespace EMStudio
|
||||
}
|
||||
|
||||
// get the selected items
|
||||
const uint32 numTopItems = m_treeWidget->topLevelItemCount();
|
||||
for (uint32 i = 0; i < numTopItems; ++i)
|
||||
const int numTopItems = m_treeWidget->topLevelItemCount();
|
||||
for (int i = 0; i < numTopItems; ++i)
|
||||
{
|
||||
// selection of the topLevelItems
|
||||
QTreeWidgetItem* topLevelItem = m_treeWidget->topLevelItem(i);
|
||||
@@ -439,8 +435,8 @@ namespace EMStudio
|
||||
}
|
||||
|
||||
// loop trough the children and adjust selection there
|
||||
uint32 numChilds = topLevelItem->childCount();
|
||||
for (uint32 j = 0; j < numChilds; ++j)
|
||||
int numChilds = topLevelItem->childCount();
|
||||
for (int j = 0; j < numChilds; ++j)
|
||||
{
|
||||
QTreeWidgetItem* child = topLevelItem->child(j);
|
||||
if (child->isSelected())
|
||||
@@ -486,20 +482,15 @@ namespace EMStudio
|
||||
|
||||
void ActorsWindow::contextMenuEvent(QContextMenuEvent* event)
|
||||
{
|
||||
const QList<QTreeWidgetItem*> items = m_treeWidget->selectedItems();
|
||||
|
||||
// get number of selected items and top level items
|
||||
const uint32 numSelected = items.size();
|
||||
const uint32 numTopItems = m_treeWidget->topLevelItemCount();
|
||||
const QList<QTreeWidgetItem*> items = m_treeWidget->selectedItems();
|
||||
|
||||
// create the context menu
|
||||
QMenu menu(this);
|
||||
menu.setToolTipsVisible(true);
|
||||
|
||||
bool actorSelected = false;
|
||||
for (uint32 i = 0; i < numSelected; ++i)
|
||||
for (const QTreeWidgetItem* item : items)
|
||||
{
|
||||
QTreeWidgetItem* item = items[i];
|
||||
if (item->parent() == nullptr)
|
||||
{
|
||||
actorSelected = true;
|
||||
@@ -518,7 +509,7 @@ namespace EMStudio
|
||||
}
|
||||
}
|
||||
|
||||
if (numSelected > 0)
|
||||
if (!items.empty())
|
||||
{
|
||||
if (instanceSelected)
|
||||
{
|
||||
@@ -546,7 +537,7 @@ namespace EMStudio
|
||||
connect(removeAction, &QAction::triggered, this, &ActorsWindow::OnRemoveButtonClicked);
|
||||
}
|
||||
|
||||
if (numTopItems > 0)
|
||||
if (m_treeWidget->topLevelItemCount() > 0)
|
||||
{
|
||||
QAction* clearAction = menu.addAction("Remove all");
|
||||
connect(clearAction, &QAction::triggered, this, &ActorsWindow::OnClearButtonClicked);
|
||||
@@ -596,24 +587,16 @@ namespace EMStudio
|
||||
|
||||
// get number of selected items and top level items
|
||||
const QList<QTreeWidgetItem*> items = m_treeWidget->selectedItems();
|
||||
const uint32 numSelected = items.size();
|
||||
const uint32 numTopItems = m_treeWidget->topLevelItemCount();
|
||||
|
||||
// check if at least one actor selected
|
||||
bool actorSelected = false;
|
||||
for (uint32 i = 0; i < numSelected; ++i)
|
||||
const bool actorSelected = AZStd::any_of(items.begin(), items.end(), [](const QTreeWidgetItem* item)
|
||||
{
|
||||
QTreeWidgetItem* item = items[i];
|
||||
if (item->parent() == nullptr)
|
||||
{
|
||||
actorSelected = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return item->parent() == nullptr;
|
||||
});
|
||||
|
||||
// set the enabled state of the buttons
|
||||
m_createInstanceAction->setEnabled(actorSelected);
|
||||
m_saveAction->setEnabled(numSelected != 0);
|
||||
m_saveAction->setEnabled(!items.empty());
|
||||
}
|
||||
|
||||
|
||||
@@ -623,11 +606,9 @@ namespace EMStudio
|
||||
|
||||
// create the instances of the selected actors
|
||||
const QList<QTreeWidgetItem*> items = m_treeWidget->selectedItems();
|
||||
const uint32 numItems = items.length();
|
||||
for (uint32 i = 0; i < numItems; ++i)
|
||||
for (const QTreeWidgetItem* item : items)
|
||||
{
|
||||
// check if parent or child item
|
||||
QTreeWidgetItem* item = items[i];
|
||||
if (item == nullptr || item->parent() == nullptr)
|
||||
{
|
||||
continue;
|
||||
@@ -652,7 +633,7 @@ namespace EMStudio
|
||||
}
|
||||
|
||||
|
||||
uint32 ActorsWindow::GetIDFromTreeItem(QTreeWidgetItem* item)
|
||||
uint32 ActorsWindow::GetIDFromTreeItem(const QTreeWidgetItem* item)
|
||||
{
|
||||
if (item == nullptr)
|
||||
{
|
||||
|
||||
+1
-1
@@ -52,7 +52,7 @@ namespace EMStudio
|
||||
void keyReleaseEvent(QKeyEvent* event) override;
|
||||
|
||||
void SetControlsEnabled();
|
||||
uint32 GetIDFromTreeItem(QTreeWidgetItem* item);
|
||||
uint32 GetIDFromTreeItem(const QTreeWidgetItem* item);
|
||||
void SetVisibilityFlags(bool isVisible);
|
||||
|
||||
private:
|
||||
|
||||
+3
-5
@@ -25,8 +25,8 @@ namespace EMStudio
|
||||
{
|
||||
void SaveDirtyActorFilesCallback::GetDirtyFileNames(AZStd::vector<AZStd::string>* outFileNames, AZStd::vector<ObjectPointer>* outObjects)
|
||||
{
|
||||
const uint32 numLeaderActors = EMotionFX::GetActorManager().GetNumActors();
|
||||
for (uint32 i = 0; i < numLeaderActors; ++i)
|
||||
const size_t numLeaderActors = EMotionFX::GetActorManager().GetNumActors();
|
||||
for (size_t i = 0; i < numLeaderActors; ++i)
|
||||
{
|
||||
EMotionFX::Actor* actor = EMotionFX::GetActorManager().GetActor(i);
|
||||
|
||||
@@ -49,11 +49,9 @@ namespace EMStudio
|
||||
{
|
||||
MCORE_UNUSED(filenamesToSave);
|
||||
|
||||
const size_t numObjects = objects.size();
|
||||
for (size_t i = 0; i < numObjects; ++i)
|
||||
for (const ObjectPointer& objPointer : objects)
|
||||
{
|
||||
// get the current object pointer and skip directly if the type check fails
|
||||
ObjectPointer objPointer = objects[i];
|
||||
if (objPointer.mActor == nullptr)
|
||||
{
|
||||
continue;
|
||||
|
||||
+2
-2
@@ -129,8 +129,8 @@ namespace EMStudio
|
||||
return false;
|
||||
}
|
||||
|
||||
const AZ::u32 numActorInstances = EMotionFX::GetActorManager().GetNumActorInstances();
|
||||
for (AZ::u32 i = 0; i < numActorInstances; ++i)
|
||||
const size_t numActorInstances = EMotionFX::GetActorManager().GetNumActorInstances();
|
||||
for (size_t i = 0; i < numActorInstances; ++i)
|
||||
{
|
||||
EMotionFX::ActorInstance* actorInstance = EMotionFX::GetActorManager().GetActorInstance(i);
|
||||
|
||||
|
||||
+3
-3
@@ -81,7 +81,7 @@ namespace EMStudio
|
||||
{
|
||||
const CommandSystem::SelectionList& selection = CommandSystem::GetCommandManager()->GetCurrentSelection();
|
||||
|
||||
const uint32 numSelectedMotions = selection.GetNumSelectedMotions();
|
||||
const size_t numSelectedMotions = selection.GetNumSelectedMotions();
|
||||
const bool isEnabled = (numSelectedMotions == 1);
|
||||
|
||||
m_loopForeverAction->setEnabled(isEnabled);
|
||||
@@ -98,8 +98,8 @@ namespace EMStudio
|
||||
MotionWindowPlugin* motionWindowPlugin = TimeViewToolBar::GetMotionWindowPlugin();
|
||||
if (motionWindowPlugin)
|
||||
{
|
||||
const uint32 numMotions = selection.GetNumSelectedMotions();
|
||||
for (uint32 i = 0; i < numMotions; ++i)
|
||||
const size_t numMotions = selection.GetNumSelectedMotions();
|
||||
for (size_t i = 0; i < numMotions; ++i)
|
||||
{
|
||||
MotionWindowPlugin::MotionTableEntry* entry = motionWindowPlugin->FindMotionEntryByID(selection.GetMotion(i)->GetID());
|
||||
if (!entry)
|
||||
|
||||
+4
-7
@@ -163,10 +163,9 @@ namespace EMStudio
|
||||
{
|
||||
if (delFromMem)
|
||||
{
|
||||
const size_t numElems = mElements.size();
|
||||
for (size_t i = 0; i < numElems; ++i)
|
||||
for (TimeTrackElement* mElement : mElements)
|
||||
{
|
||||
delete mElements[i];
|
||||
delete mElement;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -175,7 +174,7 @@ namespace EMStudio
|
||||
|
||||
|
||||
// get the track element at a given pixel
|
||||
TimeTrackElement* TimeTrack::GetElementAt(int32 x, int32 y)
|
||||
TimeTrackElement* TimeTrack::GetElementAt(int32 x, int32 y) const
|
||||
{
|
||||
if (mVisible == false)
|
||||
{
|
||||
@@ -183,11 +182,9 @@ namespace EMStudio
|
||||
}
|
||||
|
||||
// for all elements
|
||||
const size_t numElems = mElements.size();
|
||||
for (size_t i = 0; i < numElems; ++i)
|
||||
for (TimeTrackElement* element : mElements)
|
||||
{
|
||||
// check if its inside
|
||||
TimeTrackElement* element = mElements[i];
|
||||
if (element->GetIsVisible() == false)
|
||||
{
|
||||
continue;
|
||||
|
||||
+2
-2
@@ -78,7 +78,7 @@ namespace EMStudio
|
||||
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) { return (y >= mStartY) && (y <= (mStartY + mHeight)); }
|
||||
bool GetIsInside(uint32 y) const { return (y >= mStartY) && (y <= (mStartY + mHeight)); }
|
||||
|
||||
void SetName(const char* name) { mName = name; }
|
||||
const char* GetName() const { return mName.c_str(); }
|
||||
@@ -95,7 +95,7 @@ namespace EMStudio
|
||||
MCORE_INLINE bool GetIsHighlighted() const { return mIsHighlighted; }
|
||||
MCORE_INLINE void SetIsHighlighted(bool enabled) { mIsHighlighted = enabled; }
|
||||
|
||||
TimeTrackElement* GetElementAt(int32 x, int32 y);
|
||||
TimeTrackElement* GetElementAt(int32 x, int32 y) const;
|
||||
|
||||
protected:
|
||||
AZStd::string mName;
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ namespace EMStudio
|
||||
int32 TimeTrackElement::mTickHalfWidth = 7;
|
||||
|
||||
// constructor
|
||||
TimeTrackElement::TimeTrackElement(const char* name, TimeTrack* timeTrack, uint32 elementNumber, QColor color)
|
||||
TimeTrackElement::TimeTrackElement(const char* name, TimeTrack* timeTrack, size_t elementNumber, QColor color)
|
||||
{
|
||||
mTrack = timeTrack;
|
||||
mName = name;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user