コード例 #1
0
	def openSelectedFile(self):
		try:
			item = self.previewAnimTable.selectedItems()[0]
			if item.column() == 0:
				self.openMayaFile(item.text(),'preview')
			elif item.column() == 2:
				if item.text() == 'Yes':
					filename = self.previewAnimTable.item(item.row(),0).text()
					self.openMovFile(filename,'preview')
		except:
			pass
		
		try:
			item = self.wipAnimTable.selectedItems()[0]
			if item.column() ==0:
				self.openMayaFile(item.text(),'wip')
			elif item.column() == 2:
				if item.text() == 'Yes':
					filename = self.wipAnimTable.item(item.row(),0).text()
					self.openMovFile(filename)
		except:
			pass
		currentFile = pm.sceneName()
		pm.optionVar(stringValueAppend=('RecentFilesList', currentFile))
		pm.optionVar(stringValueAppend=('RecentFilesTypeList', 'mayaAscii'))
		
		self.bdPopulateFiles()
コード例 #2
0
ファイル: sol_dialogs.py プロジェクト: Vimkxi/vmTools
    def accept(self):
        """Sets option/environnement vars to remember user choices."""

        # Set session var if checkbox1 was checked
        if self.cbx_switch_session.isChecked():
            pmu.putEnv(Vars.VIEWPORT_ENVVAR, "1")

        # Set option var if checkbox2 was checked
        if self.cbx_switch_always.isChecked():
            pmc.optionVar(iv=(Vars.VIEWPORT_OPTION, 1))

        # Accept event
        QtGui.QDialog.accept(self)
コード例 #3
0
 def saveScene(self):
     # Set 
     pc.optionVar(intValue=['isIncrementalSaveEnabled', True])
     pc.optionVar(intValue=['incrementalSaveLimitBackups', 2])
     pc.optionVar(intValue=['incrementalSaveMaxBackups', 3])
     pc.optionVar(intValue=['isCompressedSaveEnabled', False])
     # NOTE saveFile was mistakenly left out from pymel 2011 build
     # so this is the solution for it
     pc.mel.eval("SaveScene")
コード例 #4
0
    def value(self):
        if not pm.optionVar(exists=self.name):
            return self.default

        value = pm.optionVar(q=self.name)

        # Make sure the value is of the type we expect.  If it's not, return the default instead.
        item_type = self._types[self.var_type]
        expected_class = item_type.expected_type
        if not isinstance(value, expected_class):
            return self.default

        # For bool, cast to bool.
        if self.var_type == 'bool':
            value = bool(value)

        return value
コード例 #5
0
    def value(self, value):
        old_value = self.value

        item_type = self._types[self.var_type]
        expected_class = item_type.expected_type
        assert isinstance(
            value, expected_class
        ), 'Option %s has type %s and can\'t be set to "%s"' % (
            self.name, self.var_type, value)

        kwargs = {}
        arg = item_type.maya_type
        kwargs[arg] = (self.name, value)
        pm.optionVar(**kwargs)

        if value != old_value:
            self._call_on_change()
コード例 #6
0
ファイル: general.py プロジェクト: ice-animations/imaya
def addOptionVar(name, value, array=False):
    if type(value) == type(int):
        if array:
            pc.optionVar(iva=(name, value))
        else:
            pc.optionVar(iv=(name, value))
    elif isinstance(value, basestring):
        if array:
            pc.optionVar(sva=(name, value))
        else:
            pc.optionVar(sv=(name, value))
コード例 #7
0
 def init_project_filter(self):
     project_list = [
         {
             'type': 'Project',
             'id': 122,
             'name': 'Dance6 Project',
         },
         {
             'type': 'Project',
             'id': 155,
             'name': 'Kongsuni7_Project',
         },
     ]
     self.project_filter_combo.clear()
     for i, sg_prj in enumerate(project_list):
         self.project_filter_combo.addItem(sg_prj['name'])
         self.project_filter_combo.setItemData(i, sg_prj)
     if pm.optionVar(exists=self.STORED_PROJECT_INDEX_OPTIONVAR):
         idx = pm.optionVar(query=self.STORED_PROJECT_INDEX_OPTIONVAR)
         self.project_filter_combo.setCurrentIndex(idx)
コード例 #8
0
ファイル: legacy.py プロジェクト: VSPipe/reveries-config
    def xgmMakeCurvesDynamic(descHairSysName, collide):
        """
        Create nHairSystem with good name before MakeCurvesDynamic
        and without optionBox UI
        """
        selection = pmc.ls(sl=True, long=True)
        # find hair holding mesh for later rigid body rename
        meshPatch = []
        for dag in selection:
            if dag.getShape().type() == "mesh":
                meshPatch.append(dag.name())

        # create the first time we hit a valid curve
        hsys = pmc.createNode("hairSystem")
        hsys.getParent().rename(descHairSysName)

        # we want uniform stiffness because the curves
        # are initially point locked to both ends
        pmc.removeMultiInstance(hsys.stiffnessScale[1], b=True)

        hsys.clumpWidth.set(0.00001)
        hsys.hairsPerClump.set(1)
        pmc.connectAttr("time1.outTime", hsys.currentTime)

        nucleus = pmc.mel.getActiveNucleusNode(False, True)
        pmc.mel.addActiveToNSystem(hsys, nucleus)
        pmc.connectAttr(nucleus + ".startFrame", hsys.startFrame)

        # select the hairSystem we just created and well named,
        # and maya won't create one when making curves dynamic
        selection.append(hsys)
        # re-select curves, mesh and hairSystem
        pmc.select(selection, replace=True)
        # trun on 'Collide With Mesh'
        pmc.optionVar(
            intValue=["makeCurvesDynamicCollideWithMesh",
                      int(collide)])
        # MakeCurvesDynamic callback
        mel.eval('makeCurvesDynamic 2 { "1", "0", "1", "1", "0"}')

        return meshPatch, hsys.name()
