From 39e76014d4a4c8c344569a05b7f975836af3974c Mon Sep 17 00:00:00 2001 From: Vixelz Date: Thu, 21 Feb 2019 14:23:48 +0000 Subject: [PATCH] Include global class resources in Resource property inspector Much like how script defined global classes can be created from the "New Resource..." button in the FileSystem panel, this allows the creation of script defined resources to be embedded. (cherry picked from commit 03f7a724ed8c1fc1601510338a349e72fe263e8c) --- editor/editor_properties.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp index c13a4a5a5e5..0e8cd955b56 100644 --- a/editor/editor_properties.cpp +++ b/editor/editor_properties.cpp @@ -2289,6 +2289,16 @@ void EditorPropertyResource::_update_menu_items() { E = E->next(); } + List global_classes; + ScriptServer::get_global_class_list(&global_classes); + E = global_classes.front(); + while (E) { + if (EditorNode::get_editor_data().script_class_is_parent(E->get(), base_type)) { + valid_inheritors.insert(E->get()); + } + E = E->next(); + } + for (Set::Element *F = valid_inheritors.front(); F; F = F->next()) { String t = F->get(); @@ -2305,7 +2315,7 @@ void EditorPropertyResource::_update_menu_items() { } } - if (!is_custom_resource && !ClassDB::can_instance(t)) + if (!is_custom_resource && !(ScriptServer::is_global_class(t) || ClassDB::can_instance(t))) continue; inheritors_array.push_back(t);