removing image bake scripts to make room for Ton's built in baking stuff.

This commit is contained in:
Campbell Barton 2006-11-26 19:08:19 +00:00
parent d2c482115e
commit b36bafe524
5 changed files with 0 additions and 550 deletions

@ -1,106 +0,0 @@
#!BPY
"""
Name: 'Bake Texface Image from UVs'
Blender: 242
Group: 'Image'
Tooltip: 'Make a new image from the texface of the selected mesh objects.'
"""
__author__= ['Campbell Barton']
__url__= ('blender', 'elysiun', 'http://www.gametutorials.com')
__version__= '0.1'
__bpydoc__= '''\
Bake Texface Images to 1 image
This script makes an image from a meshes texface images, using the UV coordinates
to draw the faces into the image.
This makes it possible to bake many images into 1 texture.
Make sure your UV Coordinates do not overlap.
LSCM Unwrapper or archimap unwrapper work well to automaticaly do this.
'''
import Blender
import BPyRender
#reload(BPyRender)
import BPyMessages
Vector= Blender.Mathutils.Vector
Create= Blender.Draw.Create
def main():
# Create the variables.
# Filename without path or extension.
# Big LC, gets all unique mesh objects from the selection that have UV coords.
me_s= dict([\
(ob.getData(name_only=1), ob.getData(mesh=1))\
for ob in Blender.Object.GetSelected()\
if ob.getType()=='Mesh' if ob.getData(mesh=1).faceUV]).values()
if not me_s:
BPyMessages.Error_NoMeshUvSelected()
return
newpath= Blender.Get('filename').split('/')[-1].split('\\')[-1].replace('.blend', '_img.png')
###PREF_IMAGE_PATH = Create('//%s_img' % newpath)
PREF_IMAGE_SIZE = Create(512)
PREF_IMAGE_BLEED = Create(4)
PREF_IMAGE_SMOOTH= Create(0)
PREF_SEL_FACES_ONLY= Create(0)
pup_block = [\
###('', PREF_IMAGE_PATH, 3, 100, 'Path to new Image. "//" for curent blend dir.'),\
('Pixel Size:', PREF_IMAGE_SIZE, 64, 4096, 'Image Width and Height.'),\
('Pixel Bleed:', PREF_IMAGE_BLEED, 0, 64, 'Extend pixels from boundry edges to avoid mipmapping errors on rendering.'),\
('Smooth lines', PREF_IMAGE_SMOOTH, 'Render smooth lines.'),\
'',\
('Selected Faces only', PREF_SEL_FACES_ONLY, 'Only bake from selected faces.'),\
]
if not Blender.Draw.PupBlock('Texface Image Bake', pup_block):
return
# Defaults for VCol, user cant change
PREF_IMAGE_WIRE= False
PREF_IMAGE_WIRE_INVERT= False
PREF_IMAGE_WIRE_UNDERLAY= False
PREF_USE_IMAGE= True # of course we need this one
PREF_USE_VCOL= False
PREF_USE_MATCOL= False
PREF_USE_NORMAL= False
PREF_USE_TEXTURE= False
def file_sel(PREF_IMAGE_PATH):
if not (BPyMessages.Warning_SaveOver(PREF_IMAGE_PATH) and \
BPyMessages.Warning_SaveOver(PREF_IMAGE_PATH+'.png')):
return
image = BPyRender.vcol2image(me_s,\
PREF_IMAGE_PATH,\
PREF_IMAGE_SIZE.val,\
PREF_IMAGE_BLEED.val,\
PREF_IMAGE_SMOOTH.val,\
PREF_IMAGE_WIRE,\
PREF_IMAGE_WIRE_INVERT,\
PREF_IMAGE_WIRE_UNDERLAY,\
PREF_USE_IMAGE,\
PREF_USE_VCOL,\
PREF_USE_MATCOL,\
PREF_USE_NORMAL,\
PREF_USE_TEXTURE,\
PREF_SEL_FACES_ONLY.val)
if image:
image.makeCurrent()
Blender.Window.RedrawAll()
Blender.Window.FileSelector(file_sel, 'SAVE PNG', newpath)
if __name__ == '__main__':
main()

