Normand Briere
2019-07-30 475f8cbdbd96fdbf8f5b216ffebb31a51f25c2f9
GroupEditor.java
....@@ -23,6 +23,240 @@
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 + "/preview.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("penguins", "dust", row0);
62
+ AddSkyboxButton("penguins", "tropic", row0);
63
+ AddSkyboxButton("default", "skycube", row0);
64
+
65
+ AddSkyboxButton("default", "uffizi", row1);
66
+ AddSkyboxButton("bridge", "Bridge", row1);
67
+ AddSkyboxButton("bridge", "Bridge2", row1);
68
+ AddSkyboxButton("urban", "GamlaStan2", row1);
69
+
70
+ AddSkyboxButton("urban", "Parliament", row2);
71
+ AddSkyboxButton("urban", "Roundabout", row2);
72
+ AddSkyboxButton("urban", "SaintLazarusChurch", row2);
73
+ AddSkyboxButton("urban", "SaintLazarusChurch2", row2);
74
+
75
+ AddSkyboxButton("urban", "SaintLazarusChurch3", row3);
76
+ AddSkyboxButton("urban", "UnionSquare", row3);
77
+ AddSkyboxButton("urban", "Medborgarplatsen", row3);
78
+ AddSkyboxButton("park", "BerzeliiPark", row3);
79
+
80
+ AddSkyboxButton("park", "Buddha", row4);
81
+ AddSkyboxButton("park", "CNTower2", row4);
82
+ AddSkyboxButton("park", "NiagaraFalls1", row4);
83
+ AddSkyboxButton("park", "NiagaraFalls3", row4);
84
+
85
+ AddSkyboxButton("park", "Park", row5);
86
+ AddSkyboxButton("park", "Pond", row5);
87
+ AddSkyboxButton("park", "Skansen", row5);
88
+ AddSkyboxButton("park", "Skansen2", row5);
89
+
90
+ AddSkyboxButton("park", "Skansen3", row6);
91
+ AddSkyboxButton("park", "Skansen4", row6);
92
+ AddSkyboxButton("park", "Skansen5", row6);
93
+ AddSkyboxButton("park", "Stairs", row6);
94
+
95
+ tab0.add(row0);
96
+ tab0.add(row1);
97
+ tab0.add(row2);
98
+ tab0.add(row3);
99
+ tab0.add(row4);
100
+ tab0.add(row5);
101
+ tab0.add(row6);
102
+
103
+ for (int i=5; --i>=0;)
104
+ {
105
+ //oe.toolboxPanel.Return();
106
+ //tab0.add(new cGridBag());
107
+ }
108
+ }
109
+
110
+ public void AddSkyboxTab1(JTabbedPane skyboxpanel)
111
+ {
112
+ cGridBag tab0 = new cGridBag().setVertical(true);
113
+
114
+ tab0.setName("Nature");
115
+ skyboxpanel.add(tab0);
116
+
117
+ cGridBag row0 = new cGridBag();
118
+ cGridBag row1 = new cGridBag();
119
+ cGridBag row2 = new cGridBag();
120
+ cGridBag row3 = new cGridBag();
121
+ cGridBag row4 = new cGridBag();
122
+ cGridBag row5 = new cGridBag();
123
+ cGridBag row6 = new cGridBag();
124
+
125
+ AddSkyboxButton("beach", "HeartInTheSand", row0);
126
+ AddSkyboxButton("beach", "LarnacaBeach", row0);
127
+ AddSkyboxButton("beach", "PalmTrees", row0);
128
+ AddSkyboxButton("beach", "Tenerife", row0);
129
+
130
+ AddSkyboxButton("beach", "Tenerife2", row1);
131
+ AddSkyboxButton("beach", "Tenerife3", row1);
132
+ AddSkyboxButton("field", "FishPond", row1);
133
+ AddSkyboxButton("field", "Footballfield", row1);
134
+
135
+ AddSkyboxButton("field", "Meadow", row2);
136
+ AddSkyboxButton("field", "Sorsele", row2);
137
+ AddSkyboxButton("field", "Sorsele2", row2);
138
+ AddSkyboxButton("field", "Sorsele3", row2);
139
+
140
+ AddSkyboxButton("forest", "Brudslojan", row3);
141
+ AddSkyboxButton("forest", "Langholmen2", row3);
142
+ AddSkyboxButton("forest", "Plants", row3);
143
+ AddSkyboxButton("mountain", "Maskonaive", row3);
144
+
145
+ AddSkyboxButton("mountain", "Maskonaive2", row4);
146
+ AddSkyboxButton("mountain", "Maskonaive3", row4);
147
+ AddSkyboxButton("mountain", "Ryfjallet", row4);
148
+ AddSkyboxButton("mountain", "Teide", row4);
149
+ AddSkyboxButton("park", "Tantolunden4", row4);
150
+
151
+ AddSkyboxButton("penguins", "wrath", row5);
152
+ AddSkyboxButton("penguins", "yonder", row5);
153
+ AddSkyboxButton("rocky", "Langholmen", row5);
154
+ AddSkyboxButton("rocky", "Skinnarviksberget", row5);
155
+ AddSkyboxButton("rocky", "Tantolunden6", row5);
156
+
157
+ AddSkyboxButton("default", "CloudyHills", row6);
158
+ AddSkyboxButton("daz", "Autumn", row6);
159
+ AddSkyboxButton("daz", "Greenlands", row6);
160
+ AddSkyboxButton("daz", "MountainTrail", row6);
161
+ AddSkyboxButton("daz", "Oasis", row6);
162
+ /*
163
+Autumn
164
+Greenlands
165
+MountainTrail
166
+Oasis
167
+TheRock
168
+TopOfTheWorld
169
+Winter
170
+ */
171
+
172
+ tab0.add(row0);
173
+ tab0.add(row1);
174
+ tab0.add(row2);
175
+ tab0.add(row3);
176
+ tab0.add(row4);
177
+ tab0.add(row5);
178
+ tab0.add(row6);
179
+
180
+ for (int i=5; --i>=0;)
181
+ {
182
+ //oe.toolboxPanel.Return();
183
+ //tab0.add(new cGridBag());
184
+ }
185
+ }
186
+
187
+ public void AddSkyboxTab2(JTabbedPane skyboxpanel)
188
+ {
189
+ cGridBag tab0 = new cGridBag().setVertical(true);
190
+
191
+ tab0.setName("Night");
192
+ skyboxpanel.add(tab0);
193
+
194
+ cGridBag row0 = new cGridBag();
195
+ cGridBag row1 = new cGridBag();
196
+ cGridBag row2 = new cGridBag();
197
+ cGridBag row3 = new cGridBag();
198
+ cGridBag row4 = new cGridBag();
199
+ cGridBag row5 = new cGridBag();
200
+ cGridBag row6 = new cGridBag();
201
+
202
+ AddSkyboxButton("night", "NightPath", row0);
203
+ AddSkyboxButton("night", "PondNight", row0);
204
+ AddSkyboxButton("night", "Powerlines", row0);
205
+ AddSkyboxButton("night", "SwedishRoyalCastle", row0);
206
+
207
+ AddSkyboxButton("urban", "CNTower", row1);
208
+ AddSkyboxButton("bridge", "ArstaBridge", row1);
209
+ AddSkyboxButton("rocky", "Riddarfjarden", row1);
210
+ AddSkyboxButton("penguins", "sleepyhollow", row1);
211
+
212
+ AddSkyboxButton("penguins", "kenon_star", row2);
213
+ AddSkyboxButton("indoors", "DallasW", row2);
214
+ AddSkyboxButton("indoors", "MarriottMadisonWest", row2);
215
+ AddSkyboxButton("indoors", "Vasa", row2);
216
+
217
+ AddSkyboxButton("winter", "Backyard", row3);
218
+ AddSkyboxButton("winter", "Creek", row3);
219
+ AddSkyboxButton("winter", "FootballField3", row3);
220
+ AddSkyboxButton("winter", "Forest", row3);
221
+
222
+ AddSkyboxButton("winter", "HornstullsStrand2", row4);
223
+ AddSkyboxButton("winter", "House", row4);
224
+ AddSkyboxButton("winter", "IceLake", row4);
225
+ AddSkyboxButton("winter", "IceRiver", row4);
226
+
227
+ AddSkyboxButton("winter", "Park3", row5);
228
+ AddSkyboxButton("winter", "PondWinter", row5);
229
+ AddSkyboxButton("winter", "Tantolunden5", row5);
230
+ AddSkyboxButton("winter", "Vindelalven", row5);
231
+
232
+ AddSkyboxButton("daz", "TheRock", row6);
233
+ AddSkyboxButton("daz", "TopOfTheWorld", row6);
234
+ AddSkyboxButton("daz", "Winter", row6);
235
+ AddSkyboxButton("penguins", "desertdawn", row6);
236
+
237
+ tab0.add(row0);
238
+ tab0.add(row1);
239
+ tab0.add(row2);
240
+ tab0.add(row3);
241
+ tab0.add(row4);
242
+ tab0.add(row5);
243
+ tab0.add(row6);
244
+
245
+ for (int i=5; --i>=0;)
246
+ {
247
+ //oe.toolboxPanel.Return();
248
+ //tab0.add(new cGridBag());
249
+ }
250
+ }
251
+
252
+ public void ChangeSkybox(String name)
253
+ {
254
+ //cameraView.envyoff = false;
255
+ group.skyboxname = name;
256
+ group.skyboxext = "jpg";
257
+ cameraView.repaint();
258
+ }
259
+
26260 //ObjEditor objEditor;
27261 public void closeUI2()
28262 {
....@@ -60,6 +294,12 @@
60294 this.copy = this.group = group;
61295 //selectees = this.group.selectees;
62296
297
+ if (copy.versions == null)
298
+ {
299
+ copy.versions = new byte[100][];
300
+ copy.versionindex = -1;
301
+ }
302
+
63303 if(ui)
64304 SetupUI(objEditor);
65305 }
....@@ -80,14 +320,22 @@
80320 SetupViews(objEditor);
81321
82322 ((cRadio)radioPanel.getComponent(0)).SetCamera(cameraView.renderCamera, true);
323
+
324
+ if (copy.versions == null)
325
+ {
326
+ copy.versions = new byte[100][];
327
+ copy.versionindex = -1;
328
+
329
+ Save(true);
330
+ }
83331 }
84332
85333 void CloneSelection(boolean supports)
86334 {
87
- if (Globals.SAVEONMAKE)
335
+ if (Globals.REPLACEONMAKE)
88336 Save();
89
- boolean keep = Globals.SAVEONMAKE;
90
- Globals.SAVEONMAKE = false;
337
+ boolean keep = Globals.REPLACEONMAKE;
338
+ Globals.REPLACEONMAKE = false;
91339 // Object3D keep = GrafreeD.clipboard;
92340 //Object3D obj;
93341 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -98,7 +346,7 @@
98346
99347 makeSomething(clone, i==group.selection.size()-1);
100348 }
101
- Globals.SAVEONMAKE = keep;
349
+ Globals.REPLACEONMAKE = keep;
102350 }
103351
104352 void CloneClipboard(boolean supports)
....@@ -194,8 +442,8 @@
194442 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
195443 // pasteExpandItem.addActionListener(this);
196444 menu.add("-");
197
- clearItem = menu.add(new MenuItem("Clear"));
198
- clearItem.addActionListener(this);
445
+ deleteItem = menu.add(new MenuItem("Delete"));
446
+ deleteItem.addActionListener(this);
199447
200448 if (Globals.ADVANCED)
201449 {
....@@ -421,7 +669,7 @@
421669 genNormalsMESHItem.addActionListener(this);
422670 if (Globals.ADVANCED)
423671 {
424
- genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
672
+ genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
425673 genNormalsMINEItem.addActionListener(this);
426674 }
427675 stripifyItem = menu.add(new MenuItem("Stripify"));
....@@ -514,10 +762,15 @@
514762 attachBumpItem.addActionListener(this);
515763 pigmentBumpItem = menu.add(new MenuItem("Pigment -> Bump"));
516764 pigmentBumpItem.addActionListener(this);
765
+ //embedTexturesItem
517766 detachPigmentItem = menu.add(new MenuItem("Detach Pigment"));
518767 detachPigmentItem.addActionListener(this);
519768 detachBumpItem = menu.add(new MenuItem("Detach Bump"));
520769 detachBumpItem.addActionListener(this);
770
+ embedTexturesItem = menu.add(new MenuItem("Embed Textures"));
771
+ embedTexturesItem.addActionListener(this);
772
+ deEmbedTexturesItem = menu.add(new MenuItem("De-embed Textures"));
773
+ deEmbedTexturesItem.addActionListener(this);
521774 menu.add("-");
522775 sortbysizeItem = menu.add(new MenuItem("Sort by size"));
523776 sortbysizeItem.addActionListener(this);
....@@ -544,6 +797,7 @@
544797 buildToolsMenu(menu);
545798 }
546799
800
+
547801 void SetupUI2(ObjEditor oe)
548802 {
549803 // June 2019
....@@ -588,7 +842,7 @@
588842 */
589843 cGridBag copyOptionsPanel = new cGridBag();
590844
591
- copyOptionsPanel.preferredHeight = 1;
845
+ copyOptionsPanel.preferredHeight = 2;
592846
593847 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
594848
....@@ -615,29 +869,42 @@
615869 restoreCameraButton.setToolTipText("Restore viewpoint");
616870 restoreCameraButton.addActionListener(this);
617871
872
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
873
+ saveButton.setToolTipText("New version");
874
+ saveButton.addActionListener(this);
875
+
618876 copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
619
- undoButton.setToolTipText("Undo changes");
877
+ undoButton.setToolTipText("Previous version");
620878 undoButton.addActionListener(this);
621879 undoButton.setEnabled(false);
622880
881
+ cGridBag updown = new cGridBag().setVertical(true);
882
+ updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
883
+ restoreButton.setToolTipText("Restore current");
884
+ restoreButton.addActionListener(this);
885
+ restoreButton.setEnabled(false);
886
+
887
+ updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
888
+ replaceButton.setToolTipText("Replace current");
889
+ replaceButton.addActionListener(this);
890
+ replaceButton.setEnabled(false);
891
+
892
+ copyOptionsPanel.add(updown);
893
+
623894 copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
624
- redoButton.setToolTipText("Redo changes");
895
+ redoButton.setToolTipText("Next version");
625896 redoButton.addActionListener(this);
626897 redoButton.setEnabled(false);
627898
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);
899
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
633900 liveCB.setToolTipText("Enable animation");
634901 liveCB.addItemListener(this);
635902
636
- copyOptionsPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
903
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
637904 oneStepButton.setToolTipText("Animate one step forward");
638905 oneStepButton.addActionListener(this);
639906
640
- copyOptionsPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
907
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
641908 fastCB.setToolTipText("Fast mode");
642909 fastCB.addItemListener(this);
643910
....@@ -655,31 +922,32 @@
655922 oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
656923 snapobjectButton.addActionListener(this);
657924 snapobjectButton.setToolTipText("Snap Object");
925
+
926
+ oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
927
+ fourButton.addActionListener(this);
928
+ fourButton.setToolTipText("Show control panel only");
658929 }
659930
660931 //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
661932
662
- oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
663
- twoButton.setToolTipText("Show center view only");
933
+ oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
934
+ twoButton.setToolTipText("Show 3D view only");
664935 twoButton.addActionListener(this);
665936 this.fullscreenLayout = twoButton;
666937
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");
938
+ oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
939
+ threeButton.setToolTipText("Show controls and 3D view");
675940 threeButton.addActionListener(this);
676
- oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
677
- sevenButton.setToolTipText("3-column layout");
678
- sevenButton.addActionListener(this);
941
+ oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
942
+ sixButton.setToolTipText("Show 3D view and controls");
943
+ sixButton.addActionListener(this);
944
+// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
945
+// sevenButton.setToolTipText("3-column layout");
946
+// sevenButton.addActionListener(this);
679947 //
680948
681
- oe.toolbarPanel.add(rootButton = GetButton("icons/write.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
682
- rootButton.setToolTipText("Edit selection in new tab");
949
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
950
+ rootButton.setToolTipText("Open selection in new tab");
683951 rootButton.addActionListener(this);
684952
685953 oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
....@@ -688,28 +956,30 @@
688956 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
689957 //clearButton.addActionListener(this);
690958
959
+ cGridBag row1 = new cGridBag();
960
+
691961 // INSERT
692
- oe.toolboxPanel.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
962
+ row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
693963 gridButton.setToolTipText("Create grid");
694964 gridButton.addActionListener(this);
695965
696
- oe.toolboxPanel.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
966
+ row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
697967 boxButton.setToolTipText("Create box");
698968 boxButton.addActionListener(this);
699969
700
- oe.toolboxPanel.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
970
+ row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
701971 sphereButton.setToolTipText("Create sphere");
702972 sphereButton.addActionListener(this);
703973
704
- oe.toolboxPanel.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
974
+ row1.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
705975 coneButton.setToolTipText("Create cone");
706976 coneButton.addActionListener(this);
707977
708
- oe.toolboxPanel.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
978
+ row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
709979 torusButton.setToolTipText("Create torus");
710980 torusButton.addActionListener(this);
711981
712
- oe.toolboxPanel.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
982
+ row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
713983 superButton.setToolTipText("Create superellipsoid");
714984 superButton.addActionListener(this);
715985
....@@ -720,51 +990,56 @@
720990 kleinButton.addActionListener(this);
721991 }
722992
723
- oe.toolboxPanel.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
993
+ row1.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
724994 particlesButton.setToolTipText("Create particle system");
725995 particlesButton.addActionListener(this);
726996
727
- oe.toolboxPanel.Return();
997
+ oe.toolboxPanel.add(row1);
728998
729
- oe.toolboxPanel.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
999
+ cGridBag row2 = new cGridBag();
1000
+
1001
+ row2.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
7301002 groupButton.setToolTipText("Create group");
7311003 groupButton.addActionListener(this);
7321004
733
- oe.toolboxPanel.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1005
+ row2.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
7341006 compositeButton.setToolTipText("Create composite");
7351007 compositeButton.addActionListener(this);
7361008
737
- oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1009
+ row2.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
7381010 switchButton.setToolTipText("Create item switcher");
7391011 switchButton.addActionListener(this);
7401012
741
- oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1013
+ row2.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
7421014 loopButton.setToolTipText("Create loop");
7431015 loopButton.addActionListener(this);
7441016
745
- oe.toolboxPanel.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1017
+ row2.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
7461018 textureButton.setToolTipText("Create texture");
7471019 textureButton.addActionListener(this);
7481020
749
- oe.toolboxPanel.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1021
+ row2.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
7501022 overlayButton.setToolTipText("Create overlay");
7511023 overlayButton.addActionListener(this);
7521024
753
- oe.toolboxPanel.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1025
+ row2.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
7541026 lightButton.setToolTipText("Create light");
7551027 lightButton.addActionListener(this);
7561028
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
- }
1029
+ oe.toolboxPanel.add(row2);
1030
+
1031
+ // ENVYMAPS
1032
+ cGridBag skyboxpane = new cGridBag();
1033
+ skyboxpane.preferredHeight = 100;
1034
+
1035
+ oe.toolboxPanel.add(skyboxpane);
1036
+
1037
+ JTabbedPane skyboxpanel = new JTabbedPane();
1038
+ skyboxpane.add(skyboxpanel);
1039
+
1040
+ AddSkyboxTab0(skyboxpanel);
1041
+ AddSkyboxTab1(skyboxpanel);
1042
+ AddSkyboxTab2(skyboxpanel);
7681043
7691044 // EDIT panel
7701045 editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
....@@ -820,9 +1095,12 @@
8201095
8211096 oe.treePanel.add(copyOptionsPanel);
8221097 oe.treePanel.Return();
1098
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1099
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
1100
+ sliderPane.preferredHeight = 1;
8231101
824
-// mainPanel.setDividerLocation(0.5); //1.0);
825
-// mainPanel.setResizeWeight(0.5);
1102
+// mainPanel.setDividerLocation(0.1); //1.0);
1103
+ mainPanel.setResizeWeight(0.4);
8261104
8271105 //jList.addListSelectionListener(this);
8281106 oe.jTree.addTreeSelectionListener(this);
....@@ -830,7 +1108,7 @@
8301108 //jTree.setEditable(true);
8311109 oe.jTree.setDragEnabled(true);
8321110 //jTree.setPreferredSize(new Dimension(10,10));
833
- jSP.setPreferredSize(new Dimension(100,200));
1111
+ //jSP.setPreferredSize(new Dimension(100,200));
8341112
8351113 oe.jTree.setCellRenderer(new cTreeModel.Renderer());
8361114
....@@ -842,7 +1120,7 @@
8421120 dgr.addDragGestureListener(this);
8431121 }catch(Exception e) {}
8441122 */
845
- radio.layout = sevenButton;
1123
+ radio.layout = sixButton; // sevenButton;
8461124 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
8471125 }
8481126
....@@ -945,9 +1223,9 @@
9451223 toggleSwitchCB.setToolTipText("Choose a single item");
9461224 toggleSwitchCB.addItemListener(this);
9471225
948
- panel.add(autosaveCB = new cCheckBox("Auto-save", Globals.SAVEONMAKE)); //, constraints);
949
- autosaveCB.setToolTipText("On structure change");
950
- autosaveCB.addItemListener(this);
1226
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
1227
+ autokeepCB.setToolTipText("On structure change");
1228
+ autokeepCB.addItemListener(this);
9511229
9521230 panel.Return();
9531231 if (Globals.ADVANCED)
....@@ -984,7 +1262,7 @@
9841262 }
9851263
9861264 radioButton.SetObject(obj);
987
- radioButton.layout = sevenButton;
1265
+ radioButton.layout = sixButton; // sevenButton;
9881266 radioButton.SetCamera(cameraView.renderCamera, false);
9891267 radioButton.addActionListener(this);
9901268 radioPanel.add(radioButton);
....@@ -1024,7 +1302,7 @@
10241302
10251303 cCheckBox oeilCB;
10261304 cCheckBox shadowCB;
1027
- cCheckBox autosaveCB;
1305
+ cCheckBox autokeepCB;
10281306 cCheckBox lookAtCB;
10291307
10301308 // static int COLOR = 1;
....@@ -1136,9 +1414,9 @@
11361414 {
11371415 Globals.FREEZEONMOVE ^= true;
11381416 }
1139
- else if(e.getSource() == autosaveCB)
1417
+ else if(e.getSource() == autokeepCB)
11401418 {
1141
- Globals.SAVEONMAKE ^= true;
1419
+ Globals.REPLACEONMAKE ^= true;
11421420 }
11431421 else if(e.getSource() == lookAtCB)
11441422 {
....@@ -1664,6 +1942,16 @@
16641942 }
16651943 }
16661944 }
1945
+
1946
+ private void EditElement(Object3D elem, boolean newWindow)
1947
+ {
1948
+ // if (!(elem instanceof Composite))
1949
+ // newWindow = false;
1950
+ listUI.add(elem);
1951
+ elem.openEditWindow(this, newWindow); //, false);
1952
+ System.out.println("edit : " + elem);
1953
+ elem.editWindow.refreshContents(true); // ? new
1954
+ }
16671955
16681956 /**
16691957 * applyExample
....@@ -2092,6 +2380,23 @@
20922380 {
20932381 makeSomething(new Light());
20942382 } else
2383
+// if (source == skybox1Button ||
2384
+// source == skybox2Button ||
2385
+// source == skybox3Button ||
2386
+// source == skybox4Button ||
2387
+// source == skybox5Button ||
2388
+// source == skybox6Button ||
2389
+// source == skybox7Button ||
2390
+// source == skybox11Button ||
2391
+// source == skybox12Button ||
2392
+// source == skybox13Button ||
2393
+// source == skybox14Button ||
2394
+// source == skybox15Button ||
2395
+// source == skybox16Button ||
2396
+// source == skybox17Button)
2397
+// {
2398
+// ChangeSkybox(source);
2399
+// } else
20952400 if (source == csgItem)
20962401 {
20972402 group(new CSG());
....@@ -2177,7 +2482,7 @@
21772482 if (source == computeAOItem)
21782483 {
21792484 Globals.drawMode = CameraPane.OCCLUSION;
2180
- Globals.theRenderer.repaint();
2485
+ cameraView.repaint();
21812486 } else
21822487 if (source == recompileItem)
21832488 {
....@@ -2225,15 +2530,29 @@
22252530 } else
22262531 if (source == undoButton)
22272532 {
2228
- if (!Undo())
2229
- java.awt.Toolkit.getDefaultToolkit().beep();
2533
+ // Go to previous version
2534
+ //if (!Undo())
2535
+ //java.awt.Toolkit.getDefaultToolkit().beep();
2536
+ Undo();
2537
+ } else
2538
+ if (source == restoreButton)
2539
+ {
2540
+ // Restore current version
2541
+ Restore();
2542
+ } else
2543
+ if (source == replaceButton)
2544
+ {
2545
+ // Overwrite current version
2546
+ Replace();
22302547 } else
22312548 if (source == redoButton)
22322549 {
2550
+ // Go to next version
22332551 Redo();
22342552 } else
22352553 if (source == saveButton)
22362554 {
2555
+ // Save a new version
22372556 if (!Save(true))
22382557 java.awt.Toolkit.getDefaultToolkit().beep();
22392558 } else
....@@ -2615,7 +2934,7 @@
26152934 {
26162935 StepAll();
26172936 } else
2618
- if (source == clearItem) // || event.getSource() == clearButton)
2937
+ if (source == deleteItem) // || event.getSource() == clearButton)
26192938 {
26202939 //int indices[] = jList.getSelectedIndices();
26212940 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -3097,7 +3416,7 @@
30973416 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
30983417 {
30993418 obj = (Object3D)e.nextElement();
3100
- obj.SetBumpTexture(null);
3419
+ obj.ResetBumpTexture();
31013420 }
31023421
31033422 refreshContents();
....@@ -3111,6 +3430,31 @@
31113430 obj.SetBumpTexture(obj.GetPigmentTexture());
31123431 }
31133432
3433
+ refreshContents();
3434
+ } else
3435
+ if (source == embedTexturesItem)
3436
+ {
3437
+ Object3D obj;
3438
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3439
+ {
3440
+ obj = (Object3D)e.nextElement();
3441
+ obj.EmbedTextures(true);
3442
+ }
3443
+
3444
+ refreshContents();
3445
+ } else
3446
+ if (source == deEmbedTexturesItem)
3447
+ {
3448
+ Object3D obj;
3449
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3450
+ {
3451
+ obj = (Object3D)e.nextElement();
3452
+ obj.EmbedTextures(false);
3453
+ }
3454
+
3455
+ CameraPane.texturepigment.clear();
3456
+ CameraPane.texturebump.clear();
3457
+
31143458 refreshContents();
31153459 } else
31163460 if (source == flashSelectionButton)
....@@ -3214,8 +3558,8 @@
32143558 // centralPanel.setVisible(true);
32153559 // XYZPanel.setVisible(true);
32163560 bigThree.ClearUI();
3561
+ bigThree.add(scenePanel);
32173562 bigThree.add(centralPanel);
3218
- bigThree.add(XYZPanel);
32193563 bigThree.FlushUI();
32203564
32213565 cameraView.requestFocusInWindow();
....@@ -3295,8 +3639,8 @@
32953639 // centralPanel.setVisible(true);
32963640 // XYZPanel.setVisible(false);
32973641 bigThree.ClearUI();
3298
- bigThree.add(scenePanel);
32993642 bigThree.add(centralPanel);
3643
+ bigThree.add(scenePanel);
33003644 bigThree.FlushUI();
33013645
33023646 cameraView.requestFocusInWindow();
....@@ -3479,6 +3823,9 @@
34793823 }
34803824
34813825 copy = group;
3826
+
3827
+ SetUndoStates();
3828
+
34823829 //Globals.theRenderer.object = group;
34833830 if(!useclient)
34843831 {
....@@ -3507,8 +3854,10 @@
35073854 radio.layout.doClick();
35083855
35093856 ClearUnpinned();
3510
- SetPinStates(group.selection.size() > 0);
3511
- if (group.selection.size() == 1)
3857
+ //Grafreed.Assert(group != null);
3858
+ //Grafreed.Assert(group.selection != null);
3859
+ SetPinStates(group.selection == null || group.selection.size() > 0);
3860
+ if (group.selection == null || group.selection.size() == 1)
35123861 EditSelection(false);
35133862 keepparent = group.parent;
35143863 // PARENT = NULL or not???
....@@ -4102,7 +4451,7 @@
41024451
41034452 try
41044453 {
4105
- texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4454
+ texturedata = Globals.theRenderer.GetTextureData(tex, false, node.texres);
41064455 }
41074456 catch (Exception e)
41084457 {
....@@ -4579,6 +4928,12 @@
45794928
45804929 void EditSelection(boolean newWindow)
45814930 {
4931
+ if (group.selection == null)
4932
+ {
4933
+ EditElement(group, newWindow); // ? new
4934
+ return;
4935
+ }
4936
+
45824937 // aConstraints.gridy = 0;
45834938 for (int i=0; i<group.selection.size(); i++)
45844939 {
....@@ -4589,12 +4944,7 @@
45894944 Object3D elem = (Object3D)group.selection.elementAt(i);
45904945 if(elem != group || !newWindow)
45914946 {
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
4947
+ EditElement(elem, newWindow); // ? new
45984948 }
45994949 }
46004950 }
....@@ -4738,7 +5088,7 @@
47385088
47395089 void refreshContents(boolean cp)
47405090 {
4741
- if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
5091
+ if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
47425092 if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
47435093 {
47445094 objEditor.ClearInfo(); // .GetMaterial());
....@@ -4942,10 +5292,10 @@
49425292
49435293 void paste(boolean expand)
49445294 {
4945
- if (Globals.SAVEONMAKE)
5295
+ if (Globals.REPLACEONMAKE)
49465296 Save();
4947
- boolean keep = Globals.SAVEONMAKE;
4948
- Globals.SAVEONMAKE = false;
5297
+ boolean keep = Globals.REPLACEONMAKE;
5298
+ Globals.REPLACEONMAKE = false;
49495299 // if (GrafreeD.clipboard == null)
49505300 // return;
49515301 boolean first = true;
....@@ -5005,7 +5355,7 @@
50055355 Grafreed.clipboard.get(0).parent = keepparent;
50065356 }
50075357
5008
- Globals.SAVEONMAKE = keep;
5358
+ Globals.REPLACEONMAKE = keep;
50095359 ResetModel();
50105360 refreshContents();
50115361 }
....@@ -5141,10 +5491,10 @@
51415491
51425492 void group(Object3D csg, boolean grab)
51435493 {
5144
- if (Globals.SAVEONMAKE)
5494
+ if (Globals.REPLACEONMAKE)
51455495 Save();
5146
- boolean keep = Globals.SAVEONMAKE;
5147
- Globals.SAVEONMAKE = false;
5496
+ boolean keep = Globals.REPLACEONMAKE;
5497
+ Globals.REPLACEONMAKE = false;
51485498 if (//false) // why??
51495499 !group.selection.isEmpty())
51505500 {
....@@ -5258,15 +5608,15 @@
52585608 //node.add(csg);
52595609 //makeSomething(node);
52605610 makeSomething(csg);
5261
- Globals.SAVEONMAKE = keep;
5611
+ Globals.REPLACEONMAKE = keep;
52625612 }
52635613
52645614 void Ungroup(Object3D g)
52655615 {
5266
- if (Globals.SAVEONMAKE)
5616
+ if (Globals.REPLACEONMAKE)
52675617 Save();
5268
- boolean keep = Globals.SAVEONMAKE;
5269
- Globals.SAVEONMAKE = false;
5618
+ boolean keep = Globals.REPLACEONMAKE;
5619
+ Globals.REPLACEONMAKE = false;
52705620 if (g instanceof HiddenObject)
52715621 {
52725622 HiddenObject h = (HiddenObject) g;
....@@ -5283,7 +5633,7 @@
52835633 objEditor.makeSomething(g.get(i), false);
52845634 }
52855635 }
5286
- Globals.SAVEONMAKE = keep;
5636
+ Globals.REPLACEONMAKE = keep;
52875637 }
52885638
52895639 void ungroup()
....@@ -5584,6 +5934,22 @@
55845934 cButton loopButton;
55855935 cButton textureButton;
55865936
5937
+ cButton skybox1Button;
5938
+ cButton skybox2Button;
5939
+ cButton skybox3Button;
5940
+ cButton skybox4Button;
5941
+ cButton skybox5Button;
5942
+ cButton skybox6Button;
5943
+ cButton skybox7Button;
5944
+
5945
+ cButton skybox11Button;
5946
+ cButton skybox12Button;
5947
+ cButton skybox13Button;
5948
+ cButton skybox14Button;
5949
+ cButton skybox15Button;
5950
+ cButton skybox16Button;
5951
+ cButton skybox17Button;
5952
+
55875953 cButton gridButton;
55885954 cButton boxButton;
55895955 cButton sphereButton;
....@@ -5647,7 +6013,7 @@
56476013 private MenuItem pasteLinkItem;
56486014 private MenuItem pasteCloneItem;
56496015 private MenuItem pasteExpandItem;
5650
- private MenuItem clearItem;
6016
+ private MenuItem deleteItem;
56516017 private MenuItem clearAllItem;
56526018 private MenuItem genUVItem;
56536019 private MenuItem genNormalsMESHItem;
....@@ -5731,6 +6097,8 @@
57316097 private MenuItem attachBumpItem;
57326098 private MenuItem detachBumpItem;
57336099 private MenuItem pigmentBumpItem;
6100
+ private MenuItem embedTexturesItem;
6101
+ private MenuItem deEmbedTexturesItem;
57346102
57356103 private MenuItem particleItem;
57366104 private MenuItem ragdollItem;