Пример #1
0
	def __init__(self) :

		#check to see if the window exists:
		if cmds.window("Box2DTool", exists = True):
			cmds.deleteUI("Box2DTool")

		#create the window:
		window = cmds.window("Box2DTool", title = 'Box2D Tool', sizeable = False)

		#create the main layout:
		cmds.columnLayout(columnWidth = 300, adjustableColumn = False, columnAttach = ('both', 10))

		#make dockable:
		allowedAreas = ['right', 'left']
		cmds.dockControl( 'Box2D Tool', area='left', content=window, allowedArea=allowedAreas )

		self.dim=cmds.floatFieldGrp('dim', numberOfFields=2, label='Dimension', extraLabel='pixel', value1=5, value2=1  )
		self.dim=cmds.floatFieldGrp('friction', numberOfFields=1, label='Friction',  value1=0.2 )
		self.dim=cmds.floatFieldGrp('restitution', numberOfFields=1, label='restitution',  value1=0.0 )
		self.dim=cmds.floatFieldGrp('density', numberOfFields=1, label='density',  value1=0.0 )
		cmds.separator()
		self.dim=cmds.floatFieldGrp('rotation', numberOfFields=1, label='rotation',  value1=0.0 )
		cmds.separator()
		cmds.optionMenuGrp( "bodyType",l='Body Type' )
		cmds.menuItem(label='b2_staticBody');
		cmds.menuItem(label='b2_kinematicBody');
		cmds.menuItem(label='b2_dynamicBody');


		cmds.button(label = "PlaceBlock", w = 100, h = 25, c = self.placeBlock)
		cmds.separator()
		cmds.button( label='Export', command=self.export )
def vrayReUI():
	if cmds.dockControl('vrayRendElem', exists=True):
		cmds.deleteUI('vrayRendElem', ctl=True)
	awVrayRETools = cmds.loadUI (f = 'Q:/Tools/maya/2012/scripts/python/UI/awRenderElem.ui')
	awVrayREPane = cmds.paneLayout (cn = 'single', parent = awVrayRETools)
	awVrayDock = cmds.dockControl ( 'vrayRendElem',allowedArea = ("right","left"), area = "right", floating = False ,con = awVrayRETools, label = 'Render Element tools')
	vrayUpdateUI()
Пример #3
0
def dock(window):

    main_window = None
    for obj in QtWidgets.qApp.topLevelWidgets():
        if obj.objectName() == "MayaWindow":
            main_window = obj

    if not main_window:
        raise ValueError("Could not find the main Maya window.")

    # Deleting existing dock
    print "Deleting existing dock..."
    if self._dock:
        self._dock.setParent(None)
        self._dock.deleteLater()

    if self._dock_control:
        if cmds.dockControl(self._dock_control, query=True, exists=True):
            cmds.deleteUI(self._dock_control)

    # Creating new dock
    print "Creating new dock..."
    dock = Dock(parent=main_window)

    dock_control = cmds.dockControl(label=window.windowTitle(), area="right",
                                    visible=True, content=dock.objectName(),
                                    allowedArea=["right", "left"])
    dock.layout().addWidget(window)

    self._dock = dock
    self._dock_control = dock_control
Пример #4
0
    def open():
        '''
        just a shortcut method to construct and display main window
        '''

        window = MainWindow.getInstance()
        
        if cmds.control(MainWindow.DOCK_NAME,q=True,exists=True):
            cmds.control(MainWindow.DOCK_NAME,e=True,visible=True)
        else:
            cmds.dockControl(MainWindow.DOCK_NAME,l=window.createWindowTitle(),content=MainWindow.WINDOW_NAME,
                             area='right',allowedArea=['right', 'left'],
                             width=window.preferedWidth.get(),
                             floating=window.preferedFloating.get(),
                             visibleChangeCommand=window.visibilityChanged)
            
            if window.preferedFloating.get():
                cmds.window(MainWindow.DOCK_NAME,e=True,
                            topEdge=window.preferedTop.get(),leftEdge=window.preferedLeft.get(),
                            w=window.preferedWidth.get(),h=window.preferedHeight.get())
        
            Utils.silentCheckForUpdates()
        
        # bring tab to front; evaluate lazily as sometimes UI can show other errors and this command somehow fails
        cmds.evalDeferred(lambda *args: cmds.dockControl(MainWindow.DOCK_NAME,e=True,r=True));
        
        # a bit of a fake, but can't find a better place for an infrequent save
        LayerEvents.layerAvailabilityChanged.addHandler(window.savePrefs, MainWindow.DOCK_NAME)
        
        return window
Пример #5
0
	def win(self,**kwargs):
		if mc.window(self.window,ex=True):mc.deleteUI(self.window,window=True)
		if mc.dockControl(self.dock,ex=True):mc.deleteUI(self.dock)
		#if mc.workspaceControl(self.dock,ex=True): mc.deleteUI(self.dock)
		#mc.workspaceControl(self.dock,dockToPanel=['rcTools','left',1],label=self.name,floating=False)
		mc.window(self.window,t=self.name,dc=['topLeft','bottomLeft'],w=350)#,nde=True
		mc.formLayout(w=self.rowWidth)
		mc.dockControl(self.dock,area='left',content=self.window,label=self.name,floating=False,**kwargs)
Пример #6
0
def mainWindow(configData, assetsList, modules):
	layoutWidth = 450
	#check if the window already exists, if it does delete it.
	if cmds.window( 'pipeline', exists = True ):
		cmds.deleteUI( 'pipeline' )
	cmds.window( 'pipeline' )
	
	# create the base layouts for the UI
	form = cmds.formLayout( 'pipeline_mainFormLayout' )
	tabs = cmds.tabLayout('pipeline_mainTabsLayout', innerMarginWidth=5, innerMarginHeight=5)
	cmds.formLayout( form, edit=True, attachForm=((tabs, 'top', 0), (tabs, 'left', 0), (tabs, 'bottom', 0), (tabs, 'right', 0)) )
	
	# tab one contents start here
	tabOne = cmds.scrollLayout( horizontalScrollBarThickness=16, verticalScrollBarThickness=16)
	cmds.rowColumnLayout( 'pipeline_TabOne', width = layoutWidth, numberOfColumns = 1 )
	cmds.text( 'pipeline_tabOne_heading', label = 'manage pipline here' )
	
	# use the module names to create the work flow catagories
	for module in modules:
		# becuase the name of hte module is a string, use __import__ method to import it.
		currentModule = __import__(module)
		reload(currentModule)
		#based of the setting in config, create the module or not
		if module + '=True' in configData:
			currentModule.FMlayout(layoutWidth,configData,assetsList)
			cmds.setParent( '..' )
		if module + '=False' in configData:
			currentModule.disabledMessage()
	cmds.setParent('..'), cmds.setParent('..')
	
	# tab two starts here, it contains the options from the config file
	tabTwo = cmds.rowColumnLayout( width = layoutWidth, numberOfColumns = 1 )
	#cmds.text( label = 'This is intenationally blank.' )
	cmds.text( label = '' )
	# loop over the config data, creating relevant checkboxes and textfields
	for data in configData:
		dataName, dataType, property = pipe_func.findDataType(data)
		#print dataName
		if dataType == 'booleanData':
			if property == 'True':
				propertyValue = True
			if property == 'False':
				propertyValue = False
			cmds.checkBox( dataName + 'CB', label = dataName, value = propertyValue)
		if dataType == 'string':
			cmds.text( label = dataName )
			cmds.textField( dataName + 'TF', text = property, width = (layoutWidth -100) )
	# the save button goes here
	cmds.button( label = 'Save settings', command = lambda arg : pipe_func.saveOptionsSettings(configData) )
	cmds.setParent('..'), cmds.setParent('..')
	
	# tab names
	cmds.tabLayout( tabs, edit=True, tabLabel=((tabOne, 'pipeline'), (tabTwo, 'Options')) )
	
	# This line docks the window as tool palette or utility window, so it sits nicey nice at the side
	if cmds.dockControl( 'pipeline', exists = True ):
		cmds.deleteUI( 'pipeline' )
	cmds.dockControl( 'pipeline', label = 'Fire Monkeys Pipline Manager', area='right', content='pipeline', allowedArea='right' )
