Ok, I have a simple object data plugin that takes a list of objects and rotates them along the timeline. It works perfectly in the editor view but won't update (looks stuck) in the picture viewer.
In the editor my objects link fine but the console when rendering says my objects are returning NoneType.
What am I missing here? Is the renderer not using my document or creating some kind of clone and not finding the objects?
Cheers mates for any thought on this.
Sounds like your objects have not built their cache yet, so they return nothing. How do you access those objects in your object plugin?
And, if the whole point is simply rotating them around, maybe an expression tag is what you actually need?
as always, please use the Q&A system to mark questions and post questions regarding the Cinema 4D API in the "Cinema 4D Development" forum.
If something works in the viewport but not in the Picture Viewer, this is typically caused by using GetActiveDocument(). This function always returns the active document - the document currently displayed in the viewport. It will not return the document currently rendered etc.
If you want to access the document your object is part of, use GetDocument().
See BaseDocument Manual.
I'm accessing the objects from an inExclude using.
doc = c4d.documents.GetActiveDocument()
inEx = op[res.MyInExcludeData]
activeObj = inEx.ObjectFromIndex(doc, i)
@fwilleke80 yes this was a python generator object that I've converted to a plugin. I'm still figuring out the basics here so sorry for the noob Q's.
I tried to replace GetActiveDocument() with GetDocument() but I don't think I'm structuring my plugin properly. I can't seem to find any resources online to figure this one out.
you cannot use c4d.documents.GetActiveDocument() in a NodeData environment. The reason being, that nodes will also be executed when a document is not the active document (while rendering for example, as a document is getting cloned for rendering).
You have to either use the document arguments provided by the methods of NodeData\ObjectData or use BaseList2D.GetDocument() on the node attached to your plugin to get the relevant document.
I would however agree with @fwilleke80, and also think, that you might be better off with a TagData plugin.
as now said multiple times, GetActiveDocument() must not be used, but GetDocument() instead.
What is the point of your In/Exclude list? Are these the objects you "rotate along the timeline"?
This is typically not how a ObjectData object works; it generates objects based on its child objects or deforms objects in its hierarchy. It is not supposed to move arbitrary other objects.
As mentioned above, a tag plugin may be the better solution. The "look_at_camera" example show such a plugin rotating its host object.