def update_size_ui(self):
     if self.dock_ui and self.dock[0]:
         kwargs = self.__dock_kwargs()
         kwargs["e"] = True
         pmc.dockControl(self.dock_ui, **kwargs)
     else:
         self.win.setWidthHeight(self.sizes[:2])
     
     paneSizes = []
     tmp = self.sizes[2:8]
     j = 1
     for i in range(0, len(tmp) - 1, 2):
         paneSizes.append([j, tmp[i], tmp[i + 1]])
         j += 1
     pmc.paneLayout(self.main_layout, e=True, paneSize=paneSizes)
     
     pmc.paneLayout(self.script_layout, e=True,
                    paneSize=[
                              [1, self.sizes[8], self.sizes[10]],
                              [2, self.sizes[9], self.sizes[11]],
                              ]
                    )
     
     pmc.checkBoxGrp(self.order_ui, e=True, v1=self.order)
     pmc.checkBoxGrp(self.order_ui, e=True, v2=self.show_doc)
     
     pmc.optionMenuGrp(self.filter_test_ui, e=True, v=self.filter_test)
示例#2
0
    def getHumanIK(self):
        sel = pm.ls(sl=1, ni=1)[0]

        mode = ""
        if sel.type() == "hikFKJoint" or sel.type() == "hikIKEffector":
            mode = "ctrl"
        elif sel.type() == "joint":
            mode = "joint"
        else:
            QtWidgets.QMessageBox.information(self, u"警告",
                                              u"请选择 HumanIK 相关的物体")
            return

        prefix = sel.split("_")[0]

        if not pm.optionMenuGrp("hikCharacterList", q=1, ex=1):
            QtWidgets.QMessageBox.information(self, u"警告", u"请创建HumanIK骨骼")
            return

        for item in pm.optionMenuGrp("hikCharacterList", q=1, itemListLong=1):
            if pm.menuItem(item, q=1, label=1) == prefix and prefix != "None":
                break
        else:
            QtWidgets.QMessageBox.information(self, u"警告",
                                              u"当前选择没有找到 HumanIK 所属")
            return

        top_parent = sel.fullPath().split("|")[1]
        if mode == "ctrl":
            top_parent = top_parent.replace("_Ctrl_", "_")

        return top_parent
示例#3
0
 def attributeChanged(self, nodeName, attr, *args):
     """
     called when the translator attribute is changed
     """
     transName = pm.getAttr(attr)
     pm.optionMenuGrp(self._optionMenu, edit=True, value=transName)
     self.updateChildren(nodeName, transName)
示例#4
0
    def updateMenu(self, nodeName):
        """
        called to update an optionMenuGrp for choosing between multiple translator options for a given node
        """
        # delete current options
        translators = pm.optionMenuGrp(self._optionMenu,
                                       q=True,
                                       itemListLong=True)
        for tran in translators:
            pm.deleteUI(tran, menuItem=True)

        # populate with a fresh list
        parent = pm.setParent(self._optionMenu)
        for tran in self._translators:
            pm.menuItem(label=tran, parent=parent + '|OptionMenu')

        transName = self.getCurrentTranslator(nodeName)
        pm.optionMenuGrp(self._optionMenu,
                         edit=True,
                         value=transName,
                         cc=lambda *args: self.menuChanged(nodeName, args[0]))
        self.updateChildren(nodeName, transName)

        transAttr = nodeName + ".aiTranslator"
        pm.scriptJob(attributeChange=[
            transAttr,
            lambda *args: self.attributeChanged(nodeName, transAttr, *args)
        ],
                     replacePrevious=True,
                     parent=self._optionMenu)
示例#5
0
 def attributeChanged(self, nodeName, attr, *args):
     """
     called when the translator attribute is changed
     """
     transName = pm.getAttr(attr)
     pm.optionMenuGrp(self._optionMenu, edit=True, value=transName)
     self.updateChildren(nodeName, transName)
        def add_blend_shape_selector(name, label, mesh_label, src):
            blend_shape_menu = pm.optionMenuGrp(name, label=label)

            # When the source selection is changed, update the source blend shape list.
            def changed(value):
                # Only refresh what's needed, so changing one blendShape doesn't reset the mesh selected
                # for the other.
                if src:
                    self.refresh_src_blend_shape_list()
                    self.refresh_src_mesh_list()
                else:
                    self.refresh_dst_mesh_list()

            pm.optionMenuGrp(blend_shape_menu,
                             edit=True,
                             changeCommand=changed)

            # Create a list of blendShapes.
            bnArray = pm.ls(type='blendShape')
            for entry in bnArray:
                pm.menuItem(label=entry)
            if not bnArray:
                pm.menuItem(label='No Blend Shapes In Scene')

            mesh_option_group = pm.optionMenuGrp(name + 'Mesh',
                                                 label=mesh_label)

            return mesh_option_group + '|OptionMenu'
示例#7
0
 def addLightFilterCB(self, name):
     """
     This callback is triggered when the filter menu changes.  The filter menu contains a list of 
     filter types, and of existing filter nodes.
     """
     if not name or name == '<Add Filter>':
         # selected a menu divider. reset
         self.updateAddMenu()
         return
     items = pm.optionMenuGrp(self.addOptionMenuGrp,
                              query=True,
                              itemListLong=True)
     index = pm.optionMenuGrp(self.addOptionMenuGrp,
                              query=True,
                              select=True)
     # get the mode of the callback
     mode = pm.menuItem(items[index - 1], query=True, data=True)
     if mode == self.MENU_NODE_TYPE:
         # name is a type
         newFilter = self.addLightFilter(name)
         # not sure whether selecting is the right thing to do. it's a bit of jolt.
         #pm.mel.updateAE(newFilter)
     else:  # MENU_NODE_INSTANCE
         # name is an existing node
         self.connectLightFilter(pm.PyNode(name))
示例#8
0
文件: editor.py 项目: jzboylxj/XDLibs
    def new_joint_to_ar_channel(self, auto_sdk=False):
        all_items = pm.textScrollList(self.ar_item_scroll, q=True, ai=True)
        for item in pm.ls(sl=True):
            if item not in all_items:
                pm.textScrollList(self.ar_item_scroll, e=True, a=item)
                self.ar_data.set_channel_joint(
                    channel=pm.optionMenuGrp(self.ar_channel_options,
                                             q=True,
                                             value=True),
                    joint=item.controller_name(),
                )
                self.ar_data.set_channel_joint_attr(
                    channel=pm.optionMenuGrp(self.ar_channel_options,
                                             q=True,
                                             value=True),
                    joint=item.controller_name(),
                    value=[0, 0, 0, 0, 0, 0, 1, 1, 1])

            pm.textScrollList(self.ar_item_scroll, e=True, da=True)
            pm.textScrollList(self.ar_item_scroll, e=True, si=item)

            if auto_sdk:
                self.update_sdk_json(type="select")

            self.ar_data.data_to_json()

        return True
示例#9
0
    def fill_blend_target(self, unused=True):
        # Clear the existing target list.
        for item in pm.optionMenu('sbsTargetList|OptionMenu',
                                  q=True,
                                  itemListLong=True):
            pm.deleteUI(item)

        # Prevent a warning from being printed if there aren't any blendShapes.
        if pm.optionMenuGrp('sbsList', q=True, ni=True) == 0:
            return

        # Get the names of the targets in the selected blend shape.
        value = pm.optionMenuGrp('sbsList', q=True, v=True)

        if not value:
            return
        nodes = pm.ls(value)
        if not nodes:
            return
        node = nodes[0]

        pm.menuItem(label='All', parent='sbsTargetList|OptionMenu')

        for item in node.attr('w'):
            target_name = pm.aliasAttr(item, q=True)
            pm.menuItem(label=target_name, parent='sbsTargetList|OptionMenu')
示例#10
0
def populate_characters(path_name, selected_character, characterList, selected_file):
    clear_option_menu("character_menu")
    characters = os.listdir(path_name)
    for characterFolder in characters:
        pm.menuItem(characterFolder, label=characterFolder, parent=("character_menu"+'|OptionMenu'))
    if selected_character is None:
        scroll_list(str(path_name + characters[0] + "/"), selected_file)
    else:
        pm.optionMenuGrp("character_menu", e=True, v=selected_character)
        scroll_list(str(path_name + selected_character + "/"), selected_file)
示例#11
0
    def createImageFormatControls(self):
        self.createGlobalsNode()
        self.createImageFormats()
        if pm.optionMenuGrp("openMayaImageFormats", q=True, exists=True):
            pm.deleteUI("openMayaImageFormats")
        self.imageFormatCtrl = pm.optionMenuGrp("openMayaImageFormats", label="Image Formats", cc=pm.Callback(self.imageFormatCallback))

        for pr in self.imageFormats:
            log.debug("adding image format: " + pr)
            pm.menuItem(pr)
        return self.imageFormatCtrl
示例#12
0
    def createImageFormatControls(self):
        self.createGlobalsNode()
        self.createImageFormats()
        if pm.optionMenuGrp("openMayaImageFormats", q=True, exists=True):
            pm.deleteUI("openMayaImageFormats")
        self.imageFormatCtrl = pm.optionMenuGrp("openMayaImageFormats", label="Image Formats", cc=pm.Callback(self.imageFormatCallback))

        for pr in self.imageFormats:
            log.debug("adding image format: " + pr)
            pm.menuItem(pr)
        return self.imageFormatCtrl
    def enable_all(self, value):
        if self.all_item is None:
            return

        pm.menuItem(self.all_item, edit=True, enable=value)

        if not value and self.get_selected_target():
            # The "All" entry is being disabled, but it's selected.  Select a different item
            # if possible.
            if pm.optionMenuGrp(self.control_name, q=True,
                                numberOfItems=True) > 1:
                pm.optionMenuGrp(self.control_name, edit=True, select=2)
示例#14
0
    def refresh_enabled_blend_shape_target_list(self, blend_shape_target_list, deformer):
        # Only enable this for blendShape deformers.
        enable_list = isinstance(deformer, pm.nodetypes.BlendShape)

        if blend_shape_target_list.control_name == 'cpwOutputBlendShapeTargets':
            # If this is the output deformer's list, and the input deformer is a blendShape and set to
            # All, disable this.
            input_deformer = self.input_deformer_list.get_selected_deformer()
            if isinstance(input_deformer, pm.nodetypes.BlendShape):
                selected_input_target = self.input_blend_shape_target_list.get_selected_target()
                if selected_input_target == '(all)':
                    enable_list = False

        pm.optionMenuGrp(blend_shape_target_list.control_name, edit=True, enable=enable_list)
示例#15
0
    def options_box_setup(self):
        self.optvars.add('zSplitBlendShapesBlendDistance', 'float', 2)
        self.optvars.add('zSplitBlendShapesPlane', 'int', 2)
        self.optvars.add('zSplitBlendShapesPlaneOrigin', 'float', 0)
        self.optvars.add('zSplitBlendShapesNamingPattern', 'string', '<name>_<L|R>')
        
        parent = pm.columnLayout(adjustableColumn=1)

        pm.optionMenuGrp('sbsList', label='Blend shape:', cc=self.fill_blend_target)
        self.fill_blend_shapes('sbsList|OptionMenu', False)

        pm.optionMenuGrp('sbsLeftOutput', label='Left output:')
        self.fill_blend_shapes('sbsLeftOutput|OptionMenu', True)

        pm.optionMenuGrp('sbsRightOutput', label='Right output:')
        self.fill_blend_shapes('sbsRightOutput|OptionMenu', True)

        # If something is selected, try to find a blend shape to select by default.
        selection = pm.ls(sl=True)
        if selection:
            history = pm.listHistory(selection)
            blend_shapes = pm.ls(history, type='blendShape')
            if blend_shapes:
                default_blend_shape = blend_shapes[0]
                self.select_blend_shape(default_blend_shape)

        pm.optionMenuGrp('sbsTargetList', label='Blend target:')
        self.fill_blend_target()

        pm.floatSliderGrp('sbsBlendDistance', label='Blend distance', field=True, min=0, max=10, fieldMinValue=0, fieldMaxValue=1000)
        pm.radioButtonGrp('sbsPlane', label='Plane:', numberOfRadioButtons=3, labelArray3=('XY', 'YZ', 'XZ'))
        pm.floatSliderGrp('sbsPlaneOrigin', label='Plane origin', v=0, min=0, max=1000)
        pm.textFieldGrp('sbsNamingPattern', label='Naming pattern')
示例#16
0
    def select_blend_shape(self, blend_shape):
        menu_items = pm.optionMenu('sbsList|OptionMenu', q=True, itemListLong=True)
        for idx, menu_item in enumerate(menu_items):
            item = pm.menuItem(menu_item, q=True, label=True)

            nodes = pm.ls(item)
            if not nodes:
                continue
            node = nodes[0]

            if node != blend_shape:
                continue;

            pm.optionMenuGrp('sbsList', edit=True, select=idx + 1)