Пример #7
0
        def dockWindow(window):
            dWindow = "moduleManagerDockedWindow"
            if cmds.dockControl(dWindow, exists=1):
                cmds.deleteUI(dWindow)

            formLayout = str(cmds.formLayout(parent=window))
            cmds.dockControl(dWindow, allowedArea="all", content=formLayout, area="right", label=self.title)
            cmds.control(window, p=formLayout, e=1, w=310)
            cmds.setParent('..')
Пример #8
0
 def endLayout(self):
     # cmds.window( gMainWindow, edit=True, widthHeight=(900, 777) )
     if self.subdialog:
         cmds.showWindow(self.winName)
     elif self.dock:
         allowedAreas = ["right", "left"]
         cmds.dockControl(self.winName, l=self.title, area="left", content=self.winName, allowedArea=allowedAreas)
     else:
         cmds.showWindow(self.winName)
Пример #9
0
def open():

    global synoptic_window
    synoptic_window = Synoptic(getMayaWindow())
    synoptic_window.show()
    if (cmds.dockControl('synoptic_dock', q=1, ex=1)):
        cmds.deleteUI('synoptic_dock')
    allowedAreas = ['right', 'left']
    synoptic_dock = cmds.dockControl('synoptic_dock',aa=allowedAreas, a='left', content=SYNOPTIC_WIDGET_NAME, label='Synoptic View', w=350)
Пример #10
0
def reset_screen():
    """
    Hide all main window docks.
    """
    for name in config['WINDOW_RESET_DOCKS']:
        try:
            cmds.dockControl(name, e=True, vis=False)
        except RuntimeError:
            pass
Пример #11
0
 def deleteDock(self):
     obscured = mc.dockControl('shotDock', q = True, io = True)
     docked = mc.dockControl('shotDock', q = True, fl = True)
     if obscured and not docked:
         try:
             mc.evalDeferred("mc.deleteUI('shotDock')")
             print "Cleared Dock"
         except:
             pass            
Пример #12
0
def dockUI(iUI):
    if (cmds.dockControl(str(iUI.windowTitle()), q = True, exists = True)):
        cmds.deleteUI(str(iUI.windowTitle()))

    allowedAreas = ["left", "right"]
    cmds.dockControl(str(iUI.windowTitle()), area = "left", 
                     content = str(iUI.objectName()),
                     allowedArea = allowedAreas, width = 400,
                     vcc = lambda *x: iUI.close(), sizeable = True)
    iUI.show()
Пример #13
0
Файл: gui.py Проект: mkolar/Tapp
    def show(self):
        #delete previous ui
        if cmds.dockControl('tappWindow', exists=True):
            cmds.deleteUI('tappWindow')

        #creating ui
        win = Window()
        minSize = win.minimumSizeHint()
        cmds.dockControl('tappWindow', content='tappDialog', area='right',
                         label='Tapp', width=minSize.width())
Пример #14
0
    def __init__(self, dock = False):
        self.window = mc.window(title = "Task Info", width = 420, height = 600)
        mc.setParent(self.window)

        mc.columnLayout(adjustableColumn=True)

        if dock:
            mc.dockControl(l = "Import Asset", area = 'right', content = self.window, allowedArea = ['right', 'left'] )
        else:
            mc.showWindow(self.window)
Пример #15
0
    def savePrefs(self):
        if cmds.dockControl(MainWindow.DOCK_NAME,exists=True):
            self.preferedFloating.set(cmds.dockControl(MainWindow.DOCK_NAME,q=True,floating=True))
            self.preferedWidth.set(cmds.dockControl(MainWindow.DOCK_NAME,q=True,w=True))

        if cmds.window(MainWindow.DOCK_NAME,exists=True):
            self.preferedWidth.set(cmds.window(MainWindow.DOCK_NAME,q=True,w=True))
            self.preferedHeight.set(cmds.window(MainWindow.DOCK_NAME,q=True,h=True))
            self.preferedTop.set(cmds.window(MainWindow.DOCK_NAME,q=True,topEdge=True))
            self.preferedLeft.set(cmds.window(MainWindow.DOCK_NAME,q=True,leftEdge=True))
Пример #16
0
    def __init__(self):      
        if mc.layout(self.layoutname, query=True, exists=True) == True:
            mc.deleteUI(self.layoutname, lay=True)
        if mc.layout(self.layoutname, query=True, exists=True) != True:
            self.windowName = mc.loadUI(f=self._UI_File)
            mc.showWindow(self.windowName)

            allowedAreas = ['right', 'left']
            self.layout=mc.dockControl(area='right', content=self.windowName, l='SP_2012', w=390, h=490, allowedArea=allowedAreas)
            self.layoutname=mc.dockControl(self.layout,q=1,fpn=1)
Пример #17
0
def SundayUIToolsDockedOutliner():
    outlinerLayout = cmds.paneLayout(parent = mel.eval('$temp1=$gMainWindow'))
    if cmds.dockControl('sundayOutlinerInTheDock', exists = True):
        cmds.deleteUI('sundayOutlinerInTheDock')
    
    outlinerDock = cmds.dockControl('sundayOutlinerInTheDock', width = 275, area = 'left', label = 'Outliner', content = outlinerLayout, allowedArea = [
        'right',
        'left'])
    mel.eval('OutlinerWindow;')
    cmds.control('outlinerPanel1Window', edit = True, parent = outlinerLayout)
Пример #18
0
 def moveDock(self):  # Update dock location information
     if cmds.dockControl(self.GUI['dock'], q=True, fl=True):
         self.setLocation("float")
         self.purgeGUI()
         self.buildFloatLayout()
     else:
         area = cmds.dockControl(self.GUI['dock'], q=True, a=True)
         self.setLocation(area)
         self.purgeGUI()
         self.buildDockLayout()
Пример #19
0
    def createUI(self,winName,dock):
        """
        Creates dockable GUI if maya version above 2011
        else creates flying window
        """
        if dock:
            if cmds.dockControl(self.winName+"_dock",exists=True):
                cmds.deleteUI(winName+"_dock")
        else:
            if cmds.window(self.winName, exists=True):
                cmds.deleteUI(self.winName)
        self.widgets["window"] = cmds.window(self.winName, title = "Set Imageplane", width = 350, height = 300)
        self.obj=setimageplane()

        #create main layout
        self.widgets["mainLayout"]=cmds.columnLayout("mainLayout",width=350,height=400)
        #create rwoColumn layout for controls
        self.widgets["rowColumnLayout"]=cmds.rowColumnLayout('rowColumnLayout',nc=3,cw=[(1,40),(2,250),(3,30)],columnOffset=[(1,"both",5),(2,"both",5)])

        #Front imageplane
        self.widgets["frntlbl"]=cmds.text( label='Front' )
        self.widgets["fronti"]=cmds.textField('fronti',tx=self.frnttxt)
        self.widgets["frntbtn"]=cmds.iconTextButton('frntbtn', style='iconAndTextVertical',align='right', image1='fileOpen.xpm', height=8,command=partial(self.obj.selectImagePlane, 'frntbtn'))

        #Top imageplane
        self.widgets["toplbl"]=frntlbl=cmds.text( label='Top' )
        self.widgets["topi"]=cmds.textField('topi',tx=self.toptxt)
        self.widgets["topbtn"]=cmds.iconTextButton('toptn', style='iconAndTextVertical',align='right', image1='fileOpen.xpm', height=8,command=partial(self.obj.selectImagePlane, 'topbtn') )

        #Side imageplane
        self.widgets["sidelbl"]=cmds.text( label='Side' )
        self.widgets["sidei"]=cmds.textField('sidei',tx=self.sidetxt)
        self.widgets["sidebtn"]=cmds.iconTextButton('sidebtn', style='iconAndTextVertical',align='right', image1='fileOpen.xpm', height=8,command=partial(self.obj.selectImagePlane, 'sidebtn') )

        #back imageplane
        self.widgets["backlbl"]=cmds.text( label='Back')
        self.widgets["backi"]=cmds.textField('backi',tx=self.backtxt)
        self.widgets["backbtn"]=cmds.iconTextButton('backbtn', style='iconAndTextVertical',align='right', image1='fileOpen.xpm', height=8,command=partial(self.obj.selectImagePlane, 'backbtn') )
        cmds.separator( style='none',h=16,parent="mainLayout")

        # place btn controls
        self.widgets["btnLayout"]=cmds.rowColumnLayout(parent="mainLayout",nc=4,cw=[(1,120),(2,60),(3,60),(4,60)],columnOffset=[(1,"both",5),(2,"both",5),(3,"both",5)])

        self.widgets["hip"]=cmds.checkBox('hip',align='left', label='Hide in Perspective')
        mpInfocus=cmds.getPanel(wf=True)
        self.widgets["cancelbtn"] = cmds.button(label="Toggle",c=partial(self.toggleIp,mpInfocus))
        self.widgets["reset"] = cmds.button(label="Reset")
        self.widgets["donebtn"]=cmds.button(label="Set",c=partial(self.obj.ImgplaneDone))
        cmds.separator( style='none',h=16 )

        #Show the window
        if dock:
            cmds.dockControl(self.winName+"_dock", label="Set Imageplane", area="left",allowedArea="left", content=self.widgets["window"])
        else:
            cmds.showWindow(self.widgets["window"])
