SceneHook detecting render vs viewport
On 26/06/2014 at 04:12, xxxxxxxx wrote:
Cinema 4D Version: R15 Stud
Platform: Mac OSX ;
Language(s) : C++ ;
I have a scenehook plugin with is "Executed()" whenever redraw occurs. Is there a way to detect whether the the redraw is a "Render to Viewport" or a full render as opposed to an editor viewport redraw?
I also have a tool plugin which receives the start / stop render notifications. However they are only received if the tool plugin is the currently active tool. This means if some other tool is active, I do not get the start / stop render notifications.
My aim is to detect start of render and end of render so I can manipulate aspects of the scene.
How should I best achieve this?
On 26/06/2014 at 09:47, xxxxxxxx wrote:
MSG_MULTI_RENDERNOTIFICATION is sent to your SceneHook when the scene is about to be rendered.
It's not safe to do scene structure modifications in that context, though.
On 26/06/2014 at 10:53, xxxxxxxx wrote:
Understood re not making scene modifications at that time.
Is there a suitable time when I can make scene mods prior to and post render?
If not I can probably work around it however I was trying to minimise the scene footprint that the renderer has to deal with.
If not, I'm thinking that two objects, one for editor version and one for render version would work. That way the normal SetEditorMode() and SetRenderMode() controls will automatically take care of the switch between light detail and full detail for me.
On 26/06/2014 at 10:58, xxxxxxxx wrote:
Thinking about it further...
In a future plugin, I may need to move an existing object between frames. This may be just moving points in an object, or it may mean moving the whole object.
Would you not do that in the execute() animate phase? Does that count as a unsafe scene modification? If so, when should you make such changes?
On 26/06/2014 at 11:04, xxxxxxxx wrote:
it is safe to do in SceneHookData::Execute() whatever you are allowed to do from
TagData::Execute() or ObjectData::Execute(). You can of course only do the processing
when actually rendering. But this is rarely used because one usually wants to see the
changes in the Viewport, too :-)