how can I link a button that I made to modifier



  • 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 
    **👏👏👏👏🙂🙂🙂🙂👏👏👏
    **



  • 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



  • 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



  • 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



  • 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



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

    thanks a lot 🙂


Log in to reply