当前位置: 首页>>代码示例>>Python>>正文


Python core.getAttr函数代码示例

本文整理汇总了Python中pymel.core.getAttr函数的典型用法代码示例。如果您正苦于以下问题:Python getAttr函数的具体用法?Python getAttr怎么用?Python getAttr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了getAttr函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: writeRetimeFile

    def writeRetimeFile(viz, pubShot):
        '''
        Write the animated data on the currentTime attribute to a txt file.
        '''
        tmpPath = None
        # Return None if the attribute is not keyed.
        
        if pm.keyframe('%s.currentTime'%viz, query=True, keyframeCount=True):
            # get framelist from pod
            podFile = str(pm.getAttr('%s.podFile'%viz))
            ggcp = GtoGeometryCachePod.fromPodFile(podFile)
            ggcp.startFrame = pm.playbackOptions(q=True, animationStartTime=True)
            ggcp.endFrame = pm.playbackOptions(q=True, animationEndTime=True)
            frameList = ggcp.frameNumberList()
#             offset = float(pm.getAttr('%s.timeOffset'%viz))
#             frameList = [frame + offset for frame in ggcp.frameNumberList()]
            
            # Get curve data
            animCurveData = list()
            for frame in frameList:
                value = pm.keyframe(viz, query=True, time=[frame], attribute='currentTime', eval=True)
                assert len(value) == 1, '%s keyframes found for time %s. One expected.' % (len(value), frame)
                animCurveData.append([frame, value[0]])

            # Write it out to a temp file
            selCharName = str(pm.getAttr('%s.label'%viz))
            if not tmpPath:
                name = '_'.join(['animLib', 'bd', pubShot, selCharName, 'retime.txt'])
                tmpPath = os.path.join(tempfile.gettempdir(), name)
            fh = open(tmpPath, 'w')
            for time, value in animCurveData:
                fh.write('%s %s\n' % (time, value))
            fh.close()
            
        return tmpPath
开发者ID:davidkaplan,项目名称:tippett-codesamples,代码行数:35,代码来源:animLib.py

示例2: transImgPlnDp

def transImgPlnDp():
    #comfirmDialog for checking if ImgPln in the scene
    allTransNd = pm.ls(type='transform',fl=True)
    isImgPln = []
    for trans in allTransNd:
        if trans == 'ImagePlane_Parent_Loc':
            isImgPln.append(trans)
    if len(isImgPln) == 0:
        cfmAnswer = pm.confirmDialog( title='Confirm', message='Create New Image Plane?', button=['Yes','No'], defaultButton='Yes', cancelButton='No', dismissString='No' )
        if cfmAnswer == 'Yes':
            createImgPln()
    elif len(isImgPln) >= 1:
        camDp = -pm.getAttr(curCam+'.translateZ')
        imgPlnScale = pm.getAttr(ImgPln[0]+'.s')
        if pm.getAttr(ImgPln[0]+'.translateZ') == (camDp)*0.01:
            pm.setAttr(ImgPln[0]+'.translateX',0)
            pm.setAttr(ImgPln[0]+'.translateY',0)
            pm.setAttr(ImgPln[0]+'.translateZ',(camDp)*0.1)
            pm.setAttr(ImgPln[0]+'.s',1,1,1)
        elif pm.getAttr(ImgPln[0]+'.translateZ') == (camDp)*0.1:
            pm.setAttr(ImgPln[0]+'.translateX',0)
            pm.setAttr(ImgPln[0]+'.translateY',0)
            pm.setAttr(ImgPln[0]+'.translateZ',(camDp)*0.01)
            pm.setAttr(ImgPln[0]+'.s',0.2,0.2,0.2)
        else:
            pm.setAttr(ImgPln[0]+'.translateX',0)
            pm.setAttr(ImgPln[0]+'.translateY',0)
            pm.setAttr(ImgPln[0]+'.translateZ',(camDp)*0.1)
            pm.setAttr(ImgPln[0]+'.s',1,1,1)
开发者ID:aaronfang,项目名称:personal_scripts,代码行数:29,代码来源:afImgPanel.py