示例#17
0
    def putProjectSettings(self):
        self.projDict['projectName'] = pm.textFieldGrp(self.projNameTxt,
                                                       q=True,
                                                       text=True)
        self.projDict['prefix'] = pm.textFieldGrp(self.prefixTxt,
                                                  q=True,
                                                  text=True)
        self.projDict['status'] = pm.optionMenuGrp(self.statusOpt,
                                                   q=True,
                                                   v=True)
        self.projDict['workLocation'] = pm.textFieldButtonGrp(self.workLocTxt,
                                                              q=True,
                                                              text=True)
        self.projDict['publishLocation'] = pm.textFieldButtonGrp(
            self.publishLocTxt, q=True, text=True)
        self.projDict['imagesWorkLocation'] = pm.textFieldButtonGrp(
            self.imgWorkLocTxt, q=True, text=True)
        self.projDict['imagesPublishLocation'] = pm.textFieldButtonGrp(
            self.imgPublishLocTxt, q=True, text=True)
        self.projDict['cacheLocation'] = pm.textFieldButtonGrp(
            self.cacheLocTxt, q=True, text=True)
        self.projDict[
            'assetCollection'] = self.projDict['projectName'] + '_asset'
        self.projDict[
            'shotCollection'] = self.projDict['projectName'] + '_shot'
        nameTemplateString = pm.textFieldGrp(self.nameTemplTxt,
                                             q=True,
                                             text=True)
        self.projDict['assetNameTemplate'] = nameTemplateString.split(',')
        cacheTemplateString = pm.textFieldGrp(self.cacheTemplTxt,
                                              q=True,
                                              text=True)
        self.projDict['cacheNameTemplate'] = cacheTemplateString.split(',')
        self.projDict['fps'] = pm.textFieldGrp(self.fpsTxt, q=True, text=True)
        self.projDict['mayaVersion'] = pm.optionMenuGrp(self.mayaVersionOpt,
                                                        q=True,
                                                        v=True)
        self.projDict['renderer'] = pm.optionMenuGrp(self.rendererOpt,
                                                     q=True,
                                                     v=True)

        res = pm.optionMenuGrp(self.resolutionOpt, q=True, v=True)
        self.projDict['resolution'] = [
            int(res.split('x')[0]),
            int(res.split('x')[1])
        ]

        self.projDict['assetFolders'] = self.assetTreeView.putFolderTree()
        self.projDict['shotFolders'] = self.shotTreeView.putFolderTree()
示例#18
0
 def createImageFormatControls(self):
     log.debug("createImageFormatControls()")
     self.createGlobalsNode()        
     self.createImageFormats()
     # self.imageFormatCtrl = pm.optionMenuGrp(label="Image Formats")
     
     if pm.optionMenuGrp("openMayaImageFormats", q=True, exists=True):
         pm.deleteUI("openMayaImageFormats")
         
     self.imageFormatCtrl = pm.optionMenuGrp("openMayaImageFormats", label="Image Formats", cc=pm.Callback(self.imageFormatCallback))                    
     
     for pr in self.imageFormats:
         log.debug("adding image format: " + pr)
         pm.menuItem(pr)
     # pm.scriptJob(attributeChange=[self.renderGlobalsNode.imageFormat, pm.Callback(self.imageFormatCallback)], parent = self.imageFormatCtrl)
     return self.imageFormatCtrl
示例#19
0
 def createImageFormatControls(self):
     log.debug("createImageFormatControls()")
     self.createGlobalsNode()        
     self.createImageFormats()
     # self.imageFormatCtrl = pm.optionMenuGrp(label="Image Formats")
     
     if pm.optionMenuGrp("openMayaImageFormats", q=True, exists=True):
         pm.deleteUI("openMayaImageFormats")
         
     self.imageFormatCtrl = pm.optionMenuGrp("openMayaImageFormats", label="Image Formats", cc=pm.Callback(self.imageFormatCallback))                    
     
     for pr in self.imageFormats:
         log.debug("adding image format: " + pr)
         pm.menuItem(pr)
     # pm.scriptJob(attributeChange=[self.renderGlobalsNode.imageFormat, pm.Callback(self.imageFormatCallback)], parent = self.imageFormatCtrl)
     return self.imageFormatCtrl
示例#20
0
    def jntToCrv(self, jnts=None, size=1.0, shape='sphere', *args):

        if not jnts:
            try:
                jnts = pm.ls(sl=True)
            except:
                pass
        if not jnts:
            pm.warning(
                'ehm_tools...JntToCrv: select joints to create control curve for them.'
            )

        else:
            jnts = pm.ls(jnts)

        try:  # if in UI mode, get info from UI
            shape = pm.optionMenuGrp(self.shapeType, q=True, value=True)
            size = pm.floatSliderGrp(self.sizeSlider, q=True, value=True)
        except:
            pass

        shapeCmd = {'sphere': SphereCrv, 'cube': CubeCrv, 'circle': Circle8Crv}
        self.newShapes = []

        for jnt in jnts:
            # if not (jnt.type()=='joint') :
            # pm.warning('ehm_tools...JntToCrv: %s is not a joint, skipped!'% jnt)
            # else:
            currentCircle = shapeCmd[shape](size=size)
            shapeNode = currentCircle.getShape()
            pm.select(shapeNode, jnt)
            pm.parent(add=True, shape=True)
            pm.delete(currentCircle)
            self.newShapes.append(jnt.getShape())
示例#21
0
文件: editor.py 项目: jzboylxj/XDLibs
    def selected_ar_channel(self):
        u"""选择AR通道

        :return:
        """
        current_channel = pm.optionMenuGrp(self.ar_channel_options,
                                           q=True,
                                           value=True)
        pm.textScrollList(self.ar_item_scroll, e=True, ra=True)
        if len(self.ar_data.get_channel_joints(current_channel)) > 0:
            pm.textScrollList(
                self.ar_item_scroll,
                e=True,
                a=self.ar_data.get_channel_joints(current_channel))
            pm.textScrollList(self.ar_item_scroll, e=True, sii=1)
            self.selected_ar_item_in_scroll()

        # print(u"已选择通道:{}".format(current_channel))

        work_mode = [
            "FaceUnityPoseLib", "ArkitPoseLib"
        ][pm.radioButtonGrp(self.work_mode_control, q=True, sl=True) - 1]
        if pm.objExists(work_mode):
            pm.connectControl('arIDControlSlider',
                              '{}.{}'.format(work_mode, current_channel))

        return
        def add_blend_shape_selector(name, label, refresh_on_change):
            pm.optionMenuGrp(name, label=label)

            # Create a list of blendShapes.
            bnArray = pm.ls(type='blendShape')
            for entry in bnArray:
                pm.menuItem(label=entry)
            if not bnArray:
                pm.menuItem(label='No Blend Shape Selected')

            # When the source selection is changed, update the source blend shape list.
            def changed(value):
                self.refresh_src_blend_shape_list()

            if refresh_on_change:
                pm.optionMenuGrp(name, edit=True, changeCommand=changed)
示例#23
0
    def createAssetCallBack(self, *args):
        name = pm.textFieldGrp('CrAsset_nameField', q=True, tx=True)
        if not name:
            return pm.confirmDialog(
                title='error',
                ma='center',
                message='please choose a name for the asset',
                button=['OK'],
                defaultButton='OK',
                dismissString='OK')
        workflow = pm.optionMenuGrp('CrAsset_workflowOpt', q=True, v=True)
        code = pm.textFieldGrp('CrAsset_codeField', q=True, tx=True)

        itemDict = database.createItem(self.type, name, self.path, workflow,
                                       code)
        print itemDict
        if itemDict == 'codeExists':
            return pm.confirmDialog(title='error',
                                    ma='center',
                                    message='this code already exists',
                                    button=['OK'],
                                    defaultButton='OK',
                                    dismissString='OK')

        pm.layoutDialog(dismiss='ok')
示例#24
0
 def get_files_cmd(self, *args):
     """ Get the files from the directory folder and put them into a menu for selection
     :return: None
     """
     self.selectedCharacter = pm.optionMenuGrp("character_menu", q=True, v=True)
     self.characterList = str(self.dirName + self.selectedCharacter + "/")
     populate_characters(self.dirName, self.selectedCharacter, self.characterList, self.selectedFile)
示例#25
0
文件: editor.py 项目: jzboylxj/XDLibs
    def remove_select_joint_in_scroll(self):
        u"""从列表里面移除选择的骨骼

        :return: None
        """
        select_joint = pm.textScrollList(self.ar_item_scroll, q=True, si=True)
        select_index = pm.textScrollList(self.ar_item_scroll, q=True, sii=True)

        # print "select_index: %s" % select_index[0]
        # print self.ar_data.dict_data[
        #     pm.optionMenuGrp(self.ar_channel_options, q=True, value=True)]

        helper.position_joint(select_joint[0],
                              value=[0, 0, 0, 0, 0, 0, 1, 1, 1])
        self.ar_data.dict_data[pm.optionMenuGrp(self.ar_channel_options,
                                                q=True,
                                                value=True)].pop(
                                                    select_joint[0])

        pm.textScrollList(self.ar_item_scroll, e=True, rii=select_index)

        self.ar_data.data_to_json()

        if int(select_index[0]) > 1:
            pm.textScrollList(self.ar_item_scroll, e=True, da=True)
            pm.textScrollList(self.ar_item_scroll,
                              e=True,
                              sii=(select_index[0] - 1))
            self.selected_ar_item_in_scroll()
        return
示例#26
0
文件: editor.py 项目: jzboylxj/XDLibs
    def initialize(self):
        if pm.optionVar(q='ARFaceEditor_jsonFileLocation'):
            self.ar_file_location = pm.optionVar(
                q='ARFaceEditor_jsonFileLocation')
            if os.path.isfile(self.ar_file_location):
                pm.textFieldButtonGrp(self.json_location_widget,
                                      e=True,
                                      text=self.ar_file_location)

                self.init_ar_channel_options(json_file=self.ar_file_location)
                pm.optionMenuGrp(self.ar_channel_options, e=True, sl=1)
                self.selected_ar_channel()
        else:
            self.ar_file_location = ""

        print(self.ar_file_location)
    def refresh(self):
        # Clear the existing target list.
        for item in pm.optionMenu(self.control_name + '|OptionMenu',
                                  q=True,
                                  itemListLong=True):
            pm.deleteUI(item)

        # Get the names of the outputs of the selected deformer.
        value = pm.optionMenuGrp(self.deformer_control.control_name,
                                 q=True,
                                 v=True)
        if not value:
            return
        nodes = pm.ls(value)
        if not nodes:
            return
        node = nodes[0]

        # Make a list of output shapes for this deformer.
        self.shapes = []
        for deformed_idx in range(node.numOutputConnections()):
            try:
                output_shape = node.outputShapeAtIndex(deformed_idx)
            except RuntimeError:
                # This fails with RuntimeError if we query an index that isn't connected, which can happen if you
                # create a deformer for three shapes and then delete the second one.
                continue

            self.shapes.append((output_shape, deformed_idx))
            pm.menuItem(label=output_shape.getParent().name(),
                        parent=self.control_name + '|OptionMenu')
 def get_selected_target(self):
     selected_target_idx = pm.optionMenuGrp(self.control_name,
                                            q=True,
                                            select=True)
     if not self.blend_shape_map:
         return None
     return self.blend_shape_map[selected_target_idx]
 def add_target(name, shape_id):
     item = pm.menuItem(label=name,
                        parent=self.control_name + '|OptionMenu')
     idx = pm.optionMenuGrp(self.control_name,
                            q=True,
                            numberOfItems=True)
     self.blend_shape_map[idx] = shape_id
     return item
 def get_selected_deformer(self):
     deformer = pm.optionMenuGrp(self.control_name, q=True, v=True)
     if not deformer:
         return None
     deformers = pm.ls(deformer)
     if not deformers:
         return None
     return deformers[0]
 def get_selected_shape(self):
     """
     Return the selected shape, and its index in the deformer's output.
     """
     shape_idx = pm.optionMenuGrp(self.control_name, q=True,
                                  select=True) - 1
     shape, deformer_shape_idx = self.shapes[shape_idx]
     return shape, deformer_shape_idx
示例#32
0
	def UI(self):
		
		# create window
		if pm.window( 'ehm_CtrlForThis_UI', exists=True ):
			pm.deleteUI( 'ehm_CtrlForThis_UI' )
		pm.window( 'ehm_CtrlForThis_UI', title='Create Control For Objects', w=280, h=100, mxb=False, mnb=False, sizeable=False )
		
		# main layout
		mainLayout = pm.columnLayout(w=280, h=130)
		formLayout = pm.formLayout(w=270, h=120)
		frameLayout = pm.frameLayout(borderStyle='etchedIn', labelVisible=False)	
		pm.setParent( formLayout )
		
		# num of joints slider
		self.shapeType = pm.optionMenuGrp(  label='shape type: '
												, h=30
												, columnAttach2=('left','left')
												, columnOffset2=(20,0)
												, columnWidth2=(90,60)	)												
		pm.menuItem(label="sphere")
		pm.menuItem(label="cube")
		pm.menuItem(label="circle")
		
		# size of shapes
		self.sizeSlider = pm.floatSliderGrp( label='shape size: '
												, value=1
												, minValue=0.0
												, maxValue=20
												, fieldMaxValue=10000, h=30, field=True
												, columnAttach3=('left','left','left' )
												, columnOffset3=(20,0,0 )
												, columnWidth3=(80,60,120)   )
	
		# button
		button = pm.button( label='apply', w=100, h=30,  c=partial( self.ctrlForThis, None, 1.0 , 'sphere' )  )
		
		# place controls
		pm.formLayout( formLayout, edit=True, attachForm=(frameLayout,'left', 3) )
		pm.formLayout( formLayout, edit=True, attachForm=(frameLayout,'right', 3) )
		pm.formLayout( formLayout, edit=True, attachForm=(frameLayout,'top', 3) )
		pm.formLayout( formLayout, edit=True, attachForm=(frameLayout,'bottom', 38) )
				
		
		pm.formLayout( formLayout, edit=True, attachForm=(self.shapeType,'left', 0) )
		pm.formLayout( formLayout, edit=True, attachForm=(self.shapeType,'top', 8) )
		
		pm.formLayout( formLayout, edit=True, attachForm=(self.sizeSlider,'left', 5) )
		pm.formLayout( formLayout, edit=True, attachForm=(self.sizeSlider,'top', 40) )
				
		
		pm.formLayout( formLayout, edit=True, attachForm=(button,'left', 5) )
		pm.formLayout( formLayout, edit=True, attachForm=(button,'right', 5) )
		pm.formLayout( formLayout, edit=True, attachForm=(button,'bottom', 5) )
		
		
		# show window
		pm.showWindow( 'ehm_CtrlForThis_UI' )
