vertexpaint_selfshadow_ao adds face uv to the mesh if there not alredy there...

added GPL header and docstrings to other scripts

removed double batch_name_edit, same file is object_batch_name_edit
This commit is contained in:
2006-07-08 06:14:45 +00:00
parent 73d50a8289
commit 219a6b245c
13 changed files with 256 additions and 143 deletions

View File

@@ -15,7 +15,7 @@ __version__ = "1.1 12/18/05"
__bpydoc__ = """\ __bpydoc__ = """\
This script projection unwraps the selected faces of a mesh. This script projection unwraps the selected faces of a mesh.
it operates on all selected mesh objects, and can be set to unwrap it operates on all selected mesh objects, and can be used unwrap
selected faces, or all faces. selected faces, or all faces.
""" """

View File

@@ -1,131 +0,0 @@
#!BPY
"""
Name: 'Batch Object Name Edit'
Blender: 232
Group: 'Object'
Tooltip: 'Apply the chosen rule to rename all selected objects at once.'
"""
__author__ = "Campbell Barton"
__url__ = ("blender", "elysiun")
__version__ = "1.0"
__bpydoc__ = """\
"Batch Object Name Edit" allows you to change multiple names of Blender
objects at once. It provides options to define if you want to: replace text
in the current names, truncate their beginnings or endings or prepend / append
strings to them.
Usage:
Select the objects to be renamed and run this script from the Object->Scripts
menu of the 3d View.
"""
# $Id$
#
# --------------------------------------------------------------------------
# Batch Name Edit by Campbell Barton (AKA Ideasman)
# --------------------------------------------------------------------------
# ***** BEGIN GPL LICENSE BLOCK *****
#
# 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
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# ***** END GPL LICENCE BLOCK *****
# --------------------------------------------------------------------------
from Blender import *
def main():
def new():
newname = Draw.PupStrInput('Name: ', '', 32)
if newname == None: return
Window.WaitCursor(1)
for ob in Object.GetSelected():
ob.name = newname
def replace():
replace = Draw.PupStrInput('Replace: ', '', 32)
if replace == None: return
with = Draw.PupStrInput('With: ', '', 32)
if with == None: return
Window.WaitCursor(1)
for ob in Object.GetSelected():
ob.name = ob.name.replace(replace, with)
# Use pythons replace, its better.
'''
if replace in ob.name:
chIdx = ob.name.index(replace)
# Remove the offending word and replace it with - 'with'
ob.name = ob.name[ :chIdx] + with + ob.name[chIdx + len(replace):]
'''
def prefix():
prefix = Draw.PupStrInput('prefix: ', '', 32)
if prefix == None: return
Window.WaitCursor(1)
for ob in Object.GetSelected():
ob.name = prefix + ob.name
def suffix():
suffix = Draw.PupStrInput('Suffix: ', '', 32)
if suffix == None: return
Window.WaitCursor(1)
for ob in Object.GetSelected():
ob.name = ob.name + suffix
def truncate_start():
truncate = Draw.PupIntInput('Truncate Start: ', 0, 0, 31)
if truncate != None:
Window.WaitCursor(1)
for ob in Object.GetSelected():
ob.name = ob.name[truncate: ]
def truncate_end():
truncate = Draw.PupIntInput('Truncate End: ', 0, 0, 31)
if truncate == None: return
Window.WaitCursor(1)
for ob in Object.GetSelected():
ob.name = ob.name[ :-truncate]
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:
new()
elif result == 2:
replace()
elif result == 3:
prefix()
elif result == 4:
suffix()
elif result == 5:
truncate_start()
elif result == 6:
truncate_end()
Window.WaitCursor(0)
main()

View File

@@ -1,3 +1,23 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# 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
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# ***** END GPL LICENCE BLOCK *****
# --------------------------------------------------------------------------
import Blender import Blender
from BPyMesh_redux import redux # seperated because of its size. from BPyMesh_redux import redux # seperated because of its size.

View File

@@ -11,7 +11,35 @@ __author__ = "Campbell Barton AKA Ideasman"
__url__ = ["http://members.iinet.net.au/~cpbarton/ideasman/", "blender", "elysiun"] __url__ = ["http://members.iinet.net.au/~cpbarton/ideasman/", "blender", "elysiun"]
__bpydoc__ = """\ __bpydoc__ = """\
Find image target paths
This script searches for images whos
file paths do not point to an existing image file,
usefull when moving projects between computers, when absolute paths links are broken.
""" """
# ***** BEGIN GPL LICENSE BLOCK *****
#
# Script copyright (C) Campbell J Barton
#
# 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
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# ***** END GPL LICENCE BLOCK *****
# --------------------------------------------------------------------------
from Blender import * from Blender import *
try: try:
@@ -20,6 +48,8 @@ except:
Draw.PupMenu('You need a full python install to use this script') Draw.PupMenu('You need a full python install to use this script')
os= None os= None
#==============================================# #==============================================#
# Strips the slashes from the back of a string # # Strips the slashes from the back of a string #
#==============================================# #==============================================#

