Commit 00bdcf13 authored by Bruno Laurencich's avatar Bruno Laurencich

debug mode

parent 987082c1
......@@ -68,6 +68,7 @@ else:
import bpy
from bpy import props
from bpy.types import WindowManager
import faulthandler
C = bpy.context
# =========================================
......@@ -123,7 +124,15 @@ class Chord_Properties(bpy.types.AddonPreferences):
playing = props.BoolProperty( name="Record capture", default = False )
# ----------- ADVANCED -----------
debug_osc = props.BoolProperty( name="Debug osc to console", default = False )
def on_debug_update(self, context):
if self.debug_mode:
faulthandler.enable()
print("*** Debug mode enabled ***")
else:
faulthandler.disable()
print("** Debug mode disabled **")
debug_mode = props.BoolProperty( name="Enable debuging for the Chordata add-on", default = False, update=on_debug_update )
notochord_parameters = props.StringProperty( default = "" )
......@@ -223,9 +232,15 @@ def register():
bpy.utils.register_module(__name__)
if context.user_preferences.addons[__package__].preferences.debug_mode:
faulthandler.enable()
def unregister():
# bpy.utils.unregister_class(Chord_Get_Ip)
bpy.utils.unregister_module(__name__)
faulthandler.disable()
# del WindowManager.chordata
if __name__ == "__main__":
......
......@@ -264,7 +264,7 @@ class Chord_advanced_panel(bpy.types.Panel):
self.chord_global = context.user_preferences.addons[__package__].preferences
layout = self.layout
layout.prop(self.chord_global, "debug_osc", text="Debug OSC")
layout.prop(self.chord_global, "debug_mode", text="Debug mode", expand=True)
layout.label("Control notochord")
row = layout.row(align=True)
......
......@@ -244,7 +244,7 @@ class Chord_Receive_OSC(bpy.types.Operator):
#TODO: work on the OSC routing, the library is not using regex but glob??
bone_handler = self.receive_bones
if self.chord_global.debug_osc: bone_handler = self.receive_bones_verbose
if self.chord_global.debug_mode: bone_handler = self.receive_bones_verbose
osc_method("/Chordata/*", bone_handler,\
argscheme=osm.OSCARG_ADDRESS + osm.OSCARG_DATA)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment