| 2688 | } |
| 2689 | |
| 2690 | void 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 | |
| 2733 | static bool overrides_external_editor(Object *p_object) { |
| 2734 | Script *script = Object::cast_to<Script>(p_object); |