Просмотр исходного кода

Several fixes for stabilization/2305 and latest development branch.

Signed-off-by: Jason Dela Cruz <[email protected]>
Jason Dela Cruz 2 лет назад
Родитель
Сommit
f599586059

+ 6 - 5
Gems/O3DE/GeomNodes/Code/Source/Editor/Components/EditorGeomNodesComponent.cpp

@@ -94,7 +94,7 @@ namespace GeomNodes
                         ->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, &EditorGeomNodesComponent::OnParamChange)
+                    ->Attribute(AZ::Edit::Attributes::ChangeNotify, &GNProperty::OnParamChange)
                     ->Attribute(AZ::Edit::Attributes::NameLabelOverride, &GNParamBoolean::m_name);
 
                 ec->Class<GNParamInt>("Geom Nodes Property (int)", "A Geom Nodes int property")
@@ -102,7 +102,7 @@ namespace GeomNodes
                         ->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, &EditorGeomNodesComponent::OnParamChange)
+                    ->Attribute(AZ::Edit::Attributes::ChangeNotify, &GNProperty::OnParamChange)
                     ->Attribute(AZ::Edit::Attributes::NameLabelOverride, &GNParamInt::m_name);
 
                 ec->Class<GNParamValue>("Geom Nodes Property (double)", "A Geom Nodes double property")
@@ -110,7 +110,7 @@ namespace GeomNodes
                         ->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, &EditorGeomNodesComponent::OnParamChange)
+                        ->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")
@@ -118,7 +118,7 @@ namespace GeomNodes
                         ->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, &EditorGeomNodesComponent::OnParamChange)
+                        ->Attribute(AZ::Edit::Attributes::ChangeNotify, &GNProperty::OnParamChange)
                         ->Attribute(AZ::Edit::Attributes::NameLabelOverride, &GNParamString::m_name);
             }
         }
@@ -362,7 +362,7 @@ namespace GeomNodes
         ei.m_editData.m_elementId = AZ::Edit::UIHandlers::ComboBox;
         ei.m_sortOrder = FLT_MAX;
 
-        auto gnParam = aznew GNParamString(Field::Objects, "", &m_workInProgress);
+        auto gnParam = aznew GNParamString(Field::Objects, "", &m_workInProgress, GetEntityId());
         gnParam->m_value = m_currentObject;
         
         ei.m_editData.m_attributes.push_back(
@@ -403,6 +403,7 @@ namespace GeomNodes
             GNParamDataContext gndc;
             gndc.SetParamObject(itr);
             gndc.SetReadOnlyPointer(&m_workInProgress);
+            gndc.SetEntityId(GetEntityId());
             auto propertyName = gndc.GetParamName();
             auto paramType = gndc.GetParamType();
                 

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

@@ -39,6 +39,7 @@ namespace GeomNodes
         void SetWorkInProgress(bool flag) override;
         bool GetWorkInProgress() override;
         void SendIPCMsg(const AZStd::string& msg) override;
+		void OnParamChange() override;
 
     private:
 		
@@ -56,7 +57,6 @@ namespace GeomNodes
         
 		void Clear();
         void OnPathChange(const AZStd::string& path);
-        void OnParamChange();
         // IpcHandlerNotificationBus overrides...
         void OnMessageReceived(const AZ::u8* content, const AZ::u64 length) override;
 

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

@@ -18,7 +18,19 @@ namespace GeomNodes
         }
     }
 
-    EditorGeomNodesSystemComponent::EditorGeomNodesSystemComponent() = default;
+    EditorGeomNodesSystemComponent::EditorGeomNodesSystemComponent()
+		: m_onSystemInitializedHandler(
+			[](const GNConfiguration* /*config*/)
+	        {
+		        
+	        })
+		, m_onSystemConfigChangedHandler(
+			[](const GNConfiguration* /*config*/)
+	        {
+	        })
+    {
+
+    }
 
     EditorGeomNodesSystemComponent::~EditorGeomNodesSystemComponent() = default;
 

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

