Ver Fonte

ran clang-format on the source files and other changes based on the PR comments.

Signed-off-by: Jason Dela Cruz <[email protected]>
Jason Dela Cruz há 2 anos atrás
pai
commit
d756b38541
67 ficheiros alterados com 1736 adições e 1572 exclusões
  1. 61 0
      .clang-format
  2. 1 2
      Gems/O3DE/GeomNodes/Code/Include/GeomNodes/GeomNodesBus.h
  3. 6 20
      Gems/O3DE/GeomNodes/Code/Source/Editor/Common/GNAPI.cpp
  4. 2 2
      Gems/O3DE/GeomNodes/Code/Source/Editor/Common/GNAPI.h
  5. 39 37
      Gems/O3DE/GeomNodes/Code/Source/Editor/Common/GNConstants.h
  6. 1 1
      Gems/O3DE/GeomNodes/Code/Source/Editor/Common/GNEvents.h
  7. 110 111
      Gems/O3DE/GeomNodes/Code/Source/Editor/Components/EditorGeomNodesComponent.cpp
  8. 26 28
      Gems/O3DE/GeomNodes/Code/Source/Editor/Components/EditorGeomNodesComponent.h
  9. 40 40
      Gems/O3DE/GeomNodes/Code/Source/Editor/Components/EditorGeomNodesSystemComponent.cpp
  10. 7 5
      Gems/O3DE/GeomNodes/Code/Source/Editor/Components/EditorGeomNodesSystemComponent.h
  11. 8 11
      Gems/O3DE/GeomNodes/Code/Source/Editor/Configuration/GNConfiguration.cpp
  12. 5 3
      Gems/O3DE/GeomNodes/Code/Source/Editor/Configuration/GNConfiguration.h
  13. 26 18
      Gems/O3DE/GeomNodes/Code/Source/Editor/Configuration/GNEditorSettingsRegistryManager.cpp
  14. 1 1
      Gems/O3DE/GeomNodes/Code/Source/Editor/Configuration/GNEditorSettingsRegistryManager.h
  15. 12 7
      Gems/O3DE/GeomNodes/Code/Source/Editor/Configuration/GNSettingsRegistryManager.cpp
  16. 3 3
      Gems/O3DE/GeomNodes/Code/Source/Editor/EBus/EditorGeomNodesComponentBus.h
  17. 4 2
      Gems/O3DE/GeomNodes/Code/Source/Editor/EBus/IpcHandlerBus.h
  18. 1 2
      Gems/O3DE/GeomNodes/Code/Source/Editor/EBus/ValidatorBus.h
  19. 9 4
      Gems/O3DE/GeomNodes/Code/Source/Editor/Math/MathHelper.cpp
  20. 4 3
      Gems/O3DE/GeomNodes/Code/Source/Editor/Math/MathHelper.h
  21. 14 12
      Gems/O3DE/GeomNodes/Code/Source/Editor/Modules/GeomNodesEditorModule.cpp
  22. 14 14
      Gems/O3DE/GeomNodes/Code/Source/Editor/Rendering/Atom/GNAttributeBuffer.h
  23. 2 3
      Gems/O3DE/GeomNodes/Code/Source/Editor/Rendering/Atom/GNBuffer.h
  24. 239 214
      Gems/O3DE/GeomNodes/Code/Source/Editor/Rendering/GNMeshController.cpp
  25. 52 52
      Gems/O3DE/GeomNodes/Code/Source/Editor/Rendering/GNMeshController.h
  26. 187 148
      Gems/O3DE/GeomNodes/Code/Source/Editor/Rendering/GNMeshData.cpp
  27. 36 35
      Gems/O3DE/GeomNodes/Code/Source/Editor/Rendering/GNMeshData.h
  28. 234 211
      Gems/O3DE/GeomNodes/Code/Source/Editor/Rendering/GNModelData.cpp
  29. 21 20
      Gems/O3DE/GeomNodes/Code/Source/Editor/Rendering/GNModelData.h
  30. 49 48
      Gems/O3DE/GeomNodes/Code/Source/Editor/Rendering/GNRenderMesh.cpp
  31. 14 13
      Gems/O3DE/GeomNodes/Code/Source/Editor/Rendering/GNRenderMesh.h
  32. 35 35
      Gems/O3DE/GeomNodes/Code/Source/Editor/Systems/GNInstance.cpp
  33. 2 1
      Gems/O3DE/GeomNodes/Code/Source/Editor/Systems/GNInstance.h
  34. 4 4
      Gems/O3DE/GeomNodes/Code/Source/Editor/Systems/GNParamContext.cpp
  35. 6 3
      Gems/O3DE/GeomNodes/Code/Source/Editor/Systems/GNParamContext.h
  36. 62 68
      Gems/O3DE/GeomNodes/Code/Source/Editor/Systems/GNProperty.cpp
  37. 35 34
      Gems/O3DE/GeomNodes/Code/Source/Editor/Systems/GNProperty.h
  38. 2 2
      Gems/O3DE/GeomNodes/Code/Source/Editor/Systems/GNSystemInterface.cpp
  39. 15 9
      Gems/O3DE/GeomNodes/Code/Source/Editor/Systems/GNSystemInterface.h
  40. 48 53
      Gems/O3DE/GeomNodes/Code/Source/Editor/Systems/GeomNodesSystem.cpp
  41. 18 17
      Gems/O3DE/GeomNodes/Code/Source/Editor/Systems/GeomNodesSystem.h
  42. 15 12
      Gems/O3DE/GeomNodes/Code/Source/Editor/UI/ConfigurationWidget.cpp
  43. 5 5
      Gems/O3DE/GeomNodes/Code/Source/Editor/UI/ConfigurationWidget.h
  44. 24 13
      Gems/O3DE/GeomNodes/Code/Source/Editor/UI/EditorWindow.cpp
  45. 4 7
      Gems/O3DE/GeomNodes/Code/Source/Editor/UI/EditorWindow.h
  46. 7 8
      Gems/O3DE/GeomNodes/Code/Source/Editor/UI/FunctorValidator.h
  47. 3 3
      Gems/O3DE/GeomNodes/Code/Source/Editor/UI/GeomNodesValidator.cpp
  48. 5 6
      Gems/O3DE/GeomNodes/Code/Source/Editor/UI/GeomNodesValidator.h
  49. 20 10
      Gems/O3DE/GeomNodes/Code/Source/Editor/UI/PropertyFileSelect.cpp
  50. 16 9
      Gems/O3DE/GeomNodes/Code/Source/Editor/UI/PropertyFileSelect.h
  51. 27 16
      Gems/O3DE/GeomNodes/Code/Source/Editor/UI/PropertyFuncValBrowseEdit.cpp
  52. 31 20
      Gems/O3DE/GeomNodes/Code/Source/Editor/UI/PropertyFuncValBrowseEdit.h
  53. 10 12
      Gems/O3DE/GeomNodes/Code/Source/Editor/UI/SettingsWidget.cpp
  54. 4 3
      Gems/O3DE/GeomNodes/Code/Source/Editor/UI/SettingsWidget.h
  55. 25 24
      Gems/O3DE/GeomNodes/Code/Source/Editor/UI/Utils.cpp
  56. 3 3
      Gems/O3DE/GeomNodes/Code/Source/Editor/UI/Utils.h
  57. 0 13
      Gems/O3DE/GeomNodes/Code/Source/Editor/UI/ValidationHandler.cpp
  58. 1 2
      Gems/O3DE/GeomNodes/Code/Source/Editor/UI/ValidationHandler.h
  59. 3 3
      Gems/O3DE/GeomNodes/Code/Source/Editor/UI/Validators.cpp
  60. 7 7
      Gems/O3DE/GeomNodes/Code/Source/Editor/UI/Validators.h
  61. 1 3
      Gems/O3DE/GeomNodes/Code/Source/GeomNodes/Components/GeomNodesSystemComponent.cpp
  62. 1 1
      Gems/O3DE/GeomNodes/Code/Source/GeomNodes/Components/GeomNodesSystemComponent.h
  63. 2 3
      Gems/O3DE/GeomNodes/Code/Source/GeomNodes/Modules/GeomNodesModule.cpp
  64. 10 8
      Gems/O3DE/GeomNodes/Code/Source/GeomNodesModuleInterface.h
  65. 0 2
      Gems/O3DE/GeomNodes/External/Bridge/Bridge.h
  66. 11 28
      Gems/O3DE/GeomNodes/External/Bridge/Ipc.cpp
  67. 46 55
      Gems/O3DE/GeomNodes/External/Bridge/Ipc.h

+ 61 - 0
.clang-format

@@ -0,0 +1,61 @@
+Language: Cpp
+
+AccessModifierOffset: -4
+AlignAfterOpenBracket: AlwaysBreak
+AlignConsecutiveAssignments: false
+AlignConsecutiveDeclarations: false
+AlignEscapedNewlines: Right
+AlignOperands: false
+AlignTrailingComments: false
+AllowAllArgumentsOnNextLine: true
+AllowAllParametersOfDeclarationOnNextLine: true
+AllowShortFunctionsOnASingleLine: None
+AllowShortLambdasOnASingleLine: None
+AlwaysBreakAfterReturnType: None
+AlwaysBreakTemplateDeclarations: true
+BinPackArguments: false
+BinPackParameters: false
+BreakBeforeBraces: Custom
+BraceWrapping:
+    AfterClass: true
+    AfterControlStatement: true
+    AfterEnum: true
+    AfterFunction: true
+    AfterNamespace: true
+    BeforeLambdaBody: true
+    AfterStruct: true
+    BeforeElse: true
+    SplitEmptyFunction: true
+BreakBeforeTernaryOperators: true
+BreakConstructorInitializers: BeforeComma
+BreakInheritanceList: BeforeComma
+ColumnLimit: 140
+ConstructorInitializerIndentWidth: 4
+ContinuationIndentWidth: 4
+Cpp11BracedListStyle: false
+FixNamespaceComments: true
+IncludeBlocks: Preserve
+IndentCaseBlocks: true
+IndentCaseLabels: false
+IndentPPDirectives: None
+IndentWidth: 4
+KeepEmptyLinesAtTheStartOfBlocks: false
+MaxEmptyLinesToKeep: 1
+NamespaceIndentation: All
+PenaltyReturnTypeOnItsOwnLine: 1000
+PointerAlignment: Left
+SortIncludes: true
+SpaceAfterLogicalNot: false
+SpaceAfterTemplateKeyword: false
+SpaceBeforeAssignmentOperators: true
+SpaceBeforeCpp11BracedList: false
+SpaceBeforeCtorInitializerColon: true
+SpaceBeforeInheritanceColon: true
+SpaceBeforeParens: ControlStatements
+SpaceBeforeRangeBasedForLoopColon: true
+SpaceInEmptyParentheses: false
+SpacesInAngles: false
+SpacesInCStyleCastParentheses: false
+SpacesInParentheses: false
+Standard: c++17
+UseTab: Never

+ 1 - 2
Gems/O3DE/GeomNodes/Code/Include/GeomNodes/GeomNodesBus.h

@@ -23,8 +23,7 @@ namespace GeomNodes
         // Put your public methods here
     };
 
-    class GeomNodesBusTraits
-        : public AZ::EBusTraits
+    class GeomNodesBusTraits : public AZ::EBusTraits
     {
     public:
         //////////////////////////////////////////////////////////////////////////

+ 6 - 20
Gems/O3DE/GeomNodes/Code/Source/Editor/Common/GNAPI.cpp

@@ -12,13 +12,11 @@ namespace GeomNodes
 {
     namespace API
     {
-        bool Init(u64 id, HandlerCallback cb)
+        bool Init([[maybe_unused]] u64 id, [[maybe_unused]] HandlerCallback cb)
         {
 #ifdef USE_BRIDGE
             return ::Init(id, cb);
 #else
-            (void)id;
-            (void)cb;
             return false;
 #endif
         }
@@ -30,56 +28,44 @@ namespace GeomNodes
 #endif
         }
 
-        void SendMsg(const char* data, u64 length, u64 id)
+        void SendMsg([[maybe_unused]] const char* data, [[maybe_unused]] u64 length, [[maybe_unused]] u64 id)
         {
 #ifdef USE_BRIDGE
             ::SendMsg(data, length, id);
-#else
-            (void)data;
-            (void)length;
-            (void)id;
 #endif
         }
 
-        bool ReadMsg(char* buffer, u64 length)
+        bool ReadMsg([[maybe_unused]] char* buffer, [[maybe_unused]] u64 length)
         {
 #ifdef USE_BRIDGE
             return ::ReadMsg(buffer, length);
 #else
-            (void)buffer;
-            (void)length;
             return false;
 #endif
         }
 
-        bool OpenSHM(u64 mapId)
+        bool OpenSHM([[maybe_unused]] u64 mapId)
         {
 #ifdef USE_BRIDGE
             return ::OpenSHM(mapId);
 #else
-            (void)mapId;
             return false;
 #endif
         }
 
-        bool ReadSHM(u64 uId, void** address, u64* length)
+        bool ReadSHM([[maybe_unused]] u64 uId, [[maybe_unused]] void** address, [[maybe_unused]] u64* length)
         {
 #ifdef USE_BRIDGE
             return ::ReadSHM(uId, address, length);
 #else
-            (void)uId;
-            (void)address;
-            (void)length;
             return false;
 #endif
         }
 
-        void ClearSHM(u64 uId)
+        void ClearSHM([[maybe_unused]] u64 uId)
         {
 #ifdef USE_BRIDGE
             ::ClearSHM(uId);
-#else
-            (void)uId;
 #endif
         }
     } // namespace API

+ 2 - 2
Gems/O3DE/GeomNodes/Code/Source/Editor/Common/GNAPI.h

@@ -26,8 +26,8 @@ namespace GeomNodes
     namespace API
     {
         /*!
-        * Interface for Bridge methods
-        */
+         * Interface for Bridge methods
+         */
         bool Init(u64 id, HandlerCallback cb);
         void Uninitialize();
         void SendMsg(const char* data, u64 length, u64 id);

+ 39 - 37
Gems/O3DE/GeomNodes/Code/Source/Editor/Common/GNConstants.h

@@ -8,45 +8,47 @@
 
 #pragma once
 
+#include <AzCore/std/containers/vector.h>
+
 namespace GeomNodes
 {
-	//! Keys used for IPC JSON messages between clients(blender instances) and server(gem)
-	namespace Field
-	{
-		static constexpr char Initialized[] = "Initialized";
-		static constexpr char Heartbeat[] = "Heartbeat";
-		static constexpr char ObjectNames[] = "ObjectNames";
-		static constexpr char Objects[] = "Objects";
-		static constexpr char Object[] = "Object";
-		static constexpr char SHMOpen[] = "SHMOpen";
-		static constexpr char SHMClose[] = "SHMClose";
-		static constexpr char MapId[] = "MapId";
-		static constexpr char Export[] = "Export";
-		static constexpr char Error[] = "Error";
-
-		static constexpr char Params[] = "Params";
-		static constexpr char Materials[] = "Materials";
-		static constexpr char Id[] = "Id";
-		static constexpr char Name[] = "Name";
-		static constexpr char Type[] = "Type";
-		static constexpr char DefaultValue[] = "DefaultValue";
-		static constexpr char Value[] = "Value";
-		static constexpr char MinValue[] = "MinValue";
-		static constexpr char MaxValue[] = "MaxValue";
-
-		static constexpr char FBXPath[] = "FBXPath";
-	}
-
-	//! Attributes for mesh vertices.
-	enum class AttributeType
-	{
-		Position,
-		Normal,
-		Tangent,
-		Bitangent,
-		UV,
-		Color
-	};
+    //! Keys used for IPC JSON messages between clients(blender instances) and server(gem)
+    namespace Field
+    {
+        static constexpr char Initialized[] = "Initialized";
+        static constexpr char Heartbeat[] = "Heartbeat";
+        static constexpr char ObjectNames[] = "ObjectNames";
+        static constexpr char Objects[] = "Objects";
+        static constexpr char Object[] = "Object";
+        static constexpr char SHMOpen[] = "SHMOpen";
+        static constexpr char SHMClose[] = "SHMClose";
+        static constexpr char MapId[] = "MapId";
+        static constexpr char Export[] = "Export";
+        static constexpr char Error[] = "Error";
+
+        static constexpr char Params[] = "Params";
+        static constexpr char Materials[] = "Materials";
+        static constexpr char Id[] = "Id";
+        static constexpr char Name[] = "Name";
+        static constexpr char Type[] = "Type";
+        static constexpr char DefaultValue[] = "DefaultValue";
+        static constexpr char Value[] = "Value";
+        static constexpr char MinValue[] = "MinValue";
+        static constexpr char MaxValue[] = "MaxValue";
+
+        static constexpr char FBXPath[] = "FBXPath";
+    } // namespace Field
+
+    //! Attributes for mesh vertices.
+    enum class AttributeType
+    {
+        Position,
+        Normal,
+        Tangent,
+        Bitangent,
+        UV,
+        Color
+    };
 
     static constexpr AZStd::string_view AssetsFolderPath = "assets/geomnodes/";
     static constexpr AZStd::string_view MaterialsFolder = "materials";

+ 1 - 1
Gems/O3DE/GeomNodes/Code/Source/Editor/Common/GNEvents.h

@@ -22,5 +22,5 @@ namespace GeomNodes
         //! Event triggers when the GeomNodes system has completed initialization.
         //! When triggered the event will send the GNConfiguration used to initialize the system.
         using OnInitializedEvent = AZ::Event<const GNConfiguration*>;
-    }
+    } // namespace SystemEvents
 } // namespace GeomNodes

+ 110 - 111
Gems/O3DE/GeomNodes/Code/Source/Editor/Components/EditorGeomNodesComponent.cpp

@@ -6,21 +6,21 @@
  *
  */
 
+#include <AzCore/Utils/Utils.h>
+#include <AzToolsFramework/API/EntityCompositionRequestBus.h>
+#include <AzToolsFramework/API/ToolsApplicationAPI.h>
 #include <Editor/Components/EditorGeomNodesComponent.h>
+#include <Editor/Rendering/GNMeshController.h>
+#include <Editor/Systems/GNProperty.h>
 #include <Editor/UI/UI_common.h>
-#include <Editor/UI/Validators.h>
 #include <Editor/UI/Utils.h>
-#include <Editor/Systems/GNProperty.h>
-#include <Editor/Rendering/GNMeshController.h>
-#include <AzToolsFramework/API/ToolsApplicationAPI.h>
-#include <AzToolsFramework/API/EntityCompositionRequestBus.h>
-#include <AzCore/Utils/Utils.h>
+#include <Editor/UI/Validators.h>
 
-#include <AzCore/JSON/prettywriter.h>
-#include <AzCore/JSON/stringbuffer.h>
 #include <Atom/Feature/Mesh/MeshFeatureProcessorInterface.h>
 #include <Atom/RPI.Public/Scene.h>
 #include <AzCore/Component/NonUniformScaleBus.h>
+#include <AzCore/JSON/prettywriter.h>
+#include <AzCore/JSON/stringbuffer.h>
 #include <AzCore/Settings/SettingsRegistryMergeUtils.h>
 
 namespace GeomNodes
@@ -43,22 +43,19 @@ namespace GeomNodes
                 ->Version(1)
                 ->Field("GNParamContext", &EditorGeomNodesComponent::m_paramContext)
                 ->Field("BlenderFile", &EditorGeomNodesComponent::m_blenderFile)
-				->Field("ObjectNameList", &EditorGeomNodesComponent::m_enumValues)
-				->Field("ObjectInfos", &EditorGeomNodesComponent::m_defaultObjectInfos)
-				//->Field("CurrentObject", &EditorGeomNodesComponent::m_currentObject)
+                ->Field("ObjectNameList", &EditorGeomNodesComponent::m_enumValues)
+                ->Field("ObjectInfos", &EditorGeomNodesComponent::m_defaultObjectInfos)
                 ->Field("CurrentObjectInfo", &EditorGeomNodesComponent::m_currentObjectInfo)
-                ->Field("IsInitialized", &EditorGeomNodesComponent::m_initialized)
-                ;
-            
+                ->Field("IsInitialized", &EditorGeomNodesComponent::m_initialized);
+
             GNParamContext::Reflect(context);
-            
 
             AZ::EditContext* ec = serializeContext->GetEditContext();
             if (ec)
             {
                 ec->Class<EditorGeomNodesComponent>(
-                    "Geometry Node",
-                    "The Geometry Node component allows you to load a blend file with geometry node and tweak exposed parameters. ")
+                      "Geometry Node",
+                      "The Geometry Node component allows you to load a blend file with geometry node and tweak exposed parameters. ")
                     ->ClassElement(AZ::Edit::ClassElements::EditorData, "")
                     ->Attribute(AZ::Edit::Attributes::Category, "Blender")
                     ->Attribute(AZ::Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC("Game", 0x232b318c))
@@ -67,29 +64,24 @@ namespace GeomNodes
                     ->Attribute(AZ::Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC("Layer", 0xe4db211a))
                     ->Attribute(AZ::Edit::Attributes::AutoExpand, true)
                     ->DataElement(
-                        Handlers::FileSelect,
-                        &EditorGeomNodesComponent::m_blenderFile,
-                        "Blender File",
-                        "Blender file with Geometry Nodes")
-                        ->Attribute(Attributes::FuncValidator, ConvertFunctorToVoid(&Validators::ValidBlenderOrEmpty))
-                        ->Attribute(Attributes::SelectFunction, blendFunctor)
-                        ->Attribute(Attributes::ValidationChange, &EditorGeomNodesComponent::OnPathChange)
-                        ->Attribute(AZ::Edit::Attributes::ReadOnly, &EditorGeomNodesComponent::GetWorkInProgress)
-					->DataElement(nullptr, &EditorGeomNodesComponent::m_paramContext, "Geom Nodes Parameters", "Parameter template")
+                        Handlers::FileSelect, &EditorGeomNodesComponent::m_blenderFile, "Blender File", "Blender file with Geometry Nodes")
+                    ->Attribute(Attributes::FuncValidator, ConvertFunctorToVoid(&Validators::ValidBlenderOrEmpty))
+                    ->Attribute(Attributes::SelectFunction, blendFunctor)
+                    ->Attribute(Attributes::ValidationChange, &EditorGeomNodesComponent::OnPathChange)
+                    ->Attribute(AZ::Edit::Attributes::ReadOnly, &EditorGeomNodesComponent::GetWorkInProgress)
+                    ->DataElement(nullptr, &EditorGeomNodesComponent::m_paramContext, "Geom Nodes Parameters", "Parameter template")
                     ->SetDynamicEditDataProvider(&EditorGeomNodesComponent::GetParamsEditData)
-                        ->Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)
-					->UIElement(AZ::Edit::UIHandlers::Button, "", "Export to static mesh")
-					->Attribute(AZ::Edit::Attributes::ChangeNotify, &EditorGeomNodesComponent::ExportToStaticMesh)
-					->Attribute(AZ::Edit::Attributes::ButtonText, &EditorGeomNodesComponent::ExportButtonText)
+                    ->Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)
+                    ->UIElement(AZ::Edit::UIHandlers::Button, "", "Export to static mesh")
+                    ->Attribute(AZ::Edit::Attributes::ChangeNotify, &EditorGeomNodesComponent::ExportToStaticMesh)
+                    ->Attribute(AZ::Edit::Attributes::ButtonText, &EditorGeomNodesComponent::ExportButtonText)
                     ->Attribute(AZ::Edit::Attributes::Visibility, &EditorGeomNodesComponent::IsBlenderFileLoaded)
                     ->Attribute(AZ::Edit::Attributes::ChangeNotify, AZ::Edit::PropertyRefreshLevels::EntireTree)
-                    ->Attribute(AZ::Edit::Attributes::ReadOnly, &EditorGeomNodesComponent::GetWorkInProgress)
-                    ;
+                    ->Attribute(AZ::Edit::Attributes::ReadOnly, &EditorGeomNodesComponent::GetWorkInProgress);
 
                 ec->Class<GNParamContext>("Geom Nodes Parameter Context", "Adding exposed Geometry Nodes parameters to the entity!")
                     ->DataElement(nullptr, &GNParamContext::m_group, "Properties", "Geometry Nodes properties")
-                    ->Attribute(AZ::Edit::Attributes::AutoExpand, true)
-                    ;
+                    ->Attribute(AZ::Edit::Attributes::AutoExpand, true);
 
                 ec->Class<GNPropertyGroup>("Geom Nodes Property group", "This is a  property group")
                     ->ClassElement(AZ::Edit::ClassElements::EditorData, "GNPropertyGroup's class attributes.")
@@ -106,7 +98,7 @@ namespace GeomNodes
 
                 ec->Class<GNParamBoolean>("Geom Nodes Property (bool)", "A Geom Nodes boolean property")
                     ->ClassElement(AZ::Edit::ClassElements::EditorData, "GNPropertyGroup's class attributes.")
-                        ->Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)
+                    ->Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)
                     ->DataElement(AZ::Edit::UIHandlers::Default, &GNParamBoolean::m_value, "m_value", "A boolean")
                     ->Attribute(AZ::Edit::Attributes::ReadOnly, &GNProperty::IsReadOnly)
                     ->Attribute(AZ::Edit::Attributes::ChangeNotify, &GNProperty::OnParamChange)
@@ -114,7 +106,7 @@ namespace GeomNodes
 
                 ec->Class<GNParamInt>("Geom Nodes Property (int)", "A Geom Nodes int property")
                     ->ClassElement(AZ::Edit::ClassElements::EditorData, "GNPropertyGroup's class attributes.")
-                        ->Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)
+                    ->Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)
                     ->DataElement(AZ::Edit::UIHandlers::Default, &GNParamInt::m_value, "m_value", "An int")
                     ->Attribute(AZ::Edit::Attributes::ReadOnly, &GNProperty::IsReadOnly)
                     ->Attribute(AZ::Edit::Attributes::ChangeNotify, &GNProperty::OnParamChange)
@@ -122,19 +114,19 @@ namespace GeomNodes
 
                 ec->Class<GNParamValue>("Geom Nodes Property (double)", "A Geom Nodes double property")
                     ->ClassElement(AZ::Edit::ClassElements::EditorData, "GNPropertyGroup's class attributes.")
-                        ->Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)
+                    ->Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)
                     ->DataElement(AZ::Edit::UIHandlers::Default, &GNParamValue::m_value, "m_value", "A double/value")
                     ->Attribute(AZ::Edit::Attributes::ReadOnly, &GNProperty::IsReadOnly)
-                        ->Attribute(AZ::Edit::Attributes::ChangeNotify, &GNProperty::OnParamChange)
-                        ->Attribute(AZ::Edit::Attributes::NameLabelOverride, &GNParamValue::m_name);
+                    ->Attribute(AZ::Edit::Attributes::ChangeNotify, &GNProperty::OnParamChange)
+                    ->Attribute(AZ::Edit::Attributes::NameLabelOverride, &GNParamValue::m_name);
 
                 ec->Class<GNParamString>("Geom Nodes Property (string)", "A Geom Nodes string property")
                     ->ClassElement(AZ::Edit::ClassElements::EditorData, "GNPropertyGroup's class attributes.")
-                        ->Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)
+                    ->Attribute(AZ::Edit::Attributes::Visibility, AZ::Edit::PropertyVisibility::ShowChildrenOnly)
                     ->DataElement(AZ::Edit::UIHandlers::Default, &GNParamString::m_value, "m_value", "A string")
                     ->Attribute(AZ::Edit::Attributes::ReadOnly, &GNProperty::IsReadOnly)
-                        ->Attribute(AZ::Edit::Attributes::ChangeNotify, &GNProperty::OnParamChange)
-                        ->Attribute(AZ::Edit::Attributes::NameLabelOverride, &GNParamString::m_name);
+                    ->Attribute(AZ::Edit::Attributes::ChangeNotify, &GNProperty::OnParamChange)
+                    ->Attribute(AZ::Edit::Attributes::NameLabelOverride, &GNParamString::m_name);
             }
         }
     }
@@ -162,7 +154,7 @@ namespace GeomNodes
 
                 const AZ::IO::FixedMaxPath gemPath = AZ::Utils::GetGemPath("GeomNodes");
                 const AZ::IO::FixedMaxPath exePath = AZ::Utils::GetExecutableDirectory();
-                AZ::IO::FixedMaxPath bridgePath = exePath / "Bridge.dll"; //TODO: make this platform agnostic
+                AZ::IO::FixedMaxPath bridgePath = exePath / "Bridge.dll"; // TODO: make this platform agnostic
                 if (!AZ::IO::SystemFile::Exists(bridgePath.c_str()))
                 {
                     auto registry = AZ::SettingsRegistry::Get();
@@ -173,7 +165,8 @@ namespace GeomNodes
                         return;
                     }
 
