本文整理汇总了Python中maya.cmds.button函数的典型用法代码示例。如果您正苦于以下问题:Python button函数的具体用法?Python button怎么用?Python button使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了button函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: snapOnClosestVertex_window
def snapOnClosestVertex_window():
"""
Creates the 'Snap On Closest Vertex' vertex window.
"""
cmds.windowPref(enableAll=False)
if (cmds.window("snapOnClosestVertex_window", exists=True)):
cmds.deleteUI("snapOnClosestVertex_window")
cmds.window("snapOnClosestVertex_window",
title="Snap On Closest Vertex",
width=320)
spacing = 5
cmds.columnLayout(adjustableColumn=True, rowSpacing=spacing)
cmds.rowLayout(numberOfColumns=3, columnWidth3=(125, 150, 130), adjustableColumn=2, columnAlign=(2, "left"), columnAttach=[(1, "both", spacing), (2, "both", spacing), (3, "both", spacing)])
cmds.text(label="Reference Object:")
referenceObject_textField = cmds.textField("referenceObject_textField")
cmds.button("getReferenceObject_button", label="Get Reference Object!", command=getReferenceObject_button_OnClicked)
cmds.setParent(topLevel=True)
cmds.separator(style="single")
cmds.button("snapIt_button", label="Snap It!", al="center", command=snapIt_button_OnClicked)
cmds.showWindow("snapOnClosestVertex_window")
cmds.windowPref(enableAll=True)
开发者ID:KelSolaar,项目名称:Snippets,代码行数:30,代码来源:snapOnClosestVertex.py
示例2: zbw_offsetAnim
def zbw_offsetAnim(*args):
"""creates offset from first obj sel to last based on the entered offset value"""
def zbw_runOffsetAnim(*args):
#get frame range!!!!!!
#get selection, check that they are tranforms
sel = cmds.ls(sl=True,type="transform")
selSize = int(len(sel))
#for each selection mult the index by the offset value
for i in range(0,selSize):
obj = sel[i]
offsetRaw = cmds.intFieldGrp('zbw_offsetValue', q=True, v=True)
offset = offsetRaw[0]
multFactor = i * offset
#shift the entire anim curve by the offset mult value
cmds.keyframe(obj, edit=True,relative=True,timeChange=multFactor,time=(1,24))
#create UI, get offset value, frame range or all anim
if (cmds.window('zbw_offsetAnimUI', exists=True)):
cmds.deleteUI('zbw_offsetAnimUI', window=True)
cmds.windowPref('zbw_offsetAnimUI', remove=True)
window=cmds.window('zbw_offsetAnimUI', widthHeight=(350,200), title='zbw_offsetAnim')
cmds.columnLayout(cal='center')
cmds.intFieldGrp('zbw_offsetValue', cal=(1,'left'), label='frequency(frames)', value1=5)
#CREATE FRAME RANGE AREA (WHICH FRAMES ARE WE DOING?)
#WHEN THAT HAPPENS, WHAT DO WE DO WITH THE FRAMES AFTER THAT? (PROBABLY NOTHING. . . LET USER WORRY ABOUT IT)
#checkbox for random freq (to give a random amount to offset each object)
#cmds.checkBoxGrp('zbw_animNoiseRandom', cal=(1,'left'), cw=(1, 175),label='random frequency on', value1=0, cc=zbw_animNoiseRandom)
cmds.button('zbw_offsetAnimGo', label='offset!', width=75, command=zbw_runOffsetAnim)
cmds.showWindow(window)
开发者ID:zethwillie,项目名称:zbw_python_tools,代码行数:30,代码来源:zbw_animTools.py
示例3: removeFloatVariable
def removeFloatVariable(self, nodeAttr, varslayout, index):
# Remove variable
children = cmds.columnLayout(varslayout, query=1, childArray=1)
if len(children) <= index:
return
baseNameAttr = nodeAttr
baseValueAttr = nodeAttr.replace("fparam_name", "fparam_value");
for i in xrange(index+1, len(children)):
rembtn, namefld, _, valfld = cmds.formLayout(children[i], query=1, childArray=1)
indexStr = "[%d]" % (i - 1)
nextIndexStr = "[%d]" % i
nameAttr = baseNameAttr + indexStr
valueAttr = baseValueAttr + indexStr
cmds.setAttr(nameAttr, cmds.getAttr(baseNameAttr + nextIndexStr), type="string")
cmds.setAttr(valueAttr, cmds.getAttr(baseValueAttr + nextIndexStr));
self.setupVariableNameCallback(nameAttr, namefld)
self.setupFloatVariableValueCallback(valueAttr, valfld)
cmds.button(rembtn, edit=1, command=lambda *args: self.removeFloatVariable(nodeAttr, varslayout, i-1))
cmds.deleteUI(children[index])
cmds.removeMultiInstance("%s[%d]" % (baseNameAttr, len(children)-1), b=True)
cmds.removeMultiInstance("%s[%d]" % (baseValueAttr, len(children)-1), b=True)
开发者ID:mousekoz,项目名称:SeExprArnold,代码行数:30,代码来源:aiSeexprTemplate.py
示例4: doIt
def doIt( self, arglist ):
wnd = cmds.window( "kgmEngineWindow_" + str(time.time()), widthHeight = ( 200, 200 ) )
#cmds.columnLayout( adjustableColumn = True )
#cmds.button( label = 'Export Map', command = kgmEngine.exportMap )
#cmds.button( label = 'Export Mesh', command = kgmEngine.exportMesh )
#cmds.button( label = 'Export Skeleton', command = kgmEngine.exportSkeleton )
#cmds.button( label = 'Export Animation', command = kgmEngine.exportAnimation )
#cmds.button( label = 'Insert Node', command = kgmEngine.insertNode )
cmds.columnLayout()
cmds.rowColumnLayout( numberOfColumns = 2 )
cmds.checkBox( "Mesh", label="Mesh", value=False, onCommand=kgmEngine.enableMesh, offCommand=kgmEngine.enableMesh )
cmds.checkBox( "Material", label="Material", value=False, onCommand=kgmEngine.enableMaterial, offCommand=kgmEngine.enableMaterial )
cmds.checkBox( "Skeleton", label="Skeleton", value=False, onCommand=kgmEngine.enableSkeleton, offCommand=kgmEngine.enableSkeleton )
cmds.checkBox( "Animation", label="Animation", value=False, onCommand=kgmEngine.enableAnimation, offCommand=kgmEngine.enableAnimation )
cmds.columnLayout()
cmds.rowColumnLayout( numberOfColumns = 2 )
cmds.columnLayout( adjustableColumn=True )
cmds.button( label = 'Export', command = kgmEngine.export )
cmds.button( label = 'Insert Node', command = kgmEngine.insertNode )
cmds.columnLayout()
cmds.rowColumnLayout( numberOfColumns = 3 )
cmds.columnLayout( adjustableColumn=True )
cmds.radioCollection()
cmds.radioButton( label='Bin', align='left', select=False )
cmds.radioButton( label='Xml', align='left', select=True )
#cmds.radioButtonGrp( label='Format', labelArray3=['Bin', 'Txt', 'Xml'], numberOfRadioButtons=3 )
#cmds.radioButton( 'Format', label='Bin', )
cmds.showWindow( wnd )
开发者ID:nocs13,项目名称:kgmEngine,代码行数:31,代码来源:kgmExport.py
示例5: locatorParticlesUI
def locatorParticlesUI():
"""
"""
# Define window
locParticleUI = 'locatorParticleWindow'
if cmds.window(locParticleUI, q=True, ex=True): cmds.deleteUI(locParticleUI)
locParticleUI = cmds.window(locParticleUI, t='Generate Particles')
# UI Layout
cmds.columnLayout(adj=False, cal='left')
partiTFG = cmds.textFieldGrp('locParticle_particleTFG', label='Particle', text='', cw=[(1, 100)])
radiusFFG = cmds.floatSliderGrp('locParticle_radiusFSG', label='radius', f=True, min=0.1, max=10.0, fmn=0.01,
fmx=100.0, pre=2, v=1.0, cw=[(1, 100)])
rotateLocCBG = cmds.checkBoxGrp('locParticle_rotateCBG', label='Add rotatePP', ncb=1, v1=0, cw=[(1, 100)])
scaleLocCBG = cmds.checkBoxGrp('locParticle_scaleCBG', label='Add scalePP', ncb=1, v1=0, cw=[(1, 100)])
selfCollideCBG = cmds.checkBoxGrp('locParticle_selfCollideCBG', label='self collide', ncb=1, v1=0, cw=[(1, 100)])
cmds.button(l='Create Particles', c='glTools.tools.generateParticles.locatorParticlesFromUI()')
# Popup menu
cmds.popupMenu(parent=partiTFG)
for p in cmds.ls(type=['particle', 'nParticle']):
cmds.menuItem(p, c='cmds.textFieldGrp("' + partiTFG + '",e=True,text="' + p + '")')
# Show Window
cmds.showWindow(locParticleUI)
开发者ID:bennymuller,项目名称:glTools,代码行数:26,代码来源:generateParticles.py
示例6: new
def new(self):
cmds.setParent(self.parent)
self.name = cmds.button(self.name, label=self.label, c=self.cmd, h=self.h)
if self.bgc:
cmds.button(self.name, e=True, bgc=self.bgc)
attachForm = [(self.name, 'bottom', self.moveUp), (self.name, 'right', 0), (self.name, 'left', 0)]
cmds.formLayout(self.parent, edit=True, attachForm=attachForm)
开发者ID:boochos,项目名称:work,代码行数:7,代码来源:ui_micro_lib.py
示例7: setAttributeVectorUI
def setAttributeVectorUI():
global tfXIn, tfXOut, tfYIn, tfYOut, tfZIn, tfZOut, tslVectorList, tfXAdd, tfYAdd, tfZAdd, vectorUI
vectorUI = 'vectorUI'
closeUI(vectorUI)
cmds.window(vectorUI, title = 'vectorUI')
cmds.columnLayout(columnAttach = ['both', 5], rowSpacing = 5, columnWidth = 210)
cmds.text('..: random range :..', backgroundColor = [0.15, 0.15, 0.0])
cmds.gridLayout(numberOfColumns = 6, cellWidthHeight = (33, 20))
tfXIn = cmds.textField(text = '0.0', backgroundColor = [0.15, 0.1, 0.0])
tfXOut = cmds.textField(text = '1.0', backgroundColor = [0.15, 0.1, 0.0])
tfYIn = cmds.textField(text = '0.0', backgroundColor = [0.0, 0.15, 0.1])
tfYOut = cmds.textField(text = '1.0', backgroundColor = [0.0, 0.15, 0.1])
tfZIn = cmds.textField(text = '0.0', backgroundColor = [0.0, 0.1, 0.15])
tfZOut = cmds.textField(text = '1.0', backgroundColor = [0.0, 0.1, 0.15])
cmds.setParent('..')
cmds.button('ok', command = 'setAttributeVectorRandom()')
cmds.separator(style = 'out')
cmds.text('..: vector list :..', backgroundColor = [0.0, 0.15, 0.15])
tslVectorList = cmds.textScrollList(allowMultiSelection = True)
cmds.button('remove', command = 'removeScrollListVector()')
cmds.gridLayout(numberOfColumns = 4, cellWidthHeight = (50, 20))
tfXAdd = cmds.textField(text = '0.0', backgroundColor = [0.15, 0.1, 0.0])
tfYAdd = cmds.textField(text = '0.0', backgroundColor = [0.0, 0.15, 0.1])
tfZAdd = cmds.textField(text = '0.0', backgroundColor = [0.0, 0.1, 0.15])
cmds.button('add..', command = 'addScrollListVector()')
cmds.setParent('..')
cmds.button('random', command = 'setAttributeListVectorRandom()')
cmds.button('increment %', command = 'setAttributeListVectorInc()')
cmds.setParent('..')
cmds.showWindow()
开发者ID:diegoinacio,项目名称:coding,代码行数:30,代码来源:mayaAiAttribManager.py
示例8: stabilizer
def stabilizer (task):
camera = Camera()
point = cmds.ls (selection = True)
if task == 'end':
# turn off stab
expression = str (cmds.expression ('stabilizator_expression', string = True, query = True))
camera.shape = expression[2:expression.find('#')]
cmds.delete ('stabilizator_expression')
camera.reset_camera ()
cmds.button ('button_stabilizer',
edit = True,
label = 'stabilize',
backgroundColor = (0, 0.5, 0),
command = 'fstab.stabilizer("start")')
else:
# start stab
if cmds.objExists ('stabilizator_expression'):
# stabilizator exists
expression = str (cmds.expression ('stabilizator_expression', string = True, query = True))
camera.shape = expression[2:expression.find('#')]
cmds.delete ('stabilizator_expression')
cmds.select (camera.shape, replace = True)
cmds.warning (('>>> STAB WAS TURNED ON. CHECK: ' + camera.shape + ' <<< FOR NONZERO OFFSET VALUES ::..'))
else:
if cmds.nodeType (point) != 'mesh' and cmds.nodeType (point) != 'transform' and len (point) == 0:
# wrong selection
cmds.warning ('..:: SELECT SOMETHING TO STABILIZE ::..')
else:
point = point[0]
if point != camera.transform and point != camera.shape and camera.transform != 'empty':
# stabilize
cmds.setAttr( camera.shape + '.displayResolution', 0)
cmds.setAttr( camera.shape + '.displayFilmGate', 0)
expression = '//%s#' % camera.shape
expression += '\npython "import maya.cmds as cmds";'
expression += '\npython "fov_h = cmds.camera (\'%s\', query = True, horizontalFieldOfView = True)";' % camera.shape
expression += '\npython "fov_v = cmds.camera (\'%s\', query = True, verticalFieldOfView = True)";' % camera.shape
expression += '\npython "aperture_h = cmds.camera (\'%s\', query = True, horizontalFilmAperture = True)";' % camera.shape
expression += '\npython "aperture_v = cmds.camera (\'%s\', query = True, verticalFilmAperture = True)";' % camera.shape
expression += '\n$pos=`python "fstab.get_normalized_screen_position(\'%s\',\'%s\',fov_h, fov_v,aperture_h,aperture_v)"`;' % (point, camera.transform)
expression += '\nsetAttr "%s.horizontalFilmOffset" ($pos[2]);' % camera.shape
expression += '\nsetAttr "%s.verticalFilmOffset" ($pos[3]);' % camera.shape
# create expression
cmds.expression (name = 'stabilizator_expression', string = expression)
# update GUI
cmds.button ('button_stabilizer',
edit = True,
label ="deStabilize",
backgroundColor = (1, 0, 0),
command = 'fstab.stabilizer("end")')
else:
cmds.warning ('..:: CLICK IN THE PANE WITH THE CAMERA ::..')
开发者ID:danielforgacs,项目名称:code-dump,代码行数:60,代码来源:ford_stabilizer_v0.5.5.py
示例9: create
def create( self, *args ):
if cmds.window( self.winName, ex=1 ):
cmds.deleteUI( self.winName, wnd=1 )
cmds.window( self.winName, title= self.title, titleBarMenu=0 )
cmds.columnLayout()
cmds.rowColumnLayout( nc=1, cw=[( 1,self.width-2)] )
cmds.text( l='Register ID', h=30 )
idField = cmds.textField( h=25 )
helpField = cmds.textField( en=0 )
cmds.setParent( '..' )
firstWidth = (self.width-2)*0.5
secondWidth = (self.width-2)-firstWidth
cmds.rowColumnLayout( nc=2, cw=[(1,firstWidth),(2,secondWidth)])
cmds.button( l='Create', h=25, c=self.cmdCreate )
cmds.button( l='Cancel', h=25, c=self.cmdCancel )
cmds.setParent( '..' )
cmds.window( self.winName, e=1,
width = self.width,
height = self.height )
cmds.showWindow( self.winName )
self.idField = idField
self.helpField = helpField
开发者ID:jonntd,项目名称:mayadev-1,代码行数:27,代码来源:view.py
示例10: drawButton
def drawButton(self,elem,x,y,w=None,h=None):
""" Draw a Button
@type elem: dictionary
@param elem: the button dictionary
@type x: int
@param x: position on x in the gui windows
@type y: int
@param y: position on y in the gui windows
@type w: int
@param w: force the width of the item
@type h: int
@param h: force the height of the item
"""
name = elem["name"]
if elem["label"] != None:
name = elem["label"]
if elem["action"] is not None :
elem["id"] = cmds.button( label=name,
w=elem["width"]*self.scale,
h=elem["height"]*self.scale,
c=partial(elem["action"],),
recomputeSize=False)
else :
elem["id"] = cmds.button( label=name,
w=elem["width"]*self.scale,
h=elem["height"]*self.scale,recomputeSize=False)
开发者ID:gj210,项目名称:upy,代码行数:26,代码来源:mayaUI.py
示例11: setupRLUI
def setupRLUI():
if cmds.window("RLWin", exists=True):
cmds.deleteUI("RLWin")
widgets["win"] = cmds.window("RLWin", t="zbw_setupRL", w=200, h=400)
widgets["mainCL"] = cmds.columnLayout(w=200)
widgets["mainFrame"] = cmds.frameLayout(l="Create Render Layers", w=200, cll=True, bgc=(.2,.2,.2))
widgets["CarKey"] = cmds.checkBox(l="Car_Env", v=True)
widgets["CarEnv"] = cmds.checkBox(l="Car_Key", v=True)
widgets["BGKey"] = cmds.checkBox(l="BG_Env", v=True)
widgets["BGEnv"] = cmds.checkBox(l="BG_Key", v=True)
widgets["AO"] = cmds.checkBox(l="All_AO", v=True)
widgets["MatteA"] = cmds.checkBox(l="All_MatteA", v=True)
widgets["MatteB"] = cmds.checkBox(l="All_MatteB", v=True)
widgets["MoVec"] = cmds.checkBox(l="All_MoVec", v=True)
widgets["Shadow"] = cmds.checkBox(l="All_Shadow", v=True)
widgets["createBut"] = cmds.button(l="Create Layers", w=200, h=40, bgc=(.6,.8,.6), c=createRL)
cmds.text("NOTE: this is setting the overrides for \nthe moVec layer RG's and materials \n(if you have them in scene\n for the AO and Movec layers but \n NO passes are set up")
cmds.separator(h=20, style = "double")
#widgets["copyBut"] = cmds.button(l="Copy Selected Layer", w=200, h=40, bgc=(.8,.8,.6), c=copyRL)
#cmds.separator(h=20, style = "double")
widgets["importBut"] = cmds.button(l="Import RL Shaders File", w=200, h=40, bgc=(.8,.6,.6), c=importRL)
cmds.showWindow(widgets["win"])
cmds.window(widgets["win"], e=True, w=200, h=400)
开发者ID:zethwillie,项目名称:zbw_python_tools,代码行数:27,代码来源:zbw_setupRL.py
示例12: smoothEdgeLineUI
def smoothEdgeLineUI():
"""
Smooth Edge Line UI
"""
# Window
window = 'smoothEdgesUI'
if cmds.window(window, q=True, ex=1): cmds.deleteUI(window)
window = cmds.window(window, t='Smooth Edge Line', s=True)
# Layout
CL = cmds.columnLayout()
# UI Elements
cmds.intSliderGrp('smoothEdges_smoothISG', label='Smooth', field=True, minValue=1, maxValue=20, fieldMinValue=1,
fieldMaxValue=100, value=4)
cmds.floatSliderGrp('smoothEdges_falloffFSG', label='Falloff Distance', field=True, precision=3, minValue=0.0,
maxValue=10.0, fieldMinValue=0.0, fieldMaxValue=100.0, value=0.01)
cmds.checkBoxGrp('smoothEdges_edgeSpacingCBG', label='Maintain Edge Spacing', numberOfCheckBoxes=1, v1=False)
cmds.checkBoxGrp('smoothEdges_snapToOrigCBG', label='Maintain Shape', numberOfCheckBoxes=1,
v1=False) # columnWidth2=[100,165]
cmds.checkBoxGrp('smoothEdges_deleteHistoryCBG', label='Delete History', numberOfCheckBoxes=1, v1=False)
cmds.button('smoothEdgesB', l='Smooth', w=390, c='glTools.model.straightenVerts.smoothEdgeLineFromUI()')
# Show Window
cmds.window(window, e=True, wh=[392, 115])
cmds.showWindow(window)
开发者ID:bennymuller,项目名称:glTools,代码行数:26,代码来源:straightenVerts.py
示例13: evenEdgeSpacingUI
def evenEdgeSpacingUI():
"""
Even Edge Spacing UI
"""
# Window
window = 'evenEdgeSpacingUI'
if cmds.window(window, q=True, ex=1): cmds.deleteUI(window)
window = cmds.window(window, t='Even Edge Spacing', s=True)
# Layout
CL = cmds.columnLayout()
# UI Elements
cmds.intSliderGrp('evenEdgeSpacing_smoothISG', label='Smooth', field=True, minValue=0, maxValue=20, fieldMinValue=0,
fieldMaxValue=100, value=4)
cmds.floatSliderGrp('evenEdgeSpacing_influenceFSG', label='Influence', field=True, minValue=0.0, maxValue=1.0,
fieldMinValue=0.0, fieldMaxValue=1.0, value=1.0)
cmds.checkBoxGrp('evenEdgeSpacing_snapToOrigCBG', label='Maintain Shape', numberOfCheckBoxes=1,
v1=False) # columnWidth2=[100,165]
cmds.checkBoxGrp('evenEdgeSpacing_deleteHistoryCBG', label='Delete History', numberOfCheckBoxes=1, v1=False)
cmds.button('evenEdgeSpacingB', l='Even Edge Spacing', w=390,
c='glTools.model.straightenVerts.evenEdgeSpacingFromUI()')
# Show Window
cmds.window(window, e=True, wh=[392, 99])
cmds.showWindow(window)
开发者ID:bennymuller,项目名称:glTools,代码行数:26,代码来源:straightenVerts.py
示例14: commonButtons
def commonButtons(self):
# Creates a button size parameter with a padding of 18 pixels. The width is the size of the UI width minus the padding
# divided by three. The height is 26 pixels.
self.commonBtnSize = ((self.size[0]-18)/3, 26)
# Establishes the layout of the buttons. Sets them into a row, with three buttons in the row. Also establishes their size.
# Creates the "create and close" button.
self.actionBtn = mc.button(label = self.actionName, height = self.commonBtnSize[1], command = self.actionBtnCmd)
# Creates the "create" button.
self.createBtn = mc.button(label = "Create", height = self.commonBtnSize[1], command = self.createBtnCmd)
# Creates the "close" button.
self.closeBtn = mc.button(label = "Close", height = self.commonBtnSize[1], command = self.closeBtnCmd)
# Dictates how the buttons scale when the user scales the UI.
# First sets the main form to edit mode.
mc.formLayout(self.mainForm, e=True, attachForm=(
# Then takes each button, specifies the edge to adjust, and then specifies the value to adjust by.
# Pins the action button to the left of the UI with a padding of 5 pixels.
[self.actionBtn, 'left', 5],
# Pins the action button to the bottom of the UI with a padding of 5 pixels.
[self.actionBtn, 'bottom', 5],
# Pins the create button to the bottom of the UI with a padding of 5 pixels.
[self.createBtn, 'bottom', 5],
# Pins the close botton to the bottom of the UI with a padding of 5 pixels.
[self.closeBtn, 'bottom', 5],
# Pins the close button to the right of the UI with a padding of 5 pixels.
[self.closeBtn, 'right', 5]),
# Pins buttons relative to the coordinates specified in the create(self) function according to the
# numberOfDivisions flag in the mainForm command.
attachPosition = ([self.actionBtn, 'right', 1, 33], [self.closeBtn, 'left', 0, 67]),
# Pins the middle button to the outer two buttons. Allows it to scale along with the other two buttons.
attachControl = ([self.createBtn, 'left', 4, self.actionBtn], [self.createBtn, 'right', 4, self.closeBtn]),
# Makes sure that the the top edges of the buttons scale according to the above parameters.
attachNone = ([self.actionBtn, 'top'], [self.createBtn, 'top'], [self.closeBtn, 'top']))
开发者ID:ericnegron,项目名称:pythonScripts,代码行数:33,代码来源:simpleRig.py
示例15: makeSaveVisible
def makeSaveVisible(self):
cmds.button("btnSaveNetwork", e=1, en = 1)
cmds.button("btnSaveWs", e=1, en = 1)
#if __name__=="__main__":
# obj = shotManager_SID()
开发者ID:sid2364,项目名称:Maya_Python,代码行数:7,代码来源:ShotManager_PlugIn__Sid.py
示例16: __init__
def __init__(self) :
# get the currently selected objects and make sure we have only one object
selected = OM.MSelectionList()
OM.MGlobal.getActiveSelectionList(selected)
self.selectedObjects = []
selected.getSelectionStrings(self.selectedObjects)
if len(self.selectedObjects) == 0 :
cmds.confirmDialog( title='No objects Selected', message='Select a Mesh Object', button=['Ok'], defaultButton='Ok', cancelButton='Ok', dismissString='Ok' )
elif len(self.selectedObjects) > 1 :
cmds.confirmDialog( title='Select One Object', message='Only One Mesh mat be exported at a time', button=['Ok'], defaultButton='Ok', cancelButton='Ok', dismissString='Ok' )
# now we have the correct criteria we can proceed with the export
else :
# get the start and end values for our UI sliders
anim=OMA.MAnimControl()
minTime=anim.minTime()
maxTime=anim.maxTime()
self.m_start=int(minTime.value())
self.m_end=int(maxTime.value())
# now we create a window ready to populate the components
self.m_window = cmds.window( title='NCCA Pointbake Export' )
# create a layout
cmds.columnLayout()
# create two sliders for start and end we also attach methods to be called when the slider
# changes
self.m_startSlider=cmds.intSliderGrp( changeCommand=self.startChanged,field=True, label='Start Frame', minValue=self.m_start, maxValue=self.m_end, fieldMinValue=self.m_start, fieldMaxValue=self.m_end, value=self.m_start )
self.m_endSlider=cmds.intSliderGrp( changeCommand=self.endChanged ,field=True, label='End Frame', minValue=self.m_start, maxValue=self.m_end, fieldMinValue=self.m_end, fieldMaxValue=self.m_end, value=self.m_end )
# create a button and add the method called when pressed
cmds.button( label='Export', command=self.export )
# finally show the window
cmds.showWindow( self.m_window )
开发者ID:NCCA,项目名称:NGL6Demos,代码行数:30,代码来源:NCCAPointBakeMayaExport.py
示例17: addMultiAttr
def addMultiAttr():
#Create a variable for the window name
winName = 'blend'
winTitle = 'rh_addMultiAttr'
#Delete the window if it exists
if cmds.window(winName, exists=True):
cmds.deleteUI(winName, window=True)
#Build the main window
cmds.window(winName, title=winTitle, sizeable=True)
cmds.textFieldButtonGrp('Obj',label='Object :', text='', ed = False,buttonLabel='Load Sel',bc = 'sel()')
cmds.columnLayout(adjustableColumn=True)
cmds.textFieldGrp('Attr',l='Attribute:',text='')
cmds.columnLayout(adjustableColumn=True)
cmds.floatFieldGrp('minAttr', numberOfFields=1, label='Min Value', value1=0)
cmds.columnLayout(adjustableColumn=True)
cmds.floatFieldGrp('maxAttr', numberOfFields=1, label='Max Value', value1=0)
cmds.columnLayout(adjustableColumn=True)
cmds.button(label='Contact', command='Connect()')
cmds.columnLayout(adjustableColumn=True)
#Show the window
cmds.showWindow(winName)
cmds.window(winName, edit=True, width=300, height=120)
开发者ID:RyugasakiHu,项目名称:Maya-tools,代码行数:25,代码来源:rh_addMultiAttr.py
示例18: build
def build(self):
if mc.windowPref(self.win, exists=1):
mc.windowPref(self.win, remove=1)
if mc.window(self.win,exists=1):
mc.deleteUI(self.win)
mc.window( self.win, title=self.title, widthHeight=(500, 210) )
cl1 = mc.columnLayout( columnAttach=('both', 2), rowSpacing=3, columnWidth=500, adjustableColumn = True)
mc.radioCollection()
self.mouth = mc.radioButton( l='user import', select=1, p=cl1 )
self.autoR = mc.radioButton( l='auto import', p=cl1 )
mc.separator()
mc.frameLayout('selected')
mc.rowLayout(numberOfColumns=3, columnWidth3=(80, 75, 150), adjustableColumn=2, columnAlign=(1, 'right'), columnAttach=[(1, 'both', 0), (2, 'both', 0), (3, 'both', 0)] )
mc.text(l='Mode')
mc.columnLayout()
mc.radioCollection()
self.prop = mc.radioButton( l='Prop', select=1 )
self.character = mc.radioButton( l='Character' )
mc.setParent( '..' )
mc.setParent( '..' )
self.numText = mc.floatFieldGrp( l='Num' )
self.txtProp = mc.textFieldButtonGrp( label='File Path', text='', buttonLabel='Browse', cw3 = (40,400,50), adjustableColumn3 = 2, cl3 = ('left', 'center', 'right'), bc = self.browse,cc=self.getPath )
#mc.separator()
#self.txtCharacter = mc.textFieldButtonGrp( label='Path', text='', buttonLabel='Browse', cw3 = (40,400,50), adjustableColumn3 = 2, cl3 = ('left', 'center', 'right'), bc = self.browse,cc=self.getPath )
#mc.separator()
mc.separator(p=cl1)
mc.button( 'importR', l='Import Reference File', p=cl1 )
mc.setParent( '..' )
开发者ID:chuckbruno,项目名称:Python_scripts,代码行数:28,代码来源:multiReference.py
示例19: __init__
def __init__(self):
winName = "Size set"
global typeMenu
winTitle = winName
if cmds.window(winName, exists=True):
cmds.deleteUI(winName)
# self.window = cmds.window(self.winName, title=self.winTitle, tbm=1, w=150, h=100 )
window = cmds.window(winName, title=winTitle, tbm=1, w=250, h=100 )
cmds.menuBarLayout(h=30)
cmds.rowColumnLayout (' selectArrayRow ', nr=1, w=250)
cmds.frameLayout('LrRow', label='', lv=0, nch=1, borderStyle='out', bv=1, p='selectArrayRow')
cmds.rowLayout (' rMainRow ', w=300, numberOfColumns=6, p='selectArrayRow')
cmds.columnLayout ('selectArrayColumn', parent = 'rMainRow')
cmds.setParent ('selectArrayColumn')
cmds.separator(h=10, p='selectArrayColumn')
cmds.gridLayout('listBuildButtonLayout', p='selectArrayColumn', numberOfColumns=2, cellWidthHeight=(100, 20))
typeMenu=cmds.optionMenu( label='ctrl size')
cmds.menuItem( label="Large" )
cmds.menuItem( label="Med" )
cmds.menuItem( label="Small" )
cmds.button (label='Change Selection', p='listBuildButtonLayout', command = lambda *args:self.controllerSize())
cmds.showWindow(window)
开发者ID:edeglau,项目名称:storage,代码行数:26,代码来源:HoofRig_Toe.py
示例20: UI
def UI():
if cmds.window("TressFXExporterUI", exists = True):
cmds.deleteUI("TressFXExporterUI")
windowTitle = 'TressFX Exporter' + ' ' + 'v' + tressfx_exporter_version
window = cmds.window("TressFXExporterUI", title = windowTitle, w=280, h = 260, mnb=False, sizeable=False)
mainLayout = cmds.columnLayout(w=280, h=260)
cmds.separator(h=8, style='in')
cmds.text(label='Number of vertices per strand (4, 8, 16, 32 or 64):', align='left')
cmds.intField("numVerticesPerStrand", w=30, minValue=4, maxValue=64, value=16 )
cmds.separator(h=8, style='in')
cmds.checkBox("bothEndsImmovable", label='Both ends immovable')
cmds.checkBox("InvertZ", label='Invert Z', value = True)
cmds.checkBox("exportSkinCheckBox", label='Export skin data', value = False)
cmds.checkBox("randomStrandCheckBox", label='Randomize strands for LOD', value = True)
cmds.separator(h=15)
cmds.button(label="Set the base mesh", w=170, h=30, command=SetBaseMesh)
cmds.textField("MeshNameLabel", w=170, editable=False)
cmds.separator(height=10, style='none')
cmds.button(label="Export as binary (*.tfx)", w=170, h=30, command=ExportBinary)
cmds.separator(h=15)
version_text = 'v' + tressfx_exporter_version
cmds.text(label=version_text, align='left')
global selected_mesh_shape_name
selected_mesh_shape_name = ''
cmds.showWindow(window)
开发者ID:GPUOpen-Effects,项目名称:TressFX,代码行数:34,代码来源:TressFX_Exporter.py
注:本文中的maya.cmds.button函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论