[Bf-blender-cvs] [8d12463] master: Related to T39950.

Antony Riakiotakis noreply at git.blender.org
Tue May 6 15:54:38 CEST 2014


Commit: 8d1246328d942ceafdf2e2f3cfc57cd09a56c668
Author: Antony Riakiotakis
Date:   Tue May 6 16:54:22 2014 +0300
https://developer.blender.org/rB8d1246328d942ceafdf2e2f3cfc57cd09a56c668

Related to T39950.

When in sculpt mode add a multires, not subsurf modifier. Also allow
subdivision of multires when user explicitly requests a certain non-

===================================================================

M	release/scripts/startup/bl_operators/object.py

===================================================================

diff --git a/release/scripts/startup/bl_operators/object.py b/release/scripts/startup/bl_operators/object.py
index 04f4cba..971c50c 100644
--- a/release/scripts/startup/bl_operators/object.py
+++ b/release/scripts/startup/bl_operators/object.py
@@ -248,13 +248,17 @@ class SubdivisionSet(Operator):
             for mod in obj.modifiers:
                 if mod.type == 'MULTIRES':
                     if not relative:
-                        if level <= mod.total_levels:
-                            if obj.mode == 'SCULPT':
-                                if mod.sculpt_levels != level:
-                                    mod.sculpt_levels = level
-                            elif obj.mode == 'OBJECT':
-                                if mod.levels != level:
-                                    mod.levels = level
+                        if level > mod.total_levels:
+                           sub = level - mod.total_levels
+                           for i in range (0, sub):
+                               bpy.ops.object.multires_subdivide(modifier="Multires")
+
+                        if obj.mode == 'SCULPT':
+                            if mod.sculpt_levels != level:
+                                mod.sculpt_levels = level
+                        elif obj.mode == 'OBJECT':
+                            if mod.levels != level:
+                                mod.levels = level
                         return
                     else:
                         if obj.mode == 'SCULPT':
@@ -276,8 +280,13 @@ class SubdivisionSet(Operator):
 
             # add a new modifier
             try:
-                mod = obj.modifiers.new("Subsurf", 'SUBSURF')
-                mod.levels = level
+                if obj.mode == 'SCULPT':
+                    mod = obj.modifiers.new("Multires", 'MULTIRES')
+                    for i in range(0, level):
+                        bpy.ops.object.multires_subdivide(modifier="Multires")
+                else:
+                    mod = obj.modifiers.new("Subsurf", 'SUBSURF')
+                    mod.levels = level
             except:
                 self.report({'WARNING'},
                             "Modifiers cannot be added to object: " + obj.name)




More information about the Bf-blender-cvs mailing list