Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2006-04-05 20:48:55 +0400
committerCampbell Barton <ideasman42@gmail.com>2006-04-05 20:48:55 +0400
commit97407950d336b3d4c1153393cd41cb4bff661616 (patch)
tree9864ad9bee21a248ba720adab7c4ec28d06c2d99
parenta4c110f8eb8ea1732d3e3f071ead41470abb24cd (diff)
Added an option to batch rename vert Groups.
-rw-r--r--release/scripts/object_batch_name_edit.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/release/scripts/object_batch_name_edit.py b/release/scripts/object_batch_name_edit.py
index f5cec15ecec..a4ee2a12aa8 100644
--- a/release/scripts/object_batch_name_edit.py
+++ b/release/scripts/object_batch_name_edit.py
@@ -102,15 +102,17 @@ def main():
REPLACE_STRING = Draw.Create('')
WITH_STRING = Draw.Create('')
RENAME_LINKED = Draw.Create(0)
+ RENAME_VGROUP = Draw.Create(0)
pup_block = [\
('Replace: ', REPLACE_STRING, 19, 19, 'Text to find'),\
('With:', WITH_STRING, 19, 19, 'Text to replace with'),\
- ('Rename ObData', RENAME_LINKED, 'Renames objects data to match the obname'),\
+ ('Rename ObData from Ob', RENAME_LINKED, 'Renames objects data to match the obname'),\
+ ('Replace VGroup Names', RENAME_VGROUP, 'Renames mesh objects vertex group names'),\
]
if not Draw.PupBlock('Replace in name...', pup_block) or\
- ((not REPLACE_STRING.val) and (not WITH_STRING)):
+ (not REPLACE_STRING.val+WITH_STRING.val):
return 0
REPLACE_STRING = REPLACE_STRING.val
@@ -122,6 +124,14 @@ def main():
if ob.name != newname:
ob.name = newname
renameCount+=1
+ if RENAME_VGROUP.val:
+ if ob.getType() == 'Mesh':
+ me= ob.getData(mesh=1)
+ for group in me.getVertGroupNames():
+ newname= group.replace(REPLACE_STRING, WITH_STRING)
+ if newname != group:
+ me.renameVertGroup(group, newname)
+ renameCount+=1
return RENAME_LINKED.val