def highlight(obj, branch=True): # save selection in order to retrieve it at the end selection = XSIFactory.CreateObject("XSI.Collection") selection.AddItems(xsi.Selection) pref = xsi.Dictionary.GetObject("Preferences") scene_color = dynDispatch(pref.NestedObjects("Scene Colors")) sel_color = scene_color.Parameters("selcol") inh_color = scene_color.Parameters("inhcol") selColor_value = sel_color.Value inhColor_value = inh_color.Value sel_color.Value = 16712703 inh_color.Value = 16712703 if branch: mode = "BRANCH" else: mode = "ASITIS" xsi.SelectObj(obj, mode) xsi.Refresh() time.sleep(.2) sel_color.Value = selColor_value inh_color.Value = inhColor_value # Retrieve selection xsi.SelectObj(selection)
def toggleGroupVisibility(group): prop = group.Properties("Visibility") if prop: param = prop.Parameters("viewvis") group.Parameters("viewvis").Value = 2 param.Value = not param.Value else: if group.Parameters("viewvis").Value == 0: group.Parameters("viewvis").Value = 2 else: group.Parameters("viewvis").Value = 0 xsi.Refresh()
def processComponents(self): import gear.xsi.rig.component as comp self.plog.reset(len(self.guides), 1) # Init self.components_infos = {} for guide in self.guides.values(): self.plog.log("Init", guide.fullName + " (" + guide.type + ")", True) module_name = "gear.xsi.rig.component." + guide.type module = __import__(module_name, globals(), locals(), ["*"], -1) Component = getattr(module, "Component") component = Component(self, guide) if component.fullName not in self.componentsIndex: self.components[component.fullName] = component self.componentsIndex.append(component.fullName) self.components_infos[component.fullName] = [ guide.compType, guide.getVersion(), guide.author ] par.setDataGridFromDict(self.components_grid, self.components_infos) # Creation steps self.steps = MainComponent.steps self.plog.reset(len(self.guides) * self.options["step"] + 1, 1) for i, name in enumerate(self.steps): for count, compName in enumerate(self.componentsIndex): component = self.components[compName] self.plog.log(name, component.fullName + " (" + component.type + ")", True) component.stepMethods[i]() xsi.Refresh() if self.options["step"] >= 0 and i >= self.options["step"]: break