[Bf-extensions-cvs] [ab0c2572] master: sun_position: remove world map operator and image file
Damien Picard
noreply at git.blender.org
Wed Dec 4 01:42:34 CET 2019
Commit: ab0c2572c13b93797d4ef2ba41edc8a05308fa41
Author: Damien Picard
Date: Tue Dec 3 13:02:09 2019 +0100
Branches: master
https://developer.blender.org/rBACab0c2572c13b93797d4ef2ba41edc8a05308fa41
sun_position: remove world map operator and image file
===================================================================
D sun_position/World.jpg
M sun_position/__init__.py
D sun_position/map.py
M sun_position/properties.py
M sun_position/ui_sun.py
===================================================================
diff --git a/sun_position/World.jpg b/sun_position/World.jpg
deleted file mode 100644
index 84b37e3a..00000000
Binary files a/sun_position/World.jpg and /dev/null differ
diff --git a/sun_position/__init__.py b/sun_position/__init__.py
index 6cce76f3..de2dd858 100644
--- a/sun_position/__init__.py
+++ b/sun_position/__init__.py
@@ -24,10 +24,6 @@
# freely by the public as outlined in their policies at
# www.nws.noaa.gov/disclaimer.php
# --------------------------------------------------------------------------
-# The world map images have been composited from two NASA images.
-# NASA's image use policy can be found at:
-# http://www.nasa.gov/audience/formedia/features/MP_Photo_Guidelines.html
-# --------------------------------------------------------------------------
# The geo parser script is by Maximilian Högner, released
# under the GNU GPL license:
# http://hoegners.de/Maxi/geo/
@@ -52,11 +48,10 @@ if "bpy" in locals():
import importlib
importlib.reload(properties)
importlib.reload(ui_sun)
- # importlib.reload(map)
importlib.reload(hdr)
else:
- from . import properties, ui_sun, hdr#, map
+ from . import properties, ui_sun, hdr
import bpy
@@ -73,13 +68,11 @@ def register():
bpy.utils.register_class(ui_sun.SUNPOS_MT_Presets)
bpy.utils.register_class(ui_sun.SUNPOS_PT_Panel)
bpy.utils.register_class(hdr.SUNPOS_OT_ShowHdr)
- # bpy.utils.register_class(map.SunPos_Help)
bpy.app.handlers.frame_change_post.append(sun_calc.sun_handler)
def unregister():
- # bpy.utils.unregister_class(map.SunPos_Help)
bpy.utils.unregister_class(hdr.SUNPOS_OT_ShowHdr)
bpy.utils.unregister_class(ui_sun.SUNPOS_PT_Panel)
bpy.utils.unregister_class(ui_sun.SUNPOS_MT_Presets)
diff --git a/sun_position/map.py b/sun_position/map.py
deleted file mode 100644
index e90b6692..00000000
--- a/sun_position/map.py
+++ /dev/null
@@ -1,1299 +0,0 @@
-### BEGIN GPL LICENSE BLOCK #####
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# ##### END GPL LICENSE BLOCK #####
-
-# -*- coding: utf-8 -*-
-
-import bpy
-import bgl
-import blf
-import sys
-import os
-import datetime
-import math
-
-from math import radians
-from . sun_calc import format_hms, sun
-
-# ---------------------------------------------------------------------------
-
-
-class MapObject:
-
- class Origin:
- x = 0
- y = 0
-
- def __init__(self, t, w, h):
- self.type = t
- self.width = w
- self.height = h
- self.height_factor = .50
- self.opacity = 1.0
- self.focused = False
- self.view3d_area = None
- self.color_style = 'N'
- self.origin = self.Origin()
-
- def set_dimensions(self, width):
- self.width = width
- self.height = int(width * self.height_factor)
-
- def check_focus(self, context, event):
- self.focused = self.is_focused(context, event)
- return self.focused
-
- def is_focused(self, context, event):
- if context.area != self.view3d_area:
- return False
-
- x = event.mouse_region_x
- y = event.mouse_region_y
-
- for reg in self.view3d_area.regions:
- if reg.type == 'WINDOW':
- if x < 0 or x > reg.width:
- return False
- else:
- break
-
- if x < self.origin.x or x > (self.origin.x + self.width) or \
- y < self.origin.y or y > (self.origin.y + self.height) or \
- y < 0 or y > reg.height:
- return False
- return True
-
- def near_border(self, context, event):
- if context.area != self.view3d_area:
- return False
-
- x = event.mouse_region_x
- y = event.mouse_region_y
-
- for reg in self.view3d_area.regions:
- if reg.type == 'WINDOW':
- if x < 20 or x > (reg.width - 20) or \
- y < 20 or y > (reg.height - 20):
- return True
- else:
- break
- return False
-
-# ---------------------------------------------------------------------------
-
-
-class MapClass:
-
- class mouse:
- pass
-
- class grab:
-
- class spot:
- pass
-
- class offset:
- pass
-
- class zoom:
- pass
-
- class image:
- pass
-
- def __init__(self):
- self.handler1 = None
- self.handler2 = None
- self.view3d_area = None
- self.draw_region = None
- self.glImage = None
- self.mapLocation = 'VIEWPORT'
- self.init_zoom_preference = True
- self.reset(self.mapLocation)
-
- def init(self, location):
- self.object = [MapObject('MAP', 0, 0), MapObject('TEXT', 100, 160)]
- self.object[0].set_dimensions(200)
- self.object[1].origin.x = 10
- self.object[1].origin.y = 80
- self.mapLocation = location
-
- def zoom_preferences(self, invert_zoom_wheel, invert_mouse_zoom):
- self.init_zoom_preference = False
- if invert_zoom_wheel:
- self.zoom.wheel_up = 'OUT'
- self.zoom.wheel_down = 'IN'
- else:
- self.zoom.wheel_up = 'IN'
- self.zoom.wheel_down = 'OUT'
- if invert_mouse_zoom:
- self.zoom.mouse_up = 'IN'
- self.zoom.mouse_down = 'OUT'
- else:
- self.zoom.mouse_up = 'OUT'
- self.zoom.mouse_down = 'IN'
-
- def reset(self, location):
- self.init(location)
- self.action = None
- self.is_active = False
- self.start = False
- self.stop = False
- self.lock_crosshair = True
- self.show_info = False
- self.latitude = 0.0
- self.longitude = 0.0
- self.ctrl_press = False
- self.alt_press = False
- self.line_width = 1.0
- self.textureless = False
- self.mouse.x = 0
- self.mouse.y = 0
- self.grab.spot.x = 0
- self.grab.spot.y = 0
- self.grab.offset.x = 0
- self.grab.offset.y = 0
- self.zoom.width = 0
- self.zoom.x = 0
- self.zoom.y = 0
- self.image.name = None
- self.image.bindcode = 0
- self.image.loaded = False
- self.image.free_it = False
-
- def clear_callbacks(self):
- if self.mapLocation == 'PANEL':
- pl = bpy.types.SpaceProperties
- else:
- pl = bpy.types.SpaceView3D
- if self.handler2 is not None:
- pl.draw_handler_remove(self.handler2, 'WINDOW')
- self.handler2 = None
- if self.handler1 is not None:
- pl.draw_handler_remove(self.handler1, 'WINDOW')
- self.handler1 = None
-
- def set_view3d_area(self, area):
- for obj in self.object:
- obj.view3d_area = area
-
- def activate(self, context):
- if context.area.type == 'PROPERTIES':
- self.reset(self.mapLocation)
-
- def fw(self, context):
- if self.mapLocation == 'PANEL':
- self.draw_region = context.region
- areas = bpy.context.screen.areas
- for area in areas:
- if area.type == 'VIEW_3D':
- self.view3d_area = context.area
- if self.mapLocation == 'PANEL':
- return True
- for reg in area.regions:
- if reg.type == 'WINDOW':
- self.draw_region = reg
- Display.refresh()
- return True
- return False
- if not fw(self, context):
- self.draw_region = context.region
-
- self.set_view3d_area(self.view3d_area)
- self.start = True
- if self.mapLocation == 'PANEL':
- self.handler1 = bpy.types.SpaceProperties.draw_handler_add(
- Map_load_callback,
- (self, context), 'WINDOW', 'POST_PIXEL')
- else:
- self.handler1 = bpy.types.SpaceView3D.draw_handler_add(
- Map_load_callback,
- (self, context), 'WINDOW', 'POST_PIXEL')
- self.is_active = True
- return True
- else:
- return False
-
- def activateBGLcallback(self, context):
- if self.mapLocation == 'PANEL':
- self.handler2 = bpy.types.SpaceProperties.draw_handler_add(
- Draw_map_callback,
- (self, context), 'WINDOW', 'POST_PIXEL')
- else:
- self.handler2 = bpy.types.SpaceView3D.draw_handler_add(
- Draw_map_callback,
- (self, context), 'WINDOW', 'POST_PIXEL')
- self.view3d_area = context.area
- self.set_view3d_area(self.view3d_area)
- bpy.ops.sunpos.map('INVOKE_DEFAULT')
-
- def deactivate(self):
- self.clear_callbacks()
- self.stop = False
- self.action = None
- self.image.loaded = False
- if self.glImage is not None:
- try:
- if self.glImage.bindcode == self.image.bindcode:
- self.glImage.gl_free()
- bpy.data.images.remove(self.glImage)
- except:
- pass
- self.image.free_it =
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-extensions-cvs
mailing list