コード例 #9
0
def set_symmetry_axis(components):
    """
    Given a list of components, set the UV symmetry mirror axis and axis position.

    If the components only have 1 UV, the axis position will be set based on the
    currently selected axis.
    """
    uvs = pm.polyEditUV(components, q=True)
    uvs = [(u, v) for u, v in zip(uvs[0::2], uvs[1::2])]

    # Find the bounding box of the selection.
    bounds_u = min(u for u, v in uvs), max(u for u, v in uvs)
    bounds_v = min(v for u, v in uvs), max(v for u, v in uvs)

    # Choose a vertical or horizontal axis based on the bounding box.
    width = abs(bounds_u[0] - bounds_u[1])
    height = abs(bounds_v[0] - bounds_v[1])

    # Do a quick sanity check to make sure the selection is vertical or horizontal.ww
    angle = math.atan2(width, height) * 180 / math.pi
    tol = 10
    if abs(angle) > tol and abs(90 - angle) > tol:
        om.MGlobal.displayInfo('Selected symmetry plane isn\'t axis-aligned')
        return

    if width == 0 and height == 0:
        # If the size is 0, a single UV was selected.  Just set the axis based on the current mode.
        u_axis = pm.optionVar(q='polySymmetrizeUVAxis')
    else:
        # If the bounding box is vertical, the seam is on the V plane.
        u_axis = width > height
        pm.optionVar(iv=('polySymmetrizeUVAxis', 1 if u_axis else 0))

    # Use the average of the selection as the mirror plane.  If there's only one UV selected, this will
    # be its position.
    if u_axis:
        offset = (bounds_v[0] + bounds_v[1]) / 2
    else:
        offset = (bounds_u[0] + bounds_u[1]) / 2

    pm.optionVar(fv=('polySymmetrizeUVAxisOffset', offset))
コード例 #10
0
ファイル: animToolUI.py プロジェクト: Mortaciunea/bdScripts
	def openMayaFile(self,filename,folder):
		f=''
		wipPath = self.wipFolderEdit.text()
		print filename, folder
		if folder == 'wip':
			f = os.path.abspath(os.path.join(wipPath,filename))
		elif folder == 'preview':
			f = os.path.abspath(os.path.join(wipPath.replace('01_wip','03_preview'),filename))
		
		if os.path.isfile(f):
			saveDlg = saveChangesDlg()
			#saveDlg.setFixedSize(800,  300)
			result = saveDlg.exec_()
			if result == 1:
				pm.saveFile()
				pm.openFile(f)
			elif result == 2:
				pm.openFile(f,f=1)
				
			pm.optionVar(stringValueAppend=('RecentFilesList', currentFile))
			pm.optionVar(stringValueAppend=('RecentFilesTypeList', 'mayaAscii'))			
コード例 #11
0
    def openMayaFile(self, filename, folder):
        f = ''
        wipPath = self.wipFolderEdit.text()
        print filename, folder
        if folder == 'wip':
            f = os.path.abspath(os.path.join(wipPath, filename))
        elif folder == 'preview':
            f = os.path.abspath(os.path.join(wipPath.replace('01_wip', '03_preview'), filename))

        if os.path.isfile(f):
            saveDlg = saveChangesDlg()
            # saveDlg.setFixedSize(800,  300)
            result = saveDlg.exec_()
            if result == 1:
                pm.saveFile()
                pm.openFile(f)
            elif result == 2:
                pm.openFile(f, f=1)

            pm.optionVar(stringValueAppend=('RecentFilesList', currentFile))
            pm.optionVar(stringValueAppend=('RecentFilesTypeList', 'mayaAscii'))
コード例 #12
0
def settings():
    """setup vray before baking"""
    global size
    size = pm.intSliderGrp("baker_size", q=True, v=True)

    pm.optionVar(intValue=("vrayBakeType", 2))
    pm.optionVar(intValue=("vraySkipNodesWithoutBakeOptions", 0))
    pm.optionVar(intValue=("vrayAssignBakedTextures", 0))
    pm.optionVar(stringValue=("vrayBakeOutputPath", textures_dir))
    pm.optionVar(intValue=("vrayBakeType", 2))

    try:
        options = nt.VRayBakeOptions("vrayDefaultBakeOptions")
    except pm.MayaNodeError:
        options = pm.createNode("VRayBakeOptions", n="vrayDefaultBakeOptions")
    options.setAttr("resolutionX", size)
    options.setAttr("outputTexturePath", textures_dir, type="string")
    options.setAttr("filenamePrefix", "")

    # ao material
    if not pm.objExists("ao_material"):
        material = pm.createNode("VRayMtl", n="ao_material")
        texture = pm.createNode("VRayDirt", n="ao_texture")
        texture.connectAttr("outColor", material.attr("color"))
        texture.connectAttr("outColor", material.attr("illumColor"))
    else:
        texture = nt.DependNode("ao_texture")
    texture.setAttr("radius", pm.floatSliderGrp("baker_radius", q=True,
                                                v=True))
    texture.setAttr("falloff",
                    pm.floatSliderGrp("baker_falloff", q=True, v=True))
    texture.setAttr("subdivs", pm.intSliderGrp("baker_sub", q=True, v=True))

    # shadows catch material
    if not pm.objExists("shadow_material"):
        material = pm.createNode("VRayMtl", n="shadow_material")
        material.setAttr("color", (1, 1, 1))
