bobToolz: load all group entities, was hardcoded list of them

fix crash in DEntity::SelectBrushes after DEntity::LoadSelectedBrushes (which may load brushes from other entities)
generalize loading options; fix ignored loadPatches option; use only visible brushes in Find Duplicates
This commit is contained in:
Garux
2023-09-04 06:38:59 +06:00
parent bf4db60613
commit dea7800d3c
7 changed files with 58 additions and 74 deletions

View File

@@ -109,7 +109,7 @@ void DMap::BuildInRadiant( bool bAllowDestruction ){
entity->BuildInRadiant( bAllowDestruction );
}
void DMap::LoadAll( bool bLoadPatches ){
void DMap::LoadAll( const LoadOptions options ){
ClearEntities();
GlobalSelectionSystem().setSelectedAll( false );
@@ -117,19 +117,18 @@ void DMap::LoadAll( bool bLoadPatches ){
class load_entities_t : public scene::Traversable::Walker
{
DMap* m_map;
bool m_bLoadPatches;
const LoadOptions m_options;
public:
load_entities_t( DMap* map, bool bLoadPatches )
: m_map( map ), m_bLoadPatches( bLoadPatches ){
load_entities_t( DMap* map, const LoadOptions options )
: m_map( map ), m_options( options ){
}
bool pre( scene::Node& node ) const {
if ( Node_isEntity( node ) ) {
DEntity* loadEntity = m_map->AddEntity( "", 0 );
loadEntity->LoadFromEntity( node, m_bLoadPatches );
if ( Node_isEntity( node ) && !( m_options.loadVisibleOnly && !node.visible() ) ) {
m_map->AddEntity( "", 0 )->LoadFromEntity( node, m_options );
}
return false;
}
} load_entities( this, bLoadPatches );
} load_entities( this, options );
Node_getTraversable( GlobalSceneGraph().root() )->traverse( load_entities );
}