From 74114d95f195756f1dac92040901404380689066 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Wed, 28 Oct 2026 10:49:05 +0100 Subject: Add Daz Studio batch script for corpus export Co-Authored-By: Claude Opus 5.5 --- tools/export_corpus.dsa | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 tools/export_corpus.dsa (limited to 'tools/export_corpus.dsa') 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. +// +// 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/.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"); -- cgit v1.2.3