aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/export_corpus.dsa46
1 files changed, 46 insertions, 0 deletions
diff --git a/tools/export_corpus.dsa b/tools/export_corpus.dsa
new file mode 100644
index 0000000..f7e61ad
--- /dev/null
+++ b/tools/export_corpus.dsa
@@ -0,0 +1,46 @@
+// generat3D - evaluate Daz DSON scenes and write .dbz files
+// Copyright (C) 2026 Danilo M. <danix@danix.xyz>
+//
+// 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.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+// Batch corpus export, run from Daz Studio's Script IDE pane.
+// Loads every .duf in XFER/scenes and writes XFER/corpus/<name>.dbz with
+// Diffeomorphic's export_to_blender.dsa, minus its dialogs.
+
+var XFER = "E:/"; // drive letter of the XFER disk, edit if different
+var EXPORT = XFER + "Diffeomorphic/export_to_blender.dsa";
+
+function readText(path) {
+ var f = new DzFile(path);
+ f.open(DzFile.ReadOnly);
+ var text = f.read();
+ f.close();
+ return text;
+}
+
+var src = readText(EXPORT);
+src = src.replace(/\ncreateDialog\(\)\s*$/, "\n");
+src = src.replace(/MessageBox\.information\(\s*msg,\s*appName,\s*"&OK"\s*\);/, "print(msg);");
+eval(src);
+
+var dir = new DzDir(XFER + "scenes");
+var files = dir.entryList(["*.duf"], DzDir.Files);
+for (var i = 0; i < files.length; i++) {
+ Scene.clear();
+ Scene.loadScene(XFER + "scenes/" + files[i], DzScene.OpenNew);
+ exportToBlender(XFER + "corpus/" + files[i].replace(/\.duf$/, ".dbz"));
+ print("exported " + files[i]);
+}
+print("done: " + files.length + " scenes");