forked from bartvdbraak/blender
Scripts:
-- Campbell Barton updated some of his contributions, thanks!
This commit is contained in:
parent
40f1dfe380
commit
f6aaafe868
@ -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()
|
||||
|
||||
|
||||
|
@ -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:
|
||||
|
@ -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.
|
||||
|
@ -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)
|
||||
|
||||
'''
|
||||
|
||||
# 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)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user