コード例 #13
0
ファイル: userSetup.py プロジェクト: afrocircus/LVFX-pipeline
def setupPrefs():
    #set the current options on load of maya (incase someone manually changed them it their settings)
    pm.playbackOptions(min=1, max=120)
    pm.currentTime(1)
    if 'FS' in os.environ and 'FE' in os.environ:
        first = os.environ['FS']
        last = os.environ['FE']
        fps = os.environ['FPS']
        fpsPreset = getFPSpreset(fps)
        mc.currentUnit(time=fpsPreset)
        if not first == '1' and not last == '2':
            pm.playbackOptions(minTime=first, maxTime=last, animationStartTime=first,
                               animationEndTime=last)
            pm.currentTime(first)

    '''pm.grid(size=1000, spacing=100, divisions=10)
    pm.optionVar (fv=("playbackMax",120))
    pm.optionVar (fv=("playbackMaxDefault",120))
    pm.optionVar (fv=("playbackMaxRange",120))
    pm.optionVar (fv=("playbackMaxRangeDefault",120))
    pm.optionVar (fv=("playbackMin",1))
    pm.optionVar (fv=("playbackMinDefault",1))
    pm.optionVar (fv=("playbackMinRange",1))
    pm.optionVar (fv=("playbackMinRangeDefault",1))'''

    #setting the grid settings
    pm.optionVar (fv=("gridDivisions",10))
    pm.optionVar (fv=("gridSize",1000))
    pm.optionVar (fv=("gridSpacing",100))

    mc.displayColor('gridAxis', 2, dormant=True)
    mc.displayColor('gridHighlight', 1, dormant=True)
    mc.displayColor('grid', 3, dormant=True)

    #setting the units
    pm.optionVar (sv=("workingUnitLinear", "cm"))
    pm.optionVar (sv=("workingUnitLinearDefault", "cm"))
コード例 #14
0
def initializePlugin(mobject):
    plugin = ompx.MFnPlugin(mobject)
    if om.MGlobal.mayaState() != om.MGlobal.kInteractive:
        return

    menu.add_menu_items()
    material_assignment_menu.AssignMaterialsContextMenu.register()
    skin_clusters.MoveSkinnedJoints.register(plugin)
    animation_helpers.install()
    pick_walk.setup_runtime_commands()
    maya_helpers.setup_runtime_commands()
    wireframes.setup_runtime_commands()

    if pm.optionVar(q='zFixLayerEditorUndo'):
        fix_layer_editor_undo.install()
コード例 #15
0
ファイル: view.py プロジェクト: lefan2016/TDClass01
    def update(self, init=False, target=None):
        """
        Update options values when required.
        The values displayed and the actual Maya preferences are synchronous.
        :param init: Only available in __init__.
        :param target: The target preset to change to.
        """
        # Update presets list
        for item in pm.optionMenu(self.prj_omg, q=True, itemListLong=True):
            pm.deleteUI(item)
        for preset in model.get_presets():
            pm.menuItem(parent=self.prj_omg, label=preset['name'])

        if init:  # If MainUI is just opened, retrieve current preset from Maya's optionVar.
            current_preset = pm.optionVar(q='currentPreset') if pm.optionVar(exists='currentPreset') else model.default
            try:
                pm.optionMenu(self.prj_omg, e=True, value=current_preset)
            except RuntimeError:
                current_preset = model.default

        else:  # Or set current preset to a specified one.
            if target:
                current_preset = target
                pm.optionMenu(self.prj_omg, e=True, value=target)
            else:
                current_preset = pm.optionMenu(self.prj_omg, q=True, value=True)

        # Apply current preset.
        for preset in model.get_presets():
            if current_preset == preset['name']:
                for setter in self.setters:
                    # Make sure each option value display is correct.
                    setter['creator'](setter['control'], **{'e': True, setter['arg']: preset[setter['label']]})
                model.apply(preset)

        pm.optionVar(stringValue=('currentPreset', current_preset))
コード例 #16
0
ファイル: export.py プロジェクト: jzboylxj/XDLibs
    def initialize(self):
        if pm.optionVar(q='autoExportFBXFileToolOutputPath'):
            self.output_path = pm.optionVar(
                q='autoExportFBXFileToolOutputPath')

        if pm.optionVar(q='autoExportFBXFileToolAutoChecked'):
            self.auto_work_state = pm.optionVar(
                q='autoExportFBXFileToolAutoChecked')

        if pm.optionVar(q='autoExportFBXFileToolWorkMode'):
            self.work_mode_selected = int(pm.optionVar(
                q='autoExportFBXFileToolWorkMode'))
コード例 #17
0
ファイル: bake_anim.py プロジェクト: jzboylxj/XDLibs
    def initialize(self):
        """
        初始化数据

        从MAYA的保存的属性数据里面获取一些值

        :return:
        """
        if pm.optionVar(q='doBakeAnimOutputPath'):
            self.output_path = pm.optionVar(q='doBakeAnimOutputPath')
        if pm.optionVar(q='doBakeAnimTemplateFile'):
            self.template_file = pm.optionVar(q='doBakeAnimTemplateFile')
        if pm.optionVar(q='doBakeAnimCleanFileChecked'):
            if pm.optionVar(q='doBakeAnimCleanFileChecked') == "False":
                self.clean_file = False
            elif pm.optionVar(q='doBakeAnimCleanFileChecked') == "True":
                self.clean_file = True
        if pm.optionVar(q='doBakeAnimExportAtomChecked'):
            if pm.optionVar(q='doBakeAnimExportAtomChecked') == "False":
                self.export_atom = False
            elif pm.optionVar(q='doBakeAnimExportAtomChecked') == "True":
                self.export_atom = True

        if pm.optionVar(q='doBakeAnimRigFile'):
            self.rig_file = pm.optionVar(q='doBakeAnimRigFile')
        if pm.optionVar(q='doBakeAnimAtomFile'):
            self.atom_file = pm.optionVar(q='doBakeAnimAtomFile')
        if pm.optionVar(q='doBakeChangeNTSCChecked'):
            if pm.optionVar(q='doBakeChangeNTSCChecked') == "False":
                self.changeNTSC = False
            elif pm.optionVar(q='doBakeChangeNTSCChecked') == "True":
                self.changeNTSC = True
