* Edited and consistent-ified the File->Import menu item labels and fileselect button labels, as discussed on the forums.

* Added items for importing DXF, VRML, etc. in the File->Import menu, that just call the normal Open function. Most people don't even know that you can open these formats through the normal Open fileselect, so this will make it more obvious.

* Removed the 'Export Selected' menu, and put poor old lonely STL in the Import and Export menus too. Most of the exporters export only the selected object anyway, so it's not really a necessary distinction to make.
This commit is contained in:
Matt Ebb 2004-06-11 02:12:37 +00:00
parent a23c6a71da
commit d34f89b755
26 changed files with 122 additions and 116 deletions

@ -1,11 +1,11 @@
#!BPY
""" Registration info for Blender menus:
Name: 'DirectX'
Name: 'DirectX (.X)...'
Blender: 232
Group: 'Export'
Submenu: 'Only mesh data...' mesh
Submenu: 'Animation(not armature yet)...' anim
Submenu: 'Only Mesh Data...' mesh
Submenu: 'Animation (not armature yet)...' anim
Tip: 'Export to DirectX text file format format.'
"""
# $Id$

@ -1,7 +1,7 @@
#!BPY
""" Registration info for Blender menus:
Name: 'AC3D'
Name: 'AC3D (.ac)...'
Blender: 232
Group: 'Export'
Submenu: 'All meshes...' all
@ -420,4 +420,4 @@ def fs_callback(filename):
if __script__['arg'] == 'config':
Draw.Register(gui, event, b_event)
else:
Blender.Window.FileSelector(fs_callback, "AC3D Export")
Blender.Window.FileSelector(fs_callback, "Export AC3D")

@ -1,7 +1,7 @@
#!BPY
""" Registration info for Blender menus:
Name: 'AC3D...'
Name: 'AC3D (.ac)...'
Blender: 232
Group: 'Import'
Tip: 'Import an AC3D (.ac) file.'

@ -1,7 +1,7 @@
#!BPY
"""
Name: 'Cal3D v0.5'
Name: 'Cal3D v0.5...'
Blender: 232
Group: 'Export'
Tip: 'Export armature/bone data to the Cal3D library.'

@ -1,10 +1,10 @@
#!BPY
"""
Name: 'Motion Capture (*.bvh)'
Name: 'Motion Capture (.bvh)...'
Blender: 232
Group: 'Export'
Tip: 'Export a (*.bvh) motion capture file'
Tip: 'Export a (.bvh) motion capture file'
"""
# $Id$
@ -386,4 +386,4 @@ def saveBVH(filename):
file.close()
print 'done'
Blender.Window.FileSelector(saveBVH, 'SELECT NEW BVH FILE')
Blender.Window.FileSelector(saveBVH, 'Export BVH')

@ -1,10 +1,10 @@
#!BPY
"""
Name: 'Motion Capture (*.bvh)'
Name: 'Motion Capture (.bvh)...'
Blender: 232
Group: 'Import'
Tip: 'Import a (*.bvh) motion capture file'
Tip: 'Import a (.bvh) motion capture file'
"""
# $Id$
@ -441,4 +441,4 @@ def loadBVH(filename):
# Main file loop
lineIdx += 1
Blender.Window.FileSelector(loadBVH)
Blender.Window.FileSelector(loadBVH, "Import BVH")

@ -1,10 +1,10 @@
#!BPY
"""
Name: 'LightWave...'
Name: 'LightWave (.lwo)...'
Blender: 232
Group: 'Export'
Tooltip: 'Export selected meshes to LightWave File Format (*.lwo)'
Tooltip: 'Export selected meshes to LightWave File Format (.lwo)'
"""
# $Id$
@ -527,4 +527,4 @@ def fs_callback(filename):
if filename.find('.lwo', -4) <= 0: filename += '.lwo'
write(filename)
Blender.Window.FileSelector(fs_callback, "LWO Export")
Blender.Window.FileSelector(fs_callback, "Export LWO")

@ -1,10 +1,10 @@
#!BPY
"""
Name: 'LightWave...'
Name: 'LightWave (.lwo)...'
Blender: 232
Group: 'Import'
Tooltip: 'Import LightWave Object File Format (*.lwo)'
Tooltip: 'Import LightWave Object File Format (.lwo)'
"""
# $Id$
@ -171,4 +171,4 @@ def read_faces_6(lwochunk):
def fs_callback(filename):
read(filename)
Blender.Window.FileSelector(fs_callback, "LWO Import")
Blender.Window.FileSelector(fs_callback, "Import LWO")

@ -1,7 +1,7 @@
#!BPY
"""
Name: 'Nendo...'
Name: 'Nendo (.ndo)...'
Blender: 232
Group: 'Export'
Tooltip: 'Export selected mesh to Nendo File Format (*.ndo)'
@ -182,4 +182,4 @@ def fs_callback(filename):
if filename.find('.ndo', -4) <= 0: filename += '.ndo'
write(filename)
Blender.Window.FileSelector(fs_callback, "Nendo Export")
Blender.Window.FileSelector(fs_callback, "Export Nendo")

