-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Allow copying property path from inspector. #39404
Conversation
534e8ca
to
78c8c74
Compare
There are 2 related PRs right now: #39398 and #34892 The reason I bring this up is that if the all 3 were going to be merged, the shortcut for your feature would need to changed to Ctrl + Shift + C for consistency (my scene tree PR changes Copy Node Path to this shortcut). But this is probably not important for now, as it's uncertain which of these PRs are going to make it 🤔 |
@KoBeWi it seems like your PR adds I'm thinking we should add two separate editor shortcuts, "property_editor/copy_property_path" and "property_editor/copy_property", so the user can create individual bindings for either, both separate from "copy_node_path". |
(BTW I'm trying to combine the two efforts now) |
NVM, I misread. Your interpretation of accelerators is correct. |
@KoBeWi I think I combined the two in a way that makes sense. Now the popup menu has options for "copy property (ctrl+c)", "paste property (ctrl+v)", and "copy property path (ctrl+shift+c)". The keybindings work -- I followed the same pattern that seemed to be used for other popup menus with shortcuts, e.g. https://github.com/rcorre/godot/blob/d110aa421b04312e428baf93e97f40049e452381/editor/scene_tree_dock.cpp#L2467. |
I'm getting these warnings though, which I haven't figured out, as
Its also weird that it throws for those two, but not |
@HEAVYPOLY This hasn't been merged yet so it's not included in 3.2.3 RC 3. Or do you mean that you cherry-picked this PR manually and made your own build? |
d110aa4
to
6166f30
Compare
I just backported to 3.2 here and it seems to work. I don't have a mac to test on though. |
@akien-mga Ah my mistake. Look forward to trying this in the next release! |
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.
Needs rebase, but otherwise looks good.
EDIT:
Well, seems like there is issue with Ctrl+V changing pivot if compatible node is selected (e.g. Sprite). The inspector doesn't correctly grab focus. This wasn't important before, but now that we have this inspector-specific shortcut, this should be solved somehow. Not sure how though, it could be done in another PR.
EDIT2:
Also you need to squash the commits and update the commit message.
651f528
to
99e7124
Compare
@KoBeWi I see what you're saying about the pivot shortcut, though it also conflicts with the existing copy/paste node shortcuts, so it seems like a more general problem that needs to be solved outside the context of this. Is there a customizeable shortcut for changing the pivot? I couldn't find it (even typing |
The shortcut is just V and it's not customizable. It wouldn't be a problem if clicking a property would focus the inspector. |
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.
Wait, actually there is one thing that needs to be changed. Inspector creates many EditorProperties at once and creating a menu for each of them is inefficient. They should be created on demand. See #50530 Just add a method _ensure_popup()
and call it each time the popup is supposed to open.
Another thing which will be relevant after #51722 is that you need to block the popup and shortcuts when the property is readonly (by using is_read_only()
).
02930b9
to
909628c
Compare
The popup is now created just-in-time. I'm assuming that if it is readonly, I should block the paste shortcut, but not the popup as a whole, since copy/copy_path should still be allowed, right? |
You are right, only paste should be blocked. btw I now noticed that shortcut checking in |
909628c
to
e4630a6
Compare
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.
Looks good now.
Will need update if #51983 gets merged first.
I don't see it mentioned in the OP, but from the last screenshot... does this implement godotengine/godot-proposals#3098? |
Partially, Open in Help would be missing. |
Yeah, and reset I guess? But since the proposal is based around the problem of copying the path, I think we can say that it closes it, and maybe do a follow-up PR that adds extra options. |
I wouldn't close the proposal, rather just leave a comment that it's halfway there. |
Aand #51983 was merged. |
Resolves godotengine/godot-proposals#106. Adds the following property menu options with default bindings: - Copy Property (ctrl+c) - Paste Property (ctrl+v) - Copy Property Path (ctrl+shift+c) If you hover over a property label in the inspector dock, you can copy either the property value or the property path to the system clipboard using the shortcuts above This is especially useful for the `AnimationTree`, where code might reference properties like "parameters/state/aim/move/blend_position". One issue is that if you click a property, then click on the node you currently have selected in the node tree, then press ctrl+shift+c, it will still copy the selected property path rather than the node path. If you click on a different node in the nodetree, however, ctrl+shift+c will return to copying the nodepath. The property value copy/paste was implemented by @KoBeWi at godotengine#39398 and merged into this PR due to their similarity.
e4630a6
to
0205fff
Compare
Thanks! |
This would require a dedicated PR for |
Pretty sure I still have the old |
A backport to |
If you hover over a property label in the inspector dock and press
the "property_ediotr/copy_property_path" shortcut (ctrl+c by default),
the complete property path will be copied to the system clipboard. This
is especially useful for the
AnimationTree
, where code might referenceproperties like "parameters/state/aim/move/blend_position".
Resolves godotengine/godot-proposals#106.
One issue is that if you click a property, then click on the node you
currently have selected in the node tree, then press ctrl+c, it will
still copy the selected property path rather than the node path. If you
click on a different node in the nodetree, however, ctrl+c will return
to copying the nodepath.