Small fixes to get the ingame AF editor running

This commit is contained in:
Robert Beckebans 2022-09-15 11:44:26 +02:00
parent 25b7680cfb
commit 322245d9f1
9 changed files with 71 additions and 141 deletions

View file

@ -1088,6 +1088,9 @@ file(GLOB IMGUI_EDITOR_SOURCES tools/imgui/*.cpp)
file(GLOB IMGUI_EDITOR_LIGHT_INCLUDES tools/imgui/lighteditor/*.h)
file(GLOB IMGUI_EDITOR_LIGHT_SOURCES tools/imgui/lighteditor/*.cpp)
file(GLOB IMGUI_EDITOR_UTIL_INCLUDES tools/imgui/util/*.h)
file(GLOB IMGUI_EDITOR_UTIL_SOURCES tools/imgui/util/*.cpp)
file(GLOB DOOMCLASSIC_INCLUDES ../doomclassic/doom/*.h)
file(GLOB DOOMCLASSIC_SOURCES ../doomclassic/doom/*.cpp)
@ -1441,6 +1444,8 @@ source_group("tools\\imgui" FILES ${IMGUI_EDITOR_SOURCES})
source_group("tools\\imgui\\lighteditor" FILES ${IMGUI_EDITOR_LIGHT_INCLUDES})
source_group("tools\\imgui\\lighteditor" FILES ${IMGUI_EDITOR_LIGHT_SOURCES})
source_group("tools\\imgui\\util" FILES ${IMGUI_EDITOR_UTIL_INCLUDES})
source_group("tools\\imgui\\util" FILES ${IMGUI_EDITOR_UTIL_SOURCES})
set(RBDOOM3_INCLUDES
${AAS_INCLUDES}
@ -1497,6 +1502,7 @@ set(RBDOOM3_INCLUDES
${TOOLS_INCLUDES}
${IMGUI_EDITOR_INCLUDES}
${IMGUI_EDITOR_LIGHT_INCLUDES}
${IMGUI_EDITOR_UTIL_INCLUDES}
${GAMED3XP_INCLUDES}
${GAMED3XP_AI_INCLUDES}
@ -1543,6 +1549,7 @@ set(RBDOOM3_SOURCES
${IMGUI_EDITOR_SOURCES}
${IMGUI_EDITOR_LIGHT_SOURCES}
${IMGUI_EDITOR_UTIL_SOURCES}
${GAMED3XP_SOURCES}
${GAMED3XP_AI_SOURCES}

View file

@ -1427,21 +1427,4 @@ void idClass::ExportScriptEvents_f( const idCmdArgs& args )
delete[] set;
}
void idClass::EditLights_f( const idCmdArgs& args )
{
if( g_editEntityMode.GetInteger() != 1 )
{
g_editEntityMode.SetInteger( 1 );
// turn off com_smp multithreading so we can load and check light textures on main thread
com_editors |= EDITOR_LIGHT;
}
else
{
g_editEntityMode.SetInteger( 0 );
com_editors &= ~EDITOR_LIGHT;
}
}
// RB end

View file

@ -297,7 +297,6 @@ public:
static void ListClasses_f( const idCmdArgs& args );
// RB begin
static void ExportScriptEvents_f( const idCmdArgs& args );
static void EditLights_f( const idCmdArgs& args );
// RB end
static idClass* CreateInstance( const char* name );
static int GetNumTypes()

View file

@ -32,6 +32,8 @@ If you have questions concerning this license or the applicable additional terms
#include "../Game_local.h"
#include "../tools/imgui/afeditor/AfEditor.h"
/*
==================
Cmd_GetFloatArg
@ -2725,6 +2727,44 @@ void Cmd_TestId_f( const idCmdArgs& args )
}
// RB begin
void Cmd_EditLights_f( const idCmdArgs& args )
{
if( g_editEntityMode.GetInteger() != 1 )
{
g_editEntityMode.SetInteger( 1 );
// turn off com_smp multithreading so we can load and check light textures on main thread
com_editors |= EDITOR_LIGHT;
}
else
{
g_editEntityMode.SetInteger( 0 );
com_editors &= ~EDITOR_LIGHT;
}
}
// RB end
// SP begin
void Cmd_ShowAfEditor_f( const idCmdArgs& args )
{
if( g_editEntityMode.GetInteger() != 3 )
{
g_editEntityMode.SetInteger( 3 );
com_editors |= EDITOR_AF;
ImGuiTools::AfEditor::Instance().Init();
ImGuiTools::AfEditor::Instance().ShowIt( true );
}
else
{
g_editEntityMode.SetInteger( 0 );
com_editors &= ~EDITOR_AF;
ImGuiTools::AfEditor::Instance().ShowIt( false );
}
}
// SP end
/*
=================
idGameLocal::InitConsoleCommands
@ -2812,10 +2852,14 @@ void idGameLocal::InitConsoleCommands()
// RB begin
cmdSystem->AddCommand( "exportScriptEvents", idClass::ExportScriptEvents_f, CMD_FL_GAME | CMD_FL_TOOL, "update script/doom_events.script" );
cmdSystem->AddCommand( "editLights", idClass::EditLights_f, CMD_FL_GAME | CMD_FL_TOOL, "launches the in-game Light Editor" );
cmdSystem->AddCommand( "editLights", Cmd_EditLights_f, CMD_FL_GAME | CMD_FL_TOOL, "launches the in-game Light Editor" );
cmdSystem->AddCommand( "saveEnvprobes", Cmd_SaveEnvprobes_f, CMD_FL_GAME | CMD_FL_CHEAT, "saves all autogenerated env_probes to a .extras_env_probes.map file" );
// RB end
// SP Begin
cmdSystem->AddCommand( "editAFs", Cmd_ShowAfEditor_f, CMD_FL_GAME | CMD_FL_TOOL, "launches the in-game Articulated Figure Editor" );
// SP end
// multiplayer client commands ( replaces old impulses stuff )
//cmdSystem->AddCommand( "clientDropWeapon", idMultiplayerGame::DropWeapon_f, CMD_FL_GAME, "drop current weapon" );
cmdSystem->AddCommand( "clientMessageMode", idMultiplayerGame::MessageMode_f, CMD_FL_GAME, "ingame gui message mode" );

View file

@ -361,25 +361,15 @@ idCommonLocal::InitTool
*/
void idCommonLocal::InitTool( const toolFlag_t tool, const idDict* dict, idEntity* entity )
{
#if defined(USE_MFC_TOOLS)
if( tool & EDITOR_SOUND )
{
//SoundEditorInit( dict ); // TODO: implement this somewhere
}
else if( tool & EDITOR_PARTICLE )
{
//ParticleEditorInit( dict );
}
else if( tool & EDITOR_AF )
{
//AFEditorInit( dict );
}
#else
if( tool & EDITOR_LIGHT )
{
ImGuiTools::LightEditorInit( dict, entity );
}
#endif
if( tool & EDITOR_AF )
{
ImGuiTools::AfEditorInit();
}
}
// DG end

View file

@ -157,10 +157,8 @@ const int MAX_EXPRESSION_REGISTERS = 4096;
// The editor entry points are always declared, but may just be
// stubbed out on non-windows platforms.
//#if defined(USE_MFC_TOOLS) || defined(USE_QT_TOOLS) || defined(USE_GTK_TOOLS)
#include "../imgui/ImGui_Hooks.h"
#include "../tools/edit_public.h"
//#endif
#include "../tools/compilers/compiler_public.h"

View file

@ -249,8 +249,6 @@ bool Init( int windowWidth, int windowHeight )
g_DisplaySize.y = windowHeight;
io.DisplaySize = g_DisplaySize;
io.RenderDrawListsFn = idRenderBackend::ImGui_RenderDrawLists;
// RB: FIXME double check
io.SetClipboardTextFn = SetClipboardText;
io.GetClipboardTextFn = GetClipboardText;
@ -434,9 +432,8 @@ void Render()
ImGui::ShowDemoWindow();
}
//ImGui::End();
ImGui::Render();
idRenderBackend::ImGui_RenderDrawLists( ImGui::GetDrawData() );
g_haveNewFrame = false;
}
}

