def texture_sampler(texture, uvs_list=None):
'''
Create a textureSampler node
:param texture_node: Path to texture node like "ramp1"
:param uvs_list: List of uvs like [(0.0, 0.5), (0.5, 1.0)]
'''
texture_attr = texture + '.outColor'
if not cmds.objExists(texture_attr):
raise Exception('texture must have an outColor attribute')
texture_node = cmds.shadingNode('textureSampler', asUtility=True)
sampler = TextureSampler(texture_node)
sampler.inColor = texture_attr
uvs_list = uvs_list or [(0.5, 0.5)]
sampler.set_uvs(uvs_list)
return sampler
评论列表
文章目录