OverviewFilesCommitsIssuesDocsReleasesPeers

cthuloid / blender-addon / diagnose.py

42 lines · python ref:
# Paste into Blender's Python Console (Scripting workspace), or run from Text Editor.
import bpy, sys
MOD = "bl_ext.user_default.cthuloid_lights"
sc = bpy.context.scene

print("=" * 60)
print("addon loaded      :", MOD in bpy.context.preferences.addons.keys())
m = sys.modules.get(MOD)
print("has anim module   :", hasattr(m, "anim") if m else False, "(False = STALE, restart Blender)")

p = getattr(sc, "cthuloid", None)
if p is None:
    print("scene.cthuloid    : MISSING")
else:
    print("LIVE armed        :", p.live, "   <-- must be True")
    print("send_on_frame     :", p.send_on_frame)
    print("send_on_edit      :", p.send_on_edit)
    print("fixtures          :", len(p.fixtures))

    from bl_ext.user_default.cthuloid_lights import rig, engine
    from bl_ext.user_default.cthuloid_lights.net import SENDER
    for f in p.fixtures:
        lights = rig.fixture_lights(sc, f)
        print("-" * 60)
        print("  host          :", repr(f.host), "port", f.port)
        print("  enabled       :", f.enabled)
        print("  fade_mode     :", f.fade_mode)
        print("  lights mapped :", sorted(lights.keys()), "<-- empty means nothing to send")
        print("  net status    :", SENDER.status_of(f.host, f.port))
        try:
            print("  would send    :", str(engine.build_command(sc, f)).strip()[:70])
        except Exception as e:
            print("  build ERROR   :", type(e).__name__, e)

import bl_ext.user_default.cthuloid_lights.engine as eng
print("-" * 60)
print("frame handler     :", eng._on_frame_change in bpy.app.handlers.frame_change_post)
print("depsgraph handler :", eng._on_depsgraph_update in bpy.app.handlers.depsgraph_update_post)
print("untagged lights   :", [o.name for o in sc.objects
      if o.type == 'LIGHT' and not o.cthuloid_light.is_fixture_light])
print("=" * 60)