-                    bridgePath = projectBuildPath / "bin/profile/Bridge.dll"; //TODO: check if there is a way to get "bin/profile" in the registry or somewhere and not hard coded.
+                    bridgePath = projectBuildPath / "bin/profile/Bridge.dll"; // TODO: check if there is a way to get "bin/profile" in the
+                                                                              // registry or somewhere and not hard coded.
                     if (!AZ::IO::SystemFile::Exists(bridgePath.c_str()))
                     {
                         AZ_Error("GeomNodes", false, "Can't find Bridge.dll");
@@ -204,28 +197,28 @@ namespace GeomNodes
     void EditorGeomNodesComponent::OnParamChange()
     {
         SetWorkInProgress(true);
-        
+
         if (m_paramContext.m_group.m_properties.size() > 0)
         {
             // this checks if the user chooses another object.
-			auto gnParam = reinterpret_cast<GNParamString*>(m_paramContext.m_group.GetProperty(Field::Objects));
-			if (gnParam->m_value != m_currentObject)
-			{
-				m_currentObject = gnParam->m_value;
-				m_paramContext.m_group.Clear(); // clear the group/properties
+            auto gnParam = reinterpret_cast<GNParamString*>(m_paramContext.m_group.GetProperty(Field::Objects));
+            if (gnParam->m_value != m_currentObject)
+            {
+                m_currentObject = gnParam->m_value;
+                m_paramContext.m_group.Clear(); // clear the group/properties
                 CreateDataElements(m_paramContext.m_group);
-			}
+            }
         }
-        
-        if(m_instance)
+
+        if (m_instance)
         {
             if (!m_instance->IsValid())
             {
                 m_instance->RestartProcess();
             }
-            
-			m_currentObjectInfo = m_instance->SendParamUpdates(m_paramContext.m_group
-				.GetGroup(m_currentObject.c_str())->GetProperties(), m_currentObject);
+
+            m_currentObjectInfo =
+                m_instance->SendParamUpdates(m_paramContext.m_group.GetGroup(m_currentObject.c_str())->GetProperties(), m_currentObject);
         }
 
         AZ_Printf("EditorGeomNodesComponent", "%llu: Parameter has changed", (AZ::u64)GetEntityId());
@@ -237,7 +230,7 @@ namespace GeomNodes
         jsonDocument.Parse((const char*)content, length);
         if (!jsonDocument.HasParseError())
         {
-            // send back an "Alive" message to the client when it asks for a heartbeat. 
+            // send back an "Alive" message to the client when it asks for a heartbeat.
             if (jsonDocument.HasMember(Field::Heartbeat))
             {
                 m_instance->SendHeartbeat();
@@ -249,13 +242,15 @@ namespace GeomNodes
                     m_instance->RequestObjectParams();
                     m_initialized = true;
                 }
-                else if(m_fromActivate)
+                else if (m_fromActivate)
                 {
                     OnParamChange();
                 }
                 m_fromActivate = false;
             }
-            else if (jsonDocument.HasMember(Field::ObjectNames) && jsonDocument.HasMember(Field::Objects) && jsonDocument.HasMember(Field::Materials))
+            else if (
+                jsonDocument.HasMember(Field::ObjectNames) && jsonDocument.HasMember(Field::Objects) &&
+                jsonDocument.HasMember(Field::Materials))
             {
                 LoadObjects(jsonDocument[Field::ObjectNames], jsonDocument[Field::Objects]);
                 CreateDataElements(m_paramContext.m_group);
@@ -296,9 +291,10 @@ namespace GeomNodes
     {
         if (!m_workInProgress)
         {
-			m_instance->RequestExport(m_paramContext.m_group
-				.GetGroup(m_currentObject.c_str())->GetProperties()
-                , m_currentObject, m_controller->GenerateFBXPath());
+            m_instance->RequestExport(
+                m_paramContext.m_group.GetGroup(m_currentObject.c_str())->GetProperties(),
+                m_currentObject,
+                m_controller->GenerateFBXPath());
             SetWorkInProgress(true);
         }
     }
@@ -310,12 +306,14 @@ namespace GeomNodes
 
     void EditorGeomNodesComponent::SetWorkInProgress(bool flag)
     {
-		AZ::SystemTickBus::QueueFunction(
-            [=]() {
-				if (m_workInProgress != flag)
-				{
-    				m_workInProgress = flag;
-                    EBUS_EVENT(AzToolsFramework::ToolsApplicationEvents::Bus, InvalidatePropertyDisplay, AzToolsFramework::Refresh_EntireTree);
+        AZ::SystemTickBus::QueueFunction(
+            [=]()
+            {
+                if (m_workInProgress != flag)
+                {
+                    m_workInProgress = flag;
+                    EBUS_EVENT(
+                        AzToolsFramework::ToolsApplicationEvents::Bus, InvalidatePropertyDisplay, AzToolsFramework::Refresh_EntireTree);
                 }
             });
     }
@@ -340,11 +338,11 @@ namespace GeomNodes
 
     void EditorGeomNodesComponent::LoadObjects(const rapidjson::Value& objectNameArray, const rapidjson::Value& objectArray)
     {
-        
         // Populate m_enumValues that will store the list of object names
         LoadObjectNames(objectNameArray);
-        
-        // Load and save our param list object from json. Need this so it's faster to switch between objects and not need to send a request via IPC.
+
+        // Load and save our param list object from json. Need this so it's faster to switch between objects and not need to send a request
+        // via IPC.
         LoadParams(objectArray);
 
         m_currentObject = m_enumValues[0];
@@ -389,14 +387,16 @@ namespace GeomNodes
         CreateParam(m_currentObject, group);
 
         AZ::SystemTickBus::QueueFunction(
-            [=]() {
+            [=]()
+            {
                 EBUS_EVENT(AzToolsFramework::ToolsApplicationEvents::Bus, InvalidatePropertyDisplay, AzToolsFramework::Refresh_EntireTree);
                 AzToolsFramework::ToolsApplicationRequests::Bus::Broadcast(
                     &AzToolsFramework::ToolsApplicationRequests::Bus::Events::AddDirtyEntity, GetEntityId());
             });
     }
 
-    void EditorGeomNodesComponent::CreateObjectNames(const AZStd::string& objectName, const StringVector& enumValues, GNPropertyGroup& group)
+    void EditorGeomNodesComponent::CreateObjectNames(
+        const AZStd::string& objectName, const StringVector& enumValues, GNPropertyGroup& group)
     {
         ElementInfo ei;
         ei.m_editData.m_name = CacheString(Field::Objects);
@@ -406,7 +406,7 @@ namespace GeomNodes
 
         auto gnParam = aznew GNParamString(Field::Objects, "", &m_workInProgress, GetEntityId());
         gnParam->m_value = objectName;
-        
+
         ei.m_editData.m_attributes.push_back(
             AZ::Edit::AttributePair(AZ::Edit::Attributes::StringList, aznew AZ::AttributeContainerType<StringVector>(enumValues)));
 
@@ -421,32 +421,32 @@ namespace GeomNodes
 
         if (m_currentObjectInfo.empty())
         {
-			auto it = m_defaultObjectInfos.find(objectName);
-			if (it != m_defaultObjectInfos.end())
-			{
-				jsonBuffer = it->second;
-			}
+            auto it = m_defaultObjectInfos.find(objectName);
+            if (it != m_defaultObjectInfos.end())
+            {
+                jsonBuffer = it->second;
+            }
         }
-        else {
-			jsonBuffer = m_currentObjectInfo;
+        else
+        {
+            jsonBuffer = m_currentObjectInfo;
         }
-        
 
         if (!jsonBuffer.empty())
         {
-			rapidjson::Document jsonDocument;
-			jsonDocument.Parse(jsonBuffer.c_str(), jsonBuffer.size());
-			if (!jsonDocument.HasParseError())
-			{
-				GNPropertyGroup* subGroup = group.GetGroup(objectName.c_str());
-				if (subGroup == nullptr)
-				{
-					group.m_groups.emplace_back();
-					subGroup = &group.m_groups.back();
-					subGroup->m_name = objectName;
-				}
-				LoadProperties(jsonDocument[Field::Params], *subGroup);
-			}
+            rapidjson::Document jsonDocument;
+            jsonDocument.Parse(jsonBuffer.c_str(), jsonBuffer.size());
+            if (!jsonDocument.HasParseError())
+            {
+                GNPropertyGroup* subGroup = group.GetGroup(objectName.c_str());
+                if (subGroup == nullptr)
+                {
+                    group.m_groups.emplace_back();
+                    subGroup = &group.m_groups.back();
+                    subGroup->m_name = objectName;
+                }
+                LoadProperties(jsonDocument[Field::Params], *subGroup);
+            }
         }
     }
 
@@ -455,14 +455,14 @@ namespace GeomNodes
         // parse params
         for (rapidjson::Value::ConstValueIterator itr = paramVal.Begin(); itr != paramVal.End(); ++itr)
         {
-            //set this up so the context can do it's own parsing of the current GN param JSON object.
+            // set this up so the context can do it's own parsing of the current GN param JSON object.
             GNParamDataContext gndc;
             gndc.SetParamObject(itr);
             gndc.SetReadOnlyPointer(&m_workInProgress);
             gndc.SetEntityId(GetEntityId());
             auto propertyName = gndc.GetParamName();
             auto paramType = gndc.GetParamType();
-                
+
             // default value will differ based on the type
 
             if (GNProperty* gnParam = m_paramContext.ConstructGNParam(gndc, paramType, propertyName))
@@ -520,28 +520,26 @@ namespace GeomNodes
             }
 
             ed.m_attributes.push_back(AZ::Edit::AttributePair(AZ::Edit::Attributes::Step, aznew AZ::Edit::AttributeData<double>(0.1f)));
-            
+
             break;
         }
     }
 
-	void EditorGeomNodesComponent::GetRequiredServices([[maybe_unused]] AZ::ComponentDescriptor::DependencyArrayType& required)
-	{
-		//required.push_back(AZ_CRC("TransformService", 0x8ee22c50));
-	}
+    void EditorGeomNodesComponent::GetRequiredServices([[maybe_unused]] AZ::ComponentDescriptor::DependencyArrayType& required)
+    {
+    }
 
-	void EditorGeomNodesComponent::GetDependentServices(AZ::ComponentDescriptor::DependencyArrayType& dependent)
-	{
-		dependent.push_back(AZ_CRC("TransformService", 0x8ee22c50));
-	}
+    void EditorGeomNodesComponent::GetDependentServices(AZ::ComponentDescriptor::DependencyArrayType& dependent)
+    {
+        dependent.push_back(AZ_CRC("TransformService", 0x8ee22c50));
+    }
 
     void EditorGeomNodesComponent::GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided)
     {
         provided.push_back(AZ_CRC_CE("EditorGeomNodesService"));
     }
 
-    void EditorGeomNodesComponent::GetIncompatibleServices(
-        [[maybe_unused]] AZ::ComponentDescriptor::DependencyArrayType& incompatible)
+    void EditorGeomNodesComponent::GetIncompatibleServices([[maybe_unused]] AZ::ComponentDescriptor::DependencyArrayType& incompatible)
     {
         incompatible.push_back(AZ_CRC("EditorGeomNodesService"));
     }
@@ -554,7 +552,7 @@ namespace GeomNodes
     {
         AzToolsFramework::Components::EditorComponentBase::Activate();
         EditorGeomNodesComponentRequestBus::Handler::BusConnect(GetEntityId());
-        
+
         m_controller = AZStd::make_unique<GNMeshController>(GetEntityId());
 
         m_fromActivate = true;
@@ -632,7 +630,8 @@ namespace GeomNodes
         if (GetEntity())
         {
             AZ::SystemTickBus::QueueFunction(
-                [=]() {
+                [=]()
+                {
                     AzToolsFramework::ToolsApplicationEvents::Bus::Broadcast(
                         &AzToolsFramework::ToolsApplicationEvents::InvalidatePropertyDisplay, AzToolsFramework::Refresh_EntireTree);
                 });
@@ -651,4 +650,4 @@ namespace GeomNodes
         }
         return nullptr;
     }
-}
+} // namespace GeomNodes

+ 26 - 28
Gems/O3DE/GeomNodes/Code/Source/Editor/Components/EditorGeomNodesComponent.h

@@ -8,15 +8,15 @@
 
 #pragma once
 
-#include <AzToolsFramework/ToolsComponents/EditorComponentBase.h>
-#include <AzCore/Serialization/EditContext.h>
+#include "Editor/Rendering/GNModelData.h"
 #include "Editor/Systems/GNInstance.h"
 #include "Editor/Systems/GNParamContext.h"
-#include "Editor/Rendering/GNModelData.h"
-#include <Editor/EBus/IpcHandlerBus.h>
-#include <Editor/EBus/EditorGeomNodesComponentBus.h>
-#include <Editor/Common/GNConstants.h>
+#include <AzCore/Serialization/EditContext.h>
 #include <AzToolsFramework/Entity/EntityTypes.h>
+#include <AzToolsFramework/ToolsComponents/EditorComponentBase.h>
+#include <Editor/Common/GNConstants.h>
+#include <Editor/EBus/EditorGeomNodesComponentBus.h>
+#include <Editor/EBus/IpcHandlerBus.h>
 
 namespace GeomNodes
 {
@@ -43,31 +43,30 @@ namespace GeomNodes
         void Activate() override;
         void Deactivate() override;
 
-		// EditorGeomNodesComponentRequestBus overrides ...
+        // EditorGeomNodesComponentRequestBus overrides ...
         void SetWorkInProgress(bool flag) override;
         bool GetWorkInProgress() override;
         void SendIPCMsg(const AZStd::string& msg) override;
-		void OnParamChange() override;
+        void OnParamChange() override;
 
     private:
-		
     protected:
         //! got this from ScriptEditorComponent
         struct ElementInfo
         {
-            AZ::Uuid m_uuid;                    //! Type uuid for the class field that should use this edit data.
-            AZ::Edit::ElementData m_editData;   //! Edit metadata (name, description, attribs, etc).
-            bool m_isAttributeOwner;            //! True if this ElementInfo owns the internal attributes. We can use a single
-                                                //! ElementInfo for more than one class field, but only one owns the Attributes.
-            float m_sortOrder;                  //! Sort order of the property as defined by using the "order" attribute, by default the order is FLT_MAX
-                                                //! which means alphabetical sort will be used
+            AZ::Uuid m_uuid; //! Type uuid for the class field that should use this edit data.
+            AZ::Edit::ElementData m_editData; //! Edit metadata (name, description, attribs, etc).
+            bool m_isAttributeOwner; //! True if this ElementInfo owns the internal attributes. We can use a single
+                                     //! ElementInfo for more than one class field, but only one owns the Attributes.
+            float m_sortOrder; //! Sort order of the property as defined by using the "order" attribute, by default the order is FLT_MAX
+                               //! which means alphabetical sort will be used
         };
-        
-		// IpcHandlerNotificationBus overrides...
+
+        // IpcHandlerNotificationBus overrides...
         void OnMessageReceived(const AZ::u8* content, const AZ::u64 length) override;
 
-		void Clear();
-		void OnPathChange(const AZStd::string& path);
+        void Clear();
+        void OnPathChange(const AZStd::string& path);
         void ExportToStaticMesh();
         bool IsBlenderFileLoaded();
         AZStd::string ExportButtonText();
@@ -80,18 +79,17 @@ namespace GeomNodes
         void CreateParam(const AZStd::string& objectName, GNPropertyGroup& group);
         bool LoadProperties(const rapidjson::Value& paramVal, GNPropertyGroup& group);
         void LoadAttribute(ParamType type, AZ::Edit::ElementData& ed, GNProperty* prop);
-        
+
         void ClearDataElements();
 
         const AZ::Edit::ElementData* GetDataElement(const void* element, const AZ::Uuid& typeUuid) const;
 
-        static const AZ::Edit::ElementData* GetParamsEditData(
-            const void* handlerPtr, const void* elementPtr, const AZ::Uuid& elementType);
+        static const AZ::Edit::ElementData* GetParamsEditData(const void* handlerPtr, const void* elementPtr, const AZ::Uuid& elementType);
 
         void AddDataElement(GNProperty* gnParam, ElementInfo& ei);
 
         const char* CacheString(const char* str);
-    
+
         AZStd::unordered_map<const void*, AZStd::string> m_cachedStrings;
         AZStd::unordered_map<const void*, ElementInfo> m_dataElements;
         AZStd::unordered_map<AZStd::string, AZStd::string> m_defaultObjectInfos;
@@ -107,15 +105,15 @@ namespace GeomNodes
         AZStd::unique_ptr<GNMeshController> m_controller;
 
         //! Current blender file loaded.
-        AZStd::string m_blenderFile;        
+        AZStd::string m_blenderFile;
         //! The current object name selected.
-        AZStd::string m_currentObject;      
+        AZStd::string m_currentObject;
         //! in JSON form. This is the representation of the current selected object along with the current parameters.
-        AZStd::string m_currentObjectInfo;  
+        AZStd::string m_currentObjectInfo;
 
         //! a handle on the blender instance.
         GNInstance* m_instance = nullptr;
-        
+
         //! Flag if the component is done initializing.
         bool m_initialized = false;
         //! Flag to set if parameters needs to be disabled or not.
@@ -123,4 +121,4 @@ namespace GeomNodes
         //! Flag if set true triggers a parameter reload coming from a saved point.
         bool m_fromActivate = false;
     };
-}
+} // namespace GeomNodes

+ 40 - 40
Gems/O3DE/GeomNodes/Code/Source/Editor/Components/EditorGeomNodesSystemComponent.cpp

@@ -6,9 +6,9 @@
  *
  */
 
+#include "EditorGeomNodesSystemComponent.h"
 #include <AzCore/Serialization/SerializeContext.h>
 #include <Editor/Systems/GeomNodesSystem.h>
-#include "EditorGeomNodesSystemComponent.h"
 #include <Editor/UI/EditorWindow.h>
 
 #include <GeomNodes/GeomNodesTypeIds.h>
@@ -22,23 +22,21 @@ namespace GeomNodes
         GNConfiguration::Reflect(context);
         if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
         {
-            serializeContext->Class<EditorGeomNodesSystemComponent, GeomNodesSystemComponent>()
-                ->Version(0);
+            serializeContext->Class<EditorGeomNodesSystemComponent, GeomNodesSystemComponent>()->Version(0);
         }
     }
 
     EditorGeomNodesSystemComponent::EditorGeomNodesSystemComponent()
-		: m_onSystemInitializedHandler(
-			[](const GNConfiguration* /*config*/)
-	        {
-		        
-	        })
-		, m_onSystemConfigChangedHandler(
-			[](const GNConfiguration* /*config*/)
-	        {
-	        })
+        : m_onSystemInitializedHandler(
+              []([[maybe_unused]] const GNConfiguration* config)
+              {
+
+              })
+        , m_onSystemConfigChangedHandler(
+              []([[maybe_unused]] const GNConfiguration* config)
+              {
+              })
     {
-
     }
 
     EditorGeomNodesSystemComponent::~EditorGeomNodesSystemComponent() = default;
@@ -70,26 +68,28 @@ namespace GeomNodes
         m_system = GetGNSystem();
         if (m_system)
         {
-			m_system->RegisterSystemInitializedEvent(m_onSystemInitializedHandler);
-			m_system->RegisterSystemConfigurationChangedEvent(m_onSystemConfigChangedHandler);
-			const GNSettingsRegistryManager& registryManager = m_system->GetSettingsRegistryManager();
-			if (AZStd::optional<GNConfiguration> config = registryManager.LoadSystemConfiguration();
-				config.has_value())
-			{
-				m_system->Initialize(&(*config));
-			}
-			else //load defaults if there is no config
-			{
-				const GNConfiguration defaultConfig = GNConfiguration::CreateDefault();
-				m_system->Initialize(&defaultConfig);
-
-				auto saveCallback = []([[maybe_unused]] const GNConfiguration& config, [[maybe_unused]] GNSettingsRegistryManager::Result result)
-				{
-					AZ_Warning("GeomNodes", result == GNSettingsRegistryManager::Result::Success,
-						"Unable to save the default GeomNodes configuration.");
-				};
-				registryManager.SaveSystemConfiguration(defaultConfig, saveCallback);
-			}
+            m_system->RegisterSystemInitializedEvent(m_onSystemInitializedHandler);
+            m_system->RegisterSystemConfigurationChangedEvent(m_onSystemConfigChangedHandler);
+            const GNSettingsRegistryManager& registryManager = m_system->GetSettingsRegistryManager();
+            if (AZStd::optional<GNConfiguration> config = registryManager.LoadSystemConfiguration(); config.has_value())
+            {
+                m_system->Initialize(&(*config));
+            }
+            else // load defaults if there is no config
+            {
+                const GNConfiguration defaultConfig = GNConfiguration::CreateDefault();
+                m_system->Initialize(&defaultConfig);
+
+                auto saveCallback =
+                    []([[maybe_unused]] const GNConfiguration& config, [[maybe_unused]] GNSettingsRegistryManager::Result result)
+                {
+                    AZ_Warning(
+                        "GeomNodes",
+                        result == GNSettingsRegistryManager::Result::Success,
+                        "Unable to save the default GeomNodes configuration.");
+                };
+                registryManager.SaveSystemConfiguration(defaultConfig, saveCallback);
+            }
         }
     }
 
@@ -102,13 +102,13 @@ namespace GeomNodes
 
     void EditorGeomNodesSystemComponent::Deactivate()
     {
-		m_onSystemInitializedHandler.Disconnect();
-		m_onSystemConfigChangedHandler.Disconnect();
-		if (m_system != nullptr)
-		{
-			m_system->Shutdown();
-			m_system = nullptr;
-		}
+        m_onSystemInitializedHandler.Disconnect();
+        m_onSystemConfigChangedHandler.Disconnect();
+        if (m_system != nullptr)
+        {
+            m_system->Shutdown();
+            m_system = nullptr;
+        }
 
         AzToolsFramework::EditorEvents::Bus::Handler::BusDisconnect();
         GeomNodesSystemComponent::Deactivate();

+ 7 - 5
Gems/O3DE/GeomNodes/Code/Source/Editor/Components/EditorGeomNodesSystemComponent.h

@@ -10,8 +10,9 @@
 
 #include <AzToolsFramework/API/ToolsApplicationAPI.h>
 
-#include <GeomNodes/Components/GeomNodesSystemComponent.h>
 #include <Editor/Common/GNEvents.h>
+#include <GeomNodes/Components/GeomNodesSystemComponent.h>
+
 
 namespace GeomNodes
 {
@@ -23,6 +24,7 @@ namespace GeomNodes
         , private AzToolsFramework::EditorEvents::Bus::Handler
     {
         using BaseSystemComponent = GeomNodesSystemComponent;
+
     public:
         AZ_COMPONENT(EditorGeomNodesSystemComponent, GeomNodesEditorSystemComponentTypeId, BaseSystemComponent);
 
@@ -43,11 +45,11 @@ namespace GeomNodes
         void Activate() override;
         void Deactivate() override;
 
-		// AztoolsFramework::EditorEvents overrides...
-		void NotifyRegisterViews() override;
+        // AztoolsFramework::EditorEvents overrides...
+        void NotifyRegisterViews() override;
 
         GeomNodesSystem* m_system = nullptr;
-		SystemEvents::OnInitializedEvent::Handler m_onSystemInitializedHandler;
-		SystemEvents::OnConfigurationChangedEvent::Handler m_onSystemConfigChangedHandler;
+        SystemEvents::OnInitializedEvent::Handler m_onSystemInitializedHandler;
+        SystemEvents::OnConfigurationChangedEvent::Handler m_onSystemConfigChangedHandler;
     };
 } // namespace GeomNodes

+ 8 - 11
Gems/O3DE/GeomNodes/Code/Source/Editor/Configuration/GNConfiguration.cpp

@@ -16,38 +16,35 @@ namespace GeomNodes
 {
     AZ_CLASS_ALLOCATOR_IMPL(GNConfiguration, AZ::SystemAllocator);
 
-    /*static*/ void GNConfiguration::Reflect(AZ::ReflectContext* context)
+    void GNConfiguration::Reflect(AZ::ReflectContext* context)
     {
         if (auto* serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
         {
             serializeContext->Class<GNConfiguration>()
                 ->Version(2)
                 ->Field("Blender Path", &GNConfiguration::m_blenderPath)
-                ->Field("Last Selected Path", &GNConfiguration::m_lastFilePath)
-                ;
+                ->Field("Last Selected Path", &GNConfiguration::m_lastFilePath);
 
             if (auto* editContext = serializeContext->GetEditContext())
             {
                 editContext->Class<GNConfiguration>("GeomNodes Configuration", "Default GeomNodes configuration")
                     ->ClassElement(AZ::Edit::ClassElements::EditorData, "")
                     ->Attribute(AZ::Edit::Attributes::AutoExpand, true)
-                    ->DataElement(AZ::Edit::UIHandlers::ExeSelectBrowseEdit, &GNConfiguration::m_blenderPath, "Blender Path", "Blender Path")
-                    ->Attribute(AZ::Edit::Attributes::ChangeNotify, &GNConfiguration::OnBlenderPathChanged)
-                    ;
+                    ->DataElement(
+                        AZ::Edit::UIHandlers::ExeSelectBrowseEdit, &GNConfiguration::m_blenderPath, "Blender Path", "Blender Path")
+                    ->Attribute(AZ::Edit::Attributes::ChangeNotify, &GNConfiguration::OnBlenderPathChanged);
             }
         }
     }
 
-    /*static*/ GNConfiguration GNConfiguration::CreateDefault()
+    GNConfiguration GNConfiguration::CreateDefault()
     {
         return GNConfiguration();
     }
 
     bool GNConfiguration::operator==(const GNConfiguration& other) const
     {
-        return m_blenderPath == other.m_blenderPath
-            && m_lastFilePath == other.m_lastFilePath
-        ;
+        return m_blenderPath == other.m_blenderPath && m_lastFilePath == other.m_lastFilePath;
     }
 
     bool GNConfiguration::operator!=(const GNConfiguration& other) const
@@ -59,4 +56,4 @@ namespace GeomNodes
     {
         return AZ::Edit::PropertyRefreshLevels::AttributesAndValues;
     }
-}
+} // namespace GeomNodes

+ 5 - 3
Gems/O3DE/GeomNodes/Code/Source/Editor/Configuration/GNConfiguration.h

@@ -8,10 +8,11 @@
 
 #pragma once
 
-#include <AzCore/std/string/string.h>
 #include <AzCore/Memory/Memory.h>
+#include <AzCore/std/string/string.h>
 #include <GeomNodes/GeomNodesTypeIds.h>
 
+
 namespace AZ
 {
     class ReflectContext;
@@ -28,13 +29,14 @@ namespace GeomNodes
 
         static GNConfiguration CreateDefault();
 
-        AZStd::string m_blenderPath = "C:/Program Files/Blender Foundation/Blender 3.4/blender.exe"; //!< Currently set blender path in user's machine.
+        AZStd::string m_blenderPath =
+            "C:/Program Files/Blender Foundation/Blender 3.4/blender.exe"; //!< Currently set blender path in user's machine.
 
         AZStd::string m_lastFilePath; //!< Last file path used when selecting a blender file.
 
         bool operator==(const GNConfiguration& other) const;
         bool operator!=(const GNConfiguration& other) const;
-    
+
     private:
         AZ::u32 OnBlenderPathChanged();
     };

+ 26 - 18
Gems/O3DE/GeomNodes/Code/Source/Editor/Configuration/GNEditorSettingsRegistryManager.cpp

@@ -8,9 +8,9 @@
 
 #include <Editor/Configuration/GNEditorSettingsRegistryManager.h>
 
+#include <AzCore/IO/ByteContainerStream.h>
 #include <AzCore/IO/SystemFile.h>
 #include <AzCore/IO/TextStreamWriters.h>
-#include <AzCore/IO/ByteContainerStream.h>
 #include <AzCore/JSON/document.h>
 #include <AzCore/JSON/pointer.h>
 #include <AzCore/JSON/prettywriter.h>
@@ -19,6 +19,7 @@
 #include <AzCore/Utils/Utils.h>
 #include <AzToolsFramework/SourceControl/SourceControlAPI.h>
 
+
 namespace GeomNodes
 {
     namespace Internal
@@ -38,13 +39,14 @@ namespace GeomNodes
         AzToolsFramework::SourceControlResponseCallback GetConfigurationSaveCallback(
             AZStd::string configurationPayload, AZStd::function<void(bool)> postSaveCallback)
         {
-            return[payloadBuffer = AZStd::move(configurationPayload), postSaveCB = AZStd::move(postSaveCallback)]
-            (bool, const AzToolsFramework::SourceControlFileInfo& info)
+            return [payloadBuffer = AZStd::move(configurationPayload),
+                    postSaveCB = AZStd::move(postSaveCallback)](bool, const AzToolsFramework::SourceControlFileInfo& info)
             {
                 // Save GeomNodes configuration.
                 if (info.IsLockedByOther())
                 {
-                    AZ_Warning("GeomNodesEditor", false, R"(The file "%s" already exclusively opened by another user)", info.m_filePath.c_str());
+                    AZ_Warning(
+                        "GeomNodesEditor", false, R"(The file "%s" already exclusively opened by another user)", info.m_filePath.c_str());
                     return;
                 }
                 else if (info.IsReadOnly() && AZ::IO::SystemFile::Exists(info.m_filePath.c_str()))
@@ -54,10 +56,8 @@ namespace GeomNodes
                 }
 
                 bool saved = false;
-                constexpr auto configurationMode
-                    = AZ::IO::SystemFile::SF_OPEN_CREATE
-                    | AZ::IO::SystemFile::SF_OPEN_CREATE_PATH
-                    | AZ::IO::SystemFile::SF_OPEN_WRITE_ONLY;
+                constexpr auto configurationMode =
+                    AZ::IO::SystemFile::SF_OPEN_CREATE | AZ::IO::SystemFile::SF_OPEN_CREATE_PATH | AZ::IO::SystemFile::SF_OPEN_WRITE_ONLY;
                 if (AZ::IO::SystemFile outputFile; outputFile.Open(info.m_filePath.c_str(), configurationMode))
                 {
                     saved = outputFile.Write(payloadBuffer.data(), payloadBuffer.size()) == payloadBuffer.size();
@@ -70,7 +70,7 @@ namespace GeomNodes
                 }
             };
         }
-    }
+    } // namespace Internal
 
     GNEditorSettingsRegistryManager::GNEditorSettingsRegistryManager()
         : GNSettingsRegistryManager()
@@ -84,11 +84,15 @@ namespace GeomNodes
         m_initialized = true;
     }
 
-    void GNEditorSettingsRegistryManager::SaveSystemConfiguration(const GNConfiguration& config, const OnGNConfigSaveComplete& saveCallback) const
+    void GNEditorSettingsRegistryManager::SaveSystemConfiguration(
+        const GNConfiguration& config, const OnGNConfigSaveComplete& saveCallback) const
     {
         if (!m_initialized)
         {
-            AZ_Warning("GeomNodesSystemEditor", false, "Unable to save GeomNodes configurations. GeomNodes Editor Settings Registry Manager could not initialize");
+            AZ_Warning(
+                "GeomNodesSystemEditor",
+                false,
+                "Unable to save GeomNodes configurations. GeomNodes Editor Settings Registry Manager could not initialize");
             if (saveCallback)
             {
                 saveCallback(config, Result::Failed);
@@ -101,12 +105,14 @@ namespace GeomNodes
         // The SourceControlCommandBus callbacks must be used as checking out a file is an asynchronous
         // operation that doesn't complete immediately
         bool sourceControlActive = false;
-        AzToolsFramework::SourceControlConnectionRequestBus::BroadcastResult(sourceControlActive,
-            &AzToolsFramework::SourceControlConnectionRequests::IsActive);
+        AzToolsFramework::SourceControlConnectionRequestBus::BroadcastResult(
+            sourceControlActive, &AzToolsFramework::SourceControlConnectionRequests::IsActive);
         // If Source Control is active then use it to check out the file before saving
         // otherwise query the file info and save only if the file is not read-only
-        auto SourceControlSaveCallback = [sourceControlActive](AzToolsFramework::SourceControlCommands* sourceControlCommands,
-            const char* filePath, const AzToolsFramework::SourceControlResponseCallback& configurationSaveCallback)
+        auto SourceControlSaveCallback = [sourceControlActive](
+                                             AzToolsFramework::SourceControlCommands* sourceControlCommands,
+                                             const char* filePath,
+                                             const AzToolsFramework::SourceControlResponseCallback& configurationSaveCallback)
         {
             if (sourceControlActive)
             {
@@ -120,7 +126,8 @@ namespace GeomNodes
 
         // Save GeomNodes System Configuration Settings Registry file
         rapidjson::Document gnConfigurationDocument;
-        rapidjson::Value& gnConfigurationValue = rapidjson::CreateValueByPointer(gnConfigurationDocument, rapidjson::Pointer(m_settingsRegistryPath.c_str()));
+        rapidjson::Value& gnConfigurationValue =
+            rapidjson::CreateValueByPointer(gnConfigurationDocument, rapidjson::Pointer(m_settingsRegistryPath.c_str()));
         AZ::JsonSerialization::Store(gnConfigurationValue, gnConfigurationDocument.GetAllocator(), config);
 
         auto postSaveCallback = [config, saveCallback](bool result)
@@ -131,8 +138,9 @@ namespace GeomNodes
             }
         };
 
-        AzToolsFramework::SourceControlCommandBus::Broadcast(SourceControlSaveCallback,
+        AzToolsFramework::SourceControlCommandBus::Broadcast(
+            SourceControlSaveCallback,
             m_gnConfigurationFilePath.c_str(),
             Internal::GetConfigurationSaveCallback(Internal::WriteDocumentToString(gnConfigurationDocument), postSaveCallback));
     }
-}
+} // namespace GeomNodes

+ 1 - 1
Gems/O3DE/GeomNodes/Code/Source/Editor/Configuration/GNEditorSettingsRegistryManager.h

@@ -19,7 +19,7 @@ namespace GeomNodes
 
         // GNSystemSettingsRegistry ...
         void SaveSystemConfiguration(const GNConfiguration& config, const OnGNConfigSaveComplete& saveCallback) const override;
-        
+
     private:
         AZ::IO::FixedMaxPath m_gnConfigurationFilePath = "Registry/geomnodesconfiguration.setreg";
 

+ 12 - 7
Gems/O3DE/GeomNodes/Code/Source/Editor/Configuration/GNSettingsRegistryManager.cpp

@@ -15,7 +15,8 @@ namespace GeomNodes
 {
     GNSettingsRegistryManager::GNSettingsRegistryManager()
     {
-        m_settingsRegistryPath = AZStd::string::format("%s/Gems/GeomNodes/GNConfiguration", AZ::SettingsRegistryMergeUtils::OrganizationRootKey);
+        m_settingsRegistryPath =
+            AZStd::string::format("%s/Gems/GeomNodes/GNConfiguration", AZ::SettingsRegistryMergeUtils::OrganizationRootKey);
     }
 
     AZStd::optional<GNConfiguration> GNSettingsRegistryManager::LoadSystemConfiguration() const
@@ -23,7 +24,7 @@ namespace GeomNodes
         GNConfiguration systemConfig;
 
         bool configurationRead = false;
-        
+
         AZ::SettingsRegistryInterface* settingsRegistry = AZ::SettingsRegistry::Get();
         if (settingsRegistry)
         {
@@ -32,19 +33,23 @@ namespace GeomNodes
 
         if (configurationRead)
         {
-            AZ_TracePrintf("GeomNodesSystem", R"(GNConfiguration was read from settings registry at pointer path)"
-                R"( "%s)" "\n",
+            AZ_TracePrintf(
+                "GeomNodesSystem",
+                R"(GNConfiguration was read from settings registry at pointer path)"
+                R"( "%s)"
+                "\n",
                 m_settingsRegistryPath.c_str());
             return systemConfig;
         }
         return AZStd::nullopt;
     }
 
-    void GNSettingsRegistryManager::SaveSystemConfiguration([[maybe_unused]] const GNConfiguration& config, const OnGNConfigSaveComplete& saveCallback) const
+    void GNSettingsRegistryManager::SaveSystemConfiguration(
+        [[maybe_unused]] const GNConfiguration& config, const OnGNConfigSaveComplete& saveCallback) const
     {
         if (saveCallback)
         {
             saveCallback(config, Result::Failed);
-        } 
+        }
     }
