Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python 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
    • Recent
    • Tags
    • Users
    • Login

    GetData() always nil

    Scheduled Pinned Locked Moved SDK Help
    3 Posts 0 Posters 291 Views
    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 Offline
      Helper
      last edited by

      THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

      On 31/05/2011 at 02:11, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   11.5 
      Platform:      Mac OSX  ; 
      Language(s) :   C.O.F.F.E.E  ;

      ---------
      Hi,

      I'm trying to read out some attributes from different objects.

      for (i=0; object(i); i++) {   
                println(object(i)->GetName());   
                container = object(i)->GetContainer();   
                println(container->GetData(ID_LAYER_LINK));   
                println(container->GetData(ID_BASEOBJECT_VISIBILITY_EDITOR));   
           }
      

      The result I get is always 'nil' for the GetData() instructions. The GetName() prints out the name, so I'm doing something wrong in getting the container. How does one do this normally?

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

        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

        On 31/05/2011 at 09:46, xxxxxxxx wrote:

        That's because visibility is not a container item on an object.
        The middle section of the Basic tab on objects are descriptions. That don't exist inside of the object's container.

        Here's how to get the list of all the items in an object's container:

        var obj = doc->GetActiveObject();  
        var bc = obj->GetContainer();  
        var i = 0;  
        while (bc->GetIndexId(i) != NOTOK)  
          {  
        println(bc->GetIndexData(i));  
        i++;  
          }
        

        *Notice that if you change the visibility options. And run this code. None of them changes.

        You can just use this to change the visibility:  obj#ID_BASEOBJECT_VISIBILITY_EDITOR=1;

        But if you want to use containers with Coffee. You'll need to create a custom container to change things that are descriptions. Like this:

        //This script puts a description into a new container so it can be changed  
          
        var obj = doc->GetActiveObject();  
        var bc = new(BaseContainer);  
          
        //With new containers.  
        //You must provide your own custom ID number, and the attribute to change  
        bc->SetData(12345, obj#ID_BASEOBJECT_VISIBILITY_EDITOR=1);// Sets the Visibilty to "OFF"
        

        In Python and C++. We don't need to create containers for them.
        We can access them directly.

        -ScottA

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

          THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

          On 01/06/2011 at 02:15, xxxxxxxx wrote:

          The prefered way to access descriptions is through the # operator.

          cheers,
          Matthias

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