diff options
Diffstat (limited to 'release')
27 files changed, 416 insertions, 192 deletions
diff --git a/release/scripts/bpydata/KUlang.txt b/release/scripts/bpydata/KUlang.txt new file mode 100644 index 00000000000..38605d69c9f --- /dev/null +++ b/release/scripts/bpydata/KUlang.txt @@ -0,0 +1,121 @@ +Version 3.233-2004 +****************** +Espanol +Sale del programa +Utilidades de...%t|Alinea objetos%x1|Creacion%x2|Edita mallas%x3|Edita objetos%x4 +11 +Mov +Esc +Encaja +Abarca +Separa +Alinea +Rota +Incr. +Crea nuevos objetos +Es+ +Es* +Separar entre:%t|Origenes%x1|Centros geometricos%x2|Minimos%x3|Maximos%x4|Baricentro%x5|Objetos%x6 +Crear%t|Arco (3 ptos.)%x1|Arco (interactivo)%x2|Circunferencia (3 ptos.)%x3 +12 +Puntos +Centro +Orden +Objeto +AngIni: +AngFin: +Angulo: +Radio: +Puntos: +Centro +Nombre: +Puntos +Modifica vertices%t|Subdivide%x1|Envia a un plano%x2|Aplica LocRotSize%x3 +Partes +Proyectar en el plano:%t|Coordenado global...%x1|Coordenado local...%x2 +Actuar sobre el plano%t|Yz%x1|Zx%x2|Xy%x3 +En la dirección%t|X%x1|Y%x2|Z%x3|Ortogonal al plano%x4 +Captura +Buffer%t|Copia vector diferencia%x1|Copia distancia%x2|Copia diferencia de rotacion%x3|Copia media LocRotSiz%x4|Ver buffer en consola%x5 +Transformar LocRotSize%t|Hacia el obj. activo%x1|Aleatoriamente%x2 +Poner a distancia fija%x1|Sumar (desp. absoluto)%x2|Multiplicar (desp. relativo)%x3 +******************** +English +Exit program +Utils about:%t|Align Objects%x1|Create%x2|Edit Meshes%x3|Edit Objects%x4 +11 +Mov +Sca +Fit +Embrace +Separate +Align +Rota +Incr. +Create new objects +Sc+ +Sc* +Separate between:%t|Origins%x1|Geometric centers%x2|Minimum%x3|Maximum%x4|Baricenter%x5|Objects%x6 +Create what%t|Arc (3 pts.)%x1|Arc (interactive)%x2|Circunference (3 pts.)%x3 +12 +Points +Centre +Sort +Object +AngIni: +AngEnd: +Angle: +Radius: +Points: +Centre +ObjName: +Points +Modify vertices%t|Subdivide edges%x1|Send to a plane%x2|Set LocRotSize%x3 +Parts +Project onto the plane:%t|Global coordinated...%x1|Local coordinated...%x2 +Act on plane%t|Yz%x1|Zx%x2|Xy%x3 +In direction%t|X%x1|Y%x2|Z%x3|Ortogonal to plane%x4 +Get +Buffer%t|Copy diference vector%x1|Copy distance%x2|Copy rot diference%x3|Copy LocRotSiz average%x4|Show Buffer in Console%x5 +Transform LocRotSize%t|Close to active%x1|Randomly%x2 +Set at fixed distance%x1|Add (absolute displ.)%x2|Multiply (relative displ.)%x3 +******************** +Catala +Surt del programa +Utilitats de...%t|Alinea objectes%x1|Creacio%x2|Edita malles%x3|Edita objetes%x4 +11 +Mov +Esc +Encaixa +Abarca +Separa +Alinea +Rotacio +Incr. +Crea objectes nous +Es+ +Es* +Separa entra:%t|Origens%x1|Centres geometrics%x2|Minims%x3|Maxims%x4|Baricentre%x5|Objectes%x6 +Crear%t|Arc (3 pts.)%x1|Arc (interactiu)%x2|Circumferencia (3 pts.)%x3 +12 +Punts +Centre +Ordre +Objecte +AngIni: +AngFi: +Angle: +Radi: +Punts: +Centre +Nom: +Punts +Modifica vertex%t|Subdivideix%x1|Envia a un pla%x2|Aplica LocRotSize%x3 +Parts +Projectar en el pla:%t|Coordenacio global...%x1|Coordenacio local...%x2 +Actuar sobre el pla%t|Yz%x1|Zx%x2|Xy%x3 +En la direccio%t|X%x1|Y%x2|Z%x3|Ortogonal al pla%x4 +Captura +Buffer%t|Copia vector diferencia%x1|Copia distancia%x2|Copia diferencia de rotacio%x3|Copia mitjana LocRotSiz%x4|Veure buffer en consola%x5 +Transformar LocRotSize%t|Cap al obj. actiu%x1|Aleatoriamente%x2 +Posar a distancia fixa%x1|Sumar (desp. absolut)%x2|Multiplicar (desp. relatiu)%x3 diff --git a/release/scripts/bpydata/config/readme.txt b/release/scripts/bpydata/config/readme.txt new file mode 100644 index 00000000000..099ade0f3e5 --- /dev/null +++ b/release/scripts/bpydata/config/readme.txt @@ -0,0 +1,10 @@ +This folder is for automatically saved scripts configuration data. +This data is loaded when Blender starts and saved whenever a .blend file is +saved. + +To use this feature scripts just need to set a Blender.Registry key with the +extension ".cfg" (for example, "myscript.cfg"). + +Please check the API Reference doc or the documentation for the +"Scripts Config Editor" script with the Help menu-> "Scripts Help Browser" +script in Blender. diff --git a/release/scripts/bpydata/readme.txt b/release/scripts/bpydata/readme.txt new file mode 100644 index 00000000000..3e640e27c4b --- /dev/null +++ b/release/scripts/bpydata/readme.txt @@ -0,0 +1,9 @@ +This directory is the default place for scripts to put their data, +like internal files needed by the script and its saved configuration. + +Scripts can find the path to this dir using Blender.Get("datadir"). +Ex: + +import Blender +print Blender.Get("datadir") + diff --git a/release/scripts/mod_blender.py b/release/scripts/bpymodules/BPyBlender.py index a4e4419381d..dda491e3af9 100644 --- a/release/scripts/mod_blender.py +++ b/release/scripts/bpymodules/BPyBlender.py @@ -1,7 +1,7 @@ # $Id$ # # -------------------------------------------------------------------------- -# mod_blender.py version 0.2 Jul 26, 2004 +# BPyBlender.py version 0.3 Mar 20, 2005 # -------------------------------------------------------------------------- # helper functions to be used by other scripts # -------------------------------------------------------------------------- @@ -32,6 +32,6 @@ basic_modules = [ 'Blender', 'chunk','colorsys','copy','copy_reg','gzip','os','random','repr','stat', 'string','StringIO','types','UserDict','webbrowser','whrandom', -'zlib', -'math' +'zlib', 'math', +'BPyBlender' ] diff --git a/release/scripts/mod_ai2obj.py b/release/scripts/bpymodules/ai2obj.py index 8be6c5e18eb..8be6c5e18eb 100644 --- a/release/scripts/mod_ai2obj.py +++ b/release/scripts/bpymodules/ai2obj.py diff --git a/release/scripts/mod_eps2obj.py b/release/scripts/bpymodules/eps2obj.py index 8db89892fc6..8db89892fc6 100644 --- a/release/scripts/mod_eps2obj.py +++ b/release/scripts/bpymodules/eps2obj.py diff --git a/release/scripts/mod_gimp2obj.py b/release/scripts/bpymodules/gimp2obj.py index 7128107cfcd..7128107cfcd 100644 --- a/release/scripts/mod_gimp2obj.py +++ b/release/scripts/bpymodules/gimp2obj.py diff --git a/release/scripts/mod_meshtools.py b/release/scripts/bpymodules/meshtools.py index 772b7549a11..4ddf6035e59 100644 --- a/release/scripts/mod_meshtools.py +++ b/release/scripts/bpymodules/meshtools.py @@ -25,7 +25,7 @@ try: import operator except: msg = "Error: you need a full Python install to run this script." - mod_meshtools.print_boxed(msg) + meshtools.print_boxed(msg) Blender.Draw.PupMenu("ERROR%t|"+msg) # ================================= diff --git a/release/scripts/mod_svg2obj.py b/release/scripts/bpymodules/svg2obj.py index 7445b13a4a7..7445b13a4a7 100644 --- a/release/scripts/mod_svg2obj.py +++ b/release/scripts/bpymodules/svg2obj.py diff --git a/release/scripts/lightwave_export.py b/release/scripts/lightwave_export.py index 99d7deab440..dc14d036503 100644 --- a/release/scripts/lightwave_export.py +++ b/release/scripts/lightwave_export.py @@ -52,7 +52,7 @@ v5.5 format. # | Read and write LightWave Object File Format (*.lwo) | # +---------------------------------------------------------+ -import Blender, mod_meshtools +import Blender, meshtools import struct, chunk, os, cStringIO, time, operator # ============================== @@ -65,11 +65,11 @@ def write(filename): objects = Blender.Object.GetSelected() objects.sort(lambda a,b: cmp(a.name, b.name)) if not objects: - mod_meshtools.print_boxed("No mesh objects are selected.") + meshtools.print_boxed("No mesh objects are selected.") return - if len(objects) > 20 and mod_meshtools.show_progress: - mod_meshtools.show_progress = 0 + if len(objects) > 20 and meshtools.show_progress: + meshtools.show_progress = 0 text = generate_text() desc = generate_desc() @@ -99,8 +99,8 @@ def write(filename): if mesh.hasFaceUV(): vmad_uv = generate_vmad_uv(mesh) # per face - if mod_meshtools.has_vertex_colors(mesh): - if mod_meshtools.average_vcols: + if meshtools.has_vertex_colors(mesh): + if meshtools.average_vcols: vmap_vc = generate_vmap_vc(mesh) # per vert else: vmad_vc = generate_vmad_vc(mesh) # per face @@ -115,8 +115,8 @@ def write(filename): write_chunk(meshdata, "VMAD", vmad_uv) chunks.append(vmad_uv) - if mod_meshtools.has_vertex_colors(mesh): - if mod_meshtools.average_vcols: + if meshtools.has_vertex_colors(mesh): + if meshtools.average_vcols: write_chunk(meshdata, "VMAP", vmap_vc) chunks.append(vmap_vc) else: @@ -142,7 +142,7 @@ def write(filename): end = time.clock() seconds = " in %.2f %s" % (end-start, "seconds") message = "Successfully exported " + os.path.basename(filename) + seconds - mod_meshtools.print_boxed(message) + meshtools.print_boxed(message) # ======================================= # === Generate Null-Terminated String === @@ -164,17 +164,17 @@ def get_used_material_names(objects): meshname = object.data.name mesh = Blender.NMesh.GetRaw(meshname) if not mesh: continue - if (not mesh.materials) and (mod_meshtools.has_vertex_colors(mesh)): + if (not mesh.materials) and (meshtools.has_vertex_colors(mesh)): # vcols only - if mod_meshtools.average_vcols: + if meshtools.average_vcols: matnames["\251 Per-Vert Vertex Colors"] = None else: matnames["\251 Per-Face Vertex Colors"] = None - elif (mesh.materials) and (not mod_meshtools.has_vertex_colors(mesh)): + elif (mesh.materials) and (not meshtools.has_vertex_colors(mesh)): # materials only for material in mesh.materials: matnames[material.name] = None - elif (not mesh.materials) and (not mod_meshtools.has_vertex_colors(mesh)): + elif (not mesh.materials) and (not meshtools.has_vertex_colors(mesh)): # neither matnames["\251 Blender Default"] = None else: @@ -228,9 +228,9 @@ def generate_layr(name, idx): def generate_pnts(mesh, matrix): data = cStringIO.StringIO() for i in range(len(mesh.verts)): - if not i%100 and mod_meshtools.show_progress: + if not i%100 and meshtools.show_progress: Blender.Window.DrawProgressBar(float(i)/len(mesh.verts), "Writing Verts") - x, y, z = mod_meshtools.apply_transform(mesh.verts[i].co, matrix) + x, y, z = meshtools.apply_transform(mesh.verts[i].co, matrix) data.write(struct.pack(">fff", x, z, y)) return data.getvalue() @@ -255,7 +255,7 @@ def average_vertexcolors(mesh): vcolor_add = lambda u, v: [u[0]+v[0], u[1]+v[1], u[2]+v[2], u[3]+v[3]] vcolor_div = lambda u, s: [u[0]/s, u[1]/s, u[2]/s, u[3]/s] for i in range(len(mesh.faces)): # get all vcolors that share this vertex - if not i%100 and mod_meshtools.show_progress: + if not i%100 and meshtools.show_progress: Blender.Window.DrawProgressBar(float(i)/len(mesh.verts), "Finding Shared VColors") for j in range(len(mesh.faces[i].v)): index = mesh.faces[i].v[j].index @@ -263,7 +263,7 @@ def average_vertexcolors(mesh): r,g,b,a = color.r, color.g, color.b, color.a vertexcolors.setdefault(index, []).append([r,g,b,a]) for i in range(len(vertexcolors)): # average them - if not i%100 and mod_meshtools.show_progress: + if not i%100 and meshtools.show_progress: Blender.Window.DrawProgressBar(float(i)/len(mesh.verts), "Averaging Vertex Colors") vcolor = [0,0,0,0] # rgba for j in range(len(vertexcolors[i])): @@ -296,7 +296,7 @@ def generate_vmad_vc(mesh): data.write(struct.pack(">H", 3)) # dimension data.write(generate_nstring("Blender's Vertex Colors")) # name for i in range(len(mesh.faces)): - if not i%100 and mod_meshtools.show_progress: + if not i%100 and meshtools.show_progress: Blender.Window.DrawProgressBar(float(i)/len(mesh.faces), "Writing Vertex Colors") numfaceverts = len(mesh.faces[i].v) for j in range(numfaceverts-1, -1, -1): # Reverse order @@ -318,7 +318,7 @@ def generate_vmad_uv(mesh): data.write(struct.pack(">H", 2)) # dimension data.write(generate_nstring("Blender's UV Coordinates")) # name for i in range(len(mesh.faces)): - if not i%100 and mod_meshtools.show_progress: + if not i%100 and meshtools.show_progress: Blender.Window.DrawProgressBar(float(i)/len(mesh.faces), "Writing UV Coordinates") numfaceverts = len(mesh.faces[i].v) for j in range(numfaceverts-1, -1, -1): # Reverse order @@ -346,7 +346,7 @@ def generate_pols(mesh): data = cStringIO.StringIO() data.write("FACE") # polygon type for i in range(len(mesh.faces)): - if not i%100 and mod_meshtools.show_progress: + if not i%100 and meshtools.show_progress: Blender.Window.DrawProgressBar(float(i)/len(mesh.faces), "Writing Faces") data.write(struct.pack(">H", len(mesh.faces[i].v))) # numfaceverts numfaceverts = len(mesh.faces[i].v) @@ -362,18 +362,18 @@ def generate_ptag(mesh, material_names): data = cStringIO.StringIO() data.write("SURF") # polygon tag type for i in range(len(mesh.faces)): # numfaces - if not i%100 and mod_meshtools.show_progress: + if not i%100 and meshtools.show_progress: Blender.Window.DrawProgressBar(float(i)/len(mesh.faces), "Writing Surface Indices") data.write(generate_vx(i)) - if (not mesh.materials) and (mod_meshtools.has_vertex_colors(mesh)): # vcols only - if mod_meshtools.average_vcols: + if (not mesh.materials) and (meshtools.has_vertex_colors(mesh)): # vcols only + if meshtools.average_vcols: name = "\251 Per-Vert Vertex Colors" else: name = "\251 Per-Face Vertex Colors" - elif (mesh.materials) and (not mod_meshtools.has_vertex_colors(mesh)): # materials only + elif (mesh.materials) and (not meshtools.has_vertex_colors(mesh)): # materials only idx = mesh.faces[i].mat #erialIndex name = mesh.materials[idx].name - elif (not mesh.materials) and (not mod_meshtools.has_vertex_colors(mesh)): # neither + elif (not mesh.materials) and (not meshtools.has_vertex_colors(mesh)): # neither name = "\251 Blender Default" else: # both idx = mesh.faces[i].mat @@ -388,7 +388,7 @@ def generate_ptag(mesh, material_names): # =================================================== def generate_vcol_surf(mesh): data = cStringIO.StringIO() - if mod_meshtools.average_vcols and mod_meshtools.has_vertex_colors(mesh): + if meshtools.average_vcols and meshtools.has_vertex_colors(mesh): surface_name = generate_nstring("\251 Per-Vert Vertex Colors") else: surface_name = generate_nstring("\251 Per-Face Vertex Colors") @@ -413,7 +413,7 @@ def generate_vcol_surf(mesh): data.write(generate_nstring("Blender's Vertex Colors")) # name data.write("CMNT") # material comment - comment = "Vertex Colors: Exported from Blender\256 " + mod_meshtools.blender_version_str + comment = "Vertex Colors: Exported from Blender\256 " + meshtools.blender_version_str comment = generate_nstring(comment) data.write(struct.pack(">H", len(comment))) data.write(comment) @@ -452,7 +452,7 @@ def generate_surf(material_name): data.write(struct.pack(">fH", gloss, 0)) data.write("CMNT") # material comment - comment = material_name + ": Exported from Blender\256 " + mod_meshtools.blender_version_str + comment = material_name + ": Exported from Blender\256 " + meshtools.blender_version_str comment = generate_nstring(comment) data.write(struct.pack(">H", len(comment))) data.write(comment) @@ -490,7 +490,7 @@ def generate_default_surf(): data.write(struct.pack(">fH", gloss, 0)) data.write("CMNT") # material comment - comment = material_name + ": Exported from Blender\256 " + mod_meshtools.blender_version_str + comment = material_name + ": Exported from Blender\256 " + meshtools.blender_version_str # vals = map(chr, range(164,255,1)) # keys = range(164,255,1) @@ -509,7 +509,7 @@ def generate_default_surf(): # ============================================ def generate_text(): comment = "Lightwave Export Script for Blender " - comment += mod_meshtools.blender_version_str + "\n" + comment += meshtools.blender_version_str + "\n" comment += "by Anthony D'Agostino\n" comment += "scorpius@netzero.com\n" comment += "http://ourworld.compuserve.com/homepages/scorpius\n" diff --git a/release/scripts/lightwave_import.py b/release/scripts/lightwave_import.py index c795358c734..7e479536678 100644 --- a/release/scripts/lightwave_import.py +++ b/release/scripts/lightwave_import.py @@ -52,7 +52,7 @@ Notes:<br> # | Read and write LightWave Object File Format (*.lwo) | # +---------------------------------------------------------+ -import Blender, mod_meshtools +import Blender, meshtools import struct, chunk, os, cStringIO, time, operator # ============================= @@ -81,10 +81,10 @@ def read(filename): verts = read_verts(lwochunk) elif lwochunk.chunkname == "POLS" and form_type == "LWO2": # Faces v6.0 faces = read_faces_6(lwochunk) - mod_meshtools.create_mesh(verts, faces, objname) + meshtools.create_mesh(verts, faces, objname) elif lwochunk.chunkname == "POLS" and form_type == "LWOB": # Faces v5.5 faces = read_faces_5(lwochunk) - mod_meshtools.create_mesh(verts, faces, objname) + meshtools.create_mesh(verts, faces, objname) else: # Misc Chunks lwochunk.skip() @@ -95,7 +95,7 @@ def read(filename): if form_type == "LWO2": fmt = " (v6.0 Format)" if form_type == "LWOB": fmt = " (v5.5 Format)" message = "Successfully imported " + os.path.basename(filename) + fmt + seconds - mod_meshtools.print_boxed(message) + meshtools.print_boxed(message) # ================== # === Read Verts === @@ -106,7 +106,7 @@ def read_verts(lwochunk): #$verts = [] verts = [None] * numverts for i in range(numverts): - if not i%100 and mod_meshtools.show_progress: + if not i%100 and meshtools.show_progress: Blender.Window.DrawProgressBar(float(i)/numverts, "Reading Verts") x, y, z = struct.unpack(">fff", data.read(12)) #$verts.append((x, z, y)) @@ -143,7 +143,7 @@ def read_faces_5(lwochunk): faces = [] i = 0 while i < lwochunk.chunksize: - if not i%100 and mod_meshtools.show_progress: + if not i%100 and meshtools.show_progress: Blender.Window.DrawProgressBar(float(i)/lwochunk.chunksize, "Reading Faces") facev = [] numfaceverts, = struct.unpack(">H", data.read(2)) @@ -186,7 +186,7 @@ def read_faces_6(lwochunk): return "" i = 0 while(i < lwochunk.chunksize-4): - if not i%100 and mod_meshtools.show_progress: + if not i%100 and meshtools.show_progress: Blender.Window.DrawProgressBar(float(i)/lwochunk.chunksize, "Reading Faces") facev = [] numfaceverts, = struct.unpack(">H", data.read(2)) diff --git a/release/scripts/nendo_export.py b/release/scripts/nendo_export.py index 1dd84bb6d81..830c4303f56 100644 --- a/release/scripts/nendo_export.py +++ b/release/scripts/nendo_export.py @@ -59,7 +59,7 @@ field. # | Read and write Nendo File Format (*.nendo) | # +---------------------------------------------------------+ -import Blender, mod_meshtools +import Blender, meshtools import struct, time, sys, os # ============================== @@ -82,15 +82,15 @@ def write(filename): Blender.Draw.PupMenu("Nendo Export Error%t|"+message) return - edge_table = mod_meshtools.generate_edgetable(mesh) + edge_table = meshtools.generate_edgetable(mesh) try: - edge_table = mod_meshtools.generate_edgetable(mesh) + edge_table = meshtools.generate_edgetable(mesh) assert len(edge_table) <= maxedges except: edge_table = {} message = "Unable to generate Edge Table for the object named " + meshname - mod_meshtools.print_boxed(message) + meshtools.print_boxed(message) Blender.Draw.PupMenu("Edge Table Error%t|"+message) Blender.Window.DrawProgressBar(1.0, "") # clear progressbar return @@ -109,7 +109,7 @@ def write(filename): end = time.clock() seconds = " in %.2f %s" % (end-start, "seconds") message = "Successfully exported " + os.path.basename(filename) + seconds - mod_meshtools.print_boxed(message) + meshtools.print_boxed(message) # ==================== # === Write Header === diff --git a/release/scripts/nendo_import.py b/release/scripts/nendo_import.py index 2af19ff5a5d..e7f3071bd99 100644 --- a/release/scripts/nendo_import.py +++ b/release/scripts/nendo_import.py @@ -54,7 +54,7 @@ edges during the course of modeling. # | Read and write Nendo File Format (*.nendo) | # +---------------------------------------------------------+ -import Blender, mod_meshtools +import Blender, meshtools import struct, time, sys, os # ============================= @@ -75,7 +75,7 @@ def read(filename): uv = read_uv(file) verts = make_verts(vert_table) faces = make_faces(edge_table) - mod_meshtools.create_mesh(verts, faces, objname) + meshtools.create_mesh(verts, faces, objname) Blender.Window.DrawProgressBar(1.0, "Done") # clear progressbar file.close() @@ -83,7 +83,7 @@ def read(filename): seconds = " in %.2f %s" % (end-start, "seconds") message = "Successfully imported " + os.path.basename(filename) + seconds message += " (%s)" % version.title() - mod_meshtools.print_boxed(message) + meshtools.print_boxed(message) # ======================= # === Read The Header === @@ -93,7 +93,7 @@ def read_header(file): misc, = struct.unpack(">H", file.read(2)) numobjs, = struct.unpack(">B", file.read(1)) if (version != "nendo 1.0") and (version != "nendo 1.1"): - mod_meshtools.print_boxed(file.name, "is not a Nendo file") + meshtools.print_boxed(file.name, "is not a Nendo file") return return version, numobjs @@ -116,7 +116,7 @@ def read_edge_table(file, version): numedges, = struct.unpack(">H", file.read(2)) edge_table = {} for i in range(numedges): - if not i%100 and mod_meshtools.show_progress: + if not i%100 and meshtools.show_progress: Blender.Window.DrawProgressBar(float(i)/numedges, "Reading Edge Table") edge = struct.unpack(">8H", file.read(16)) if version == "nendo 1.1": @@ -132,7 +132,7 @@ def read_face_table(file): numfaces, = struct.unpack(">H", file.read(2)) face_table = {} for i in range(numfaces): - if not i%100 and mod_meshtools.show_progress: + if not i%100 and meshtools.show_progress: Blender.Window.DrawProgressBar(float(i)/numfaces, "Reading Face Table") face_table[i] = struct.unpack(">H", file.read(2))[0] return face_table @@ -144,7 +144,7 @@ def read_vert_table(file): numverts, = struct.unpack(">H", file.read(2)) vert_table = [] for i in range(numverts): - if not i%100 and mod_meshtools.show_progress: + if not i%100 and meshtools.show_progress: Blender.Window.DrawProgressBar(float(i)/numverts, "Reading Vertex Table") w, x, y, z = struct.unpack(">H3f", file.read(14)) vert_table.append((w,(x, y, z))) @@ -164,7 +164,7 @@ def read_uv(file): print "%ix%i" % (xres, yres) pixel = 0 while pixel < (xres*yres): - if not pixel%100 and mod_meshtools.show_progress: + if not pixel%100 and meshtools.show_progress: Blender.Window.DrawProgressBar(float(pixel)/xres*yres, "Reading Texture") count, = struct.unpack(">B", file.read(1)) rgb = file.read(3) @@ -183,7 +183,7 @@ def make_verts(vert_table): verts = [] for i in range(len(vert_table)): vertex = vert_table[i][1] - vertex = mod_meshtools.apply_transform(vertex, matrix) + vertex = meshtools.apply_transform(vertex, matrix) verts.append(vertex) return verts diff --git a/release/scripts/off_export.py b/release/scripts/off_export.py index 332d553b389..8465720478f 100644 --- a/release/scripts/off_export.py +++ b/release/scripts/off_export.py @@ -39,7 +39,7 @@ Notes:<br> # | Read and write Object File Format (*.off) | # +---------------------------------------------------------+ -import Blender, mod_meshtools +import Blender, meshtools #import time # ============================== @@ -62,14 +62,14 @@ def write(filename): # === Vertex List === for i in range(len(mesh.verts)): - if not i%100 and mod_meshtools.show_progress: + if not i%100 and meshtools.show_progress: Blender.Window.DrawProgressBar(float(i)/len(mesh.verts), "Writing Verts") x, y, z = mesh.verts[i].co file.write("%f %f %f\n" % (x, y, z)) # === Face List === for i in range(len(mesh.faces)): - if not i%100 and mod_meshtools.show_progress: + if not i%100 and meshtools.show_progress: Blender.Window.DrawProgressBar(float(i)/len(mesh.faces), "Writing Faces") file.write(`len(mesh.faces[i].v)`+' ') mesh.faces[i].v.reverse() @@ -83,7 +83,7 @@ def write(filename): #end = time.clock() #seconds = " in %.2f %s" % (end-start, "seconds") message = "Successfully exported " + Blender.sys.basename(filename)# + seconds - mod_meshtools.print_boxed(message) + meshtools.print_boxed(message) def fs_callback(filename): if filename.find('.off', -4) <= 0: filename += '.off' diff --git a/release/scripts/off_import.py b/release/scripts/off_import.py index 94b6423149a..cbaab483154 100644 --- a/release/scripts/off_import.py +++ b/release/scripts/off_import.py @@ -41,7 +41,7 @@ Notes:<br> # | Read and write Object File Format (*.off) | # +---------------------------------------------------------+ -import Blender, mod_meshtools +import Blender, meshtools #import time # ============================= @@ -67,7 +67,7 @@ def read(filename): # === Vertex List === for i in range(numverts): - if not i%100 and mod_meshtools.show_progress: + if not i%100 and meshtools.show_progress: Blender.Window.DrawProgressBar(float(i)/numverts, "Reading Verts") if has_uv: x, y, z, u, v = map(float, file.readline().split()) @@ -78,7 +78,7 @@ def read(filename): # === Face List === for i in range(numfaces): - if not i%100 and mod_meshtools.show_progress: + if not i%100 and meshtools.show_progress: Blender.Window.DrawProgressBar(float(i)/numfaces, "Reading Faces") line = file.readline().split() numfaceverts = len(line)-1 @@ -91,13 +91,13 @@ def read(filename): objname = Blender.sys.splitext(Blender.sys.basename(filename))[0] - mod_meshtools.create_mesh(verts, faces, objname, faces, uv) + meshtools.create_mesh(verts, faces, objname, faces, uv) Blender.Window.DrawProgressBar(1.0, '') # clear progressbar file.close() #end = time.clock() #seconds = " in %.2f %s" % (end-start, "seconds") message = "Successfully imported " + Blender.sys.basename(filename)# + seconds - mod_meshtools.print_boxed(message) + meshtools.print_boxed(message) def fs_callback(filename): read(filename) diff --git a/release/scripts/paths_import.py b/release/scripts/paths_import.py index 0ec2b4e2f8a..889bcdad1e6 100644 --- a/release/scripts/paths_import.py +++ b/release/scripts/paths_import.py @@ -46,19 +46,19 @@ import Blender argv=__script__['arg'] if argv=='SVG': - from mod_svg2obj import * + from svg2obj import * elif argv=='AI': - from mod_ai2obj import * + from ai2obj import * elif argv=='EPS': - from mod_eps2obj import * + from eps2obj import * elif argv=='Gimp_1_0': - from mod_gimp2obj import * + from gimp2obj import * elif argv=='Gimp_2_0': - from mod_svg2obj import * + from svg2obj import * text = 'Import %s' % argv Blender.Window.FileSelector (fonctionSELECT, text) diff --git a/release/scripts/radiosity_export.py b/release/scripts/radiosity_export.py index c9d5128b367..4f7766c3dd5 100644 --- a/release/scripts/radiosity_export.py +++ b/release/scripts/radiosity_export.py @@ -52,14 +52,14 @@ specular highlights to the vertex colors. # | Read and write Radiosity File Format (*.radio) | # +---------------------------------------------------------+ -import Blender, mod_meshtools +import Blender, meshtools #import time try: import struct except: msg = "Error: you need a full Python install to run this script." - mod_meshtools.print_boxed(msg) + meshtools.print_boxed(msg) Blender.Draw.PupMenu("ERROR%t|"+msg) # ================================ @@ -75,10 +75,10 @@ def write(filename): mesh = Blender.NMesh.GetRaw(meshname) obj = Blender.Object.Get(objname) - if not mod_meshtools.has_vertex_colors(mesh): + if not meshtools.has_vertex_colors(mesh): message = "Please assign vertex colors before exporting. \n" message += objname + " object was not saved." - mod_meshtools.print_boxed(message) + meshtools.print_boxed(message) Blender.Draw.PupMenu("ERROR%t|"+message) return @@ -89,7 +89,7 @@ def write(filename): # === Vertex List === file.write(struct.pack("<l", len(mesh.verts))) for i in range(len(mesh.verts)): - if not i%100 and mod_meshtools.show_progress: + if not i%100 and meshtools.show_progress: Blender.Window.DrawProgressBar(float(i)/len(mesh.verts), "Writing Verts") x, y, z = mesh.verts[i].co @@ -98,7 +98,7 @@ def write(filename): # === Face List === file.write(struct.pack("<l", len(mesh.faces))) for i in range(len(mesh.faces)): - if not i%100 and mod_meshtools.show_progress: + if not i%100 and meshtools.show_progress: Blender.Window.DrawProgressBar(float(i)/len(mesh.faces), "Writing Faces") file.write(struct.pack("<b", len(mesh.faces[i].v))) @@ -116,7 +116,7 @@ def write(filename): #end = time.clock() #seconds = " in %.2f %s" % (end-start, "seconds") message = "Successfully exported " + Blender.sys.basename(filename)# + seconds - mod_meshtools.print_boxed(message) + meshtools.print_boxed(message) def fs_callback(filename): if filename.find('.radio', -6) <= 0: filename += '.radio' diff --git a/release/scripts/radiosity_import.py b/release/scripts/radiosity_import.py index f3e14d669a6..704a87becf5 100644 --- a/release/scripts/radiosity_import.py +++ b/release/scripts/radiosity_import.py @@ -37,14 +37,14 @@ file to open. # | Read and write Radiosity File Format (*.radio) | # +---------------------------------------------------------+ -import Blender, mod_meshtools +import Blender, meshtools #import time try: import struct except: msg = "Error: you need a full Python install to run this script." - mod_meshtools.print_boxed(msg) + meshtools.print_boxed(msg) Blender.Draw.PupMenu("ERROR%t|"+msg) # =============================== @@ -63,7 +63,7 @@ def read(filename): # === Vertex List === numverts, = struct.unpack("<l", file.read(4)) for i in range(numverts): - if not i%100 and mod_meshtools.show_progress: + if not i%100 and meshtools.show_progress: Blender.Window.DrawProgressBar(float(i)/numverts, "Reading Verts") x, y, z = struct.unpack("<fff", file.read(12)) mesh.verts.append(Blender.NMesh.Vert(x, y, z)) @@ -71,7 +71,7 @@ def read(filename): # === Face List === numfaces, = struct.unpack("<l", file.read(4)) for i in range(numfaces): - if not i%100 and mod_meshtools.show_progress: + if not i%100 and meshtools.show_progress: Blender.Window.DrawProgressBar(float(i)/numfaces, "Reading Faces") face = Blender.NMesh.Face() @@ -105,7 +105,7 @@ def read(filename): #end = time.clock() #seconds = " in %.2f %s" % (end-start, "seconds") message = "Successfully imported " + Blender.sys.basename(filename)# + seconds - mod_meshtools.print_boxed(message) + meshtools.print_boxed(message) def fs_callback(filename): read(filename) diff --git a/release/scripts/raw_export.py b/release/scripts/raw_export.py index 4cc49baff1e..f52f0404e19 100644 --- a/release/scripts/raw_export.py +++ b/release/scripts/raw_export.py @@ -39,7 +39,7 @@ Usage:<br> # | Read and write RAW Triangle File Format (*.raw) | # +---------------------------------------------------------+ -import Blender, mod_meshtools +import Blender, meshtools import sys #import time @@ -78,7 +78,7 @@ def write(filename): #end = time.clock() #seconds = " in %.2f %s" % (end-start, "seconds") message = "Successfully exported " + Blender.sys.basename(filename)# + seconds - mod_meshtools.print_boxed(message) + meshtools.print_boxed(message) def fs_callback(filename): if filename.find('.raw', -4) <= 0: filename += '.raw' diff --git a/release/scripts/raw_import.py b/release/scripts/raw_import.py index 13b2e187826..c793791664f 100644 --- a/release/scripts/raw_import.py +++ b/release/scripts/raw_import.py @@ -44,7 +44,7 @@ tolerance. # | Read and write RAW Triangle File Format (*.raw) | # +---------------------------------------------------------+ -import Blender, mod_meshtools +import Blender, meshtools #import time # ================================ @@ -79,13 +79,13 @@ def read(filename): objname = Blender.sys.splitext(Blender.sys.basename(filename))[0] - mod_meshtools.create_mesh(verts, faces, objname) + meshtools.create_mesh(verts, faces, objname) Blender.Window.DrawProgressBar(1.0, '') # clear progressbar file.close() #end = time.clock() #seconds = " in %.2f %s" % (end-start, "seconds") message = "Successfully imported " + Blender.sys.basename(filename)# + seconds - mod_meshtools.print_boxed(message) + meshtools.print_boxed(message) def fs_callback(filename): read(filename) diff --git a/release/scripts/slp_import.py b/release/scripts/slp_import.py index e8c84f62ba2..246f84ec02b 100644 --- a/release/scripts/slp_import.py +++ b/release/scripts/slp_import.py @@ -42,7 +42,7 @@ tolerance. # | Read and write SLP Triangle File Format (*.slp) | # +---------------------------------------------------------+ -import Blender, mod_meshtools +import Blender, meshtools #import time # ================================ @@ -86,13 +86,13 @@ def read(filename): objname = Blender.sys.splitext(Blender.sys.basename(filename))[0] - mod_meshtools.create_mesh(verts, faces, objname) + meshtools.create_mesh(verts, faces, objname) Blender.Window.DrawProgressBar(1.0, '') # clear progressbar file.close() #end = time.clock() #seconds = " in %.2f %s" % (end-start, "seconds") message = "Successfully imported " + Blender.sys.basename(filename)# + seconds - mod_meshtools.print_boxed(message) + meshtools.print_boxed(message) def fs_callback(filename): read(filename) diff --git a/release/scripts/sysinfo.py b/release/scripts/sysinfo.py index 04d31ccec16..daa6867e1a8 100644 --- a/release/scripts/sysinfo.py +++ b/release/scripts/sysinfo.py @@ -2,14 +2,14 @@ """ Name: 'System Information...' -Blender: 234 +Blender: 236 Group: 'HelpSystem' Tooltip: 'Information about your Blender environment, useful to diagnose problems.' """ __author__ = "Willian P. Germano" __url__ = ("blender", "elysiun") -__version__ = "1.0" +__version__ = "1.1" __bpydoc__ = """\ This script creates a text in Blender's Text Editor with information about your OS, video card, OpenGL driver, Blender and Python versions and @@ -24,7 +24,7 @@ or the program's developers. # $Id$ # # -------------------------------------------------------------------------- -# sysinfo.py version 1.0 Jun 09, 2004 +# sysinfo.py version 1.1 Mar 20, 2005 # -------------------------------------------------------------------------- # ***** BEGIN GPL LICENSE BLOCK ***** # @@ -37,7 +37,7 @@ or the program's developers. # # 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 +# 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 @@ -48,6 +48,7 @@ or the program's developers. # -------------------------------------------------------------------------- import Blender +import Blender.sys as bsys from Blender.BGL import * import sys @@ -55,25 +56,26 @@ Blender.Window.WaitCursor(1) # has_textwrap = 1 # see commented code below output_filename = "system-info.txt" warnings = 0 +notices = 0 # non critical warnings def cutPoint(text, length): - "Returns position of the last space found before 'length' chars" - l = length - c = text[l] - while c != ' ': - l -= 1 - if l == 0: return length # no space found - c = text[l] - return l + "Returns position of the last space found before 'length' chars" + l = length + c = text[l] + while c != ' ': + l -= 1 + if l == 0: return length # no space found + c = text[l] + return l def textWrap(text, length = 70): - lines = [] - while len(text) > 70: - cpt = cutPoint(text, length) - line, text = text[:cpt], text[cpt + 1:] - lines.append(line) - lines.append(text) - return lines + lines = [] + while len(text) > 70: + cpt = cutPoint(text, length) + line, text = text[:cpt], text[cpt + 1:] + lines.append(line) + lines.append(text) + return lines ## Better use our own text wrap functions here #try: @@ -83,7 +85,7 @@ def textWrap(text, length = 70): # msg = sys.exc_info()[1].__str__().split()[3] # Blender.Draw.PupMenu("Python error:|This script requires the %s module" %msg) -header = "= Blender %s System Information =" % Blender.Get("version") +header = "= Blender %s System Information =" % Blender.Get("version") lilies = len(header)*"="+"\n" header = lilies + header + "\n" + lilies @@ -97,66 +99,148 @@ output.write("Python:\n======\n\n") output.write("- Version: %s\n\n" % sys.version) output.write("- Path:\n\n") for p in sys.path: - output.write(p + '\n') + output.write(p + '\n') -output.write("\n- Default folder for registered scripts:\n\n") -scriptsdir = Blender.Get("scriptsdir") -if not scriptsdir: - output.write("<WARNING> -- not found") - warnings += 1 +output.write("\n- Directories:") + +if not Blender.Get('homedir'): + outmsg = """ + +<WARNING> - Blender home dir not found! + This should probably be "<path>/.blender/" + where <path> is usually the user's home dir. + + Blender's home dir is where entries like: + folders scripts/, plugins/ and locale/ and + files .Blanguages and .bfont.ttf + are located. + + It's also where Blender stores the Bpymenus file + with information about registered scripts, so it + only needs to scan scripts dir(s) when they are + modified. +""" + output.write(outmsg) + if Blender.Get('scriptsdir').find('release') > 0: + output.write(""" +It seems this Blender binary is located at its cvs source tree: +that's ok, but the scripts registration data will be recreated +from dir(s) whenever you start the program, instead of only +when those dirs are modified. + +Adding a .blender/ subdir to e. g. your home dir can prevent that. +""") + +dirlist = [ + ['homedir', 'Blender home dir', 1], + ['scriptsdir', 'Default dir for scripts', 1], + ['datadir', 'Default "bpydata/" data dir for scripts', 1], + ['uscriptsdir', 'User defined dir for scripts', 0], + ['udatadir', 'Data dir "bpydata/" inside user defined dir', 0] +] + +for dir in dirlist: + dirname, dirstr, is_critical = dir + dirpath = Blender.Get(dirname) + output.write("\n\n %s:\n" % dirstr) + if not dirpath: + if is_critical: + warnings += 1 + output.write(" <WARNING> -- not found") + else: + notices += 1 + output.write(" <NOTICE> -- not found") + else: + output.write(" %s" % dirpath) + +configdir = bsys.join(Blender.Get('datadir'), 'config') +output.write('\n\n Default config data "bpydata/config/" dir:') +if bsys.exists(configdir): + output.write(" %s" % configdir) else: - output.write(scriptsdir) + warnings += 1 + output.write(""" + <WARNING> -- not found. + config/ should be inside the default scripts *data dir*. + It's used by Blender to store scripts configuration data. +""") + +if Blender.Get('udatadir'): + uconfigdir = bsys.join(Blender.Get('udatadir'), 'config') + output.write("\n\n User defined config data dir:") + if bsys.exists(configdir): + output.write(" %s" % configdir) + else: + notices += 1 + output.write(""" + <NOTICE> -- not found. + bpydata/config/ should be inside the user defined scripts dir. + It's used by Blender to store scripts configuration data. + (Since it is on the user defined dir, a new Blender installation + won't overwrite the data.) +""") missing_mods = [] # missing basic modules try: - from mod_blender import basic_modules - for m in basic_modules: - try: exec ("import %s" % m) - except: missing_mods.append(m) - - if missing_mods: - output.write("\n\n<WARNING>:\n\nSome expected modules were not found.\n") - output.write("Because of that some scripts bundled with Blender may not work.\n") - output.write("Please read the FAQ in the Readme.html file shipped with Blender\n") - output.write("for information about how to fix the problem.\n\n") - output.write("The missing modules:\n") - warnings += 1 - for m in missing_mods: - output.write('-> ' + m + '\n') - else: - output.write("\n\n- Modules: all basic ones were found.\n") - -except: - output.write("\n\n<WARNING>:\nCouldn't find mod_blender.py in scripts dir.") - output.write("\nBasic modules availability won't be tested.\n") - warnings += 1 - + from BPyBlender import basic_modules + for m in basic_modules: + try: exec ("import %s" % m) + except: missing_mods.append(m) + + if missing_mods: + outmsg = """ + +<WARNING>: + +Some expected modules were not found. +Because of that some scripts bundled with Blender may not work. +Please read the FAQ in the Readme.html file shipped with Blender +for information about how to fix the problem. +Missing modules:""" + output.write(outmsg) + warnings += 1 + for m in missing_mods: + output.write('-> ' + m + '\n') + else: + output.write("\n\n- Modules: all basic ones were found.\n") + +except ImportError: + output.write("\n\n<WARNING>:\n Couldn't find BPyBlender.py in scripts/bpymodules/ dir.") + output.write("\n Basic modules availability won't be tested.\n") + warnings += 1 output.write("\nOpenGL:\n======\n\n") -output.write("- Renderer: %s\n" % glGetString(GL_RENDERER)) -output.write("- Vendor: %s\n" % glGetString(GL_VENDOR)) -output.write("- Version: %s\n\n" % glGetString(GL_VERSION)) +output.write("- Renderer: %s\n" % glGetString(GL_RENDERER)) +output.write("- Vendor: %s\n" % glGetString(GL_VENDOR)) +output.write("- Version: %s\n\n" % glGetString(GL_VERSION)) output.write("- Extensions:\n\n") glext = glGetString(GL_EXTENSIONS) glext = textWrap(glext, 70) for l in glext: - output.write(l + "\n") + output.write(l + "\n") output.write("\n\n- Simplistic almost useless benchmark:\n\n") t = Blender.sys.time() nredraws = 10 for i in range(nredraws): - Blender.Redraw(-1) # redraw all windows -result = str(Blender.sys.time() - t) -output.write("Redrawing all areas %s times took %s seconds.\n" % (nredraws, result)) - -if (warnings): - output.write("\n(*) Found %d warning" % warnings) - if (warnings > 1): output.write("s") # (blush) - output.write(", documented in the text above.") + Blender.Redraw(-1) # redraw all windows +result = Blender.sys.time() - t +output.write("Redrawing all areas %s times took %.4f seconds.\n" % (nredraws, result)) + +if warnings or notices: + output.write("\n%s%s\n" % (warnings*"#", notices*".")) + if warnings: + output.write("\n(*) Found %d warning" % warnings) + if (warnings > 1): output.write("s") # (blush) + output.write(", documented in the text above.\n") + if notices: + output.write("\n(*) Found %d notice" % notices) + if (notices > 1): output.write("s") # (blush) + output.write(", documented in the text above.\n") + else: output.write("\n==\nNo problems were found (scroll up for details).") Blender.Window.WaitCursor(0) diff --git a/release/scripts/truespace_export.py b/release/scripts/truespace_export.py index d9cd0b1ad99..af9aa2a5a23 100644 --- a/release/scripts/truespace_export.py +++ b/release/scripts/truespace_export.py @@ -63,7 +63,7 @@ how to handle it. # | Read and write Caligari trueSpace File Format (*.cob) | # +---------------------------------------------------------+ -import Blender, mod_meshtools +import Blender, meshtools import struct, os, cStringIO, time # ============================== @@ -86,7 +86,7 @@ def write(filename): grou = generate_grou('Group ' + `objects.index(object)+1`) polh = generate_polh(objname, obj, mesh) - if mod_meshtools.has_vertex_colors(mesh): vcol = generate_vcol(mesh) + if meshtools.has_vertex_colors(mesh): vcol = generate_vcol(mesh) unit = generate_unit() mat1 = generate_mat1(mesh) @@ -94,7 +94,7 @@ def write(filename): write_chunk(file, "Grou", 0, 1, G, X, grou) write_chunk(file, "PolH", 0, 4, P, G, polh) - if mod_meshtools.has_vertex_colors(mesh) and vcol: + if meshtools.has_vertex_colors(mesh) and vcol: write_chunk(file, "VCol", 1, 0, V, P, vcol) write_chunk(file, "Unit", 0, 1, U, P, unit) write_chunk(file, "Mat1", 0, 5, M, P, mat1) @@ -109,7 +109,7 @@ def write(filename): end = time.clock() seconds = " in %.2f %s" % (end-start, "seconds") message = "Successfully exported " + os.path.basename(filename) + seconds - mod_meshtools.print_boxed(message) + meshtools.print_boxed(message) # ============================= # === Write COB File Header === @@ -163,7 +163,7 @@ def write_CurrentPosition(data, obj): def write_VertexList(data, mesh): data.write(struct.pack("<l", len(mesh.verts))) for i in range(len(mesh.verts)): - if not i%100 and mod_meshtools.show_progress: + if not i%100 and meshtools.show_progress: Blender.Window.DrawProgressBar(float(i)/len(mesh.verts), "Writing Verts") x, y, z = mesh.verts[i].co data.write(struct.pack("<fff", -y, x, z)) @@ -185,7 +185,7 @@ def write_UVCoordsList(data, mesh): uvcoords = {} uvidx = 0 for i in range(len(mesh.faces)): - if not i%100 and mod_meshtools.show_progress: + if not i%100 and meshtools.show_progress: Blender.Window.DrawProgressBar(float(i)/len(mesh.faces), "Writing UV Coords") numfaceverts = len(mesh.faces[i].v) for j in range(numfaceverts-1, -1, -1): # Reverse order @@ -206,7 +206,7 @@ def write_UVCoordsList(data, mesh): def write_FaceList(data, mesh, uvcoords): data.write(struct.pack("<l", len(mesh.faces))) for i in range(len(mesh.faces)): - if not i%100 and mod_meshtools.show_progress: + if not i%100 and meshtools.show_progress: Blender.Window.DrawProgressBar(float(i)/len(mesh.faces), "Writing Faces") numfaceverts = len(mesh.faces[i].v) data.write(struct.pack("<B", 0x10)) # Cull Back Faces Flag @@ -230,7 +230,7 @@ def generate_vcol(mesh): uniquecolors = {} unique_alpha = {} for i in range(len(mesh.faces)): - if not i%100 and mod_meshtools.show_progress: + if not i%100 and meshtools.show_progress: Blender.Window.DrawProgressBar(float(i)/len(mesh.faces), "Writing Vertex Colors") numfaceverts = len(mesh.faces[i].v) data.write(struct.pack("<ll", i, numfaceverts)) diff --git a/release/scripts/truespace_import.py b/release/scripts/truespace_import.py index d1bfd3ab6bf..40326612f3f 100644 --- a/release/scripts/truespace_import.py +++ b/release/scripts/truespace_import.py @@ -68,7 +68,7 @@ how to handle it. # | Read and write Caligari trueSpace File Format (*.cob) | # +---------------------------------------------------------+ -import Blender, mod_meshtools +import Blender, meshtools import struct, chunk, os, cStringIO, time # ======================= @@ -146,7 +146,7 @@ def read_LocalAxes(data): #print "% f % f % f" % row rotation_matrix.append(list(row)) #print - rotation_matrix = mod_meshtools.transpose(rotation_matrix) + rotation_matrix = meshtools.transpose(rotation_matrix) # === Read Current Position === def read_CurrentPosition(data): @@ -162,7 +162,7 @@ def read_VertexList(data): verts = [] numverts, = struct.unpack("<l", data.read(4)) for i in range(numverts): - if not i%100 and mod_meshtools.show_progress: + if not i%100 and meshtools.show_progress: Blender.Window.DrawProgressBar(float(i)/numverts, "Reading Verts") x, y, z = struct.unpack("<fff", data.read(12)) verts.append((y, -x, z)) @@ -173,7 +173,7 @@ def read_UVCoords(data): uvcoords = [] numuvcoords, = struct.unpack("<l", data.read(4)) for i in range(numuvcoords): - if not i%100 and mod_meshtools.show_progress: + if not i%100 and meshtools.show_progress: Blender.Window.DrawProgressBar(float(i)/numuvcoords, "Reading UV Coords") uv = struct.unpack("<ff", data.read(8)) uvcoords.append(uv) @@ -187,7 +187,7 @@ def read_FaceList(data, chunk): faces = [] ; facesuv = [] numfaces, = struct.unpack("<l", data.read(4)) for i in range(numfaces): - if not i%100 and mod_meshtools.show_progress: + if not i%100 and meshtools.show_progress: Blender.Window.DrawProgressBar(float(i)/numfaces, "Reading Faces") face_flags, numfaceverts = struct.unpack("<Bh", data.read(3)) @@ -231,13 +231,13 @@ def read(filename): break if cobchunk.chunkname == "PolH": verts, faces, objname, facesuv, uvcoords = read_polh(cobchunk) - mod_meshtools.create_mesh(verts, faces, objname, facesuv, uvcoords) + meshtools.create_mesh(verts, faces, objname, facesuv, uvcoords) ''' object = Blender.Object.GetSelected() obj = Blender.Object.Get(objname) obj.loc = location - obj.rot = mod_meshtools.mat2euler(rotation_matrix) + obj.rot = meshtools.mat2euler(rotation_matrix) obj.size = (transformation_matrix[0][0]/rotation_matrix[0][0], transformation_matrix[1][1]/rotation_matrix[1][1], transformation_matrix[2][2]/rotation_matrix[2][2]) @@ -251,7 +251,7 @@ def read(filename): end = time.clock() seconds = " in %.2f %s" % (end-start, "seconds") message = "Successfully imported " + os.path.basename(filename) + seconds - mod_meshtools.print_boxed(message) + meshtools.print_boxed(message) #print "objname :", objname #print "numverts:", len(verts) #print "numfaces:", len(faces) diff --git a/release/scripts/videoscape_export.py b/release/scripts/videoscape_export.py index 26bd7d08b01..37905239496 100644 --- a/release/scripts/videoscape_export.py +++ b/release/scripts/videoscape_export.py @@ -57,7 +57,7 @@ specular highlights to the vertex colors. # | Write Videoscape File Format (*.obj NOT WAVEFRONT OBJ) | # +---------------------------------------------------------+ -import Blender, mod_meshtools +import Blender, meshtools #import time # ===================================== @@ -73,10 +73,10 @@ def write(filename): mesh = Blender.NMesh.GetRaw(meshname) obj = Blender.Object.Get(objname) - if not mod_meshtools.has_vertex_colors(mesh): + if not meshtools.has_vertex_colors(mesh): message = "Please assign vertex colors before exporting.\n" message += objname + " object was not saved." - mod_meshtools.print_boxed(message) + meshtools.print_boxed(message) return vcols = average_vertexcolors(mesh) @@ -87,7 +87,7 @@ def write(filename): # === Write Vertex List & Vertex Colors === for i in range(len(mesh.verts)): - if not i%100 and mod_meshtools.show_progress: + if not i%100 and meshtools.show_progress: Blender.Window.DrawProgressBar(float(i)/len(mesh.verts), "Writing Verts") file.write("% f % f % f 0x" % tuple(mesh.verts[i].co)) for j in range(len(vcols[i])): @@ -96,7 +96,7 @@ def write(filename): # === Write Face List === for i in range(len(mesh.faces)): - if not i%100 and mod_meshtools.show_progress: + if not i%100 and meshtools.show_progress: Blender.Window.DrawProgressBar(float(i)/len(mesh.faces), "Writing Faces") file.write("%d " % len(mesh.faces[i].v)) # numfaceverts for j in range(len(mesh.faces[i].v)): @@ -108,7 +108,7 @@ def write(filename): #end = time.clock() #seconds = " in %.2f %s" % (end-start, "seconds") message = "Successfully exported " + Blender.sys.basename(filename)# + seconds - mod_meshtools.print_boxed(message) + meshtools.print_boxed(message) # =========================================== # === Vector Operations for Vertex Colors === @@ -122,7 +122,7 @@ vcolor_div = lambda u, s: [u[0]/s, u[1]/s, u[2]/s, u[3]/s] def average_vertexcolors(mesh, debug=0): vertexcolors = {} for i in range(len(mesh.faces)): # get all vcolors that share this vertex - if not i%100 and mod_meshtools.show_progress: Blender.Window.DrawProgressBar(float(i)/len(mesh.verts), "Finding Shared VColors") + if not i%100 and meshtools.show_progress: Blender.Window.DrawProgressBar(float(i)/len(mesh.verts), "Finding Shared VColors") for j in range(len(mesh.faces[i].v)): index = mesh.faces[i].v[j].index color = mesh.faces[i].col[j] @@ -131,7 +131,7 @@ def average_vertexcolors(mesh, debug=0): if debug: print 'before'; vcprint(vertexcolors) for i in range(len(vertexcolors)): # average them - if not i%100 and mod_meshtools.show_progress: Blender.Window.DrawProgressBar(float(i)/len(mesh.verts), "Averaging Vertex Colors") + if not i%100 and meshtools.show_progress: Blender.Window.DrawProgressBar(float(i)/len(mesh.verts), "Averaging Vertex Colors") vcolor = [0,0,0,0] # rgba for j in range(len(vertexcolors[i])): vcolor = vcolor_add(vcolor, vertexcolors[i][j]) @@ -147,7 +147,7 @@ def average_vertexcolors_slow_1(mesh, debug=0): vertexcolors = [] i = 0 for vertex in mesh.verts: - if not i%100 and mod_meshtools.show_progress: Blender.Window.DrawProgressBar(float(i)/len(mesh.verts), "Averaging Vertex Colors") + if not i%100 and meshtools.show_progress: Blender.Window.DrawProgressBar(float(i)/len(mesh.verts), "Averaging Vertex Colors") i += 1 vcolor = [0,0,0,0] # rgba shared = 0 @@ -169,7 +169,7 @@ def average_vertexcolors_slow_1(mesh, debug=0): def average_vertexcolors_slow_2(mesh, debug=0): vertexcolors = [] for i in range(len(mesh.verts)): - if not i%100 and mod_meshtools.show_progress: Blender.Window.DrawProgressBar(float(i)/len(mesh.verts), "Averaging Vertex Colors") + if not i%100 and meshtools.show_progress: Blender.Window.DrawProgressBar(float(i)/len(mesh.verts), "Averaging Vertex Colors") vcolor = [0,0,0,0] # rgba shared = 0 for j in range(len(mesh.faces)): @@ -189,7 +189,7 @@ def average_vertexcolors_slow_2(mesh, debug=0): def average_vertexcolors_slow_3(mesh, debug=0): vertexcolors = [] for i in range(len(mesh.verts)): - if not i%100 and mod_meshtools.show_progress: Blender.Window.DrawProgressBar(float(i)/len(mesh.verts), "Averaging Vertex Colors") + if not i%100 and meshtools.show_progress: Blender.Window.DrawProgressBar(float(i)/len(mesh.verts), "Averaging Vertex Colors") vcolor = [0,0,0,0] # rgba shared = 0 for j in range(len(mesh.faces)): diff --git a/release/scripts/wings_export.py b/release/scripts/wings_export.py index c35b141cc97..424ee2513d4 100644 --- a/release/scripts/wings_export.py +++ b/release/scripts/wings_export.py @@ -56,7 +56,7 @@ Notes:<br> # | Read and write Wings3D File Format (*.wings) | # +---------------------------------------------------------+ -import Blender, mod_meshtools +import Blender, meshtools import struct, time, sys, os, zlib, cStringIO # =============================================== @@ -74,7 +74,7 @@ def write_faces(data, mesh): numfaces = len(mesh.faces) data.write(struct.pack(">BL", 0x6C, numfaces)) #for i in range(numfaces): - # if not i%100 and mod_meshtools.show_progress: Blender.Window.DrawProgressBar(float(i)/numfaces, "Writing Faces") + # if not i%100 and meshtools.show_progress: Blender.Window.DrawProgressBar(float(i)/numfaces, "Writing Faces") # data.write("\x6A") data.write("\x6A" * numfaces) # same, but faster than the above loop data.write("\x6A") @@ -86,7 +86,7 @@ def write_verts(data, mesh): numverts = len(mesh.verts) data.write(struct.pack(">BL", 0x6C, numverts)) for i in range(numverts): - if not i%100 and mod_meshtools.show_progress: Blender.Window.DrawProgressBar(float(i)/numverts, "Writing Verts") + if not i%100 and meshtools.show_progress: Blender.Window.DrawProgressBar(float(i)/numverts, "Writing Verts") data.write(struct.pack(">BLBL", 0x6C, 1, 0x6D, 24)) #data.write("\x6c\x00\x00\x00\x01\x6D\x00\x00\x00\x30") x, y, z = mesh.verts[i].co @@ -104,9 +104,9 @@ def write_edges(data, mesh, edge_table): keys.sort() for key in keys: i = edge_table[key][6] - if not i%100 and mod_meshtools.show_progress: Blender.Window.DrawProgressBar(float(i)/numedges, "Writing Edges") + if not i%100 and meshtools.show_progress: Blender.Window.DrawProgressBar(float(i)/numedges, "Writing Edges") - if mod_meshtools.has_vertex_colors(mesh): + if meshtools.has_vertex_colors(mesh): r1, g1, b1 = edge_table[key][7] r2, g2, b2 = edge_table[key][8] data.write("\x6C\x00\x00\x00\x02") @@ -141,7 +141,7 @@ def write_mode(data, mesh): data.write("\x6A") data.write(struct.pack(">BL", 0x6C, 1)) write_chunkheader(data, 0x68, 0x02, "mode") - if mod_meshtools.has_vertex_colors(mesh): + if meshtools.has_vertex_colors(mesh): data.write(struct.pack(">BH6s", 0x64, 6, "vertex")) else: data.write(struct.pack(">BH8s", 0x64, 8, "material")) @@ -313,12 +313,12 @@ def write(filename): obj = Blender.Object.Get(objname) try: - edge_table = mod_meshtools.generate_edgetable(mesh) + edge_table = meshtools.generate_edgetable(mesh) except: edge_table = {} message = "Unable to generate\nEdge Table for mesh.\n" message += "Object name is: " + meshname - mod_meshtools.print_boxed(message) + meshtools.print_boxed(message) Blender.Draw.PupMenu("Wings Export error|Unable to generate Edge Table for mesh") return @@ -369,7 +369,7 @@ def write(filename): message += "faces : " + `len(mesh.faces)` + '\n' message += "edges : " + `len(edge_table)` + '\n' message += "verts : " + `len(mesh.verts)` + '\n' - mod_meshtools.print_boxed(message) + meshtools.print_boxed(message) def fs_callback(filename): if filename.find('.wings', -6) <= 0: filename += '.wings' diff --git a/release/scripts/wings_import.py b/release/scripts/wings_import.py index dc28e978aae..70f124b3bac 100644 --- a/release/scripts/wings_import.py +++ b/release/scripts/wings_import.py @@ -53,7 +53,7 @@ Notes:<br> # | Read and write Wings3D File Format (*.wings) | # +---------------------------------------------------------+ -import Blender, mod_meshtools +import Blender, meshtools import struct, time, sys, os, zlib, cStringIO # ============================================== @@ -107,7 +107,7 @@ def read_edges(data): misc, numedges = struct.unpack(">BL", data.read(5)) edge_table = {} # the winged-edge table for i in range(numedges): - if not i%100 and mod_meshtools.show_progress: Blender.Window.DrawProgressBar(float(i)/numedges, "Reading Edges") + if not i%100 and meshtools.show_progress: Blender.Window.DrawProgressBar(float(i)/numedges, "Reading Edges") misc, etype = struct.unpack(">BL", data.read(5)) if etype == 2: # Vertex Colors data.read(10) # or read_chunkheader(data) # "color" @@ -136,7 +136,7 @@ def read_edges(data): def read_faces(data): misc, numfaces = struct.unpack(">BL", data.read(5)) for i in range(numfaces): - if not i%100 and mod_meshtools.show_progress: Blender.Window.DrawProgressBar(float(i)/numfaces, "Reading Faces") + if not i%100 and meshtools.show_progress: Blender.Window.DrawProgressBar(float(i)/numfaces, "Reading Faces") if data.read(1) == '\x6C': # a material follows data.read(4) read_chunkheader(data) @@ -153,7 +153,7 @@ def read_verts(data): misc, numverts = struct.unpack(">BL", data.read(5)) verts = [] # a list of verts for i in range(numverts): - if not i%100 and mod_meshtools.show_progress: Blender.Window.DrawProgressBar(float(i)/numverts, "Reading Verts") + if not i%100 and meshtools.show_progress: Blender.Window.DrawProgressBar(float(i)/numverts, "Reading Verts") data.read(10) x, y, z = struct.unpack(">ddd", data.read(24)) # double precision verts.append((x, -z, y)) @@ -305,7 +305,7 @@ def read(filename): read_mode(data) faces = make_faces(edge_table) message += "%s %8s %8s %8s\n" % (objname.ljust(15), len(faces), len(edge_table), len(verts)) - mod_meshtools.create_mesh(verts, faces, objname) + meshtools.create_mesh(verts, faces, objname) material = data.read() #for i in material[0:6]: print "%02X" % ord(i), @@ -315,7 +315,7 @@ def read(filename): end = time.clock() seconds = "\nDone in %.2f %s" % (end-start, "seconds") message += seconds - mod_meshtools.print_boxed(message) + meshtools.print_boxed(message) def fs_callback(filename): read(filename) |