-}
+} // namespace GeomNodes

+ 3 - 3
Gems/O3DE/GeomNodes/Code/Source/Editor/EBus/EditorGeomNodesComponentBus.h

@@ -23,10 +23,10 @@ namespace GeomNodes
         //! Sends an IPC message to the script running on the blender instance.
         virtual void SendIPCMsg(const AZStd::string& msg) = 0;
         //! Tells the component that a parameter value has changed. Usually tied to AZ::Edit::Attributes::ChangeNotify
-		virtual void OnParamChange() = 0;
+        virtual void OnParamChange() = 0;
 
-	protected:
-		~EditorGeomNodesComponentRequests() = default;
+    protected:
+        ~EditorGeomNodesComponentRequests() = default;
     };
 
     using EditorGeomNodesComponentRequestBus = AZ::EBus<EditorGeomNodesComponentRequests>;

+ 4 - 2
Gems/O3DE/GeomNodes/Code/Source/Editor/EBus/IpcHandlerBus.h

@@ -22,11 +22,13 @@ namespace Ipc
         using BusIdType = AZ::EntityId;
         //////////////////////////////////////////////////////////////////////////
 
-        virtual ~IpcHandlerNotifications() {}
+        virtual ~IpcHandlerNotifications()
+        {
+        }
 
         //! Triggered when an IPC message is sent from the client(s) to the gem.
         virtual void OnMessageReceived(const AZ::u8* content, const AZ::u64 length) = 0;
     };
 
     using IpcHandlerNotificationBus = AZ::EBus<IpcHandlerNotifications>;
-}
+} // namespace Ipc

+ 1 - 2
Gems/O3DE/GeomNodes/Code/Source/Editor/EBus/ValidatorBus.h

@@ -14,8 +14,7 @@
 
 namespace GeomNodes
 {
-    class ValidatorTraits
-        : public AZ::EBusTraits
+    class ValidatorTraits : public AZ::EBusTraits
     {
     public:
         using Bus = AZ::EBus<ValidatorTraits>;

+ 9 - 4
Gems/O3DE/GeomNodes/Code/Source/Editor/Math/MathHelper.cpp

@@ -69,7 +69,7 @@ namespace GeomNodes
 
         return Scale3D;
     }
-        
+
     AZ::Matrix4x4 MathHelper::ConvertTransformAndScaleToMat4(const AZ::Transform& transform, const AZ::Vector3& nonUniformScale)
     {
         const AZ::Vector3& o3deTranslation = transform.GetTranslation();
@@ -80,37 +80,42 @@ namespace GeomNodes
         newTransform.SetTranslation(o3deTranslation);
         newTransform.SetRotationPartFromQuaternion(o3deRotation);
         newTransform.MultiplyByScale(newScale);
-        
+
         return newTransform;
     }
 
     std::size_t MathHelper::Align(std::size_t location, std::size_t align)
     {
-        //AZ_Assert(((0 != align) && !(align & (align - 1))), "non-power of 2 alignment");
         return ((location + (align - 1)) & ~(align - 1));
     }
+
     AZ::Vector2 MathHelper::Vec2fToVec2(const Vector2f& vec)
     {
         return AZ::Vector2(vec[0], vec[1]);
     }
+
     AZ::Vector3 MathHelper::Vec3fToVec3(const Vector3f& vec)
     {
         return AZ::Vector3(vec[0], vec[1], vec[2]);
     }
+
     AZ::Vector4 MathHelper::Vec4fToVec4(const Vector4f& vec)
     {
         return AZ::Vector4(vec[0], vec[1], vec[2], vec[3]);
     }
+
     Vector2f MathHelper::Vec2ToVec2f(const AZ::Vector2& vec)
     {
         return Vector2f{ vec.GetX(), vec.GetY() };
     }
+
     Vector3f MathHelper::Vec3ToVec3f(const AZ::Vector3& vec)
     {
         return Vector3f{ vec.GetX(), vec.GetY(), vec.GetZ() };
     }
+
     Vector4f MathHelper::Vec4ToVec4f(const AZ::Vector4& vec)
     {
         return Vector4f{ vec.GetX(), vec.GetY(), vec.GetZ(), vec.GetW() };
     }
-}
+} // namespace GeomNodes

+ 4 - 3
Gems/O3DE/GeomNodes/Code/Source/Editor/Math/MathHelper.h

@@ -8,13 +8,14 @@
 
 #pragma once
 
+#include <AzCore/Math/Matrix4x4.h>
+#include <AzCore/Math/Quaternion.h>
 #include <AzCore/Math/Transform.h>
 #include <AzCore/Math/Vector3.h>
 #include <AzCore/Math/Vector4.h>
-#include <AzCore/Math/Quaternion.h>
-#include <AzCore/Math/Matrix4x4.h>
-#include <AzCore/std/containers/vector.h>
 #include <AzCore/Utils/TypeHash.h>
+#include <AzCore/std/containers/vector.h>
+
 
 namespace GeomNodes
 {

+ 14 - 12
Gems/O3DE/GeomNodes/Code/Source/Editor/Modules/GeomNodesEditorModule.cpp

@@ -6,17 +6,17 @@
  *
  */
 
-#include <GeomNodes/GeomNodesTypeIds.h>
-#include <GeomNodesModuleInterface.h>
-#include "Editor/Components/EditorGeomNodesSystemComponent.h"
 #include "Editor/Components/EditorGeomNodesComponent.h"
+#include "Editor/Components/EditorGeomNodesSystemComponent.h"
 #include "Editor/Systems/GeomNodesSystem.h"
 #include <Editor/Configuration/GNEditorSettingsRegistryManager.h>
+#include <GeomNodes/GeomNodesTypeIds.h>
+#include <GeomNodesModuleInterface.h>
+
 
 namespace GeomNodes
 {
-    class GeomNodesEditorModule
-        : public GeomNodesModuleInterface
+    class GeomNodesEditorModule : public GeomNodesModuleInterface
     {
     public:
         AZ_RTTI(GeomNodesEditorModule, GeomNodesEditorModuleTypeId, GeomNodesModuleInterface);
@@ -25,15 +25,16 @@ namespace GeomNodes
         GeomNodesEditorModule()
             : m_gnSystem(AZStd::make_unique<GNEditorSettingsRegistryManager>())
         {
-
             // Push results of [MyComponent]::CreateDescriptor() into m_descriptors here.
             // Add ALL components descriptors associated with this gem to m_descriptors.
-            // This will associate the AzTypeInfo information for the components with the the SerializeContext, BehaviorContext and EditContext.
-            // This happens through the [MyComponent]::Reflect() function.
-            m_descriptors.insert(m_descriptors.end(), {
+            // This will associate the AzTypeInfo information for the components with the the SerializeContext, BehaviorContext and
+            // EditContext. This happens through the [MyComponent]::Reflect() function.
+            m_descriptors.insert(
+                m_descriptors.end(),
+                {
                     EditorGeomNodesSystemComponent::CreateDescriptor(),
                     EditorGeomNodesComponent::CreateDescriptor(),
-            });
+                });
         }
 
         virtual ~GeomNodesEditorModule()
@@ -47,14 +48,15 @@ namespace GeomNodes
          */
         AZ::ComponentTypeList GetRequiredSystemComponents() const override
         {
-            return AZ::ComponentTypeList {
+            return AZ::ComponentTypeList{
                 azrtti_typeid<EditorGeomNodesSystemComponent>(),
                 azrtti_typeid<EditorGeomNodesComponent>(),
             };
         }
+
     private:
         GeomNodesSystem m_gnSystem;
     };
-}// namespace GeomNodes
+} // namespace GeomNodes
 
 AZ_DECLARE_MODULE_CLASS(Gem_GeomNodes, GeomNodes::GeomNodesEditorModule)

+ 14 - 14
Gems/O3DE/GeomNodes/Code/Source/Editor/Rendering/Atom/GNAttributeBuffer.h

@@ -9,14 +9,15 @@
 #pragma once
 
 #include "GNBuffer.h"
-#include <Editor/Common/GNConstants.h>
 #include <Atom/RHI.Reflect/ShaderSemantic.h>
 #include <Atom/RPI.Reflect/Model/ModelLodAssetCreator.h>
+#include <Editor/Common/GNConstants.h>
 #include <Editor/Rendering/GNMeshData.h>
 
+
 namespace GeomNodes
 {
-	//! The number of attributes required by the mesh.
+    //! The number of attributes required by the mesh.
     inline constexpr uint32_t NumAttributes = 6;
 
     //! Trait to describe mesh vertex attribute format.
@@ -130,9 +131,7 @@ namespace GeomNodes
     {
         if (!IsValid())
         {
-            AZ_Error(
-                "AttributeBuffer", false, "Couldn't create buffer for attribute %s",
-                m_shaderSemantic.ToString().c_str());
+            AZ_Error("AttributeBuffer", false, "Couldn't create buffer for attribute %s", m_shaderSemantic.ToString().c_str());
         }
     }
 
@@ -167,12 +166,15 @@ namespace GeomNodes
     }
 
     template<AttributeType AttributeTypeT>
-    void AttributeBuffer<AttributeTypeT>::AddMeshStreamBuffer(AZ::RPI::ModelLodAssetCreator& modelLodCreator, const GNMeshData& meshData) const
-    {
-        modelLodCreator.AddMeshStreamBuffer(GetShaderSemantic(), AZ::Name(),
-            { m_buffer.GetBuffer(), 
-                AZ::RHI::BufferViewDescriptor::CreateTyped(meshData.GetOffset<AttributeTypeT>(), meshData.GetCount<AttributeTypeT>(), m_format)
-            });
+    void AttributeBuffer<AttributeTypeT>::AddMeshStreamBuffer(
+        AZ::RPI::ModelLodAssetCreator& modelLodCreator, const GNMeshData& meshData) const
+    {
+        modelLodCreator.AddMeshStreamBuffer(
+            GetShaderSemantic(),
+            AZ::Name(),
+            { m_buffer.GetBuffer(),
+              AZ::RHI::BufferViewDescriptor::CreateTyped(
+                  meshData.GetOffset<AttributeTypeT>(), meshData.GetCount<AttributeTypeT>(), m_format) });
     }
 
     template<AttributeType AttributeTypeT>
@@ -187,9 +189,7 @@ namespace GeomNodes
     {
         if (!m_buffer.UpdateData(data))
         {
-            AZ_Error(
-                "AttributeBuffer", false, "Couldn't update buffer for attribute %s",
-                m_shaderSemantic.ToString().c_str());
+            AZ_Error("AttributeBuffer", false, "Couldn't update buffer for attribute %s", m_shaderSemantic.ToString().c_str());
             return false;
         }
 

+ 2 - 3
Gems/O3DE/GeomNodes/Code/Source/Editor/Rendering/Atom/GNBuffer.h

@@ -75,8 +75,7 @@ namespace GeomNodes
 
         //! The format used by the buffer (must be one of the supported types in GetFormatForVertexStreamDataType).
         static constexpr auto VertexStreamFormat = GetFormatForVertexStreamDataType<VertexStreamDataType>();
-        static_assert(
-            VertexStreamFormat != AZ::RHI::Format::Unknown, "Cannot initialize a buffer with an unknown format.");
+        static_assert(VertexStreamFormat != AZ::RHI::Format::Unknown, "Cannot initialize a buffer with an unknown format.");
     };
 
     template<typename VertexStreamDataType>
@@ -116,7 +115,7 @@ namespace GeomNodes
         }
         else
         {
-            m_bufferAssetView = AZ::RPI::BufferAssetView{m_buffer, m_bufferViewDescriptor};
+            m_bufferAssetView = AZ::RPI::BufferAssetView{ m_buffer, m_bufferViewDescriptor };
             m_isValid = true;
         }
     }

+ 239 - 214
Gems/O3DE/GeomNodes/Code/Source/Editor/Rendering/GNMeshController.cpp

@@ -6,23 +6,23 @@
  *
  */
 
+#include <Editor/Common/GNConstants.h>
+#include <Editor/EBus/EditorGeomNodesComponentBus.h>
 #include <Editor/Rendering/GNMeshController.h>
 #include <Editor/Rendering/GNRenderMesh.h>
 #include <Editor/UI/Utils.h>
-#include <Editor/Common/GNConstants.h>
-#include <Editor/EBus/EditorGeomNodesComponentBus.h>
 
-#include <AzCore/Debug/Profiler.h>
+#include <AtomLyIntegration/CommonFeatures/Material/MaterialComponentConstants.h>
+#include <AtomLyIntegration/CommonFeatures/Mesh/MeshComponentBus.h>
+#include <AtomLyIntegration/CommonFeatures/Mesh/MeshComponentConstants.h>
 #include <AzCore/Component/NonUniformScaleBus.h>
-#include <AzCore/std/string/regex.h>
+#include <AzCore/Debug/Profiler.h>
 #include <AzCore/Utils/Utils.h>
-#include <AzToolsFramework/API/ToolsApplicationAPI.h>
+#include <AzCore/std/string/regex.h>
 #include <AzToolsFramework/API/EntityCompositionRequestBus.h>
-#include <AzToolsFramework/ToolsComponents/TransformComponent.h>
+#include <AzToolsFramework/API/ToolsApplicationAPI.h>
 #include <AzToolsFramework/Entity/EditorEntityHelpers.h>
-#include <AtomLyIntegration/CommonFeatures/Mesh/MeshComponentConstants.h>
-#include <AtomLyIntegration/CommonFeatures/Material/MaterialComponentConstants.h>
-#include <AtomLyIntegration/CommonFeatures/Mesh/MeshComponentBus.h>
+#include <AzToolsFramework/ToolsComponents/TransformComponent.h>
 
 namespace GeomNodes
 {
@@ -34,242 +34,267 @@ namespace GeomNodes
             m_renderMesh = AZStd::make_unique<GNRenderMesh>(m_entityId);
         }
 
-		AZ::TransformNotificationBus::Handler::BusConnect(m_entityId);
-		AzFramework::AssetCatalogEventBus::Handler::BusConnect();
+        AZ::TransformNotificationBus::Handler::BusConnect(m_entityId);
+        AzFramework::AssetCatalogEventBus::Handler::BusConnect();
 
-		m_world = AZ::Transform::CreateIdentity();
-		AZ::TransformBus::EventResult(m_world, m_entityId, &AZ::TransformBus::Events::GetWorldTM);
+        m_world = AZ::Transform::CreateIdentity();
+        AZ::TransformBus::EventResult(m_world, m_entityId, &AZ::TransformBus::Events::GetWorldTM);
     }
 
     GNMeshController::~GNMeshController()
     {
-		AzFramework::AssetCatalogEventBus::Handler::BusDisconnect();
-		AzToolsFramework::EditorComponentSelectionRequestsBus::Handler::BusDisconnect();
-		AzFramework::BoundsRequestBus::Handler::BusDisconnect();
-		AZ::TransformNotificationBus::Handler::BusDisconnect();
-		m_renderMesh.reset();
+        AzFramework::AssetCatalogEventBus::Handler::BusDisconnect();
+        AzToolsFramework::EditorComponentSelectionRequestsBus::Handler::BusDisconnect();
+        AzFramework::BoundsRequestBus::Handler::BusDisconnect();
+        AZ::TransformNotificationBus::Handler::BusDisconnect();
+        m_renderMesh.reset();
     }
 
-    AZ::Aabb GNMeshController::GetEditorSelectionBoundsViewport(const AzFramework::ViewportInfo& /*viewportInfo*/)
+    AZ::Aabb GNMeshController::GetEditorSelectionBoundsViewport([[maybe_unused]] const AzFramework::ViewportInfo& viewportInfo)
     {
         return GetWorldBounds();
     }
-    bool GNMeshController::EditorSelectionIntersectRayViewport(const AzFramework::ViewportInfo& /*viewportInfo*/, const AZ::Vector3& src, const AZ::Vector3& dir, float& distance)
+
+    bool GNMeshController::EditorSelectionIntersectRayViewport(
+        [[maybe_unused]] const AzFramework::ViewportInfo& viewportInfo, const AZ::Vector3& src, const AZ::Vector3& dir, float& distance)
     {
-		AZ_PROFILE_FUNCTION(AzToolsFramework);
+        AZ_PROFILE_FUNCTION(AzToolsFramework);
 
-		if (!m_renderMesh->GetModel())
-		{
-			return false;
-		}
+        if (!m_renderMesh->GetModel())
+        {
+            return false;
+        }
 
-		AZ::Transform transform = AZ::Transform::CreateIdentity();
-		AZ::TransformBus::EventResult(transform, m_entityId, &AZ::TransformBus::Events::GetWorldTM);
+        AZ::Transform transform = AZ::Transform::CreateIdentity();
+        AZ::TransformBus::EventResult(transform, m_entityId, &AZ::TransformBus::Events::GetWorldTM);
 
-		AZ::Vector3 nonUniformScale = AZ::Vector3::CreateOne();
-		AZ::NonUniformScaleRequestBus::EventResult(nonUniformScale, m_entityId, &AZ::NonUniformScaleRequests::GetScale);
+        AZ::Vector3 nonUniformScale = AZ::Vector3::CreateOne();
+        AZ::NonUniformScaleRequestBus::EventResult(nonUniformScale, m_entityId, &AZ::NonUniformScaleRequests::GetScale);
 
-		float t;
-		AZ::Vector3 ignoreNormal;
-		constexpr float rayLength = 1000.0f;
-		if (m_renderMesh->GetModel()->RayIntersection(transform, nonUniformScale, src, dir * rayLength, t, ignoreNormal))
-		{
-			distance = rayLength * t;
-			return true;
-		}
+        float t;
+        AZ::Vector3 ignoreNormal;
+        constexpr float rayLength = 1000.0f;
+        if (m_renderMesh->GetModel()->RayIntersection(transform, nonUniformScale, src, dir * rayLength, t, ignoreNormal))
+        {
+            distance = rayLength * t;
+            return true;
+        }
 
-		return false;
+        return false;
     }
+
     bool GNMeshController::SupportsEditorRayIntersect()
     {
         return true;
     }
+
     AZ::Aabb GNMeshController::GetWorldBounds()
     {
-		if (!m_worldAabb.has_value())
-		{
-			m_worldAabb = GetLocalBounds();
-			m_worldAabb->ApplyTransform(m_world);
-		}
+        if (!m_worldAabb.has_value())
+        {
+            m_worldAabb = GetLocalBounds();
+            m_worldAabb->ApplyTransform(m_world);
+        }
 
-		return m_worldAabb.value();
+        return m_worldAabb.value();
     }
+
     AZ::Aabb GNMeshController::GetLocalBounds()
     {
-		if (!m_localAabb.has_value() && m_modelData.MeshCount() > 0)
-		{
-			m_localAabb = m_modelData.GetAabb();
-		}
+        if (!m_localAabb.has_value() && m_modelData.MeshCount() > 0)
+        {
+            m_localAabb = m_modelData.GetAabb();
+        }
 
-		return m_localAabb.value();
+        return m_localAabb.value();
     }
-	void GNMeshController::RebuildRenderMesh()
-	{
-		if (!m_materialWaitList.empty())
-			return;
-
-		m_worldAabb.reset();
-		m_localAabb.reset();
-
-		if (m_modelData.MeshCount() > 0)
-		{
-			AZ::SystemTickBus::QueueFunction(
-				[=]() {
-				AzToolsFramework::EditorComponentSelectionRequestsBus::Handler::BusDisconnect();
-				AzFramework::BoundsRequestBus::Handler::BusDisconnect();
-				m_renderMesh->BuildMesh(m_modelData);
-				m_renderMesh->UpdateTransform(m_world);
-				AzFramework::BoundsRequestBus::Handler::BusConnect(m_entityId);
-				AzToolsFramework::EditorComponentSelectionRequestsBus::Handler::BusConnect(m_entityId);
-				EditorGeomNodesComponentRequestBus::Event(m_entityId, &EditorGeomNodesComponentRequests::SetWorkInProgress, false);
-			});
-		}
-	}
-
-	void GNMeshController::ReadData(AZ::u64 mapId)
-	{
-		m_modelData.ReadData(mapId);
-
-		// set the render mesh's material list here so it only get the materials for the current object and not the whole scene.
-		MaterialList materialList;
-		AZStd::string materialFilePath = AZStd::string(AssetsFolderPath) + m_blenderFilename + "/" + MaterialsFolder.data() + "/";
-		for (auto materialName : m_modelData.GetMaterials())
-		{
-			AZStd::string azMaterialPath = materialFilePath + materialName + AzMaterialExtension.data();
-			materialList.push_back(azMaterialPath);
-		}
-
-		m_renderMesh->SetMaterialPathList(materialList);
-	}
-
-	void GNMeshController::LoadMaterials(const rapidjson::Value& materialArray)
-	{
-		m_materialWaitList.clear();
-		// iterate through the material arrays and write them into files.
-		AZStd::string projectRootPath = GetProjectRoot() + "/";
-		AZStd::string materialFilePath = AZStd::string(AssetsFolderPath) + m_blenderFilename + "/" + MaterialsFolder.data() + "/";
-		for (rapidjson::Value::ConstValueIterator itr = materialArray.Begin(); itr != materialArray.End(); ++itr)
-		{
-			const auto matItr = itr->MemberBegin();
-			AZStd::string materialName = matItr->name.GetString();
-			AZStd::string materialContent = matItr->value.GetString();
-
-			AZStd::string fullFilePath = projectRootPath + materialFilePath + materialName + MaterialExtension.data();
-
-			AZ::Utils::WriteFile(materialContent, fullFilePath.c_str());
-
-			AZStd::string azMaterialPath = materialFilePath + materialName + AzMaterialExtension.data();
-			if (AZ::IO::FileIOBase::GetInstance()->Exists(azMaterialPath.c_str()))
-			{
-				AZ::Data::AssetId materialAssetId;
-				EBUS_EVENT_RESULT(materialAssetId, AZ::Data::AssetCatalogRequestBus, GetAssetIdByPath, azMaterialPath.c_str(), AZ::Data::s_invalidAssetType, false);
-
-				// If found, notify mesh that the mesh data is assigned and material is ready.
-				if (!materialAssetId.IsValid())
-				{
-					m_materialWaitList.push_back(azMaterialPath);
-				}
-			}
-			else {
-				m_materialWaitList.push_back(azMaterialPath);
-			}
-		}
-	}
-
-	void GNMeshController::SetFileName(const AZStd::string& path)
-	{
-		AzFramework::StringFunc::Path::GetFileName(path.c_str(), m_blenderFilename);
-
-		AZStd::regex reg("[^\\w\\s]+");
-		m_blenderFilename = AZStd::regex_replace(m_blenderFilename, reg, "_");
-	}
-
-	AZStd::string GNMeshController::GenerateFBXPath()
-	{
-		AZStd::string fullFilePath = GetProjectRoot() + "/";
-		AZStd::string filePath = AZStd::string(AssetsFolderPath) + m_blenderFilename + "/";
-		fullFilePath += filePath + GenerateModelAssetName() + FbxExtension.data();
-		return fullFilePath;
-	}
-
-	AZStd::string GNMeshController::GenerateModelAssetName()
-	{
-		return m_blenderFilename + "_" + AZStd::string::format("%llu", (AZ::u64)m_entityId);
-	}
-
-    void GNMeshController::OnTransformChanged(const AZ::Transform& /*local*/, const AZ::Transform& world)
+
+    void GNMeshController::RebuildRenderMesh()
     {
-		m_worldAabb.reset();
-		m_localAabb.reset();
+        if (!m_materialWaitList.empty())
+            return;
 
-		m_world = world;
+        m_worldAabb.reset();
+        m_localAabb.reset();
 
-		if (m_renderMesh)
-		{
-			m_renderMesh->UpdateTransform(world);
-		}
+        if (m_modelData.MeshCount() > 0)
+        {
+            AZ::SystemTickBus::QueueFunction(
+                [=]()
+                {
+                    AzToolsFramework::EditorComponentSelectionRequestsBus::Handler::BusDisconnect();
+                    AzFramework::BoundsRequestBus::Handler::BusDisconnect();
+                    m_renderMesh->BuildMesh(m_modelData);
+                    m_renderMesh->UpdateTransform(m_world);
+                    AzFramework::BoundsRequestBus::Handler::BusConnect(m_entityId);
+                    AzToolsFramework::EditorComponentSelectionRequestsBus::Handler::BusConnect(m_entityId);
+                    EditorGeomNodesComponentRequestBus::Event(m_entityId, &EditorGeomNodesComponentRequests::SetWorkInProgress, false);
+                });
+        }
+    }
+
+    void GNMeshController::ReadData(AZ::u64 mapId)
+    {
+        m_modelData.ReadData(mapId);
+
+        // set the render mesh's material list here so it only get the materials for the current object and not the whole scene.
+        MaterialList materialList;
+        AZStd::string materialFilePath = AZStd::string(AssetsFolderPath) + m_blenderFilename + "/" + MaterialsFolder.data() + "/";
+        for (auto materialName : m_modelData.GetMaterials())
+        {
+            AZStd::string azMaterialPath = materialFilePath + materialName + AzMaterialExtension.data();
+            materialList.push_back(azMaterialPath);
+        }
+
+        m_renderMesh->SetMaterialPathList(materialList);
+    }
+
+    void GNMeshController::LoadMaterials(const rapidjson::Value& materialArray)
+    {
+        m_materialWaitList.clear();
+        // iterate through the material arrays and write them into files.
+        AZStd::string projectRootPath = GetProjectRoot() + "/";
+        AZStd::string materialFilePath = AZStd::string(AssetsFolderPath) + m_blenderFilename + "/" + MaterialsFolder.data() + "/";
+        for (rapidjson::Value::ConstValueIterator itr = materialArray.Begin(); itr != materialArray.End(); ++itr)
+        {
+            const auto matItr = itr->MemberBegin();
+            AZStd::string materialName = matItr->name.GetString();
+            AZStd::string materialContent = matItr->value.GetString();
+
+            AZStd::string fullFilePath = projectRootPath + materialFilePath + materialName + MaterialExtension.data();
+
+            AZ::Utils::WriteFile(materialContent, fullFilePath.c_str());
+
+            AZStd::string azMaterialPath = materialFilePath + materialName + AzMaterialExtension.data();
+            if (AZ::IO::FileIOBase::GetInstance()->Exists(azMaterialPath.c_str()))
+            {
+                AZ::Data::AssetId materialAssetId;
+                EBUS_EVENT_RESULT(
+                    materialAssetId,
+                    AZ::Data::AssetCatalogRequestBus,
+                    GetAssetIdByPath,
+                    azMaterialPath.c_str(),
+                    AZ::Data::s_invalidAssetType,
+                    false);
+
+                // If found, notify mesh that the mesh data is assigned and material is ready.
+                if (!materialAssetId.IsValid())
+                {
+                    m_materialWaitList.push_back(azMaterialPath);
+                }
+            }
+            else
+            {
+                m_materialWaitList.push_back(azMaterialPath);
+            }
+        }
+    }
+
+    void GNMeshController::SetFileName(const AZStd::string& path)
+    {
+        AzFramework::StringFunc::Path::GetFileName(path.c_str(), m_blenderFilename);
+
+        AZStd::regex reg("[^\\w\\s]+");
+        m_blenderFilename = AZStd::regex_replace(m_blenderFilename, reg, "_");
+    }
+
+    AZStd::string GNMeshController::GenerateFBXPath()
+    {
+        AZStd::string fullFilePath = GetProjectRoot() + "/";
+        AZStd::string filePath = AZStd::string(AssetsFolderPath) + m_blenderFilename + "/";
+        fullFilePath += filePath + GenerateModelAssetName() + FbxExtension.data();
+        return fullFilePath;
+    }
+
+    AZStd::string GNMeshController::GenerateModelAssetName()
+    {
+        return m_blenderFilename + "_" + AZStd::string::format("%llu", (AZ::u64)m_entityId);
+    }
+
+    void GNMeshController::OnTransformChanged([[maybe_unused]] const AZ::Transform& local, const AZ::Transform& world)
+    {
+        m_worldAabb.reset();
+        m_localAabb.reset();
+
+        m_world = world;
+
+        if (m_renderMesh)
+        {
+            m_renderMesh->UpdateTransform(world);
+        }
+    }
+
+    void GNMeshController::OnCatalogAssetAdded(const AZ::Data::AssetId& assetId)
+    {
+        AZ::Data::AssetInfo assetInfo;
+        EBUS_EVENT_RESULT(assetInfo, AZ::Data::AssetCatalogRequestBus, GetAssetInfoById, assetId);
+
+        // note that this will get called twice, once with the real assetId and once with legacy assetId.
+        // we only want to add the real asset to the list, in which the assetId passed in is equal to the final assetId returned
+        // otherwise, you look up assetId (and its a legacy assetId) and the actual asset will be different.
+        if ((assetInfo.m_assetId.IsValid()) && (assetInfo.m_assetId == assetId))
+        {
+            AZStd::string assetName;
+            AzFramework::StringFunc::Path::GetFileName(assetInfo.m_relativePath.c_str(), assetName);
+
+            bool workInProgress = false;
+            EditorGeomNodesComponentRequestBus::EventResult(
+                workInProgress, m_entityId, &EditorGeomNodesComponentRequests::GetWorkInProgress);
+            if (workInProgress && (assetName == GenerateModelAssetName()))
+            {
+                auto entity = AzToolsFramework::GetEntity(m_entityId);
+                auto transformComponent = entity->FindComponent<AzToolsFramework::Components::TransformComponent>();
+                AZ::EntityId parentId = transformComponent->GetParentId();
+                auto worldTransform = transformComponent->GetWorldTM();
+
+                AZ::EntityId entityId;
+                EBUS_EVENT_RESULT(entityId, AzToolsFramework::EditorRequests::Bus, CreateNewEntity, parentId);
+
+                AzToolsFramework::EntityIdList entityIdList = { entityId };
+
+                AzToolsFramework::EntityCompositionRequests::AddComponentsOutcome addedComponentsResult =
+                    AZ::Failure(AZStd::string("Failed to call AddComponentsToEntities on EntityCompositionRequestBus"));
+                AzToolsFramework::EntityCompositionRequestBus::BroadcastResult(
+                    addedComponentsResult,
+                    &AzToolsFramework::EntityCompositionRequests::AddComponentsToEntities,
+                    entityIdList,
+                    AZ::ComponentTypeList{ AZ::Render::EditorMeshComponentTypeId });
+
+                if (addedComponentsResult.IsSuccess())
+                {
+                    AZ::TransformBus::Event(entityId, &AZ::TransformBus::Events::SetWorldTM, worldTransform);
+
+                    AZ::Render::MeshComponentRequestBus::Event(
+                        entityId, &AZ::Render::MeshComponentRequestBus::Events::SetModelAssetPath, assetInfo.m_relativePath);
+
+                    EBUS_EVENT(
+                        AzToolsFramework::ToolsApplicationRequests::Bus,
+                        DeleteEntitiesAndAllDescendants,
+                        AzToolsFramework::EntityIdList{ m_entityId });
+                }
+
+                EditorGeomNodesComponentRequestBus::Event(m_entityId, &EditorGeomNodesComponentRequests::SetWorkInProgress, false);
+            }
+            else
+            {
+                if (!m_materialWaitList.empty())
+                {
+                    auto iter = AZStd::find(m_materialWaitList.begin(), m_materialWaitList.end(), assetInfo.m_relativePath);
+                    if (iter != m_materialWaitList.end())
+                    {
+                        m_materialWaitList.erase(iter);
+                        if (m_materialWaitList.empty())
+                        {
+                            RebuildRenderMesh();
+                        }
+                    }
+                }
+            }
+        }
+    }
+
+    void GNMeshController::OnCatalogAssetChanged(const AZ::Data::AssetId& assetId)
+    {
+        OnCatalogAssetAdded(assetId);
     }
