Fixed changing enabled classes resetting folding in manage editor features.
This commit is contained in:
parent
364ea7f280
commit
0f9913ce33
|
@ -118,6 +118,18 @@ bool EditorFeatureProfile::has_class_properties_disabled(const StringName &p_cla
|
|||
return disabled_properties.has(p_class);
|
||||
}
|
||||
|
||||
void EditorFeatureProfile::set_item_collapsed(const StringName &p_class, bool p_collapsed) {
|
||||
if (p_collapsed) {
|
||||
collapsed_classes.insert(p_class);
|
||||
} else {
|
||||
collapsed_classes.erase(p_class);
|
||||
}
|
||||
}
|
||||
|
||||
bool EditorFeatureProfile::is_item_collapsed(const StringName &p_class) const {
|
||||
return collapsed_classes.has(p_class);
|
||||
}
|
||||
|
||||
void EditorFeatureProfile::set_disable_feature(Feature p_feature, bool p_disable) {
|
||||
ERR_FAIL_INDEX(p_feature, FEATURE_MAX);
|
||||
features_disabled[p_feature] = p_disable;
|
||||
|
@ -484,6 +496,9 @@ void EditorFeatureProfileManager::_fill_classes_from(TreeItem *p_parent, const S
|
|||
class_item->set_selectable(0, true);
|
||||
class_item->set_metadata(0, p_class);
|
||||
|
||||
bool collapsed = edited->is_item_collapsed(p_class);
|
||||
class_item->set_collapsed(collapsed);
|
||||
|
||||
if (p_class == p_selected) {
|
||||
class_item->select(0);
|
||||
}
|
||||
|
@ -596,6 +611,26 @@ void EditorFeatureProfileManager::_class_list_item_edited() {
|
|||
}
|
||||
}
|
||||
|
||||
void EditorFeatureProfileManager::_class_list_item_collapsed(Object *p_item) {
|
||||
if (updating_features) {
|
||||
return;
|
||||
}
|
||||
|
||||
TreeItem *item = Object::cast_to<TreeItem>(p_item);
|
||||
if (!item) {
|
||||
return;
|
||||
}
|
||||
|
||||
Variant md = item->get_metadata(0);
|
||||
if (md.get_type() != Variant::STRING && md.get_type() != Variant::STRING_NAME) {
|
||||
return;
|
||||
}
|
||||
|
||||
String class_name = md;
|
||||
bool collapsed = item->is_collapsed();
|
||||
edited->set_item_collapsed(class_name, collapsed);
|
||||
}
|
||||
|
||||
void EditorFeatureProfileManager::_property_item_edited() {
|
||||
if (updating_features) {
|
||||
return;
|
||||
|
@ -853,6 +888,7 @@ EditorFeatureProfileManager::EditorFeatureProfileManager() {
|
|||
class_list->set_edit_checkbox_cell_only_when_checkbox_is_pressed(true);
|
||||
class_list->connect("cell_selected", callable_mp(this, &EditorFeatureProfileManager::_class_list_item_selected));
|
||||
class_list->connect("item_edited", callable_mp(this, &EditorFeatureProfileManager::_class_list_item_edited), varray(), CONNECT_DEFERRED);
|
||||
class_list->connect("item_collapsed", callable_mp(this, &EditorFeatureProfileManager::_class_list_item_collapsed));
|
||||
// It will be displayed once the user creates or chooses a profile.
|
||||
class_list_vbc->hide();
|
||||
|
||||
|
|
|
@ -60,6 +60,8 @@ private:
|
|||
Set<StringName> disabled_editors;
|
||||
Map<StringName, Set<StringName>> disabled_properties;
|
||||
|
||||
Set<StringName> collapsed_classes;
|
||||
|
||||
bool features_disabled[FEATURE_MAX];
|
||||
static const char *feature_names[FEATURE_MAX];
|
||||
static const char *feature_identifiers[FEATURE_MAX];
|
||||
|
@ -80,6 +82,9 @@ public:
|
|||
bool is_class_property_disabled(const StringName &p_class, const StringName &p_property) const;
|
||||
bool has_class_properties_disabled(const StringName &p_class) const;
|
||||
|
||||
void set_item_collapsed(const StringName &p_class, bool p_collapsed);
|
||||
bool is_item_collapsed(const StringName &p_class) const;
|
||||
|
||||
void set_disable_feature(Feature p_feature, bool p_disable);
|
||||
bool is_feature_disabled(Feature p_feature) const;
|
||||
|
||||
|
@ -151,6 +156,7 @@ class EditorFeatureProfileManager : public AcceptDialog {
|
|||
|
||||
void _class_list_item_selected();
|
||||
void _class_list_item_edited();
|
||||
void _class_list_item_collapsed(Object *p_item);
|
||||
void _property_item_edited();
|
||||
void _save_and_update();
|
||||
|
||||
|
|
Loading…
Reference in New Issue