@@ -78,10 +78,8 @@ ParticleEditor::ParticleEditor()
7878void ParticleEditor::Draw ()
7979{
8080 int i, num;
81- bool showTool;
82- bool clickedNew = false , clickedSelect = false ;
83-
8481 showTool = isShown;
82+ bool clickedNew = false , clickedSelect = false ;
8583
8684 if ( ImGui::Begin ( " Particle Editor" , &showTool, ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_MenuBar ) ) {
8785 impl::SetReleaseToolMouse ( true );
@@ -105,9 +103,11 @@ void ParticleEditor::Draw()
105103 OnBnClickedButtonSave ();
106104 }
107105
108- if ( ImGui::MenuItem ( " Close" , " Ctrl+W" ) )
106+ ImGui::Separator ();
107+
108+ if ( ImGui::MenuItem ( " Exit" ) )
109109 {
110- showTool = false ;
110+ Exit () ;
111111 }
112112
113113 ImGui::EndMenu ();
@@ -706,11 +706,22 @@ void ParticleEditor::Draw()
706706 if ( isShown && !showTool )
707707 {
708708 isShown = showTool;
709- impl::SetReleaseToolMouse ( false );
710- D3::ImGuiHooks::CloseWindow ( D3::ImGuiHooks::D3_ImGuiWin_ParticleEditor );
709+ Exit ();
711710 }
712711}
713712
713+ void ParticleEditor::Exit ( void )
714+ {
715+ // close this tool, release mouse, clear editor flags and reset edit mode
716+ showTool = false ;
717+ ParticleEditor::Instance ().ShowIt ( false );
718+ impl::SetReleaseToolMouse ( false );
719+ D3::ImGuiHooks::CloseWindow ( D3::ImGuiHooks::D3_ImGuiWin_ParticleEditor );
720+ // clear editor flag and reset edit mode cvar
721+ com_editors &= ~EDITOR_PARTICLE;
722+ cvarSystem->SetCVarInteger ( " g_editEntityMode" , 0 );
723+ }
724+
714725// ParticleEditor message handlers
715726
716727void ParticleEditor::OnBnClickedParticleMode () {
0 commit comments