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
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Array value problem

    SDK Help
    0
    3
    376
    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
      Helper
      last edited by

      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:

      User Information:
      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[12] value in a process, how can I make that call without the processing affecting MyArray[12]?

      Thanks in advance!

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

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

        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[12];
        Now myvar has the value stored in MyArray[12].  Nothing happens to the value in MyArray[12]; it's still there.
        Robert

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

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

          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.

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