Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.
Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).
On 10/02/2015 at 04:16, xxxxxxxx wrote:
User Information: Cinema 4D Version: 16 Platform: Language(s) : C++ ;
--------- Hi everyone.
I'm having a problem with a shader I've created which gets various values from a BaseObject and converts them to colour values for the shader.
It works fine in the viewport (and renders fine there too) but it seems that the object doesn't get passed when I render to picture viewer.
This appears to be where it goes wrong:
INITRENDERRESULT MiscShaderPluginClass::InitRender(BaseShader* sh, const InitRenderStruct& irs) { BaseContainer* dat = sh->GetDataInstance(); target = dat->GetObjectLink(SDK_OBJECTLINK, GetActiveDocument()); // Gets the linked object if (!target) { GePrint("NO OBJECT FOUND") return INITRENDERRESULT_UNKNOWNERROR; } else{ "Do shader stuff" return INITRENDERRESULT_OK; } }
I just get my NO OBJECT FOUND message..... Does anyone know why this doesn't work?
Thanks,
Adam (sorry about the slightly weird code formatting)
On 10/02/2015 at 04:45, xxxxxxxx wrote:
Probably the active document is not the same the one you are rendering (maybe a temp copy). Try passing sh->GetDocument() to GetObjectLink() instead of GetActiveDocument().
On 10/02/2015 at 04:53, xxxxxxxx wrote:
Amazing. Worked like a charm.
Thanks.
Adam