你好我不会创建具有多个功能的类中的每个功能,我需要,所以我这样做是为了创建自己的公众成员,但它给了我一个错误Python类和公共成员
import maya.cmds as cmds
class creatingShadingNode():
def _FileTexture(self, name = 'new' , path = '' , place2dT = None):
# craeting file texture
mapping = [
['coverage', 'coverage'],
['translateFrame', 'translateFrame'],
['rotateFrame', 'rotateFrame'],
['mirrorU', 'mirrorU'],
['mirrorV', 'mirrorV']
]
file = cmds.shadingNode ('file' , asTexture = 1 , isColorManaged = 1 , n = name + '_file')
if not place2dT:
place2dT = cmds.shadingNode ('place2dTexture' , asUtility = 1 , n = name + '_p2d')
for con in mapping:
cmds.connectAttr(place2dT + '.' + con[0] , file + '.' + con[1] , f = 1)
if path:
cmds.setAttr(file + '.fileTextureName' , path, type = 'string')
self.File = file
self.P2d = place2dT
test = creatingShadingNode()._FileTexture(name = 'test' , path = 'test\test')
print test.File
我得到第1行: “NoneType”对象有没有属性“文件”
你的问题是什么?你认为'createShadingNode()._ FileTexture(name ='test',path ='test \ test')'返回什么? – Goyo