예제 #1
0
 def create(self):
     if cmds.window(self.window, exists=True):
         cmds.deleteUI(self.window);
     self.window = cmds.loadUI(uiFile=self.uiFile, verbose=False)
     
     cmds.showWindow(self.window);
     try:
         initPos = cmds.windowPref( self.window, query=True, topLeftCorner=True )
         if initPos[0] < 0:
             initPos[0] = 0
         if initPos[1] < 0:
             initPos[1] = 0
         cmds.windowPref( self.window, edit=True, topLeftCorner=initPos )
     except :
         pass
     
     ctrlPath = '|'.join([self.window, 'radioButton']);
     cmds.radioButton(ctrlPath, edit=True, select=True);
     
     ctrlPath = '|'.join([self.window, 'groupBox_4']);
     cmds.control(ctrlPath, edit=True, enable=False);
     
     ctrlPath = '|'.join([self.window, 'groupBox_2', 'pushButton_7']);
     cmds.button(ctrlPath, edit=True, enable=False);
     
     ctrlPath = '|'.join([self.window, 'groupBox_2', 'lineEdit']);
     cmds.textField(ctrlPath, edit=True, text="-u --oiio");
예제 #2
0
 def parent_maya_layout(self):
     object_name = str(self.objectName())
     self.floating_layout = cmds.paneLayout(
         cn='single', w=self.width, p=platforms.get_main_window())
     cmds.dockControl(self.tool_kit_object, l=self.tool_kit_titile, area='right',
                      content=self.floating_layout, allowedArea=['right', 'left'])
     cmds.control(object_name, e=1, p=self.floating_layout)
예제 #3
0
def autoRow(*args):
	form = cmds.formLayout(nd=100)
	cmds.setParent('..')

	length = float(len(args))
	step = 100 / length

	i = 0
	for x in args:

		if cmds.control(x, q=True, exists=True):
			x = cmds.control(x, e=True, p=form)

		elif cmds.layout(x, q=True, exists=True):
			x = cmds.layout(x, e=True, p=form)

		if i == 0:
			cmds.formLayout(form, edit=True, attachForm=[(x, 'left', 0), (x, 'top', 0), (x, 'bottom', 0), ],
			                attachPosition=[(x, 'right', 1, step), ], )

		else:
			cmds.formLayout(form, edit=True,
			                attachForm=[(x, 'top', 0), (x, 'bottom', 0), ],
			                attachControl=[(x, 'left', 2, args[i - 1]), ],
			                attachPosition=[(x, 'right', 1, step), ]
			                )

		step += 100 / length
		i += 1

	return form
예제 #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 orderLayout(self, item, origin, destination, *args):

        # --
        originList = cmds.layout(origin, q=True, ca=True)
        destinList = cmds.layout(destination, q=True, ca=True)

        if originList:
            for y1 in originList:
                cmds.control(y1, e=True, parent=self.tempLayout1)

        if destinList:
            for y2 in destinList:
                cmds.control(y2, e=True, parent=self.tempLayout2)

        # --

        cmds.control(item, e=True, parent=self.tempLayout2)

        # --

        tempList1 = cmds.layout(self.tempLayout1, q=True, ca=True)
        tempList2 = cmds.layout(self.tempLayout2, q=True, ca=True)

        if tempList1:
            for x1 in tempList1:
                cmds.control(x1, e=True, parent=origin)

        if tempList2:
            for x2 in tempList2:
                cmds.control(x2, e=True, parent=destination)
예제 #6
0
파일: display_lib.py 프로젝트: boochos/work
def findControlParent(control='', split=3):
    # split = which parent in full path to return
    path = cmds.control(control, q=1, fpn=1)
    stf = path.split('|')
    tmp = stf[len(stf) - split]
    result = cmds.control(tmp, q=1, fpn=1)
    return result
예제 #7
0
    def update(self):
        
        cmds.control(self.controls.nonCommercialBanner, e=True, visible=not license.status.isLicenseActive())

        
        
        attachPoint = self.data.getLayersCandidateFromSelection()
        
        attachPossible = bool(attachPoint)
        selection = cmds.ls(sl=True,o=True)
        selectionAvailable = selection is not None and len(selection)>0
        
        if attachPossible:
            self.controls.label1.setLabel('Skin selected:')
            self.controls.label2.setLabel("%s (%s)" % tuple(map(Utils.shortName,tuple(attachPoint))))
        elif selectionAvailable:
            self.controls.label1.setLabel("Layer data cannot be attached to:")
            self.controls.label2.setLabel(Utils.shortName(selection[0]))
        else:
            self.controls.label1.setLabel("Nothing is selected")
            self.controls.label2.setLabel('')
        
        self.controls.label1.setEnabled(selectionAvailable)
        self.controls.label2.setEnabled(selectionAvailable)
        
        cmds.button(self.controls.addLayerDataButton,e=True,enable=attachPossible)
        
예제 #8
0
def dock_with_dockControl(widget):
    """Create a docked widget for Maya 2016.5 and lower.

    Args:
        widget: QWidget to parent to dock control

    Returns:
        str: Name of the new dock control
    """
    dock_name = '{0}Dock'.format(widget.objectName())

    try:
        cmds.deleteUI(dock_name)
    except RuntimeError as e:
        LOG.exception(e)

    panel = cmds.paneLayout(configuration='single')
    cmds.control(widget.objectName(), e=True, p=panel)
    cmds.evalDeferred(
        lambda *args: cmds.dockControl(dock_name,
                                       r=True,
                                       vis=True,
                                       closeCommand=widget.close,
                                       area='right',
                                       content=panel,
                                       label=widget.windowTitle(),
                                       width=550))

    return dock_name
