Files
Pr3tz/run_script.py
Stefan Cepko 31e464f5cd Release 0.1
2026-06-05 04:47:34 -04:00

42 lines
1.2 KiB
Python

import sys
import os
import bpy
# Get the directory of this script (workspace root) and append it to sys.path
dir_path = os.path.dirname(os.path.abspath(__file__))
if dir_path not in sys.path:
sys.path.append(dir_path)
# Try to register the pr3tz module
try:
# If the module was already imported, reload it to pick up changes
if "pr3tz" in sys.modules:
import importlib
import pr3tz
# Trigger reload inside pr3tz to refresh its submodules
importlib.reload(pr3tz)
else:
import pr3tz
# Unregister first to clean up any leftover handlers or UI components
try:
pr3tz.unregister()
except Exception:
pass
# Register the addon components
pr3tz.register()
# Run the initial scene setup (creates camera, light, and default playlist)
pr3tz.setup_scene()
# Generate the torus knot for the current frame immediately
pr3tz.knot_frame_handler(bpy.context.scene)
print("[Pr3tz] Registered and scene set up successfully!")
print("[Pr3tz] Scrub the timeline or press Space in the Viewport to animate.")
except Exception as e:
print(f"[Pr3tz] Failed to register: {e}")
import traceback
traceback.print_exc()