Пример #20
0
 def moveDock(s):  # Update dock location information
     """
     Track dock movement
     """
     if cmds.dockControl(s.dock, q=True, fl=True):
         s.location = "float"
         print "Floating Dock."
     else:
         area = cmds.dockControl(s.dock, q=True, a=True)
         s.location = area
         print "Docking %s." % area
Пример #21
0
	def updateTextField(self):
		self.m2011 = ( cmds.about(version=1) == "2011 x64")
		if ( self.m2011 and cmds.dockControl('DiagnosticUIManager', exists=1)) or cmds.window('DiagnosticUIManager', q=True, ex=True): # if in Maya 2011+ and dockable,

			textFieldString = '---window objects---\n\n'
			for obj in self.window:
			    if cmds.window(obj, q=True, ex=True): textFieldString += obj + '\n'
			textFieldString += '\n---dockable objects---\n\n'
			for obj in self.dockControl:
			    if cmds.dockControl(obj, q=1, exists=1): textFieldString += obj + '\n'
			cmds.scrollField('diagnosticUI_UIObjects_scrollField', edit=1, text=textFieldString)
Пример #22
0
def runMaya():
	if cmds.window(windowObject, q=True, exists=True):
		cmds.deleteUI(windowObject)
	global gui
	gui = MediaViewer( maya_main_window() )

	dockedWindow = False						# Edit this to change between docked window and free floating window
	if dockedWindow:
		allowedAreas = ['right', 'left']
		cmds.dockControl( label=windowTitle, area='left', content=windowObject, allowedArea=allowedAreas )
	else:
		gui.show() 
Пример #23
0
def SundayWarehouseBrowserDockedUI():
    if cmds.dockControl('sundayWarehouseBrowserDock', query = True, exists = True):
        cmds.deleteUI('sundayWarehouseBrowserDock')
    
    SundayWarehouseBrowserUI()
    mainWindow = cmds.paneLayout(parent = mel.eval('$temp1=$gMainWindow'))
    cmds.dockControl('sundayWarehouseBrowserDock', width = 275, area = 'right', label = 'Sunday | Warehouse Browser', content = mainWindow, allowedArea = [
        'right',
        'left'], backgroundColor = [
        4.6007e+18,
        4.6007e+18,
        4.6007e+18])
    cmds.control(warehouseBrowserUI, edit = True, parent = mainWindow)
Пример #24
0
 def __init__(self, *args):
     # first delete window if it already exists
     if (cmds.window('MainWindow', exists=True)):
         cmds.deleteUI('MainWindow')
     path = os.path.dirname(__file__)
     ui_file = path + '/ui/launcher.ui'
     self.ui = cmds.loadUI(f=ui_file)
     ## Create dock layout and tell it where it can go
     dockLayout = cmds.paneLayout(configuration='single', parent=self.ui)
     cmds.dockControl(allowedArea='all', area='right', floating=True, content=dockLayout, label='RenderBOX 1.0 Launcher')
     ## parent our window underneath the dock layout
     cmds.control(self.ui, e=True, parent=dockLayout)
     cmds.button( "send_PB", edit=True, command=self.sendJob )
Пример #25
0
def main(*args, **kwargs):
    if cmds.window(window_object, query=True, exists=True):
        cmds.deleteUI(window_object)
    if cmds.window(guide_object, query=True, exists=True):
        cmds.deleteUI(guide_object)
    if cmds.dockControl(dock_object, exists=True):
        cmds.deleteUI(dock_object)

    win = PandorasBox(content.get_maya_window())

    cmds.dockControl(dock_object, area="right", allowedArea=["left", "right"], 
                     width=430, content=window_object, label=dock_title)
    print win.objectName(), ' successfully loaded'
def setupScene(*args):
    
    cmds.currentUnit(time = 'ntsc')
    cmds.playbackOptions(min = 0, max = 100, animationStartTime = 0, animationEndTime = 100)
    cmds.currentTime(0)
    
    
    #check for skeleton builder or animation UIs
    if cmds.dockControl("skeletonBuilder_dock", exists = True):
	print "Custom Maya Menu: SetupScene"
	channelBox = cmds.formLayout("SkelBuilder_channelBoxFormLayout", q = True, childArray = True)
	if channelBox != None:
	    channelBox = channelBox[0]
	
	    #reparent the channelBox Layout back to maya's window
	    cmds.control(channelBox, e = True, p = "MainChannelsLayersLayout")
	    channelBoxLayout = mel.eval('$temp1=$gChannelsLayersForm')
	    channelBoxForm = mel.eval('$temp1 = $gChannelButtonForm')
	
	    #edit the channel box pane's attachment to the formLayout
	    cmds.formLayout(channelBoxLayout, edit = True, af = [(channelBox, "left", 0),(channelBox, "right", 0), (channelBox, "bottom", 0)], attachControl = (channelBox, "top", 0, channelBoxForm))
	    
	    
	#print "deleting dock and window and shit"
	cmds.deleteUI("skeletonBuilder_dock")
	if cmds.window("SkelBuilder_window", exists = True):
	    cmds.deleteUI("SkelBuilder_window")	




	
    if cmds.dockControl("artAnimUIDock", exists = True):
	
	channelBox = cmds.formLayout("ART_cbFormLayout", q = True, childArray = True)
	if channelBox != None:
	    channelBox = channelBox[0]
	
	    #reparent the channelBox Layout back to maya's window
	    cmds.control(channelBox, e = True, p = "MainChannelsLayersLayout")
	    channelBoxLayout = mel.eval('$temp1=$gChannelsLayersForm')
	    channelBoxForm = mel.eval('$temp1 = $gChannelButtonForm')
	
	    #edit the channel box pane's attachment to the formLayout
	    cmds.formLayout(channelBoxLayout, edit = True, af = [(channelBox, "left", 0),(channelBox, "right", 0), (channelBox, "bottom", 0)], attachControl = (channelBox, "top", 0, channelBoxForm))
	    
	    
	#print "deleting dock and window and shit"
	cmds.deleteUI("artAnimUIDock")
	if cmds.window("artAnimUI", exists = True):
	    cmds.deleteUI("artAnimUI")
Пример #27
0
def showItemsUI():
    """Shows a window with all items available"""

    windowName = 'dmptools_items_window'
    controlName = 'dmptools_items_ctrl'
    title = 'dmptools item list'
    try:
        cmds.deleteUI(controlName, control=True)
    except:
        pass
    try:
        cmds.deleteUI(windowName, window=True)
    except:
        pass

    cmds.window(windowName, title=title)
    form = cmds.formLayout()
    itemsFilterField = cmds.textFieldGrp('itemsFilterField', l='filter:', tcc=filterItems, annotation='start typing something to filter the list of hotkeys.\
                                            \ntype: "key <letter/number>" to filter only by hotkey key.')
    scrollListField = cmds.textScrollList('dmptoolsItemsScrollList')

    # use the string list and generate the scroll list for the UI
    for item in createScrollList():
        # append to global var
        SCROLL_ITEMS.append(item)
        # append to the actual scroll list
        cmds.textScrollList('dmptoolsItemsScrollList', e=True, append=item, dcc=executeCommand, sc=showHelp, ann='Click on the item to print the help about it.\
                                                                                                        \nYou can double click the item to execute the associated command.')
    closeButton = cmds.button('itemsCloseButton',
                label="Close",
                c='import maya.cmds as cmds;cmds.deleteUI("'+controlName+'", control=True)')
    
    # attach the ui elements to the main form layout
    cmds.formLayout(form, e=True,
                        attachForm=[
                                        (itemsFilterField, 'top', 5),
                                        (itemsFilterField, 'left', 5),
                                        (itemsFilterField, 'right', 5),
                                        (scrollListField, 'left', 5),
                                        (scrollListField, 'right', 5),
                                        (closeButton, 'left', 5),
                                        (closeButton, 'right', 5),
                                        (closeButton, 'bottom', 5),
                                    ],
                        attachControl=[
                                        (scrollListField, "top", 5, itemsFilterField),
                                        (scrollListField, "bottom", 5, closeButton)
                                    ]
                    )
    # create a dockable window if dockable is true
    cmds.dockControl(controlName, label=title, floating=False, area='right', content=windowName)