示例#33
0
    def createMenu(self, nodeName):
        """
        called to create an optionMenuGrp for choosing between multiple translator options for a given node
        """
        self._optionMenu = pm.optionMenuGrp(self._optionMenu, label=self._label,
                                             cc=lambda *args: self.menuChanged(nodeName, args[0]))
        # create menu items
        for tran in self.getTranslators():
            pm.menuItem(label=tran)
        pm.setParent(menu=True)

        transName = self.getCurrentTranslator(nodeName)
        pm.optionMenuGrp(self._optionMenu, edit=True, value=transName)

        transAttr = nodeName + ".aiTranslator"
        pm.scriptJob(attributeChange=[transAttr, lambda *args: self.attributeChanged(nodeName, transAttr, *args)],
                     replacePrevious=True,
                     parent=self._optionMenu)
示例#34
0
	def UI(self):
		
		# create window
		if pm.window( 'ehm_JntToCrv_UI', exists=True ):
			pm.deleteUI( 'ehm_JntToCrv_UI' )
		pm.window( 'ehm_JntToCrv_UI', title='Create Curve Shape On Joints', w=270, h=100, mxb=False, mnb=False, sizeable=False )
		
		# main layout
		mainLayout = pm.columnLayout(w=270, h=130)
		formLayout = pm.formLayout(w=260, h=120)
		frameLayout = pm.frameLayout(borderStyle='etchedIn', labelVisible=False)	
		pm.setParent( formLayout )
		
		# num of joints slider
		self.shapeType = pm.optionMenuGrp(  label='shape type: '
												, h=30
												, columnAttach2=('left','left')
												, columnOffset2=(20,0)
												, columnWidth2=(90,60)	)												
		pm.menuItem(label="sphere")
		pm.menuItem(label="cube")
		pm.menuItem(label="circle")
		
		# size of shapes
		self.sizeSlider = pm.floatSliderGrp( label='shape size: '
												, value=1
												, minValue=0.0
												, maxValue=20
												, fieldMaxValue=10000, h=30, field=True
												, columnAttach3=('left','left','left' )
												, columnOffset3=(20,0,0 )
												, columnWidth3=(80,50,80)   )
	
		# button
		button = pm.button( label='apply', w=100, h=30,  c=partial( self.jntToCrv, None, 1.0 , 'sphere' )  )
		
		# place controls
		pm.formLayout( formLayout, edit=True, attachForm=(frameLayout,'left', 3) )
		pm.formLayout( formLayout, edit=True, attachForm=(frameLayout,'right', 3) )
		pm.formLayout( formLayout, edit=True, attachForm=(frameLayout,'top', 3) )
		pm.formLayout( formLayout, edit=True, attachForm=(frameLayout,'bottom', 38) )
				
		
		pm.formLayout( formLayout, edit=True, attachForm=(self.shapeType,'left', 0) )
		pm.formLayout( formLayout, edit=True, attachForm=(self.shapeType,'top', 8) )
		
		pm.formLayout( formLayout, edit=True, attachForm=(self.sizeSlider,'left', 5) )
		pm.formLayout( formLayout, edit=True, attachForm=(self.sizeSlider,'top', 40) )
				
		
		pm.formLayout( formLayout, edit=True, attachForm=(button,'left', 5) )
		pm.formLayout( formLayout, edit=True, attachForm=(button,'right', 5) )
		pm.formLayout( formLayout, edit=True, attachForm=(button,'bottom', 5) )
		
		
		# show window
		pm.showWindow( 'ehm_JntToCrv_UI' )
示例#35
0
    def updateImageSize(self, *args):

        w = float(self.defaultResolution.width.get())
        h = float(self.defaultResolution.height.get())
        dar = float(self.defaultResolution.deviceAspectRatio.get())
        aspectLock = self.defaultResolution.aspectLock.get()

        if args is None or len(args) == 0:
            return

        if args[0] == "width":
            if aspectLock:
                h = w / dar
        if args[0] == "height":
            if aspectLock:
                w = h * dar
        if args[0] == "devAsp":
            h = w / dar
        darNew = w / h

        self.defaultResolution.deviceAspectRatio.set(darNew)
        self.defaultResolution.width.set(w)
        self.defaultResolution.height.set(h)

        defrw = pm.SCENE.defaultResolution.width
        defrh = pm.SCENE.defaultResolution.height
        defrd = pm.SCENE.defaultResolution.deviceAspectRatio
        if args[0] == "width":
            pm.scriptJob(attributeChange=(defrw,
                                          pm.Callback(self.updateImageSize,
                                                      ["width"])),
                         runOnce=True)
        if args[0] == "height":
            pm.scriptJob(attributeChange=(defrh,
                                          pm.Callback(self.updateImageSize,
                                                      ["height"])),
                         runOnce=True)
        if args[0] == "devAsp":
            pm.scriptJob(attributeChange=(defrd,
                                          pm.Callback(self.updateImageSize,
                                                      ["devAsp"])),
                         runOnce=True)

        if not self.rendererTabUiDict.has_key('common'):
            return
        uiDict = self.rendererTabUiDict['common']

        if not pm.optionMenuGrp(uiDict['imageSizePresets'], exists=True):
            log.debug("imageSizePresets Option menu does not exist.")
            return

        for imgFormat in self.imageFormatData:
            if w == imgFormat[1] and h == imgFormat[2]:
                uiDict['imageSizePresets'].setSelect(
                    self.imageFormatData.index(imgFormat) + 1)
                return
        uiDict['imageSizePresets'].setSelect(1)
    def createAssetPrompt(self):
        code = ''

        proj = database.getProjectDict()
        if self.type == 'asset':
            code = "%04d" % proj['nextAsset']
        elif self.type == 'shot':
            code = "%04d" % proj['nextShot']

        form = pm.setParent(q=True)
        f = pm.formLayout(form, e=True, width=150)
        row = pm.rowLayout(nc=2, adj=2)
        pm.picture(image='sphere.png', w=50, h=50)
        col = pm.columnLayout(adjustableColumn=True)
        nameField = pm.textFieldGrp('CrAsset_nameField',
                                    label='Name',
                                    cw=(1, 70),
                                    text='',
                                    adj=2,
                                    cat=[(1, 'left', 5), (2, 'left', 5)],
                                    editable=True)
        codeField = pm.textFieldGrp('CrAsset_codeField',
                                    label='Code',
                                    cw=(1, 70),
                                    text=code,
                                    adj=2,
                                    cat=[(1, 'left', 5), (2, 'left', 5)],
                                    editable=True)
        workflow = pm.optionMenuGrp('CrAsset_workflowOpt',
                                    label='Workflow',
                                    cw=(1, 70),
                                    cat=[(1, 'left', 5), (2, 'left', 5)])
        proj = database.getProjectDict()

        for key in proj['workflow']:
            context = set([
                proj['workflow'][key][x]['type'] for x in proj['workflow'][key]
            ])
            if self.type in context:
                pm.menuItem(label=key)

        b1 = pm.button(p=f, l='Cancel', c=self.abortCreateCallback)
        b2 = pm.button(p=f, l='OK', c=self.createAssetCallBack)

        spacer = 5
        top = 5
        edge = 5
        pm.formLayout(form,
                      edit=True,
                      attachForm=[(row, 'right', edge), (row, 'top', top),
                                  (row, 'left', edge), (row, 'right', edge),
                                  (b1, 'right', edge), (b1, 'bottom', edge),
                                  (b2, 'left', edge), (b2, 'bottom', edge)],
                      attachNone=[],
                      attachControl=[],
                      attachPosition=[(b1, 'right', spacer, 90),
                                      (b2, 'left', spacer, 10)])
示例#37
0
 def _assetSelected(self, fileID):
     # Update background color for buttons.
     if self._currentSelectedAsset != None:
         _pmCore.iconTextButton(self._uiWidget[_UiWidgetEnum.assetBtnList][self._assetBtnName(self._currentSelectedAsset)], edit=True, backgroundColor=self._defaultColor)
     btnName = self._assetBtnName(fileID)
     button = self._uiWidget[_UiWidgetEnum.assetBtnList].get(btnName)
     _pmCore.iconTextButton(button, edit=True, backgroundColor=self._highlightColor)
     
     # Get file info from database.
     fileInfo = _Database.getFileInfo(fileID)
     _pmCore.textFieldGrp(self._uiWidget[_UiWidgetEnum.sceneNameTextField], edit=True, text=fileInfo[1])
     _pmCore.textFieldGrp(self._uiWidget[_UiWidgetEnum.filePathTextField], edit=True, text=fileInfo[2])
     _pmCore.scrollField(self._uiWidget[_UiWidgetEnum.descriptionTextField], edit=True, text=fileInfo[4])
     _pmCore.optionMenuGrp(self._uiWidget[_UiWidgetEnum.categoryCombox], edit=True, value=fileInfo[5])
     
     # Update version text.
     versionNum = _Database.getCurrentVersion(fileID)
     _pmCore.text(self._uiWidget[_UiWidgetEnum.versionNumText], edit=True, label=str(versionNum))
     self._currentSelectedAsset = fileID
示例#38
0
    def AppleseedEnvironmentCreateTab(self):
        self.createGlobalsNode()
        parentForm = pm.setParent(query=True)
        pm.setUITemplate("attributeEditorTemplate", pushTemplate=True)
        scLo = self.rendererName + "AOScrollLayout"
        envDict = {}
        self.rendererTabUiDict['environment'] = envDict
        uiDict = envDict
        with pm.scrollLayout(scLo, horizontalScrollBarThickness=0):
            with pm.columnLayout(self.rendererName + "ColumnLayout", adjustableColumn=True, width=400):
                with pm.frameLayout(label="Environment Lighting", collapsable=False):
                    with pm.columnLayout(self.rendererName + "ColumnLayout", adjustableColumn=True, width=400):
                        attr = pm.Attribute(self.renderGlobalsNodeName + ".environmentType")
                        envDict['environmentType'] = pm.attrEnumOptionMenuGrp(label="Environment Type", at=self.renderGlobalsNodeName + ".environmentType", ei=self.getEnumList(attr))

                with pm.frameLayout(label="Environment Colors", collapsable=False) as envDict['commonEnvFrame']:
                    with pm.columnLayout(self.rendererName + "ColumnLayout", adjustableColumn=True, width=400):
                        ui = pm.floatFieldGrp(label="Environment Intensity:", value1=1.0, numberOfFields=1)
                        pm.connectControl(ui, self.renderGlobalsNodeName + ".environmentIntensity", index=2)
                        envDict['environmentColor'] = pm.attrColorSliderGrp(label="Environment Color:", at=self.renderGlobalsNodeName + ".environmentColor")
                        envDict['gradientHorizon'] = pm.attrColorSliderGrp(label="Gradient Horizon Color:", at=self.renderGlobalsNodeName + ".gradientHorizon")
                        envDict['gradientZenit'] = pm.attrColorSliderGrp(label="Gradient Zenith Color:", at=self.renderGlobalsNodeName + ".gradientZenit")
                        envDict['environmentMap'] = pm.attrColorSliderGrp(label="Environment Map:", at=self.renderGlobalsNodeName + ".environmentMap")
                        self.addRenderGlobalsUIElement(attName='latlongHoShift', uiType='float', displayName='Lat-Long Horizontal Shift:', uiDict=uiDict)
                        self.addRenderGlobalsUIElement(attName='latlongVeShift', uiType='float', displayName='Lat-Long Vertical Shift:', uiDict=uiDict)

                with pm.frameLayout(label="Physical Sky", collapsable=False) as envDict['pysSkyFrame']:
                    with pm.columnLayout(self.rendererName + "ColumnLayout", adjustableColumn=True, width=400):
                        attr = pm.Attribute(self.renderGlobalsNodeName + ".skyModel")
                        envDict['pskModel'] = pm.attrEnumOptionMenuGrp(label="Sky Model:", at=self.renderGlobalsNodeName + ".skyModel", ei=self.getEnumList(attr))
                        uiDict['sunLightOptionMenu'] = pm.optionMenuGrp(label="Sun Light:", changeCommand=self.updateSunLightOptionMenu)
                        envDict['pskGrAlbedo'] = pm.floatFieldGrp(label="Ground Albedo:", value1=1.0, numberOfFields=1)
                        pm.connectControl(envDict['pskGrAlbedo'], self.renderGlobalsNodeName + ".ground_albedo", index=2)
                        envDict['pskGrHShit'] = pm.floatFieldGrp(label="Horizon Shift:", value1=1.0, numberOfFields=1)
                        pm.connectControl(envDict['pskGrHShit'], self.renderGlobalsNodeName + ".horizon_shift", index=2)
                        envDict['pskLumMulti'] = pm.floatFieldGrp(label="Luminance Multiplier:", value1=1.0, numberOfFields=1)
                        pm.connectControl(envDict['pskLumMulti'], self.renderGlobalsNodeName + ".luminance_multiplier", index=2)
                        envDict['pskSatMulti'] = pm.floatFieldGrp(label="Saturation Multiplier:", value1=1.0, numberOfFields=1)
                        pm.connectControl(envDict['pskSatMulti'], self.renderGlobalsNodeName + ".saturation_multiplier", index=2)
                        envDict['pskTurb'] = pm.floatFieldGrp(label="Turbidity:", value1=1.0, numberOfFields=1)
                        pm.connectControl(envDict['pskTurb'], self.renderGlobalsNodeName + ".turbidity", index=2)
                        envDict['pskTurbMin'] = pm.floatFieldGrp(label="Turbidity Min:", value1=1.0, numberOfFields=1)
                        pm.connectControl(envDict['pskTurbMin'], self.renderGlobalsNodeName + ".turbidity_min", index=2)
                        envDict['pskTurbMax'] = pm.floatFieldGrp(label="Turbidity Max:", value1=1.0, numberOfFields=1)
                        pm.connectControl(envDict['pskTurbMax'], self.renderGlobalsNodeName + ".turbidity_max", index=2)

                with pm.frameLayout(label="OSL", collapsable=False) as envDict['oslFrame']:
                    with pm.columnLayout(self.rendererName + "ColumnLayout", adjustableColumn=True, width=400):
                        envDict['environmentOSL'] = pm.attrColorSliderGrp(label="OSL Background", at=self.renderGlobalsNodeName + ".environmentOSL")

        pm.setUITemplate("attributeEditorTemplate", popTemplate=True)
        pm.formLayout(parentForm, edit=True, attachForm=[ (scLo, "top", 0), (scLo, "bottom", 0), (scLo, "left", 0), (scLo, "right", 0) ])
        pm.scriptJob(attributeChange=[self.renderGlobalsNode.environmentType, pm.Callback(self.uiCallback, tab="environment")])
        pm.scriptJob(attributeChange=[self.renderGlobalsNode.skyModel, pm.Callback(self.uiCallback, tab="environment")])
        self.updateEnvironment()
