Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Want <cwant@ualberta.ca>2004-03-30 07:10:34 +0400
committerChris Want <cwant@ualberta.ca>2004-03-30 07:10:34 +0400
commitc2a691a94eed48bd310c110a96729eb8aeb5bf25 (patch)
treec12a2a2a165cc8d4db02feeeea585131e129bee6 /source/blender/src/header_info.c
parentfc275fd72fc856fb194c54789b164ceb9d1201e6 (diff)
Support for the STL (stereolithography) file format. Reads the ASCII and
binary subformats, and writes the binary subformat. Read is done with usual F1, write is done in the menu 'File->Export Selected->STL'. Writes meshes only, writing the 'displistmesh' if subsurf is on. The 'magic' to determine whether it is reading the binary or ASCII subformat could use a little work, but makes the correct choice most of the time.
Diffstat (limited to 'source/blender/src/header_info.c')
-rw-r--r--source/blender/src/header_info.c74
1 files changed, 67 insertions, 7 deletions
diff --git a/source/blender/src/header_info.c b/source/blender/src/header_info.c
index dc2d38a631a..ec10aef40ac 100644
--- a/source/blender/src/header_info.c
+++ b/source/blender/src/header_info.c
@@ -230,6 +230,19 @@ void write_dxf_fs()
activate_fileselect(FILE_SPECIAL, "Save DXF", videosc_dir, write_dxf);
}
}
+
+void write_stl_fs()
+{
+ if(G.obedit) {
+ error("Can't save STL. Press TAB to leave EditMode");
+ }
+ else {
+
+ if(videosc_dir[0]==0) strcpy(videosc_dir, G.sce);
+
+ activate_fileselect(FILE_SPECIAL, "SAVE STL", videosc_dir, write_stl);
+ }
+}
/* ------------ */
int buttons_do_unpack()
@@ -735,18 +748,64 @@ static uiBlock *info_file_exportmenu(void *arg_unused)
block= uiNewBlock(&curarea->uiblocks, "exportmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
uiBlockSetButmFunc(block, do_info_file_exportmenu, NULL);
//uiBlockSetXOfs(block, -50); // offset to parent button
-
- uiDefBut(block, BUTM, 1, "VRML 1.0...|Ctrl F2", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
- uiDefBut(block, BUTM, 1, "DXF...|Shift F2", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
- uiDefBut(block, BUTM, 1, "Videoscape...|Alt W", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
- uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
+ uiDefBut(block, BUTM, 1, "VRML 1.0...|Ctrl F2",
+ 0, yco-=20, 120, 19, NULL, 0.0, 0.0, 1, 0, "");
+ uiDefBut(block, BUTM, 1, "DXF...|Shift F2",
+ 0, yco-=20, 120, 19, NULL, 0.0, 0.0, 1, 1, "");
+ uiDefBut(block, BUTM, 1, "Videoscape...|Alt W",
+ 0, yco-=20, 120, 19, NULL, 0.0, 0.0, 1, 2, "");
+
+ 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: */
+ /* note that we acount for the 3 previous entries with i+3: */
for (pym = BPyMenuTable[PYMENU_EXPORT]; pym; pym = pym->next, i++) {
- uiDefBut(block, BUTM, 1, pym->name, 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, i+3, pym->tooltip?pym->tooltip:pym->filename);
+ uiDefBut(block, BUTM, 1, pym->name, 0, yco-=20, menuwidth, 19,
+ NULL, 0.0, 0.0, 1, i+3,
+ pym->tooltip?pym->tooltip:pym->filename);
+ }
+
+
+ uiBlockSetDirection(block, UI_RIGHT);
+ uiTextBoundsBlock(block, 60);
+
+ 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);
@@ -875,6 +934,7 @@ 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, "");