Пример #28
0
 def display(self):
     """ Create and Open the current gui windows """
     res = cmds.window(self.winName, exists=True)
     print (self.winName, res) 
     if res and self.created:
         if self.subdialog:
             cmds.window(self.winName,e=1,vis=True)
         elif self.dock  :
             cmds.dockControl(self.winName, e=1,vis=True)
         else :
             cmds.window(self.winName,e=1,vis=True)
     else :    
         self.CreateLayout()
         self.created = True
Пример #29
0
    def close(self,*args):
        """ Close the windows"""
#        res = cmds.window(self.winName, q=1, exists=1)
#        print res
#        if bool(res):
#            print winName, " exist"
#            cmds.deleteUI(self.winName, window=True)
#            cmds.window(self.winName,e=1,vis=False)#this delete the windows...
        if self.subdialog:
            cmds.window(self.winName,e=1,vis=False)
        elif self.dock  :
            cmds.dockControl(self.winName, e=1,vis=False)
        else :
            cmds.window(self.winName,e=1,vis=False)
def runMaya():
    if cmds.window(windowObject, q=True, exists=True):
        cmds.deleteUI(windowObject)
    if cmds.dockControl("MayaWindow|" + windowTitle, q=True, ex=True):
        cmds.deleteUI("MayaWindow|" + windowTitle)
    global gui
    gui = Main(parent=maya_main_window())
    # gui = Main( parent=QtGui.QApplication.activeWindow() ) # Alternative way of setting parent window

    if launchAsDockedWindow:
        allowedAreas = ["right", "left"]
        cmds.dockControl(windowTitle, label=windowTitle, area="left", content=windowObject, allowedArea=allowedAreas)
    else:
        # gui.setWindowModality(QtCore.Qt.WindowModal) # Set modality
        gui.show()
 def __init__(self):
     self.projInfo = ppc.ProjectInfo()
     if not self.projInfo.validProject:
         utils.msgWin("Error", "Not a valid Project", False)
         return
     self.cachePipe = True if self.projInfo.pipelineType == "cache" else False
     if mc.window('shotManager', exists=1): mc.deleteUI('shotManager')
     if mc.windowPref('shotManager', exists=1):
         mc.windowPref('shotManager', r=1)
     if mc.dockControl('shotDock', q=True, exists=1):
         mc.deleteUI('shotDock')
     if mc.tabLayout("mainShotTab", ex=True): mc.deleteUI("mainShotTab")
     mel.eval(
         "global string $gMainWindow;tabLayout -parent $gMainWindow mainShotTab"
     )
     self.win = mc.loadUI(f=shotUi)
     mc.control(self.win, e=1, ebg=1, p="mainShotTab")
     mc.tabLayout("mainShotTab", e=1, tv=0)
     mc.dockControl('shotDock',
                    w=375,
                    a='right',
                    con="mainShotTab",
                    aa=['right', 'left'],
                    l='Toonz Shot Manager',
                    vcc=self.clearDock)
     eporsq = "Episode : " if self.projInfo.epOrSeq == "ep" else "Sequence : "
     mc.text("lblEpisode", e=True, l=eporsq)
     breakDown = self.projInfo.breakDown
     self.breakDownPath = "%s/%s" % (self.projInfo.mapDrive, breakDown)
     self.setDept()
     self.deptChange()
     mc.optionMenu('cmbDepts', e=1, cc=lambda event: self.deptChange())
     mc.optionMenu('cmbEpisode', e=1, cc=lambda event: self.loadShots())
     mc.optionMenu('cmbShot', e=1, cc=lambda event: self.selectDeptVer())
     mc.optionMenu('cmbDeptVer', e=1, cc=lambda event: self.loadVersions())
     mc.optionMenu('cmbRetake', e=1, cc=lambda event: self.loadVersions())
     mc.optionMenu('cmbCategory', e=1, cc=lambda event: self.fgbgSwitch())
     mc.button('btnOpen', e=1, c=lambda event: self.openFile("file"))
     mc.button('btnOpenVer', e=1, c=lambda event: self.openFile("ver"))
     mc.button('btnImpCam', e=1, c=lambda event: self.importCamera())
     mc.button('btnOpenBlast', e=1, c=lambda event: self.openBlast())
     mc.button('btnCreateWs', e=1, c=lambda event: self.createWs())
     mc.button('btnSaveToWs', e=1, c=lambda event: self.saveFile())
     mc.button('btnSaveToLocal', e=1, c=lambda event: self.saveFile(True))
     mc.checkBox('chkPlayblast', e=1, cc=lambda event: self.toggleCache())
     mc.checkBox('chkCache', e=1, cc=lambda event: self.togglePb())
Пример #32
0
def UI():

    if cmds.dockControl("myToolbarDock", exists=True):
        cmds.deleteUI("myToolbarDock")

    widget["window"] = cmds.window(mnb=False, mxb=False, title="Toolbar")
    widget["scrollLayout"] = cmds.scrollLayout(horizontalScrollBarThickness=0)
    widget["mainLayout"] = cmds.columnLayout(adj=True, parent=widget["scrollLayout"])

    # find icons and create symbol button for each icon

    populateIcons()

    # create a dock
    widget["dock"] = cmds.dockControl("myToolbarDock", label="ToolBar Dock", area='left',
                                      content=widget["window"],
                                      allowedArea='left')
Пример #33
0
def run(found_file):
    if cmds.window(windowObject, q=True, exists=True):
        cmds.deleteUI(windowObject)
    if cmds.dockControl( 'MayaWindow|'+windowTitle, q=True, ex=True):
        cmds.deleteUI( 'MayaWindow|'+windowTitle )
    global gui
    gui = Importer( found_file, maya_main_window())
    gui.show()
Пример #34
0
def main(*args, **kwargs):
    if cmds.window(window_object, query=True, exists=True):
        cmds.deleteUI(window_object)
    if cmds.window(guide_object, query=True, exists=True):
        cmds.deleteUI(guide_object)
    if cmds.dockControl(dock_object, exists=True):
        cmds.deleteUI(dock_object)

    win = PandorasBox(content.get_maya_window())

    cmds.dockControl(dock_object,
                     area="right",
                     allowedArea=["left", "right"],
                     width=430,
                     content=window_object,
                     label=dock_title)
    print win.objectName(), ' successfully loaded'
Пример #35
0
 def __init__(self, *args):
     # first delete window if it already exists
     if (cmds.window('MainWindow', exists=True)):
         cmds.deleteUI('MainWindow')
     path = os.path.dirname(__file__)
     ui_file = path + '/ui/launcher.ui'
     self.ui = cmds.loadUI(f=ui_file)
     ## Create dock layout and tell it where it can go
     dockLayout = cmds.paneLayout(configuration='single', parent=self.ui)
     cmds.dockControl(allowedArea='all',
                      area='right',
                      floating=True,
                      content=dockLayout,
                      label='RenderBOX 1.0 Launcher')
     ## parent our window underneath the dock layout
     cmds.control(self.ui, e=True, parent=dockLayout)
     cmds.button("send_PB", edit=True, command=self.sendJob)
    def Dock_Win_Management(self, title="Defualt"):
        Title_Name = title

        def mayaToQT(name):
            # Maya -> QWidget
            ptr = omui.MQtUtil.findControl(name)
            if ptr is None: ptr = omui.MQtUtil.findLayout(name)
            if ptr is None: ptr = omui.MQtUtil.findMenuItem(name)
            if ptr is not None: return wrapInstance(long(ptr), QWidget)

        if self.DOCK == "undock":
            # undock 窗口
            # win = omui.MQtUtil_mainWindow()
            if mel.eval("getApplicationVersionAsFloat;") >= 2017:
                self.undockWindow = cmds.window(title=Title_Name,
                                                cc=self.Save_Json_Fun)
            else:
                self.undockWindow = cmds.window(title=Title_Name,
                                                rc=self.Save_Json_Fun)
            cmds.paneLayout()
            cmds.showWindow(self.undockWindow)
            ptr = mayaToQT(self.undockWindow)
            return ptr

        elif self.DOCK == "dock":
            window = cmds.window(title=Title_Name)
            cmds.paneLayout()
            self.dockControl = cmds.dockControl(
                area='right',
                fl=False,
                content=window,
                label=Title_Name,
                floatChangeCommand=self.Save_Json_Fun,
                vcc=self.Save_Json_Fun)

            # 显示当前面板
            cmds.evalDeferred("cmds.dockControl(\"" + self.dockControl +
                              "\",e=True,r=True)")

            dock = mayaToQT(window)
            return dock

        elif self.DOCK == "workspace":
            name = title

            # string $channelsLayersDockControl = getUIComponentDockControl(“Channel Box / Layer Editor”, false);
            # workspaceControl –e –tabToControl $channelsLayersDockControl -1 yourWorkspaceControl;
            self.workspaceCtrl = cmds.workspaceControl(
                name,
                tabToControl=["ChannelBoxLayerEditor", 0],
                label=Title_Name,
                vcc=self.Save_Json_Fun)

            # 显示当前面板
            cmds.evalDeferred("cmds.workspaceControl(\"" + self.workspaceCtrl +
                              "\",e=True,r=True)")
            workspace = mayaToQT(self.workspaceCtrl)
            return workspace
