Skip to content

Commit 133bc26

Browse files
feat(ui): Add unlock/lock all button to skill graphs
1 parent 9030767 commit 133bc26

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/bw_save_game/ui/__init__.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ def __init__(self):
207207
self.selected_definition_index = 0
208208
self.selected_instance_index = 0
209209
self.hash_input = ""
210+
self.temporary_select_all = False
210211

211212
self.default_save_path = detect_save_game_path()
212213

@@ -270,6 +271,7 @@ def close(self):
270271
self.selected_collectible_set_index = 0
271272
self.selected_definition_index = 0
272273
self.selected_instance_index = 0
274+
self.temporary_select_all = False
273275

274276

275277
def set_window_title(title: str):
@@ -1145,6 +1147,20 @@ def show_editor_skills(state: State, archetype: CharacterArchetype):
11451147
skill_points = PersistencePropertyDefinition(persistence_key, 2271481620, "Uint32", 0)
11461148

11471149
show_persisted_value_editor(state, "Skill points:", skill_points)
1150+
1151+
# There are quite a few, provide a shortcut to grant/deny all
1152+
imgui.columns(2)
1153+
imgui.next_column() # align with list checkbox
1154+
changed, new_value = imgui.checkbox("Unlock/Lock all", state.temporary_select_all)
1155+
if changed:
1156+
state.temporary_select_all = new_value
1157+
for skill in SKILL_GRAPHS[graph_id]["skills"]:
1158+
unlock_property = PersistencePropertyDefinition(
1159+
persistence_key, skill["unlock_property_id"], "Boolean", False
1160+
)
1161+
state.save_game.set_persistence_property(unlock_property, new_value)
1162+
imgui.columns(1)
1163+
11481164
show_editor_skills_list(state, SKILL_GRAPHS[graph_id], persistence_key)
11491165

11501166

0 commit comments

Comments
 (0)