From c590c0dd9ca133680e553c5cefd6cf28ee455ae7 Mon Sep 17 00:00:00 2001 From: ranjian0 Date: Sun, 15 May 2022 16:05:29 +0300 Subject: [PATCH] Don't access context during registration. Closes #201 --- btools/utils/util_common.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/btools/utils/util_common.py b/btools/utils/util_common.py index b03a816..8bf9501 100644 --- a/btools/utils/util_common.py +++ b/btools/utils/util_common.py @@ -143,5 +143,9 @@ def XYDir(vec): def get_scaled_unit(value): """Mostly to scale prop values to current scene unit scale """ - scale = bpy.context.scene.unit_settings.scale_length + try: + scale = bpy.context.scene.unit_settings.scale_length + except AttributeError: + # Addon Registration, context.scene is not available + scale = 1.0 return value / scale \ No newline at end of file