def UI():
    
    startDirectory = "D:/"
    
    #check to see if window exists
    if cmds.dockControl("fileListerDock", exists = True):
        cmds.deleteUI("fileListerDock")
        
    if cmds.window("customFileLister", exists = True):
        cmds.deleteUI("customFileLister")
        
    #create our window
    window = cmds.window("customFileLister", w = 300, h = 400, sizeable = False, mnb = False, mxb = False, title = "File Lister")
    
    #create the layout
    form = cmds.formLayout(w = 300, h = 400)
    
    #create the widgets
    addressBar = cmds.textField("addressBarTF", w = 250, text = startDirectory, parent = form)
    backButton = cmds.button(label = "<--", w = 30, h = 20, command = back, parent = form)
    fileFilters = cmds.optionMenu("fileFiltersOM", label = "", w = 80, parent = form, cc = partial(getContents, None))
    searchField = cmds.textField("searchTF", w = 90, text = "search..", cc = partial(getContents, None))
    addFavoriteButton = cmds.button(label = "Add Favortite", w = 90, c = addFavorite)
    favoriteList = cmds.scrollLayout("favoriteListSL", w = 90, h = 210, parent = form)
    scrollLayout = cmds.scrollLayout("contentSL", w = 200, h = 300, hst = 0, parent = form)
    
    #add menuItems to the optionMenu
    for item in ["All Files", "Maya Files", "Import Files", "Texture Files"]:
        cmds.menuItem(label = item, parent = fileFilters)
    
    #attach the UI elements to the layout
    cmds.formLayout(form, edit = True, af = [(addressBar,  "top", 10), (addressBar, "left", 40)] )
    cmds.formLayout(form, edit = True, af = [(backButton,  "top", 10), (backButton, "left", 10)] )
    cmds.formLayout(form, edit = True, af = [(scrollLayout,  "top", 40), (scrollLayout, "left", 10)] )
    cmds.formLayout(form, edit = True, af = [(fileFilters,  "top", 40)], ac = [fileFilters, "left", 5, scrollLayout] )
    cmds.formLayout(form, edit = True, af = [(searchField,  "top", 70)], ac = [searchField, "left", 5, scrollLayout] )
    cmds.formLayout(form, edit = True, af = [(addFavoriteButton,  "top", 100)], ac = [addFavoriteButton, "left", 5, scrollLayout] )
    cmds.formLayout(form, edit = True, af = [(favoriteList,  "top", 130)], ac = [favoriteList, "left", 5, scrollLayout] )


    #show the window
    cmds.dockControl("fileListerDock", area = "right", content = window, w = 310, aa = "left")
    
    getContents(startDirectory)
    loadFavorites()
Пример #38
0
 def createDockLayout(self):
     gMainWindow = mm.eval('$temp1=$gMainWindow')
     columnLay = cmds.paneLayout(parent=gMainWindow, width=500)
     dockControl = cmds.dockControl(l='AnimSubmitUI',
                                    allowedArea='all',
                                    area='right',
                                    content=columnLay,
                                    width=500)
     cmds.control(str(self.objectName()), e=True, p=columnLay)
def interCreate(docked=False):
    deleteFromGlobal()
    global interDialog
    if interDialog is None:
        interDialog = ProShaper()
        if docked:
            ptr = mui.MQtUtil.mainWindow()
            main_window = shi.wrapInstance(long(ptr), qg.QMainWindow)

            interDialog.setParent(main_window)
            size = interDialog.size()

            name = mui.MQtUtil.fullName(long(
                shi.getCppPointer(interDialog)[0]))
            dock = cmds.dockControl(allowedArea=['right', 'left'],
                                    floating=not (docked),
                                    content=name,
                                    width=size.width(),
                                    height=size.height(),
                                    label='Interpolate It',
                                    r=True,
                                    bgc=(0.141, 0.135, 0.135),
                                    ebg=True,
                                    ret=False)
            """ from this is the process to delete the dock from maya window
            before create it again, this way will only appear once in dock panel """
            dockWidget = mui.MQtUtil.findControl(dock)
            dockName = shi.wrapInstance(long(dockWidget), qg.QWidget)
            interDialog.dock_widget = dockWidget
            interDialog.dock_name = dockName
            name = dockName.objectName()

            def changeName(name):
                intNum = int(name[-1])
                if intNum in range(1, 10):
                    preNum = str(intNum - 1)
                    alpha = list(name)
                    alpha[-1] = preNum
                    newName = "".join(alpha)
                    print newName
                    return newName

            oldTool = changeName(name)
            stackDock = 'dockControl5'
            print stackDock

            if oldTool != stackDock[:]:
                try:
                    cmds.deleteUI(oldTool)
                    print('DockControl -- > {} DELETED'.format(oldTool))
                except:
                    pass
            else:
                pass

        else:
            interDialog.show(dockable=True)
Пример #40
0
def runMaya(obj):

    if cmds.window(windowObject, q=True, exists=True):
        cmds.deleteUI(windowObject)
    if cmds.dockControl('MayaWindow|' + windowTitle, q=True, ex=True):
        cmds.deleteUI('MayaWindow|' + windowTitle)
    global gui
    gui = Publisher(obj)

    if launchAsDockedWindow:
        allowedAreas = ['right', 'left']
        cmds.dockControl(windowTitle,
                         label=windowTitle,
                         area='left',
                         content=windowObject,
                         allowedArea=allowedAreas)
    else:
        gui.show()
Пример #41
0
    def updateTextField(self):
        self.m2011 = (cmds.about(version=1) == "2011 x64")
        if (self.m2011 and cmds.dockControl(
                'DiagnosticUIManager', exists=1)) or cmds.window(
                    'DiagnosticUIManager', q=True,
                    ex=True):  # if in Maya 2011+ and dockable,

            textFieldString = '---window objects---\n\n'
            for obj in self.window:
                if cmds.window(obj, q=True, ex=True):
                    textFieldString += obj + '\n'
            textFieldString += '\n---dockable objects---\n\n'
            for obj in self.dockControl:
                if cmds.dockControl(obj, q=1, exists=1):
                    textFieldString += obj + '\n'
            cmds.scrollField('diagnosticUI_UIObjects_scrollField',
                             edit=1,
                             text=textFieldString)
