diff options
| author | Danilo M. <danix@danix.xyz> | 2026-10-28 10:49:05 +0100 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-10-28 10:49:05 +0100 |
| commit | 74114d95f195756f1dac92040901404380689066 (patch) | |
| tree | 7f2020a8e297886f5979db6b8249c9077be639a6 /tools | |
| parent | 2f823a78162d3b77727a5eb440c25aa7524d81c3 (diff) | |
| download | generat3D-74114d95f195756f1dac92040901404380689066.tar.gz generat3D-74114d95f195756f1dac92040901404380689066.zip | |
Add Daz Studio batch script for corpus export
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/export_corpus.dsa | 46 |
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"); |
