diff --git a/src/blenderbim/blenderbim/bim/module/debug/__init__.py b/src/blenderbim/blenderbim/bim/module/debug/__init__.py index 8790917a4a..ec0460699d 100644 --- a/src/blenderbim/blenderbim/bim/module/debug/__init__.py +++ b/src/blenderbim/blenderbim/bim/module/debug/__init__.py @@ -40,6 +40,7 @@ classes = ( operator.SelectExpressFile, operator.SelectHighPolygonMeshes, operator.SelectHighestPolygonMeshes, + operator.ToggleDetailedIOSLogs, operator.ValidateIfcFile, prop.BIMDebugProperties, ui.BIM_PT_debug, diff --git a/src/blenderbim/blenderbim/bim/module/debug/operator.py b/src/blenderbim/blenderbim/bim/module/debug/operator.py index 5b293d8da3..90eb8472bf 100644 --- a/src/blenderbim/blenderbim/bim/module/debug/operator.py +++ b/src/blenderbim/blenderbim/bim/module/debug/operator.py @@ -724,3 +724,36 @@ class DebugActiveDrawing(bpy.types.Operator): self.report({"INFO"}, "See system console for the results") return {"FINISHED"} + + +class ToggleDetailedIOSLogs(bpy.types.Operator): + bl_idname = "bim.toggle_detailed_ios_logs" + bl_label = "Toggle Detailed IfcOpenShell Logs" + bl_options = {"REGISTER", "UNDO"} + bl_description = ( + "Turn on detailed IfcOpenShell logs in the system console.\n" + + "Could be useful debugging issues " + + "loading IFC representations / serializing IFC geometry." + + "\n\nALT+CLICK to disable the logs" + ) + # NOTE: No idea if it's possible to check from Python + # whether detailed logs are currently enabled or not. + # Therefore we just distinguish between click + # and alt-click to allow enabling/disabling the logs. + turn_on_logs: bpy.props.BoolProperty(name="Turn On Logs", default=True, options={"SKIP_SAVE"}) + + def invoke(self, context, event): + if event.type == "LEFTMOUSE" and event.alt: + self.turn_on_logs = False + return self.execute(context) + + def execute(self, context): + import ifcopenshell.ifcopenshell_wrapper as wrapper + + if self.turn_on_logs: + wrapper.turn_on_detailed_logging() + self.report({"INFO"}, "Detailed IfcOpenShell logs turned on.") + else: + wrapper.turn_off_detailed_logging() + self.report({"INFO"}, "Detailed IfcOpenShell logs turned off.") + return {"FINISHED"} diff --git a/src/blenderbim/blenderbim/bim/module/debug/ui.py b/src/blenderbim/blenderbim/bim/module/debug/ui.py index ec296b47d6..044756163a 100644 --- a/src/blenderbim/blenderbim/bim/module/debug/ui.py +++ b/src/blenderbim/blenderbim/bim/module/debug/ui.py @@ -75,6 +75,9 @@ class BIM_PT_debug(Panel): row = layout.row() row.operator("bim.debug_active_drawing") + row = layout.row() + row.operator("bim.toggle_detailed_ios_logs") + row = layout.split(factor=0.5, align=True) row.operator("bim.create_shape_from_step_id").should_include_curves = False row.operator("bim.create_shape_from_step_id", text="", icon="IPO_ELASTIC").should_include_curves = True