hkb_editor.hkb.index_attributes
¶
fix_index_references
¶
fix_index_references(behavior: HavokBehavior, attributes: dict[str, list[str]], prev_idx: int, new_idx: int)
Fix attributes that refer to values by index.
Events, variables and animations are referred to by index, so when a value is inserted, removed, or deleted, these indices would suddenly point to different entries. This function adjusts these attributes based on how the value array was modified.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
behavior
|
HavokBehavior
|
Behavior to fix attributes in. |
required |
attributes
|
dict[str, list[str]]
|
A dict from record type names to attribute paths to fix. |
required |
prev_idx
|
int
|
The previous index of the modified array value. Set to None if a new item was inserted at new_idx. |
required |
new_idx
|
int
|
The new index of the modified array value. Set to None if an item at prev_idx was deleted. |
required |