Normand Briere
2019-07-28 d7fd07756f4095cb87dc25d89fcffcbda092e2cf
GroupEditor.java
....@@ -23,6 +23,237 @@
2323 DragGestureListener, DragSourceListener, DropTargetListener,
2424 ItemListener // ListSelectionListener
2525 {
26
+
27
+ public void AddSkyboxButton(String f, String s, cGridBag row)
28
+ {
29
+ cButton skyboxButton;
30
+ final String path = "cubemaps/" + f + "-skyboxes/" + s;
31
+ //row.add(skyboxButton = GetButton(path + "/" + s + ".jpg", !Grafreed.NIMBUSLAF));
32
+ row.add(skyboxButton = GetButton(path + "/negx.jpg", !Grafreed.NIMBUSLAF));
33
+ skyboxButton.setToolTipText(s);
34
+ skyboxButton.addActionListener(new ActionListener()
35
+ {
36
+ @Override
37
+ public void actionPerformed(ActionEvent e)
38
+ {
39
+ ChangeSkybox(path);
40
+ }
41
+ });
42
+ }
43
+
44
+ public void AddSkyboxTab0(JTabbedPane skyboxpanel)
45
+ {
46
+ cGridBag tab0 = new cGridBag().setVertical(true);
47
+
48
+ tab0.setName("Urban");
49
+ skyboxpanel.add(tab0);
50
+
51
+ cGridBag row0 = new cGridBag();
52
+ cGridBag row1 = new cGridBag();
53
+ cGridBag row2 = new cGridBag();
54
+ cGridBag row3 = new cGridBag();
55
+ cGridBag row4 = new cGridBag();
56
+ cGridBag row5 = new cGridBag();
57
+ cGridBag row6 = new cGridBag();
58
+
59
+ AddSkyboxButton("default", "rgb", row0);
60
+ AddSkyboxButton("default", "cornell", row0);
61
+ AddSkyboxButton("default", "uffizi", row0);
62
+ AddSkyboxButton("default", "CloudyHills", row0);
63
+
64
+ AddSkyboxButton("default", "skycube", row1);
65
+ AddSkyboxButton("bridge", "Bridge", row1);
66
+ AddSkyboxButton("bridge", "Bridge2", row1);
67
+ AddSkyboxButton("urban", "GamlaStan2", row1);
68
+
69
+ AddSkyboxButton("urban", "Parliament", row2);
70
+ AddSkyboxButton("urban", "Roundabout", row2);
71
+ AddSkyboxButton("urban", "SaintLazarusChurch", row2);
72
+ AddSkyboxButton("urban", "SaintLazarusChurch2", row2);
73
+
74
+ AddSkyboxButton("urban", "SaintLazarusChurch3", row3);
75
+ AddSkyboxButton("urban", "UnionSquare", row3);
76
+ AddSkyboxButton("park", "BerzeliiPark", row3);
77
+ AddSkyboxButton("park", "Buddha", row3);
78
+
79
+ AddSkyboxButton("park", "CNTower2", row4);
80
+ AddSkyboxButton("park", "NiagaraFalls1", row4);
81
+ AddSkyboxButton("park", "NiagaraFalls3", row4);
82
+ AddSkyboxButton("park", "Park", row4);
83
+
84
+ AddSkyboxButton("park", "Pond", row5);
85
+ AddSkyboxButton("park", "Skansen", row5);
86
+ AddSkyboxButton("park", "Skansen2", row5);
87
+ AddSkyboxButton("park", "Skansen3", row5);
88
+
89
+ AddSkyboxButton("park", "Skansen4", row6);
90
+ AddSkyboxButton("park", "Skansen5", row6);
91
+ AddSkyboxButton("park", "Stairs", row6);
92
+ AddSkyboxButton("park", "Tantolunden4", row6);
93
+
94
+ tab0.add(row0);
95
+ tab0.add(row1);
96
+ tab0.add(row2);
97
+ tab0.add(row3);
98
+ tab0.add(row4);
99
+ tab0.add(row5);
100
+ tab0.add(row6);
101
+
102
+ for (int i=5; --i>=0;)
103
+ {
104
+ //oe.toolboxPanel.Return();
105
+ //tab0.add(new cGridBag());
106
+ }
107
+ }
108
+
109
+ public void AddSkyboxTab1(JTabbedPane skyboxpanel)
110
+ {
111
+ cGridBag tab0 = new cGridBag().setVertical(true);
112
+
113
+ tab0.setName("Nature");
114
+ skyboxpanel.add(tab0);
115
+
116
+ cGridBag row0 = new cGridBag();
117
+ cGridBag row1 = new cGridBag();
118
+ cGridBag row2 = new cGridBag();
119
+ cGridBag row3 = new cGridBag();
120
+ cGridBag row4 = new cGridBag();
121
+ cGridBag row5 = new cGridBag();
122
+ cGridBag row6 = new cGridBag();
123
+
124
+ AddSkyboxButton("beach", "HeartInTheSand", row0);
125
+ AddSkyboxButton("beach", "LarnacaBeach", row0);
126
+ AddSkyboxButton("beach", "PalmTrees", row0);
127
+ AddSkyboxButton("beach", "Tenerife", row0);
128
+
129
+ AddSkyboxButton("beach", "Tenerife2", row1);
130
+ AddSkyboxButton("beach", "Tenerife3", row1);
131
+ AddSkyboxButton("field", "FishPond", row1);
132
+ AddSkyboxButton("field", "Footballfield", row1);
133
+
134
+ AddSkyboxButton("field", "Meadow", row2);
135
+ AddSkyboxButton("field", "Sorsele", row2);
136
+ AddSkyboxButton("field", "Sorsele2", row2);
137
+ AddSkyboxButton("field", "Sorsele3", row2);
138
+
139
+ AddSkyboxButton("forest", "Brudslojan", row3);
140
+ AddSkyboxButton("forest", "Langholmen2", row3);
141
+ AddSkyboxButton("forest", "Plants", row3);
142
+ AddSkyboxButton("mountain", "Maskonaive", row3);
143
+ AddSkyboxButton("mountain", "Maskonaive2", row4);
144
+
145
+ AddSkyboxButton("mountain", "Maskonaive3", row4);
146
+ AddSkyboxButton("mountain", "Ryfjallet", row4);
147
+ AddSkyboxButton("mountain", "Teide", row4);
148
+
149
+ AddSkyboxButton("rocky", "Langholmen", row5);
150
+ AddSkyboxButton("rocky", "Riddarfjarden", row5);
151
+ AddSkyboxButton("rocky", "Skinnarviksberget", row5);
152
+ AddSkyboxButton("rocky", "Tantolunden6", row5);
153
+ /*
154
+Kastellholmen
155
+Langholmen
156
+Riddarfjarden
157
+Skinnarviksberget
158
+Tanto
159
+Tantolunden2
160
+Tantolunden6
161
+ */
162
+
163
+ tab0.add(row0);
164
+ tab0.add(row1);
165
+ tab0.add(row2);
166
+ tab0.add(row3);
167
+ tab0.add(row4);
168
+ tab0.add(row5);
169
+ tab0.add(row6);
170
+
171
+ for (int i=5; --i>=0;)
172
+ {
173
+ //oe.toolboxPanel.Return();
174
+ //tab0.add(new cGridBag());
175
+ }
176
+ }
177
+
178
+ public void AddSkyboxTab2(JTabbedPane skyboxpanel)
179
+ {
180
+ cGridBag tab0 = new cGridBag().setVertical(true);
181
+
182
+ tab0.setName("Night");
183
+ skyboxpanel.add(tab0);
184
+
185
+ cGridBag row0 = new cGridBag();
186
+ cGridBag row1 = new cGridBag();
187
+ cGridBag row2 = new cGridBag();
188
+ cGridBag row3 = new cGridBag();
189
+ cGridBag row4 = new cGridBag();
190
+ cGridBag row5 = new cGridBag();
191
+ cGridBag row6 = new cGridBag();
192
+
193
+ AddSkyboxButton("night", "NightPath", row0);
194
+ AddSkyboxButton("night", "PondNight", row0);
195
+ AddSkyboxButton("night", "Powerlines", row0);
196
+ AddSkyboxButton("night", "SwedishRoyalCastle", row0);
197
+
198
+ AddSkyboxButton("urban", "CNTower", row1);
199
+ AddSkyboxButton("bridge", "ArstaBridge", row1);
200
+ AddSkyboxButton("indoors", "DallasW", row1);
201
+ AddSkyboxButton("indoors", "MarriottMadisonWest", row1);
202
+
203
+ AddSkyboxButton("indoors", "Vasa", row2);
204
+ AddSkyboxButton("winter", "Backyard", row2);
205
+ AddSkyboxButton("winter", "Creek", row2);
206
+ AddSkyboxButton("winter", "FootballField3", row2);
207
+
208
+ AddSkyboxButton("winter", "Forest", row3);
209
+ AddSkyboxButton("winter", "HornstullsStrand2", row3);
210
+ AddSkyboxButton("winter", "House", row3);
211
+ AddSkyboxButton("winter", "IceLake", row3);
212
+
213
+ AddSkyboxButton("winter", "IceRiver", row4);
214
+ AddSkyboxButton("winter", "Park3", row4);
215
+ AddSkyboxButton("winter", "PondWinter", row4);
216
+
217
+ AddSkyboxButton("winter", "Tantolunden5", row5);
218
+ AddSkyboxButton("winter", "Vindelalven", row5);
219
+ /*
220
+Backyard
221
+Creek
222
+FootballField3
223
+Forest
224
+HornstullsStrand2
225
+House
226
+IceLake
227
+IceRiver
228
+Park3
229
+PondWinter
230
+Tantolunden5
231
+Vindelalven *
232
+ */
233
+
234
+ tab0.add(row0);
235
+ tab0.add(row1);
236
+ tab0.add(row2);
237
+ tab0.add(row3);
238
+ tab0.add(row4);
239
+ tab0.add(row5);
240
+ tab0.add(row6);
241
+
242
+ for (int i=5; --i>=0;)
243
+ {
244
+ //oe.toolboxPanel.Return();
245
+ //tab0.add(new cGridBag());
246
+ }
247
+ }
248
+
249
+ public void ChangeSkybox(String name)
250
+ {
251
+ cameraView.envyoff = false;
252
+ cameraView.skyboxname = name;
253
+ cameraView.skyboxext = "jpg";
254
+ cameraView.repaint();
255
+ }
256
+
26257 //ObjEditor objEditor;
27258 public void closeUI2()
28259 {
....@@ -60,6 +291,12 @@
60291 this.copy = this.group = group;
61292 //selectees = this.group.selectees;
62293
294
+ if (copy.versions == null)
295
+ {
296
+ copy.versions = new byte[100][];
297
+ copy.versionindex = -1;
298
+ }
299
+
63300 if(ui)
64301 SetupUI(objEditor);
65302 }
....@@ -80,10 +317,22 @@
80317 SetupViews(objEditor);
81318
82319 ((cRadio)radioPanel.getComponent(0)).SetCamera(cameraView.renderCamera, true);
320
+
321
+ if (copy.versions == null)
322
+ {
323
+ copy.versions = new byte[100][];
324
+ copy.versionindex = -1;
325
+
326
+ Save(true);
327
+ }
83328 }
84329
85330 void CloneSelection(boolean supports)
86331 {
332
+ if (Globals.REPLACEONMAKE)
333
+ Save();
334
+ boolean keep = Globals.REPLACEONMAKE;
335
+ Globals.REPLACEONMAKE = false;
87336 // Object3D keep = GrafreeD.clipboard;
88337 //Object3D obj;
89338 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -94,6 +343,7 @@
94343
95344 makeSomething(clone, i==group.selection.size()-1);
96345 }
346
+ Globals.REPLACEONMAKE = keep;
97347 }
98348
99349 void CloneClipboard(boolean supports)
....@@ -150,6 +400,8 @@
150400
151401 void SetupMenu2(GroupEditor oe)
152402 {
403
+ oe.jTree = new cTree();
404
+
153405 Menu menu;
154406 oe.menuBar.add(menu = new Menu("Edit"));
155407 //editItem = menu.add(new MenuItem("Edit"));
....@@ -160,7 +412,7 @@
160412 // redoItem = menu.add(new MenuItem("Redo"));
161413 // redoItem.addActionListener(this);
162414 // menu.add("-");
163
- duplicateItem = menu.add(new MenuItem("Duplicate"));
415
+ duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
164416 duplicateItem.addActionListener(this);
165417 cloneItem = menu.add(new MenuItem("Clone"));
166418 cloneItem.addActionListener(this);
....@@ -176,7 +428,6 @@
176428 copyItem.addActionListener(this);
177429 pasteItem = menu.add(new MenuItem("Paste"));
178430 pasteItem.addActionListener(this);
179
- menu.add("-");
180431
181432 menu.add("-");
182433 pasteIntoItem = menu.add(new MenuItem("Paste into"));
....@@ -188,8 +439,8 @@
188439 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
189440 // pasteExpandItem.addActionListener(this);
190441 menu.add("-");
191
- clearItem = menu.add(new MenuItem("Clear"));
192
- clearItem.addActionListener(this);
442
+ deleteItem = menu.add(new MenuItem("Delete"));
443
+ deleteItem.addActionListener(this);
193444
194445 if (Globals.ADVANCED)
195446 {
....@@ -203,23 +454,23 @@
203454 //zBufferItem.addActionListener(this);
204455 //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
205456 //normalLensItem.addActionListener(this);
206
- cameraMenu.add(revertCameraItem = new MenuItem("Restore Viewpoint"));
207
- revertCameraItem.addActionListener(this);
457
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
458
+ restoreCameraItem.addActionListener(this);
208459
209
- cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
210
- toggleFullScreenItem.addItemListener(this);
211
- toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
212
- cameraMenu.add("-");
460
+// cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
461
+// toggleFullScreenItem.addItemListener(this);
462
+// toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
463
+// cameraMenu.add("-");
464
+//
465
+// cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
466
+// toggleTextureItem.addItemListener(this);
467
+// toggleTextureItem.setState(CameraPane.textureon);
468
+//
469
+// cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
470
+// toggleSwitchItem.addItemListener(this);
471
+// toggleSwitchItem.setState(CameraPane.SWITCH);
213472
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"));
473
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
223474 toggleHandleItem.addItemListener(this);
224475 toggleHandleItem.setState(CameraPane.HANDLES);
225476
....@@ -246,7 +497,7 @@
246497
247498 cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
248499 toggleDebugItem.addItemListener(this);
249
- toggleDebugItem.setState(CameraPane.DEBUG);
500
+ toggleDebugItem.setState(Globals.DEBUG);
250501
251502 cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
252503 toggleFrustumItem.addItemListener(this);
....@@ -274,7 +525,7 @@
274525 {
275526 oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
276527 //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
277
- //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
528
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
278529 editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
279530 oe.cameraMenu.add("-");
280531 openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
....@@ -282,7 +533,7 @@
282533 editLeafItem.addActionListener(this);
283534 lookAtItem.addActionListener(this);
284535 //lookFromItem.addActinoListener(this);
285
- //switchItem.addActionListener(this);
536
+ //switchViewItem.addActionListener(this);
286537 }
287538
288539 oe.menuBar.add(menu = new Menu("Setting"));
....@@ -327,21 +578,29 @@
327578 }
328579
329580 oe.menuBar.add(menu = new Menu("Group"));
330
- grabItem = menu.add(new MenuItem("Grab"));
331
- grabItem.addActionListener(this);
581
+// grabItem = menu.add(new MenuItem("Grab"));
582
+// grabItem.addActionListener(this);
332583 backItem = menu.add(new MenuItem("Back"));
333584 backItem.addActionListener(this);
334585 frontItem = menu.add(new MenuItem("Front"));
335586 frontItem.addActionListener(this);
336
- compositeItem = menu.add(new MenuItem("Composite"));
337
- compositeItem.addActionListener(this);
587
+// compositeItem = menu.add(new MenuItem("Composite"));
588
+// compositeItem.addActionListener(this);
589
+
590
+ if (Globals.ADVANCED)
591
+ {
338592 hideItem = menu.add(new MenuItem("Hidden Group"));
339593 hideItem.addActionListener(this);
594
+ }
340595 ungroupItem = menu.add(new MenuItem("Ungroup"));
341596 ungroupItem.addActionListener(this);
342
- menu.add("-");
343
- randomItem = menu.add(new MenuItem("Switch node"));
344
- randomItem.addActionListener(this);
597
+
598
+// menu.add("-");
599
+//
600
+// switchItem = menu.add(new MenuItem("Switch node"));
601
+// switchItem.addActionListener(this);
602
+ if (Globals.ADVANCED)
603
+ {
345604 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
346605 switchGeoItem.addActionListener(this);
347606 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
....@@ -349,8 +608,6 @@
349608 morphItem = menu.add(new MenuItem("Morph Group"));
350609 morphItem.addActionListener(this);
351610
352
- if (Globals.ADVANCED)
353
- {
354611 menu.add("-");
355612 physicsItem = menu.add(new MenuItem("Physics"));
356613 physicsItem.addActionListener(this);
....@@ -358,30 +615,29 @@
358615 frameselectorItem.addActionListener(this);
359616 scriptNodeItem = menu.add(new MenuItem("Script Node"));
360617 scriptNodeItem.addActionListener(this);
361
- cameraItem = menu.add(new MenuItem("Camera"));
362
- cameraItem.addActionListener(this);
363618 }
364619
365620 oe.menuBar.add(menu = new Menu("Object"));
366
- textureItem = menu.add(new MenuItem("Texture"));
367
- textureItem.addActionListener(this);
621
+// textureItem = menu.add(new MenuItem("Texture"));
622
+// textureItem.addActionListener(this);
368623 billboardItem = menu.add(new MenuItem("Billboard"));
369624 billboardItem.addActionListener(this);
370625 csgItem = menu.add(new MenuItem("CSG"));
371626 csgItem.addActionListener(this);
372
- shadowXItem = menu.add(new MenuItem("Shadow X"));
627
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
373628 shadowXItem.addActionListener(this);
374
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
629
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
375630 shadowYItem.addActionListener(this);
376
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
631
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
377632 shadowZItem.addActionListener(this);
633
+ attributeItem = menu.add(new MenuItem("Attribute"));
634
+ attributeItem.addActionListener(this);
635
+
378636 if (Globals.ADVANCED)
379637 {
380638 menu.add("-");
381639 linkerItem = menu.add(new MenuItem("Linker"));
382640 linkerItem.addActionListener(this);
383
- attributeItem = menu.add(new MenuItem("Attribute"));
384
- attributeItem.addActionListener(this);
385641 templateItem = menu.add(new MenuItem("Template"));
386642 templateItem.addActionListener(this);
387643 pointflowItem = menu.add(new MenuItem("Point Flow"));
....@@ -410,7 +666,7 @@
410666 genNormalsMESHItem.addActionListener(this);
411667 if (Globals.ADVANCED)
412668 {
413
- genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
669
+ genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
414670 genNormalsMINEItem.addActionListener(this);
415671 }
416672 stripifyItem = menu.add(new MenuItem("Stripify"));
....@@ -470,6 +726,14 @@
470726 markleavesItem.addActionListener(this);
471727 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
472728 unmarkleavesItem.addActionListener(this);
729
+ rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
730
+ rewindleavesItem.addActionListener(this);
731
+ unrewindleavesItem = menu.add(new MenuItem("Unrewind Leaves"));
732
+ unrewindleavesItem.addActionListener(this);
733
+ randomleavesItem = menu.add(new MenuItem("Random Leaves"));
734
+ randomleavesItem.addActionListener(this);
735
+ unrandomleavesItem = menu.add(new MenuItem("Unrandom Leaves"));
736
+ unrandomleavesItem.addActionListener(this);
473737 menu.add("-");
474738 flipVItem = menu.add(new MenuItem("Flip V"));
475739 flipVItem.addActionListener(this);
....@@ -495,10 +759,15 @@
495759 attachBumpItem.addActionListener(this);
496760 pigmentBumpItem = menu.add(new MenuItem("Pigment -> Bump"));
497761 pigmentBumpItem.addActionListener(this);
762
+ //embedTexturesItem
498763 detachPigmentItem = menu.add(new MenuItem("Detach Pigment"));
499764 detachPigmentItem.addActionListener(this);
500765 detachBumpItem = menu.add(new MenuItem("Detach Bump"));
501766 detachBumpItem.addActionListener(this);
767
+ embedTexturesItem = menu.add(new MenuItem("Embed Textures"));
768
+ embedTexturesItem.addActionListener(this);
769
+ deEmbedTexturesItem = menu.add(new MenuItem("De-embed Textures"));
770
+ deEmbedTexturesItem.addActionListener(this);
502771 menu.add("-");
503772 sortbysizeItem = menu.add(new MenuItem("Sort by size"));
504773 sortbysizeItem.addActionListener(this);
....@@ -525,8 +794,21 @@
525794 buildToolsMenu(menu);
526795 }
527796
797
+
528798 void SetupUI2(ObjEditor oe)
529799 {
800
+ // June 2019
801
+ if (oe == null)
802
+ {
803
+ //super.SetupUI2(this);
804
+ //return;
805
+ }
806
+
807
+ if (copy != group)
808
+ {
809
+ //super.SetupUI2(this);
810
+ }
811
+
530812 //new Exception().printStackTrace();
531813
532814 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -555,39 +837,79 @@
555837 oe.radioPanel.add(dummyButton);
556838 oe.buttonGroup.add(dummyButton);
557839 */
840
+ cGridBag copyOptionsPanel = new cGridBag();
841
+
842
+ copyOptionsPanel.preferredHeight = 2;
843
+
558844 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
559845
560
- oe.toolbarPanel.add(undoButton = new cButton("Undo", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
561
- undoButton.setToolTipText("Undo changes");
562
- undoButton.addActionListener(this);
846
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
847
+ //minButton.setToolTipText("Minimize window");
848
+ //minButton.addActionListener(this);
563849
564
- oe.toolbarPanel.add(redoButton = new cButton("Redo", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
565
- redoButton.setToolTipText("Redo changes");
566
- redoButton.addActionListener(this);
850
+ if (Globals.ADVANCED)
851
+ {
852
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
853
+ maxButton.setToolTipText("Maximize window");
854
+ maxButton.addActionListener(this);
855
+ }
567856
568
- oe.toolbarPanel.add(saveButton = new cButton("Save", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
569
- saveButton.setToolTipText("Save changes");
857
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
858
+ fullButton.setToolTipText("Full-screen window");
859
+ fullButton.addActionListener(this);
860
+
861
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
862
+ screenfitButton.setToolTipText("Screen fit");
863
+ screenfitButton.addActionListener(this);
864
+
865
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
866
+ restoreCameraButton.setToolTipText("Restore viewpoint");
867
+ restoreCameraButton.addActionListener(this);
868
+
869
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
870
+ saveButton.setToolTipText("New version");
570871 saveButton.addActionListener(this);
872
+
873
+ copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
874
+ undoButton.setToolTipText("Previous version");
875
+ undoButton.addActionListener(this);
876
+ undoButton.setEnabled(false);
571877
572
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
878
+ cGridBag updown = new cGridBag().setVertical(true);
879
+ updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
880
+ restoreButton.setToolTipText("Restore current");
881
+ restoreButton.addActionListener(this);
882
+ restoreButton.setEnabled(false);
883
+
884
+ updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
885
+ replaceButton.setToolTipText("Replace current");
886
+ replaceButton.addActionListener(this);
887
+ replaceButton.setEnabled(false);
888
+
889
+ copyOptionsPanel.add(updown);
890
+
891
+ copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
892
+ redoButton.setToolTipText("Next version");
893
+ redoButton.addActionListener(this);
894
+ redoButton.setEnabled(false);
895
+
896
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
573897 liveCB.setToolTipText("Enable animation");
574898 liveCB.addItemListener(this);
575899
576
- oe.toolbarPanel.add(oneStepButton = new cButton("Step", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
900
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
577901 oneStepButton.setToolTipText("Animate one step forward");
578902 oneStepButton.addActionListener(this);
579903
580
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
904
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
581905 fastCB.setToolTipText("Fast mode");
582906 fastCB.addItemListener(this);
583907
584
- oe.toolbarPanel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
585
- trackCB.setToolTipText("Enable tracking");
586
- trackCB.addItemListener(this);
587
-
588
- oe.toolbarPanel.add(screenfitButton = new cButton("@", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
589
- screenfitButton.setToolTipText("Screen fit");
590
- screenfitButton.addActionListener(this);
908
+ //oe.toolboxPanel.Return();
909
+
910
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
911
+// trackCB.setToolTipText("Enable tracking");
912
+// trackCB.addItemListener(this);
591913
592914 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
593915 // screenfitpointButton.addActionListener(this);
....@@ -597,67 +919,155 @@
597919 oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
598920 snapobjectButton.addActionListener(this);
599921 snapobjectButton.setToolTipText("Snap Object");
922
+
923
+ oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
924
+ fourButton.addActionListener(this);
925
+ fourButton.setToolTipText("Show control panel only");
600926 }
601927
602
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
603
- flashSelectionButton.setToolTipText("Show selection");
604
- flashSelectionButton.addActionListener(this);
928
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
605929
606
- oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
607
-
608
- oe.toolbarPanel.add(twoButton = new cButton("|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
609
- twoButton.setToolTipText("Show center view only");
930
+ oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
931
+ twoButton.setToolTipText("Show 3D view only");
610932 twoButton.addActionListener(this);
611
- oe.toolbarPanel.add(fourButton = new cButton("+||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
612
- fourButton.addActionListener(this);
613
- fourButton.setToolTipText("Show left panel only");
614
- oe.toolbarPanel.add(sixButton = new cButton("+|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
615
- sixButton.setToolTipText("2-column layout left");
616
- sixButton.addActionListener(this);
617
- oe.toolbarPanel.add(threeButton = new cButton("|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
618
- threeButton.setToolTipText("2-column layout right");
933
+ this.fullscreenLayout = twoButton;
934
+
935
+ oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
936
+ threeButton.setToolTipText("Show controls and 3D view");
619937 threeButton.addActionListener(this);
620
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
621
- sevenButton.setToolTipText("3-column layout");
622
- sevenButton.addActionListener(this);
938
+ oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
939
+ sixButton.setToolTipText("Show 3D view and controls");
940
+ sixButton.addActionListener(this);
941
+// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
942
+// sevenButton.setToolTipText("3-column layout");
943
+// sevenButton.addActionListener(this);
623944 //
624945
625
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
626
- rootButton.setToolTipText("Edit selection in new tab");
946
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
947
+ rootButton.setToolTipText("Open selection in new tab");
627948 rootButton.addActionListener(this);
628949
629
- oe.toolbarPanel.add(closeButton = new cButton("X", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
950
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
630951 closeButton.setToolTipText("Close tab");
631952 closeButton.addActionListener(this);
632953 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
633954 //clearButton.addActionListener(this);
634
-
635
- cGridBag commandsPanel = new cGridBag();
955
+
956
+ cGridBag row1 = new cGridBag();
636957
637
- commandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
638
- editButton.setToolTipText("Edit selection");
958
+ // INSERT
959
+ row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
960
+ gridButton.setToolTipText("Create grid");
961
+ gridButton.addActionListener(this);
962
+
963
+ row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
964
+ boxButton.setToolTipText("Create box");
965
+ boxButton.addActionListener(this);
966
+
967
+ row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
968
+ sphereButton.setToolTipText("Create sphere");
969
+ sphereButton.addActionListener(this);
970
+
971
+ row1.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
972
+ coneButton.setToolTipText("Create cone");
973
+ coneButton.addActionListener(this);
974
+
975
+ row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
976
+ torusButton.setToolTipText("Create torus");
977
+ torusButton.addActionListener(this);
978
+
979
+ row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
980
+ superButton.setToolTipText("Create superellipsoid");
981
+ superButton.addActionListener(this);
982
+
983
+ if (Globals.ADVANCED)
984
+ {
985
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
986
+ kleinButton.setToolTipText("Create Klein bottle");
987
+ kleinButton.addActionListener(this);
988
+ }
989
+
990
+ row1.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
991
+ particlesButton.setToolTipText("Create particle system");
992
+ particlesButton.addActionListener(this);
993
+
994
+ oe.toolboxPanel.add(row1);
995
+
996
+ cGridBag row2 = new cGridBag();
997
+
998
+ row2.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
999
+ groupButton.setToolTipText("Create group");
1000
+ groupButton.addActionListener(this);
1001
+
1002
+ row2.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1003
+ compositeButton.setToolTipText("Create composite");
1004
+ compositeButton.addActionListener(this);
1005
+
1006
+ row2.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1007
+ switchButton.setToolTipText("Create item switcher");
1008
+ switchButton.addActionListener(this);
1009
+
1010
+ row2.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1011
+ loopButton.setToolTipText("Create loop");
1012
+ loopButton.addActionListener(this);
1013
+
1014
+ row2.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1015
+ textureButton.setToolTipText("Create texture");
1016
+ textureButton.addActionListener(this);
1017
+
1018
+ row2.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1019
+ overlayButton.setToolTipText("Create overlay");
1020
+ overlayButton.addActionListener(this);
1021
+
1022
+ row2.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1023
+ lightButton.setToolTipText("Create light");
1024
+ lightButton.addActionListener(this);
1025
+
1026
+ oe.toolboxPanel.add(row2);
1027
+
1028
+ // ENVYMAPS
1029
+ cGridBag skyboxpane = new cGridBag();
1030
+ skyboxpane.preferredHeight = 100;
1031
+
1032
+ oe.toolboxPanel.add(skyboxpane);
1033
+
1034
+ JTabbedPane skyboxpanel = new JTabbedPane();
1035
+ skyboxpane.add(skyboxpanel);
1036
+
1037
+ AddSkyboxTab0(skyboxpanel);
1038
+ AddSkyboxTab1(skyboxpanel);
1039
+ AddSkyboxTab2(skyboxpanel);
1040
+
1041
+ // EDIT panel
1042
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1043
+ editButton.setToolTipText("Pin selection controls");
6391044 editButton.addActionListener(this);
6401045
641
- commandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
642
- uneditButton.setToolTipText("Unedit selection");
1046
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1047
+ uneditButton.setToolTipText("Remove selection controls");
6431048 uneditButton.addActionListener(this);
6441049
645
- commandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
646
- allParamsButton.setToolTipText("Edit all params");
1050
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
1051
+ allParamsButton.setToolTipText("Show all controle");
6471052 allParamsButton.addActionListener(this);
6481053
649
- commandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1054
+ editCommandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
6501055 clearPanelButton.setToolTipText("Clear edit panel");
6511056 clearPanelButton.addActionListener(this);
6521057
653
- commandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1058
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
6541059 unselectButton.setToolTipText("Unselect");
6551060 unselectButton.addActionListener(this);
6561061
657
- commandsPanel.preferredHeight = 1;
1062
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1063
+ flashSelectionButton.setToolTipText("Highlight selection");
1064
+ flashSelectionButton.addActionListener(this);
6581065
659
- oe.treePanel.add(commandsPanel);
660
- oe.treePanel.Return();
1066
+ editCommandsPanel.preferredHeight = 1;
1067
+
1068
+ SetPinStates(false);
1069
+// oe.treePanel.add(commandsPanel);
1070
+// oe.treePanel.Return();
6611071
6621072 // oe.aConstraints.gridx += 1;
6631073 // oe.aConstraints.weighty = 0;
....@@ -674,32 +1084,20 @@
6741084
6751085 JScrollPane jSP;
6761086 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
677
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
1087
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
6781088 ResetModel();
6791089
6801090 oe.treePanel.add(jSPPanel);
6811091 oe.treePanel.Return();
6821092
683
- cGridBag copyOptionsPanel = new cGridBag();
684
-
685
- copyOptionsPanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
686
- colorCB.setToolTipText("Copy color when dropped");
687
- colorCB.addItemListener(this);
688
-
689
- copyOptionsPanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
690
- materialCB.setToolTipText("Copy material when dropped");
691
- materialCB.addItemListener(this);
692
-
693
- copyOptionsPanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
694
- textureCB.setToolTipText("Copy texture when dropped");
695
- textureCB.addItemListener(this);
696
-
697
- copyOptionsPanel.preferredHeight = 1;
6981093 oe.treePanel.add(copyOptionsPanel);
6991094 oe.treePanel.Return();
1095
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1096
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
1097
+ sliderPane.preferredHeight = 1;
7001098
701
-// mainPanel.setDividerLocation(0.5); //1.0);
702
-// mainPanel.setResizeWeight(0.5);
1099
+// mainPanel.setDividerLocation(0.1); //1.0);
1100
+ mainPanel.setResizeWeight(0.4);
7031101
7041102 //jList.addListSelectionListener(this);
7051103 oe.jTree.addTreeSelectionListener(this);
....@@ -707,7 +1105,7 @@
7071105 //jTree.setEditable(true);
7081106 oe.jTree.setDragEnabled(true);
7091107 //jTree.setPreferredSize(new Dimension(10,10));
710
- jSP.setPreferredSize(new Dimension(100,200));
1108
+ //jSP.setPreferredSize(new Dimension(100,200));
7111109
7121110 oe.jTree.setCellRenderer(new cTreeModel.Renderer());
7131111
....@@ -719,29 +1117,49 @@
7191117 dgr.addDragGestureListener(this);
7201118 }catch(Exception e) {}
7211119 */
722
- radio.layout = sevenButton;
1120
+ radio.layout = sixButton; // sevenButton;
7231121 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
7241122 }
7251123
7261124 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
7271125 {
1126
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
1127
+ colorCB.setToolTipText("Copy color when dropped");
1128
+ colorCB.addItemListener(this);
1129
+
1130
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
1131
+ materialCB.setToolTipText("Copy material when dropped");
1132
+ materialCB.addItemListener(this);
1133
+
1134
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
1135
+ textureCB.setToolTipText("Copy texture when dropped");
1136
+ textureCB.addItemListener(this);
1137
+
1138
+ panel.Return();
1139
+
7281140 panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
7291141 boxCB.setToolTipText("Display bounding boxes");
7301142 boxCB.addItemListener(this);
7311143
7321144 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
733
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
1145
+ zoomBoxCB.setToolTipText("Display only for wheel");
7341146 zoomBoxCB.addItemListener(this);
7351147
7361148 if (true) // Globals.ADVANCED)
7371149 {
738
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
739
- supportCB.setToolTipText("Enable rigging");
740
- supportCB.addItemListener(this);
1150
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
1151
+// supportCB.setToolTipText("Enable rigging");
1152
+// supportCB.addItemListener(this);
1153
+
1154
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
1155
+ freezeCB.setToolTipText("Fast moving camera");
1156
+ freezeCB.addItemListener(this);
7411157
7421158 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
7431159 // localCB.addItemListener(this);
7441160
1161
+ panel.Return();
1162
+
7451163 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
7461164 crowdCB.setToolTipText("Used for crowds");
7471165 crowdCB.addItemListener(this);
....@@ -758,6 +1176,8 @@
7581176 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
7591177 // speakerMocapCB.addItemListener(this);
7601178
1179
+ panel.Return();
1180
+
7611181 if (false)
7621182 {
7631183 // handled in scripts
....@@ -772,34 +1192,74 @@
7721192 //constraints.gridy += 1;
7731193 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
7741194 smoothfocusCB.addItemListener(this);
1195
+ panel.Return();
7751196 }
7761197
7771198 //constraints.gridx += 1;
7781199 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
7791200 // debugCB.addItemListener(this);
7801201
1202
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
1203
+ trackCB.setToolTipText("Enable tracking target");
1204
+ trackCB.addItemListener(this);
1205
+
7811206 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
1207
+ oeilCB.setToolTipText("Move camera when tracking");
7821208 oeilCB.addItemListener(this);
7831209
1210
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
1211
+ shadowCB.setToolTipText("When live compute shadows");
1212
+ shadowCB.addItemListener(this);
1213
+
1214
+ panel.Return();
1215
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
1216
+ toggleTextureCB.setToolTipText("Load textures");
1217
+ toggleTextureCB.addItemListener(this);
1218
+
1219
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
1220
+ toggleSwitchCB.setToolTipText("Choose a single item");
1221
+ toggleSwitchCB.addItemListener(this);
1222
+
1223
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
1224
+ autokeepCB.setToolTipText("On structure change");
1225
+ autokeepCB.addItemListener(this);
1226
+
1227
+ panel.Return();
1228
+ if (Globals.ADVANCED)
1229
+ {
7841230 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
7851231 lookAtCB.setToolTipText("Look-at target");
7861232 lookAtCB.addItemListener(this);
1233
+ }
7871234
7881235 }
7891236
7901237 cGridBag fill = new cGridBag();
791
-
7921238 fill.preferredHeight = 200;
1239
+ cGridBag fill2 = new cGridBag();
1240
+ fill2.preferredHeight = 200;
1241
+ cGridBag fill3 = new cGridBag();
1242
+ fill3.preferredHeight = 200;
7931243
7941244 panel.add(fill);
1245
+ panel.add(fill2);
1246
+ panel.add(fill3);
7951247
7961248 }
7971249
7981250 void EditObject(Object3D obj)
7991251 {
8001252 cRadio radioButton = new cRadio(obj.name);
1253
+
1254
+ // June 2019. Patch to avoid bug with transparency.
1255
+ radioButton.hadMaterial = obj.material != null;
1256
+ if (!radioButton.hadMaterial)
1257
+ {
1258
+ obj.material = new cMaterial();
1259
+ }
1260
+
8011261 radioButton.SetObject(obj);
802
- radioButton.layout = sevenButton;
1262
+ radioButton.layout = sixButton; // sevenButton;
8031263 radioButton.SetCamera(cameraView.renderCamera, false);
8041264 radioButton.addActionListener(this);
8051265 radioPanel.add(radioButton);
....@@ -809,6 +1269,8 @@
8091269
8101270 void SetupViews(ObjEditor oe)
8111271 {
1272
+ theFrame = this;
1273
+
8121274 oe.SetupViews();
8131275
8141276 System.out.println("SetupViews");
....@@ -817,23 +1279,28 @@
8171279 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
8181280 }
8191281
820
- JCheckBox liveCB;
821
- JCheckBox supportCB;
822
- JCheckBox localCB;
823
- JCheckBox crowdCB;
824
- JCheckBox smoothCB;
825
- JCheckBox fastCB;
826
- JCheckBox slowCB;
827
- JCheckBox boxCB;
828
- JCheckBox zoomBoxCB;
829
- JCheckBox trackCB;
830
- JCheckBox smoothfocusCB;
1282
+ cToggleButton liveCB;
1283
+ cCheckBox supportCB;
1284
+ cCheckBox localCB;
1285
+ cCheckBox crowdCB;
1286
+ cCheckBox smoothCB;
1287
+ cToggleButton fastCB;
1288
+ cCheckBox slowCB;
1289
+ cCheckBox boxCB;
1290
+ cCheckBox zoomBoxCB;
1291
+ cCheckBox freezeCB;
1292
+ //cToggleButton trackCB;
1293
+ cCheckBox trackCB;
1294
+ cCheckBox smoothfocusCB;
8311295 // JCheckBox speakerMocapCB;
832
- JCheckBox speakerCameraCB;
833
- JCheckBox speakerFocusCB;
834
- JCheckBox debugCB;
835
- JCheckBox oeilCB;
836
- JCheckBox lookAtCB;
1296
+ cCheckBox speakerCameraCB;
1297
+ cCheckBox speakerFocusCB;
1298
+ cCheckBox debugCB;
1299
+
1300
+ cCheckBox oeilCB;
1301
+ cCheckBox shadowCB;
1302
+ cCheckBox autokeepCB;
1303
+ cCheckBox lookAtCB;
8371304
8381305 // static int COLOR = 1;
8391306 // static int MATERIAL = 2;
....@@ -841,9 +1308,9 @@
8411308
8421309 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
8431310
844
- JCheckBox colorCB;
845
- JCheckBox materialCB;
846
- JCheckBox textureCB;
1311
+ cCheckBox colorCB;
1312
+ cCheckBox materialCB;
1313
+ cCheckBox textureCB;
8471314
8481315 public void itemStateChanged(ItemEvent e)
8491316 {
....@@ -871,6 +1338,7 @@
8711338 } else if(e.getSource() == liveCB)
8721339 {
8731340 cameraView.ToggleLive();
1341
+ refreshContents(false);
8741342 }
8751343 else if(e.getSource() == supportCB)
8761344 {
....@@ -935,6 +1403,18 @@
9351403 {
9361404 cameraView.ToggleOeil();
9371405 }
1406
+ else if(e.getSource() == shadowCB)
1407
+ {
1408
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1409
+ }
1410
+ else if(e.getSource() == freezeCB)
1411
+ {
1412
+ Globals.FREEZEONMOVE ^= true;
1413
+ }
1414
+ else if(e.getSource() == autokeepCB)
1415
+ {
1416
+ Globals.REPLACEONMAKE ^= true;
1417
+ }
9381418 else if(e.getSource() == lookAtCB)
9391419 {
9401420 cameraView.ToggleLookAt();
....@@ -951,7 +1431,8 @@
9511431
9521432 /**/
9531433 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
954
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1434
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1435
+ TreePath path = objEditor.jTree.getSelectionPath();
9551436 if ((path == null) || (path.getPathCount() <= 1)) {
9561437 // We can't move the root node or an empty selection
9571438 return;
....@@ -1014,8 +1495,6 @@
10141495 }
10151496 }
10161497
1017
- String string = (String) object;
1018
-
10191498 System.out.println("Transfer = " + object + "; drop : " + target);
10201499 // if( object instanceof java.io.File[])
10211500 // {
....@@ -1023,6 +1502,8 @@
10231502 // objEditor.DropFile((java.io.File[]) object, true);
10241503 // return;
10251504 // }
1505
+
1506
+ String string = object.toString();
10261507
10271508 // File path for Mac and Windows
10281509 if (string.charAt(0) == '/' || string.charAt(1) == ':')
....@@ -1068,23 +1549,33 @@
10681549
10691550 assert target == objEditor.jTree;
10701551 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1552
+ Object3D destinationLeaf;
10711553 try {
1072
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1554
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
10731555 } catch (Exception e) {
10741556 System.out.println("destinationPath : " + destinationPath);
10751557 return;
10761558 }
10771559
1078
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1560
+ for (int i=group.selection.size(); --i>=0;)
10791561 {
1562
+ Object3D child = (Object3D)group.selection.elementAt(i);
1563
+
1564
+ // Cannot move into itself
1565
+ if (child == destinationLeaf)
1566
+ return;
1567
+ }
1568
+
1569
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1570
+// {
10801571 loadClipboard(true);
10811572 objEditor.jTree.setSelectionPath(destinationPath);
10821573 pasteInto(false, false);
1083
- } else {
1084
- loadClipboard(false);
1085
- objEditor.jTree.setSelectionPath(destinationPath);
1086
- pasteInto(false, false); // true); // ???
1087
- }
1574
+// } else {
1575
+// loadClipboard(false);
1576
+// objEditor.jTree.setSelectionPath(destinationPath);
1577
+// pasteInto(false, false); // true); // ???
1578
+// }
10881579 }
10891580 public void dropActionChanged(DropTargetDragEvent dtde)
10901581 // Called if the user has modified the current drop gesture
....@@ -1189,22 +1680,30 @@
11891680 {
11901681 //heightFieldItem = menu.add(new MenuItem("Height Field"));
11911682 //heightFieldItem.addActionListener(this);
1192
- gridItem = menu.add(new MenuItem("Grid"));
1193
- gridItem.addActionListener(this);
1194
- rectoidItem = menu.add(new MenuItem("Box"));
1195
- rectoidItem.addActionListener(this);
1196
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1197
- ellipsoidItem.addActionListener(this);
1198
- coneItem = menu.add(new MenuItem("Cone"));
1199
- coneItem.addActionListener(this);
1200
- torusItem = menu.add(new MenuItem("Torus"));
1201
- torusItem.addActionListener(this);
1202
- superItem = menu.add(new MenuItem("Superellipsoid"));
1203
- superItem.addActionListener(this);
1683
+// gridItem = menu.add(new MenuItem("Grid"));
1684
+// gridItem.addActionListener(this);
1685
+// rectoidItem = menu.add(new MenuItem("Box"));
1686
+// rectoidItem.addActionListener(this);
1687
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1688
+// ellipsoidItem.addActionListener(this);
1689
+// coneItem = menu.add(new MenuItem("Cone"));
1690
+// coneItem.addActionListener(this);
1691
+// torusItem = menu.add(new MenuItem("Torus"));
1692
+// torusItem.addActionListener(this);
1693
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1694
+// superItem.addActionListener(this);
1695
+
1696
+ cameraItem = menu.add(new MenuItem("Camera"));
1697
+ cameraItem.addActionListener(this);
1698
+
1699
+ if (!Globals.ADVANCED)
1700
+ {
12041701 kleinItem = menu.add(new MenuItem("Klein Bottle"));
12051702 kleinItem.addActionListener(this);
1206
- particleItem = menu.add(new MenuItem("Particle system"));
1207
- particleItem.addActionListener(this);
1703
+ }
1704
+
1705
+// particleItem = menu.add(new MenuItem("Particle system"));
1706
+// particleItem.addActionListener(this);
12081707 if (Globals.ADVANCED)
12091708 {
12101709 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1230,15 +1729,15 @@
12301729 }
12311730 bezierItem = menu.add(new MenuItem("Bezier Patch"));
12321731 bezierItem.addActionListener(this);
1233
- overlayItem = menu.add(new MenuItem("Overlay"));
1234
- overlayItem.addActionListener(this);
1235
- lightItem = menu.add(new MenuItem("Light"));
1236
- lightItem.addActionListener(this);
1732
+// overlayItem = menu.add(new MenuItem("Overlay"));
1733
+// overlayItem.addActionListener(this);
1734
+// lightItem = menu.add(new MenuItem("Light"));
1735
+// lightItem.addActionListener(this);
12371736 menu.add("-");
12381737 //superLoopItem = menu.add(new MenuItem("Super Loop"));
12391738 //superLoopItem.addActionListener(this);
1240
- loopItem = menu.add(new MenuItem("Loop"));
1241
- loopItem.addActionListener(this);
1739
+// loopItem = menu.add(new MenuItem("Loop"));
1740
+// loopItem.addActionListener(this);
12421741 doubleItem = menu.add(new MenuItem("Fork"));
12431742 doubleItem.addActionListener(this);
12441743 if (Globals.ADVANCED)
....@@ -1254,6 +1753,9 @@
12541753 animationItem.addItemListener(this);
12551754 animationItem.setState(Globals.ANIMATION);
12561755
1756
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1757
+ archiveItem.addActionListener(this);
1758
+
12571759 menu.add("-");
12581760 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
12591761 parseverticesItem.addActionListener(this);
....@@ -1266,6 +1768,8 @@
12661768 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
12671769 reduce34MorphItem.addActionListener(this);
12681770 menu.add("-");
1771
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1772
+ memoryItem.addActionListener(this);
12691773 menu.add(computeAOItem = new MenuItem("Compute AO"));
12701774 computeAOItem.addActionListener(this);
12711775
....@@ -1274,11 +1778,9 @@
12741778 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
12751779 mirrorItem.addActionListener(this);
12761780 menu.add("-");
1277
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1278
- memoryItem.addActionListener(this);
12791781 menu.add(analyzeItem = new MenuItem("Analyze"));
12801782 analyzeItem.addActionListener(this);
1281
- menu.add(dumpItem = new MenuItem("Dump"));
1783
+ menu.add(dumpItem = new MenuItem("Print"));
12821784 dumpItem.addActionListener(this);
12831785 // menu.add(pathItem = new MenuItem("From-to path"));
12841786 // pathItem.addActionListener(this);
....@@ -1419,9 +1921,34 @@
14191921 shadow.material = new cMaterial(obj.material);
14201922 shadow.material.diffuse = 0.0001f;
14211923 shadow.material.specular = 0.0001f;
1924
+ //shadow.projectedVertices[1].x = 300;
14221925
14231926 makeSomething(shadow);
14241927 }
1928
+
1929
+ private void ClearUnpinned()
1930
+ {
1931
+ //for (Object3D obj : listUI)
1932
+ for (int i=listUI.size(); --i>=0;)
1933
+ {
1934
+ Object3D obj = listUI.elementAt(i);
1935
+ if (!obj.pinned)
1936
+ {
1937
+ obj.CloseUI();
1938
+ listUI.remove(i);
1939
+ }
1940
+ }
1941
+ }
1942
+
1943
+ private void EditElement(Object3D elem, boolean newWindow)
1944
+ {
1945
+ // if (!(elem instanceof Composite))
1946
+ // newWindow = false;
1947
+ listUI.add(elem);
1948
+ elem.openEditWindow(this, newWindow); //, false);
1949
+ System.out.println("edit : " + elem);
1950
+ elem.editWindow.refreshContents(true); // ? new
1951
+ }
14251952
14261953 /**
14271954 * applyExample
....@@ -1666,7 +2193,7 @@
16662193 {
16672194 ScreenFit();
16682195 } else
1669
- if (source == switchItem)
2196
+ if (source == switchViewItem)
16702197 {
16712198 cVector v1 = new cVector();
16722199 cVector v2 = new cVector();
....@@ -1675,11 +2202,11 @@
16752202 objEditor.cameraView.renderCamera.setAim(v2, v1);
16762203 objEditor.cameraView.repaint();
16772204 } else
1678
- if (source == rectoidItem)
2205
+ if (source == rectoidItem || source == boxButton)
16792206 {
16802207 makeSomething(new Box());
16812208 } else
1682
- if (source == particleItem)
2209
+ if (source == particleItem || source == particlesButton)
16832210 {
16842211 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
16852212 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1758,27 +2285,27 @@
17582285
17592286 makeSomething(obj);
17602287 } else
1761
- if (source == gridItem)
2288
+ if (source == gridItem || source == gridButton)
17622289 {
17632290 makeSomething(new Grid());
17642291 } else
1765
- if (source == ellipsoidItem)
2292
+ if (source == ellipsoidItem || source == sphereButton)
17662293 {
17672294 makeSomething(new Sphere());
17682295 } else
1769
- if (source == coneItem)
2296
+ if (source == coneItem || source == coneButton)
17702297 {
17712298 makeSomething(new Cone());
17722299 } else
1773
- if (source == torusItem)
2300
+ if (source == torusItem || source == torusButton)
17742301 {
17752302 makeSomething(new Torus());
17762303 } else
1777
- if (source == superItem)
2304
+ if (source == superItem || source == superButton)
17782305 {
17792306 makeSomething(new Superellipsoid());
17802307 } else
1781
- if (source == kleinItem)
2308
+ if (source == kleinItem || source == kleinButton)
17822309 {
17832310 makeSomething(new Klein());
17842311 } else
....@@ -1798,7 +2325,7 @@
17982325 {
17992326 makeSomething(new BezierSurface());
18002327 } else
1801
- if (source == overlayItem)
2328
+ if (source == overlayItem || source == overlayButton)
18022329 {
18032330 /*
18042331 Object3D obj = new BezierSurface(5,8);
....@@ -1846,10 +2373,27 @@
18462373 s.setup();
18472374 makeSomething(s);
18482375 } else
1849
- if (source == lightItem)
2376
+ if (source == lightItem || source == lightButton)
18502377 {
18512378 makeSomething(new Light());
18522379 } else
2380
+// if (source == skybox1Button ||
2381
+// source == skybox2Button ||
2382
+// source == skybox3Button ||
2383
+// source == skybox4Button ||
2384
+// source == skybox5Button ||
2385
+// source == skybox6Button ||
2386
+// source == skybox7Button ||
2387
+// source == skybox11Button ||
2388
+// source == skybox12Button ||
2389
+// source == skybox13Button ||
2390
+// source == skybox14Button ||
2391
+// source == skybox15Button ||
2392
+// source == skybox16Button ||
2393
+// source == skybox17Button)
2394
+// {
2395
+// ChangeSkybox(source);
2396
+// } else
18532397 if (source == csgItem)
18542398 {
18552399 group(new CSG());
....@@ -1896,30 +2440,30 @@
18962440
18972441 group(g);
18982442 } else
1899
- if (source == loopItem)
2443
+ if (source == loopItem || source == loopButton)
19002444 {
19012445 Composite csg = new GroupLeaf();
19022446 csg.count = 5;
19032447 group(csg);
1904
- Composite child = new cGroup();
2448
+ Composite child = new cGroup("Branch");
19052449 csg.addChild(child);
19062450 child.addChild(csg);
19072451 } else
19082452 if (source == doubleItem)
19092453 {
1910
- Composite csg = new GroupLeaf();
2454
+ Composite csg = new GroupLeaf("Fork");
19112455 csg.count = 5;
19122456 group(csg);
1913
- Composite child = new cGroup();
2457
+ Composite child = new cGroup("Branch A");
19142458 csg.addChild(child);
19152459 child.addChild(csg);
1916
- child = new cGroup();
2460
+ child = new cGroup("Branch B");
19172461 csg.addChild(child);
19182462 child.addChild(csg);
19192463 } else
19202464 if (source == tripleItem)
19212465 {
1922
- Composite csg = new GroupLeaf();
2466
+ Composite csg = new GroupLeaf("Trident");
19232467 csg.count = 4;
19242468 group(csg);
19252469 Composite child = new cGroup();
....@@ -1935,7 +2479,7 @@
19352479 if (source == computeAOItem)
19362480 {
19372481 Globals.drawMode = CameraPane.OCCLUSION;
1938
- Globals.theRenderer.repaint();
2482
+ cameraView.repaint();
19392483 } else
19402484 if (source == recompileItem)
19412485 {
....@@ -1969,17 +2513,45 @@
19692513 {
19702514 DumpObject();
19712515 } else
2516
+ if (source == minButton)
2517
+ {
2518
+ Minimize();
2519
+ } else
2520
+ if (source == maxButton)
2521
+ {
2522
+ Maximize();
2523
+ } else
2524
+ if (source == fullButton)
2525
+ {
2526
+ ToggleFullScreen();
2527
+ } else
19722528 if (source == undoButton)
19732529 {
2530
+ // Go to previous version
2531
+ //if (!Undo())
2532
+ //java.awt.Toolkit.getDefaultToolkit().beep();
19742533 Undo();
2534
+ } else
2535
+ if (source == restoreButton)
2536
+ {
2537
+ // Restore current version
2538
+ Restore();
2539
+ } else
2540
+ if (source == replaceButton)
2541
+ {
2542
+ // Overwrite current version
2543
+ Replace();
19752544 } else
19762545 if (source == redoButton)
19772546 {
2547
+ // Go to next version
19782548 Redo();
19792549 } else
19802550 if (source == saveButton)
19812551 {
1982
- Save();
2552
+ // Save a new version
2553
+ if (!Save(true))
2554
+ java.awt.Toolkit.getDefaultToolkit().beep();
19832555 } else
19842556 if (source == oneStepButton)
19852557 {
....@@ -1988,17 +2560,14 @@
19882560 } else
19892561 if (source == screenfitButton)
19902562 {
1991
- //Reload(lastConverter, lastFilename, true);
19922563 ScreenFit();
19932564 } else
19942565 if (source == screenfitpointButton)
19952566 {
1996
- //Reload(lastConverter, lastFilename, true);
19972567 ScreenFitPoint();
19982568 } else
19992569 if (source == snapobjectButton)
20002570 {
2001
- //Reload(lastConverter, lastFilename, true);
20022571 SnapObject();
20032572 } else
20042573 // if (event.getSource() == recompileButton)
....@@ -2362,7 +2931,7 @@
23622931 {
23632932 StepAll();
23642933 } else
2365
- if (source == clearItem) // || event.getSource() == clearButton)
2934
+ if (source == deleteItem) // || event.getSource() == clearButton)
23662935 {
23672936 //int indices[] = jList.getSelectedIndices();
23682937 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2374,9 +2943,9 @@
23742943 {
23752944 ClearSelection(true);
23762945 } else
2377
- if (source == grabItem)
2946
+ if (source == grabItem || source == groupButton)
23782947 {
2379
- group(new cGroup(), true);
2948
+ group(new cGroup(), false); // true);
23802949 } else
23812950 if (source == hideItem)
23822951 {
....@@ -2394,11 +2963,11 @@
23942963 {
23952964 makeSomething(new Camera());
23962965 } else
2397
- if (source == compositeItem)
2966
+ if (source == compositeItem || source == compositeButton)
23982967 {
23992968 group(new Composite());
24002969 } else
2401
- if (source == randomItem)
2970
+ if (source == switchItem || source == switchButton)
24022971 {
24032972 RandomNode random = new RandomNode();
24042973 group(random);
....@@ -2500,7 +3069,7 @@
25003069 {
25013070 group(new cLinker());
25023071 } else
2503
- if (source == textureItem)
3072
+ if (source == textureItem || source == textureButton)
25043073 {
25053074 group(new TextureNode());
25063075 } else
....@@ -2520,17 +3089,30 @@
25203089 {
25213090 CastShadow(2);
25223091 } else
2523
- if (source == ungroupItem)
3092
+ if (source == ungroupItem || source == ungroupButton)
25243093 {
2525
- //ungroup();
3094
+ boolean hasRoot = false;
3095
+
25263096 for (int i=0; i<group.selection.size(); i++)
25273097 {
2528
- Ungroup(group.selection.get(i));
3098
+ if (group.selection.get(i) == group)
3099
+ {
3100
+ hasRoot = true;
3101
+ break;
3102
+ }
25293103 }
25303104
2531
- ClearSelection(false);
2532
-
2533
- refreshContents();
3105
+ if (!hasRoot)
3106
+ {
3107
+ for (int i=0; i<group.selection.size(); i++)
3108
+ {
3109
+ Ungroup(group.selection.get(i));
3110
+ }
3111
+
3112
+ ClearSelection(false);
3113
+
3114
+ refreshContents();
3115
+ }
25343116 } else
25353117 if (source == genUVItem)
25363118 {
....@@ -2542,7 +3124,7 @@
25423124 } else
25433125 if (source == genNormalsMESHItem)
25443126 {
2545
- GenNormals(true); // TODO
3127
+ GenNormalsMESH();
25463128 } else
25473129 if (source == genNormalsORGANItem)
25483130 {
....@@ -2607,6 +3189,22 @@
26073189 if (source == unmarkleavesItem)
26083190 {
26093191 MarkLeaves(false);
3192
+ } else
3193
+ if (source == rewindleavesItem)
3194
+ {
3195
+ RewindLeaves(true);
3196
+ } else
3197
+ if (source == unrewindleavesItem)
3198
+ {
3199
+ RewindLeaves(false);
3200
+ } else
3201
+ if (source == randomleavesItem)
3202
+ {
3203
+ RandomLeaves(true);
3204
+ } else
3205
+ if (source == unrandomleavesItem)
3206
+ {
3207
+ RandomLeaves(false);
26103208 } else
26113209 if (source == flipVItem)
26123210 {
....@@ -2815,7 +3413,7 @@
28153413 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
28163414 {
28173415 obj = (Object3D)e.nextElement();
2818
- obj.SetBumpTexture(null);
3416
+ obj.ResetBumpTexture();
28193417 }
28203418
28213419 refreshContents();
....@@ -2831,6 +3429,31 @@
28313429
28323430 refreshContents();
28333431 } else
3432
+ if (source == embedTexturesItem)
3433
+ {
3434
+ Object3D obj;
3435
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3436
+ {
3437
+ obj = (Object3D)e.nextElement();
3438
+ obj.EmbedTextures(true);
3439
+ }
3440
+
3441
+ refreshContents();
3442
+ } else
3443
+ if (source == deEmbedTexturesItem)
3444
+ {
3445
+ Object3D obj;
3446
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3447
+ {
3448
+ obj = (Object3D)e.nextElement();
3449
+ obj.EmbedTextures(false);
3450
+ }
3451
+
3452
+ CameraPane.texturepigment.clear();
3453
+ CameraPane.texturebump.clear();
3454
+
3455
+ refreshContents();
3456
+ } else
28343457 if (source == flashSelectionButton)
28353458 {
28363459 CameraPane.flash = true;
....@@ -2842,6 +3465,10 @@
28423465 if (source == twoButton)
28433466 {
28443467 radio.layout = twoButton;
3468
+
3469
+ if (CameraPane.FULLSCREEN)
3470
+ fullscreenLayout = radio.layout;
3471
+
28453472 // bug
28463473 //gridPanel.setDividerLocation(1.0);
28473474 //bigPanel.setDividerLocation(0.0);
....@@ -2874,10 +3501,31 @@
28743501 bigThree.ClearUI();
28753502 bigThree.add(centralPanel);
28763503 bigThree.FlushUI();
3504
+
3505
+ cameraView.requestFocusInWindow();
3506
+
3507
+// refreshContents(true);
3508
+//
3509
+// try
3510
+// {
3511
+// java.awt.Robot bot = new java.awt.Robot();
3512
+// int mask = InputEvent.BUTTON1_MASK;
3513
+// bot.mouseMove(100, 100);
3514
+// bot.mousePress(mask);
3515
+// bot.mouseRelease(mask);
3516
+// }
3517
+// catch (Exception e)
3518
+// {
3519
+//
3520
+// }
3521
+
28773522 } else
28783523 if (source == threeButton)
28793524 {
28803525 radio.layout = threeButton;
3526
+
3527
+ if (CameraPane.FULLSCREEN)
3528
+ fullscreenLayout = radio.layout;
28813529
28823530 // bigThree.remove(scenePanel);
28833531 // bigThree.remove(centralPanel);
....@@ -2907,13 +3555,18 @@
29073555 // centralPanel.setVisible(true);
29083556 // XYZPanel.setVisible(true);
29093557 bigThree.ClearUI();
3558
+ bigThree.add(scenePanel);
29103559 bigThree.add(centralPanel);
2911
- bigThree.add(XYZPanel);
29123560 bigThree.FlushUI();
3561
+
3562
+ cameraView.requestFocusInWindow();
29133563 } else
29143564 if (source == fourButton)
29153565 {
29163566 radio.layout = fourButton;
3567
+
3568
+ if (CameraPane.FULLSCREEN)
3569
+ fullscreenLayout = radio.layout;
29173570
29183571 // bigThree.remove(scenePanel);
29193572 // bigThree.remove(centralPanel);
....@@ -2945,10 +3598,15 @@
29453598 bigThree.ClearUI();
29463599 bigThree.add(scenePanel);
29473600 bigThree.FlushUI();
3601
+
3602
+ cameraView.requestFocusInWindow();
29483603 } else
29493604 if (source == sixButton)
29503605 {
29513606 radio.layout = sixButton;
3607
+
3608
+ if (CameraPane.FULLSCREEN)
3609
+ fullscreenLayout = radio.layout;
29523610
29533611 // bigThree.remove(scenePanel);
29543612 // bigThree.remove(centralPanel);
....@@ -2978,13 +3636,18 @@
29783636 // centralPanel.setVisible(true);
29793637 // XYZPanel.setVisible(false);
29803638 bigThree.ClearUI();
2981
- bigThree.add(scenePanel);
29823639 bigThree.add(centralPanel);
3640
+ bigThree.add(scenePanel);
29833641 bigThree.FlushUI();
3642
+
3643
+ cameraView.requestFocusInWindow();
29843644 } else
29853645 if (source == sevenButton)
29863646 {
29873647 radio.layout = sevenButton;
3648
+
3649
+ if (CameraPane.FULLSCREEN)
3650
+ fullscreenLayout = radio.layout;
29883651
29893652 // bigThree.remove(scenePanel);
29903653 // bigThree.remove(centralPanel);
....@@ -3018,6 +3681,8 @@
30183681 bigThree.add(centralPanel);
30193682 bigThree.add(XYZPanel);
30203683 bigThree.FlushUI();
3684
+
3685
+ cameraView.requestFocusInWindow();
30213686 } else
30223687 if (source == rootButton)
30233688 {
....@@ -3029,6 +3694,7 @@
30293694 EditObject(obj);
30303695 }
30313696
3697
+ cameraView.requestFocusInWindow();
30323698 refreshContents(true);
30333699 } else
30343700 if (source == closeButton)
....@@ -3038,22 +3704,37 @@
30383704 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
30393705 {
30403706 ab = (cRadio)e.nextElement();
3041
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3707
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
30423708 {
3709
+ // Patch to avoid bug with transparency.
3710
+ if (!ab.hadMaterial)
3711
+ {
3712
+ ab.object.material = null;
3713
+ }
3714
+
30433715 buttonGroup.remove(ab);
30443716 radioPanel.remove(ab);
30453717
3046
- ab.GetObject().editWindow = null;
3718
+ //ab.GetObject().editWindow = null;
3719
+ ab.GetObject().manipWindow = null;
30473720 // ab.GetObject().objectUI = null; // ?????????
30483721
30493722 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
30503723 break;
30513724 }
30523725 }
3726
+
3727
+ cameraView.requestFocusInWindow();
30533728 refreshContents(true);
30543729 } else
30553730 if (source == editItem || source == editButton)
30563731 {
3732
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3733
+ {
3734
+ Object3D child = (Object3D)e.nextElement();
3735
+ child.pinned = true;
3736
+ }
3737
+
30573738 EditSelection(false);
30583739 } else
30593740 if (source == uneditButton)
....@@ -3063,6 +3744,7 @@
30633744 Object3D child = (Object3D)e.nextElement();
30643745 if(child.editWindow != null)
30653746 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3747
+ child.pinned = false;
30663748 child.CloseUI();
30673749 listUI.remove(child);
30683750
....@@ -3079,6 +3761,7 @@
30793761 //copy.ClearUI();
30803762 for (Object3D obj : listUI)
30813763 {
3764
+ obj.pinned = false;
30823765 obj.CloseUI();
30833766 }
30843767 listUI.clear();
....@@ -3088,7 +3771,7 @@
30883771 {
30893772 assert(copy == group);
30903773
3091
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3774
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
30923775
30933776 for (Object3D obj : listUI)
30943777 {
....@@ -3137,6 +3820,9 @@
31373820 }
31383821
31393822 copy = group;
3823
+
3824
+ SetUndoStates();
3825
+
31403826 //Globals.theRenderer.object = group;
31413827 if(!useclient)
31423828 {
....@@ -3154,7 +3840,8 @@
31543840 }
31553841
31563842 // fix "+" issue
3157
- group.editWindow = this;
3843
+ //group.editWindow = this;
3844
+ group.manipWindow = this;
31583845
31593846 /*
31603847 currentLayout = radio.layout;
....@@ -3162,18 +3849,27 @@
31623849 currentLayout = sevenButton;
31633850 */
31643851 radio.layout.doClick();
3852
+
3853
+ ClearUnpinned();
3854
+ //Grafreed.Assert(group != null);
3855
+ //Grafreed.Assert(group.selection != null);
3856
+ SetPinStates(group.selection == null || group.selection.size() > 0);
3857
+ if (group.selection == null || group.selection.size() == 1)
3858
+ EditSelection(false);
31653859 keepparent = group.parent;
31663860 // PARENT = NULL or not???
31673861 //group.parent = null; // ROOT
31683862 //group.attributes = -1;
31693863 ResetModel();
3864
+
3865
+ cameraView.requestFocusInWindow();
31703866 refreshContents(true);
31713867 } else if (event.getSource() == editCameraItem)
31723868 {
31733869 cameraView.ProtectCamera();
31743870 cameraView.repaint();
31753871 return;
3176
- } else if (event.getSource() == revertCameraItem)
3872
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
31773873 {
31783874 cameraView.RevertCamera();
31793875 cameraView.repaint();
....@@ -3190,7 +3886,6 @@
31903886 }
31913887
31923888 boolean useclient = false;
3193
- cRadio radio;
31943889
31953890 void ToggleRoot()
31963891 {
....@@ -3429,7 +4124,8 @@
34294124
34304125 int size = obj.MemorySize();
34314126
3432
- System.err.println((size/1024) + " KB is the size of " + obj);
4127
+ //System.err.println((size/1024) + " KB is the size of " + obj);
4128
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
34334129 }
34344130 }
34354131 catch (Exception e)
....@@ -3510,6 +4206,13 @@
35104206 void GenNormals(boolean crease)
35114207 {
35124208 group.GenNormalsS(crease);
4209
+
4210
+ refreshContents();
4211
+ }
4212
+
4213
+ void GenNormalsMESH()
4214
+ {
4215
+ group.GenNormalsMeshS();
35134216
35144217 refreshContents();
35154218 }
....@@ -3745,7 +4448,7 @@
37454448
37464449 try
37474450 {
3748
- texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4451
+ texturedata = Globals.theRenderer.GetTextureData(tex, false, node.texres);
37494452 }
37504453 catch (Exception e)
37514454 {
....@@ -4137,6 +4840,18 @@
41374840 refreshContents();
41384841 }
41394842
4843
+ void RewindLeaves(boolean hide)
4844
+ {
4845
+ group.selection.RewindLeaves(hide);
4846
+ refreshContents();
4847
+ }
4848
+
4849
+ void RandomLeaves(boolean hide)
4850
+ {
4851
+ group.selection.RandomLeaves(hide);
4852
+ refreshContents();
4853
+ }
4854
+
41404855 void SetTexRes(int tr)
41414856 {
41424857 group.selection.SetTexRes(tr);
....@@ -4208,28 +4923,25 @@
42084923 // }
42094924 // }
42104925
4211
- static boolean allparams = true;
4212
-
4213
- static Vector<Object3D> listUI = new Vector<Object3D>();
4214
-
42154926 void EditSelection(boolean newWindow)
42164927 {
4928
+ if (group.selection == null)
4929
+ {
4930
+ EditElement(group, newWindow); // ? new
4931
+ return;
4932
+ }
4933
+
42174934 // aConstraints.gridy = 0;
42184935 for (int i=0; i<group.selection.size(); i++)
42194936 {
42204937 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
42214938 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4222
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
4939
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
42234940
42244941 Object3D elem = (Object3D)group.selection.elementAt(i);
42254942 if(elem != group || !newWindow)
42264943 {
4227
- // if (!(elem instanceof Composite))
4228
- // newWindow = false;
4229
- listUI.add(elem);
4230
- elem.openEditWindow(this, newWindow); //, false);
4231
- System.out.println("edit : " + elem);
4232
- elem.editWindow.refreshContents(true); // ? new
4944
+ EditElement(elem, newWindow); // ? new
42334945 }
42344946 }
42354947 }
....@@ -4304,7 +5016,8 @@
43045016 //new Exception().printStackTrace();
43055017
43065018 freezemodel = true;
4307
-
5019
+ ClearUnpinned();
5020
+
43085021 /**/
43095022 //switch (event.id)
43105023 {
....@@ -4312,7 +5025,6 @@
43125025 //case 702: // Event.LIST_DESELECT
43135026 group.deselectAll();
43145027 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4315
- objEditor.ClearInfo(); // .GetMaterial());
43165028 if (tps != null)
43175029 {
43185030 for (int i=0; i < tps.length; i++)
....@@ -4321,10 +5033,8 @@
43215033
43225034 //if (child.parent != null)
43235035 //child.parent.addSelectee(child);
5036
+ objEditor.SetMaterial(child);
43245037 group.addSelectee(child);
4325
- objEditor.SetMaterial(child); // .GetMaterial());
4326
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4327
- System.err.println("info : " + child.GetPath());
43285038 }
43295039 }
43305040 // else
....@@ -4334,15 +5044,13 @@
43345044 // System.err.println("info : " + group.GetPath());
43355045 // }
43365046
4337
- objEditor.SetText(); // jan 2014
4338
-
43395047 if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
43405048 CameraPane.flash = true;
43415049
43425050 if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
43435051 // a camera
43445052 {
4345
- if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera())
5053
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
43465054 {
43475055 CameraPane.camerachangeframe = 0; // don't refuse it
43485056 Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
....@@ -4351,6 +5059,13 @@
43515059 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
43525060 }
43535061
5062
+ if (tps != null && tps.length == 1)
5063
+ {
5064
+ EditSelection(false);
5065
+ }
5066
+
5067
+ SetPinStates(tps != null && tps.length > 0);
5068
+
43545069 refreshContents();
43555070 //return true;
43565071 }
....@@ -4359,6 +5074,35 @@
43595074
43605075 freezemodel = false;
43615076 }
5077
+
5078
+ void SetPinStates(boolean enabled)
5079
+ {
5080
+ editButton.setEnabled(enabled);
5081
+ uneditButton.setEnabled(enabled);
5082
+ unselectButton.setEnabled(enabled);
5083
+ flashSelectionButton.setEnabled(enabled);
5084
+ }
5085
+
5086
+ void refreshContents(boolean cp)
5087
+ {
5088
+ if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
5089
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
5090
+ {
5091
+ objEditor.ClearInfo(); // .GetMaterial());
5092
+
5093
+ for (int i=0; i < group.selection.Size(); i++)
5094
+ {
5095
+ Object3D child = (Object3D) group.selection.get(i);
5096
+
5097
+ objEditor.AddInfo(child, this, true);
5098
+ System.err.println("info : " + child.GetPath());
5099
+ }
5100
+
5101
+ objEditor.SetText(); // jan 2014
5102
+ }
5103
+
5104
+ super.refreshContents(cp);
5105
+ }
43625106
43635107 void linkSomething(Object3D thing)
43645108 {
....@@ -4441,7 +5185,8 @@
44415185
44425186 if (cut)
44435187 {
4444
- Save();
5188
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
5189
+// Save();
44455190 //int indices[] = jList.getSelectedIndices();
44465191 //for (int i = indices.length - 1; i >= 0; i--)
44475192 //jList.remove(indices[i]);
....@@ -4544,6 +5289,10 @@
45445289
45455290 void paste(boolean expand)
45465291 {
5292
+ if (Globals.REPLACEONMAKE)
5293
+ Save();
5294
+ boolean keep = Globals.REPLACEONMAKE;
5295
+ Globals.REPLACEONMAKE = false;
45475296 // if (GrafreeD.clipboard == null)
45485297 // return;
45495298 boolean first = true;
....@@ -4603,6 +5352,7 @@
46035352 Grafreed.clipboard.get(0).parent = keepparent;
46045353 }
46055354
5355
+ Globals.REPLACEONMAKE = keep;
46065356 ResetModel();
46075357 refreshContents();
46085358 }
....@@ -4738,6 +5488,10 @@
47385488
47395489 void group(Object3D csg, boolean grab)
47405490 {
5491
+ if (Globals.REPLACEONMAKE)
5492
+ Save();
5493
+ boolean keep = Globals.REPLACEONMAKE;
5494
+ Globals.REPLACEONMAKE = false;
47415495 if (//false) // why??
47425496 !group.selection.isEmpty())
47435497 {
....@@ -4851,10 +5605,15 @@
48515605 //node.add(csg);
48525606 //makeSomething(node);
48535607 makeSomething(csg);
5608
+ Globals.REPLACEONMAKE = keep;
48545609 }
48555610
48565611 void Ungroup(Object3D g)
48575612 {
5613
+ if (Globals.REPLACEONMAKE)
5614
+ Save();
5615
+ boolean keep = Globals.REPLACEONMAKE;
5616
+ Globals.REPLACEONMAKE = false;
48585617 if (g instanceof HiddenObject)
48595618 {
48605619 HiddenObject h = (HiddenObject) g;
....@@ -4871,6 +5630,7 @@
48715630 objEditor.makeSomething(g.get(i), false);
48725631 }
48735632 }
5633
+ Globals.REPLACEONMAKE = keep;
48745634 }
48755635
48765636 void ungroup()
....@@ -5159,10 +5919,44 @@
51595919 cButton clearpanelButton;
51605920 cButton unselectButton;
51615921
5922
+ cButton restoreCameraButton;
5923
+
51625924 cButton saveButton;
5163
- cButton undoButton;
5164
- cButton redoButton;
51655925 cButton oneStepButton;
5926
+
5927
+ cButton groupButton;
5928
+ cButton ungroupButton;
5929
+ cButton compositeButton;
5930
+ cButton switchButton;
5931
+ cButton loopButton;
5932
+ cButton textureButton;
5933
+
5934
+ cButton skybox1Button;
5935
+ cButton skybox2Button;
5936
+ cButton skybox3Button;
5937
+ cButton skybox4Button;
5938
+ cButton skybox5Button;
5939
+ cButton skybox6Button;
5940
+ cButton skybox7Button;
5941
+
5942
+ cButton skybox11Button;
5943
+ cButton skybox12Button;
5944
+ cButton skybox13Button;
5945
+ cButton skybox14Button;
5946
+ cButton skybox15Button;
5947
+ cButton skybox16Button;
5948
+ cButton skybox17Button;
5949
+
5950
+ cButton gridButton;
5951
+ cButton boxButton;
5952
+ cButton sphereButton;
5953
+ cButton coneButton;
5954
+ cButton torusButton;
5955
+ cButton superButton;
5956
+ cButton kleinButton;
5957
+ cButton particlesButton;
5958
+ cButton overlayButton;
5959
+ cButton lightButton;
51665960
51675961 cButton screenfitButton;
51685962 cButton screenfitpointButton;
....@@ -5175,14 +5969,6 @@
51755969
51765970 cButton setsupportButton;
51775971
5178
- cButton twoButton;
5179
- cButton sixButton;
5180
- cButton threeButton;
5181
- cButton sevenButton;
5182
- cButton fourButton; // full panel
5183
- cButton oneButton; // full XYZ
5184
- //cButton currentLayout;
5185
-
51865972 //
51875973 //Composite
51885974 Object3D // to do !!
....@@ -5192,11 +5978,11 @@
51925978 //JTree jTree;
51935979 private MenuItem lookAtItem;
51945980 private MenuItem lookFromItem;
5195
- private MenuItem switchItem;
5981
+ private MenuItem switchViewItem;
51965982 private MenuItem cutItem;
51975983 private MenuItem undoItem;
51985984 private MenuItem redoItem;
5199
- private MenuItem duplicateItem;
5985
+ private JMenuItem duplicateItem;
52005986 private MenuItem cloneItem;
52015987 private MenuItem cloneSupportItem;
52025988 private MenuItem overwriteGeoItem;
....@@ -5224,7 +6010,7 @@
52246010 private MenuItem pasteLinkItem;
52256011 private MenuItem pasteCloneItem;
52266012 private MenuItem pasteExpandItem;
5227
- private MenuItem clearItem;
6013
+ private MenuItem deleteItem;
52286014 private MenuItem clearAllItem;
52296015 private MenuItem genUVItem;
52306016 private MenuItem genNormalsMESHItem;
....@@ -5259,6 +6045,10 @@
52596045 private MenuItem showleavesItem;
52606046 private MenuItem markleavesItem;
52616047 private MenuItem unmarkleavesItem;
6048
+ private MenuItem rewindleavesItem;
6049
+ private MenuItem unrewindleavesItem;
6050
+ private MenuItem randomleavesItem;
6051
+ private MenuItem unrandomleavesItem;
52626052
52636053 private MenuItem flipVItem;
52646054 private MenuItem unflipVItem;
....@@ -5280,7 +6070,7 @@
52806070 private MenuItem frontItem;
52816071 private MenuItem cameraItem;
52826072 private MenuItem compositeItem;
5283
- private MenuItem randomItem;
6073
+ private MenuItem switchItem;
52846074 private MenuItem physicsItem;
52856075 private MenuItem frameselectorItem;
52866076 private MenuItem scriptNodeItem;
....@@ -5304,6 +6094,8 @@
53046094 private MenuItem attachBumpItem;
53056095 private MenuItem detachBumpItem;
53066096 private MenuItem pigmentBumpItem;
6097
+ private MenuItem embedTexturesItem;
6098
+ private MenuItem deEmbedTexturesItem;
53076099
53086100 private MenuItem particleItem;
53096101 private MenuItem ragdollItem;
....@@ -5354,5 +6146,5 @@
53546146
53556147 Menu cameraMenu;
53566148 MenuItem editCameraItem;
5357
- MenuItem revertCameraItem;
6149
+ MenuItem restoreCameraItem;
53586150 }