def follicleUI(*args):
"""UI for the script"""
if cmds.window("folWin", exists=True):
cmds.deleteUI("folWin")
widgets["win"] = cmds.window("folWin", t="zbw_makeFollicle", w=300, h=100)
widgets["mainCLO"] = cmds.columnLayout()
# widgets["polyFrame"] = cmds.frameLayout(l="Polygon Vert(s) Follicle")
# widgets["polyCLO"] = cmds.columnLayout()
widgets["text"] = cmds.text("Select one or two vertices (2 will get avg position) and run")
widgets["nameTFG"] = cmds.textFieldGrp(l="FollicleName:", cal=([1, "left"],[2,"left"]), cw=([1,100],[2,200]), tx="follicle")
cmds.separator(h=10)
widgets["button"] = cmds.button(w=300, h=50, bgc=(0.6,.8,.6), l="Add follicle to vert(s)", c=getUV)
# cmds.setParent(widgets["mainCLO"])
# widgets["nurbsFrame"] = cmds.frameLayout(l="Nurbs select")
cmds.showWindow(widgets["win"])
cmds.window(widgets["win"], e=True, w=300, h=100)
#-------could also select edit point????
#-------multiple selection and average uv position? Orrrr option to create multiple UV's, one on each vertex
#-------grab an edge and convert to 2 verts and get average. . .
#-------have option for distributed (select 2 verts and number of follicles, spread that num between the two uv positions)
python类frameLayout()的实例源码
def finish(self):
'''
Finalize the UI
'''
mc.setParent(self.form)
frame = mc.frameLayout(labelVisible=False)
mc.helpLine()
mc.formLayout( self.form, edit=True,
attachForm=((self.column, 'top', 0), (self.column, 'left', 0),
(self.column, 'right', 0), (frame, 'left', 0),
(frame, 'bottom', 0), (frame, 'right', 0)),
attachNone=((self.column, 'bottom'), (frame, 'top')) )
mc.showWindow(self.name)
mc.window(self.name, edit=True, width=self.width, height=self.height)
NinjaRipperMayaImportTools.py 文件源码
项目:NinjaRipperMayaImportTools
作者: T-Maxxx
项目源码
文件源码
阅读 24
收藏 0
点赞 0
评论 0
def changeVertexRecognition(isManual):
global VertexLayout
VertexLayout['autoMode'] = isManual is False
cmds.frameLayout('NR_VertexLayout_Position', edit=True, en=False)
cmds.frameLayout('NR_VertexLayout_Normal', edit=True, en=isManual)
cmds.frameLayout('NR_VertexLayout_TexCoord', edit=True, en=isManual)
def show(self):
u"""Window???"""
self.safe_delete_ui(RecentFileWindow._WINDOW_NAME)
cmds.window(RecentFileWindow._WINDOW_NAME, title=RecentFileWindow._WINDOW_TITLE)
cmds.frameLayout(label="RecentFiles",
marginWidth=6,
marginHeight=6,
borderStyle="etchedIn")
for file_path, file_type in get_recent_files().items():
cmds.button(label=file_path, c=partial(self._open_file, file_path, file_type))
cmds.showWindow(RecentFileWindow._WINDOW_NAME)
def spaceMatchUI():
if (cmds.window("spaceMatchWin", exists=True)):
cmds.deleteUI("spaceMatchWin", window=True)
#create window
widgets["window"] = cmds.window("spaceMatchWin", title="Space Matcher", w=250, h=300)
#create top frame
widgets["topFrame"] = cmds.frameLayout(l="Object/Attr Selection", w=250, li=70, bgc=(0,0,0))
widgets["objCLO"] = cmds.columnLayout()
#create top controls
widgets["objTFG"] = cmds.textFieldGrp(l="Selected Obj", cw=([1,70],[2,175]), cal=([1,"left"], [2,"left"]), cc=clearList)
widgets["matchObjButton"] = cmds.button(l="Select Control Object", w=250, bgc=(.8,.8,.8), c = getObj)
# #or we could assume the obj has a "follow" enum attr. . . .
# widgets["attrTFG"] = cmds.textFieldGrp(l="Selected Attr", cw=([1,70],[2,175]), cal=([1,"left"], [2,"left"]), cc=clearList)
# widgets["matchObjButton"] = cmds.button(l="Select Spaces Enum Attr", w=250, bgc=(.8,.8,.8), c = getAttr)
#back to window
cmds.setParent(widgets["window"])
#create bottom frmae
widgets["bottomFrame"] = cmds.frameLayout(l="Spaces", li=100, w=250, bgc=(0,0,0))
widgets["bottomRCLO"] = cmds.rowColumnLayout(nc=2, w=250)
#get obj and put it in
sel = cmds.ls(sl=True)
if (len(sel)) == 1:
getObj()
#show window
cmds.showWindow(widgets["window"])
cmds.window(widgets["window"], e=True, w=250, h=300)
def extendUI(*args):
"""UI for the script"""
#UI
if cmds.window("curbWin", exists=True):
cmds.deleteUI("curbWin")
cmds.window("curbWin", t="zbw_polyExtender", w=200, h=200)
cmds.columnLayout("colLO")
cmds.frameLayout("topFrame", l="Covert Edge", cll=True, bgc=(.2,.2,.2))
cmds.text("Select poly edge to convert")
cmds.button("convertBut", l="Convert!", w=200, h=30, bgc=(.8, .8,.6), c=convertEdge)
cmds.separator(h=5)
cmds.setParent("colLO")
cmds.frameLayout("midFrame", l="Create Poly", cll=True, bgc=(.2,.2,.2))
cmds.text("Select curve")
cmds.separator(h=5)
cmds.textFieldGrp("name", l="Name", w=200, cw=[(1,30), (2,170)], tx="newPoly")
cmds.checkBox("curbCB", l="Positive Direction", v=True)
# cmds.checkBox("bumpCB", l="Add vertical hump?", v=True)
cmds.floatFieldGrp("curbFFG", l="Curb Width", cal=((1, "left"),(2,"left")), cw=([1,75],[2,50]), v1=10)
cmds.intFieldGrp("UDivIFG", l="Width Subdivisions", cal=((1, "left"),(2,"left")), cw=([1,75],[2,50]), v1=1)
cmds.intFieldGrp("VDivIFG", l="Length Subdivisions", cal=((1, "left"),(2,"left")), cw=([1,75],[2,50]), v1=1)
cmds.checkBox("polyHistory", l="Keep history on final poly?", v=False)
cmds.checkBox("history", l="Keep history objects?", v=True, cc=enableHistory)
cmds.separator(h=5)
cmds.button("curbBut", l="Create Curb", h=40, w=200, bgc=(.6, .8, .6), c=extendPoly)
cmds.showWindow("curbWin")
cmds.window("curbWin", e=True, h=150, w=200)
def wireRigUI (*args):
if cmds.window("wireRigWin", exists = True):
cmds.deleteUI("wireRigWin")
widgets["win"] = cmds.window("wireRigWin", t="zbw_wireRig", w=300, h=250)
widgets["mainCLO"] = cmds.columnLayout()
widgets["topFLO"] = cmds.frameLayout(l="Convert Poly Edges",cll=True, cl=True)
widgets["topCLO"] = cmds.columnLayout()
widgets["convertBut"] = cmds.button(l="convert selected poly edge to curve", w=300, bgc = (.8,.8,0), c=convertEdge)
cmds.separator(h=20, style="single")
widgets["reverseBut"] = cmds.button(l="reverse direction of selected curve", w=300, bgc = (.8,.5,0), c=reverseCrv)
cmds.setParent(widgets["mainCLO"])
widgets["botFLO"] = cmds.frameLayout(l="Create Wire Rig", cll=True)
widgets["botCLO"] = cmds.columnLayout()
widgets["numCtrlIFG"] = cmds.intFieldGrp(l="Number of Ctrls:", v1=5, cal=[(1, "left"), (2, "left")], cw=[(1, 150),(3, 75)])
widgets["hierCBG"] = cmds.checkBoxGrp(ncb=1, l1 = "Put Ctrls in hierarchy?", v1=True, en=True)
widgets["nameTFG"] = cmds.textFieldGrp(l="Wire Rig Name:", w=300, tx="wireCtrl1", cal=[(1, "left")])
widgets["scaleFFG"] = cmds.floatFieldGrp(l="Control scale:", v1=1.0, cal=[(1, "left"), (2, "left")], cw=[(1, 150),(3, 75)])
cmds.separator(h=30, style="single")
widgets["textText"] = cmds.text("Select geo, then curve, then button below", al="center")
widgets["rigBut"] = cmds.button(l="Create Wire Rig", w= 300, h=40, bgc= (0, .5, 0), c=createWireDef)
cmds.showWindow(widgets["win"])
#option to pull curve from edges
def __init__(self):
name = 'cmt_orientjoints'
if cmds.window(name, exists=True):
cmds.deleteUI(name, window=True)
if cmds.windowPref(name, exists=True):
cmds.windowPref(name, remove=True)
self.window = cmds.window(name, title='CMT Orient Joints', widthHeight=(358, 330))
cmds.columnLayout(adjustableColumn=True)
margin_width = 4
cmds.frameLayout(bv=False, label='Quick Actions', collapsable=True, mw=margin_width)
cmds.gridLayout(numberOfColumns=2, cellWidthHeight=(175, 65))
cmds.button(label='Make Planar Orientation', command=self.make_planar)
cmds.button(label='Project to Planar Position', command=partial(make_position_planar))
cmds.button(label='Align Up With Child', command=self.align_with_child)
cmds.button(label='Zero Orient', command=self.zero_orient)
cmds.button(label='Orient to World', command=self.orient_to_world)
cmds.rowColumnLayout(numberOfColumns=4)
height = 20
label_width = 60
icon_left = 'nudgeLeft.png'
icon_right = 'nudgeRight.png'
cmds.text(label='Offset X', align='right', width=label_width)
cmds.iconTextButton(style='iconOnly', image1=icon_left, label='spotlight', h=height, w=height, c=partial(self.offset_orient_x, direction=-1))
self.offset_x = cmds.floatField(value=90.0)
cmds.iconTextButton(style='iconOnly', image1=icon_right, label='spotlight', h=height, w=height, c=partial(self.offset_orient_x, direction=1))
cmds.text(label='Offset Y', align='right', width=label_width)
cmds.iconTextButton(style='iconOnly', image1=icon_left, label='spotlight', h=height, w=height, c=partial(self.offset_orient_y, direction=-1))
self.offset_y = cmds.floatField(value=90.0)
cmds.iconTextButton(style='iconOnly', image1=icon_right, label='spotlight', h=height, w=height, c=partial(self.offset_orient_y, direction=1))
cmds.text(label='Offset Z', align='right', width=label_width)
cmds.iconTextButton(style='iconOnly', image1=icon_left, label='spotlight', h=height, w=height, c=partial(self.offset_orient_z, direction=-1))
self.offset_z = cmds.floatField(value=90.0)
cmds.iconTextButton(style='iconOnly', image1=icon_right, label='spotlight', h=height, w=height, c=partial(self.offset_orient_z, direction=1))
cmds.setParent('..')
cmds.setParent('..')
cmds.setParent('..')
cmds.frameLayout(bv=False, label='Manual Orient', collapsable=True, mw=margin_width)
cmds.columnLayout(adj=True)
cmds.rowLayout(numberOfColumns=2, cw2=(150, 150))
self.reorient_children = cmds.checkBox(label='Reorient children', value=True, align='left')
self.reset_orientation = cmds.checkBox(label='Reset orientation', value=True, align='left')
cmds.setParent('..')
cmds.gridLayout(numberOfColumns=2, cellWidthHeight=(175, 65))
cmds.button(label='Template Joints', command=partial(self.template_joints))
cmds.button(label='Rebuild Joints', command=partial(rebuild_joints))
cmds.setParent('..')
cmds.setParent('..')
cmds.setParent('..')
cmds.showWindow(self.window)
def spaceMatchUI():
if (cmds.window("spaceMatchWin", exists=True)):
cmds.deleteUI("spaceMatchWin", window=True)
widgets["window"] = cmds.window("spaceMatchWin", title="Space Matcher", w=250, h=300)
widgets["mainLO"] = cmds.columnLayout()
widgets["tabLO"] = cmds.tabLayout()
widgets["getObjCLO"] = cmds.columnLayout()
widgets["instruct"] = cmds.text("get obj, then attr, then space then do it")
cmds.separator(h=10)
#----------fill with selection automatically?
widgets["objTFG"] = cmds.textFieldGrp(l="select obj", cw=([1,50],[2,150],[3,50]), cal=([1,"left"], [2,"left"],[3,"left"]), cc=clearList)
widgets["matchObjButton"] = cmds.button(l="select object", c=partial(getObj, widgets["objTFG"]))
cmds.separator(h=10)
#-----------maybe here have it catch the selected obj by default
#-----------and/or have a field for the attribute (default to "follow")
widgets["getAttrButton"] = cmds.button(w=250, al="center", h=20, l="select enum space attr from obj", bgc= (.5, .5, 0), c=getAttr)
#-----------when the attr is selected list the attrs automagically,
widgets["spacesTSL"] = cmds.textScrollList(w=250, h=200, nr=8, ams=False, bgc=(.2, .2, .2))
widgets["matchButton"] = cmds.button(w=250, al="center", h=40, bgc= (0,.5,0), l="space switch/match", c= doSpaceMatch)
#tab for creation/setup of matching
cmds.setParent(widgets["tabLO"])
#----------in this tab, create frames. One (closable) to create constraint and fill items, check boxes for orient, position (with user selecting objects), one frame (maybe already filled out) (always open) for setting up attrs (message, strings)
widgets["setupCLO"] = cmds.columnLayout()
#frame layout for creating the constraints
widgets["createFrameLO"] = cmds.frameLayout(l="create Constrants", collapsable=True, w=250)
cmds.text("have em select for constraint")
widgets["posRotCBG"] = cmds.checkBoxGrp(ncb=2, l1="translation", v1=True, l2="rotation", v2=True)
#----------this button should just create the constraints on the objects in question, but then fill in what parts of the lower half it can
widgets["createSetupButton"] = cmds.button(l="create constraints")
cmds.setParent(widgets["setupCLO"])
#frameLayout for setting up the attrs
widgets["setupFrameLO"] = cmds.frameLayout(l="setup matching", collapsable=False, w=250, h=250)
widgets["setupObjTFG"] = cmds.textFieldGrp(l="select ctrl obj", cw=([1,100],[2,150]), cal=([1,"left"], [2,"left"]))
widgets["setupObjButton"] = cmds.button(l="get ctrl object", h=40, c= partial(getObj, widgets["setupObjTFG"]))
widgets["setupConstrTFG"] = cmds.textFieldGrp(l="constraint", cw=([1,100],[2,150]), cal=([1,"left"], [2,"left"]))
widgets["setupConstrButton"] = cmds.button(l="get constraint", h=40, c= partial(getObj, widgets["setupConstrTFG"]))
#create list of attrs on constraint
#attr = cmds.listAttr(sel,ud=True )
#create list of spaces on obj attr
cmds.tabLayout(widgets["tabLO"], e=True, tabLabel = ((widgets["getObjCLO"], "change spaces"),(widgets["setupCLO"], "setup matching")))
cmds.showWindow(widgets["window"])
cmds.window(widgets["window"], e=True, w=250, h=300)