@ -1,10 +1,10 @@
#!BPY
"""
Name: 'Nendo...'
Name: 'Nendo (.ndo)...'
Blender: 232
Group: 'Import'
Tooltip: 'Import Nendo Object File Format (*.ndo)'
Tooltip: 'Import Nendo Object File Format (.ndo)'
"""
# $Id$
@ -204,4 +204,4 @@ def make_faces(edge_table): # For Nendo
def fs_callback(filename):
read(filename)
Blender.Window.FileSelector(fs_callback, "Nendo Import")
Blender.Window.FileSelector(fs_callback, "Import Nendo")

@ -1,7 +1,7 @@
#!BPY
"""
Name: 'Wavefront (*.obj)'
Name: 'Wavefront (.obj)...'
Blender: 232
Group: 'Export'
Tooltip: 'Save a Wavefront OBJ File'
@ -144,4 +144,4 @@ def save_obj(filename):
file.close()
Window.FileSelector(save_obj, 'SELECT OBJ FILE')
Window.FileSelector(save_obj, 'Export OBJ')

@ -1,7 +1,7 @@
#!BPY
"""
Name: 'Wavefront (*.obj)'
Name: 'Wavefront (.obj)...'
Blender: 232
Group: 'Import'
Tooltip: 'Load a Wavefront OBJ File'
@ -244,4 +244,4 @@ def load_obj(file):
if len(mesh.verts) > 0:
NMesh.PutRaw(mesh, fileName + '_' + objectName)
Window.FileSelector(load_obj, 'SELECT OBJ FILE')
Window.FileSelector(load_obj, 'Import OBJ')

@ -1,7 +1,7 @@
#!BPY
"""
Name: 'OFF...'
Name: 'Object File Format (.off)...'
Blender: 232
Group: 'Export'
Tooltip: 'Export selected mesh to Object File Format (*.off)'
@ -68,4 +68,4 @@ def fs_callback(filename):
if filename.find('.off', -4) <= 0: filename += '.off'
write(filename)
Blender.Window.FileSelector(fs_callback, "OFF Export")
Blender.Window.FileSelector(fs_callback, "Export OFF")

@ -1,7 +1,7 @@
#!BPY
"""
Name: 'OFF...'
Name: 'Object File Format (.off)...'
Blender: 232
Group: 'Import'
Tooltip: 'Import Object File Format (*.off)'
@ -71,4 +71,4 @@ def read(filename):
def fs_callback(filename):
read(filename)
Blender.Window.FileSelector(fs_callback, "OFF Import")
Blender.Window.FileSelector(fs_callback, "Import OFF")

@ -1,10 +1,10 @@
#!BPY
"""
Name: 'Radiosity...'
Name: 'Radiosity (.radio)...'
Blender: 232
Group: 'Export'
Tooltip: 'Export selected mesh (with vertex colors) to Radiosity File Format (*.radio)'
Tooltip: 'Export selected mesh (with vertex colors) to Radiosity File Format (.radio)'
"""
# $Id$
@ -90,4 +90,4 @@ def fs_callback(filename):
if filename.find('.radio', -6) <= 0: filename += '.radio'
write(filename)
Blender.Window.FileSelector(fs_callback, "Radio Export")
Blender.Window.FileSelector(fs_callback, "Export Radio")

@ -1,10 +1,10 @@
#!BPY
"""
Name: 'Radiosity...'
Name: 'Radiosity (.radio)...'
Blender: 232
Group: 'Import'
Tooltip: 'Import Radiosity File Format (*.radio) with vertex colors'
Tooltip: 'Import Radiosity File Format (.radio) with vertex colors'
"""
# $Id$
@ -93,4 +93,4 @@ def read(filename):
def fs_callback(filename):
read(filename)
Blender.Window.FileSelector(fs_callback, "Radio Import")
Blender.Window.FileSelector(fs_callback, "Import Radio")

