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

    Large, constant variables

    Scheduled Pinned Locked Moved PYTHON Development
    3 Posts 0 Posters 201 Views
    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 Offline
      Helper
      last edited by

      On 26/03/2013 at 15:58, xxxxxxxx wrote:

      Hello all,

      In short: I'm wondering right now what's the best way to bring in a massive list of variables that doesn't need to be "reloaded" between frames (just referenced).

      In long: I managed to jerry-rig some kind of amateur plugin that will write out particle information from a different 3D application (Houdini, in this case) that can be brought in to C4D.  I did it (don't laugh at me) by making an object-sequence-esque string of .txt files that contain each particle's position and alignment vectors.

      The dumb thing about it being that every frame python has to open and close a .txt.  Putting it all in one .txt was, needless to say, worse, since it has to open it every frame.  My ultimate question is: would it be better to/how do I bring in all the information I need (say on frame 0) and store it away on... something... in C4D...?  Am I making sense?  Should I be taking this in a completely different direction?

      Thanks a million for your time and patience with me; please let me know how I can be more clear.  When you look at something up close long enough, sometimes it's hard to explain from the beginning.

      ~Whithers

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

        On 26/03/2013 at 16:03, xxxxxxxx wrote:

        It is important to know in what environment you are working. In a Python Tag (not Tag Plugin), you
        can use a global variable and read in the file once if the variable was not initialized at the point you
        want to read from it. In a Tag Plugin, it can be done the same way, but using an instance attribute.

        -Niklas

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

          On 26/03/2013 at 16:28, xxxxxxxx wrote:

          Oh my goodness, Niklas, it was that simple.  I was thinking in a non-C4D context regarding global variables, so it just never occurred to me.

          Thank you so much.

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