0

nurbsPlane を作成し、平面にイメージを配置したいと思います。これをPythonで実行したいのですが、これは私がこれまでに持っているものです:

import maya.cmds as cmds

class image(object):
    def __init__(self,name):
        cmds.nurbsPlane(axis=(0,0,0),width = 10)
        cmds.image( image=name )

name='C:\Desert.jpg'
temp = image(name)
4

1 に答える 1

2
import maya.cmds as cmds

class image(object):
    def __init__(self,name):
        plane = cmds.nurbsPlane(axis=(0,0,0),width = 10)
        shader = cmds.shadingNode('surfaceShader', asShader=True)
        SG = cmds.sets(empty=True, renderable=True, 
                       noSurfaceShader=True, name=shader+"SG")
        cmds.connectAttr(shader+'.outColor', SG+".surfaceShader",
                         force=True)
        img = cmds.shadingNode('file', asTexture=True)
        cmds.setAttr(img+'.fileTextureName', name, type='string')
        cmds.connectAttr(img+'.outColor', shader+'.outColor',
                         force=True)
        # you should connect to a texture placement node and
        # its numerous connectins here
        cmds.sets(plane[0], edit=True, forceElement=SG)


name=r'C:\Desert.jpg'
temp = image(name)

これは、ビューポートをテクスチャリングとシェーディングに変更したことを前提としています。とにかく、アトリビュートを適切に配置ノードに接続する必要があります。

PS:これはやりたくないかもしれませんが、代わりにイメージ プレーン ノードを使用するつもりでした。

于 2013-03-07T20:38:08.283 に答える