예제 #9
0
    def enabled(self, value):
        self.__enabled = value

        cmds.checkBox("chk_{}".format(self._name), e=True, v=value)
        cmds.control("int_{}".format(self._name), e=True, en=value)

        self.notify_property_changed("enabled", value)
        print('\'enabled\' property of CIntInput set to \'{}\'').format(value)
예제 #10
0
 def changePrefix(s, element, text):
     text = text.strip().title()
     if text and 2 < len(text) < 30 and "@" not in text:
         cmds.layout(element, e=True, bgc=(0.3,1,0.3))
         s.data["pref"] = text
         s.save()
     else:
         cmds.control(element, e=True, bgc=(1,0.4,0.4))
예제 #11
0
    def toggle(self, value):
        """Method called when the File Path Input's state changed."""

        self.__toggle_command(value)

        self.enabled = value

        cmds.control("txt_{}".format(self._name), e=True, en=value)
예제 #12
0
 def _hide_inactive_views(self):
     model_panels = cmds.getPanel(type="modelPanel")
     for pan in model_panels:
         if not cmds.modelEditor(pan, q=True, activeView=True):
             view_control = cmds.modelPanel(pan, q=True, control=True)
             if view_control:
                 cmds.control(view_control, edit=True, manage=False)
                 self._hidden_views.append(view_control)
예제 #13
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)
예제 #14
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('..')
예제 #15
0
        def value_changed(self, *args):

            value = cmds.checkBoxGrp(self.use_max_dist, q=True, value1=True)

            for control in [self.max_dist, self.use_color, self.color]:
                cmds.control(control, edit=True, enable=value)

            color_value = cmds.checkBoxGrp(self.use_color, q=True, value1=True)

            cmds.control(self.color, edit=True, enable=color_value)
예제 #16
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)
예제 #17
0
def hideUIElements():
    global hiddenElements
    global elementsToHide
    for i in cmds.lsUI(ctl=True):
        for e in elementsToHide:
            if i.find(e) != -1 and cmds.control(i, q=True, visible=True):
                hiddenElements.append(i)
                #print "hiding... " + i
                cmds.control(i, e=True, visible=False)
                break
예제 #18
0
	def loadSandboxTabs(self, *args):
		self.activeTabs = []
		
		generalTab = cmds.paneLayout('General', parent=self.saverTabLayout)
		generalWidget = cmds.loadUI(uiFile=data.Constants().toolPath() + '/core/handler/saver/general.ui')
		cmds.control(generalWidget, e=True, p=generalTab)
		self.setGeneralTabDefaults()
		
		self.activeTabs.append(generalTab)
		cmds.scrollField('saverGeneralComment_text', e=True, text=self.description)
예제 #19
0
def hideUIElements():
    global hiddenElements
    global elementsToHide
    for i in cmds.lsUI(ctl=True):
        for e in elementsToHide:
            if i.find(e) != -1 and cmds.control(i, q=True, visible=True):
                hiddenElements.append(i)
                #print "hiding... " + i
                cmds.control(i, e=True, visible=False)
                break
예제 #20
0
def getViewSize():
    '''
    Gets the size of the pane under the cursor and retruns
    it as a array index 0 is x axis and index 1 is y axis
    '''
    viewPanel = cmds.getPanel(underPointer=True)
    size = [0, 0]
    size[0] = cmds.control(viewPanel, q=True, w=True)
    size[1] = cmds.control(viewPanel, q=True, h=True)
    return size
예제 #21
0
파일: helpers.py 프로젝트: shdwdln/pbTools
def getViewSize():
    '''
    Gets the size of the pane under the cursor and retruns
    it as a array index 0 is x axis and index 1 is y axis
    '''
    viewPanel = cmds.getPanel(underPointer=True)
    size = [0, 0]
    size[0] = cmds.control(viewPanel, q=True, w=True)
    size[1] = cmds.control(viewPanel, q=True, h=True)
    return size
예제 #22
0
 def addPaidAnnotation(self, control, licenseActive):
     annotation = cmds.control(control, q=True, annotation=True)
     text = " (paid feature)"
     if licenseActive:
         if annotation.endswith(text):
             cmds.control(control,
                          e=True,
                          annotation=annotation[:-len(text)])
     else:
         if not annotation.endswith(text):
             cmds.control(control, e=True, annotation=annotation + text)
예제 #23
0
    def updateEnabled(self):
        '''
        triggers update on this action's enabled state, and updates controls with that state
        '''

        enabled = self.isEnabled()
        for i in self.updateControls:
            if i[1]:
                cmds.menuItem(i[0], e=True, enable=enabled)
            else:
                cmds.control(i[0], e=True, enable=enabled)
예제 #24
0
파일: actions.py 프로젝트: leandropim/Tapp
 def updateEnabled(self):
     '''
     triggers update on this action's enabled state, and updates controls with that state
     '''
     
     enabled = self.isEnabled()
     for i in self.updateControls:
         if i[1]:
             cmds.menuItem(i[0],e=True,enable=enabled)
         else:
             cmds.control(i[0],e=True,enable=enabled)