示例#39
0
 def addLightFilterCB(self, name):
     """
     This callback is triggered when the filter menu changes.  The filter menu contains a list of 
     filter types, and of existing filter nodes.
     """
     if not name or name == '<Add Filter>':
         # selected a menu divider. reset
         self.updateAddMenu()
         return
     items = pm.optionMenuGrp(self.addOptionMenuGrp, query=True, itemListLong=True)
     index = pm.optionMenuGrp(self.addOptionMenuGrp, query=True, select=True)
     # get the mode of the callback
     mode = pm.menuItem(items[index-1], query=True, data=True)
     if mode == self.MENU_NODE_TYPE:
         # name is a type
         newFilter = self.addLightFilter(name)
         # not sure whether selecting is the right thing to do. it's a bit of jolt.
         #pm.mel.updateAE(newFilter)
     else: # MENU_NODE_INSTANCE
         # name is an existing node
         self.connectLightFilter(pm.PyNode(name))
示例#40
0
 def _newAssetInfoConfirmed(self, args):
     sceneName = _pmCore.textFieldGrp(self._sceneName, query=True, text=True)
     directory = _pmCore.textFieldGrp(self._filePath, query=True, text=True)
     description = _pmCore.scrollField(self._description, query=True, text=True)
     category = _pmCore.optionMenuGrp(self._category, value=True, query=True)
     if not sceneName or not directory or not description:
         _pmCore.confirmDialog(title='Invalid Asset Info', message='Asset info for "Scene Name", "Directory" and "Description" can not be empty.', button='OK')
         return
     self._newAssetInfoClose()
     fileID = _MayaFunctions.saveScene(sceneName, directory, description, category)
     if self._addedCallback:
         self._addedCallback(fileID, category)
示例#41
0
def gui():
    '''
    Triggers the interface for zoomerate.
    '''
    
    # Warning this is causeing issues with 2012
    panel = pm.getPanel(wf=True)
    try:
        whichCam = pm.modelPanel(panel, q=1, camera=True)
    except RuntimeError:
        whichCam = pm.modelPanel('modelPanel4', q=1, camera=True)
        print 'Using: %s' % whichCam
        
    whichCamShape = pm.ls(whichCam, dag=True, shapes=True, ap=True)
    
    # Figure out what cameras to use when building the menu
    cameras = pm.ls(ca=True)
    diffCams = []
    diffCams.extend(whichCamShape)
    diffCams.extend(cameras)
    print diffCams, len(diffCams)
    
    win_name = 'zoomer_win2'
    if pm.window(win_name, ex=True):
        pm.deleteUI(win_name)
        
    win = pm.window(win_name, s=0, ip=True, iconName='zoomer', w=400, h=180,
                    t='Camera zoomeratro v1.0')
    main = pm.columnLayout()
    pm.frameLayout(borderVisible=True, labelVisible=True, labelAlign='cener', label='Zoom Options', marginWidth=5, marginHeight=5)
    pm.columnLayout()
    global which_cam_menu
    which_cam_menu = pm.optionMenuGrp(label='Camera to Zoom', cc=connect)
    pm.menuItem(label=whichCamShape[0])
    for i in xrange(len(diffCams)-1):
        pm.menuItem(label=cameras[i])
    
    horizontal_attr = '%s.horizontalFilmOffset' % whichCamShape[0]
    vertical_attr = '%s.verticalFilmOffset' % whichCamShape[0]
    overscan_attr = '%s.overscan' % whichCamShape[0]
    
    global horizontal_slider, vertical_slider, overscan_slider
    horizontal_slider = pm.floatSliderGrp(field=True, label='Horizontal', min=-3, max=3, pre=3, step=0.001)
    vertical_slider = pm.floatSliderGrp(field=True, label='Vertical', min=-3, max=3, pre=3, step=0.001)
    overscan_slider = pm.floatSliderGrp(field=True, label='Overscan', min=-3, max=3, pre=3, step=0.001)
    
    pm.connectControl(horizontal_slider, horizontal_attr)
    pm.connectControl(vertical_slider, vertical_attr)
    pm.connectControl(overscan_slider, overscan_slider)
    
    pm.button(label='Reset', c=reset)
    win.show()
示例#42
0
    def updateMenu(self, nodeName):
        """
        called to update an optionMenuGrp for choosing between multiple translator options for a given node
        """
        # delete current options
        translators = pm.optionMenuGrp(self._optionMenu, q=True, itemListLong=True)
        for tran in translators:
            pm.deleteUI(tran, menuItem=True)

        # populate with a fresh list
        parent = pm.setParent(self._optionMenu)
        for tran in self._translators:
            pm.menuItem(label=tran, parent=parent + '|OptionMenu')

        transName = self.getCurrentTranslator(nodeName)
        pm.optionMenuGrp(self._optionMenu, edit=True, value=transName,
                           cc=lambda *args: self.menuChanged(nodeName, args[0]))
        self.updateChildren(nodeName, transName)

        transAttr = nodeName + ".aiTranslator"
        pm.scriptJob(attributeChange=[transAttr, lambda *args: self.attributeChanged(nodeName, transAttr, *args)],
                     replacePrevious=True,
                     parent=self._optionMenu)
示例#43
0
 def _updateAssetClicked(self):
     if self._currentSelectedAsset == None:
         raise RuntimeError('Nothing selected.')
     sceneName = _pmCore.textFieldGrp(self._uiWidget[_UiWidgetEnum.sceneNameTextField], query=True, text=True)
     filePath = _pmCore.textFieldGrp(self._uiWidget[_UiWidgetEnum.filePathTextField], query=True, text=True)
     category = _pmCore.optionMenuGrp(self._uiWidget[_UiWidgetEnum.categoryCombox], query=True, value=True)
     description = _pmCore.scrollField(self._uiWidget[_UiWidgetEnum.descriptionTextField], query=True, text=True)
     _Database.setFileCategory(self._currentSelectedAsset, category)
         
     _Database.setFileDescription(self._currentSelectedAsset, description)
     _Database.setFilename(self._currentSelectedAsset, sceneName)
     _Database.setFilePath(self._currentSelectedAsset, filePath)
     _pmCore.iconTextButton(self._uiWidget[_UiWidgetEnum.assetBtnList][self._assetBtnName(self._currentSelectedAsset)], edit=True, label=sceneName)
 
     self._refreshAssetButtonView()
示例#44
0
    def updateImageSize(self, *args):
                        
        w = float(self.defaultResolution.width.get())
        h = float(self.defaultResolution.height.get())
        dar = float(self.defaultResolution.deviceAspectRatio.get())
        aspectLock = self.defaultResolution.aspectLock.get()
        
        
        if args is None or len(args) == 0:
            return
                        
        if args[0] == "width":
            if aspectLock:
                h = w / dar
        if args[0] == "height":
            if aspectLock:
                w = h * dar
        if args[0] == "devAsp":
            h = w / dar
        darNew = w / h
        
        self.defaultResolution.deviceAspectRatio.set(darNew)
        self.defaultResolution.width.set(w)
        self.defaultResolution.height.set(h)

        defrw = pm.SCENE.defaultResolution.width
        defrh = pm.SCENE.defaultResolution.height
        defrd = pm.SCENE.defaultResolution.deviceAspectRatio
        if args[0] == "width":
            pm.scriptJob(attributeChange=(defrw, pm.Callback(self.updateImageSize, ["width"])), runOnce=True)
        if args[0] == "height":
            pm.scriptJob(attributeChange=(defrh, pm.Callback(self.updateImageSize, ["height"])), runOnce=True)
        if args[0] == "devAsp":
            pm.scriptJob(attributeChange=(defrd, pm.Callback(self.updateImageSize, ["devAsp"])), runOnce=True)

        if not self.rendererTabUiDict.has_key('common'):
            return
        uiDict = self.rendererTabUiDict['common']
        
        if not pm.optionMenuGrp(uiDict['imageSizePresets'], exists=True):
            log.debug("imageSizePresets Option menu does not exist.")
            return
        
        for imgFormat in self.imageFormatData:            
            if w == imgFormat[1] and h == imgFormat[2]:
                uiDict['imageSizePresets'].setSelect(self.imageFormatData.index(imgFormat) + 1) 
                return
        uiDict['imageSizePresets'].setSelect(1)
示例#45
0
 def updateAddMenu(self):
     # clear
     for item in pm.optionMenuGrp(self.addOptionMenuGrp, query=True, itemListLong=True) or []:
         pm.deleteUI(item)
     # rebuild
     pm.menuItem(label='<Add Filter>', parent=self.addOptionMenu)
     if self.validFilters():
         for filterType in self.validFilters():
             pm.menuItem(label=filterType, data=self.MENU_NODE_TYPE, parent=self.addOptionMenu)
         connected = self.getConnectedLightFilters()
         existing = [node for node in pm.ls(type=self.validFilters()) or [] if node not in connected]
         if existing:
             #pm.menuItem(label='<Existing Filters...>', parent=self.addOptionMenu)
             pm.menuItem(divider=True, parent=self.addOptionMenu)
             for filter in existing:
                 pm.menuItem(label=filter, data=self.MENU_NODE_INSTANCE, parent=self.addOptionMenu)
示例#46
0
 def _buildupWindow(self):
     if isinstance(self._window, _pmCore.uitypes.Window) and self._window.exists(self._window.name()):
         _pmCore.deleteUI(self._window, window=True)
     self._window = _pmCore.window(title=self._winTitle)
     _pmCore.columnLayout()
     self._sceneName = _pmCore.textFieldGrp(label='Scene Name: ', columnAlign2=('left', 'left'), columnWidth2=(80, 200))
     _pmCore.rowLayout(numberOfColumns=2)
     self._filePath = _pmCore.textFieldGrp(label='Directory: ', columnAlign2 = ('left', 'left'), columnWidth2=(80, 180))
     _pmCore.button(label='...', width=20, command=_functools.partial(self._directorySelection, self._filePath))
     _pmCore.setParent('..')
     self._category = _pmCore.optionMenuGrp(label='Category: ', columnAlign2=('left', 'left'), columnWidth2=(80, 200))
     for category in _Database.getCategoryList():
         _pmCore.menuItem(label=category)
     _pmCore.text(label='Description: ')
     self._description = _pmCore.scrollField(width = 300, height=100)
     _pmCore.rowLayout(numberOfColumns=2)
     _pmCore.button(label='OK', width=150, align='left', command=self._newAssetInfoConfirmed)
     _pmCore.button(label='Cancel', width=150, align='left', command=self._newAssetInfoClose)
示例#47
0
 def _buildupWindow(self):
     if self._dockControl and self._dockControl.exists(self._winTitle):
         _pmCore.deleteUI(self._dockControl)
     self._window = _pmCore.window(title=self._winTitle)
     
     _pmCore.columnLayout()
     self._dockControl = _pmCore.dockControl(area='right', content=self._window, label=self._winTitle)
     tabLayout = _pmCore.tabLayout()
     self._uiWidget[_UiWidgetEnum.categoryTabLayout] = tabLayout
     for category in _Database.getCategoryList():
         childLayout = _pmCore.scrollLayout(width=300, height=300, childResizable=True)
         self._uiWidget[category] = _pmCore.gridLayout(numberOfColumns=3, cellHeight = self._iconSize, cellWidth=self._iconSize)
         for assetInfo in _Database.getAssetUnderCategory(category):
             id, sceneName, _, versionID, _, _, _ = assetInfo
             self._addAssetButton(id, sceneName, versionID)
         _pmCore.tabLayout(tabLayout, tabLabel=((childLayout, category),), edit=True)
         _pmCore.setParent('..')
         _pmCore.setParent('..')
         
     _pmCore.setParent('..')
     
     self._uiWidget[_UiWidgetEnum.sceneNameTextField] = _pmCore.textFieldGrp(label='Scene Name: ', width=300, columnAlign2=['left', 'left'], columnWidth2=[100, 195])
     self._uiWidget[_UiWidgetEnum.filePathTextField] = _pmCore.textFieldGrp(label='File Path: ', width=300, columnAlign2=['left', 'left'], columnWidth2=[100, 195])
     _pmCore.rowLayout(numberOfColumns=2)
     _pmCore.text(label="Current Version:", width=100, align='left')
     self._uiWidget[_UiWidgetEnum.versionNumText] = _pmCore.text(label="")
     _pmCore.setParent('..')
     self._uiWidget[_UiWidgetEnum.categoryCombox] = _pmCore.optionMenuGrp(label='Category: ', width=300, columnAlign2=['left', 'left'], columnWidth2=[100, 195])
     for category in _Database.getCategoryList():
         self._uiWidget.setdefault(_UiWidgetEnum.categoryMenuList, []).append(_pmCore.menuItem(label=category))
     _pmCore.text(label='Description:')
     self._uiWidget[_UiWidgetEnum.descriptionTextField] = _pmCore.scrollField(width=300, height=50)
 
     _pmCore.separator(style='single', horizontal=True)
     _pmCore.gridLayout(numberOfColumns=2, cellWidth=150)
     self._uiWidget[_UiWidgetEnum.updateAssetBtn] = _pmCore.button(label='Update Asset Info', command=_pmCore.Callback(self._updateAssetClicked))
     self._uiWidget[_UiWidgetEnum.addCommentBtn] = _pmCore.button(label='View Version & Comment', command=_pmCore.Callback(self._viewVersionListClicked))
     self._uiWidget[_UiWidgetEnum.addAssetBtn] = _pmCore.button(label='Add New Asset', command=_pmCore.Callback(self._addAssetClicked))
     self._uiWidget[_UiWidgetEnum.deleteAssetBtn] = _pmCore.button(label='Delete Asset', command=_pmCore.Callback(self._deleteAssetClicked))
     self._uiWidget[_UiWidgetEnum.addVersionBtn] = _pmCore.button(label='Add Version', command=_pmCore.Callback(self._addVersionClicked))
     self._uiWidget[_UiWidgetEnum.manageCategoryBtn] = _pmCore.button(label='Manage Category', command=self._manageCategoryClicked)
     
     _pmCore.setParent('..')
