GetGUID() fails when rendering
-
On 03/12/2013 at 05:30, xxxxxxxx wrote:
User Information:
Cinema 4D Version: R13-R14
Platform: Windows ;
Language(s) : C++ ;---------
EXECUTIONRESULT MyPlugin::Execute (BaseTag* tag, BaseDocument* doc, BaseObject* op, BaseThread* bt , LONG priority, EXECUTIONFLAGS flags) { LLONG foo = op->GetGUID(); }
When working in C4D and creating an animation, scrubbing the time line, testing the animation, all is fine. Variable foo will get the same value, regardless. I can close down C4D, start it up again and load the project, foo is always the same, very long, unique number.
However - when I want to render my animation, this number suddenly changes, and becomes very different, and will also vary from C4D session to the next C4D session.
Is this a known fact? Any way to circumvent it?
I need this number also when rendering, of course, otherwise my animation will not function at all. -
On 03/12/2013 at 05:54, xxxxxxxx wrote:
Hi,
Have you tried using the number given by BaseObject::GetUniqueIP() instead of BaseObject::GetGUID()?
-
On 03/12/2013 at 06:08, xxxxxxxx wrote:
Hi Yannick,
I have read several articles / posts on this subject, and from what I understand, only GetGUID will fit the bill. GetUniqueIP requires some extra action from me as I understand. GetGUID always works, except when rendering. So I am more interested in finding out to what extent this issue is caused by something I do (or don't do), and to what extent this is "by design" and how C4D works.
GetGUID is perfect, because it is always generated by C4D, and it is persistent, it is stored in the document between C4D sessions. I wonder why on earth it changes as soon as rendering starts. -
On 03/12/2013 at 11:58, xxxxxxxx wrote:
Anyone on this issue?
I have worked 5 months now on my plugins, and took this for granted, that the GetGUID() would work. From the docs:===========
LULONG GetGUID()
Returns a unique ID for any object in a document. This works for generated objects in a cache (e.g. clones generated by a MoGraph cloner) and also for "real" objects in the document (this is special, becauseGetUniqueIP()
[URL-REMOVED] does not do this).
===========_<_h4_>_
I have this code:BaseObject* fooBar = doc->SearchObject("FooBar"); if(fooBar) { GePrint("FooBar " + LLongToString(fooBar->GetGUID())); }
Which yields this result:
Can someone confirm that GetGUID() will not work when rendering? Because then I'll have to rewrite my stuff and find other solutions. Or is there something I am missing, something I misunderstand?
[URL-REMOVED] @maxon: This section contained a non-resolving link which has been removed.
-
On 03/12/2013 at 13:10, xxxxxxxx wrote:
Does that happen when rendering to the viewport, or to the PV, or both? If it's only when rendering to the PV, the document is cloned before rendering. Possibly the GUID will then also change?
-
On 03/12/2013 at 13:34, xxxxxxxx wrote:
Yes, it probably has something to do with the doc being cloned. I made this test:
GetGUID() gives a totally different number when rendering to the preview.
GetGUID() gives yet another totally different number when rendering to an image sequence.
This is easy to sum up:
GetGUID() cannot be used where an animation intended for rendering is involved. Period.I am now storing the object(s) in the container, using SetParameter(..) and retrieving them using GetParameter(..). It works, but I have to take care of certain other details that I did not have to bother with, when I used GetGUID().