예제 #25
0
 def _start_streaming_ui(self):
     self._orig_active_view = self._get_active_view()
     cmds.deleteUI(self._ui_view, control=True)
     self._ui_view = cmds.modelPanel(copy=self._orig_active_view, menuBarVisible=False, parent=self._ui_layout)
     bar_layout = cmds.modelPanel(self._ui_view, q=True, barLayout=True)
     cmds.frameLayout(bar_layout, edit=True, collapse=True)
     self._update_ui_layout()
     cmds.control(self._ui_view, edit=True, width=self._STREAM_WIDTH, height=self._STREAM_HEIGHT)
     cmds.text(self._ui_tx_help, edit=True, label='Client App connected  |  Streaming viewport...')
     cmds.modelEditor(self._ui_view, e=True, activeView=True)
     self._hide_inactive_views()
     self._look_through_current_camera()
예제 #26
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)
예제 #27
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 )
예제 #28
0
def SLiBBrowserDockedUI():
    if cmds.dockControl('slBrowserDock', query = True, exists = True):
        cmds.deleteUI('slBrowserDock')
    
    SLiBBrowserUI()
    mainWindow = cmds.paneLayout(parent = mel.eval('$temp1=$gMainWindow'))
    cmds.dockControl('slBrowserDock', width = 275, area = 'right', label = 'SLiB Browser', content = mainWindow, allowedArea = [
        'right',
        'left'], backgroundColor = [
        4.6007e+18,
        4.6007e+18,
        4.6007e+18])
    cmds.control(slBrowserUI, edit = True, parent = mainWindow)
예제 #29
0
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")
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")
예제 #31
0
    def update(self, node):

        self.setNode(node)

        nodeType = cmds.nodeType(self.node)

        # Connect all attributes of the current node to the corresponding control
        for item in self.connectControls:

            attr, control = item[:2]
            index = None

            try:
                index = item[2]
            except IndexError:
                pass

            attribute = self.attr(attr)

            enable = cmds.objExists(attribute)

            if enable:
                if index:
                    cmds.connectControl(control, attribute, index=index)
                else:
                    cmds.connectControl(control, attribute)

            cmds.control(control, edit=True, manage=enable)

        for item in self.controls:
            attr, control, cmd = item[:3]
            index = None

            attribute = self.attr(attr)

            enable = cmds.objExists(attribute)

            if enable:
                cmd(control, edit=True, attribute=attribute)

            cmds.control(control, edit=True, manage=enable)

        # Update all scriptJob to target the correct node
        for item in self.scriptJobs:

            attr, parentControl, scriptJobArg, cmd = item
            attribute = self.attr(attr)

            kargs = {scriptJobArg: (attribute, cmd)}

            cmds.scriptJob(replacePrevious=True, parent=parentControl, **kargs)
예제 #32
0
파일: tabPaint.py 프로젝트: leandropim/Tapp
    def updateToTool(self):
        '''
        update controls to current tool
        '''
        isPainting = self.isPainting()
        cmds.control(self.cmdLayout.innerLayout,e=True,enable=isPainting)
        cmds.button(self.cmdLayout.buttons[1],e=True,label="Flood" if isPainting else "Paint")

        if (isPainting):        
            self.controls.brushRadiusSlider.setValue(cmds.artUserPaintCtx(self.TOOL_PAINT,q=True,radius=True))
        self.controls.brushRadiusSlider.setEnabled(isPainting)
        
        layersAvailable = LayerDataModel.getInstance().layerDataAvailable
        cmds.layout(self.cmdLayout.buttonForm,e=True,enable=layersAvailable)
예제 #33
0
    def updateToTool(self):
        '''
        update controls to current tool
        '''
        isPainting = self.isPainting()
        cmds.control(self.cmdLayout.innerLayout,e=True,enable=isPainting)
        cmds.button(self.cmdLayout.buttons[1],e=True,label="Flood" if isPainting else "Paint")

        if (isPainting):        
            self.controls.brushRadiusSlider.setValue(cmds.artUserPaintCtx(self.TOOL_PAINT,q=True,radius=True))
        self.controls.brushRadiusSlider.setEnabled(isPainting)
        
        layersAvailable = LayerDataModel.getInstance().layerDataAvailable
        cmds.layout(self.cmdLayout.buttonForm,e=True,enable=layersAvailable)
예제 #34
0
    def _setDirectionalMode(self, *args):

        customShow = False
        iorShow = False

        mode = cmds.optionMenuGrp(self.directionalWeight,
                                  query=True,
                                  value=True)

        if mode == "Constant":
            cmds.setAttr(self.attr("use_directional_weight"), False)
        elif mode == "IOR":
            cmds.setAttr(self.attr("use_directional_weight"), True)
            cmds.setAttr(self.attr("directional_weight_mode"), 0)
            iorShow = True
        elif mode == "Custom":
            cmds.setAttr(self.attr("use_directional_weight"), True)
            cmds.setAttr(self.attr("directional_weight_mode"), 1)
            customShow = True

        cmds.control(self.normal_reflectivity, edit=True, visible=customShow)
        cmds.control(self.grazing_reflectivity, edit=True, visible=customShow)
        cmds.control(self.exponent, edit=True, visible=customShow)

        cmds.control(self.ior, edit=True, visible=iorShow)
