//********************************************************* // Name: doIt // Desc: All of the one-time setup and initialization // code for the breakdown command. doIt is called // by Maya when any command is executed in MEL. // Any code that changes the state of Maya is // handled by the redoIt method. //********************************************************* MStatus BreakdownCommand::doIt( const MArgList &args ) { parseCommandFlags( args ); getSelectedObjects(); if( selectionList.length() == 0 ) { MGlobal::displayError( "No Objects Selected" ); status = MS::kFailure; } else if( selectedAttrOnly && (populateSelectedAttributeList() == 0) ) { MGlobal::displayError( "No Attributes Selected" ); status = MS::kFailure; } else { MStringArray results; selectionList.getSelectionStrings( results ); if( !createBreakdownList()) { // Create breakdown will display its own error } // When in ripple mode, the default behaviour is to verify that // all attributes have a key set at the current time or all keys // have no keys set at the current time. The ripple breakdown // will fail if this is not the case unless the check is disabled. else if( breakdownMode == Breakdown::kRipple && !ignoreRippleCheck && !(status = breakdownList.areOriginalKeysUniform()) ) { MGlobal::displayError( "Breakdown Failed. (Ripple Mode)All attributes must have a key set or no keys set at the current time." ); } else { if( !redoIt() ) { pluginError( "BreakdownCommand", "doIt", "Failed to redoIt" ); } else { MString output( "Result: " ); output += breakdownList.size(); if( attributesSkipped ) output += " (See Script Editor for skipped attributes)"; else if( objectsSkipped ) output += " (See Script Editor for skipped objects)"; MGlobal::displayInfo( output ); } } } return status; }
bool LLFloaterPathfindingLinksets::isShowCannotBeVolumeWarning(LLPathfindingLinkset::ELinksetUse pLinksetUse) const { bool isShowWarning = false; if (pLinksetUse != LLPathfindingLinkset::kUnknown) { LLPathfindingObjectListPtr selectedObjects = getSelectedObjects(); if ((selectedObjects != NULL) && !selectedObjects->isEmpty()) { const LLPathfindingLinksetList *linksetList = dynamic_cast<const LLPathfindingLinksetList *>(selectedObjects.get()); isShowWarning = linksetList->isShowCannotBeVolumeWarning(pLinksetUse); } } return isShowWarning; }
void LLFloaterPathfindingLinksets::doApplyEdit() { LLPathfindingObjectListPtr selectedObjects = getSelectedObjects(); if ((selectedObjects != NULL) && !selectedObjects->isEmpty()) { LLPathfindingLinkset::ELinksetUse linksetUse = getEditLinksetUse(); const std::string &aString = mEditA->getText(); const std::string &bString = mEditB->getText(); const std::string &cString = mEditC->getText(); const std::string &dString = mEditD->getText(); S32 aValue = static_cast<S32>(atoi(aString.c_str())); S32 bValue = static_cast<S32>(atoi(bString.c_str())); S32 cValue = static_cast<S32>(atoi(cString.c_str())); S32 dValue = static_cast<S32>(atoi(dString.c_str())); requestSetLinksets(selectedObjects, linksetUse, aValue, bValue, cValue, dValue); } }
void LLFloaterPathfindingLinksets::updateStateOnEditLinksetUse() { BOOL useWalkable = FALSE; BOOL useStaticObstacle = FALSE; BOOL useDynamicObstacle = FALSE; BOOL useMaterialVolume = FALSE; BOOL useExclusionVolume = FALSE; BOOL useDynamicPhantom = FALSE; LLPathfindingObjectListPtr selectedObjects = getSelectedObjects(); if ((selectedObjects != NULL) && !selectedObjects->isEmpty()) { const LLPathfindingLinksetList *linksetList = dynamic_cast<const LLPathfindingLinksetList *>(selectedObjects.get()); linksetList->determinePossibleStates(useWalkable, useStaticObstacle, useDynamicObstacle, useMaterialVolume, useExclusionVolume, useDynamicPhantom); } mEditLinksetUseWalkable->setEnabled(useWalkable); mEditLinksetUseStaticObstacle->setEnabled(useStaticObstacle); mEditLinksetUseDynamicObstacle->setEnabled(useDynamicObstacle); mEditLinksetUseMaterialVolume->setEnabled(useMaterialVolume); mEditLinksetUseExclusionVolume->setEnabled(useExclusionVolume); mEditLinksetUseDynamicPhantom->setEnabled(useDynamicPhantom); }