[Bf-extensions-cvs] [44eb1ac2] master: Geographical Sun: Remove the dependency on the extensions_framework

lijenstina noreply at git.blender.org
Tue Oct 17 21:36:58 CEST 2017


Commit: 44eb1ac20eddca183d820d26522a81a5f7a97aa9
Author: lijenstina
Date:   Tue Oct 17 19:36:09 2017 +0200
Branches: master
https://developer.blender.org/rBAC44eb1ac20eddca183d820d26522a81a5f7a97aa9

Geographical Sun: Remove the dependency on the extensions_framework

Bump version to 0.0.2

Part of T52564:
Fix crash during unregister releted to access of PropertyGroup
in current master (Blender 2.79.1)

Refactor code to remove the extensions_framework dependency:
- Use register and unregister for classes
- Declare the menu classes explicitly
- Use a PropertyGroup attached to the SunLamp

Pep 8 cleanup
Add some missing tooltips
Small UI changes

Note: This seems the only add-on using the framework

===================================================================

M	lamp_geographical_sun.py

===================================================================

diff --git a/lamp_geographical_sun.py b/lamp_geographical_sun.py
index 79ec6c7c..8a24407c 100644
--- a/lamp_geographical_sun.py
+++ b/lamp_geographical_sun.py
@@ -1,6 +1,6 @@
 # -*- coding: utf-8 -*-
 #
-# ***** BEGIN GPL LICENSE BLOCK *****
+# ##### BEGIN GPL LICENSE BLOCK #####
 #
 # --------------------------------------------------------------------------
 # Blender 2.5 Geographical Sun Add-On
@@ -22,235 +22,247 @@
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, see <http://www.gnu.org/licenses/>.
 #
-# ***** END GPL LICENCE BLOCK *****
-#
-
-# System imports
-#-----------------------------------------------------------------------------
-import datetime, math, time
-today = datetime.datetime.now()
+# ##### END GPL LICENCE BLOCK #####
 
-# Blender imports
-#-----------------------------------------------------------------------------
-import bpy
-from extensions_framework import Addon, declarative_property_group
-from extensions_framework.ui import property_group_renderer
+# Note: Update to version 0.0.2 remove the dependency on modules\extensions_framework
 
-# Addon setup
-#-----------------------------------------------------------------------------
 bl_info = {
     "name": "Geographical Sun",
     "author": "Doug Hammond (dougal2)",
-    "version": (0, 0, 1),
-    "blender": (2, 56, 0),
+    "version": (0, 0, 2),
+    "blender": (2, 7, 0),
     "category": "Lighting",
     "location": "Lamp data > Geographical Sun",
     "warning": "",
     "wiki_url": "",
     "tracker_url": "https://developer.blender.org/maniphest/task/edit/form/2/",
-    "description": "Set SUN Lamp rotation according to geographical time and location."
+    "description": "Set Sun Lamp rotation according to geographical time and location"
 }
-GeoSunAddon = Addon(bl_info)
+
+import bpy
+import datetime
+from math import (
+        asin, sin, cos,
+        tan, atan, radians,
+        degrees, floor,
+        )
+import time
+
+today = datetime.datetime.now()
+
+from bpy.types import (
+        Operator,
+        Menu,
+        Panel,
+        PropertyGroup,
+        )
+from bpy.props import (
+        BoolProperty,
+        FloatProperty,
+        IntProperty,
+        PointerProperty,
+        )
+
 
 # Sun rotation calculator implementation
-#-----------------------------------------------------------------------------
 class sun_calculator(object):
     """
     Based on SunLight v1.0 by Miguel Kabantsov (miguelkab at gmail.com)
-    Replaces the faulty sun position calculation algorythm with a precise calculation (Source for algorythm: http://de.wikipedia.org/wiki/Sonnenstand),
+    Replaces the faulty sun position calculation algorythm with a precise calculation
+   (Source for algorythm: http://de.wikipedia.org/wiki/Sonnenstand),
     Co-Ordinates: http://www.bcca.org/misc/qiblih/latlong.html
     Author: Nils-Peter Fischer (Nils-Peter.Fischer at web.de)
     """
 
