On second thought, make the label dump runtime based on enabled log masks

This commit is contained in:
Marek Roszko 2021-10-11 19:49:44 -04:00
parent 57d0cbcefa
commit f2783a86e0
1 changed files with 6 additions and 6 deletions

View File

@ -85,7 +85,7 @@
// log mask for wxLogTrace // log mask for wxLogTrace
#define MASK_OCE "PLUGIN_OCE" #define MASK_OCE "PLUGIN_OCE"
//#define DUMP_LABELS #define MASK_OCE_EXTRA "PLUGIN_OCE_EXTRA"
// precision for mesh creation; 0.07 should be good enough for ECAD viewing // precision for mesh creation; 0.07 should be good enough for ECAD viewing
#define USER_PREC (0.14) #define USER_PREC (0.14)
@ -344,7 +344,6 @@ void getTag( const TDF_Label& aLabel, std::string& aTag )
} }
#ifdef DUMP_LABELS
static wxString getLabelName( const TDF_Label& aLabel ) static wxString getLabelName( const TDF_Label& aLabel )
{ {
wxString txt; wxString txt;
@ -474,7 +473,6 @@ static void dumpLabels( TDF_Label aLabel, Handle( XCAFDoc_ShapeTool ) aShapeTool
for( it.Initialize( aLabel ); it.More(); it.Next() ) for( it.Initialize( aLabel ); it.More(); it.Next() )
dumpLabels( it.Value(), aShapeTool, aColorTool, aDepth + 1 ); dumpLabels( it.Value(), aShapeTool, aColorTool, aDepth + 1 );
} }
#endif
bool getColor( DATA& data, TDF_Label label, Quantity_Color& color ) bool getColor( DATA& data, TDF_Label label, Quantity_Color& color )
@ -696,9 +694,11 @@ SCENEGRAPH* LoadModel( char const* filename )
data.m_assy = XCAFDoc_DocumentTool::ShapeTool( data.m_doc->Main() ); data.m_assy = XCAFDoc_DocumentTool::ShapeTool( data.m_doc->Main() );
data.m_color = XCAFDoc_DocumentTool::ColorTool( data.m_doc->Main() ); data.m_color = XCAFDoc_DocumentTool::ColorTool( data.m_doc->Main() );
#ifdef DUMP_LABELS // Check if the log mask is enabled otherwise the dump routine may be expensive before the wxLog call
dumpLabels( data.m_doc->Main(), data.m_assy, data.m_color ); if( wxLog::IsAllowedTraceMask( MASK_OCE ) )
#endif {
dumpLabels( data.m_doc->Main(), data.m_assy, data.m_color );
}
// retrieve all free shapes // retrieve all free shapes
TDF_LabelSequence frshapes; TDF_LabelSequence frshapes;