public static MSelectionList GetObjectsByName(string name) { MSelectionList matched = new MSelectionList(); MGlobal.getSelectionListByName(name, matched); //Debug.Log("ask if [" + name + "] exist,result count:" + matched.length); return(matched); }
static private void createIK2BsolverAfterOpen(object sender, MBasicFunctionArgs arg) // This method creates the ik2Bsolver after a File->Open // if the ik2Bsolver does not exist in the loaded file. // { MSelectionList selList = new MSelectionList(); MGlobal.getSelectionListByName("ik2BsolverCSharp", selList); if (selList.length == 0) { MGlobal.getActiveSelectionList(selList); MGlobal.executeCommand("createNode -n ik2BsolverCSharp ik2BsolverCSharp"); MGlobal.setActiveSelectionList(selList); } }