Skip to content

Commit

Permalink
Don't access context during registration. Closes #201
Browse files Browse the repository at this point in the history
  • Loading branch information
ranjian0 committed May 15, 2022
1 parent d0cd71a commit c590c0d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion btools/utils/util_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit c590c0d

Please sign in to comment.