Normand Briere
2019-07-28 d7fd07756f4095cb87dc25d89fcffcbda092e2cf
GroupEditor.java
....@@ -23,6 +23,237 @@
2323 DragGestureListener, DragSourceListener, DropTargetListener,
2424 ItemListener // ListSelectionListener
2525 {
26
+
27
+ public void AddSkyboxButton(String f, String s, cGridBag row)
28
+ {
29
+ cButton skyboxButton;
30
+ final String path = "cubemaps/" + f + "-skyboxes/" + s;
31
+ //row.add(skyboxButton = GetButton(path + "/" + s + ".jpg", !Grafreed.NIMBUSLAF));
32
+ row.add(skyboxButton = GetButton(path + "/negx.jpg", !Grafreed.NIMBUSLAF));
33
+ skyboxButton.setToolTipText(s);
34
+ skyboxButton.addActionListener(new ActionListener()
35
+ {
36
+ @Override
37
+ public void actionPerformed(ActionEvent e)
38
+ {
39
+ ChangeSkybox(path);
40
+ }
41
+ });
42
+ }
43
+
44
+ public void AddSkyboxTab0(JTabbedPane skyboxpanel)
45
+ {
46
+ cGridBag tab0 = new cGridBag().setVertical(true);
47
+
48
+ tab0.setName("Urban");
49
+ skyboxpanel.add(tab0);
50
+
51
+ cGridBag row0 = new cGridBag();
52
+ cGridBag row1 = new cGridBag();
53
+ cGridBag row2 = new cGridBag();
54
+ cGridBag row3 = new cGridBag();
55
+ cGridBag row4 = new cGridBag();
56
+ cGridBag row5 = new cGridBag();
57
+ cGridBag row6 = new cGridBag();
58
+
59
+ AddSkyboxButton("default", "rgb", row0);
60
+ AddSkyboxButton("default", "cornell", row0);
61
+ AddSkyboxButton("default", "uffizi", row0);
62
+ AddSkyboxButton("default", "CloudyHills", row0);
63
+
64
+ AddSkyboxButton("default", "skycube", row1);
65
+ AddSkyboxButton("bridge", "Bridge", row1);
66
+ AddSkyboxButton("bridge", "Bridge2", row1);
67
+ AddSkyboxButton("urban", "GamlaStan2", row1);
68
+
69
+ AddSkyboxButton("urban", "Parliament", row2);
70
+ AddSkyboxButton("urban", "Roundabout", row2);
71
+ AddSkyboxButton("urban", "SaintLazarusChurch", row2);
72
+ AddSkyboxButton("urban", "SaintLazarusChurch2", row2);
73
+
74
+ AddSkyboxButton("urban", "SaintLazarusChurch3", row3);
75
+ AddSkyboxButton("urban", "UnionSquare", row3);
76
+ AddSkyboxButton("park", "BerzeliiPark", row3);
77
+ AddSkyboxButton("park", "Buddha", row3);
78
+
79
+ AddSkyboxButton("park", "CNTower2", row4);
80
+ AddSkyboxButton("park", "NiagaraFalls1", row4);
81
+ AddSkyboxButton("park", "NiagaraFalls3", row4);
82
+ AddSkyboxButton("park", "Park", row4);
83
+
84
+ AddSkyboxButton("park", "Pond", row5);
85
+ AddSkyboxButton("park", "Skansen", row5);
86
+ AddSkyboxButton("park", "Skansen2", row5);
87
+ AddSkyboxButton("park", "Skansen3", row5);
88
+
89
+ AddSkyboxButton("park", "Skansen4", row6);
90
+ AddSkyboxButton("park", "Skansen5", row6);
91
+ AddSkyboxButton("park", "Stairs", row6);
92
+ AddSkyboxButton("park", "Tantolunden4", row6);
93
+
94
+ tab0.add(row0);
95
+ tab0.add(row1);
96
+ tab0.add(row2);
97
+ tab0.add(row3);
98
+ tab0.add(row4);
99
+ tab0.add(row5);
100
+ tab0.add(row6);
101
+
102
+ for (int i=5; --i>=0;)
103
+ {
104
+ //oe.toolboxPanel.Return();
105
+ //tab0.add(new cGridBag());
106
+ }
107
+ }
108
+
109
+ public void AddSkyboxTab1(JTabbedPane skyboxpanel)
110
+ {
111
+ cGridBag tab0 = new cGridBag().setVertical(true);
112
+
113
+ tab0.setName("Nature");
114
+ skyboxpanel.add(tab0);
115
+
116
+ cGridBag row0 = new cGridBag();
117
+ cGridBag row1 = new cGridBag();
118
+ cGridBag row2 = new cGridBag();
119
+ cGridBag row3 = new cGridBag();
120
+ cGridBag row4 = new cGridBag();
121
+ cGridBag row5 = new cGridBag();
122
+ cGridBag row6 = new cGridBag();
123
+
124
+ AddSkyboxButton("beach", "HeartInTheSand", row0);
125
+ AddSkyboxButton("beach", "LarnacaBeach", row0);
126
+ AddSkyboxButton("beach", "PalmTrees", row0);
127
+ AddSkyboxButton("beach", "Tenerife", row0);
128
+
129
+ AddSkyboxButton("beach", "Tenerife2", row1);
130
+ AddSkyboxButton("beach", "Tenerife3", row1);
131
+ AddSkyboxButton("field", "FishPond", row1);
132
+ AddSkyboxButton("field", "Footballfield", row1);
133
+
134
+ AddSkyboxButton("field", "Meadow", row2);
135
+ AddSkyboxButton("field", "Sorsele", row2);
136
+ AddSkyboxButton("field", "Sorsele2", row2);
137
+ AddSkyboxButton("field", "Sorsele3", row2);
138
+
139
+ AddSkyboxButton("forest", "Brudslojan", row3);
140
+ AddSkyboxButton("forest", "Langholmen2", row3);
141
+ AddSkyboxButton("forest", "Plants", row3);
142
+ AddSkyboxButton("mountain", "Maskonaive", row3);
143
+ AddSkyboxButton("mountain", "Maskonaive2", row4);
144
+
145
+ AddSkyboxButton("mountain", "Maskonaive3", row4);
146
+ AddSkyboxButton("mountain", "Ryfjallet", row4);
147
+ AddSkyboxButton("mountain", "Teide", row4);
148
+
149
+ AddSkyboxButton("rocky", "Langholmen", row5);
150
+ AddSkyboxButton("rocky", "Riddarfjarden", row5);
151
+ AddSkyboxButton("rocky", "Skinnarviksberget", row5);
152
+ AddSkyboxButton("rocky", "Tantolunden6", row5);
153
+ /*
154
+Kastellholmen
155
+Langholmen
156
+Riddarfjarden
157
+Skinnarviksberget
158
+Tanto
159
+Tantolunden2
160
+Tantolunden6
161
+ */
162
+
163
+ tab0.add(row0);
164
+ tab0.add(row1);
165
+ tab0.add(row2);
166
+ tab0.add(row3);
167
+ tab0.add(row4);
168
+ tab0.add(row5);
169
+ tab0.add(row6);
170
+
171
+ for (int i=5; --i>=0;)
172
+ {
173
+ //oe.toolboxPanel.Return();
174
+ //tab0.add(new cGridBag());
175
+ }
176
+ }
177
+
178
+ public void AddSkyboxTab2(JTabbedPane skyboxpanel)
179
+ {
180
+ cGridBag tab0 = new cGridBag().setVertical(true);
181
+
182
+ tab0.setName("Night");
183
+ skyboxpanel.add(tab0);
184
+
185
+ cGridBag row0 = new cGridBag();
186
+ cGridBag row1 = new cGridBag();
187
+ cGridBag row2 = new cGridBag();
188
+ cGridBag row3 = new cGridBag();
189
+ cGridBag row4 = new cGridBag();
190
+ cGridBag row5 = new cGridBag();
191
+ cGridBag row6 = new cGridBag();
192
+
193
+ AddSkyboxButton("night", "NightPath", row0);
194
+ AddSkyboxButton("night", "PondNight", row0);
195
+ AddSkyboxButton("night", "Powerlines", row0);
196
+ AddSkyboxButton("night", "SwedishRoyalCastle", row0);
197
+
198
+ AddSkyboxButton("urban", "CNTower", row1);
199
+ AddSkyboxButton("bridge", "ArstaBridge", row1);
200
+ AddSkyboxButton("indoors", "DallasW", row1);
201
+ AddSkyboxButton("indoors", "MarriottMadisonWest", row1);
202
+
203
+ AddSkyboxButton("indoors", "Vasa", row2);
204
+ AddSkyboxButton("winter", "Backyard", row2);
205
+ AddSkyboxButton("winter", "Creek", row2);
206
+ AddSkyboxButton("winter", "FootballField3", row2);
207
+
208
+ AddSkyboxButton("winter", "Forest", row3);
209
+ AddSkyboxButton("winter", "HornstullsStrand2", row3);
210
+ AddSkyboxButton("winter", "House", row3);
211
+ AddSkyboxButton("winter", "IceLake", row3);
212
+
213
+ AddSkyboxButton("winter", "IceRiver", row4);
214
+ AddSkyboxButton("winter", "Park3", row4);
215
+ AddSkyboxButton("winter", "PondWinter", row4);
216
+
217
+ AddSkyboxButton("winter", "Tantolunden5", row5);
218
+ AddSkyboxButton("winter", "Vindelalven", row5);
219
+ /*
220
+Backyard
221
+Creek
222
+FootballField3
223
+Forest
224
+HornstullsStrand2
225
+House
226
+IceLake
227
+IceRiver
228
+Park3
229
+PondWinter
230
+Tantolunden5
231
+Vindelalven *
232
+ */
233
+
234
+ tab0.add(row0);
235
+ tab0.add(row1);
236
+ tab0.add(row2);
237
+ tab0.add(row3);
238
+ tab0.add(row4);
239
+ tab0.add(row5);
240
+ tab0.add(row6);
241
+
242
+ for (int i=5; --i>=0;)
243
+ {
244
+ //oe.toolboxPanel.Return();
245
+ //tab0.add(new cGridBag());
246
+ }
247
+ }
248
+
249
+ public void ChangeSkybox(String name)
250
+ {
251
+ cameraView.envyoff = false;
252
+ cameraView.skyboxname = name;
253
+ cameraView.skyboxext = "jpg";
254
+ cameraView.repaint();
255
+ }
256
+
26257 //ObjEditor objEditor;
27258 public void closeUI2()
28259 {
....@@ -60,6 +291,12 @@
60291 this.copy = this.group = group;
61292 //selectees = this.group.selectees;
62293
294
+ if (copy.versions == null)
295
+ {
296
+ copy.versions = new byte[100][];
297
+ copy.versionindex = -1;
298
+ }
299
+
63300 if(ui)
64301 SetupUI(objEditor);
65302 }
....@@ -80,14 +317,22 @@
80317 SetupViews(objEditor);
81318
82319 ((cRadio)radioPanel.getComponent(0)).SetCamera(cameraView.renderCamera, true);
320
+
321
+ if (copy.versions == null)
322
+ {
323
+ copy.versions = new byte[100][];
324
+ copy.versionindex = -1;
325
+
326
+ Save(true);
327
+ }
83328 }
84329
85330 void CloneSelection(boolean supports)
86331 {
87
- if (Globals.SAVEONMAKE)
332
+ if (Globals.REPLACEONMAKE)
88333 Save();
89
- boolean keep = Globals.SAVEONMAKE;
90
- Globals.SAVEONMAKE = false;
334
+ boolean keep = Globals.REPLACEONMAKE;
335
+ Globals.REPLACEONMAKE = false;
91336 // Object3D keep = GrafreeD.clipboard;
92337 //Object3D obj;
93338 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -98,7 +343,7 @@
98343
99344 makeSomething(clone, i==group.selection.size()-1);
100345 }
101
- Globals.SAVEONMAKE = keep;
346
+ Globals.REPLACEONMAKE = keep;
102347 }
103348
104349 void CloneClipboard(boolean supports)
....@@ -194,8 +439,8 @@
194439 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
195440 // pasteExpandItem.addActionListener(this);
196441 menu.add("-");
197
- clearItem = menu.add(new MenuItem("Clear"));
198
- clearItem.addActionListener(this);
442
+ deleteItem = menu.add(new MenuItem("Delete"));
443
+ deleteItem.addActionListener(this);
199444
200445 if (Globals.ADVANCED)
201446 {
....@@ -421,7 +666,7 @@
421666 genNormalsMESHItem.addActionListener(this);
422667 if (Globals.ADVANCED)
423668 {
424
- genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
669
+ genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
425670 genNormalsMINEItem.addActionListener(this);
426671 }
427672 stripifyItem = menu.add(new MenuItem("Stripify"));
....@@ -514,10 +759,15 @@
514759 attachBumpItem.addActionListener(this);
515760 pigmentBumpItem = menu.add(new MenuItem("Pigment -> Bump"));
516761 pigmentBumpItem.addActionListener(this);
762
+ //embedTexturesItem
517763 detachPigmentItem = menu.add(new MenuItem("Detach Pigment"));
518764 detachPigmentItem.addActionListener(this);
519765 detachBumpItem = menu.add(new MenuItem("Detach Bump"));
520766 detachBumpItem.addActionListener(this);
767
+ embedTexturesItem = menu.add(new MenuItem("Embed Textures"));
768
+ embedTexturesItem.addActionListener(this);
769
+ deEmbedTexturesItem = menu.add(new MenuItem("De-embed Textures"));
770
+ deEmbedTexturesItem.addActionListener(this);
521771 menu.add("-");
522772 sortbysizeItem = menu.add(new MenuItem("Sort by size"));
523773 sortbysizeItem.addActionListener(this);
....@@ -544,6 +794,7 @@
544794 buildToolsMenu(menu);
545795 }
546796
797
+
547798 void SetupUI2(ObjEditor oe)
548799 {
549800 // June 2019
....@@ -588,7 +839,7 @@
588839 */
589840 cGridBag copyOptionsPanel = new cGridBag();
590841
591
- copyOptionsPanel.preferredHeight = 1;
842
+ copyOptionsPanel.preferredHeight = 2;
592843
593844 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
594845
....@@ -615,29 +866,42 @@
615866 restoreCameraButton.setToolTipText("Restore viewpoint");
616867 restoreCameraButton.addActionListener(this);
617868
869
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
870
+ saveButton.setToolTipText("New version");
871
+ saveButton.addActionListener(this);
872
+
618873 copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
619
- undoButton.setToolTipText("Undo changes");
874
+ undoButton.setToolTipText("Previous version");
620875 undoButton.addActionListener(this);
621876 undoButton.setEnabled(false);
622877
878
+ cGridBag updown = new cGridBag().setVertical(true);
879
+ updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
880
+ restoreButton.setToolTipText("Restore current");
881
+ restoreButton.addActionListener(this);
882
+ restoreButton.setEnabled(false);
883
+
884
+ updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
885
+ replaceButton.setToolTipText("Replace current");
886
+ replaceButton.addActionListener(this);
887
+ replaceButton.setEnabled(false);
888
+
889
+ copyOptionsPanel.add(updown);
890
+
623891 copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
624
- redoButton.setToolTipText("Redo changes");
892
+ redoButton.setToolTipText("Next version");
625893 redoButton.addActionListener(this);
626894 redoButton.setEnabled(false);
627895
628
- copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
629
- saveButton.setToolTipText("Save changes");
630
- saveButton.addActionListener(this);
631
-
632
- copyOptionsPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
896
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
633897 liveCB.setToolTipText("Enable animation");
634898 liveCB.addItemListener(this);
635899
636
- copyOptionsPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
900
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
637901 oneStepButton.setToolTipText("Animate one step forward");
638902 oneStepButton.addActionListener(this);
639903
640
- copyOptionsPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
904
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
641905 fastCB.setToolTipText("Fast mode");
642906 fastCB.addItemListener(this);
643907
....@@ -655,31 +919,32 @@
655919 oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
656920 snapobjectButton.addActionListener(this);
657921 snapobjectButton.setToolTipText("Snap Object");
922
+
923
+ oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
924
+ fourButton.addActionListener(this);
925
+ fourButton.setToolTipText("Show control panel only");
658926 }
659927
660928 //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
661929
662
- oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
663
- twoButton.setToolTipText("Show center view only");
930
+ oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
931
+ twoButton.setToolTipText("Show 3D view only");
664932 twoButton.addActionListener(this);
665933 this.fullscreenLayout = twoButton;
666934
667
- oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
668
- fourButton.addActionListener(this);
669
- fourButton.setToolTipText("Show left panel only");
670
- oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
671
- sixButton.setToolTipText("2-column layout left");
672
- sixButton.addActionListener(this);
673
- oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
674
- threeButton.setToolTipText("2-column layout right");
935
+ oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
936
+ threeButton.setToolTipText("Show controls and 3D view");
675937 threeButton.addActionListener(this);
676
- oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
677
- sevenButton.setToolTipText("3-column layout");
678
- sevenButton.addActionListener(this);
938
+ oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
939
+ sixButton.setToolTipText("Show 3D view and controls");
940
+ sixButton.addActionListener(this);
941
+// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
942
+// sevenButton.setToolTipText("3-column layout");
943
+// sevenButton.addActionListener(this);
679944 //
680945
681
- oe.toolbarPanel.add(rootButton = GetButton("icons/write.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
682
- rootButton.setToolTipText("Edit selection in new tab");
946
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
947
+ rootButton.setToolTipText("Open selection in new tab");
683948 rootButton.addActionListener(this);
684949
685950 oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
....@@ -688,28 +953,30 @@
688953 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
689954 //clearButton.addActionListener(this);
690955
956
+ cGridBag row1 = new cGridBag();
957
+
691958 // INSERT
692
- oe.toolboxPanel.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
959
+ row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
693960 gridButton.setToolTipText("Create grid");
694961 gridButton.addActionListener(this);
695962
696
- oe.toolboxPanel.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
963
+ row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
697964 boxButton.setToolTipText("Create box");
698965 boxButton.addActionListener(this);
699966
700
- oe.toolboxPanel.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
967
+ row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
701968 sphereButton.setToolTipText("Create sphere");
702969 sphereButton.addActionListener(this);
703970
704
- oe.toolboxPanel.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
971
+ row1.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
705972 coneButton.setToolTipText("Create cone");
706973 coneButton.addActionListener(this);
707974
708
- oe.toolboxPanel.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
975
+ row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
709976 torusButton.setToolTipText("Create torus");
710977 torusButton.addActionListener(this);
711978
712
- oe.toolboxPanel.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
979
+ row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
713980 superButton.setToolTipText("Create superellipsoid");
714981 superButton.addActionListener(this);
715982
....@@ -720,51 +987,56 @@
720987 kleinButton.addActionListener(this);
721988 }
722989
723
- oe.toolboxPanel.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
990
+ row1.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
724991 particlesButton.setToolTipText("Create particle system");
725992 particlesButton.addActionListener(this);
726993
727
- oe.toolboxPanel.Return();
994
+ oe.toolboxPanel.add(row1);
728995
729
- oe.toolboxPanel.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
996
+ cGridBag row2 = new cGridBag();
997
+
998
+ row2.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
730999 groupButton.setToolTipText("Create group");
7311000 groupButton.addActionListener(this);
7321001
733
- oe.toolboxPanel.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1002
+ row2.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
7341003 compositeButton.setToolTipText("Create composite");
7351004 compositeButton.addActionListener(this);
7361005
737
- oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1006
+ row2.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
7381007 switchButton.setToolTipText("Create item switcher");
7391008 switchButton.addActionListener(this);
7401009
741
- oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1010
+ row2.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
7421011 loopButton.setToolTipText("Create loop");
7431012 loopButton.addActionListener(this);
7441013
745
- oe.toolboxPanel.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1014
+ row2.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
7461015 textureButton.setToolTipText("Create texture");
7471016 textureButton.addActionListener(this);
7481017
749
- oe.toolboxPanel.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1018
+ row2.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
7501019 overlayButton.setToolTipText("Create overlay");
7511020 overlayButton.addActionListener(this);
7521021
753
- oe.toolboxPanel.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1022
+ row2.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
7541023 lightButton.setToolTipText("Create light");
7551024 lightButton.addActionListener(this);
7561025
757
- for (int i=6; --i>=0;)
758
- {
759
- oe.toolboxPanel.Return();
760
- oe.toolboxPanel.add(new cGridBag());
761
- oe.toolboxPanel.add(new cGridBag());
762
- oe.toolboxPanel.add(new cGridBag());
763
- oe.toolboxPanel.add(new cGridBag());
764
- oe.toolboxPanel.add(new cGridBag());
765
- oe.toolboxPanel.add(new cGridBag());
766
- oe.toolboxPanel.add(new cGridBag());
767
- }
1026
+ oe.toolboxPanel.add(row2);
1027
+
1028
+ // ENVYMAPS
1029
+ cGridBag skyboxpane = new cGridBag();
1030
+ skyboxpane.preferredHeight = 100;
1031
+
1032
+ oe.toolboxPanel.add(skyboxpane);
1033
+
1034
+ JTabbedPane skyboxpanel = new JTabbedPane();
1035
+ skyboxpane.add(skyboxpanel);
1036
+
1037
+ AddSkyboxTab0(skyboxpanel);
1038
+ AddSkyboxTab1(skyboxpanel);
1039
+ AddSkyboxTab2(skyboxpanel);
7681040
7691041 // EDIT panel
7701042 editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
....@@ -820,9 +1092,12 @@
8201092
8211093 oe.treePanel.add(copyOptionsPanel);
8221094 oe.treePanel.Return();
1095
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1096
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
1097
+ sliderPane.preferredHeight = 1;
8231098
824
-// mainPanel.setDividerLocation(0.5); //1.0);
825
-// mainPanel.setResizeWeight(0.5);
1099
+// mainPanel.setDividerLocation(0.1); //1.0);
1100
+ mainPanel.setResizeWeight(0.4);
8261101
8271102 //jList.addListSelectionListener(this);
8281103 oe.jTree.addTreeSelectionListener(this);
....@@ -830,7 +1105,7 @@
8301105 //jTree.setEditable(true);
8311106 oe.jTree.setDragEnabled(true);
8321107 //jTree.setPreferredSize(new Dimension(10,10));
833
- jSP.setPreferredSize(new Dimension(100,200));
1108
+ //jSP.setPreferredSize(new Dimension(100,200));
8341109
8351110 oe.jTree.setCellRenderer(new cTreeModel.Renderer());
8361111
....@@ -842,7 +1117,7 @@
8421117 dgr.addDragGestureListener(this);
8431118 }catch(Exception e) {}
8441119 */
845
- radio.layout = sevenButton;
1120
+ radio.layout = sixButton; // sevenButton;
8461121 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
8471122 }
8481123
....@@ -945,9 +1220,9 @@
9451220 toggleSwitchCB.setToolTipText("Choose a single item");
9461221 toggleSwitchCB.addItemListener(this);
9471222
948
- panel.add(autosaveCB = new cCheckBox("Auto-save", Globals.SAVEONMAKE)); //, constraints);
949
- autosaveCB.setToolTipText("On structure change");
950
- autosaveCB.addItemListener(this);
1223
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
1224
+ autokeepCB.setToolTipText("On structure change");
1225
+ autokeepCB.addItemListener(this);
9511226
9521227 panel.Return();
9531228 if (Globals.ADVANCED)
....@@ -984,7 +1259,7 @@
9841259 }
9851260
9861261 radioButton.SetObject(obj);
987
- radioButton.layout = sevenButton;
1262
+ radioButton.layout = sixButton; // sevenButton;
9881263 radioButton.SetCamera(cameraView.renderCamera, false);
9891264 radioButton.addActionListener(this);
9901265 radioPanel.add(radioButton);
....@@ -1024,7 +1299,7 @@
10241299
10251300 cCheckBox oeilCB;
10261301 cCheckBox shadowCB;
1027
- cCheckBox autosaveCB;
1302
+ cCheckBox autokeepCB;
10281303 cCheckBox lookAtCB;
10291304
10301305 // static int COLOR = 1;
....@@ -1136,9 +1411,9 @@
11361411 {
11371412 Globals.FREEZEONMOVE ^= true;
11381413 }
1139
- else if(e.getSource() == autosaveCB)
1414
+ else if(e.getSource() == autokeepCB)
11401415 {
1141
- Globals.SAVEONMAKE ^= true;
1416
+ Globals.REPLACEONMAKE ^= true;
11421417 }
11431418 else if(e.getSource() == lookAtCB)
11441419 {
....@@ -1664,6 +1939,16 @@
16641939 }
16651940 }
16661941 }
1942
+
1943
+ private void EditElement(Object3D elem, boolean newWindow)
1944
+ {
1945
+ // if (!(elem instanceof Composite))
1946
+ // newWindow = false;
1947
+ listUI.add(elem);
1948
+ elem.openEditWindow(this, newWindow); //, false);
1949
+ System.out.println("edit : " + elem);
1950
+ elem.editWindow.refreshContents(true); // ? new
1951
+ }
16671952
16681953 /**
16691954 * applyExample
....@@ -2092,6 +2377,23 @@
20922377 {
20932378 makeSomething(new Light());
20942379 } else
2380
+// if (source == skybox1Button ||
2381
+// source == skybox2Button ||
2382
+// source == skybox3Button ||
2383
+// source == skybox4Button ||
2384
+// source == skybox5Button ||
2385
+// source == skybox6Button ||
2386
+// source == skybox7Button ||
2387
+// source == skybox11Button ||
2388
+// source == skybox12Button ||
2389
+// source == skybox13Button ||
2390
+// source == skybox14Button ||
2391
+// source == skybox15Button ||
2392
+// source == skybox16Button ||
2393
+// source == skybox17Button)
2394
+// {
2395
+// ChangeSkybox(source);
2396
+// } else
20952397 if (source == csgItem)
20962398 {
20972399 group(new CSG());
....@@ -2177,7 +2479,7 @@
21772479 if (source == computeAOItem)
21782480 {
21792481 Globals.drawMode = CameraPane.OCCLUSION;
2180
- Globals.theRenderer.repaint();
2482
+ cameraView.repaint();
21812483 } else
21822484 if (source == recompileItem)
21832485 {
....@@ -2225,15 +2527,29 @@
22252527 } else
22262528 if (source == undoButton)
22272529 {
2228
- if (!Undo())
2229
- java.awt.Toolkit.getDefaultToolkit().beep();
2530
+ // Go to previous version
2531
+ //if (!Undo())
2532
+ //java.awt.Toolkit.getDefaultToolkit().beep();
2533
+ Undo();
2534
+ } else
2535
+ if (source == restoreButton)
2536
+ {
2537
+ // Restore current version
2538
+ Restore();
2539
+ } else
2540
+ if (source == replaceButton)
2541
+ {
2542
+ // Overwrite current version
2543
+ Replace();
22302544 } else
22312545 if (source == redoButton)
22322546 {
2547
+ // Go to next version
22332548 Redo();
22342549 } else
22352550 if (source == saveButton)
22362551 {
2552
+ // Save a new version
22372553 if (!Save(true))
22382554 java.awt.Toolkit.getDefaultToolkit().beep();
22392555 } else
....@@ -2615,7 +2931,7 @@
26152931 {
26162932 StepAll();
26172933 } else
2618
- if (source == clearItem) // || event.getSource() == clearButton)
2934
+ if (source == deleteItem) // || event.getSource() == clearButton)
26192935 {
26202936 //int indices[] = jList.getSelectedIndices();
26212937 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -3097,7 +3413,7 @@
30973413 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
30983414 {
30993415 obj = (Object3D)e.nextElement();
3100
- obj.SetBumpTexture(null);
3416
+ obj.ResetBumpTexture();
31013417 }
31023418
31033419 refreshContents();
....@@ -3111,6 +3427,31 @@
31113427 obj.SetBumpTexture(obj.GetPigmentTexture());
31123428 }
31133429
3430
+ refreshContents();
3431
+ } else
3432
+ if (source == embedTexturesItem)
3433
+ {
3434
+ Object3D obj;
3435
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3436
+ {
3437
+ obj = (Object3D)e.nextElement();
3438
+ obj.EmbedTextures(true);
3439
+ }
3440
+
3441
+ refreshContents();
3442
+ } else
3443
+ if (source == deEmbedTexturesItem)
3444
+ {
3445
+ Object3D obj;
3446
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3447
+ {
3448
+ obj = (Object3D)e.nextElement();
3449
+ obj.EmbedTextures(false);
3450
+ }
3451
+
3452
+ CameraPane.texturepigment.clear();
3453
+ CameraPane.texturebump.clear();
3454
+
31143455 refreshContents();
31153456 } else
31163457 if (source == flashSelectionButton)
....@@ -3214,8 +3555,8 @@
32143555 // centralPanel.setVisible(true);
32153556 // XYZPanel.setVisible(true);
32163557 bigThree.ClearUI();
3558
+ bigThree.add(scenePanel);
32173559 bigThree.add(centralPanel);
3218
- bigThree.add(XYZPanel);
32193560 bigThree.FlushUI();
32203561
32213562 cameraView.requestFocusInWindow();
....@@ -3295,8 +3636,8 @@
32953636 // centralPanel.setVisible(true);
32963637 // XYZPanel.setVisible(false);
32973638 bigThree.ClearUI();
3298
- bigThree.add(scenePanel);
32993639 bigThree.add(centralPanel);
3640
+ bigThree.add(scenePanel);
33003641 bigThree.FlushUI();
33013642
33023643 cameraView.requestFocusInWindow();
....@@ -3479,6 +3820,9 @@
34793820 }
34803821
34813822 copy = group;
3823
+
3824
+ SetUndoStates();
3825
+
34823826 //Globals.theRenderer.object = group;
34833827 if(!useclient)
34843828 {
....@@ -3507,8 +3851,10 @@
35073851 radio.layout.doClick();
35083852
35093853 ClearUnpinned();
3510
- SetPinStates(group.selection.size() > 0);
3511
- if (group.selection.size() == 1)
3854
+ //Grafreed.Assert(group != null);
3855
+ //Grafreed.Assert(group.selection != null);
3856
+ SetPinStates(group.selection == null || group.selection.size() > 0);
3857
+ if (group.selection == null || group.selection.size() == 1)
35123858 EditSelection(false);
35133859 keepparent = group.parent;
35143860 // PARENT = NULL or not???
....@@ -4102,7 +4448,7 @@
41024448
41034449 try
41044450 {
4105
- texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4451
+ texturedata = Globals.theRenderer.GetTextureData(tex, false, node.texres);
41064452 }
41074453 catch (Exception e)
41084454 {
....@@ -4579,6 +4925,12 @@
45794925
45804926 void EditSelection(boolean newWindow)
45814927 {
4928
+ if (group.selection == null)
4929
+ {
4930
+ EditElement(group, newWindow); // ? new
4931
+ return;
4932
+ }
4933
+
45824934 // aConstraints.gridy = 0;
45834935 for (int i=0; i<group.selection.size(); i++)
45844936 {
....@@ -4589,12 +4941,7 @@
45894941 Object3D elem = (Object3D)group.selection.elementAt(i);
45904942 if(elem != group || !newWindow)
45914943 {
4592
- // if (!(elem instanceof Composite))
4593
- // newWindow = false;
4594
- listUI.add(elem);
4595
- elem.openEditWindow(this, newWindow); //, false);
4596
- System.out.println("edit : " + elem);
4597
- elem.editWindow.refreshContents(true); // ? new
4944
+ EditElement(elem, newWindow); // ? new
45984945 }
45994946 }
46004947 }
....@@ -4738,7 +5085,7 @@
47385085
47395086 void refreshContents(boolean cp)
47405087 {
4741
- if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
5088
+ if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
47425089 if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
47435090 {
47445091 objEditor.ClearInfo(); // .GetMaterial());
....@@ -4942,10 +5289,10 @@
49425289
49435290 void paste(boolean expand)
49445291 {
4945
- if (Globals.SAVEONMAKE)
5292
+ if (Globals.REPLACEONMAKE)
49465293 Save();
4947
- boolean keep = Globals.SAVEONMAKE;
4948
- Globals.SAVEONMAKE = false;
5294
+ boolean keep = Globals.REPLACEONMAKE;
5295
+ Globals.REPLACEONMAKE = false;
49495296 // if (GrafreeD.clipboard == null)
49505297 // return;
49515298 boolean first = true;
....@@ -5005,7 +5352,7 @@
50055352 Grafreed.clipboard.get(0).parent = keepparent;
50065353 }
50075354
5008
- Globals.SAVEONMAKE = keep;
5355
+ Globals.REPLACEONMAKE = keep;
50095356 ResetModel();
50105357 refreshContents();
50115358 }
....@@ -5141,10 +5488,10 @@
51415488
51425489 void group(Object3D csg, boolean grab)
51435490 {
5144
- if (Globals.SAVEONMAKE)
5491
+ if (Globals.REPLACEONMAKE)
51455492 Save();
5146
- boolean keep = Globals.SAVEONMAKE;
5147
- Globals.SAVEONMAKE = false;
5493
+ boolean keep = Globals.REPLACEONMAKE;
5494
+ Globals.REPLACEONMAKE = false;
51485495 if (//false) // why??
51495496 !group.selection.isEmpty())
51505497 {
....@@ -5258,15 +5605,15 @@
52585605 //node.add(csg);
52595606 //makeSomething(node);
52605607 makeSomething(csg);
5261
- Globals.SAVEONMAKE = keep;
5608
+ Globals.REPLACEONMAKE = keep;
52625609 }
52635610
52645611 void Ungroup(Object3D g)
52655612 {
5266
- if (Globals.SAVEONMAKE)
5613
+ if (Globals.REPLACEONMAKE)
52675614 Save();
5268
- boolean keep = Globals.SAVEONMAKE;
5269
- Globals.SAVEONMAKE = false;
5615
+ boolean keep = Globals.REPLACEONMAKE;
5616
+ Globals.REPLACEONMAKE = false;
52705617 if (g instanceof HiddenObject)
52715618 {
52725619 HiddenObject h = (HiddenObject) g;
....@@ -5283,7 +5630,7 @@
52835630 objEditor.makeSomething(g.get(i), false);
52845631 }
52855632 }
5286
- Globals.SAVEONMAKE = keep;
5633
+ Globals.REPLACEONMAKE = keep;
52875634 }
52885635
52895636 void ungroup()
....@@ -5584,6 +5931,22 @@
55845931 cButton loopButton;
55855932 cButton textureButton;
55865933
5934
+ cButton skybox1Button;
5935
+ cButton skybox2Button;
5936
+ cButton skybox3Button;
5937
+ cButton skybox4Button;
5938
+ cButton skybox5Button;
5939
+ cButton skybox6Button;
5940
+ cButton skybox7Button;
5941
+
5942
+ cButton skybox11Button;
5943
+ cButton skybox12Button;
5944
+ cButton skybox13Button;
5945
+ cButton skybox14Button;
5946
+ cButton skybox15Button;
5947
+ cButton skybox16Button;
5948
+ cButton skybox17Button;
5949
+
55875950 cButton gridButton;
55885951 cButton boxButton;
55895952 cButton sphereButton;
....@@ -5647,7 +6010,7 @@
56476010 private MenuItem pasteLinkItem;
56486011 private MenuItem pasteCloneItem;
56496012 private MenuItem pasteExpandItem;
5650
- private MenuItem clearItem;
6013
+ private MenuItem deleteItem;
56516014 private MenuItem clearAllItem;
56526015 private MenuItem genUVItem;
56536016 private MenuItem genNormalsMESHItem;
....@@ -5731,6 +6094,8 @@
57316094 private MenuItem attachBumpItem;
57326095 private MenuItem detachBumpItem;
57336096 private MenuItem pigmentBumpItem;
6097
+ private MenuItem embedTexturesItem;
6098
+ private MenuItem deEmbedTexturesItem;
57346099
57356100 private MenuItem particleItem;
57366101 private MenuItem ragdollItem;