@ -1,126 +0,0 @@
#!BPY
"""
Name: 'Bake Normal Map Image from UVs'
Blender: 242
Group: 'Image'
Tooltip: 'Generate a normal map image from selected mesh objects.'
"""
__author__= ['Campbell Barton']
__url__= ('blender', 'elysiun', 'http://www.gametutorials.com')
__version__= '0.1'
__bpydoc__= '''\
Bake Vertex Normals to an image
This script makes an image from a meshes vertex normals, using the UV coordinates
to draw the faces into the image.
Make sure your UV Coordinates do not overlap.
LSCM Unwrapper or archimap unwrapper work well to automaticaly do this.
'''
import Blender
import BPyRender
#reload(BPyRender)
import BPyMessages
Vector= Blender.Mathutils.Vector
Create= Blender.Draw.Create
def main():
# Create the variables.
# Filename without path or extension.
# Big LC, gets all unique mesh objects from the selection that have UV coords.
def worldnormals(ob):
nor_mtx= ob.matrixWorld.rotationPart()
me= ob.getData(mesh=1)
for v in me.verts:
v.no= v.no*nor_mtx
return me
ob_s= dict([\
(ob.getData(name_only=1), ob)\
for ob in Blender.Object.GetSelected()\
if ob.getType()=='Mesh' if ob.getData(mesh=1).faceUV]).values()
me_s= [worldnormals(ob) for ob in ob_s]
del ob_s
if not me_s:
BPyMessages.Error_NoMeshUvSelected()
return
newpath= Blender.Get('filename').split('/')[-1].split('\\')[-1].replace('.blend', '_nor.png')
###PREF_IMAGE_PATH = Create('//%s_nor' % newpath)
PREF_IMAGE_SIZE = Create(512)
PREF_IMAGE_BLEED = Create(4)
PREF_IMAGE_SMOOTH= Create(0)
PREF_SEL_FACES_ONLY= Create(0)
pup_block = [\
###('', PREF_IMAGE_PATH, 3, 100, 'Path to new Image. "//" for curent blend dir.'),\
('Pixel Size:', PREF_IMAGE_SIZE, 64, 4096, 'Image Width and Height.'),\
('Pixel Bleed:', PREF_IMAGE_BLEED, 0, 64, 'Extend pixels from boundry edges to avoid mipmapping errors on rendering.'),\
('Smooth lines', PREF_IMAGE_SMOOTH, 'Render smooth lines.'),\
'',\
('Selected Faces only', PREF_SEL_FACES_ONLY, 'Only bake from selected faces.'),\
]
if not Blender.Draw.PupBlock('Texface Image Bake', pup_block):
# Update the normals before we exit
for me in me_s:
me.update()
return
# Defaults for VCol, user cant change
PREF_IMAGE_WIRE= False
PREF_IMAGE_WIRE_INVERT= False
PREF_IMAGE_WIRE_UNDERLAY= False
PREF_USE_IMAGE= False
PREF_USE_VCOL= False
PREF_USE_MATCOL= False
PREF_USE_TEXTURE= False
PREF_USE_NORMAL= True # of course we need this one
def file_sel(PREF_IMAGE_PATH):
if not (BPyMessages.Warning_SaveOver(PREF_IMAGE_PATH) and \
BPyMessages.Warning_SaveOver(PREF_IMAGE_PATH+'.png')):
return
image = BPyRender.vcol2image(me_s,\
PREF_IMAGE_PATH,\
PREF_IMAGE_SIZE.val,\
PREF_IMAGE_BLEED.val,\
PREF_IMAGE_SMOOTH.val,\
PREF_IMAGE_WIRE,\
PREF_IMAGE_WIRE_INVERT,\
PREF_IMAGE_WIRE_UNDERLAY,\
PREF_USE_IMAGE,\
PREF_USE_VCOL,\
PREF_USE_MATCOL,\
PREF_USE_NORMAL,\
PREF_USE_TEXTURE,\
PREF_SEL_FACES_ONLY.val)
# Restore normals
for me in me_s:
me.update()
if image:
image.makeCurrent()
Blender.Window.RedrawAll()
Blender.Window.FileSelector(file_sel, 'SAVE PNG', newpath)
if __name__ == '__main__':
main()

