mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 01:41:57 +00:00
make sun_position an optional addon for bbim
This commit is contained in:
@@ -21,7 +21,12 @@ import blf
|
||||
import gpu
|
||||
import bmesh
|
||||
import blenderbim.tool as tool
|
||||
import sun_position.sun_calc
|
||||
|
||||
try:
|
||||
import sun_position.sun_calc
|
||||
except ImportError:
|
||||
sun_position = None
|
||||
|
||||
from bpy.types import SpaceView3D
|
||||
from math import radians
|
||||
from mathutils import Vector, Matrix
|
||||
|
||||
@@ -20,7 +20,12 @@ import bpy
|
||||
import pytz
|
||||
import tzfpy
|
||||
import datetime
|
||||
import sun_position.sun_calc
|
||||
|
||||
try:
|
||||
import sun_position.sun_calc
|
||||
except ImportError:
|
||||
sun_position = None
|
||||
|
||||
import blenderbim.tool as tool
|
||||
from math import radians, pi
|
||||
from mathutils import Euler, Vector, Matrix, Quaternion
|
||||
|
||||
@@ -18,7 +18,12 @@
|
||||
|
||||
import bpy
|
||||
from blenderbim.bim.module.light.data import SolarData
|
||||
from sun_position.sun_calc import format_time, format_hms, sun
|
||||
|
||||
try:
|
||||
import sun_position
|
||||
from sun_position.sun_calc import format_time, format_hms, sun
|
||||
except ImportError:
|
||||
sun_position = None
|
||||
|
||||
|
||||
class BIM_PT_radiance_exporter(bpy.types.Panel):
|
||||
@@ -35,6 +40,10 @@ class BIM_PT_radiance_exporter(bpy.types.Panel):
|
||||
layout = self.layout
|
||||
scene = context.scene
|
||||
|
||||
if sun_position is None:
|
||||
layout.label(text="Enable 'Sun Position' addon to continue.")
|
||||
return
|
||||
|
||||
props = scene.radiance_exporter_properties
|
||||
|
||||
row = layout.row()
|
||||
@@ -78,6 +87,10 @@ class BIM_PT_solar(bpy.types.Panel):
|
||||
bl_options = {"HIDE_HEADER"}
|
||||
|
||||
def draw(self, context):
|
||||
if sun_position is None:
|
||||
self.layout.label(text="Enable 'Sun Position' addon to continue.")
|
||||
return
|
||||
|
||||
if not SolarData.is_loaded:
|
||||
SolarData.load()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user