/// <summary> /// /// </summary> /// <param name="args">order: windowName, lineIndex , buttonIndex</param> public override void doIt(MArgList args) { //Debug.Log("at least do it...."); if (args.length != 3) { //Debug.Log("param count error:" + args.length); return; } string wName = args.asString(0); int lineIndex = args.asInt(1); int buttonIndex = args.asInt(2); //Debug.Log("name:" + wName + ",line:" + lineIndex + ",btn:" + buttonIndex); BasicWindow.ExcuteInDic(wName, lineIndex, buttonIndex); }
public override void doIt(MArgList args) { // Command line argument specifies type of primitive to create // shapeFlag = 1; if (args.length > 0) { shapeFlag = args.asInt(0); } // Create the mesh and its transform. try { createNodes(); } catch (System.Exception) { // If the creation failed, clean up any partial changes made. dagMod.undoIt(); throw; //Rethrow the same exception } return; }
void parseArgs(MArgList args) { createdUsed = (args.flagIndex(kCreateFlag, kCreateFlagLong) != MArgList.kInvalidArgIndex); editUsed = (args.flagIndex(kEditFlag, kEditFlagLong) != MArgList.kInvalidArgIndex); queryUsed = (args.flagIndex(kQueryFlag, kQueryFlagLong) != MArgList.kInvalidArgIndex); helpUsed = (args.flagIndex(kHelpFlag, kHelpFlagLong) != MArgList.kInvalidArgIndex); numLayersUsed = (args.flagIndex(kNumLayersFlag, kNumLayersFlagLong) != MArgList.kInvalidArgIndex); // If flags are used which require no other information, return now. // if (createdUsed || helpUsed) return; uint maxArg = args.length - 1; uint activeIndex = args.flagIndex(kActiveFlag, kActiveFlagLong); uint appendCameraIndex = args.flagIndex(kAppendCameraFlag, kAppendCameraFlagLong); uint appendCameraAndSetIndex = args.flagIndex(kAppendCameraAndSetFlag, kAppendCameraAndSetFlagLong); uint cameraIndex = args.flagIndex(kCameraFlag, kCameraFlagLong); uint deleteLayerIndex = args.flagIndex(kDeleteLayerFlag, kDeleteLayerFlagLong); uint layerIndex = args.flagIndex(kLayerFlag, kLayerFlagLong); uint layerTypeIndex = args.flagIndex(kLayerTypeFlag, kLayerTypeFlagLong); uint setIndex = args.flagIndex(kSetFlag, kSetFlagLong); activeUsed = (activeIndex != MArgList.kInvalidArgIndex); appendCameraUsed = (appendCameraIndex != MArgList.kInvalidArgIndex); appendCameraAndSetUsed = (appendCameraAndSetIndex != MArgList.kInvalidArgIndex); cameraUsed = (cameraIndex != MArgList.kInvalidArgIndex); deleteLayerUsed = (deleteLayerIndex != MArgList.kInvalidArgIndex); layerUsed = (layerIndex != MArgList.kInvalidArgIndex); layerTypeUsed = (layerTypeIndex != MArgList.kInvalidArgIndex); setUsed = (setIndex != MArgList.kInvalidArgIndex); // Process each flag. // bool maxArgUsed = false; if (activeUsed) { if (editUsed) { activeVal = args.asBool((activeIndex + 1)); if ((layerTypeIndex + 1) == maxArg) maxArgUsed = true; } } if (appendCameraUsed) { camName = args.asString((appendCameraIndex + 1)); if ((appendCameraIndex + 1) == maxArg) maxArgUsed = true; } if (appendCameraAndSetUsed) { camName = args.asString((appendCameraAndSetIndex + 1)); setName = args.asString((appendCameraAndSetIndex + 2)); if ((appendCameraAndSetIndex + 2) == maxArg) maxArgUsed = true; } if (cameraUsed) { if (editUsed) { camName = args.asString(cameraIndex + 1); if ((cameraIndex + 1) == maxArg) maxArgUsed = true; } } if (deleteLayerUsed) { cameraLayer = args.asInt(deleteLayerIndex + 1); if ((deleteLayerIndex + 1) == maxArg) maxArgUsed = true; } if (layerUsed) { cameraLayer = args.asInt(layerIndex + 1); if ((layerIndex + 1) == maxArg) maxArgUsed = true; } if (layerTypeUsed) { if (editUsed) { layerTypeVal = args.asString(layerTypeIndex + 1); if ((layerTypeIndex + 1) == maxArg) maxArgUsed = true; } } if (setUsed) { if (editUsed) { setName = args.asString(setIndex + 1); if ((setIndex + 1) == maxArg) maxArgUsed = true; } } // If all of the arguments have been used, get the cameraSet node from the selection list. // Otherwise, get it from the last argument. // if (maxArgUsed) MGlobal.getActiveSelectionList(list); else list.add(args.asString(maxArg)); }
void parseArgs(MArgList args) { createdUsed = (args.flagIndex(kCreateFlag, kCreateFlagLong) != MArgList.kInvalidArgIndex); editUsed = (args.flagIndex(kEditFlag, kEditFlagLong) != MArgList.kInvalidArgIndex); queryUsed = (args.flagIndex(kQueryFlag, kQueryFlagLong) != MArgList.kInvalidArgIndex); helpUsed = (args.flagIndex(kHelpFlag, kHelpFlagLong) != MArgList.kInvalidArgIndex); numLayersUsed = (args.flagIndex(kNumLayersFlag, kNumLayersFlagLong) != MArgList.kInvalidArgIndex); // If flags are used which require no other information, return now. // if (createdUsed || helpUsed) { return; } uint maxArg = args.length - 1; uint activeIndex = args.flagIndex(kActiveFlag, kActiveFlagLong); uint appendCameraIndex = args.flagIndex(kAppendCameraFlag, kAppendCameraFlagLong); uint appendCameraAndSetIndex = args.flagIndex(kAppendCameraAndSetFlag, kAppendCameraAndSetFlagLong); uint cameraIndex = args.flagIndex(kCameraFlag, kCameraFlagLong); uint deleteLayerIndex = args.flagIndex(kDeleteLayerFlag, kDeleteLayerFlagLong); uint layerIndex = args.flagIndex(kLayerFlag, kLayerFlagLong); uint layerTypeIndex = args.flagIndex(kLayerTypeFlag, kLayerTypeFlagLong); uint setIndex = args.flagIndex(kSetFlag, kSetFlagLong); activeUsed = (activeIndex != MArgList.kInvalidArgIndex); appendCameraUsed = (appendCameraIndex != MArgList.kInvalidArgIndex); appendCameraAndSetUsed = (appendCameraAndSetIndex != MArgList.kInvalidArgIndex); cameraUsed = (cameraIndex != MArgList.kInvalidArgIndex); deleteLayerUsed = (deleteLayerIndex != MArgList.kInvalidArgIndex); layerUsed = (layerIndex != MArgList.kInvalidArgIndex); layerTypeUsed = (layerTypeIndex != MArgList.kInvalidArgIndex); setUsed = (setIndex != MArgList.kInvalidArgIndex); // Process each flag. // bool maxArgUsed = false; if (activeUsed) { if (editUsed) { activeVal = args.asBool((activeIndex + 1)); if ((layerTypeIndex + 1) == maxArg) { maxArgUsed = true; } } } if (appendCameraUsed) { camName = args.asString((appendCameraIndex + 1)); if ((appendCameraIndex + 1) == maxArg) { maxArgUsed = true; } } if (appendCameraAndSetUsed) { camName = args.asString((appendCameraAndSetIndex + 1)); setName = args.asString((appendCameraAndSetIndex + 2)); if ((appendCameraAndSetIndex + 2) == maxArg) { maxArgUsed = true; } } if (cameraUsed) { if (editUsed) { camName = args.asString(cameraIndex + 1); if ((cameraIndex + 1) == maxArg) { maxArgUsed = true; } } } if (deleteLayerUsed) { cameraLayer = args.asInt(deleteLayerIndex + 1); if ((deleteLayerIndex + 1) == maxArg) { maxArgUsed = true; } } if (layerUsed) { cameraLayer = args.asInt(layerIndex + 1); if ((layerIndex + 1) == maxArg) { maxArgUsed = true; } } if (layerTypeUsed) { if (editUsed) { layerTypeVal = args.asString(layerTypeIndex + 1); if ((layerTypeIndex + 1) == maxArg) { maxArgUsed = true; } } } if (setUsed) { if (editUsed) { setName = args.asString(setIndex + 1); if ((setIndex + 1) == maxArg) { maxArgUsed = true; } } } // If all of the arguments have been used, get the cameraSet node from the selection list. // Otherwise, get it from the last argument. // if (maxArgUsed) { MGlobal.getActiveSelectionList(list); } else { list.add(args.asString(maxArg)); } }
public override void doIt(MArgList args) { // Command line argument specifies type of primitive to create // shapeFlag = 1; if (args.length > 0) shapeFlag = args.asInt(0); // Create the mesh and its transform. try { createNodes(); } catch (System.Exception) { // If the creation failed, clean up any partial changes made. dagMod.undoIt(); throw;//Rethrow the same exception } return; }