diff options
Diffstat (limited to 'editor/editor_properties.cpp')
-rw-r--r-- | editor/editor_properties.cpp | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp index d7faa44441..31f53305e2 100644 --- a/editor/editor_properties.cpp +++ b/editor/editor_properties.cpp @@ -1982,6 +1982,8 @@ void EditorPropertyResource::_file_selected(const String &p_path) { RES res = ResourceLoader::load(p_path); + ERR_FAIL_COND(res.is_null()); + List<PropertyInfo> prop_list; get_edited_object()->get_property_list(&prop_list); String property_types; @@ -2287,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(); @@ -2303,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); @@ -2540,6 +2552,7 @@ void EditorPropertyResource::update_property() { sub_inspector->edit(res.ptr()); } + sub_inspector->refresh(); } else { if (sub_inspector) { set_bottom_editor(NULL); @@ -2870,7 +2883,8 @@ bool EditorInspectorDefaultPlugin::parse_property(Object *p_object, Variant::Typ case PROPERTY_HINT_LAYERS_3D_PHYSICS: lt = EditorPropertyLayers::LAYER_PHYSICS_3D; break; - default: {} //compiler could be smarter here and realize this can't happen + default: { + } //compiler could be smarter here and realize this can't happen } EditorPropertyLayers *editor = memnew(EditorPropertyLayers); editor->setup(lt); @@ -3007,7 +3021,8 @@ bool EditorInspectorDefaultPlugin::parse_property(Object *p_object, Variant::Typ case PROPERTY_HINT_PROPERTY_OF_BASE_TYPE: type = EditorPropertyMember::MEMBER_PROPERTY_OF_BASE_TYPE; break; case PROPERTY_HINT_PROPERTY_OF_INSTANCE: type = EditorPropertyMember::MEMBER_PROPERTY_OF_INSTANCE; break; case PROPERTY_HINT_PROPERTY_OF_SCRIPT: type = EditorPropertyMember::MEMBER_PROPERTY_OF_SCRIPT; break; - default: {} + default: { + } } editor->setup(type, p_hint_text); add_property_editor(p_path, editor); @@ -3271,7 +3286,8 @@ bool EditorInspectorDefaultPlugin::parse_property(Object *p_object, Variant::Typ editor->setup(Variant::POOL_COLOR_ARRAY); add_property_editor(p_path, editor); } break; - default: {} + default: { + } } return false; //can be overridden, although it will most likely be last anyway |