• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python core.connectAttr函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: create_dominant_color_shader

def create_dominant_color_shader(dag, tex_name_surfix=['co', 'color', 'diffuse', 'dif', 'base'],
                                 sample_rate=None, max_auto_sample=50,
                                 default_shader='aiStandardSurface', default_channel='baseColor'):
    """
    Create an auto average-color lambert shader and assign it to input object.
    Maybe does not work with TIFF texture ( cannot extract color ).
    """

    if type(dag) == pm.nodetypes.Transform:
        mesh = dag.getShape()
        if not type(mesh) == pm.nodetypes.Mesh:
            return None
    elif type(dag) == pm.nodetypes.Mesh:
        mesh = dag
    else:
        return None
    avg_color = _detect_dominant_color(mesh, tex_name_surfix, sample_rate,
                                       max_auto_sample, default_shader, default_channel)
    if not avg_color:
        return None

    color_shader, sg = pm.createSurfaceShader('lambert')
    color_shader.color.set(avg_color)
    pm.connectAttr(color_shader.color, sg.surfaceShader, f=1)
    pm.sets(sg, forceElement=mesh)

    return color_shader
开发者ID:duyyudus,项目名称:yudus-td,代码行数:27,代码来源:dominant_color.py


示例2: createBoundJointConstraintsAndConnectVisibility

	def createBoundJointConstraintsAndConnectVisibility(self):
		
		pm.select(cl = True)
		
		#bound joint constraint list
		self.boundJointConstraintList = []
		
		#iterate bound joint list and create orient constraint for each
		for index in range(len(self.boundJointsList)):
			pm.select(cl = True)
			self.boundJointConstraintList.append(pm.orientConstraint(self.ikSplineJointsList[index], self.ikDynamicJointsList[index], self.boundJointsList[index], mo = True))
			pm.select(cl = True)
			
		
		#create reverse node
		self.orientConstraintWeight_reverse = pm.createNode('reverse')
		pm.select(cl = True)
		
		#connect to manip dynamic blend
		self.manip_dynamic.manualDynamicBlend >> self.orientConstraintWeight_reverse.inputX
		pm.select(cl = True)
			
		#Connect Constraints to manip_dynamic
		for index in range(len(self.boundJointConstraintList)):
			pm.select(cl = True)
			pm.connectAttr(self.orientConstraintWeight_reverse.outputX, self.boundJointConstraintList[index].name() +'.' +self.ikSplineJointsList[index].name() +'W0', f = True)
			pm.connectAttr(self.manip_dynamic.manualDynamicBlend, self.boundJointConstraintList[index].name() +'.' +self.ikDynamicJointsList[index].name() +'W1', f = True)
			pm.select(cl = True)
	
	
		
		
		#Visibility
		self.orientConstraintWeight_reverse.outputX >> self.manipIkSplineTopGrp.visibility
开发者ID:gitter-badger,项目名称:rugbybugs,代码行数:34,代码来源:rbDynamicChainFromCurves.py


示例3: stretchyBack

def stretchyBack( ikHandleTorso, jntList ):
    pymelLogger.debug('Starting: stretchyBack()...')     
    #Stretchy process
    # ArcLen to create curveInfo
    curveInfoNodeBack = pm.arclen( ikHandleTorso[2], ch=True )
    # add attr to curveinfo Node (normalizedScale)
    # this will have a value coming from a multiply divide node that will be 
    # dividing the current length by the initial length of the curve
    # this will be used later to scale the joints
    pm.addAttr(curveInfoNodeBack, longName='normalizedScale', attributeType='double')
    # get initial length of the curve
    iniLen = pm.getAttr( curveInfoNodeBack + '.arcLength' )
    
    # create a node multiplydivide, operation set to division
    MDCurveBack = pm.shadingNode( 'multiplyDivide', asUtility=True )
    pm.setAttr( MDCurveBack+'.operation', 2 ) # divide
    
    # Connect curve arcLength to input1X
    pm.connectAttr( curveInfoNodeBack + '.arcLength', MDCurveBack + '.input1X', force=True )
    # Set input2X to initial length of the curve
    pm.setAttr(MDCurveBack+'.input2X', iniLen)
    # connect outpux x from multiplydivide to normalized scale of the curve info
    pm.connectAttr(MDCurveBack + '.outputX', curveInfoNodeBack + '.normalizedScale', force=True)
    
    returnList = [curveInfoNodeBack,MDCurveBack]
    
    
    pymelLogger.debug('End: stretchyBack()...')   
    return returnList
