Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware 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

    How to open Script Manager and set what Script it is showing?

    Cinema 4D SDK
    c++
    3
    3
    375
    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.
    • kbarK
      kbar
      last edited by

      I would like to open up the Script Manager and make it display a specific script.

      Is this possible in C++ for R20 to S26?

      I saw the CodeEditor_Open function, but that seems built for a completely different purpose.

      https://www.gamelogicdesign.com
      https://www.plugins4d.com

      1 Reply Last reply Reply Quote 0
      • M
        m_adam
        last edited by m_adam

        Hi @kbar, the CodeEditor_Open function is for the Expression Manager, explanation and example can be found in the Using CodeEditor_Open() topic.

        To open the ScriptManager, the only possible way is to use CallCommand(1001084).

        Since S26 LoadPythonScript and SetActiveScriptObject have been added. The first one will load an existing script and set it as active while the second will set a script already loaded as active.
        Before S26, this is not possible, even if the GeListHead containing all BaseList2D representing a script is public (via GetScriptHead) the BaseList2D object representing a script did not expose any way to get/set its script content or even if it is active.

        Finally you can find an example in load_python_script.py, it's in Python but porting it to C++ is straightforward.

        Cheers,
        Maxime.

        MAXON SDK Specialist

        Development Blog, MAXON Registered Developer

        1 Reply Last reply Reply Quote 1
        • mikeudinM
          mikeudin
          last edited by

          @kbar I think much better to create your own Edit Script dialog with blackjack and... Save and Execute Buttons. Use GeDialog.AddMultiLineEditText with a flags DR_MULTILINE_SYNTAXCOLOR and DR_MULTILINE_PYTHON.

          Checkout my python tutorials, plugins, scripts, xpresso presets and more
          https://mikeudin.net

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