mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-19 22:50:21 +00:00
Minor fix to sun_position < Blender 4.2
This commit is contained in:
@@ -145,8 +145,8 @@ class BIM_PT_solar(bpy.types.Panel):
|
|||||||
row = col.row(align=True)
|
row = col.row(align=True)
|
||||||
box = row.box()
|
box = row.box()
|
||||||
|
|
||||||
local_time = format_time(sun_props.time, sun_props.use_daylight_savings)
|
local_time = sun_position.sun_calc.format_time(sun_props.time, sun_props.use_daylight_savings)
|
||||||
utc_time = format_time(sun_props.time, sun_props.use_daylight_savings, sun_props.UTC_zone)
|
utc_time = sun_position.sun_calc.format_time(sun_props.time, sun_props.use_daylight_savings, sun_props.UTC_zone)
|
||||||
|
|
||||||
row2 = box.row()
|
row2 = box.row()
|
||||||
row2.label(text=f"Local Time: {local_time}")
|
row2.label(text=f"Local Time: {local_time}")
|
||||||
@@ -155,8 +155,8 @@ class BIM_PT_solar(bpy.types.Panel):
|
|||||||
|
|
||||||
box = row.box()
|
box = row.box()
|
||||||
|
|
||||||
sunrise = format_hms(sun.sunrise)
|
sunrise = sun_position.sun_calc.format_hms(sun_position.sun_calc.sun.sunrise)
|
||||||
sunset = format_hms(sun.sunset)
|
sunset = sun_position.sun_calc.format_hms(sun_position.sun_calc.sun.sunset)
|
||||||
|
|
||||||
row2 = box.row()
|
row2 = box.row()
|
||||||
row2.label(text=f"Sunrise: {sunrise}")
|
row2.label(text=f"Sunrise: {sunrise}")
|
||||||
|
|||||||
@@ -1121,13 +1121,15 @@ class Blender(blenderbim.core.tool.Blender):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def get_sun_position_addon(cls) -> Union[types.ModuleType, None]:
|
def get_sun_position_addon(cls) -> Union[types.ModuleType, None]:
|
||||||
# Check if it's installed as legacy Blender addon.
|
# Check if it's installed as legacy Blender addon.
|
||||||
|
import importlib
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import sun_position
|
sun_position = importlib.import_module("sun_position")
|
||||||
except ImportError:
|
except ImportError:
|
||||||
sun_position = None
|
sun_position = None
|
||||||
|
|
||||||
if sun_position:
|
if sun_position:
|
||||||
return
|
return sun_position
|
||||||
|
|
||||||
# No extensions prior to 4.2.
|
# No extensions prior to 4.2.
|
||||||
if bpy.app.version < (4, 2, 0):
|
if bpy.app.version < (4, 2, 0):
|
||||||
@@ -1136,8 +1138,6 @@ class Blender(blenderbim.core.tool.Blender):
|
|||||||
if sun_position:
|
if sun_position:
|
||||||
return sun_position
|
return sun_position
|
||||||
|
|
||||||
import importlib
|
|
||||||
|
|
||||||
for package_name in bpy.context.preferences.addons.keys():
|
for package_name in bpy.context.preferences.addons.keys():
|
||||||
if package_name.endswith(".sun_position"):
|
if package_name.endswith(".sun_position"):
|
||||||
sun_position = importlib.import_module(package_name)
|
sun_position = importlib.import_module(package_name)
|
||||||
|
|||||||
Reference in New Issue
Block a user