From fa8a7a9c7bf2cc370d91a8ac4d7eb6bcea405952 Mon Sep 17 00:00:00 2001 From: Robert Beckebans Date: Sat, 18 May 2024 21:23:41 +0200 Subject: [PATCH] Tweaked exportFGD to display correctly func_animate ents in TrenchBroom --- neo/framework/DeclManager.cpp | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/neo/framework/DeclManager.cpp b/neo/framework/DeclManager.cpp index 91d1ab64..b1c2d60a 100644 --- a/neo/framework/DeclManager.cpp +++ b/neo/framework/DeclManager.cpp @@ -2641,16 +2641,7 @@ void idDeclManagerLocal::ExportEntityDefsToTrenchBroom_f( const idCmdArgs& args // precache model/animations const idDeclModelDef* modelDef = static_cast( declManager->FindType( DECL_MODELDEF, kv->GetValue(), false ) ); - if( modelDef == NULL ) - { - // there is no modelDef so use direct path - renderModelManager->FindModel( kv->GetValue() ); - - exportedModelFileName = "_tb/"; - exportedModelFileName.AppendPath( kv->GetValue() ); - exportedModelFileName.SetFileExtension( ".obj" ); - } - else + if( modelDef != NULL ) { idRenderModel* renderModel = modelDef->ModelHandle(); if( renderModel ) @@ -2660,6 +2651,15 @@ void idDeclManagerLocal::ExportEntityDefsToTrenchBroom_f( const idCmdArgs& args exportedModelFileName.SetFileExtension( ".obj" ); } } + else + { + // there is no modelDef so use direct path + renderModelManager->FindModel( kv->GetValue() ); + + exportedModelFileName = "_tb/"; + exportedModelFileName.AppendPath( kv->GetValue() ); + exportedModelFileName.SetFileExtension( ".obj" ); + } } } } @@ -2669,6 +2669,7 @@ void idDeclManagerLocal::ExportEntityDefsToTrenchBroom_f( const idCmdArgs& args file->Printf( "model({ \"path\": \"%s\" }) ", exportedModelFileName.c_str() ); } else if( idStr::Icmp( decl->GetName(), "misc_model" ) == 0 || + idStr::Icmp( decl->GetName(), "func_animate" ) == 0 || idStr::Icmp( decl->GetName(), "func_bobbing_model" ) == 0 || idStr::Icmp( decl->GetName(), "func_door_model" ) == 0 || idStr::Icmp( decl->GetName(), "func_elevator_model" ) == 0 || @@ -2871,7 +2872,7 @@ void idDeclManagerLocal::ExportEntityDefsToTrenchBroom_f( const idCmdArgs& args } //declManagerLocal.Reload( true ); - common->FatalError( "Exporting successful, need to restart manually" ); + common->FatalError( "Exporting successful, need to restart engine manually" ); } void idDeclManagerLocal::ExportImagesToTrenchBroom_f( const idCmdArgs& args )