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 access the BaseContainer of an Command-Dialog

    Cinema 4D SDK
    r23 2023 2024 python windows
    2
    5
    830
    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.
    • ThomasBT
      ThomasB
      last edited by ferdinand

      Hi,

      when the script is called it should call the command in the timeline "Bake Object" and set the parameters in the BaseContainer and then automatically call the Button "Bake"

      I do not now how to access this, the ID's, of the command dialog.

      script:

      from typing import Optional
      import c4d
      
      doc: c4d.documents.BaseDocument  # The active document
      op: Optional[c4d.BaseObject]  # The active object, None if unselected
      
      def main() -> None:
          c4d.CallCommand(465001219)  # bake objects dialog
          tool = c4d.plugins.FindPlugin(465001219, c4d.PLUGINTYPE_COMMAND)
      
      # Here I want to access and set the dialogs parameters, set some checkboxes and press then the button
      
          # this is probably the wrong way :-)
      
          bc = tool.GetDescription(0)
          
          for ide in bc:
              print(tool.GetParameter(ide[1][0].id, 0), tool.GetParameter(ide[2][0].id, 0))  
      
      
      
      
      
      if __name__ == '__main__':
          main()
      

      Thanks,
      T.S.B

      ferdinandF 1 Reply Last reply Reply Quote 0
      • ferdinandF
        ferdinand @ThomasB
        last edited by ferdinand

        Hello @ThomasB,

        Thank you for reaching out to us. Maxon never exposes UIs, e.g., dialogs, in its APIs and a dialog also does not have data container which you could get or set.

        You can get and set the data containers for tools, but the main characteristic of a tool is that its UI lives inside the Attribute Manager instead of having its own dialog. That does not apply to the Bake Objects dialog, it is not a tool but a command (a distinction which admittedly might seem very subtle for beginners). But as always, we expose the functionalities, the logic, behind things, in this case in the form of the functions c4d.utils.InitBakeTexture and c4d.utils.BakeTexture.

        The py-texture_baker_r18.pyp example demonstrates the usage of these functions.

        Cheers,
        Ferdinand

        MAXON SDK Specialist
        developers.maxon.net

        ThomasBT 1 Reply Last reply Reply Quote 0
        • ThomasBT
          ThomasB @ferdinand
          last edited by ThomasB

          @ferdinand
          Thanks Ferdinand, but I meant the command bake objects in the timeline where you can bake the animations. For the upcoming dialog I wanted to automate the process so I need to access the dialog parameters to set it, as the user needs to set the parameters and click the button and then delete some keys, I wanted to automate this with just one click.

          But thank you, I will have a look at the py-texture_baker_r18.pyp.

          Thanks,
          T.S.B

          ferdinandF 1 Reply Last reply Reply Quote 0
          • ferdinandF
            ferdinand @ThomasB
            last edited by ferdinand

            Hey @ThomasB,

            my apologies, you were quite clear in your first posting that you meant the timeline, I simply overlooked that information. You are talking about this dialog here, right?

            d2a2c1fd-21ac-4a84-b654-0acf3eed24ee-image.png

            My answer from above applies here in general too. This is a command, and you can c4d.CallCommand it, but that is all the control you have. And other than for texture baking, the underlying functionality is unfortunately not exposed. If you wanted something like this, you would have to write it yourself (which would probably be too much work unless one REALLY, REALLY needs this).

            Cheers,
            Ferdinand

            MAXON SDK Specialist
            developers.maxon.net

            ThomasBT 1 Reply Last reply Reply Quote 0
            • ThomasBT
              ThomasB @ferdinand
              last edited by ThomasB

              @ferdinand

              This is a command, and you can c4d.CallCommand it, but that is all the control you have.
              

              thank you Ferdiand,

              Thanks,
              T.S.B

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