-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathKeyboard.pde
86 lines (76 loc) · 2.91 KB
/
Keyboard.pde
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
// some useful keyboard actions
void keyPressed() {
isHoldingShift = (keyCode == SHIFT);
isHoldingAlt = (keyCode == ALT);
isHoldingCtrl = (keyCode == CONTROL);
// toggle autoRotate, translation & rotation
if (key == 'r') {
if (autoRotate == false) {
cp5.getController("autoRotate").setValue(1);
} else {
cp5.getController("autoRotate").setValue(0);
}
}
// toggle the cp5 gui
if (key == '5') {
drawcp5 = !drawcp5;
}
// set X & Y speed of translation & rotation to zero
if (key == '0') {
cp5.getController("changeSpeedX").setValue(0);
cp5.getController("changeSpeedY").setValue(0);
}
// toggle sunflow manually
if (key == 's') {
if (saveSunflow) {
cp5.getController("saveSunflow").setValue(0);
} else {
cp5.getController("saveSunflow").setValue(1);
}
}
// save a single screenshot
if (key == 'z') {
timestamp = year() + nf(month(), 2) + nf(day(), 2) + "-" + nf(hour(), 2) + nf(minute(), 2) + nf(second(), 2);
save("renders/screenshots/" + timestamp + " (gui).png");
println("Screenshot of current GUI saved");
}
// preview quality sunflow render (+ gui screenshot)
if (key == 'x') {
cp5.getController("autoRotate").setValue(0);
((Toggle)cp5.getController("saveContinuous")).setValue(0).setLabel("Continuously").setColorCaptionLabel(currentTheme.ControlCaptionLabel);
cp5.getController("saveGui").setValue(1);
cp5.getController("savePreview").setValue(1);
cp5.getController("saveSunflow").setValue(1);
save();
}
// high quality sunflow render (+ gui screenshot)
if (key == 'c') {
cp5.getController("autoRotate").setValue(0);
((Toggle)cp5.getController("saveContinuous")).setValue(0).setLabel("Continuously").setColorCaptionLabel(currentTheme.ControlCaptionLabel);
cp5.getController("saveGui").setValue(1);
cp5.getController("savePreview").setValue(0);
cp5.getController("saveSunflow").setValue(1);
save();
}
// decrease sunflow multiplication factor by 0.5 (key: <)
if (key == ',') {
if (sunflowMultiply >= 1) {
sunflowMultiply -= 0.5;
}
println("Sunflow render output: " + int(sceneWidth*sunflowMultiply) + " x " + int(sceneHeight*sunflowMultiply));
cp5.getController("lblSunflowSize")
.setValueLabel("SUNFLOW RENDERING SIZE : " + int(sceneWidth*sunflowMultiply)+ " x " + int(sceneHeight*sunflowMultiply));
}
// increase sunflow multiplication factor by 0.5 (key: >)
if (key == '.') {
sunflowMultiply += 0.5;
println("Sunflow render output: " + int(sceneWidth*sunflowMultiply) + " x " + int(sceneHeight*sunflowMultiply));
cp5.getController("lblSunflowSize")
.setValueLabel("SUNFLOW RENDERING SIZE : " + int(sceneWidth*sunflowMultiply)+ " x " + int(sceneHeight*sunflowMultiply));
}
}
void keyReleased() {
if (keyCode == SHIFT) isHoldingShift = false;
if (keyCode == ALT) isHoldingAlt = false;
if (keyCode == CONTROL) isHoldingCtrl = false;
}