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