コード例 #18
0
    def setup_huds(self):
        data = dict(
            objectDetailsVisibility='ToggleObjectDetails;',
            polyCountVisibility='TogglePolyCount;',
            subdDetailsVisibility='ToggleSubdDetails;',
            animationDetailsVisibility='ToggleAnimationDetails;',
            frameRateVisibility='ToggleFrameRate;',
            viewAxisVisibility='ToggleViewAxis;',
            toolMessageVisible='ToggleToolMessage;',
            currentContainerVisibility='ToggleCurrentContainerHud',
            currentFrameVisibility='ToggleCurrentFrame',
            focalLengthVisibility='ToggleFocalLength',
            hikDetailsVisibility='ToggleHikDetails',
            materialLoadingDetailsVisibility=
            'ToggleMaterialLoadingDetailsVisibility',
            particleCountVisibility='ToggleParticleCount',
            sceneTimecodeVisibility='ToggleSceneTimecode',
            # 'cameraNamesVisibility': 'ToggleCameraNames;',
            selectDetailsVisibility='ToggleSelectDetails',
            symmetryVisibility='ToggleSymmetryDisplay')
        for tgl in data:
            try:
                if cmds.optionVar(q=tgl):
                    mel.eval(data[tgl])
            except:
                pass
        try:
            if cmds.toggleAxis(q=True, o=True):
                mel.eval('ToggleOriginAxis;')
        except:
            pass
        if not pm.optionVar(q='cameraNamesVisibility'):
            mel.eval('ToggleCameraNames;')
        dfs = 'large'
        labelFontSize = 'large'
        blockSize = 'small'

        # for i in range(10):
        #     for b in range(4):
        #         cmds.headsUpDisplay(rp=[i, b])
        HUD_names = [
            'HUD_partNum', 'HUD_sceneNum', 'HUD_user', 'HUD_version',
            'HUD_frame'
        ]
        for h in HUD_names:
            try:
                pm.headsUpDisplay(h, rem=True)
            except:
                pass

        pm.headsUpDisplay('HUD_partNum',
                          section=6,
                          block=4,
                          blockSize=blockSize,
                          label='Part:',
                          dfs=dfs,
                          labelFontSize=labelFontSize,
                          command=lambda: self.part)

        pm.headsUpDisplay('HUD_sceneNum',
                          section=6,
                          block=3,
                          blockSize=blockSize,
                          label='Scene:',
                          dfs=dfs,
                          labelFontSize=labelFontSize,
                          command=lambda: self.scene)

        pm.headsUpDisplay('HUD_user',
                          section=5,
                          block=3,
                          blockSize=blockSize,
                          label='User:'******'HUD_version',
                          section=5,
                          block=4,
                          blockSize=blockSize,
                          label='ver:',
                          dfs=dfs,
                          labelFontSize=labelFontSize,
                          command=lambda: self.version,
                          atr=True)

        pm.headsUpDisplay('HUD_frame',
                          section=8,
                          block=3,
                          blockSize=blockSize,
                          label='frame:',
                          dfs=dfs,
                          labelFontSize=labelFontSize,
                          command=lambda: pm.currentTime(q=1),
                          atr=True)
コード例 #19
0
 def deleteOptionVars(self):
     pm.optionVar(remove='rigString')
     pm.optionVar(remove='shadeString')
     pm.optionVar(remove='animString')
     pm.optionVar(remove='geoString')
     pm.optionVar(remove='lightingString')
     pm.optionVar(remove='animFolderString')
     pm.optionVar(remove='rigsFolderString')
     pm.optionVar(remove='shadeFolderString')
     pm.optionVar(remove='lightingFolderString')
コード例 #20
0
ファイル: lcPrefs.py プロジェクト: leocov-dev/lct-legacy
    def show(self, *args, **kwargs):
        ''' '''
        width = 300
        height = 200

        if pm.window(self.name, ex=True):
            pm.deleteUI(self.name)

        self.window = pm.window(self.name,
                                t=self.name,
                                w=width,
                                mxb=False,
                                mnb=False,
                                s=False,
                                toolbox=True)

        pm.columnLayout('lcPrefs_column_main')

        pm.text(l='Maya Preferences',
                w=width,
                h=30,
                al='center',
                font='boldLabelFont')

        # Image Editing Applications
        # pm.text(l=' Image Editing Applications', font='boldLabelFont')
        pm.frameLayout(l='Image Editing Applications', w=width - 2)
        pm.separator(style='none', h=1)
        cw2 = 25
        cw1 = width - cw2 - 4
        ##Photoshop
        pm.text(l=' Photoshop (PSD) Files', w=width, al='left')
        pm.rowColumnLayout(nc=2, cw=([1, cw1], [2, cw2]))
        photoshop_dir = ''
        if pm.optionVar(query='PhotoshopDir') != 0:
            photoshop_dir = pm.optionVar(query='PhotoshopDir')
        pm.textField(
            'lcPrefs_photosohp',
            w=cw2,
            text=photoshop_dir,
            changeCommand=lambda *args: self.browse_path('lcPrefs_photosohp'))
        pm.symbolButton(
            image='navButtonBrowse.png',
            w=cw2,
            command=lambda *args: self.browse_path('lcPrefs_photosohp', True))
        pm.setParent('..')
        # pm.separator(style='none', h=10)
        ##Others
        pm.text(l=' Other Image Files', w=width, al='left')
        pm.rowColumnLayout(nc=2, cw=([1, cw1], [2, cw2]))
        edit_image_dir = ''
        if pm.optionVar(query='EditImageDir') != 0:
            edit_image_dir = pm.optionVar(query='EditImageDir')
        pm.textField(
            'lcPrefs_image',
            w=cw2,
            text=edit_image_dir,
            changeCommand=lambda *args: self.browse_path('lcPrefs_image'))
        pm.symbolButton(
            image='navButtonBrowse.png',
            w=cw2,
            command=lambda *args: self.browse_path('lcPrefs_image', True))
        pm.setParent('lcPrefs_column_main')
        # pm.separator(style='none', h=10)

        # Save and Close
        pm.separator(style='none', h=10)
        pm.button(l='Save and Close',
                  w=width - 4,
                  h=30,
                  command=lambda *args: self.save_and_close())

        self.window.show()
        pm.window(self.name, edit=True, w=width, h=height)
