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

    how can I link a button that I made to modifier

    Scheduled Pinned Locked Moved PYTHON Development
    6 Posts 0 Posters 559 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 16/07/2015 at 00:03, xxxxxxxx wrote:

      hi , 
      I have some knowledge in xpresso and trying to make simple tool , I want to link initialize button to user data button that I had created , 
      please give me a simple answer because I am beginner with python 
      **👏👏👏👏🙂🙂🙂🙂👏👏👏
      **

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

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

        Hello and welcome,

        could you please elaborate what exactly you want to do? What modifier do you talk about? What exactly do you mean with "link initialize button to user data button", what workflow do you want to create?

        Best wishes,
        Sebastian

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

          On 16/07/2015 at 13:53, xxxxxxxx wrote:

          the modifier that I am talking about is mesh deformer and I want to link the button in the picture below 
          http://i.imgur.com/wMi5DGl.png?1
          and thanks for your support

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

            On 16/07/2015 at 13:58, xxxxxxxx wrote:

            and I want to link that button to this user data that I created 
            http://i.imgur.com/1HmuhuK.png

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

              On 17/07/2015 at 07:20, xxxxxxxx wrote:

              Hello,

              I wouldn't know any Xpresso way. But you could add your userdata to a Python Generator or Python Tag. Then you could catch the event when your userdata button is pressed to use CallButton() to "press" the button on the deformer. Something like this:

                
              def message(id,data) :  
                 
                if id == c4d.MSG_DESCRIPTION_CHECKUPDATE:   
                  
                    # check if button  
                    if data["descid"][1].dtype == c4d.DTYPE_BUTTON:  
                          
                        # get id  
                        buttonID =  data["descid"][1].id  
                          
                        # lets assume that the userdata button has the ID 1  
                        if buttonID == 1:  
                              
                            # get linked "Mesh" deformer from the userdata link 2  
                            meshDeformer = op[c4d.ID_USERDATA,2]  
                              
                            if meshDeformer is not None:  
                                c4d.CallButton(meshDeformer, c4d.ID_CA_MESH_DEFORMER_OBJECT_INITIAL)  
              

              The code assumes that the userdata button has the ID 1 and that the target modifier is referenced in a userdata link field with the ID 2.

              best wishes,
              Sebastian

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

                On 19/07/2015 at 15:03, xxxxxxxx wrote:

                thanks a lot 🙂

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