Пример #42
0
    def buildUI(self):
        if cmds.dockControl("characterPicker_dockControl", exists=True):
            cmds.deleteUI("characterPicker_dockControl")

        self.widgets["window"] = cmds.window(title="Character Picker", w=400, h=600, mnb=False, mxb=False)
        self.widgets["mainLayout"] = cmds.columnLayout(w=400, h=600)
        self.widgets["tabLayout"] = cmds.tabLayout()

        for name in self.namespaces:
            self.widgets[(name + "_formLayout")] = cmds.formLayout(w=400, h=600, parent=self.widgets["tabLayout"])

            namespace = name + ":"

            # create the buttons
            self.widgets[name + "_headButton"] = cmds.button(label="", w=40, h=40, bgc=[0, 0.593, 1])
            cmds.button(self.widgets[name + "_headButton"], edit=True, c=partial(self.selectControls, [namespace + "head"], [(self.widgets[name + "_headButton"], [0, 0.593, 1])]))

            self.widgets[name + "_spine03Button"] = cmds.button(label="", w=100, h=40, bgc=[0.824, 0.522, 0.275])
            cmds.button(self.widgets[name + "_spine03Button"], edit=True, c=partial(self.selectControls, [namespace + "spine_03"], [(self.widgets[name + "_spine03Button"], [0.824, 0.522, 0.275])]))

            self.widgets[name + "_spine02Button"] = cmds.button(label="", w=100, h=40, bgc=[0.824, 0.522, 0.275])
            cmds.button(self.widgets[name + "_spine02Button"], edit=True, c=partial(self.selectControls, [namespace + "spine_02"], [(self.widgets[name + "_spine02Button"], [0.824, 0.522, 0.275])]))

            self.widgets[name + "_spine01Button"] = cmds.button(label="", w=100, h=40, bgc=[0.824, 0.522, 0.275])
            cmds.button(self.widgets[name + "_spine01Button"], edit=True, c=partial(self.selectControls, [namespace + "spine_01"], [(self.widgets[name + "_spine01Button"], [0.824, 0.522, 0.275])]))

            self.widgets[name + "_selectAllSpineButton"] = cmds.button(label="", w=30, h=30, bgc=[0, 1, 0])
            cmds.button(self.widgets[name + "_selectAllSpineButton"], edit=True, c=partial(self.selectControls,
            [(namespace + "spine_01"), (namespace + "spine_02"), (namespace + "spine_03")],
            [(self.widgets[name + "_spine01Button"], [0.824, 0.522, 0.275]),
             (self.widgets[name + "_spine02Button"], [0.824, 0.522, 0.275]),
             (self.widgets[name + "_spine03Button"], [0.824, 0.522, 0.275])]))

            # place the buttons
            cmds.formLayout(self.widgets[name + "_formLayout"], edit=True, af=[(self.widgets[name + "_headButton"], "left", 175), (self.widgets[name + "_headButton"], "top", 100)])
            cmds.formLayout(self.widgets[name + "_formLayout"], edit=True, af=[(self.widgets[name + "_spine03Button"], "left", 145), (self.widgets[name + "_spine03Button"], "top", 150)])
            cmds.formLayout(self.widgets[name + "_formLayout"], edit=True, af=[(self.widgets[name + "_spine02Button"], "left", 145), (self.widgets[name + "_spine02Button"], "top", 200)])
            cmds.formLayout(self.widgets[name + "_formLayout"], edit=True, af=[(self.widgets[name + "_spine01Button"], "left", 145), (self.widgets[name + "_spine01Button"], "top", 250)])
            cmds.formLayout(self.widgets[name + "_formLayout"], edit=True, af=[(self.widgets[name + "_selectAllSpineButton"], "left", 250), (self.widgets[name + "_selectAllSpineButton"], "top", 205)])

            cmds.tabLayout(self.widgets["tabLayout"], edit=True, tabLabel=((self.widgets[(name + "_formLayout")], name)))

        # cmds.showWindow(self.widgets["window"])
        cmds.dockControl(label="Character Picker", area="right", allowedArea="right", content=self.widgets["window"])
Пример #43
0
def runMaya():
    if cmds.window(windowObject, q=True, exists=True):
        cmds.deleteUI(windowObject)
    if cmds.dockControl('MayaWindow|' + windowTitle, q=True, ex=True):
        cmds.deleteUI('MayaWindow|' + windowTitle)
    global gui
    gui = HelloWorld(parent=maya_main_window())
    #gui = HelloWorld( parent=QtGui.QApplication.activeWindow() ) # Alternative way of setting parent window

    if launchAsDockedWindow:
        allowedAreas = ['right', 'left']
        cmds.dockControl(windowTitle,
                         label=windowTitle,
                         area='left',
                         content=windowObject,
                         allowedArea=allowedAreas)
    else:
        #gui.setWindowModality(QtCore.Qt.WindowModal) # Set modality
        gui.show()
Пример #44
0
def script_output(direction):
    """
    Script output dock for layouts.
    """
    dock_control = config['WINDOW_SCRIPT_OUTPUT_DOCK']
    dock_window = config['WINDOW_SCRIPT_OUTPUT']
    if cmds.dockControl(dock_control, ex=True):
        return cmds.dockControl(dock_control, e=True, vis=True, fl=False)

    if cmds.window(dock_window, ex=True):
        main_win = dock_window
    else:
        main_win = cmds.window(dock_window, title='Output Window')

    cmds.paneLayout(parent=main_win)

    # context menu
    output_win = cmds.cmdScrollFieldReporter(fst="")
    cmds.popupMenu(parent=output_win)
    cmds.menuItem(
        label='Clear Output',
        command=lambda c: cmds.cmdScrollFieldReporter(
            output_win, e=True, clear=True),
    )
    # Echo all commands toggle
    cmds.menuItem(
        label='Toggle Echo Commands',
        command=lambda c: cmds.commandEcho(state=not (cmds.commandEcho(
            q=True, state=True))),
    )
    # Go to python reference
    cmds.menuItem(
        label='Python Command Reference',
        command=lambda c: cmds.showHelp('DocsPythonCommands'),
    )

    cmds.dockControl(dock_control,
                     content=main_win,
                     label='Output Window',
                     area=direction,
                     height=500,
                     floating=False,
                     allowedArea=['left', 'right'])
def run_maya():
    """Run in Maya"""
    _maya_delete_ui()  # Delete any existing existing UI
    boil = Boilerplate(parent=_maya_main_window())

    # Makes Maya perform magic which makes the window stay
    # on top in OS X and Linux. As an added bonus, it'll
    # make Maya remember the window position
    boil.setProperty("saveWindowPref", True)

    if not DOCK_WITH_MAYA_UI:
        boil.show()  # Show the UI
    elif DOCK_WITH_MAYA_UI:
        allowed_areas = ['right', 'left']
        cmds.dockControl(WINDOW_TITLE,
                         label=WINDOW_TITLE,
                         area='left',
                         content=WINDOW_OBJECT,
                         allowedArea=allowed_areas)
Пример #46
0
def _UIprotoloco():
    if mc.window('protowin', ex=True):
        mc.deleteUI('protowin')

    if mc.dockControl('dockWin', ex=True):
        mc.deleteUI('dockWin')

    protoWinV = mc.window('protowin', s=0)
    buttonForm = mc.rowColumnLayout(parent=protoWinV, numberOfRows=1)
    mc.button(parent=buttonForm,
              label='TIME RANGE',
              command='PH_PROTOLOCOS._rangeTimeLine()',
              bgc=(0.1, 0.8, 0.0))
    mc.button(parent=buttonForm,
              label='Protocolo KEY 0',
              command='PH_PROTOLOCOS._protocolo0Key()',
              w=100,
              h=20,
              bgc=(1.0, 0.4, 0.0),
              visible=0)
    mc.button(parent=buttonForm,
              label='Protocolo KEY 60',
              command='PH_PROTOLOCOS._protocolo60Key()',
              bgc=(1.0, 0.5, 0.0),
              visible=0)
    mc.button(parent=buttonForm,
              label='Protocolo KEY 90',
              bgc=(1.0, 0.6, 0.0),
              visible=0)
    mc.button(parent=buttonForm,
              label='Protocolo KEY 100',
              bgc=(1.0, 0.7, 0.0),
              visible=0)
    mc.button(parent=buttonForm,
              label='Protocolo KEY +5',
              bgc=(1.0, 0.8, 0.0),
              visible=0)
    #dock bar
    mc.dockControl('dockWin',
                   label='PROTOLOCOS PH TOOL v0.2',
                   area='bottom',
                   content=protoWinV,
                   allowedArea='right')
Пример #47
0
def run_maya():
	if cmds.window(WINDOW_OBJECT, q=True, exists=True):
		cmds.deleteUI(WINDOW_OBJECT)

	if cmds.dockControl( 'MayaWindow|'+WINDOW_TITLE, q=True, ex=True):
		cmds.deleteUI( 'MayaWindow|'+WINDOW_TITLE )

	global gui
	gui = HelloWorld( parent=maya_main_window() )
	# Alternative way of setting parent window below:
	#gui = HelloWorld( parent=QtGui.QApplication.activeWindow() )

	if MAYA_LAUNCH_AS_DOCKED_WINDOW:
		allowedAreas = ['right', 'left']
		cmds.dockControl( WINDOW_TITLE, label=WINDOW_TITLE, area='left',
						  content=WINDOW_OBJECT, allowedArea=allowedAreas )
	else:
		#gui.setWindowModality(QtCore.Qt.WindowModal) # Set modality
		gui.show()