开发者ID:Mauricio3000,项目名称:MSH_Maya,代码行数:29,代码来源:Torso.py


示例4: fetch_attr

 def fetch_attr(self, source, target):
     if source is None:
         return
     elif isinstance(source, pymel.Attribute):
         pymel.connectAttr(source, target)
     else:
         target.set(source)
开发者ID:Leopardob,项目名称:omtk,代码行数:7,代码来源:classRigCtrl.py


示例5: addAOV

def addAOV( aovName, aovType = None ):
	"""docstring for addAov"""
	if aovType is None:
		aovType = aovs.getAOVTypeMap().get(aovName, 'rgba')
	if not isinstance(aovType, int):
		aovType = dict(aovs.TYPES)[aovType]
	aovNode = pm.createNode('aiAOV', name='aiAOV_' + aovName, skipSelect=True)
	out = aovNode.attr('outputs')[0]

	pm.connectAttr('defaultArnoldDriver.message', out.driver)
	filter = aovs.defaultFiltersByName.get(aovName, None)
	if filter:
		node = pm.createNode('aiAOVFilter', skipSelect=True)
		node.aiTranslator.set(filter)
		filterAttr = node.attr('message')
		import mtoa.hooks as hooks
		hooks.setupFilter(filter, aovName)
	else:
		filterAttr = 'defaultArnoldFilter.message'
	pm.connectAttr(filterAttr, out.filter)

	aovNode.attr('name').set(aovName)
	aovNode.attr('type').set(aovType)
	base = pm.PyNode('defaultArnoldRenderOptions')
	aovAttr = base.aovs
	nextPlug = aovAttr.elementByLogicalIndex(aovAttr.numElements())
	aovNode.message.connect(nextPlug)
	aov = aovs.SceneAOV(aovNode, nextPlug)
	return aov
开发者ID:skarone,项目名称:PipeL,代码行数:29,代码来源:aov.py


示例6: addAOV

    def addAOV(self, aovName, aovType=None):
        '''
        add an AOV to the active list for this AOV node

        returns the created AOV node
        '''
        if aovType is None:
            aovType = getAOVTypeMap().get(aovName, 'rgba')
        if not isinstance(aovType, int):
            aovType = dict(TYPES)[aovType]
        aovNode = pm.createNode('aiAOV', name='aiAOV_' + aovName, skipSelect=True)
        out = aovNode.attr('outputs')[0]

        pm.connectAttr('defaultArnoldDriver.message', out.driver)
        filter = defaultFiltersByName.get(aovName, None)
        if filter:
            node = pm.createNode('aiAOVFilter', skipSelect=True)
            node.aiTranslator.set(filter)
            filterAttr = node.attr('message')
            import mtoa.hooks as hooks
            hooks.setupFilter(filter, aovName)
        else:
            filterAttr = 'defaultArnoldFilter.message'
        pm.connectAttr(filterAttr, out.filter)

        aovNode.attr('name').set(aovName)
        aovNode.attr('type').set(aovType)
        nextPlug = self.nextAvailableAttr()
        aovNode.message.connect(nextPlug)
        aov = SceneAOV(aovNode, nextPlug)
        addAliases([aov])
        return aov
开发者ID:Quazo,项目名称:breakingpoint,代码行数:32,代码来源:aovs.py


示例7: Connect

def Connect(src, dst):

    pm.undoInfo(openChunk=True)

    alembics = src
    if not isinstance(src, list):
        alembics = pm.ls(src, dagObjects=True, type='transform')

    targets = dst
    if not isinstance(dst, list):
        targets = pm.ls(dst, dagObjects=True, type='transform')

    attrs = ['translate', 'rotate', 'scale', 'visibility']
    for node in targets:
        for abc in alembics:
            if node.longName().split(':')[-1] == abc.longName().split(':')[-1]:
                for attr in attrs:
                    pm.connectAttr('%s.%s' % (abc, attr),
                                   '%s.%s' % (node, attr),
                                   force=True)

                # securing primary shape is connected
                pm.connectAttr('%s.worldMesh[0]' % abc.getShape(),
                               '%s.inMesh' % node.getShape(),
                               force=True)

    pm.undoInfo(closeChunk=True)
