From 857998f409951f2f2454756841abd43fd456587a Mon Sep 17 00:00:00 2001 From: Damien Picard Date: Tue, 21 Apr 2020 10:44:36 +0200 Subject: Sun position: add time and place presets, remove reset operator --- sun_position/__init__.py | 2 -- sun_position/ui_sun.py | 35 ----------------------------------- 2 files changed, 37 deletions(-) (limited to 'sun_position') diff --git a/sun_position/__init__.py b/sun_position/__init__.py index c1638ef6..ddbc2bc0 100644 --- a/sun_position/__init__.py +++ b/sun_position/__init__.py @@ -62,7 +62,6 @@ def register(): description="Sun Position Settings")) bpy.utils.register_class(properties.SunPosAddonPreferences) bpy.utils.register_class(ui_sun.SUNPOS_OT_AddPreset) - bpy.utils.register_class(ui_sun.SUNPOS_OT_DefaultPresets) bpy.utils.register_class(ui_sun.SUNPOS_MT_Presets) bpy.utils.register_class(ui_sun.SUNPOS_PT_Panel) bpy.utils.register_class(ui_sun.SUNPOS_PT_Location) @@ -78,7 +77,6 @@ def unregister(): bpy.utils.unregister_class(ui_sun.SUNPOS_PT_Location) bpy.utils.unregister_class(ui_sun.SUNPOS_PT_Time) bpy.utils.unregister_class(ui_sun.SUNPOS_MT_Presets) - bpy.utils.unregister_class(ui_sun.SUNPOS_OT_DefaultPresets) bpy.utils.unregister_class(ui_sun.SUNPOS_OT_AddPreset) bpy.utils.unregister_class(properties.SunPosAddonPreferences) del bpy.types.Scene.sun_pos_properties diff --git a/sun_position/ui_sun.py b/sun_position/ui_sun.py index 6dcc0905..e14d9600 100644 --- a/sun_position/ui_sun.py +++ b/sun_position/ui_sun.py @@ -63,40 +63,6 @@ class SUNPOS_OT_AddPreset(AddPresetBase, Operator): preset_subdir = "operator/sun_position" -class SUNPOS_OT_DefaultPresets(Operator): - '''Copy Sun Position default presets''' - bl_idname = "world.sunpos_default_presets" - bl_label = "Copy Sun Position default presets" - - def execute(self, context): - preset_dirpath = bpy.utils.user_resource('SCRIPTS', path="presets/operator/sun_position", create=True) - # [month, day, time, UTC, lat, lon, dst] - presets = {"chongqing.py": [10, 1, 7.18, 8, 29.5583, 106.567, False], - "sao_paulo.py": [9, 7, 12.0, -3, -23.55, -46.6333, False], - "kinshasa.py": [6, 30, 12.0, 1, -4.325, 15.3222, False], - "london.py": [6, 11, 12.0, 0, 51.5072, -0.1275, True], - "new_york.py": [7, 4, 12.0, -5, 40.6611, -73.9439, True], - "sydney.py": [1, 26, 17.6, 10, -33.865, 151.209, False]} - - script = '''import bpy -sun_props = bpy.context.scene.sun_pos_properties - -sun_props.month = {:d} -sun_props.day = {:d} -sun_props.time = {:f} -sun_props.UTC_zone = {:d} -sun_props.latitude = {:f} -sun_props.longitude = {:f} -sun_props.use_daylight_savings = {} -''' - - for path, p in presets.items(): - print(p) - with open(os.path.join(preset_dirpath, path), 'w') as f: - f.write(script.format(*p)) - - return {'FINISHED'} - # ------------------------------------------------------------------- # # Draw the Sun Panel, sliders, et. al. @@ -168,7 +134,6 @@ class SUNPOS_PT_Panel(bpy.types.Panel): row.menu(SUNPOS_MT_Presets.__name__, text=SUNPOS_MT_Presets.bl_label) row.operator(SUNPOS_OT_AddPreset.bl_idname, text="", icon='ADD') row.operator(SUNPOS_OT_AddPreset.bl_idname, text="", icon='REMOVE').remove_active = True - row.operator(SUNPOS_OT_DefaultPresets.bl_idname, text="", icon='FILE_REFRESH') col = layout.column(align=True) col.use_property_split = True -- cgit v1.2.3