@ -1,105 +0,0 @@
#!BPY
"""
Name: 'Bake Texture Image from UVs'
Blender: 242
Group: 'Image'
Tooltip: 'Generate a texture image from the selected mesh objects UV coords'
"""
__author__= ['Campbell Barton']
__url__= ('blender', 'elysiun', 'http://www.gametutorials.com')
__version__= '0.1'
__bpydoc__= '''\
Bake Procedural Textures to an image
This script makes an image from a meshes textures, using the UV coordinates
to draw the faces into the image.
Make sure your UV Coordinates do not overlap.
LSCM Unwrapper or archimap unwrapper work well to automaticaly do this.
'''
import Blender
import BPyRender
reload(BPyRender)
import BPyMessages
Vector= Blender.Mathutils.Vector
Create= Blender.Draw.Create
def main():
# Create the variables.
# Filename without path or extension.
# Big LC, gets all unique mesh objects from the selection that have UV coords.
me_s= dict([\
(ob.getData(name_only=1), ob.getData(mesh=1))\
for ob in Blender.Object.GetSelected()\
if ob.getType()=='Mesh' if ob.getData(mesh=1).faceUV]).values()
if not me_s:
BPyMessages.Error_NoMeshUvSelected()
return
newpath= Blender.Get('filename').split('/')[-1].split('\\')[-1].replace('.blend', '_tex.png')
PREF_IMAGE_PATH = Create('//%s_wire' % newpath)
PREF_IMAGE_SIZE = Create(512)
PREF_IMAGE_BLEED = Create(4)
PREF_IMAGE_SMOOTH= Create(0)
PREF_SEL_FACES_ONLY= Create(0)
pup_block = [\
('Pixel Size:', PREF_IMAGE_SIZE, 64, 4096, 'Image Width and Height.'),\
('Pixel Bleed:', PREF_IMAGE_BLEED, 0, 64, 'Extend pixels from boundry edges to avoid mipmapping errors on rendering.'),\
('Smooth lines', PREF_IMAGE_SMOOTH, 'Render smooth lines.'),\
'',\
('Selected Faces only', PREF_SEL_FACES_ONLY, 'Only bake from selected faces.'),\
]
if not Blender.Draw.PupBlock('Wire Bake', pup_block):
return
# Defaults for VCol, user cant change
PREF_IMAGE_WIRE= False
PREF_USE_IMAGE= False
PREF_IMAGE_WIRE_INVERT= False
PREF_IMAGE_WIRE_UNDERLAY= False
PREF_USE_VCOL= False
PREF_USE_MATCOL= False
PREF_USE_NORMAL= False
PREF_USE_TEXTURE= True # of course we need this one
def file_sel(PREF_IMAGE_PATH):
if not (BPyMessages.Warning_SaveOver(PREF_IMAGE_PATH) and \
BPyMessages.Warning_SaveOver(PREF_IMAGE_PATH+'.png')):
return
image = BPyRender.vcol2image(me_s,\
PREF_IMAGE_PATH,\
PREF_IMAGE_SIZE.val,\
PREF_IMAGE_BLEED.val,\
PREF_IMAGE_SMOOTH.val,\
PREF_IMAGE_WIRE,\
PREF_IMAGE_WIRE_INVERT,\
PREF_IMAGE_WIRE_UNDERLAY,\
PREF_USE_IMAGE,\
PREF_USE_VCOL,\
PREF_USE_MATCOL,\
PREF_USE_NORMAL,\
PREF_USE_TEXTURE,\
PREF_SEL_FACES_ONLY.val)
if image:
image.makeCurrent()
Blender.Window.RedrawAll()
Blender.Window.FileSelector(file_sel, 'SAVE PNG', newpath)
if __name__ == '__main__':
main()

