BProjection: now the cursor 3D stay in the same location with the numpad shortcut
authorGeo Kgeo <kgeogeo@hotmail.com>
Wed, 14 Mar 2012 12:15:08 +0000 (12:15 +0000)
committerGeo Kgeo <kgeogeo@hotmail.com>
Wed, 14 Mar 2012 12:15:08 +0000 (12:15 +0000)
space_view3d_paint_bprojection.py

index 7e3024e39cc49bb47a5241412c89b6fd1a9562aa..5a2c3f7a89aa195ed4c7f9a9683184ff4073b6a2 100644 (file)
@@ -527,6 +527,9 @@ class PresetView3D(Operator):
 
     def invoke(self, context, event):                   
         origine = bpy.context.object.location
+        
+        pos_init_cursor = view3d_utils.location_3d_to_region_2d(bpy.context.region, bpy.context.space_data.region_3d, bpy.context.space_data.cursor_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
@@ -541,7 +544,10 @@ class PresetView3D(Operator):
             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
             align_to_view(context)
-        
+
+        if bpy.context.object.custom_c3d:
+            bpy.context.space_data.region_3d.update()       
+            bpy.context.space_data.cursor_location = view3d_utils.region_2d_to_location_3d(bpy.context.region, bpy.context.space_data.region_3d, pos_init_cursor, Vector((0,0,0)))        
                     
         return {'FINISHED'}