1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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 = "D:/"; // 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");
|