示例3: dpaf_outputsFix

	def dpaf_outputsFix(self, layer):
		"""fix image output path if renderer is vray

		:param layer: maya renderLayer name
		:return outputs_Fixed: correct image output path
		"""
		outputs_Fixed = ''
		currentRenderer = pm.PyNode('defaultRenderGlobals').getAttr('currentRenderer')

		# get current maya image format setting
		tmp_OutFormatControl = pm.getAttr('defaultRenderGlobals.outFormatControl') if currentRenderer == 'vray' else ''
		imgPrefix_vray = pm.getAttr('vraySettings.fileNamePrefix') if currentRenderer == 'vray' else ''
		imgPrefix_maya = pm.getAttr('defaultRenderGlobals.imageFilePrefix') if currentRenderer == 'vray' else ''
		imageFormatStr = ('.' + ('png' if not pm.getAttr('vraySettings.imageFormatStr') else pm.getAttr('vraySettings.imageFormatStr'))) if currentRenderer == 'vray' else ''
		
		if currentRenderer == 'vray':
			# change current setting for fixing vray output path
			pm.setAttr('defaultRenderGlobals.outFormatControl', 1)
			pm.setAttr('defaultRenderGlobals.imageFilePrefix', imgPrefix_vray if imgPrefix_vray else '', type= 'string') if imgPrefix_vray else None

		# write output path
		outputs_Fixed = pm.renderSettings(layer= layer, fullPath= 1, firstImageName= 1, lastImageName= 1)
		outputs_Fixed[0] = os.path.normpath(outputs_Fixed[0]) + imageFormatStr
		outputs_Fixed[1] = os.path.normpath(outputs_Fixed[1]) + imageFormatStr
		outputs_Fixed = ','.join(outputs_Fixed)

		if currentRenderer == 'vray':
			# restore previous setting for good
			pm.setAttr('defaultRenderGlobals.imageFilePrefix', imgPrefix_maya if imgPrefix_maya else '', type= 'string') if imgPrefix_vray else None
			pm.setAttr('defaultRenderGlobals.outFormatControl', tmp_OutFormatControl)

		return outputs_Fixed
开发者ID:davidpower,项目名称:cgru_pxfly,代码行数:32,代码来源:__init__.py

示例4: ChangeNumberOfJoints

	def ChangeNumberOfJoints(self, *args):
		self.blueprint_UI_instance.DeleteScriptJob()
		
		# Collect information from current spline module
		joints = self.GetJoints()
		numJoints = len(joints)
		
		newNumJoints = pm.intField(self.numberOfJointsField, query = True, value = True)
		
		startPos = pm.xform(self.GetTranslationControl(joints[0]), query = True, worldSpace = True, translation = True)
		endPos = pm.xform(self.GetTranslationControl(joints[numJoints - 1]), query = True, worldSpace = True, translation = True)
		
		hookObj = self.FindHookObjectForLock()
		
		rotateOrder = pm.getAttr("%s.rotateOrder" %joints[0])
		sao_local = pm.getAttr("%s:module_grp.sao_local" %self.moduleNamespace)
		sao_world = pm.getAttr("%s:module_grp.sao_world" %self.moduleNamespace)
		
		# Delete current spline module
		self.Delete()
		
		# Create new spline module with new joint count
		newInstance = Spline(self.userSpecifiedName, hookObj, newNumJoints, startPos, endPos)
		newInstance.Install()
		
		# Apply previous attribute values
		newJoints = newInstance.GetJoints()
		pm.setAttr("%s.rotateOrder" %newJoints[0], rotateOrder)
		pm.setAttr("%s:module_grp.sao_local" %newInstance.moduleNamespace, sao_local)
		pm.setAttr("%s:module_grp.sao_world" %newInstance.moduleNamespace, sao_world)
		
		self.blueprint_UI_instance.CreateScriptJob()
		
		pm.select("%s:module_transform" %newInstance.moduleNamespace, replace = True)
开发者ID:Shadowtags,项目名称:ModularRiggingTool,代码行数:34,代码来源:spline.py

