Repository: godotengine/godot (language: cpp)

Issue:
Make Sub-Resources Unique shortcut does nothing
### Tested versions

4.3 beta1 and earlier
Not sure when it started, but it was functional at least in 3.5 🙃

### System information

Windows 10.0.19045 - Vulkan (Forward+) - dedicated NVIDIA GeForce GTX 1060 (NVIDIA; 31.0.15.4633) - Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz (8 Threads)

### Issue description

I have a shortcut for Make Sub-Resources Unique:
![image](https://github.com/godotengine/godot/assets/2223172/257ad8de-e84b-4323-a415-48a7b4da9304)
but pressing the shortcut, regardless where is the focus, does nothing. It used to be functional, but it might've broken long ago (I noticed it earlier, but forgot to report).

### Steps to reproduce

1. Assign a shorctut to Make Sub-Resources Unique (it doesn't have one by default)
2. Create a CollisionShape2D and add a Shape
3. Duplicate the node
4. Press the shorctut
5. Resize the shape in duplicated node
6. Both shapes get resized

### Minimal reproduction project (MRP)

N/A


Discussion / hints:
> but pressing the shortcut, regardless where is the focus, does nothing.

![Image](https://github.com/user-attachments/assets/b76e0ae0-9c96-4e18-a16f-71e86aa2084f)

It looks like it works fine when you focus on the shape property.
Indeed, but given how I usually want to duplicate single resource, it's rather useless. If I have to focus the resource, I can as well right-click it and duplicate via context menu.
I'm interested in fixing this, but I haven't been able to locate where this shortcut is being processed.
I was able to find that the shortcut gets detected inside of here:
https://github.com/godotengine/godot/blob/0c763602f9d737d1ded25f7eacfc79d0492931cb/scene/main/scene_tree.cpp#L1318-L1320

by removing that check, I was able to use the shortcut without having to focus on the properties.
I assume that we would be able to fix this issue by checking if `p_input` is equivalent to the `Make Sub-Resources Unique` shortcut.
I need help here though, as I don't really know how I can do that.
Maybe the popup menu has wrong shortcut context? It's set explicitly with `set_shortcut_context()`.
> Maybe the popup menu has wrong shortcut context?

How can I check it?
Find where the menu/button is created and see if it has context assigned. Then find some working menu and compare the contexts.
It might be created in this script:

https://github.com/godotengine/godot/blob/8c6dbff6d35eb613c83f065c408a49ab02fa7f67/editor/inspector_dock.cpp#L765-L786

https://github.com/godotengine/godot/blob/8c6dbff6d35eb613c83f065c408a49ab02fa7f67/editor/inspector_dock.cpp#L120-L202

other menus have the shortcut context set to as `set_shortcut_context(this)`
but I wasn't able to fix it by giving related menu parts the shortcut context
I'm really lost now. I've been trying to find the MenuButton or Button, I've looked almost everywhere on the call stack and tried to add shortcut contexts to ones that are missing, but none of them really did anything.
I've tried them inside `editor_resource_picker.cpp` and `popup_menu.cpp` too.
Could I be missing something?
The shortcut context with this button is set here:
https://github.com/godotengine/godot/blob/a7146ef807a7676f51a8a63cf4441ad647f4be66/editor/inspector_dock.cpp#L753
So the shortcut is functional only if the inspector is focused.

It seems the shortcut have existed since #42109, which is the PR that implemented contexts. I tried removing it and it doesn't seem to cause problems. The menu has no default shortcuts so removing the context should be safe.

Fix patch:
diff --git a/editor/inspector_dock.cpp b/editor/inspector_dock.cpp
index dc2fc72a48b5..036c0eca9b6b 100644
--- a/editor/inspector_dock.cpp
+++ b/editor/inspector_dock.cpp
@@ -750,7 +750,6 @@ InspectorDock::InspectorDock(EditorData &p_editor_data) {
 	object_menu = memnew(MenuButton);
 	object_menu->set_flat(false);
 	object_menu->set_theme_type_variation("FlatMenuButton");
-	object_menu->set_shortcut_context(this);
 	property_tools_hb->add_child(object_menu);
 	object_menu->set_tooltip_text(TTR("Manage object properties."));
 	object_menu->get_popup()->connect("about_to_popup", callable_mp(this, &InspectorDock::_prepare_menu));


Test patch: