On 23/06/2016 at 13:47, xxxxxxxx wrote:
Hello Forum,
I'm trying to sample a bitmap shader with code inside a Python Generator object. When the BITMAPSHADER_FILENAME is just set to a file name('somtjpg.jpg') and the file is inside the tex folder in the same directory as the document, InitRender() returns INITRENDERRESULT_ASSETMISSING. If BITMAPSHADER_FILENAME == the full path to the file, InitRender() returns INITRENDERRESULT_OK.
If I just set BITMAPSHADER_FILENAME like inside the Python Generator:
original_color_shader[c4d.BITMAPSHADER_FILENAME] = bitmap_path
the actual material in the document gets updated. I do not want this.
Here is my questionable solution that clones the shader and sets the path:
original_color_shader = material[c4d.MATERIAL_COLOR_SHADER]
if not original_color_shader:
return
bitmap_filename = original_color_shader[c4d.BITMAPSHADER_FILENAME]
bitmap_path = c4d.GenerateTexturePath(doc.GetDocumentPath(), bitmap_filename, "")
color_shader = original_color_shader.GetClone()
color_shader[c4d.BITMAPSHADER_FILENAME] = bitmap_path
This works, but seems hacky.
Is cloning the shader necessary?
Also, I would like to know if c4d.GenerateTexturePath() sets up paths properly for Team Render Server?
Thank you,
Joe Buck