Esempio n. 1
0
 def __init__(s, i18n, parent, char, clip, sendRunClip, refresh):
     s.wrapper = cmds.columnLayout(adj=True, bgc=[0.18,0.18,0.18], p=parent) # Main block
     s.i18n = i18n
     s.char = char
     s.clip = clip
     s.name = clip.metadata.get("name", "CLIP").title()
     length = clip.metadata.get("length", None)
     if length is not None:
         s.name = "%s - %s" % (s.name, length)
     s.thumbs = list(clip.thumbs) if clip.thumbs else ["savePaintSnapshot.png"]
     s.thumbs.reverse()
     s.index = 0
     s.imgbtn = cmds.iconTextButton(
         ann=i18n["clips.addClip"],
         style="iconOnly",#"iconAndTextVertical",
         image=s.thumbs[-1],
         c=lambda: warn.run(sendRunClip, char, clip)
         )
     s.label = cmds.text(l=s.name, h=20)
     cmds.popupMenu(p=s.imgbtn)
     cmds.menuItem(l=s.name, en=False, itl=True)
     cmds.menuItem(l=i18n["clips.ignoreSel"], c=lambda x: warn.run(sendRunClip, char, clip, ignore=True))
     cmds.menuItem(ob=True, obi="channelBoxMedium.png")
     cmds.menuItem(l=i18n["clips.includeSel"], c=lambda x: warn.run(sendRunClip, char, clip, include=True))
     cmds.menuItem(ob=True, obi="channelBoxSlow.png")
     cmds.menuItem(d=True)
     cmds.menuItem(l=i18n["clips.renameClip"], c=lambda x: s.rename(char, clip))
     cmds.menuItem(ob=True, obi="pencilCursor.png")
     cmds.menuItem(l=i18n["clips.deleteClip"], c=lambda x: s.delete())
     cmds.menuItem(ob=True, obi="SP_TrashIcon.png")
Esempio n. 2
0
    def __init__(s, i18n, char, requestRetarget, requestObjects, sendNewObj, sendAttributeChange, sendObjDelete, sendRefresh):
        s.i18n = i18n
        s.char = char
        s.requestObjects = requestObjects
        s.sendNewObj = sendNewObj
        s.sendAttributeChange = sendAttributeChange
        s.sendObjDelete = sendObjDelete
        name = s.char.metadata["name"].title()

        s.objClose = {} # Close state of obj
        s.filterBox = {} # Storing filter bloxes for dynamic updates

        winName = "CharacterEditWin"
        if cmds.window(winName, ex=True): cmds.deleteUI(winName)
        s.window = cmds.window(t="%s :: %s" % (s.i18n["characterEdit.title"], name), rtf=True, s=False)
        cmds.columnLayout(adj=True)
        # Title
        cmds.text(l="<h1>%s</h1>" % name)
        # Top button
        cmds.rowLayout(nc=2)
        cmds.iconTextButton(
            l=s.i18n["characterEdit.addBtn"],
            image="selectByObject.png",
            style="iconAndTextHorizontal",
            c=lambda: s.refresh(warn.run(s.sendNewObj, s.char))
        )
        cmds.iconTextButton(
            l=s.i18n["characterEdit.retargetBtn"],
            image="geometryToBoundingBox.png",
            style="iconAndTextHorizontal",
            c=lambda: (warn.run(requestRetarget, s.char), cmds.deleteUI(s.window))
        )
        cmds.setParent("..")
        cmds.separator()
        # row = cmds.rowLayout(nc=3, adj=2)
        row = cmds.paneLayout(cn="vertical2")
        # Begin Filters
        cmds.columnLayout(adj=True)
        cmds.text(l=i18n["characterEdit.filter"])
        s.filterWrapper = cmds.scrollLayout(h=400, cr=True, bgc=[0.2,0.2,0.2])
        # Begin Objects
        cmds.columnLayout(w=400, p=row)
        cmds.text(l=i18n["characterEdit.attrs"])
        s.objWrapper = cmds.scrollLayout(h=400, w=400, cr=True, bgc=[0.2,0.2,0.2])
        cmds.showWindow(s.window)
        cmds.scriptJob(uid=[s.window, s.save], ro=True)
        s.refresh()
Esempio n. 3
0
 def addAttrFilter(s, attr, value):
     s.filterBox[attr] = cmds.checkBox(
         l=attr,
         v=value,
         p=s.filterWrapper,
         # ofc=lambda x: warn.run(s.refresh, s.sendAttributeChange(s.char, x, attr))
         cc=lambda x: warn.run(s.refresh, s.sendAttributeChange(s.char, x, attr))
     )