-	void GNMeshController::OnCatalogAssetAdded(const AZ::Data::AssetId& assetId)
-	{
-		AZ::Data::AssetInfo assetInfo;
-		EBUS_EVENT_RESULT(assetInfo, AZ::Data::AssetCatalogRequestBus, GetAssetInfoById, assetId);
-
-		// note that this will get called twice, once with the real assetId and once with legacy assetId.
-		// we only want to add the real asset to the list, in which the assetId passed in is equal to the final assetId returned
-		// otherwise, you look up assetId (and its a legacy assetId) and the actual asset will be different.
-		if ((assetInfo.m_assetId.IsValid()) && (assetInfo.m_assetId == assetId))
-		{
-			AZStd::string assetName;
-			AzFramework::StringFunc::Path::GetFileName(assetInfo.m_relativePath.c_str(), assetName);
-
-			bool workInProgress = false;
-			EditorGeomNodesComponentRequestBus::EventResult(workInProgress, m_entityId, &EditorGeomNodesComponentRequests::GetWorkInProgress);
-			if (workInProgress && (assetName == GenerateModelAssetName()))
-			{
-				auto entity = AzToolsFramework::GetEntity(m_entityId);
-				auto transformComponent = entity->FindComponent<AzToolsFramework::Components::TransformComponent>();
-				AZ::EntityId parentId = transformComponent->GetParentId();
-				auto worldTransform = transformComponent->GetWorldTM();
-
-				AZ::EntityId entityId;
-				EBUS_EVENT_RESULT(entityId, AzToolsFramework::EditorRequests::Bus, CreateNewEntity, parentId);
-
-				AzToolsFramework::EntityIdList entityIdList = { entityId };
-
-				AzToolsFramework::EntityCompositionRequests::AddComponentsOutcome addedComponentsResult = AZ::Failure(AZStd::string("Failed to call AddComponentsToEntities on EntityCompositionRequestBus"));
-				AzToolsFramework::EntityCompositionRequestBus::BroadcastResult(addedComponentsResult, &AzToolsFramework::EntityCompositionRequests::AddComponentsToEntities, entityIdList, AZ::ComponentTypeList{ AZ::Render::EditorMeshComponentTypeId });
-
-				if (addedComponentsResult.IsSuccess())
-				{
-					AZ::TransformBus::Event(
-						entityId, &AZ::TransformBus::Events::SetWorldTM, worldTransform);
-
-					AZ::Render::MeshComponentRequestBus::Event(
-						entityId, &AZ::Render::MeshComponentRequestBus::Events::SetModelAssetPath, assetInfo.m_relativePath);
-
-					EBUS_EVENT(AzToolsFramework::ToolsApplicationRequests::Bus, DeleteEntitiesAndAllDescendants, AzToolsFramework::EntityIdList{ m_entityId });
-				}
-
-				EditorGeomNodesComponentRequestBus::Event(m_entityId, &EditorGeomNodesComponentRequests::SetWorkInProgress, false);
-			}
-			else
-			{
-				if (!m_materialWaitList.empty())
-				{
-					auto iter = AZStd::find(m_materialWaitList.begin(), m_materialWaitList.end(), assetInfo.m_relativePath);
-					if (iter != m_materialWaitList.end())
-					{
-						m_materialWaitList.erase(iter);
-						if (m_materialWaitList.empty()) {
-							RebuildRenderMesh();
-						}
-					}
-				}
-			}
-		}
-	}
-	void GNMeshController::OnCatalogAssetChanged(const AZ::Data::AssetId& assetId)
-	{
-		OnCatalogAssetAdded(assetId);
-	}
 } // namespace GeomNodes

+ 52 - 52
Gems/O3DE/GeomNodes/Code/Source/Editor/Rendering/GNMeshController.h

@@ -7,78 +7,78 @@
  */
 
 #pragma once
-#include <AzFramework/Visibility/BoundsBus.h>
-#include <AzFramework/Asset/AssetCatalogBus.h>
 #include <AzCore/Component/TransformBus.h>
+#include <AzFramework/Asset/AssetCatalogBus.h>
+#include <AzFramework/Visibility/BoundsBus.h>
 #include <AzToolsFramework/API/ComponentEntitySelectionBus.h>
 #include <Editor/Rendering/GNModelData.h>
 
+
 namespace GeomNodes
 {
-	class GNRenderMesh;
-	//! A common class that handles everything from storing the model data, rendering the mesh via GNRenderMesh
-	//! handling different mesh events like bound request, transform updates and others.
+    class GNRenderMesh;
+    //! A common class that handles everything from storing the model data, rendering the mesh via GNRenderMesh
+    //! handling different mesh events like bound request, transform updates and others.
     class GNMeshController
-		: public AzFramework::BoundsRequestBus::Handler
-		, public AzToolsFramework::EditorComponentSelectionRequestsBus::Handler
-		, private AZ::TransformNotificationBus::Handler
-		, private AzFramework::AssetCatalogEventBus::Handler
+        : public AzFramework::BoundsRequestBus::Handler
+        , public AzToolsFramework::EditorComponentSelectionRequestsBus::Handler
+        , private AZ::TransformNotificationBus::Handler
+        , private AzFramework::AssetCatalogEventBus::Handler
     {
     public:
         explicit GNMeshController(AZ::EntityId entityId);
         ~GNMeshController();
 
-		// EditorComponentSelectionRequestsBus overrides ...
-		AZ::Aabb GetEditorSelectionBoundsViewport(const AzFramework::ViewportInfo& viewportInfo) override;
-		bool EditorSelectionIntersectRayViewport(
-			const AzFramework::ViewportInfo& viewportInfo, const AZ::Vector3& src, const AZ::Vector3& dir,
-			float& distance) override;
-		bool SupportsEditorRayIntersect() override;
+        // EditorComponentSelectionRequestsBus overrides ...
+        AZ::Aabb GetEditorSelectionBoundsViewport(const AzFramework::ViewportInfo& viewportInfo) override;
+        bool EditorSelectionIntersectRayViewport(
+            const AzFramework::ViewportInfo& viewportInfo, const AZ::Vector3& src, const AZ::Vector3& dir, float& distance) override;
+        bool SupportsEditorRayIntersect() override;
 
-		// BoundsRequestBus overrides ...
-		AZ::Aabb GetWorldBounds() override;
-		AZ::Aabb GetLocalBounds() override;
+        // BoundsRequestBus overrides ...
+        AZ::Aabb GetWorldBounds() override;
+        AZ::Aabb GetLocalBounds() override;
 
-		//! Builds the model for atom rendering.
-		void RebuildRenderMesh();
-		//! Read the data from the shared memory and setup everything before building the render mesh.
-		void ReadData(AZ::u64 mapId);
+        //! Builds the model for atom rendering.
+        void RebuildRenderMesh();
+        //! Read the data from the shared memory and setup everything before building the render mesh.
+        void ReadData(AZ::u64 mapId);
 
-		//! Load the materials giver the json array. If there materials that are still in the AP in will tag them for waiting
-		//! so that the render mesh can properly load the materials.
-		void LoadMaterials(const rapidjson::Value& materialArray);
-		//! Sets the blender filename.
-		void SetFileName(const AZStd::string& path);
-		//! Generates the full FBX Path. This is usually used when exporting. 
-		AZStd::string GenerateFBXPath();
-		//! Generates the Model asset name with the full path but without the file extension.
-		AZStd::string GenerateModelAssetName();
+        //! Load the materials giver the json array. If there materials that are still in the AP in will tag them for waiting
+        //! so that the render mesh can properly load the materials.
+        void LoadMaterials(const rapidjson::Value& materialArray);
+        //! Sets the blender filename.
+        void SetFileName(const AZStd::string& path);
+        //! Generates the full FBX Path. This is usually used when exporting.
+        AZStd::string GenerateFBXPath();
+        //! Generates the Model asset name with the full path but without the file extension.
+        AZStd::string GenerateModelAssetName();
 
     private:
-		// TransformNotificationBus overrides ...
-		void OnTransformChanged(const AZ::Transform& local, const AZ::Transform& world) override;
+        // TransformNotificationBus overrides ...
+        void OnTransformChanged(const AZ::Transform& local, const AZ::Transform& world) override;
 
-		// AssetCatalogEventBus::Handler ...
-		//! we use these functions to know if our assets like materials are already loaded so we can proceed with rendering the model/meshes
-		void OnCatalogAssetAdded(const AZ::Data::AssetId& assetId) override;
-		void OnCatalogAssetChanged(const AZ::Data::AssetId& assetId) override;
+        // AssetCatalogEventBus::Handler ...
+        //! we use these functions to know if our assets like materials are already loaded so we can proceed with rendering the model/meshes
+        void OnCatalogAssetAdded(const AZ::Data::AssetId& assetId) override;
+        void OnCatalogAssetChanged(const AZ::Data::AssetId& assetId) override;
 
-		//! assigned EntityId to this Mesh Controller
+        //! assigned EntityId to this Mesh Controller
         AZ::EntityId m_entityId;
-		//! Stores the model's data.
-		GNModelData m_modelData;
-		//! Reference to our render mesh.
-		AZStd::unique_ptr<GNRenderMesh> m_renderMesh;
-		//! Current world transform of the object.
-		AZ::Transform m_world = AZ::Transform::CreateIdentity();
-		//! Cached world aabb (used for selection/view determination).
-		AZStd::optional<AZ::Aabb> m_worldAabb; 
-		//! Cached local aabb (used for center pivot calculation).
-		AZStd::optional<AZ::Aabb> m_localAabb; 
-		//! Current loaded blender filename
-		AZStd::string m_blenderFilename;
-		//! List for materials building in AP. Having an empty list all materials are built and ready for loading.
-		AZStd::vector<AZStd::string> m_materialWaitList;
+        //! Stores the model's data.
+        GNModelData m_modelData;
+        //! Reference to our render mesh.
+        AZStd::unique_ptr<GNRenderMesh> m_renderMesh;
+        //! Current world transform of the object.
+        AZ::Transform m_world = AZ::Transform::CreateIdentity();
+        //! Cached world aabb (used for selection/view determination).
+        AZStd::optional<AZ::Aabb> m_worldAabb;
+        //! Cached local aabb (used for center pivot calculation).
+        AZStd::optional<AZ::Aabb> m_localAabb;
+        //! Current loaded blender filename
+        AZStd::string m_blenderFilename;
+        //! List for materials building in AP. Having an empty list all materials are built and ready for loading.
+        AZStd::vector<AZStd::string> m_materialWaitList;
     };
 
 } // namespace GeomNodes

+ 187 - 148
Gems/O3DE/GeomNodes/Code/Source/Editor/Rendering/GNMeshData.cpp

@@ -6,8 +6,9 @@
  *
  */
 
-#include <Editor/Rendering/GNMeshData.h>
 #include <AzCore/std/containers/unordered_map.h>
+#include <Editor/Rendering/GNMeshData.h>
+
 
 namespace GeomNodes
 {
@@ -35,21 +36,24 @@ namespace GeomNodes
         m_hash = hash;
         m_colors = colors;
         m_uvs = uvs;
-		m_indices.resize(indices.size());
-		AZStd::transform(indices.begin(), indices.end(), m_indices.begin(),
-			[](int x)
-		{
-			return aznumeric_cast<AZ::u32>(x);
-		});
-        
+        m_indices.resize(indices.size());
+        AZStd::transform(
+            indices.begin(),
+            indices.end(),
+            m_indices.begin(),
+            [](int x)
+            {
+                return aznumeric_cast<AZ::u32>(x);
+            });
+
         m_materialIndices = materialIndices;
         m_materialNames = materials;
 
-        // we still need to build all the vertices, uvs, normals and colors as what we have is incomplete. 
+        // we still need to build all the vertices, uvs, normals and colors as what we have is incomplete.
         // the initial data are shared and is done this way so the data coming from blender will be small.
         Vert2Vector finalUVs;
         Vert3Vector finalPositions, finalNormals;
-		Vert4Vector finalColors;
+        Vert4Vector finalColors;
 
         finalPositions.reserve(m_positions.size());
         finalNormals.reserve(m_normals.size());
@@ -70,67 +74,72 @@ namespace GeomNodes
                 normal,
                 m_uvs[isIndexedUVs ? *indexPtr : triangleLoops[i]],
                 m_colors[isIndexedColors ? *indexPtr : triangleLoops[i]]);
-            
+
             auto iter = uniqueKeys.find(key);
             if (iter == uniqueKeys.end())
             {
-				finalPositions.emplace_back(m_positions[*indexPtr]);
+                finalPositions.emplace_back(m_positions[*indexPtr]);
 
-				if (isIndexedUVs)
-				{
-					finalUVs.emplace_back(m_uvs[*indexPtr]);
-				}
+                if (isIndexedUVs)
+                {
+                    finalUVs.emplace_back(m_uvs[*indexPtr]);
+                }
 
-				if (isIndexedColors)
-				{
-					finalColors.emplace_back(m_colors[*indexPtr]);
-				}
+                if (isIndexedColors)
+                {
+                    finalColors.emplace_back(m_colors[*indexPtr]);
+                }
 
                 // update the indexes using the new one
                 *indexPtr = m_loops[triangleLoops[i]] = aznumeric_cast<AZ::s32>(finalPositions.size() - 1);
-				finalNormals.emplace_back(normal);
-				uniqueKeys.emplace(AZStd::make_pair<UniqueKey, AZ::s32>(AZStd::move(key), AZStd::move(i)));
+                finalNormals.emplace_back(normal);
+                uniqueKeys.emplace(AZStd::make_pair<UniqueKey, AZ::s32>(AZStd::move(key), AZStd::move(i)));
             }
             else
             {
-				auto splitVertexIdx = iter->second;
+                auto splitVertexIdx = iter->second;
                 *indexPtr = m_indices[splitVertexIdx];
-				m_loops[triangleLoops[i]] = m_loops[triangleLoops[splitVertexIdx]];
+                m_loops[triangleLoops[i]] = m_loops[triangleLoops[splitVertexIdx]];
             }
         }
 
         m_positions = finalPositions;
         m_normals = finalNormals;
 
-		AZStd::vector<AZ::s32> cornerIdxList;
-		cornerIdxList.resize(m_loops.size());
-		for (AZ::s32 i = 0; i < m_loops.size(); i++)
-		{
-			cornerIdxList[m_loops[i]] = i;
-		}
+        AZStd::vector<AZ::s32> cornerIdxList;
+        cornerIdxList.resize(m_loops.size());
+        for (AZ::s32 i = 0; i < m_loops.size(); i++)
+        {
+            cornerIdxList[m_loops[i]] = i;
+        }
 
         if (isIndexedUVs)
         {
             m_uvs = finalUVs;
 
-			std::transform(m_uvs.begin(), m_uvs.end(), m_uvs.begin(),
-				[](Vector2f& uv) {
-				uv[1] = 1.f - uv[1];
-				return uv;
-			});
+            std::transform(
+                m_uvs.begin(),
+                m_uvs.end(),
+                m_uvs.begin(),
+                [](Vector2f& uv)
+                {
+                    uv[1] = 1.f - uv[1];
+                    return uv;
+                });
         }
-        else {
-			AZStd::vector<Vector2f> indexedUVs;
-			indexedUVs.reserve(m_positions.size());
-			for (AZ::s32 i = 0; i < m_positions.size(); i++)
-			{
-				const auto cornerIdx = cornerIdxList[i];
-				indexedUVs.emplace_back(Vector2f{ m_uvs[cornerIdx][0], 1.f - m_uvs[cornerIdx][1] });
-			}
+        else
+        {
+            AZStd::vector<Vector2f> indexedUVs;
+            indexedUVs.reserve(m_positions.size());
+            for (AZ::s32 i = 0; i < m_positions.size(); i++)
+            {
+                const auto cornerIdx = cornerIdxList[i];
+                indexedUVs.emplace_back(Vector2f{ m_uvs[cornerIdx][0], 1.f - m_uvs[cornerIdx][1] });
+            }
 
-			m_uvs = indexedUVs;
+            m_uvs = indexedUVs;
         }
-        
+
         if (isIndexedColors)
         {
             m_colors = finalColors;
@@ -193,73 +202,91 @@ namespace GeomNodes
         }
     }
 
-	template<AttributeType AttributeTypeT>
-	AZ::u32 GNMeshData::GetCount() const
+    template<AttributeType AttributeTypeT>
+    AZ::u32 GNMeshData::GetCount() const
     {
-		if constexpr (AttributeTypeT == AttributeType::Position) {
-			return aznumeric_cast<AZ::u32>(m_positionsRange.count);
-		}
-		else if constexpr (AttributeTypeT == AttributeType::Normal) {
+        if constexpr (AttributeTypeT == AttributeType::Position)
+        {
+            return aznumeric_cast<AZ::u32>(m_positionsRange.count);
+        }
+        else if constexpr (AttributeTypeT == AttributeType::Normal)
+        {
             return aznumeric_cast<AZ::u32>(m_normalsRange.count);
-		}
-		else if constexpr (AttributeTypeT == AttributeType::Tangent) {
+        }
+        else if constexpr (AttributeTypeT == AttributeType::Tangent)
+        {
             return aznumeric_cast<AZ::u32>(m_tangentsRange.count);
-		}
-		else if constexpr (AttributeTypeT == AttributeType::Bitangent) {
+        }
+        else if constexpr (AttributeTypeT == AttributeType::Bitangent)
+        {
             return aznumeric_cast<AZ::u32>(m_bitangentsRange.count);
-		}
-		else if constexpr (AttributeTypeT == AttributeType::UV) {
+        }
+        else if constexpr (AttributeTypeT == AttributeType::UV)
+        {
             return aznumeric_cast<AZ::u32>(m_uvsRange.count);
-		}
-		else if constexpr (AttributeTypeT == AttributeType::Color) {
+        }
+        else if constexpr (AttributeTypeT == AttributeType::Color)
+        {
             return aznumeric_cast<AZ::u32>(m_colorsRange.count);
-		}
+        }
     }
 
     template<AttributeType AttributeTypeT>
     AZ::u32 GNMeshData::GetOffset() const
     {
-		if constexpr (AttributeTypeT == AttributeType::Position) {
-			return m_positionsRange.offset;
-		}
-		else if constexpr (AttributeTypeT == AttributeType::Normal) {
-			return m_normalsRange.offset;
-		}
-		else if constexpr (AttributeTypeT == AttributeType::Tangent) {
-			return m_tangentsRange.offset;
-		}
-		else if constexpr (AttributeTypeT == AttributeType::Bitangent) {
-			return m_bitangentsRange.offset;
-		}
-		else if constexpr (AttributeTypeT == AttributeType::UV) {
-			return m_uvsRange.offset;
-		}
-		else if constexpr (AttributeTypeT == AttributeType::Color) {
-			return m_colorsRange.offset;
-		}
+        if constexpr (AttributeTypeT == AttributeType::Position)
+        {
+            return m_positionsRange.offset;
+        }
+        else if constexpr (AttributeTypeT == AttributeType::Normal)
+        {
+            return m_normalsRange.offset;
+        }
+        else if constexpr (AttributeTypeT == AttributeType::Tangent)
+        {
+            return m_tangentsRange.offset;
+        }
+        else if constexpr (AttributeTypeT == AttributeType::Bitangent)
+        {
+            return m_bitangentsRange.offset;
+        }
+        else if constexpr (AttributeTypeT == AttributeType::UV)
+        {
+            return m_uvsRange.offset;
+        }
+        else if constexpr (AttributeTypeT == AttributeType::Color)
+        {
+            return m_colorsRange.offset;
+        }
     }
 
     template<AttributeType AttributeTypeT>
     void GNMeshData::SetCount(AZ::u32 count)
     {
-		if constexpr (AttributeTypeT == AttributeType::Position) {
-			m_positionsRange.count = count;
-		}
-		else if constexpr (AttributeTypeT == AttributeType::Normal) {
-			m_normalsRange.count = count;
-		}
-		else if constexpr (AttributeTypeT == AttributeType::Tangent) {
-			m_tangentsRange.count = count;
-		}
-		else if constexpr (AttributeTypeT == AttributeType::Bitangent) {
-			m_bitangentsRange.count = count;
-		}
-		else if constexpr (AttributeTypeT == AttributeType::UV) {
-			m_uvsRange.count = count;
-		}
-		else if constexpr (AttributeTypeT == AttributeType::Color) {
-			m_colorsRange.count = count;
-		}
+        if constexpr (AttributeTypeT == AttributeType::Position)
+        {
+            m_positionsRange.count = count;
+        }
+        else if constexpr (AttributeTypeT == AttributeType::Normal)
+        {
+            m_normalsRange.count = count;
+        }
+        else if constexpr (AttributeTypeT == AttributeType::Tangent)
+        {
+            m_tangentsRange.count = count;
+        }
+        else if constexpr (AttributeTypeT == AttributeType::Bitangent)
+        {
+            m_bitangentsRange.count = count;
+        }
+        else if constexpr (AttributeTypeT == AttributeType::UV)
+        {
+            m_uvsRange.count = count;
+        }
+        else if constexpr (AttributeTypeT == AttributeType::Color)
+        {
+            m_colorsRange.count = count;
+        }
     }
 
     template<AttributeType AttributeTypeT>
@@ -271,24 +298,30 @@ namespace GeomNodes
     template<AttributeType AttributeTypeT>
     void GNMeshData::SetOffset(AZ::u32 offset)
     {
-		if constexpr (AttributeTypeT == AttributeType::Position) {
-			m_positionsRange.offset = offset;
-		}
-		else if constexpr (AttributeTypeT == AttributeType::Normal) {
-			m_normalsRange.offset = offset;
-		}
-		else if constexpr (AttributeTypeT == AttributeType::Tangent) {
-			m_tangentsRange.offset = offset;
-		}
-		else if constexpr (AttributeTypeT == AttributeType::Bitangent) {
-			m_bitangentsRange.offset = offset;
-		}
-		else if constexpr (AttributeTypeT == AttributeType::UV) {
-			m_uvsRange.offset = offset;
-		}
-		else if constexpr (AttributeTypeT == AttributeType::Color) {
-			m_colorsRange.offset = offset;
-		}
+        if constexpr (AttributeTypeT == AttributeType::Position)
+        {
+            m_positionsRange.offset = offset;
+        }
+        else if constexpr (AttributeTypeT == AttributeType::Normal)
+        {
+            m_normalsRange.offset = offset;
+        }
+        else if constexpr (AttributeTypeT == AttributeType::Tangent)
+        {
+            m_tangentsRange.offset = offset;
+        }
+        else if constexpr (AttributeTypeT == AttributeType::Bitangent)
+        {
+            m_bitangentsRange.offset = offset;
+        }
+        else if constexpr (AttributeTypeT == AttributeType::UV)
+        {
+            m_uvsRange.offset = offset;
+        }
+        else if constexpr (AttributeTypeT == AttributeType::Color)
+        {
+            m_colorsRange.offset = offset;
+        }
     }
 
     template<AttributeType AttributeTypeT>
@@ -300,24 +333,30 @@ namespace GeomNodes
     template<AttributeType AttributeTypeT>
     const auto& GNMeshData::GetDataBuffer() const
     {
-		if constexpr (AttributeTypeT == AttributeType::Position) {
-			return m_positions;
-		}
-		else if constexpr (AttributeTypeT == AttributeType::Normal) {
-			return m_normals;
-		}
-		else if constexpr (AttributeTypeT == AttributeType::Tangent) {
-			return m_tangents;
-		}
-		else if constexpr (AttributeTypeT == AttributeType::Bitangent) {
-			return m_bitangents;
-		}
-		else if constexpr (AttributeTypeT == AttributeType::UV) {
-			return m_uvs;
-		}
-		else if constexpr (AttributeTypeT == AttributeType::Color) {
-			return m_colors;
-		}
+        if constexpr (AttributeTypeT == AttributeType::Position)
+        {
+            return m_positions;
+        }
+        else if constexpr (AttributeTypeT == AttributeType::Normal)
+        {
+            return m_normals;
+        }
+        else if constexpr (AttributeTypeT == AttributeType::Tangent)
+        {
+            return m_tangents;
+        }
+        else if constexpr (AttributeTypeT == AttributeType::Bitangent)
+        {
+            return m_bitangents;
+        }
+        else if constexpr (AttributeTypeT == AttributeType::UV)
+        {
+            return m_uvs;
+        }
+        else if constexpr (AttributeTypeT == AttributeType::Color)
+        {
+            return m_colors;
+        }
     }
 
     AZ::u32 GNMeshData::GetIndexCount() const
@@ -380,10 +419,10 @@ namespace GeomNodes
         m_materialIndex = materialIndex;
     }
 
-	AZ::u32 GNMeshData::GetMaterialIndex() const
-	{
-		return m_materialIndex;
-	}
+    AZ::u32 GNMeshData::GetMaterialIndex() const
+    {
+        return m_materialIndex;
+    }
 
     void GNMeshData::AddInstance(const AZ::Matrix4x4& mat4)
     {
@@ -482,17 +521,17 @@ namespace GeomNodes
 
     void GNMeshData::ClearBuffers()
     {
-		m_indices.clear();
-		m_loops.clear();
-		m_materialIndices.clear();
-
-		m_positions.clear();
-		m_normals.clear();
-		m_tangents.clear();
-		m_bitangents.clear();
-		m_uvs.clear();
-		m_colors.clear();
-
-		m_instances.clear();
+        m_indices.clear();
+        m_loops.clear();
+        m_materialIndices.clear();
+
+        m_positions.clear();
+        m_normals.clear();
+        m_tangents.clear();
+        m_bitangents.clear();
+        m_uvs.clear();
+        m_colors.clear();
+
+        m_instances.clear();
     }
 } // namespace GeomNodes

+ 36 - 35
Gems/O3DE/GeomNodes/Code/Source/Editor/Rendering/GNMeshData.h

@@ -8,10 +8,11 @@
 
 #pragma once
 
+#include <AZCore/std/string/string.h>
+#include <AzCore/Math/Aabb.h>
 #include <Editor/Common/GNConstants.h>
 #include <Editor/Math/MathHelper.h>
-#include <AzCore/Math/Aabb.h>
-#include <AZCore/std/string/string.h>
+
 
 namespace GeomNodes
 {
@@ -23,24 +24,24 @@ namespace GeomNodes
     public:
         struct DataRange
         {
-            AZ::u32 offset = 0; 
+            AZ::u32 offset = 0;
             AZ::u32 count = 0;
         };
 
         GNMeshData();
         explicit GNMeshData(
-            const Vert3Vector& positions
-            , const Vert3Vector& normals
-            , const S32Vector& indices
-            , const S32Vector& triangleLoops
-            , const S32Vector& loops
-            , const Vert2Vector& uvs
-            , const Vert4Vector& colors
-            , const S32Vector& materialIndices
-            , const MaterialList& materials
-            , AZ::u64 hash
-            , bool isIndexedUVs
-            , bool isIndexedColors);
+            const Vert3Vector& positions,
+            const Vert3Vector& normals,
+            const S32Vector& indices,
+            const S32Vector& triangleLoops,
+            const S32Vector& loops,
+            const Vert2Vector& uvs,
+            const Vert4Vector& colors,
+            const S32Vector& materialIndices,
+            const MaterialList& materials,
+            AZ::u64 hash,
+            bool isIndexedUVs,
+            bool isIndexedColors);
 
         ~GNMeshData() = default;
 
@@ -51,16 +52,16 @@ namespace GeomNodes
         void SetIndexCount(AZ::u32 count);
         void SetIndexCount(AZ::u64 count);
 
-		template<AttributeType AttributeTypeT>
-		AZ::u32 GetCount() const;
-		template<AttributeType AttributeTypeT>
-		AZ::u32 GetOffset() const;
-		template<AttributeType AttributeTypeT>
-		void SetCount(AZ::u32 count);
+        template<AttributeType AttributeTypeT>
+        AZ::u32 GetCount() const;
+        template<AttributeType AttributeTypeT>
+        AZ::u32 GetOffset() const;
+        template<AttributeType AttributeTypeT>
+        void SetCount(AZ::u32 count);
         template<AttributeType AttributeTypeT>
         void SetCount(AZ::u64 count);
-		template<AttributeType AttributeTypeT>
-		void SetOffset(AZ::u32 offset);
+        template<AttributeType AttributeTypeT>
+        void SetOffset(AZ::u32 offset);
         template<AttributeType AttributeTypeT>
         void SetOffset(AZ::u64 offset);
 
@@ -69,14 +70,14 @@ namespace GeomNodes
 
         template<AttributeType AttributeTypeT>
         const auto& GetDataBuffer() const;
-        
+
         const Mat4Vector& GetInstances() const;
         const MaterialList& GetMaterials() const;
         void ClearMaterialList();
         void SetMaterialIndex(AZ::u32 materialIndex);
         AZ::u32 GetMaterialIndex() const;
         void AddInstance(const AZ::Matrix4x4& mat4);
-		
+
         U32Vector GetIndicesByMaterialIndex(int materialIndex);
 
         AZ::Aabb GetAabb() const;
@@ -92,15 +93,15 @@ namespace GeomNodes
         U32Vector m_indices;
         S32Vector m_loops;
         S32Vector m_materialIndices;
-        
-		//! hash are used to easily matched if you have the same mesh.
-		AZ::s64 m_hash = 0;
-		//! List of material names used by the mesh.
-		MaterialList m_materialNames;
-		//! List of instances. Instances are used so that you have the same mesh but on a different transform.
-		Mat4Vector m_instances;
 
-		AZ::Aabb m_aabb = AZ::Aabb::CreateNull();
+        //! hash are used to easily matched if you have the same mesh.
+        AZ::s64 m_hash = 0;
+        //! List of material names used by the mesh.
+        MaterialList m_materialNames;
+        //! List of instances. Instances are used so that you have the same mesh but on a different transform.
+        Mat4Vector m_instances;
+
+        AZ::Aabb m_aabb = AZ::Aabb::CreateNull();
 
         Vert3Vector m_positions;
         Vert3Vector m_normals;
@@ -108,7 +109,7 @@ namespace GeomNodes
         Vert3Vector m_bitangents;
         Vert2Vector m_uvs;
         Vert4Vector m_colors;
-        
+
         //! As meshes are eventually merged to common buffers we need to keep track of the offset and element count.
         //! When we create the Atom Buffers we will need these infos while the mesh buffers will be held in GNModelData.
         DataRange m_indicesRange;
@@ -123,4 +124,4 @@ namespace GeomNodes
         //! This way they can be grouped together by material and merge the vertices.
         AZ::u32 m_materialIndex = 0;
     };
-}
+} // namespace GeomNodes

