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
    • Login

    Python Scripting Tag Global Variables

    Scheduled Pinned Locked Moved PYTHON Development
    3 Posts 0 Posters 262 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 15/07/2015 at 21:31, xxxxxxxx wrote:

      Hello Forum,

      After reading these great posts:
      https://developers.maxon.net/forum/topic/8461/11042_python-tag-catch-button-presson-parent-object&KW=user+data+button&PID=43468#43468 Thanks Niklas.
      https://developers.maxon.net/forum/topic/8312/10843_user-button-test-on-python-generator-solved&KW=user+data+button&PID=42531#42531 Thanks Sebastian.
      I realized there is much to learn about Python Scripting Tags.

      Where are the global variables for the Python Scripting Tags documented?
      By reading other posts/examples, I understand that "op" and "doc" are global variables, but I did knot know there was a global function like message(msg_type, data) : available in a scripting tag.

      I do not understand how message(msg_type, data) works in the scripting tag.  How is it getting called?  Is it like a virtual method in c++?  Are there other functions like this available?

      Thank you,

      Joe Buck

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

        On 16/07/2015 at 02:03, xxxxxxxx wrote:

        Hi Joe,

        The Python documentation is currently lacking information on Python scripting features (tags, scripts, XPresso node etc).

        main() in a Python tag is the same as TagData::Execute() and the available global variables are:
        doc : the host document of the tag.
        flags : the execution flags.
        priority : the execution priority in the pipeline (EXECUTIONPRIORITY_INITIAL, EXECUTIONPRIORITY_ANIMATION, EXECUTIONPRIORITY_GENERATOR etc).
        op : the Python tag.
        bt : the calling thread.
        tp : the TP master system for the host document if there's one.

        message(id, data) in a Python tag behaves the same as TagData::Message().
        It receives the data as Python dictionaries with the entries matching the names used in the C++ API for the structure members.
        The available global variables are the same as in main() except that flags and priority does not make sense in message().

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

          On 16/07/2015 at 08:20, xxxxxxxx wrote:

          Thank you Yannick.  This is solved.

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