示例5: create_preset

 def create_preset(self):
     '''
     # creates the file for the preset
     ******
     # file pattern
     # data = ['preset name', 'light type', 'description',
                         xform_attrs[], shape_attrs[]] 
     ******
     '''
     sel = pm.ls(selection= True)[0]
     sel_shape = sel.getShape()
     node_type = pm.nodeType(sel_shape)
     
     if 'Light' not in node_type:
         return
     
     data = []
     
     data.append('%s' % (self.field.getText()))
     
     data.append('%s' % (node_type))
     
     data.append('%s' % (self.scroll.getText()))
     
     sel_data = []
     
     sel_shape_data = []
     
     sel_attrs = pm.listAttr(sel)
     sel_shape_attrs = pm.listAttr(sel_shape)
     
     for attr in sel_attrs:
         try :
             value = pm.getAttr('%s.%s' % (sel, attr))
             temp_data = (attr , value)
             sel_data.append(temp_data)
         
         except:
             pass
         
     for attr in sel_shape_attrs:
         try:
             value = pm.getAttr('%s.%s' % (sel_shape, attr))
             temp_data = (attr , value)
             sel_shape_data.append(temp_data)
         
         except:
             pass
         
         
     data.append(sel_data)
     data.append(sel_shape_data)
     
     name ='%s.light'  % (self.field.getText())
     full_path = os.path.join(self.path, name)
     f = open(full_path, 'w')
     pickle_data = pickle.dump(data, f)
     f.close()
     
     preset_ui() # this will list will update the preset section
开发者ID:creuter23,项目名称:fs-tech-artist,代码行数:60,代码来源:light_rig.py

示例6: SetupModuleSpecificControls

	def SetupModuleSpecificControls(self):
		currentlySelectedModuleInfo = pm.textScrollList(self.UIElements["animationModule_textScroll"], query = True, selectItem = True)
		currentlySelectedModuleNamespace = None
		
		if len(currentlySelectedModuleInfo) != 0:
			currentlySelectedModuleNamespace = currentlySelectedModuleInfo[0]
			
			if currentlySelectedModuleNamespace == self.previousAnimationModule and self.selectedBlueprintModule == self.previousBlueprintModule:
				return
		
		existingControls = pm.columnLayout(self.UIElements["moduleSpecificControlsColumn"], query = True, childArray = True)
		if existingControls != None:
			pm.deleteUI(existingControls)
		
		pm.button(self.UIElements["matchingButton"], edit = True, enable = False)
		
		pm.setParent(self.UIElements["moduleSpecificControlsColumn"])
		
		moduleNameInfo = utils.FindAllModuleNames("/Modules/Animation")
		modules = moduleNameInfo[0]
		moduleNames = moduleNameInfo[1]
		
		
		if len(currentlySelectedModuleInfo) != 0:
			currentlySelectedModule = currentlySelectedModuleNamespace.rpartition("_")[0]
			
			if currentlySelectedModule in moduleNames:
				moduleWeightValue = pm.getAttr("%s:SETTINGS.%s_weight" %(self.selectedBlueprintModule, currentlySelectedModuleNamespace))
				matchButtonEnable = moduleWeightValue > 0.0001
				
				moduleIndex = moduleNames.index(currentlySelectedModule)
				module = modules[moduleIndex]
				
				pm.attrControlGrp(attribute = "%s:%s:module_grp.levelOfDetail" %(self.selectedBlueprintModule, currentlySelectedModuleNamespace), label = "Module LOD")
				
				mod = __import__("Animation.%s" %module, (), (), [module])
				reload(mod)
				
				moduleClass = getattr(mod, mod.CLASS_NAME)
				
				moduleInst = moduleClass("%s:%s" %(self.selectedBlueprintModule, currentlySelectedModuleNamespace))
				
				moduleInst.UI(self.UIElements["moduleSpecificControlsColumn"])
				
				self.UIElements["moduleSpecificControls_preferenceFrame"] = pm.frameLayout(borderVisible = False, label = "preferences", collapsable = True, parent = self.UIElements["moduleSpecificControlsColumn"])
				self.UIElements["moduleSpecificControls_preferenceColumn"] = pm.columnLayout(columnAttach = ["both", 5], adjustableColumn = True, parent = self.UIElements["moduleSpecificControls_preferenceFrame"])
				
				pm.attrControlGrp(attribute = "%s:%s:module_grp.iconScale" %(self.selectedBlueprintModule, currentlySelectedModuleNamespace), label = "Icon Scale")
				
				value = pm.getAttr("%s:%s:module_grp.overrideColor" %(self.selectedBlueprintModule, currentlySelectedModuleNamespace)) + 1
				self.UIElements["iconColor"] = pm.colorIndexSliderGrp(label = "Icon Color", maxValue = 32, value = value, changeCommand = partial(self.IconColor_callback, currentlySelectedModuleNamespace), parent = self.UIElements["moduleSpecificControls_preferenceColumn"])
				
				moduleInst.UI_preferences(self.UIElements["moduleSpecificControls_preferenceColumn"])
				
				pm.button(self.UIElements["matchingButton"], edit = True, enable = matchButtonEnable, command = moduleInst.Match)
			
			self.previousBlueprintModule = self.selectedBlueprintModule
			self.previousAnimationModule = currentlySelectedModuleNamespace