예제 #35
0
 def _init_capture_vars(self):
     self._real_stream_width = cmds.control(self._ui_view,
                                            query=True,
                                            width=True)
     self._real_stream_height = cmds.control(self._ui_view,
                                             query=True,
                                             height=True)
     if self._is_streaming_screenshot:
         self._sct = mss.mss()
         qw = v1apiUI.MQtUtil.findControl(self._ui_view)
         self._ui_view_qw = wrapInstance(long(qw), QtWidgets.QWidget)
     else:
         self._view = apiUI.M3dView.getM3dViewFromModelPanel(self._ui_view)
         self._img = api.MImage()
         self._img_len = self._real_stream_width * self._real_stream_height * 4  # x4 - rgba pixels
예제 #36
0
    def attributeReplace(self, plug):
        """Called to create the UI objects when a new node type is edited."""
        node, attrName = plug.split('.')
        group = attrName + "Grp"
        button = attrName + "Btn"
        layout = attrName + "Layout"

        # Check if the layout exists.
        controlExists = cmds.control(layout, exists=True)

        # If it's not exist, try to create it. attributeBuild() will start this
        # method in the case of success.
        if not controlExists:
            self.attributeBuild(plug)
            return

        # Check if attribute exists.
        exists = attrName in cmds.listAttr(node)
        # Hide/show the layout
        self.setVisible(exists)

        # Edit the UI items
        if exists:
            control = self.getControllerGroup(plug)
            control(group, edit=True, attribute=plug)

            cmds.button(
                button,
                edit=True,
                command=lambda c, a=attrName: self.deleteAttr(a))
예제 #37
0
	def __init__(self):	
		"""
		Initializes the pop up menu class call
		"""
		self.optionVars = []
		IsClickedOptionVar = OptionVarFactory('cgmVar_IsClicked', 0)
		mmActionOptionVar = OptionVarFactory('cgmVar_mmAction',0)			
		
		panel = mc.getPanel(up = True)
		if panel:
			# Attempt at fixing a bug of some tools not working when the pop up parent isn't 'viewPanes'
			if 'MayaWindow' in mc.panel(panel,q = True,ctl = True):
				panel = 'viewPanes'
			
		sel = search.selectCheck()
		
		IsClickedOptionVar.set(0)
		mmActionOptionVar.set(0)
		
		if mc.popupMenu('cgmMM',ex = True):
			mc.deleteUI('cgmMM')
			
		if panel:
			if mc.control(panel, ex = True):
				try:
					mc.popupMenu('cgmMM', ctl = 0, alt = 0, sh = 0, mm = 1, b =1, aob = 1, p = panel,
						         pmc = lambda *a: self.createUI('cgmMM'))
				except:
					guiFactory.warning('Exception on set key marking menu')
					mel.eval('performSetKeyframeArgList 1 {"0", "animationList"};')		
예제 #38
0
def nodesInTabs_fix(self, nodes, func_name, func_name_fix):
    fixed = 0
    panels = cmds.getPanel(sty='nodeEditorPanel')

    for mypanel in panels:
        #Open window
        cmds.scriptedPanel(mypanel, e=True, to=True)

        ned = mypanel + 'NodeEditorEd'

        #Close all tabs
        cmds.nodeEditor(ned, e=True, closeAllTabs=True)

        #Close window
        control = cmds.control(ned, query=True, fullPathName=True)
        cmds.deleteUI(control.split('|')[0], window=True)
        fixed = 1
    cmds.refresh()

    if fixed == 1:
        #Output message and restore state buttons
        self.reportOutputUI.insertHtml(
            '<br> Cleaned all nodes in Node Editor! <font color=#3da94d> [ SUCCESS ] <br>'
        )
        restoreStateButtons(self, func_name)
    else:
        self.reportOutputUI.insertHtml(
            'Error cleaning nodes in Node Editor <font color=#9c4f4f> [ FAILED ] <br>'
        )
예제 #39
0
    def __init__(self, parent=get_maya_window()):
        super(MTTViewer, self).__init__(parent)

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

        self.parent = parent
        self.setObjectName(VIEWER_NAME)
        self.setWindowTitle(VIEWER_TITLE)
        self.setWindowIcon(QIcon(WINDOW_ICON))

        self.texture_path = None
        self.texture_compare_path = None
        self.is_mtt_sender = False

        # UI variables
        self.viewer_statusbar = None
        self.graphics_view = None
        self.channel_btn = dict()
        self.fit_btn = None
        self.reset_zoom_btn = None
        self.toggle_tile_btn = None
        self.toggle_compare_btn = None
        self.toggle_picker_btn = None
        self.settings_btn = None

        # create UI
        self.__create_ui()
        # self.setMouseTracking(True)

        # restore geometry
        self.restoreGeometry(MTTSettings.value('Viewer/windowGeometry'))
예제 #40
0
	def __init__(self):	
		"""
		Initializes the pop up menu class call
		"""
		self.optionVars = []
		IsClickedOptionVar = OptionVarFactory('cgmVar_IsClicked', 0)
		mmActionOptionVar = OptionVarFactory('cgmVar_mmAction',0)			
		
		panel = mc.getPanel(up = True)
		if panel:
			# Attempt at fixing a bug of some tools not working when the pop up parent isn't 'viewPanes'
			if 'MayaWindow' in mc.panel(panel,q = True,ctl = True):
				panel = 'viewPanes'
			
		sel = search.selectCheck()
		
		IsClickedOptionVar.set(0)
		mmActionOptionVar.set(0)
		
		if mc.popupMenu('cgmMM',ex = True):
			mc.deleteUI('cgmMM')
			
		if panel:
			if mc.control(panel, ex = True):
				try:
					mc.popupMenu('cgmMM', ctl = 0, alt = 0, sh = 0, mm = 1, b =1, aob = 1, p = panel,
						         pmc = lambda *a: self.createUI('cgmMM'))
				except:
					guiFactory.warning('Exception on set key marking menu')
					mel.eval('performSetKeyframeArgList 1 {"0", "animationList"};')		
