import sys import os import bpy # 1. Resolve path to include workspace root so pr3tz can be imported dir_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) if dir_path not in sys.path: sys.path.append(dir_path) import pr3tz # 2. Register pr3tz addon try: if "pr3tz" in sys.modules: import importlib importlib.reload(pr3tz) else: import pr3tz pr3tz.register() print("[Pr3tz] Registered successfully!") except Exception as e: print(f"[Pr3tz] Failed to register: {e}") sys.exit(1) # 3. Configure the scene (camera, lights, timeline, etc.) pr3tz.setup_scene() # 4. Clear existing playlist scene = bpy.context.scene scene.knot_list.clear() # ── Style 1: Tube Spin Winding ── # Animates the knot twisting around its own tube geometry. item_spin = scene.knot_list.add() item_spin.name = "Tube Spin Animation" item_spin.shape_type = 'TORUS_KNOT' item_spin.torus_p = 3 item_spin.torus_q = 5 item_spin.spin_phase_rate = 0.05 # Radians spin rate per frame item_spin.material_mode = 'PRESET' item_spin.shader_id = 'CARBON_FIBER' item_spin.preset_color = (0.3, 0.3, 0.3) # ── Style 2: Orbital Revolution ── # Animates the entire knot revolving/orbiting around the core torus axis. item_orbit = scene.knot_list.add() item_orbit.name = "Orbital Orbit Animation" item_orbit.shape_type = 'TORUS_KNOT' item_orbit.torus_p = 3 item_orbit.torus_q = 5 item_orbit.rev_phase_rate = 0.03 # Radians revolution rate per frame item_orbit.material_mode = 'PRESET' item_orbit.shader_id = 'GLASS' item_orbit.preset_color = (0.7, 0.9, 1.0) # ── Style 3: Vertical Height Breathing ── # Vertically stretches and squashes the knot structure. item_breath = scene.knot_list.add() item_breath.name = "Height Breathing Pulse" item_breath.shape_type = 'TORUS_KNOT' item_breath.torus_p = 3 item_breath.torus_q = 5 item_breath.height_rate = 0.06 # Sine frequency for height pulse item_breath.material_mode = 'PRESET' item_breath.shader_id = 'PLASMA_GLOW' item_breath.preset_color = (1.0, 0.1, 0.7) # ── Style 4: Uniform Scale Pulsation ── # Animates the overall scale of the knot using a sine multiplier. item_scale = scene.knot_list.add() item_scale.name = "Scale Pulsation" item_scale.shape_type = 'TORUS_KNOT' item_scale.torus_p = 3 item_scale.torus_q = 5 item_scale.scale_amplitude = 0.25 # Scale factor oscillation amplitude (+/- 25%) item_scale.scale_rate = 0.08 # Frequency of scale pulsation item_scale.material_mode = 'PRESET' item_scale.shader_id = 'ZEBRA_STRIPES' # 5. Fit timeline scene.knot_globals.frames_per_knot = 150 bpy.ops.knot.fit_timeline() # 6. Force instant geometry generation for current frame pr3tz.knot_frame_handler(scene) print("\n=====================================================================") print("Example 4: Animation Styles Playlist Loaded!") print("=====================================================================") print("Created 4 separate entries showing off isolated animation rates:") print(" 1. Tube Spin (Carbon Fiber) — spin_phase_rate=0.05") print(" 2. Orbital Orbit (Glass) — rev_phase_rate=0.03") print(" 3. Height Breathing (Plasma) — height_rate=0.06") print(" 4. Scale Pulsation (Zebra) — scale_amplitude=0.25, scale_rate=0.08") print("=====================================================================") print("Interact with it in Blender:") print(" - Play the animation (Space) to see how the rates animate.") print(" - Adjust the global 'Reactivity' slider to scale these speeds.") print("=====================================================================\n")