[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [3488] contrib/py/scripts/addons/ space_view3d_paint_bprojection.py: BProjection: fast navigate for multires too

geo kgeo kgeogeo at hotmail.com
Wed Jun 13 00:19:24 CEST 2012


Revision: 3488
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=3488
Author:   kgeogeo
Date:     2012-06-12 22:19:22 +0000 (Tue, 12 Jun 2012)
Log Message:
-----------
BProjection: fast navigate for multires too

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-06-12 21:44:34 UTC (rev 3487)
+++ contrib/py/scripts/addons/space_view3d_paint_bprojection.py	2012-06-12 22:19:22 UTC (rev 3488)
@@ -1130,7 +1130,9 @@
                         
         elif event.type == 'MIDDLEMOUSE'and event.value == 'RELEASE':
             if self.tmp_level > -1:
-                bpy.context.object.modifiers['Subsurf'].levels = self.tmp_level      
+                for sub in context.object.modifiers:
+                    if sub.type in ['SUBSURF','MULTIRES']:
+                        sub.levels = self.tmp_level   
             
             return {'FINISHED'}
         
@@ -1151,9 +1153,9 @@
         self.first_mouse = Vector((event.mouse_region_x,event.mouse_region_y))
         self.first_time = True
         for sub in context.object.modifiers:
-            if sub.type == 'SUBSURF':
-                self.tmp_level = bpy.context.object.modifiers['Subsurf'].levels
-                bpy.context.object.modifiers['Subsurf'].levels = 0
+            if sub.type in ['SUBSURF', 'MULTIRES']:
+                self.tmp_level = sub.levels
+                sub.levels = 0
         return {'RUNNING_MODAL'}
 
 # Oprerator Class to pan the view3D
@@ -1194,7 +1196,9 @@
 
         if event.type == 'MIDDLEMOUSE'and event.value == 'RELEASE':
             if self.tmp_level > -1:
-                bpy.context.object.modifiers['Subsurf'].levels = self.tmp_level 
+                for sub in context.object.modifiers:
+                    if sub.type in ['SUBSURF','MULTIRES']:
+                        sub.levels = self.tmp_level
             return {'FINISHED'}
         
         return {'RUNNING_MODAL'}
@@ -1204,9 +1208,10 @@
         self.first_mouse.x = event.mouse_region_x
         self.first_mouse.y = event.mouse_region_y   
         for sub in context.object.modifiers:
-            if sub.type == 'SUBSURF':
-                self.tmp_level = bpy.context.object.modifiers['Subsurf'].levels
-                bpy.context.object.modifiers['Subsurf'].levels = 0        
+            if sub.type in ['SUBSURF', 'MULTIRES']:
+                self.tmp_level = sub.levels
+                sub.levels = 0  
+                      
         return {'RUNNING_MODAL'}
 
     def execute(self, context):        
@@ -1274,7 +1279,6 @@
     bl_label = "Preset View3D"
 
     view = StringProperty(name="View", description="Select the view", default='TOP')
-
     def invoke(self, context, event):                   
         ob = context.object
         em = bpy.data.objects['Empty for BProjection']
@@ -1294,8 +1298,7 @@
 
         vr_a = sd.region_3d.view_rotation.copy()                           
         pos_init.rotate(vr_a*vr_b)            
-        sd.region_3d.view_location =  pos_init + origine
-               
+        sd.region_3d.view_location =  pos_init + origine              
                     
         return {'FINISHED'}
 



More information about the Bf-extensions-cvs mailing list