예제 #41
0
def job(scroll='', k=False):
    import webrImport as web
    ss = web.mod('selectionSet_lib')
    # print '\n  run job  \n'
    #
    add = []
    if scroll:
        if cmds.control(scroll, ex=True):
            cmds.textScrollList(scroll, edit=True, ra=True)
            selection = cmds.ls(sl=True, fl=True)  # returns full path if same object with dif namespace existskeys
            if selection:
                for sel in selection:
                    if '|' in sel:
                        sel = sel.split('|')
                        sel = sel[len(sel) - 1]
                        add.append(sel)
                    else:
                        add.append(sel)
                add = ss.outputDict(add)
                # keys or values
                if k:
                    # add to list
                    cmds.textScrollList(scroll, edit=True, append=sorted(add.keys()))
                else:
                    # add to list
                    cmds.textScrollList(scroll, edit=True, append=sorted(add.values()))
            else:
                pass
                # message('no selection', warning=True)
        else:
            pass
예제 #42
0
    def edCssDone(self, opt):

        ctr = cmds.control("edCssDoneContainer", query=True, fullPathName=True)
        if (opt):
            cmds.rowLayout(ctr, edit=True, columnWidth=(2, 30))
        else:
            cmds.rowLayout(ctr, edit=True, columnWidth=(2, 1))
예제 #43
0
파일: graph.py 프로젝트: ewerybody/melDrop
def createInfinityMM():
	# pmn = 'graphEditor1GraphEdanimCurveEditorMenu' # standard rmb popupmenu
	gEd = 'graphEditor1GraphEd' # graph editor name
	if not m.control( gEd, ex=1 ):
		print ('the graph editor: ' + str(gEd) + ' does not (yet) exist!! :/')
		return
	# our new popup
	pup = 'tweakGraphEditPopup'
	if not m.popupMenu( pup, ex=1 ):
		m.popupMenu( pup, parent=gEd, markingMenu=1, ctrlModifier=1 )

	m.popupMenu( pup, edit=1, deleteAllItems=1 )
	m.setParent( pup, menu=1 )

	# display infinities checkbox
	cmd = 'from maya.cmds import animCurveEditor; animCurveEditor( "' +gEd+ '", e=1, displayInfinities=int(not animCurveEditor( "' +gEd+ '", q=1, displayInfinities=1 )) )'
	m.menuItem( 'displayInfinitiesMenuItem', label='Display Infinities', checkBox=m.animCurveEditor( gEd, q=1, displayInfinities=1 ), c=cmd, radialPosition='N' )

	m.menuItem( 'preInfinityMenuItem', label='< Pre Infinity', subMenu=True, parent=pup ) # radialPosition='W'
	m.menuItem( 'postInfinityMenuItem', label='Post Infinity >', subMenu=True, parent=pup ) # , radialPosition='E'
	m.menuItem( 'bothInfinityMenuItem', label='< Both Infinity >', subMenu=True, parent=pup ) # , radialPosition='S'

	infType = ['cycle', 'linear', 'constant', 'cycleRelative', 'oscillate']
	itemList = ['preInfinityMenuItem', 'postInfinityMenuItem', 'bothInfinityMenuItem']
	for i in range(3):
		for type in infType:
			cmd = 'from maya.cmds import setInfinity;'
			if i != 0:
				cmd += 'setInfinity( poi="' + type + '" );'
			if i != 1:
				cmd += 'setInfinity( pri="' + type + '" );'
			m.menuItem( label=type, parent=itemList[i], c=cmd )
예제 #44
0
def view_outliner(floating=False):
    """
    Toggle the outliner on as a dock window to the right side of the viewport,
    if floating is ture then toggle outliner to a floating window.

    makes sure to delete the dockControl UI when visibility is lost to
    ensure the name is available for maya.

    .. old::
        panel_window = 'outlinerPanel1Window'
        if cmds.window(panel_window, q=True, exists=True):
            cmds.deleteUI(panel_window, window=True)
        else:
            panel = cmds.getPanel(withLabel='Outliner')
            cmds.outlinerPanel(panel, e=True, tearOff=True)
    """
    # Constants
    TABLAYOUT = "MAM_TAB_LAYOUT"
    DOCK_CONTROL_OUTLINER = "MAM_DOCK_CONTROL_OUTLINER"

    if not cmds.paneLayout(TABLAYOUT, q=True, ex=True):
        cmds.paneLayout(TABLAYOUT, p="viewPanes")  # mel.eval('$tmp = $gMainWindow'))

    # Creat or show outliner.
    if not cmds.dockControl(DOCK_CONTROL_OUTLINER, q=True, ex=True):
        cmds.dockControl(
            DOCK_CONTROL_OUTLINER,
            label="Outliner",
            width=280,
            content=TABLAYOUT,
            allowedArea=["left", "right"],
            area="right",
        )

    # Tear it off or dock it depending on floating arg.
    vis_state = cmds.dockControl(DOCK_CONTROL_OUTLINER, q=True, vis=True)
    fl_state = cmds.dockControl(DOCK_CONTROL_OUTLINER, q=True, fl=True)
    cmds.dockControl(DOCK_CONTROL_OUTLINER, e=True, fl=floating)
    if vis_state and not fl_state == floating:
        pass
    else:
        cmds.dockControl(
            DOCK_CONTROL_OUTLINER, e=True, vis=not (cmds.dockControl(DOCK_CONTROL_OUTLINER, q=True, vis=True))
        )

    if not cmds.dockControl(DOCK_CONTROL_OUTLINER, q=True, vis=True):
        try:
            cmds.deleteUI(DOCK_CONTROL_OUTLINER)
        except RuntimeError:
            pass
    else:
        # Create outliner pane under tablayout if it's not there.
        outliner_window = "outlinerPanel1Window"
        if not cmds.control(outliner_window, q=True, ex=True):
            panel = cmds.getPanel(withLabel="Outliner")
            cmds.outlinerPanel(panel, e=True, p=TABLAYOUT)
            # cmds.control(outliner_window, e=True, p=TABLAYOUT)

    if floating:
        cmds.dockControl(DOCK_CONTROL_OUTLINER, e=True, height=600)