@ -1,104 +0,0 @@
#!BPY
"""
Name: 'Bake Vertex Color Image from UVs'
Blender: 242
Group: 'Image'
Tooltip: 'Generate an image from the selected mesh objects vertex colors.'
"""
__author__= ['Campbell Barton']
__url__= ('blender', 'elysiun', 'http://www.gametutorials.com')
__version__= '0.1'
__bpydoc__= '''\
Bake Vertex Colors to an image
This script makes an image from a meshes vertex colors, using the UV coordinates
to draw the faces into the image.
This makes it possible to bake radiosity into a texture.
Make sure your UV Coordinates do not overlap.
LSCM Unwrapper or archimap unwrapper work well to automaticaly do this.
'''
import Blender
import BPyRender
reload(BPyRender)
import BPyMessages
Vector= Blender.Mathutils.Vector
Create= Blender.Draw.Create
def main():
# Create the variables.
# Filename without path or extension.
# Big LC, gets all unique mesh objects from the selection that have UV coords.
me_s= dict([\
(ob.getData(name_only=1), ob.getData(mesh=1))\
for ob in Blender.Object.GetSelected()\
if ob.getType()=='Mesh' if ob.getData(mesh=1).faceUV]).values()
if not me_s:
BPyMessages.Error_NoMeshUvSelected()
return
newpath= Blender.Get('filename').split('/')[-1].split('\\')[-1].replace('.blend', '_vcol.png')
#PREF_IMAGE_PATH = Create('//%s_vcol' % newpath)
PREF_IMAGE_SIZE = Create(512)
PREF_IMAGE_BLEED = Create(4)
PREF_IMAGE_SMOOTH= Create(0)
PREF_SEL_FACES_ONLY= Create(0)
pup_block = [\
###('', PREF_IMAGE_PATH, 3, 100, 'Path to new Image. "//" for curent blend dir.'),\
('Pixel Size:', PREF_IMAGE_SIZE, 64, 4096, 'Image Width and Height.'),\
('Pixel Bleed:', PREF_IMAGE_BLEED, 0, 64, 'Extend pixels from boundry edges to avoid mipmapping errors on rendering.'),\
('Smooth lines', PREF_IMAGE_SMOOTH, 'Render smooth lines.'),\
'',\
('Selected Faces only', PREF_SEL_FACES_ONLY, 'Only bake from selected faces.'),\
]
if not Blender.Draw.PupBlock('VCol to Image', pup_block):
return
# Defaults for VCol, user cant change
PREF_IMAGE_WIRE= False
PREF_IMAGE_WIRE_INVERT= False
PREF_IMAGE_WIRE_UNDERLAY= False
PREF_USE_IMAGE= False
PREF_USE_VCOL= True # of course we need this one
PREF_USE_MATCOL= False
PREF_USE_NORMAL= False
PREF_USE_TEXTURE= False
def file_sel(PREF_IMAGE_PATH):
if not (BPyMessages.Warning_SaveOver(PREF_IMAGE_PATH) and \
BPyMessages.Warning_SaveOver(PREF_IMAGE_PATH+'.png')):
return
image=\
BPyRender.vcol2image(me_s,\
PREF_IMAGE_PATH,\
PREF_IMAGE_SIZE.val,\
PREF_IMAGE_BLEED.val,\
PREF_IMAGE_SMOOTH.val,\
PREF_IMAGE_WIRE,\
PREF_IMAGE_WIRE_INVERT,\
PREF_IMAGE_WIRE_UNDERLAY,\
PREF_USE_IMAGE,\
PREF_USE_VCOL,\
PREF_USE_MATCOL,\
PREF_USE_NORMAL,\
PREF_USE_TEXTURE,\
PREF_SEL_FACES_ONLY.val)
if image:
image.makeCurrent()
Blender.Window.RedrawAll()
Blender.Window.FileSelector(file_sel, 'SAVE PNG', newpath)
if __name__ == '__main__':
main()

