pymel.core.modeling.transferShadingSets

transferShadingSets(*args, **kwargs)

Command to transfer shading set assignments between meshes. The last mesh in the list receives the shading assignments from the other meshes. In query mode, return type is based on queried flag.

Flags:
Long name (short name) Argument Types Properties
sampleSpace (spa) int ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
 
Selects which space the attribute transfer is performed in. 0 is world space, 1 is model space. The default is world space.
searchMethod (sm) int ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
 

Specifies which search method to use when correlating points. 0 is closest along normal, 3 is closest to point. The default is closest to point.Flag can appear in Create mode of commandFlag can have multiple arguments, passed either as a tuple or a list.

Derived from mel command maya.cmds.transferShadingSets

Example:

import pymel.core as pm

# make a low res sphere with shaders
low = pm.polySphere( sx=6, sy=6 )[0]
lowShape = pm.listRelatives( low, fullPath=True, shapes=True )[0]
redSG = pm.sets( r=True, em=True )
redMat = pm.shadingNode( "lambert", asShader=True )
pm.setAttr( redMat + ".color", 1, 0, 0, type='double3' )
pm.connectAttr( redMat + ".outColor", redSG + ".surfaceShader", f=True )
greenSG = pm.sets( r=True, em=True )
greenMat = pm.shadingNode( "lambert", asShader=True )
pm.setAttr( greenMat + ".color", 0, 1, 0, type='double3' )
pm.connectAttr( greenMat + ".outColor", greenSG + ".surfaceShader", f=True )
pm.sets( lowShape + '.f[0:17]', e=True, fe=redSG )
pm.sets( lowShape + '.f[18:36]', e=True, fe=greenSG )
# make a high res sphere
high = pm.polySphere( sx=20, sy=20 )[0]
highShape = pm.listRelatives( high, fullPath=True, shapes=True )[0]
pm.xform( high, ws=True, t=(2, 0, 0) )
# transfer the shading sets
pm.select( low, r=True )
pm.select( high, tgl=True )
pm.transferShadingSets( sampleSpace=1 )

Previous topic

pymel.core.modeling.transferAttributes

Next topic

pymel.core.modeling.trim

Core

Core Modules

Other Modules

This Page