THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 16/02/2003 at 05:51, xxxxxxxx wrote:
Cinema 4D Version: 7.303
Platform: Mac ;
Language(s) : C.O.F.F.E.E ;
I have a basic problem I can't solve - how to work with array values without affecting the array itself? I understand arrays are referenced directly...
Say if I have an array MyArray, size 48, then want to get the MyArray value in a process, how can I make that call without the processing affecting MyArray?
Thanks in advance!
On 16/02/2003 at 09:51, xxxxxxxx wrote:
What do you mean by "affecting" [sic]? To retrieve a variable from an array, you just assign it to another variable:
var myvar = MyArray;
Now myvar has the value stored in MyArray. Nothing happens to the value in MyArray; it's still there.
On 16/02/2003 at 11:32, xxxxxxxx wrote:
That's how I thought it worked.... the problem is actually a bit weirder I've discovered. The plugin works as expected the first time it's run, the second time one of the array values is affected by the processing of the first time. The array is stored as a global variable, and I don't seem able to clear it between runs, have tried everything, setting to null, gc(), re-constructing it at end, no luck.
The 'culprit' is a Struppercase and another related routine, I got them here from Samir, but they work fine in another plugin where they look up values from objects, obj->GetName(). And like I say, they work fine with the array too the first time after load up of plugin, but then use a processed value in the subsequent runs.
It's not a major issue as it's purely a cosmetic error - I get an all UPPERCASE prompt in the dialog, I'm just a bit spooked by this. Are global values in a basic modal dialog plugin not supposed to be cleared between runs?
I'm happy to post the code here, if people are interested. It's quite long though, but some might like it - it's a basic commandline interface plugin.