예제 #45
0
    def __init__(self):
        """
		Initializes the pop up menu class call
		"""
        self.optionVars = []
        self.IsClickedOptionVar = OptionVarFactory("cgmVar_IsClicked", "int", 0)
        self.mmActionOptionVar = OptionVarFactory("cgmVar_mmAction", "int", 0)

        self.setupVariables()

        panel = mc.getPanel(up=True)
        if panel:
            # Attempt at fixing a bug of some tools not working when the pop up parent isn't 'viewPanes'
            if "MayaWindow" in mc.panel(panel, q=True, ctl=True):
                panel = "viewPanes"

        sel = search.selectCheck()

        self.IsClickedOptionVar.set(0)
        self.mmActionOptionVar.set(0)

        if mc.popupMenu("cgmMM", ex=True):
            mc.deleteUI("cgmMM")

        if panel:
            if mc.control(panel, ex=True):
                try:
                    mc.popupMenu(
                        "cgmMM", ctl=0, alt=0, sh=0, mm=1, b=1, aob=1, p=panel, pmc=lambda *a: self.createUI("cgmMM")
                    )
                except:
                    guiFactory.warning("cgm.setMenu failed!")
예제 #46
0
def maya_recurse_children(root, *args, **kwargs):
    tree = kwargs.get('tree', {})

    children = []

    try:
        children = cmds.layout(root, q=True, ca=True)
    except RuntimeError:
        pass

    if children:
        for child in children:
            name = child

            try:
                name = cmds.layout(child, q=True, fpn=True)
            except RuntimeError:
                try:
                    name = cmds.control(child, q=True, fpn=True)
                except RuntimeError:
                    pass
            tree[name] = maya_recurse_children(child)
            print name

    return tree
예제 #47
0
def startUp():
	print( '########## mayaWrangler >>>>>>>>>>>>>>>>>>>>>>>>' )
	# todo embedd in interface:
	wantSecondsCurrentTimeField = 1
	wantCurrentTimeFieldInt = 1
	wantCurrentTimeToMinMaxPopup = 1
	wantTweakGraphEditPopup = 1
	wantShelfSwitcherMM = 1

	if not m.layout( lyout, ex=1 ):
		raise IOError, 'timeSlider layout: ' + lyout + ' does not exist (yet)! :/'
	print ('check! layout: ' + str(lyout) + ' exists!')
	if not m.control( currTimeField, ex=1 ):
		raise IOError, 'currTimeField: ' + currTimeField + ' does not exist (yet)! :/'
	print ('check! currTimeField: ' + str(currTimeField) + ' exists!')

	if wantSecondsCurrentTimeField:
		createSecondsCurrentTimeField()
	if wantCurrentTimeFieldInt:
		makeCurrentTimeFieldInt()
	if wantCurrentTimeToMinMaxPopup:
		addCurrentTimeToMinMaxPopup()
	if wantTweakGraphEditPopup:
		createTweakGraphEditPopup()
	if wantShelfSwitcherMM:
		import shelfSwitcher
		shelfSwitcher.build()
	print( '########## mayaWrangler <<<<<<<<<<<<<<<<<<<<<<<<<' )
예제 #48
0
	def __init__(self):	
		"""
		Initializes the pop up menu class call
		"""
		self.optionVars = []
		self.toolName = 'cgm.snapMM'
		IsClickedOptionVar = OptionVarFactory('cgmVar_IsClicked', 'int')
		mmActionOptionVar = OptionVarFactory('cgmVar_mmAction', 'int')	
		surfaceSnapAimModeVar = OptionVarFactory('cgmVar_SurfaceSnapAimMode', 'int')	
		UpdateRotateOrderOnTagVar = OptionVarFactory('cgmVar_TaggingUpdateRO', 'int')	
		self.LocinatorUpdateObjectsBufferOptionVar = OptionVarFactory('cgmVar_LocinatorUpdateObjectsBuffer',defaultValue = [''])
		
		self.LocinatorUpdateObjectsOptionVar = OptionVarFactory('cgmVar_SnapMMUpdateMode',defaultValue = 0)
		guiFactory.appendOptionVarList(self,self.LocinatorUpdateObjectsOptionVar.name)
		
		self.SnapModeOptionVar = OptionVarFactory('cgmVar_SnapMatchMode',defaultValue = 0)
		guiFactory.appendOptionVarList(self,self.SnapModeOptionVar.name)
				
		
		panel = mc.getPanel(up = True)
		sel = search.selectCheck()
		
		IsClickedOptionVar.set(0)
		mmActionOptionVar.set(0)
		
		if mc.popupMenu('cgmMM',ex = True):
			mc.deleteUI('cgmMM')
			
		if panel:
			if mc.control(panel, ex = True):
				mc.popupMenu('cgmMM', ctl = 0, alt = 0, sh = 0, mm = 1, b =1, aob = 1, p = 'viewPanes',
					         pmc = lambda *a: self.createUI('cgmMM'))