@ -1,10 +1,10 @@
#!BPY
"""
Name: 'Raw Triangle...'
Name: 'Raw Triangle (.raw)...'
Blender: 232
Group: 'Export'
Tooltip: 'Export selected mesh to Raw Triangle Format (*.raw)'
Tooltip: 'Export selected mesh to Raw Triangle Format (.raw)'
"""
# $Id$
@ -65,4 +65,4 @@ def fs_callback(filename):
if filename.find('.raw', -4) <= 0: filename += '.raw'
write(filename)
Blender.Window.FileSelector(fs_callback, "Raw Export")
Blender.Window.FileSelector(fs_callback, "Export Raw")

@ -1,10 +1,10 @@
#!BPY
"""
Name: 'Raw Triangle...'
Name: 'Raw Triangle (.raw)...'
Blender: 232
Group: 'Import'
Tooltip: 'Import Raw Triangle File Format (*.raw)'
Tooltip: 'Import Raw Triangle File Format (.raw)'
"""
# $Id$
@ -66,4 +66,4 @@ def read(filename):
def fs_callback(filename):
read(filename)
Blender.Window.FileSelector(fs_callback, "Raw Import")
Blender.Window.FileSelector(fs_callback, "Import Raw")

@ -1,10 +1,10 @@
#!BPY
"""
Name: 'SLP (Pro Engineer)...'
Name: 'Pro Engineer (.slp)...'
Blender: 232
Group: 'Import'
Tooltip: 'Import SLP (Pro Engineer) File Format (*.raw)'
Tooltip: 'Import Pro Engineer (.slp) File Format'
"""
# $Id$
@ -75,4 +75,4 @@ def read(filename):
def fs_callback(filename):
read(filename)
Blender.Window.FileSelector(fs_callback, "SLP Import")
Blender.Window.FileSelector(fs_callback, "Import SLP")

@ -1,10 +1,10 @@
#!BPY
"""
Name: 'TrueSpace...'
Name: 'TrueSpace (.cob)...'
Blender: 232
Group: 'Export'
Tooltip: 'Export selected meshes to trueSpace File Format (*.cob)'
Tooltip: 'Export selected meshes to TrueSpace File Format (.cob)'
"""
# $Id$
@ -247,7 +247,7 @@ def fs_callback(filename):
if filename.find('.cob', -4) <= 0: filename += '.cob'
write(filename)
Blender.Window.FileSelector(fs_callback, "COB Export")
Blender.Window.FileSelector(fs_callback, "Export COB")
# === Matrix Differences between Blender & trueSpace ===
#

@ -1,10 +1,10 @@
#!BPY
"""
Name: 'TrueSpace...'
Name: 'TrueSpace (.cob)...'
Blender: 232
Group: 'Import'
Tooltip: 'Import trueSpace Object File Format (*.cob)'
Tooltip: 'Import TrueSpace Object File Format (.cob)'
"""
# $Id$
@ -211,7 +211,7 @@ def read(filename):
def fs_callback(filename):
read(filename)
Blender.Window.FileSelector(fs_callback, "COB Import")
Blender.Window.FileSelector(fs_callback, "Import COB")
# === Matrix Differences between Blender & trueSpace ===
#

@ -1,10 +1,10 @@
#!BPY
"""
Name: 'Videoscape (with Vertex Colors)...'
Name: 'VideoScape with Vertex Colors (.obj)...'
Blender: 232
Group: 'Export'
Tooltip: 'Export selected mesh to VideoScape File Format (*.obj)'
Tooltip: 'Export selected mesh to VideoScape File Format (.obj)'
"""
# $Id$
@ -179,7 +179,7 @@ def fs_callback(filename):
if filename.find('.obj', -4) <= 0: filename += '.VIDEOSCAPE.obj'
write(filename)
Blender.Window.FileSelector(fs_callback, "Videoscape Export")
Blender.Window.FileSelector(fs_callback, "Export VideoScape")
# filename = "VIDEOSCAPE_" + objname + ".obj"

@ -1,10 +1,10 @@
#!BPY
"""
Name: 'Wings3D...'
Name: 'Wings3D (.wings)...'
Blender: 232
Group: 'Export'
Tooltip: 'Export selected mesh to Wings3D File Format (*.wings)'
Tooltip: 'Export selected mesh to Wings3D File Format (.wings)'
"""
# $Id$
@ -343,4 +343,4 @@ def fs_callback(filename):
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")
Blender.Window.FileSelector(fs_callback, "Export Wings3D")