Esempio n. 4
0
    def __init__(s, i18n, char, requestCharEdit, requestClipEdit, sendRunClip):
        s.i18n = i18n
        s.char = char
        s.requestClipEdit = requestClipEdit # We're asking to edit the clip
        s.sendRunClip = sendRunClip # User wants to place the clip
        s.clips = [] # Init clips!
        name = s.char.metadata.get("name", "CLips").title()

        if not char.data: # Does the character contain nothing?
            with warn:
                requestCharEdit(char, s.refresh)

        s.winName = "%sWin" % name
        if cmds.window(s.winName, ex=True):
            cmds.deleteUI(s.winName)
        s.window = cmds.window(s.winName, rtf=True, s=False, t="%s %s" % (name, i18n["clips.title"]))
        cmds.columnLayout(adj=True)
        cmds.rowLayout(nc=2, adj=2) # Open Row
        cmds.iconTextButton(
            ann=i18n["clips.editChar"],
            style="iconOnly",
            font="boldLabelFont",
            image="goToBindPose.png",
            h=50,
            w=50,
            bgc=[0.3,0.3,0.3],
            c=lambda: requestCharEdit(s.char, s.refresh)
        )
        cmds.text(
            l="<h1>%s</h1>" % name,
            hl=True,
            h=50
            )
        cmds.setParent("..") # Close row
        cmds.columnLayout(adj=True) # Open Col
        cmds.button(
            l=i18n["clips.newClip"],
            h=50,
            c=lambda x: warn.run(requestClipEdit, s.char, s.refresh)
            )
        cmds.setParent("..") # Close row
        cmds.floatSlider(
            min=50,
            max=200,
            v=100,
            dc=s.sizeClips,
            h=20
            )
        cmds.separator()
        cmds.frameLayout(l=i18n["clips.moreInfo"], font="tinyBoldLabelFont")
        cmds.scrollLayout(cr=True, bgc=[0.2,0.2,0.2], h=400)
        s.wrapper = cmds.gridLayout(w=400, cwh=[100, 120], cr=True, aec=False)
        cmds.setParent("..") # Close grid
        cmds.setParent("..") # Close Scroll
        cmds.separator()
        cmds.showWindow(s.window)
        cmds.scriptJob(uid=[s.window, s.cleanup], ro=True)
        s.refresh()
Esempio n. 5
0
 def addItem(name, path, folder=False):
     cmds.iconTextButton(
         l=name.title(),
         style="iconAndTextHorizontal",
         font="boldLabelFont",
         image="SP_DirClosedIcon.png" if folder else "polyColorSetEditor.png",
         h=40,
         bgc=[0.22,0.22,0.22] if folder else [0.2,0.2,0.2],
         c=lambda: warn.run(s.openFolder if folder else s.sendOpen, path)
     )
Esempio n. 6
0
 def addAttr(s, val, attr, obj, parent):
     def boxChange(attr, val):
         s.sendAttributeChange(s.char, val, attr, obj)
         if val: cmds.checkBox(s.filterBox[attr], e=True, v=True)
     cmds.checkBox(
         l=attr,
         v=val,
         cc=lambda x: warn.run(boxChange, attr, x),
         p=parent
         )
Esempio n. 7
0
 def addItem(name, path, folder=False):
     cmds.iconTextButton(
         l=name.title(),
         style="iconAndTextHorizontal",
         font="boldLabelFont",
         image="SP_DirClosedIcon.png"
         if folder else "polyColorSetEditor.png",
         h=40,
         bgc=[0.22, 0.22, 0.22] if folder else [0.2, 0.2, 0.2],
         c=lambda: warn.run(s.openFolder
                            if folder else s.sendOpen, path))