开发者ID:mkolar,项目名称:Tapp,代码行数:27,代码来源:utils.py


示例8: connect_or_set_attr

def connect_or_set_attr(_attr, _val):
    if isinstance(_val, list) or isinstance(_val, tuple):

        # Note: List attribute and compound attribute don't have the same way of iterating.
        if _attr.isArray():
            for i, val in enumerate(_val):
                connect_or_set_attr(_attr.elementByLogicalIndex(i), val)
        elif _attr.isCompound():
            children = _attr.getChildren()
            for child, val in zip(children, _val):
                connect_or_set_attr(child, val)
        else:
            raise Exception("Can't apply value {0} on attribute {1}, need an array or compound".format(_val, _attr))

        '''
        for i, pSubValue in enumerate(_val):
            ConnectOrSetAttr(_attr.elementByLogicalIndex(i), pSubValue)
        '''
    else:
        if isinstance(_val, pymel.Attribute):
            pymel.connectAttr(_val, _attr, force=True)
        elif is_basic_type(_val):
            _attr.set(_val)
        else:
            logging.error(
                '[ConnectOrSetAttr] Invalid value for attribute {0} of type {1} and value {2}'.format(_attr.name(),
                                                                                                      type(_val),
                                                                                                      _val))
            raise TypeError
开发者ID:renaudll,项目名称:omtk,代码行数:29,代码来源:libRigging.py


示例9: main

def main():
	prefRun()
	
	center = pm.ikHandle(name="centerIK", startJoint="center1", endEffector="center13",  sol="ikSplineSolver",ns=3)
	left = pm.ikHandle(name="leftIK", startJoint="left1", endEffector="left13",  sol="ikSplineSolver",ns=3)
	right = pm.ikHandle(name="rightIK", startJoint="right1", endEffector="right13",  sol="ikSplineSolver",ns=3)
	
	pm.rename(center[2], "center_crv")
	pm.rename(left[2], "left_crv")
	pm.rename(right[2], "right_crv")
	
	clusterGrp_center = clusterCurve("center_crv")
	clusterGrp_left = clusterCurve("left_crv")
	clusterGrp_right = clusterCurve("right_crv")
	
	
	pm.connectAttr("jacketRight1.rz", clusterGrp_right+".rz")
	pm.connectAttr("jacketLeft1.rz", clusterGrp_left+".rz")
	
	pm.parent("center_crv", "rig")
	pm.parent("left_crv", "rig")
	pm.parent("right_crv", "rig")
	
	pm.parent(clusterGrp_center, "world_ctrl")
	pm.parent(clusterGrp_left, "world_ctrl")
	pm.parent(clusterGrp_right, "world_ctrl")
	
	for i in ["centerIK", "leftIK", "rightIK"]:
		pm.setAttr(i+".visibility", 0)
		pm.parent(i, "rig")
	
	for i in ['center_crv','left_crv','right_crv','center_crv_cv0_loc', 'left_crv_cv0_loc', 'right_crv_cv0_loc', 'pageTargets_grp', 'pages_grp', 'jacket_grp']:
		pm.setAttr(i+".visibility", 0)
开发者ID:maitelels,项目名称:maya_scripts,代码行数:33,代码来源:tim_pageSetupFinish.py


示例10: create_render_cam

def create_render_cam(name="RENDER_CAM", exposure=True):
    """
    Creates a camera and renames it 
    
    str name: name of the camera
    bool exposure: connect a mia_exposure_photographic node to the camera     
    """
    if not pm.objExists(name):
        cam = pm.camera()[0]
        pm.rename(cam, name)
        [cam.renderable.set(cam.name().startswith(name)) for cam in pm.ls(cameras=True)]
    cam = pm.PyNode(name)
    
    if exposure:
        if not cam.miLensShader.isConnected():
            node = pm.createNode("mia_exposure_photographic")
            node.film_iso.set(800)
            node.f_number.set(1.2)
            node.gamma.set(1)
            pm.connectAttr(node.message, cam.miLensShader, force=True)
    
    cam.getShape().setDisplayResolution(True)
    pm.lookThru(name)
    
    pm.select(cam)
开发者ID:borgfriend,项目名称:MayaTools,代码行数:25,代码来源:CameraTools.py


示例11: connectAttr_withLinearDrivenKeys