Пример #48
0
def deleteDock(name=''):
    """
    Deletes a docked UI
    Args:
        name: Name of the dock to delete
    """
    if cmds.dockControl(name, query=True,
                        exists=True):  # workspaceControl on 2017
        logger.debug("The dock should be deleted next")
        cmds.deleteUI(name)
Пример #49
0
def MainWidow():
    if cmds.dockControl('MainDock', ex=True):
        cmds.deleteUI('MainDock')
    # win = cmds.window('Mainplugins', title='MyPlugins', widthHeight=(500, 200))
    Mywindow = cmds.window(widthHeight=(100, 100))
    bufttonForm = cmds.columnLayout('MainLay', adj=True)
    cmds.button(en=False, l='python ' + version)
    cmds.button(l=u'显示场景插件', c=showPlugins)
    cmds.button(l=u'查看项目路径', c=showworkspace)
    cmds.button(l=u'显示FumeFX缓存文件', c=showFumeFX)
    cmds.button(l=u'显示Realflow缓存文件', c=showRealfowcache)
    cmds.button(l=u'设置maya2016视口模式', c=setViewport)
    cmds.button(l=u'清理场景', c=cleanmysence)
    cmds.button(l=u'检查代理', c=ProxyWindow)
    allowedAreas = ['right', 'left']
    cmds.dockControl('MainDock',
                     l='Myplugins',
                     area='right',
                     allowedArea=allowedAreas,
                     content=Mywindow)
def _maya_delete_ui(window_object, window_title):
	""" Delete existing UI in Maya.
	"""
	if mc.window(window_object, query=True, exists=True):
		mc.deleteUI(window_object)  # Delete window
		print("Delete UI: " + window_object)

	dock_control = '%s|%s' % (_maya_main_window().objectName(), re.sub(r'\W', '_', window_title))
	if mc.dockControl(dock_control, query=True, exists=True):
		mc.deleteUI(dock_control)  # Delete docked window
		print("Delete Dock Control: " + dock_control)
Пример #51
0
    def createUI(self, windowName, windowHeight, windowWidth, dock, scroll):
        if dock == True:
            if cmds.dockControl(windowName + "_dock", exists=True):
                cmds.deleteUI(windowName + "_dock")
        else:
            if cmds.window(windowName, exists=True):
                cmds.deleteUI(windowName)

        self.window = cmds.window(windowName, title=windowName, w=windowWidth, h=windowHeight, mnb=False, mxb=False)

        self.mainLayout = cmds.columnLayout(w=windowWidth, h=windowHeight)


        # unique UI stuff
        self.createCustom()

        if dock == True:
            cmds.dockControl(windowName + "_dock", label=windowName + "_dock", area="left", content=self.window)
        else:
            cmds.showWindow(self.window)
Пример #52
0
	def createUI(self,winName,dock):
		##if Maya version is 2011 or above, create a doclable window,
		##else create a floating window.
		if dock==True:
			if cmds.dockControl("%s_dock" % winName, q=True, exists=True):
				cmds.deleteUI("%s_dock" % winName)
		else:
			if cmds.window(winName, q=True, exists=True):
				cmds.deleteUI(winName)
		try:
			###create window
			self.widgets["window"]=cmds.window(title="Render Wireframe", width=350, mnb=False,mxb=False)
			self.widgets["mainLayout"]=cmds.columnLayout("mainLayout",width=340,height=400,adj=True)
			self.widgets["scrolFldRprtr"]=cmds.cmdScrollFieldReporter("scrolFldRprtr",w=350,eac=False,fst="python")
			cmds.separator(h=5,style="none")
			cmds.separator(h=5,style="none")
			self.widgets["Amb_Occlus"]=cmds.text( label='Press CTRL button & hit the shelfbar button to render with AO' )
			self.widgets["rowColumnLayout"]=cmds.rowColumnLayout(nc=2,cw=[(1,180),(2,140)],columnOffset=[(1,"both",5),(2,"both",2)])
			self.widgets["aoCheck"]=cmds.checkBox("aoCheck",label='Render with Ambient Occlusion' ,  value=self.FLAG)


			self.widgets["mtrlSg_Attrib_Contrls"]= cmds.frameLayout('mtrlSg_Attrib_Contrls',w=340,
			label='Change Color and Wire Width', borderStyle='in',parent=self.widgets["mainLayout"] )
			self.widgets["formLayout"] = cmds.formLayout("formLayout",numberOfDivisions=100)

			self.widgets["wireframeColor"]=cmds.attrColorSliderGrp('wireframeColor', sb=True, at='lambert1.outColor', l='Object Color')
			self.widgets["wireColorSlider"]=cmds.attrColorSliderGrp("wireColorSlider", l='Wire Color', at='initialShadingGroup.miContourColor',
			ann='the Wires will only show up in Render', sb=False)
			self.widgets["wirewidthControl"]=cmds.attrFieldSliderGrp("wirewidthControl",at=self.shadEngine+'.miContourWidth',
			ann='keep value between .5 and .8', min=0.0, max=1.50,l='Wire Width' )
			self.widgets["antiAliasControl"]=cmds.floatSliderGrp("antiAliasControl", label='Anti Alias', cc=partial(self._change), field=True, minValue=0.01, maxValue=1.0, ann="change anti-alias contrast",  value=cmds.getAttr("miDefaultOptions.contrastR") )

			cmds.setParent('..')

			self.widgets["rowColumnRenLayout"]=cmds.rowColumnLayout( nc=2,cw=[(1,180),(2,140)],columnOffset=[(1,"both",5),(2,"both",2)])


			self.widgets["renderSelected"]=cmds.iconTextButton('renderSelbtn', al='left',h=25,image='WireFrameOnShaded.png',ann='Wireframe selected object',
			style='iconAndTextHorizontal',label='Wireframe Selected',c=self._restrictUiReload)

			self.widgets["renderBtn"]=cmds.iconTextButton('renderBtn', align="right", h=25, width=100 , ann='Click here to take a test Render Preview\n For good quality use high resolution',
			c=cmds.RenderIntoNewWindow, style='iconAndTextHorizontal', image='menuIconRender.png', label='Render Preview')
			self.widgets["mainLayout_btns"]=cmds.columnLayout("mainLayout_btns", width=340, height=400)
			self.widgets["showSGbtn"]=cmds.button(c=self.showSGroup, l="Show Material", ann="Opens Attribute Editor and displays material of the selected object")

			self.widgets["formLayout"]=cmds.formLayout("formLayout", edit=True, af=[("wireframeColor",'top',0), ("wireframeColor",'left', -70)])
			self.widgets["formLayout"]=cmds.formLayout("formLayout", edit=True, af=[("wireColorSlider",'top',20), ("wireColorSlider",'left', -70)])
			self.widgets["formLayout"]=cmds.formLayout("formLayout", edit=True, af=[("wirewidthControl",'top',40), ("wirewidthControl",'left', -70)])
			self.widgets["formLayout"]=cmds.formLayout("formLayout", edit=True, af=[("antiAliasControl",'top',60), ("antiAliasControl",'left', -70)])

			cmds.scriptJob(parent=self.widgets["window"], e=["SelectionChanged",self.update])
		except RuntimeError, err:
			   print err
Пример #53
0
def OPEN():
    window_name = 'HIK_retargeting'
    dock_control = 'HIK_retargeting_Dock'

    if cmds.window(window_name, exists=True):
        cmds.deleteUI(window_name)

    Window = uiMainWindow()
    Window.show()

    Window.setObjectName(window_name)

    if (cmds.dockControl(dock_control, q=True, ex=True)):
        cmds.deleteUI(dock_control)
    AllowedAreas = ['right', 'left']
    cmds.dockControl(dock_control,
                     aa=AllowedAreas,
                     a='left',
                     floating=False,
                     content=window_name,
                     label='HIK_retargeting')
