TakeSystem changes bitmap [SOLVED]
-
On 31/01/2017 at 00:14, xxxxxxxx wrote:
I'd like to operate TakeSystem in Python.
github.com/PluginCafe/cinema4d_py_sdk/blob/master/scripts/takesystem/takesystem_MaterialOverride.py
This script is consulted. I'd like to replace a texture of a material by take.
materialColorParameter = c4d.DescID(c4d.DescLevel(c4d.MATERIAL_COLOR_COLOR, c4d.DTYPE_COLOR, 0))
hsv = c4d.Vector(float(i) * 0.1, 1.0, 1.0)
rgb = c4d.utils.HSVToRGB(hsv)
overrideNode = materialVariation.FindOrAddOverrideParam(takeData, material,materialColorParameter, rgb)This part was changed.
materialColorParameter = c4d.DescID(c4d.DescLevel(c4d.MATERIAL_COLOR_SHADER, c4d.DTYPE_TEXTURE, 0))
shader = c4d.BaseList2D(c4d.Xbitmap)
shader[c4d.BITMAPSHADER_FILENAME] = "Bitmap_path"
overrideNode = pathVariation.FindOrAddOverrideParam(takeData,arnold_sky,materialColorParameter, shader)I'd like to make and change bitmap Shader of a material.
When Script is carried out, a texture of a material will be None. -
On 31/01/2017 at 01:41, xxxxxxxx wrote:
Hello and welcome,
in your code you are creating a new shader but you do not insert this shader into anything (nobody owns that shader). A new shader must be inserted into the element that uses that shader using BaseList2D.InsertShader().
Alternatively, you could add the override to the shader directly and not to the material. Then you would override just the BITMAPSHADER_FILENAME parameter.
best wishes,
Sebastian -
On 31/01/2017 at 02:37, xxxxxxxx wrote:
Special thanks!!!!
I forgot Shader insert.materialColorParameter = c4d.DescID(c4d.DescLevel(c4d.MATERIAL_COLOR_SHADER, c4d.DTYPE_TEXTURE, 0))
shader = c4d.BaseList2D(c4d.Xbitmap)
shader[c4d.BITMAPSHADER_FILENAME] = "Bitmap_path"
material.InsertShader(shader)
material.Message(c4d.MSG_UPDATE)overrideNode = pathVariation.FindOrAddOverrideParam(takeData,material,materialColorParameter, shader)