示例#48
0
    def customLightFiltersNew(self, attr):
        pm.rowLayout(numberOfColumns=3,
                       adjustableColumn=2,
                       rowAttach=(1, "top", 0),
                       columnWidth=[(1, 140), (2, 180)])
        pm.text(label="")
        pm.columnLayout(adjustableColumn=True,
                          columnAttach=("both", 0),
                          rowSpacing=5)
        uiName = '%s_aiFilter'%(self.nodeType())
        self.scrollList = pm.textScrollList(uiName, height=150, ams=False,
                                              sc=self.lightFilterListChanged,
                                              dcc=self.updateCustomLightFiltersNew)

        pm.rowLayout(numberOfColumns=2,
                       columnWidth2=(80,80),
                       columnAttach2=("both", "both"),
                       columnAlign2=("center", "center"),
                       columnOffset2=(2, 2))

        pm.button('lf_add_button', label="Add", c=Callback(self.addLightFilterWin))
        pm.button('lf_remove_button', label="Disconnect", c=Callback(self.removeLightFilter))
        # implicit end of row layout
        pm.setParent('..') # back to column layout
        pm.setParent('..') # back to row layout
        pm.columnLayout(adjustableColumn=True,
                          columnAttach=("both", 0),
                          rowSpacing=5)
        pm.symbolButton('lf_move_up_button', image='arrowUp.xpm', c=Callback(self.moveLightFilterUp))
        pm.symbolButton('lf_move_down_button', image='arrowDown.xpm', c=Callback(self.moveLightFilterDown))
        pm.setParent('..')
        pm.setParent('..')
                
        self.addOptionMenuGrp = pm.optionMenuGrp('lf_add_menu', label='Add',
                                                 changeCommand=self.addLightFilterCB)
        self.addOptionMenu = self.addOptionMenuGrp + '|OptionMenu'
    
        self.lightFiltersUpdateList()
        self.updateAddMenu()
示例#49
0
	def jntToCrv ( self, jnts=None, size=1.0, shape='sphere', *args ):

		if not jnts:
			try:
				jnts = pm.ls(sl=True)
			except:
				pass
		if not jnts:
			pm.warning('ehm_tools...JntToCrv: select joints to create control curve for them.')
		
		else:
			jnts = pm.ls( jnts )
			
		try:# if in UI mode, get info from UI
			shape =  pm.optionMenuGrp( self.shapeType, q=True,  value= True  )
			size = pm.floatSliderGrp( self.sizeSlider, q=True,  value= True  )
		except:
			pass		

		shapeCmd = { 'sphere': SphereCrv
					,'cube'  : CubeCrv
					,'circle': Circle8Crv
					}
		self.newShapes = []
		

		for jnt in jnts:
			# if not (jnt.type()=='joint') :
				# pm.warning('ehm_tools...JntToCrv: %s is not a joint, skipped!'% jnt)
			# else:
			currentCircle = shapeCmd[shape]( size=size )
			shapeNode = currentCircle.getShape()
			pm.select ( shapeNode , jnt )
			pm.parent ( add = True  , shape = True )
			pm.delete (currentCircle)
			self.newShapes.append( jnt.getShape() )
