Skip to content

Commit

Permalink
Merge pull request #26122 from vixelz/allow-embedding-gdscript-define…
Browse files Browse the repository at this point in the history
…d-resources

Include global class resources in Resource property inspector
  • Loading branch information
akien-mga authored Apr 6, 2019
2 parents 87ee2a9 + 03f7a72 commit b319168
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion editor/editor_properties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2289,6 +2289,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();

Expand All @@ -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);
Expand Down

0 comments on commit b319168

Please sign in to comment.