@@ -11,6 +11,7 @@ namespace GeomNodes
         virtual void SetWorkInProgress(bool flag) = 0;
         virtual bool GetWorkInProgress() = 0;
         virtual void SendIPCMsg(const AZStd::string& msg) = 0;
+		virtual void OnParamChange() = 0;
 
 	protected:
 		~EditorGeomNodesComponentRequests() = default;

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

@@ -82,7 +82,7 @@ namespace GeomNodes
                 // 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>(key, i));
+				uniqueKeys.emplace(AZStd::make_pair<UniqueKey, AZ::s32>(AZStd::move(key), AZStd::move(i)));
             }
             else
             {

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

@@ -230,7 +230,7 @@ namespace GeomNodes
     {
 		if (m_meshFeatureProcessor)
 		{
-			m_meshFeatureProcessor->SetMaterialAssignmentMap(m_meshHandle, m_materialMap);
+			m_meshFeatureProcessor->SetCustomMaterials(m_meshHandle, AZ::Render::ConvertToCustomMaterialMap(m_materialMap));
 		}
     }
 
@@ -279,7 +279,7 @@ namespace GeomNodes
     {
 		if (m_meshFeatureProcessor)
 		{
-			m_meshFeatureProcessor->SetMaterialAssignmentMap(m_meshHandle, materials);
+            m_meshFeatureProcessor->SetCustomMaterials(m_meshHandle, AZ::Render::ConvertToCustomMaterialMap(materials));
 		}
     }
 

+ 11 - 0
Gems/O3DE/GeomNodes/Code/Source/Editor/Systems/GNParamContext.h

@@ -128,12 +128,23 @@ namespace GeomNodes
             return m_pReadOnly;
         }
 
+        void SetEntityId(AZ::EntityId entityId)
+        {
+            m_entityId = entityId;
+        }
+
+        AZ::EntityId GetEntityId()
+        {
+            return m_entityId;
+        }
+
         const char* GetParamName();
         ParamType GetParamType();
 
     protected:
         const rapidjson::Value* m_curParamObj;
         bool* m_pReadOnly;
+        AZ::EntityId m_entityId;
     };
 
     template<class T>

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

@@ -82,7 +82,7 @@ namespace GeomNodes
         GNProperty* retVal = nullptr;
         if (context.IsNil(valueIndex))
         {
-            retVal = aznew GNParamNil(name, context.GetReadOnlyPointer());
+            retVal = aznew GNParamNil(name, context.GetReadOnlyPointer(), context.GetEntityId());
         }
 
         return retVal;
@@ -130,7 +130,7 @@ namespace GeomNodes
             bool value;
             if (context.ReadValue(value, Field::DefaultValue))
             {
-                retVal = aznew GNParamBoolean(name, value, context.GetReadOnlyPointer());
+                retVal = aznew GNParamBoolean(name, value, context.GetReadOnlyPointer(), context.GetEntityId());
                 retVal->ReadSetGNId(context);
             }
         }