开发者ID:Shadowtags,项目名称:ModularRiggingTool,代码行数:58,代码来源:animation_UI.py

示例7: create_jointChain

def create_jointChain( IdName = 'joint', inputCurve = pm.selected(), orientation = 'xyz' ):
    
    # get number of CVs on InputCurve
    numberOfCvs = pm.getAttr( inputCurve[0] + '.cp',s=1 )
    
    # create joints on world space cv locations
    Jnts = []
    for i in range(0, numberOfCvs):
        pm.select( clear = True )
        currentCvPos = pm.pointPosition( inputCurve[0].cv[i], w=1 )
        Jnt = pm.joint( name = '_'.join( ['bn', IdName, str( i+1 )] ) )
        pm.xform( Jnt, t = currentCvPos )
        Jnts.append( Jnt )
        
    # create end joint
    pm.select( clear = True )
    endJntPos = 0.1 * ( pm.getAttr( Jnts[len(Jnts)-1].translate ) - pm.getAttr( Jnts[len(Jnts)-2].translate ) ) + pm.getAttr( Jnts[len(Jnts)-1].translate )
    endJnt = pm.joint( name = 'be_' + IdName, position = endJntPos, a = True )
    Jnts.append( endJnt )
    
    # set aim and orientation vectors, always yup
    aimDict = {}
    aimDict[orientation[0]] = 1
    aimDict[orientation[1]] = 0
    aimDict[orientation[2]] = 0
    aimVec = ( aimDict['x'], aimDict['y'], aimDict['z'] )

    orientDict = {}
    orientDict[orientation[0]] = 0
    orientDict[orientation[1]] = 0
    orientDict[orientation[2]] = 1
    orientVec = ( orientDict['x'], orientDict['y'], orientDict['z'] )
    
    # orient first joint
    JntAimConstrain = pm.aimConstraint( Jnts[1], Jnts[0], aimVector = aimVec, upVector = (0,1,0), worldUpType = "scene" )
    pm.delete( JntAimConstrain )
    Jnts[0].jointOrient.set( Jnts[0].rotate.get() )
    Jnts[0].rotate.set( 0,0,0 )
    
    # orient middle joints
    for i in range( 1, len( Jnts ) - 1 ):
        JntAimConstrain = pm.aimConstraint( Jnts[i+1], Jnts[i], aimVector = aimVec, upVector = orientVec, worldUpType = "objectrotation", worldUpVector = orientVec, worldUpObject = Jnts[i-1] )
        pm.delete( JntAimConstrain )
        Jnts[i].jointOrient.set( Jnts[i].rotate.get() )
        Jnts[i].rotate.set( 0,0,0 )
    
    # orient last joint
    Jnts[len( Jnts ) -1 ].jointOrient.set( Jnts[len( Jnts ) -2 ].jointOrient.get() )
    
    # parent joints
    for i in range( 1, len( Jnts ) ):
        pm.parent( Jnts[i], Jnts[i-1], absolute = True)

    pm.select( Jnts[0] )
    print('Successfully created and oriented joint-chain. Continuing...')
    return Jnts
开发者ID:kyuhoChoi,项目名称:mayaTools,代码行数:56,代码来源:jo_varFk.py

示例8: matchPos