+ 234 - 211
Gems/O3DE/GeomNodes/Code/Source/Editor/Rendering/GNModelData.cpp

@@ -6,11 +6,12 @@
  *
  */
 
-#include <Editor/Rendering/GNModelData.h>
-#include <Editor/Systems/GNParamContext.h>
-#include <AzCore/std/containers/set.h>
 #include <AzCore/std/containers/map.h>
+#include <AzCore/std/containers/set.h>
 #include <Editor/Common/GNAPI.h>
+#include <Editor/Rendering/GNModelData.h>
+#include <Editor/Systems/GNParamContext.h>
+
 
 namespace GeomNodes
 {
@@ -20,136 +21,149 @@ namespace GeomNodes
 
     GNModelData::GNModelData(AZ::u64 mapId)
     {
-		ReadData(mapId);
+        ReadData(mapId);
     }
 
     void GNModelData::ReadData(AZ::u64 mapId)
     {
-		m_meshes.clear();
-		
-		if (API::OpenSHM(mapId))
-		{
-			AZ::s32 meshCount = Read<AZ::s32>(mapId);
-			AZ::s32 instanceCount = Read<AZ::s32>(mapId);
-
-			AZ_Printf("GNInstance", "meshCount : %i, instanceCount : %i", meshCount, instanceCount);
-
-			AZStd::map<AZStd::string, AZStd::vector<GNMeshData>> meshMap;
-			for ([[maybe_unused]] AZ::s32 meshIdx = 0; meshIdx < meshCount; meshIdx++)
-			{
-				auto positions = ReadArray<Vector3f>(mapId);
-				auto normals = ReadArray<Vector3f>(mapId);
-				auto indices = ReadArray<AZ::s32>(mapId);
-				auto triangleLoops = ReadArray<AZ::s32>(mapId);
-				auto loops = ReadArray<AZ::s32>(mapId);
-				auto hash = Read<AZ::s64>(mapId);
-
-				auto colors = ReadArray<Vector4f>(mapId);
-				bool bIndexedColors = Read<bool>(mapId);
-				auto uvs = ReadArray<Vector2f>(mapId);
-				bool bIndexedUVs = Read<bool>(mapId);
-				auto materialIndices = ReadArray<AZ::s32>(mapId);
-				auto materials = ReadArray<char>(mapId);
-
-				if (positions.empty())
-				{
-					continue;
-				}
-
-				MaterialList materialList;
-				rapidjson::Document jsonDocument;
-				jsonDocument.Parse((const char*)materials.data(), materials.size());
-				if (!jsonDocument.HasParseError())
-				{
-					if (jsonDocument.HasMember(Field::Materials))
-					{
-						for (auto& entry : jsonDocument[Field::Materials].GetArray())
-						{
-							const auto materialName = entry.GetString();
-							materialList.push_back(materialName);
-							if (meshMap.find(materialName) == meshMap.end()) // check if we have the key in the map
-							{
-								meshMap.emplace(AZStd::make_pair(materialName, AZStd::vector<GNMeshData>({})));
-							}
-						}
-					}
-				}
-
-				GNMeshData meshData(positions, normals, indices, triangleLoops, loops, uvs, colors, materialIndices, materialList, hash, bIndexedUVs, bIndexedColors);
-				m_meshes.push_back(meshData);
-			}
-
-			// at this stage meshes can have multiple materials and we need to create their own mesh copy 
-			// but with a different indices based on the material indices.
-			for (auto& mesh : m_meshes)
-			{
-				int materialMeshIndex = 0;
-				for (auto& materialName : mesh.GetMaterials())
-				{
-					auto indices = mesh.GetIndicesByMaterialIndex(materialMeshIndex);
-					if (indices.size() > 0) {
-						auto& meshInstance = meshMap[materialName].emplace_back(mesh);
-						meshInstance.SetIndices(indices);
-						meshInstance.CalculateTangents();
-						meshInstance.ClearMaterialList();
-					}
-					materialMeshIndex++;
-				}
-			}
-
-			for ([[maybe_unused]] AZ::s32 instanceIdx = 0; instanceIdx < instanceCount; instanceIdx++)
-			{
-				AZ::s64 hash = Read<AZ::s64>(mapId);
-
-				[[maybe_unused]] AZ::Matrix4x4 localMatrix = Read<AZ::Matrix4x4>(mapId);
-				[[maybe_unused]] AZ::Matrix4x4 worldMatrix = Read<AZ::Matrix4x4>(mapId);
-				
-				AZ::Matrix3x3 rotateZ = AZ::Matrix3x3::CreateRotationZ(AZ::DegToRad(180.0f));
-				
-				auto rotate4x4 = AZ::Matrix4x4::CreateFromMatrix3x4(AZ::Matrix3x4::CreateFromMatrix3x3(rotateZ));
-				AZ::Matrix4x4 instanceMatrix = rotate4x4 * localMatrix;
-
-				for (auto& meshGroup : meshMap)
-				{
-					for (auto& mesh : meshGroup.second)
-					{
-						if (mesh.GetHash() == hash)
-						{
-							mesh.AddInstance(instanceMatrix);
-						}
-					}
-				}
-			}
-
-			m_meshes.clear();
-			m_materials.clear();
-
-			// merge all meshes in each mesh group along with their instances
-			AZ::u32 materialIndex = 0;
-			for (auto& meshGroup : meshMap)
-			{
-				GNMeshData meshData;
-				for (const auto& mesh : meshGroup.second)
-				{
-					meshData += mesh;
-				}
-
-				if (meshData.GetCount<AttributeType::Position>() > 0)
-				{
-					meshData.SetMaterialIndex(materialIndex);
-					meshData.CalculateAABB();
-					m_aabb.AddAabb(meshData.GetAabb()); // add mesh data's aabb to get the aabb for the whole model
-					m_meshes.push_back(meshData);
-					m_materials.push_back(meshGroup.first);
-					materialIndex++;
-				}
-			}
-
-			// Convert to only one buffers/arrays and keep track of the offsets and element counts
-			MergeMeshBuffers();
-
-			API::ClearSHM(mapId);
-		}
+        m_meshes.clear();
+
+        if (API::OpenSHM(mapId))
+        {
+            AZ::s32 meshCount = Read<AZ::s32>(mapId);
+            AZ::s32 instanceCount = Read<AZ::s32>(mapId);
+
+            AZ_Printf("GNInstance", "meshCount : %i, instanceCount : %i", meshCount, instanceCount);
+
+            AZStd::map<AZStd::string, AZStd::vector<GNMeshData>> meshMap;
+            for ([[maybe_unused]] AZ::s32 meshIdx = 0; meshIdx < meshCount; meshIdx++)
+            {
+                auto positions = ReadArray<Vector3f>(mapId);
+                auto normals = ReadArray<Vector3f>(mapId);
+                auto indices = ReadArray<AZ::s32>(mapId);
+                auto triangleLoops = ReadArray<AZ::s32>(mapId);
+                auto loops = ReadArray<AZ::s32>(mapId);
+                auto hash = Read<AZ::s64>(mapId);
+
+                auto colors = ReadArray<Vector4f>(mapId);
+                bool bIndexedColors = Read<bool>(mapId);
+                auto uvs = ReadArray<Vector2f>(mapId);
+                bool bIndexedUVs = Read<bool>(mapId);
+                auto materialIndices = ReadArray<AZ::s32>(mapId);
+                auto materials = ReadArray<char>(mapId);
+
+                if (positions.empty())
+                {
+                    continue;
+                }
+
+                MaterialList materialList;
+                rapidjson::Document jsonDocument;
+                jsonDocument.Parse((const char*)materials.data(), materials.size());
+                if (!jsonDocument.HasParseError())
+                {
+                    if (jsonDocument.HasMember(Field::Materials))
+                    {
+                        for (auto& entry : jsonDocument[Field::Materials].GetArray())
+                        {
+                            const auto materialName = entry.GetString();
+                            materialList.push_back(materialName);
+                            if (meshMap.find(materialName) == meshMap.end()) // check if we have the key in the map
+                            {
+                                meshMap.emplace(AZStd::make_pair(materialName, AZStd::vector<GNMeshData>({})));
+                            }
+                        }
+                    }
+                }
+
+                GNMeshData meshData(
+                    positions,
+                    normals,
+                    indices,
+                    triangleLoops,
+                    loops,
+                    uvs,
+                    colors,
+                    materialIndices,
+                    materialList,
+                    hash,
+                    bIndexedUVs,
+                    bIndexedColors);
+                m_meshes.push_back(meshData);
+            }
+
+            // at this stage meshes can have multiple materials and we need to create their own mesh copy
+            // but with a different indices based on the material indices.
+            for (auto& mesh : m_meshes)
+            {
+                int materialMeshIndex = 0;
+                for (auto& materialName : mesh.GetMaterials())
+                {
+                    auto indices = mesh.GetIndicesByMaterialIndex(materialMeshIndex);
+                    if (indices.size() > 0)
+                    {
+                        auto& meshInstance = meshMap[materialName].emplace_back(mesh);
+                        meshInstance.SetIndices(indices);
+                        meshInstance.CalculateTangents();
+                        meshInstance.ClearMaterialList();
+                    }
+                    materialMeshIndex++;
+                }
+            }
+
+            for ([[maybe_unused]] AZ::s32 instanceIdx = 0; instanceIdx < instanceCount; instanceIdx++)
+            {
+                AZ::s64 hash = Read<AZ::s64>(mapId);
+
+                [[maybe_unused]] AZ::Matrix4x4 localMatrix = Read<AZ::Matrix4x4>(mapId);
+                [[maybe_unused]] AZ::Matrix4x4 worldMatrix = Read<AZ::Matrix4x4>(mapId);
+
+                AZ::Matrix3x3 rotateZ = AZ::Matrix3x3::CreateRotationZ(AZ::DegToRad(180.0f));
+
+                auto rotate4x4 = AZ::Matrix4x4::CreateFromMatrix3x4(AZ::Matrix3x4::CreateFromMatrix3x3(rotateZ));
+                AZ::Matrix4x4 instanceMatrix = rotate4x4 * localMatrix;
+
+                for (auto& meshGroup : meshMap)
+                {
+                    for (auto& mesh : meshGroup.second)
+                    {
+                        if (mesh.GetHash() == hash)
+                        {
+                            mesh.AddInstance(instanceMatrix);
+                        }
+                    }
+                }
+            }
+
+            m_meshes.clear();
+            m_materials.clear();
+
+            // merge all meshes in each mesh group along with their instances
+            AZ::u32 materialIndex = 0;
+            for (auto& meshGroup : meshMap)
+            {
+                GNMeshData meshData;
+                for (const auto& mesh : meshGroup.second)
+                {
+                    meshData += mesh;
+                }
+
+                if (meshData.GetCount<AttributeType::Position>() > 0)
+                {
+                    meshData.SetMaterialIndex(materialIndex);
+                    meshData.CalculateAABB();
+                    m_aabb.AddAabb(meshData.GetAabb()); // add mesh data's aabb to get the aabb for the whole model
+                    m_meshes.push_back(meshData);
+                    m_materials.push_back(meshGroup.first);
+                    materialIndex++;
+                }
+            }
+
+            // Convert to only one buffers/arrays and keep track of the offsets and element counts
+            MergeMeshBuffers();
+
+            API::ClearSHM(mapId);
+        }
     }
 
     const AZ::u32 GNModelData::MeshCount() const
@@ -162,88 +176,97 @@ namespace GeomNodes
         return m_meshes;
     }
 
-	MaterialList GNModelData::GetMaterials()
-	{
-		return m_materials;
-	}
-
-	const U32Vector& GNModelData::GetIndices() const
-	{
-		return m_indices;
-	}
-
-	const Vert3Vector& GNModelData::GetPositions() const
-	{
-		return m_positions;
-	}
-
-	const Vert3Vector& GNModelData::GetNormals() const
-	{
-		return m_normals;
-	}
-
-	const Vert4Vector& GNModelData::GetTangents() const
-	{
-		return m_tangents;
-	}
-
-	const Vert3Vector& GNModelData::GetBitangents() const
-	{
-		return m_bitangents;
-	}
-
-	const Vert2Vector& GNModelData::GetUVs() const
-	{
-		return m_uvs;
-	}
-
-	const Vert4Vector& GNModelData::GetColors() const
-	{
-		return m_colors;
-	}
-
-	AZ::Aabb GNModelData::GetAabb() const
-	{
-		return m_aabb;
-	}
-
-	void GNModelData::MergeMeshBuffers()
-	{
-		m_indices.clear();
-		m_positions.clear();
-		m_normals.clear();
-		m_tangents.clear();
-		m_bitangents.clear();
-		m_uvs.clear();
-		m_colors.clear();
-
-		for (auto& mesh : m_meshes)
-		{
-			mesh.SetIndexOffset(m_indices.size());
-			m_indices.insert(m_indices.end(), mesh.GetIndices().begin(), mesh.GetIndices().end());
-
-			mesh.SetOffset<AttributeType::Position>(m_positions.size());
-			m_positions.insert(m_positions.end(), mesh.GetDataBuffer<AttributeType::Position>().begin(), mesh.GetDataBuffer<AttributeType::Position>().end());
-
-			mesh.SetOffset<AttributeType::Normal>(m_normals.size());
-			m_normals.insert(m_normals.end(), mesh.GetDataBuffer<AttributeType::Normal>().begin(), mesh.GetDataBuffer<AttributeType::Normal>().end());
-
-			mesh.SetOffset<AttributeType::Tangent>(m_tangents.size());
-			m_tangents.insert(m_tangents.end(), mesh.GetDataBuffer<AttributeType::Tangent>().begin(), mesh.GetDataBuffer<AttributeType::Tangent>().end());
-
-			mesh.SetOffset<AttributeType::Bitangent>(m_bitangents.size());
-			m_bitangents.insert(m_bitangents.end(), mesh.GetDataBuffer<AttributeType::Bitangent>().begin(), mesh.GetDataBuffer<AttributeType::Bitangent>().end());
-
-			mesh.SetOffset<AttributeType::UV>(m_uvs.size());
-			m_uvs.insert(m_uvs.end(), mesh.GetDataBuffer<AttributeType::UV>().begin(), mesh.GetDataBuffer<AttributeType::UV>().end());
-
-			mesh.SetOffset<AttributeType::Color>(m_colors.size());
-			m_colors.insert(m_colors.end(), mesh.GetDataBuffer<AttributeType::Color>().begin(), mesh.GetDataBuffer<AttributeType::Color>().end());
-
-			// clear the buffers since we already copied them.
-			mesh.ClearBuffers();
-		}
-	}
+    MaterialList GNModelData::GetMaterials()
+    {
+        return m_materials;
+    }
+
+    const U32Vector& GNModelData::GetIndices() const
+    {
+        return m_indices;
+    }
+
+    const Vert3Vector& GNModelData::GetPositions() const
+    {
+        return m_positions;
+    }
+
+    const Vert3Vector& GNModelData::GetNormals() const
+    {
+        return m_normals;
+    }
+
+    const Vert4Vector& GNModelData::GetTangents() const
+    {
+        return m_tangents;
+    }
+
+    const Vert3Vector& GNModelData::GetBitangents() const
+    {
+        return m_bitangents;
+    }
+
+    const Vert2Vector& GNModelData::GetUVs() const
+    {
+        return m_uvs;
+    }
+
+    const Vert4Vector& GNModelData::GetColors() const
+    {
+        return m_colors;
+    }
+
+    AZ::Aabb GNModelData::GetAabb() const
+    {
+        return m_aabb;
+    }
+
+    void GNModelData::MergeMeshBuffers()
+    {
+        m_indices.clear();
+        m_positions.clear();
+        m_normals.clear();
+        m_tangents.clear();
+        m_bitangents.clear();
+        m_uvs.clear();
+        m_colors.clear();
+
+        for (auto& mesh : m_meshes)
+        {
+            mesh.SetIndexOffset(m_indices.size());
+            m_indices.insert(m_indices.end(), mesh.GetIndices().begin(), mesh.GetIndices().end());
+
+            mesh.SetOffset<AttributeType::Position>(m_positions.size());
+            m_positions.insert(
+                m_positions.end(),
+                mesh.GetDataBuffer<AttributeType::Position>().begin(),
+                mesh.GetDataBuffer<AttributeType::Position>().end());
+
+            mesh.SetOffset<AttributeType::Normal>(m_normals.size());
+            m_normals.insert(
+                m_normals.end(), mesh.GetDataBuffer<AttributeType::Normal>().begin(), mesh.GetDataBuffer<AttributeType::Normal>().end());
+
+            mesh.SetOffset<AttributeType::Tangent>(m_tangents.size());
+            m_tangents.insert(
+                m_tangents.end(), mesh.GetDataBuffer<AttributeType::Tangent>().begin(), mesh.GetDataBuffer<AttributeType::Tangent>().end());
+
+            mesh.SetOffset<AttributeType::Bitangent>(m_bitangents.size());
+            m_bitangents.insert(
+                m_bitangents.end(),
+                mesh.GetDataBuffer<AttributeType::Bitangent>().begin(),
+                mesh.GetDataBuffer<AttributeType::Bitangent>().end());
+
+            mesh.SetOffset<AttributeType::UV>(m_uvs.size());
+            m_uvs.insert(m_uvs.end(), mesh.GetDataBuffer<AttributeType::UV>().begin(), mesh.GetDataBuffer<AttributeType::UV>().end());
+
+            mesh.SetOffset<AttributeType::Color>(m_colors.size());
+            m_colors.insert(
+                m_colors.end(), mesh.GetDataBuffer<AttributeType::Color>().begin(), mesh.GetDataBuffer<AttributeType::Color>().end());
+
+            // clear the buffers since we already copied them.
+            mesh.ClearBuffers();
+        }
+    }
 
     template<typename T>
     AZStd::vector<T> GNModelData::ReadArray(AZ::u64 mapId)

+ 21 - 20
Gems/O3DE/GeomNodes/Code/Source/Editor/Rendering/GNModelData.h

@@ -8,8 +8,9 @@
 
 #pragma once
 
-#include <Editor/Rendering/GNMeshData.h>
 #include <AzCore/std/containers/map.h>
+#include <Editor/Rendering/GNMeshData.h>
+
 
 namespace GeomNodes
 {
@@ -18,7 +19,7 @@ namespace GeomNodes
     {
     public:
         using MeshDataList = AZStd::vector<GNMeshData>;
-        
+
         GNModelData();
         GNModelData(AZ::u64 mapId);
         ~GNModelData() = default;
@@ -34,14 +35,14 @@ namespace GeomNodes
         MaterialList GetMaterials();
 
         //! These functions are the combination of all mesh buffers in order based on their position in MeshDataList
-		const U32Vector& GetIndices() const;
-		const Vert3Vector& GetPositions() const;
-		const Vert3Vector& GetNormals() const;
-		const Vert4Vector& GetTangents() const;
-		const Vert3Vector& GetBitangents() const;
-		const Vert2Vector& GetUVs() const;
-		const Vert4Vector& GetColors() const;
-		
+        const U32Vector& GetIndices() const;
+        const Vert3Vector& GetPositions() const;
+        const Vert3Vector& GetNormals() const;
+        const Vert4Vector& GetTangents() const;
+        const Vert3Vector& GetBitangents() const;
+        const Vert2Vector& GetUVs() const;
+        const Vert4Vector& GetColors() const;
+
         AZ::Aabb GetAabb() const;
 
     private:
@@ -50,8 +51,8 @@ namespace GeomNodes
         //! Given the map id as the SHM name read data array from the shared memory based on typename T.
         template<typename T>
         AZStd::vector<T> ReadArray(AZ::u64 mapId);
-		//! Given the map id as the SHM name read data from the shared memory based on typename T.
-		template<typename T>
+        //! Given the map id as the SHM name read data from the shared memory based on typename T.
+        template<typename T>
         T Read(AZ::u64 mapId);
 
         //! stores the mesh data.
@@ -60,14 +61,14 @@ namespace GeomNodes
         MaterialList m_materials;
         //! These are all data combined from the meshes in single arrays
         //! Combine them to one buffer to avoid the 256 mesh limit.
-		U32Vector m_indices;
-		Vert3Vector m_positions;
-		Vert3Vector m_normals;
-		Vert4Vector m_tangents;
-		Vert3Vector m_bitangents;
-		Vert2Vector m_uvs;
-		Vert4Vector m_colors;
+        U32Vector m_indices;
+        Vert3Vector m_positions;
+        Vert3Vector m_normals;
+        Vert4Vector m_tangents;
+        Vert3Vector m_bitangents;
+        Vert2Vector m_uvs;
+        Vert4Vector m_colors;
 
         AZ::Aabb m_aabb = AZ::Aabb::CreateNull();
     };
-}
+} // namespace GeomNodes

+ 49 - 48
Gems/O3DE/GeomNodes/Code/Source/Editor/Rendering/GNRenderMesh.cpp

@@ -36,10 +36,9 @@ namespace GeomNodes
                 m_entityId, &AZ::Render::MeshHandleStateNotificationBus::Events::OnMeshHandleSet, &m_meshHandle);
         }
 
-		AZ::Render::MaterialConsumerRequestBus::Handler::BusDisconnect();
-		AZ::Render::MaterialComponentNotificationBus::Handler::BusDisconnect();
+        AZ::Render::MaterialConsumerRequestBus::Handler::BusDisconnect();
+        AZ::Render::MaterialComponentNotificationBus::Handler::BusDisconnect();
         AZ::Render::MeshHandleStateRequestBus::Handler::BusDisconnect();
-        //AZ::TickBus::Handler::BusDisconnect();
     }
 
     bool GNRenderMesh::AreAttributesValid() const
@@ -64,16 +63,16 @@ namespace GeomNodes
 
     bool GNRenderMesh::CreateMeshBuffers(const GNModelData& modelData)
     {
-		m_indexBuffer = AZStd::make_unique<IndexBuffer>(modelData.GetIndices());
+        m_indexBuffer = AZStd::make_unique<IndexBuffer>(modelData.GetIndices());
 
-		CreateAttributeBuffer<AttributeType::Position>(modelData.GetPositions());
-		CreateAttributeBuffer<AttributeType::Normal>(modelData.GetNormals());
-		CreateAttributeBuffer<AttributeType::Tangent>(modelData.GetTangents());
-		CreateAttributeBuffer<AttributeType::Bitangent>(modelData.GetBitangents());
-		CreateAttributeBuffer<AttributeType::UV>(modelData.GetUVs());
-		CreateAttributeBuffer<AttributeType::Color>(modelData.GetColors());
+        CreateAttributeBuffer<AttributeType::Position>(modelData.GetPositions());
+        CreateAttributeBuffer<AttributeType::Normal>(modelData.GetNormals());
+        CreateAttributeBuffer<AttributeType::Tangent>(modelData.GetTangents());
+        CreateAttributeBuffer<AttributeType::Bitangent>(modelData.GetBitangents());
+        CreateAttributeBuffer<AttributeType::UV>(modelData.GetUVs());
+        CreateAttributeBuffer<AttributeType::Color>(modelData.GetColors());
 
-		return AreAttributesValid();
+        return AreAttributesValid();
     }
 
     void GNRenderMesh::AddLodBuffers(AZ::RPI::ModelLodAssetCreator& modelLodCreator)
@@ -93,8 +92,10 @@ namespace GeomNodes
 
     void GNRenderMesh::AddMeshBuffers(AZ::RPI::ModelLodAssetCreator& modelLodCreator, const GNMeshData& meshData)
     {
-		modelLodCreator.SetMeshIndexBuffer({ m_indexBuffer->GetBuffer(), 
-            AZ::RHI::BufferViewDescriptor::CreateTyped(meshData.GetIndexOffset(), meshData.GetIndexCount(), GetFormatForVertexStreamDataType<uint32_t>()) });
+        modelLodCreator.SetMeshIndexBuffer(
+            { m_indexBuffer->GetBuffer(),
+              AZ::RHI::BufferViewDescriptor::CreateTyped(
+                  meshData.GetIndexOffset(), meshData.GetIndexCount(), GetFormatForVertexStreamDataType<uint32_t>()) });
 
         for (auto& attribute : m_attributes)
         {
@@ -118,16 +119,15 @@ namespace GeomNodes
         modelLodCreator.Begin(AZ::Data::AssetId(AZ::Uuid::CreateRandom()));
         AddLodBuffers(modelLodCreator);
 
-
         for (auto meshData : modelData.GetMeshes())
         {
-			modelLodCreator.BeginMesh();
-			modelLodCreator.SetMeshAabb(modelData.GetAabb());
+            modelLodCreator.BeginMesh();
+            modelLodCreator.SetMeshAabb(modelData.GetAabb());
 
             modelLodCreator.SetMeshMaterialSlot(meshData.GetMaterialIndex());
 
-			AddMeshBuffers(modelLodCreator, meshData);
-			modelLodCreator.EndMesh();
+            AddMeshBuffers(modelLodCreator, meshData);
+            modelLodCreator.EndMesh();
         }
 
         if (!modelLodCreator.End(m_lodAsset))
@@ -162,23 +162,23 @@ namespace GeomNodes
         AZ::RPI::ModelMaterialSlot::StableId slotId = 0;
         for (auto materialPath : m_materialPathList)
         {
-			if (auto materialAsset = AZ::RPI::AssetUtils::LoadAssetByProductPath<AZ::RPI::MaterialAsset>(materialPath.c_str()))
-			{
-				auto materialOverrideInstance = AZ::RPI::Material::FindOrCreate(materialAsset);
-				auto& materialAssignment = m_materialMap[AZ::Render::MaterialAssignmentId::CreateFromStableIdOnly(slotId)];
-				materialAssignment.m_materialAsset = materialAsset;
-				materialAssignment.m_materialInstance = materialOverrideInstance;
-
-				AZ::RPI::ModelMaterialSlot materialSlot;
-				materialSlot.m_stableId = slotId;
-				materialSlot.m_defaultMaterialAsset = materialAsset;
-				modelCreator.AddMaterialSlot(materialSlot);
-			}
-			else
-			{
-				AZ_Error("CreateLodAsset", false, "Could not load material.");
-				return;
-			}
+            if (auto materialAsset = AZ::RPI::AssetUtils::LoadAssetByProductPath<AZ::RPI::MaterialAsset>(materialPath.c_str()))
+            {
+                auto materialOverrideInstance = AZ::RPI::Material::FindOrCreate(materialAsset);
+                auto& materialAssignment = m_materialMap[AZ::Render::MaterialAssignmentId::CreateFromStableIdOnly(slotId)];
+                materialAssignment.m_materialAsset = materialAsset;
+                materialAssignment.m_materialInstance = materialOverrideInstance;
+
+                AZ::RPI::ModelMaterialSlot materialSlot;
+                materialSlot.m_stableId = slotId;
+                materialSlot.m_defaultMaterialAsset = materialAsset;
+                modelCreator.AddMaterialSlot(materialSlot);
+            }
+            else
+            {
+                AZ_Error("CreateLodAsset", false, "Could not load material.");
+                return;
+            }
 
             slotId++;
         }
@@ -220,7 +220,7 @@ namespace GeomNodes
         }
 
         SetMaterials();
-        
+
         return true;
     }
 
@@ -236,10 +236,10 @@ namespace GeomNodes
 
     void GNRenderMesh::SetMaterials()
     {
-		if (m_meshFeatureProcessor && m_meshHandle.IsValid())
-		{
-			m_meshFeatureProcessor->SetCustomMaterials(m_meshHandle, AZ::Render::ConvertToCustomMaterialMap(m_materialMap));
-		}
+        if (m_meshFeatureProcessor && m_meshHandle.IsValid())
+        {
+            m_meshFeatureProcessor->SetCustomMaterials(m_meshHandle, AZ::Render::ConvertToCustomMaterialMap(m_materialMap));
+        }
     }
 
     void GNRenderMesh::SetMaterialPathList(const AZStd::vector<AZStd::string>& materialPaths)
@@ -252,7 +252,7 @@ namespace GeomNodes
         CreateMesh(modelData);
     }
 
-    void GNRenderMesh::UpdateTransform(const AZ::Transform& worldFromLocal, const AZ::Vector3& /*scale*/)
+    void GNRenderMesh::UpdateTransform(const AZ::Transform& worldFromLocal)
     {
         if (m_meshFeatureProcessor && m_meshHandle.IsValid())
         {
@@ -264,7 +264,8 @@ namespace GeomNodes
     {
     }
 
-    AZ::Render::MaterialAssignmentId GNRenderMesh::FindMaterialAssignmentId(const AZ::Render::MaterialAssignmentLodIndex lod, const AZStd::string& label) const
+    AZ::Render::MaterialAssignmentId GNRenderMesh::FindMaterialAssignmentId(
+        const AZ::Render::MaterialAssignmentLodIndex lod, const AZStd::string& label) const
     {
         return AZ::Render::GetMaterialSlotIdFromModelAsset(m_modelAsset, lod, label);
     }
@@ -281,16 +282,16 @@ namespace GeomNodes
 
     AZStd::unordered_set<AZ::Name> GNRenderMesh::GetModelUvNames() const
     {
-		const AZ::Data::Instance<AZ::RPI::Model> model = GetModel();
-		return model ? model->GetUvNames() : AZStd::unordered_set<AZ::Name>();
+        const AZ::Data::Instance<AZ::RPI::Model> model = GetModel();
+        return model ? model->GetUvNames() : AZStd::unordered_set<AZ::Name>();
     }
 
     void GNRenderMesh::OnMaterialsUpdated(const AZ::Render::MaterialAssignmentMap& materials)
     {
-		if (m_meshFeatureProcessor)
-		{
+        if (m_meshFeatureProcessor)
+        {
             m_meshFeatureProcessor->SetCustomMaterials(m_meshHandle, AZ::Render::ConvertToCustomMaterialMap(materials));
-		}
+        }
     }
 
     AZ::Data::Instance<AZ::RPI::Model> GNRenderMesh::GetModel() const
@@ -313,4 +314,4 @@ namespace GeomNodes
     {
         return &m_meshHandle;
     }
-} // namespace WhiteBox
+} // namespace GeomNodes

+ 14 - 13
Gems/O3DE/GeomNodes/Code/Source/Editor/Rendering/GNRenderMesh.h

@@ -14,11 +14,12 @@
 #include <Editor/Rendering/GNModelData.h>
 
 #include <Atom/Feature/Mesh/MeshFeatureProcessorInterface.h>
-#include <AtomLyIntegration/CommonFeatures/Mesh/MeshHandleStateBus.h>
 #include <AtomLyIntegration/CommonFeatures/Material/MaterialComponentBus.h>
+#include <AtomLyIntegration/CommonFeatures/Mesh/MeshHandleStateBus.h>
 #include <AzCore/Component/TransformBus.h>
 #include <AzCore/Name/Name.h>
 
