-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Publisher: context menu option to revert each attribute to default #147
Publisher: context menu option to revert each attribute to default #147
Conversation
Maybe @Innders could chip in with ideas or whether there is some convention in AYON already. |
There does seem to be a bug though that if you click that reset button it doesn't disappear in that particular UI - but it's a decent reference. |
I do agree that right click is not good option to reset value, consideting I want to reset all attributes to default state. |
Well, not always. I usually want to revert an attribute or two - not the full instance. But if I'd want to revert 10, then yes. This will be very slow. However, the context menu could show a "shortcut" label like e.g. |
There is a separate ticket for a reset all attributes button. What's the consensus should we keep the context menu, or add a button next to each attribute. |
I find the Houdini context menu option to be a clean non distacting implementation. |
You just described hidden feature, that requires 2 clicks. But I'm not known for UX, so hard to tell. EDITED: |
I personally quite like Houdini's implementation - only if we can also match the shortcut behavior of CTRL + MMB to revert to default and the context menu label showing the shortcut. That way you can also perform the revert in one click per attribute. |
action.triggered.connect(self.reset_to_default_requested) | ||
menu.insertAction(first_action, action) | ||
|
||
def reset_to_default_requested(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The method name is not ideal. It should be something like set_to_default_value
, or private method for signal handling and in that case _on_default_value_requested
.
self.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) | ||
self.customContextMenuRequested.connect(self._on_context_menu) | ||
|
||
def _on_context_menu(self, pos): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Menu and action does not have to be stored under self
they live and die during stack of method. The same for other widgets.
self._multivalue | ||
and obj is self._input_widget | ||
and event.type() == QtCore.QEvent.FocusOut | ||
): | ||
self._set_multiselection_visible(True) | ||
return False | ||
|
||
def _on_menu_timeout(self): | ||
menu = self.findChild(QtWidgets.QMenu, "qt_edit_menu") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if all DCCs are using this name of menu, considering Houdini, Nuke, Maya and SubstancePainter etc. Could someone validate those DCCs if the right click does work for text and number fields there?
We might need to use createStandardContextMenu
if it does not work there.
So, let it in context menu with hint to use Ctrl + MMB instead (oh, Mac users will be pissed 😈 ). |
Would be Command + MMB then I suppose. No idea how that works. Didn't Qt have something built-in for that and also to labelize menu entries, etc - by Also according to Qt docs:
As such, that should handle itself? |
It was not about CTRL, you would have to find MMB :) |
🤦♂️ Of course. Anyway, not sure what Houdini does there. |
Seriously folks. Context menu is more than enough here. We're talking about something that is probably used very occasionally and it's super common to add these kinds of things to right click. It's a few attributes, so resetting all at once is really on a fringe of usefulness compared to the effort. |
Closed in favor of #986 |
Changelog Description
Publisher - now has a "Revert to default" context menu option for each menu of various widgets ( Int, Float, String and Enum)
Additional info
Paragraphs of text giving context of additional technical information or code examples.
Testing notes: