//********************************************************* // Name: createBreakdownList // Desc: //********************************************************* MStatus BreakdownCommand::createBreakdownList() { MObject dependNode; unsigned int objID = 0; MItSelectionList sIter( selectionList, MFn::kInvalid, &status ); for( ; !sIter.isDone(); sIter.next() ) { sIter.getDependNode( dependNode ); MFnDependencyNode dependFn( dependNode ); MPlugArray connections; dependFn.getConnections( connections ); if( !processConnections( connections, objID, dependFn.name()) ) { pluginWarning( "BreakdownCommand", "createBreakdownList", "processConnections Error if *not* Skipping All Objects" ); break; } objID++; } if( breakdownList.size() == 0 && status ) { pluginTrace( "BreakdownCommand", "createBreakdownList", "There are no breakdowns on the list" ); MGlobal::displayError( "No attributes were found to set breakdowns on. (See Script Editor)" ); status = MS::kFailure; } return status; }
//////////////////////////////////////////////////////////////////////////// // path.comparisons int path::__compare(const value_type* __s) const { path_view_iterator thisIter(this->native()); path_view_iterator sIter(__s); while (!thisIter.is_end() && !sIter.is_end()) { int res = (*thisIter).compare(*sIter); if (res != 0) return res; ++thisIter; ++sIter; } if (thisIter.is_end() && sIter.is_end()) return 0; if (thisIter.is_end()) return -1; return 1; }
//---------------------------------------------------------------------- CWizardInputs::~CWizardInputs() { m_pXml.clear(); HashIterator info(m_invalidServerCombo); for(info.first();info.isValid();info.next()) { StringArray *a = *m_invalidServerCombo.mapToValue(&info.query()); delete a; } HashIterator iter(m_compIpMap); ForEach(iter) { IMapping &cur = iter.query(); CInstDetails* pInfo = m_compIpMap.mapToValue(&cur); pInfo->Release(); } HashIterator sIter(m_compForTopology); for(sIter.first();sIter.isValid();sIter.next()) { StringArray* a = *m_compForTopology.mapToValue(&sIter.query()); delete a; } }
//----------------------------------------------------------------- MStatus ByronsPolyTools::doIt(const MArgList& args) //----------------------------------------------------------------- { // Ist die version abgelaufen ? // #ifdef EXPIRES if( ! checkExpires() ) { MGlobal::displayError( "This AlphaVersion is expired. Scenes will still load properly. " ); return MS::kSuccess; } #endif MSelectionList sList; MStatus status; MArgDatabase argData(syntax(),args); if(argData.isFlagSet("-help")) { MGlobal::executeCommand("showBPTHelpWindow",false,false); return MS::kSuccess; } //SELECTION UEBERPRUEFEN // Selection holen // argData.getObjects(sList); // OrigList fuer UndoZwecke speichern origList = sList; // Check, ob ueberhaupt Objekt gewaehlt if ( (sList.length() == 0) ) { displayError("ONE mesh or its transform node must be selected."); return MStatus::kFailure; } //MDagPath meshDagPath; MItSelectionList sIter(sList);//,MFn::kMesh); bool meshOK = false,hasComps = false; INVIS(cout<<"SELECTIONLIST LAENGE: "<<sList.length()<<endl); for(; !sIter.isDone(); sIter.next()) { sIter.getDagPath(meshDagPath, components); //sList.getDagPath(0, meshDagPath, components); //if(!meshDagPath.hasFn(MFn::kPluginDependNode)) if(meshDagPath.apiType() == (MFn::kMesh)) { if(!meshDagPath.hasFn(MFn::kMesh) ) meshOK = false; else meshOK = true; if( components.apiType() == MFn::kInvalid ) hasComps = false; else { hasComps = true; break; } } } if(!meshOK) { displayError("Invalid type! Only a mesh or its transform with selected components can be specified!"); return MStatus::kFailure; } #ifdef DEMO MFnMesh meshFn(meshDagPath); if(meshFn.numPolygons() > 500) { MGlobal::displayError("This DEMO will only work on meshes with a maximum number of 500 polygons"); return MS::kFailure; } #endif if(!hasComps) { displayError("Please select some components to operate on"); return MStatus::kFailure; } // Flags und Argumente Holen //---------------------------------- if(argData.isFlagSet("-iv")) operationMode = 0; else operationMode = 1; //zuerst mal edgeComoponents holen - wenn welche vorhanden und -peb flag gesetzt, dann wird auf jeden Fall der case 0 mode verwendet getEdgeComponents(sList); if( argData.isFlagSet("-peb") && edgeIDs.length() != 0 ) operationMode = 0; //------------------------------------ // OPTIONS //------------------------------------ switch(operationMode) { case 0://insert Vtx mode { if(argData.isFlagSet("-ic")) argData.getFlagArgument("-ic",0,initialCount); else initialCount = 1; goto default_values; } case 1: //PolyToolsMode { //------------------------------------ // FLAGS //------------------------------------ smartSplitFlagSet = argData.isFlagSet("-smartSplit"); edgeLoopFlagSet = argData.isFlagSet("-edgeLoop"); edgeRingFlagSet = argData.isFlagSet("-edgeRing"); boundaryFlagSet = argData.isFlagSet("-boundary"); chamferFlagSet = argData.isFlagSet("-chamfer"); solidChamferFlagSet = argData.isFlagSet("-solidChamfer"); smcFlagSet = argData.isFlagSet("-smartMoveComponent"); growFlagSet = argData.isFlagSet("-gro"); schrinkFlagSet = argData.isFlagSet("-shr"); // abbruch, wenn flags nicht eindeutig und actionMode nicht gesetzt werden kann status = setActionMode(); if(status == MS::kFailure) return status; //-------------------ENDE----------------------------- goto default_values; } default: { default_values: avt = (argData.isFlagSet("-avf"))?true:false; avm = (argData.isFlagSet("-avm"))?true:false; options.setLength(10); options[0] = argData.isFlagSet("-connectEnds"); options[1] = argData.isFlagSet("-triangulateEnds"); if(argData.isFlagSet("-maxEdgeCount")) argData.getFlagArgument("-maxEdgeCount",0,options[2]); else options[2] = 16666666; options[3] = 0; //side ist standardmaessig 0: if(argData.isFlagSet("-snl") ) options[4] = 1; else options[4] = 0; options[5] = (argData.isFlagSet("-ast"))?1:0; options[6] = 0; if(argData.isFlagSet("-se")) options[6] = 1; if( CMDactionMode == 5 && argData.isFlagSet("-") ) options[6] += 3; if(argData.isFlagSet("-sf")) options[6] = 2; if(argData.isFlagSet("-sv")) options[6] = 5; //IV flag - wenn -peb aktiv ist, wird er auf jeden Fall gesetzt if( argData.isFlagSet("-peb") ) options[9] = 1; else options[9] = argData.isFlagSet("-civ")?true:false; //----------------------------------------OPTIONS ENDE slideIsRelative = argData.isFlagSet("-sir"); //slideIsRelative ist an, wenn Chamfer aktiv ist if(chamferFlagSet+solidChamferFlagSet > 0) slideIsRelative = 1; if(CMDactionMode == 6) slideIsRelative = true; normalIsRelative = argData.isFlagSet("-nir"); //slide soll automatisch auf gesetzt werden, wenn -peb aktiv (dies entspricht einem slidewert von 1 if( argData.isFlagSet("-peb") && edgeIDs.length() != 0) directSlide = 1; else { if(argData.isFlagSet("-slide")) argData.getFlagArgument("-slide",0,directSlide); else directSlide = 0.5; //defaultValue } } } //undoIndo sammeln MSelectionMask tmpMask(MGlobal::componentSelectionMask()); undoMask = tmpMask; /* CallWindowProc( (WNDPROC)(GetWindowLong(mayaWin, GWL_WNDPROC)), mayaWin, WM_CLOSE, NULL, NULL); DWORD dwStyle = WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN; //MessageBox(mayaWin, "Help", "Whatever", MB_OK); HWND myWin = CreateWindowEx( 0,"MyFirstWin","Lala" , dwStyle, 0, 0, 300, 400, mayaWin, NULL, NULL, NULL); ShowWindow(myWin, SW_SHOWNORMAL); SetFocus(myWin); UpdateWindow(myWin); */ //checken ob makeHistory aus ist. Wenn ja, dann wieder an machen, weil maya sonst crashed int result; MGlobal::executeCommand( "constructionHistory -q -tgl", result ); if(!result) MGlobal::executeCommand( "constructionHistory -tgl 1",false,false); meshDagPath.extendToShape(); // Mesh von polyModifierCommand setzen setMeshNode(meshDagPath); switch(operationMode) { case 0: { //getEdgeComponents(sList); convertToEdges(sList, argData.isFlagSet("-peb") ); // setCreateAnimCurves(false);//damit nicht versucht wird, auf dieser Node animCurves fuer tweak zu erstellen // Jetzt sind tweaks vonnten setModifierNodeType( BPT_InsertVtx::IVid ); break; } case 1: { // Komponenten herausfiltern und IntIDArrays schreiben //getEdgeComponents(sList); getVertComponents(sList); getPolyComponents(sList); setModifierNodeType( ByronsPolyToolsNode::id ); break; } } // Aktion ausfuehren if(CMDactionMode == 0 || CMDactionMode == 4 || CMDactionMode == 5 || CMDactionMode == 6 || operationMode == 0) { MGlobal::executeCommand("setToolTo selectSuperContext",false,false); status = doModifyPoly(); MFnDependencyNode depNodeFn(bptNode); setResult(depNodeFn.name()); if( !(status == MS::kSuccess) ) { MGlobal::displayError( "An error occoured." ); MGlobal::displayError( status.errorString() ); } } else { // Wenn mesh nicht veraendert wird, wird einfach so die Factory gerufen directModifier(meshDagPath.node()); //setResult( "BPTOperation succeeded" ); } //Command wird nur einmal verwendet, also muessen die Datenarrays auch m#keinen Speicher mehr verschwenden //.clear() wuerde sie nicht physisch loeschen polyIDs.setLength(0); edgeIDs.setLength(0); vertIDs.setLength(0); // return status; return MS::kSuccess; }
void run() override { const String search = getTextEditorContents("search"); const String replace = getTextEditorContents("replace"); pool->setUpdatePool(false); int foundThisTime = 0; showStatusMessage("Replacing references"); try { const double numMissingSoundsDouble = (double)missingSounds.size(); for (int i = 0; i < missingSounds.size(); i++) { if (threadShouldExit()) return; setProgress(double(i) / numMissingSoundsDouble); StreamingSamplerSound *sound = missingSounds[i]; String newFileName = sound->getFileName(true).replace(search, replace, true); String newFileNameSanitized = newFileName.replace("\\", "/"); if (File(newFileNameSanitized).existsAsFile()) { sound->replaceFileReference(newFileNameSanitized); foundThisTime++; missingSounds.remove(i); i--; } } } catch (StreamingSamplerSound::LoadingError e) { String x; x << "Error at loading sample " << e.fileName << ": " << e.errorDescription; mainSynthChain->getMainController()->getDebugLogger().logMessage(x); errorMessage = "There was an error at preloading."; return; } remainingSounds -= foundThisTime; showStatusMessage("Replacing references"); Processor::Iterator<ModulatorSampler> iter(mainSynthChain); int numSamplers = iter.getNumProcessors(); int index = 0; while (ModulatorSampler *s = iter.getNextProcessor()) { setProgress((double)index / (double)numSamplers); ModulatorSampler::SoundIterator sIter(s); while (auto sound = sIter.getNextSound()) { sound->checkFileReference(); } s->sendChangeMessage(); index++; } }