Пример #54
0
def deleteDock(name='SplitJoint', version=VERSION):
    """
    A simple function to delete the given dock
    Args:
        name: the name of the dock
    """
    if version >= 2017:
        if cmds.workspaceControl(name, query=True, exists=True):
            cmds.deleteUI(name)
    else:
        if cmds.dockControl(name, query=True, exists=True):
            cmds.deleteUI(name)
Пример #55
0
def dock_widget(widget, dock_name, **kwargs):
    dock_path = '{0}Dock'.format(dock_name)

    dock_name = ' '.join(re.findall('[A-Z][a-z]*', dock_name))

    if cmds.dockControl(dock_path, q=True, ex=True):
        cmds.deleteUI(dock_path)

    kw = dict(r=True, area='right', vis=True, width=350)
    kw.update(kwargs)

    panel = cmds.paneLayout(configuration='single')
    cmds.control(widget.objectName(), e=True, p=panel)
    dock = cmds.dockControl(dock_path,
                            closeCommand=widget.close,
                            content=panel,
                            label=dock_name,
                            **kw)
    dock_ptr = omui.MQtUtil.findControl(dock)

    return shiboken.wrapInstance(long(dock_ptr), QtWidgets.QWidget)
Пример #56
0
def ehToolboxCreate():
    import maya.cmds as cmds
    import maya.mel as mel

    if cmds.window('ehToolbox', ex = True):
        cmds.deleteUI('ehToolbox')
    ehToolbox = cmds.window('ehToolbox', widthHeight=(200, 150) )

    form = cmds.formLayout()
    tabs = cmds.tabLayout(innerMarginWidth=5, innerMarginHeight=5)
    cmds.formLayout( form, edit=True, attachForm=((tabs, 'top', 5), (tabs, 'left', 5), (tabs, 'bottom', 5), (tabs, 'right', 5)))

    child1 = cmds.rowColumnLayout(numberOfColumns=4)
    cmds.symbolButton(image='square.xpm', c = jntChainFromSelection, ann = 'Joint Chain From Selection')
    jntModeBtn = cmds.symbolButton(image='square.xpm', c = jointOrientModeToggle, ann = 'Joint Orient Mode: Right click to manually select mode')
    jntModePopup = cmds.popupMenu(parent=jntModeBtn, ctl=False, button=3)
    jntModeitem1 = cmds.menuItem(l='Joint Orient Mode On', c = jointOrientModeOn)
    jntModeitem2 = cmds.menuItem(l='Joint Orient Mode Off', c = jointOrientModeOff)
    cmds.symbolButton(image='square.xpm', c = selNextSkinJnt, ann = 'Next Skin Joint', en = False)
    cmds.symbolButton(image='square.xpm', c = selectHi, ann = 'Select Hierarchy')
    cmds.symbolButton(image='square.xpm', c = sceneAnalyzerCreate, ann = 'Scene Analyzer')
    connectBtn = cmds.symbolButton(image='square.xpm', c = lambda x: connectTRSn('trsv'), ann = 'Connect Transform: Left click for all, right click for individual channels')
    connectPopup = cmds.popupMenu(parent=connectBtn, ctl=False, button=3)
    connectitem1 = cmds.menuItem(l='Connect Translate', fc = lambda x: connectTRSn('t'))
    connectitem2 = cmds.menuItem(l='Connect Rotate', c = lambda x: connectTRSn('r'))
    connectitem3 = cmds.menuItem(l='Connect Scale', c = lambda x: connectTRSn('s'))
    connectitem4 = cmds.menuItem(l='Connect Visibility', c = lambda x: connectTRSn('v'))
    ctrlBtn = cmds.symbolButton(image='square.xpm', c = lambda x: makeSimpleCtrl(True), ann = 'Make Simple Control: Right click for no constraint')
    ctrlPopup = cmds.popupMenu(parent=ctrlBtn, ctl=False, button=3)
    connectitem1 = cmds.menuItem(l='Unconstrained Control', c = lambda x: makeSimpleCtrl(False))
    cmds.symbolButton(image='square.xpm', c = basicAutoRigger, ann = 'WIP Autorigger')


    cmds.setParent( '..' )

    cmds.tabLayout( tabs, edit=True, tabLabel=(child1, 'One'))

    #cmds.tabLayout( tabs, edit=True, tabLabel=((child1, 'One'), (child2, 'Two'), (child3, 'Three')))

    cmds.dockControl(area='left', content=ehToolbox, allowedArea='all')
    def Dock_Win_Management(self):
        Title_Name = u"藤蔓生长快速绑定工具"

        def mayaToQT(name):
            # Maya -> QWidget
            ptr = omui.MQtUtil.findControl(name)
            if ptr is None: ptr = omui.MQtUtil.findLayout(name)
            if ptr is None: ptr = omui.MQtUtil.findMenuItem(name)
            if ptr is not None: return wrapInstance(long(ptr), QWidget)

        if self.DOCK == "undock":
            # undock 窗口
            # win = omui.MQtUtil_mainWindow()
            if mel.eval("getApplicationVersionAsFloat;") >= 2017:
                self.undockWindow = cmds.window(title=Title_Name,
                                                cc=partial(
                                                    self.closeEvent,
                                                    self.event))
            else:
                self.undockWindow = cmds.window(title=Title_Name,
                                                rc=partial(
                                                    self.closeEvent,
                                                    self.event))
            cmds.paneLayout()
            cmds.showWindow(self.undockWindow)
            ptr = mayaToQT(self.undockWindow)
            return ptr

        elif self.DOCK == "dock":

            window = cmds.window(title=Title_Name)
            cmds.paneLayout()
            self.dockControl = cmds.dockControl(
                area='right',
                content=window,
                label=Title_Name,
                floatChangeCommand=self.Win_Size_Adjustment,
                vcc=self.closeEvent)
            dock = mayaToQT(window)
            return dock

        elif self.DOCK == "workspace":
            name = 'VineGrowDock'
            if cmds.workspaceControl(name, query=True, exists=True):
                cmds.deleteUI(name)
            self.workspaceCtrl = cmds.workspaceControl(name,
                                                       fl=True,
                                                       label=Title_Name,
                                                       vcc=self.closeEvent)
            cmds.paneLayout()
            workspace = mayaToQT(self.workspaceCtrl)
            return workspace
Пример #58
0
 def reload(self):
     '''
     "reload" resets the diagnosticUI
     '''
     for obj in self.UIObjects.window:
         if cmds.window(obj, q=True, ex=True):
             cmds.deleteUI(obj)
     for obj in self.UIObjects.dockControl:
         if cmds.dockControl(obj, q=1, exists=1):
             cmds.deleteUI(obj)
     self.UIObjects = UIObjects.UIObjects()
     self.showWindow()
     self.updateTextField()
Пример #59
0
    def window_remove(self, *args):
        if not cmds.window(self.window, exists=True,
                           q=True) and not cmds.dockControl(
                               self.window, vis=True, q=True):

            for callback in self.callback_list:
                OpenMaya.MMessage.removeCallback(callback)

            sys.stdout.write('// Removed {0} callbacks!'.format(self.window))

            return False

        return True
Пример #60
0
    def open():
        '''
        just a shortcut method to construct and display main window
        '''

        window = MainWindow.getInstance()

        if cmds.control(MainWindow.DOCK_NAME, q=True, exists=True):
            cmds.control(MainWindow.DOCK_NAME, e=True, visible=True)
        else:
            cmds.dockControl(MainWindow.DOCK_NAME,
                             l=window.createWindowTitle(),
                             content=MainWindow.WINDOW_NAME,
                             area='right',
                             allowedArea=['right', 'left'],
                             width=window.preferedWidth.get(),
                             floating=window.preferedFloating.get(),
                             visibleChangeCommand=window.visibilityChanged)

            if window.preferedFloating.get():
                cmds.window(MainWindow.DOCK_NAME,
                            e=True,
                            topEdge=window.preferedTop.get(),
                            leftEdge=window.preferedLeft.get(),
                            w=window.preferedWidth.get(),
                            h=window.preferedHeight.get())

            Utils.silentCheckForUpdates()

        # bring tab to front; evaluate lazily as sometimes UI can show other errors and this command somehow fails
        cmds.evalDeferred(lambda *args: cmds.dockControl(
            MainWindow.DOCK_NAME, e=True, r=True))

        # a bit of a fake, but can't find a better place for an infrequent save
        LayerEvents.layerAvailabilityChanged.addHandler(
            window.savePrefs, MainWindow.DOCK_NAME)

        return window