userdata work around

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

On 27/08/2009 at 05:57, xxxxxxxx wrote:

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

---------
Hi
I was hoping to find a way of gathering up all my userdata from a null to put into an array, but I saw from the forum that coffee might not support this

<<"I'd like to check if an object has user data(s) , how many , and their name . Do you think it's possible in coffee ?">>

is there a work around for this? could I make a null with one userdata field, then copy and paste as many as I need and in my coffee script loop through all the nulls of the same name to find out how many userdata fields there are, or is there a much simpler way?

Kind regards Conor

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

On 27/08/2009 at 07:27, xxxxxxxx wrote:

Hi I've just been looking at kattkieru's post about "BaseContainer and user data". I have a null with two user data fields (one is 56 the other 24) and I've tried the code

main(doc,op)
{

var op = doc->FindObject("userdata");

var bc = op->GetContainer();

var i = 0;

while (bc->GetIndexId(i) != NOTOK)

{

println(bc->GetIndexData(i));

i++;

}

}

but I get

0
10.000000
1.000000
0
[Object-0x17a1d32c]

in the console window, have I completely misunderstood this code if I'm expecting it to print the contents of the user data?
Kind regards Conor

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

On 27/08/2009 at 08:01, xxxxxxxx wrote:

It's not possible to iterate through userdata in COFFEE.

Userdata can only be accessed directly in COFFEE, like this: var data = op#ID_USERDATA:1

The only workaround is described in this thread:

some COFFEE questions

For full userdata access you have to use the C++ API.

cheers,
Matthias

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

On 27/08/2009 at 08:12, xxxxxxxx wrote:

Thanks Matthias, I'll give that a go.
cheers
Conor