Explorar o código

Fixed issue with adding IPC messages.

Signed-off-by: Jason Dela Cruz <[email protected]>
Jason Dela Cruz %!s(int64=2) %!d(string=hai) anos
pai
achega
285d4399e5

+ 2 - 4
Gems/O3DE/GeomNodes/Code/Source/Editor/Components/EditorGeomNodesComponent.cpp

@@ -189,9 +189,7 @@ namespace GeomNodes
                 m_instance->Init(path, scriptPath, bridgePath.c_str(), GetEntityId());
                 if (m_instance->IsValid())
                 {
-                    //AZ::EntityId entityId = AZ::EntityId(123456);
-                    auto entityId = GetEntityId();
-                    Ipc::IpcHandlerNotificationBus::Handler::BusConnect(entityId);
+                    Ipc::IpcHandlerNotificationBus::Handler::BusConnect(GetEntityId());
                 }
 
                 m_controller->SetFileName(path);
@@ -226,7 +224,7 @@ namespace GeomNodes
 				.GetGroup(m_currentObject.c_str())->GetProperties(), m_currentObject);
         }
 
-        AZ_Printf("EditorGeomNodesComponent", "Parameter has changed");
+        AZ_Printf("EditorGeomNodesComponent", "%llu: Parameter has changed", (AZ::u64)GetEntityId());
     }
 
     void EditorGeomNodesComponent::OnMessageReceived(const AZ::u8* content, const AZ::u64 length)

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

@@ -247,7 +247,10 @@ namespace GeomNodes
     void GNRenderMesh::UpdateTransform(const AZ::Transform& worldFromLocal, const AZ::Vector3& /*scale*/)
     {
         // TODO: multiply this to worldFromLocal transform
-        m_meshFeatureProcessor->SetTransform(m_meshHandle, worldFromLocal);
+        if (m_meshHandle.IsValid())
+        {
+            m_meshFeatureProcessor->SetTransform(m_meshHandle, worldFromLocal);
+        }
     }
 
     void GNRenderMesh::OnTick([[maybe_unused]] float deltaTime, [[maybe_unused]] AZ::ScriptTimePoint time)

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

@@ -56,9 +56,7 @@ namespace GeomNodes
 
     void GNInstance::SendIPCMsg(const AZStd::string& content)
     {
-        //AZ::u64 entityId = 123456;
-        AZ::u64 entityId = (AZ::u64)m_entityId;
-        API::SendMsg(content.c_str(), content.size(), entityId);
+        API::SendMsg(content.c_str(), content.size(), (AZ::u64)m_entityId);
     }
 
     bool GNInstance::RestartProcess()
@@ -77,11 +75,12 @@ namespace GeomNodes
             m_scriptPath.c_str(),
             m_exePath.c_str(),
             (AZ::u64)m_entityId);
+        // NOTE: if you want to debug and see the console print outs set m_showWindow to true
         processLaunchInfo.m_showWindow = false;
         processLaunchInfo.m_processPriority = AzFramework::ProcessPriority::PROCESSPRIORITY_NORMAL;
 
         AzFramework::ProcessWatcher* outProcess = AzFramework::ProcessWatcher::LaunchProcess(
-            processLaunchInfo, AzFramework::ProcessCommunicationType::COMMUNICATOR_TYPE_STDINOUT);
+            processLaunchInfo, AzFramework::ProcessCommunicationType::COMMUNICATOR_TYPE_NONE);
 
         if (outProcess)
         {

+ 2 - 2
Gems/O3DE/GeomNodes/External/Bridge/Ipc.cpp

@@ -835,7 +835,7 @@ namespace Ipc
                         }
 
                         ++m_uMsgAddIdx;
-                        if (m_uMsgAddIdx > 9)
+                        if (m_uMsgAddIdx > IPC_MAX_PID - 1)
                             m_uMsgAddIdx = 0;
 
                         if (m_uMsgAddIdx == nInitialIdx)
@@ -1095,7 +1095,7 @@ namespace Ipc
                 i = (pIDx * 10) + m_uMsgAddIdx;
                 dwToSendPid = m_MsgTable->message[i].pid;
 
-                if (dwToSendPid == SERVER_ID
+                if (dwToSendPid == 0
                     || ((tNow - m_MsgTable->message[i].i64Timestamp) > 30))
                 {
                     IPCMessage tMsg(pID, m_uID, pType, uSize, m_ProcessIDs->uiPrevMsgSequence[pIDx] + 1, tNow);

+ 1 - 1
Gems/O3DE/GeomNodes/External/Bridge/Ipc.h

@@ -212,7 +212,7 @@ namespace Ipc
         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_uMsgAddIdx = 0;
+        AZ::u32 m_uMsgAddIdx = 5;
         AZ::s64 m_uLastCmdTime = 0;
 
         AZ::SharedMemory m_SharedMem;   // IPC map

+ 0 - 5
Gems/O3DE/GeomNodes/External/Scripts/__init__.py

@@ -16,7 +16,6 @@ _LOGGER = _logging.getLogger(_PACKAGENAME)
 #_logging.basicConfig(format=FRMT_LOG_LONG, level=_logging.DEBUG)
 _logging.basicConfig(level=_logging.DEBUG)
 _LOGGER.debug('Initializing: {0}.'.format({_PACKAGENAME}))
-#sys.stdout = open("f:/output.txt", "w")
 
 dir = os.path.dirname(__file__)
 if not dir in sys.path:
@@ -38,8 +37,4 @@ if __name__ == "__main__":
     else:
         run()
 
-# Close the file
-#sys.stdout.close()
-#sys.stdout = sys.__stdout__
-
 del _LOGGER