- tiny updates for better behavior, unix line endings, cvs Id tags;
- Updated DX7 exporter (thanks to author Ben Omari who's also working on a DX8 one);
- added sysinfo script;

Interface (scripts):

- changed behavior for which win is chosen for script guis:
    Now there's a smarter order, guis will use either:
    - Scripts win
    - Buttons win (if not a script from groups Wizards or Utils)
    - Text win
    - Closest bigger area
- Added a button to the scripts header so that it's faster to return to the buttons win (this can be made general), if that was the previous win used.
This commit is contained in:
Willian Padovani Germano 2004-06-10 03:27:46 +00:00
parent 7ff5c16a02
commit a6d077bae2
37 changed files with 400 additions and 87 deletions

@ -8,6 +8,8 @@ Submenu: 'Only mesh data...' mesh
Submenu: 'Animation(not armature yet)...' anim
Tip: 'Export to DirectX text file format format.'
"""
# $Id$
#
# DirectX.py version 1.0
# Copyright (C) 2003 Arben OMARI -- aromari@tin.it
#
@ -28,7 +30,6 @@ Tip: 'Export to DirectX text file format format.'
import Blender
from Blender import Types, Object, NMesh, Material
#import string
from math import *
@ -114,9 +115,6 @@ class xExport:
self.file.write("%s;\n" % (mat.spec))
self.file.write("%s; %s; %s;;\n" % (mat.specR, mat.specG, mat.specB))
self.file.write("0.0; 0.0; 0.0;;\n")
self.file.write("TextureFilename {\n")
self.file.write('none ;')
self.file.write("}\n")
self.file.write("}\n")
self.writeTextures(name, tex)
@ -198,18 +196,18 @@ class xExport:
coun += 1
if coun == numface:
if len(face.v) == 3:
self.file.write("3; %s; %s; %s;;\n" % (counter, counter + 1, counter + 2))
self.file.write("3; %s, %s, %s;;\n" % (counter, counter + 1, counter + 2))
counter += 3
else :
self.file.write("4; %s; %s; %s; %s;;\n" % (counter, counter + 1, counter + 2, counter + 3))
self.file.write("4; %s, %s, %s, %s;;\n" % (counter, counter + 1, counter + 2, counter + 3))
counter += 4
else:
if len(face.v) == 3:
self.file.write("3; %s; %s; %s;,\n" % (counter, counter + 1, counter + 2))
self.file.write("3; %s, %s, %s;,\n" % (counter, counter + 1, counter + 2))
counter += 3
else :
self.file.write("4; %s; %s; %s; %s;,\n" % (counter, counter + 1, counter + 2, counter + 3))
self.file.write("4; %s, %s, %s, %s;,\n" % (counter, counter + 1, counter + 2, counter + 3))
counter += 4
@ -280,14 +278,14 @@ class xExport:
counter += 1
if counter == numfaces:
if len(face.v) == 3:
self.file.write("3; %s; %s; %s;;\n" % (face[0].index, face[1].index, face[2].index))
self.file.write("3; %s, %s, %s;;\n" % (face[0].index, face[1].index, face[2].index))
elif len(face.v) == 4:
self.file.write("4; %s; %s; %s; %s;;\n" % (face[0].index, face[1].index, face[2].index, face[3].index))
self.file.write("4; %s, %s, %s, %s;;\n" % (face[0].index, face[1].index, face[2].index, face[3].index))
else:
if len(face.v) == 3:
self.file.write("3; %s; %s; %s;,\n" % (face[0].index, face[1].index, face[2].index))
self.file.write("3; %s, %s, %s;,\n" % (face[0].index, face[1].index, face[2].index))
elif len(face.v) == 4 :
self.file.write("4; %s; %s; %s; %s;,\n" % (face[0].index, face[1].index, face[2].index, face[3].index))
self.file.write("4; %s, %s, %s, %s;,\n" % (face[0].index, face[1].index, face[2].index, face[3].index))
self.file.write("}\n")
#***********************************************
#MESH TEXTURE COORDS
@ -298,6 +296,7 @@ class xExport:
#VERTICES NUMBER
mesh = name.data
numvert = 0
numfaces=len(obj.faces)
for face in mesh.faces:
numvert = numvert + len(face.v)
self.file.write("%s;\n" % (numvert))
@ -305,15 +304,26 @@ class xExport:
counter = -1
for face in mesh.faces:
counter += 1
if len(face.v) == 4:
self.file.write("%s;%s;,\n" % (mesh.faces[counter].uv[0][0], -mesh.faces[counter].uv[0][1]))
self.file.write("%s;%s;,\n" % (mesh.faces[counter].uv[1][0], -mesh.faces[counter].uv[1][1]))
self.file.write("%s;%s;,\n" % (mesh.faces[counter].uv[2][0], -mesh.faces[counter].uv[2][1]))
self.file.write("%s;%s;,\n" % (mesh.faces[counter].uv[3][0], -mesh.faces[counter].uv[3][1]))
elif len(face.v) == 3:
self.file.write("%s;%s;,\n" % (mesh.faces[counter].uv[0][0], -mesh.faces[counter].uv[0][1]))
self.file.write("%s;%s;,\n" % (mesh.faces[counter].uv[1][0], -mesh.faces[counter].uv[1][1]))
self.file.write("%s;%s;,\n" % (mesh.faces[counter].uv[2][0], -mesh.faces[counter].uv[2][1]))
if counter == numfaces - 1:
if len(face.v) == 4:
self.file.write("%s;%s;,\n" % (mesh.faces[counter].uv[0][0], -mesh.faces[counter].uv[0][1]))
self.file.write("%s;%s;,\n" % (mesh.faces[counter].uv[1][0], -mesh.faces[counter].uv[1][1]))
self.file.write("%s;%s;,\n" % (mesh.faces[counter].uv[2][0], -mesh.faces[counter].uv[2][1]))
self.file.write("%s;%s;;\n" % (mesh.faces[counter].uv[3][0], -mesh.faces[counter].uv[3][1]))
elif len(face.v) == 3:
self.file.write("%s;%s;,\n" % (mesh.faces[counter].uv[0][0], -mesh.faces[counter].uv[0][1]))
self.file.write("%s;%s;,\n" % (mesh.faces[counter].uv[1][0], -mesh.faces[counter].uv[1][1]))
self.file.write("%s;%s;;\n" % (mesh.faces[counter].uv[2][0], -mesh.faces[counter].uv[2][1]))
else :
if len(face.v) == 4:
self.file.write("%s;%s;,\n" % (mesh.faces[counter].uv[0][0], -mesh.faces[counter].uv[0][1]))
self.file.write("%s;%s;,\n" % (mesh.faces[counter].uv[1][0], -mesh.faces[counter].uv[1][1]))
self.file.write("%s;%s;,\n" % (mesh.faces[counter].uv[2][0], -mesh.faces[counter].uv[2][1]))
self.file.write("%s;%s;,\n" % (mesh.faces[counter].uv[3][0], -mesh.faces[counter].uv[3][1]))
elif len(face.v) == 3:
self.file.write("%s;%s;,\n" % (mesh.faces[counter].uv[0][0], -mesh.faces[counter].uv[0][1]))
self.file.write("%s;%s;,\n" % (mesh.faces[counter].uv[1][0], -mesh.faces[counter].uv[1][1]))
self.file.write("%s;%s;,\n" % (mesh.faces[counter].uv[2][0], -mesh.faces[counter].uv[2][1]))
self.file.write("}\n")

@ -5,7 +5,8 @@ Blender: 232
Group: 'UV'
Tip: 'Use vertex paint color value to fill uvmapping.'
"""
# $Id$
#
#----------------------------------------------
# uvpainter script (c) 04/2004 jean-michel soler
# http://jmsoler.free.fr/util/blenderfile/py/UVpaint05.zip

@ -10,6 +10,8 @@ Submenu: 'Configure +' config
Tip: 'Export to AC3D (.ac) format.'
"""
# $Id$
#
# --------------------------------------------------------------------------
# AC3DExport version 2.32-1 Jan 21, 2004
# Program versions: Blender 2.32+ and AC3Db files (means version 0xb)
@ -62,7 +64,7 @@ def update_RegistryInfo():
d['ADD_DEFAULT_MAT'] = ADD_DEFAULT_MAT
Blender.Registry.SetKey('AC3DExport', d)
# The default material to be used when necessary (see right above)
# The default material to be used when necessary (see ADD_DEFAULT_MAT)
DEFAULT_MAT = \
'MATERIAL "DefaultWhite" rgb 1 1 1 amb 1 1 1 emis 0 0 0 spec 0.5 0.5 0.5 shi 64 trans 0'
@ -329,23 +331,19 @@ def gui():
BGL.glClearColor(0.6,0.6,0.9,1)
BGL.glClear(BGL.GL_COLOR_BUFFER_BIT)
BGL.glColor3f(1,1,1)
BGL.glRasterPos2i(20, 270)
Draw.Text("AC3D Exporter")
BGL.glRasterPos2i(30, 250)
BGL.glRasterPos2i(18, 150)
Draw.Text("AC3D is a simple, affordable commercial 3d modeller that can be found at www.ac3d.org .")
BGL.glRasterPos2i(30, 230)
BGL.glRasterPos2i(18, 130)
Draw.Text("It uses a nice text file format (extension .ac) which supports uv-textured meshes")
BGL.glRasterPos2i(30, 210)
BGL.glRasterPos2i(18, 110)
Draw.Text("with parenting (grouping) information.")
BGL.glRasterPos2i(30, 190)
BGL.glRasterPos2i(18, 90)
Draw.Text("Notes: AC3D has a 'data' token that assigns a string to each mesh, useful for games,")
BGL.glRasterPos2i(67, 170)
BGL.glRasterPos2i(55, 70)
Draw.Text("for example. You can use Blender's mesh datablock name for that.")
BGL.glRasterPos2i(67, 150)
Draw.Text("The .ac format is well supported by the PLib 3d gaming library. You can use this")
BGL.glRasterPos2i(67, 130)
Draw.Text("exporter to have your Blender models in games and other apps written with PLib.")
Draw.Button("Ok", 21, 285, 80, 100, 40, "Click to return to previous screen.")
BGL.glRasterPos2i(55, 50)
Draw.Text("The .ac format is well supported by the PLib 3d gaming library.")
Draw.Button("Ok", 21, 285, 10, 45, 20, "Click to return to previous screen.")
else:
BGL.glClearColor(0,0,1,1)
BGL.glClear(BGL.GL_COLOR_BUFFER_BIT)

@ -6,7 +6,8 @@ Blender: 232
Group: 'Import'
Tip: 'Import an AC3D (.ac) file.'
"""
# $Id$
#
# --------------------------------------------------------------------------
# AC3DImport version 2.32-1 Jan 21, 2004
# Program versions: Blender 2.32+ and AC3Db files (means version 0xb)

@ -6,7 +6,8 @@ Blender: 232
Group: 'Export'
Tip: 'Export armature/bone data to the Cal3D library.'
"""
# $Id$
#
# blender2cal3D.py version 0.5
# Copyright (C) 2003 Jean-Baptiste LAMY -- jiba@tuxfamily.org
#

@ -6,6 +6,9 @@ Blender: 232
Group: 'Export'
Tip: 'Export a (*.bvh) motion capture file'
"""
# $Id$
#
#===============================================#
# BVH Export script 1.0 by Campbell Barton #
# Copyright MetaVR 30/03/2004, #
@ -381,4 +384,4 @@ def saveBVH(filename):
file.close()
print 'done'
Blender.Window.FileSelector(saveBVH, 'SELECT NEW BVH FILE')
Blender.Window.FileSelector(saveBVH, 'SELECT NEW BVH FILE')

@ -7,6 +7,8 @@ Group: 'Import'
Tip: 'Import a (*.bvh) motion capture file'
"""
# $Id$
#
#===============================================#
# BVH Import script 1.0 by Campbell Barton #
# 25/03/2004, euler rotation code taken from #
@ -439,4 +441,4 @@ def loadBVH(filename):
# Main file loop
lineIdx += 1
Blender.Window.FileSelector(loadBVH)
Blender.Window.FileSelector(loadBVH)

@ -7,6 +7,8 @@ Group: 'Modifiers'
Tip: 'use vertex paint color value to modify shape displacing vertices along normal.'
"""
# $Id$
#
#----------------------------------------------
# jm soler, displacement paint 03/2002 - > 05/2004: disp_paintf
#----------------------------------------------

@ -6,7 +6,8 @@ Blender: 232
Group: 'Generators'
Tip: 'Fix armature deformation.'
"""
# $Id$
#
#----------------------------------------------
# jm soler 05/2004 : 'FixfromArmature'
#----------------------------------------------

@ -7,6 +7,8 @@ Group: 'Export'
Tooltip: 'Export selected meshes to LightWave File Format (*.lwo)'
"""
# $Id$
#
# +---------------------------------------------------------+
# | Copyright (c) 2002 Anthony D'Agostino |
# | http://www.redrival.com/scorpius |

@ -7,6 +7,8 @@ Group: 'Import'
Tooltip: 'Import LightWave Object File Format (*.lwo)'
"""
# $Id$
#
# +---------------------------------------------------------+
# | Copyright (c) 2002 Anthony D'Agostino |
# | http://www.redrival.com/scorpius |

@ -0,0 +1,39 @@
# $Id$
#
# --------------------------------------------------------------------------
# mod_blender.py version 0.1 Jun 09, 2004
# --------------------------------------------------------------------------
# helper functions to be used by other scripts
# --------------------------------------------------------------------------
# ***** BEGIN GPL LICENSE BLOCK *****
#
# Copyright (C) 2004: Willian P. Germano, wgermano _at_ ig.com.br
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# ***** END GPL LICENCE BLOCK *****
# --------------------------------------------------------------------------
# Basic set of modules Blender should have in all supported platforms:
# XXX still incomplete
basic_modules = [
'Blender',
'sys',
'os',
'math',
'chunk',
'gzip',
'string'
]

@ -1,3 +1,5 @@
# $Id$
#
# +---------------------------------------------------------+
# | Copyright (c) 2001 Anthony D'Agostino |
# | http://www.redrival.com/scorpius |

@ -7,6 +7,8 @@ Group: 'Export'
Tooltip: 'Export selected mesh to Nendo File Format (*.ndo)'
"""
# $Id$
#
# +---------------------------------------------------------+
# | Copyright (c) 2001 Anthony D'Agostino |
# | http://www.redrival.com/scorpius |

@ -7,6 +7,8 @@ Group: 'Import'
Tooltip: 'Import Nendo Object File Format (*.ndo)'
"""
# $Id$
#
# +---------------------------------------------------------+
# | Copyright (c) 2001 Anthony D'Agostino |
# | http://www.redrival.com/scorpius |

@ -7,6 +7,8 @@ Group: 'Export'
Tooltip: 'Save a Wavefront OBJ File'
"""
# $Id$
#
# --------------------------------------------------------------------------
# OBJ Export v0.9 by Campbell Barton (AKA Ideasman)
# --------------------------------------------------------------------------

@ -7,6 +7,8 @@ Group: 'Import'
Tooltip: 'Load a Wavefront OBJ File'
"""
# $Id$
#
# --------------------------------------------------------------------------
# OBJ Import v0.9 by Campbell Barton (AKA Ideasman)
# --------------------------------------------------------------------------

@ -7,6 +7,8 @@ Group: 'Export'
Tooltip: 'Export selected mesh (with vertex colors) to Radiosity File Format (*.radio)'
"""
# $Id$
#
# +---------------------------------------------------------+
# | Copyright (c) 2002 Anthony D'Agostino |
# | http://www.redrival.com/scorpius |

@ -7,6 +7,8 @@ Group: 'Import'
Tooltip: 'Import Radiosity File Format (*.radio) with vertex colors'
"""
# $Id$
#
# +---------------------------------------------------------+
# | Copyright (c) 2002 Anthony D'Agostino |
# | http://www.redrival.com/scorpius |

@ -7,6 +7,8 @@ Group: 'Export'
Tooltip: 'Export selected mesh to Raw Triangle Format (*.raw)'
"""
# $Id$
#
# +---------------------------------------------------------+
# | Copyright (c) 2002 Anthony D'Agostino |
# | http://www.redrival.com/scorpius |

@ -7,6 +7,8 @@ Group: 'Import'
Tooltip: 'Import Raw Triangle File Format (*.raw)'
"""
# $Id$
#
# +---------------------------------------------------------+
# | Copyright (c) 2002 Anthony D'Agostino |
# | http://www.redrival.com/scorpius |

@ -7,6 +7,8 @@ Group: 'Animation'
Tip: 'Copy deform data (not surf. subdiv) of active obj to rvk of the 2nd selected obj.'
"""
# $Id$
#
#----------------------------------------------
# jm soler (c) 05/2004 : 'Rvk1toRvk2' release under blender artistic licence
#----------------------------------------------

@ -7,6 +7,8 @@ Group: 'Import'
Tooltip: 'Import SLP (Pro Engineer) File Format (*.raw)'
"""
# $Id$
#
# +---------------------------------------------------------+
# | Copyright (c) 2004 Anthony D'Agostino |
# | http://www.redrival.com/scorpius |

148
release/scripts/sysinfo.py Normal file

@ -0,0 +1,148 @@
#!BPY
"""
Name: 'System Info'
Blender: 233
Group: 'Utils'
Tooltip: 'Information about your Blender environment, useful to diagnose problems.'
"""
# $Id$
#
# --------------------------------------------------------------------------
# sysinfo.py version 0.1 Jun 09, 2004
# --------------------------------------------------------------------------
# ***** BEGIN GPL LICENSE BLOCK *****
#
# Copyright (C) 2004: Willian P. Germano, wgermano _at_ ig.com.br
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# ***** END GPL LICENCE BLOCK *****
# --------------------------------------------------------------------------
import Blender
from Blender.BGL import *
import sys
# has_textwrap = 1 # see commented code below
output_filename = "system-info.txt"
warnings = 0
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
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
## Better use our own text wrap functions here
#try:
# import textwrap
#except:
# has_textwrap = 0
# 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")
lilies = len(header)*"="+"\n"
header = lilies + header + "\n" + lilies
output = Blender.Text.New(output_filename)
output.write(header + "\n\n")
output.write("Platform: %s\n========\n\n" % sys.platform)
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("\n- Default folder for registered scripts:\n\n")
scriptsdir = Blender.Get("datadir")
if scriptsdir:
scriptsdir = scriptsdir.replace("/bpydata","/scripts")
output.write(scriptsdir)
else:
output.write("<WARNING> -- not found")
warnings += 1
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
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("- Extensions:\n\n")
glext = glGetString(GL_EXTENSIONS)
glext = textWrap(glext, 70)
for l in glext:
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.")
else: output.write("\n==\nNo problems were found.")
exitmsg = "Done!|Please check the text %s at the Text Editor window." % output.name
Blender.Draw.PupMenu(exitmsg)

@ -7,6 +7,8 @@ Group: 'Export'
Tooltip: 'Export selected meshes to trueSpace File Format (*.cob)'
"""
# $Id$
#
# +---------------------------------------------------------+
# | Copyright (c) 2001 Anthony D'Agostino |
# | http://www.redrival.com/scorpius |

@ -7,6 +7,8 @@ Group: 'Import'
Tooltip: 'Import trueSpace Object File Format (*.cob)'
"""
# $Id$
#
# +---------------------------------------------------------+
# | Copyright (c) 2001 Anthony D'Agostino |
# | http://www.redrival.com/scorpius |

@ -6,6 +6,8 @@ Group: 'Modifiers'
Tip: 'unweld all faces from one selected and commun vertex. Made vertex bevelling'
"""
# $Id$
#
# ------------------------------------------
# Un-Weld script 0.4.4 beta
#

@ -7,6 +7,8 @@ Group: 'UV'
Tooltip: 'Export the UV face layout of the selected object to a .TGA file'
"""
# $Id$
#
# --------------------------------------------------------------------------
# ***** BEGIN GPL LICENSE BLOCK *****
#

@ -7,6 +7,8 @@ Group: 'Export'
Tooltip: 'Export selected mesh to VideoScape File Format (*.obj)'
"""
# $Id$
#
# +---------------------------------------------------------+
# | Copyright (c) 2001 Anthony D'Agostino |
# | http://www.redrival.com/scorpius |

@ -7,6 +7,8 @@ Group: 'Export'
Tooltip: 'Export selected mesh to Wings3D File Format (*.wings)'
"""
# $Id$
#
# +---------------------------------------------------------+
# | Copyright (c) 2002 Anthony D'Agostino |
# | http://www.redrival.com/scorpius |
@ -268,6 +270,7 @@ def write(filename):
start = time.clock()
objects = Blender.Object.GetSelected()
objname = objects[0].name
meshname = objects[0].data.name
mesh = Blender.NMesh.GetRaw(meshname)
@ -280,28 +283,30 @@ def write(filename):
message = "Unable to generate\nEdge Table for mesh.\n"
message += "Object name is: " + meshname
mod_meshtools.print_boxed(message)
#return
Blender.Draw.PupMenu("Wings Export error|Unable to generate Edge Table for mesh")
return
if 0:
import Tkinter, tkMessageBox
sys.argv=['wings.pyo','wings.pyc'] # ?
#Tkinter.NoDefaultRoot()
win1 = Tkinter.Tk()
ans = tkMessageBox.showerror("Error", message)
win1.pack()
print ans
if ans:
win1.quit()
win1.mainloop()
else:
from Tkinter import Label
sys.argv = 'wings.py'
widget = Label(None, text=message)
#widget.title("Error")
widget.pack()
widget.mainloop()
# if 0:
# import Tkinter, tkMessageBox
# sys.argv=['wings.pyo','wings.pyc'] # ?
#
# #Tkinter.NoDefaultRoot()
# win1 = Tkinter.Tk()
# ans = tkMessageBox.showerror("Error", message)
# win1.pack()
# print ans
# if ans:
# win1.quit()
# win1.mainloop()
#
# else:
# from Tkinter import Label
# sys.argv = 'wings.py'
# widget = Label(None, text=message)
# #widget.title("Error")
# widget.pack()
# widget.mainloop()
data = generate_data(objname, edge_table, mesh)
dsize = len(data)
@ -334,4 +339,8 @@ def fs_callback(filename):
if filename.find('.wings', -6) <= 0: filename += '.wings'
write(filename)
Blender.Window.FileSelector(fs_callback, "Wings3D Export")
if Blender.Object.GetSelected()[0].getType() != "Mesh":
Blender.Draw.PupMenu("Wings Export error|Selected object is not a mesh!")
else:
Blender.Window.FileSelector(fs_callback, "Wings3D Export")

@ -7,6 +7,8 @@ Group: 'Import'
Tooltip: 'Import Wings3D File Format (*.wings)'
"""
# $Id$
#
# +---------------------------------------------------------+
# | Copyright (c) 2002 Anthony D'Agostino |
# | http://www.redrival.com/scorpius |

@ -7,13 +7,14 @@ Submenu: 'All objects...' all
Submenu: 'Only selected objects...' selected
Tooltip: 'Export to VRML2 (.wrl) file.'
"""
# $Id$
#
#------------------------------------------------------------------------
# VRML2 exporter for blender 2.28a or above
#
# Source: http://blender.kimballsoftware.com/
#
# $Id$
#
# Authors: Rick Kimball with much inspiration
# from the forum at www.elysiun.com
# and irc://irc.freenode.net/blenderchat

@ -35,7 +35,7 @@ world-wide community.</p>
distribution. It's open-source software, released under a dual GPL / BL
licence. The full program sources are available online.</p>
<p>For impatient readers; here the two most important links:</p>
<p>For impatient readers, here the two most important links:</p>
<a href="http://www.blender.org">www.blender.org</a> the developement/community website<br>
<a href="http://www.blender3d.org">www.blender3d.org</a> the general website<br>
@ -97,7 +97,10 @@ Some downloaded scripts may require extra Python modules not shipped with
Blender. Installing the whole Python distribution is a way to solve this
issue for most cases except scripts that require extensions (3rd party
modules), but we are starting to add more modules to Blender itself so that
most scripts don't depend on full Python installs anymore.</p>
most scripts don't depend on full Python installs anymore. This is mostly
about Windows, in other platforms Python is usually a standard component
nowadays, so unless there's a version mismatch or an incomplete py
installation, there should be no problems.</p>
<p>Even if you do have the right version of Python installed you may need to
tell the embedded Python interpreter where the installation is. To do that
@ -279,11 +282,15 @@ YafRay and many goodies: sample .blend files with models, textures and
animations, plugins, scripts, documentation, etc. It's an extensive reference
written by Blender gurus and also a good way to help Blender development.</p>
<p><strong>New</strong>: the new guide's text is now available for download
online and the second edition of the printed book has also been released.</p>
<p>You can learn more about it at the main Blender site:
<a href="http://www.blender3d.org">www.blender3d.org</a>. There you'll also
find news, online documentation like tutorials, the 2.0 guide, the Blender
Python API Reference for script writers, etc. There are also forums,
galleries of images and movies, games, scripts, plugins, links and more.</p>
Python API Reference for script writers, docs for the newest features added
to the program, etc. There are also forums, galleries of images and movies,
games, scripts, plugins, links for many resources and more.</p>
<p>The main Blender community site is elYsiun:
<a href="http://www.elysiun.com">www.elysiun.com</a>. There's a lot of
@ -313,12 +320,14 @@ and should be updated on future versions of this text.</p>
<dl>
<dt><a href="http://www.gimp.org">The Gimp</a></dt>
<dd>The mighty GNU Image Manipulation Program. In 3d work it is a valuable
resource to create, convert and, of course, manipulate texture images.</dd>
resource to create, convert and, of course, manipulate texture images.
It is also useful for work with rendered pictures, for example to add 2d text,
logos or to touch-up, apply factory or hand-made effects and compose with other
images.</dd>
<dt><a href="http://www.wings3d.com">The Wings 3D modeler</a></dt>
<dd>A great mesh modeler, with a different approach. Some things are much
easier to model in Wings, others in Blender, making them a powerful combination
for experienced users.
</dd>
for experienced users.</dd>
</dl>
<h4>Renderers:</h4>
@ -402,6 +411,9 @@ usually the Python &amp; Plugins forum at
announcements, questions, suggestions and bug reports related to scripts. It's
the recommended place to look first, specially if no site was specified at the
script's window or source file(s).</p>
<p>If some or all scripts that should appear in menus are not there, running
Blender in <a href="#trouble_gen">debug mode </a> can possibly inform what is
wrong. Make sure the reported dir(s) really exist.</p>
<h3><a name="trouble_bugt">The Bug Tracker</a></h3>
@ -430,6 +442,12 @@ make sure the scene has a camera pointing at your models (camera view is
NumPad 0) and at least one light properly placed. Otherwise you'll only get a
black rectangle.</p>
<p>Setting texture map input to "uv" in the Material Buttons window is not enough
to assign a texture image and uv data to a mesh. It's necessary to select the mesh,
enter face select mode (modes can be accessed in the 3d view's header), load an
image in the UV/Image Editor window and then define the mapping. Only then
the mesh will have uv data available for exporting.</p>
<p>If you want the fastest possible access to Blender's functionality, remember
what a <cite>wise power user</cite> wrote: "keep one hand on the keyboard
and the other on the mouse". Learn and use the shortcuts, configure your
@ -498,7 +516,7 @@ as "newbie-friendly". It doesn't come packed with "one-click" or "wizard"
functionality, where you get much faster results in detriment of flexibility
and value. It also isn't bundled with tens of megabytes of sample models,
texture images, tutorials, etc. (which only partly explains how Blender can fit
in a less than 3 MB download).</p>
in a less than 4 MB download).</p>
<p>Thankfully, these are not fatal shortcomings. The pace at which features
are being added or polished in Blender is impressive, now that it's a well
@ -534,7 +552,7 @@ should not be sent to Blender developers or its bug tracker. Then
<hr>
<p>Thanks for reading, we hope you enjoy Blender!</p>
<p><font size=-1>Document version 1.0, april 2004</font></p>
<p><font size=-1>Document version 1.01, June 2004</font></p>
<p align="right"><a href="#top">back to top</a></p>

@ -342,6 +342,7 @@
/* SCRIPT: 525 */
#define B_SCRIPTBROWSE 526
#define B_SCRIPT2BUTS 527
/* FILE: 550 */
#define B_SORTFILELIST 551

@ -42,7 +42,8 @@
#include <MEM_guardedalloc.h>
#include <BLI_blenlib.h> /* for BLI_last_slash() */
#include <BIF_interface.h> /* for pupmenu */
#include <BDR_editobject.h> /* for exit_editmode() */
#include <BIF_interface.h> /* for pupmenu() */
#include <BIF_space.h>
#include <BIF_screen.h>
#include <BIF_toolbox.h>
@ -273,10 +274,26 @@ void init_syspath(void)
/*****************************************************************************/
void BPY_post_start_python(void)
{
PyObject *result, *dict;
if (U.pythondir && U.pythondir[0] != '\0')
syspath_append(U.pythondir); /* append to module search path */
BPyMenu_Init(0); /* get dynamic menus (registered scripts) data */
dict = PyDict_New();
/* here we check if the user has (some of) the expected modules */
if (dict) {
char *s = "import chunk, gzip, math, os, struct, string";
result = PyRun_String(s, Py_eval_input, dict, dict);
if (!result) {
PyErr_Clear();
/*XXX print msg about this, point to readme.html */
}
else Py_DECREF(result);
Py_DECREF(dict);
}
}
/*****************************************************************************/
@ -425,6 +442,10 @@ int BPY_txt_do_python_Text(struct Text* text)
return 0;
}
/* if in it, leave editmode, since changes a script makes to meshdata
* can be lost otherwise. */
if (G.obedit) exit_editmode(1);
script->id.us = 1;
script->flags = SCRIPT_RUNNING;
script->py_draw = NULL;
@ -586,6 +607,30 @@ int BPY_menu_do_python(short menutype, int event)
return 0;
}
/* if in editmode, leave it, since changes a script makes to meshdata
* can be lost otherwise. */
if (G.obedit) exit_editmode(1);
/* let's find a proper area for an eventual script gui:
* preference in order: Script, Buttons (if not a Wizards or Utils script),
* Text, any closest bigger area */
if (curarea->spacetype != SPACE_SCRIPT) {
ScrArea *sa;
sa = find_biggest_area_of_type(SPACE_SCRIPT);
if (!sa) {
if ((menutype != PYMENU_WIZARDS) && (menutype != PYMENU_UTILS))
sa = find_biggest_area_of_type(SPACE_BUTS);
}
if (!sa) sa = find_biggest_area_of_type(SPACE_TEXT);
if (!sa) sa = closest_bigger_area();
areawinset(sa->win);
}
script->id.us = 1;
script->flags = SCRIPT_RUNNING;
script->py_draw = NULL;

@ -673,13 +673,6 @@ static uiBlock *info_runtime_optionsmenu(void *arg_unused)
static void do_info_file_importmenu(void *arg, int event)
{
extern int BPY_menu_do_python(short menutype, int event); // BPY_interface.c
ScrArea *sa;
if(curarea->spacetype==SPACE_INFO) {
sa= find_biggest_area_of_type(SPACE_SCRIPT);
if (!sa) sa= closest_bigger_area();
areawinset(sa->win);
}
BPY_menu_do_python(PYMENU_IMPORT, event);
@ -710,13 +703,6 @@ static uiBlock *info_file_importmenu(void *arg_unused)
static void do_info_file_exportmenu(void *arg, int event)
{
extern int BPY_menu_do_python(short menutype, int event); // BPY_interface.c
ScrArea *sa;
if(curarea->spacetype==SPACE_INFO) {
sa= find_biggest_area_of_type(SPACE_SCRIPT);
if (!sa) sa= closest_bigger_area();
areawinset(sa->win);
}
/* events >=3 are registered bpython scripts */
if (event >= 3) BPY_menu_do_python(PYMENU_EXPORT, event - 3);

@ -202,6 +202,9 @@ void do_script_buttons(unsigned short event)
allqueue(REDRAWHEADERS, 0);
}
break;
case B_SCRIPT2BUTS:
newspace(curarea, SPACE_BUTS);
break;
}
return;
@ -267,6 +270,12 @@ void script_buttons(void)
xco += 2*XIC;
xco= std_libbuttons(block, xco, 0, 0, NULL, B_SCRIPTBROWSE, (ID*)sc->script, 0, &(sc->menunr), 0, 0, 0, 0, 0);
if (sc->script && sc->script->lastspace == SPACE_BUTS) {
xco += 10;
uiDefIconBut(block, BUT, B_SCRIPT2BUTS, ICON_BUTS, xco+=XIC, 0, XIC, YIC,
0, 0, 0, 0, 0, "Returns to Buttons Window");
}
/* always as last */
curarea->headbutlen= xco+2*XIC;