Add additional plugin path checks (3.2)
Need for compatibility after #45316.
This commit is contained in:
parent
aa7c298788
commit
eb98ddf2c7
2 changed files with 18 additions and 8 deletions
|
@ -491,11 +491,7 @@ void EditorNode::_notification(int p_what) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < addons.size(); i++) {
|
for (int i = 0; i < addons.size(); i++) {
|
||||||
if (addons[i].begins_with("res://")) {
|
set_addon_plugin_enabled(addons[i], true);
|
||||||
set_addon_plugin_enabled(addons[i], true);
|
|
||||||
} else {
|
|
||||||
set_addon_plugin_enabled("res://addons/" + addons[i] + "/plugin.cfg", true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
_initializing_addons = false;
|
_initializing_addons = false;
|
||||||
}
|
}
|
||||||
|
@ -3210,7 +3206,11 @@ void EditorNode::_update_addon_config() {
|
||||||
project_settings->queue_save();
|
project_settings->queue_save();
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditorNode::set_addon_plugin_enabled(const String &p_addon, bool p_enabled, bool p_config_changed) {
|
void EditorNode::set_addon_plugin_enabled(String p_addon, bool p_enabled, bool p_config_changed) {
|
||||||
|
|
||||||
|
if (!p_addon.begins_with("res://")) {
|
||||||
|
p_addon = _to_absolute_plugin_path(p_addon);
|
||||||
|
}
|
||||||
|
|
||||||
ERR_FAIL_COND(p_enabled && plugin_addons.has(p_addon));
|
ERR_FAIL_COND(p_enabled && plugin_addons.has(p_addon));
|
||||||
ERR_FAIL_COND(!p_enabled && !plugin_addons.has(p_addon));
|
ERR_FAIL_COND(!p_enabled && !plugin_addons.has(p_addon));
|
||||||
|
@ -3293,7 +3293,11 @@ void EditorNode::set_addon_plugin_enabled(const String &p_addon, bool p_enabled,
|
||||||
|
|
||||||
bool EditorNode::is_addon_plugin_enabled(const String &p_addon) const {
|
bool EditorNode::is_addon_plugin_enabled(const String &p_addon) const {
|
||||||
|
|
||||||
return plugin_addons.has(p_addon);
|
if (p_addon.begins_with("res://")) {
|
||||||
|
return plugin_addons.has(p_addon);
|
||||||
|
}
|
||||||
|
|
||||||
|
return plugin_addons.has(_to_absolute_plugin_path(p_addon));
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditorNode::_remove_edited_scene(bool p_change_tab) {
|
void EditorNode::_remove_edited_scene(bool p_change_tab) {
|
||||||
|
@ -3968,6 +3972,10 @@ Ref<ImageTexture> EditorNode::_load_custom_class_icon(const String &p_path) cons
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String EditorNode::_to_absolute_plugin_path(const String &p_plugin_name) {
|
||||||
|
return "res://addons/" + p_plugin_name + "/plugin.cfg";
|
||||||
|
}
|
||||||
|
|
||||||
Ref<Texture> EditorNode::get_object_icon(const Object *p_object, const String &p_fallback) const {
|
Ref<Texture> EditorNode::get_object_icon(const Object *p_object, const String &p_fallback) const {
|
||||||
ERR_FAIL_COND_V(!p_object || !gui_base, NULL);
|
ERR_FAIL_COND_V(!p_object || !gui_base, NULL);
|
||||||
|
|
||||||
|
|
|
@ -653,6 +653,8 @@ private:
|
||||||
bool _is_class_editor_disabled_by_feature_profile(const StringName &p_class);
|
bool _is_class_editor_disabled_by_feature_profile(const StringName &p_class);
|
||||||
Ref<ImageTexture> _load_custom_class_icon(const String &p_path) const;
|
Ref<ImageTexture> _load_custom_class_icon(const String &p_path) const;
|
||||||
|
|
||||||
|
static String _to_absolute_plugin_path(const String &p_path);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void _notification(int p_what);
|
void _notification(int p_what);
|
||||||
|
|
||||||
|
@ -705,7 +707,7 @@ public:
|
||||||
void add_control_to_dock(DockSlot p_slot, Control *p_control);
|
void add_control_to_dock(DockSlot p_slot, Control *p_control);
|
||||||
void remove_control_from_dock(Control *p_control);
|
void remove_control_from_dock(Control *p_control);
|
||||||
|
|
||||||
void set_addon_plugin_enabled(const String &p_addon, bool p_enabled, bool p_config_changed = false);
|
void set_addon_plugin_enabled(String p_addon, bool p_enabled, bool p_config_changed = false);
|
||||||
bool is_addon_plugin_enabled(const String &p_addon) const;
|
bool is_addon_plugin_enabled(const String &p_addon) const;
|
||||||
|
|
||||||
void edit_node(Node *p_node);
|
void edit_node(Node *p_node);
|
||||||
|
|
Loading…
Reference in a new issue