Hello, I'm creating a plugin and part of what it does is create Redshift materials, but I seem to be getting this error when using the CreateShader() function. I tested graphos' example with the TextureSampler and it worked perfectly, but when I'm trying to use it within my fuction I'm getting an error.
Here's my function -
def createRedshiftMaterial(op,materials,name,texpath):
rs = Redshift()
RSMATERIAL_ID = 1000
# Get BaseDocument
doc = c4d.documents.GetActiveDocument()
# Create RS Material
c4d.CallCommand(1036759, 1000)
mat = doc.SearchMaterial("RS Material")
# Name it
mat.SetName(name)
#Assign Material
rs.SetMat(doc.GetFirstMaterial())
#Get default material node and output node
listNode = rs.GetAllNodes()
MatNode = None
OutPutNode = None
for node in listNode:
if node.GetType() == "Output":
OutPutNode = node
elif node.GetType() == "Material":
MatNode = node
if not MatNode or not OutPutNode:
return
for texture in materials[name].keys():
position = 0,0
if texture == "Color Map":
position = 200,500
mat_input = c4d.REDSHIFT_SHADER_MATERIAL_DIFFUSE_WEIGHT
# Create image path
#imagePath = "%s\\%s.tga" %(str(texpath),materials[name][texture])
if position[0] != 0:
TextureNode = rs.CreateShader(rs.TexSampler, x=20, y=200)
#TextureNode[c4d.REDSHIFT_SHADER_TEXTURESAMPLER_TEX0, c4d.REDSHIFT_FILE_PATH] = imagePath
#Expose a paramter of the material
MatNode.ExposeParameter(mat_input, c4d.GV_PORT_INPUT)
#Connect Texture shader to the material
rs.CreateConnection(TextureNode, MatNode, 0, 0)
#Connect material shader to the output
rs.CreateConnection(MatNode, OutPutNode, 0, 0)
c4d.EventAdd()
# Create Texture-Tag for our object
textag = c4d.TextureTag()
# Assign our material to the tag
textag.SetMaterial(mat)
# Set Texture-Tag Projection
textag[c4d.TEXTURETAG_PROJECTION]=c4d.TEXTURETAG_PROJECTION_UVW
# Assign material to our object
op.InsertTag(textag)
doc.InsertMaterial(mat)
op.Message(c4d.MSG_UPDATE)
c4d.EventAdd()
The error -
TextureNode = rs.CreateShader(rs.TexSampler, x=20, y=200)
File "<string>", line 350, in CreateShader
File "<string>", line 183, in _TestProperty
TypeError: 'str' object is not callable
Hello, I'm creating a plugin and part of what it does is create Redshift materials, but I seem to be getting this error when using the CreateShader() function. I tested graphos' example with the TextureSampler and it worked perfectly, but when I'm trying to use it within my fuction I'm getting an error.
Here's my function -
The error -