diff options
author | Antony Riakiotakis <kalast@gmail.com> | 2014-05-06 17:54:22 +0400 |
---|---|---|
committer | Antony Riakiotakis <kalast@gmail.com> | 2014-05-06 17:54:22 +0400 |
commit | 8d1246328d942ceafdf2e2f3cfc57cd09a56c668 (patch) | |
tree | b8bb51dabe804f9198e60cd3be8402868a3c14d7 /release/scripts | |
parent | e393dde435ab2f944cff03e6312cae437800184f (diff) |
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-
Diffstat (limited to 'release/scripts')
-rw-r--r-- | release/scripts/startup/bl_operators/object.py | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/release/scripts/startup/bl_operators/object.py b/release/scripts/startup/bl_operators/object.py index 04f4cba6d3b..971c50ce1f7 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) |