Detect camera movements
-
On 15/09/2017 at 03:11, xxxxxxxx wrote:
User Information:
Cinema 4D Version: R16
Platform: Windows ;
Language(s) : C++ ;---------
In fact I'm looking for the generic (I supose there is one) callback system to detect changes on the scene inside my object.It should get the notification to reflect some changes on it, probably this is a trivial question if you know how that callback system works but I didn't find where I should start.
Thank you in advance.
-
On 20/09/2017 at 00:04, xxxxxxxx wrote:
Hi Victor, thanks for writing us and sorry for getting back you with a slight delay.
With reference to your question, you can approach the task of intercepting a camera update (whatever it's affecting the position rather than its parameters) by using two different approaches:
- inside GeDialog and GeUserArea or in MessageData-derived plugin you can rely on overriding the CoreMessage() method and intercepting the EVMSG_CHANGE you could check if the camera of interest has been impacted by a change.
- inside a SceneHookData-derived plugin you can rely on the Execute() method to catch the active editing camera via BaseDraw::GetEditorCamera() and check there for potential changes occurred between the current editor camera state and the state stored in the SceneHookData-derived plugin.A few additional notes:
- the EVMSG_CHANGE notifies only about the fact that "something" has changed in the scene and not what actually changed; i warmly suggest you to have a look here where CoreMessages are properly explained
- the Execute() method gets executed when the scene is evaluated. Beside this consider that other classes (like ObjectData, TagData, ...) expose the Execute() method as well.Best, Riccardo
-
On 25/09/2017 at 02:37, xxxxxxxx wrote:
Thank you!
I started with scenehook but probably I didn't understand its usage totally.
I have an object in the scene (custom class derived from ObjectData) and I registered a scene hook on its constructor.
Unfortunatly I cannot determine when that hook is called, the registered is called when I change my object params and I cannot manage to trigger the Execute on that hook when I modify other objects (cams).
Is there any example on this? I've searched in the forums but it looks that it has been used mostly for drawing info on top of meshes and so.
Regards
-
On 27/09/2017 at 00:12, xxxxxxxx wrote:
Forget about that registering it in PluginStart did the work
-
On 27/09/2017 at 01:45, xxxxxxxx wrote:
Hi Victor, great to hear you fixed.
With reference to SceneHook-derived plugins please have also a look at this example on GitHub.
Best, Riccardo