-    location_list = [
-        ("EUROPE",[
-            ("Antwerp, Belgium",            67),
-            ("Berlin, Germany",             1),
+    location_list = {
+        "EUROPE": [
+            ("Antwerp, Belgium", 67),
+            ("Berlin, Germany", 1),
             ("Bratislava, Slovak Republic", 70),
-            ("Brno, Czech Republic",        72),
-            ("Brussles, Belgium",           68),
-            ("Geneva, Switzerland",         65),
-            ("Helsinki, Finland",           7),
-            ("Innsbruck, Austria",          62),
-            ("Kyiv, Ukraine",               64),
-            ("London, England",             10),
-            ("Lyon, France",                66),
-            ("Nitra, Slovak Republic",      69),
-            ("Oslo, Norway",                58),
-            ("Paris, France",               15),
-            ("Praha, Czech Republic",       71),
-            ("Rome, Italy",                 18),
-            ("Telfs, Austria",              63),
-            ("Warsaw, Poland",              74),
-            ("Wroclaw, Poland",             73),
-            ("Zurich, Switzerland",         21),
-        ]),
-
-        ("WORLD CITIES", [
-            ("Beijing, China",              0),
-            ("Bombay, India",               2),
-            ("Buenos Aires, Argentina",     3),
-            ("Cairo, Egypt",                4),
-            ("Cape Town, South Africa",     5),
-            ("Caracas, Venezuela",          6),
-            ("Curitiba, Brazil",            60),
-            ("Hong Kong, China",            8),
-            ("Jerusalem, Israel",           9),
-            ("Joinville, Brazil",           61),
-            ("Mexico City, Mexico",         11),
-            ("Moscow, Russia",              12),
-            ("New Delhi, India",            13),
-            ("Ottawa, Canada",              14),
-            ("Rio de Janeiro, Brazil",      16),
-            ("Riyadh, Saudi Arabia",        17),
-            ("Sao Paulo, Brazil",           59),
-            ("Sydney, Australia",           19),
-            ("Tokyo, Japan",                20),
-        ]),
-
-        ("US CITIES", [
-            ("Albuquerque, NM",             22),
-            ("Anchorage, AK",               23),
-            ("Atlanta, GA",                 24),
-            ("Austin, TX",                  25),
-            ("Birmingham, AL",              26),
-            ("Bismarck, ND",                27),
-            ("Boston, MA",                  28),
-            ("Boulder, CO",                 29),
-            ("Chicago, IL",                 30),
-            ("Dallas, TX",                  31),
-            ("Denver, CO",                  32),
-            ("Detroit, MI",                 33),
-            ("Honolulu, HI",                34),
-            ("Houston, TX",                 35),
-            ("Indianapolis, IN",            36),
-            ("Jackson, MS",                 37),
-            ("Kansas City, MO",             38),
-            ("Los Angeles, CA",             39),
-            ("Menomonee Falls, WI",         40),
-            ("Miami, FL",                   41),
-            ("Minneapolis, MN",             42),
-            ("New Orleans, LA",             43),
-            ("New York City, NY",           44),
-            ("Oklahoma City, OK",           45),
-            ("Philadelphia, PA",            46),
-            ("Phoenix, AZ",                 47),
-            ("Pittsburgh, PA",              48),
-            ("Portland, ME",                49),
-            ("Portland, OR",                50),
-            ("Raleigh, NC",                 51),
-            ("Richmond, VA",                52),
-            ("Saint Louis, MO",             53),
-            ("San Diego, CA",               54),
-            ("San Francisco, CA",           55),
-            ("Seattle, WA",                 56),
-            ("Washington DC",               57),
-        ])
-    ]
+            ("Brno, Czech Republic", 72),
+            ("Brussles, Belgium", 68),
+            ("Geneva, Switzerland", 65),
+            ("Helsinki, Finland", 7),
+            ("Innsbruck, Austria", 62),
+            ("Kyiv, Ukraine", 64),
+            ("London, England", 10),
+            ("Lyon, France", 66),
+            ("Nitra, Slovak Republic", 69),
+            ("Oslo, Norway", 58),
+            ("Paris, France", 15),
+            ("Praha, Czech Republic", 71),
+            ("Rome, Italy", 18),
+            ("Telfs, Austria", 63),
+            ("Warsaw, Poland", 74),
+            ("Wroclaw, Poland", 73),
+            ("Zurich, Switzerland", 21),
+        ],
+
+        "WORLD_CITIES": [
+            ("Beijing, China", 0),
+            ("Bombay, India", 2),
+            ("Buenos Aires, Argentina", 3),
+            ("Cairo, Egypt", 4),
+            ("Cape Town, South Africa", 5),
+            ("Caracas, Venezuela", 6),
+            ("Curitiba, Brazil", 60),
+            ("Hong Kong, China", 8),
+            ("Jerusalem, Israel", 9),
+            ("Joinville, Brazil", 61),
+            ("Mexico City, Mexico", 11),
+            ("Moscow, Russia", 12),
+            ("New Delhi, India", 13),
+            ("Ottawa, Canada", 14),
+            ("Rio de Janeiro, Brazil", 16),
+            ("Riyadh, Saudi Arabia", 17),
+            ("Sao Paulo, Brazil", 59),
+            ("Sydney, Australia", 19),
+            ("Tokyo, Japan", 20),
+        ],
+
+        "USA_CITIES": [
+            ("Albuquerque, NM", 22),
+            ("Anchorage, AK", 23),
+            ("Atlanta, GA", 24),
+            ("Austin, TX", 25),
+            ("Birmingham, AL", 26),
+            ("Bismarck, ND", 27),
+            ("Boston, MA", 28),
+            ("Boulder, CO", 29),
+            ("Chicago, IL", 30),
+            ("Dallas, TX", 31),
+            ("Denver, CO", 32),
+            ("Detroit, MI", 33),
+            ("Honolulu, HI", 34),
+            ("Houston, TX", 35),
+            ("Indianapolis, IN", 36),
+            ("Jackson, MS", 37),
+            ("Kansas City, MO", 38),
+            ("Los Angeles, CA", 39),
+            ("Menomonee Falls, WI", 40),
+            ("Miami, FL", 41),
+            ("Minneapolis, MN", 42),
+            ("New Orleans, LA", 43),
+            ("New York City, NY", 44),
+            ("Oklahoma City, OK", 45),
+            ("Philadelphia, PA", 46),
+            ("Phoenix, AZ", 47),
+            ("Pittsburgh, PA", 48),
+            ("Portland, ME", 49),
+            ("Portland, OR", 50),
+            ("Raleigh, NC", 51),
+            ("Richmond, VA", 52),
+            ("Saint Louis, MO", 53),
+            ("San Diego, CA", 54),
+            ("San Francisco, CA", 55),
+            ("Seattle, WA", 56),
+            ("Washington DC", 57),
+        ]
+    }
 
     location_data = {
         # Europe
-        67: ( 51.2167, 4.4, 1),
-        1:  ( 52.33, 13.30, 1),
-        70: ( 48.17, 17.17, 1),
-        72: ( 49.2, 16.63, 1),
-        68: ( 58.8467, 4.3525, 1),
-        65: ( 46.217, 6.150, 1),
-        7:  ( 60.1667, 24.9667,2),
-        62: ( 47.2672, 11.3928, 1),
-        64: ( 50.75, 30.0833, 2),
-        10: ( 51.50, 0.0, 0),
-        66: ( 45.767, 4.833, 1),
-        69: ( 48.32, 18.07, 1),
-        58: ( 59.56, 10.41, 

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-extensions-cvs mailing list