예제 #1
0
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)
예제 #2
0
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
예제 #3
0
def gear_ImportGuide_Execute():

    path = uit.fileBrowser("Import Guide", xsi.ActiveProject2.OriginPath, "", ["xml"], False)
    if not path:
        return

    rg = RigGuide()
    rg.importFromXml(path)
예제 #4
0
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)
예제 #5
0
    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)
예제 #6
0
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)
예제 #7
0
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()
예제 #8
0
def gear_UpdateGuide_Execute():

    rg = RigGuide()
    rg.update(xsi.Selection(0))