diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-12-19 02:17:23 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-12-19 02:17:23 +0300 |
commit | de7ffa1bac820a45a65e31cd367bc446153c89af (patch) | |
tree | 808ad744123a97e5ea4367c4b0e4deb4e2480791 /release/scripts/op | |
parent | 996152de58c4dcf45637d06a6f0b777db8e95147 (diff) |
make subsurf keys - Ctrl+1,2,3,4, apply to all selected objects. not just the active ones
Diffstat (limited to 'release/scripts/op')
-rw-r--r-- | release/scripts/op/object.py | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/release/scripts/op/object.py b/release/scripts/op/object.py index a6ab3dcc93f..6a7b735e04b 100644 --- a/release/scripts/op/object.py +++ b/release/scripts/op/object.py @@ -92,23 +92,28 @@ class SubdivisionSet(bpy.types.Operator): def execute(self, context): level = self.properties.level - ob = context.active_object - for mod in ob.modifiers: - 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: + + def set_object_subd(obj): + for mod in obj.modifiers: + if mod.type == 'MULTIRES': + if level < mod.total_levels: + if obj.mode == 'SCULPT' and mod.sculpt_levels != level: + mod.sculpt_levels = level + elif obj.mode == 'OBJECT' and mod.levels != level: + mod.levels = level + return + elif mod.type == 'SUBSURF': + if mod.levels != level: mod.levels = level - return ('FINISHED',) - elif mod.type == 'SUBSURF': - if mod.levels != level: - mod.levels = level - return ('FINISHED',) - - # adda new modifier - mod = ob.modifiers.new("Subsurf", 'SUBSURF') - mod.levels = level + return + + # adda new modifier + mod = obj.modifiers.new("Subsurf", 'SUBSURF') + mod.levels = level + + for obj in context.selected_editable_objects: + set_object_subd(obj) + return ('FINISHED',) |