Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.
Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 09/06/2009 at 10:18, xxxxxxxx wrote:
User Information: Cinema 4D Version: 11 Platform: Windows ; Language(s) : C++ ;
--------- Hello,
I have built my own custom generator (object plugin derived from ObjectData), registered and working. I can add that generator to my document by clicking on the menu item that was automatically created, but what I want is to insert a new object of that generator type into the currently active document by some other command plugin (i.e. not by user-click, but by function-call).
So far I have encountered the following problems: - Obviously, I can only add objects with baseclass 'BaseObject' to the document by calling void InsertCreateObject(BaseDocument* doc, BaseObject* op, BaseObject* activeobj = NULL) but unfortunately, my object plugin has to be of baseclass 'ObjectData' which has nothing in common with 'BaseObject', so I can't add my object plugin here.
- my generator class contains a referenced BaseObject (accessible by the Get() function of NodeData) if it was created by the menu entry, but NOT if I create a new instance with gNew i.e.: MyGenerator *myGen = (MyGenerator* )(MyGenerator::Alloc()); BaseObject *object = (BaseObject* )myGen->Get(); *** object is NULL here ***
I was searching for hours, but it seems as if noone ever had this problem before. Or maybe I am missing something... ???
Cheers
On 09/06/2009 at 10:19, xxxxxxxx wrote:
Why don't you just use BaseObject::Alloc(PLUGIN_ID) ?
Greetings, Jack
On 09/06/2009 at 10:29, xxxxxxxx wrote:
can you hear that periodical thumping? That's my head trying to crack through the wooden plate of my desk!
I've seen the parameter of the Alloc function, but I was so sure that it only works with the built-in objects that I didn't even try it.
Now that I tried, it worked instantly!
Thanks a lot Jack, you saved my day
On 09/06/2009 at 14:19, xxxxxxxx wrote:
Glad I could help
Cheers, Jack