THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 18/12/2008 at 01:17, xxxxxxxx wrote:
Cinema 4D Version: 10 & 11
Platform: Windows ; Mac ;
Language(s) : C++ ;
I need to create keyframes from within the GetVirtualObjects() function of my ObjectData plugin. As I have learned from experience and from the SDK, this is a bad thing, because in R10 is may crash and in R11 it will crash.
What I want to do is a key frame baking function for my plugin. The user clicks a button in the plugin, I catch the click in the plugin's Message() function. I set a Bool variable "RecordMode" to TRUE. Then a loop from the first to the last frame of the scene will run, animating the document to each frame of the scene; each time triggering the GetVirtualObjects(). In the GetVirtualObjects(), I check if "RecordMode" is TRUE. If so, I want to create keyframes for several objects in the scene.
As I said, creating the keyframes directly in the GetVirtualObjects() will crash R11, because it's not thread safe. I have now two possibilities:
1. Create the keyframes in the plugin's Message() function.
This would mean to run the above mentioned loop, trigger GetVirtualObjects() and then create the keyframes. Sounds good, but unfortunately, GetVirtualObjects() always seems to be called last. Whatever keyframes I create, they're created before GetVirtualObjects() did its work.
Question: Is there a way to manually FORCE GetVirtualObjects() to be called?
2. Call a MessageData plugin to create the keyframes
Very little is known about the MessageData. As I understood it, I could call a MessageData plugin from the end of my GetVirtualObjects(). It would create the keyframes and not get me into trouble with thread stuff. I see there's also a (very) little example in the SDK.
Question: Will a MessageData plugin help me, and if so: how would I pass the required data (e.g. a Pointer to an object in the scene) to it?
Long text, sorry. I really hope somebody can help. Thanks in advance!