mirror of
				https://github.com/kevinporetti/UnrealImGui.git
				synced 2025-11-03 23:33:16 +00:00 
			
		
		
		
	Fixed duplicated registrations of ImGui Demo that were introduced in recent changes.
This commit is contained in:
		
							parent
							
								
									e05cea2789
								
							
						
					
					
						commit
						c662869820
					
				@ -16,6 +16,9 @@ FImGuiModuleManager::FImGuiModuleManager()
 | 
				
			|||||||
	: ModuleCommands(*this)
 | 
						: ModuleCommands(*this)
 | 
				
			||||||
	, ImGuiDemo(*this)
 | 
						, ImGuiDemo(*this)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
						// Register in context manager to get information whenever a new context proxy is created.
 | 
				
			||||||
 | 
						ContextManager.OnContextProxyCreated().AddRaw(this, &FImGuiModuleManager::OnContextProxyCreated);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Typically we will use viewport created events to add widget to new game viewports.
 | 
						// Typically we will use viewport created events to add widget to new game viewports.
 | 
				
			||||||
	ViewportCreatedHandle = UGameViewportClient::OnViewportCreated().AddRaw(this, &FImGuiModuleManager::OnViewportCreated);
 | 
						ViewportCreatedHandle = UGameViewportClient::OnViewportCreated().AddRaw(this, &FImGuiModuleManager::OnViewportCreated);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -169,7 +172,6 @@ void FImGuiModuleManager::AddWidgetToViewport(UGameViewportClient* GameViewport)
 | 
				
			|||||||
	// Make sure that we have a context for this viewport's world and get its index.
 | 
						// Make sure that we have a context for this viewport's world and get its index.
 | 
				
			||||||
	int32 ContextIndex;
 | 
						int32 ContextIndex;
 | 
				
			||||||
	auto& ContextProxy = ContextManager.GetWorldContextProxy(*GameViewport->GetWorld(), ContextIndex);
 | 
						auto& ContextProxy = ContextManager.GetWorldContextProxy(*GameViewport->GetWorld(), ContextIndex);
 | 
				
			||||||
	ContextProxy.OnDraw().AddLambda([this, ContextIndex]() { ImGuiDemo.DrawControls(ContextIndex); });
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Make sure that textures are loaded before the first Slate widget is created.
 | 
						// Make sure that textures are loaded before the first Slate widget is created.
 | 
				
			||||||
	LoadTextures();
 | 
						LoadTextures();
 | 
				
			||||||
@ -208,3 +210,8 @@ void FImGuiModuleManager::AddWidgetsToActiveViewports()
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void FImGuiModuleManager::OnContextProxyCreated(int32 ContextIndex, FImGuiContextProxy& ContextProxy)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						ContextProxy.OnDraw().AddLambda([this, ContextIndex]() { ImGuiDemo.DrawControls(ContextIndex); });
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -59,6 +59,8 @@ private:
 | 
				
			|||||||
	void AddWidgetToViewport(UGameViewportClient* GameViewport);
 | 
						void AddWidgetToViewport(UGameViewportClient* GameViewport);
 | 
				
			||||||
	void AddWidgetsToActiveViewports();
 | 
						void AddWidgetsToActiveViewports();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						void OnContextProxyCreated(int32 ContextIndex, FImGuiContextProxy& ContextProxy);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Event that we call after ImGui is updated.
 | 
						// Event that we call after ImGui is updated.
 | 
				
			||||||
	FSimpleMulticastDelegate PostImGuiUpdateEvent;
 | 
						FSimpleMulticastDelegate PostImGuiUpdateEvent;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user