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() # 5. Add a multi-link knot configuration item = scene.knot_list.add() item.name = "Interlocking Solomon Link" item.shape_type = 'TORUS_KNOT' # Topology with GCD > 1 item.torus_p = 4 # 4 revolutions item.torus_q = 6 # 6 spins. gcd(4, 6) = 2 separate interlocking links item.multiple_links = True # Enable rendering of all links as separate splines # Dimensions & Geometry item.torus_R = 2.5 item.torus_r = 1.0 item.geo_bDepth = 0.05 # Use a bright emissive neon color item.material_mode = 'PRESET' item.shader_id = 'NEON_GLOW' item.preset_color = (0.0, 1.0, 0.9) # Cyan item.preset_emission_strength = 3.0 # 6. Fit timeline so the knot plays scene.knot_globals.frames_per_knot = 120 bpy.ops.knot.fit_timeline() # 7. Force instant geometry generation for current frame pr3tz.knot_frame_handler(scene) print("\n=====================================================================") print("Example 2: Multi-Link Knot Loaded!") print("=====================================================================") print("Generated a 3D Solomon Link (p=4, q=6) with multiple_links=True.") print("This renders as 2 distinct interlocking/nested splines.") print("Interact with it in Blender:") print(" - Open the 'Pr3tz' N-Panel.") print(" - Toggle 'Multiple Links' off/on to see the difference between") print(" rendering a single loop vs. all mathematical links.") print("=================================================================\n")