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

    Problem encountered when check double click in Message() Use MSG_EDIT

    Cinema 4D SDK
    2025 python
    2
    3
    121
    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.
    • chuanzhenC
      chuanzhen
      last edited by

      Hi,
      In the tag plugin, i use MSG_EDIT in Message() to detect the double-click behavior of the mouse, and then execute some commands. However, when create tag, MSG_EDIT is also used. I tried using gui.GetInputState (c4d.BFM_INPUT_MOUSE, c4d.BFM_INPUT_DOUBLECLICK,bc) obtains specific information to distinguish between label create tag and double-click behavior, but bc no double click information is obtained.
      code:

          def Message(self, node: GeListNode, type: int, data: object) -> bool:
              if type == c4d.MSG_EDIT:
                  
                  c4d.CallCommand(200000084) # Rectangle Selection
      
                  bc = c4d.BaseContainer()
                  gui.GetInputState(c4d.BFM_INPUT_MOUSE,c4d.BFM_INPUT_DOUBLECLICK,bc)
                  if bc[c4d.BFM_INPUT_DOUBLECLICK] : 
                      print("double")
                  return True
              return True
      

      How to distinguish between these two behaviors
      Thanks for any help!

      相信我,可以的!

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

        Hi @chuanzhen,

        the TagData plugins don't receive MSG_EDIT message on single click (when user selects the tag in the Object Manager). If you receive the MSG_EDIT, it means the tag is being edited, i.e. the user has double clicked on it. Technically, it can be caused by any event that ends up in editing the tag (i.e. not only by double clicking on it in OB). This is basically why you receive this message on creation. On practice, I haven't seen in the code places, other than double clicking, that send MSG_EDIT to our tagdata objects, so it's kind of safe to assume that receiving this message is equal to having a double click.

        If you like to distinguish the MSG_EDIT that's sent on creation from the double click case, you'd need to handle this bookkeeping yourself, e.g. having some system that tracks the existence of tags in the scene and filters out the on-creation MSG_EDIT misfire.

        By the way, there's no need to check for c4d.BFM_INPUT_DOUBLECLICK, as at the time tagdata plugin receives the message the input event is already consumed, hence you won't get this information at that point.

        Cheers,
        Ilia

        MAXON SDK Specialist
        developers.maxon.net

        chuanzhenC 1 Reply Last reply Reply Quote 0
        • chuanzhenC
          chuanzhen @i_mazlov
          last edited by

          @i_mazlov Thanks

          相信我,可以的!

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