def matchPos(src="", args=[], type=1, ws=True, silent=True):
    """
    Function: takes a source and matches its position to the args
    Args = src=string/PyNode, args=list of strings/PyNodes, type=int, ws=boolean
    State: type=1: parentConstraint solution
           type=2: PyNode transform solution
           type=3: string transform solution
           type=4: xform -w solution
           ws=world space if true, object if false
    Returns: None
    Example Usage: matchPos(type=4,sel=True,ws=False)
    """
    # store the seleciton as arguments if sel==True
    if args == []:
        sel = pm.ls(sl=True)
        if len(sel) <= 1:
            pm.error("Not enough objects selected numbskull")
        args = sel[1:]
        src = sel[0]
    if not silent:
        print "Positioning %s\nOn object %s" % (",".join(map(str, args)), src)
    # convert all the list to PyNodes if type==2
    if type == 2:
        if isinstance(src, basestring):
            src = pm.PyNode(src)
        count = 0
        for arg in args:
            if isinstance(arg, basestring):
                args[count] = pm.PyNode(arg)
            count += 1
    # otherwise get on to the matching!
    for tgt in args:
        if type == 1:
            pc = pm.parentConstraint(src, tgt)
            pm.delete(pc)
        if type == 2:
            tgt.t.set(src.t.get())
            tgt.r.set(src.r.get())
            tgt.s.set(src.s.get())
        if type == 3:
            pm.setAttr((tgt + ".t"), pm.getAttr(src + "t"))
            pm.setAttr((tgt + ".r"), pm.getAttr(src + "r"))
            pm.setAttr((tgt + ".s"), pm.getAttr(src + "s"))
        if type == 4:
            pm.xform(
                tgt,
                t=pm.xform(src, t=True, q=True, ws=ws),
                ro=pm.xform(src, ro=True, q=True, ws=ws),
                s=pm.xform(src, s=True, q=True, ws=ws),
            )
        if type == 5:
            attrs = []
            for attr in ["tx", "ty", "tz"]:
                if tgt.attr(attr).isLocked():
                    attrs.append(attr[1])
            pm.delete(pm.pointConstraint(src, tgt, skip=attrs))
开发者ID:creuter23,项目名称:tools,代码行数:56,代码来源:lib_position.py

示例9: update_velocity_grid_export

 def update_velocity_grid_export(self, param_name):
     grp = "OpenVDBVelocityGrids"
     attr_value = pm.getAttr(param_name)
     pm.textFieldGrp(grp, edit=True,
                     text="" if attr_value is None else attr_value,
                     changeCommand=lambda val: pm.setAttr(param_name, val))
     pm.scriptJob(parent=grp,
                  replacePrevious=True,
                  attributeChange=[param_name,
                                   lambda: pm.textFieldGrp(grp, edit=True,
                                                           text=pm.getAttr(param_name))])
     self.setup_velocity_grid_popup(grp, param_name)
开发者ID:redpawfx,项目名称:openvdb-render,代码行数:12,代码来源:AEvdb_visualizerTemplate.py

示例10: create

    def create( self ):

        #
        # Create Kinect2 Joints
        #
        aimer = []
        for kjot in self.k2map:
            tag = self.k2map[kjot][0]
            aimid = self.k2map[kjot][2]
            aim = None if aimid is None else self.k2map[aimid][0]
            aimv = (1,0,0)

            t = pm.xform( tag, q=True, ws=True, t=True )
            pm.select( cl=True )
            pm.joint( p=t, n=kjot )

            if not aim is None:
                aimv = (-1,0,0) if pm.getAttr(aim+'.tx') < 0 else aimv
                aimer.append(pm.aimConstraint( aim, kjot, aim=aimv, wut='objectrotation', u=(0,1,0), wu=(0,1,0), wuo=tag ))
        pm.delete( aimer )

        #
        # Make Joints Hierarchy
        #
        for kjot in self.k2map:
            parent = self.k2map[kjot][1]
            aimid = self.k2map[kjot][2]
            if not parent is None:
                pm.parent( kjot, self.k2map[kjot][1] )
                if aimid is None:
                    pm.setAttr( kjot+'.jointOrient', (0,0,0) )

            # Freeze Transformations
            pm.makeIdentity( kjot, a=True, jo=False, t=False, r=True, s=False, n=0, pn=True )

        #
        # Make Constraint
        #
        for kjot in self.k2map:
            tag = self.k2map[kjot][0]
            aimid = self.k2map[kjot][2]
            aim = None if aimid is None else self.k2map[aimid][0]
            aimv = (1,0,0)

            # Aim Constraint
            pm.pointConstraint( tag, kjot )

            # Aim Constraint
            if not aim is None:
                aimv = (-1,0,0) if pm.getAttr(aim+'.tx') < 0 else aimv
                pm.aimConstraint( aim, kjot, aim=aimv, wut='objectrotation', u=(0,1,0), wu=(0,1,0), wuo=tag )

        return
