Accumulated uncommitted work: GHOST Web backend, WebGL/GPU web layer, web workflow engine and protocol, tooling, docs and task records. Large generated evidence, user-testing archives, build snapshots and imported test assets remain untracked. Co-Authored-By: Claude Code <noreply@anthropic.com>
23 lines
994 B
Python
23 lines
994 B
Python
"""Load the Web Blender profile without touching the desktop user's config."""
|
|
from pathlib import Path
|
|
import bpy
|
|
|
|
|
|
def load_preferences(root):
|
|
if (root / 'config' / 'userpref.blend').is_file():
|
|
state = bpy.ops.wm.read_userpref('EXEC_DEFAULT')
|
|
if 'FINISHED' not in state: raise RuntimeError('PREFERENCES_LOAD_FAILED')
|
|
# Persistence is an explicit Web session command, not shutdown of a temporary job.
|
|
bpy.context.preferences.use_preferences_save = False
|
|
|
|
|
|
def save_preferences(root, sequence):
|
|
state = bpy.ops.wm.save_userpref('EXEC_DEFAULT')
|
|
if 'FINISHED' not in state: raise RuntimeError('PREFERENCES_SAVE_FAILED')
|
|
source = Path(bpy.utils.user_resource('CONFIG')) / 'userpref.blend'
|
|
if not source.is_file() or source.stat().st_size > 16 * 1024 * 1024:
|
|
raise RuntimeError('PREFERENCES_SAVE_OUTPUT_INVALID')
|
|
destination = root / f'preferences-{sequence:08d}.blend'
|
|
destination.write_bytes(source.read_bytes())
|
|
return destination
|