On 10/02/2015 at 04:16, xxxxxxxx wrote:
Cinema 4D Version: 16
Language(s) : C++ ;
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
GePrint("NO OBJECT FOUND")
"Do shader stuff"
I just get my NO OBJECT FOUND message.....
Does anyone know why this doesn't work?
(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.