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

    Creating Attribute manager controls

    PYTHON Development
    0
    30
    20.8k
    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
      Helper
      last edited by

      THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

      On 25/05/2011 at 08:54, xxxxxxxx wrote:

      Did you get the button to actually work Rui?
      I can get other things to work like check boxes..But not Buttons:

      def Message(self, tag, type, bc) :  
        bc = tag.GetDataInstance();  
          
        if bc.GetLong(c4d.XRAY)== True:  #This works  
          print "CheckBox Enabled"  
            
        if bc.GetLong(c4d.CLICK_ME)== True:  #<-----This does not work!!  
          print "Button Pushed"    
      

      Maybe I need to get and check the state of the button?

      -ScottA

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

        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

        On 25/05/2011 at 09:34, xxxxxxxx wrote:

        Hm I could now look it up and i used this:

        def GetMessageID(data) :  
          try:  
              return data["id"][0].id  
          except:  
              return None
        

        cheers

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

          THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

          On 25/05/2011 at 14:09, xxxxxxxx wrote:

          What I have now (and fully working) is something like this:

          def Message(self, tag, type, data) :

          if not type: return True
          if type<>18: return True

          but=data.values()[0]

          if but[0].id==1001:
              # stuff

          if but[0].id==1002:
              # stuff

          return True

          Would this be what you need, Scott?
          Thank you all for the help 🙂

          Rui Batista

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

            THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

            On 25/05/2011 at 15:14, xxxxxxxx wrote:

            Yeah.. That helps a lot Rui.
            But it doesn't seem to work with ID names

              
            if but[0].id==1006:     print "button enabled" #<---Works  
              
            if but[0].id==CLICK_ME: print "button enabled" #<---Does Not Work!
            

            I'm sure there's a good reason for why the ID names don't work. But it's not the end of the world to have to use the ID numbers.

            Where did you find this?:type<>18
            I've never seen that before. And I'm wondering what it means.
            Is that a C4D SDK thing. Or is that something that is built into the Python language?

            -ScottA

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

              THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

              On 25/05/2011 at 15:43, xxxxxxxx wrote:

              Actually I found out by trial&error.;
              I just placed a print type inside the Message procedure. I noted the values. Then I placed a:

              if type==(numbers the I noted, one by one) :
              print data

              And when I compared the type with 18, it printed out:

              (1001, 8, 100000011)

              Not a very elegant way to find out, but it did the trick. However, I don't know what the 18 means 😉

              Rui Batista

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

                THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                On 25/05/2011 at 16:49, xxxxxxxx wrote:

                LOL. Whatever it takes.
                You don't want to know what goes through my head in order for me to use pointers in C++ 😉

                The main reason I was curious about it is because your code doesn't work when I try to use it on something other than a button. Like say a checkbox for example.
                I thought that maybe the "if type<>18: " meant "if the type is a button".
                So I was curious if there were other numbers that would allow things like checkboxes to work in a similar manner.

                I guess I'll have to try them out too. And see if anything happens.

                Thanks for the information.
                -ScottA

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

                  THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                  On 25/05/2011 at 21:58, xxxxxxxx wrote:

                  Your ID is not wokring because of the missing prefix. 😉

                  c4d.CLICK_ME

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

                    THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                    On 26/05/2011 at 02:20, xxxxxxxx wrote:

                    With this simple example of what happened to me I realized once more that the documentation for python in Cinema4D is still very sparcely arranged, lacking a lot of stuff and not very clean in general 😞
                    One has to do lots of questions, lots of digging in and a whole lot of trial&error; attempts to get even the simplest results 😞

                    Rui Batista

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

                      THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                      On 26/05/2011 at 05:30, xxxxxxxx wrote:

                      I donÄt understand what you want to do with type != 18.. ?!
                      The GetMessageID function works fine for me. It returns the pressed GUI Element's ID, i.e. a button's id.

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

                        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                        On 26/05/2011 at 07:21, xxxxxxxx wrote:

                        Originally posted by xxxxxxxx

                        Your ID is not wokring because of the missing prefix. 😉

                        c4d.CLICK_ME

                        Son of a @#@$#@$#@#@!!!.
                        I swear to God. That frakin' c4d. prefix is out to get me. 😂
                        I thought I had finally squashed that prefix demon...Guess not.

                        Instead of going round and round. And telling us it works for you in two threads nux.
                        Why not take that plugin example I posted. And add the button code to it and show us?
                        You have my permission to do that.

                        -ScottA

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

                          THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                          On 26/05/2011 at 08:13, xxxxxxxx wrote:

                          And where is the GetMessageID information?
                          I typed it in the search field of the python documentation and nothing appeared 😞

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

                            THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                            On 26/05/2011 at 10:52, xxxxxxxx wrote:

                            @Rui:
                            The function is self-made. 😉

                            Originally posted by xxxxxxxx

                            Hm I could now look it up and i used this:

                            def GetMessageID(data) :  
                              try:  
                                  return data["id"][0].id  
                              except:  
                                  return None
                            

                            cheers

                            @Scott:
                            So it's still not working for you ? (my english is too bad -.-)
                            I will tomorrow post you an absolutely fully working example !

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

                              THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                              On 26/05/2011 at 12:38, xxxxxxxx wrote:

                              Originally posted by xxxxxxxx

                              So it's still not working for you ? (my english is too bad -.-)
                              I will tomorrow post you an absolutely fully working example !

                              Yes. Using the .c4d prefix works. 👍
                              I was just yelling at myself for making such a stupid mistake. That I thought I had stopped myself from making anymore.

                              Please do post a working example with your button code in it.
                              Feel free to use the plugin I posted.  Or one of your own if you prefer.
                              Whatever is easier.

                              -ScottA

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

                                THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                                On 26/05/2011 at 14:36, xxxxxxxx wrote:

                                I changed my plug-in tag to use the GetMessageID(data) function and the id names.
                                I guess that the type check for 18 allow the procedure to terminate sooner if no button is being pressed but I also removed that check.
                                It is working just fine, now 🙂
                                Thank you all, once again.

                                Rui Batista

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

                                  THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                                  On 27/05/2011 at 07:10, xxxxxxxx wrote:

                                  So, here it is. A fully working example of a TagData Plugin demonstrating the use of descriptions.

                                  http://www.file-upload.net/download-3462169/PyTag-Example.rar.html

                                  Cheers,
                                  Niklas

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