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)
....@@ -150,6 +403,8 @@
150403
151404 void SetupMenu2(GroupEditor oe)
152405 {
406
+ oe.jTree = new cTree();
407
+
153408 Menu menu;
154409 oe.menuBar.add(menu = new Menu("Edit"));
155410 //editItem = menu.add(new MenuItem("Edit"));
....@@ -160,7 +415,7 @@
160415 // redoItem = menu.add(new MenuItem("Redo"));
161416 // redoItem.addActionListener(this);
162417 // menu.add("-");
163
- duplicateItem = menu.add(new MenuItem("Duplicate"));
418
+ duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
164419 duplicateItem.addActionListener(this);
165420 cloneItem = menu.add(new MenuItem("Clone"));
166421 cloneItem.addActionListener(this);
....@@ -176,7 +431,6 @@
176431 copyItem.addActionListener(this);
177432 pasteItem = menu.add(new MenuItem("Paste"));
178433 pasteItem.addActionListener(this);
179
- menu.add("-");
180434
181435 menu.add("-");
182436 pasteIntoItem = menu.add(new MenuItem("Paste into"));
....@@ -188,8 +442,8 @@
188442 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
189443 // pasteExpandItem.addActionListener(this);
190444 menu.add("-");
191
- clearItem = menu.add(new MenuItem("Clear"));
192
- clearItem.addActionListener(this);
445
+ deleteItem = menu.add(new MenuItem("Delete"));
446
+ deleteItem.addActionListener(this);
193447
194448 if (Globals.ADVANCED)
195449 {
....@@ -203,23 +457,23 @@
203457 //zBufferItem.addActionListener(this);
204458 //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
205459 //normalLensItem.addActionListener(this);
206
- cameraMenu.add(revertCameraItem = new MenuItem("Restore Viewpoint"));
207
- revertCameraItem.addActionListener(this);
460
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
461
+ restoreCameraItem.addActionListener(this);
208462
209
- cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
210
- toggleFullScreenItem.addItemListener(this);
211
- toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
212
- cameraMenu.add("-");
463
+// cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
464
+// toggleFullScreenItem.addItemListener(this);
465
+// toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
466
+// cameraMenu.add("-");
467
+//
468
+// cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
469
+// toggleTextureItem.addItemListener(this);
470
+// toggleTextureItem.setState(CameraPane.textureon);
471
+//
472
+// cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
473
+// toggleSwitchItem.addItemListener(this);
474
+// toggleSwitchItem.setState(CameraPane.SWITCH);
213475
214
- cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
215
- toggleTextureItem.addItemListener(this);
216
- toggleTextureItem.setState(CameraPane.textureon);
217
-
218
- cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
219
- toggleSwitchItem.addItemListener(this);
220
- toggleSwitchItem.setState(CameraPane.SWITCH);
221
-
222
- cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Handles"));
476
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
223477 toggleHandleItem.addItemListener(this);
224478 toggleHandleItem.setState(CameraPane.HANDLES);
225479
....@@ -246,7 +500,7 @@
246500
247501 cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
248502 toggleDebugItem.addItemListener(this);
249
- toggleDebugItem.setState(CameraPane.DEBUG);
503
+ toggleDebugItem.setState(Globals.DEBUG);
250504
251505 cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
252506 toggleFrustumItem.addItemListener(this);
....@@ -274,7 +528,7 @@
274528 {
275529 oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
276530 //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
277
- //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
531
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
278532 editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
279533 oe.cameraMenu.add("-");
280534 openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
....@@ -282,7 +536,7 @@
282536 editLeafItem.addActionListener(this);
283537 lookAtItem.addActionListener(this);
284538 //lookFromItem.addActinoListener(this);
285
- //switchItem.addActionListener(this);
539
+ //switchViewItem.addActionListener(this);
286540 }
287541
288542 oe.menuBar.add(menu = new Menu("Setting"));
....@@ -327,21 +581,29 @@
327581 }
328582
329583 oe.menuBar.add(menu = new Menu("Group"));
330
- grabItem = menu.add(new MenuItem("Grab"));
331
- grabItem.addActionListener(this);
584
+// grabItem = menu.add(new MenuItem("Grab"));
585
+// grabItem.addActionListener(this);
332586 backItem = menu.add(new MenuItem("Back"));
333587 backItem.addActionListener(this);
334588 frontItem = menu.add(new MenuItem("Front"));
335589 frontItem.addActionListener(this);
336
- compositeItem = menu.add(new MenuItem("Composite"));
337
- compositeItem.addActionListener(this);
590
+// compositeItem = menu.add(new MenuItem("Composite"));
591
+// compositeItem.addActionListener(this);
592
+
593
+ if (Globals.ADVANCED)
594
+ {
338595 hideItem = menu.add(new MenuItem("Hidden Group"));
339596 hideItem.addActionListener(this);
597
+ }
340598 ungroupItem = menu.add(new MenuItem("Ungroup"));
341599 ungroupItem.addActionListener(this);
342
- menu.add("-");
343
- randomItem = menu.add(new MenuItem("Switch node"));
344
- randomItem.addActionListener(this);
600
+
601
+// menu.add("-");
602
+//
603
+// switchItem = menu.add(new MenuItem("Switch node"));
604
+// switchItem.addActionListener(this);
605
+ if (Globals.ADVANCED)
606
+ {
345607 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
346608 switchGeoItem.addActionListener(this);
347609 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
....@@ -349,8 +611,6 @@
349611 morphItem = menu.add(new MenuItem("Morph Group"));
350612 morphItem.addActionListener(this);
351613
352
- if (Globals.ADVANCED)
353
- {
354614 menu.add("-");
355615 physicsItem = menu.add(new MenuItem("Physics"));
356616 physicsItem.addActionListener(this);
....@@ -358,30 +618,29 @@
358618 frameselectorItem.addActionListener(this);
359619 scriptNodeItem = menu.add(new MenuItem("Script Node"));
360620 scriptNodeItem.addActionListener(this);
361
- cameraItem = menu.add(new MenuItem("Camera"));
362
- cameraItem.addActionListener(this);
363621 }
364622
365623 oe.menuBar.add(menu = new Menu("Object"));
366
- textureItem = menu.add(new MenuItem("Texture"));
367
- textureItem.addActionListener(this);
624
+// textureItem = menu.add(new MenuItem("Texture"));
625
+// textureItem.addActionListener(this);
368626 billboardItem = menu.add(new MenuItem("Billboard"));
369627 billboardItem.addActionListener(this);
370628 csgItem = menu.add(new MenuItem("CSG"));
371629 csgItem.addActionListener(this);
372
- shadowXItem = menu.add(new MenuItem("Shadow X"));
630
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
373631 shadowXItem.addActionListener(this);
374
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
632
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
375633 shadowYItem.addActionListener(this);
376
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
634
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
377635 shadowZItem.addActionListener(this);
636
+ attributeItem = menu.add(new MenuItem("Attribute"));
637
+ attributeItem.addActionListener(this);
638
+
378639 if (Globals.ADVANCED)
379640 {
380641 menu.add("-");
381642 linkerItem = menu.add(new MenuItem("Linker"));
382643 linkerItem.addActionListener(this);
383
- attributeItem = menu.add(new MenuItem("Attribute"));
384
- attributeItem.addActionListener(this);
385644 templateItem = menu.add(new MenuItem("Template"));
386645 templateItem.addActionListener(this);
387646 pointflowItem = menu.add(new MenuItem("Point Flow"));
....@@ -410,7 +669,7 @@
410669 genNormalsMESHItem.addActionListener(this);
411670 if (Globals.ADVANCED)
412671 {
413
- genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
672
+ genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
414673 genNormalsMINEItem.addActionListener(this);
415674 }
416675 stripifyItem = menu.add(new MenuItem("Stripify"));
....@@ -503,10 +762,15 @@
503762 attachBumpItem.addActionListener(this);
504763 pigmentBumpItem = menu.add(new MenuItem("Pigment -> Bump"));
505764 pigmentBumpItem.addActionListener(this);
765
+ //embedTexturesItem
506766 detachPigmentItem = menu.add(new MenuItem("Detach Pigment"));
507767 detachPigmentItem.addActionListener(this);
508768 detachBumpItem = menu.add(new MenuItem("Detach Bump"));
509769 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);
510774 menu.add("-");
511775 sortbysizeItem = menu.add(new MenuItem("Sort by size"));
512776 sortbysizeItem.addActionListener(this);
....@@ -533,8 +797,21 @@
533797 buildToolsMenu(menu);
534798 }
535799
800
+
536801 void SetupUI2(ObjEditor oe)
537802 {
803
+ // June 2019
804
+ if (oe == null)
805
+ {
806
+ //super.SetupUI2(this);
807
+ //return;
808
+ }
809
+
810
+ if (copy != group)
811
+ {
812
+ //super.SetupUI2(this);
813
+ }
814
+
538815 //new Exception().printStackTrace();
539816
540817 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -563,39 +840,79 @@
563840 oe.radioPanel.add(dummyButton);
564841 oe.buttonGroup.add(dummyButton);
565842 */
843
+ cGridBag copyOptionsPanel = new cGridBag();
844
+
845
+ copyOptionsPanel.preferredHeight = 2;
846
+
566847 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
567848
568
- oe.toolbarPanel.add(undoButton = new cButton("Undo", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
569
- undoButton.setToolTipText("Undo changes");
570
- undoButton.addActionListener(this);
849
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
850
+ //minButton.setToolTipText("Minimize window");
851
+ //minButton.addActionListener(this);
571852
572
- oe.toolbarPanel.add(redoButton = new cButton("Redo", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
573
- redoButton.setToolTipText("Redo changes");
574
- redoButton.addActionListener(this);
853
+ if (Globals.ADVANCED)
854
+ {
855
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
856
+ maxButton.setToolTipText("Maximize window");
857
+ maxButton.addActionListener(this);
858
+ }
575859
576
- oe.toolbarPanel.add(saveButton = new cButton("Save", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
577
- saveButton.setToolTipText("Save changes");
860
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
861
+ fullButton.setToolTipText("Full-screen window");
862
+ fullButton.addActionListener(this);
863
+
864
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
865
+ screenfitButton.setToolTipText("Screen fit");
866
+ screenfitButton.addActionListener(this);
867
+
868
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
869
+ restoreCameraButton.setToolTipText("Restore viewpoint");
870
+ restoreCameraButton.addActionListener(this);
871
+
872
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
873
+ saveButton.setToolTipText("New version");
578874 saveButton.addActionListener(this);
875
+
876
+ copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
877
+ undoButton.setToolTipText("Previous version");
878
+ undoButton.addActionListener(this);
879
+ undoButton.setEnabled(false);
579880
580
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
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
+
894
+ copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
895
+ redoButton.setToolTipText("Next version");
896
+ redoButton.addActionListener(this);
897
+ redoButton.setEnabled(false);
898
+
899
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
581900 liveCB.setToolTipText("Enable animation");
582901 liveCB.addItemListener(this);
583902
584
- oe.toolbarPanel.add(oneStepButton = new cButton("Step", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
903
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
585904 oneStepButton.setToolTipText("Animate one step forward");
586905 oneStepButton.addActionListener(this);
587906
588
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
907
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
589908 fastCB.setToolTipText("Fast mode");
590909 fastCB.addItemListener(this);
591910
592
- oe.toolbarPanel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
593
- trackCB.setToolTipText("Enable tracking");
594
- trackCB.addItemListener(this);
595
-
596
- oe.toolbarPanel.add(screenfitButton = new cButton("@", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
597
- screenfitButton.setToolTipText("Screen fit");
598
- screenfitButton.addActionListener(this);
911
+ //oe.toolboxPanel.Return();
912
+
913
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
914
+// trackCB.setToolTipText("Enable tracking");
915
+// trackCB.addItemListener(this);
599916
600917 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
601918 // screenfitpointButton.addActionListener(this);
....@@ -605,67 +922,155 @@
605922 oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
606923 snapobjectButton.addActionListener(this);
607924 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");
608929 }
609930
610
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
611
- flashSelectionButton.setToolTipText("Show selection");
612
- flashSelectionButton.addActionListener(this);
931
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
613932
614
- oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
615
-
616
- oe.toolbarPanel.add(twoButton = new cButton("|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
617
- 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");
618935 twoButton.addActionListener(this);
619
- oe.toolbarPanel.add(fourButton = new cButton("+||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
620
- fourButton.addActionListener(this);
621
- fourButton.setToolTipText("Show left panel only");
622
- oe.toolbarPanel.add(sixButton = new cButton("+|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
623
- sixButton.setToolTipText("2-column layout left");
624
- sixButton.addActionListener(this);
625
- oe.toolbarPanel.add(threeButton = new cButton("|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
626
- threeButton.setToolTipText("2-column layout right");
936
+ this.fullscreenLayout = twoButton;
937
+
938
+ oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
939
+ threeButton.setToolTipText("Show controls and 3D view");
627940 threeButton.addActionListener(this);
628
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
629
- sevenButton.setToolTipText("3-column layout");
630
- 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);
631947 //
632948
633
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
634
- 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");
635951 rootButton.addActionListener(this);
636952
637
- oe.toolbarPanel.add(closeButton = new cButton("X", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
953
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
638954 closeButton.setToolTipText("Close tab");
639955 closeButton.addActionListener(this);
640956 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
641957 //clearButton.addActionListener(this);
642
-
643
- cGridBag commandsPanel = new cGridBag();
958
+
959
+ cGridBag row1 = new cGridBag();
644960
645
- commandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
646
- editButton.setToolTipText("Edit selection");
961
+ // INSERT
962
+ row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
963
+ gridButton.setToolTipText("Create grid");
964
+ gridButton.addActionListener(this);
965
+
966
+ row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
967
+ boxButton.setToolTipText("Create box");
968
+ boxButton.addActionListener(this);
969
+
970
+ row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
971
+ sphereButton.setToolTipText("Create sphere");
972
+ sphereButton.addActionListener(this);
973
+
974
+ row1.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
975
+ coneButton.setToolTipText("Create cone");
976
+ coneButton.addActionListener(this);
977
+
978
+ row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
979
+ torusButton.setToolTipText("Create torus");
980
+ torusButton.addActionListener(this);
981
+
982
+ row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
983
+ superButton.setToolTipText("Create superellipsoid");
984
+ superButton.addActionListener(this);
985
+
986
+ if (Globals.ADVANCED)
987
+ {
988
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
989
+ kleinButton.setToolTipText("Create Klein bottle");
990
+ kleinButton.addActionListener(this);
991
+ }
992
+
993
+ row1.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
994
+ particlesButton.setToolTipText("Create particle system");
995
+ particlesButton.addActionListener(this);
996
+
997
+ oe.toolboxPanel.add(row1);
998
+
999
+ cGridBag row2 = new cGridBag();
1000
+
1001
+ row2.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1002
+ groupButton.setToolTipText("Create group");
1003
+ groupButton.addActionListener(this);
1004
+
1005
+ row2.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1006
+ compositeButton.setToolTipText("Create composite");
1007
+ compositeButton.addActionListener(this);
1008
+
1009
+ row2.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1010
+ switchButton.setToolTipText("Create item switcher");
1011
+ switchButton.addActionListener(this);
1012
+
1013
+ row2.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1014
+ loopButton.setToolTipText("Create loop");
1015
+ loopButton.addActionListener(this);
1016
+
1017
+ row2.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1018
+ textureButton.setToolTipText("Create texture");
1019
+ textureButton.addActionListener(this);
1020
+
1021
+ row2.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1022
+ overlayButton.setToolTipText("Create overlay");
1023
+ overlayButton.addActionListener(this);
1024
+
1025
+ row2.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1026
+ lightButton.setToolTipText("Create light");
1027
+ lightButton.addActionListener(this);
1028
+
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);
1043
+
1044
+ // EDIT panel
1045
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1046
+ editButton.setToolTipText("Pin selection controls");
6471047 editButton.addActionListener(this);
6481048
649
- commandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
650
- uneditButton.setToolTipText("Unedit selection");
1049
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1050
+ uneditButton.setToolTipText("Remove selection controls");
6511051 uneditButton.addActionListener(this);
6521052
653
- commandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
654
- allParamsButton.setToolTipText("Edit all params");
1053
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
1054
+ allParamsButton.setToolTipText("Show all controle");
6551055 allParamsButton.addActionListener(this);
6561056
657
- commandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1057
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
6581058 clearPanelButton.setToolTipText("Clear edit panel");
6591059 clearPanelButton.addActionListener(this);
6601060
661
- commandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1061
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
6621062 unselectButton.setToolTipText("Unselect");
6631063 unselectButton.addActionListener(this);
6641064
665
- commandsPanel.preferredHeight = 1;
1065
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1066
+ flashSelectionButton.setToolTipText("Highlight selection");
1067
+ flashSelectionButton.addActionListener(this);
6661068
667
- oe.treePanel.add(commandsPanel);
668
- oe.treePanel.Return();
1069
+ editCommandsPanel.preferredHeight = 1;
1070
+
1071
+ SetPinStates(false);
1072
+// oe.treePanel.add(commandsPanel);
1073
+// oe.treePanel.Return();
6691074
6701075 // oe.aConstraints.gridx += 1;
6711076 // oe.aConstraints.weighty = 0;
....@@ -682,32 +1087,20 @@
6821087
6831088 JScrollPane jSP;
6841089 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
685
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
1090
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
6861091 ResetModel();
6871092
6881093 oe.treePanel.add(jSPPanel);
6891094 oe.treePanel.Return();
6901095
691
- cGridBag copyOptionsPanel = new cGridBag();
692
-
693
- copyOptionsPanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
694
- colorCB.setToolTipText("Copy color when dropped");
695
- colorCB.addItemListener(this);
696
-
697
- copyOptionsPanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
698
- materialCB.setToolTipText("Copy material when dropped");
699
- materialCB.addItemListener(this);
700
-
701
- copyOptionsPanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
702
- textureCB.setToolTipText("Copy texture when dropped");
703
- textureCB.addItemListener(this);
704
-
705
- copyOptionsPanel.preferredHeight = 1;
7061096 oe.treePanel.add(copyOptionsPanel);
7071097 oe.treePanel.Return();
1098
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1099
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
1100
+ sliderPane.preferredHeight = 1;
7081101
709
-// mainPanel.setDividerLocation(0.5); //1.0);
710
-// mainPanel.setResizeWeight(0.5);
1102
+// mainPanel.setDividerLocation(0.1); //1.0);
1103
+ mainPanel.setResizeWeight(0.4);
7111104
7121105 //jList.addListSelectionListener(this);
7131106 oe.jTree.addTreeSelectionListener(this);
....@@ -715,7 +1108,7 @@
7151108 //jTree.setEditable(true);
7161109 oe.jTree.setDragEnabled(true);
7171110 //jTree.setPreferredSize(new Dimension(10,10));
718
- jSP.setPreferredSize(new Dimension(100,200));
1111
+ //jSP.setPreferredSize(new Dimension(100,200));
7191112
7201113 oe.jTree.setCellRenderer(new cTreeModel.Renderer());
7211114
....@@ -727,29 +1120,49 @@
7271120 dgr.addDragGestureListener(this);
7281121 }catch(Exception e) {}
7291122 */
730
- radio.layout = sevenButton;
1123
+ radio.layout = sixButton; // sevenButton;
7311124 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
7321125 }
7331126
7341127 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
7351128 {
1129
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
1130
+ colorCB.setToolTipText("Copy color when dropped");
1131
+ colorCB.addItemListener(this);
1132
+
1133
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
1134
+ materialCB.setToolTipText("Copy material when dropped");
1135
+ materialCB.addItemListener(this);
1136
+
1137
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
1138
+ textureCB.setToolTipText("Copy texture when dropped");
1139
+ textureCB.addItemListener(this);
1140
+
1141
+ panel.Return();
1142
+
7361143 panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
7371144 boxCB.setToolTipText("Display bounding boxes");
7381145 boxCB.addItemListener(this);
7391146
7401147 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
741
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
1148
+ zoomBoxCB.setToolTipText("Display only for wheel");
7421149 zoomBoxCB.addItemListener(this);
7431150
7441151 if (true) // Globals.ADVANCED)
7451152 {
746
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
747
- supportCB.setToolTipText("Enable rigging");
748
- supportCB.addItemListener(this);
1153
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
1154
+// supportCB.setToolTipText("Enable rigging");
1155
+// supportCB.addItemListener(this);
1156
+
1157
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
1158
+ freezeCB.setToolTipText("Fast moving camera");
1159
+ freezeCB.addItemListener(this);
7491160
7501161 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
7511162 // localCB.addItemListener(this);
7521163
1164
+ panel.Return();
1165
+
7531166 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
7541167 crowdCB.setToolTipText("Used for crowds");
7551168 crowdCB.addItemListener(this);
....@@ -766,6 +1179,8 @@
7661179 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
7671180 // speakerMocapCB.addItemListener(this);
7681181
1182
+ panel.Return();
1183
+
7691184 if (false)
7701185 {
7711186 // handled in scripts
....@@ -780,34 +1195,74 @@
7801195 //constraints.gridy += 1;
7811196 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
7821197 smoothfocusCB.addItemListener(this);
1198
+ panel.Return();
7831199 }
7841200
7851201 //constraints.gridx += 1;
7861202 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
7871203 // debugCB.addItemListener(this);
7881204
1205
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
1206
+ trackCB.setToolTipText("Enable tracking target");
1207
+ trackCB.addItemListener(this);
1208
+
7891209 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
1210
+ oeilCB.setToolTipText("Move camera when tracking");
7901211 oeilCB.addItemListener(this);
7911212
1213
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
1214
+ shadowCB.setToolTipText("When live compute shadows");
1215
+ shadowCB.addItemListener(this);
1216
+
1217
+ panel.Return();
1218
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
1219
+ toggleTextureCB.setToolTipText("Load textures");
1220
+ toggleTextureCB.addItemListener(this);
1221
+
1222
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
1223
+ toggleSwitchCB.setToolTipText("Choose a single item");
1224
+ toggleSwitchCB.addItemListener(this);
1225
+
1226
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
1227
+ autokeepCB.setToolTipText("On structure change");
1228
+ autokeepCB.addItemListener(this);
1229
+
1230
+ panel.Return();
1231
+ if (Globals.ADVANCED)
1232
+ {
7921233 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
7931234 lookAtCB.setToolTipText("Look-at target");
7941235 lookAtCB.addItemListener(this);
1236
+ }
7951237
7961238 }
7971239
7981240 cGridBag fill = new cGridBag();
799
-
8001241 fill.preferredHeight = 200;
1242
+ cGridBag fill2 = new cGridBag();
1243
+ fill2.preferredHeight = 200;
1244
+ cGridBag fill3 = new cGridBag();
1245
+ fill3.preferredHeight = 200;
8011246
8021247 panel.add(fill);
1248
+ panel.add(fill2);
1249
+ panel.add(fill3);
8031250
8041251 }
8051252
8061253 void EditObject(Object3D obj)
8071254 {
8081255 cRadio radioButton = new cRadio(obj.name);
1256
+
1257
+ // June 2019. Patch to avoid bug with transparency.
1258
+ radioButton.hadMaterial = obj.material != null;
1259
+ if (!radioButton.hadMaterial)
1260
+ {
1261
+ obj.material = new cMaterial();
1262
+ }
1263
+
8091264 radioButton.SetObject(obj);
810
- radioButton.layout = sevenButton;
1265
+ radioButton.layout = sixButton; // sevenButton;
8111266 radioButton.SetCamera(cameraView.renderCamera, false);
8121267 radioButton.addActionListener(this);
8131268 radioPanel.add(radioButton);
....@@ -817,6 +1272,8 @@
8171272
8181273 void SetupViews(ObjEditor oe)
8191274 {
1275
+ theFrame = this;
1276
+
8201277 oe.SetupViews();
8211278
8221279 System.out.println("SetupViews");
....@@ -825,23 +1282,28 @@
8251282 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
8261283 }
8271284
828
- JCheckBox liveCB;
829
- JCheckBox supportCB;
830
- JCheckBox localCB;
831
- JCheckBox crowdCB;
832
- JCheckBox smoothCB;
833
- JCheckBox fastCB;
834
- JCheckBox slowCB;
835
- JCheckBox boxCB;
836
- JCheckBox zoomBoxCB;
837
- JCheckBox trackCB;
838
- JCheckBox smoothfocusCB;
1285
+ cToggleButton liveCB;
1286
+ cCheckBox supportCB;
1287
+ cCheckBox localCB;
1288
+ cCheckBox crowdCB;
1289
+ cCheckBox smoothCB;
1290
+ cToggleButton fastCB;
1291
+ cCheckBox slowCB;
1292
+ cCheckBox boxCB;
1293
+ cCheckBox zoomBoxCB;
1294
+ cCheckBox freezeCB;
1295
+ //cToggleButton trackCB;
1296
+ cCheckBox trackCB;
1297
+ cCheckBox smoothfocusCB;
8391298 // JCheckBox speakerMocapCB;
840
- JCheckBox speakerCameraCB;
841
- JCheckBox speakerFocusCB;
842
- JCheckBox debugCB;
843
- JCheckBox oeilCB;
844
- JCheckBox lookAtCB;
1299
+ cCheckBox speakerCameraCB;
1300
+ cCheckBox speakerFocusCB;
1301
+ cCheckBox debugCB;
1302
+
1303
+ cCheckBox oeilCB;
1304
+ cCheckBox shadowCB;
1305
+ cCheckBox autokeepCB;
1306
+ cCheckBox lookAtCB;
8451307
8461308 // static int COLOR = 1;
8471309 // static int MATERIAL = 2;
....@@ -849,9 +1311,9 @@
8491311
8501312 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
8511313
852
- JCheckBox colorCB;
853
- JCheckBox materialCB;
854
- JCheckBox textureCB;
1314
+ cCheckBox colorCB;
1315
+ cCheckBox materialCB;
1316
+ cCheckBox textureCB;
8551317
8561318 public void itemStateChanged(ItemEvent e)
8571319 {
....@@ -944,6 +1406,18 @@
9441406 {
9451407 cameraView.ToggleOeil();
9461408 }
1409
+ else if(e.getSource() == shadowCB)
1410
+ {
1411
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1412
+ }
1413
+ else if(e.getSource() == freezeCB)
1414
+ {
1415
+ Globals.FREEZEONMOVE ^= true;
1416
+ }
1417
+ else if(e.getSource() == autokeepCB)
1418
+ {
1419
+ Globals.REPLACEONMAKE ^= true;
1420
+ }
9471421 else if(e.getSource() == lookAtCB)
9481422 {
9491423 cameraView.ToggleLookAt();
....@@ -960,7 +1434,8 @@
9601434
9611435 /**/
9621436 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
963
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1437
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1438
+ TreePath path = objEditor.jTree.getSelectionPath();
9641439 if ((path == null) || (path.getPathCount() <= 1)) {
9651440 // We can't move the root node or an empty selection
9661441 return;
....@@ -1023,8 +1498,6 @@
10231498 }
10241499 }
10251500
1026
- String string = (String) object;
1027
-
10281501 System.out.println("Transfer = " + object + "; drop : " + target);
10291502 // if( object instanceof java.io.File[])
10301503 // {
....@@ -1032,6 +1505,8 @@
10321505 // objEditor.DropFile((java.io.File[]) object, true);
10331506 // return;
10341507 // }
1508
+
1509
+ String string = object.toString();
10351510
10361511 // File path for Mac and Windows
10371512 if (string.charAt(0) == '/' || string.charAt(1) == ':')
....@@ -1077,23 +1552,33 @@
10771552
10781553 assert target == objEditor.jTree;
10791554 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1555
+ Object3D destinationLeaf;
10801556 try {
1081
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1557
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
10821558 } catch (Exception e) {
10831559 System.out.println("destinationPath : " + destinationPath);
10841560 return;
10851561 }
10861562
1087
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1563
+ for (int i=group.selection.size(); --i>=0;)
10881564 {
1565
+ Object3D child = (Object3D)group.selection.elementAt(i);
1566
+
1567
+ // Cannot move into itself
1568
+ if (child == destinationLeaf)
1569
+ return;
1570
+ }
1571
+
1572
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1573
+// {
10891574 loadClipboard(true);
10901575 objEditor.jTree.setSelectionPath(destinationPath);
10911576 pasteInto(false, false);
1092
- } else {
1093
- loadClipboard(false);
1094
- objEditor.jTree.setSelectionPath(destinationPath);
1095
- pasteInto(false, false); // true); // ???
1096
- }
1577
+// } else {
1578
+// loadClipboard(false);
1579
+// objEditor.jTree.setSelectionPath(destinationPath);
1580
+// pasteInto(false, false); // true); // ???
1581
+// }
10971582 }
10981583 public void dropActionChanged(DropTargetDragEvent dtde)
10991584 // Called if the user has modified the current drop gesture
....@@ -1198,22 +1683,30 @@
11981683 {
11991684 //heightFieldItem = menu.add(new MenuItem("Height Field"));
12001685 //heightFieldItem.addActionListener(this);
1201
- gridItem = menu.add(new MenuItem("Grid"));
1202
- gridItem.addActionListener(this);
1203
- rectoidItem = menu.add(new MenuItem("Box"));
1204
- rectoidItem.addActionListener(this);
1205
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1206
- ellipsoidItem.addActionListener(this);
1207
- coneItem = menu.add(new MenuItem("Cone"));
1208
- coneItem.addActionListener(this);
1209
- torusItem = menu.add(new MenuItem("Torus"));
1210
- torusItem.addActionListener(this);
1211
- superItem = menu.add(new MenuItem("Superellipsoid"));
1212
- superItem.addActionListener(this);
1686
+// gridItem = menu.add(new MenuItem("Grid"));
1687
+// gridItem.addActionListener(this);
1688
+// rectoidItem = menu.add(new MenuItem("Box"));
1689
+// rectoidItem.addActionListener(this);
1690
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1691
+// ellipsoidItem.addActionListener(this);
1692
+// coneItem = menu.add(new MenuItem("Cone"));
1693
+// coneItem.addActionListener(this);
1694
+// torusItem = menu.add(new MenuItem("Torus"));
1695
+// torusItem.addActionListener(this);
1696
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1697
+// superItem.addActionListener(this);
1698
+
1699
+ cameraItem = menu.add(new MenuItem("Camera"));
1700
+ cameraItem.addActionListener(this);
1701
+
1702
+ if (!Globals.ADVANCED)
1703
+ {
12131704 kleinItem = menu.add(new MenuItem("Klein Bottle"));
12141705 kleinItem.addActionListener(this);
1215
- particleItem = menu.add(new MenuItem("Particle system"));
1216
- particleItem.addActionListener(this);
1706
+ }
1707
+
1708
+// particleItem = menu.add(new MenuItem("Particle system"));
1709
+// particleItem.addActionListener(this);
12171710 if (Globals.ADVANCED)
12181711 {
12191712 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1239,15 +1732,15 @@
12391732 }
12401733 bezierItem = menu.add(new MenuItem("Bezier Patch"));
12411734 bezierItem.addActionListener(this);
1242
- overlayItem = menu.add(new MenuItem("Overlay"));
1243
- overlayItem.addActionListener(this);
1244
- lightItem = menu.add(new MenuItem("Light"));
1245
- lightItem.addActionListener(this);
1735
+// overlayItem = menu.add(new MenuItem("Overlay"));
1736
+// overlayItem.addActionListener(this);
1737
+// lightItem = menu.add(new MenuItem("Light"));
1738
+// lightItem.addActionListener(this);
12461739 menu.add("-");
12471740 //superLoopItem = menu.add(new MenuItem("Super Loop"));
12481741 //superLoopItem.addActionListener(this);
1249
- loopItem = menu.add(new MenuItem("Loop"));
1250
- loopItem.addActionListener(this);
1742
+// loopItem = menu.add(new MenuItem("Loop"));
1743
+// loopItem.addActionListener(this);
12511744 doubleItem = menu.add(new MenuItem("Fork"));
12521745 doubleItem.addActionListener(this);
12531746 if (Globals.ADVANCED)
....@@ -1263,6 +1756,9 @@
12631756 animationItem.addItemListener(this);
12641757 animationItem.setState(Globals.ANIMATION);
12651758
1759
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1760
+ archiveItem.addActionListener(this);
1761
+
12661762 menu.add("-");
12671763 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
12681764 parseverticesItem.addActionListener(this);
....@@ -1275,6 +1771,8 @@
12751771 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
12761772 reduce34MorphItem.addActionListener(this);
12771773 menu.add("-");
1774
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1775
+ memoryItem.addActionListener(this);
12781776 menu.add(computeAOItem = new MenuItem("Compute AO"));
12791777 computeAOItem.addActionListener(this);
12801778
....@@ -1283,8 +1781,6 @@
12831781 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
12841782 mirrorItem.addActionListener(this);
12851783 menu.add("-");
1286
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1287
- memoryItem.addActionListener(this);
12881784 menu.add(analyzeItem = new MenuItem("Analyze"));
12891785 analyzeItem.addActionListener(this);
12901786 menu.add(dumpItem = new MenuItem("Print"));
....@@ -1428,9 +1924,34 @@
14281924 shadow.material = new cMaterial(obj.material);
14291925 shadow.material.diffuse = 0.0001f;
14301926 shadow.material.specular = 0.0001f;
1927
+ //shadow.projectedVertices[1].x = 300;
14311928
14321929 makeSomething(shadow);
14331930 }
1931
+
1932
+ private void ClearUnpinned()
1933
+ {
1934
+ //for (Object3D obj : listUI)
1935
+ for (int i=listUI.size(); --i>=0;)
1936
+ {
1937
+ Object3D obj = listUI.elementAt(i);
1938
+ if (!obj.pinned)
1939
+ {
1940
+ obj.CloseUI();
1941
+ listUI.remove(i);
1942
+ }
1943
+ }
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
1954
+ }
14341955
14351956 /**
14361957 * applyExample
....@@ -1675,7 +2196,7 @@
16752196 {
16762197 ScreenFit();
16772198 } else
1678
- if (source == switchItem)
2199
+ if (source == switchViewItem)
16792200 {
16802201 cVector v1 = new cVector();
16812202 cVector v2 = new cVector();
....@@ -1684,11 +2205,11 @@
16842205 objEditor.cameraView.renderCamera.setAim(v2, v1);
16852206 objEditor.cameraView.repaint();
16862207 } else
1687
- if (source == rectoidItem)
2208
+ if (source == rectoidItem || source == boxButton)
16882209 {
16892210 makeSomething(new Box());
16902211 } else
1691
- if (source == particleItem)
2212
+ if (source == particleItem || source == particlesButton)
16922213 {
16932214 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
16942215 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1767,27 +2288,27 @@
17672288
17682289 makeSomething(obj);
17692290 } else
1770
- if (source == gridItem)
2291
+ if (source == gridItem || source == gridButton)
17712292 {
17722293 makeSomething(new Grid());
17732294 } else
1774
- if (source == ellipsoidItem)
2295
+ if (source == ellipsoidItem || source == sphereButton)
17752296 {
17762297 makeSomething(new Sphere());
17772298 } else
1778
- if (source == coneItem)
2299
+ if (source == coneItem || source == coneButton)
17792300 {
17802301 makeSomething(new Cone());
17812302 } else
1782
- if (source == torusItem)
2303
+ if (source == torusItem || source == torusButton)
17832304 {
17842305 makeSomething(new Torus());
17852306 } else
1786
- if (source == superItem)
2307
+ if (source == superItem || source == superButton)
17872308 {
17882309 makeSomething(new Superellipsoid());
17892310 } else
1790
- if (source == kleinItem)
2311
+ if (source == kleinItem || source == kleinButton)
17912312 {
17922313 makeSomething(new Klein());
17932314 } else
....@@ -1807,7 +2328,7 @@
18072328 {
18082329 makeSomething(new BezierSurface());
18092330 } else
1810
- if (source == overlayItem)
2331
+ if (source == overlayItem || source == overlayButton)
18112332 {
18122333 /*
18132334 Object3D obj = new BezierSurface(5,8);
....@@ -1855,10 +2376,27 @@
18552376 s.setup();
18562377 makeSomething(s);
18572378 } else
1858
- if (source == lightItem)
2379
+ if (source == lightItem || source == lightButton)
18592380 {
18602381 makeSomething(new Light());
18612382 } 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
18622400 if (source == csgItem)
18632401 {
18642402 group(new CSG());
....@@ -1905,30 +2443,30 @@
19052443
19062444 group(g);
19072445 } else
1908
- if (source == loopItem)
2446
+ if (source == loopItem || source == loopButton)
19092447 {
19102448 Composite csg = new GroupLeaf();
19112449 csg.count = 5;
19122450 group(csg);
1913
- Composite child = new cGroup();
2451
+ Composite child = new cGroup("Branch");
19142452 csg.addChild(child);
19152453 child.addChild(csg);
19162454 } else
19172455 if (source == doubleItem)
19182456 {
1919
- Composite csg = new GroupLeaf();
2457
+ Composite csg = new GroupLeaf("Fork");
19202458 csg.count = 5;
19212459 group(csg);
1922
- Composite child = new cGroup();
2460
+ Composite child = new cGroup("Branch A");
19232461 csg.addChild(child);
19242462 child.addChild(csg);
1925
- child = new cGroup();
2463
+ child = new cGroup("Branch B");
19262464 csg.addChild(child);
19272465 child.addChild(csg);
19282466 } else
19292467 if (source == tripleItem)
19302468 {
1931
- Composite csg = new GroupLeaf();
2469
+ Composite csg = new GroupLeaf("Trident");
19322470 csg.count = 4;
19332471 group(csg);
19342472 Composite child = new cGroup();
....@@ -1944,7 +2482,7 @@
19442482 if (source == computeAOItem)
19452483 {
19462484 Globals.drawMode = CameraPane.OCCLUSION;
1947
- Globals.theRenderer.repaint();
2485
+ cameraView.repaint();
19482486 } else
19492487 if (source == recompileItem)
19502488 {
....@@ -1978,17 +2516,45 @@
19782516 {
19792517 DumpObject();
19802518 } else
2519
+ if (source == minButton)
2520
+ {
2521
+ Minimize();
2522
+ } else
2523
+ if (source == maxButton)
2524
+ {
2525
+ Maximize();
2526
+ } else
2527
+ if (source == fullButton)
2528
+ {
2529
+ ToggleFullScreen();
2530
+ } else
19812531 if (source == undoButton)
19822532 {
2533
+ // Go to previous version
2534
+ //if (!Undo())
2535
+ //java.awt.Toolkit.getDefaultToolkit().beep();
19832536 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();
19842547 } else
19852548 if (source == redoButton)
19862549 {
2550
+ // Go to next version
19872551 Redo();
19882552 } else
19892553 if (source == saveButton)
19902554 {
1991
- Save();
2555
+ // Save a new version
2556
+ if (!Save(true))
2557
+ java.awt.Toolkit.getDefaultToolkit().beep();
19922558 } else
19932559 if (source == oneStepButton)
19942560 {
....@@ -1997,17 +2563,14 @@
19972563 } else
19982564 if (source == screenfitButton)
19992565 {
2000
- //Reload(lastConverter, lastFilename, true);
20012566 ScreenFit();
20022567 } else
20032568 if (source == screenfitpointButton)
20042569 {
2005
- //Reload(lastConverter, lastFilename, true);
20062570 ScreenFitPoint();
20072571 } else
20082572 if (source == snapobjectButton)
20092573 {
2010
- //Reload(lastConverter, lastFilename, true);
20112574 SnapObject();
20122575 } else
20132576 // if (event.getSource() == recompileButton)
....@@ -2371,7 +2934,7 @@
23712934 {
23722935 StepAll();
23732936 } else
2374
- if (source == clearItem) // || event.getSource() == clearButton)
2937
+ if (source == deleteItem) // || event.getSource() == clearButton)
23752938 {
23762939 //int indices[] = jList.getSelectedIndices();
23772940 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2383,9 +2946,9 @@
23832946 {
23842947 ClearSelection(true);
23852948 } else
2386
- if (source == grabItem)
2949
+ if (source == grabItem || source == groupButton)
23872950 {
2388
- group(new cGroup(), true);
2951
+ group(new cGroup(), false); // true);
23892952 } else
23902953 if (source == hideItem)
23912954 {
....@@ -2403,11 +2966,11 @@
24032966 {
24042967 makeSomething(new Camera());
24052968 } else
2406
- if (source == compositeItem)
2969
+ if (source == compositeItem || source == compositeButton)
24072970 {
24082971 group(new Composite());
24092972 } else
2410
- if (source == randomItem)
2973
+ if (source == switchItem || source == switchButton)
24112974 {
24122975 RandomNode random = new RandomNode();
24132976 group(random);
....@@ -2509,7 +3072,7 @@
25093072 {
25103073 group(new cLinker());
25113074 } else
2512
- if (source == textureItem)
3075
+ if (source == textureItem || source == textureButton)
25133076 {
25143077 group(new TextureNode());
25153078 } else
....@@ -2529,17 +3092,30 @@
25293092 {
25303093 CastShadow(2);
25313094 } else
2532
- if (source == ungroupItem)
3095
+ if (source == ungroupItem || source == ungroupButton)
25333096 {
2534
- //ungroup();
3097
+ boolean hasRoot = false;
3098
+
25353099 for (int i=0; i<group.selection.size(); i++)
25363100 {
2537
- Ungroup(group.selection.get(i));
3101
+ if (group.selection.get(i) == group)
3102
+ {
3103
+ hasRoot = true;
3104
+ break;
3105
+ }
25383106 }
25393107
2540
- ClearSelection(false);
2541
-
2542
- refreshContents();
3108
+ if (!hasRoot)
3109
+ {
3110
+ for (int i=0; i<group.selection.size(); i++)
3111
+ {
3112
+ Ungroup(group.selection.get(i));
3113
+ }
3114
+
3115
+ ClearSelection(false);
3116
+
3117
+ refreshContents();
3118
+ }
25433119 } else
25443120 if (source == genUVItem)
25453121 {
....@@ -2840,7 +3416,7 @@
28403416 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
28413417 {
28423418 obj = (Object3D)e.nextElement();
2843
- obj.SetBumpTexture(null);
3419
+ obj.ResetBumpTexture();
28443420 }
28453421
28463422 refreshContents();
....@@ -2856,6 +3432,31 @@
28563432
28573433 refreshContents();
28583434 } 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
+
3458
+ refreshContents();
3459
+ } else
28593460 if (source == flashSelectionButton)
28603461 {
28613462 CameraPane.flash = true;
....@@ -2867,6 +3468,10 @@
28673468 if (source == twoButton)
28683469 {
28693470 radio.layout = twoButton;
3471
+
3472
+ if (CameraPane.FULLSCREEN)
3473
+ fullscreenLayout = radio.layout;
3474
+
28703475 // bug
28713476 //gridPanel.setDividerLocation(1.0);
28723477 //bigPanel.setDividerLocation(0.0);
....@@ -2899,10 +3504,31 @@
28993504 bigThree.ClearUI();
29003505 bigThree.add(centralPanel);
29013506 bigThree.FlushUI();
3507
+
3508
+ cameraView.requestFocusInWindow();
3509
+
3510
+// refreshContents(true);
3511
+//
3512
+// try
3513
+// {
3514
+// java.awt.Robot bot = new java.awt.Robot();
3515
+// int mask = InputEvent.BUTTON1_MASK;
3516
+// bot.mouseMove(100, 100);
3517
+// bot.mousePress(mask);
3518
+// bot.mouseRelease(mask);
3519
+// }
3520
+// catch (Exception e)
3521
+// {
3522
+//
3523
+// }
3524
+
29023525 } else
29033526 if (source == threeButton)
29043527 {
29053528 radio.layout = threeButton;
3529
+
3530
+ if (CameraPane.FULLSCREEN)
3531
+ fullscreenLayout = radio.layout;
29063532
29073533 // bigThree.remove(scenePanel);
29083534 // bigThree.remove(centralPanel);
....@@ -2932,13 +3558,18 @@
29323558 // centralPanel.setVisible(true);
29333559 // XYZPanel.setVisible(true);
29343560 bigThree.ClearUI();
3561
+ bigThree.add(scenePanel);
29353562 bigThree.add(centralPanel);
2936
- bigThree.add(XYZPanel);
29373563 bigThree.FlushUI();
3564
+
3565
+ cameraView.requestFocusInWindow();
29383566 } else
29393567 if (source == fourButton)
29403568 {
29413569 radio.layout = fourButton;
3570
+
3571
+ if (CameraPane.FULLSCREEN)
3572
+ fullscreenLayout = radio.layout;
29423573
29433574 // bigThree.remove(scenePanel);
29443575 // bigThree.remove(centralPanel);
....@@ -2970,10 +3601,15 @@
29703601 bigThree.ClearUI();
29713602 bigThree.add(scenePanel);
29723603 bigThree.FlushUI();
3604
+
3605
+ cameraView.requestFocusInWindow();
29733606 } else
29743607 if (source == sixButton)
29753608 {
29763609 radio.layout = sixButton;
3610
+
3611
+ if (CameraPane.FULLSCREEN)
3612
+ fullscreenLayout = radio.layout;
29773613
29783614 // bigThree.remove(scenePanel);
29793615 // bigThree.remove(centralPanel);
....@@ -3003,13 +3639,18 @@
30033639 // centralPanel.setVisible(true);
30043640 // XYZPanel.setVisible(false);
30053641 bigThree.ClearUI();
3006
- bigThree.add(scenePanel);
30073642 bigThree.add(centralPanel);
3643
+ bigThree.add(scenePanel);
30083644 bigThree.FlushUI();
3645
+
3646
+ cameraView.requestFocusInWindow();
30093647 } else
30103648 if (source == sevenButton)
30113649 {
30123650 radio.layout = sevenButton;
3651
+
3652
+ if (CameraPane.FULLSCREEN)
3653
+ fullscreenLayout = radio.layout;
30133654
30143655 // bigThree.remove(scenePanel);
30153656 // bigThree.remove(centralPanel);
....@@ -3043,6 +3684,8 @@
30433684 bigThree.add(centralPanel);
30443685 bigThree.add(XYZPanel);
30453686 bigThree.FlushUI();
3687
+
3688
+ cameraView.requestFocusInWindow();
30463689 } else
30473690 if (source == rootButton)
30483691 {
....@@ -3054,6 +3697,7 @@
30543697 EditObject(obj);
30553698 }
30563699
3700
+ cameraView.requestFocusInWindow();
30573701 refreshContents(true);
30583702 } else
30593703 if (source == closeButton)
....@@ -3063,22 +3707,37 @@
30633707 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
30643708 {
30653709 ab = (cRadio)e.nextElement();
3066
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3710
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
30673711 {
3712
+ // Patch to avoid bug with transparency.
3713
+ if (!ab.hadMaterial)
3714
+ {
3715
+ ab.object.material = null;
3716
+ }
3717
+
30683718 buttonGroup.remove(ab);
30693719 radioPanel.remove(ab);
30703720
3071
- ab.GetObject().editWindow = null;
3721
+ //ab.GetObject().editWindow = null;
3722
+ ab.GetObject().manipWindow = null;
30723723 // ab.GetObject().objectUI = null; // ?????????
30733724
30743725 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
30753726 break;
30763727 }
30773728 }
3729
+
3730
+ cameraView.requestFocusInWindow();
30783731 refreshContents(true);
30793732 } else
30803733 if (source == editItem || source == editButton)
30813734 {
3735
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3736
+ {
3737
+ Object3D child = (Object3D)e.nextElement();
3738
+ child.pinned = true;
3739
+ }
3740
+
30823741 EditSelection(false);
30833742 } else
30843743 if (source == uneditButton)
....@@ -3088,6 +3747,7 @@
30883747 Object3D child = (Object3D)e.nextElement();
30893748 if(child.editWindow != null)
30903749 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3750
+ child.pinned = false;
30913751 child.CloseUI();
30923752 listUI.remove(child);
30933753
....@@ -3104,6 +3764,7 @@
31043764 //copy.ClearUI();
31053765 for (Object3D obj : listUI)
31063766 {
3767
+ obj.pinned = false;
31073768 obj.CloseUI();
31083769 }
31093770 listUI.clear();
....@@ -3113,7 +3774,7 @@
31133774 {
31143775 assert(copy == group);
31153776
3116
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3777
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
31173778
31183779 for (Object3D obj : listUI)
31193780 {
....@@ -3162,6 +3823,9 @@
31623823 }
31633824
31643825 copy = group;
3826
+
3827
+ SetUndoStates();
3828
+
31653829 //Globals.theRenderer.object = group;
31663830 if(!useclient)
31673831 {
....@@ -3179,7 +3843,8 @@
31793843 }
31803844
31813845 // fix "+" issue
3182
- group.editWindow = this;
3846
+ //group.editWindow = this;
3847
+ group.manipWindow = this;
31833848
31843849 /*
31853850 currentLayout = radio.layout;
....@@ -3187,18 +3852,27 @@
31873852 currentLayout = sevenButton;
31883853 */
31893854 radio.layout.doClick();
3855
+
3856
+ ClearUnpinned();
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)
3861
+ EditSelection(false);
31903862 keepparent = group.parent;
31913863 // PARENT = NULL or not???
31923864 //group.parent = null; // ROOT
31933865 //group.attributes = -1;
31943866 ResetModel();
3867
+
3868
+ cameraView.requestFocusInWindow();
31953869 refreshContents(true);
31963870 } else if (event.getSource() == editCameraItem)
31973871 {
31983872 cameraView.ProtectCamera();
31993873 cameraView.repaint();
32003874 return;
3201
- } else if (event.getSource() == revertCameraItem)
3875
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
32023876 {
32033877 cameraView.RevertCamera();
32043878 cameraView.repaint();
....@@ -3215,7 +3889,6 @@
32153889 }
32163890
32173891 boolean useclient = false;
3218
- cRadio radio;
32193892
32203893 void ToggleRoot()
32213894 {
....@@ -3778,7 +4451,7 @@
37784451
37794452 try
37804453 {
3781
- texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4454
+ texturedata = Globals.theRenderer.GetTextureData(tex, false, node.texres);
37824455 }
37834456 catch (Exception e)
37844457 {
....@@ -4253,28 +4926,25 @@
42534926 // }
42544927 // }
42554928
4256
- static boolean allparams = true;
4257
-
4258
- static Vector<Object3D> listUI = new Vector<Object3D>();
4259
-
42604929 void EditSelection(boolean newWindow)
42614930 {
4931
+ if (group.selection == null)
4932
+ {
4933
+ EditElement(group, newWindow); // ? new
4934
+ return;
4935
+ }
4936
+
42624937 // aConstraints.gridy = 0;
42634938 for (int i=0; i<group.selection.size(); i++)
42644939 {
42654940 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
42664941 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4267
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4942
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
42684943
42694944 Object3D elem = (Object3D)group.selection.elementAt(i);
42704945 if(elem != group || !newWindow)
42714946 {
4272
- // if (!(elem instanceof Composite))
4273
- // newWindow = false;
4274
- listUI.add(elem);
4275
- elem.openEditWindow(this, newWindow); //, false);
4276
- System.out.println("edit : " + elem);
4277
- elem.editWindow.refreshContents(true); // ? new
4947
+ EditElement(elem, newWindow); // ? new
42784948 }
42794949 }
42804950 }
....@@ -4349,7 +5019,8 @@
43495019 //new Exception().printStackTrace();
43505020
43515021 freezemodel = true;
4352
-
5022
+ ClearUnpinned();
5023
+
43535024 /**/
43545025 //switch (event.id)
43555026 {
....@@ -4382,7 +5053,7 @@
43825053 if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
43835054 // a camera
43845055 {
4385
- if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera())
5056
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
43865057 {
43875058 CameraPane.camerachangeframe = 0; // don't refuse it
43885059 Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
....@@ -4391,6 +5062,13 @@
43915062 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
43925063 }
43935064
5065
+ if (tps != null && tps.length == 1)
5066
+ {
5067
+ EditSelection(false);
5068
+ }
5069
+
5070
+ SetPinStates(tps != null && tps.length > 0);
5071
+
43945072 refreshContents();
43955073 //return true;
43965074 }
....@@ -4400,9 +5078,18 @@
44005078 freezemodel = false;
44015079 }
44025080
5081
+ void SetPinStates(boolean enabled)
5082
+ {
5083
+ editButton.setEnabled(enabled);
5084
+ uneditButton.setEnabled(enabled);
5085
+ unselectButton.setEnabled(enabled);
5086
+ flashSelectionButton.setEnabled(enabled);
5087
+ }
5088
+
44035089 void refreshContents(boolean cp)
44045090 {
4405
- if (!Globals.MOUSEDRAGGED)
5091
+ if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
5092
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
44065093 {
44075094 objEditor.ClearInfo(); // .GetMaterial());
44085095
....@@ -4501,7 +5188,8 @@
45015188
45025189 if (cut)
45035190 {
4504
- Save();
5191
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
5192
+// Save();
45055193 //int indices[] = jList.getSelectedIndices();
45065194 //for (int i = indices.length - 1; i >= 0; i--)
45075195 //jList.remove(indices[i]);
....@@ -4604,6 +5292,10 @@
46045292
46055293 void paste(boolean expand)
46065294 {
5295
+ if (Globals.REPLACEONMAKE)
5296
+ Save();
5297
+ boolean keep = Globals.REPLACEONMAKE;
5298
+ Globals.REPLACEONMAKE = false;
46075299 // if (GrafreeD.clipboard == null)
46085300 // return;
46095301 boolean first = true;
....@@ -4663,6 +5355,7 @@
46635355 Grafreed.clipboard.get(0).parent = keepparent;
46645356 }
46655357
5358
+ Globals.REPLACEONMAKE = keep;
46665359 ResetModel();
46675360 refreshContents();
46685361 }
....@@ -4798,6 +5491,10 @@
47985491
47995492 void group(Object3D csg, boolean grab)
48005493 {
5494
+ if (Globals.REPLACEONMAKE)
5495
+ Save();
5496
+ boolean keep = Globals.REPLACEONMAKE;
5497
+ Globals.REPLACEONMAKE = false;
48015498 if (//false) // why??
48025499 !group.selection.isEmpty())
48035500 {
....@@ -4911,10 +5608,15 @@
49115608 //node.add(csg);
49125609 //makeSomething(node);
49135610 makeSomething(csg);
5611
+ Globals.REPLACEONMAKE = keep;
49145612 }
49155613
49165614 void Ungroup(Object3D g)
49175615 {
5616
+ if (Globals.REPLACEONMAKE)
5617
+ Save();
5618
+ boolean keep = Globals.REPLACEONMAKE;
5619
+ Globals.REPLACEONMAKE = false;
49185620 if (g instanceof HiddenObject)
49195621 {
49205622 HiddenObject h = (HiddenObject) g;
....@@ -4931,6 +5633,7 @@
49315633 objEditor.makeSomething(g.get(i), false);
49325634 }
49335635 }
5636
+ Globals.REPLACEONMAKE = keep;
49345637 }
49355638
49365639 void ungroup()
....@@ -5219,10 +5922,44 @@
52195922 cButton clearpanelButton;
52205923 cButton unselectButton;
52215924
5925
+ cButton restoreCameraButton;
5926
+
52225927 cButton saveButton;
5223
- cButton undoButton;
5224
- cButton redoButton;
52255928 cButton oneStepButton;
5929
+
5930
+ cButton groupButton;
5931
+ cButton ungroupButton;
5932
+ cButton compositeButton;
5933
+ cButton switchButton;
5934
+ cButton loopButton;
5935
+ cButton textureButton;
5936
+
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
+
5953
+ cButton gridButton;
5954
+ cButton boxButton;
5955
+ cButton sphereButton;
5956
+ cButton coneButton;
5957
+ cButton torusButton;
5958
+ cButton superButton;
5959
+ cButton kleinButton;
5960
+ cButton particlesButton;
5961
+ cButton overlayButton;
5962
+ cButton lightButton;
52265963
52275964 cButton screenfitButton;
52285965 cButton screenfitpointButton;
....@@ -5235,14 +5972,6 @@
52355972
52365973 cButton setsupportButton;
52375974
5238
- cButton twoButton;
5239
- cButton sixButton;
5240
- cButton threeButton;
5241
- cButton sevenButton;
5242
- cButton fourButton; // full panel
5243
- cButton oneButton; // full XYZ
5244
- //cButton currentLayout;
5245
-
52465975 //
52475976 //Composite
52485977 Object3D // to do !!
....@@ -5252,11 +5981,11 @@
52525981 //JTree jTree;
52535982 private MenuItem lookAtItem;
52545983 private MenuItem lookFromItem;
5255
- private MenuItem switchItem;
5984
+ private MenuItem switchViewItem;
52565985 private MenuItem cutItem;
52575986 private MenuItem undoItem;
52585987 private MenuItem redoItem;
5259
- private MenuItem duplicateItem;
5988
+ private JMenuItem duplicateItem;
52605989 private MenuItem cloneItem;
52615990 private MenuItem cloneSupportItem;
52625991 private MenuItem overwriteGeoItem;
....@@ -5284,7 +6013,7 @@
52846013 private MenuItem pasteLinkItem;
52856014 private MenuItem pasteCloneItem;
52866015 private MenuItem pasteExpandItem;
5287
- private MenuItem clearItem;
6016
+ private MenuItem deleteItem;
52886017 private MenuItem clearAllItem;
52896018 private MenuItem genUVItem;
52906019 private MenuItem genNormalsMESHItem;
....@@ -5344,7 +6073,7 @@
53446073 private MenuItem frontItem;
53456074 private MenuItem cameraItem;
53466075 private MenuItem compositeItem;
5347
- private MenuItem randomItem;
6076
+ private MenuItem switchItem;
53486077 private MenuItem physicsItem;
53496078 private MenuItem frameselectorItem;
53506079 private MenuItem scriptNodeItem;
....@@ -5368,6 +6097,8 @@
53686097 private MenuItem attachBumpItem;
53696098 private MenuItem detachBumpItem;
53706099 private MenuItem pigmentBumpItem;
6100
+ private MenuItem embedTexturesItem;
6101
+ private MenuItem deEmbedTexturesItem;
53716102
53726103 private MenuItem particleItem;
53736104 private MenuItem ragdollItem;
....@@ -5418,5 +6149,5 @@
54186149
54196150 Menu cameraMenu;
54206151 MenuItem editCameraItem;
5421
- MenuItem revertCameraItem;
6152
+ MenuItem restoreCameraItem;
54226153 }