def gear_GuideToolsUI_import_OnClicked(): if not os.path.exists(PPG.templateList.Value): return parent = xsi.Selection(0) if parent is not None and not parent.IsClassOf(c.siX3DObjectID): gear.log("Invalid Parent Selected", gear.sev_error) return if parent is not None: if parent.Type == "#model": target_model = parent else: target_model = parent.Model if not target_model.Properties("options"): gear.log("Invalid Parent Selected", gear.sev_error) return # import guide rg = RigGuide() model = rg.importFromXml(PPG.templateList.Value) if parent is not None: for child in model.children: if child.Name not in ["controlers_org"]: parent.AddChild(child) for group in model.Groups: if target_model.Groups(group.Name): target_model.Groups(group.Name).AddMember(group.Members) xsi.DeleteObj(model)
def gear_GuideToolsUI_duplicateSym_OnClicked(): if not xsi.Selection.Count: gear.log("No selection", gear.sev_error) return selection = XSIFactory.CreateObject("XSI.Collection") selection.AddItems(xsi.Selection) rtn = XSIFactory.CreateObject("XSI.Collection") for sel in selection: if sel.IsClassOf(c.siX3DObjectID) and sel.Properties("settings"): rg = RigGuide() root = rg.duplicate(sel, True) if root: rtn.Add(root) else: gear.log("This object was skipped : " + sel.FullName, gear.sev_warning) if rtn.Count: xsi.SelectObj(rtn) return
def gear_ImportGuide_Execute(): path = uit.fileBrowser("Import Guide", xsi.ActiveProject2.OriginPath, "", ["xml"], False) if not path: return rg = RigGuide() rg.importFromXml(path)
def gear_GuideToolsUI_draw_OnClicked(): if not PPG.componentList.Value: gear.log("There is no component selected in the list", gear.sev_error) return compType = PPG.componentList.Value rg = RigGuide() g = rg.drawNewComponent(xsi.Selection(0), compType)
def __init__(self): self.guide = RigGuide() ## Dictionary of component.\n # Keys are the component fullname (ie. 'arm_L0') self.components = {} self.componentsIndex = [] ## Dictionary of Groups. self.groups = {} self.addToGroup(None, ["hidden", "unselectable", "deformers", "geometries"]) self.plog = uit.ProgressLog(True, False)
def gear_ExportGuide_Execute(): if not xsi.Selection.Count: xsi.LogMessage("Select an object from the guide to export", c.siError) return if xsi.Selection(0).Type == "#model": model = xsi.Selection(0) else: model = xsi.Selection(0).Model options = model.Properties("options") if not options: gear.log("Invalid selection", gear.sev_error) return path = uit.fileBrowser("Export Guide", xsi.ActiveProject2.OriginPath, model.Name, ["xml"], True) if not path: return rg = RigGuide() rg.exportToXml(xsi.Selection(0), path)
def gear_GuideToolsUI_export_OnClicked(): if not xsi.Selection.Count: xsi.LogMessage("Select an object from the guide to export", c.siError) return if xsi.Selection(0).Type == "#model": model = xsi.Selection(0) else: model = xsi.Selection(0).Model options = model.Properties("options") if not options: gear.log("Invalid selection", gear.sev_error) return path = uit.fileBrowser("Export Guide", TEMPLATE_PATH, model.Name, ["xml"], True) if not path: return rg = RigGuide() rg.exportToXml(xsi.Selection(0), path) gear_GuideToolsUI_OnInit()
def gear_UpdateGuide_Execute(): rg = RigGuide() rg.update(xsi.Selection(0))