New context-menu backend
Issue #549
resolved
Currently, it seems the only way to extend context menu items in Odin (right-clicking on inspector members) is through the use of the ContextMenuAttribute
. It would be great going forward if a more powerful backend for context menu extension could be designed, allowing developers full control.
Comments (3)
-
-
reporter I had no idea! That works perfectly given that the drawer API is already quite strong, thanks.
-
reporter - changed status to resolved
- Log in to comment
Currently, if a drawer on a property implements the IDefinesGenericMenuItems interface, that interface will be invoked with an instance of a GenericMenu, and can add items to the menu as it pleases, to do anything at all. [ContextMenu] is just a convenient way to hook into this for small one-off cases. So far, this mechanism of extension has seemed sufficient to us, since, if you want to only add menu items to a property without drawing anything, you can set the drawer’s priority to be so low that it will never draw anything (or set SkipWhenDrawing to true), causing it to only exist for such things as the generic menu extension.
So, unless you feel this could be done better, I think this issue can be resolved right away.