def connectAttr_withLinearDrivenKeys(attr_src, attr_dst, type='animCurveUU', force=True, kt=(-1.0,0.0,1.0), kv=(-1.0,0.0,1.0), kit=(4,2,4), kot=(4,2,4), pre='linear', pst='linear'):
    # Skip if a connection already exist
    for node in getAttrOutput(attr_src, plugs=False, skipBlendWeighted=True):
        if 'animCurveU' in node.type():
            drivenkey_outplugs = getAttrOutput(node.output, plugs=True, skipBlendWeighted=True)
            for drivenkey_outplug in drivenkey_outplugs:
                if drivenkey_outplug == attr_dst:
                    if force:
                        pymel.disconnectAttr(node.input)
                        pymel.disconnectAttr(node.output)
                        pymel.delete(node)
                    else:
                        print("Can't connect. Attribute {0} is already connected to {1} via {2}".format(
                            attr_src.longName(),
                            attr_dst.longName(),
                            drivenkey_outplug.node().longName()
                        ))
                        return

    animCurve = create_animCurveU('animCurveUU',
                                  kt=kt,
                                  kv=kv,
                                  kit=kit, # Spline/Linear/Spline
                                  kot=kot, # Spline/Linear/Spline
                                  pre=pre,
                                  pst=pst
                                  )
    animCurve.rename('{0}_{1}'.format(attr_src.node().name(), attr_src.longName()))
    pymel.connectAttr(attr_src, animCurve.input)
    return connectAttr_withBlendWeighted(animCurve.output, attr_dst)
开发者ID:renaudll,项目名称:omtk,代码行数:30,代码来源:libRigging.py


示例12: create_compound_ctrl

    def create_compound_ctrl(self, cls, inst, suffix, attr_inn_name, attr_out_name, **kwargs):
        """
        Initialize and build and connect a controller used in the Compound.
        :param cls: The desired class for the controller.
        :param inst: The current instance.
        :param suffix: A str that identify this controller.
        :param attr_inn_name: The name of the network attribute that receive the controller local matrix.
        :param attr_out_name: The name of the network attribute that will drive the controller offset world matrix.
        :param kwargs: Any keyword argument will be passed to the controller .build() method.
        :return: A controller instance of the desired type.
        """
        attr_inn = self.grp_inn.attr(attr_inn_name)
        attr_out = self.grp_out.attr(attr_out_name)
        nomenclature_anm = self.get_nomenclature_anm()

        inst = self.init_ctrl(cls, inst)
        ref_tm = attr_out.get()

        inst.build(
            name=nomenclature_anm.resolve(suffix),
            geometries=self.rig.get_meshes(),
            refs=[ref_tm],
            **kwargs
        )
        inst.setParent(self.grp_anm)

        pymel.connectAttr(inst.matrix, attr_inn)
        _connect_matrix_attr_to_transform(attr_out, inst.offset)
        return inst
开发者ID:SqueezeStudioAnimation,项目名称:omtk,代码行数:29,代码来源:classModuleCompound.py


示例13: createSubdivApproxNode

def createSubdivApproxNode():
    '''
    copy of createApproxNode from mentalrayApproxEditor.mel
    node will be named "mathildaSubdivApprox"
    '''
    # delete existing node if exists
    nodeName = 'mathildaSubdivApprox'
    
    # make sure mental ray is loaded first
    if not pm.pluginInfo('Mayatomr', q=True, loaded=True):
        pm.loadPlugin('Mayatomr', qt=True)
    
    # create approx node
    approxNode = pm.createNode('mentalraySubdivApprox', n=nodeName)
    
    # get listNode
    try:
        mrItemsListNode = pm.ls(type='mentalrayItemsList')[0]
    except IndexError:
        mrItemsListNode = pm.createNode('mentalrayItemsList', n='mentalrayItemsList')
    
    # connect approx to list
    pm.connectAttr(approxNode.message, mrItemsListNode.subdivApproxs, na=True)
    
    return approxNode
开发者ID:sayehaye3d,项目名称:ls-rigging-tools,代码行数:25,代码来源:tools.py


示例14: create_ibl

