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,10 +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 {
335
+ if (Globals.REPLACEONMAKE)
336
+ Save();
337
+ boolean keep = Globals.REPLACEONMAKE;
338
+ Globals.REPLACEONMAKE = false;
87339 // Object3D keep = GrafreeD.clipboard;
88340 //Object3D obj;
89341 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -94,6 +346,7 @@
94346
95347 makeSomething(clone, i==group.selection.size()-1);
96348 }
349
+ Globals.REPLACEONMAKE = keep;
97350 }
98351
99352 void CloneClipboard(boolean supports)
....@@ -189,8 +442,8 @@
189442 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
190443 // pasteExpandItem.addActionListener(this);
191444 menu.add("-");
192
- clearItem = menu.add(new MenuItem("Clear"));
193
- clearItem.addActionListener(this);
445
+ deleteItem = menu.add(new MenuItem("Delete"));
446
+ deleteItem.addActionListener(this);
194447
195448 if (Globals.ADVANCED)
196449 {
....@@ -380,13 +633,14 @@
380633 shadowYItem.addActionListener(this);
381634 shadowZItem = menu.add(new MenuItem("Shadow Blue"));
382635 shadowZItem.addActionListener(this);
636
+ attributeItem = menu.add(new MenuItem("Attribute"));
637
+ attributeItem.addActionListener(this);
638
+
383639 if (Globals.ADVANCED)
384640 {
385641 menu.add("-");
386642 linkerItem = menu.add(new MenuItem("Linker"));
387643 linkerItem.addActionListener(this);
388
- attributeItem = menu.add(new MenuItem("Attribute"));
389
- attributeItem.addActionListener(this);
390644 templateItem = menu.add(new MenuItem("Template"));
391645 templateItem.addActionListener(this);
392646 pointflowItem = menu.add(new MenuItem("Point Flow"));
....@@ -415,7 +669,7 @@
415669 genNormalsMESHItem.addActionListener(this);
416670 if (Globals.ADVANCED)
417671 {
418
- genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
672
+ genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
419673 genNormalsMINEItem.addActionListener(this);
420674 }
421675 stripifyItem = menu.add(new MenuItem("Stripify"));
....@@ -508,10 +762,15 @@
508762 attachBumpItem.addActionListener(this);
509763 pigmentBumpItem = menu.add(new MenuItem("Pigment -> Bump"));
510764 pigmentBumpItem.addActionListener(this);
765
+ //embedTexturesItem
511766 detachPigmentItem = menu.add(new MenuItem("Detach Pigment"));
512767 detachPigmentItem.addActionListener(this);
513768 detachBumpItem = menu.add(new MenuItem("Detach Bump"));
514769 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);
515774 menu.add("-");
516775 sortbysizeItem = menu.add(new MenuItem("Sort by size"));
517776 sortbysizeItem.addActionListener(this);
....@@ -538,6 +797,7 @@
538797 buildToolsMenu(menu);
539798 }
540799
800
+
541801 void SetupUI2(ObjEditor oe)
542802 {
543803 // June 2019
....@@ -582,7 +842,7 @@
582842 */
583843 cGridBag copyOptionsPanel = new cGridBag();
584844
585
- copyOptionsPanel.preferredHeight = 1;
845
+ copyOptionsPanel.preferredHeight = 2;
586846
587847 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
588848
....@@ -601,42 +861,55 @@
601861 fullButton.setToolTipText("Full-screen window");
602862 fullButton.addActionListener(this);
603863
864
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
865
+ screenfitButton.setToolTipText("Screen fit");
866
+ screenfitButton.addActionListener(this);
867
+
604868 oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
605869 restoreCameraButton.setToolTipText("Restore viewpoint");
606870 restoreCameraButton.addActionListener(this);
607871
872
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
873
+ saveButton.setToolTipText("New version");
874
+ saveButton.addActionListener(this);
875
+
608876 copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
609
- undoButton.setToolTipText("Undo changes");
877
+ undoButton.setToolTipText("Previous version");
610878 undoButton.addActionListener(this);
611879 undoButton.setEnabled(false);
612880
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
+
613894 copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
614
- redoButton.setToolTipText("Redo changes");
895
+ redoButton.setToolTipText("Next version");
615896 redoButton.addActionListener(this);
616897 redoButton.setEnabled(false);
617898
618
- copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
619
- saveButton.setToolTipText("Save changes");
620
- saveButton.addActionListener(this);
621
-
622
- copyOptionsPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
899
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
623900 liveCB.setToolTipText("Enable animation");
624901 liveCB.addItemListener(this);
625902
626
- copyOptionsPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
903
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
627904 oneStepButton.setToolTipText("Animate one step forward");
628905 oneStepButton.addActionListener(this);
629906
630
- copyOptionsPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
907
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
631908 fastCB.setToolTipText("Fast mode");
632909 fastCB.addItemListener(this);
633910
634911 //oe.toolboxPanel.Return();
635912
636
- copyOptionsPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
637
- screenfitButton.setToolTipText("Screen fit");
638
- screenfitButton.addActionListener(this);
639
-
640913 // copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
641914 // trackCB.setToolTipText("Enable tracking");
642915 // trackCB.addItemListener(this);
....@@ -649,31 +922,32 @@
649922 oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
650923 snapobjectButton.addActionListener(this);
651924 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");
652929 }
653930
654931 //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
655932
656
- oe.toolbarPanel.add(twoButton = new cButton("|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
657
- 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");
658935 twoButton.addActionListener(this);
659936 this.fullscreenLayout = twoButton;
660937
661
- oe.toolbarPanel.add(fourButton = new cButton("-||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
662
- fourButton.addActionListener(this);
663
- fourButton.setToolTipText("Show left panel only");
664
- oe.toolbarPanel.add(sixButton = new cButton("-|-|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
665
- sixButton.setToolTipText("2-column layout left");
666
- sixButton.addActionListener(this);
667
- oe.toolbarPanel.add(threeButton = new cButton("|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
668
- 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");
669940 threeButton.addActionListener(this);
670
- oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
671
- sevenButton.setToolTipText("3-column layout");
672
- 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);
673947 //
674948
675
- oe.toolbarPanel.add(rootButton = GetButton("icons/write.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
676
- 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");
677951 rootButton.addActionListener(this);
678952
679953 oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
....@@ -682,28 +956,30 @@
682956 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
683957 //clearButton.addActionListener(this);
684958
959
+ cGridBag row1 = new cGridBag();
960
+
685961 // INSERT
686
- oe.toolboxPanel.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
962
+ row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
687963 gridButton.setToolTipText("Create grid");
688964 gridButton.addActionListener(this);
689965
690
- oe.toolboxPanel.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
966
+ row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
691967 boxButton.setToolTipText("Create box");
692968 boxButton.addActionListener(this);
693969
694
- oe.toolboxPanel.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
970
+ row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
695971 sphereButton.setToolTipText("Create sphere");
696972 sphereButton.addActionListener(this);
697973
698
- oe.toolboxPanel.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
974
+ row1.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
699975 coneButton.setToolTipText("Create cone");
700976 coneButton.addActionListener(this);
701977
702
- oe.toolboxPanel.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
978
+ row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
703979 torusButton.setToolTipText("Create torus");
704980 torusButton.addActionListener(this);
705981
706
- oe.toolboxPanel.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
982
+ row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
707983 superButton.setToolTipText("Create superellipsoid");
708984 superButton.addActionListener(this);
709985
....@@ -714,51 +990,56 @@
714990 kleinButton.addActionListener(this);
715991 }
716992
717
- oe.toolboxPanel.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
993
+ row1.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
718994 particlesButton.setToolTipText("Create particle system");
719995 particlesButton.addActionListener(this);
720996
721
- oe.toolboxPanel.Return();
997
+ oe.toolboxPanel.add(row1);
722998
723
- 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);
7241002 groupButton.setToolTipText("Create group");
7251003 groupButton.addActionListener(this);
7261004
727
- oe.toolboxPanel.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1005
+ row2.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
7281006 compositeButton.setToolTipText("Create composite");
7291007 compositeButton.addActionListener(this);
7301008
731
- oe.toolboxPanel.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1009
+ row2.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
7321010 switchButton.setToolTipText("Create item switcher");
7331011 switchButton.addActionListener(this);
7341012
735
- oe.toolboxPanel.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1013
+ row2.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
7361014 loopButton.setToolTipText("Create loop");
7371015 loopButton.addActionListener(this);
7381016
739
- oe.toolboxPanel.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1017
+ row2.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
7401018 textureButton.setToolTipText("Create texture");
7411019 textureButton.addActionListener(this);
7421020
743
- oe.toolboxPanel.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1021
+ row2.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
7441022 overlayButton.setToolTipText("Create overlay");
7451023 overlayButton.addActionListener(this);
7461024
747
- 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);
7481026 lightButton.setToolTipText("Create light");
7491027 lightButton.addActionListener(this);
7501028
751
- for (int i=6; --i>=0;)
752
- {
753
- oe.toolboxPanel.Return();
754
- oe.toolboxPanel.add(new cGridBag());
755
- oe.toolboxPanel.add(new cGridBag());
756
- oe.toolboxPanel.add(new cGridBag());
757
- oe.toolboxPanel.add(new cGridBag());
758
- oe.toolboxPanel.add(new cGridBag());
759
- oe.toolboxPanel.add(new cGridBag());
760
- oe.toolboxPanel.add(new cGridBag());
761
- }
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);
7621043
7631044 // EDIT panel
7641045 editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
....@@ -814,9 +1095,12 @@
8141095
8151096 oe.treePanel.add(copyOptionsPanel);
8161097 oe.treePanel.Return();
1098
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1099
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
1100
+ sliderPane.preferredHeight = 1;
8171101
818
-// mainPanel.setDividerLocation(0.5); //1.0);
819
-// mainPanel.setResizeWeight(0.5);
1102
+// mainPanel.setDividerLocation(0.1); //1.0);
1103
+ mainPanel.setResizeWeight(0.4);
8201104
8211105 //jList.addListSelectionListener(this);
8221106 oe.jTree.addTreeSelectionListener(this);
....@@ -824,7 +1108,7 @@
8241108 //jTree.setEditable(true);
8251109 oe.jTree.setDragEnabled(true);
8261110 //jTree.setPreferredSize(new Dimension(10,10));
827
- jSP.setPreferredSize(new Dimension(100,200));
1111
+ //jSP.setPreferredSize(new Dimension(100,200));
8281112
8291113 oe.jTree.setCellRenderer(new cTreeModel.Renderer());
8301114
....@@ -836,7 +1120,7 @@
8361120 dgr.addDragGestureListener(this);
8371121 }catch(Exception e) {}
8381122 */
839
- radio.layout = sevenButton;
1123
+ radio.layout = sixButton; // sevenButton;
8401124 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
8411125 }
8421126
....@@ -939,9 +1223,9 @@
9391223 toggleSwitchCB.setToolTipText("Choose a single item");
9401224 toggleSwitchCB.addItemListener(this);
9411225
942
- panel.add(autosaveCB = new cCheckBox("Auto-save", Globals.SAVEONMAKE)); //, constraints);
943
- autosaveCB.setToolTipText("On structure change");
944
- autosaveCB.addItemListener(this);
1226
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
1227
+ autokeepCB.setToolTipText("On structure change");
1228
+ autokeepCB.addItemListener(this);
9451229
9461230 panel.Return();
9471231 if (Globals.ADVANCED)
....@@ -970,7 +1254,7 @@
9701254 {
9711255 cRadio radioButton = new cRadio(obj.name);
9721256
973
- // Patch to avoid bug with transparency.
1257
+ // June 2019. Patch to avoid bug with transparency.
9741258 radioButton.hadMaterial = obj.material != null;
9751259 if (!radioButton.hadMaterial)
9761260 {
....@@ -978,7 +1262,7 @@
9781262 }
9791263
9801264 radioButton.SetObject(obj);
981
- radioButton.layout = sevenButton;
1265
+ radioButton.layout = sixButton; // sevenButton;
9821266 radioButton.SetCamera(cameraView.renderCamera, false);
9831267 radioButton.addActionListener(this);
9841268 radioPanel.add(radioButton);
....@@ -1018,7 +1302,7 @@
10181302
10191303 cCheckBox oeilCB;
10201304 cCheckBox shadowCB;
1021
- cCheckBox autosaveCB;
1305
+ cCheckBox autokeepCB;
10221306 cCheckBox lookAtCB;
10231307
10241308 // static int COLOR = 1;
....@@ -1130,9 +1414,9 @@
11301414 {
11311415 Globals.FREEZEONMOVE ^= true;
11321416 }
1133
- else if(e.getSource() == autosaveCB)
1417
+ else if(e.getSource() == autokeepCB)
11341418 {
1135
- Globals.SAVEONMAKE ^= true;
1419
+ Globals.REPLACEONMAKE ^= true;
11361420 }
11371421 else if(e.getSource() == lookAtCB)
11381422 {
....@@ -1214,8 +1498,6 @@
12141498 }
12151499 }
12161500
1217
- String string = (String) object;
1218
-
12191501 System.out.println("Transfer = " + object + "; drop : " + target);
12201502 // if( object instanceof java.io.File[])
12211503 // {
....@@ -1223,6 +1505,8 @@
12231505 // objEditor.DropFile((java.io.File[]) object, true);
12241506 // return;
12251507 // }
1508
+
1509
+ String string = object.toString();
12261510
12271511 // File path for Mac and Windows
12281512 if (string.charAt(0) == '/' || string.charAt(1) == ':')
....@@ -1487,6 +1771,8 @@
14871771 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
14881772 reduce34MorphItem.addActionListener(this);
14891773 menu.add("-");
1774
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1775
+ memoryItem.addActionListener(this);
14901776 menu.add(computeAOItem = new MenuItem("Compute AO"));
14911777 computeAOItem.addActionListener(this);
14921778
....@@ -1495,8 +1781,6 @@
14951781 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
14961782 mirrorItem.addActionListener(this);
14971783 menu.add("-");
1498
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1499
- memoryItem.addActionListener(this);
15001784 menu.add(analyzeItem = new MenuItem("Analyze"));
15011785 analyzeItem.addActionListener(this);
15021786 menu.add(dumpItem = new MenuItem("Print"));
....@@ -1657,6 +1941,16 @@
16571941 listUI.remove(i);
16581942 }
16591943 }
1944
+ }
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
16601954 }
16611955
16621956 /**
....@@ -2086,6 +2380,23 @@
20862380 {
20872381 makeSomething(new Light());
20882382 } 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
20892400 if (source == csgItem)
20902401 {
20912402 group(new CSG());
....@@ -2171,7 +2482,7 @@
21712482 if (source == computeAOItem)
21722483 {
21732484 Globals.drawMode = CameraPane.OCCLUSION;
2174
- Globals.theRenderer.repaint();
2485
+ cameraView.repaint();
21752486 } else
21762487 if (source == recompileItem)
21772488 {
....@@ -2219,15 +2530,31 @@
22192530 } else
22202531 if (source == undoButton)
22212532 {
2533
+ // Go to previous version
2534
+ //if (!Undo())
2535
+ //java.awt.Toolkit.getDefaultToolkit().beep();
22222536 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();
22232547 } else
22242548 if (source == redoButton)
22252549 {
2550
+ // Go to next version
22262551 Redo();
22272552 } else
22282553 if (source == saveButton)
22292554 {
2230
- Save();
2555
+ // Save a new version
2556
+ if (!Save(true))
2557
+ java.awt.Toolkit.getDefaultToolkit().beep();
22312558 } else
22322559 if (source == oneStepButton)
22332560 {
....@@ -2236,17 +2563,14 @@
22362563 } else
22372564 if (source == screenfitButton)
22382565 {
2239
- //Reload(lastConverter, lastFilename, true);
22402566 ScreenFit();
22412567 } else
22422568 if (source == screenfitpointButton)
22432569 {
2244
- //Reload(lastConverter, lastFilename, true);
22452570 ScreenFitPoint();
22462571 } else
22472572 if (source == snapobjectButton)
22482573 {
2249
- //Reload(lastConverter, lastFilename, true);
22502574 SnapObject();
22512575 } else
22522576 // if (event.getSource() == recompileButton)
....@@ -2610,7 +2934,7 @@
26102934 {
26112935 StepAll();
26122936 } else
2613
- if (source == clearItem) // || event.getSource() == clearButton)
2937
+ if (source == deleteItem) // || event.getSource() == clearButton)
26142938 {
26152939 //int indices[] = jList.getSelectedIndices();
26162940 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -3092,7 +3416,7 @@
30923416 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
30933417 {
30943418 obj = (Object3D)e.nextElement();
3095
- obj.SetBumpTexture(null);
3419
+ obj.ResetBumpTexture();
30963420 }
30973421
30983422 refreshContents();
....@@ -3106,6 +3430,31 @@
31063430 obj.SetBumpTexture(obj.GetPigmentTexture());
31073431 }
31083432
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
+
31093458 refreshContents();
31103459 } else
31113460 if (source == flashSelectionButton)
....@@ -3209,8 +3558,8 @@
32093558 // centralPanel.setVisible(true);
32103559 // XYZPanel.setVisible(true);
32113560 bigThree.ClearUI();
3561
+ bigThree.add(scenePanel);
32123562 bigThree.add(centralPanel);
3213
- bigThree.add(XYZPanel);
32143563 bigThree.FlushUI();
32153564
32163565 cameraView.requestFocusInWindow();
....@@ -3290,8 +3639,8 @@
32903639 // centralPanel.setVisible(true);
32913640 // XYZPanel.setVisible(false);
32923641 bigThree.ClearUI();
3293
- bigThree.add(scenePanel);
32943642 bigThree.add(centralPanel);
3643
+ bigThree.add(scenePanel);
32953644 bigThree.FlushUI();
32963645
32973646 cameraView.requestFocusInWindow();
....@@ -3474,6 +3823,9 @@
34743823 }
34753824
34763825 copy = group;
3826
+
3827
+ SetUndoStates();
3828
+
34773829 //Globals.theRenderer.object = group;
34783830 if(!useclient)
34793831 {
....@@ -3502,8 +3854,10 @@
35023854 radio.layout.doClick();
35033855
35043856 ClearUnpinned();
3505
- SetPinStates(group.selection.size() > 0);
3506
- 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)
35073861 EditSelection(false);
35083862 keepparent = group.parent;
35093863 // PARENT = NULL or not???
....@@ -4097,7 +4451,7 @@
40974451
40984452 try
40994453 {
4100
- texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4454
+ texturedata = Globals.theRenderer.GetTextureData(tex, false, node.texres);
41014455 }
41024456 catch (Exception e)
41034457 {
....@@ -4574,6 +4928,12 @@
45744928
45754929 void EditSelection(boolean newWindow)
45764930 {
4931
+ if (group.selection == null)
4932
+ {
4933
+ EditElement(group, newWindow); // ? new
4934
+ return;
4935
+ }
4936
+
45774937 // aConstraints.gridy = 0;
45784938 for (int i=0; i<group.selection.size(); i++)
45794939 {
....@@ -4584,12 +4944,7 @@
45844944 Object3D elem = (Object3D)group.selection.elementAt(i);
45854945 if(elem != group || !newWindow)
45864946 {
4587
- // if (!(elem instanceof Composite))
4588
- // newWindow = false;
4589
- listUI.add(elem);
4590
- elem.openEditWindow(this, newWindow); //, false);
4591
- System.out.println("edit : " + elem);
4592
- elem.editWindow.refreshContents(true); // ? new
4947
+ EditElement(elem, newWindow); // ? new
45934948 }
45944949 }
45954950 }
....@@ -4733,7 +5088,7 @@
47335088
47345089 void refreshContents(boolean cp)
47355090 {
4736
- if (objectPanel.getSelectedIndex() == objectPanel.indexOfTab("Info"))
5091
+ if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
47375092 if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
47385093 {
47395094 objEditor.ClearInfo(); // .GetMaterial());
....@@ -4833,8 +5188,8 @@
48335188
48345189 if (cut)
48355190 {
4836
- if (Globals.SAVEONMAKE)
4837
- Save();
5191
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
5192
+// Save();
48385193 //int indices[] = jList.getSelectedIndices();
48395194 //for (int i = indices.length - 1; i >= 0; i--)
48405195 //jList.remove(indices[i]);
....@@ -4937,6 +5292,10 @@
49375292
49385293 void paste(boolean expand)
49395294 {
5295
+ if (Globals.REPLACEONMAKE)
5296
+ Save();
5297
+ boolean keep = Globals.REPLACEONMAKE;
5298
+ Globals.REPLACEONMAKE = false;
49405299 // if (GrafreeD.clipboard == null)
49415300 // return;
49425301 boolean first = true;
....@@ -4996,6 +5355,7 @@
49965355 Grafreed.clipboard.get(0).parent = keepparent;
49975356 }
49985357
5358
+ Globals.REPLACEONMAKE = keep;
49995359 ResetModel();
50005360 refreshContents();
50015361 }
....@@ -5131,6 +5491,10 @@
51315491
51325492 void group(Object3D csg, boolean grab)
51335493 {
5494
+ if (Globals.REPLACEONMAKE)
5495
+ Save();
5496
+ boolean keep = Globals.REPLACEONMAKE;
5497
+ Globals.REPLACEONMAKE = false;
51345498 if (//false) // why??
51355499 !group.selection.isEmpty())
51365500 {
....@@ -5244,10 +5608,15 @@
52445608 //node.add(csg);
52455609 //makeSomething(node);
52465610 makeSomething(csg);
5611
+ Globals.REPLACEONMAKE = keep;
52475612 }
52485613
52495614 void Ungroup(Object3D g)
52505615 {
5616
+ if (Globals.REPLACEONMAKE)
5617
+ Save();
5618
+ boolean keep = Globals.REPLACEONMAKE;
5619
+ Globals.REPLACEONMAKE = false;
52515620 if (g instanceof HiddenObject)
52525621 {
52535622 HiddenObject h = (HiddenObject) g;
....@@ -5264,6 +5633,7 @@
52645633 objEditor.makeSomething(g.get(i), false);
52655634 }
52665635 }
5636
+ Globals.REPLACEONMAKE = keep;
52675637 }
52685638
52695639 void ungroup()
....@@ -5564,6 +5934,22 @@
55645934 cButton loopButton;
55655935 cButton textureButton;
55665936
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
+
55675953 cButton gridButton;
55685954 cButton boxButton;
55695955 cButton sphereButton;
....@@ -5627,7 +6013,7 @@
56276013 private MenuItem pasteLinkItem;
56286014 private MenuItem pasteCloneItem;
56296015 private MenuItem pasteExpandItem;
5630
- private MenuItem clearItem;
6016
+ private MenuItem deleteItem;
56316017 private MenuItem clearAllItem;
56326018 private MenuItem genUVItem;
56336019 private MenuItem genNormalsMESHItem;
....@@ -5711,6 +6097,8 @@
57116097 private MenuItem attachBumpItem;
57126098 private MenuItem detachBumpItem;
57136099 private MenuItem pigmentBumpItem;
6100
+ private MenuItem embedTexturesItem;
6101
+ private MenuItem deEmbedTexturesItem;
57146102
57156103 private MenuItem particleItem;
57166104 private MenuItem ragdollItem;