Get current frame at render time with Python?
-
Hey guys,
I have a python script that reads external files on a per frame basis and modifies the scene accordingly. This works great in the viewport but when I go to render it appears as though I can no longer get current time, because I can't get "active document" anymore while it's in the render process. Can someone point me in the correct direction of getting current time/frame during render? It seems so simple, I'm sure I'm overlooking something. Thanks!! -
Hi @android first of all welcome in the plugincafe community.
This happens because when you render the scene, the scene is actually copied and then rendered in order to avoid any kind of modification while it's rendering.
If I understand correctly you are in a given context such as a python tag or a python generator. In any case please include this information in your next topics (and confirm it on this one).
Finally, if you are in such context instead of retrieving the active document, you should retrieve the current document of the current object with BaseList2D.GetDocument.
Cheers,
Maxime. -
Hi Maxime, thanks for the response! I was aware that the scene gets copied, but unaware of the GetDocument function so it definitely makes sense! I will give that a try and report back. I have been trying this with both a python effector, as well as in a python xpresso node.
Andrew