-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathGP9_prep.dsa
More file actions
224 lines (175 loc) · 5.83 KB
/
Copy pathGP9_prep.dsa
File metadata and controls
224 lines (175 loc) · 5.83 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
// DAZ Studio version 4.22.0.16 filetype DAZ Script
include ("./DthUtils.dsa");
print(loadDufToNode);
var timeStep = Scene.getTimeStep();
// Get the primary selection
var oNode = Scene.getPrimarySelection();
// If nothing is selected
if( !oNode ){
// We are done...
return;
}
var oScript;
var oContentMgr = App.getContentMgr();
var sGpPath = "D:\\DDaz3DLibrary\\People\\Genesis 9\\Anatomy\\Golden Palace\\"
var sNipPath = "D:\\DDaz3DLibrary\\People\\Genesis 9\\Anatomy\\Rendorgal\\RDGL Nipples\\";
//var sFile = sGpPath + "1-G9 Selector.dse";
/******************************************************/
var oScriptSelectG9 = new DzScript();
oScriptSelectG9.loadFromFile(sGpPath + "1-G9 Selector.dse");
oScriptSelectG9.execute();
var oNodeG9 = Scene.getPrimarySelection();
if( !oNodeG9 ){
return;
}
/******************************************************/
loadDufToNode(oNodeG9, sNipPath + "Add Nipples.duf", "RDGL Nipples");
/******************************************************/
loadDufToNode(oNodeG9, sGpPath + "2a-Golden Palace Smart_Vanilla.duf", "GoldenPalace_G9");
loadDufToNode(oNodeG9, sGpPath + "3-Golden Palace_Material Copy.dse");
loadDufToNode(oNodeG9, sGpPath + "5_Realistic Default Shape.duf" );
Scene.selectAllNodes(false);
oNodeNipples = oNodeG9.findNodeChildByLabel("RDGL Nipples");
if (oNodeNipples){
print(oNodeNipples.objectName);
Scene.setPrimarySelection(oNodeNipples);
/******************************************************/
oScript = new DzScript();
print("Loading script: ", "Material Apply.dsa");
oScript.loadFromFile(sNipPath + "Material Apply.dsa");
oScript.execute();
/******************************************************/
var oNodeMinora = oNodeG9.findNodeChildByLabel("GoldenPalaceG9_Shell_Minora");
if (oNodeMinora){
print(oNodeMinora.objectName);
Scene.setPrimarySelection(oNodeMinora);
}
var oNodeMajora = oNodeG9.findNodeChildByLabel("GoldenPalaceG9_Shell_Majora");
if (oNodeMajora){
print(oNodeMajora.objectName);
Scene.setPrimarySelection(oNodeMajora);
}
oScript = new DzScript();
print("Loading script: ", "4_Shell Fix Omni.dsa");
oScript.loadFromFile(sGpPath + "4_Shell Fix Omni.dsa");
oScript.execute();
} else {
print("no nipples");
}
function loadDufToNode(oNodeRoot, sDufPath, sChildLabel){
var oChildNode;
if(sChildLabel)
oChildNode = oNodeRoot.findNodeChildByLabel(sChildLabel);
if(!oChildNode){
Scene.setPrimarySelection(oNodeRoot);
print("Loading DUF: ", sDufPath, "to add", sChildLabel, "to node", oNodeRoot.getLabel(), "...");
if( oContentMgr.openFile(sDufPath) ) {
print("Successfully loaded");
return true;
} else {
print("Failed to load DUF: ", sDufPath, "to add", sChildLabel, "to node", oNodeRoot.getLabel(), "...");
return false;
}
} else {
print(sChildLabel, "already exists on node:", oNodeRoot.getLabel());
return true;
}
}
//var oNodeMinora = oNodeG9.findNodeChildByLabel("GoldenPalaceG9_Shell_Minora");
//if(!oNodeMinora){
//
//
// print("Loading DUF: ", "2a-Golden Palace Smart_Vanilla.duf");
// oContentMgr.openFile(sGpPath + "2a-Golden Palace Smart_Vanilla.duf");
//
// /******************************************************/
// print("Loading DUF: ", "5_Realistic Default Shape.duf");
// oContentMgr.openFile(sGpPath + "5_Realistic Default Shape.duf");
//
// /******************************************************/
// oScript = new DzScript();
// print("Loading script: ", "3-Golden Palace_Material Copy.dse");
// oScript.loadFromFile(sGpPath + "3-Golden Palace_Material Copy.dse");
// oScript.execute();
//}
/******************************************************/
/*
var oPropertyGroupTree = oNode.getPropertyGroups();
var oProperties = oPropertyGroupTree.getAllProperties();
var a = 0;
var aInitialPropValues = {};
aInitialPropValues["a"] = 1;
print(aInitialPropValues);
var aPropList = [];
for( var i in oProperties){
var oProperty = oProperties[i];
if(oProperty && oProperty.canAnimate && oProperty.getValue && oProperty.inherits("DzNumericProperty"))
//&& !oProperty.currentValueIsDefaultValue()
{
//printPropertyInfo( oProperty );
//print(oProperty.className());
//print(oProperty.getValue());
aPropList = aPropList.concat(oProperty);
a += 1;
}
}
//print(aPropList);
print("aPropList length:", aPropList.length);
var t;
var aChanged = [];
for( var i = 3; i < 100; i++ ) {
t = i * timeStep;
aChanged[i] = [];
for( var j = 0; j < aPropList.length; j++ ) {
//print(j);
if( aPropList[j].getValue(0) != aPropList[j].getValue(t))
aChanged[i] = aChanged[i].concat(j);
}
}
for(var i in aChanged){
var tmp = [];
for(var j in aChanged[i]){
prop = aPropList[aChanged[i][j]];
if(prop)
tmp = tmp.concat(prop.getLabel());
}
print(i, tmp);
}
function buildRestPropList(){
}
print(a);
*/
/*
// Define what we are looking for
var sPropertyName = "SubDAlgorithmControl";
var sPropertyPath = "General/Mesh Resolution";
// Initialize a list of properties
var aProperties = [];
// Declare working variable
var oProperty;
// If a property name is defined
if( !sPropertyName.isEmpty() ){
// Find the property by name on the node
oProperty = findElementProperty( oNode, sPropertyName, false );
// If the property is found
if( oProperty ){
// Collect the property
aProperties.push( oProperty );
}
// If a property path is defined
} else if( !sPropertyPath.isEmpty() ){
// Collect the properties at the specified path on the node
aProperties = aProperties.concat( getElementPropertiesInPath( oNode, sPropertyPath, true ) );
// If neither a property name nor a property path is defined
} else {
// Collect the properties on the node
aProperties = aProperties.concat( getElementProperties( oNode, true, true ) );
}
// Iterate over the collected properties
for( var i = 0; i < aProperties.length; i += 1 ){
// Get the 'current' property
oProperty = aProperties[ i ];
// Print information about the property
printPropertyInfo( oProperty );
}
/**/