From 53efbdd3a3602e4befb65b1fbe5edef80ca4a35a Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 7 Jul 2006 15:51:32 +0000 Subject: Made this script motherball aware- Metaballs that are numbered are not included - only the un-numbered motherball when getting the mesh data for objects. --- release/scripts/object_apply_def.py | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) (limited to 'release/scripts/object_apply_def.py') diff --git a/release/scripts/object_apply_def.py b/release/scripts/object_apply_def.py index b93a98106cd..6b8d07bc51a 100644 --- a/release/scripts/object_apply_def.py +++ b/release/scripts/object_apply_def.py @@ -100,18 +100,33 @@ def apply_deform(): ob_list = Blender.Object.GetSelected() - if not ob_list: - Blender.Draw.PupMenu('No objects selected, nothing to do.') - return - # Deselect and test for softbody + # Assume no soft body has_sb= False - for ob in ob_list: - ob.sel = 0 + + # reverse loop so we can remove objects (metaballs in this case) + for ob_idx in xrange(len(ob_list)-1, -1, -1): + ob= ob_list[ob_idx] + + ob.sel = 0 # deselect while where checking the metaballs # Test for a softbody if not has_sb and ob.isSB(): has_sb= True + + # Remove all numbered metaballs because their disp list is only on the main metaball (un numbered) + if ob.getType()=='MBall': + name= ob.name + # is this metaball numbered? + dot_idx= name.rfind('.') + 1 + if name[dot_idx:].isdigit(): + # Not the motherball, ignore it. + del ob_list[ob_idx] + + + if not ob_list: + Blender.Draw.PupMenu('No objects selected, nothing to do.') + return if has_sb: -- cgit v1.2.3