On 25/06/2018 at 22:48, xxxxxxxx wrote:
Cinema 4D Version: R19
Platform: Windows ;
Language(s) : C++ ;
I have this silly question, which I probably already know the answer to, but I ask it anyway hoping it might provide some unexpected answers I didn't yet consider ...
Is there a way for a plugin (let's say a CommandData) to know if it was called from user action selecting from the plugin menu, or when user pressed the shortcut key assigned to the plugin.
The reason for this is that I want to display a widget in the viewport as a result of calling the plugin, and that the position of this widget would be taken from the current cursor position in the viewport (when activated from shortcut) or the center of the viewport (when selected from plugin menu).
As a result of the default location of the plugin menu and the viewport(s), when user selects a plugin from the menu the cursor usually ends up somewhere at the top right of a viewport, close to the top edge. Not really a good place for the widget to be positioned.
But since the cursor is detected having a valid viewport coordinate (i.e not being "outside") the widget would be displayed at that position ... while in this case it would be better of displaying it at the center of the viewport.
Edit: link added for informational completeness: