diff options
Diffstat (limited to 'editor/editor_inspector.cpp')
-rw-r--r-- | editor/editor_inspector.cpp | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp index 60fa5ff16f..c705f9af2b 100644 --- a/editor/editor_inspector.cpp +++ b/editor/editor_inspector.cpp @@ -1370,6 +1370,30 @@ void EditorInspector::_parse_added_editors(VBoxContainer *current_vbox, Ref<Edit ped->added_editors.clear(); } +bool EditorInspector::_is_property_disabled_by_feature_profile(const StringName &p_property) { + + Ref<EditorFeatureProfile> profile = EditorFeatureProfileManager::get_singleton()->get_current_profile(); + if (profile.is_null()) { + return false; + } + + StringName class_name = object->get_class(); + + while (class_name != StringName()) { + + if (profile->is_class_property_disabled(class_name, p_property)) { + return true; + } + if (profile->is_class_disabled(class_name)) { + //won't see properties of a disabled class + return true; + } + class_name = ClassDB::get_parent_class(class_name); + } + + return false; +} + void EditorInspector::update_tree() { //to update properly if all is refreshed @@ -1513,7 +1537,7 @@ void EditorInspector::update_tree() { continue; - } else if (!(p.usage & PROPERTY_USAGE_EDITOR)) + } else if (!(p.usage & PROPERTY_USAGE_EDITOR) || _is_property_disabled_by_feature_profile(p.name)) continue; if (p.usage & PROPERTY_USAGE_HIGH_END_GFX && VS::get_singleton()->is_low_end()) @@ -2132,6 +2156,10 @@ void EditorInspector::_node_removed(Node *p_node) { void EditorInspector::_notification(int p_what) { + if (p_what == NOTIFICATION_READY) { + EditorFeatureProfileManager::get_singleton()->connect("current_feature_profile_changed", this, "_feature_profile_changed"); + } + if (p_what == NOTIFICATION_ENTER_TREE) { if (sub_inspector) { @@ -2238,6 +2266,11 @@ String EditorInspector::get_object_class() const { return object_class; } +void EditorInspector::_feature_profile_changed() { + + update_tree(); +} + void EditorInspector::_bind_methods() { ClassDB::bind_method("_property_changed", &EditorInspector::_property_changed, DEFVAL(""), DEFVAL(false)); @@ -2254,6 +2287,7 @@ void EditorInspector::_bind_methods() { ClassDB::bind_method("_resource_selected", &EditorInspector::_resource_selected); ClassDB::bind_method("_object_id_selected", &EditorInspector::_object_id_selected); ClassDB::bind_method("_vscroll_changed", &EditorInspector::_vscroll_changed); + ClassDB::bind_method("_feature_profile_changed", &EditorInspector::_feature_profile_changed); ClassDB::bind_method("refresh", &EditorInspector::refresh); |