def create_ibl(* args):
    '''
    # creates an ibl
    '''
    
    my_ibl = pm.shadingNode('mentalrayIblShape', asLight= True)
    pm.connectAttr('%s.message' % (my_ibl),
                   'mentalrayGlobals.imageBasedLighting', force= True)
    pm.setAttr('%s.primaryVisibility' % (my_ibl), 1)
    pm.setAttr('%s.visibleInReflections' % (my_ibl), 1)
    pm.setAttr('%s.visibleInRefractions' % (my_ibl), 1)
    pm.setAttr('%s.visibleInEnvironment' % (my_ibl), 1)
    pm.setAttr('%s.visibleInFinalGather' % (my_ibl), 1)
    
    scene_objects = pm.ls(type= ['mesh', 'nurbsSurface', 'volumeLight',
                                'spotLight', 'directionalLight','areaLight',
                                    'pointLight', 'ambientLight'])

    bounding_box = pm.exactWorldBoundingBox(scene_objects)
    bounding_box.sort()
    
    ibl_size = bounding_box[-1]

    pm.setAttr('%s.scaleX' % (my_ibl), ibl_size)
    pm.setAttr('%s.scaleY' % (my_ibl), ibl_size)
    pm.setAttr('%s.scaleZ' % (my_ibl), ibl_size)
    
    return my_ibl
开发者ID:creuter23,项目名称:fs-tech-artist,代码行数:28,代码来源:light_rig.py


示例15: CreateFKControl

	def CreateFKControl(self, _joint, _parent, _moduleContainer):
		jointName = utils.StripAllNamespaces(_joint)[1]
		containedNodes = []
		name = "%s_fkControl" %jointName
		
		controlObjectInstance = controlObject.ControlObject()
		
		fkControlInfo = controlObjectInstance.Create(name, "sphere.ma", self, _lod = 1, _translation = False, _rotation = True, _globalScale = False, _spaceSwitching = False)
		fkControl = fkControlInfo[0]
		
		pm.connectAttr("%s.rotateOrder" %_joint, "%s.rotateOrder" %fkControl)
		
		orientGrp = pm.group(name = "%s_orientGrp", empty = True, parent = _parent)
		containedNodes.append(orientGrp)
		
		pm.delete(pm.parentConstraint(_joint, orientGrp, maintainOffset = False))
		
		jointParent = pm.listRelatives(_joint, parent = True)[0]
		
		orientGrp_parentConstraint = pm.parentConstraint(jointParent, orientGrp, maintainOffset = True, name = "%s_parentConstraint" %orientGrp)
		orientGrp_scaleConstraint = pm.scaleConstraint(jointParent, orientGrp, maintainOffset = True, name = "%s_scaleConstraint" %orientGrp)
		
		pm.parent(fkControl, orientGrp, relative = True)
		
		orientConstraint = pm.orientConstraint(fkControl, _joint, maintainOffset = False, name = "%s_orientConstraint" %_joint)
		
		containedNodes.extend([orientGrp_parentConstraint, orientGrp_scaleConstraint, orientConstraint])
		
		utils.AddNodeToContainer(_moduleContainer, containedNodes)
		
		return fkControl
开发者ID:Shadowtags,项目名称:ModularRiggingTool,代码行数:31,代码来源:fk.py


示例16: createJoints

    def createJoints(self, name=None, curve=None, num=None):
        ''' Create groups on curve. '''
        num = float(num)
        joints = []
        param_increment = 1.0/num
        param = 0
        curveshape = curve.getShape()
        prnt = []
        for i in range(int(num)):
            pm.select(clear=1)

            # create joint
            jnt = pm.joint(name='%s%s_jnt' % (name, i))
            joints.append(jnt)

            # attach to curve
            poci = pm.createNode('pointOnCurveInfo')
            pm.connectAttr('%s.ws' % curveshape, '%s.inputCurve' % poci, f=1)
            pm.connectAttr('%s.position' % poci, '%s.translate' % jnt, f=1)
            pm.setAttr('%s.turnOnPercentage' % poci, 1)
            pm.setAttr('%s.parameter' % poci, param)

            pm.disconnectAttr('%s.position' % poci, '%s.translate' % jnt)
            pm.delete(poci)

            if len(prnt):
                pm.parent(jnt, prnt[-1])

            prnt.append(jnt)
            param += param_increment

        return joints
开发者ID:Mauricio3000,项目名称:MSH_Maya,代码行数:32,代码来源:BlendSineRig.py


示例17: FTV_multiConnectAutoKeyableNonLocked

