Solved Unexpected ShowPopUpDialog Behavior

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

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

@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.