diff options
author | Martin Poirier <theeth@yahoo.com> | 2005-02-14 04:26:07 +0300 |
---|---|---|
committer | Martin Poirier <theeth@yahoo.com> | 2005-02-14 04:26:07 +0300 |
commit | 923a9a0b03ee499edf3b050cab9b3ad3b4172117 (patch) | |
tree | f4f406c2ec4bd10be3505fb9c0de77becb5640b2 /release/scripts | |
parent | 873a248522c0cf74ac9432aa9b36c96d42255f00 (diff) |
Vertex group support in Apply_Def. If subsurf is off on the original mesh, copies groups AND weight. If not, only copies weight.
Diffstat (limited to 'release/scripts')
-rw-r--r-- | release/scripts/Apply_def.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/release/scripts/Apply_def.py b/release/scripts/Apply_def.py index 5456d40f20b..bdcae3744ec 100644 --- a/release/scripts/Apply_def.py +++ b/release/scripts/Apply_def.py @@ -36,6 +36,8 @@ directly manipulate or export its data. # # Copyright (C) 2003: Martin Poirier, theeth@yahoo.com # +# Thanks to Jonathan Hudson for help with the vertex groups part +# # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 @@ -80,4 +82,21 @@ for ob in ob_list: pass new_ob.setName(new_name) + ob_mesh = ob.getData() + new_ob_mesh = new_ob.getData() + + # If SubSurf is off on the original, copy the vertex weight + if not ob_mesh.getMode() & Blender.NMesh.Modes['SUBSURF']: + for vgroupname in ob_mesh.getVertGroupNames(): + vlist = ob_mesh.getVertsFromGroup(vgroupname, True) + new_ob_mesh.addVertGroup(vgroupname) + for vpair in vlist: + new_ob_mesh.assignVertsToGroup(vgroupname, [vpair[0]], vpair[1], 'add') + # If it's on, just add the vertex groups + else: + for vgroupname in ob_mesh.getVertGroupNames(): + new_ob_mesh.addVertGroup(vgroupname) + + new_ob_mesh.update() + Blender.Window.EditMode(1) |