开发者ID:crystalsu2008,项目名称:MayaMiscTools,代码行数:53,代码来源:temp.py

示例11: cbsStart

def cbsStart(*args, **kwargs):
    base = kwargs.setdefault('base', pm.ls(sl=True)[0]) # (string) The base model for the character
    shape = kwargs.setdefault('shape') # (string) The shape node of the base model
    tweak = kwargs.setdefault('tweak') # (string) The tweak node of the base model that is being skinned
    skin = kwargs.setdefault('skin') # (string) The skinCluster node that is driving the base model
    
    #gather some info
    base, shape, tweak, skin = gatherInfo(base, shape, tweak, skin)
    verts = pm.polyEvaluate(base, v=True)
    
    #do a quick check to make sure this part hasn't been done before
    if base.hasAttr('baseTransform'):
        pm.error('You have already run the "Start" function on this model, so it is already ready to go.' +
                 'If corrections have already been made, click "Extract Shape to finish the process"')

    for i in pm.listHistory(base, lv=1):
        if i.type() == 'polySmoothFace':
            pm.error('The selected shape is connected to a smooth modifier. This hinders the ability to track edits. %s must be deleted.' % i)
    
    #turn off a couple things that might mess with things
    pm.symmetricModelling(e=True, symmetry= False)
    pm.softSelect(e=True, softSelectEnabled=False)


    for i in range(verts):

        x = pm.getAttr(('%s.vlist[0].vertex[%i].xVertex'%(tweak, i)))
        y = pm.getAttr(('%s.vlist[0].vertex[%i].yVertex'%(tweak, i)))
        z = pm.getAttr(('%s.vlist[0].vertex[%i].zVertex'%(tweak, i)))

        if not (x+y+z) == 0:
            pm.error('You have used the tweak node. No me gusta. If you really wanna clear it, run clearTweaks and try again. It will save what you have')

    #ok, let's get started, first instance the original mesh
    sculptTrans = pm.instance(base, n=('%s_corrective_sculpt'%base))[0]
    pm.reorderDeformers(skin, tweak, base)
    pm.setAttr('%s.v'%base, False)

    #Here, we'll make a duplicate of the base to look back on later if need be (for instance, using sculpt geometry tends to not register on tweak)
    baseRef = pm.duplicate(base, n='%s_editReference'%base)[0]
    pm.connectAttr(('%s.outMesh' %baseRef.getShapes()[1]), ('%s.inMesh' %baseRef.getShape()))

    #We'll also hook up the original so we can get it later
    pm.addAttr(sculptTrans, ln='baseTransform', at='message')
    pm.addAttr(sculptTrans, ln='baseReference', at='message')
    pm.connectAttr('%s.message'%base, '%s.baseTransform'%sculptTrans)
    pm.connectAttr('%s.message'%baseRef, '%s.baseReference'%sculptTrans)

    #now to keep things from changing between functions, we'll lock the three nodes involved in the
    #other script so our pesky little user won't delete or rename anything
    pm.lockNode(base, l=True)
    pm.lockNode(sculptTrans, l=True)
开发者ID:jadamburke,项目名称:abxStudio,代码行数:52,代码来源:na_bsCorrectiveSculpt.py

示例12: checkFresnelUseIOR

 def checkFresnelUseIOR(self, nodeName):
     fullAttr = '%s.%s'%(nodeName, "Fresnel_use_IOR")
     fresIorValue = pm.getAttr(fullAttr)
 
     fullAttr = '%s.%s'%(nodeName, "specular_Fresnel")
     specFresValue = pm.getAttr(fullAttr)
     dim = (specFresValue is False) or (fresIorValue is True)
     pm.editorTemplate(dimControl=(nodeName, "Ksn", dim))
     
     fullAttr = '%s.%s'%(nodeName, "Fresnel")
     refFresValue = pm.getAttr(fullAttr)
     dim = (refFresValue is False) or (fresIorValue is True)
     pm.editorTemplate(dimControl=(nodeName, "Krn", dim))