@ -1,10 +1,10 @@
#!BPY
"""
Name: 'Wings3D...'
Name: 'Wings3D (.wings)...'
Blender: 232
Group: 'Import'
Tooltip: 'Import Wings3D File Format (*.wings)'
Tooltip: 'Import Wings3D File Format (.wings)'
"""
# $Id$
@ -287,4 +287,4 @@ def read(filename):
def fs_callback(filename):
read(filename)
Blender.Window.FileSelector(fs_callback, "Wings3D Import")
Blender.Window.FileSelector(fs_callback, "Import Wings3D")

@ -1,10 +1,10 @@
#!BPY
""" Registration info for Blender menus:
Name: 'VRML 2.0'
Name: 'VRML 2.0 (.wrl)...'
Blender: 232
Group: 'Export'
Submenu: 'All objects...' all
Submenu: 'Only selected objects...' selected
Submenu: 'All Objects...' all
Submenu: 'Selected Objects...' selected
Tooltip: 'Export to VRML2 (.wrl) file.'
"""
@ -969,7 +969,7 @@ if Blender.Get('version') < 225:
print " download a newer version from http://blender.org/"
else:
if ARG == 'all' or ARG == 'selected':
Blender.Window.FileSelector(file_callback,"Save VRML 2.0")
Blender.Window.FileSelector(file_callback,"Export VRML 2.0")
else:
baseFileName=Blender.Get('filename')
if baseFileName.find('.') != -1:

