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
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Unexpected ShowPopUpDialog Behavior

    Cinema 4D SDK
    r21 python
    2
    3
    305
    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.
    • B
      bentraje
      last edited by

      Hi,

      I have a bunch of image buttons where if you right click them a ShowPopUpDialog appears. The problem is it doesn't work on the third image. I'm not sure why since I didn't put any "limit" that it shouldn't work on the third image.

      You can check an illustration of the problem here:
      https://www.dropbox.com/s/13cobewho5uoqpt/c4d255_python_selective_contextual_menu_error.mp4?dl=0

      You can check the illustration file here:
      https://www.dropbox.com/s/2xhmn4ia75f0lit/c4d210_stray_pop_up_dialog02.zip?dl=0

      P.S. The problem may or may not be related to this Remove Stray ShowPopUpDialog. If it is, you can close this one.

      Thank you

      1 Reply Last reply Reply Quote 0
      • ferdinandF
        ferdinand
        last edited by ferdinand

        Hi,

        judging from the video, your popup seems to have some kind of race condition with a native popup menu of Cinema. You can also see it opening on the second element, which is very odd for happening inside a custom dialog. I do not see an obvious reason for this in your code - Message would be the first place to look into. But I also find it a bit hard to read your code due to the lack of documentation and its disregard of PEP8.

        There is also a possible problem in your code, depending on how Cinema places the gadgets - if it places some kind of padding between them. You test in is_position_on_gadget for a hit condition with:

        if not buttonData["x"] < x < buttonData["x"] + buttonData["w"]:
            return False
        if not buttonData["y"] < y < buttonData["y"] + buttonData["h"]:
            return False
        

        When the gadgets are placed like [0, 100], [100, 200] ..., where each bracket group denotes the start and end of a gadget, then you cannot distinguish between two neighbouring elements with your code if I am not overlooking something.

        Probably not very helpful all together, but I am too tired for more right now 😉

        Cheers,
        zipit

        Finding out the

        MAXON SDK Specialist
        developers.maxon.net

        1 Reply Last reply Reply Quote 1
        • B
          bentraje
          last edited by

          @zipit

          Thanks for the response.
          You are right. It should have worked if there is padding between buttons.
          For now, I just chose either buttonData["w"] or buttonData["h"].

          And it works as expected.

          RE: hard to read your code due to the lack of documentation and its disregard of PEP8

          Sorry about that.

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