예제 #49
0
    def __init__(self, parent=get_maya_window()):
        super(MTTViewer, self).__init__(parent)

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

        self.parent = parent
        self.setObjectName(VIEWER_NAME)
        self.setWindowTitle(VIEWER_TITLE)
        self.setWindowIcon(QIcon(WINDOW_ICON))

        self.texture_path = None
        self.texture_compare_path = None
        self.is_mtt_sender = False

        # UI variables
        self.viewer_statusbar = None
        self.graphics_view = None
        self.channel_btn = dict()
        self.fit_btn = None
        self.reset_zoom_btn = None
        self.toggle_tile_btn = None
        self.toggle_compare_btn = None
        self.toggle_picker_btn = None
        self.settings_btn = None

        # create UI
        self.__create_ui()
        # self.setMouseTracking(True)

        # restore geometry
        self.restoreGeometry(MTTSettings.value('Viewer/windowGeometry'))
예제 #50
0
	def __init__(self):	
		"""
		Initializes the pop up menu class call
		"""
		self.optionVars = []		
		self.IsClickedOptionVar = OptionVarFactory('cgmVar_IsClicked','int',0)
		self.mmActionOptionVar = OptionVarFactory('cgmVar_mmAction','int',0)
		
		self.setupVariables()
		
		panel = mc.getPanel(up = True)
		if panel:
			# Attempt at fixing a bug of some tools not working when the pop up parent isn't 'viewPanes'
			if 'MayaWindow' in mc.panel(panel,q = True,ctl = True):
				panel = 'viewPanes'
			
		sel = search.selectCheck()
		
		self.IsClickedOptionVar.set(0)
		self.mmActionOptionVar.set(0)
		
		if mc.popupMenu('cgmMM',ex = True):
			mc.deleteUI('cgmMM')
			
		if panel:
			if mc.control(panel, ex = True):
				try:
					mc.popupMenu('cgmMM', ctl = 0, alt = 0, sh = 0, mm = 1, b =1, aob = 1, p = panel,
						         pmc = lambda *a: self.createUI('cgmMM'))
				except:
					guiFactory.warning('cgm.setMenu failed!')		
예제 #51
0
def AnimposeCreateWindow(sel_obj):
    alltab  = mc.tabLayout('tabs',q=1,st=1)
    if mc.window ('AnimposeCreateWindow',q=True,exists =1):
        mc.deleteUI ('AnimposeCreateWindow')
        
    AnimposeCreateWindow=mc.window('AnimposeCreateWindow',menuBar=True, title="AnimPoseCreate",width=302,h=100)
    poseLibCaptureCamera='poseLibCaptureCamera'
    
    mc.columnLayout ()   
    mc.rowLayout('iconCaptureRL',nc=4,cw4=[150,1,1,150])
    captureCamFrame=mc.frameLayout(borderStyle="etchedOut" ,cl=False,cll=False,labelVisible=False,m=True,w=150,h=100) 
    
    if not mc.modelPanel('plCaptureMP',q=1,ex=1):
        mc.modelPanel('plCaptureMP',parent=captureCamFrame,mbv=0,cam=poseLibCaptureCamera)
    else:
        mc.modelPanel('plCaptureMP',e=1,parent=captureCamFrame,mbv=0,cam=poseLibCaptureCamera)
        
    barLayout = mc.modelPanel('plCaptureMP',q=1,barLayout=1)
    if ("" != barLayout and mc.frameLayout(barLayout,q=1,exists=1)):
        mc.frameLayout(barLayout,e=1,collapse=1) 
        mc.control(barLayout,e=1,m=0) 
    modelEditor = mc.modelPanel('plCaptureMP',q=1,me=1)
    mc.modelEditor(modelEditor,e=1,da="smoothShaded",grid=False,hud=False,manipulators=False,displayTextures=True ,ha=0,j=0,dim=0,nc=0,wos=0,dl="default" )
    mc.setParent('..')
    mc.setParent('..')
    mc.frameLayout('glRenderFrame',borderStyle="etchedOut",cl=False,cll=False,m=0,labelVisible=False)
    mc.glRenderEditor('hardwareRenderViewBis')
    mc.setParent ('..')
    mc.frameLayout(borderStyle="etchedIn" ,cl=False,cll=False,labelVisible=False,m=True,w=200,h=100)
    mc.rowLayout(nc=2,cw2=[50,100])
    mc.text(l='   Name :',)
    Anim_name=mc.textField('Anim_name',w=140)
    mc.setParent('..')
    mc.button(l='Create '+alltab[:4],al='center',w=150,c=creation)
    mc.button(l='Cancel',c=partial(animposewinclose))
    mc.setParent('..')
    mc.modelEditor(modelEditor,e=1,camera=poseLibCaptureCamera) 
    mc.setAttr("poseLibCaptureCameraShape.displayFilmGate", 1)
    mc.setAttr("poseLibCaptureCameraShape.verticalFilmAperture",1.1)

    mc.glRenderEditor('hardwareRenderViewBis',e=1,lt=poseLibCaptureCamera) 
    #if not mc.objExists(poseLibCaptureCamera):
       #poseLibCaptureCamera='persp'
        
    mc.showWindow(AnimposeCreateWindow)
    mc.window(AnimposeCreateWindow,e=1,w=300,h=100)
    mc.select(sel_obj)