Esempio n. 8
0
 def __init__(s, i18n, parent, char, clip, sendRunClip, refresh):
     s.wrapper = cmds.columnLayout(adj=True,
                                   bgc=[0.18, 0.18, 0.18],
                                   p=parent)  # Main block
     s.i18n = i18n
     s.char = char
     s.clip = clip
     s.name = clip.metadata.get("name", "CLIP").title()
     length = clip.metadata.get("length", None)
     if length is not None:
         s.name = "%s - %s" % (s.name, length)
     s.thumbs = list(
         clip.thumbs) if clip.thumbs else ["savePaintSnapshot.png"]
     s.thumbs.reverse()
     s.index = 0
     s.imgbtn = cmds.iconTextButton(
         ann=i18n["clips.addClip"],
         style="iconOnly",  #"iconAndTextVertical",
         image=s.thumbs[-1],
         c=lambda: warn.run(sendRunClip, char, clip))
     s.label = cmds.text(l=s.name, h=20)
     cmds.popupMenu(p=s.imgbtn)
     cmds.menuItem(l=s.name, en=False, itl=True)
     cmds.menuItem(
         l=i18n["clips.ignoreSel"],
         c=lambda x: warn.run(sendRunClip, char, clip, ignore=True))
     cmds.menuItem(ob=True, obi="channelBoxMedium.png")
     cmds.menuItem(
         l=i18n["clips.includeSel"],
         c=lambda x: warn.run(sendRunClip, char, clip, include=True))
     cmds.menuItem(ob=True, obi="channelBoxSlow.png")
     cmds.menuItem(d=True)
     cmds.menuItem(l=i18n["clips.renameClip"],
                   c=lambda x: s.rename(char, clip))
     cmds.menuItem(ob=True, obi="pencilCursor.png")
     cmds.menuItem(l=i18n["clips.deleteClip"], c=lambda x: s.delete())
     cmds.menuItem(ob=True, obi="SP_TrashIcon.png")
Esempio n. 9
0
 def addObj(s, obj):
     def changeObj(obj, val):
         s.objClose[obj] = val
     s.objClose[obj] = s.objClose.get(obj, True)
     row = cmds.rowLayout(nc=3, adj=2, p=s.objWrapper)
     # ICON
     cmds.iconTextButton(
         l="",
         style="iconOnly",
         image="cube.png",
         h=20,
         w=20,
         # c=warn.run(cmds.select, obj, r=True),
         p=row
     )
     # OBJECT
     attrPoint = cmds.frameLayout(
         l=obj,
         cll=True,
         cl=s.objClose[obj],
         cc=lambda: warn.run(changeObj, obj, True),
         ec=lambda: warn.run(changeObj, obj, False),
         bgc=[0.3,0.3,0.3],
         p=row
         )
     # DELETE BUTTON
     cmds.iconTextButton(
         ann=s.i18n["characterEdit.delDesc"],
         image="removeRenderable.png",
         style="iconOnly",
         h=20,
         w=20,
         p=row,
         c=lambda: warn.run(s.refresh, s.askDeleteObj(obj))
     )
     return attrPoint
Esempio n. 10
0
    def __init__(s, i18n, char, requestCharEdit, requestClipEdit, sendRunClip):
        s.i18n = i18n
        s.char = char
        s.requestClipEdit = requestClipEdit  # We're asking to edit the clip
        s.sendRunClip = sendRunClip  # User wants to place the clip
        s.clips = []  # Init clips!
        name = s.char.metadata.get("name", "CLips").title()

        if not char.data:  # Does the character contain nothing?
            with warn:
                requestCharEdit(char, s.refresh)

        s.winName = "%sWin" % name
        if cmds.window(s.winName, ex=True):
            cmds.deleteUI(s.winName)
        s.window = cmds.window(s.winName,
                               rtf=True,
                               s=False,
                               t="%s %s" % (name, i18n["clips.title"]))
        cmds.columnLayout(adj=True)
        cmds.rowLayout(nc=2, adj=2)  # Open Row
        cmds.iconTextButton(ann=i18n["clips.editChar"],
                            style="iconOnly",
                            font="boldLabelFont",
                            image="goToBindPose.png",
                            h=50,
                            w=50,
                            bgc=[0.3, 0.3, 0.3],
                            c=lambda: requestCharEdit(s.char, s.refresh))
        cmds.text(l="<h1>%s</h1>" % name, hl=True, h=50)
        cmds.setParent("..")  # Close row
        cmds.columnLayout(adj=True)  # Open Col
        cmds.button(l=i18n["clips.newClip"],
                    h=50,
                    c=lambda x: warn.run(requestClipEdit, s.char, s.refresh))
        cmds.setParent("..")  # Close row
        cmds.floatSlider(min=50, max=200, v=100, dc=s.sizeClips, h=20)
        cmds.separator()
        cmds.frameLayout(l=i18n["clips.moreInfo"], font="tinyBoldLabelFont")
        cmds.scrollLayout(cr=True, bgc=[0.2, 0.2, 0.2], h=400)
        s.wrapper = cmds.gridLayout(w=400, cwh=[100, 120], cr=True, aec=False)
        cmds.setParent("..")  # Close grid
        cmds.setParent("..")  # Close Scroll
        cmds.separator()
        cmds.showWindow(s.window)
        cmds.scriptJob(uid=[s.window, s.cleanup], ro=True)
        s.refresh()