开发者ID:haggi,项目名称:OpenMaya,代码行数:13,代码来源:AEuberShaderTemplate.py

示例13: face_mesh_query

def face_mesh_query():
    transforms = []
    transforms.append(py.getAttr('Blend_Morph.translate'))
    transforms.append(py.getAttr('Blend_Morph.rotate'))
    transforms.append(py.getAttr('Blend_Morph.scale'))
    py.setAttr('master_locator_grp.translate', transforms[0], type="double3")
    py.setAttr('master_locator_grp.rotate', transforms[1], type="double3")
    py.setAttr('master_locator_grp.scale', transforms[2], type="double3")

    py.setAttr('master_offset_grp.translate', transforms[0], type="double3")
    py.setAttr('master_offset_grp.rotate', transforms[1], type="double3")
    py.setAttr('master_offset_grp.scale', transforms[2], type="double3")
    py.hide('Blend_Morph')
开发者ID:coxevan,项目名称:tech_art_tools,代码行数:13,代码来源:definitions.py

示例14: update_channel

 def update_channel(self, channel_name, param_name):
     grp = "OpenVDB%sChannelGrp" % channel_name
     attr_value = pm.getAttr(param_name)
     pm.textFieldGrp(grp, edit=True,
                     text="" if attr_value is None else attr_value,
                     changeCommand=lambda val: pm.setAttr(param_name, val))
     pm.scriptJob(parent=grp,
                  replacePrevious=True,
                  attributeChange=[param_name,
                                   lambda : pm.textFieldGrp(grp, edit=True,
                                                           text=pm.getAttr(param_name))])
     self.clear_popups(grp)
     pm.popupMenu(parent=grp, postMenuCommand=lambda popup, popup_parent: AEvdb_visualizerTemplate.setup_popup_menu_elems(popup, popup_parent, param_name))
开发者ID:redpawfx,项目名称:openvdb-render,代码行数:13,代码来源:AEvdb_visualizerTemplate.py

示例15: attrTextFieldGrp

def attrTextFieldGrp(*args, **kwargs):
    """
    There is a bug with attrControlGrp and string attributes where it ignores
    any attempt to edit the current attribute.  So, we have to write our own
    replacement
    """
    attribute = kwargs.pop('attribute', kwargs.pop('a', None))
    assert attribute is not None, "You must passed an attribute"
    changeCommand = kwargs.pop('changeCommand', kwargs.pop('cc', None))
    if changeCommand:
        def cc(newVal):
            pm.setAttr(attribute, newVal)
            changeCommand(newVal)
    else:
        cc = lambda newVal: pm.setAttr(attribute, newVal)

    if kwargs.pop('edit', kwargs.pop('e', False)):
        ctrl = args[0]
        pm.textFieldGrp(ctrl, edit=True,
                    text=pm.getAttr(attribute),
                    changeCommand=cc)
        pm.scriptJob(parent=ctrl,
                     replacePrevious=True,
                     attributeChange=[attribute,
                                      lambda: pm.textFieldGrp(ctrl, edit=True,
                                                              text=pm.getAttr(attribute))])
    elif kwargs.pop('query', kwargs.pop('q', False)):
        # query
        pass
    else:
        # create
        labelText = kwargs.pop('label', None)
        if not labelText:
            labelText = pm.mel.interToUI(attribute.split('.')[-1])
        ctrl = None
        if len(args) > 0:
            ctrl = args[0]
            pm.textFieldGrp(ctrl,
                            label=labelText,
                            text=pm.getAttr(attribute),
                            changeCommand=cc)
        else:
            ctrl = pm.textFieldGrp(label=labelText,
                                   text=pm.getAttr(attribute),
                                   changeCommand=cc)
        pm.scriptJob(parent=ctrl,
                     attributeChange=[attribute,
                                      lambda: pm.textFieldGrp(ctrl, edit=True,
                                                              text=pm.getAttr(attribute))])
        return ctrl
开发者ID:Quazo,项目名称:breakingpoint,代码行数:50,代码来源:utils.py


注:本文中的pymel.core.getAttr函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。