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:
authorWillian Padovani Germano <wpgermano@gmail.com>2004-12-01 07:49:04 +0300
committerWillian Padovani Germano <wpgermano@gmail.com>2004-12-01 07:49:04 +0300
commitf6aaafe86891ab63c3ce4d3d6ee2cfa8a8d693dc (patch)
tree6cdb35e904d2a842fd15f0433ac3947e68bc0307 /release
parent40f1dfe38098eaabd464ee116dbcad4c4284ae2e (diff)
Scripts:
-- Campbell Barton updated some of his contributions, thanks!
Diffstat (limited to 'release')
-rw-r--r--release/scripts/batch_name_edit.py22
-rw-r--r--release/scripts/clean_mesh.py17
-rw-r--r--release/scripts/obj_export.py2
-rw-r--r--release/scripts/obj_import.py21
4 files changed, 36 insertions, 26 deletions
diff --git a/release/scripts/batch_name_edit.py b/release/scripts/batch_name_edit.py
index 08611198d47..175d33cb973 100644
--- a/release/scripts/batch_name_edit.py
+++ b/release/scripts/batch_name_edit.py
@@ -4,7 +4,7 @@
Name: 'Batch Object Name Edit'
Blender: 232
Group: 'Object'
-Tooltip: 'Apply the chosen rule to rename all selected objects at once'
+Tooltip: 'Apply the chosen rule to rename all selected objects at once.'
"""
__author__ = "Campbell Barton"
@@ -23,6 +23,7 @@ Select the objects to be renamed and run this script from the Object->Scripts
menu of the 3d View.
"""
+
# $Id$
#
# --------------------------------------------------------------------------
@@ -49,6 +50,12 @@ menu of the 3d View.
from Blender import *
+def new():
+ newname = Draw.PupStrInput('Name: ', '', 32)
+ if newname == None: return
+ for ob in Object.GetSelected():
+ ob.name = newname
+
def replace():
replace = Draw.PupStrInput('Replace: ', '', 32)
if replace == None: return
@@ -96,20 +103,21 @@ def truncate_end():
-name = "Selected Object Names%t|Replace Text|Add Prefix|Add Suffix|Truncate Start|Truncate End"
+name = "Selected Object Names%t|New Name|Replace Text|Add Prefix|Add Suffix|Truncate Start|Truncate End"
result = Draw.PupMenu(name)
if result == -1:
pass
elif result == 1:
- replace()
+ new()
elif result == 2:
- prefix()
+ replace()
elif result == 3:
- suffix()
+ prefix()
elif result == 4:
- truncate_start()
+ suffix()
elif result == 5:
+ truncate_start()
+elif result == 6:
truncate_end()
-
diff --git a/release/scripts/clean_mesh.py b/release/scripts/clean_mesh.py
index be1fa460572..d7e20daa27f 100644
--- a/release/scripts/clean_mesh.py
+++ b/release/scripts/clean_mesh.py
@@ -1,7 +1,7 @@
#!BPY
"""
-Name: 'Cleanup Meshes'
+Name: 'Clean Mesh'
Blender: 234
Group: 'Mesh'
Tooltip: 'Clean unused data from all selected meshes'
@@ -9,7 +9,7 @@ Tooltip: 'Clean unused data from all selected meshes'
__author__ = "Campbell Barton"
__url__ = ("blender", "elysiun")
-__version__ = "1.0 04/25/04"
+__version__ = "1.1 04/25/04"
__bpydoc__ = """\
This script cleans specific data from all selected meshes.
@@ -29,6 +29,7 @@ After choosing one of the above alternatives, if your choice requires a
threshold value you'll be prompted with a number pop-up to set it.
"""
+
# $Id$
#
# --------------------------------------------------------------------------
@@ -60,6 +61,8 @@ import Blender
from Blender import *
from math import sqrt
+time1 = Blender.sys.time()
+
VRemNum = ERemNum = FRemNum = 0 # Remember for statistics
@@ -112,7 +115,7 @@ def delFreeVert(mesh):
vIdx = 0
for bool in usedList:
if bool == False:
- mesh.verts.remove(mesh.verts[vIdx])
+ mesh.verts.pop(vIdx)
vIdx -= 1
VRemNum += 1
vIdx += 1
@@ -124,7 +127,7 @@ def delEdge(mesh):
fIdx = 0
while fIdx < len(mesh.faces):
if len(mesh.faces[fIdx].v) == 2:
- mesh.faces.remove(mesh.faces[fIdx])
+ mesh.faces.pop(fIdx)
ERemNum += 1
fIdx -= 1
fIdx +=1
@@ -136,7 +139,7 @@ def delEdgeLen(mesh, limit):
while fIdx < len(mesh.faces):
if len(mesh.faces[fIdx].v) == 2:
if measure(mesh.faces[fIdx].v[0].co, mesh.faces[fIdx].v[1].co) <= limit:
- mesh.faces.remove(mesh.faces[fIdx])
+ mesh.faces(fIdx)
ERemNum += 1
fIdx -= 1
fIdx +=1
@@ -148,7 +151,7 @@ def delFaceArea(mesh, limit):
while fIdx < len(mesh.faces):
if len(mesh.faces[fIdx].v) > 2:
if faceArea(mesh.faces[fIdx]) <= limit:
- mesh.faces.remove(mesh.faces[fIdx])
+ mesh.faces.pop(fIdx)
FRemNum += 1
fIdx -= 1
fIdx +=1
@@ -203,7 +206,7 @@ else:
mesh.update(0)
Redraw()
-
+print 'mesh cleanup time',Blender.sys.time() - time1
if is_editmode: Window.EditMode(1)
if method != -1:
diff --git a/release/scripts/obj_export.py b/release/scripts/obj_export.py
index d39d9969859..cba44b6ea61 100644
--- a/release/scripts/obj_export.py
+++ b/release/scripts/obj_export.py
@@ -135,7 +135,7 @@ def save_obj(filename):
# modify the open file.
for f in m.faces:
if len(f.v) < 3:
- mesh.faces.remove(f)
+ m.faces.remove(f)
if len(m.faces) == 0: # Make sure there is somthing to write.
continue #dont bother with this mesh.
diff --git a/release/scripts/obj_import.py b/release/scripts/obj_import.py
index c6cb032a632..c08a1d07141 100644
--- a/release/scripts/obj_import.py
+++ b/release/scripts/obj_import.py
@@ -497,14 +497,13 @@ def load_obj(file):
Window.FileSelector(load_obj, 'Import Wavefront OBJ')
-'''
-# For testing compatability
-import os
-for obj in os.listdir('/obj/'):
- if obj[-3:] == 'obj':
- print obj
- newScn = Scene.New(obj)
- newScn.makeCurrent()
- load_obj('/obj/' + obj)
-
-''' \ No newline at end of file
+
+# For testing compatibility
+#import os
+#for obj in os.listdir('/obj/'):
+# if obj[-3:] == 'obj':
+# print obj
+# newScn = Scene.New(obj)
+# newScn.makeCurrent()
+# load_obj('/obj/' + obj)
+