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

    Updade script only after frame change?

    Scheduled Pinned Locked Moved PYTHON Development
    3 Posts 0 Posters 347 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 20/05/2016 at 06:28, xxxxxxxx wrote:

      Hello community,

      I'm very green to python but working on it 🙂
      So I haven't found something useful in the web or here with the search... so I hope someone can help me.
      I've a script that needs to be updated only if the actual frame is changed! Is this possible?

      My version is the R17 Student on win 10.

      Best regards
      liquidlights

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

        On 20/05/2016 at 13:46, xxxxxxxx wrote:

        Hi
        Can you use a Python Tag on a null object? That will run on every frame.

        -b

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

          On 23/05/2016 at 07:22, xxxxxxxx wrote:

          Hi liquidlights,

          welcome to the Plugin Café forums 🙂

          As you say, that you have a script that needs to be updated per frame, are you talking about a script in the sense of a script in C4D's Script Manager. Then the answer is: No, it's not possible. Such a script runs only, when it is executed by the user.

          Bonsak's suggestion would be one way to achieve something being "constantly" evaluated. But you have to be aware that the script of a Python tag is run within the scene evaluation pipeline.

          This has several implications:
          The code is not only run, when the current frame is changed, but on several other occasions as well. So for your purpose you will have to store the document time (GetTime()) and compare if it changed.
          More important, your code is executed in a threaded context and you are not allowed to do any changes to the scene (apart from your tag and its parent object).

          I hope this helped.

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