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
    • Register
    • Register
    • Login

    Understanding SetCommandDragId

    Cinema 4D SDK
    2
    6
    1.1k
    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.
    • lasselauchL
      lasselauch
      last edited by lasselauch

      I'm having troubles to understand the SetCommandDragId function for c4d.gui.BitmapButtonCustomGui.
      I'm using the following function to add my BitmapButton to my Dialog:

          def AddIconButton(self, buttonid, title, iconid, tooltip):
              bc = c4d.BaseContainer()
              bc.SetBool(c4d.BITMAPBUTTON_BUTTON, True)
              bc.SetInt32(c4d.BITMAPBUTTON_ICONID1, iconid)
              bc.SetString(c4d.BITMAPBUTTON_TOOLTIP, tooltip)
              bc.SetInt32(c4d.BITMAPBUTTON_FORCE_SIZE, 32)
              button = self.AddCustomGui(buttonid, c4d.CUSTOMGUI_BITMAPBUTTON, title, c4d.BFH_SCALEFIT | c4d.BFV_SCALEFIT, 40, 40, bc)
              #set button.SetCommandDragId() here?!!!
              return button
      

      Even inside the CreateLayout I had no luck with FindCustomGUI() ...
      What's the best way to approach this?

      Thanks,
      Lasse

      1 Reply Last reply Reply Quote 0
      • lasselauchL
        lasselauch
        last edited by lasselauch

        I must add:

        Either they are dragable to the layout or I'm only able to press within the dialog...

        1 Reply Last reply Reply Quote 0
        • M
          m_adam
          last edited by

          Hi yes, the behavior changes a bit once you defined the BitmapCustomGui as a Button that can be dragged.

              def CreateLayout(self):
                  bc = c4d.BaseContainer()
                  bc.SetBool(c4d.BITMAPBUTTON_BUTTON, True)
                  bc.SetInt32(c4d.BITMAPBUTTON_ICONID1, c4d.Ocube)
                  bc.SetInt32(c4d.BITMAPBUTTON_FORCE_SIZE, 32)
                  button = self.AddCustomGui(10003, c4d.CUSTOMGUI_BITMAPBUTTON, "but", c4d.BFH_SCALEFIT | c4d.BFV_SCALEFIT, 40, 40, bc)
                  button.SetCommandDragId(c4d.Ocube)
                  return True
          
              def Message(self, msg, result):
                  if msg.GetId() == c4d.BFM_INTERACTEND:
                      if self.IsActive(10003):
                          print 'Icon clicked in the GeDialog.'
          

          Note that if you click on the icon directly from the Cinema 4D palette it will automatically call the CallCommand with the correct it.

          Cheers,
          Maxime.

          MAXON SDK Specialist

          Development Blog, MAXON Registered Developer

          1 Reply Last reply Reply Quote 1
          • lasselauchL
            lasselauch
            last edited by

            Thanks so much, @m_adam!
            Works like a charm!

            Cheers,
            Lasse

            1 Reply Last reply Reply Quote 0
            • lasselauchL
              lasselauch
              last edited by

              Just to reconcile:

              button.SetCommandDragId(THIS_ID) -> THIS_ID needs to be a unique PluginID, correct?

              Cheers,
              Lasse

              1 Reply Last reply Reply Quote 0
              • M
                m_adam
                last edited by

                Correct, and I would say a CommandData id.

                MAXON SDK Specialist

                Development Blog, MAXON Registered Developer

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