示例#50
0
    def uiCreate(self):

        self.onCloseClicked()

        self.window = pm.window(
            WIN_NAME,
            title='PyMel Window',
            maximizeButton=False
        )

        with self.window:
            with pm.formLayout() as uiLAY_mainForm:
                with pm.scrollLayout('uiLAY_mainScroll', childResizable=True) as self.uiLAY_mainScroll:
                    with pm.columnLayout(adjustableColumn=True):

                        with self.uiCreateFrame('uiLAY_frameCheckBoxes', 'Check Boxes (PMCheckBox)') as self.uiLAY_frameCheckBoxes:
                            with pm.columnLayout():
                                pm.separator(style='none', height=2)
                                with pm.rowLayout(numberOfColumns=3):
                                    pm.separator(width=140, style='none')
                                    self.uiCHK_test1 = pm.checkBox('uiCHK_test1', label='test1')
                                    self.uiCHK_test2 = pm.checkBox('uiCHK_test2', label='test2')

                        with self.uiCreateFrame('uiLAY_frameCheckBoxGroups', 'Check Box Groups (PMCheckBoxGrp#)') as self.uiLAY_frameCheckBoxGroups:
                            with pm.columnLayout():
                                pm.separator(style='none', height=2)
                                self.uiCHKGRP_test1 = pm.checkBoxGrp(
                                    'uiCHKGRP_test1',
                                    numberOfCheckBoxes=1,
                                    label='PMCheckBoxGrp1',
                                    label1='test1'
                                )
                                self.uiCHKGRP_test2 = pm.checkBoxGrp(
                                    'uiCHKGRP_test2',
                                    numberOfCheckBoxes=2,
                                    label='PMCheckBoxGrp2',
                                    labelArray2=('test1', 'test2')
                                )
                                self.uiCHKGRP_test3 = pm.checkBoxGrp(
                                    'uiCHKGRP_test3',
                                    numberOfCheckBoxes=3,
                                    label='PMCheckBoxGrp3',
                                    labelArray3=('test1', 'test2', 'test3')
                                )
                                self.uiCHKGRP_test4 = pm.checkBoxGrp(
                                    'uiCHKGRP_test4',
                                    numberOfCheckBoxes=4,
                                    label='PMCheckBoxGrp4',
                                    labelArray4=('test1', 'test2', 'test3', 'test4')
                                )

                        with self.uiCreateFrame('uiLAY_frameColorSliders', 'Color Slider Groups (PMColorSliderGrp)') as self.uiLAY_frameColorSliders:
                            with pm.columnLayout():
                                pm.separator(style='none', height=2)
                                self.uiCLRGRP_test1 = pm.colorSliderGrp(
                                    'uiCLRGRP_test1',
                                    label='test1'
                                )
                                self.uiCLRGRP_test2 = pm.colorSliderGrp(
                                    'uiCLRGRP_test2',
                                    label='test2'
                                )

                        with self.uiCreateFrame('uiLAY_frameFloatFields', 'Float Fields (PMFloatField)') as self.uiLAY_frameFloatFields:
                            with pm.columnLayout():
                                pm.separator(style='none', height=2)
                                with pm.rowLayout(numberOfColumns=3):
                                    pm.separator(width=140, style='none')
                                    self.uiFLF_test1 = pm.floatField('uiFLF_test1')
                                    self.uiFLF_test2 = pm.floatField('uiFLF_test2')

                        with self.uiCreateFrame('uiLAY_frameFloatFieldGroups', 'Float Field Groups (PMFloatFieldGrp#)') as self.uiLAY_frameFloatFieldGroups:
                            with pm.columnLayout():
                                pm.separator(style='none', height=2)
                                self.uiFLFGRP_test1 = pm.floatFieldGrp(
                                    'uiFLFGRP_test1',
                                    numberOfFields=1,
                                    label='PMFloatFieldGrp1'
                                )
                                self.uiFLFGRP_test2 = pm.floatFieldGrp(
                                    'uiFLFGRP_test2',
                                    numberOfFields=2,
                                    label='PMFloatFieldGrp2'
                                )
                                self.uiFLFGRP_test3 = pm.floatFieldGrp(
                                    'uiFLFGRP_test3',
                                    numberOfFields=3,
                                    label='PMFloatFieldGrp3'
                                )
                                self.uiFLFGRP_test4 = pm.floatFieldGrp(
                                    'uiFLFGRP_test4',
                                    numberOfFields=4,
                                    label='PMFloatFieldGrp4'
                                )

                        with self.uiCreateFrame('uiLAY_frameFloatScrollBars', 'Float Scroll Bars (PMFloatScrollBar)') as self.uiLAY_frameFloatScrollBars:
                            with pm.columnLayout(adjustableColumn=True):
                                pm.separator(style='none', height=2)
                                self.uiFLSCRL_test1 = pm.floatScrollBar('uiFLSCRL_test1')
                                self.uiFLSCRL_test2 = pm.floatScrollBar('uiFLSCRL_test2')

                        with self.uiCreateFrame('uiLAY_frameFloatSliders', 'Float Sliders (PMFloatSlider)') as self.uiLAY_frameFloatSliders:
                            with pm.columnLayout(adjustableColumn=True):
                                pm.separator(style='none', height=2)
                                self.uiFLTSLD_test1 = pm.floatSlider('uiFLTSLD_test1')
                                self.uiFLTSLD_test2 = pm.floatSlider('uiFLTSLD_test2')

                        with self.uiCreateFrame('uiLAY_frameFloatSliderGroups', 'Float Slider Groups (PMFloatSliderGrp)') as self.uiLAY_frameFloatSliderGroups:
                            with pm.columnLayout():
                                pm.separator(style='none', height=2)
                                self.uiFLSGRP_test1 = pm.floatSliderGrp(
                                    'uiFLSGRP_test1',
                                    label='test1',
                                    field=True
                                )
                                self.uiFLSGRP_test2 = pm.floatSliderGrp(
                                    'uiFLSGRP_test2',
                                    label='test2',
                                    field=True
                                )

                        with self.uiCreateFrame('uiLAY_frameIconTextCheckBoxes', 'Icon Text Check Boxes (PMIconTextCheckBox)') as self.uiLAY_frameIconTextCheckBoxes:
                            with pm.columnLayout():
                                with pm.rowLayout(numberOfColumns=3):
                                    pm.separator(style='none', width=140)
                                    self.uiITCHK_test1 = pm.iconTextCheckBox(
                                        'uiITCHK_test1',
                                        style='iconAndTextHorizontal',
                                        label='cube',
                                        image1='cube'
                                    )
                                    self.uiITCHK_test2 = pm.iconTextCheckBox(
                                        'uiITCHK_test2',
                                        style='iconAndTextHorizontal',
                                        label='cone',
                                        image1='cone'
                                    )

                        with self.uiCreateFrame('uiLAY_frameIconTextRadioButtons', 'Icon Text Radio Buttons (PMIconTextRadioButton)') as self.uiLAY_frameIconTextRadioButtons:
                            with pm.columnLayout():
                                with pm.rowLayout(numberOfColumns=4):
                                    pm.separator(style='none', width=140)
                                    pm.iconTextRadioCollection()
                                    self.uiITRAD_test1 = pm.iconTextRadioButton(
                                        'uiITRAD_test1',
                                        style='iconAndTextHorizontal',
                                        label='cube',
                                        image1='cube'
                                    )
                                    self.uiITRAD_test2 = pm.iconTextRadioButton(
                                        'uiITRAD_test2',
                                        style='iconAndTextHorizontal',
                                        label='cone',
                                        image1='cone'
                                    )
                                    self.uiITRAD_test3 = pm.iconTextRadioButton(
                                        'uiITRAD_test3',
                                        style='iconAndTextHorizontal',
                                        label='torus',
                                        image1='torus'
                                    )

                        with self.uiCreateFrame('uiLAY_frameIconTextScrollLists', 'Icon Text Scroll Lists (PMIconTextScrollList)') as self.uiLAY_frameIconTextScrollLists:
                            with pm.columnLayout():
                                with pm.rowLayout(numberOfColumns=3):
                                    pm.separator(style='none', width=140)
                                    self.uiITSLST_test1 = pm.iconTextScrollList(
                                        'uiITSLST_test1',
                                        allowMultiSelection=True,
                                        append=('one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten')
                                    )
                                    self.uiITSLST_test2 = pm.iconTextScrollList(
                                        'uiITSLST_test2',
                                        allowMultiSelection=True,
                                        append=('one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten')
                                    )

                        with self.uiCreateFrame('uiLAY_frameIntFields', 'Int Fields (PMIntField)') as self.uiLAY_frameIntFields:
                            with pm.columnLayout():
                                pm.separator(style='none', height=2)
                                with pm.rowLayout(numberOfColumns=3):
                                    pm.separator(width=140, style='none')
                                    self.uiINF_test1 = pm.intField('uiINF_test1')
                                    self.uiINF_test2 = pm.intField('uiINF_test2')

                        with self.uiCreateFrame('uiLAY_frameIntFieldGroups', 'Int Field Groups (PMIntFieldGrp#)') as self.uiLAY_frameIntFieldGroups:
                            with pm.columnLayout():
                                pm.separator(style='none', height=2)
                                self.uiINFGRP_test1 = pm.intFieldGrp(
                                    'uiINFGRP_test1',
                                    numberOfFields=1,
                                    label='PMIntFieldGrp1'
                                )
                                self.uiINFGRP_test2 = pm.intFieldGrp(
                                    'uiINFGRP_test2',
                                    numberOfFields=2,
                                    label='PMIntFieldGrp2'
                                )
                                self.uiINFGRP_test3 = pm.intFieldGrp(
                                    'uiINFGRP_test3',
                                    numberOfFields=3,
                                    label='PMIntFieldGrp3'
                                )
                                self.uiINFGRP_test4 = pm.intFieldGrp(
                                    'uiINFGRP_test4',
                                    numberOfFields=4,
                                    label='PMIntFieldGrp4'
                                )

                        with self.uiCreateFrame('uiLAY_frameIntScrollBars', 'Int Scroll Bars (PMIntScrollBar)') as self.uiLAY_frameIntScrollBars:
                            with pm.columnLayout(adjustableColumn=True):
                                pm.separator(style='none', height=2)
                                self.uiINSCRL_test1 = pm.intScrollBar('uiINSCRL_test1')
                                self.uiINSCRL_test2 = pm.intScrollBar('uiINSCRL_test2')

                        with self.uiCreateFrame('uiLAY_frameIntSliders', 'Int Sliders (PMIntSlider)') as self.uiLAY_frameIntSliders:
                            with pm.columnLayout(adjustableColumn=True):
                                pm.separator(style='none', height=2)
                                self.uiINTSLD_test1 = pm.intSlider('uiINTSLD_test1')
                                self.uiINTSLD_test2 = pm.intSlider('uiINTSLD_test2')

                        with self.uiCreateFrame('uiLAY_frameIntSliderGroups', 'Int Slider Groups (PMIntSliderGrp)') as self.uiLAY_frameIntSliderGroups:
                            with pm.columnLayout():
                                pm.separator(style='none', height=2)
                                self.uiINSGRP_test1 = pm.intSliderGrp(
                                    'uiINSGRP_test1',
                                    label='test1',
                                    field=True
                                )
                                self.uiINSGRP_test2 = pm.intSliderGrp(
                                    'uiINSGRP_test2',
                                    label='test2',
                                    field=True
                                )

                        with self.uiCreateFrame('uiLAY_frameOptionMenus', 'Option Menus (PMOptionMenu)') as self.uiLAY_frameOptionMenus:
                            with pm.columnLayout():
                                pm.separator(style='none', height=2)
                                with pm.rowLayout(numberOfColumns=3):
                                    pm.separator(width=110, style='none')
                                    self.uiOPTMNU_test1 = pm.optionMenu('uiOPTMNU_test1', label='test1')
                                    pm.menuItem(label='one')
                                    pm.menuItem(label='two')
                                    pm.menuItem(label='three')
                                    self.uiOPTMNU_test2 = pm.optionMenu('uiOPTMNU_test2', label='test2')
                                    pm.menuItem(label='four')
                                    pm.menuItem(label='five')
                                    pm.menuItem(label='six')

                        with self.uiCreateFrame('uiLAY_frameOptionMenuGroups', 'Option Menus Groups (PMOptionMenuGrp)') as self.uiLAY_frameOptionMenuGroups:
                            with pm.columnLayout():
                                pm.separator(style='none', height=2)
                                self.uiOPMGRP_test1 = pm.optionMenuGrp('uiOPMGRP_test1', label='test1', extraLabel='extraLabel')
                                pm.menuItem(label='one')
                                pm.menuItem(label='two')
                                pm.menuItem(label='three')
                                self.uiOPMGRP_test2 = pm.optionMenuGrp('uiOPMGRP_test2', label='test2', extraLabel='extraLabel')
                                pm.menuItem(label='four')
                                pm.menuItem(label='five')
                                pm.menuItem(label='six')

                        with self.uiCreateFrame('uiLAY_frameRadioButtons', 'Radio Buttons (PMRadioButton)') as self.uiLAY_frameRadioButtons:
                            with pm.columnLayout():
                                with pm.rowLayout(numberOfColumns=4):
                                    pm.separator(style='none', width=140)
                                    pm.radioCollection()
                                    self.uiRAD_test1 = pm.radioButton('uiRAD_test1', label='test1')
                                    self.uiRAD_test2 = pm.radioButton('uiRAD_test2', label='test2')
                                    self.uiRAD_test3 = pm.radioButton('uiRAD_test3', label='test3')

                        with self.uiCreateFrame('uiLAY_frameRadioButtonGroups', 'Radio Button Groups (PMRadioButtonGrp#)') as self.uiLAY_frameRadioButtonGroups:
                            with pm.columnLayout():
                                pm.separator(style='none', height=2)
                                self.uiRADGRP_test1 = pm.radioButtonGrp(
                                    'uiRADGRP_test1',
                                    numberOfRadioButtons=1,
                                    label='PMRadioButtonGrp1',
                                    label1='test1'
                                )
                                self.uiRADGRP_test2 = pm.radioButtonGrp(
                                    'uiRADGRP_test2',
                                    numberOfRadioButtons=2,
                                    label='PMRadioButtonGrp2',
                                    labelArray2=('test1', 'test2')
                                )
                                self.uiRADGRP_test3 = pm.radioButtonGrp(
                                    'uiRADGRP_test3',
                                    numberOfRadioButtons=3,
                                    label='PMRadioButtonGrp3',
                                    labelArray3=('test1', 'test2', 'test3')
                                )
                                self.uiRADGRP_test4 = pm.radioButtonGrp(
                                    'uiRADGRP_test4',
                                    numberOfRadioButtons=4,
                                    label='PMRadioButtonGrp4',
                                    labelArray4=('test1', 'test2', 'test3', 'test4')
                                )

                        with self.uiCreateFrame('uiLAY_frameSymbolCheckBoxes', 'Symbol Check Boxes (PMSymbolCheckBox)') as self.uiLAY_frameSymbolCheckBoxes:
                            with pm.columnLayout():
                                with pm.rowLayout(numberOfColumns=3):
                                    pm.separator(style='none', width=140)
                                    self.uiSYMCHK_test1 = pm.symbolCheckBox(
                                        'uiSYMCHK_test1',
                                        image='polyCube'
                                    )
                                    self.uiSYMCHK_test2 = pm.symbolCheckBox(
                                        'uiSYMCHK_test2',
                                        image='polyCone'
                                    )

                        with self.uiCreateFrame('uiLAY_frameScriptTables', 'Script Tables (PMScriptTable)') as self.uiLAY_frameScriptTables:
                            with pm.columnLayout():
                                with pm.rowLayout(numberOfColumns=3):
                                    pm.separator(style='none', width=140)
                                    self.uiSCRTBL_test1 = pm.scriptTable(
                                        'uiSCRTBL_test1',
                                        selectionMode=3,
                                        rows=4,
                                        columns=2
                                    )
                                    self.uiSCRTBL_test2 = pm.scriptTable(
                                        'uiSCRTBL_test2',
                                        selectionMode=3,
                                        rows=4,
                                        columns=2
                                    )

                        with self.uiCreateFrame('uiLAY_frameScrollField', 'Scroll Field (PMScrollField)') as self.uiLAY_frameScrollField:
                            with pm.columnLayout():
                                with pm.rowLayout(numberOfColumns=3):
                                    pm.separator(style='none', width=140)
                                    self.uiSCRFLD_test1 = pm.scrollField(
                                        'uiSCRFLD_test1',
                                        wordWrap=True
                                    )
                                    self.uiSCRFLD_test2 = pm.scrollField(
                                        'uiSCRFLD_test2',
                                        wordWrap=True
                                    )

                        with self.uiCreateFrame('uiLAY_frameShelfTabLayout', 'Shelf Tab Layout (PMShelfTabLayout)') as self.uiLAY_frameShelfTabLayout:
                            with pm.columnLayout(adjustableColumn=True):
                                with pm.shelfTabLayout('uiSHLTAB_test1') as self.uiSHLTAB_test1:
                                    with pm.shelfLayout('test1'):
                                        pass
                                    with pm.shelfLayout('test2'):
                                        pass
                                    with pm.shelfLayout('test3'):
                                        pass
                                with pm.shelfTabLayout('uiSHLTAB_test2') as self.uiSHLTAB_test2:
                                    with pm.shelfLayout('test4'):
                                        pass
                                    with pm.shelfLayout('test5'):
                                        pass
                                    with pm.shelfLayout('test6'):
                                        pass

                        with self.uiCreateFrame('uiLAY_frameTabLayout', 'Tab Layout (PMTabLayout)') as self.uiLAY_frameTabLayout:
                            with pm.columnLayout(adjustableColumn=True):
                                with pm.tabLayout('uiTAB_test1') as self.uiTAB_test1:

                                    with pm.rowLayout(numberOfColumns=1) as uiLAY_tabRow1:
                                        pass
                                    with pm.rowLayout(numberOfColumns=1) as uiLAY_tabRow2:
                                        pass
                                    with pm.rowLayout(numberOfColumns=1) as uiLAY_tabRow3:
                                        pass

                                pm.tabLayout(
                                    self.uiTAB_test1,
                                    edit=True,
                                    tabLabel=((uiLAY_tabRow1, 'test1'), (uiLAY_tabRow2, 'test2'), (uiLAY_tabRow3, 'test3'),)
                                )

                                with pm.tabLayout('uiTAB_test2') as self.uiTAB_test2:

                                    with pm.rowLayout(numberOfColumns=1) as uiLAY_tabRow4:
                                        pass
                                    with pm.rowLayout(numberOfColumns=1) as uiLAY_tabRow5:
                                        pass
                                    with pm.rowLayout(numberOfColumns=1) as uiLAY_tabRow6:
                                        pass

                                pm.tabLayout(
                                    self.uiTAB_test2,
                                    edit=True,
                                    tabLabel=((uiLAY_tabRow4, 'test4'), (uiLAY_tabRow5, 'test5'), (uiLAY_tabRow6, 'test6'),)
                                )

                        with self.uiCreateFrame('uiLAY_frameTextFields', 'Text Fields (PMTextField)') as self.uiLAY_frameTextFields:
                            with pm.columnLayout():
                                pm.separator(style='none', height=2)
                                with pm.rowLayout(numberOfColumns=3):
                                    pm.separator(width=140, style='none')
                                    self.uiTXT_test1 = pm.textField('uiTXT_test1')
                                    self.uiTXT_test2 = pm.textField('uiTXT_test2')

                        with self.uiCreateFrame('uiLAY_frameTextFieldButtonGroups', 'Text Field Button Groups (PMTextFieldButtonGrp)') as self.uiLAY_frameTextFieldButtonGroups:
                            with pm.columnLayout():
                                pm.separator(style='none', height=2)
                                self.uiTXBTGR_test1 = pm.textFieldButtonGrp(
                                    'uiTXBTGR_test1',
                                    label='test1',
                                    buttonLabel='button1'
                                )
                                self.uiTXBTGR_test2 = pm.textFieldButtonGrp(
                                    'uiTXBTGR_test2',
                                    label='test2',
                                    buttonLabel='button2'
                                )

                        with self.uiCreateFrame('uiLAY_frameTextFieldGroups', 'Text Field Groups (PMTextFieldGrp)') as self.uiLAY_frameTextFieldGroups:
                            with pm.columnLayout():
                                pm.separator(style='none', height=2)
                                self.uiTXTGRP_test1 = pm.textFieldGrp(
                                    'uiTXTGRP_test1',
                                    label='test1'
                                )
                                self.uiTXTGRP_test2 = pm.textFieldGrp(
                                    'uiTXTGRP_test2',
                                    label='test2'
                                )

                        with self.uiCreateFrame('uiLAY_frameTextScrollLists', 'Text Scroll Lists (PMTextScrollList)') as self.uiLAY_frameTextScrollLists:
                            with pm.columnLayout():
                                with pm.rowLayout(numberOfColumns=3):
                                    pm.separator(style='none', width=140)
                                    self.uiTXTLST_test1 = pm.textScrollList(
                                        'uiTXTLST_test1',
                                        allowMultiSelection=True,
                                        append=('one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten')
                                    )
                                    self.uiTXTLST_test2 = pm.textScrollList(
                                        'uiTXTLST_test2',
                                        allowMultiSelection=True,
                                        append=('one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten')
                                    )

                self.uiBTN_savePrefs = pm.button(
                    label='Save Prefs',
                    height=MAIN_BUTTONS_HEIGHT,
                    command=self.onSavePrefsClicked
                )

                self.uiBTN_loadPrefs = pm.button(
                    label='Load Prefs',
                    height=MAIN_BUTTONS_HEIGHT,
                    command=self.onLoadPrefsClicked
                )

                self.uiBTN_resetPrefs = pm.button(
                    label='Reset Prefs',
                    height=MAIN_BUTTONS_HEIGHT,
                    command=self.onResetPrefsClicked
                )

                uiLAY_mainForm.attachForm(self.uiLAY_mainScroll, 'top', 2)
                uiLAY_mainForm.attachForm(self.uiLAY_mainScroll, 'left', 2)
                uiLAY_mainForm.attachForm(self.uiLAY_mainScroll, 'right', 2)
                uiLAY_mainForm.attachControl(self.uiLAY_mainScroll, 'bottom', 2, self.uiBTN_savePrefs)

                uiLAY_mainForm.attachNone(self.uiBTN_savePrefs, 'top')
                uiLAY_mainForm.attachForm(self.uiBTN_savePrefs, 'left', 2)
                uiLAY_mainForm.attachPosition(self.uiBTN_savePrefs, 'right', 2, 33)
                uiLAY_mainForm.attachForm(self.uiBTN_savePrefs, 'bottom', 2)

                uiLAY_mainForm.attachNone(self.uiBTN_loadPrefs, 'top')
                uiLAY_mainForm.attachPosition(self.uiBTN_loadPrefs, 'left', 2, 33)
                uiLAY_mainForm.attachPosition(self.uiBTN_loadPrefs, 'right', 2, 66)
                uiLAY_mainForm.attachForm(self.uiBTN_loadPrefs, 'bottom', 2)

                uiLAY_mainForm.attachNone(self.uiBTN_resetPrefs, 'top')
                uiLAY_mainForm.attachPosition(self.uiBTN_resetPrefs, 'left', 2, 66)
                uiLAY_mainForm.attachForm(self.uiBTN_resetPrefs, 'right', 2)
                uiLAY_mainForm.attachForm(self.uiBTN_resetPrefs, 'bottom', 2)

        self.window.setTitle(self.window.__class__)
