You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-04 12:00:25 +00:00
Keep collapsed state for actions when modifying Input Map
Changing the Input Map in Project Settings (adding/removing/renaming actions, reordering, or changing action events) causes the action list Tree to be cleared/repopulated. Updated ActionMapEditor::update_action_list to store which actions were collapsed before clearing, so they can remain collapsed after modifications.
This commit is contained in:
@@ -423,8 +423,18 @@ void ActionMapEditor::update_action_list(const Vector<ActionInfo> &p_action_info
|
|||||||
actions_cache = p_action_infos;
|
actions_cache = p_action_infos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HashSet<String> collapsed_actions;
|
||||||
|
TreeItem *root = action_tree->get_root();
|
||||||
|
if (root) {
|
||||||
|
for (TreeItem *child = root->get_first_child(); child; child = child->get_next()) {
|
||||||
|
if (child->is_collapsed()) {
|
||||||
|
collapsed_actions.insert(child->get_meta("__name"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
action_tree->clear();
|
action_tree->clear();
|
||||||
TreeItem *root = action_tree->create_item();
|
root = action_tree->create_item();
|
||||||
|
|
||||||
for (const ActionInfo &action_info : actions_cache) {
|
for (const ActionInfo &action_info : actions_cache) {
|
||||||
const Array events = action_info.action["events"];
|
const Array events = action_info.action["events"];
|
||||||
@@ -444,6 +454,7 @@ void ActionMapEditor::update_action_list(const Vector<ActionInfo> &p_action_info
|
|||||||
ERR_FAIL_NULL(action_item);
|
ERR_FAIL_NULL(action_item);
|
||||||
action_item->set_meta("__action", action_info.action);
|
action_item->set_meta("__action", action_info.action);
|
||||||
action_item->set_meta("__name", action_info.name);
|
action_item->set_meta("__name", action_info.name);
|
||||||
|
action_item->set_collapsed(collapsed_actions.has(action_info.name));
|
||||||
|
|
||||||
// First Column - Action Name
|
// First Column - Action Name
|
||||||
action_item->set_auto_translate_mode(0, AUTO_TRANSLATE_MODE_DISABLED);
|
action_item->set_auto_translate_mode(0, AUTO_TRANSLATE_MODE_DISABLED);
|
||||||
|
|||||||
Reference in New Issue
Block a user