コード例 #21
0
 def on_project_changed(self):
     pm.optionVar(intValue=(self.STORED_PROJECT_INDEX_OPTIONVAR,
                            self.project_filter_combo.currentIndex()))
     self.init_episode_filter()
コード例 #22
0
	def exportVRaySceneFile(self, palName):
		"""doc"""
		version = self.getAnimBranch(palName)
		if not version:
			pm.error('[XGen Hub] : Couldn\'t get ANIM branch name. Export process stop.')
			return None
		shotName = self.getAnimShotName(palName)
		if not shotName:
			pm.error('[XGen Hub] : Couldn\'t get ANIM shotName. Export process stop.')
			return None

		vraySet = mRender.getVRaySettingsNode()
		if vraySet.getAttr("sys_distributed_rendering_on"):
			pm.error('[XGen Hub] : VRay Distributed Rendering should be OFF, process stop.')
			return None

		# set preview only in cam to false
		prvValueDict = self.setPreviewInCam(palName)
		# get start, end frame from time slider
		start, end = self.getTimeSliderMinMax()
		# trun on autoupdate
		self.previewAutoUpdate(True)
		# set renderer to VRay and time range
		renderGlob = pm.PyNode('defaultRenderGlobals')
		renderGlob.currentRenderer.set('vray')
		renderGlob.startFrame.set(start)
		renderGlob.endFrame.set(end)
		renderGlob.byFrameStep.set(1)
		# setup vray render settings
		vrsceneFile = self.getVRaySceneFilePath(palName, shotName)
		vrayAttrs = {
			'vrscene_render_on': 0,
			'vrscene_on': 1,
			'misc_separateFiles': 1,
			'misc_exportLights': 0,
			'misc_exportNodes': 1,
			'misc_exportGeometry': 1,
			'misc_exportMaterials': 1,
			'misc_exportTextures': 1,
			'misc_exportBitmaps': 1,
			'misc_eachFrameInFile': 1,
			'misc_meshAsHex': 1,
			'misc_transformAsHex': 1,
			'misc_compressedVrscene': 1,
			'vrscene_filename': vrsceneFile,
			'animType': 1,
			'animBatchOnly': 0,
			'runToAnimationStart': 0,
			'runToCurrentTime': 0
		}
		for attr in vrayAttrs:
			vraySet.setAttr(attr, vrayAttrs[attr])

		# disable render region
		editor = pm.renderWindowEditor(query=True, editorName=True)
		if len(editor) == 0:
			editor = pm.renderWindowEditor('renderView')
		pm.renderWindowEditor(editor, edit=True, resetRegion=True)
		pm.mel.eval('vray showVFB;')
		pm.mel.eval('vray vfbControl -setregion reset;')

		# hide imagePlane
		for imgp in pm.ls(type="imagePlane") or []:
			imgp.setAttr("alphaGain", 0)

		# render selected only
		opVar = 'renderViewRenderSelectedObj'
		opAlt = False
		if not pm.optionVar(exists=opVar) or not pm.optionVar(query=opVar):
			pm.optionVar(intValue=[opVar, 1])
			opAlt = True
		# select palette hierarchy
		pm.select(clear=True)
		pm.select(palName, hierarchy=True, noExpand=True)

		# get resolved repo shotName path
		deltaPath = self.paletteDeltaDir(palName, version, shotName)
		if not os.path.exists(deltaPath):
			os.makedirs(deltaPath)

		# hit render
		pm.mel.RenderIntoNewWindow()

		# restore preview only in cam value
		self.setPreviewInCam(palName, prvValueDict)
		# restore render selected only
		if opAlt:
			pm.optionVar(intValue=[opVar, 0])
		# restore vray render settings
		vrayAttrs = {
			'vrscene_render_on': 1,
			'vrscene_on': 0,
			'vrscene_filename': '',
			'animBatchOnly': 1
		}
		for attr in vrayAttrs:
			vraySet.setAttr(attr, vrayAttrs[attr])

		self.notifyMsg('File .vrscene Export Complete !', 0)

		return True