View file

@ -38,106 +38,6 @@ If you have questions concerning this license or the applicable additional terms
*/
// RB begin
#if defined(USE_MFC_TOOLS)
class idProgram;
class idInterpreter;
// Radiant Level Editor
void RadiantInit();
void RadiantShutdown();
void RadiantRun();
void RadiantPrint( const char* text );
void RadiantSync( const char* mapName, const idVec3& viewOrg, const idAngles& viewAngles );
// in-game Light Editor
void LightEditorInit( const idDict* spawnArgs );
void LightEditorShutdown();
void LightEditorRun();
// in-game Sound Editor
void SoundEditorInit( const idDict* spawnArgs );
void SoundEditorShutdown();
void SoundEditorRun();
// in-game Articulated Figure Editor
void AFEditorInit( const idDict* spawnArgs );
void AFEditorShutdown();
void AFEditorRun();
// in-game Particle Editor
void ParticleEditorInit( const idDict* spawnArgs );
void ParticleEditorShutdown();
void ParticleEditorRun();
// in-game PDA Editor
void PDAEditorInit( const idDict* spawnArgs );
void PDAEditorShutdown();
void PDAEditorRun();
// in-game Script Editor
void ScriptEditorInit( const idDict* spawnArgs );
void ScriptEditorShutdown();
void ScriptEditorRun();
// in-game Declaration Browser
void DeclBrowserInit( const idDict* spawnArgs );
void DeclBrowserShutdown();
void DeclBrowserRun();
void DeclBrowserReloadDeclarations();
// GUI Editor
void GUIEditorInit();
void GUIEditorShutdown();
void GUIEditorRun();
bool GUIEditorHandleMessage( void* msg );
// Script Debugger
void DebuggerClientLaunch();
void DebuggerClientInit( const char* cmdline );
bool DebuggerServerInit();
void DebuggerServerShutdown();
void DebuggerServerPrint( const char* text );
void DebuggerServerCheckBreakpoint( idInterpreter* interpreter, idProgram* program, int instructionPointer );
//Material Editor
void MaterialEditorInit();
void MaterialEditorRun();
void MaterialEditorShutdown();
void MaterialEditorPrintConsole( const char* msg );
#endif // #if defined(USE_MFC_TOOLS)
#if defined(USE_GTK_TOOLS)
void GtkTestEditorInit();
void GtkTestEditorShutdown();
void GtkTestEditorRun();
#endif
#if defined(USE_QT_TOOLS)
void QtRadiantInit();
void QtRadiantShutdown();
void QtRadiantRun();
void QtRadiantPrint( const char* text );
void QtStringEditorInit();
void QtStringEditorShutdown();
void QtStringEditorRun();
#endif
// RB end
namespace ImGuiTools
{

View file

@ -3,6 +3,7 @@
Doom 3 BFG Edition GPL Source Code
Copyright (C) 2016 Daniel Gibson
Copyright (C) 2022 Stephen Pridham
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
@ -32,6 +33,7 @@ If you have questions concerning this license or the applicable additional terms
#include "../imgui/BFGimgui.h"
#include "../idlib/CmdArgs.h"
#include "afeditor/AfEditor.h"
#include "lighteditor/LightEditor.h"
@ -62,7 +64,7 @@ void SetReleaseToolMouse( bool doRelease )
bool AreEditorsActive()
{
// FIXME: this is not exactly clean and must be changed if we ever support game dlls
return g_editEntityMode.GetInteger() > 0;
return g_editEntityMode.GetInteger() > 0 || com_editors != 0;
}
bool ReleaseMouseForTools()
@ -85,6 +87,10 @@ void DrawToolWindows()
LightEditor::Draw();
}
if( AfEditor::Instance().IsShown() )
{
AfEditor::Instance().Draw();
}
// TODO: other editor windows..
//ImGui::End();
}
@ -108,4 +114,10 @@ void LightEditorInit( const idDict* dict, idEntity* ent )
LightEditor::ReInit( dict, ent );
}
void AfEditorInit()
{
AfEditor::Instance().ShowIt( true );
impl::SetReleaseToolMouse( true );
}
} //namespace ImGuiTools