From b335285e19aae79fb0535211ab2e4713f739f30a Mon Sep 17 00:00:00 2001 From: Benjamin Jillich Date: Tue, 3 Aug 2021 17:13:19 +0200 Subject: [PATCH] Removed OBB rendering helpers and color options (was already hidden from the UI) Signed-off-by: Benjamin Jillich --- .../EMotionFX/Rendering/Common/RenderUtil.cpp | 71 ------------------- .../EMotionFX/Rendering/Common/RenderUtil.h | 12 ---- Gems/EMotionFX/Code/EMotionFX/Source/Node.cpp | 1 - .../Source/RenderPlugin/RenderOptions.cpp | 23 ------ .../Source/RenderPlugin/RenderOptions.h | 6 -- .../Source/RenderPlugin/RenderPlugin.cpp | 4 -- .../RenderPlugin/RenderUpdateCallback.cpp | 4 -- .../Source/RenderPlugin/RenderViewWidget.cpp | 3 - .../Source/RenderPlugin/RenderViewWidget.h | 1 - 9 files changed, 125 deletions(-) diff --git a/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/RenderUtil.cpp b/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/RenderUtil.cpp index 36bce97f88..8464cb2b2a 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/RenderUtil.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/RenderUtil.cpp @@ -403,77 +403,6 @@ namespace MCommon } } - - // render object orientated bounding boxes for all enabled nodes inside the actor instance - void RenderUtil::RenderOBBs(EMotionFX::ActorInstance* actorInstance, const AZStd::unordered_set* visibleJointIndices, const AZStd::unordered_set* selectedJointIndices, const MCore::RGBAColor& color, const MCore::RGBAColor& selectedColor, bool directlyRender) - { - AZ::Vector3 p[8]; - - // get the actor it is an instance from - const EMotionFX::Actor* actor = actorInstance->GetActor(); - const EMotionFX::Skeleton* skeleton = actor->GetSkeleton(); - const EMotionFX::Pose* pose = actorInstance->GetTransformData()->GetCurrentPose(); - - // iterate through all enabled nodes - MCore::RGBAColor tempColor; - const uint32 numEnabled = actorInstance->GetNumEnabledNodes(); - for (uint32 i = 0; i < numEnabled; ++i) - { - const EMotionFX::Node* joint = skeleton->GetNode(actorInstance->GetEnabledNode(i)); - const AZ::u32 jointIndex = joint->GetNodeIndex(); - - if (!visibleJointIndices || visibleJointIndices->empty() || - (visibleJointIndices->find(jointIndex) != visibleJointIndices->end())) - { - const MCore::OBB& obb = actor->GetNodeOBB(jointIndex); - EMotionFX::Transform worldTransform = pose->GetWorldSpaceTransform(jointIndex); - - // skip the OBB if it isn't valid - if (obb.CheckIfIsValid() == false) - { - continue; - } - - // check if the current bone is selected and set the color according to it - if (selectedJointIndices && selectedJointIndices->find(jointIndex) != selectedJointIndices->end()) - { - tempColor = selectedColor; - } - else - { - tempColor = color; - } - - obb.CalcCornerPoints(p); - for (uint32 a = 0; a < 8; a++) - { - p[a] = worldTransform.TransformPoint(p[a]); - } - - // render - RenderLine(p[0], p[1], tempColor); - RenderLine(p[1], p[2], tempColor); - RenderLine(p[2], p[3], tempColor); - RenderLine(p[0], p[3], tempColor); - - RenderLine(p[1], p[5], tempColor); - RenderLine(p[3], p[7], tempColor); - RenderLine(p[2], p[6], tempColor); - RenderLine(p[0], p[4], tempColor); - - RenderLine(p[4], p[5], tempColor); - RenderLine(p[4], p[7], tempColor); - RenderLine(p[6], p[7], tempColor); - RenderLine(p[6], p[5], tempColor); - } - } - - if (directlyRender) - { - RenderLines(); - } - } - // render wireframe mesh void RenderUtil::RenderWireframe(EMotionFX::Mesh* mesh, const AZ::Transform& worldTM, const MCore::RGBAColor& color, bool directlyRender, float offsetScale) { diff --git a/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/RenderUtil.h b/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/RenderUtil.h index 5c5d7bbef8..f63d41e812 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/RenderUtil.h +++ b/Gems/EMotionFX/Code/EMotionFX/Rendering/Common/RenderUtil.h @@ -167,18 +167,6 @@ namespace MCommon */ void RenderAabbs(EMotionFX::ActorInstance* actorInstance, const AABBRenderSettings& renderSettings = AABBRenderSettings(), bool directlyRender = false); - /** - * Render OBB for all enabled nodes inside the actor instance. - * @param actorInstance A pointer to the actor instance which will be rendered. - * @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. - * @param[in] color The color of the OBBs. - * @param[in] selectedColor The color of the selected OBBs. - * @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 RenderOBBs(EMotionFX::ActorInstance* actorInstance, const AZStd::unordered_set* visibleJointIndices = nullptr, const AZStd::unordered_set* 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), bool directlyRender = false); - /** * Render a simple line based skeleton for all enabled nodes of the actor instance. * @param[in] actorInstance A pointer to the actor instance which will be rendered. diff --git a/Gems/EMotionFX/Code/EMotionFX/Source/Node.cpp b/Gems/EMotionFX/Code/EMotionFX/Source/Node.cpp index 2aa6b796ab..8ab7fa540d 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Source/Node.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Source/Node.cpp @@ -98,7 +98,6 @@ namespace EMotionFX result->mChildIndices = mChildIndices; //result->mImportanceFactor = mImportanceFactor; result->mNodeFlags = mNodeFlags; - result->mOBB = mOBB; result->mSemanticNameID = mSemanticNameID; // copy the node attributes diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/RenderPlugin/RenderOptions.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/RenderPlugin/RenderOptions.cpp index 5e57d64167..274edd36ce 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/RenderPlugin/RenderOptions.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/RenderPlugin/RenderOptions.cpp @@ -55,7 +55,6 @@ namespace EMStudio const char* RenderOptions::s_nodeAABBColorOptionName = "nodeAABBColor"; const char* RenderOptions::s_staticAABBColorOptionName = "staticAABBColor"; const char* RenderOptions::s_meshAABBColorOptionName = "meshAABBColor"; - const char* RenderOptions::s_OBBsColorOptionName = "OBBsColor"; const char* RenderOptions::s_lineSkeletonColorOptionName = "lineSkeletonColor_v2"; const char* RenderOptions::s_skeletonColorOptionName = "skeletonColor"; const char* RenderOptions::s_selectionColorOptionName = "selectionColor"; @@ -107,7 +106,6 @@ namespace EMStudio , m_nodeAABBColor(1.0f, 0.0f, 0.0f, 1.0f) , m_staticAABBColor(0.0f, 0.7f, 0.7f, 1.0f) , m_meshAABBColor(0.0f, 0.0f, 0.7f, 1.0f) - , m_OBBsColor(1.0f, 1.0f, 0.0f, 1.0f) , m_lineSkeletonColor(0.33333f, 1.0f, 0.0f, 1.0f) , m_skeletonColor(0.19f, 0.58f, 0.19f, 1.0f) , m_selectionColor(1.0f, 1.0f, 1.0f, 1.0f) @@ -167,7 +165,6 @@ namespace EMStudio SetNodeAABBColor(other.GetNodeAABBColor()); SetStaticAABBColor(other.GetStaticAABBColor()); SetMeshAABBColor(other.GetMeshAABBColor()); - SetOBBsColor(other.GetOBBsColor()); SetLineSkeletonColor(other.GetLineSkeletonColor()); SetSkeletonColor(other.GetSkeletonColor()); SetSelectionColor(other.GetSelectionColor()); @@ -204,7 +201,6 @@ namespace EMStudio settings->setValue(s_staticAABBColorOptionName, ColorToString(m_staticAABBColor)); settings->setValue(s_meshAABBColorOptionName, ColorToString(m_meshAABBColor)); settings->setValue(s_collisionMeshColorOptionName, ColorToString(m_collisionMeshColor)); - settings->setValue(s_OBBsColorOptionName, ColorToString(m_OBBsColor)); settings->setValue(s_lineSkeletonColorOptionName, ColorToString(m_lineSkeletonColor)); settings->setValue(s_skeletonColorOptionName, ColorToString(m_skeletonColor)); settings->setValue(s_selectionColorOptionName, ColorToString(m_selectionColor)); @@ -272,7 +268,6 @@ namespace EMStudio options.m_staticAABBColor = StringToColor(settings->value(s_staticAABBColorOptionName, ColorToString(options.m_staticAABBColor)).toString()); options.m_meshAABBColor = StringToColor(settings->value(s_meshAABBColorOptionName, ColorToString(options.m_meshAABBColor)).toString()); options.m_collisionMeshColor = StringToColor(settings->value(s_collisionMeshColorOptionName, ColorToString(options.m_collisionMeshColor)).toString()); - options.m_OBBsColor = StringToColor(settings->value(s_OBBsColorOptionName, ColorToString(options.m_OBBsColor)).toString()); options.m_lineSkeletonColor = StringToColor(settings->value(s_lineSkeletonColorOptionName, ColorToString(options.m_lineSkeletonColor)).toString()); options.m_skeletonColor = StringToColor(settings->value(s_skeletonColorOptionName, ColorToString(options.m_skeletonColor)).toString()); options.m_selectionColor = StringToColor(settings->value(s_selectionColorOptionName, ColorToString(options.m_selectionColor)).toString()); @@ -388,7 +383,6 @@ namespace EMStudio ->Field(s_nodeAABBColorOptionName, &RenderOptions::m_nodeAABBColor) ->Field(s_staticAABBColorOptionName, &RenderOptions::m_staticAABBColor) ->Field(s_meshAABBColorOptionName, &RenderOptions::m_meshAABBColor) - ->Field(s_OBBsColorOptionName, &RenderOptions::m_OBBsColor) ->Field(s_lineSkeletonColorOptionName, &RenderOptions::m_lineSkeletonColor) ->Field(s_skeletonColorOptionName, &RenderOptions::m_skeletonColor) ->Field(s_selectionColorOptionName, &RenderOptions::m_selectionColor) @@ -546,9 +540,6 @@ namespace EMStudio ->DataElement(AZ::Edit::UIHandlers::Default, &RenderOptions::m_meshAABBColor, "Mesh based AABB color", "Color for the runtime-updated AABB calculated based on the deformed meshes.") ->Attribute(AZ::Edit::Attributes::ChangeNotify, &RenderOptions::OnMeshAABBColorChangedCallback) - ->DataElement(AZ::Edit::UIHandlers::Default, &RenderOptions::m_OBBsColor, "Joint OBB color", - "Color used for the pre-calculated joint oriented bounding boxes.") - ->Attribute(AZ::Edit::Attributes::ChangeNotify, &RenderOptions::OnOBBsColorChangedCallback) ->DataElement(AZ::Edit::UIHandlers::Default, &RenderOptions::m_lineSkeletonColor, "Line based skeleton color", "Line-based skeleton color.") ->Attribute(AZ::Edit::Attributes::ChangeNotify, &RenderOptions::OnLineSkeletonColorChangedCallback) @@ -894,15 +885,6 @@ namespace EMStudio } } - void RenderOptions::SetOBBsColor(const AZ::Color& OBBsColor) - { - if (!OBBsColor.IsClose(m_OBBsColor)) - { - m_OBBsColor = OBBsColor; - OnOBBsColorChangedCallback(); - } - } - void RenderOptions::SetLineSkeletonColor(const AZ::Color& lineSkeletonColor) { if (!lineSkeletonColor.IsClose(m_lineSkeletonColor)) @@ -1240,11 +1222,6 @@ namespace EMStudio PluginOptionsNotificationsBus::Event(s_meshAABBColorOptionName, &PluginOptionsNotificationsBus::Events::OnOptionChanged, s_meshAABBColorOptionName); } - void RenderOptions::OnOBBsColorChangedCallback() const - { - PluginOptionsNotificationsBus::Event(s_OBBsColorOptionName, &PluginOptionsNotificationsBus::Events::OnOptionChanged, s_OBBsColorOptionName); - } - void RenderOptions::OnLineSkeletonColorChangedCallback() const { PluginOptionsNotificationsBus::Event(s_lineSkeletonColorOptionName, &PluginOptionsNotificationsBus::Events::OnOptionChanged, s_lineSkeletonColorOptionName); diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/RenderPlugin/RenderOptions.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/RenderPlugin/RenderOptions.h index 5e12cf935f..60f7aa1291 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/RenderPlugin/RenderOptions.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/RenderPlugin/RenderOptions.h @@ -59,7 +59,6 @@ namespace EMStudio static const char* s_nodeAABBColorOptionName; static const char* s_staticAABBColorOptionName; static const char* s_meshAABBColorOptionName; - static const char* s_OBBsColorOptionName; static const char* s_lineSkeletonColorOptionName; static const char* s_skeletonColorOptionName; static const char* s_selectionColorOptionName; @@ -190,9 +189,6 @@ namespace EMStudio AZ::Color GetMeshAABBColor() const { return m_meshAABBColor; } void SetMeshAABBColor(const AZ::Color& meshAABBColor); - AZ::Color GetOBBsColor() const { return m_OBBsColor; } - void SetOBBsColor(const AZ::Color& OBBsColor); - AZ::Color GetLineSkeletonColor() const { return m_lineSkeletonColor; } void SetLineSkeletonColor(const AZ::Color& lineSkeletonColor); @@ -299,7 +295,6 @@ namespace EMStudio void OnNodeAABBColorChangedCallback() const; void OnStaticAABBColorChangedCallback() const; void OnMeshAABBColorChangedCallback() const; - void OnOBBsColorChangedCallback() const; void OnLineSkeletonColorChangedCallback() const; void OnSkeletonColorChangedCallback() const; void OnSelectionColorChangedCallback() const; @@ -356,7 +351,6 @@ namespace EMStudio AZ::Color m_nodeAABBColor; AZ::Color m_staticAABBColor; AZ::Color m_meshAABBColor; - AZ::Color m_OBBsColor; AZ::Color m_lineSkeletonColor; AZ::Color m_skeletonColor; AZ::Color m_selectionColor; diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/RenderPlugin/RenderPlugin.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/RenderPlugin/RenderPlugin.cpp index e4663750ce..ef281b8301 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/RenderPlugin/RenderPlugin.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/RenderPlugin/RenderPlugin.cpp @@ -1160,10 +1160,6 @@ namespace EMStudio renderUtil->RenderAabbs(actorInstance, settings); } - if (widget->GetRenderFlag(RenderViewWidget::RENDER_OBB)) - { - renderUtil->RenderOBBs(actorInstance, &visibleJointIndices, &selectedJointIndices, renderOptions->GetOBBsColor(), renderOptions->GetSelectedObjectColor()); - } if (widget->GetRenderFlag(RenderViewWidget::RENDER_LINESKELETON)) { const MCommon::Camera* camera = widget->GetRenderWidget()->GetCamera(); diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/RenderPlugin/RenderUpdateCallback.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/RenderPlugin/RenderUpdateCallback.cpp index fed309d2e5..6de228fa52 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/RenderPlugin/RenderUpdateCallback.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/RenderPlugin/RenderUpdateCallback.cpp @@ -174,10 +174,6 @@ namespace EMStudio renderUtil->RenderAabbs(actorInstance, settings); } - if (widget->GetRenderFlag(RenderViewWidget::RENDER_OBB)) - { - renderUtil->RenderOBBs(actorInstance, &visibleJointIndices, &selectedJointIndices, renderOptions->GetOBBsColor(), renderOptions->GetSelectedObjectColor()); - } if (widget->GetRenderFlag(RenderViewWidget::RENDER_LINESKELETON)) { renderUtil->RenderSimpleSkeleton(actorInstance, &visibleJointIndices, &selectedJointIndices, renderOptions->GetLineSkeletonColor(), renderOptions->GetSelectedObjectColor()); diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/RenderPlugin/RenderViewWidget.cpp b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/RenderPlugin/RenderViewWidget.cpp index 76e1a1e7f3..55699c165f 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/RenderPlugin/RenderViewWidget.cpp +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/RenderPlugin/RenderViewWidget.cpp @@ -108,7 +108,6 @@ namespace EMStudio CreateViewOptionEntry(contextMenu, "Face Normals", RENDER_FACENORMALS); CreateViewOptionEntry(contextMenu, "Tangents", RENDER_TANGENTS); CreateViewOptionEntry(contextMenu, "Actor Bounding Boxes", RENDER_AABB); - CreateViewOptionEntry(contextMenu, "Joint OBBs", RENDER_OBB, false); CreateViewOptionEntry(contextMenu, "Collision Meshes", RENDER_COLLISIONMESHES, false); contextMenu->addSeparator(); CreateViewOptionEntry(contextMenu, "Line Skeleton", RENDER_LINESKELETON); @@ -233,7 +232,6 @@ namespace EMStudio SetRenderFlag(RENDER_TANGENTS, false); SetRenderFlag(RENDER_AABB, false); - SetRenderFlag(RENDER_OBB, false); SetRenderFlag(RENDER_COLLISIONMESHES, false); SetRenderFlag(RENDER_RAGDOLL_COLLIDERS, true); SetRenderFlag(RENDER_RAGDOLL_JOINTLIMITS, true); @@ -410,7 +408,6 @@ namespace EMStudio } // Override some settings as we removed those from the menu. - SetRenderFlag(RENDER_OBB, false); SetRenderFlag(RENDER_COLLISIONMESHES, false); SetRenderFlag(RENDER_TEXTURING, false); diff --git a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/RenderPlugin/RenderViewWidget.h b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/RenderPlugin/RenderViewWidget.h index 74e5e0ce72..defdb0d2a7 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/RenderPlugin/RenderViewWidget.h +++ b/Gems/EMotionFX/Code/EMotionFX/Tools/EMotionStudio/EMStudioSDK/Source/RenderPlugin/RenderViewWidget.h @@ -52,7 +52,6 @@ namespace EMStudio RENDER_VERTEXNORMALS = 6, RENDER_TANGENTS = 7, RENDER_AABB = 8, - RENDER_OBB = 9, RENDER_COLLISIONMESHES = 10, RENDER_SKELETON = 11, RENDER_LINESKELETON = 12,