コード例 #23
0
    def createParticleEmitter(self, meshEmitter, collider):

        # Force nParticle balls at creation
        pm.optionVar(sv=("NParticleStyle", "Balls"))

        self.particle, self.partShape = pm.nParticle(n=str(meshEmitter) + "_particle")
        # Add attribute in particleShape
        pm.addAttr(self.partShape, ln="indexPP", dt="doubleArray")
        pm.addAttr(self.partShape, ln="rotatePP", dt="vectorArray")
        pm.addAttr(self.partShape, ln="scalePP", dt="vectorArray")
        pm.addAttr(self.partShape, ln="rgbPP", dt="vectorArray")
        pm.addAttr(self.partShape, ln="fixPosPP", dt="vectorArray")
        pm.addAttr(self.partShape, ln="opacityPP", dt="doubleArray")

        pm.addAttr(self.partShape, ln="typePP", dt="doubleArray")

        self.nameEmitter = str(meshEmitter) + "_emitter"
        pm.emitter(meshEmitter, type="surface", name=self.nameEmitter, r=float(self.ui.simulationEmit_le.text()))
        pm.connectDynamic(self.partShape, em=self.nameEmitter)

        # Used maya command because pymel crash when find nucleus node
        self.nucleusName = mel.eval('listConnections -type "nucleus" ' + self.partShape + ";")[0]

        pm.parent(self.partShape, self.worldParent)
        pm.parent(self.nameEmitter, self.worldParent)
        pm.parent(self.nucleusName, self.worldParent)

        self.setParamaters(self.partShape, self.particleParameter)
        self.setParamaters(self.nameEmitter, self.emitterParameter)
        self.setParamaters(self.nucleusName, self.nucleusParameter)
        pm.addAttr(self.partShape, ln="radiusPP", dt="doubleArray")

        # Create Rigid
        pm.select(collider, r=1)
        pm.runtime.nClothMakeCollide(collider)
        self.nrigid = pm.listConnections(collider.listRelatives(s=1, c=1)[0], type="nRigid")[0]
        self.setParamaters(self.nrigid.listRelatives(s=1, c=1)[0], self.rigidParameter)
        pm.parent(self.nrigid, self.worldParent)
        self.nrigid.setAttr("v", 0)

        # Create instancer
        self.instancer = pm.particleInstancer(
            self.partShape,
            a=True,
            object=self.listInstance,
            n=str(meshEmitter) + "_instancer",
            cycle="sequential",
            age="indexPP",
            rotation="rotatePP",
            scale="scalePP",
            visibility="opacityPP",
        )
        pm.parent(self.instancer, self.worldParent)

        # Create proc Colision
        expression = """
global proc forestGeneratorEvent(string $particleObject,int $particleId, string  $geometryObject) 
{

    vector $rgb = `nParticle -attribute rgbPP -id $particleId -q $particleObject`;

    if ($rgb != << 1,1,1 >>)
    {
        nParticle -e -attribute rgbPP -id $particleId -vv 0 1 0 $particleObject;
    }
    
    vector $pos = `nParticle -attribute position -id $particleId -q $particleObject`;
    
    vector $lastPos = `nParticle -attribute lastPosition -id $particleId -q $particleObject`;
    
    
    
    nParticle -e -attribute opacityPP -id $particleId -fv 1 $particleObject;

    if (mag($pos - $lastPos) >= 10 && $rgb != << 1,1,1 >>){
    
        nParticle -e -attribute lifespanPP -id $particleId -fv 0 $particleObject;
    }
}"""
        pm.expression(s=expression, n="forestGenerator_exp")
        # Create  Colision event

        pm.event(self.partShape, die=0, count=0, proc="forestGeneratorEvent")
コード例 #24
0
 def set(self, value):
     if value is None:
         pm.optionVar(remove=self.var)
     else:
         pm.optionVar(sv=(self.var, value))
コード例 #25
0
ファイル: forestGenerator.py プロジェクト: DeanB93/test
    def createParticleEmitter(self, meshEmitter, collider):

        # Force nParticle balls at creation
        pm.optionVar(sv=("NParticleStyle", "Balls"))

        self.particle, self.partShape = pm.nParticle(n=str(meshEmitter) +
                                                     "_particle")
        #Add attribute in particleShape
        pm.addAttr(self.partShape, ln="indexPP", dt="doubleArray")
        pm.addAttr(self.partShape, ln="rotatePP", dt="vectorArray")
        pm.addAttr(self.partShape, ln="scalePP", dt="vectorArray")
        pm.addAttr(self.partShape, ln="rgbPP", dt="vectorArray")
        pm.addAttr(self.partShape, ln="fixPosPP", dt="vectorArray")
        pm.addAttr(self.partShape, ln="opacityPP", dt="doubleArray")

        pm.addAttr(self.partShape, ln="typePP", dt="doubleArray")

        self.nameEmitter = str(meshEmitter) + "_emitter"
        pm.emitter(meshEmitter,
                   type="surface",
                   name=self.nameEmitter,
                   r=float(self.ui.simulationEmit_le.text()))
        pm.connectDynamic(self.partShape, em=self.nameEmitter)

        #Used maya command because pymel crash when find nucleus node
        self.nucleusName = mel.eval("listConnections -type \"nucleus\" " +
                                    self.partShape + ";")[0]

        pm.parent(self.partShape, self.worldParent)
        pm.parent(self.nameEmitter, self.worldParent)
        pm.parent(self.nucleusName, self.worldParent)

        self.setParamaters(self.partShape, self.particleParameter)
        self.setParamaters(self.nameEmitter, self.emitterParameter)
        self.setParamaters(self.nucleusName, self.nucleusParameter)
        pm.addAttr(self.partShape, ln="radiusPP", dt="doubleArray")

        #Create Rigid
        pm.select(collider, r=1)
        pm.runtime.nClothMakeCollide(collider)
        self.nrigid = pm.listConnections(collider.listRelatives(s=1, c=1)[0],
                                         type='nRigid')[0]
        self.setParamaters(
            self.nrigid.listRelatives(s=1, c=1)[0], self.rigidParameter)
        pm.parent(self.nrigid, self.worldParent)
        self.nrigid.setAttr("v", 0)

        #Create instancer
        self.instancer = pm.particleInstancer(self.partShape,
                                              a=True,
                                              object=self.listInstance,
                                              n=str(meshEmitter) +
                                              "_instancer",
                                              cycle="sequential",
                                              age="indexPP",
                                              rotation="rotatePP",
                                              scale="scalePP",
                                              visibility="opacityPP")
        pm.parent(self.instancer, self.worldParent)

        #Create proc Colision
        expression = """
global proc forestGeneratorEvent(string $particleObject,int $particleId, string  $geometryObject) 
{

    vector $rgb = `nParticle -attribute rgbPP -id $particleId -q $particleObject`;

    if ($rgb != << 1,1,1 >>)
    {
        nParticle -e -attribute rgbPP -id $particleId -vv 0 1 0 $particleObject;
    }
    
    vector $pos = `nParticle -attribute position -id $particleId -q $particleObject`;
    
    vector $lastPos = `nParticle -attribute lastPosition -id $particleId -q $particleObject`;
    
    
    
    nParticle -e -attribute opacityPP -id $particleId -fv 1 $particleObject;

    if (mag($pos - $lastPos) >= 10 && $rgb != << 1,1,1 >>){
    
        nParticle -e -attribute lifespanPP -id $particleId -fv 0 $particleObject;
    }
}"""
        pm.expression(s=expression, n="forestGenerator_exp")
        #Create  Colision event

        pm.event(self.partShape, die=0, count=0, proc="forestGeneratorEvent")
