Interesting behaviour with loaded object..[SOLVED]
On 03/10/2014 at 07:41, xxxxxxxx wrote:
If AliasTrans doesn't work. There's no need to keep it in there just for me.
I was basically just taking a guess.
I would try the other flags like Mohamed suggested.
And if that doesn't work. Then I guess I would try to free the individual object pointers rather than the source document. And see if that works.
On 03/10/2014 at 14:03, xxxxxxxx wrote:
Scott it was the doc name i changed to
sourcedocjust for you :)
The other flags don`t look relevant at all but i could test them out..
Freeing the individual object pointers i guess is an idea..
Any word from the Maxon guys on this ie how to duplicate an object completely?
On 06/10/2014 at 02:52, xxxxxxxx wrote:
just wanted to let you know, that you are not forgotten and I'll dig into this.
But as you might know, I'm still in a learning process, so I need to ask for a bit your patience.
On 06/10/2014 at 07:02, xxxxxxxx wrote:
Thanks that`d be appreciated..
I can live with it at the moment but would like to know at some point if this is the expected behaviour and/or the right way of going about the cloning i described..
On 06/10/2014 at 08:29, xxxxxxxx wrote:
your code looks just fine (even the first). There is no AliasTrans necessary. GetClone will always give you a clone independant from the flags used.
There should be no dependancies after this call and you definetly take over the ownership. It's hard to say if this is a follow-up error. What kind of plugin are you executing your code in?
On 06/10/2014 at 14:40, xxxxxxxx wrote:
s an Object Generator plugin. A simplified version of how it flows at the moment is - The GVO function calls Function A. Function A does some stuff, and calls Function B ( which is my doc/object loader function above ) which returns the loaded BaseObject to Function A, which then returns it to the GVO. And thats about it.
Plugin is registered with the OBJECT_GENERATOR and OBJECT_INPUT flags ( although i could prob have just used generator ).
On 07/10/2014 at 00:00, xxxxxxxx wrote:
I think, I solved your problem.
Is it possible, that you are calling LoadMyObject() on every call of GVO? At least that's how a I was able to reproduce the described behaviour. Basically I suppose you are reloading the scene and importing the object from the MyObjects.c4d scene on every requested update. That's why you get the updated object only AFTER you save MyObjects.c4d. The connection is not in memory, but on your harddisc.
Just in case, I understood something wrong, here's what I did to test on my side:
I took the RoundedTube.cpp from cinema4dsdk examples, replaced the code in GVO with a call to your LoadMyObject() function. I created a new scene MyObjects.c4d containing a default cube and a default sphere and closed it. Then I called the changed RoundedTube plugin (I didn't care for elaborate code, so the sphere only showed up after a forced viewport update). Then I loaded the MyObjects.c4d and changed the sphere size. Up to now, the "rounded tube scene" is still fine. The moment I saved the MyObjects.c4d and returned to the rounded tube scene, I got the updated sphere. The reason I explained above.
On 07/10/2014 at 01:03, xxxxxxxx wrote:
I haven't tested it but guess it's enough Andreas did. In one of your above scenes you wrote you are inserting it into the currently active scene. Please be aware that in general it is forbidden to modify the current scene in any way out of a GetVirtualObjects call!
On 07/10/2014 at 02:28, xxxxxxxx wrote:
Andreas that is absolutely correct you solved it. Damnit why didn
t i see that! Im calling it from GVO and it is reloading each time.. *slow gratuitous facepalm* Thanks for taking the time!
m still getting used to what is and isnt good practice so thanks for the heads-up. What i`ll do here is i think load the object elsewhere ( possibly from Init ), and then clone and return it via my GVO routines..
Thanks for the help folks!
On 07/10/2014 at 02:43, xxxxxxxx wrote:
You are welcome. I'm glad I could help (my first solved issue as an MAXON employee, yeah! ), everybody's making errors and often it's hard to see the wood in between all those trees.
A small advice, although you might already know:
The console (to be opened from the scripts menu) is a very good friend. In conjunction with GePrint() (or its friends from the debug front) this can work miracles to get an overview, who is called how often and in what order. GVO for example is called quite often. You do good to double check your code in there and invest some time to optimize it.
And even more mighty, the good old debugger. Even though you don't have the source for C4D, you can very well use the debugger to step through your plugin. On Windows ind VisualStudio (Express is fine) simply put CINEMA 4D's exe in your project settings under Debug->Debug Command. Beginning with R15 it's a good idea to add -g_alloc=debug as command argument, for versions before R15 simply put an empty text file called c4d_debug.txt next to your cinema.exe, in order to get even more information.