diff --git a/Source/ImGui/Private/ImGuiDelegatesContainer.cpp b/Source/ImGui/Private/ImGuiDelegatesContainer.cpp index 2f035dc..b750b0a 100644 --- a/Source/ImGui/Private/ImGuiDelegatesContainer.cpp +++ b/Source/ImGui/Private/ImGuiDelegatesContainer.cpp @@ -3,11 +3,32 @@ #include "ImGuiDelegatesContainer.h" #include "ImGuiModule.h" -#include "Utilities/RedirectingHandle.h" #include "Utilities/WorldContextIndex.h" -// Redirecting handle which will automatically bind to another one, if a different instance of the module is loaded. +#if !WITH_EDITOR +// +// Non-editor version without container redirection +// + +static FImGuiDelegatesContainer DelegatesContainer; + +FImGuiDelegatesContainer& FImGuiDelegatesContainer::Get() +{ + return DelegatesContainer; +} + +#endif // !WITH_EDITOR + + +#if WITH_EDITOR +// +// Editor version supporting container redirection needed for hot-reloading +// + +#include "Utilities/RedirectingHandle.h" + +// Redirecting handle which will always bind to a container from the currently loaded module. struct FImGuiDelegatesContainerHandle : Utilities::TRedirectingHandle { FImGuiDelegatesContainerHandle(FImGuiDelegatesContainer& InDefaultContainer) @@ -47,6 +68,9 @@ void FImGuiDelegatesContainer::MoveContainer(FImGuiDelegatesContainerHandle& Oth GetHandle().SetParent(&OtherContainerHandle); } +#endif // WITH_EDITOR + + int32 FImGuiDelegatesContainer::GetContextIndex(UWorld* World) { return Utilities::GetWorldContextIndex(*World); diff --git a/Source/ImGui/Private/ImGuiDelegatesContainer.h b/Source/ImGui/Private/ImGuiDelegatesContainer.h index 30be160..9b71f5a 100644 --- a/Source/ImGui/Private/ImGuiDelegatesContainer.h +++ b/Source/ImGui/Private/ImGuiDelegatesContainer.h @@ -6,7 +6,9 @@ #include +#if WITH_EDITOR struct FImGuiDelegatesContainerHandle; +#endif struct FImGuiDelegatesContainer { @@ -15,11 +17,13 @@ public: // Get the current instance (can change during hot-reloading). static FImGuiDelegatesContainer& Get(); +#if WITH_EDITOR // Get the handle to the container instance (can attach to other handles in hot-reloaded modules). static FImGuiDelegatesContainerHandle& GetHandle(); // Redirect to the other container and if this one is still active move its data to the other one. static void MoveContainer(FImGuiDelegatesContainerHandle& OtherContainerHandle); +#endif // Get delegate to ImGui world early debug event from known world instance. FSimpleMulticastDelegate& OnWorldEarlyDebug(UWorld* World) { return OnWorldEarlyDebug(GetContextIndex(World)); } diff --git a/Source/ImGui/Private/TextureManager.h b/Source/ImGui/Private/TextureManager.h index be1b100..cb560a6 100644 --- a/Source/ImGui/Private/TextureManager.h +++ b/Source/ImGui/Private/TextureManager.h @@ -26,8 +26,8 @@ public: FTextureManager& operator=(const FTextureManager&) = delete; // Moving transfers ownership and leaves source empty. - FTextureManager(FTextureManager&&) = default; - FTextureManager& operator=(FTextureManager&&) = default; + FTextureManager(FTextureManager&&) = delete; + FTextureManager& operator=(FTextureManager&&) = delete; // Initialize error texture that will be used for rendering textures without registered resources. Can be called // multiple time, if color needs to be changed. diff --git a/Source/ImGui/Public/ImGuiModule.h b/Source/ImGui/Public/ImGuiModule.h index 239854c..f63a480 100644 --- a/Source/ImGui/Public/ImGuiModule.h +++ b/Source/ImGui/Public/ImGuiModule.h @@ -167,10 +167,10 @@ public: private: #if WITH_EDITOR + virtual void SetProperties(const FImGuiModuleProperties& Properties); + virtual struct FImGuiContextHandle& GetImGuiContextHandle(); + virtual struct FImGuiDelegatesContainerHandle& GetDelegatesContainerHandle(); friend struct FImGuiContextHandle; friend struct FImGuiDelegatesContainerHandle; - virtual void SetProperties(const FImGuiModuleProperties& Properties); - virtual FImGuiContextHandle& GetImGuiContextHandle(); - virtual FImGuiDelegatesContainerHandle& GetDelegatesContainerHandle(); #endif };