bool pre( scene::Node& node ) const { if ( Node_isEntity( node ) ) { DEntity* loadEntity = m_map->AddEntity( "", 0 ); loadEntity->LoadFromEntity( node, m_bLoadPatches ); } return false; }
void Entity_ungroupSelected(){ if ( GlobalSelectionSystem().countSelected() < 1 ) { return; } UndoableCommand undo( "ungroupSelectedEntities" ); scene::Path world_path( makeReference( GlobalSceneGraph().root() ) ); world_path.push( makeReference( Map_FindOrInsertWorldspawn( g_map ) ) ); scene::Instance &instance = GlobalSelectionSystem().ultimateSelected(); scene::Path path = instance.path(); if ( !Node_isEntity( path.top() ) ) { path.pop(); } if ( Node_getEntity( path.top() ) != 0 && node_is_group( path.top() ) ) { if ( world_path.top().get_pointer() != path.top().get_pointer() ) { parentBrushes( path.top(), world_path.top() ); Path_deleteTop( path ); } } }
virtual bool pre(const scene::INodePtr& node) { if(Node_isEntity(node) && m_index-- == 0) { m_path.push(node); } return false; }
/// moves selected primitives to entity, which is or its primitive is ultimateSelected() or firstSelected() void Entity_moveSelectedPrimitives( bool toLast ){ if ( GlobalSelectionSystem().countSelected() < 2 ) { globalErrorStream() << "Source and target entity primitives should be selected!\n"; return; } const scene::Path& path = toLast? GlobalSelectionSystem().ultimateSelected().path() : GlobalSelectionSystem().firstSelected().path(); scene::Node& node = ( !Node_isEntity( path.top() ) && path.size() > 1 )? path.parent() : path.top(); if ( Node_isEntity( node ) && node_is_group( node ) ) { StringOutputStream command; command << "movePrimitivesToEntity " << makeQuoted( Node_getEntity( node )->getEntityClass().name() ); UndoableCommand undo( command.c_str() ); Scene_parentSelectedBrushesToEntity( GlobalSceneGraph(), node ); } }
void Entity_ungroupSelected(){ if ( GlobalSelectionSystem().countSelected() < 1 ) { return; } UndoableCommand undo( "ungroupSelectedEntities" ); scene::Instance &instance = GlobalSelectionSystem().ultimateSelected(); scene::Path path = instance.path(); scene::Node& world = Map_FindOrInsertWorldspawn( g_map ); if ( !Node_isEntity( path.top() ) && path.size() > 1 ) { path.pop(); } if ( Node_isEntity( path.top() ) && node_is_group( path.top() ) ) { if ( &world != path.top().get_pointer() ) { parentBrushes( path.top(), world ); Path_deleteTop( path ); } } }
bool pre(const scene::INodePtr& node) { if (Node_isEntity(node)) { // Have we found the node? if (_node == node) { // Yes, found, set needle to NULL _node = scene::INodePtr(); } // As long as the needle is non-NULL, increment the counter if (_node != NULL) { ++_count; } } return true; }
LayerUsageBreakdown LayerUsageBreakdown::CreateFromScene(bool includeHidden) { LayerUsageBreakdown bd; InitialiseVector(bd); GlobalSceneGraph().foreachNode([&](const scene::INodePtr& node) { // Filter out any hidden nodes, unless we want them if (!includeHidden && !node->visible()) return false; // Consider only entities and primitives if (!Node_isPrimitive(node) && !Node_isEntity(node)) return true; addNodeMapping(bd, node); return true; }); return bd; }
void GetSelectionIndex(std::size_t& ent, std::size_t& brush) { if (GlobalSelectionSystem().countSelected() != 0) { scene::INodePtr node = GlobalSelectionSystem().ultimateSelected(); scene::INodePtr parent = node->getParent(); if (Node_isEntity(node)) { // Selection is an entity, find its index EntityFindIndexWalker walker(node, ent); Node_traverseSubgraph(GlobalSceneGraph().root(), walker); } else if (Node_isPrimitive(node)) { // Node is a primitive, find parent entity and child index EntityFindIndexWalker walker(parent, ent); Node_traverseSubgraph(GlobalSceneGraph().root(), walker); PrimitiveFindIndexWalker brushWalker(node, brush); Node_traverseSubgraph(parent, brushWalker); } } }
// Checks if the given SceneNode structure is a BrushNode bool ScriptEntityNode::isEntity(const ScriptSceneNode& node) { return Node_isEntity(node); }
// Constructor, checks if the passed node is actually an entity ScriptEntityNode::ScriptEntityNode(const scene::INodePtr& node) : ScriptSceneNode((node != NULL && Node_isEntity(node)) ? node : scene::INodePtr()) {}
bool contains_primitive (scene::Node& node) const { return Node_isEntity(node) && Node_getTraversable(node) != 0 && Node_getEntity(node)->isContainer(); }
bool contains_entity (scene::Node& node) const { return Node_getTraversable(node) != 0 && !Node_isBrush(node) && !Node_isEntity(node); }