示例#51
0
    def OpenMayaCommonGlobalsCreateTab(self):
        scLo = "scrollLayout"
        parentForm = pm.setParent(query=True)
        pm.setUITemplate("attributeEditorTemplate", pushTemplate=True)
        if self.rendererTabUiDict.has_key("common"):
            self.rendererTabUiDict.pop("common")
        uiDict = {}
        self.rendererTabUiDict["common"] = uiDict
        clo = "clo"

        with pm.frameLayout(clo, labelVisible=False, collapsable=False, mw=8, mh=5, borderVisible=False):
            with pm.columnLayout(adj=True):
                uiDict["imgpath"] = pm.text(label="Path:", align="left", font="smallBoldLabelFont")
                uiDict["imgname"] = pm.text(label="File Name:", align="left", font="smallBoldLabelFont")
                uiDict["imgsize"] = pm.text(label="Image Size:", align="left", font="smallBoldLabelFont")

        with pm.scrollLayout(scLo, horizontalScrollBarThickness=0) as sl:
            with pm.columnLayout("commonTabColumn", adjustableColumn=True, width=400) as ctc:
                with pm.frameLayout(label="File Output", collapsable=True, collapse=False):
                    with pm.columnLayout(adjustableColumn=True, width=400):
                        uiDict["fileNamePrefixField"] = pm.textFieldGrp(
                            label="File Name Prefix:", cc=self.updateFileNamePrefix
                        )
                        pm.connectControl(
                            uiDict["fileNamePrefixField"], pm.SCENE.defaultRenderGlobals.imageFilePrefix, index=2
                        )
                        pm.attrEnumOptionMenuGrp(
                            "imageMenuMayaSW", label="Image Format:", attribute=self.renderNode.imageFormat
                        )
                        formats = self.renderNode.imageFormat.getEnums().keys()
                        if "EXR" in formats:
                            with pm.columnLayout("exrOptionsLayout", adjustableColumn=True, width=400) as uiDict[
                                "exrOptionsLayout"
                            ]:
                                self.addRenderGlobalsUIElement(
                                    attName="exrDataTypeHalf",
                                    uiType="bool",
                                    displayName="Half Float",
                                    default="false",
                                    uiDict={},
                                )
                                self.addRenderGlobalsUIElement(
                                    attName="exrMergeChannels",
                                    uiType="bool",
                                    displayName="Merge passes",
                                    default="true",
                                    uiDict={},
                                )

                        uiDict["imageNumbering"] = pm.optionMenuGrp(
                            label="Frame/Animation ext:", changeCommand=self.setFrameNumbering
                        )
                        for value in ["name.ext", "name.#.ext"]:
                            pm.menuItem(value)
                        if self.defaultGlobals.animation.get():
                            uiDict["imageNumbering"].setSelect(2)

                        self.addRenderDefaultGlobalsUIElement(
                            attName="extensionPadding", uiType="int", displayName="Frame Padding:", uiDict=uiDict
                        )

                with pm.frameLayout(label="Frame Range", collapsable=True, collapse=False) as frameRangeLayout:
                    uiDict["frameRangeLayout"] = frameRangeLayout
                    with pm.columnLayout(adjustableColumn=True, width=400):
                        self.addRenderDefaultGlobalsUIElement(
                            attName="startFrame", uiType="float", displayName="Start Frame:", uiDict=uiDict
                        )
                        self.addRenderDefaultGlobalsUIElement(
                            attName="endFrame", uiType="float", displayName="End Frame:", uiDict=uiDict
                        )
                        self.addRenderDefaultGlobalsUIElement(
                            attName="byFrameStep", uiType="float", displayName="By Frame:", uiDict=uiDict
                        )

                with pm.frameLayout(label="Renderable Cameras", collapsable=True, collapse=False) as uiDict[
                    "camerasFrame"
                ]:
                    self.createCamerasUI(uiDict)

                with pm.frameLayout(label="Image Size", collapsable=True, collapse=False):
                    with pm.columnLayout(adjustableColumn=True, width=400):
                        uiDict["imageSizePresets"] = pm.optionMenuGrp(label="Presets:", changeCommand=self.setImageSize)
                        for imgFormat in self.imageFormatData:
                            pm.menuItem(imgFormat[0])

                        self.addRenderDefaultResGlobalsUIElement(
                            attName="aspectLock", uiType="bool", displayName="Maintain aspect ratio", uiDict=uiDict
                        )
                        self.addRenderDefaultResGlobalsUIElement(
                            attName="width",
                            uiType="int",
                            displayName="Width:",
                            uiDict=uiDict,
                            callback=pm.Callback(self.updateImageSize, "width"),
                        )
                        self.addRenderDefaultResGlobalsUIElement(
                            attName="height",
                            uiType="int",
                            displayName="Height:",
                            uiDict=uiDict,
                            callback=pm.Callback(self.updateImageSize, "height"),
                        )
                        self.addRenderDefaultResGlobalsUIElement(
                            attName="deviceAspectRatio",
                            uiType="float",
                            displayName="Device Aspect:",
                            uiDict=uiDict,
                            callback=pm.Callback(self.updateImageSize, "devAsp"),
                        )

                with pm.frameLayout(label="Render Scripts", collapsable=True, collapse=False):
                    with pm.columnLayout(adjustableColumn=True, width=400):
                        self.addRenderDefaultGlobalsUIElement(
                            attName="preMel", uiType="string", displayName="Pre Render Mel:", uiDict=uiDict
                        )
                        self.addRenderDefaultGlobalsUIElement(
                            attName="postMel", uiType="string", displayName="Post Render Mel:", uiDict=uiDict
                        )
                        self.addRenderDefaultGlobalsUIElement(
                            attName="preRenderLayerMel", uiType="string", displayName="Pre Layer Mel:", uiDict=uiDict
                        )
                        self.addRenderDefaultGlobalsUIElement(
                            attName="postRenderLayerMel", uiType="string", displayName="Post Layer Mel:", uiDict=uiDict
                        )
                        self.addRenderDefaultGlobalsUIElement(
                            attName="preRenderMel", uiType="string", displayName="Pre Frame Mel:", uiDict=uiDict
                        )
                        self.addRenderDefaultGlobalsUIElement(
                            attName="postRenderMel", uiType="string", displayName="Post Frame Mel:", uiDict=uiDict
                        )

        pm.setUITemplate("attributeEditorTemplate", popTemplate=True)
        pm.formLayout(
            parentForm,
            edit=True,
            attachForm=[
                (clo, "right", 0),
                (clo, "left", 0),
                (clo, "top", 0),
                (scLo, "bottom", 0),
                (scLo, "left", 0),
                (scLo, "right", 0),
            ],
            attachControl=[(scLo, "top", 0, clo)],
        )
        self.OpenMayaCommonGlobalsUpdateTab()
        self.updateExrUI()
        self.updateImageSize(["width"])
        self.updateFileNamePrefix()
        pm.scriptJob(attributeChange=(self.renderNode.imageFormat, self.updateExrUI), parent=parentForm)
        defrw = pm.SCENE.defaultResolution.width
        defrh = pm.SCENE.defaultResolution.height
        defrd = pm.SCENE.defaultResolution.deviceAspectRatio
        pm.scriptJob(attributeChange=(defrw, pm.Callback(self.updateImageSize, ["width"])), runOnce=True)
        pm.scriptJob(attributeChange=(defrh, pm.Callback(self.updateImageSize, ["height"])), runOnce=True)
        pm.scriptJob(attributeChange=(defrd, pm.Callback(self.updateImageSize, ["devAsp"])), runOnce=True)
        pm.scriptJob(event=("SelectionChanged", self.selectionChangedEvent))
    def ui(self):
        marge = 2
        self.win = None
        if pmc.window(self.__class__.__name__, q=True, exists=True):
            pmc.deleteUI(self.__class__.__name__)
        
        with pmc.window(self.__class__.__name__, title=self.ui_name, menuBar=True) as self.win:
            #===================================================================
            # Menus
            #===================================================================
            pmc.menu(label="File", tearOff=False)
            pmc.menuItem(label="Open", c=self.select_py_ui)
            pmc.menuItem(label="Refresh", c=self.read_py)
            
            self.recents_menu_ui = pmc.menuItem(subMenu=True, label="Recents")
            pmc.setParent("..", menu=True)
            
            pmc.setParent("..", menu=True)
            
            pmc.menu(label="Options", tearOff=False)
            pmc.menuItem(label="Insert ScriptEditor", c=self.insert_script_editor_ui)
            self.reset_menu_ui = pmc.menuItem(label="Run Reset History",
                                              checkBox=self.reset,
                                              c=self.set_reset_his_ui)
            if self.maya_version >= 2011:
                self.dock_ui_item = pmc.menuItem(label="In Dock",
                                                 checkBox=self.dock[0],
                                                 c=self.set_in_dock_ui)
            pmc.menuItem(divider=True)
            pmc.menuItem(subMenu=True, label="Recents")
            self.max_recents_ui = pmc.menuItem(l="Set length (%s)" % self.max_recents, c=self.set_recents_ui)
            pmc.menuItem(l="Reset", c=self.reset_recents_ui)
            pmc.setParent("..", menu=True)
            
            pmc.menuItem(subMenu=True, label="Settings")
            pmc.menuItem(l="Reset", c=self.reset_options_ui)
            pmc.menuItem(l="Save", c=self.save_options)
            pmc.setParent("..", menu=True)
            
            pmc.menu(label='Help', helpMenu=True)
            pmc.menuItem(label='About', c=self.help_ui)
            
            #===================================================================
            # Layout and Contents
            #===================================================================
            main_form = pmc.formLayout(nd=100)
            self.run_but = pmc.button(l="Run", c=self.run_cmd_ui)
            
            self.main_layout = pmc.paneLayout(configuration="top3")
            
            form = pmc.formLayout(nd=100)
            self.cmd_ui = pmc.scrollField(ed=1, ww=0)
            pmc.setParent("..")
            
            form_infos = pmc.formLayout(nd=100)
            self.infos_ui = pmc.textScrollList(ams=0, fn="fixedWidthFont",
                                               sc=self.doc_cmd_ui,
                                               dcc=self.insert_cmd_ui)
            
            infos_layout = pmc.frameLayout(label="Filter / Sort / Doc", collapse=True, collapsable=True)
            pmc.columnLayout(adj=1)
            pmc.rowLayout(numberOfColumns=2, adj=1)
            self.filter_ui = pmc.textFieldGrp(label="Filter",
                                              text="",
                                              cw=[1, 40], adj=2,
                                              fcc=True,
                                              cc=self.order_by_ui)
            
            self.filter_test_ui = pmc.optionMenuGrp(cc=self.set_filter_test_ui)
            pmc.menuItem(label="in")
            pmc.menuItem(label="startswith")
            pmc.menuItem(label="endswith")
            
            pmc.setParent("..")
            
            self.order_ui = pmc.checkBoxGrp(numberOfCheckBoxes=2,
                                            label="Sort",
                                            label1="Alphabetical",
                                            label2="Show doc",
                                            cw=[1, 40],
                                            cc1=self.order_by_ui,
                                            cc2=self.set_show_doc_ui,
                                            )
            
            pmc.setParent("..")
            pmc.setParent("..")
            pmc.setParent("..")
            
            self.form_scriptEditor = pmc.formLayout(nd=100)
#            self.form_scriptEditor = pmc.paneLayout(configuration="single")
            pmc.setParent("..")
            
            pmc.setParent("..")
            
            #===================================================================
            # Layout settings
            #===================================================================
            pmc.formLayout(main_form, edit=True,
                             attachNone=[
                                         (self.run_but, "bottom")
                                         ],
                             attachForm=[
                                         (self.run_but, "top", marge),
                                         (self.run_but, "left", marge),
                                         (self.run_but, "right", marge),
                                         (self.main_layout, "top", marge),
                                         (self.main_layout, "left", marge),
                                         (self.main_layout, "right", marge),
                                         (self.main_layout, "bottom", marge),
                                         ],
                             attachControl=[
                                            (self.main_layout, "top", marge, self.run_but),
                                            ]
                            )
            pmc.formLayout(form, edit=True,
                             attachForm=[
                                         (self.cmd_ui, "top", marge),
                                         (self.cmd_ui, "left", marge),
                                         (self.cmd_ui, "right", marge),
                                         (self.cmd_ui, "bottom", marge),
                                         ],
                             )
            
            pmc.formLayout(form_infos, edit=True,
                             attachForm=[
                                         (self.infos_ui, "top", marge),
                                         (self.infos_ui, "left", marge),
                                         (self.infos_ui, "right", marge),
                                         (infos_layout, "left", marge),
                                         (infos_layout, "right", marge),
                                         (infos_layout, "bottom", marge),
                                         ],
                            attachControl=[
                                           (self.infos_ui, "bottom", marge, infos_layout)
                                           ]
                             )
        
        self.insert_script_editor_ui()
        
        self.dock_it()
 def set_filter_test_ui(self, *args):
     self.filter_test = pmc.optionMenuGrp(self.filter_test_ui, q=True, v=True)
     self.save_options()
     self.update_ui()
示例#54
0
	def ctrlForThis( self,  createZeroGroup=False , size=1.0, shape='sphere', *args ):

		self.ctrls = [] # ctrls names for return

		objsToPutCtrlOn =  pm.ls ( sl = True )
		
		
		try:# if in UI mode, get info from UI
			shape =  pm.optionMenuGrp( self.shapeType, q=True,  value= True  )
			size = pm.floatSliderGrp( self.sizeSlider, q=True,  value= True  )
		except:
			pass	
		
		
		shapeCmd = { 'sphere': SphereCrv
					,'cube'  : CubeCrv
					,'circle': Circle8Crv
					}
		
		# for every selected object create ctrl curve

		for i in range (len(objsToPutCtrlOn)):
		
	
			objToPutCtrlOn = objsToPutCtrlOn[i]
			
			ctrl = shapeCmd[shape]( size=size,  name = "%s_ctrl" %objToPutCtrlOn.name()  )
			
			'''
			# create circle, find the proper name for the contorl curve and name the circle
			if str(objToPutCtrlOn)[-3:] == "jnt":
				pm.rename( ctrl , objToPutCtrlOn.name().replace("jnt", "ctrl") )
			else:
				pm.rename( ctrl , objToPutCtrlOn.name() + "_ctrl" )
			'''

			# parent curve to corisponding joint
			pm.parent( ctrl, objToPutCtrlOn )

			#reset tranform values on circles
			pm.xform (ctrl , t = (0,0,0) , ro= (0,0,0))

			firstParent = pm.listRelatives ( objToPutCtrlOn , fullPath = True , parent = True )

			# parent ctrls to their firstgrandparent
			if firstParent  :
				pm.parent ( ctrl , firstParent[0] )
			else :
				pm.parent ( ctrl , world = True  )


			pm.parentConstraint ( ctrl, objToPutCtrlOn )

			self.ctrls.append ( ctrl )
			



		# create zero groups if needed - add zero groups as well to return value
		if createZeroGroup == True:
			pm.select (self.ctrls)
			self.ctrls.extend (  ZeroGrp()  )
