MCPcopy Create free account
hub / github.com/IfcOpenShell/IfcOpenShell / get_debug_info

Function get_debug_info

src/bonsai/bonsai/__init__.py:120–168  ·  view source on GitHub ↗
(*, bonsai_failed_to_load: bool = False)

Source from the content-addressed store, hash-verified

118
119
120def get_debug_info(*, bonsai_failed_to_load: bool = False) -> dict[str, Any]:
121 import bpy
122
123 bbim_version = bbim_semver["version"]
124
125 # All data here should be gettable even in case of `bpy.context` and `bpy.data` being inaccessible
126 # and Bonsai completely failed to load.
127 debug_info = {
128 "os": platform.system(),
129 "os_version": platform.version(),
130 "python_version": platform.python_version(),
131 "architecture": platform.architecture(),
132 "machine": platform.machine(),
133 "processor": platform.processor(),
134 "blender_version": bpy.app.version_string,
135 "bonsai_version": bbim_version,
136 "bonsai_commit_hash": get_last_commit_hash(),
137 "bonsai_commit_date": get_last_commit_date(),
138 "bonsai_git_branch": get_git_branch(),
139 "last_actions": last_actions,
140 "last_error": last_error,
141 }
142
143 # Can't access blend data or context during registration.
144 # If Bonsai failed to load we cannot safely access any of its properties or its tools
145 # as they may not be registered yet and acessing them will break Bonsai Fatal Error UI.
146 if is_registering() or bonsai_failed_to_load:
147 return debug_info
148
149 import bonsai.tool as tool
150
151 # Add .blend file save information
152 if bpy.data.is_saved:
153 debug_info["blend_file_path"] = bpy.data.filepath
154 debug_info["blend_file_dirty"] = bpy.data.is_dirty
155 else:
156 debug_info["blend_file_path"] = "Not saved"
157 debug_info["blend_file_dirty"] = "N/A"
158
159 # Add IFC file information
160 bim_props = tool.Blender.get_bim_props()
161 if bim_props.ifc_file:
162 debug_info["ifc_file_path"] = bim_props.ifc_file
163 debug_info["ifc_is_dirty"] = bim_props.is_dirty
164 else:
165 debug_info["ifc_file_path"] = "No IFC loaded"
166 debug_info["ifc_is_dirty"] = "N/A"
167
168 return debug_info
169
170
171def format_debug_info(info: dict[str, Any]) -> str:

Callers 4

executeMethod · 0.90
__init__.pyFile · 0.85
drawMethod · 0.85
executeMethod · 0.85

Calls 6

get_last_commit_hashFunction · 0.85
get_last_commit_dateFunction · 0.85
get_git_branchFunction · 0.85
is_registeringFunction · 0.85
get_bim_propsMethod · 0.80
versionMethod · 0.45

Tested by

no test coverage detected