THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 05/04/2011 at 00:37, xxxxxxxx wrote:
Cinema 4D Version: 12
Platform: Windows ;
Language(s) : C.O.F.F.E.E ;
Is there a way to dynamically construct a variable name?
E.g. I have variables Title1, Title2, Title3, and so on (it's a big list).
I want to use a loop to set each Title variable rather than manually specify each Title.
Is there a way for me to construct the variable name and then assign a value to it?
Just to clarify, arrays won't work for me because these Title(n) variables are outputs on an Xpresso COFFEE node.
On 05/04/2011 at 01:58, xxxxxxxx wrote:
No, that's not possible.
On 05/04/2011 at 02:47, xxxxxxxx wrote:
Because all your outputs are defined in the node, you can do this:
var myArray = new(array,4);
myArray = 123;
myArray = 0.456;
myArray = 11.1;
myArray = -234;
On 05/04/2011 at 03:21, xxxxxxxx wrote:
This is possible in Python. You can iterate over ports of a node(to get the name) or any variable in any scope and read/set it's values.
On 28/04/2011 at 04:10, xxxxxxxx wrote:
Just some samplecode (Python) :
\>>>locs = locals()
\>>>for i in range(20) :
locs['number%s'%i] = i
1 5 17 19
name 'number20' is not defined
<traceback object at 0x5fca7d4>