コード例 #26
0
 def set_height(cls, height):
     print('new height : {}'.format(height))
     pm.shelfTabLayout(cls.SHELF_LAYOUT, edit=True, height=height)
     pm.optionVar(intValue=(cls.OPTION_VAR, height))
コード例 #27
0
 def on_header_resized(self, *args):
     index, old, value = args
     pm.optionVar(intValue=(self._ov(index), value))
コード例 #28
0
ファイル: bake_anim.py プロジェクト: jzboylxj/XDLibs
    def _close_main_window(self):
        pm.optionVar(sv=('doBakeAnimOutputPath', self.output_path))
        pm.optionVar(sv=('doBakeAnimTemplateFile', self.template_file))
        pm.optionVar(sv=('doBakeAnimCleanFileChecked', self.clean_file))
        pm.optionVar(sv=('doBakeAnimExportAtomChecked', self.export_atom))

        pm.optionVar(sv=('doBakeAnimRigFile', self.rig_file))
        pm.optionVar(sv=('doBakeAnimAtomFile', self.atom_file))
        pm.optionVar(sv=('doBakeChangeNTSCChecked', self.changeNTSC))
コード例 #29
0
    def create_layout(self):
        self.win = pm.window(title="Cluster Weight Interpolation")
        layout = pm.rowColumnLayout(numberOfColumns=2,
                                    columnAttach=(1, 'right', 0),
                                    columnWidth=[(1, 150), (2, 250)],
                                    rowOffset=(6, "bottom", 15),
                                    rowSpacing=(1, 10),
                                    columnSpacing=(2, 15))
        #chkBox = pm.checkBox(label = "My Checkbox", value=True, parent=layout)

        #Set up weight inputs
        pm.text(label="Min Weight")
        self.minWeight = pm.textField()
        pm.text(label="Max Weight")
        self.maxWeight = pm.textField()

        #Set up cluster Menu
        pm.text(label='Cluster')
        self.clusterMenu = pm.optionMenu()
        clusterList = hybridClusterList(self.vertList)
        for c in clusterList:
            pm.menuItem(label=str(c))

        #Set up Equation Menu
        pm.text(label='Equation')
        self.functionMenu = pm.optionMenu()
        pm.menuItem(label='Ramp')
        pm.menuItem(label='Linear')
        pm.menuItem(label='Quadratic')

        #Set up Ramp
        #TODO is there a way that we can hide or disable this thing if the user should select to use the Linear or Quadratic options?
        pm.text(label='Ramp Value')
        pm.optionVar(stringValueAppend=['falloffCurveOptionVar', '0,1,2'])
        pm.optionVar(stringValueAppend=['falloffCurveOptionVar', '1,0,2'])
        pm.gradientControlNoAttr('falloffCurve', h=90)
        self.ramp = pm.gradientControlNoAttr('falloffCurve',
                                             e=True,
                                             optionVar='falloffCurveOptionVar')

        pm.text(label='Invert')
        self.invert = pm.optionMenu()
        pm.menuItem(label='Yes')
        pm.menuItem(label='No')

        #Set up Axis Menu
        pm.text(label='Axies for Dist Measurement')
        self.interpolationAxis = pm.optionMenu()
        pm.menuItem(label='xyz')
        pm.menuItem(label='x')
        pm.menuItem(label='y')
        pm.menuItem(label='z')
        pm.menuItem(label='xy')
        pm.menuItem(label='xz')
        pm.menuItem(label='yz')
        pm.menuItem(label='Point Number')

        #Set up Buttons
        closeBtn = pm.button(label="Close", parent=layout)
        interpolateBtn = pm.button(label="Interpolate", parent=layout)

        interpolateBtn.setCommand(lambda *args: self.interpolate())
        closeBtn.setCommand(lambda *args: self.close_dialog())
コード例 #30
0
 def get(self):
     if not pm.optionVar(exists=self.var):
         return None
     return pm.optionVar(q=self.var)
コード例 #31
0
ファイル: sol_dialogs.py プロジェクト: Vimkxi/vmTools
 def is_switch_automatic():
     """Checks if the viewport switch should be automatic."""
     return (
         pmc.optionVar(q=Vars.VIEWPORT_OPTION) or
         pmu.getEnv(Vars.VIEWPORT_ENVVAR)
     )
コード例 #32
0
def openLastScene():
    recentFilesList = pymel.optionVar(query="RecentFilesList")
    cmds.file(recentFilesList[-1], f=True, open=True)