+
 #include <GeomNodes/GeomNodesTypeIds.h>
 namespace AZ::RPI
 {
@@ -46,7 +47,7 @@ namespace GeomNodes
         //! For building the mesh.
         void BuildMesh(const GNModelData& renderData);
         //! Updates the models transform
-        void UpdateTransform(const AZ::Transform& worldFromLocal, const AZ::Vector3& scale = AZ::Vector3::CreateOne());
+        void UpdateTransform(const AZ::Transform& worldFromLocal);
         //! Returns if the Model/Mesh is visible or not.
         bool IsVisible() const;
         //! Sets the visibility of the Model/Mesh
@@ -55,15 +56,15 @@ namespace GeomNodes
         // AZ::TickBus overrides ...
         void OnTick(float deltaTime, AZ::ScriptTimePoint time) override;
 
-		// MaterialConsumerRequestBus::Handler overrides...
-		AZ::Render::MaterialAssignmentId FindMaterialAssignmentId(
-			const AZ::Render::MaterialAssignmentLodIndex lod, const AZStd::string& label) const override;
+        // MaterialConsumerRequestBus::Handler overrides...
+        AZ::Render::MaterialAssignmentId FindMaterialAssignmentId(
+            const AZ::Render::MaterialAssignmentLodIndex lod, const AZStd::string& label) const override;
         AZ::Render::MaterialAssignmentLabelMap GetMaterialLabels() const override;
         AZ::Render::MaterialAssignmentMap GetDefautMaterialMap() const override;
-		AZStd::unordered_set<AZ::Name> GetModelUvNames() const override;
+        AZStd::unordered_set<AZ::Name> GetModelUvNames() const override;
 
-		// MaterialComponentNotificationBus::Handler overrides...
-		void OnMaterialsUpdated(const AZ::Render::MaterialAssignmentMap& materials) override;
+        // MaterialComponentNotificationBus::Handler overrides...
+        void OnMaterialsUpdated(const AZ::Render::MaterialAssignmentMap& materials) override;
 
         //! Returns the Model's data instance
         AZ::Data::Instance<AZ::RPI::Model> GetModel() const;
@@ -93,14 +94,14 @@ namespace GeomNodes
         const AZ::Render::MeshFeatureProcessorInterface::MeshHandle* GetMeshHandle() const override;
 
         //! Creates the attribute mesh buffers
-		bool CreateMeshBuffers(const GNModelData& modelData);
-        //! Creates everything related to the model for Atom Rendering. 
+        bool CreateMeshBuffers(const GNModelData& modelData);
+        //! Creates everything related to the model for Atom Rendering.
         bool CreateMesh(const GNModelData& modelData);
         //! Using the ModelLodAssetCreator creates the Model LOD asset and the meshes.
         bool CreateLodAsset(const GNModelData& modelData);
         //! Using the ModelAssetCreator creates the model asset and sets the material slots.
         void CreateModelAsset();
-        //! Final step for create the model by acquiring the mesh handle from the mesh feature processor 
+        //! Final step for create the model by acquiring the mesh handle from the mesh feature processor
         bool CreateModel();
         //! Add LOD buffers to ModelLodAsset
         void AddLodBuffers(AZ::RPI::ModelLodAssetCreator& modelLodCreator);
@@ -121,7 +122,7 @@ namespace GeomNodes
         //! Reference to a Model instance
         AZ::Data::Instance<AZ::RPI::Model> m_model;
         //! Reference to MeshFeatureProcessor
-		AZ::Render::MeshFeatureProcessorInterface* m_meshFeatureProcessor = nullptr;
+        AZ::Render::MeshFeatureProcessorInterface* m_meshFeatureProcessor = nullptr;
         //! Reference to MeshHandle
         AZ::Render::MeshFeatureProcessorInterface::MeshHandle m_meshHandle;
         //! Material map
@@ -152,4 +153,4 @@ namespace GeomNodes
         //! current model scale
         AZ::Vector3 m_scale;
     };
-}
+} // namespace GeomNodes

+ 35 - 35
Gems/O3DE/GeomNodes/Code/Source/Editor/Systems/GNInstance.cpp

@@ -8,8 +8,9 @@
 
 #include "GNInstance.h"
 #include <Editor/Common/GNAPI.h>
-#include <Editor/Systems/GeomNodesSystem.h>
 #include <Editor/Common/GNConstants.h>
+#include <Editor/Systems/GeomNodesSystem.h>
+
 
 namespace GeomNodes
 {
@@ -33,7 +34,8 @@ namespace GeomNodes
         return m_blenderProcessWatcher && m_blenderProcessWatcher->IsProcessRunning();
     }
 
-    bool GNInstance::Init(const AZStd::string& filePath, const AZStd::string& scriptPath, const AZStd::string& exePath, AZ::EntityId entityId)
+    bool GNInstance::Init(
+        const AZStd::string& filePath, const AZStd::string& scriptPath, const AZStd::string& exePath, AZ::EntityId entityId)
     {
         m_entityId = entityId;
         m_path = filePath;
@@ -65,8 +67,8 @@ namespace GeomNodes
         AZStd::string blenderPath = GetGNSystem()->GetBlenderPath();
         if (blenderPath.empty())
         {
-			AZ_Error("GNInstance", false, "Blender instance failed to launch! Blender path is not set or valid.");
-			return false;
+            AZ_Error("GNInstance", false, "Blender instance failed to launch! Blender path is not set or valid.");
+            return false;
         }
 
         processLaunchInfo.m_commandlineParameters = AZStd::string::format(
@@ -80,8 +82,8 @@ namespace GeomNodes
         processLaunchInfo.m_showWindow = false;
         processLaunchInfo.m_processPriority = AzFramework::ProcessPriority::PROCESSPRIORITY_NORMAL;
 
-        AzFramework::ProcessWatcher* outProcess = AzFramework::ProcessWatcher::LaunchProcess(
-            processLaunchInfo, AzFramework::ProcessCommunicationType::COMMUNICATOR_TYPE_NONE);
+        AzFramework::ProcessWatcher* outProcess =
+            AzFramework::ProcessWatcher::LaunchProcess(processLaunchInfo, AzFramework::ProcessCommunicationType::COMMUNICATOR_TYPE_NONE);
 
         if (outProcess)
         {
@@ -104,28 +106,27 @@ namespace GeomNodes
 
     AZStd::string GNInstance::SendParamUpdates(const AZStd::string& params, const AZStd::string& objectName)
     {
-		auto msg = AZStd::string::format(
-			R"JSON(
+        auto msg = AZStd::string::format(
+            R"JSON(
                 {
                     "%s": [ %s ],
                     "%s": "%s",
                     "ParamUpdate": true
                 }
-            )JSON"
-			, Field::Params
-			, params.c_str()
-			, Field::Object
-			, objectName.c_str()
-		);
+            )JSON",
+            Field::Params,
+            params.c_str(),
+            Field::Object,
+            objectName.c_str());
 
-		SendIPCMsg(msg);
+        SendIPCMsg(msg);
 
         return msg;
     }
 
     void GNInstance::SendHeartbeat()
     {
-		SendIPCMsg(R"JSON(
+        SendIPCMsg(R"JSON(
                         {
                             "Alive": true 
                         }
@@ -134,7 +135,7 @@ namespace GeomNodes
 
     void GNInstance::RequestObjectParams()
     {
-		SendIPCMsg(R"JSON(
+        SendIPCMsg(R"JSON(
                         {
                             "FetchObjectParams": true 
                         }
@@ -143,39 +144,38 @@ namespace GeomNodes
 
     void GNInstance::CloseMap(AZ::u64 mapId)
     {
-		auto msg = AZStd::string::format(
-			R"JSON(
+        auto msg = AZStd::string::format(
+            R"JSON(
                     {
                         "%s": true,
                         "%s": %llu
                     }
                     )JSON",
-			Field::SHMClose,
-			Field::MapId,
-			mapId);
-		SendIPCMsg(msg);
+            Field::SHMClose,
+            Field::MapId,
+            mapId);
+        SendIPCMsg(msg);
     }
 
     void GNInstance::RequestExport(const AZStd::string& params, const AZStd::string& objectName, const AZStd::string& fbxPath)
     {
-		auto msg = AZStd::string::format(
-			R"JSON(
+        auto msg = AZStd::string::format(
+            R"JSON(
                     {
                         "%s": true,
                         "%s": [ %s ],
                         "%s": "%s",
                         "%s": "%s"
                     }
-                    )JSON"
-			, Field::Export
-			, Field::Params
-			, params.c_str()
-            , Field::Object
-            , objectName.c_str()
-            , Field::FBXPath
-            , fbxPath.c_str()
-			);
-		SendIPCMsg(msg);
+                    )JSON",
+            Field::Export,
+            Field::Params,
+            params.c_str(),
+            Field::Object,
+            objectName.c_str(),
+            Field::FBXPath,
+            fbxPath.c_str());
+        SendIPCMsg(msg);
     }
 
 } // namespace GeomNodes

+ 2 - 1
Gems/O3DE/GeomNodes/Code/Source/Editor/Systems/GNInstance.h

@@ -9,9 +9,10 @@
 #pragma once
 
 #include "Editor/Commons.h"
-#include <AzFramework/Process/ProcessWatcher.h>
 #include <AzCore/Component/EntityId.h>
 #include <AzCore/Component/TickBus.h>
+#include <AzFramework/Process/ProcessWatcher.h>
+
 
 namespace GeomNodes
 {

+ 4 - 4
Gems/O3DE/GeomNodes/Code/Source/Editor/Systems/GNParamContext.cpp

@@ -57,7 +57,7 @@ namespace GeomNodes
             if (serializeContext->FindClassData(AZ::Uuid("{AA9713B7-70F1-43CB-9F95-5BEC9F44F556}")) == nullptr)
             {
                 serializeContext->Class<GNParamContext>()->Version(2)->Field("Properties", &GNParamContext::m_group);
-                    
+
                 serializeContext->Class<GNPropertyGroup>()
                     ->Field("Name", &GNPropertyGroup::m_name)
                     ->Field("Properties", &GNPropertyGroup::m_properties)
@@ -111,7 +111,7 @@ namespace GeomNodes
         AZ::u64 uCtr = m_properties.size();
         for (GNProperty* prop : m_properties)
         {
-            jsonString += prop->ToJSONString() ;
+            jsonString += prop->ToJSONString();
             uCtr--;
             if (uCtr > 0)
                 jsonString += ", ";
@@ -166,7 +166,7 @@ namespace GeomNodes
         case ParamType::String:
             return "STRING";
         }
-        
+
         return "UNKNOWN";
     }
 
@@ -193,7 +193,7 @@ namespace GeomNodes
     }
 
     // GNParamDataContext
-    
+
     bool GNParamDataContext::IsNil(int index) const
     {
         return index == (int)ParamType::Unknown;

+ 6 - 3
Gems/O3DE/GeomNodes/Code/Source/Editor/Systems/GNParamContext.h

@@ -8,12 +8,13 @@
 
 #pragma once
 
-#include <AzCore/RTTI/ReflectContext.h>
 #include <AzCore/JSON/document.h>
 #include <AzCore/JSON/rapidjson.h>
+#include <AzCore/RTTI/ReflectContext.h>
 #include <Editor/Common/GNConstants.h>
 #include <GeomNodes/GeomNodesTypeIds.h>
 
+
 namespace GeomNodes
 {
     class GNProperty;
@@ -37,7 +38,8 @@ namespace GeomNodes
     template<class T>
     struct GNValue
     {
-        typedef typename AZStd::remove_const<typename AZStd::remove_reference<typename AZStd::remove_pointer<T>::type>::type>::type ValueType;
+        typedef
+            typename AZStd::remove_const<typename AZStd::remove_reference<typename AZStd::remove_pointer<T>::type>::type>::type ValueType;
     };
 
     template<>
@@ -102,6 +104,7 @@ namespace GeomNodes
     class GNParamDataContext
     {
         friend GNParamContext;
+
     public:
         AZ_TYPE_INFO(GNParamDataContext, GNParamDataContextTypeId);
 
@@ -163,7 +166,7 @@ namespace GeomNodes
             return false;
 
         valueRef = GNValue<T>::Read((*m_curParamObj)[key]);
-        
+
         return true;
     }
 

+ 62 - 68
Gems/O3DE/GeomNodes/Code/Source/Editor/Systems/GNProperty.cpp

@@ -35,8 +35,7 @@ namespace GeomNodes
                     })
                 ->Field("id", &GNProperty::m_id)
                 ->Field("name", &GNProperty::m_name)
-                ->Field("gnId", &GNProperty::m_gnId)
-                ;
+                ->Field("gnId", &GNProperty::m_gnId);
         }
     }
 
@@ -141,13 +140,13 @@ namespace GeomNodes
                 }
             }
 
-			retVal = aznew GNParamBoolean(name, value, context.GetReadOnlyPointer(), context.GetEntityId());
-			retVal->ReadSetGNId(context);
+            retVal = aznew GNParamBoolean(name, value, context.GetReadOnlyPointer(), context.GetEntityId());
+            retVal->ReadSetGNId(context);
         }
 
         return retVal;
     }
-    
+
     AZStd::string GNParamBoolean::ToJSONString() const
     {
         auto jsonString = AZStd::string::format(
@@ -158,16 +157,15 @@ namespace GeomNodes
                         "%s": "%s",
                         "%s": "%s"
                     }
-                )JSON"
-            , Field::Id
-            , m_gnId.c_str()
-            , Field::Value
-            , m_value ? 1 : 0
-            , Field::Type
-            , m_type.c_str()
-			, Field::Name
-			, m_name.c_str()
-        );
+                )JSON",
+            Field::Id,
+            m_gnId.c_str(),
+            Field::Value,
+            m_value ? 1 : 0,
+            Field::Type,
+            m_type.c_str(),
+            Field::Name,
+            m_name.c_str());
         return jsonString;
     }
 
@@ -196,13 +194,13 @@ namespace GeomNodes
         if (context.IsInt(valueIndex))
         {
             int value;
-			if (!context.ReadValue(value, Field::DefaultValue))
-			{
-				if (!context.ReadValue(value, Field::Value))
-				{
-					AZ_Error("GNParamInt", false, "Missing DefaultValue or Value keys in the JSON data\n");
-				}
-			}
+            if (!context.ReadValue(value, Field::DefaultValue))
+            {
+                if (!context.ReadValue(value, Field::Value))
+                {
+                    AZ_Error("GNParamInt", false, "Missing DefaultValue or Value keys in the JSON data\n");
+                }
+            }
             auto paramInt = aznew GNParamInt(name, value, context.GetReadOnlyPointer(), context.GetEntityId());
 
             int min, max;
@@ -238,16 +236,15 @@ namespace GeomNodes
                         "%s": "%s",
                         "%s": "%s"
                     }
-                )JSON"
-            , Field::Id
-            , m_gnId.c_str()
-            , Field::Value
-            , m_value
-            , Field::Type
-            , m_type.c_str()
-			, Field::Name
-			, m_name.c_str()
-        );
+                )JSON",
+            Field::Id,
+            m_gnId.c_str(),
+            Field::Value,
+            m_value,
+            Field::Type,
+            m_type.c_str(),
+            Field::Name,
+            m_name.c_str());
         return jsonString;
     }
 
@@ -260,8 +257,7 @@ namespace GeomNodes
 
         if (serializeContext)
         {
-            serializeContext->Class<GNParamValue, GNProperty>()->Version(1)->Field(
-                "value", &GNParamValue::m_value);
+            serializeContext->Class<GNParamValue, GNProperty>()->Version(1)->Field("value", &GNParamValue::m_value);
         }
     }
 
@@ -272,13 +268,13 @@ namespace GeomNodes
         if (context.IsValue(valueIndex))
         {
             double value;
-			if (!context.ReadValue(value, Field::DefaultValue))
-			{
-				if (!context.ReadValue(value, Field::Value))
-				{
-					AZ_Error("GNParamValue", false, "Missing DefaultValue or Value keys in the JSON data\n");
-				}
-			}
+            if (!context.ReadValue(value, Field::DefaultValue))
+            {
+                if (!context.ReadValue(value, Field::Value))
+                {
+                    AZ_Error("GNParamValue", false, "Missing DefaultValue or Value keys in the JSON data\n");
+                }
+            }
             auto paramValue = aznew GNParamValue(name, value, context.GetReadOnlyPointer(), context.GetEntityId());
             double min, max;
             if (context.ReadValue(min, Field::MinValue))
@@ -313,16 +309,15 @@ namespace GeomNodes
                         "%s": "%s",
                         "%s": "%s"
                     }
-                )JSON"
-            , Field::Id
-            , m_gnId.c_str()
-            , Field::Value
-            , m_value
-            , Field::Type
-            , m_type.c_str()
-			, Field::Name
-			, m_name.c_str()
-        );
+                )JSON",
+            Field::Id,
+            m_gnId.c_str(),
+            Field::Value,
+            m_value,
+            Field::Type,
+            m_type.c_str(),
+            Field::Name,
+            m_name.c_str());
         return jsonString;
     }
 
@@ -346,13 +341,13 @@ namespace GeomNodes
         if (context.IsString(valueIndex))
         {
             const char* value = nullptr;
-			if (!context.ReadValue(value, Field::DefaultValue))
-			{
-				if (!context.ReadValue(value, Field::Value))
-				{
-					AZ_Error("GNParamString", false, "Missing DefaultValue or Value keys in the JSON data\n");
-				}
-			}
+            if (!context.ReadValue(value, Field::DefaultValue))
+            {
+                if (!context.ReadValue(value, Field::Value))
+                {
+                    AZ_Error("GNParamString", false, "Missing DefaultValue or Value keys in the JSON data\n");
+                }
+            }
             retVal = aznew GNParamString(name, value, context.GetReadOnlyPointer(), context.GetEntityId());
             retVal->ReadSetGNId(context);
         }
@@ -375,16 +370,15 @@ namespace GeomNodes
                         "%s": "%s",
                         "%s": "%s"
                     }
-                )JSON"
-            , Field::Id
-            , m_gnId.c_str()
-            , Field::Value
-            , m_value.c_str()
-            , Field::Type
-            , m_type.c_str()
-			, Field::Name
-			, m_name.c_str()
-        );
+                )JSON",
+            Field::Id,
+            m_gnId.c_str(),
+            Field::Value,
+            m_value.c_str(),
+            Field::Type,
+            m_type.c_str(),
+            Field::Name,
+            m_name.c_str());
         return jsonString;
     }
 } // namespace GeomNodes

+ 35 - 34
Gems/O3DE/GeomNodes/Code/Source/Editor/Systems/GNProperty.h

@@ -8,14 +8,14 @@
 
 #pragma once
 
-#include <AzCore/Memory/SystemAllocator.h>
+#include <AzCore/Component/EntityId.h>
 #include <AzCore/Math/Crc.h>
+#include <AzCore/Memory/SystemAllocator.h>
 #include <AzCore/RTTI/TypeInfoSimple.h>
-#include <AzCore/Serialization/SerializeContext.h>
-#include <AzCore/Component/EntityId.h>
-#include <Editor/Systems/GNParamContext.h>
 #include <AzCore/Serialization/EditContext.h>
+#include <AzCore/Serialization/SerializeContext.h>
 #include <Editor/EBus/EditorGeomNodesComponentBus.h>
+#include <Editor/Systems/GNParamContext.h>
 #include <GeomNodes/GeomNodesTypeIds.h>
 
 namespace AZ
@@ -25,7 +25,6 @@ namespace AZ
 
 namespace GeomNodes
 {
-    
     class GNProperties
     {
     public:
@@ -38,8 +37,6 @@ namespace GeomNodes
     class GNProperty
     {
     public:
-        //static void UpdateScriptProperty(GNParamDataContext& sdc, int valueIndex, GNProperty** targetProperty);
-
         static void Reflect(AZ::ReflectContext* reflection);
         static bool VersionConverter(AZ::SerializeContext& context, AZ::SerializeContext::DataElementNode& classElement);
 
@@ -62,9 +59,9 @@ namespace GeomNodes
         virtual const void* GetDataAddress() const = 0;
         virtual AZ::TypeId GetDataTypeUuid() const = 0;
         virtual AZStd::string ToJSONString() const = 0;
-        
+
         virtual void ReadSetGNId(GNParamDataContext& context);
-        
+
         virtual bool IsReadOnly()
         {
             return m_pReadOnly == nullptr ? false : *m_pReadOnly;
@@ -75,14 +72,17 @@ namespace GeomNodes
             EditorGeomNodesComponentRequestBus::Event(m_entityId, &EditorGeomNodesComponentRequests::OnParamChange);
         }
 
-        AZ::u64         m_id;
-        AZStd::string   m_gnId;                     // Geometry Node Param Id
-        AZStd::string   m_name;                     // Geometry Node Param Name
-        AZStd::string   m_type = "UNKNOWN";         // Geometry Node Param Type
-        bool*           m_pReadOnly = nullptr;
-        bool            m_isMaxSet = false;
-        bool            m_isMinSet = false;
-        AZ::EntityId    m_entityId;
+        AZ::u64 m_id;
+        //! Geometry Node Param Id
+        AZStd::string m_gnId;
+        //! Geometry Node Param Name
+        AZStd::string m_name;
+        //! Geometry Node Param Type
+        AZStd::string m_type = "UNKNOWN";
+        bool* m_pReadOnly = nullptr;
+        bool m_isMaxSet = false;
+        bool m_isMinSet = false;
+        AZ::EntityId m_entityId;
     };
 
     class GNParamNil : public GNProperty
@@ -97,8 +97,8 @@ namespace GeomNodes
         GNParamNil()
         {
         }
-		GNParamNil(const char* name, bool* pReadOnly, AZ::EntityId entityId)
-			: GNProperty(name, pReadOnly, entityId)
+        GNParamNil(const char* name, bool* pReadOnly, AZ::EntityId entityId)
+            : GNProperty(name, pReadOnly, entityId)
         {
         }
 
@@ -121,8 +121,8 @@ namespace GeomNodes
         {
             m_type = GetEnumString(ParamType::Bool);
         }
-		GNParamBoolean(const char* name, bool value, bool* pReadOnly, AZ::EntityId entityId)
-			: GNProperty(name, pReadOnly, entityId)
+        GNParamBoolean(const char* name, bool value, bool* pReadOnly, AZ::EntityId entityId)
+            : GNProperty(name, pReadOnly, entityId)
             , m_value(value)
         {
             m_type = GetEnumString(ParamType::Bool);
@@ -154,8 +154,8 @@ namespace GeomNodes
         {
             m_type = GetEnumString(ParamType::Int);
         }
-		GNParamInt(const char* name, int value, bool* pReadOnly, AZ::EntityId entityId)
-			: GNProperty(name, pReadOnly, entityId)
+        GNParamInt(const char* name, int value, bool* pReadOnly, AZ::EntityId entityId)
+            : GNProperty(name, pReadOnly, entityId)
             , m_value(value)
         {
             m_type = GetEnumString(ParamType::Int);
@@ -181,9 +181,10 @@ namespace GeomNodes
         }
 
         int m_value;
-        int m_max;      // Geometry Node Param Max(int)
-        int m_min;      // Geometry Node Param Min(int)
-
+        //! Geometry Node Param Max(int)
+        int m_max;
+        //! Geometry Node Param Min(int)
+        int m_min;
     };
 
     class GNParamValue : public GNProperty
@@ -200,8 +201,8 @@ namespace GeomNodes
         {
             m_type = GetEnumString(ParamType::Value);
         }
-		GNParamValue(const char* name, double value, bool* pReadOnly, AZ::EntityId entityId)
-			: GNProperty(name, pReadOnly, entityId)
+        GNParamValue(const char* name, double value, bool* pReadOnly, AZ::EntityId entityId)
+            : GNProperty(name, pReadOnly, entityId)
             , m_value(value)
         {
             m_type = GetEnumString(ParamType::Value);
@@ -227,9 +228,10 @@ namespace GeomNodes
         }
 
         double m_value;
-        double m_max;       // Geometry Node Param Max(double)
-        double m_min;       // Geometry Node Param Min(double)
-
+        //! Geometry Node Param Max(double)
+        double m_max;
+        //! Geometry Node Param Min(double)
+        double m_min;
     };
 
     class GNParamString : public GNProperty
@@ -245,8 +247,8 @@ namespace GeomNodes
         {
             m_type = GetEnumString(ParamType::String);
         }
-		GNParamString(const char* name, const char* value, bool* pReadOnly, AZ::EntityId entityId)
-			: GNProperty(name, pReadOnly, entityId)
+        GNParamString(const char* name, const char* value, bool* pReadOnly, AZ::EntityId entityId)
+            : GNProperty(name, pReadOnly, entityId)
             , m_value(value)
         {
             m_type = GetEnumString(ParamType::String);
@@ -260,6 +262,5 @@ namespace GeomNodes
         AZStd::string ToJSONString() const override;
 
         AZStd::string m_value;
-
     };
 } // namespace GeomNodes

+ 2 - 2
Gems/O3DE/GeomNodes/Code/Source/Editor/Systems/GNSystemInterface.cpp

@@ -10,7 +10,7 @@
 
 namespace GeomNodes
 {
-    void GNSystemInterface::Reflect(AZ::ReflectContext* /*context*/)
+    void GNSystemInterface::Reflect([[maybe_unused]] AZ::ReflectContext* context)
     {
     }
-}
+} // namespace GeomNodes

+ 15 - 9
Gems/O3DE/GeomNodes/Code/Source/Editor/Systems/GNSystemInterface.h

@@ -37,21 +37,27 @@ namespace GeomNodes
         //! @return the Blender Editor path
         virtual AZStd::string_view GetBlenderPath() = 0;
 
-		//! Get the current GNConfiguration used to initialize the GeomNodes system.
-		virtual const GNConfiguration* GetConfiguration() const = 0;
+        //! Get the current GNConfiguration used to initialize the GeomNodes system.
+        virtual const GNConfiguration* GetConfiguration() const = 0;
 
-		//! Update the GNConfiguration.
-		//! This will apply the new configuration
-		//! @param newConfig The new configuration to apply.
-		virtual void UpdateConfiguration(const GNConfiguration* newConfig) = 0;
+        //! Update the GNConfiguration.
+        //! This will apply the new configuration
+        //! @param newConfig The new configuration to apply.
+        virtual void UpdateConfiguration(const GNConfiguration* newConfig) = 0;
 
         //! Register to receive notifications when the GeomNodes System is Initialized.
         //! @param handler The handler to receive the event.
-        void RegisterSystemInitializedEvent(SystemEvents::OnInitializedEvent::Handler& handler) { handler.Connect(m_initializeEvent); }
+        void RegisterSystemInitializedEvent(SystemEvents::OnInitializedEvent::Handler& handler)
+        {
+            handler.Connect(m_initializeEvent);
+        }
         //! Register to receive notifications when the GNConfiguration changes.
         //! @param handler The handler to receive the event.
-        void RegisterSystemConfigurationChangedEvent(SystemEvents::OnConfigurationChangedEvent::Handler& handler) { handler.Connect(m_configChangeEvent); }
-    
+        void RegisterSystemConfigurationChangedEvent(SystemEvents::OnConfigurationChangedEvent::Handler& handler)
+        {
+            handler.Connect(m_configChangeEvent);
+        }
+
     protected:
         SystemEvents::OnInitializedEvent m_initializeEvent;
         SystemEvents::OnConfigurationChangedEvent m_configChangeEvent;

+ 48 - 53
Gems/O3DE/GeomNodes/Code/Source/Editor/Systems/GeomNodesSystem.cpp

@@ -7,19 +7,17 @@
  */
 
 #include "GeomNodesSystem.h"
+#include "Editor/UI/GeomNodesValidator.h"
 #include "Editor/UI/PropertyFileSelect.h"
 #include "Editor/UI/ValidationHandler.h"
-#include "Editor/UI/GeomNodesValidator.h"
 #include <Editor/Common/GNAPI.h>
 #include <Editor/EBus/IpcHandlerBus.h>
 
+
 namespace GeomNodes
 {
     long IpcHandlerCB(AZ::u64 id, const char* data, AZ::u64 length)
     {
-        /*AZStd::string msg;
-        msg.assign(data, length);
-        AZ_Printf("GeomNodesSystem", "id: %llu data: %s length: %llu", id, msg.c_str(), length);*/
         Ipc::IpcHandlerNotificationBus::Event(
             AZ::EntityId(id), &Ipc::IpcHandlerNotificationBus::Events::OnMessageReceived, reinterpret_cast<const AZ::u8*>(data), length);
 
@@ -31,8 +29,8 @@ namespace GeomNodes
         , m_propertyHandlers()
         , m_validator(AZStd::make_unique<Validator>())
         , m_validationHandler(AZStd::make_unique<ValidationHandler>())
-        {
-        }
+    {
+    }
 
     GeomNodesSystem::~GeomNodesSystem()
     {
@@ -41,33 +39,33 @@ namespace GeomNodes
 
     void GeomNodesSystem::Initialize(const GNConfiguration* config)
     {
-		if (m_state == State::Initialized)
-		{
-			AZ_Warning("GeomNodesSystem", false, "GeomNodes system already initialized, Shutdown must be called first");
-			return;
-		}
+        if (m_state == State::Initialized)
+        {
+            AZ_Warning("GeomNodesSystem", false, "GeomNodes system already initialized, Shutdown must be called first");
+            return;
+        }
 
-		m_systemConfig = *config;
-		
-		API::Init(SERVER_ID, IpcHandlerCB);
+        m_systemConfig = *config;
 
-		RegisterHandlersAndBuses();
+        API::Init(SERVER_ID, IpcHandlerCB);
 
-		m_state = State::Initialized;
-		m_initializeEvent.Signal(&m_systemConfig);
+        RegisterHandlersAndBuses();
+
+        m_state = State::Initialized;
+        m_initializeEvent.Signal(&m_systemConfig);
     }
 
     void GeomNodesSystem::Shutdown()
     {
-		if (m_state != State::Initialized)
-		{
-			return;
-		}
+        if (m_state != State::Initialized)
+        {
+            return;
+        }
 
-		UnregisterHandlersAndBuses();
-		API::Uninitialize();
+        UnregisterHandlersAndBuses();
+        API::Uninitialize();
 
-		m_state = State::Shutdown;
+        m_state = State::Shutdown;
     }
 
     AZStd::string_view GeomNodesSystem::GetBlenderPath()
@@ -80,27 +78,30 @@ namespace GeomNodes
         return &m_systemConfig;
     }
 
-	const GNConfiguration& GeomNodesSystem::GetSystemConfiguration() const
-	{
-		return m_systemConfig;
-	}
+    const GNConfiguration& GeomNodesSystem::GetSystemConfiguration() const
+    {
+        return m_systemConfig;
+    }
 
     void GeomNodesSystem::SetLastPath(const AZStd::string& lastPath)
     {
         m_systemConfig.m_lastFilePath = lastPath;
         const GNSettingsRegistryManager& settingsRegManager = GetSettingsRegistryManager();
-		auto saveCallback = [](const GNConfiguration& config, GNSettingsRegistryManager::Result result)
-		{
-			AZ_Warning("GeomNodes", result == GNSettingsRegistryManager::Result::Success, "Unable to save the GeomNodes configuration. Any changes have not been applied.");
-			if (result == GNSettingsRegistryManager::Result::Success)
-			{
-				if (auto* gnSystem = GetGNSystem())
-				{
-					gnSystem->UpdateConfiguration(&config);
-				}
-			}
-		};
-		settingsRegManager.SaveSystemConfiguration(m_systemConfig, saveCallback);
+        auto saveCallback = [](const GNConfiguration& config, GNSettingsRegistryManager::Result result)
+        {
+            AZ_Warning(
+                "GeomNodes",
+                result == GNSettingsRegistryManager::Result::Success,
+                "Unable to save the GeomNodes configuration. Any changes have not been applied.");
+            if (result == GNSettingsRegistryManager::Result::Success)
+            {
+                if (auto* gnSystem = GetGNSystem())
+                {
+                    gnSystem->UpdateConfiguration(&config);
+                }
+            }
+        };
+        settingsRegManager.SaveSystemConfiguration(m_systemConfig, saveCallback);
     }
 
     AZStd::string GeomNodesSystem::GetLastPath()
@@ -110,11 +111,11 @@ namespace GeomNodes
 
     void GeomNodesSystem::UpdateConfiguration(const GNConfiguration* newConfig)
     {
-		if(m_systemConfig != *newConfig)
-		{
-			m_systemConfig = (*newConfig);
-			m_configChangeEvent.Signal(newConfig);
-		}
+        if (m_systemConfig != *newConfig)
+        {
+            m_systemConfig = (*newConfig);
+            m_configChangeEvent.Signal(newConfig);
+        }
     }
 
     const GNSettingsRegistryManager& GeomNodesSystem::GetSettingsRegistryManager() const
@@ -137,11 +138,6 @@ namespace GeomNodes
         m_propertyHandlers.push_back(PropertyFuncValBrowseEditHandler::Register(m_validationHandler.get()));
         m_propertyHandlers.push_back(PropertyFileSelectHandler::Register(m_validationHandler.get()));
         ValidatorBus::Handler::BusConnect();
-
-        //TODO: setup our IPC system. Since this is the gem it will be the server.
-        // only one handler. Then messages will have the sender id(EntityID) which will be used when sending
-        // the messages via the EBUS. when a component is registered as an EBUS handler they will receive
-        // the correct messages.
     }
 
     void GeomNodesSystem::UnregisterHandlersAndBuses()
@@ -151,8 +147,7 @@ namespace GeomNodes
         for (AzToolsFramework::PropertyHandlerBase* handler : m_propertyHandlers)
         {
             AzToolsFramework::PropertyTypeRegistrationMessages::Bus::Broadcast(
-                &AzToolsFramework::PropertyTypeRegistrationMessages::Bus::Handler::UnregisterPropertyType,
-                handler);
+                &AzToolsFramework::PropertyTypeRegistrationMessages::Bus::Handler::UnregisterPropertyType, handler);
             delete handler;
         }
     }
