[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [3100] contrib/py/scripts/addons/ space_view3d_paint_bprojection.py: BProjection: Now when we use numpad shortcut for frontview or leftview..., the mesh stay in the same position, don't move anymore.

geo kgeo kgeogeo at hotmail.com
Tue Mar 13 16:55:37 CET 2012


Revision: 3100
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=3100
Author:   kgeogeo
Date:     2012-03-13 15:55:36 +0000 (Tue, 13 Mar 2012)
Log Message:
-----------
BProjection: Now when we use numpad shortcut for frontview or leftview..., the mesh stay in the same position, don't move anymore.

Modified Paths:
--------------
    contrib/py/scripts/addons/space_view3d_paint_bprojection.py

Modified: contrib/py/scripts/addons/space_view3d_paint_bprojection.py
===================================================================
--- contrib/py/scripts/addons/space_view3d_paint_bprojection.py	2012-03-13 15:36:24 UTC (rev 3099)
+++ contrib/py/scripts/addons/space_view3d_paint_bprojection.py	2012-03-13 15:55:36 UTC (rev 3100)
@@ -1,5 +1,5 @@
 bl_info = {
-    "name": "BProjection",
+    "name": "Z Projection",
     "description": "Help Clone tool",
     "author": "kgeogeo",
     "version": (1, 0),
@@ -526,12 +526,21 @@
     view = StringProperty(name="View", description="Select the view", default='TOP',)
 
     def invoke(self, context, event):                   
+        origine = bpy.context.object.location
+        if bpy.context.object.custom_rot:
+            pos_init = view3d_utils.location_3d_to_region_2d(bpy.context.region, bpy.context.space_data.region_3d, origine)
+            bpy.context.space_data.region_3d.view_location = origine
+
         tmp = bpy.context.user_preferences.view.smooth_view
         bpy.context.user_preferences.view.smooth_view = 0
         bpy.ops.view3d.viewnumpad(type=self.view)        
         align_to_view(context)
         bpy.context.user_preferences.view.smooth_view = tmp
-        
+
+        if bpy.context.object.custom_rot:
+            pos_end = view3d_utils.region_2d_to_location_3d(bpy.context.region, bpy.context.space_data.region_3d, pos_init, Vector((0,0,0)))                
+            bpy.context.space_data.region_3d.view_location =  -1*pos_end
+                    
         return {'FINISHED'}
 
 
@@ -627,4 +636,4 @@
 if __name__ == "__main__":
     register()
    
-       
+       
\ No newline at end of file



More information about the Bf-extensions-cvs mailing list