View File

@@ -6,6 +6,49 @@ Group: 'Object'
Tooltip: 'Copy Bone Weights from 1 mesh, to all other selected meshes.' Tooltip: 'Copy Bone Weights from 1 mesh, to all other selected meshes.'
""" """
__author__ = ["Campbell Barton"]
__url__ = ("blender", "elysiun", "http://members.iinet.net.au/~cpbarton/ideasman/")
__version__ = "0.1"
__bpydoc__ = """\
Bone Weight Copy
This script is used to copy bone weights from 1 mesh with weights (the source mesh) to many (the target meshes).
Weights are copied from 1 mesh to another based on how close they are together.
For normal operation, select 1 source mesh with vertex weights and any number of unweighted meshes that overlap the source mesh.
Then run this script using default options and check the new weigh.
A differnt way to use this script is to update the weights an an alredy weighted mesh.
this is done using the "Copy to Selected" option enabled and works a bit differently,
With the target mesh, select the verts you want to update.
since all meshes have weights we cant just use the weighted mesh as the source,
so the Active Object is used for the source mesh.
Run the script and the selected verts on all non active meshes will be updated.
"""
# ***** BEGIN GPL LICENSE BLOCK *****
#
# Script copyright (C) Campbell J Barton
#
# 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
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# ***** END GPL LICENCE BLOCK *****
# --------------------------------------------------------------------------
import Blender import Blender
from Blender import Armature, Object, Mathutils, Window, Mesh from Blender import Armature, Object, Mathutils, Window, Mesh
Vector= Mathutils.Vector Vector= Mathutils.Vector

View File

@@ -1,10 +1,42 @@
#!BPY #!BPY
""" """
Name: 'Clean meshes' Name: 'Clean Meshes'
Blender: 228 Blender: 242
Group: 'Mesh' Group: 'Mesh'
Tooltip: 'Clean unused data from all selected mesh objects.' Tooltip: 'Clean unused data from all selected mesh objects.'
""" """
__author__ = ["Campbell Barton"]
__url__ = ("blender", "elysiun", "http://members.iinet.net.au/~cpbarton/ideasman/")
__version__ = "0.1"
__bpydoc__ = """\
Clean Meshes
Cleans unused data from selected meshes
"""
# ***** BEGIN GPL LICENSE BLOCK *****
#
# Script copyright (C) Campbell J Barton
#
# 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
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# ***** END GPL LICENCE BLOCK *****
# --------------------------------------------------------------------------
from Blender import * from Blender import *
from Blender.Mathutils import TriangleArea from Blender.Mathutils import TriangleArea

View File

@@ -10,12 +10,36 @@ __url__ = ("blender", "elysiun")
__version__ = "1.0 2006/02/08" __version__ = "1.0 2006/02/08"
__bpydoc__ = """\ __bpydoc__ = """\
Edges to Curves
This script converts open and closed edge loops into polylines This script converts open and closed edge loops into polylines
Supported:<br> Supported:<br>
Polylines where each vert has no more then 2 edges attached to it. Polylines where each vert has no more then 2 edges attached to it.
""" """
# ***** BEGIN GPL LICENSE BLOCK *****
#
# Script copyright (C) Campbell J Barton
#
# 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
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# ***** END GPL LICENCE BLOCK *****
# --------------------------------------------------------------------------
from Blender import * from Blender import *
def sortPair(a,b): def sortPair(a,b):

View File

@@ -6,9 +6,38 @@ Group: 'Mesh'
Tooltip: 'Removed polygons from a mesh while maintaining the shape, textures and weights.' Tooltip: 'Removed polygons from a mesh while maintaining the shape, textures and weights.'
""" """
__author__ = "Campbell Barton"
__url__ = ("blender", "elysiun")
__version__ = "1.0 2006/02/07"
__bpydoc__ = """\
This script simplifies the mesh by removing faces, keeping the overall shape of the mesh.
"""
from Blender import Draw, Window, Scene, Mesh, Mathutils, sys, Object from Blender import Draw, Window, Scene, Mesh, Mathutils, sys, Object
import BPyMesh import BPyMesh
# ***** BEGIN GPL LICENSE BLOCK *****
#
# Script copyright (C) Campbell J Barton
#
# 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
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# ***** END GPL LICENCE BLOCK *****
# --------------------------------------------------------------------------
def main(): def main():
scn = Scene.GetCurrent() scn = Scene.GetCurrent()

