Changeset View
Changeset View
Standalone View
Standalone View
sun_position/properties.py
| # SPDX-License-Identifier: GPL-2.0-or-later | # SPDX-License-Identifier: GPL-2.0-or-later | ||||
| import bpy | import bpy | ||||
| from bpy.types import AddonPreferences, PropertyGroup | from bpy.types import AddonPreferences, PropertyGroup | ||||
| from bpy.props import (StringProperty, EnumProperty, IntProperty, | from bpy.props import (StringProperty, EnumProperty, IntProperty, | ||||
| FloatProperty, BoolProperty, PointerProperty) | FloatProperty, BoolProperty, PointerProperty) | ||||
| from .sun_calc import sun_update, parse_coordinates | from .sun_calc import sun_update, parse_coordinates, surface_update, analemmas_update | ||||
| from .draw import north_update | from .draw import north_update | ||||
| from math import pi | from math import pi | ||||
| from datetime import datetime | from datetime import datetime | ||||
| TODAY = datetime.today() | TODAY = datetime.today() | ||||
| ############################################################################ | ############################################################################ | ||||
| # Sun panel properties | # Sun panel properties | ||||
| Show All 31 Lines | class SunPosProperties(PropertyGroup): | ||||
| north_offset: FloatProperty( | north_offset: FloatProperty( | ||||
| name="North Offset", | name="North Offset", | ||||
| description="Rotate the scene to choose North direction", | description="Rotate the scene to choose North direction", | ||||
| unit="ROTATION", | unit="ROTATION", | ||||
| soft_min=-pi, soft_max=pi, step=10.0, default=0.0, | soft_min=-pi, soft_max=pi, step=10.0, default=0.0, | ||||
| update=sun_update) | update=sun_update) | ||||
| show_surface: BoolProperty( | |||||
| name="Show Surface", | |||||
| description="Draw sun surface", | |||||
| default=False, | |||||
| update=surface_update) | |||||
| show_analemmas: BoolProperty( | |||||
| name="Show Analemmas", | |||||
| description="Draw sun analemmas", | |||||
| default=False, | |||||
| update=analemmas_update) | |||||
| latitude: FloatProperty( | latitude: FloatProperty( | ||||
| name="Latitude", | name="Latitude", | ||||
| description="Latitude: (+) Northern (-) Southern", | description="Latitude: (+) Northern (-) Southern", | ||||
| soft_min=-90.0, soft_max=90.0, | soft_min=-90.0, soft_max=90.0, | ||||
| step=5, precision=3, | step=5, precision=3, | ||||
| default=0.0, | default=0.0, | ||||
| update=sun_update) | update=sun_update) | ||||
| ▲ Show 20 Lines • Show All 117 Lines • ▼ Show 20 Lines | class SunPosProperties(PropertyGroup): | ||||
| time_spread: FloatProperty( | time_spread: FloatProperty( | ||||
| name="Time Spread", | name="Time Spread", | ||||
| description="Time period in which to spread object collection", | description="Time period in which to spread object collection", | ||||
| precision=4, | precision=4, | ||||
| soft_min=1.0, soft_max=24.0, step=1.0, default=23.0, | soft_min=1.0, soft_max=24.0, step=1.0, default=23.0, | ||||
| update=sun_update) | update=sun_update) | ||||
| ############################################################################ | ############################################################################ | ||||
| # Preference panel properties | # Preference panel properties | ||||
| ############################################################################ | ############################################################################ | ||||
| class SunPosAddonPreferences(AddonPreferences): | class SunPosAddonPreferences(AddonPreferences): | ||||
| bl_idname = __package__ | bl_idname = __package__ | ||||
| show_time_place: BoolProperty( | show_time_place: BoolProperty( | ||||
| name="Time and place presets", | name="Time and place presets", | ||||
| description="Show time/place presets", | description="Show time/place presets", | ||||
| default=False) | default=False) | ||||
| show_dms: BoolProperty( | show_dms: BoolProperty( | ||||
| name="D° M' S\"", | name="D° M' S\"", | ||||
| description="Show lat/long degrees, minutes, seconds labels", | description="Show lat/long degrees, minutes, seconds labels", | ||||
| default=True) | default=True) | ||||
| show_north: BoolProperty( | show_north: BoolProperty( | ||||
| name="Show North", | name="Show North", | ||||
| description="Show north offset choice and slider", | description="Show north offset choice and slider", | ||||
| default=True, | default=True, | ||||
| update=sun_update) | update=sun_update) | ||||
| show_surface: BoolProperty( | |||||
| name="Show Surface", | |||||
| description="Show sun surface choice and slider", | |||||
| default=True, | |||||
| update=sun_update) | |||||
| show_analemmas: BoolProperty( | |||||
| name="Show Analemmas", | |||||
| description="Show analemmas choice and slider", | |||||
| default=True, | |||||
| update=sun_update) | |||||
| show_refraction: BoolProperty( | show_refraction: BoolProperty( | ||||
| name="Refraction", | name="Refraction", | ||||
| description="Show sun refraction choice", | description="Show sun refraction choice", | ||||
| default=True, | default=True, | ||||
| update=sun_update) | update=sun_update) | ||||
| show_az_el: BoolProperty( | show_az_el: BoolProperty( | ||||
| name="Azimuth and elevation info", | name="Azimuth and elevation info", | ||||
| Show All 17 Lines | def draw(self, context): | ||||
| box = layout.box() | box = layout.box() | ||||
| col = box.column() | col = box.column() | ||||
| col.label(text="Show options or labels:") | col.label(text="Show options or labels:") | ||||
| flow = col.grid_flow(columns=0, even_columns=True, even_rows=False, align=False) | flow = col.grid_flow(columns=0, even_columns=True, even_rows=False, align=False) | ||||
| flow.prop(self, "show_time_place") | flow.prop(self, "show_time_place") | ||||
| flow.prop(self, "show_dms") | flow.prop(self, "show_dms") | ||||
| flow.prop(self, "show_north") | flow.prop(self, "show_north") | ||||
| flow.prop(self, "show_surface") | |||||
| flow.prop(self, "show_analemmas") | |||||
| flow.prop(self, "show_refraction") | flow.prop(self, "show_refraction") | ||||
| flow.prop(self, "show_az_el") | flow.prop(self, "show_az_el") | ||||
| flow.prop(self, "show_daylight_savings") | flow.prop(self, "show_daylight_savings") | ||||
| flow.prop(self, "show_rise_set") | flow.prop(self, "show_rise_set") | ||||