GetActiveDocument in Team Render



  • On 14/09/2013 at 11:15, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   15 
    Platform:      
    Language(s) :     C++  ;

    ---------
    Hi everyone,
    I've been trying to update a plugin for R15, and I'm running into an issue with finding documents in Team Render. Using GetActiveDocument() worked in the old Netrender (it returned the document that was rendering), but it seems to return an empty document in Team Render.

    Here's some code I've been testing with:

      
      BaseDocument * doc = GetFirstDocument();  
      BaseObject * obj;  
      
      while(doc) {  
          GePrint("doc: " + doc->GetDocumentName().GetString());  
          obj = doc->GetFirstObject();  
          while(obj) {  
              GePrint(obj->GetName());  
              obj = obj->GetNext();  
          }  
          doc = doc->GetNext();  
      }  
    

    This loops through all the documents and prints their names and the top level objects in each of them. In Netrender R13 I get 'client.c4d' and a list of the scene's objects, but in Team Render I get 'Untitled 1' and no objects, regardless of the scene (and the correct scene is still rendering, but I don't know how to get to it).

    Does Team Render have a different/new way to access documents?

    My plugin is a FalloffData - which doesn't get a BaseDocument fed into it anywhere (except for some messages, which also don't seem to be called in the Team Render), which is why I'm using GetActiveDocument().

    If anyone has any advice that'd be amazing, I'm really struggling with this one!

    Thanks,
    Dan



  • On 16/09/2013 at 08:00, xxxxxxxx wrote:

    Hi Dan,

    Unfortunately I can not help you with this. I've redirected your questions to the developers and
    will report back.

    Best regards,
    -Niklas



  • On 16/09/2013 at 12:25, xxxxxxxx wrote:

    That'd be great, thanks Niklas!



  • On 17/09/2013 at 03:50, xxxxxxxx wrote:

    Hi Dan,

    I'll cite the answer I got from the developers:

    Current Limitation - There is no document in the falloff structure passed and no linkage to the main document, so unless the falloff has a link to an object in scene in it's description/container or the userdata has been filled with the document in the FalloffDataData function then this isn't possible.

    The internal Object falloff works by using the linked objects own GetDocument() routine.

    Best,
    -Niklas



  • On 17/09/2013 at 05:19, xxxxxxxx wrote:

    Hi Niklas,
    Thanks for your reply. Based on your answer I think I might be missing something. My plugin's container is full of object links, and you've suggested I could use those to get the document. What I'm really after is those objects, but I don't know how to get to them without having the document first - the basecontainer GetLink functions require a document to be passed to retrieve those objects. If there's another way to get the objects without knowing the document that would solve my problem as well.

    Best,
    Dan



  • On 18/09/2013 at 01:57, xxxxxxxx wrote:

    BaseLink* l = bc->GetLink();
    l->ForceGetLink()
    will probably work



  • On 18/09/2013 at 02:27, xxxxxxxx wrote:

    Hi Dan,

    you can pass NULL to BaseContainer::GetLink(). This is equal to using BaseLink::ForceGetLink(). It is
    not an ideal solution, but there is no other and the internal Object Falloff does the same. Using
    GetLink(doc) just gives you an additional layer of security, so this is still the preferred way to
    access links when a document is available.

    Best,
    -Niklas



  • On 18/09/2013 at 03:32, xxxxxxxx wrote:

    Ok great, thanks Niklas and Michael, I'll give that a go.



  • On 22/09/2013 at 14:28, xxxxxxxx wrote:

    Hi Niklas and Michael - I just had a chance to try that out this weekend, and passing NULL for the document has been working just fine, thanks for your help!


Log in to reply