[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [4312] contrib/py/scripts/addons: Addons: Updated for API change (draw handlers) and minor code cleanups.

Sebastian Nell codemanx at gmx.de
Wed Feb 20 00:56:04 CET 2013


Revision: 4312
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=4312
Author:   codemanx
Date:     2013-02-19 23:56:04 +0000 (Tue, 19 Feb 2013)
Log Message:
-----------
Addons: Updated for API change (draw handlers) and minor code cleanups.

Fixed wrong order of multiplication (mat*vec) in Game Prop Visulizer.

Added overlay limit prop to VGroupsWeights addon to prevent Blender hangups, uses a mix of bm.select_history and bm.verts (since select_history doesn't support lasso, box and similar selection types).

Modified Paths:
--------------
    contrib/py/scripts/addons/anim_selection_sets.py
    contrib/py/scripts/addons/animation_motion_trail.py
    contrib/py/scripts/addons/mesh_show_vgroup_weights.py
    contrib/py/scripts/addons/space_view3d_game_props_visualiser.py

Modified: contrib/py/scripts/addons/anim_selection_sets.py
===================================================================
--- contrib/py/scripts/addons/anim_selection_sets.py	2013-02-19 16:21:17 UTC (rev 4311)
+++ contrib/py/scripts/addons/anim_selection_sets.py	2013-02-19 23:56:04 UTC (rev 4312)
@@ -12,7 +12,7 @@
  #
  #  You should have received a copy of the GNU General Public License
  #  along with this program; if not, see <http://www.gnu.org/licenses/>
- #  and write to the Free Software Foundation, Inc., 51 Franklin Street, 
+ #  and write to the Free Software Foundation, Inc., 51 Franklin Street,
  #  Fifth Floor, Boston, MA  02110-1301, USA..
  #
  #  The Original Code is Copyright (C) 2012 Blender Foundation ###
@@ -35,8 +35,8 @@
   "author": "Dan Eicher",
   "version": (0, 1, 1),
   "blender": (2, 65, 4),
-  "location": "Properties -> Object Data -> Selection Sets",
-  "description": "Selection Sets to select groups of bones",
+  "location": "Properties > Object data (Armature) > Selection Sets",
+  "description": "Selection Sets to select groups of posebones",
   "warning": "Proxy armatures need to export sets and run generated script on re-opening file",
   "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts/Animation/SelectionSets",
   "tracker_url": "http://projects.blender.org/tracker/index.php?func=detail&aid=31492",

Modified: contrib/py/scripts/addons/animation_motion_trail.py
===================================================================
--- contrib/py/scripts/addons/animation_motion_trail.py	2013-02-19 16:21:17 UTC (rev 4311)
+++ contrib/py/scripts/addons/animation_motion_trail.py	2013-02-19 23:56:04 UTC (rev 4312)
@@ -22,8 +22,8 @@
 bl_info = {
     "name": "Motion Trail",
     "author": "Bart Crouch",
-    "version": (3, 1, 1),
-    "blender": (2, 61, 0),
+    "version": (3, 1, 2),
+    "blender": (2, 65, 4),
     "location": "View3D > Toolbar > Motion Trail tab",
     "warning": "",
     "description": "Display and edit motion trails in the 3d-view",
@@ -59,10 +59,10 @@
         else:
             self.loc = object.rotation_euler[index]
         self.keyframe_points = []
-    
+
     def evaluate(self, frame):
         return(self.loc)
-    
+
     def range(self):
         return([])
 
@@ -92,7 +92,7 @@
                 if current_strip.strips:
                     # meta strip
                     not_handled += [s for s in current_strip.strips]
-        
+
         for strip in strips:
             if child:
                 # posebone
@@ -109,7 +109,7 @@
     else:
         # should not happen?
         curves = []
-    
+
     # ensure we have three curves per object
     fcx = None
     fcy = None
@@ -137,7 +137,7 @@
         context.region, context.region_data, [x,y])
     vector = view3d_utils.region_2d_to_location_3d(\
         context.region, context.region_data, [x,y], depth_vector)
-    
+
     return(vector)
 
 
@@ -150,7 +150,7 @@
 
     x = int(width_half + width_half * (prj.x / prj.w))
     y = int(height_half + height_half * (prj.y / prj.w))
-    
+
     # correction for corner cases in perspective mode
     if prj.w < 0:
         if x < 0:
@@ -161,7 +161,7 @@
             y = context.region.height * 2
         else:
             y = context.region.height * -2
-    
+
     return(x, y)
 
 
@@ -184,7 +184,7 @@
         locy = fcy.evaluate(frame)
         locz = fcz.evaluate(frame)
         loc = mathutils.Vector([locx, locy, locz])
-    
+
     return(loc)
 
 
@@ -192,14 +192,14 @@
 def get_original_animation_data(context, keyframes):
     keyframes_ori = {}
     handles_ori = {}
-    
+
     if context.active_object and context.active_object.mode == 'POSE':
         armature_ob = context.active_object
         objects = [[armature_ob, pb, armature_ob] for pb in \
             context.selected_pose_bones]
     else:
         objects = [[ob, False, False] for ob in context.selected_objects]
-    
+
     for action_ob, child, offset_ob in objects:
         if not action_ob.animation_data:
             continue
@@ -211,14 +211,14 @@
             display_ob = child
         else:
             display_ob = action_ob
-        
+
         # get keyframe positions
         frame_old = context.scene.frame_current
         keyframes_ori[display_ob.name] = {}
         for frame in keyframes[display_ob.name]:
             loc = get_location(frame, display_ob, offset_ob, curves)
             keyframes_ori[display_ob.name][frame] = [frame, loc]
-        
+
         # get handle positions
         handles_ori[display_ob.name] = {}
         for frame in keyframes[display_ob.name]:
@@ -248,10 +248,10 @@
                 left_z]
             handles_ori[display_ob.name][frame]["right"] = [right_x, right_y,
                 right_z]
-        
+
         if context.scene.frame_current != frame_old:
             context.scene.frame_set(frame_old)
-    
+
     return(keyframes_ori, handles_ori)
 
 
@@ -267,12 +267,12 @@
         selection_change = False
     else:
         selection_change = True
-    
+
     if self.lock and not selection_change and \
     context.region_data.perspective_matrix == self.perspective and not \
     context.window_manager.motion_trail.force_update:
         return
-    
+
     # dictionaries with key: objectname
     self.paths = {} # value: list of lists with x, y, color
     self.keyframes = {} # value: dict with frame as key and [x,y] as value
@@ -294,10 +294,10 @@
     self.perspective = context.region_data.perspective_matrix.copy()
     self.displayed = objects # store, so it can be checked next time
     context.window_manager.motion_trail.force_update = False
-   
+
     global_undo = context.user_preferences.edit.use_global_undo
     context.user_preferences.edit.use_global_undo = False
-    
+
     for action_ob, child, offset_ob in objects:
         if selection_change:
             if not child:
@@ -308,13 +308,13 @@
                 mat = editbones[child.name].matrix.copy().to_3x3().inverted()
                 bpy.ops.object.mode_set(mode='POSE')
                 self.edit_bones[child.name] = mat
-        
+
         if not action_ob.animation_data:
             continue
         curves = get_curves(action_ob, child)
         if len(curves) == 0:
             continue
-        
+
         if context.window_manager.motion_trail.path_before == 0:
             range_min = context.scene.frame_start
         else:
@@ -332,13 +332,13 @@
             display_ob = child
         else:
             display_ob = action_ob
-        
+
         # get location data of motion path
         path = []
         speeds = []
         frame_old = context.scene.frame_current
         step = 11 - context.window_manager.motion_trail.path_resolution
-        
+
         if not use_cache:
             if display_ob.name not in self.cached["path"]:
                 self.cached["path"][display_ob.name] = {}
@@ -347,7 +347,7 @@
         else:
             prev_loc = get_location(range_min-1, display_ob, offset_ob, curves)
             self.cached["path"][display_ob.name][range_min-1] = prev_loc
-        
+
         for frame in range(range_min, range_max + 1, step):
             if use_cache and frame in self.cached["path"][display_ob.name]:
                 loc = self.cached["path"][display_ob.name][frame]
@@ -364,7 +364,7 @@
                 path.append([x, y, dloc, frame, action_ob, child])
                 speeds.append(dloc)
                 prev_loc = loc
-        
+
         # calculate color of path
         if context.window_manager.motion_trail.path_style == 'speed':
             speeds.sort()
@@ -398,7 +398,7 @@
                 else:
                     path[i][2] = [1.0, 1.0, 0.0]
         self.paths[display_ob.name] = path
-        
+
         # get keyframes and handles
         keyframes = {}
         handle_difs = {}
@@ -407,7 +407,7 @@
         if not use_cache:
             if display_ob.name not in self.cached["keyframes"]:
                 self.cached["keyframes"][display_ob.name] = {}
-        
+
         for fc in curves:
             for kf in fc.keyframe_points:
                 # handles for location mode
@@ -426,7 +426,7 @@
                     continue
                 kf_time.append(kf.co[0])
                 co = kf.co[0]
-                
+
                 if use_cache and co in \
                 self.cached["keyframes"][display_ob.name]:
                     loc = self.cached["keyframes"][display_ob.name][co]
@@ -435,7 +435,7 @@
                     self.cached["keyframes"][display_ob.name][co] = loc
                 if handle_difs:
                     handle_difs[co]["keyframe_loc"] = loc
-                
+
                 x, y = world_to_screen(context, loc)
                 keyframes[kf.co[0]] = [x, y]
                 if context.window_manager.motion_trail.mode != 'speed':
@@ -443,7 +443,7 @@
                     click.append([kf.co[0], "keyframe",
                         mathutils.Vector([x,y]), action_ob, child])
         self.keyframes[display_ob.name] = keyframes
-        
+
         # handles are only shown in location-altering mode
         if context.window_manager.motion_trail.mode == 'location' and \
         context.window_manager.motion_trail.handle_display:
@@ -474,7 +474,7 @@
                 click.append([frame, "handle_right",
                     mathutils.Vector([x_right, y_right]), action_ob, child])
             self.handles[display_ob.name] = handles
-        
+
         # calculate timebeads for timing mode
         if context.window_manager.motion_trail.mode == 'timing':
             timebeads = {}
@@ -484,7 +484,7 @@
             if not use_cache:
                 if display_ob.name not in self.cached["timebeads_timing"]:
                     self.cached["timebeads_timing"][display_ob.name] = {}
-            
+
             for i in range(1, n+1):
                 frame = range_min + i * dframe
                 if use_cache and frame in \
@@ -500,7 +500,7 @@
                 click.append([frame, "timebead", mathutils.Vector([x,y]),
                     action_ob, child])
             self.timebeads[display_ob.name] = timebeads
-        
+
         # calculate timebeads for speed mode
         if context.window_manager.motion_trail.mode == 'speed':
             angles = dict([[kf, {"left":[], "right":[]}] for kf in \
@@ -524,7 +524,7 @@
             if not use_cache:
                 if display_ob.name not in self.cached["timebeads_speed"]:
                     self.cached["timebeads_speed"][display_ob.name] = {}

@@ Diff output truncated at 10240 characters. @@


More information about the Bf-extensions-cvs mailing list