@@ -161,4 +156,4 @@ namespace GeomNodes
     {
         return azdynamic_cast<GeomNodesSystem*>(AZ::Interface<GeomNodes::GNSystemInterface>::Get());
     }
-}
+} // namespace GeomNodes

+ 18 - 17
Gems/O3DE/GeomNodes/Code/Source/Editor/Systems/GeomNodesSystem.h

@@ -8,16 +8,17 @@
 
 #pragma once
 
-#include <AzCore/Interface/Interface.h>
-#include <Editor/Systems/GNSystemInterface.h>
-#include <Editor/Configuration/GNConfiguration.h>
-#include <Editor/Configuration/GNSettingsRegistryManager.h>
+#include "Editor/EBus/ValidatorBus.h"
 #include <AZCore/std/containers/vector.h>
 #include <AZCore/std/smart_ptr/unique_ptr.h>
+#include <AzCore/Interface/Interface.h>
 #include <AzToolsFramework/UI/PropertyEditor/PropertyEditorAPI.h>
-#include "Editor/EBus/ValidatorBus.h"
+#include <Editor/Configuration/GNConfiguration.h>
+#include <Editor/Configuration/GNSettingsRegistryManager.h>
+#include <Editor/Systems/GNSystemInterface.h>
 #include <GeomNodes/GeomNodesTypeIds.h>
 
+
 namespace GeomNodes
 {
     class Validator;
@@ -37,7 +38,7 @@ namespace GeomNodes
         void Initialize(const GNConfiguration* config) override;
         void Shutdown() override;
         AZStd::string_view GetBlenderPath() override;
-		const GNConfiguration* GetConfiguration() const override;
+        const GNConfiguration* GetConfiguration() const override;
         void UpdateConfiguration(const GNConfiguration* newConfig) override;
 
         //! Accessor to get the Settings Registry Manager.
@@ -57,7 +58,7 @@ namespace GeomNodes
         void UnregisterHandlersAndBuses();
 
         //! Handles all settings registry interactions.
-        AZStd::unique_ptr<GNSettingsRegistryManager> m_registryManager; 
+        AZStd::unique_ptr<GNSettingsRegistryManager> m_registryManager;
 
         //! Allows lookup and contains all allocated QValidators
         AZStd::unique_ptr<Validator> m_validator;
@@ -67,15 +68,15 @@ namespace GeomNodes
 
         GNConfiguration m_systemConfig;
 
-		enum class State : AZ::u8
-		{
-			Uninitialized = 0,
-			Initialized,
-			Shutdown
-		};
-		State m_state = State::Uninitialized;
+        enum class State : AZ::u8
+        {
+            Uninitialized = 0,
+            Initialized,
+            Shutdown
+        };
+        State m_state = State::Uninitialized;
     };
 
-	//! Helper function for getting the GeomNodes System interface from inside the GeomNodes gem.
-	GeomNodesSystem* GetGNSystem();
-}
+    //! Helper function for getting the GeomNodes System interface from inside the GeomNodes gem.
+    GeomNodesSystem* GetGNSystem();
+} // namespace GeomNodes

+ 15 - 12
Gems/O3DE/GeomNodes/Code/Source/Editor/UI/ConfigurationWidget.cpp

@@ -6,14 +6,15 @@
  *
  */
 
-#include <AzFramework/Physics/SystemBus.h>
 #include <AzFramework/Physics/Collision/CollisionGroups.h>
 #include <AzFramework/Physics/Collision/CollisionLayers.h>
-#include <AzToolsFramework/UI/PropertyEditor/ReflectedPropertyEditor.hxx>
+#include <AzFramework/Physics/SystemBus.h>
 #include <AzToolsFramework/UI/PropertyEditor/InstanceDataHierarchy.h>
-#include <QBoxLayout>
+#include <AzToolsFramework/UI/PropertyEditor/ReflectedPropertyEditor.hxx>
 #include <Editor/UI/ConfigurationWidget.h>
 #include <Editor/UI/SettingsWidget.h>
+#include <QBoxLayout>
+
 
 namespace GeomNodes
 {
@@ -27,23 +28,25 @@ namespace GeomNodes
             verticalLayout->setSpacing(0);
 
             m_settings = new SettingsWidget();
-            
+
             verticalLayout->addWidget(m_settings);
 
-            connect(m_settings, &SettingsWidget::onValueChanged,
-                this, [this](const GNConfiguration& gnSystemConfiguration)
-            {
-                m_gnSystemConfiguration = gnSystemConfiguration;
-                emit onConfigurationChanged(m_gnSystemConfiguration);
-            });
+            connect(
+                m_settings,
+                &SettingsWidget::onValueChanged,
+                this,
+                [this](const GNConfiguration& gnSystemConfiguration)
+                {
+                    m_gnSystemConfiguration = gnSystemConfiguration;
+                    emit onConfigurationChanged(m_gnSystemConfiguration);
+                });
         }
 
         ConfigurationWidget::~ConfigurationWidget()
         {
         }
 
-        void ConfigurationWidget::SetConfiguration(
-            const GNConfiguration& gnSystemConfiguration)
+        void ConfigurationWidget::SetConfiguration(const GNConfiguration& gnSystemConfiguration)
         {
             m_gnSystemConfiguration = gnSystemConfiguration;
             m_settings->SetValue(m_gnSystemConfiguration);

+ 5 - 5
Gems/O3DE/GeomNodes/Code/Source/Editor/UI/ConfigurationWidget.h

@@ -9,8 +9,9 @@
 #pragma once
 
 #if !defined(Q_MOC_RUN)
-#include <Editor/Configuration/GNConfiguration.h>
 #include <AzCore/Memory/SystemAllocator.h>
+#include <Editor/Configuration/GNConfiguration.h>
+
 #endif
 
 namespace GeomNodes
@@ -18,11 +19,10 @@ namespace GeomNodes
     namespace Editor
     {
         class SettingsWidget;
-        
+
         /// Widget for editing GeomNodes configuration and settings.
         ///
-        class ConfigurationWidget
-            : public QWidget
+        class ConfigurationWidget : public QWidget
         {
             Q_OBJECT
 
@@ -39,7 +39,7 @@ namespace GeomNodes
 
         private:
             GNConfiguration m_gnSystemConfiguration;
-            
+
             SettingsWidget* m_settings;
         };
     } // namespace Editor

+ 24 - 13
Gems/O3DE/GeomNodes/Code/Source/Editor/UI/EditorWindow.cpp

@@ -6,15 +6,17 @@
  *
  */
 
-#include <Editor/UI/ui_EditorWindow.h>
-#include <Editor/UI/EditorWindow.h>
-#include <Editor/UI/ConfigurationWidget.h>
-#include <Editor/Systems/GeomNodesSystem.h>
 #include <Editor/Configuration/GNConfiguration.h>
+#include <Editor/Systems/GeomNodesSystem.h>
+#include <Editor/UI/ConfigurationWidget.h>
+#include <Editor/UI/EditorWindow.h>
+#include <Editor/UI/ui_EditorWindow.h>
+
 
 #include <AzCore/Interface/Interface.h>
-#include <AzToolsFramework/API/ViewPaneOptions.h>
 #include <AzToolsFramework/API/ToolsApplicationAPI.h>
+#include <AzToolsFramework/API/ViewPaneOptions.h>
+
 
 namespace GeomNodes
 {
@@ -31,10 +33,13 @@ namespace GeomNodes
 
             auto* gnSystem = AZ::Interface<GNSystemInterface>::Get();
             const auto* gnSystemConfiguration = azdynamic_cast<const GNConfiguration*>(gnSystem->GetConfiguration());
-            
+
             m_ui->m_GeomNodesConfigurationWidget->SetConfiguration(*gnSystemConfiguration);
-            connect(m_ui->m_GeomNodesConfigurationWidget, &Editor::ConfigurationWidget::onConfigurationChanged, 
-                this, &EditorWindow::SaveConfiguration);
+            connect(
+                m_ui->m_GeomNodesConfigurationWidget,
+                &Editor::ConfigurationWidget::onConfigurationChanged,
+                this,
+                &EditorWindow::SaveConfiguration);
         }
 
         void EditorWindow::RegisterViewClass()
@@ -51,17 +56,23 @@ namespace GeomNodes
             auto* gnSystem = GetGNSystem();
             if (gnSystem == nullptr)
             {
-                AZ_Error("GeomNodes", false, "Unable to save the GeomNodes configuration. The GeomNodesSystem not initialized. Any changes have not been applied.");
+                AZ_Error(
+                    "GeomNodes",
+                    false,
+                    "Unable to save the GeomNodes configuration. The GeomNodesSystem not initialized. Any changes have not been applied.");
                 return;
             }
 
-            //update the GeomNodes system config if it has changed
+            // update the GeomNodes system config if it has changed
             const GNSettingsRegistryManager& settingsRegManager = gnSystem->GetSettingsRegistryManager();
             if (gnSystem->GetSystemConfiguration() != gnSystemConfiguration)
             {
                 auto saveCallback = [](const GNConfiguration& config, GNSettingsRegistryManager::Result result)
                 {
-                    AZ_Warning("GeomNodes", result == GNSettingsRegistryManager::Result::Success, "Unable to save the GeomNodes configuration. Any changes have not been applied.");
+                    AZ_Warning(
+                        "GeomNodes",
+                        result == GNSettingsRegistryManager::Result::Success,
+                        "Unable to save the GeomNodes configuration. Any changes have not been applied.");
                     if (result == GNSettingsRegistryManager::Result::Success)
                     {
                         if (auto* gnSystem = GetGNSystem())
@@ -73,6 +84,6 @@ namespace GeomNodes
                 settingsRegManager.SaveSystemConfiguration(gnSystemConfiguration, saveCallback);
             }
         }
-    }
-}
+    } // namespace Editor
+} // namespace GeomNodes
 #include <Editor/UI/moc_EditorWindow.cpp>

+ 4 - 7
Gems/O3DE/GeomNodes/Code/Source/Editor/UI/EditorWindow.h

@@ -21,13 +21,12 @@ namespace Ui
 namespace GeomNodes
 {
     struct GNConfiguration;
-    
+
     namespace Editor
     {
         /// Window pane wrapper for the GeomNodes Configuration Widget.
         ///
-        class EditorWindow
-            : public QWidget
+        class EditorWindow : public QWidget
         {
             Q_OBJECT
         public:
@@ -41,7 +40,5 @@ namespace GeomNodes
 
             QScopedPointer<Ui::EditorWindowClass> m_ui;
         };
-    }
-};
-
-
+    } // namespace Editor
+}; // namespace GeomNodes

+ 7 - 8
Gems/O3DE/GeomNodes/Code/Source/Editor/UI/FunctorValidator.h

@@ -18,28 +18,27 @@
 
 namespace GeomNodes
 {
-    class FunctorValidator
-        : public QValidator
+    class FunctorValidator : public QValidator
     {
         Q_OBJECT
 
     public:
         typedef AZStd::pair<QValidator::State, const QString> ReturnType;
-        typedef ReturnType(* FunctorType)(const QString&);
+        typedef ReturnType (*FunctorType)(const QString&);
 
         FunctorValidator(FunctorType functor);
 
-        // Validates using QValidates api
+        //! Validates using QValidates api
         QValidator::State validate(QString& input, int& pos) const override;
-        // Validates and returns the result with an error string if one occurred
+        //! Validates and returns the result with an error string if one occurred
         virtual ReturnType ValidateWithErrors(const QString& input) const;
-        // Returns the function used to validate
+        //! Returns the function used to validate
         FunctorType Functor() const;
 
     protected:
         FunctorValidator();
 
-        // The function to use for validating
+        //! The function to use for validating
         FunctorType m_functor;
     };
-} // namespace ProjectSettingsTool
+} // namespace GeomNodes

+ 3 - 3
Gems/O3DE/GeomNodes/Code/Source/Editor/UI/GeomNodesValidator.cpp

@@ -13,7 +13,8 @@
 namespace GeomNodes
 {
     Validator::Validator()
-    {}
+    {
+    }
 
     Validator::~Validator()
     {
@@ -40,8 +41,7 @@ namespace GeomNodes
             else
             {
                 FunctorValidator* qValidator = new FunctorValidator(validator);
-                m_validatorToQValidator.insert(
-                    AZStd::pair<FunctorValidator::FunctorType, FunctorValidator*>(validator, qValidator));
+                m_validatorToQValidator.insert(AZStd::pair<FunctorValidator::FunctorType, FunctorValidator*>(validator, qValidator));
 
                 return qValidator;
             }

+ 5 - 6
Gems/O3DE/GeomNodes/Code/Source/Editor/UI/GeomNodesValidator.h

@@ -10,9 +10,8 @@
 
 #include "FunctorValidator.h"
 
-#include <AzCore/std/string/string.h>
 #include <AzCore/std/containers/unordered_map.h>
-
+#include <AzCore/std/string/string.h>
 
 namespace GeomNodes
 {
@@ -25,9 +24,9 @@ namespace GeomNodes
         Validator();
         ~Validator();
 
-        // Finds the QValidator for a given validator or makes one and returns it
+        //! Finds the QValidator for a given validator or makes one and returns it
         FunctorValidator* GetQValidator(FunctorValidator::FunctorType validator);
-        // Tracks this QValidator and deletes it in the destructor
+        //! Tracks this QValidator and deletes it in the destructor
         void TrackThisValidator(FunctorValidator* validator);
 
     private:
@@ -36,9 +35,9 @@ namespace GeomNodes
 
         AZ_DISABLE_COPY_MOVE(Validator);
 
-        // Maps validator functions to QValidators
+        //! Maps validator functions to QValidators
         ValidatorToQValidatorType m_validatorToQValidator;
-        // Tracks allocations of other QValidators so they don't leak
+        //! Tracks allocations of other QValidators so they don't leak
         QValidatorList m_otherValidators;
     };
 } // namespace GeomNodes

+ 20 - 10
Gems/O3DE/GeomNodes/Code/Source/Editor/UI/PropertyFileSelect.cpp

@@ -12,8 +12,9 @@
 #include "ValidationHandler.h"
 
 #include <QLayout>
-#include <QPushButton>
 #include <QLineEdit>
+#include <QPushButton>
+
 
 namespace GeomNodes
 {
@@ -43,7 +44,8 @@ namespace GeomNodes
         }
     }
 
-    void PropertyFileSelectCtrl::ConsumeAttribute(AZ::u32 attrib, AzToolsFramework::PropertyAttributeReader* attrValue, const char* debugName)
+    void PropertyFileSelectCtrl::ConsumeAttribute(
+        AZ::u32 attrib, AzToolsFramework::PropertyAttributeReader* attrValue, const char* debugName)
     {
         if (attrib == Attributes::SelectFunction)
         {
@@ -65,7 +67,8 @@ namespace GeomNodes
     PropertyFileSelectHandler::PropertyFileSelectHandler(ValidationHandler* valHdlr)
         : AzToolsFramework::PropertyHandler<AZStd::string, PropertyFileSelectCtrl>()
         , m_validationHandler(valHdlr)
-    {}
+    {
+    }
 
     AZ::u32 PropertyFileSelectHandler::GetHandlerName(void) const
     {
@@ -79,22 +82,31 @@ namespace GeomNodes
         return ctrl;
     }
 
-    void PropertyFileSelectHandler::ConsumeAttribute(PropertyFileSelectCtrl* GUI, AZ::u32 attrib, AzToolsFramework::PropertyAttributeReader* attrValue, const char* debugName)
+    void PropertyFileSelectHandler::ConsumeAttribute(
+        PropertyFileSelectCtrl* GUI, AZ::u32 attrib, AzToolsFramework::PropertyAttributeReader* attrValue, const char* debugName)
     {
         GUI->ConsumeAttribute(attrib, attrValue, debugName);
     }
 
-    void PropertyFileSelectHandler::WriteGUIValuesIntoProperty([[maybe_unused]] size_t index, [[maybe_unused]] PropertyFileSelectCtrl* GUI, [[maybe_unused]] property_t& instance, [[maybe_unused]] AzToolsFramework::InstanceDataNode* node)
+    void PropertyFileSelectHandler::WriteGUIValuesIntoProperty(
+        [[maybe_unused]] size_t index,
+        [[maybe_unused]] PropertyFileSelectCtrl* GUI,
+        [[maybe_unused]] property_t& instance,
+        [[maybe_unused]] AzToolsFramework::InstanceDataNode* node)
     {
         instance = GUI->GetValue().toUtf8().data();
     }
 
-    bool PropertyFileSelectHandler::ReadValuesIntoGUI([[maybe_unused]] size_t index, [[maybe_unused]] PropertyFileSelectCtrl* GUI, [[maybe_unused]] const property_t& instance, [[maybe_unused]] AzToolsFramework::InstanceDataNode* node)
+    bool PropertyFileSelectHandler::ReadValuesIntoGUI(
+        [[maybe_unused]] size_t index,
+        [[maybe_unused]] PropertyFileSelectCtrl* GUI,
+        [[maybe_unused]] const property_t& instance,
+        [[maybe_unused]] AzToolsFramework::InstanceDataNode* node)
     {
         QSignalBlocker blocker(GUI);
         GUI->SetNotifyTarget(node->GetParent()->GetInstance(0));
         GUI->SetValue(instance.data());
-        //GUI->ForceValidate(); // <= causes an undo bug crash when moving the transform.
+        // GUI->ForceValidate(); // <= causes an undo bug crash when moving the transform.
         return true;
     }
 
@@ -102,11 +114,9 @@ namespace GeomNodes
     {
         PropertyFileSelectHandler* handler = aznew PropertyFileSelectHandler(valHdlr);
         AzToolsFramework::PropertyTypeRegistrationMessages::Bus::Broadcast(
-            &AzToolsFramework::PropertyTypeRegistrationMessages::Bus::Handler::RegisterPropertyType,
-            handler);
+            &AzToolsFramework::PropertyTypeRegistrationMessages::Bus::Handler::RegisterPropertyType, handler);
         return handler;
     }
 } // namespace GeomNodes
 
 #include <moc_PropertyFileSelect.cpp>
-

+ 16 - 9
Gems/O3DE/GeomNodes/Code/Source/Editor/UI/PropertyFileSelect.h

@@ -20,14 +20,13 @@ namespace GeomNodes
     // Forward declare
     class ValidationHandler;
 
-    class PropertyFileSelectCtrl
-        : public PropertyFuncValBrowseEditCtrl
+    class PropertyFileSelectCtrl : public PropertyFuncValBrowseEditCtrl
     {
         Q_OBJECT
 
     public:
         AZ_CLASS_ALLOCATOR(PropertyFileSelectCtrl, AZ::SystemAllocator)
-        typedef QString(* FileSelectFuncType)(const QString&);
+        typedef QString (*FileSelectFuncType)(const QString&);
 
         PropertyFileSelectCtrl(QWidget* pParent = nullptr);
 
@@ -40,8 +39,7 @@ namespace GeomNodes
         FileSelectFuncType m_selectFunctor;
     };
 
-    class PropertyFileSelectHandler
-        : public AzToolsFramework::PropertyHandler<AZStd::string, PropertyFileSelectCtrl>
+    class PropertyFileSelectHandler : public AzToolsFramework::PropertyHandler<AZStd::string, PropertyFileSelectCtrl>
     {
         AZ_CLASS_ALLOCATOR(PropertyFileSelectHandler, AZ::SystemAllocator);
 
@@ -50,12 +48,21 @@ namespace GeomNodes
 
         AZ::u32 GetHandlerName(void) const override;
         // Need to unregister ourselves
-        bool AutoDelete() const override { return false; }
+        bool AutoDelete() const override
+        {
+            return false;
+        }
 
         QWidget* CreateGUI(QWidget* pParent) override;
-        void ConsumeAttribute(PropertyFileSelectCtrl* GUI, AZ::u32 attrib, AzToolsFramework::PropertyAttributeReader* attrValue, const char* debugName) override;
-        void WriteGUIValuesIntoProperty(size_t index, PropertyFileSelectCtrl* GUI, property_t& instance, AzToolsFramework::InstanceDataNode* node) override;
-        bool ReadValuesIntoGUI(size_t index, PropertyFileSelectCtrl* GUI, const property_t& instance, AzToolsFramework::InstanceDataNode* node)  override;
+        void ConsumeAttribute(
+            PropertyFileSelectCtrl* GUI,
+            AZ::u32 attrib,
+            AzToolsFramework::PropertyAttributeReader* attrValue,
+            const char* debugName) override;
+        void WriteGUIValuesIntoProperty(
+            size_t index, PropertyFileSelectCtrl* GUI, property_t& instance, AzToolsFramework::InstanceDataNode* node) override;
+        bool ReadValuesIntoGUI(
+            size_t index, PropertyFileSelectCtrl* GUI, const property_t& instance, AzToolsFramework::InstanceDataNode* node) override;
         static PropertyFileSelectHandler* Register(ValidationHandler* valHdlr);
 
     private:

+ 27 - 16
Gems/O3DE/GeomNodes/Code/Source/Editor/UI/PropertyFuncValBrowseEdit.cpp

@@ -12,8 +12,9 @@
 
 #include <AzToolsFramework/UI/PropertyEditor/PropertyQTConstants.h>
 
-#include <QLineEdit>
 #include <QHBoxLayout>
+#include <QLineEdit>
+
 
 namespace GeomNodes
 {
@@ -41,7 +42,11 @@ namespace GeomNodes
         m_browseEdit->setClearButtonEnabled(true);
         connect(m_browseEdit, &AzQtComponents::BrowseEdit::textChanged, this, &PropertyFuncValBrowseEditCtrl::ValueChangedByUser);
         connect(m_browseEdit, &AzQtComponents::BrowseEdit::textChanged, this, &PropertyFuncValBrowseEditCtrl::ValidateAndShowErrors);
-        connect(m_browseEdit, &AzQtComponents::BrowseEdit::textChanged, this, [this]([[maybe_unused]] const QString& text)
+        connect(
+            m_browseEdit,
+            &AzQtComponents::BrowseEdit::textChanged,
+            this,
+            [this]([[maybe_unused]] const QString& text)
             {
                 EBUS_EVENT(AzToolsFramework::PropertyEditorGUIMessages::Bus, RequestWrite, this);
             });
@@ -78,10 +83,7 @@ namespace GeomNodes
     void PropertyFuncValBrowseEditCtrl::SetValidator(FunctorValidator::FunctorType validator)
     {
         FunctorValidator* val = nullptr;
-        ValidatorBus::BroadcastResult(
-            val,
-            &ValidatorBus::Handler::GetValidator,
-            validator);
+        ValidatorBus::BroadcastResult(val, &ValidatorBus::Handler::GetValidator, validator);
 
         SetValidator(val);
     }
@@ -125,7 +127,8 @@ namespace GeomNodes
         m_notifyTarget = notifyTarget;
     }
 
-    void PropertyFuncValBrowseEditCtrl::ConsumeAttribute(AZ::u32 attrib, AzToolsFramework::PropertyAttributeReader* attrValue, [[maybe_unused]] const char* debugName)
+    void PropertyFuncValBrowseEditCtrl::ConsumeAttribute(
+        AZ::u32 attrib, AzToolsFramework::PropertyAttributeReader* attrValue, [[maybe_unused]] const char* debugName)
     {
         if (attrib == Attributes::FuncValidator)
         {
@@ -185,10 +188,10 @@ namespace GeomNodes
     //  Handler  ///////////////////////////////////////////////////////////////////
 
     PropertyFuncValBrowseEditHandler::PropertyFuncValBrowseEditHandler(ValidationHandler* valHdlr)
-        : AzToolsFramework::PropertyHandler <AZStd::string, PropertyFuncValBrowseEditCtrl>()
-        , m_validationHandler(valHdlr
-            )
-    {}
+        : AzToolsFramework::PropertyHandler<AZStd::string, PropertyFuncValBrowseEditCtrl>()
+        , m_validationHandler(valHdlr)
+    {
+    }
 
     AZ::u32 PropertyFuncValBrowseEditHandler::GetHandlerName(void) const
     {
@@ -202,17 +205,26 @@ namespace GeomNodes
         return ctrl;
     }
 
-    void PropertyFuncValBrowseEditHandler::ConsumeAttribute(PropertyFuncValBrowseEditCtrl* GUI, AZ::u32 attrib, AzToolsFramework::PropertyAttributeReader* attrValue, const char* debugName)
+    void PropertyFuncValBrowseEditHandler::ConsumeAttribute(
+        PropertyFuncValBrowseEditCtrl* GUI, AZ::u32 attrib, AzToolsFramework::PropertyAttributeReader* attrValue, const char* debugName)
     {
         GUI->ConsumeAttribute(attrib, attrValue, debugName);
     }
 
-    void PropertyFuncValBrowseEditHandler::WriteGUIValuesIntoProperty([[maybe_unused]] size_t index, PropertyFuncValBrowseEditCtrl* GUI, property_t& instance, [[maybe_unused]] AzToolsFramework::InstanceDataNode* node)
+    void PropertyFuncValBrowseEditHandler::WriteGUIValuesIntoProperty(
+        [[maybe_unused]] size_t index,
+        PropertyFuncValBrowseEditCtrl* GUI,
+        property_t& instance,
+        [[maybe_unused]] AzToolsFramework::InstanceDataNode* node)
     {
         instance = GUI->GetValue().toUtf8().data();
     }
 
-    bool PropertyFuncValBrowseEditHandler::ReadValuesIntoGUI([[maybe_unused]] size_t index, PropertyFuncValBrowseEditCtrl* GUI, const property_t& instance, [[maybe_unused]] AzToolsFramework::InstanceDataNode* node)
+    bool PropertyFuncValBrowseEditHandler::ReadValuesIntoGUI(
+        [[maybe_unused]] size_t index,
+        PropertyFuncValBrowseEditCtrl* GUI,
+        const property_t& instance,
+        [[maybe_unused]] AzToolsFramework::InstanceDataNode* node)
     {
         GUI->SetValue(instance.data());
         GUI->ForceValidate();
@@ -223,8 +235,7 @@ namespace GeomNodes
     {
         PropertyFuncValBrowseEditHandler* handler = aznew PropertyFuncValBrowseEditHandler(valHdlr);
         AzToolsFramework::PropertyTypeRegistrationMessages::Bus::Broadcast(
-            &AzToolsFramework::PropertyTypeRegistrationMessages::Bus::Handler::RegisterPropertyType,
-            handler);
+            &AzToolsFramework::PropertyTypeRegistrationMessages::Bus::Handler::RegisterPropertyType, handler);
         return handler;
     }
 } // namespace GeomNodes

+ 31 - 20
Gems/O3DE/GeomNodes/Code/Source/Editor/UI/PropertyFuncValBrowseEdit.h

@@ -11,8 +11,9 @@
 #if !defined(Q_MOC_RUN)
 #include "FunctorValidator.h"
 
-#include <AzToolsFramework/UI/PropertyEditor/PropertyEditorAPI.h>
 #include <AzQtComponents/Components/Widgets/BrowseEdit.h>
+#include <AzToolsFramework/UI/PropertyEditor/PropertyEditorAPI.h>
+
 #endif
 
 #include "UI_common.h"
@@ -21,9 +22,8 @@ namespace GeomNodes
 {
     // Forward Declare
     class ValidationHandler;
-    
-    class PropertyFuncValBrowseEditCtrl
-        : public QWidget
+
+    class PropertyFuncValBrowseEditCtrl : public QWidget
     {
         Q_OBJECT
 
@@ -35,23 +35,23 @@ namespace GeomNodes
         PropertyFuncValBrowseEditCtrl(QWidget* pParent = nullptr);
 
         virtual QString GetValue() const;
-        // Sets value programmatically and triggers validation
+        //! Sets value programmatically and triggers validation
         virtual void SetValue(const QString& value);
-        // Sets value as if user set it
+        //! Sets value as if user set it
         void SetValueUser(const QString& value);
-        // Returns pointer to the validator used
+        //! Returns pointer to the validator used
         FunctorValidator* GetValidator();
-        // Sets the validator for the lineedit
+        //! Sets the validator for the lineedit
         void SetValidator(FunctorValidator* validator);
-        // Sets the validator for the linedit
+        //! Sets the validator for the linedit
         void SetValidator(FunctorValidator::FunctorType validator);
-        // Returns false if invalid and returns shows error as tooltip
+        //! Returns false if invalid and returns shows error as tooltip
         bool ValidateAndShowErrors();
-        // Forces the values to up validated and style updated
+        //! Forces the values to up validated and style updated
         void ForceValidate();
         virtual void SetNotifyTarget(void* notifyTarget);
 
-        // Returns a pointer to the BrowseEdit object.
+        //! Returns a pointer to the BrowseEdit object.
         AzQtComponents::BrowseEdit* browseEdit();
 
         virtual void ConsumeAttribute(AZ::u32 attrib, AzToolsFramework::PropertyAttributeReader* attrValue, const char* debugName);
@@ -60,7 +60,7 @@ namespace GeomNodes
         void ValueChangedByUser();
 
     protected:
-        // Keeps track of the validator so no const_casts must be done
+        //! Keeps track of the validator so no const_casts must be done
         FunctorValidator* m_validator;
         ValidationCallbackType* m_validationResultHandler = nullptr;
         void* m_notifyTarget = nullptr;
@@ -68,8 +68,7 @@ namespace GeomNodes
         AzQtComponents::BrowseEdit* m_browseEdit = nullptr;
     };
 
-    class PropertyFuncValBrowseEditHandler
-        : public AzToolsFramework::PropertyHandler <AZStd::string, PropertyFuncValBrowseEditCtrl>
+    class PropertyFuncValBrowseEditHandler : public AzToolsFramework::PropertyHandler<AZStd::string, PropertyFuncValBrowseEditCtrl>
     {
         AZ_CLASS_ALLOCATOR(PropertyFuncValBrowseEditHandler, AZ::SystemAllocator);
 
@@ -77,13 +76,25 @@ namespace GeomNodes
         PropertyFuncValBrowseEditHandler(ValidationHandler* valHdlr);
 
         AZ::u32 GetHandlerName(void) const override;
-        // Need to unregister ourselves
-        bool AutoDelete() const override { return false; }
+        //! Need to unregister ourselves
+        bool AutoDelete() const override
+        {
+            return false;
+        }
 
         QWidget* CreateGUI(QWidget* pParent) override;
-        void ConsumeAttribute(PropertyFuncValBrowseEditCtrl* GUI, AZ::u32 attrib, AzToolsFramework::PropertyAttributeReader* attrValue, const char* debugName) override;
-        void WriteGUIValuesIntoProperty(size_t index, PropertyFuncValBrowseEditCtrl* GUI, property_t& instance, AzToolsFramework::InstanceDataNode* node) override;
-        bool ReadValuesIntoGUI(size_t index, PropertyFuncValBrowseEditCtrl* GUI, const property_t& instance, AzToolsFramework::InstanceDataNode* node)  override;
+        void ConsumeAttribute(
+            PropertyFuncValBrowseEditCtrl* GUI,
+            AZ::u32 attrib,
+            AzToolsFramework::PropertyAttributeReader* attrValue,
+            const char* debugName) override;
+        void WriteGUIValuesIntoProperty(
+            size_t index, PropertyFuncValBrowseEditCtrl* GUI, property_t& instance, AzToolsFramework::InstanceDataNode* node) override;
+        bool ReadValuesIntoGUI(
+            size_t index,
+            PropertyFuncValBrowseEditCtrl* GUI,
+            const property_t& instance,
+            AzToolsFramework::InstanceDataNode* node) override;
         static PropertyFuncValBrowseEditHandler* Register(ValidationHandler* valHdlr);
 
     private:

+ 10 - 12
Gems/O3DE/GeomNodes/Code/Source/Editor/UI/SettingsWidget.cpp

@@ -7,10 +7,11 @@
  */
 
 #include <AzCore/Component/ComponentApplicationBus.h>
-#include <AzToolsFramework/UI/PropertyEditor/ReflectedPropertyEditor.hxx>
 #include <AzToolsFramework/UI/PropertyEditor/InstanceDataHierarchy.h>
-#include <QBoxLayout>
+#include <AzToolsFramework/UI/PropertyEditor/ReflectedPropertyEditor.hxx>
 #include <Editor/UI/SettingsWidget.h>
+#include <QBoxLayout>
+
 
 namespace GeomNodes
 {
@@ -25,7 +26,7 @@ namespace GeomNodes
         void SettingsWidget::SetValue(const GNConfiguration& gnSystemConfiguration)
         {
             m_gnSystemConfiguration = gnSystemConfiguration;
-            
+
             blockSignals(true);
             m_propertyEditor->ClearInstances();
             m_propertyEditor->AddInstance(&m_gnSystemConfiguration);
@@ -52,30 +53,27 @@ namespace GeomNodes
             verticalLayout->addWidget(m_propertyEditor);
         }
 
-        void SettingsWidget::BeforePropertyModified(AzToolsFramework::InstanceDataNode* node)
+        void SettingsWidget::BeforePropertyModified([[maybe_unused]] AzToolsFramework::InstanceDataNode* node)
         {
-            (void)node;
         }
 
-        void SettingsWidget::AfterPropertyModified(AzToolsFramework::InstanceDataNode* /*node*/)
+        void SettingsWidget::AfterPropertyModified([[maybe_unused]] AzToolsFramework::InstanceDataNode* node)
         {
             emit onValueChanged(m_gnSystemConfiguration);
         }
 
-        void SettingsWidget::SetPropertyEditingActive(AzToolsFramework::InstanceDataNode* node)
+        void SettingsWidget::SetPropertyEditingActive([[maybe_unused]] AzToolsFramework::InstanceDataNode* node)
         {
-            (void)node;
         }
 
-        void SettingsWidget::SetPropertyEditingComplete(AzToolsFramework::InstanceDataNode* node)
+        void SettingsWidget::SetPropertyEditingComplete([[maybe_unused]] AzToolsFramework::InstanceDataNode* node)
         {
-            (void)node;
         }
 
         void SettingsWidget::SealUndoStack()
         {
         }
-    } // Editor
-} // GeomNodes
+    } // namespace Editor
+} // namespace GeomNodes
 
 #include <Editor/UI/moc_SettingsWidget.cpp>

+ 4 - 3
Gems/O3DE/GeomNodes/Code/Source/Editor/UI/SettingsWidget.h

@@ -10,8 +10,9 @@
 
 #if !defined(Q_MOC_RUN)
 #include <AzToolsFramework/UI/PropertyEditor/PropertyEditorAPI_Internals.h>
-#include <QWidget>
 #include <Editor/Configuration/GNConfiguration.h>
+#include <QWidget>
+
 #endif
 
 namespace GeomNodes
@@ -46,5 +47,5 @@ namespace GeomNodes
             AzToolsFramework::ReflectedPropertyEditor* m_propertyEditor;
             GNConfiguration m_gnSystemConfiguration;
         };
-    }
-}
+    } // namespace Editor
+} // namespace GeomNodes