View File

@@ -25,6 +25,28 @@ The joining of quads takes into account UV mapping, UV Images and Vertex colours
and will not join faces that have mis-matching data. and will not join faces that have mis-matching data.
""" """
# ***** BEGIN GPL LICENSE BLOCK *****
#
# Script copyright (C) Campbell J Barton
#
# 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
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# ***** END GPL LICENCE BLOCK *****
# --------------------------------------------------------------------------
from Blender import Scene, Object, Mathutils, Draw, Window, sys from Blender import Scene, Object, Mathutils, Draw, Window, sys

View File

@@ -276,4 +276,5 @@ def main():
Draw.PupMenu('renamed: %d objects.' % renameCount) Draw.PupMenu('renamed: %d objects.' % renameCount)
main() if __name__=='__main__':
main()

View File

@@ -12,9 +12,31 @@ __version__ = "1.0 2006/02/07"
__bpydoc__ = """\ __bpydoc__ = """\
This script sets the UV mapping and image of selected faces from adjacent unselected faces. This script sets the UV mapping and image of selected faces from adjacent unselected faces.
Use this script in face select mode. Use this script in face select mode for texturing between textured faces.
""" """
# ***** BEGIN GPL LICENSE BLOCK *****
#
# Script copyright (C) Campbell J Barton
#
# 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
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# ***** END GPL LICENCE BLOCK *****
# --------------------------------------------------------------------------
from Blender import * from Blender import *

View File

@@ -17,6 +17,28 @@ Use this script in face select mode.
Left Click to finish or wait until no more relaxing can be done. Left Click to finish or wait until no more relaxing can be done.
""" """
# ***** BEGIN GPL LICENSE BLOCK *****
#
# Script copyright (C) Campbell J Barton
#
# 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
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# ***** END GPL LICENCE BLOCK *****
# --------------------------------------------------------------------------
from Blender import Scene, Object, Mesh, Window from Blender import Scene, Object, Mesh, Window
from Blender.Mathutils import Vector from Blender.Mathutils import Vector

View File

@@ -11,10 +11,10 @@ __url__ = ("blender", "elysiun", "http://members.iinet.net.au/~cpbarton/ideasman
__version__ = "0.1" __version__ = "0.1"
__bpydoc__ = """\ __bpydoc__ = """\
Clean Weight Self Shadow
This Script is to be used only in weight paint mode, This usript uses the angles between faces to shade the mesh,
It removes very low weighted verts from the current group with a weight option. and optionaly blur the shading to remove artifacts from spesific edges.
""" """
# ***** BEGIN GPL LICENSE BLOCK ***** # ***** BEGIN GPL LICENSE BLOCK *****
@@ -149,10 +149,6 @@ def main():
me= ob.getData(mesh=1) me= ob.getData(mesh=1)
if not me.faceUV:
Draw.PupMenu('Error, The active mesh does not have texface/vertex colors. aborting')
return
PREF_BLUR_ITERATIONS= Draw.Create(1) PREF_BLUR_ITERATIONS= Draw.Create(1)
PREF_BLUR_RADIUS= Draw.Create(0.05) PREF_BLUR_RADIUS= Draw.Create(0.05)
PREF_MIN_EDLEN= Draw.Create(0.01) PREF_MIN_EDLEN= Draw.Create(0.01)
@@ -183,6 +179,9 @@ def main():
PREF_SHADOW_ONLY= PREF_SHADOW_ONLY.val PREF_SHADOW_ONLY= PREF_SHADOW_ONLY.val
PREF_SEL_ONLY= PREF_SEL_ONLY.val PREF_SEL_ONLY= PREF_SEL_ONLY.val
if not me.faceUV:
me.faceUV= 1
#t= sys.time() #t= sys.time()
vertexFakeAO(me, PREF_BLUR_ITERATIONS, PREF_BLUR_RADIUS, PREF_MIN_EDLEN, PREF_CLAMP_CONCAVE, PREF_CLAMP_CONVEX, PREF_SHADOW_ONLY, PREF_SEL_ONLY) vertexFakeAO(me, PREF_BLUR_ITERATIONS, PREF_BLUR_RADIUS, PREF_MIN_EDLEN, PREF_CLAMP_CONCAVE, PREF_CLAMP_CONVEX, PREF_SHADOW_ONLY, PREF_SEL_ONLY)
#print 'done in %.6f' % (sys.time()-t) #print 'done in %.6f' % (sys.time()-t)