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

    Frame All command on Spline User Data

    Cinema 4D SDK
    python 2023
    2
    8
    1.5k
    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.
    • G
      gsmetzer
      last edited by gsmetzer

      I have a python tag where I can manipulate the knots of a Spline User Data. However the spline and knots often go out of range when editing. How can I call the 'Frame All' command with python to keep the spline nicely framed while using? Thank you for any help. Screenshot 2023-11-14 at 12.43.45 AM.png

      1 Reply Last reply Reply Quote 0
      • G
        gsmetzer
        last edited by

        I'm assuming this menu specific to the SPLINEDATA user-data is not accessible via python tag. Anyone have another idea to be able to automatically frame your spline in the window?

        1 Reply Last reply Reply Quote 0
        • G
          gsmetzer
          last edited by

          Ok, I have found the command in C++. Is there any way to implement this C++ command via python tag? I am getting a change in the Spline User-Data when calling this in the python tag:

          container[c4d.DESC_CUSTOMGUI] = c4d.IDC_SPLINE_FRAME_ALL

          However this line of code just kills my user data gui.
          I must be close to being able to call this command from a python tag, is there anything I am missing or could try?

          https://developers.maxon.net/docs/cpp/2024_0_0/group___i_d_c___s_p_l_i_n_e.html#gacf7f59f521655282b7d514bb7b3822aa

          1 Reply Last reply Reply Quote 0
          • i_mazlovI
            i_mazlov
            last edited by

            Hi @gsmetzer ,

            In your next postings please consider accompanying your questions with a code snippet showcasing the problem in the context you have. Otherwise creating the context code from scratch on our side does nothing else than leading to reduced efficiency and bigger delays in answers.

            Regarding your question. The general answer is no, it's not actually possible to do so from the Python Generator, because the SplineCustomGui is sealed inside the code.

            Regarding the IDC_SPLINE_FRAME_ALL, one's supposed to use it as a separate basecontainer in the Command() function, which is not exposed to python. Setting this id in your userdata container results in nothing (good).

            Cheers,
            Ilia

            MAXON SDK Specialist
            developers.maxon.net

            1 Reply Last reply Reply Quote 1
            • G
              gsmetzer
              last edited by

              Thank you @i_mazlov for your reply. I have made a project here for download with the Spline User Data as simple as I could make the file.

              I wonder if there is a way to externally call a separate C++ script command from python? I cannot find anything online. Would this be possible as a plugin? Thank you for any thoughts here.

              https://www.dropbox.com/scl/fi/quhrfhygp25r0uqjvhqg3/testSplineUserData_03.c4d?rlkey=r5qf1na6dgspubzs6af2wgb4b&dl=0

              Also, here is my python tag code:

              import c4d
              
              
              def main():
                  
                  bc = c4d.BaseContainer()
              
                  bc[c4d.DESC_NAME] = 'Motion Design'
              
                  bc[c4d.DESC_CUSTOMGUI] = c4d.CUSTOMGUI_SPLINE
                 
                  #c4d.IDC_SPLINE_FRAME_ALL  This is the C++ command I want to call to frame my spline
                 
                  
                  
                  print(c4d.IDC_SPLINE_FRAME_ALL)
              
                  op.SetUserDataContainer([c4d.ID_USERDATA, 1], bc)
              
                  #The intention is to always frame the spline knots when they are positioned outside the frame they always stay in view for the user. 
                  #I cant write any c++ So I am looking for a way to externally call this C++ command. (Or an alternative)
                  
                  #Additionally, the twirl down menu also frames the spline, if I had a way to twirl this down from python that could also work. 
                  
              
              
              1 Reply Last reply Reply Quote 0
              • i_mazlovI
                i_mazlov
                last edited by

                Hi @gsmetzer ,

                Thank you for providing a visual and descriptive sample scene.

                Generally speaking, you cannot use functions that are not exposed into python. There can be a slight chance of having a workaround depending on each specific scenario. Unfortunately, in the case of SplineCustomGui you cannot call Command() unless you're using C++ API.

                In case you like to pursue the C++ way, the possible workaround could be to move away some functionality from your python plugin to a c++ plugin and create an interaction between them. For example, you could have a very simple CommandData plugin that only covers your framing all functionality, and all the rest resides in your python plugin that interacts with the command data plugin when necessary.

                Cheers,
                Ilia

                MAXON SDK Specialist
                developers.maxon.net

                G 1 Reply Last reply Reply Quote 1
                • G
                  gsmetzer @i_mazlov
                  last edited by

                  Thank you @i_mazlov

                  An external C++ command will have to wait until my skills develop.

                  Last question on this topic and then I'm done.

                  Is there any way to allow this triangle next to the 'Spline' User-Data can unfold. i.e. I want to be able to unfold from python. How can I access? Thank you
                  GabrielScreenshot 2023-11-17 at 12.23.12 PM.png

                  1 Reply Last reply Reply Quote 0
                  • i_mazlovI
                    i_mazlov
                    last edited by

                    Hi Gabriel,

                    Sorry for the delay in this thread.

                    Unfortunately you cannot control this folding GUI functionality as it is sealed to the non-public GUI implementation. That would not be the case when using custom GUI implementations.

                    Cheers,
                    Ilia

                    MAXON SDK Specialist
                    developers.maxon.net

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