Fix #20356: ctrl+1/2/.. could set multires levels outside limits.
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Mon, 14 Dec 2009 14:08:04 +0000 (14:08 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Mon, 14 Dec 2009 14:08:04 +0000 (14:08 +0000)
release/scripts/op/object.py

index 64406fd0d5c0b05f79889acc14e068cbb758a784..a6ab3dcc93fe9478c020fd73fe142b777b65ce43 100644 (file)
@@ -94,11 +94,14 @@ class SubdivisionSet(bpy.types.Operator):
         level = self.properties.level
         ob = context.active_object
         for mod in ob.modifiers:
-            if mod.type == 'MULTIRES' and ob.mode == 'SCULPT':
-                if mod.sculpt_levels != level:
-                    mod.sculpt_levels = level
+            if mod.type == 'MULTIRES':
+                if level < mod.total_levels:
+                    if ob.mode == 'SCULPT' and mod.sculpt_levels != level:
+                        mod.sculpt_levels = level
+                    elif ob.mode == 'OBJECT' and mod.levels != level:
+                        mod.levels = level
                 return ('FINISHED',)
-            elif mod.type == 'SUBSURF' or mod.type == 'MULTIRES':
+            elif mod.type == 'SUBSURF':
                 if mod.levels != level:
                     mod.levels = level
                 return ('FINISHED',)