@ -1,109 +0,0 @@
#!BPY
"""
Name: 'Bake Wire Image from UVs'
Blender: 242
Group: 'Image'
Tooltip: 'Generate an image from the selected mesh objects UV coords and materials'
"""
__author__= ['Campbell Barton']
__url__= ('blender', 'elysiun', 'http://www.gametutorials.com')
__version__= '0.1'
__bpydoc__= '''\
Bake Wire Image from UVs
Write a wireframe image from the UV coords and the the material color
This is usefull for laying out UV images on an unwrapped mesh.
Make sure your UV Coordinates do not overlap.
LSCM Unwrapper or archimap unwrapper work well to automaticaly do this.
'''
import Blender
import BPyRender
#reload(BPyRender)
import BPyMessages
Vector= Blender.Mathutils.Vector
Create= Blender.Draw.Create
def main():
# Create the variables.
# Filename without path or extension.
# Big LC, gets all unique mesh objects from the selection that have UV coords.
me_s= dict([\
(ob.getData(name_only=1), ob.getData(mesh=1))\
for ob in Blender.Object.GetSelected()\
if ob.getType()=='Mesh' if ob.getData(mesh=1).faceUV]).values()
if not me_s:
BPyMessages.Error_NoMeshUvSelected()
return
newpath= Blender.Get('filename').split('/')[-1].split('\\')[-1].replace('.blend', '_wire.png')
PREF_IMAGE_PATH = Create('//%s_wire' % newpath)
PREF_IMAGE_SIZE = Create(512)
PREF_IMAGE_WIRE_INVERT = Create(0)
PREF_IMAGE_WIRE_UNDERLAY = Create(1)
PREF_IMAGE_SMOOTH= Create(1)
PREF_SEL_FACES_ONLY= Create(0)
pup_block = [\
###'Image Path: (no ext)',\
###('', PREF_IMAGE_PATH, 3, 100, 'Path to new Image. "//" for curent blend dir.'),\
###'Image Options',
('Pixel Size:', PREF_IMAGE_SIZE, 64, 4096, 'Image Width and Height.'),\
('White Wire', PREF_IMAGE_WIRE_INVERT, 'Sets the wire to white (otherwise its black).'),\
('Fill Faces', PREF_IMAGE_WIRE_UNDERLAY, 'Fill in faces with material color.'),\
('Smooth lines', PREF_IMAGE_SMOOTH, 'Render smooth lines.'),\
'',\
('Selected Faces only', PREF_SEL_FACES_ONLY, 'Only bake from selected faces.'),\
]
if not Blender.Draw.PupBlock('Wire Bake', pup_block):
return
# Defaults for VCol, user cant change
PREF_IMAGE_WIRE= True # of course we need this one
PREF_USE_IMAGE= False
PREF_IMAGE_BLEED= 0
PREF_USE_VCOL= False
PREF_USE_MATCOL= False
PREF_USE_NORMAL= False
PREF_USE_TEXTURE= False
def file_sel(PREF_IMAGE_PATH):
if not (BPyMessages.Warning_SaveOver(PREF_IMAGE_PATH) and \
BPyMessages.Warning_SaveOver(PREF_IMAGE_PATH+'.png')):
return
image = BPyRender.vcol2image(me_s,\
PREF_IMAGE_PATH,\
PREF_IMAGE_SIZE.val,\
PREF_IMAGE_BLEED,\
PREF_IMAGE_SMOOTH.val,\
PREF_IMAGE_WIRE,\
PREF_IMAGE_WIRE_INVERT.val,\
PREF_IMAGE_WIRE_UNDERLAY.val,\
PREF_USE_IMAGE,\
PREF_USE_VCOL,\
PREF_USE_MATCOL,\
PREF_USE_NORMAL,\
PREF_USE_TEXTURE,\
PREF_SEL_FACES_ONLY.val)
if image:
image.makeCurrent()
Blender.Window.RedrawAll()
Blender.Window.FileSelector(file_sel, 'SAVE PNG', newpath)
if __name__ == '__main__':
main()