Forum Moderators: Lobo3433 Forum Coordinators: LuxXeon
Blender F.A.Q (Last Updated: 2024 Nov 10 9:28 pm)
dont google, the site seems to be down. it doesnt work to well because i am lazy and if you misplace the original file, you loose your library without hopes of retreval
http://www.blendernation.com/2006/06/22/blender-library-script-133/
#!BPY
""" Registration info for Blender menus:
Name: 'Blender Library'
Blender: 241
Group: 'Object'
Tooltip: 'Library to store and catalog all your materials, objects, textures, etc'
"""
author = "Mariano Hidalgo AKA uselessdreamer"
url = ("http:uselessdreamer.byethost32.comblender_library_intro.html", "http:blender-stuff.byethost32.com")
version = "1.3.3"
bpydoc = """
Blender Library 1.3.3
With this script you can easily store and retrieve all your materials, objects, textures, etc.
You can also quickly share your stuff with other Blender users by using the built in import/
export functionality.
For more information please go to:
http:uselessdreamer.byethost32.com/blender_library_intro.html
"""
import Blender
from Blender import *
import webbrowser
try:
import nt
os = nt
os.sep=''
except:
import posix
os = posix
os.sep='/'
from os import path
try:
import tarfile
COMPRESSION = 1
except:
COMPRESSION = 0
def first_setup(rootFolder):
global DefaultAuthorName, DefaultAuthorEmail, DefaultAuthorWebPage
libFolder = sys.dirname(rootFolder)
libs = ["objectLib","materialLib","ipoLib","pathLib","lampLib","worldLib","cameraLib","textureLib","particleLib","actionLib","armatureLib","poseLib","latticeLib","sceneLib","logicLib"]
cats = []
cats.append("Vehicles,Buildings,Furniture,Mechanical,Characters,Clothing,Weapons,Nature,Props,Tools,Aircrafts,Misc")
cats.append("Skin,Terrain,Building,Abstract,Mechanical,Stone,Fabric,Organic,Metals,Technical,Water,Wood,Misc,Nature")
cats.append("Simple,Complex,Misc")
cats.append("Simple,Complex,Misc")
cats.append("Portrait,Outdoors,Indoors,FX,Colored")
cats.append("Skies,Enviroment,Grids,Abstract,Technical,Water")
cats.append("Static,Motion,Misc,FX")
cats.append("ColorBands,Patterns,Skin,Terrain,Building,Abstract,Mechanical,Stone,Fabric,Organic,Metals,Technical,Water,Wood,Misc,Nature")
cats.append("Hair,Fur,Static,Special Fx,Motion,Physics")
cats.append("Simple,Complex,Misc")
cats.append("Humanoid,Mechanical,Animals,Simple")
cats.append("Simple,Complex,Misc")
cats.append("Simple,Complex,Misc")
cats.append("Concepts,Enviroment,Demos,Tutorials")
cats.append("Concepts,Game,Demos")
if libFolder:
if not sys.exists(sys.dirname(libFolder) + os.sep + "BlenderLib" + os.sep + "library.txt") and not sys.exists(sys.dirname(libFolder) + os.sep + "library.txt"):
libFolder = sys.dirname(rootFolder) + os.sep + "BlenderLib"
os.mkdir(libFolder)
txt = open(libFolder + os.sep + "library.txt","w")
txt.write("Blender Library Folder 1.3n")
txt.close()
count = 0
for lib in libs:
where = libFolder + os.sep + lib
os.mkdir(where)
for cat in cats[count].split(","):
os.mkdir(where + os.sep + cat)
count = count + 1
set_registry(libFolder)
get_registry()
init("material")
else:
if sys.exists(libFolder + os.sep + "library.txt"):
txt = open(libFolder + os.sep + "library.txt","r")
text = txt.readline()
txt.close()
if text != "Blender Library Folder 1.3n":
c = Draw.PupMenu("Old library format (1.2.1 or below). Upgrade?%t|Yes (You wont lose your content)%x1|No, let me choose another folder%x2")
if c == 1:
txt = open(libFolder + os.sep + "library.txt","w")
txt.write("Blender Library Folder 1.3n")
txt.close()
count = 0
for lib in libs:
where = sys.dirname(rootFolder) + os.sep + lib
if not sys.exists(where):
os.mkdir(where)
for cat in cats[count].split(","):
if not sys.exists(where + os.sep + cat):
os.mkdir(where + os.sep + cat)
count = count + 1
set_registry(sys.dirname(libFolder))
get_registry()
init("material")
Draw.PupMenu("Now we are about to import your old content%t|Ok, go ahead...")
for lib in libs:
where = sys.dirname(rootFolder) + os.sep + lib + os.sep
for f in os.listdir(where):
if f[-3:] == "txt" or f[-3:] == "jpg" or f[-5:] == "blend":
os.rename(where + f,where + lib.upper()[:-3] + "-" + f)
elif f[-3:] == "dat" or f[-3:] == "bak":
os.remove(where + f)
import_folder(where)
Draw.PupMenu("All done.%t|It´s now safe to delete the files in the root of each lib|OBJECT-. ,MATERIAL-., etc.")
else:
set_registry(sys.dirname(libFolder + os.sep))
get_registry()
init("material")
def init(lib):
global LIB, LIB_FOLDER, LIB_FILE, LIB_TH, LIB_DAT, LIB_CATS, LIB_FAVS, FILE_NAME, setNAMEstr, DefaultDescription, MENU_MAT_SCENE, LIC, LICENSE
global LIBS, IMG, BROWSING,TOTAL_CATS, TOTAL_ITEMS, CURRENT_CAT, CURRENT_ITEM, PACK, CURRENT_SUBCAT,TOTAL_SUBCATS
global ITEMS, AUTHORS, DESCS, MAILS, WEBPAGES, ONAMES, SHAPE, NAMEstr, RAY, LibraryDir, DefaultName
global DefaultAuthorName, DefaultAuthorEmail, DefaultAuthorWebPage, LIBmenu, CURRENT_LIB, TEXFACE, SEARCHstr
global BATCH_MODE, BATCH_ALL
# Init filesystem variables.
LIB = lib
LIB_FOLDER = LibraryDir + os.sep + LIB + "Lib" + os.sep
LIB_FAVS = LIB_FOLDER + "favourites.dat"
FILE_NAME = Blender.Get("filename")
LIBS = ["material","object","lamp","path","ipo","world","camera","texture","particle","armature","lattice","scene","action","pose","logic"]
LIBS.sort()
CURRENT_LIB = LIBS.index(lib) +1
# Try to load the libThumb image; is not yet loaded, create a new one.
try:
IMG = Image.Get("libThumb")
except:
IMG = Image.New("libThumb",240,240,24)
# check if Blender version can pack images via python.
try:
IMG.pack
PACK = 1
except:
PACK = 0
LIBmenu = ""
for l in LIBS:
LIBmenu += l.capitalize() + "s|"
# Init browsing variables.
TOTAL_CATS = 0
TOTAL_SUBCATS = 0
TOTAL_ITEMS = 0
CURRENT_SUBCAT = 1
CURRENT_CAT = 1
CURRENT_ITEM = 1
LIC = 1
LICENSE =""
ITEMS = []
AUTHORS = []
DESCS = []
MAILS = []
WEBPAGES = []
ONAMES = []
NAMEstr = ""
setNAMEstr = ""
DefaultName = ""
SEARCHstr = ""
MENU_MAT_SCENE = 0
SHAPE = 3
RAY = 0
TEXFACE = 0
BATCH_MODE = 0
BATCH_ALL = 0
ShowWarnigns = 1
# Init unkown author data
DefaultName = ""
DefaultAuthorName = "Unkown"
DefaultAuthorEmail = "Not available"
DefaultAuthorWebPage = "Not available"
DefaultDescription = "Just some " + LIB.capitalize()
get_categories()
get_buffer()
get_favs()
get_items()
def get_registry():
global DefaultAuthorName, DefaultAuthorEmail, DefaultAuthorWebPage, BROWSING,LibraryDir,ShowWarnings
global AuthorName, AuthorEmail, AuthorWebPage, BROWSING,LibraryDir, SHOW_HELP
rdict = Registry.GetKey('BlenderLibrary', True)
if rdict:
AuthorName = rdict['Default_Author_Name']
AuthorEmail = rdict['Default_Author_Email']
AuthorWebPage = rdict['Default_Author_WebPage']
DefaultDescription = rdict['Default_Description']
DefaultUsageDoc = rdict['Default_Usage_Doc']
DefaultBackground = rdict['Default_Background']
DefaultLicenseText = rdict['Default_License_File']
LibraryDir = rdict['Library_DIR'].rstrip(os.sep)
ShowWarnings = rdict['Show_Warnings']
if ShowWarnings:
SHOW_HELP = 1
else:
SHOW_HELP = 0
if sys.exists(LibraryDir + os.sep + "library.txt"):
BROWSING = 1
where = LibraryDir + os.sep +"sceneLib"
if not sys.exists(where):
sceneCats = ["Concepts","Enviroment","Demos","Tutorials"]
os.mkdir(where)
for sC in sceneCats:
if not sys.exists(where + os.sep + sC):
os.mkdir(where + os.sep + sC)
where = LibraryDir + os.sep + "logicLib"
if not sys.exists(where):
logicCats = ["Concepts","Game","Demos"]
os.mkdir(where)
for sC in logicCats:
if not sys.exists(where + os.sep + sC):
os.mkdir(where + os.sep + sC)
else:
BROWSING = 2
else:
BROWSING = 2
def set_registry(libFolder):
global AuthorName, AuthorEmail, AuthorWebPage, ShowWarnings
d =
d['Default_Author_Name'] = AuthorName
d['Default_Author_Email'] = AuthorEmail
d['Default_Author_WebPage'] = AuthorWebPage
d['Default_Description'] = "Just some "
d['Default_Usage_Doc'] = "None"
d['Default_Background'] = "Grid"
d['Default_License_File'] = "license.txt"
d['Library_DIR'] = libFolder #+ os.sep
d['Show_Warnings'] = ShowWarnings
Blender.Registry.SetKey('BlenderLibrary', d, True)
def event(evt, val):
global CURRENT_ITEM, TOTAL_ITEMS, SHOW_HELP
if evt == Draw.ESCKEY or evt == Draw.QKEY:
Draw.Exit()
return
elif evt == Draw.RIGHTMOUSE:
if BROWSING != 2:
if SHOW_HELP == 1:
SHOW_HELP = 2
Draw.Redraw()
Window.RedrawAll()
show_libs()
if SHOW_HELP == 2: SHOW_HELP = 1
else:
c = Draw.PupMenu("Setup Menu%t|Quit%x20")
if c: Draw.Exit()
# Previous Item Buttom
elif evt == Draw.WHEELUPMOUSE:
if CURRENT_ITEM != 1:
CURRENT_ITEM = CURRENT_ITEM - 1
update_thumb()
Draw.Redraw(1)
# Next Item Buttom
elif evt == Draw.WHEELDOWNMOUSE:
if CURRENT_ITEM != TOTAL_ITEMS:
CURRENT_ITEM = CURRENT_ITEM + 1
update_thumb()
Draw.Redraw(1)
def button_event(evt):
global CURRENT_CAT, CURRENT_ITEM, MENU_CAT, TOTAL_ITEMS, TOTAL_CATS, ITEMS, AUTHORS, BROWSING, NAMEstr, FAVmenu, FAVlist, MENU_MAT_SCENE, SCENE_ITEMS, SHAPE, MENU_SHAPE, setNAMEstr, MENU_LIC, LIC, LICENSE, LICS, ITEMlist
global AUTHORstr,DESCstr,EMAILstr, WEBPAGEstr, DefaultAuthorName, DefaultAuthorEmail, DefaultAuthorWebPage,DefaultDescription, LIB, LIBS, RAY, obITEMS, DefaultName, CURRENT_SUBCAT, CURRENT_LIB, MENU_SUBCAT
global AuthorName, AuthorEmail, AuthorWebPage, LibraryDir, MENU_LIB, TEXFACE, SEARCHstr , SearchString
global BATCH_MODE, BATCH_ALL, SHOW_HELP
# Load items and Favorites Menu
#
if evt == 1:
if SHOW_HELP == 1:
SHOW_HELP = 4
Draw.Redraw()
Window.RedrawAll()
if LIB == "material":
c = Draw.PupMenu("Load " + LIB.capitalize() + "%t|Load this " + LIB + "|Load into selected object|%l|" + FAVmenu)
if LIB == "texture":
c = Draw.PupMenu("Load " + LIB.capitalize() + "%t|Load this " + LIB + "|%l|" + FAVmenu)
elif LIB == "particle":
c = Draw.PupMenu("Load " + LIB.capitalize() + "%t|Load with " + LIB + " object|Load into selected object%x122|%l|" + FAVmenu)
elif LIB == "world":
c = Draw.PupMenu("Load " + LIB.capitalize() + "%t|Load this " + LIB + "|Load and set current%x99|%l|" + FAVmenu)
elif LIB == "ipo":
c = Draw.PupMenu("Load " + LIB.capitalize() + "%t|Load this " + LIB + "|Load and set on this object%x121|%l|" + FAVmenu)
elif LIB == "object":
c = Draw.PupMenu("Load " + LIB.capitalize() + "%t|Load this " + LIB + "|Load at 3D Cursor Position%x124|%l|" + FAVmenu)
elif LIB == "path":
c = Draw.PupMenu("Load " + LIB.capitalize() + "%t|Load this " + LIB + "|%l|" + FAVmenu)
elif LIB == "lamp":
c = Draw.PupMenu("Load " + LIB.capitalize() + "%t|Load this " + LIB + "s|%l|" + FAVmenu)
elif LIB == "action":
c = Draw.PupMenu("Load " + LIB.capitalize() + "%t|Load this " + LIB + "|Load and set in Armature%x136|%l|" + FAVmenu)
elif LIB == "camera":
c = Draw.PupMenu("Load " + LIB.capitalize() + "%t|Load this " + LIB + "|Load and set current%x120|%l|" + FAVmenu)
elif LIB == "pose":
c = Draw.PupMenu("Load " + LIB.capitalize() + "%t|Load this " + LIB + "|%l|" + FAVmenu)
elif LIB == "armature":
c = Draw.PupMenu("Load " + LIB.capitalize() + "%t|Load this " + LIB + "|%l|" + FAVmenu)
elif LIB == "lattice":
c = Draw.PupMenu("Load " + LIB.capitalize() + "%t|Load this " + LIB + "|%l|" + FAVmenu)
elif LIB == "scene":
c = Draw.PupMenu("Load " + LIB.capitalize() + "%t|Load this " + LIB + "|Load and set current%x127|%l|" + FAVmenu)
if LIB == "logic":
c = Draw.PupMenu("Load " + LIB.capitalize() + "%t|Load with " + LIB + " object|Load into selected object%x137|%l|" + FAVmenu)
if SHOW_HELP == 4: SHOW_HELP = 1
# Just Load the item
#
if c == 1:
if LIB != "pose":
load_item(ITEMS[CURRENT_ITEM-1],AUTHORS[CURRENT_ITEM-1],ONAMES[CURRENT_ITEM-1],0,0)
else:
load_pose(ITEMS[CURRENT_ITEM-1],AUTHORS[CURRENT_ITEM-1],ONAMES[CURRENT_ITEM-1],0)
# Load material and set in object
#
elif c == 2:
load_item(ITEMS[CURRENT_ITEM-1],AUTHORS[CURRENT_ITEM-1],ONAMES[CURRENT_ITEM-1],0,0)
ob = Object.GetSelected()
if ob:
if ob[0].getType() == "Mesh":
me = NMesh.GetRaw(ob[0].getData(1))
mat = Material.Get(ITEMS[CURRENT_ITEM-1])
mats = me.getMaterials()
newmats = [mat]
if len(mats) <= 1:
me.setMaterials(newmats)
else:
c = Draw.PupMenu("Replace material index?%t|1|2|3|4|5|6")
mats[c-1] = mat
me.setMaterials(mats)
me.update()
else:
Draw.PupMenu("Can´t set material into this object!%t|The selected object is not a mesh.")
else:
Draw.PupMenu("No object selected!")
# Load object at 3D Cursor.
#
elif c == 124:
load_item(ITEMS[CURRENT_ITEM-1],AUTHORS[CURRENT_ITEM-1],ONAMES[CURRENT_ITEM-1],0,1)
# Load camera and set current.
#
elif c == 120:
load_item(ITEMS[CURRENT_ITEM-1],AUTHORS[CURRENT_ITEM-1],ONAMES[CURRENT_ITEM-1],0,0)
scn = Scene.GetCurrent()
scn.setCurrentCamera(Object.Get(ITEMS[CURRENT_ITEM-1]))
Window.CameraView(0)
Window.Redraw()
# Load world and set current
#
elif c == 99:
load_item(ITEMS[CURRENT_ITEM-1],AUTHORS[CURRENT_ITEM-1],ONAMES[CURRENT_ITEM-1],0,0)
cWorld = World.Get(ITEMS[CURRENT_ITEM-1])
cWorld.setCurrent()
# Load IPO and set in select object
#
elif c == 121:
load_item(ITEMS[CURRENT_ITEM-1],AUTHORS[CURRENT_ITEM-1],ONAMES[CURRENT_ITEM-1],0,0)
ob = Object.GetSelected()[0]
ipo = Ipo.Get(ITEMS[CURRENT_ITEM-1])
ob.setIpo(ipo)
elif c == 127:
load_item(ITEMS[CURRENT_ITEM-1],AUTHORS[CURRENT_ITEM-1],ONAMES[CURRENT_ITEM-1],0,0)
scn = Scene.Get(ITEMS[CURRENT_ITEM-1])
scn.makeCurrent()
elif c == 136:
load_item(ITEMS[CURRENT_ITEM-1],AUTHORS[CURRENT_ITEM-1],ONAMES[CURRENT_ITEM-1],0,0)
actions = Armature.NLA.GetActions()
for a in actions:
if a == ONAMES[CURRENT_ITEM-1]:
action = actions[a]
ob = Object.GetSelected()[0]
if ob.getType() == "Armature":
action.setActive(ob)
else:
Draw.PupMenu("Error.%t|Please select an Armature.")
Window.RedrawAll()
elif c == 137:
load_item(ITEMS[CURRENT_ITEM-1],AUTHORS[CURRENT_ITEM-1],ONAMES[CURRENT_ITEM-1],0,0)
scn = Scene.GetCurrent()
obs = scn.getChildren()
logOb = Object.Get(ITEMS[CURRENT_ITEM-1])
destOb = Object.GetSelected()[0]
for o in obs:
o.sel = 0
destOb.sel = 1
logOb.sel = 1
Draw.PupMenu("Important!%t|Please selec Logic Bricks in the following menu.")
for win in Window.GetScreenInfo():
if win["type"] == 1:
winId = win["id"]
Window.SetKeyQualifiers(48)
Window.QAdd(winId,Draw.CKEY,1)
Window.QHandle(winId)
Window.QRead()
Window.SetKeyQualifiers(0)
for o in obs:
o.sel = 0
destOb.sel = 1
logOb.copyAllPropertiesTo(destOb)
Draw.Redraw()
scn.unlink(logOb)
scn.update()
Window.RedrawAll()
# Load particle setting and materials into selected object
#
elif c == 122:
scn = Scene.GetCurrent()
ob = Object.GetSelected()[0]
if ob:
if ob.getType() == "Mesh":
load_item(ITEMS[CURRENT_ITEM-1],AUTHORS[CURRENT_ITEM-1],ONAMES[CURRENT_ITEM-1],0,0)
obName = ob.getName()
obMatrix = ob.getMatrix()
ob.setName("libraryTemp")
me = ob.getData()
parOb = Object.Get(ONAMES[CURRENT_ITEM-1])
parMe = parOb.getData()
parMats = parMe.getMaterials()
cc = Draw.PupMenu("Add particle materials too?%t|Yes%x1|No%x2")
if cc == 1:
me.materials = parMats
me.update()
parOb.link(me)
parOb.setMatrix(obMatrix)
scn.unlink(ob)
scn.update(1)
parOb.makeDisplayList()
parOb.setName(obName)
Blender.Redraw()
else:
Draw.PupMenu("Can´t load particle settings!%t|The selected object is not a mesh.")
else:
Draw.PupMenu("No object selected!")
# Load or remove a favourite from the menu
#
elif c > 2 and Window.GetKeyQualifiers() != 48:
f = FAVlist[c-4].split(",")
tcat = f[3].split("|")
if len(tcat) == 1:
f[3] = tcat[0] + os.sep
elif len(tcat) == 2:
f[3] = tcat[0] + os.sep + tcat[1] + os.sep
if sys.exists(LIB_FOLDER + f[3] +prepare_item(f[0]) + "-" + prepare_item(f[1]) + ".blend"):
load_item(f[0],f[1],f[2],f[3],0)
else:
cf = Draw.PupMenu(LIB.capitalize() + " no longer seems to be in your library. Remove from Favourites?%t|Yes%x1|No%x2")
if cf == 1:
remove_fav(f[0]+","+f[1]+","+f[2])
elif c > 2 and Window.GetKeyQualifiers() == 48:
f = FAVlist[c-4].split(",")
remove_fav(f[0]+","+f[1]+","+f[2])
Draw.Redraw(1)
# Info Button
elif evt == 2:
if SHOW_HELP == 1:
SHOW_HELP = 3
Draw.Redraw()
Window.RedrawAll()
show_info()
if SHOW_HELP == 3: SHOW_HELP = 1
Draw.Redraw(1)
# Manage Button
elif evt == 3:
if SHOW_HELP == 1:
SHOW_HELP = 5
Draw.Redraw()
Window.RedrawAll()
t = "Manage " + LIB.capitalize() + "%t|Rename%x1|Delete%x2|Add to favourites%x4|Move to category%x3|%l|Custom preview image...%x9|%l|Import " + LIB.capitalize() + "s...%x5|Export this " + LIB.capitalize() + "...%x6"
if LIB != "pose" : t += "|%l|Open " + LIB + " .blend%x7"
c = Draw.PupMenu(t)
manage(c)
if SHOW_HELP == 5: SHOW_HELP = 1
# Categories Menu
elif evt == 12:
LIC = MENU_LIC.val
LICENSE = LICS[LIC-1]
elif evt == 10:
if MENU_CAT.val <= TOTAL_CATS and not Window.GetKeyQualifiers():
CURRENT_CAT = MENU_CAT.val
Blender.Wc = MENU_CAT.val
get_buffer()
get_items()
elif MENU_CAT.val <= TOTAL_CATS and Window.GetKeyQualifiers() == 48:
cc = Draw.PupMenu("Delete this categorie?%t|Yes%x1|No%x2")
if cc == 1:
delete_categorie(MENU_CAT.val)
elif MENU_CAT.val <= TOTAL_CATS and Window.GetKeyQualifiers() == 12:
c = Draw.PupStrInput("New Name:", "", 25)
if c:
rename_categorie(MENU_SUBCAT.val,c,0)
elif not Window.GetKeyQualifiers():
c = Draw.PupStrInput("Name:", "", 25)
if c:
add_new_categorie(c)
Draw.Redraw(1)
# Sub Categories Menu
elif evt == 500:
if MENU_SUBCAT.val <= TOTAL_SUBCATS and not Window.GetKeyQualifiers():
CURRENT_SUBCAT = MENU_SUBCAT.val
get_buffer2()
get_items()
elif MENU_SUBCAT.val <= TOTAL_SUBCATS and Window.GetKeyQualifiers() == 48:
c = Draw.PupMenu("Delete this sub categorie?%t|Yes%x1|No%x2")
if c == 1:
delete_subcat(MENU_SUBCAT.val)
elif MENU_SUBCAT.val <= TOTAL_SUBCATS and Window.GetKeyQualifiers() == 12:
c = Draw.PupStrInput("NewName:", "", 25)
if c:
rename_categorie(MENU_SUBCAT.val,c,1)
elif not Window.GetKeyQualifiers():
c = Draw.PupStrInput("Name:", "", 25)
if c:
add_new_categorie(CATlist[CURRENT_CAT-1] + os.sep + c)
Draw.Redraw(1)
# Libraries Menu
elif evt == 600:
Blender.Wb=LIBS[MENU_LIB.val-1]
CURRENT_LIB = MENU_LIB.val
init(LIBS[MENU_LIB.val-1])
Draw.Redraw(1)
# Items Menu
elif evt == 11:
CURRENT_ITEM = MENU_MAT.val
update_thumb()
Draw.Redraw(1)
# Previous Item Buttom
elif evt == 5:
if CURRENT_ITEM != 1:
CURRENT_ITEM = CURRENT_ITEM - 1
update_thumb()
Draw.Redraw(1)
# Next Item Buttom
elif evt == 6:
if CURRENT_ITEM != TOTAL_ITEMS:
CURRENT_ITEM = CURRENT_ITEM + 1
update_thumb()
Draw.Redraw(1)
# Previous Category Buttom
elif evt == 7:
if CURRENT_CAT != 1:
CURRENT_CAT = CURRENT_CAT - 1
Blender.Wc = CURRENT_CAT
get_buffer()
get_items()
Draw.Redraw(1)
# Next Category Buttom
elif evt == 8:
if CURRENT_CAT != TOTAL_CATS:
CURRENT_CAT = CURRENT_CAT + 1
Blender.Wc = CURRENT_CAT
get_buffer()
get_items()
Draw.Redraw(1)
# Previous Category Buttom
elif evt == 77:
if CURRENT_SUBCAT != 1:
CURRENT_SUBCAT = CURRENT_SUBCAT - 1
get_buffer2()
get_items()
Draw.Redraw(1)
# Next Category Buttom
elif evt == 88:
if CURRENT_SUBCAT != TOTAL_SUBCATS:
CURRENT_SUBCAT = CURRENT_SUBCAT + 1
get_buffer2()
get_items()
Draw.Redraw(1)
# Prev Library Button
elif evt == 777:
if CURRENT_LIB != 1:
init(LIBS[CURRENT_LIB -2])
Draw.Redraw(1)
# Next Library Button
elif evt == 888:
if CURRENT_LIB != len(LIBS):
init(LIBS[CURRENT_LIB])
Draw.Redraw(1)
# Shape Menu for Material Library
elif evt == 13:
SHAPE = MENU_SHAPE.val
Draw.Redraw(1)
elif evt == 60:
BATCH_MODE = 1 - BATCH_MODE
Draw.Redraw(1)
elif evt == 61:
BATCH_ALL = 1 - BATCH_ALL
Draw.Redraw(1)
# Items Drop Down Menu
elif evt == 14:
scene_items()
c = Draw.PupMenu(SCENE_ITEMSmenu)
if c != -1 and LIB != "object" and LIB != "lamp":
NAMEstr = SCENE_ITEMS[c-1]
MENU_MAT_SCENE = c-1
elif c != -1 and (LIB == "object" or LIB == "lamp"):
DefaultName = SCENE_ITEMS[c-1]
MENU_MAT_SCENE = c-1
Draw.Redraw(1)
# Set Name Label
elif evt == 520:
DefaultName = setNAMEstr.val
Draw.Redraw(1)
# Description Label
elif evt == 21:
DefaultDescription = DESCstr.val
Draw.Redraw(1)
# Author Label
elif evt == 22:
DefaultAuthorName = AUTHORstr.val
Draw.Redraw(1)
# E-mail Label
elif evt == 23:
DefaultAuthorEmail = EMAILstr.val
Draw.Redraw(1)
# Website Label
elif evt == 24:
DefaultAuthorWebPage = WEBPAGEstr.val
Draw.Redraw(1)
# Add stuff to the library Button
elif evt == 31:
BROWSING = 0
#if LIB == "object":
# Blender.Redraw()
# if ShowWarnings:
# Draw.PupMenu("Select the "+ LIB.capitalize() +"s you want to save by|SELECTING THEM ON SCENE, then type a name for them.|You CAN select several " + LIB.capitalize() + "s.|Frame them with the active camera to get a nice preview.|Save the .blend first if you have unsaved changes,|it will be reopened after adding the " + LIB.capitalize() +".")
#elif LIB == "lamp":
# Blender.Redraw()
# if ShowWarnings:
# Draw.PupMenu("Select the "+ LIB.capitalize() +"s you want to save by|SELECTING THEM ON SCENE, then type a name for them.|You CAN select several " + LIB.capitalize() + "s.|Save the .blend first if you have unsaved changes,|it will be reopened after adding the " + LIB.capitalize() +".")
#elif LIB == "pose":
# Blender.Redraw()
# if ShowWarnings:
# Draw.PupMenu("Select the armature with the pose by|SELECTING IT ON SCENE, then type a name for the pose.|Frame the figure with the active camera to get a nice preview.|After adding the pose there is no need to save the .blend|You can continue working as usual.")
#elif LIB == "logic":
# Blender.Redraw()
# if ShowWarnings:
# Draw.PupMenu("Select the object with " + LIB.capitalize() + " Bricks you want to save by|CLICKING IN THE UPPER ARROW BUTTON.|You can only select one object from the list.|Save this .blend first if you have unsaved changes,|it will be reopened after adding the object.")
#else:
# Blender.Redraw()
# if ShowWarnings:
# Draw.PupMenu("Select the " + LIB.capitalize() + " you want to save by|CLICKING IN THE UPPER ARROW BUTTON.|You can only select one " + LIB.capitalize() +" from the list.|Save this .blend first if you have unsaved changes,|it will be reopened after adding the " + LIB.capitalize() +".")
Draw.Redraw(1)
# Cancel add form and go back to browse the library
# Reset labels to they defaults
elif evt == 33:
DefaultAuthorName = "Unkown"
DefaultAuthorEmail = "Not available"
DefaultAuthorWebPage = "Not available"
BROWSING = 1
Draw.Redraw(1)
# Add the item to the library.
elif evt == 34:
if (NAMEstr != "" or DefaultName != "") or BATCH_MODE:
if checkforview():
if LIB == "object" or LIB == "lamp":
scene_items()
if LIB == "material": save_mat(CATlist[CURRENT_CAT-1],NAMEstr,DefaultAuthorName,DefaultAuthorEmail,DefaultAuthorWebPage,DefaultDescription,SHAPE,MENU_MAT_SCENE)
elif LIB == "texture": save_tex(CATlist[CURRENT_CAT-1],NAMEstr,DefaultAuthorName,DefaultAuthorEmail,DefaultAuthorWebPage,DefaultDescription,SHAPE,MENU_MAT_SCENE)
elif LIB == "particle": save_particle(CATlist[CURRENT_CAT-1],NAMEstr,DefaultAuthorName,DefaultAuthorEmail,DefaultAuthorWebPage,DefaultDescription,SHAPE,MENU_MAT_SCENE)
elif LIB == "world": save_world(CATlist[CURRENT_CAT-1],NAMEstr,DefaultAuthorName,DefaultAuthorEmail,DefaultAuthorWebPage,DefaultDescription,SHAPE,MENU_MAT_SCENE)
elif LIB == "object": save_object(CATlist[CURRENT_CAT-1],NAMEstr,DefaultAuthorName,DefaultAuthorEmail,DefaultAuthorWebPage,DefaultDescription,SHAPE,MENU_MAT_SCENE,obITEMS,DefaultName)
elif LIB == "lamp": save_lamp(CATlist[CURRENT_CAT-1],NAMEstr,DefaultAuthorName,DefaultAuthorEmail,DefaultAuthorWebPage,DefaultDescription,SHAPE,MENU_MAT_SCENE,obITEMS,DefaultName)
elif LIB == "ipo": save_ipo(CATlist[CURRENT_CAT-1],NAMEstr,DefaultAuthorName,DefaultAuthorEmail,DefaultAuthorWebPage,DefaultDescription,SHAPE,MENU_MAT_SCENE)
elif LIB == "action": save_action(CATlist[CURRENT_CAT-1],NAMEstr,DefaultAuthorName,DefaultAuthorEmail,DefaultAuthorWebPage,DefaultDescription,SHAPE,MENU_MAT_SCENE)
elif LIB == "image": save_image(CATlist[CURRENT_CAT-1],NAMEstr,DefaultAuthorName,DefaultAuthorEmail,DefaultAuthorWebPage,DefaultDescription,SHAPE,MENU_MAT_SCENE)
elif LIB == "camera": save_camera(CATlist[CURRENT_CAT-1],NAMEstr,DefaultAuthorName,DefaultAuthorEmail,DefaultAuthorWebPage,DefaultDescription,SHAPE,MENU_MAT_SCENE)
elif LIB == "path": save_path(CATlist[CURRENT_CAT-1],NAMEstr,DefaultAuthorName,DefaultAuthorEmail,DefaultAuthorWebPage,DefaultDescription,SHAPE,MENU_MAT_SCENE)
elif LIB == "armature": save_armature(CATlist[CURRENT_CAT-1],NAMEstr,DefaultAuthorName,DefaultAuthorEmail,DefaultAuthorWebPage,DefaultDescription,SHAPE,MENU_MAT_SCENE)
elif LIB == "lattice": save_lattice(CATlist[CURRENT_CAT-1],NAMEstr,DefaultAuthorName,DefaultAuthorEmail,DefaultAuthorWebPage,DefaultDescription,SHAPE,MENU_MAT_SCENE)
elif LIB == "scene": save_scene(CATlist[CURRENT_CAT-1],NAMEstr,DefaultAuthorName,DefaultAuthorEmail,DefaultAuthorWebPage,DefaultDescription,SHAPE,MENU_MAT_SCENE)
elif LIB == "pose": save_pose(CATlist[CURRENT_CAT-1],NAMEstr,DefaultAuthorName,DefaultAuthorEmail,DefaultAuthorWebPage,DefaultDescription,SHAPE,MENU_MAT_SCENE,DefaultName)
elif LIB == "logic": save_logic(CATlist[CURRENT_CAT-1],NAMEstr,DefaultAuthorName,DefaultAuthorEmail,DefaultAuthorWebPage,DefaultDescription,SHAPE,MENU_MAT_SCENE)
else:
Draw.PupMenu("No 3dView!%t|Please have at least one 3dView displayed along with the Script Window.")
elif NAMEstr == "" and LIB != "object" and LIB != "lamp":
Draw.PupMenu("No " + LIB.capitalize() +"!%t|Please select a " + LIB.capitalize() + " to add.")
else:
Draw.PupMenu("No set name!%t|Please type a Name if the upper NAME: field.")
# Main Menu Button
elif evt == 50:
show_libs()
Draw.Redraw(1)
# Enable Raytrace Button
elif evt == 51:
RAY = 1 - RAY
Draw.Redraw(1)
# Enable Texface Button
elif evt == 53:
TEXFACE = 1 - TEXFACE
Draw.Redraw(1)
# Fill Button
elif evt == 52:
AUTHORstr.val = AuthorName
EMAILstr.val = AuthorEmail
WEBPAGEstr.val = AuthorWebPage
DefaultAuthorName = AuthorName
DefaultAuthorEmail = AuthorEmail
DefaultAuthorWebPage = AuthorWebPage
Draw.Redraw(1)
# Search Button
elif evt == 54:
if SEARCHstr:
#print "nSearching for " + SEARCHstr + "!"
ITEMlist =[]
path.walk(LIB_FOLDER,search,SEARCHstr)
if TOTAL_ITEMS > 0:
CURRENT_ITEM = 1
update_thumb()
else:
Draw.PupMenu("Search error.%t|Please enter some text to search for.")
Draw.Redraw(1)
elif evt == 55:
SEARCHstr = SearchString.val
if SEARCHstr:
ITEMlist =[]
path.walk(LIB_FOLDER,search,SEARCHstr)
if TOTAL_ITEMS > 0:
CURRENT_ITEM = 1
update_thumb()
else:
Draw.PupMenu("Search error.%t|Please enter some text to search for.")
elif evt == 57:
ITEMlist =[]
BROWSING = 1
get_buffer()
get_items()
Draw.Redraw(1)
# First Setup FileSelector
elif evt == 99:
Window.FileSelector(first_setup, 'CHOOSE FOLDER')
Draw.Redraw(1)
elif evt == 101:
SHOW_HELP = 1 - SHOW_HELP
Draw.Redraw(1)
def draw_square(x,y,w,h,r,g,b,a):
BGL.glEnable(BGL.GL_BLEND)
BGL.glBlendFunc(BGL.GL_SRC_ALPHA, BGL.GL_ONE_MINUS_SRC_ALPHA)
BGL.glColor4f(r,g,b,a)
BGL.glBegin(BGL.GL_POLYGON)
BGL.glVertex2i(x, y)
BGL.glVertex2i(x, y + h)
BGL.glVertex2i(x + w, y + h)
BGL.glVertex2i(x + w, y)
BGL.glEnd()
BGL.glDisable(BGL.GL_BLEND)
def INTtoFLOAT(rgba):
r = float(rgba[0] *10 /254) /10
g = float(rgba[1] *10 /254) /10
b = float(rgba[2] *10 /254) /10
a = float(rgba[3] *10 /254) /10
return [r,g,b,a]
def gui():
global MENU_MAT, MENU_CAT, TOTAL_ITEMS, BROWSING, NAMEstr, MENU_MAT_SCENE, SCENE_ITEMSmenu, SHAPE, MENU_SHAPE, setNAMEstr, MENU_SUBCAT,MENU_LIC, TOTAL_SUBCATS, CURRENT_SUBCAT
global AUTHORstr,DESCstr,EMAILstr, WEBPAGEstr,LIB, RAY, DefaultName, MENU_LIB, CURRENT_LIB, LIC, TEXFACE, TEXFACE
global DefaultAuthorName, DefaultAuthorEmail, DefaultAuthorWebPage, SEARCHstr , SearchString
global BATCH_MODE, BATCH_ALL, SHOW_HELP
theme = Window.Theme.Get()[0]
buts = theme.get('buts')
r,g,b,a = INTtoFLOAT(buts.back)
BGL.glClearColor(r+0.05,g+0.05,b+0.05,a)
BGL.glClear(BGL.GL_COLOR_BUFFER_BIT)
r,g,b,a = INTtoFLOAT(buts.panel)
draw_square(5,5,170,340,r,g,b,a+0.1)
r,g,b,a = INTtoFLOAT(buts.header)
draw_square(5,340,170,16,r-0.1,g-0.1,b-0.1,a)
if BROWSING != 2:
r,g,b,a = INTtoFLOAT(buts.text_hi)
BGL.glColor4f(r,g,b,a)
BGL.glRasterPos2i(10,344)
Draw.Text("Blender Library 1.3.3", "small")
#Draw.PushButton("", 50, 165, 340, 5,5 , "Change Library")
Draw.Toggle("?", 101,150,338, 15,15,SHOW_HELP , "Show Help")
r,g,b,a = INTtoFLOAT(buts.text)
BGL.glColor4f(r,g,b,a)
# Buttons and thumbnail in the BROWSE LIBRARY form
if BROWSING == 1:
if SHOW_HELP == 5:
text = "In this menu you will find options to manage your library items.||If you add an item to favourites it will be listed in the Load menu.||You can also import a custom preview image.||The last option will allow you to open the item's .blend, for editing or to redone the preview image."
elif SHOW_HELP == 4:
text = "From this menu you can load an item to the current .blend||Depending on the kind of item you´ll get diferent loading options.||Below these options there is a list with all the items you have added to your favourites. Just click on one and it will be load, or CRTL-Click to remove it from the list."
elif SHOW_HELP == 3:
text = "This menu displays info about the current item.||If you CRTL-Click in item's name or description you can edit them.||If you click in author's website you will go to his webpage."
elif SHOW_HELP == 2:
text = "Use the first two options to import a single item or a folder full of items you may have downloaded from the net.||"
text += "The third one will launch your web-browser and redirect you to Blender Stuff, where you can download lots of ready to use items.||"
text += "With the fourth one you can run a search for certain matching items in the current library.||"
text += "Click in Preferences... and you can enter your personal info to use the auto fill button in the Add Panel."
elif SHOW_HELP == 1:
text = "This is browsing mode. By using the three drop-down menus on top you can explore your library.||The first one is the library. The two below are categories and subcategories.|You can quickly navigate thru the content by using the arrow buttons on the right of the menus.||The button at the bottom will allow you to add content to the current library."
if SHOW_HELP >= 1:
paragraph([r,g,b],text,140,"small",182,316,14,1)
staX, staY = 0,20
r,g,b,a = INTtoFLOAT(buts.text)
BGL.glColor4f(r,g,b,a)
if TOTAL_ITEMS > 0: # Write current item / total items.
r,g,b,a = INTtoFLOAT(buts.header)
draw_square(9,224,26,16,r,g,b,a)
BGL.glColor3f(0,0,0)
BGL.glRasterPos2i(9,229)
Draw.Text(str(CURRENT_ITEM) + " / " + str(TOTAL_ITEMS), "tiny")
if TOTAL_SUBCATS > 1: # Write current subcat / total subcats.
r,g,b,a = INTtoFLOAT(buts.header)
draw_square(9,274,26,16,r,g,b,a)
BGL.glColor3f(0,0,0)
BGL.glRasterPos2i(9,279)
Draw.Text(str(CURRENT_SUBCAT) + " / " + str(TOTAL_SUBCATS), "tiny")
if TOTAL_ITEMS > 0 :
try:
if IMG.getMaxXY() == [240,240]:
Draw.Image(IMG, 10, 35,0.67,0.67)
else:
Draw.Image(IMG, 10, 35,1,1)
except:
print "No preview image for this item!"
Draw.PushButton("Load", 1, staX + 10, staY + 180, 50,16 , "Load this " + LIB.capitalize())
Draw.PushButton("Info", 2, staX + 65, staY + 180, 50,16 , "Info about this " + LIB.capitalize())
Draw.PushButton("Manage", 3, staX + 120, staY + 180, 50,16 , "Manage your" + LIB.capitalize() +"s")
MENU_MAT = Draw.Menu(ITEMmenu, 11, staX + 10, staY + 226, 120, 16, CURRENT_ITEM, "Select a " + LIB.capitalize())
if CURRENT_ITEM != 1 : Draw.PushButton("<", 5, staX + 134, staY + 226, 16,16 , "Prev " + LIB.capitalize())
if CURRENT_ITEM != TOTAL_ITEMS : Draw.PushButton(">", 6, staX + 150, staY + 226, 16,16 , "Next " + LIB.capitalize())
BGL.glRasterPos2i(staX + 38,staY + 208)
if len(DESCS[CURRENT_ITEM-1]) < 23:
if DESCS[CURRENT_ITEM-1][-1:] == "." or DESCS[CURRENT_ITEM-1][-1:] == "?":
Draw.Text(DESCS[CURRENT_ITEM-1].replace("#",","),"small")
else:
Draw.Text(DESCS[CURRENT_ITEM-1].replace("#",",") +".","small")
else:
Draw.Text(DESCS[CURRENT_ITEM-1][:23].replace("#",",") + "...","small")
MENU_CAT = Draw.Menu(CATmenu, 10, staX + 25, staY + 274, 105, 16, CURRENT_CAT, "Select a Category.")
Draw.PushButton("<", 7, staX + 134, staY + 274, 16,16 , "Prev Category")
Draw.PushButton(">", 8, staX + 150, staY + 274, 16,16 , "Next Category")
MENU_SUBCAT = Draw.Menu(SUBCATmenu, 500, staX + 40, staY + 254, 90, 16, CURRENT_SUBCAT, "Select a Sub Category.")
if CURRENT_SUBCAT != 1 :Draw.PushButton("<", 77, staX + 134, staY + 254, 16,16 , "Prev Sub Category")
if CURRENT_SUBCAT != TOTAL_SUBCATS :Draw.PushButton(">", 88, staX + 150, staY + 254, 16,16 , "Next Sub Category")
MENU_LIB = Draw.Menu(LIBmenu, 600, staX + 10, staY + 294, 120, 16, CURRENT_LIB, "Select a Library.")
Draw.PushButton("<", 777, staX + 134, staY + 294, 16,16 , "Prev Library")
Draw.PushButton(">", 888, staX + 150, staY + 294, 16,16 , "Next Library")
Draw.PushButton("Add " + LIB.capitalize() + "s to Library", 31, 10, 12, 160,16 , "Add " + LIB.capitalize() + " to the Library")
elif BROWSING == 0:
staX, staY = 0,60
scene_items()
get_licenses()
# Labels and buttons for the ADD ITEM form
if LIB != "lamp" and LIB != "object" and LIB != "pose":
Draw.String("Name: ", 20, staX + 10, staY + 220, 135, 16, NAMEstr, 30, "The " + LIB.capitalize() + " Name")
else:
setNAMEstr = Draw.String("Set Name: ", 520, staX + 10, staY + 220, 135, 16, DefaultName, 30, "The " + LIB.capitalize() + " Set Name")
DESCstr = Draw.String("Desc: ", 21, staX + 10, staY + 200, 155, 16, DefaultDescription, 90, "The " + LIB.capitalize() + " Description")
AUTHORstr = Draw.String("Author: ", 22, staX + 10, staY + 160, 155, 16, DefaultAuthorName, 30, "The" + LIB.capitalize() + "Author Name")
EMAILstr = Draw.String("Email: ", 23, staX + 10, staY + 140, 155, 16, DefaultAuthorEmail, 50, "The " + LIB.capitalize() + " Author E-mail")
WEBPAGEstr= Draw.String("Site: ", 24, staX + 10, staY + 120, 155, 16, DefaultAuthorWebPage, 50, "The " + LIB.capitalize() + " Author Site")
MENU_LIC = Draw.Menu(LICmenu, 12, staX + 80, staY + 95, 85, 16, LIC, "Select a License Text.")
if LIB == "material":
MENU_SHAPE = Draw.Menu("Plane%x1|Cube%x2|Sphere%x3", 13, staX + 90, staY + 70, 75, 16, SHAPE, "Select a Shape.")
if LIB == "material" or LIB == "object" or LIB == "lamp":
Draw.Toggle("Enable Ray", 51, staX + 70,staY + 50,95,16, RAY, "Enable raytracer for preview.")
if LIB == "object":
Draw.Toggle("Enable TEXFACE", 53, staX + 70,staY + 30,95,16, TEXFACE, "Enable TEXFACE for preview.")
if LIB == "object" or LIB == "lamp":
Draw.PushButton(">", 14, staX + 145, staY + 220, 20, 16, "Selected " + LIB.capitalize() + "s.")
else:
if LIB != "pose":
Draw.PushButton(">", 14, staX + 145, staY + 220, 20, 16, "Select a " + LIB.capitalize() + ".")
Draw.PushButton("Cancel", 33, 120, 15, 50,16 , "Cancel Operation")
Draw.PushButton("Add "+ LIB.capitalize(), 34, 40, 15, 80,16 , "Adds the " + LIB.capitalize())
Draw.PushButton("Fill", 52, staX + 136, staY + 178, 28,15 , "Fill with your data")
# Text for the ADD ITEM form
BGL.glRasterPos2i(staX + 16,staY + 98)
Draw.Text("License text:", "small")
if LIB == "material":
BGL.glRasterPos2i(staX + 16,staY + 73)
Draw.Text("Preview shape:", "small")
BGL.glRasterPos2i(staX + 10,staY + 242)
Draw.Text("Requiered information :", "small")
BGL.glRasterPos2i(staX + 10,staY + 182)
Draw.Text("Optional information :", "small")
BGL.glRasterPos2i(staX + 10,staY + 261)
Draw.Text("Add " + LIB.capitalize()+ " to Library", "small")
#Batch Mode
if LIB == "material" or LIB == "texture":
Draw.Toggle("Batch Mode", 60, staX + 10,staY + 10,85,16, BATCH_MODE, "Enable Batch Mode.")
if BATCH_MODE:
Draw.Toggle("Add All", 61, staX + 120,staY + 10,45,16, BATCH_ALL, "Add every " + LIB.capitalize() + " in this blend.")
if SHOW_HELP:
if LIB == "object":
text = "Choose the "+ LIB.capitalize() +"s you want to save by SELECTING THEM ON SCENE, then type a name for them.|You CAN select several " + LIB.capitalize() + "s.|Frame them with the active camera to get a nice preview.||Save the .blend first if you have unsaved changes,|it will be reopened after adding the " + LIB.capitalize() +"."
elif LIB == "lamp":
text = "Choose the "+ LIB.capitalize() +"s you want to save by SELECTING THEM ON SCENE, then type a name for them.|You CAN select several " + LIB.capitalize() + "s.||Save the .blend first if you have unsaved changes,|it will be reopened after adding the " + LIB.capitalize() +"."
elif LIB == "pose":
text = "Choose the armature with the pose you want to save by SELECTING IT ON SCENE, then type a name for the pose in the label on the left.||Frame the figure with the active camera to get a nice preview.||After adding the pose there is no need to reopen the .blend, You can continue working as usual."
elif LIB == "logic":
text = "Select the object with " + LIB.capitalize() + " Bricks you want to save by CLICKING IN THE ARROW BUTTON on the left.|You can only select one object from the list.||Save this .blend first if you have unsaved changes, it will be reopened after adding the object."
else:
text = "Select the " + LIB.capitalize() + " you want to save by CLICKING IN THE ARROW BUTTON on the left.|You can select only one " + LIB.capitalize() +" from the list.||You can use the FILL button to auto enter your personal info.||If you
This isn't going to be as EZ as I thought. A few more questions if I may.
Can I copy this script to Note Pad, and run the script in Blender?
Will this script work in version 2.42a? (I noticed it said, it was for
version 2.41.)
Sorry for all the questions, I am fairly new to Blender. It has a huge learning curve. Once you get past the learning curve, I think it is a wonderful program. I prefer to model in Wings3d, but the materials in blender are much more supeireor.
Here is an exsample of what I beleive can be used in the libary.
Here is the original thread by the author. It contains all the instructions and updates.
Your picture looks like it might just be a seperate blend file to store materials. Simply create a scene like you want it, with some spheres, ect, create your materials and apply them to the spheres. Remember to name each material. Save as MyMaterials.blend
Later on, when you want to add one of your previously created materials to a model you are working on, click on File at the top/left corner and choose Append. In the menu, locate the file MyMaterials.blend and select it. You will now be presented with different items to be appended. You want a material so choose Material. Now you will see a list of the materials, so simply click on one and the click the LoadLibrary button at top/right. Now, select your model and go to the materials buttons (F5) Click the little arrows beside Add New and you will see your newly appended material. Click it and your done!
Which ever method you decide to use, good luck and have fun.
to save the script to your computer coppy script to notepad (windows not blender). save scrip under .blender-scripts- then library.py
make sure while saving it that no encoding is selected and its not a .txt type file.
yes, this script works in 2.42a, infact it even works in the current cvs.
to access the script make a new blender window, set the type to scripts, and click scripts and open object-"Blender Library". then the rest is pretty simple.
after a couple weeks in blender you will learn modeling in blender is far superior to wings. there is a panel for all the tools as well as hotkeys and its much more stable as well as efficient and userfriendly
I like this appending function. Here's a few samples of the materials that I've been appending:
I still don't think I have it right though. In their sample picture, you can see a display of the material. This is what mine looks like:
As you can see there is no display window.
Also the script doesn't seem to be loading in blender.:
Anybody know what I'm doing wrong?
This site uses cookies to deliver the best experience. Our own cookies make user accounts and other features possible. Third-party cookies are used to display relevant ads and to analyze how Renderosity is used. By using our site, you acknowledge that you have read and understood our Terms of Service, including our Cookie Policy and our Privacy Policy.
Is their a way you can save a material. Say I created a material I like, and want to save it. Is their a way I can do that, and load it again?