void EntityInstanceNode::Show( const EntityNode& instanceClassNode ) { if( instanceClassNode == EntityNode::Null ) return; MFnDagNode instanceFn( thisMObject() ); MDagPath path; instanceFn.getPath( path ); MFnDagNode nodeFn( instanceClassNode.thisMObject() ); u32 len = nodeFn.childCount(); for( u32 i = 0; i < len; ++i ) { MFnDagNode nodeFn( nodeFn.child( i ) ); MDagPath child; nodeFn.getPath( child ); MDagPath result; Maya::duplicate( child, path, result, true, true ); } }
//----------------------------------------------------------------------------- // EntityInstanceNodeCmd::doIt // execution of the command //----------------------------------------------------------------------------- MStatus EntityInstanceNodeCmd::doIt( const MArgList & args ) { MStatus stat; // parse the command line arguments using the declared syntax MArgDatabase argParser( syntax(), args, &stat ); if( argParser.isFlagSet( ReloadAllArtFlagLong ) ) { EntityNode::UnloadAllArt(); EntityNode::LoadAllArt(); return MS::kSuccess; } else if( argParser.isFlagSet( UnloadAllArtFlagLong ) ) { EntityNode::UnloadAllArt(); return MS::kSuccess; } else if( argParser.isFlagSet( UnselectFlag ) ) { MGlobal::executeCommand( "select -all" ); MSelectionList list; MGlobal::getActiveSelectionList( list ); EntityNode::UnselectAll( list ); MGlobal::setActiveSelectionList( list ); return MS::kSuccess; } else if( argParser.isFlagSet( CreateInstanceFlag ) ) { HELIUM_BREAK(); #pragma TODO( "Reimplement to use the Vault" ) //File::FileBrowser browserDlg( NULL, -1, "Create Instance" ); //browserDlg.AddFilter( FinderSpecs::Asset::ENTITY_DECORATION ); //browserDlg.SetFilterIndex( FinderSpecs::Asset::ENTITY_DECORATION ); //if ( browserDlg.ShowModal() == wxID_OK ) //{ // tstring fullPath = browserDlg.GetPath(); // if ( FileSystem::Exists( fullPath ) ) // { // if ( FileSystem::HasExtension( fullPath, FinderSpecs::Asset::ENTITY_DECORATION.GetDecoration() ) ) // { // Asset::EntityPtr instance = new Asset::Entity( fullPath ); // std::pair< EntityNode*, EntityInstanceNode* >result = EntityNode::CreateInstance( instance ); // MFnDependencyNode nodeFn( result.second->thisMObject() ); // } // } //} return MS::kSuccess; } else if( argParser.isFlagSet( FlattenLong ) ) { EntityNode::FlattenInstances(); return MS::kSuccess; } // // the following flags need an EntityNode object to proceed // MSelectionList selection; argParser.getObjects( selection ); MObject selectedNode; selection.getDependNode( 0, selectedNode ); MFnDependencyNode nodeFn; nodeFn.setObject( selectedNode ); EntityNode* classTransform = NULL; if( nodeFn.typeId() == EntityInstanceNode::s_TypeID ) { EntityInstanceNode* node = static_cast< EntityInstanceNode* >( nodeFn.userNode( &stat ) ); if( !node ) { return MS::kFailure; } classTransform = &EntityNode::Get( node->GetBackingEntity()->GetEntity()->GetPath() ); if( *classTransform == EntityNode::Null ) { return MS::kFailure; } } else if ( nodeFn.typeId() == EntityNode::s_TypeID ) { classTransform = static_cast< EntityNode* >( nodeFn.userNode( &stat ) ); if( !classTransform ) { return MS::kFailure; } } if (argParser.isFlagSet( ReloadArtLong ) ) { classTransform->LoadArt(); } else if( argParser.isFlagSet( SelectEntityAssetFlagLong ) ) { MFnDagNode nodeFn( classTransform->thisMObject() ); MGlobal::executeCommand( "select -r \"" + nodeFn.fullPathName() + "\"" ); } return MS::kSuccess; }