Esempio n. 11
0
 def addPair(s, item, func):
     row = cmds.rowLayout(nc=3,
                          adj=2,
                          cw2=[s.colWidth, s.colWidth],
                          p=s.wrapper)
     # FROM COLUMN!
     cmds.text(
         ann=s.i18n["characterRetarget.fromDesc"],
         l=item,
         h=s.rowHeight,
         w=s.colWidth,
         bgc=[0.3, 0.3, 0.3],
     )
     cmds.text(
         l="  >  ",
         h=s.rowHeight,
     )
     btn = cmds.button(
         ann=s.i18n["characterRetarget.toDesc"],
         l=item,
         h=s.rowHeight,
         c=lambda x: warn.run(func, item, btn),
         w=s.colWidth,
     )
Esempio n. 12
0
    def __init__(s, i18n, char, requestEdit, requestObjects, sendRetarget):
        s.i18n = i18n
        s.char = char
        s.requestObjects = requestObjects
        s.sendRetarget = sendRetarget
        name = s.char.metadata["name"].title()

        s.colWidth = 300
        s.rowHeight = 25
        s.allItems = set()
        s.values = dd(str)

        winName = "CharacterEditWin"
        if cmds.window(winName, ex=True): cmds.deleteUI(winName)
        s.window = cmds.window(s=False,
                               t="%s :: %s" %
                               (s.i18n["characterRetarget.title"], name),
                               rtf=True)
        mainLayout = cmds.columnLayout(adj=True)
        # Title
        cmds.text(l="<h1>%s</h1>" % name)
        # Top button
        cmds.iconTextButton(l=s.i18n["characterRetarget.return"],
                            image="goToBindPose.png",
                            style="iconAndTextHorizontal",
                            c=lambda:
                            (warn.run(requestEdit, s.char, lambda: None),
                             cmds.deleteUI(s.window)))
        frameLay = cmds.frameLayout(cll=True,
                                    l="Replace in bulk",
                                    p=mainLayout)
        rowLayout = cmds.rowLayout(nc=3, adj=2)
        cmds.columnLayout(adj=True, p=rowLayout)
        cmds.text(l=s.i18n["characterRetarget.search"],
                  w=s.colWidth,
                  h=s.rowHeight)
        cmds.textFieldGrp(adj=1,
                          w=s.colWidth,
                          h=s.rowHeight,
                          tcc=lambda x: s.updateValue("search", x))
        cmds.columnLayout(adj=True, p=rowLayout)
        cmds.text(l="  >  ")
        cmds.columnLayout(adj=True, p=rowLayout)
        cmds.text(l=s.i18n["characterRetarget.replace"],
                  w=s.colWidth,
                  h=s.rowHeight)
        cmds.textFieldGrp(adj=1,
                          w=s.colWidth,
                          h=s.rowHeight,
                          tcc=lambda x: s.updateValue("replace", x))
        cmds.rowLayout(nc=2, adj=2, p=frameLay)
        cmds.checkBox(l=s.i18n["characterRetarget.regex"],
                      h=s.rowHeight,
                      cc=lambda x: s.updateValue("regex", x))
        cmds.button(l=s.i18n["characterRetarget.replace"],
                    h=s.rowHeight,
                    c=lambda x: warn.run(s.strReplace))
        col2 = cmds.frameLayout(cll=True,
                                l="Replace individually",
                                p=mainLayout)
        cmds.rowLayout(nc=3, adj=2)
        cmds.text(l=i18n["characterRetarget.from"], w=s.colWidth)
        cmds.text(l="  >  ", h=s.rowHeight)
        cmds.text(l=i18n["characterRetarget.to"], w=s.colWidth)
        cmds.setParent("..")
        cmds.scrollLayout(h=400, w=s.colWidth * 2, bgc=[0.2, 0.2, 0.2])
        s.wrapper = cmds.columnLayout(adj=True)
        cmds.showWindow(s.window)
        cmds.scriptJob(uid=[s.window, s.save], ro=True)
        s.refresh()