Пример #1
0
void GMSetUI::Process()
{
	/// First remove the old UI.
	UserInterface * oldUI = NULL;
	if (window)
	{
		oldUI = window->GetUI();		
	}
	else if (viewport)
	{
		oldUI = viewport->ui;
	}
	// Default. Assume ui of main AppWindow?
	else {
		window = WindowMan.MainWindow();
		oldUI = window->GetUI();
	}
	// Make sure its not re-setting. Skip it if so.
	if (oldUI == ui)
	{
		std::cout<<"\nSetting same UI. Doing nothing then!";
		return;
	}
	/// Remove references to old ui and enter the new one.
	if (window)
	{
		window->ui = ui;
	}
	else if (viewport)
	{
		viewport->ui = ui;
	}
	/// And finally remove the old one.
	if (oldUI)
	{
		oldUI->OnExitScope();
		/// Unbufferize it too as needed.
		if (oldUI->IsBuffered())
			oldUI->Unbufferize();
		if (oldUI->IsGeometryCreated())
			oldUI->DeleteGeometry();
//		delete oldUI;
	}

	/// If ui..
	if (ui)
		ui->OnEnterScope();

	Graphics.renderQueried = true;
}
Пример #2
0
void GMSetGlobalUI::Process()
{
	/// Allow single windows for all projects with them no more.
	if (!window)
	{
		window = WindowMan.MainWindow();
	}
	UserInterface * oldGlobalUI = window->GetGlobalUI();
	// Re-setting same?
	if (oldGlobalUI == ui)
		return;
	if (oldGlobalUI)
	{
		oldGlobalUI->OnExitScope();
		// Unbufferize it
		if (oldGlobalUI->IsBuffered())
			oldGlobalUI->Unbufferize();
		if (oldGlobalUI->IsGeometryCreated())
			oldGlobalUI->DeleteGeometry();
	}
	window->globalUI = ui;
	if (ui)
		ui->OnEnterScope();
}