MCPcopy Create free account
hub / github.com/Redot-Engine/redot-engine / hide_unused_editors

Method hide_unused_editors

editor/editor_node.cpp:2690–2731  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2688}
2689
2690void EditorNode::hide_unused_editors(const Object *p_editing_owner) {
2691 if (p_editing_owner) {
2692 const ObjectID id = p_editing_owner->get_instance_id();
2693 for (EditorPlugin *plugin : active_plugins[id]) {
2694 if (plugin->can_auto_hide()) {
2695 _plugin_over_edit(plugin, nullptr);
2696 } else {
2697 _plugin_over_self_own(plugin);
2698 }
2699 }
2700 active_plugins.erase(id);
2701 } else {
2702 // If no editing owner is provided, this method will go over all owners and check if they are valid.
2703 // This is to sweep properties that were removed from the inspector.
2704 List<ObjectID> to_remove;
2705 for (KeyValue<ObjectID, HashSet<EditorPlugin *>> &kv : active_plugins) {
2706 Object *context = ObjectDB::get_instance(kv.key);
2707 if (context) {
2708 // In case of self-owning plugins, they are disabled here if they can auto hide.
2709 const EditorPlugin *self_owning = Object::cast_to<EditorPlugin>(context);
2710 if (self_owning && self_owning->can_auto_hide()) {
2711 context = nullptr;
2712 }
2713 }
2714
2715 if (!context || context->call(SNAME("_should_stop_editing"))) {
2716 to_remove.push_back(kv.key);
2717 for (EditorPlugin *plugin : kv.value) {
2718 if (plugin->can_auto_hide()) {
2719 _plugin_over_edit(plugin, nullptr);
2720 } else {
2721 _plugin_over_self_own(plugin);
2722 }
2723 }
2724 }
2725 }
2726
2727 for (const ObjectID &id : to_remove) {
2728 active_plugins.erase(id);
2729 }
2730 }
2731}
2732
2733static bool overrides_external_editor(Object *p_object) {
2734 Script *script = Object::cast_to<Script>(p_object);

Callers 8

_scene_closedMethod · 0.80
update_treeMethod · 0.80
_clearMethod · 0.80
update_propertyMethod · 0.80
_inspect_hovered_nodeMethod · 0.80
_push_itemMethod · 0.80
_delete_confirmMethod · 0.80

Calls 5

get_instance_idMethod · 0.45
can_auto_hideMethod · 0.45
eraseMethod · 0.45
callMethod · 0.45
push_backMethod · 0.45

Tested by 2

update_treeMethod · 0.64
_clearMethod · 0.64