Help needed with sketch material
-
I need help with the sketch material
If I want to create and apply a regular material to, say, a cube I am fine using the code below:mat = c4d.BaseMaterial(c4d.Mmaterial) # material tag = c4d.BaseTag(c4d.Ttexture) # tag tag.SetMaterial(mat) # assign material to tag obj = c4d.BaseObject(c4d.Ocube) # create cube doc.InsertObject(obj) # insert cube doc.InsertMaterial(mat) # insert material obj.InsertTag(tag) # apply tag to material
Now if I want to do the same thing with the sketch material with the analogous code:
c4d.Msketch = 1011014 # add missing descriptor for sketch material c4d.Tsketch = 1011012 # add missing descriptor for sketch tag mat = c4d.BaseMaterial(c4d.Msketch) # material tag = c4d.BaseTag(c4d.Tsketch) # tag tag.SetMaterial(mat) # assign material to tag obj = c4d.BaseObject(c4d.Ocube) # create cube doc.InsertObject(obj) # insert cube doc.InsertMaterial(mat) # insert material obj.InsertTag(tag) # apply tag to material
I get the error message:
AttributeError: 'c4d.BaseTag' object has no attribute 'SetMaterial'
I obtained the missing descriptors from the script log, but the sketch tag and material seem to behave differently than regular materials in this regard.
Help would be greatly appreciated!
-
1011012
is the sketch style tag which is not a subclass of theTextureTag
class.
To assign a sketch material to an object, you use thec4d.Ttexture
ID as well, like in your previous example.
If you want to do something with an actual sketch style tag, you can use the square bracket notation, like
SketchStyle[c4d.OUTLINEMAT_LINE_DEFAULT_MAT_V]
for the Default Visible material. -
-
It worked!
Thank you so much!