GetData() always nil
-
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?
-
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
-
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