@@ -202,7 +202,7 @@ namespace GeomNodes
             int value;
             if (context.ReadValue(value, Field::DefaultValue))
             {
-                auto paramInt = aznew GNParamInt(name, value, context.GetReadOnlyPointer());
+                auto paramInt = aznew GNParamInt(name, value, context.GetReadOnlyPointer(), context.GetEntityId());
 
                 int min, max;
                 if (context.ReadValue(min, Field::MinValue))
@@ -289,7 +289,7 @@ namespace GeomNodes
             double value;
             if (context.ReadValue(value, Field::DefaultValue))
             {
-                auto paramValue = aznew GNParamValue(name, value, context.GetReadOnlyPointer());
+                auto paramValue = aznew GNParamValue(name, value, context.GetReadOnlyPointer(), context.GetEntityId());
                 double min, max;
                 if (context.ReadValue(min, Field::MinValue))
                 {
@@ -372,7 +372,7 @@ namespace GeomNodes
             const char* value = nullptr;
             if (context.ReadValue(value, Field::DefaultValue))
             {
-                retVal = aznew GNParamString(name, value, context.GetReadOnlyPointer());
+                retVal = aznew GNParamString(name, value, context.GetReadOnlyPointer(), context.GetEntityId());
                 retVal->ReadSetGNId(context);
             }
         }

+ 19 - 11
Gems/O3DE/GeomNodes/Code/Source/Editor/Systems/GNProperty.h

@@ -4,6 +4,7 @@
 #include <AzCore/Math/Crc.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>
 
@@ -40,10 +41,11 @@ namespace GeomNodes
         GNProperty()
         {
         }
-        GNProperty(const char* name, bool* pReadOnly)
+        GNProperty(const char* name, bool* pReadOnly, AZ::EntityId entityId)
             : m_id(AZ::Crc32(name))
             , m_name(name)
             , m_pReadOnly(pReadOnly)
+            , m_entityId(entityId)
         {
         }
 
@@ -84,6 +86,11 @@ namespace GeomNodes
             return m_pReadOnly == nullptr ? false : *m_pReadOnly;
         }
 
+        void OnParamChange()
+        {
+            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
@@ -91,6 +98,7 @@ namespace GeomNodes
         bool*           m_pReadOnly = nullptr;
         bool            m_isMaxSet = false;
         bool            m_isMinSet = false;
+        AZ::EntityId    m_entityId;
     protected:
         virtual void CloneDataFrom(const GNProperty* gnProperty) = 0;
     };
@@ -107,8 +115,8 @@ namespace GeomNodes
         GNParamNil()
         {
         }
-		GNParamNil(const char* name, bool* pReadOnly)
-			: GNProperty(name, pReadOnly)
+		GNParamNil(const char* name, bool* pReadOnly, AZ::EntityId entityId)
+			: GNProperty(name, pReadOnly, entityId)
         {
         }
 
@@ -137,8 +145,8 @@ namespace GeomNodes
         {
             m_type = GetEnumString(ParamType::Bool);
         }
-        GNParamBoolean(const char* name, bool value, bool* pReadOnly)
-            : GNProperty(name, pReadOnly)
+		GNParamBoolean(const char* name, bool value, bool* pReadOnly, AZ::EntityId entityId)
+			: GNProperty(name, pReadOnly, entityId)
             , m_value(value)
         {
             m_type = GetEnumString(ParamType::Bool);
@@ -178,8 +186,8 @@ namespace GeomNodes
         {
             m_type = GetEnumString(ParamType::Int);
         }
-		GNParamInt(const char* name, int value, bool* pReadOnly)
-			: GNProperty(name, pReadOnly)
+		GNParamInt(const char* name, int value, bool* pReadOnly, AZ::EntityId entityId)
+			: GNProperty(name, pReadOnly, entityId)
             , m_value(value)
         {
             m_type = GetEnumString(ParamType::Int);
@@ -231,8 +239,8 @@ namespace GeomNodes
         {
             m_type = GetEnumString(ParamType::Value);
         }
-		GNParamValue(const char* name, double value, bool* pReadOnly)
-			: GNProperty(name, pReadOnly)
+		GNParamValue(const char* name, double value, bool* pReadOnly, AZ::EntityId entityId)
+			: GNProperty(name, pReadOnly, entityId)
             , m_value(value)
         {
             m_type = GetEnumString(ParamType::Value);
@@ -283,8 +291,8 @@ namespace GeomNodes
         {
             m_type = GetEnumString(ParamType::String);
         }
-		GNParamString(const char* name, const char* value, bool* pReadOnly)
-			: GNProperty(name, pReadOnly)
+		GNParamString(const char* name, const char* value, bool* pReadOnly, AZ::EntityId entityId)
+			: GNProperty(name, pReadOnly, entityId)
             , m_value(value)
         {
             m_type = GetEnumString(ParamType::String);

+ 0 - 55
Gems/O3DE/GeomNodes/External/Bridge/Ipc.cpp

@@ -268,51 +268,6 @@ namespace Ipc
         Uninitialize();
     }
 
-    void Ipc::CreateOSAllocator()
-    {
-        if (!AZ::AllocatorInstance<AZ::OSAllocator>::IsReady())
-        {
-            AZ::AllocatorInstance<AZ::OSAllocator>::Create();
-            m_isOSAllocatorOwner = true;
-        }
-        m_osAllocator = &AZ::AllocatorInstance<AZ::OSAllocator>::Get();
-    }
-
-    void Ipc::DestroyAllocator()
-    {
-        // kill the system allocator if we created it
-        if (m_isSystemAllocatorOwner)
-        {
-            AZ::Debug::Trace::Instance().Destroy();
-            AZ::AllocatorInstance<AZ::SystemAllocator>::Destroy();
-
-            if (m_fixedMemoryBlock)
-            {
-                m_osAllocator->DeAllocate(m_fixedMemoryBlock);
-            }
-            m_fixedMemoryBlock = nullptr;
-            m_isSystemAllocatorOwner = false;
-        }
-
-        if (m_isOSAllocatorOwner)
-        {
-            AZ::AllocatorInstance<AZ::OSAllocator>::Destroy();
-            m_isOSAllocatorOwner = false;
-        }
-
-        m_osAllocator = nullptr;
-    }
-
-    void Ipc::CreateSystemAllocator()
-    {
-        if (!AZ::AllocatorInstance<AZ::SystemAllocator>::IsReady())
-        {
-            AZ::AllocatorInstance<AZ::SystemAllocator>::Create();
-
-            m_isSystemAllocatorOwner = true;
-        }
-    }
-
     void Ipc::Initialize(AZ::u64 id, IPCHandler handler)
     {
         //MessageBox(NULL, L"Debug-WMain-Install", L"Debug", MB_OK);
@@ -322,9 +277,6 @@ namespace Ipc
 
         bool bServer = id == SERVER_ID;
 
-        CreateOSAllocator();
-        CreateSystemAllocator();
-
         if (m_handler == nullptr && m_bServer)
         {
             AZ_Warning("App", false, "GNIPC: Callback is not set. You'll miss messages..");
@@ -451,10 +403,6 @@ namespace Ipc
         }
 
         m_SharedMemMap.clear();
-
-
-        AZ_Warning("App", false, "GNIPC: Uninitialized called");
-        DestroyAllocator();
     }
 
     void Ipc::SendMsg(AZ::u32 pType, const AZ::u8* pData, AZ::u64 uSize, AZ::u64 id)
@@ -472,9 +420,6 @@ namespace Ipc
                     m_SharedMem.unlock();
                 }
             }
-
-            /*if (m_handler)
-                m_handler(0, "SendMessage", 11);*/
         }
     }
 

+ 0 - 11
Gems/O3DE/GeomNodes/External/Bridge/Ipc.h

@@ -157,10 +157,6 @@ namespace Ipc
         Ipc();
         virtual ~Ipc();
 
-        void CreateOSAllocator();
-        void DestroyAllocator();
-        void CreateSystemAllocator();
-
         void Initialize(AZ::u64 id = SERVER_ID, IPCHandler handler = nullptr);
         void Uninitialize();
 
@@ -251,13 +247,6 @@ namespace Ipc
         typedef AZStd::queue<WaitingIPCMsg> MessageContainer;
         MessageContainer m_MessagesWaitingToExecute;
         AZStd::mutex m_MessageListMutex;
-
-        //
-        bool m_isStarted{ false };
-        bool m_isSystemAllocatorOwner{ false };
-        bool m_isOSAllocatorOwner{ false };
-        void* m_fixedMemoryBlock{ nullptr }; //!< Pointer to the memory block allocator, so we can free it OnDestroy.
-        AZ::IAllocator* m_osAllocator{ nullptr };
     };
 
 }