+ 25 - 24
Gems/O3DE/GeomNodes/Code/Source/Editor/UI/Utils.cpp

@@ -9,9 +9,10 @@
 #include "Utils.h"
 
 #include <AzCore/IO/SystemFile.h>
-#include <AzCore/std/algorithm.h>
-#include <AzCore/Utils/Utils.h>
 #include <AzCore/StringFunc/StringFunc.h>
+#include <AzCore/Utils/Utils.h>
+#include <AzCore/std/algorithm.h>
+
 
 #include <QFileDialog>
 
@@ -62,7 +63,7 @@ namespace
     AZStd::string GetProjectName()
     {
         auto projectName = AZ::Utils::GetProjectName();
-        return AZStd::string{projectName.c_str()};
+        return AZStd::string{ projectName.c_str() };
     }
 
     template<>
@@ -71,7 +72,7 @@ namespace
         auto projectName = AZ::Utils::GetProjectName();
         return QString::fromUtf8(projectName.c_str(), aznumeric_cast<int>(projectName.size()));
     }
-}
+} // namespace
 
 namespace GeomNodes
 {
@@ -85,31 +86,31 @@ namespace GeomNodes
         return reinterpret_cast<void*>(func);
     }
 
-	AZStd::string GetEngineRoot()
-	{
-		return GetAbsoluteEngineRoot<AZStd::string>();
-	}
-	AZStd::string GetProjectRoot()
-	{
-		return GetAbsoluteProjectRoot<AZStd::string>();
-	}
+    AZStd::string GetEngineRoot()
+    {
+        return GetAbsoluteEngineRoot<AZStd::string>();
+    }
+    AZStd::string GetProjectRoot()
+    {
+        return GetAbsoluteProjectRoot<AZStd::string>();
+    }
 
-	AZStd::string GetProjectName()
-	{
-		return ::GetProjectName<AZStd::string>();
-	}
+    AZStd::string GetProjectName()
+    {
+        return ::GetProjectName<AZStd::string>();
+    }
 
     QString SelectBlendFromFileDialog(const QString& currentFile)
     {
         // The selected file must be relative to this path
         auto* gnSystem = GetGNSystem();
-        
+
         QString defaultPath = GetAbsoluteEngineRoot<QString>();
         if (gnSystem != nullptr && !gnSystem->GetLastPath().empty())
         {
             defaultPath = gnSystem->GetLastPath().c_str();
         }
-        
+
         QString startPath;
 
         // Choose the starting path for file dialog
@@ -129,18 +130,18 @@ namespace GeomNodes
             startPath = defaultPath;
         }
 
-        QString pickedPath = QFileDialog::getOpenFileName(nullptr, QObject::tr("Select Blend file"),
-            startPath, QObject::tr("Blender File (*.blend)"));
+        QString pickedPath =
+            QFileDialog::getOpenFileName(nullptr, QObject::tr("Select Blend file"), startPath, QObject::tr("Blender File (*.blend)"));
         ToUnixPath(pickedPath);
 
         if (!pickedPath.isEmpty())
         {
-			AZStd::string lastFilePath;
-			AZ::StringFunc::Path::GetFolderPath(pickedPath.toUtf8().data(), lastFilePath);
+            AZStd::string lastFilePath;
+            AZ::StringFunc::Path::GetFolderPath(pickedPath.toUtf8().data(), lastFilePath);
             gnSystem->SetLastPath(lastFilePath);
             AZ_Printf("Utils", "pickedPath = %s", pickedPath.toUtf8().data());
         }
-        
+
         return pickedPath;
     }
-}
+} // namespace GeomNodes

+ 3 - 3
Gems/O3DE/GeomNodes/Code/Source/Editor/UI/Utils.h

@@ -16,13 +16,13 @@
 // Derived from ProjectSettingsTool
 namespace GeomNodes
 {
-    void* ConvertFunctorToVoid(AZStd::pair<QValidator::State, const QString>(*func)(const QString&));
+    void* ConvertFunctorToVoid(AZStd::pair<QValidator::State, const QString> (*func)(const QString&));
     void* ConvertFunctorToVoid(void (*func)(const AZStd::string&));
     AZStd::string GetEngineRoot();
     AZStd::string GetProjectRoot();
     AZStd::string GetProjectName();
-    
+
     // Open file dialogs for each file type and return the result
     // CurrentFile is where the dialog opens
     QString SelectBlendFromFileDialog(const QString& currentFile);
-}
+} // namespace GeomNodes

+ 0 - 13
Gems/O3DE/GeomNodes/Code/Source/Editor/UI/ValidationHandler.cpp

@@ -13,11 +13,6 @@
 
 namespace GeomNodes
 {
-    /*void ValidationHandler::AddValidatorCtrl(PropertyFuncValLineEditCtrl* ctrl)
-    {
-        m_validators.push_back(ctrl);
-    }*/
-
     void ValidationHandler::AddValidatorCtrl(PropertyFuncValBrowseEditCtrl* ctrl)
     {
         m_browseEditValidators.push_back(ctrl);
@@ -25,14 +20,6 @@ namespace GeomNodes
 
     bool ValidationHandler::AllValid()
     {
-        // for (PropertyFuncValLineEditCtrl* ctrl : m_validators)
-        // {
-        //     if (!ctrl->ValidateAndShowErrors())
-        //     {
-        //         return false;
-        //     }
-        // }
-
         for (PropertyFuncValBrowseEditCtrl* ctrl : m_browseEditValidators)
         {
             if (!ctrl->ValidateAndShowErrors())

+ 1 - 2
Gems/O3DE/GeomNodes/Code/Source/Editor/UI/ValidationHandler.h

@@ -19,11 +19,10 @@ namespace GeomNodes
     class ValidationHandler
     {
     public:
-        //void AddValidatorCtrl(PropertyFuncValLineEditCtrl* ctrl);
         void AddValidatorCtrl(PropertyFuncValBrowseEditCtrl* ctrl);
         bool AllValid();
+
     private:
-        //AZStd::vector<PropertyFuncValLineEditCtrl*> m_validators;
         AZStd::vector<PropertyFuncValBrowseEditCtrl*> m_browseEditValidators;
     };
 } // namespace GeomNodes

+ 3 - 3
Gems/O3DE/GeomNodes/Code/Source/Editor/UI/Validators.cpp

@@ -58,7 +58,7 @@ namespace
             return RetType(QValidator::Invalid, QObject::tr("Fails to match requirements at all."));
         }
     }
-}
+} // namespace
 
 namespace GeomNodes
 {
@@ -139,5 +139,5 @@ namespace GeomNodes
                 return STANDARD_SUCCESS;
             }
         }
-    }
-}
+    } // namespace Validators
+} // namespace GeomNodes

+ 7 - 7
Gems/O3DE/GeomNodes/Code/Source/Editor/UI/Validators.h

@@ -16,17 +16,17 @@ namespace GeomNodes
     {
         namespace Internal
         {
-            // Returns true if file is readable and the correct mime type
+            //! Returns true if file is readable and the correct mime type
             FunctorValidator::ReturnType FileReadableAndCorrectType(const QString& path, const QString& fileType);
         } // namespace Internal
 
-        // Returns true if valid cross platform file or directory name
+        //! Returns true if valid cross platform file or directory name
         FunctorValidator::ReturnType FileName(const QString& name);
-        // Returns true if valid cross platform file or directory name or empty
+        //! Returns true if valid cross platform file or directory name or empty
         FunctorValidator::ReturnType FileNameOrEmpty(const QString& name);
-        // Returns true if string isn't empty
+        //! Returns true if string isn't empty
         FunctorValidator::ReturnType IsNotEmpty(const QString& value);
-        // Returns true if path is empty or a valid blend file relative to <build dir>
+        //! Returns true if path is empty or a valid blend file relative to <build dir>
         FunctorValidator::ReturnType ValidBlenderOrEmpty(const QString& path);
-    }
-}
+    } // namespace Validators
+} // namespace GeomNodes

+ 1 - 3
Gems/O3DE/GeomNodes/Code/Source/GeomNodes/Components/GeomNodesSystemComponent.cpp

@@ -18,9 +18,7 @@ namespace GeomNodes
     {
         if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
         {
-            serializeContext->Class<GeomNodesSystemComponent, AZ::Component>()
-                ->Version(0)
-                ;
+            serializeContext->Class<GeomNodesSystemComponent, AZ::Component>()->Version(0);
         }
     }
 

+ 1 - 1
Gems/O3DE/GeomNodes/Code/Source/GeomNodes/Components/GeomNodesSystemComponent.h

@@ -20,7 +20,7 @@ namespace GeomNodes
         , public AZ::TickBus::Handler
     {
     public:
-		AZ_COMPONENT(GeomNodesSystemComponent, GeomNodesSystemComponentTypeId);
+        AZ_COMPONENT(GeomNodesSystemComponent, GeomNodesSystemComponentTypeId);
 
         static void Reflect(AZ::ReflectContext* context);
 

+ 2 - 3
Gems/O3DE/GeomNodes/Code/Source/GeomNodes/Modules/GeomNodesModule.cpp

@@ -11,13 +11,12 @@
 
 namespace GeomNodes
 {
-    class GeomNodesModule
-        : public GeomNodesModuleInterface
+    class GeomNodesModule : public GeomNodesModuleInterface
     {
     public:
         AZ_RTTI(GeomNodesModule, GeomNodesModuleTypeId, GeomNodesModuleInterface);
         AZ_CLASS_ALLOCATOR(GeomNodesModule, AZ::SystemAllocator);
     };
-}// namespace GeomNodes
+} // namespace GeomNodes
 
 AZ_DECLARE_MODULE_CLASS(Gem_GeomNodes, GeomNodes::GeomNodesModule)

+ 10 - 8
Gems/O3DE/GeomNodes/Code/Source/GeomNodesModuleInterface.h

@@ -10,13 +10,13 @@
 #include <AzCore/Module/Module.h>
 #include <AzCore/RTTI/RTTIMacros.h>
 #include <AzCore/RTTI/TypeInfoSimple.h>
-#include <GeomNodes/GeomNodesTypeIds.h>
 #include <GeomNodes/Components/GeomNodesSystemComponent.h>
+#include <GeomNodes/GeomNodesTypeIds.h>
+
 
 namespace GeomNodes
 {
-    class GeomNodesModuleInterface
-        : public AZ::Module
+    class GeomNodesModuleInterface : public AZ::Module
     {
     public:
         AZ_RTTI(GeomNodesModuleInterface, GeomNodesModuleInterfaceTypeId, AZ::Module);
@@ -26,10 +26,12 @@ namespace GeomNodes
         {
             // Push results of [MyComponent]::CreateDescriptor() into m_descriptors here.
             // Add ALL components descriptors associated with this gem to m_descriptors.
-            // This will associate the AzTypeInfo information for the components with the the SerializeContext, BehaviorContext and EditContext.
-            // This happens through the [MyComponent]::Reflect() function.
-            m_descriptors.insert(m_descriptors.end(), {
-                GeomNodesSystemComponent::CreateDescriptor(),
+            // This will associate the AzTypeInfo information for the components with the the SerializeContext, BehaviorContext and
+            // EditContext. This happens through the [MyComponent]::Reflect() function.
+            m_descriptors.insert(
+                m_descriptors.end(),
+                {
+                    GeomNodesSystemComponent::CreateDescriptor(),
                 });
         }
 
@@ -40,4 +42,4 @@ namespace GeomNodes
             };
         }
     };
-}// namespace GeomNodes
+} // namespace GeomNodes

+ 0 - 2
Gems/O3DE/GeomNodes/External/Bridge/Bridge.h

@@ -22,7 +22,6 @@ typedef unsigned int u32;
 
 typedef long (*HandlerCallback)(u64, const char*, u64);
 
-
 #define BRIDGE_EXPORT __declspec(dllexport)
 
 __declspec(dllexport) bool Init(u64 id, HandlerCallback cb);
@@ -41,7 +40,6 @@ __declspec(dllexport) bool ReadSHM(u64 uId, void** address, u64* length);
 __declspec(dllexport) void WriteSHM(u64 uId, const char* source, const u64 length);
 __declspec(dllexport) void ClearSHM(u64 uId);
 
-
 #ifdef __cplusplus
 }
 #endif

+ 11 - 28
Gems/O3DE/GeomNodes/External/Bridge/Ipc.cpp

@@ -7,12 +7,12 @@
  */
 
 #include "Ipc.h"
-#include <AzCore/std/time.h>
-#include <AzCore/std/functional.h>
-#include <AzCore/std/containers/set.h>
-#include <AzCore/Component/TickBus.h>
 #include <AzCore/Component/Entity.h> // we just use this for create a random u64 id
+#include <AzCore/Component/TickBus.h>
+#include <AzCore/std/containers/set.h>
+#include <AzCore/std/functional.h>
 #include <AzCore/std/parallel/spin_mutex.h>
+#include <AzCore/std/time.h>
 
 #define SHMEM_NAME "GNIPCSharedMemory"
 
@@ -265,7 +265,7 @@ namespace Ipc
     }
 
     Ipc* Ipc::m_Instance = nullptr;
-    
+
     Ipc::Ipc()
     {
         m_OverflowQueue.clear();
@@ -278,8 +278,6 @@ namespace Ipc
 
     void Ipc::Initialize(AZ::u64 id, IPCHandler handler)
     {
-        //MessageBox(NULL, L"Debug-WMain-Install", L"Debug", MB_OK);
-
         m_uID = id;
         m_handler = handler;
 
@@ -422,7 +420,7 @@ namespace Ipc
                 bool bMutexLocked = m_SharedMem.try_lock();
                 bMutexLocked = m_bServer ? bMutexLocked : (m_uIDIdx != 0 ? bMutexLocked : false);
                 AddMessage(id, pType, pData, uSize, bMutexLocked);
-                
+
                 if (bMutexLocked)
                 {
                     m_SharedMem.unlock();
@@ -449,7 +447,7 @@ namespace Ipc
     bool Ipc::ReadMessage(char* buffer, AZ::u64 length)
     {
         // https://stackoverflow.com/questions/26277322/passing-arrays-with-ctypes
-        //TODO: need to allocate memory and have another function to release the allocated memory.
+        // TODO: need to allocate memory and have another function to release the allocated memory.
         // or do the second method where we allocate the buffer in python.
         // modify CheckForMessage that will return the length of the needed buffer.
         AZStd::unique_lock<AZStd::mutex> lock(m_MessageListMutex);
@@ -521,12 +519,12 @@ namespace Ipc
                         break;
                     }
                 }
-                
+
                 if (mapId == 0) // if we are still zero here we create one
                 {
                     mapId = (AZ::u64)AZ::Entity::MakeId();
 
-                    auto mapTblidx = m_MapSortArray->arraySize; // 
+                    auto mapTblidx = m_MapSortArray->arraySize; //
                     m_MapTable->id[mapTblidx] = m_uID;
                     m_MapTable->mapID[mapTblidx] = mapId;
                     m_MapTable->uSize[mapTblidx] = alignedSize;
@@ -549,10 +547,6 @@ namespace Ipc
                     AZ_Error("Ipc", false, "Wasn't able to create or open an existing Map!");
                 }
             }
-            /*else
-            {
-                AZ_Error("Ipc", false, "RequestSHM: failed to lock the SHM!");
-            }*/
         }
 
         AZ_Assert(mapId != 0, "RequestSHM : there should be no zero map Id!");
@@ -603,7 +597,7 @@ namespace Ipc
                 if (chunkSize > 0)
                 {
                     auto dataRead = shmInstance->Read(address, chunkSize - headerSize);
-                    
+
                     if (length)
                         *length = dataRead;
 
@@ -868,7 +862,6 @@ namespace Ipc
                     {
                         ++mapIter;
                     }
-                    
                 }
 
                 m_SharedMem.unlock();
@@ -904,7 +897,6 @@ namespace Ipc
 
     void Ipc::ProcessThread()
     {
-        // AZ::u32 tCounter = 0;
         auto tLastCleanup = AZStd::GetTimeNowSecond();
         while (!m_ShutdownThread)
         {
@@ -1004,13 +996,6 @@ namespace Ipc
                     AZStd::this_thread::sleep_for(AZStd::chrono::milliseconds(10));
                 }
             }
-            /*else
-            {
-                if (!IsPeerAttached() || ((AZStd::GetTimeNowSecond() - m_uLastCmdTime) > 10))
-                    AZStd::this_thread::sleep_for(AZStd::chrono::milliseconds(10));
-
-                AZStd::this_thread::sleep_for(AZStd::chrono::milliseconds(10));
-            }*/
         }
     }
 
@@ -1071,8 +1056,7 @@ namespace Ipc
                 i = (pIDx * 10) + m_uMsgAddIdx;
                 dwToSendPid = m_MsgTable->message[i].pid;
 
-                if (dwToSendPid == 0
-                    || ((tNow - m_MsgTable->message[i].i64Timestamp) > 30))
+                if (dwToSendPid == 0 || ((tNow - m_MsgTable->message[i].i64Timestamp) > 30))
                 {
                     IPCMessage tMsg(pID, m_uID, pType, uSize, m_ProcessIDs->uiPrevMsgSequence[pIDx] + 1, tNow);
                     IPCMessage* tIPCMsg = &m_MsgTable->message[i];
@@ -1090,7 +1074,6 @@ namespace Ipc
 
                 if (m_uMsgAddIdx == initialIdx)
                 {
-                    //AZ_Warning("App", false, "GNIPC: Unable to find room for new message; defaulting to overflow!");
                     break;
                 }
             }

+ 46 - 55
Gems/O3DE/GeomNodes/External/Bridge/Ipc.h

@@ -9,16 +9,17 @@
 #pragma once
 #include <AzCore/IPC/SharedMemory.h>
 #include <AzCore/std/containers/deque.h>
-#include <AzCore/std/containers/queue.h>
 #include <AzCore/std/containers/map.h>
-#include <AzCore/std/function/function_template.h>
+#include <AzCore/std/containers/queue.h>
 #include <AzCore/std/containers/unordered_map.h>
+#include <AzCore/std/function/function_template.h>
 #include <AzCore/std/string/string.h>
+
 //#include <AzCore/std/containers/vector.h>
+#include <AzCore/Memory/OSAllocator.h>
 #include <AzCore/std/parallel/atomic.h>
-#include <AzCore/std/parallel/thread.h>
 #include <AzCore/std/parallel/mutex.h>
-#include <AzCore/Memory/OSAllocator.h>
+#include <AzCore/std/parallel/thread.h>
 
 #ifndef WINAPI
 #define WINAPI __stdcall
@@ -35,21 +36,20 @@ namespace Ipc
         struct RingData;
     } // namespace Internal
 
-    constexpr auto IPC_MAX_PID      = 10;       // Max size of process ID table
-    constexpr auto IPC_MAX_MSGS     = 100;      // Max number of messages stored in queue
-    constexpr auto IPC_MAX_MSG_SIZE = 0x8000;   // Max size of of a message (32KB)
-    constexpr auto IPC_MAX_MAP      = 20;       // Max number of simultaneous extended maps;
-    constexpr auto IPC_MIN_MAP_SIZE = 0x100000; // min map size (1MB);
-    constexpr auto MAP_PAGE_SIZE    = 4096;
+    constexpr auto IPC_MAX_PID = 10; //! Max size of process ID table
+    constexpr auto IPC_MAX_MSGS = 100; //! Max number of messages stored in queue
+    constexpr auto IPC_MAX_MSG_SIZE = 0x8000; //! Max size of of a message (32KB)
+    constexpr auto IPC_MAX_MAP = 20; //! Max number of simultaneous extended maps;
+    constexpr auto IPC_MIN_MAP_SIZE = 0x100000; //! min map size (1MB);
+    constexpr auto MAP_PAGE_SIZE = 4096;
 
     enum IPC_MSG_TYPE
     {
-        IPC_MSG_JSON,               // normal messages
-        IPC_MSG_SHM                 // Message is SHM map related
-                                    // 
+        IPC_MSG_JSON, //! normal messages
+        IPC_MSG_SHM //! Message is SHM map related
     };
 
-    // Table of processes that uses this IPC object
+    //! Table of processes that uses this IPC object
     struct IpcIdTable
     {
         AZ::u64 pid[IPC_MAX_PID];
@@ -59,21 +59,21 @@ namespace Ipc
 
     struct IpcMapTable
     {
-        // a table of available maps in the SHM
-        AZ::u64 id[IPC_MAX_MAP];       // owner? if 0 means it's free
-        AZ::u64 mapID[IPC_MAX_MAP];    // a randomly generated ID, it could be a uuid or current tick.
-        AZ::u64 uSize[IPC_MAX_MAP];    // map size; there should be no similar size. I don't think there will
-                                       // be two users that will use a map at the same time
+        //! a table of available maps in the SHM
+        AZ::u64 id[IPC_MAX_MAP]; //! owner? if 0 means it's free
+        AZ::u64 mapID[IPC_MAX_MAP]; //! a randomly generated ID, it could be a uuid or current tick.
+        AZ::u64 uSize[IPC_MAX_MAP]; //! map size; there should be no similar size. I don't think there will
+                                    //! be two users that will use a map at the same time
     };
 
     struct IpcMapSortArray
     {
-        AZ::u32 arraySize;              // number of created SHM
-        AZ::u32 sortArray[IPC_MAX_MAP]; // the actual sort array containing indexes mapping to IpcMapTable
-                                        // sort order is ascending
+        AZ::u32 arraySize; //! number of created SHM
+        AZ::u32 sortArray[IPC_MAX_MAP]; //! the actual sort array containing indexes mapping to IpcMapTable
+                                        //! sort order is ascending
     };
 
-    // Structure of an element in the IPC_MESSAGE_TABLE
+    //! Structure of an element in the IPC_MESSAGE_TABLE
     struct IPCMessage
     {
         IPCMessage() = default;
@@ -96,21 +96,14 @@ namespace Ipc
         AZ::u8 ucMsg[IPC_MAX_MSG_SIZE] = { 0 };
     };
 
-    #define IPC_MESSAGE_DATA_SIZE 40 // 64+64+32+64+32+64
+#define IPC_MESSAGE_DATA_SIZE 40 // 64+64+32+64+32+64
 
-    // Table of messages to be processed by IPC
+    //! Table of messages to be processed by IPC
     struct IpcMessageTable
     {
         IPCMessage message[IPC_MAX_MSGS];
-        // AZ::u32		crc[BRIPC_MAX_MESSAGES];
     };
 
-    /*class IpcHandler
-    {
-    public:
-        virtual void HandleMessage(AZ::u32 pType, AZ::u8* pData, AZ::u32 uSize) = 0;
-    };*/
-
     /**
      * Same implementation as SharedMemoryRingBuffer but with a public m_info
      */
@@ -124,27 +117,27 @@ namespace Ipc
     public:
         SHMRingBuffer();
 
-        // If return true if we are create
+        //! If return true if we are create
         bool Create(const char* name, unsigned int size, bool openIfCreated = false);
 
-        /// Maps to the created map. If size == 0 it will map the whole memory.
+        //! Maps to the created map. If size == 0 it will map the whole memory.
         bool Map(AccessMode mode = ReadWrite, unsigned int size = 0);
         bool UnMap();
 
-        /// IMPORTANT: All functions below are UNSAFE. Don't forget to Lock/Unlock before/after using them.
+        //! IMPORTANT: All functions below are UNSAFE. Don't forget to Lock/Unlock before/after using them.
 
-        /// Returns true is we wrote the data, false if the free memory is insufficient.
+        //! Returns true is we wrote the data, false if the free memory is insufficient.
         bool Write(const void* data, unsigned int dataSize);
-        /// Reads data up to the maxDataSize, returns number of bytes red.
+        //! Reads data up to the maxDataSize, returns number of bytes red.
         unsigned int Read(void* data, unsigned int maxDataSize);
 
         unsigned int Read(void** data, unsigned int maxDataSize);
 
-        /// Get number of bytes to read.
+        //! Get number of bytes to read.
         unsigned int DataToRead() const;
-        /// Get maximum data we can write.
+        //! Get maximum data we can write.
         unsigned int MaxToWrite() const;
-        /// Clears the ring buffer data and reset it to initial condition.
+        //! Clears the ring buffer data and reset it to initial condition.
         void Clear();
 
         Internal::RingData* m_info;
@@ -157,7 +150,6 @@ namespace Ipc
         typedef AZStd::deque<IPCMessage> IPCMessageQueue;
         typedef AZStd::map<AZ::u64, IPCMessageQueue> IPCMessageQueueMap;
         typedef long (*IPCHandler)(AZ::u64, const char*, AZ::u64);
-        //typedef AZStd::unordered_map<AZ::u64, IPCHandler> IPCHandlerContainer;
         typedef AZStd::map<AZ::u32, AZ::u32> IPCMsgSequence;
         typedef AZStd::vector<AZ::u8> ByteStream;
         typedef AZStd::map<AZ::u64, SHMRingBuffer*> SHMMap;
@@ -177,7 +169,7 @@ namespace Ipc
         AZ::u64 CheckForMessage();
         bool ReadMessage(char* buffer, AZ::u64 length);
 
-        // Map Functions
+        //! Map Functions
         AZ::u64 RequestSHM(AZ::u64 uSize);
         bool OpenSHM(AZ::u64 mapId);
         bool ReadSHM(AZ::u64 mapId, void** address, AZ::u64* length);
@@ -186,7 +178,7 @@ namespace Ipc
 
         bool IsServerRunning();
         bool IsPeerAttached();
-        
+
         static Ipc* GetInstance();
         static void DestroyInstance()
         {
@@ -218,23 +210,23 @@ namespace Ipc
         AZ::u64 m_uID = 0;
         AZ::u32 m_uIDIdx = 0;
         AZ::u32 m_uServerPID = 0;
-        AZ::u32 m_uiPrevMsgSequence = 0; // The index of the IPC message that was just accomplished
+        AZ::u32 m_uiPrevMsgSequence = 0; //! The index of the IPC message that was just accomplished
         AZ::u32 m_uMsgAddIdx = 5;
         AZ::s64 m_uLastCmdTime = 0;
 
-        AZ::SharedMemory m_SharedMem;   // IPC map
-        SHMMap m_SharedMemMap;          // contains the large allocation of SHM.
-                                        // server: eventually handles the management of all SHMs
-                                        // client: if no available map for the requested size it will create it's own SHM and will not close it until the server has sent a message back to the client.
+        AZ::SharedMemory m_SharedMem; //! IPC map
+        SHMMap m_SharedMemMap; //! contains the large allocation of SHM.
+                               //! server: eventually handles the management of all SHMs
+                               //! client: if no available map for the requested size it will create it's own SHM and will not close it
+                               //! until the server has sent a message back to the client.
 
         AZStd::thread m_PollThread;
 
-        IpcIdTable* m_ProcessIDs;       // Pointer to an instance of IPC_PID_TABLE
-        IpcMessageTable* m_MsgTable;    // Pointer to an instance of IPC_MESSAGE_TABLE
-        IpcMapTable* m_MapTable;        // Point to an instance of IPC_MAP_TABLE
+        IpcIdTable* m_ProcessIDs; //! Pointer to an instance of IPC_PID_TABLE
+        IpcMessageTable* m_MsgTable; //! Pointer to an instance of IPC_MESSAGE_TABLE
+        IpcMapTable* m_MapTable; //! Point to an instance of IPC_MAP_TABLE
         IpcMapSortArray* m_MapSortArray;
-        IPCMessageQueueMap m_OverflowQueue; // Extra tables should the m_MsgTable be filled
-        //IPCHandlerContainer m_Handlers;
+        IPCMessageQueueMap m_OverflowQueue; //! Extra tables should the m_MsgTable be filled
         IPCHandler m_handler = nullptr;
 
         struct WaitingIPCMsg
@@ -256,5 +248,4 @@ namespace Ipc
         AZStd::mutex m_MessageListMutex;
     };
 
-}
-
+} // namespace Ipc