def FTV_multiConnectAutoKeyableNonLocked(src, dest, attsExcept):
	'''connect every keyable and non locked attribute of src to dest (basically connect parameters from control)'''
	atts = pm.listAttr(src, k=True, u=True)
	for a in atts:
		if a in attsExcept:
			continue
		pm.connectAttr(src+'.'+a, dest+'.'+a)
开发者ID:mathieuSauvage,项目名称:MayaFluidTextureViewer,代码行数:7,代码来源:fluidTextureViewer.py


示例18: build

    def build(self, refs=None, line_target=True, *args, **kwargs):
        """
        Will create the ctrl node and it's line target if needed
        :param refs: The reference used to attach the line target
        :param line_target: Bool to tell if we want a line target
        :param args: More args passed to the super class
        :param kwargs: More kwargs passed to the super class
        :return:
        """
        super(CtrlIkSwivel, self).build(*args, **kwargs)
        assert (self.node is not None)

        ref = next(iter(refs), None) if isinstance(refs, collections.Iterable) else refs

        # Create line
        if line_target is True and ref is not None:
            # Create a spaceLocator so the annotation can hook itself to it.
            self._line_locator = pymel.spaceLocator()
            locator_shape = self._line_locator.getShape()
            pymel.pointConstraint(ref, self._line_locator)
            self._line_locator.setParent(self.node)
            self._line_locator.hide()

            self._line_annotation = pymel.createNode('annotationShape')
            annotation_transform = self._line_annotation.getParent()
            self._line_annotation.setParent(self.node, relative=True, shape=True)
            pymel.connectAttr(locator_shape.worldMatrix, self._line_annotation.dagObjectMatrix[0], force=True)
            pymel.delete(annotation_transform)

        return self.node
开发者ID:SqueezeStudioAnimation,项目名称:omtk,代码行数:30,代码来源:rigIK.py


示例19: jointsOnCurve

def jointsOnCurve(crv=None, num=None, name=None):
    if not crv: return
    if not num: return
    if not name: return
    if num < 1: return

    param_increment = 1.0/float(num)
    param = 0
    curveShape = pm.PyNode(crv).getShape()
    prnt = []
    for i in range(num):
        pm.select(clear=1)
        # Create joint
        jnt = pm.joint(n=name+'_'+str(i).zfill(2))
        # Attach to curve
        poci = pm.createNode('pointOnCurveInfo')
        pm.connectAttr('%s.ws'%curveShape,'%s.inputCurve'%poci,f=1)
        pm.connectAttr('%s.position'%poci,'%s.translate'%jnt,f=1)
        pm.setAttr('%s.parameter'%poci,param)
        pm.setAttr('%s.turnOnPercentage'%poci,1)

        pm.disconnectAttr('%s.position'%poci,'%s.translate'%jnt)
        pm.delete(poci)

        if len(prnt):
            pm.parent(jnt,prnt[-1])

        prnt.append(jnt)
        param += param_increment
开发者ID:Mauricio3000,项目名称:MSH_Maya,代码行数:29,代码来源:snippetsCollection.py


示例20: importAbcFile

def importAbcFile():
    importFilePath=pm.textField('path_ABC2', q=True, text=True)
    #.abc를 없애준다
    filePathDeletAbc = importFilePath.replace('.abc','')

    pm.importFile( filePathDeletAbc+'.ma' )
    importAbc( filePathDeletAbc+'.abc' )
    connectionsTxtFile_open = open(filePathDeletAbc+'.txt')
    import pickle
    lst = pickle.load(connectionsTxtFile_open)
    print lst
    for geo, shd, aiShd,disShd in lst:
        cmds.select( geo )
        cmds.hyperShade( assign=shd )
        node=pm.ls(geo)[0]
        shape = node.getShape()
        shadingGrps = shape.outputs( type='shadingEngine' )
        print shadingGrps[0]
        shader=pm.ls(aiShd)[0]
        print shader
        try:
            print 'good'
            pm.connectAttr(shader.outColor,shadingGrps[0].aiSurfaceShader) 
        except:
            print 'false'
        try:
            disShader=pm.ls(disShd)[0]
            pm.connectAttr(disShader.outColor,shadingGrps[0]..displacementShader) 
        except:
            print 'no dis'
开发者ID:kyuhoChoi,项目名称:mayaTools,代码行数:30,代码来源:AlembicMasterExporter_03v.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python core.createNode函数代码示例发布时间:2022-05-25
下一篇:
Python core.confirmDialog函数代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap