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

    Passing data to a CommandData plugin from Python

    Cinema 4D SDK
    2023 2024 c++ python r25
    2
    3
    539
    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.
    • D
      danniccs
      last edited by

      Hello,

      I have a command plugin that inherits from CommandData, defined and registered in C++. I am trying to create a Python script which calls this command plugin, but I want to pass data to it so it can use that data in its Execute() function. I can modify the class in C++ if necessary. Can I do this in Python? I know I can pass data using the Message() function, but have not found a way to use that from Python.

      Thank you for the help,
      Daniel

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

        Hey @danniccs the easiest way would be to have a python script that store something in the BaseContainer of the document, you can also store BaseContainer, this way you could store multiple data in it. Then your C++ code will read these values and act accordingly.

        The second way would be to directly call your python script from your C++ plugin as shown in Python - Manual.

        Cheers,
        Maxime.

        MAXON SDK Specialist

        Development Blog, MAXON Registered Developer

        1 Reply Last reply Reply Quote 0
        • D
          danniccs
          last edited by

          Hi Maxime, thank you very much for your answer! I wasn't sure if storing things in the global document BaseContainer was a good approach, but it's working well.

          Cheers,
          Daniel

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