@ -201,7 +201,7 @@ void write_videoscape_fs()
}
else {
if(videosc_dir[0]==0) strcpy(videosc_dir, G.sce);
activate_fileselect(FILE_SPECIAL, "Save Videoscape", videosc_dir,
activate_fileselect(FILE_SPECIAL, "Export Videoscape", videosc_dir,
write_videoscape);
}
}
@ -214,7 +214,7 @@ void write_vrml_fs()
else {
if(videosc_dir[0]==0) strcpy(videosc_dir, G.sce);
activate_fileselect(FILE_SPECIAL, "Save VRML 1", videosc_dir, write_vrml);
activate_fileselect(FILE_SPECIAL, "Export VRML 1.0", videosc_dir, write_vrml);
}
}
@ -227,7 +227,7 @@ void write_dxf_fs()
if(videosc_dir[0]==0) strcpy(videosc_dir, G.sce);
activate_fileselect(FILE_SPECIAL, "Save DXF", videosc_dir, write_dxf);
activate_fileselect(FILE_SPECIAL, "Export DXF", videosc_dir, write_dxf);
}
}
@ -240,7 +240,7 @@ void write_stl_fs()
if(videosc_dir[0]==0) strcpy(videosc_dir, G.sce);
activate_fileselect(FILE_SPECIAL, "SAVE STL", videosc_dir, write_stl);
activate_fileselect(FILE_SPECIAL, "Export STL", videosc_dir, write_stl);
}
}
/* ------------ */
@ -673,8 +673,33 @@ 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;
BPY_menu_do_python(PYMENU_IMPORT, event);
if(curarea->spacetype==SPACE_INFO) {
sa= find_biggest_area_of_type(SPACE_SCRIPT);
if (!sa) sa= closest_bigger_area();
areawinset(sa->win);
}
/* events >=4 are registered bpython scripts */
if (event >= 4) BPY_menu_do_python(PYMENU_IMPORT, event - 4);
else switch(event) {
case 0: /* DXF */
activate_fileselect(FILE_BLENDER, "Import DXF", G.sce, BIF_read_file);
break;
case 1: /* VRML 1.0 */
activate_fileselect(FILE_BLENDER, "Import VRML 1.0", G.sce, BIF_read_file);
break;
case 2: /* VideoScape */
activate_fileselect(FILE_BLENDER, "Import VideoScape", G.sce, BIF_read_file);
break;
case 3: /* STL */
activate_fileselect(FILE_BLENDER, "Import STL", G.sce, BIF_read_file);
break;
}
allqueue(REDRAWINFO, 0);
}
@ -689,9 +714,20 @@ static uiBlock *info_file_importmenu(void *arg_unused)
block= uiNewBlock(&curarea->uiblocks, "importmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
uiBlockSetButmFunc(block, do_info_file_importmenu, NULL);
//uiBlockSetXOfs(block, -50); // offset to parent button
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "VRML 1.0...|Ctrl F2",
0, yco-=20, 120, 19, NULL, 0.0, 0.0, 1, 0, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "DXF...|Shift F2",
0, yco-=20, 120, 19, NULL, 0.0, 0.0, 1, 1, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "VideoScape...|Alt W",
0, yco-=20, 120, 19, NULL, 0.0, 0.0, 1, 2, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "STL...",
0, yco-=20, 120, 19, NULL, 0.0, 0.0, 1, 3, "");
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
for (pym = BPyMenuTable[PYMENU_IMPORT]; pym; pym = pym->next, i++) {
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, pym->name, 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, i, pym->tooltip?pym->tooltip:pym->filename);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, pym->name, 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, i+4, pym->tooltip?pym->tooltip:pym->filename);
}
uiBlockSetDirection(block, UI_RIGHT);
@ -703,11 +739,16 @@ 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;
/* events >=3 are registered bpython scripts */
if (event >= 3) BPY_menu_do_python(PYMENU_EXPORT, event - 3);
if(curarea->spacetype==SPACE_INFO) {
sa= find_biggest_area_of_type(SPACE_SCRIPT);
if (!sa) sa= closest_bigger_area();
areawinset(sa->win);
}
/* these are no defines, easier this way, the codes are in the function below */
/* events >=4 are registered bpython scripts */
if (event >= 4) BPY_menu_do_python(PYMENU_EXPORT, event - 4);
else switch(event) {
@ -720,6 +761,9 @@ static void do_info_file_exportmenu(void *arg, int event)
case 2:
write_videoscape_fs();
break;
case 3:
write_stl_fs();
break;
}
allqueue(REDRAWINFO, 0);
}
@ -741,13 +785,15 @@ static uiBlock *info_file_exportmenu(void *arg_unused)
0, yco-=20, 120, 19, NULL, 0.0, 0.0, 1, 1, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Videoscape...|Alt W",
0, yco-=20, 120, 19, NULL, 0.0, 0.0, 1, 2, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "STL...",
0, yco-=20, 120, 19, NULL, 0.0, 0.0, 1, 3, "");
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
/* note that we acount for the 3 previous entries with i+3: */
for (pym = BPyMenuTable[PYMENU_EXPORT]; pym; pym = pym->next, i++) {
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, pym->name, 0, yco-=20, menuwidth, 19,
NULL, 0.0, 0.0, 1, i+3,
NULL, 0.0, 0.0, 1, i+4,
pym->tooltip?pym->tooltip:pym->filename);
}
@ -758,45 +804,6 @@ static uiBlock *info_file_exportmenu(void *arg_unused)
return block;
}
static void do_info_file_exportselmenu(void *arg, int event)
{
ScrArea *sa;
if(curarea->spacetype==SPACE_INFO) {
sa= closest_bigger_area();
areawinset(sa->win);
}
/* these are no defines, easier this way (yeah right!),
the codes are in the function below */
switch(event) {
case 0:
write_stl_fs();
break;
}
allqueue(REDRAWINFO, 0);
}
static uiBlock *info_file_exportselmenu(void *arg_unused)
{
uiBlock *block;
short yco = 20;
block= uiNewBlock(&curarea->uiblocks, "exportselectedmenu", UI_EMBOSSP,
UI_HELV, G.curscreen->mainwin);
uiBlockSetButmFunc(block, do_info_file_exportselmenu, NULL);
//uiBlockSetXOfs(block, -50); // offset to parent button
uiDefBut(block, BUTM, 1, "STL...",
0, yco-=20, 120, 19, NULL, 0.0, 0.0, 1, 0, "");
uiBlockSetDirection(block, UI_RIGHT);
uiTextBoundsBlock(block, 60);
return block;
}
static void do_info_filemenu(void *arg, int event)
{
ScrArea *sa;
@ -920,7 +927,6 @@ static uiBlock *info_filemenu(void *arg_unused)
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Append...|Shift F1", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
uiDefIconTextBlockBut(block, info_file_importmenu, NULL, ICON_RIGHTARROW_THIN, "Import", 0, yco-=20, menuwidth, 19, "");
uiDefIconTextBlockBut(block, info_file_exportmenu, NULL, ICON_RIGHTARROW_THIN, "Export", 0, yco-=20, menuwidth, 19, "");
uiDefIconTextBlockBut(block, info_file_exportselmenu, NULL, ICON_RIGHTARROW_THIN, "Export Selected", 0, yco-=20, menuwidth, 19, "");
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");