예제 #52
0
def returnCenter(controls, win):
	total = 0
	curWidth = cmds.window(win,q=1,w=1)
	for ctrl in controls:
		total += cmds.control( ctrl, q=1, w=1 )
	center = curWidth/2 - total	
	print("GUI Controls Total: %s Window W: %s Half: %s CtrlOffset: %s" %(total, curWidth, curWidth/2, (curWidth-total)/2))
	return center	
예제 #53
0
    def dock_ui(self):
        self.close()
        
        if cmds.dockControl('testDock', q=1, ex=1):
            cmds.deleteUI('testDock')
            
        allowedAreas = ['right', 'left']
        
        try:
            floatingLayout = cmds.paneLayout(configuration='single', width=200, height=400)
        except:
            self.show()
            return False

        cmds.dockControl('testDock', area='right', allowedArea=allowedAreas, content=floatingLayout, label='TestDock')
        cmds.control('testDialogControl', e=True, p=floatingLayout)
        return True
예제 #54
0
def _getTimelineWinSize():
    '''Dimensione finestra timeline a seconda se sono su qt o no.'''

    mayaVersion = cmds.about(version=True).split()[0]
    if _isQt:
        return (cmds.layout('MainTimeSliderLayout|formLayout9|frameLayout2', q=True, w=True)-17, 38)
    else:
        return ((cmds.control('MayaWindow|mayaMainWindowForm', q=True, w=True)-311), 70)
예제 #55
0
파일: display_lib.py 프로젝트: boochos/work
def findControl(ann='', panelTyp='', split=3):
    # split = which parent in full path to return
    cntrls = cmds.lsUI(controls=True, long=1)
    qualified = []
    result = []
    for con in cntrls:
        string = cmds.control(con, q=1, ann=1)
        if ann in string:
            qualified.append(con)
    for item in qualified:
        path = cmds.control(item, q=1, fpn=1)
        if panelTyp in path:
            stf = path.split('|')
            tmp = stf[len(stf) - split]
            result.append(cmds.control(tmp, q=1, fpn=1))
        else:
            print '______searching  ', path
    return result
예제 #56
0
def getParentPanel():
    """return the parent panel """
    upPanel = cmds.getPanel(up=True)
    if cmds.panel(upPanel, q=True, ex=True):
        upPanelLayout = cmds.layout(upPanel, q=True, p=True)
        while not cmds.paneLayout(upPanelLayout, q=True, ex=True):
            upPanelLayout = cmds.control(upPanelLayout, q=True, p=True)
        if cmds.paneLayout(upPanelLayout, q=True, ex=True):
            return upPanelLayout
    else:
        return "viewPanes"
예제 #57
0
def checkBoxToggleControl(CBG, control, invert=False):
    """
    Toggle the enabled state of a UI layout based on a checkBoxGrp
    @param control:
    @param CBG: CheckBoxGrp used to toggle layout
    @type CBG: str
    @param invert: Invert the checkBox value
    @type invert: bool
    """
    # Check CheckBoxGrp
    if not cmds.checkBoxGrp(CBG, q=True, ex=True):
        raise UIError('CheckBoxGrp "' + CBG + '" does not exist!!')
    # Check control
    if not cmds.control(control, q=True, ex=True):
        raise UIError('Control "' + control + '" does not exist!!')

    # Get checkBoxGrp state
    state = cmds.checkBoxGrp(CBG, q=True, v1=True)
    if invert: state = not state

    # Toggle Layout
    cmds.control(control, e=True, en=state)
예제 #58
0
파일: display_lib.py 프로젝트: boochos/work
def geField(name='', parent='', attach=None, label='', cmd='', w=100, gap=10, tx='', ann=''):
    if not cmds.control(name, ex=1):
        field = cmds.textField(name, tx=tx, h=21, w=w, cc=cmd, ec=cmd, ann=ann, aie=True)
        ac = [(field, 'left', gap, attach)]
        attachForm = [(field, 'left', 2), (field, 'bottom', 2)]
        if attach:
            cmds.formLayout(parent, edit=True, ac=ac, attachForm=attachForm)
        else:
            cmds.formLayout(parent, edit=True, attachForm=attachForm)
        return field
    else:
        print ''
        cmds.deleteUI(name, control=True)
예제 #59
0
파일: display_lib.py 프로젝트: boochos/work
def geHeading(name='', parent='', attach=None, label='', cmd='', gap=10, ann='', bgc=[0.275, 0.275, 0.275], w=45, h=17):
    if not cmds.control(name, ex=1):
        lab = cmds.text(name, l=label, fn='obliqueLabelFont', al='center', bgc=bgc, ebg=True, ann=ann, w=w, h=h)
        ac = [(lab, 'left', gap, attach)]
        attachForm = [(lab, 'bottom', 4)]
        if attach:
            cmds.formLayout(parent, e=True, ac=ac, attachForm=attachForm)
        else:
            cmds.formLayout(parent, e=True, attachForm=attachForm)
        return lab
    else:
        print ''
        cmds.deleteUI(name, control=True)