feat: rename 'reference path' to 'middle frame path'
Updates DEFAULTS, standard_keys, UI label, and timeline known_keys. Adds _migrate_key_renames() called on load_json to auto-migrate existing JSON files with the old key name. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+2
-2
@@ -316,7 +316,7 @@ def render_batch_processor(state: AppState):
|
|||||||
'seed', 'cfg', 'camera', 'flf', KEY_SEQUENCE_NUMBER,
|
'seed', 'cfg', 'camera', 'flf', KEY_SEQUENCE_NUMBER,
|
||||||
'frame_to_skip', 'end_frame', 'transition', 'vace_length',
|
'frame_to_skip', 'end_frame', 'transition', 'vace_length',
|
||||||
'input_a_frames', 'input_b_frames', 'reference switch', 'vace schedule',
|
'input_a_frames', 'input_b_frames', 'reference switch', 'vace schedule',
|
||||||
'reference path', 'video file path', 'reference image path', 'flf image path',
|
'middle frame path', 'video file path', 'reference image path', 'flf image path',
|
||||||
}
|
}
|
||||||
standard_keys.update(lora_keys)
|
standard_keys.update(lora_keys)
|
||||||
|
|
||||||
@@ -632,7 +632,7 @@ def _render_sequence_card(i, seq, batch_list, data, file_path, state,
|
|||||||
# Image paths with preview
|
# Image paths with preview
|
||||||
for img_label, img_key in [
|
for img_label, img_key in [
|
||||||
('Reference Image Path', 'reference image path'),
|
('Reference Image Path', 'reference image path'),
|
||||||
('Reference Path', 'reference path'),
|
('Middle Frame Path', 'middle frame path'),
|
||||||
('FLF Image Path', 'flf image path'),
|
('FLF Image Path', 'flf image path'),
|
||||||
]:
|
]:
|
||||||
with ui.row().classes('w-full items-center'):
|
with ui.row().classes('w-full items-center'):
|
||||||
|
|||||||
+1
-1
@@ -618,7 +618,7 @@ def _render_preview_fields(item_data: dict):
|
|||||||
known_keys = {
|
known_keys = {
|
||||||
'sequence_number', 'general_prompt', 'general_negative', 'current_prompt', 'prompt',
|
'sequence_number', 'general_prompt', 'general_negative', 'current_prompt', 'prompt',
|
||||||
'negative', 'camera', 'flf', 'seed', 'resolutions',
|
'negative', 'camera', 'flf', 'seed', 'resolutions',
|
||||||
'frame_to_skip', 'vace schedule', 'video file path',
|
'frame_to_skip', 'vace schedule', 'video file path', 'middle frame path',
|
||||||
}
|
}
|
||||||
# also skip lora keys
|
# also skip lora keys
|
||||||
custom_keys = [
|
custom_keys = [
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ DEFAULTS = {
|
|||||||
"reference switch": 1,
|
"reference switch": 1,
|
||||||
"video file path": "",
|
"video file path": "",
|
||||||
"reference image path": "",
|
"reference image path": "",
|
||||||
"reference path": "",
|
"middle frame path": "",
|
||||||
"flf image path": "",
|
"flf image path": "",
|
||||||
|
|
||||||
# --- LoRAs (name as STRING, strength as FLOAT) ---
|
# --- LoRAs (name as STRING, strength as FLOAT) ---
|
||||||
@@ -150,6 +150,15 @@ def save_snippets(snippets):
|
|||||||
json.dump(snippets, f, indent=4)
|
json.dump(snippets, f, indent=4)
|
||||||
os.replace(tmp, SNIPPETS_FILE)
|
os.replace(tmp, SNIPPETS_FILE)
|
||||||
|
|
||||||
|
def _migrate_key_renames(data: dict) -> None:
|
||||||
|
"""Rename legacy keys to their current names."""
|
||||||
|
for item in data.get(KEY_BATCH_DATA, []):
|
||||||
|
if not isinstance(item, dict):
|
||||||
|
continue
|
||||||
|
if 'reference path' in item and 'middle frame path' not in item:
|
||||||
|
item['middle frame path'] = item.pop('reference path')
|
||||||
|
|
||||||
|
|
||||||
def _migrate_lora_keys(data: dict) -> None:
|
def _migrate_lora_keys(data: dict) -> None:
|
||||||
"""Split combined lora 'name:strength' into separate name and strength keys.
|
"""Split combined lora 'name:strength' into separate name and strength keys.
|
||||||
|
|
||||||
@@ -208,6 +217,7 @@ def load_json(path: str | Path) -> tuple[dict[str, Any], float]:
|
|||||||
with open(path, 'r') as f:
|
with open(path, 'r') as f:
|
||||||
data = json.load(f)
|
data = json.load(f)
|
||||||
t1 = time.time()
|
t1 = time.time()
|
||||||
|
_migrate_key_renames(data)
|
||||||
_migrate_lora_keys(data)
|
_migrate_lora_keys(data)
|
||||||
t2 = time.time()
|
t2 = time.time()
|
||||||
mtime = path.stat().st_mtime
|
mtime = path.stat().st_mtime
|
||||||
|
|||||||
Reference in New Issue
Block a user