示例#55
0
    def OpenMayaCommonGlobalsCreateTab(self):        
        log.debug("OpenMayaCommonGlobalsCreateTab()")
        scLo = "scrollLayout"
        parentForm = pm.setParent(query=True)        
        pm.setUITemplate("attributeEditorTemplate", pushTemplate=True)
        if self.rendererTabUiDict.has_key('common'):
            self.rendererTabUiDict.pop('common')        
        uiDict = {}
        self.rendererTabUiDict['common'] = uiDict
        clo = "clo"
        
        with pm.frameLayout(clo, labelVisible=False, collapsable=False, mw=8, mh=5, borderVisible=False):
            with pm.columnLayout(adj=True):                        
                uiDict['imgpath'] = pm.text(label="Path:", align="left", font="smallBoldLabelFont")
                uiDict['imgname'] = pm.text(label="File Name:", align="left", font="smallBoldLabelFont")
                uiDict['imgsize'] = pm.text(label="Image Size:", align="left", font="smallBoldLabelFont")
        
        with pm.scrollLayout(scLo, horizontalScrollBarThickness=0) as sl:
            print "Scroll layout", sl
            with pm.columnLayout("commonTabColumn", adjustableColumn=True, width=400) as ctc:
                print "common", ctc
                with pm.frameLayout(label="File Output", collapsable=True, collapse=False):
                    with pm.columnLayout(adjustableColumn=True, width=400):
                        pm.textFieldGrp(label="File Name Prefix:")
                        
                        pm.attrEnumOptionMenuGrp("imageMenuMayaSW", label="Image Format:", attribute=self.renderNode.imageFormat)                            
                        
                        uiDict['imageNumbering'] = pm.optionMenuGrp(label="Frame/Animation ext:", changeCommand=self.setFrameNumbering)
                        for value in ["name.ext", "name.#.ext"]:
                            pm.menuItem(value)
                        if self.defaultGlobals.animation.get():
                            uiDict['imageNumbering'].setSelect(2)
                        
                        self.addRenderDefaultGlobalsUIElement(attName='extensionPadding', uiType='int', displayName='Frame Padding:', uiDict=uiDict)
                        
                with pm.frameLayout(label="Frame Range", collapsable=True, collapse=False) as frameRangeLayout:
                    uiDict['frameRangeLayout'] = frameRangeLayout
                    with pm.columnLayout(adjustableColumn=True, width=400):
                        self.addRenderDefaultGlobalsUIElement(attName='startFrame', uiType='float', displayName='Start Frame:', uiDict=uiDict)
                        self.addRenderDefaultGlobalsUIElement(attName='endFrame', uiType='float', displayName='End Frame:', uiDict=uiDict)
                        self.addRenderDefaultGlobalsUIElement(attName='byFrame', uiType='float', displayName='By Frame:', uiDict=uiDict)

                with pm.frameLayout(label="Renderable Cameras",collapsable=True, collapse=False):
                    with pm.columnLayout(adjustableColumn=True, width=400):
                        for cam in pm.ls(type="camera"):
                            pm.checkBoxGrp(label=cam.name(), value1=cam.renderable.get(), cc=pm.Callback(self.switchCamRenderable, cam))

                with pm.frameLayout(label="Image Size",collapsable=True, collapse=False):
                    with pm.columnLayout(adjustableColumn=True, width=400):
                        uiDict['imageSizePresets'] = pm.optionMenuGrp(label="Presets:", changeCommand=self.setImageSize)
                        for imgFormat in self.imageFormatData:
                            pm.menuItem(imgFormat[0])
                        uiDict['imageSizePresets'].setSelect(12) 

                        self.addRenderDefaultResGlobalsUIElement(attName='aspectLock', uiType='bool', displayName='Maintain aspect ratio', uiDict=uiDict)
                        self.addRenderDefaultResGlobalsUIElement(attName='width', uiType='int', displayName='Width:', uiDict=uiDict, callback=pm.Callback(self.updateImageSize, "width"))
                        self.addRenderDefaultResGlobalsUIElement(attName='height', uiType='int', displayName='Height:', uiDict=uiDict, callback=pm.Callback(self.updateImageSize, "height"))
                        self.addRenderDefaultResGlobalsUIElement(attName='deviceAspectRatio', uiType='float', displayName='Device Aspect:', uiDict=uiDict, callback=pm.Callback(self.updateImageSize, "devAsp"))
                        #self.addRenderDefaultResGlobalsUIElement(attName='pixelAspect', uiType='float', displayName='Pixel Aspect:', uiDict=uiDict, callback=self.updateImageSize)
                        
                with pm.frameLayout(label="Render Scripts",collapsable=True, collapse=False):
                    with pm.columnLayout(adjustableColumn=True, width=400):
                        self.addRenderDefaultGlobalsUIElement(attName='preMel', uiType='string', displayName='Pre Render Mel:', uiDict=uiDict)
                        self.addRenderDefaultGlobalsUIElement(attName='postMel', uiType='string', displayName='Post Render Mel:', uiDict=uiDict)
                        self.addRenderDefaultGlobalsUIElement(attName='preRenderLayerMel', uiType='string', displayName='Pre Layer Mel:', uiDict=uiDict)
                        self.addRenderDefaultGlobalsUIElement(attName='postRenderLayerMel', uiType='string', displayName='Post Layer Mel:', uiDict=uiDict)
                        self.addRenderDefaultGlobalsUIElement(attName='preRenderMel', uiType='string', displayName='Pre Frame Mel:', uiDict=uiDict)
                        self.addRenderDefaultGlobalsUIElement(attName='postRenderMel', uiType='string', displayName='Post Frame Mel:', uiDict=uiDict)

        pm.setUITemplate("attributeEditorTemplate", popTemplate=True)
        pm.formLayout(parentForm, edit=True, attachForm=[  (clo, "right", 0), (clo, "left", 0), (clo, "top", 0), (scLo, "bottom", 0), (scLo, "left", 0), (scLo, "right", 0) ], attachControl = [(scLo, "top", 0, clo)])
        self.setImageSize("HD_540") # set default
        self.OpenMayaCommonGlobalsUpdateTab()
示例#56
0
    def ui(self):
        '''
        main ui creator
        '''
        #TODO: only run once. use singleton instance
        
        if pm.window(self.name, q = True, ex = True):
            pm.deleteUI(self.name)
            
        #main window
        self.widgets['mainWindow'] = pm.window(self.name, title = self.name, widthHeight = (720, 400))
        self.widgets['mainForm']   = pm.formLayout(parent = self.widgets['mainWindow'])
        
        #top left column
        self.widgets['topLColumn'] = pm.columnLayout(adjustableColumn = True, parent = self.widgets['mainForm'], h = 168)
        self.widgets['cameraText'] = pm.text(label = "Cameras", h = 20)
        self.widgets['cameraList'] = pm.iconTextScrollList(h = 105, allowMultiSelection = True, selectCommand = pm.Callback(self.updateLayers))
        self.widgets['nameSep']    = pm.separator(horizontal = True, style = 'none', h = 13)
        self.widgets['sceneName']  = pm.textFieldGrp(label = 'Scene Name', text = self.scene.namebase, adjustableColumn = 2, columnWidth2 = [80, 0])
        
        #top right column
        self.widgets['topRColumn'] = pm.columnLayout(parent = self.widgets['mainForm'], h = 168, adjustableColumn = True, rowSpacing = 1)
        self.widgets['outputDir']  = pm.textFieldButtonGrp(label = 'Output Path', tx = self.output, adjustableColumn = 2, columnWidth = [1, 80], buttonLabel = 'Browse...', bc = pm.Callback(self.changeOutputDestination))
        self.widgets['project']    = pm.textFieldGrp(label = 'Project', adjustableColumn = 2, columnWidth = [1, 80], text = self.fileInfo.getProject())
        self.widgets['department'] = pm.textFieldGrp(label = 'Department', adjustableColumn = 2, columnWidth = [1, 80], text = MusterSubmit.defaults['department'])
        self.widgets['pool']       = pm.optionMenuGrp(label = 'Pool', adjustableColumn = 2, columnWidth = [1, 80], cc = pm.Callback(self.savePoolOpt))
        self.widgets['renderer']   = pm.optionMenuGrp(label = 'Renderer', adjustableColumn = 2, columnWidth = [1, 80], cc = pm.Callback(self.saveRendererOpt))
        self.widgets['user']       = pm.optionMenuGrp(label = 'User', adjustableColumn = 2, columnWidth = [1, 80], cc = pm.Callback(self.saveUserOpt))
        self.widgets['memPri']     = pm.rowLayout(parent = self.widgets['topRColumn'], numberOfColumns = 2, adjustableColumn2 = 1)
        self.widgets['memory']     = pm.intSliderGrp(parent = self.widgets['memPri'], label = 'Memory', columnWidth = [1,80], field = True, step = 512, value = 16384, maxValue = 65536, minValue = 512, w = 200)
        self.widgets['priority']   = pm.intFieldGrp(parent = self.widgets['memPri'], label = 'Priority', columnWidth = [1,50], value1 = self.priority)
        
        #top middle row
        self.widgets['topMRow']    = pm.rowLayout(parent = self.widgets['mainForm'], numberOfColumns = 6, adjustableColumn6 = 3)
        self.widgets['sep']        = pm.separator(style = "none", w = 15)
        self.widgets['allLayers']  = pm.checkBox(label = 'All Layers', w = 110, value = True, cc = pm.Callback(self.setAllRenderable))
        self.widgets['postCopy']   = pm.checkBox(label = 'Post Copy', w = 100, value = True)
        self.widgets['byFrame']    = pm.intFieldGrp(label = 'By Frame', columnWidth = [1, 50], value1 = int(pm.SCENE.defaultRenderGlobals.byFrame.get()))
        self.widgets['padding']    = pm.intFieldGrp(label = 'Padding', columnWidth = [1, 50], value1 = int(pm.SCENE.defaultRenderGlobals.extensionPadding.get()))
        self.widgets['packet']     = pm.intFieldGrp(label = 'Packet', columnWidth = [1, 50], value1 = int(MusterSubmit.defaults['packet']))
        
        #main layout
        self.widgets['scrollLayout'] = pm.scrollLayout(parent = self.widgets['mainForm'], childResizable = True)
                
        #bottom row
        self.widgets['bottomRow'] = pm.rowLayout(numberOfColumns = 3, parent = self.widgets['mainForm'], adjustableColumn = 1)
        self.widgets['progress']  = pm.progressBar(w = 300, progress = -1)
        self.widgets['paused']    = pm.checkBox(label = 'Paused', w = 60)
        self.widgets['Submit']    = pm.button(label = 'Submit', w = 150, c = pm.Callback(self.submit))
        
        #form Layout
        self.widgets['mainForm'].attachForm(self.widgets['topLColumn'], 'top', 0)
        self.widgets['mainForm'].attachForm(self.widgets['topLColumn'], 'left', 0)
        self.widgets['mainForm'].attachNone(self.widgets['topLColumn'], 'bottom')
        self.widgets['mainForm'].attachPosition(self.widgets['topLColumn'], 'right', 0, 40)
        
        self.widgets['mainForm'].attachForm(self.widgets['topRColumn'], 'top', 0)
        self.widgets['mainForm'].attachControl(self.widgets['topRColumn'], 'left', 0, self.widgets['topLColumn'])
        self.widgets['mainForm'].attachNone(self.widgets['topRColumn'], 'bottom')
        self.widgets['mainForm'].attachForm(self.widgets['topRColumn'], 'right', 0)
        
        self.widgets['mainForm'].attachControl(self.widgets['topMRow'], 'top', 0, self.widgets['topRColumn'])
        self.widgets['mainForm'].attachForm(self.widgets['topMRow'], 'left', 0)
        self.widgets['mainForm'].attachNone(self.widgets['topMRow'], 'bottom')
        self.widgets['mainForm'].attachForm(self.widgets['topMRow'], 'right', 0)
        
        self.widgets['mainForm'].attachControl(self.widgets['scrollLayout'], 'top', 0, self.widgets['topMRow'])
        self.widgets['mainForm'].attachForm(self.widgets['scrollLayout'], 'left', 0)
        self.widgets['mainForm'].attachControl(self.widgets['scrollLayout'], 'bottom', 0, self.widgets['bottomRow'])
        self.widgets['mainForm'].attachForm(self.widgets['scrollLayout'], 'right', 0)
        
        self.widgets['mainForm'].attachNone(self.widgets['bottomRow'], 'top')
        self.widgets['mainForm'].attachForm(self.widgets['bottomRow'], 'left', 0)
        self.widgets['mainForm'].attachForm(self.widgets['bottomRow'], 'bottom', 0)
        self.widgets['mainForm'].attachForm(self.widgets['bottomRow'], 'right', 0)
        #end form layout
        
        self._populateUI()
        
        pm.scriptJob(uiDeleted = [self.widgets['mainWindow'].name(), pm.Callback(self.saveUI)])                           #saves ui settings to optionVar
        pm.scriptJob(e = ['renderLayerChange', pm.Callback(self.updateLayers)], p = self.widgets['mainWindow'].name())    #reloads layers scroll when a layer is created or deleted

        #show created ui
        self.widgets['mainWindow'].show()
        self.getOptionVars()