Light UI - detect Sun Position addon activation/deactivation more reliably

This commit is contained in:
Andrej730
2025-06-23 19:05:12 +05:00
parent 623997b40d
commit 4574351817
+8 -3
View File
@@ -146,10 +146,17 @@ class BIM_PT_solar(bpy.types.Panel):
SolarData.load()
assert self.layout
if (sun_position := SolarData.data["sun_position"]) is None:
# Props are more reliable as they'll come and go regardless of Data update.
if (sun_props := tool.Blender.get_sun_props()) is None:
self.layout.label(text="Enable 'Sun Position' Add-on To Continue", icon="ERROR")
return
sun_position = SolarData.data["sun_position"]
if sun_position is None:
# There are props, so there must be an addon.
SolarData.data["sun_position"] = SolarData.sun_position()
if TYPE_CHECKING:
import sun_position
@@ -163,8 +170,6 @@ class BIM_PT_solar(bpy.types.Panel):
row = self.layout.row(align=True)
row.label(text="No Sites With Lat/Longs Found", icon="ERROR")
sun_props = tool.Blender.get_sun_props()
row = self.layout.row(align=True)
row.alignment = "RIGHT"
row.operator("bim.light_pick_coordinates", icon="URL", text="Pick")