コード例 #33
0
 def restore_file_path(self):
     if pm.optionVar(exists=self.LAST_DIR_OPTIONVAR):
         self.path_field.setText(
             pm.optionVar(query=self.LAST_DIR_OPTIONVAR))
         self.init_file_list()
コード例 #34
0
 def get_maya_option(self, key, default):
     real_key = "{tool_name}_{key}".format(tool_name=self.tool_name,
                                           key=key)
     if not pm.optionVar(exists=real_key):
         return default
     return pm.optionVar(query=real_key)
コード例 #35
0
def hidePolyCount():
    global __poly_count__
    if pc.optionVar(q='polyCountVisibility'):
        __poly_count__ = True
        pc.Mel.eval('setPolyCountVisibility(0)')
コード例 #36
0
 def get(self, key, default):
     option_key = self._format_key(key)
     if not pm.optionVar(exists=option_key):
         return default
     return pm.optionVar(query=option_key)
コード例 #37
0
ファイル: mayagui.py プロジェクト: LumaPictures/gozbruh
    def build(self):
        """Constructs gui
        """
        if pm.window('goz', exists=True):
            pm.deleteUI('goz', window=True)

        self.gui_window = pm.window('goz', title="gozbruh", rtf=True,
                                    width=1000, height=700)

        pm.setUITemplate('attributeEditorTemplate', pushTemplate=True)

        main_layout = pm.frameLayout(label='gozbruh Options', cll=False)
        pm.setParent(main_layout)
        #======================================================================
        # GENERAL
        #======================================================================
                    #########SHARED
        pm.setParent(main_layout)
        general_framelayout = pm.frameLayout(label='General Options',
                                             cll=False)
        pm.setParent(general_framelayout)

        general_rcl = pm.rowColumnLayout(nc=2)
        pm.setParent(general_rcl)
        pm.text(label='Shared Dir\t')
        self.user_shared_dir = pm.textField(text=utils.get_shared_dir(),
                                            width=200)

        #======================================================================
        # SERVER
        #======================================================================
        pm.setParent(main_layout)
                    #########ZBRUSH
        zbrush_layout = pm.frameLayout(label='ZBrush', cll=False)
        pm.setParent(zbrush_layout)
        zbrush_rcl = pm.rowColumnLayout(nc=2)
        zbrush_host, zbrush_port = utils.get_net_info(utils.ZBRUSH_ENV)
        pm.text(label='ZBrush Host\t')
        self.user_zbrush_host = pm.textField(text=zbrush_host, width=200)
        pm.text(label='ZBrush Port\t')
        self.user_zbrush_port = pm.textField(text=zbrush_port, width=200)

        pm.setParent(zbrush_layout)
        self.send_btn = pm.button(label="Send Selection to ZBrush")
        self.conn_btn = pm.button(label="Check Connection to ZBrush")
        self.zbrush_status_ui = pm.text(label='Status: not connected',
                                        height=30,
                                        enableBackground=True,
                                        backgroundColor=(1.0, 0.0, 0.0))

                    #########MAYA
        pm.setParent(main_layout)
        pm.text(' ')
        maya_layout = pm.frameLayout(label='Maya', cll=False)
        pm.setParent(maya_layout)
        maya_rcl = pm.rowColumnLayout(nc=2)
        maya_host, maya_port = utils.get_net_info(utils.MAYA_ENV)
        pm.text(label='Maya Host\t')
        self.user_maya_host = pm.textField(text=maya_host, width=200)
        pm.text(label='Maya Port\t')
        self.user_maya_port = pm.textField(text=maya_port, width=200)

        pm.setParent(maya_layout)
        self.listen_btn = pm.button(label="Listen for Meshes from ZBrush")
        self.maya_status_ui = pm.text(label='Status: not listening',
                                      height=30,
                                      enableBackground=True,
                                      backgroundColor=(1.0, 0.0, 0.0))

        #======================================================================
        # MORE OPTIONS
        #======================================================================
        pm.setParent(main_layout)
        pm.text(' ')
        more_framelayout = pm.frameLayout(label='Maya-Specific Options',
                                          cll=False)
        pm.setParent(more_framelayout)
        more_rcl = pm.rowColumnLayout(nc=3)
        pm.text(label='Import Visual Smooth', width=200)
        self.smooth_radio_col = pm.radioCollection()
        self.smooth_radio_off = pm.radioButton(
            label='Off',
            onc=lambda x: pm.optionVar(iv=('gozbruh_smooth', 0)))
        self.smooth_radio_on = pm.radioButton(
            label='On',
            onc=lambda x: pm.optionVar(iv=('gozbruh_smooth', 1)))
        import_smooth = 0
        if pm.optionVar(ex='gozbruh_smooth'):
            import_smooth = pm.optionVar(q='gozbruh_smooth')
        pm.radioCollection(
            self.smooth_radio_col, e=True,
            sl=self.smooth_radio_on if import_smooth else self.smooth_radio_off)

        pm.text(label='Import Delete Old Mesh', width=200)
        self.delete_radio_col = pm.radioCollection()
        self.delete_radio_off = pm.radioButton(
            label='Off',
            onc=lambda x: pm.optionVar(iv=('gozbruh_delete', 0)))
        self.delete_radio_on = pm.radioButton(
            label='On',
            onc=lambda x: pm.optionVar(iv=('gozbruh_delete', 1)))
        import_delete = 0
        if pm.optionVar(ex='gozbruh_delete'):
            import_delete = pm.optionVar(q='gozbruh_delete')
        pm.radioCollection(
            self.delete_radio_col, e=True,
            sl=self.delete_radio_on if import_delete else self.delete_radio_off)

        pm.setParent(main_layout)
        self.retain_btn = pm.button(label="Save Settings", height=50)
        pm.text('\t')
        self.remove_btn = pm.button(label="Default Settings")

        self.gui_window.show()