Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    GetGUID() fails when rendering

    SDK Help
    0
    6
    972
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H
      Helper
      last edited by

      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.

      1 Reply Last reply Reply Quote 0
      • H
        Helper
        last edited by

        On 03/12/2013 at 05:54, xxxxxxxx wrote:

        Hi,

        Have you tried using the number given by BaseObject::GetUniqueIP() instead of BaseObject::GetGUID()?

        1 Reply Last reply Reply Quote 0
        • H
          Helper
          last edited by

          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.

          1 Reply Last reply Reply Quote 0
          • H
            Helper
            last edited by

            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, because GetUniqueIP()[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.

            1 Reply Last reply Reply Quote 0
            • H
              Helper
              last edited by

              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?

              1 Reply Last reply Reply Quote 0
              • H
                Helper
                last edited by

                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().

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post