1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-22 15:06:45 +00:00

Add ability to edit editor feature profiles

Allows enabling/disabling parts of the editor and storing/loading profiles for that.
This commit is contained in:
Juan Linietsky
2019-04-08 19:18:03 -03:00
parent 9ab17b664d
commit a20235aeb0
24 changed files with 1586 additions and 67 deletions

View File

@@ -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);