本文整理汇总了Python中maya.cmds.window函数的典型用法代码示例。如果您正苦于以下问题:Python window函数的具体用法?Python window怎么用?Python window使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了window函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: 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)
示例2: create
def create(self):
"""
Draw the window
"""
# delete the window if its handle exists
if cmds.window(self.window, exists=True):
# deletes window. 'window' flag makes sure that deleted object is a window
cmds.deleteUI(self.window, window=True)
# initialize the window
self.window = cmds.window(title=self.title, widthHeight=self.size, menuBar=True)
# main form for the window
self.mainForm = cmds.formLayout(numberOfDivisions=100)
# create common menu items items and buttons
self.commonMenu()
self.commonButtons()
# create a tabLayout
self.optionsBorder = cmds.tabLayout(scrollable=True, tabsVisible=False, height=1)
# Attach tabLayout to parent formLayout, and to control button
cmds.formLayout(self.mainForm, edit=True, attachForm=
([self.optionsBorder, 'top', 0],
[self.optionsBorder, 'left', 2],
[self.optionsBorder, 'right', 2]),
attachControl=
([self.optionsBorder, 'bottom', 5, self.applyBtn]))
# new form to attach controls in displayOptions()
self.optionForm = cmds.formLayout(numberOfDivisions=100)
self.displayOptions()
# Show the window
cmds.showWindow(self.window)
示例3: 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)
示例4: __init__
def __init__(s):
with report.Report():
tracker = JointTracker()
winName = "Orient_Joints"
if cmds.window(winName, ex=True):
cmds.deleteUI(winName)
s.win = cmds.window(rtf=True, w=300, t="Orient Joints")
cmds.columnLayout(adj=True)
cmds.button(
l="Attach Marker",
h=50,
c=Callback(tracker.addMarker),
ann="""
Attach a Marker to the selected Joint.
Rotate the marker into the desired joint rotation.
"""
)
cmds.button(
l="Update Joints",
h=50,
c=Callback(tracker.orientJoints),
ann="""
Rotate all joints that have markers to their respective rotations.
"""
)
cmds.showWindow(s.win)
cmds.scriptJob(uid=[s.win, tracker.removeMarkers])
示例5: particleLocatorsUI
def particleLocatorsUI():
"""
"""
# Get current frame range
start = cmds.playbackOptions(q=True, min=True)
end = cmds.playbackOptions(q=True, max=True)
# Define window
particleLocatorsUI = 'particleLocatorsWindow'
if cmds.window(particleLocatorsUI, q=True, ex=True): cmds.deleteUI(particleLocatorsUI)
particleLocatorsUI = cmds.window(particleLocatorsUI, t='Generate Locators')
# UI Layout
cmds.columnLayout(adj=False, cal='left')
partiTFG = cmds.textFieldGrp('partiLoc_particleTFG', label='Particle', text='', cw=[(1, 120)])
prefixTFG = cmds.textFieldGrp('partiLoc_prefixTFG', label='Prefix', text='', cw=[(1, 120)])
bakeAnicmdsBG = cmds.checkBoxGrp('partiLoc_bakeAnicmdsBG', label='Bake Animation', ncb=1, v1=0, cw=[(1, 120)])
startEndIFG = cmds.intFieldGrp('partiLoc_startEndISG', nf=2, label='Frame Range', v1=start, v2=end, cw=[(1, 120)])
rotateLocCBG = cmds.checkBoxGrp('partiLoc_rotateCBG', label='Rotate (rotatePP)', ncb=1, v1=0, cw=[(1, 120)])
scaleLocCBG = cmds.checkBoxGrp('partiLoc_scaleCBG', label='Scale (scalePP)', ncb=1, v1=0, cw=[(1, 120)])
cmds.button(l='Create Locators', c='glTools.tools.generateParticles.particleLocatorsFromUI()')
# 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(particleLocatorsUI)
示例6: __enter__
def __enter__(self):
'''
Initialize the UI
'''
if mc.window(self.name, exists=True):
mc.deleteUI(self.name)
mc.window(self.name, title='ml :: '+self.title, iconName=self.title, width=self.width, height=self.height, menuBar=self.menu)
if self.menu:
self.createMenu()
self.form = mc.formLayout()
self.column = mc.columnLayout(adj=True)
mc.rowLayout( numberOfColumns=2, columnWidth2=(34, self.width-34), adjustableColumn=2,
columnAlign2=('right','left'),
columnAttach=[(1, 'both', 0), (2, 'both', 8)] )
#if we can find an icon, use that, otherwise do the text version
if self.icon:
mc.iconTextStaticLabel(style='iconOnly', image1=self.icon)
else:
mc.text(label=' _ _ |\n| | | |')
if not self.menu:
mc.popupMenu(button=1)
mc.menuItem(label='Help', command=(_showHelpCommand(wikiURL+'#'+self.name)))
mc.text(label=self.info)
mc.setParent('..')
mc.separator(height=8, style='single')
return self
示例7: __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)
示例8: 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( '..' )
示例9: windowSHM
def windowSHM(*args):
if cmds.window("shdrmnWin", exists = 1):
cmds.deleteUI("shdrmnWin")
win = cmds.window("shdrmnWin", title = "Shader manager", w = 500, sizeable = 0)
mainLayout = cmds.columnLayout (w = 500)
cmds.rowColumnLayout(w = 500, nc = 4, parent = mainLayout )
cmds.textFieldGrp( 'getAiAttrField', text = 'mColor')
cmds.button(label = "GET TX", w= 83, h = 50, c = getTextureFromShader )
cmds.button(label = "SHOW TX", w= 83, h = 50, c = assignPREVShader)
cmds.button(label = "TILE UV", w= 83, h = 50, c = setTileUV)
cmds.rowColumnLayout(w = 500, nc = 1, parent = mainLayout )
cmds.button(label = "DELETE PREVIEW", w= 500, h = 50, c = deleteShaders, parent = mainLayout )
cmds.separator(height=10, parent = mainLayout)
cmds.rowColumnLayout(w = 500, nc = 2, parent = mainLayout )
cmds.button(label = "GET MATERIALS", w= 250, h = 50, c = getMaterial )
cmds.button(label = "ASSIGN MATERIALS", w= 250, h = 50, c = asignMaterial )
cmds.showWindow(win)
示例10: 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)
示例11: 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
示例12: SetTitle
def SetTitle(self,title):
""" Initialised the windows and define the windows titles
@type title: string
@param title: the window title
"""
self.title=title
self.winName= title.replace(" ","_").replace(".","_")+"_gui"
# print winName
# print cmds.window(winName, q=1, exists=1)
res = cmds.window(self.winName, q=1, exists=1)
# print res
if bool(res):
# print self.winName, " exist"
cmds.deleteUI(self.winName, window=True)
# print self.winName, " deleted"
#chec for the dock one
res = cmds.dockControl(self.winName, q=1, exists=1)
# print res
if bool(res):
# print self.winName+"dock", " exist"
cmds.deleteUI(self.winName, control=True)
# print self.winName, " deleted"
winName = cmds.window(self.winName, menuBar=True,title=title,
w=self.w*self.scale,h=self.h*self.scale)
print ("settitle ",winName, self.winName, winName==self.winName)
self.winName = winName
# cmds.window(self.winName,e=1,vis=True)
print self.winName, " created"
示例13: createWindow
def createWindow(self):
self.log.debug("creating window "+self.windowName)
if self.windowExists(self.windowName):
raise Exception("window %s already opened" % self.windowName)
if not self.useUserPrefSize:
try:
cmds.windowPref(self.windowName,remove=True)
cmds.windowPref(self.windowName,width=self.defaultWidth,height=self.defaultHeight)
except:
pass
cmds.window(self.windowName,
title=self.windowTitle,
maximizeButton=False,
minimizeButton=False,
width=self.defaultWidth,
height=self.defaultHeight,
sizeable=self.sizeable,
menuBar=self.menuBar)
cmds.scriptJob(uiDeleted=[self.windowName,self.onWindowDeleted])
HeadlessDataHost.HANDLE.addReference(self)
示例14: secondaryUI
def secondaryUI():
sec_UIname = 'secondary'
if cmds.window(sec_UIname,exists = True):
cmds.deleteUI(sec_UIname)
cmds.window(sec_UIname,title = 'rosa_secondary')
clmLot = cmds.columnLayout( adjustableColumn=True)
cmds.textField('ctrl_name',text = 'ctrl_name')
cmds.button('createctrl',label = 'create ctrl',h = 30,c = 'ctrl()')
cmds.button('load_model',label = 'load "org" model',c = 'load_org()')
cmds.textField('org_model',text = '"org" model')
cmds.button('load_property_obj',label = 'loading property add object',c = 'load_vis()')
cmds.textField('vis',text = 'Visibility')
#
flLot = cmds.flowLayout(columnSpacing = 6)
cmds.text(label = 'ctrl axial:')
cmds.radioCollection()
cmds.radioButton('follic',label = 'follic',select = 0)
cmds.radioButton('Custom',label = 'Custom',select = 1)
#
cmds.setParent( clmLot)
cmds.button(label = 'Generate',c = 'secondary_add()')
cmds.button('add_ctrl',label = 'add controller',c = 'add_controller()')
cmds.button('Add_modelSec',label = 'Add_modelSec',c = 'Add_modelSec()')
cmds.button(label = 'inverse_connect',c = 'inverse_connect01()')
#
cmds.frameLayout( label='modify ctrl:',borderStyle='etchedOut')
cmds.setParent( clmLot)
cmds.button(label = 'loding want to modify the controller',c = 'load_ctrl()')
cmds.textField('sec_ctrl',text = 'secondary_ctrl')
cmds.button(label = 'modify the controller position',c = 'ctrl_modify()')
cmds.button(label = 'complete controller modifies',c = 'modify_complete()')
cmds.showWindow()
示例15: create
def create(self):
if cmds.window( self.winName, ex=1 ):
cmds.deleteUI( self.winName, wnd=1 )
cmds.window( self.winName, title= self.title )
form = cmds.formLayout()
field_meshForm = self.field_mesh.create()
field_uvForm = self.field_uv.create()
checkForm = self.check.create()
buttons_form = self.buttons.create()
cmds.setParent( '..' )
cmds.formLayout( form, e=1,
af=[(field_meshForm, 'top', 0 ), ( field_meshForm, 'left', 0 ), ( field_meshForm, 'right', 0 ),
(field_uvForm, 'left', 0 ), ( field_uvForm, 'right', 0 ),
(checkForm, 'left', 0 ), (checkForm, 'right', 0 ),
(buttons_form, 'left', 0 ), ( buttons_form, 'right', 0 ) ],
ac=[(field_uvForm, 'top', 0, field_meshForm ),
(checkForm, 'top', 0, field_uvForm),
(buttons_form, 'top', 0, checkForm )])
cmds.window( self.winName, e=1, w=self.width, h=self.height )
cmds.showWindow( self.winName )
self.setTextInfomation()
self.popupSetting()
self.buttonCommandSetting()