Files
ba.pbr.vmt.qc.mdl.exe/source/genqc.pde
Victor Giers 10f33e82da initial commit
2018-04-21 03:59:45 +02:00

161 lines
3.6 KiB
Plaintext

/* todo
- add more anim dynamic arraylist
*/
void nextPhase() {
if (skip && readPhase_i == 2 && imgCount > 0) {
PApplet.runSketch(args, sa);
sa.loadMRAO(false, false, false);
}
if (readPhase_i == 3 && appActive) sa.kill();
if (readPhase_i == 6) {
if (filePath == null) {
//crit_error = true;
error_s = "Warning: No texture";
error_b = true;
readPhase_i--;
}
smdInit();
}
if (readPhase_i == 7) {
if (skip) {
//crit_error = true;
error_s = "No base model";
error_b = true;
readPhase_i--;
}
bodyFileName = smdFileName;
idleFileName = smdFileName;
writeQC();
}
if (readPhase_i == 8) {
if (!skip) {
idleNotBody = true;
}
idleFileName = smdFileName;
writeQC();
}
if (readPhase_i == 9) {
if (!skip) {
collisionFileName = smdFileName;
hasCollision = true;
writeQC();
}
}
if (readPhase_i == 10) {
// if (!surfaceProp.equals("")){
writeQC();
//};
}
if (readPhase_i == 11) {
writeQC();
}
readPhase_i++;
skip = false;
}
boolean smd_b;
void smdInit() {
smd_b = true;
}
void smdDraw() {
if (readPhase_i != 12 && readPhase_i != 7 && readPhase_i != 11) {
textSize(14);
buttons[5].update();
buttons[5].display();
textSize(ts);
}
if (readPhase_i == 10) {
ts = 20;
textAlign(CENTER);
textSize(ts);
text(surfaceProp, width/2, height/2+(ts+ts/10));
String dash = "_";
if (second() % 2 != 0) {
text(dash, width/2 + textWidth(surfaceProp)/2 + 5, height/2+(ts+ts/10));
}
}
if (readPhase_i == 11) {
buttons[6].update();
buttons[6].display();
buttons[7].update();
buttons[7].display();
}
if (readPhase_i == 12){
buttons[9].update();
buttons[9].display();
}
textAlign(CENTER);
ts = 15;
textSize(ts);
text(loadText_s[0][readPhase_i], width/2, 1*ts);
ts = 12;
textSize(ts);
text(loadText_s[2][readPhase_i], width/2, 3*ts);
ts = 20;
textSize(ts);
text(loadText_s[1][readPhase_i], width/2, 3*ts);
}
String smdFileName;
String smdNameStamm;
String smdFilePath;
void getSMD(DropEvent theDropEvent) {
smdFileName = theDropEvent.file().getName();
println(smdFileName);
nameExt = smdFileName.substring(smdFileName.lastIndexOf('.'));
println(nameExt);
if (!nameExt.equals(".smd") && !nameExt.equals(".SMD")) {
error_s = "Not a .smd file";
error_b = true;
} else {
//if (theDropEvent.file().getParent() != smdFilePath) exit();
smdFilePath = theDropEvent.file().getParent();
//smdNameStamm = smdFileName.substring(0, fileName.lastIndexOf('.'));
copyFile(smdFilePath + "\\" + smdFileName, filePath + "\\models\\pbr\\" + inputName + "\\" + smdFileName);
//writeQC();
nextPhase();
}
}
boolean idleNotBody, hasCollision, hasSurfaceProp, isStaticProp;
String surfaceProp = "";
String bodyFileName, idleFileName, collisionFileName;
void writeQC() {
String[] qc={
"$modelname \"\\pbr\\" + inputName + "\\" + inputName +".mdl\"",
"$body " + inputName + " \"" + bodyFileName + "\"",
"",
"$cdmaterials \"\\pbr\\" + inputName + "\"",
"",
"",
"",
"",
"",
""
};
if (idleNotBody) qc[2] = "$sequence idle \""+ idleFileName + "\"";
else qc[2] = "$sequence idle \"" + bodyFileName + "\"";
if (hasCollision) qc[4] = "$collisionmodel \"" + collisionFileName +"\"";
if (!surfaceProp.equals("")) qc[5] = "$surfaceprop " + surfaceProp;
else qc[5] = "";
if (isStaticProp) qc[6] = "$staticprop";
saveStrings(filePath + "\\models\\pbr\\" + inputName + "\\" + inputName + ".qc", qc);
}
boolean condition;