diff options
author | Vixelz <vxlzart@gmail.com> | 2019-02-21 14:23:48 +0000 |
---|---|---|
committer | Vixelz <vxlzart@gmail.com> | 2019-02-21 18:16:49 +0000 |
commit | 03f7a724ed8c1fc1601510338a349e72fe263e8c (patch) | |
tree | 7e087426eb615c01c847f0e15dffa0fcdfb2fb54 | |
parent | 16934c7411fc7beda7459d0bb8bf5de233d671d1 (diff) |
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.
-rw-r--r-- | editor/editor_properties.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp index 98950023ce..6fb8feb804 100644 --- a/editor/editor_properties.cpp +++ b/editor/editor_properties.cpp @@ -2287,6 +2287,16 @@ void EditorPropertyResource::_update_menu_items() { E = E->next(); } + List<StringName> 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<String>::Element *F = valid_inheritors.front(); F; F = F->next()) { String t = F->get(); @@ -2303,7 +2313,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); |