Normand Briere
2019-08-04 0c85af6e46f48b7425d59fc776b193c06a4a1f52
GroupEditor.java
....@@ -23,6 +23,302 @@
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("penguins", "yonder", 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("persson", "VancouverConventionCentre", 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", "Teide", row4);
148
+ AddSkyboxButton("park", "Tantolunden4", row4);
149
+
150
+ AddSkyboxButton("park", "Stairs", row5);
151
+ AddSkyboxButton("default", "skycube", row6);
152
+ AddSkyboxButton("rocky", "Langholmen", row5);
153
+ AddSkyboxButton("rocky", "Skinnarviksberget", row5);
154
+
155
+ AddSkyboxButton("rocky", "Tantolunden6", row5);
156
+ AddSkyboxButton("default", "CloudyHills", row6);
157
+ AddSkyboxButton("daz", "Autumn", row6);
158
+ AddSkyboxButton("daz", "MountainTrail", row6);
159
+ /*
160
+Autumn
161
+Greenlands
162
+MountainTrail
163
+Oasis
164
+TheRock
165
+TopOfTheWorld
166
+Winter
167
+ */
168
+
169
+ tab0.add(row0);
170
+ tab0.add(row1);
171
+ tab0.add(row2);
172
+ tab0.add(row3);
173
+ tab0.add(row4);
174
+ tab0.add(row5);
175
+ tab0.add(row6);
176
+
177
+ for (int i=5; --i>=0;)
178
+ {
179
+ //oe.toolboxPanel.Return();
180
+ //tab0.add(new cGridBag());
181
+ }
182
+ }
183
+
184
+ public void AddSkyboxTab2(JTabbedPane skyboxpanel)
185
+ {
186
+ cGridBag tab0 = new cGridBag().setVertical(true);
187
+
188
+ tab0.setName("Night");
189
+ skyboxpanel.add(tab0);
190
+
191
+ cGridBag row0 = new cGridBag();
192
+ cGridBag row1 = new cGridBag();
193
+ cGridBag row2 = new cGridBag();
194
+ cGridBag row3 = new cGridBag();
195
+ cGridBag row4 = new cGridBag();
196
+ cGridBag row5 = new cGridBag();
197
+ cGridBag row6 = new cGridBag();
198
+
199
+ AddSkyboxButton("night", "NightPath", row0);
200
+ AddSkyboxButton("night", "PondNight", row0);
201
+ AddSkyboxButton("night", "Powerlines", row0);
202
+ AddSkyboxButton("night", "SwedishRoyalCastle", row0);
203
+
204
+ AddSkyboxButton("urban", "CNTower", row1);
205
+ AddSkyboxButton("bridge", "ArstaBridge", row1);
206
+ AddSkyboxButton("rocky", "Riddarfjarden", row1);
207
+ AddSkyboxButton("penguins", "sleepyhollow", row1);
208
+
209
+ AddSkyboxButton("penguins", "kenon_star", row2);
210
+ AddSkyboxButton("persson", "corona", row2);
211
+ AddSkyboxButton("persson", "spaceskybox", row2);
212
+ AddSkyboxButton("indoors", "Vasa", row2);
213
+
214
+ AddSkyboxButton("winter", "Backyard", row3);
215
+ AddSkyboxButton("winter", "Creek", row3);
216
+ AddSkyboxButton("winter", "FootballField3", row3);
217
+ AddSkyboxButton("winter", "Forest", row3);
218
+
219
+ AddSkyboxButton("winter", "HornstullsStrand2", row4);
220
+ AddSkyboxButton("winter", "House", row4);
221
+ AddSkyboxButton("winter", "IceLake", row4);
222
+ AddSkyboxButton("winter", "IceRiver", row4);
223
+
224
+ AddSkyboxButton("winter", "Park3", row5);
225
+ AddSkyboxButton("winter", "PondWinter", row5);
226
+ AddSkyboxButton("winter", "Tantolunden5", row5);
227
+ AddSkyboxButton("winter", "Vindelalven", row5);
228
+
229
+ AddSkyboxButton("daz", "TheRock", row6);
230
+ AddSkyboxButton("daz", "TopOfTheWorld", row6);
231
+ AddSkyboxButton("daz", "Winter", row6);
232
+ AddSkyboxButton("mountain", "Ryfjallet", row6);
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 AddSkyboxTab3(JTabbedPane skyboxpanel)
250
+ {
251
+ cGridBag tab0 = new cGridBag().setVertical(true);
252
+
253
+ tab0.setName("Others");
254
+ skyboxpanel.add(tab0);
255
+
256
+ cGridBag row0 = new cGridBag();
257
+ cGridBag row1 = new cGridBag();
258
+ cGridBag row2 = new cGridBag();
259
+ cGridBag row3 = new cGridBag();
260
+ cGridBag row4 = new cGridBag();
261
+ cGridBag row5 = new cGridBag();
262
+ cGridBag row6 = new cGridBag();
263
+
264
+ AddSkyboxButton("mayhem", "afterrain", row0);
265
+ AddSkyboxButton("mayhem", "aqua4", row0);
266
+ AddSkyboxButton("mayhem", "aqua9", row0);
267
+ AddSkyboxButton("mayhem", "flame", row0);
268
+
269
+ AddSkyboxButton("mayhem", "h2s", row1);
270
+ AddSkyboxButton("mayhem", "prehistoric", row1);
271
+ AddSkyboxButton("mayhem", "scorched", row1);
272
+ AddSkyboxButton("penguins", "desertdawn", row1);
273
+
274
+ AddSkyboxButton("persson", "Citadella", row2);
275
+ AddSkyboxButton("persson", "Citadella2", row2);
276
+ AddSkyboxButton("persson", "clouds1", row2);
277
+ AddSkyboxButton("penguins", "wrath", row2);
278
+
279
+ AddSkyboxButton("persson", "FishermansBastion", row3);
280
+ AddSkyboxButton("persson", "HeroesSquare", row3);
281
+ AddSkyboxButton("indoors", "DallasW", row3);
282
+ AddSkyboxButton("indoors", "MarriottMadisonWest", row3);
283
+
284
+ AddSkyboxButton("persson", "LancellottiChapel", row4);
285
+ AddSkyboxButton("persson", "PereaBeach1", row4);
286
+ AddSkyboxButton("persson", "PereaBeach2", row4);
287
+ AddSkyboxButton("persson", "redeclipse", row4);
288
+
289
+ AddSkyboxButton("daz", "Greenlands", row5);
290
+ AddSkyboxButton("daz", "Oasis", row5);
291
+ AddSkyboxButton("elyvisions", "arch3", row5);
292
+ AddSkyboxButton("elyvisions", "calm_sea", row5);
293
+
294
+ AddSkyboxButton("elyvisions", "rainbow", row6);
295
+ AddSkyboxButton("elyvisions", "distant_sunset", row6);
296
+ AddSkyboxButton("elyvisions", "heaven", row6);
297
+ AddSkyboxButton("elyvisions", "hot", row6);
298
+
299
+ tab0.add(row0);
300
+ tab0.add(row1);
301
+ tab0.add(row2);
302
+ tab0.add(row3);
303
+ tab0.add(row4);
304
+ tab0.add(row5);
305
+ tab0.add(row6);
306
+
307
+ for (int i=5; --i>=0;)
308
+ {
309
+ //oe.toolboxPanel.Return();
310
+ //tab0.add(new cGridBag());
311
+ }
312
+ }
313
+
314
+ public void ChangeSkybox(String name)
315
+ {
316
+ //cameraView.envyoff = false;
317
+ group.skyboxname = name;
318
+ group.skyboxext = "jpg";
319
+ cameraView.repaint();
320
+ }
321
+
26322 //ObjEditor objEditor;
27323 public void closeUI2()
28324 {
....@@ -60,6 +356,12 @@
60356 this.copy = this.group = group;
61357 //selectees = this.group.selectees;
62358
359
+ if (copy.versionlist == null)
360
+ {
361
+ copy.versionlist = new Object3D[100];
362
+ copy.versionindex = -1;
363
+ }
364
+
63365 if(ui)
64366 SetupUI(objEditor);
65367 }
....@@ -74,16 +376,28 @@
74376 this.copy = this.group = copy;
75377 //selectees = this.group.selectees;
76378
77
- SetupMenu2(objEditor);
379
+ SetupMenu2(this); //objEditor);
78380 SetupUI2(objEditor);
79381 objEditor.SetupUI(true);
80382 SetupViews(objEditor);
81383
82384 ((cRadio)radioPanel.getComponent(0)).SetCamera(cameraView.renderCamera, true);
385
+
386
+ if (copy.versionlist == null)
387
+ {
388
+ copy.versionlist = new Object3D[100];
389
+ copy.versionindex = -1;
390
+
391
+ Save(true);
392
+ }
83393 }
84394
85395 void CloneSelection(boolean supports)
86396 {
397
+ if (Globals.REPLACEONMAKE)
398
+ Save();
399
+ boolean keep = Globals.REPLACEONMAKE;
400
+ Globals.REPLACEONMAKE = false;
87401 // Object3D keep = GrafreeD.clipboard;
88402 //Object3D obj;
89403 for (int i=0; i<group.selection.size(); i++)// Enumeration e = group.selection.elements(); e.hasMoreElements();)
....@@ -94,6 +408,7 @@
94408
95409 makeSomething(clone, i==group.selection.size()-1);
96410 }
411
+ Globals.REPLACEONMAKE = keep;
97412 }
98413
99414 void CloneClipboard(boolean supports)
....@@ -148,28 +463,21 @@
148463
149464 //JTextField nameField;
150465
151
- void SetupMenu2(ObjEditor oe)
466
+ void SetupMenu2(GroupEditor oe)
152467 {
153
- if (Globals.ADVANCED)
154
- {
155
- oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
156
- //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
157
- //cameraMenu.add(switchItem = new MenuItem("Reverse View"));
158
- editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
159
- oe.cameraMenu.add("-");
160
- openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
161
- openWindowItem.addActionListener(this);
162
- editLeafItem.addActionListener(this);
163
- lookAtItem.addActionListener(this);
164
- //lookFromItem.addActinoListener(this);
165
- //switchItem.addActionListener(this);
166
- }
167
-
468
+ oe.jTree = new cTree();
469
+
168470 Menu menu;
169471 oe.menuBar.add(menu = new Menu("Edit"));
170472 //editItem = menu.add(new MenuItem("Edit"));
171473 //editItem.addActionListener(this);
172
- duplicateItem = menu.add(new MenuItem("Duplicate"));
474
+
475
+// undoItem = menu.add(new MenuItem("Undo"));
476
+// undoItem.addActionListener(this);
477
+// redoItem = menu.add(new MenuItem("Redo"));
478
+// redoItem.addActionListener(this);
479
+// menu.add("-");
480
+ duplicateItem = oe.jTree.popup.add(new JMenuItem("Duplicate"));
173481 duplicateItem.addActionListener(this);
174482 cloneItem = menu.add(new MenuItem("Clone"));
175483 cloneItem.addActionListener(this);
....@@ -185,7 +493,6 @@
185493 copyItem.addActionListener(this);
186494 pasteItem = menu.add(new MenuItem("Paste"));
187495 pasteItem.addActionListener(this);
188
- menu.add("-");
189496
190497 menu.add("-");
191498 pasteIntoItem = menu.add(new MenuItem("Paste into"));
....@@ -197,8 +504,8 @@
197504 // pasteExpandItem = menu.add(new MenuItem("Paste expand"));
198505 // pasteExpandItem.addActionListener(this);
199506 menu.add("-");
200
- clearItem = menu.add(new MenuItem("Clear"));
201
- clearItem.addActionListener(this);
507
+ deleteItem = menu.add(new MenuItem("Delete"));
508
+ deleteItem.addActionListener(this);
202509
203510 if (Globals.ADVANCED)
204511 {
....@@ -206,7 +513,94 @@
206513 clearAllItem = menu.add(new MenuItem("Clear All"));
207514 clearAllItem.addActionListener(this);
208515 }
516
+
517
+ menuBar.add(cameraMenu = new Menu("View"));
518
+ //cameraMenu.add(zBufferItem = new CheckboxMenuItem("Z Buffer"));
519
+ //zBufferItem.addActionListener(this);
520
+ //cameraMenu.add(normalLensItem = new MenuItem("Normal Lens"));
521
+ //normalLensItem.addActionListener(this);
522
+ cameraMenu.add(restoreCameraItem = new MenuItem("Restore Viewpoint"));
523
+ restoreCameraItem.addActionListener(this);
524
+
525
+// cameraMenu.add(toggleFullScreenItem = new CheckboxMenuItem("Full Screen"));
526
+// toggleFullScreenItem.addItemListener(this);
527
+// toggleFullScreenItem.setState(CameraPane.FULLSCREEN);
528
+// cameraMenu.add("-");
529
+//
530
+// cameraMenu.add(toggleTextureItem = new CheckboxMenuItem("Texture"));
531
+// toggleTextureItem.addItemListener(this);
532
+// toggleTextureItem.setState(CameraPane.textureon);
533
+//
534
+// cameraMenu.add(toggleSwitchItem = new CheckboxMenuItem("Switch"));
535
+// toggleSwitchItem.addItemListener(this);
536
+// toggleSwitchItem.setState(CameraPane.SWITCH);
537
+
538
+ cameraMenu.add(toggleHandleItem = new CheckboxMenuItem("Show Handles"));
539
+ toggleHandleItem.addItemListener(this);
540
+ toggleHandleItem.setState(CameraPane.HANDLES);
541
+
542
+ cameraMenu.add(togglePaintItem = new CheckboxMenuItem("Paint mode"));
543
+ togglePaintItem.addItemListener(this);
544
+ togglePaintItem.setState(CameraPane.PAINTMODE);
545
+
546
+ if (Globals.ADVANCED)
547
+ {
548
+ cameraMenu.add("-");
549
+ cameraMenu.add(toggleLiveItem = new CheckboxMenuItem("Live"));
550
+ toggleLiveItem.addItemListener(this);
551
+ toggleLiveItem.setState(Globals.isLIVE());
209552
553
+ cameraMenu.add(stepItem = new MenuItem("Step"));
554
+ stepItem.addActionListener(this);
555
+ // cameraMenu.add(toggleDLItem = new CheckboxMenuItem("Display List"));
556
+ // toggleDLItem.addItemListener(this);
557
+ // toggleDLItem.setState(false);
558
+
559
+ cameraMenu.add(toggleRenderItem = new CheckboxMenuItem("Render"));
560
+ toggleRenderItem.addItemListener(this);
561
+ toggleRenderItem.setState(!CameraPane.frozen);
562
+
563
+ cameraMenu.add(toggleDebugItem = new CheckboxMenuItem("Debug"));
564
+ toggleDebugItem.addItemListener(this);
565
+ toggleDebugItem.setState(Globals.DEBUG);
566
+
567
+ cameraMenu.add(toggleFrustumItem = new CheckboxMenuItem("Frustum"));
568
+ toggleFrustumItem.addItemListener(this);
569
+ toggleFrustumItem.setState(CameraPane.FRUSTUM);
570
+
571
+ cameraMenu.add(toggleFootContactItem = new CheckboxMenuItem("Foot contact"));
572
+ toggleFootContactItem.addItemListener(this);
573
+ toggleFootContactItem.setState(CameraPane.FOOTCONTACT);
574
+
575
+ cameraMenu.add(toggleTimelineItem = new CheckboxMenuItem("Timeline"));
576
+ toggleTimelineItem.addItemListener(this);
577
+ }
578
+
579
+// cameraMenu.add(toggleRootItem = new CheckboxMenuItem("Alternate Root"));
580
+// toggleRootItem.addItemListener(this);
581
+// toggleRootItem.setState(false);
582
+// cameraMenu.add(animationItem = new CheckboxMenuItem("Animation"));
583
+// animationItem.addItemListener(this);
584
+// animationItem.setState(CameraPane.ANIMATION);
585
+ cameraMenu.add("-");
586
+ cameraMenu.add(editCameraItem = new MenuItem("Save Viewpoint"));
587
+ editCameraItem.addActionListener(this);
588
+
589
+ if (Globals.ADVANCED)
590
+ {
591
+ oe.cameraMenu.add(lookAtItem = new MenuItem("Set Interest"));
592
+ //cameraMenu.add(lookFromItem = new MenuItem("Look From Selection"));
593
+ //cameraMenu.add(switchViewItem = new MenuItem("Reverse View"));
594
+ editLeafItem = oe.cameraMenu.add(new MenuItem("Edit Leaf"));
595
+ oe.cameraMenu.add("-");
596
+ openWindowItem = oe.cameraMenu.add(new MenuItem("Edit copy..."));
597
+ openWindowItem.addActionListener(this);
598
+ editLeafItem.addActionListener(this);
599
+ lookAtItem.addActionListener(this);
600
+ //lookFromItem.addActinoListener(this);
601
+ //switchViewItem.addActionListener(this);
602
+ }
603
+
210604 oe.menuBar.add(menu = new Menu("Setting"));
211605 if (Globals.ADVANCED)
212606 {
....@@ -249,21 +643,29 @@
249643 }
250644
251645 oe.menuBar.add(menu = new Menu("Group"));
252
- grabItem = menu.add(new MenuItem("Grab"));
253
- grabItem.addActionListener(this);
646
+// grabItem = menu.add(new MenuItem("Grab"));
647
+// grabItem.addActionListener(this);
254648 backItem = menu.add(new MenuItem("Back"));
255649 backItem.addActionListener(this);
256650 frontItem = menu.add(new MenuItem("Front"));
257651 frontItem.addActionListener(this);
258
- compositeItem = menu.add(new MenuItem("Composite"));
259
- compositeItem.addActionListener(this);
652
+// compositeItem = menu.add(new MenuItem("Composite"));
653
+// compositeItem.addActionListener(this);
654
+
655
+ if (Globals.ADVANCED)
656
+ {
260657 hideItem = menu.add(new MenuItem("Hidden Group"));
261658 hideItem.addActionListener(this);
659
+ }
262660 ungroupItem = menu.add(new MenuItem("Ungroup"));
263661 ungroupItem.addActionListener(this);
264
- menu.add("-");
265
- randomItem = menu.add(new MenuItem("Switch node"));
266
- randomItem.addActionListener(this);
662
+
663
+// menu.add("-");
664
+//
665
+// switchItem = menu.add(new MenuItem("Switch node"));
666
+// switchItem.addActionListener(this);
667
+ if (Globals.ADVANCED)
668
+ {
267669 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
268670 switchGeoItem.addActionListener(this);
269671 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
....@@ -271,8 +673,6 @@
271673 morphItem = menu.add(new MenuItem("Morph Group"));
272674 morphItem.addActionListener(this);
273675
274
- if (Globals.ADVANCED)
275
- {
276676 menu.add("-");
277677 physicsItem = menu.add(new MenuItem("Physics"));
278678 physicsItem.addActionListener(this);
....@@ -280,30 +680,29 @@
280680 frameselectorItem.addActionListener(this);
281681 scriptNodeItem = menu.add(new MenuItem("Script Node"));
282682 scriptNodeItem.addActionListener(this);
283
- cameraItem = menu.add(new MenuItem("Camera"));
284
- cameraItem.addActionListener(this);
285683 }
286684
287685 oe.menuBar.add(menu = new Menu("Object"));
288
- textureItem = menu.add(new MenuItem("Texture"));
289
- textureItem.addActionListener(this);
686
+// textureItem = menu.add(new MenuItem("Texture"));
687
+// textureItem.addActionListener(this);
290688 billboardItem = menu.add(new MenuItem("Billboard"));
291689 billboardItem.addActionListener(this);
292690 csgItem = menu.add(new MenuItem("CSG"));
293691 csgItem.addActionListener(this);
294
- shadowXItem = menu.add(new MenuItem("Shadow X"));
692
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
295693 shadowXItem.addActionListener(this);
296
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
694
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
297695 shadowYItem.addActionListener(this);
298
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
696
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
299697 shadowZItem.addActionListener(this);
698
+ attributeItem = menu.add(new MenuItem("Attribute"));
699
+ attributeItem.addActionListener(this);
700
+
300701 if (Globals.ADVANCED)
301702 {
302703 menu.add("-");
303704 linkerItem = menu.add(new MenuItem("Linker"));
304705 linkerItem.addActionListener(this);
305
- attributeItem = menu.add(new MenuItem("Attribute"));
306
- attributeItem.addActionListener(this);
307706 templateItem = menu.add(new MenuItem("Template"));
308707 templateItem.addActionListener(this);
309708 pointflowItem = menu.add(new MenuItem("Point Flow"));
....@@ -332,7 +731,7 @@
332731 genNormalsMESHItem.addActionListener(this);
333732 if (Globals.ADVANCED)
334733 {
335
- genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
734
+ genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
336735 genNormalsMINEItem.addActionListener(this);
337736 }
338737 stripifyItem = menu.add(new MenuItem("Stripify"));
....@@ -392,6 +791,14 @@
392791 markleavesItem.addActionListener(this);
393792 unmarkleavesItem = menu.add(new MenuItem("Unmark Leaves"));
394793 unmarkleavesItem.addActionListener(this);
794
+ rewindleavesItem = menu.add(new MenuItem("Rewind Leaves"));
795
+ rewindleavesItem.addActionListener(this);
796
+ unrewindleavesItem = menu.add(new MenuItem("Unrewind Leaves"));
797
+ unrewindleavesItem.addActionListener(this);
798
+ randomleavesItem = menu.add(new MenuItem("Random Leaves"));
799
+ randomleavesItem.addActionListener(this);
800
+ unrandomleavesItem = menu.add(new MenuItem("Unrandom Leaves"));
801
+ unrandomleavesItem.addActionListener(this);
395802 menu.add("-");
396803 flipVItem = menu.add(new MenuItem("Flip V"));
397804 flipVItem.addActionListener(this);
....@@ -417,10 +824,15 @@
417824 attachBumpItem.addActionListener(this);
418825 pigmentBumpItem = menu.add(new MenuItem("Pigment -> Bump"));
419826 pigmentBumpItem.addActionListener(this);
827
+ //embedTexturesItem
420828 detachPigmentItem = menu.add(new MenuItem("Detach Pigment"));
421829 detachPigmentItem.addActionListener(this);
422830 detachBumpItem = menu.add(new MenuItem("Detach Bump"));
423831 detachBumpItem.addActionListener(this);
832
+ embedTexturesItem = menu.add(new MenuItem("Embed Textures"));
833
+ embedTexturesItem.addActionListener(this);
834
+ deEmbedTexturesItem = menu.add(new MenuItem("De-embed Textures"));
835
+ deEmbedTexturesItem.addActionListener(this);
424836 menu.add("-");
425837 sortbysizeItem = menu.add(new MenuItem("Sort by size"));
426838 sortbysizeItem.addActionListener(this);
....@@ -443,25 +855,25 @@
443855 oe.menuBar.add(menu = new Menu("Insert"));
444856 buildCreateMenu(menu);
445857
446
- oe.menuBar.add(menu = new Menu("Include"));
447
- importOBJItem = menu.add(new MenuItem("OBJ file..."));
448
- importOBJItem.addActionListener(this);
449
- menu.add("-");
450
- import3DSItem = menu.add(new MenuItem("3DS file..."));
451
- import3DSItem.addActionListener(this);
452
- menu.add("-");
453
- importVRMLX3DItem = menu.add(new MenuItem("VRML/X3D file..."));
454
- importVRMLX3DItem.addActionListener(this);
455
- menu.add("-");
456
- importGFDItem = menu.add(new MenuItem("GrafreeD file..."));
457
- importGFDItem.addActionListener(this);
458
-
459858 oe.menuBar.add(menu = new Menu("Tools"));
460859 buildToolsMenu(menu);
461860 }
462861
862
+
463863 void SetupUI2(ObjEditor oe)
464864 {
865
+ // June 2019
866
+ if (oe == null)
867
+ {
868
+ //super.SetupUI2(this);
869
+ //return;
870
+ }
871
+
872
+ if (copy != group)
873
+ {
874
+ //super.SetupUI2(this);
875
+ }
876
+
465877 //new Exception().printStackTrace();
466878
467879 oe.radioPanel = new JPanel(new GridBagLayout());
....@@ -490,27 +902,79 @@
490902 oe.radioPanel.add(dummyButton);
491903 oe.buttonGroup.add(dummyButton);
492904 */
905
+ cGridBag copyOptionsPanel = new cGridBag();
906
+
907
+ copyOptionsPanel.preferredHeight = 2;
908
+
493909 //this.AddOptions(oe.toolbarPanel, oe.aConstraints);
494910
495
- oe.toolbarPanel.add(liveCB = new cCheckBox("Live", Globals.isLIVE())); //, oe.aConstraints);
911
+ //oe.toolbarPanel.add(minButton = new cButton("Min", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
912
+ //minButton.setToolTipText("Minimize window");
913
+ //minButton.addActionListener(this);
914
+
915
+ if (Globals.ADVANCED)
916
+ {
917
+ oe.toolbarPanel.add(maxButton = GetButton("icons/add-128.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
918
+ maxButton.setToolTipText("Maximize window");
919
+ maxButton.addActionListener(this);
920
+ }
921
+
922
+ oe.toolbarPanel.add(fullButton = GetButton("icons/fullscreen.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
923
+ fullButton.setToolTipText("Full-screen window");
924
+ fullButton.addActionListener(this);
925
+
926
+ oe.toolbarPanel.add(screenfitButton = GetButton("icons/fit.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
927
+ screenfitButton.setToolTipText("Screen fit");
928
+ screenfitButton.addActionListener(this);
929
+
930
+ oe.toolbarPanel.add(restoreCameraButton = GetButton("icons/eye.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
931
+ restoreCameraButton.setToolTipText("Restore viewpoint");
932
+ restoreCameraButton.addActionListener(this);
933
+
934
+ copyOptionsPanel.add(saveButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
935
+ saveButton.setToolTipText("Duplicate current version");
936
+ saveButton.addActionListener(this);
937
+
938
+ copyOptionsPanel.add(undoButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
939
+ undoButton.setToolTipText("Previous version");
940
+ undoButton.addActionListener(this);
941
+ undoButton.setEnabled(false);
942
+
943
+ cGridBag updown = new cGridBag().setVertical(true);
944
+ updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
945
+ restoreButton.setToolTipText("Undo (restore current version)");
946
+ restoreButton.addActionListener(this);
947
+ restoreButton.setEnabled(false);
948
+
949
+ updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
950
+ replaceButton.setToolTipText("Save (replace current version)");
951
+ replaceButton.addActionListener(this);
952
+ replaceButton.setEnabled(false);
953
+
954
+ copyOptionsPanel.add(updown);
955
+
956
+ copyOptionsPanel.add(redoButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
957
+ redoButton.setToolTipText("Next version");
958
+ redoButton.addActionListener(this);
959
+ redoButton.setEnabled(false);
960
+
961
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
496962 liveCB.setToolTipText("Enable animation");
497963 liveCB.addItemListener(this);
498964
499
- oe.toolbarPanel.add(oneStepButton = new cButton("Step", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
965
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
500966 oneStepButton.setToolTipText("Animate one step forward");
501967 oneStepButton.addActionListener(this);
502968
503
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
969
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
504970 fastCB.setToolTipText("Fast mode");
505971 fastCB.addItemListener(this);
506972
507
- oe.toolbarPanel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
508
- trackCB.setToolTipText("Enable tracking");
509
- trackCB.addItemListener(this);
510
-
511
- oe.toolbarPanel.add(screenfitButton = new cButton("@", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
512
- screenfitButton.setToolTipText("Screen fit");
513
- screenfitButton.addActionListener(this);
973
+ //oe.toolboxPanel.Return();
974
+
975
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
976
+// trackCB.setToolTipText("Enable tracking");
977
+// trackCB.addItemListener(this);
514978
515979 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
516980 // screenfitpointButton.addActionListener(this);
....@@ -520,67 +984,156 @@
520984 oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
521985 snapobjectButton.addActionListener(this);
522986 snapobjectButton.setToolTipText("Snap Object");
987
+
988
+ oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
989
+ fourButton.addActionListener(this);
990
+ fourButton.setToolTipText("Show control panel only");
523991 }
524992
525
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
526
- flashSelectionButton.setToolTipText("Show selection");
527
- flashSelectionButton.addActionListener(this);
993
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
528994
529
- oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
530
-
531
- oe.toolbarPanel.add(twoButton = new cButton("|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
532
- twoButton.setToolTipText("Show center view only");
995
+ oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
996
+ twoButton.setToolTipText("Show 3D view only");
533997 twoButton.addActionListener(this);
534
- oe.toolbarPanel.add(fourButton = new cButton("+||", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
535
- fourButton.addActionListener(this);
536
- fourButton.setToolTipText("Show left panel only");
537
- oe.toolbarPanel.add(sixButton = new cButton("+|+|", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
538
- sixButton.setToolTipText("2-column layout left");
539
- sixButton.addActionListener(this);
540
- oe.toolbarPanel.add(threeButton = new cButton("|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
541
- threeButton.setToolTipText("2-column layout right");
998
+ this.fullscreenLayout = twoButton;
999
+
1000
+ oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1001
+ threeButton.setToolTipText("Show controls and 3D view");
5421002 threeButton.addActionListener(this);
543
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
544
- sevenButton.setToolTipText("3-column layout");
545
- sevenButton.addActionListener(this);
1003
+ oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1004
+ sixButton.setToolTipText("Show 3D view and controls");
1005
+ sixButton.addActionListener(this);
1006
+// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1007
+// sevenButton.setToolTipText("3-column layout");
1008
+// sevenButton.addActionListener(this);
5461009 //
5471010
548
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
549
- rootButton.setToolTipText("Edit selection in new tab");
1011
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1012
+ rootButton.setToolTipText("Open selection in new tab");
5501013 rootButton.addActionListener(this);
5511014
552
- oe.toolbarPanel.add(closeButton = new cButton("X", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1015
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
5531016 closeButton.setToolTipText("Close tab");
5541017 closeButton.addActionListener(this);
5551018 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
5561019 //clearButton.addActionListener(this);
557
-
558
- cGridBag commandsPanel = new cGridBag();
1020
+
1021
+ cGridBag row1 = new cGridBag();
5591022
560
- commandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
561
- editButton.setToolTipText("Edit selection");
1023
+ // INSERT
1024
+ row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1025
+ gridButton.setToolTipText("Create grid");
1026
+ gridButton.addActionListener(this);
1027
+
1028
+ row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1029
+ boxButton.setToolTipText("Create box");
1030
+ boxButton.addActionListener(this);
1031
+
1032
+ row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1033
+ sphereButton.setToolTipText("Create sphere");
1034
+ sphereButton.addActionListener(this);
1035
+
1036
+ row1.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1037
+ coneButton.setToolTipText("Create cone");
1038
+ coneButton.addActionListener(this);
1039
+
1040
+ row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1041
+ torusButton.setToolTipText("Create torus");
1042
+ torusButton.addActionListener(this);
1043
+
1044
+ row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1045
+ superButton.setToolTipText("Create superellipsoid");
1046
+ superButton.addActionListener(this);
1047
+
1048
+ if (Globals.ADVANCED)
1049
+ {
1050
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1051
+ kleinButton.setToolTipText("Create Klein bottle");
1052
+ kleinButton.addActionListener(this);
1053
+ }
1054
+
1055
+ row1.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1056
+ particlesButton.setToolTipText("Create particle system");
1057
+ particlesButton.addActionListener(this);
1058
+
1059
+ oe.toolboxPanel.add(row1);
1060
+
1061
+ cGridBag row2 = new cGridBag();
1062
+
1063
+ row2.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1064
+ groupButton.setToolTipText("Create group");
1065
+ groupButton.addActionListener(this);
1066
+
1067
+ row2.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1068
+ compositeButton.setToolTipText("Create composite");
1069
+ compositeButton.addActionListener(this);
1070
+
1071
+ row2.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1072
+ switchButton.setToolTipText("Create item switcher");
1073
+ switchButton.addActionListener(this);
1074
+
1075
+ row2.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1076
+ loopButton.setToolTipText("Create loop");
1077
+ loopButton.addActionListener(this);
1078
+
1079
+ row2.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1080
+ textureButton.setToolTipText("Create texture");
1081
+ textureButton.addActionListener(this);
1082
+
1083
+ row2.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1084
+ overlayButton.setToolTipText("Create overlay");
1085
+ overlayButton.addActionListener(this);
1086
+
1087
+ row2.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1088
+ lightButton.setToolTipText("Create light");
1089
+ lightButton.addActionListener(this);
1090
+
1091
+ oe.toolboxPanel.add(row2);
1092
+
1093
+ // ENVYMAPS
1094
+ cGridBag skyboxpane = new cGridBag();
1095
+ skyboxpane.preferredHeight = 100;
1096
+
1097
+ oe.toolboxPanel.add(skyboxpane);
1098
+
1099
+ JTabbedPane skyboxpanel = new JTabbedPane();
1100
+ skyboxpane.add(skyboxpanel);
1101
+
1102
+ AddSkyboxTab0(skyboxpanel);
1103
+ AddSkyboxTab1(skyboxpanel);
1104
+ AddSkyboxTab2(skyboxpanel);
1105
+ AddSkyboxTab3(skyboxpanel);
1106
+
1107
+ // EDIT panel
1108
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1109
+ editButton.setToolTipText("Pin selection controls");
5621110 editButton.addActionListener(this);
5631111
564
- commandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
565
- uneditButton.setToolTipText("Unedit selection");
1112
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1113
+ uneditButton.setToolTipText("Unpin and remove selection controls");
5661114 uneditButton.addActionListener(this);
5671115
568
- commandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
569
- allParamsButton.setToolTipText("Edit all params");
1116
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
1117
+ allParamsButton.setToolTipText("Show all controle");
5701118 allParamsButton.addActionListener(this);
5711119
572
- commandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1120
+ editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
5731121 clearPanelButton.setToolTipText("Clear edit panel");
5741122 clearPanelButton.addActionListener(this);
5751123
576
- commandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1124
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
5771125 unselectButton.setToolTipText("Unselect");
5781126 unselectButton.addActionListener(this);
5791127
580
- commandsPanel.preferredHeight = 1;
1128
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1129
+ flashSelectionButton.setToolTipText("Highlight selection");
1130
+ flashSelectionButton.addActionListener(this);
5811131
582
- oe.treePanel.add(commandsPanel);
583
- oe.treePanel.Return();
1132
+ editCommandsPanel.preferredHeight = 1;
1133
+
1134
+ SetPinStates(false);
1135
+// oe.treePanel.add(commandsPanel);
1136
+// oe.treePanel.Return();
5841137
5851138 // oe.aConstraints.gridx += 1;
5861139 // oe.aConstraints.weighty = 0;
....@@ -597,32 +1150,20 @@
5971150
5981151 JScrollPane jSP;
5991152 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
600
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
1153
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
6011154 ResetModel();
6021155
6031156 oe.treePanel.add(jSPPanel);
6041157 oe.treePanel.Return();
6051158
606
- cGridBag copyOptionsPanel = new cGridBag();
607
-
608
- copyOptionsPanel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
609
- colorCB.setToolTipText("Copy color when dropped");
610
- colorCB.addItemListener(this);
611
-
612
- copyOptionsPanel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
613
- materialCB.setToolTipText("Copy material when dropped");
614
- materialCB.addItemListener(this);
615
-
616
- copyOptionsPanel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
617
- textureCB.setToolTipText("Copy texture when dropped");
618
- textureCB.addItemListener(this);
619
-
620
- copyOptionsPanel.preferredHeight = 1;
6211159 oe.treePanel.add(copyOptionsPanel);
6221160 oe.treePanel.Return();
1161
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1162
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
1163
+ sliderPane.preferredHeight = 1;
6231164
624
-// mainPanel.setDividerLocation(0.5); //1.0);
625
-// mainPanel.setResizeWeight(0.5);
1165
+// mainPanel.setDividerLocation(0.1); //1.0);
1166
+ mainPanel.setResizeWeight(0.4);
6261167
6271168 //jList.addListSelectionListener(this);
6281169 oe.jTree.addTreeSelectionListener(this);
....@@ -630,7 +1171,7 @@
6301171 //jTree.setEditable(true);
6311172 oe.jTree.setDragEnabled(true);
6321173 //jTree.setPreferredSize(new Dimension(10,10));
633
- jSP.setPreferredSize(new Dimension(100,200));
1174
+ //jSP.setPreferredSize(new Dimension(100,200));
6341175
6351176 oe.jTree.setCellRenderer(new cTreeModel.Renderer());
6361177
....@@ -642,29 +1183,49 @@
6421183 dgr.addDragGestureListener(this);
6431184 }catch(Exception e) {}
6441185 */
645
- radio.layout = sevenButton;
1186
+ radio.layout = threeButton; // sixButton;
6461187 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
6471188 }
6481189
6491190 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
6501191 {
1192
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
1193
+ colorCB.setToolTipText("Copy color when dropped");
1194
+ colorCB.addItemListener(this);
1195
+
1196
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
1197
+ materialCB.setToolTipText("Copy material when dropped");
1198
+ materialCB.addItemListener(this);
1199
+
1200
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
1201
+ textureCB.setToolTipText("Copy texture when dropped");
1202
+ textureCB.addItemListener(this);
1203
+
1204
+ panel.Return();
1205
+
6511206 panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
6521207 boxCB.setToolTipText("Display bounding boxes");
6531208 boxCB.addItemListener(this);
6541209
6551210 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
656
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
1211
+ zoomBoxCB.setToolTipText("Display only for wheel");
6571212 zoomBoxCB.addItemListener(this);
6581213
6591214 if (true) // Globals.ADVANCED)
6601215 {
661
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
662
- supportCB.setToolTipText("Enable rigging");
663
- supportCB.addItemListener(this);
1216
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
1217
+// supportCB.setToolTipText("Enable rigging");
1218
+// supportCB.addItemListener(this);
1219
+
1220
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
1221
+ freezeCB.setToolTipText("Fast moving camera");
1222
+ freezeCB.addItemListener(this);
6641223
6651224 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
6661225 // localCB.addItemListener(this);
6671226
1227
+ panel.Return();
1228
+
6681229 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
6691230 crowdCB.setToolTipText("Used for crowds");
6701231 crowdCB.addItemListener(this);
....@@ -673,14 +1234,19 @@
6731234 smoothCB.setToolTipText("Snapping delay");
6741235 smoothCB.addItemListener(this);
6751236
676
- panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
677
- slowCB.setToolTipText("Smooth interpolation");
678
- slowCB.addItemListener(this);
1237
+// panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
1238
+// slowCB.setToolTipText("Smooth interpolation");
1239
+// slowCB.addItemListener(this);
1240
+ panel.add(minshaderCB = new cCheckBox("Min shader", Globals.MINSHADER)); //, constraints);
1241
+ minshaderCB.setToolTipText("Minimal fast shader");
1242
+ minshaderCB.addItemListener(this);
6791243
6801244 // constraints.gridy += 1;
6811245 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
6821246 // speakerMocapCB.addItemListener(this);
6831247
1248
+ panel.Return();
1249
+
6841250 if (false)
6851251 {
6861252 // handled in scripts
....@@ -695,34 +1261,74 @@
6951261 //constraints.gridy += 1;
6961262 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
6971263 smoothfocusCB.addItemListener(this);
1264
+ panel.Return();
6981265 }
6991266
7001267 //constraints.gridx += 1;
7011268 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
7021269 // debugCB.addItemListener(this);
7031270
1271
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
1272
+ trackCB.setToolTipText("Enable tracking target");
1273
+ trackCB.addItemListener(this);
1274
+
7041275 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
1276
+ oeilCB.setToolTipText("Move camera when tracking");
7051277 oeilCB.addItemListener(this);
7061278
1279
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
1280
+ shadowCB.setToolTipText("When live compute shadows");
1281
+ shadowCB.addItemListener(this);
1282
+
1283
+ panel.Return();
1284
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
1285
+ toggleTextureCB.setToolTipText("Load textures");
1286
+ toggleTextureCB.addItemListener(this);
1287
+
1288
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
1289
+ toggleSwitchCB.setToolTipText("Choose a single item");
1290
+ toggleSwitchCB.addItemListener(this);
1291
+
1292
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
1293
+ autokeepCB.setToolTipText("On structure change");
1294
+ autokeepCB.addItemListener(this);
1295
+
1296
+ panel.Return();
1297
+ if (Globals.ADVANCED)
1298
+ {
7071299 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
7081300 lookAtCB.setToolTipText("Look-at target");
7091301 lookAtCB.addItemListener(this);
1302
+ }
7101303
7111304 }
7121305
7131306 cGridBag fill = new cGridBag();
714
-
7151307 fill.preferredHeight = 200;
1308
+ cGridBag fill2 = new cGridBag();
1309
+ fill2.preferredHeight = 200;
1310
+ cGridBag fill3 = new cGridBag();
1311
+ fill3.preferredHeight = 200;
7161312
7171313 panel.add(fill);
1314
+ panel.add(fill2);
1315
+ panel.add(fill3);
7181316
7191317 }
7201318
7211319 void EditObject(Object3D obj)
7221320 {
7231321 cRadio radioButton = new cRadio(obj.name);
1322
+
1323
+ // June 2019. Patch to avoid bug with transparency.
1324
+ radioButton.hadMaterial = obj.material != null;
1325
+ if (!radioButton.hadMaterial)
1326
+ {
1327
+ obj.material = new cMaterial();
1328
+ }
1329
+
7241330 radioButton.SetObject(obj);
725
- radioButton.layout = sevenButton;
1331
+ radioButton.layout = threeButton; // sixButton;
7261332 radioButton.SetCamera(cameraView.renderCamera, false);
7271333 radioButton.addActionListener(this);
7281334 radioPanel.add(radioButton);
....@@ -732,6 +1338,8 @@
7321338
7331339 void SetupViews(ObjEditor oe)
7341340 {
1341
+ theFrame = this;
1342
+
7351343 oe.SetupViews();
7361344
7371345 System.out.println("SetupViews");
....@@ -740,23 +1348,30 @@
7401348 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
7411349 }
7421350
743
- JCheckBox liveCB;
744
- JCheckBox supportCB;
745
- JCheckBox localCB;
746
- JCheckBox crowdCB;
747
- JCheckBox smoothCB;
748
- JCheckBox fastCB;
749
- JCheckBox slowCB;
750
- JCheckBox boxCB;
751
- JCheckBox zoomBoxCB;
752
- JCheckBox trackCB;
753
- JCheckBox smoothfocusCB;
1351
+ cToggleButton liveCB;
1352
+ cCheckBox supportCB;
1353
+ cCheckBox localCB;
1354
+ cCheckBox crowdCB;
1355
+ cCheckBox smoothCB;
1356
+ cCheckBox minshaderCB;
1357
+
1358
+ cToggleButton fastCB;
1359
+ cCheckBox slowCB;
1360
+ cCheckBox boxCB;
1361
+ cCheckBox zoomBoxCB;
1362
+ cCheckBox freezeCB;
1363
+ //cToggleButton trackCB;
1364
+ cCheckBox trackCB;
1365
+ cCheckBox smoothfocusCB;
7541366 // JCheckBox speakerMocapCB;
755
- JCheckBox speakerCameraCB;
756
- JCheckBox speakerFocusCB;
757
- JCheckBox debugCB;
758
- JCheckBox oeilCB;
759
- JCheckBox lookAtCB;
1367
+ cCheckBox speakerCameraCB;
1368
+ cCheckBox speakerFocusCB;
1369
+ cCheckBox debugCB;
1370
+
1371
+ cCheckBox oeilCB;
1372
+ cCheckBox shadowCB;
1373
+ cCheckBox autokeepCB;
1374
+ cCheckBox lookAtCB;
7601375
7611376 // static int COLOR = 1;
7621377 // static int MATERIAL = 2;
....@@ -764,9 +1379,9 @@
7641379
7651380 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
7661381
767
- JCheckBox colorCB;
768
- JCheckBox materialCB;
769
- JCheckBox textureCB;
1382
+ cCheckBox colorCB;
1383
+ cCheckBox materialCB;
1384
+ cCheckBox textureCB;
7701385
7711386 public void itemStateChanged(ItemEvent e)
7721387 {
....@@ -794,6 +1409,7 @@
7941409 } else if(e.getSource() == liveCB)
7951410 {
7961411 cameraView.ToggleLive();
1412
+ refreshContents(false);
7971413 }
7981414 else if(e.getSource() == supportCB)
7991415 {
....@@ -809,6 +1425,12 @@
8091425 {
8101426 cameraView.ToggleInertia();
8111427 cameraView.repaint();
1428
+ }
1429
+ else if(e.getSource() == minshaderCB)
1430
+ {
1431
+ Globals.MINSHADER ^= true;
1432
+ cameraView.programInitialized = false;
1433
+ cameraView.repaint();
8121434 }
8131435 else if(e.getSource() == localCB)
8141436 {
....@@ -858,6 +1480,18 @@
8581480 {
8591481 cameraView.ToggleOeil();
8601482 }
1483
+ else if(e.getSource() == shadowCB)
1484
+ {
1485
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1486
+ }
1487
+ else if(e.getSource() == freezeCB)
1488
+ {
1489
+ Globals.FREEZEONMOVE ^= true;
1490
+ }
1491
+ else if(e.getSource() == autokeepCB)
1492
+ {
1493
+ Globals.REPLACEONMAKE ^= true;
1494
+ }
8611495 else if(e.getSource() == lookAtCB)
8621496 {
8631497 cameraView.ToggleLookAt();
....@@ -874,7 +1508,8 @@
8741508
8751509 /**/
8761510 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
877
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1511
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1512
+ TreePath path = objEditor.jTree.getSelectionPath();
8781513 if ((path == null) || (path.getPathCount() <= 1)) {
8791514 // We can't move the root node or an empty selection
8801515 return;
....@@ -937,8 +1572,6 @@
9371572 }
9381573 }
9391574
940
- String string = (String) object;
941
-
9421575 System.out.println("Transfer = " + object + "; drop : " + target);
9431576 // if( object instanceof java.io.File[])
9441577 // {
....@@ -946,6 +1579,8 @@
9461579 // objEditor.DropFile((java.io.File[]) object, true);
9471580 // return;
9481581 // }
1582
+
1583
+ String string = object.toString();
9491584
9501585 // File path for Mac and Windows
9511586 if (string.charAt(0) == '/' || string.charAt(1) == ':')
....@@ -991,23 +1626,33 @@
9911626
9921627 assert target == objEditor.jTree;
9931628 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1629
+ Object3D destinationLeaf;
9941630 try {
995
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1631
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
9961632 } catch (Exception e) {
9971633 System.out.println("destinationPath : " + destinationPath);
9981634 return;
9991635 }
10001636
1001
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1637
+ for (int i=group.selection.size(); --i>=0;)
10021638 {
1639
+ Object3D child = (Object3D)group.selection.elementAt(i);
1640
+
1641
+ // Cannot move into itself
1642
+ if (child == destinationLeaf)
1643
+ return;
1644
+ }
1645
+
1646
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1647
+// {
10031648 loadClipboard(true);
10041649 objEditor.jTree.setSelectionPath(destinationPath);
10051650 pasteInto(false, false);
1006
- } else {
1007
- loadClipboard(false);
1008
- objEditor.jTree.setSelectionPath(destinationPath);
1009
- pasteInto(false, false); // true); // ???
1010
- }
1651
+// } else {
1652
+// loadClipboard(false);
1653
+// objEditor.jTree.setSelectionPath(destinationPath);
1654
+// pasteInto(false, false); // true); // ???
1655
+// }
10111656 }
10121657 public void dropActionChanged(DropTargetDragEvent dtde)
10131658 // Called if the user has modified the current drop gesture
....@@ -1112,22 +1757,30 @@
11121757 {
11131758 //heightFieldItem = menu.add(new MenuItem("Height Field"));
11141759 //heightFieldItem.addActionListener(this);
1115
- gridItem = menu.add(new MenuItem("Grid"));
1116
- gridItem.addActionListener(this);
1117
- rectoidItem = menu.add(new MenuItem("Box"));
1118
- rectoidItem.addActionListener(this);
1119
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1120
- ellipsoidItem.addActionListener(this);
1121
- coneItem = menu.add(new MenuItem("Cone"));
1122
- coneItem.addActionListener(this);
1123
- torusItem = menu.add(new MenuItem("Torus"));
1124
- torusItem.addActionListener(this);
1125
- superItem = menu.add(new MenuItem("Superellipsoid"));
1126
- superItem.addActionListener(this);
1760
+// gridItem = menu.add(new MenuItem("Grid"));
1761
+// gridItem.addActionListener(this);
1762
+// rectoidItem = menu.add(new MenuItem("Box"));
1763
+// rectoidItem.addActionListener(this);
1764
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1765
+// ellipsoidItem.addActionListener(this);
1766
+// coneItem = menu.add(new MenuItem("Cone"));
1767
+// coneItem.addActionListener(this);
1768
+// torusItem = menu.add(new MenuItem("Torus"));
1769
+// torusItem.addActionListener(this);
1770
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1771
+// superItem.addActionListener(this);
1772
+
1773
+ cameraItem = menu.add(new MenuItem("Camera"));
1774
+ cameraItem.addActionListener(this);
1775
+
1776
+ if (!Globals.ADVANCED)
1777
+ {
11271778 kleinItem = menu.add(new MenuItem("Klein Bottle"));
11281779 kleinItem.addActionListener(this);
1129
- particleItem = menu.add(new MenuItem("Particle system"));
1130
- particleItem.addActionListener(this);
1780
+ }
1781
+
1782
+// particleItem = menu.add(new MenuItem("Particle system"));
1783
+// particleItem.addActionListener(this);
11311784 if (Globals.ADVANCED)
11321785 {
11331786 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1153,15 +1806,15 @@
11531806 }
11541807 bezierItem = menu.add(new MenuItem("Bezier Patch"));
11551808 bezierItem.addActionListener(this);
1156
- overlayItem = menu.add(new MenuItem("Overlay"));
1157
- overlayItem.addActionListener(this);
1158
- lightItem = menu.add(new MenuItem("Light"));
1159
- lightItem.addActionListener(this);
1809
+// overlayItem = menu.add(new MenuItem("Overlay"));
1810
+// overlayItem.addActionListener(this);
1811
+// lightItem = menu.add(new MenuItem("Light"));
1812
+// lightItem.addActionListener(this);
11601813 menu.add("-");
11611814 //superLoopItem = menu.add(new MenuItem("Super Loop"));
11621815 //superLoopItem.addActionListener(this);
1163
- loopItem = menu.add(new MenuItem("Loop"));
1164
- loopItem.addActionListener(this);
1816
+// loopItem = menu.add(new MenuItem("Loop"));
1817
+// loopItem.addActionListener(this);
11651818 doubleItem = menu.add(new MenuItem("Fork"));
11661819 doubleItem.addActionListener(this);
11671820 if (Globals.ADVANCED)
....@@ -1177,6 +1830,9 @@
11771830 animationItem.addItemListener(this);
11781831 animationItem.setState(Globals.ANIMATION);
11791832
1833
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1834
+ archiveItem.addActionListener(this);
1835
+
11801836 menu.add("-");
11811837 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
11821838 parseverticesItem.addActionListener(this);
....@@ -1189,6 +1845,8 @@
11891845 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
11901846 reduce34MorphItem.addActionListener(this);
11911847 menu.add("-");
1848
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1849
+ memoryItem.addActionListener(this);
11921850 menu.add(computeAOItem = new MenuItem("Compute AO"));
11931851 computeAOItem.addActionListener(this);
11941852
....@@ -1197,11 +1855,9 @@
11971855 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
11981856 mirrorItem.addActionListener(this);
11991857 menu.add("-");
1200
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1201
- memoryItem.addActionListener(this);
12021858 menu.add(analyzeItem = new MenuItem("Analyze"));
12031859 analyzeItem.addActionListener(this);
1204
- menu.add(dumpItem = new MenuItem("Dump"));
1860
+ menu.add(dumpItem = new MenuItem("Print"));
12051861 dumpItem.addActionListener(this);
12061862 // menu.add(pathItem = new MenuItem("From-to path"));
12071863 // pathItem.addActionListener(this);
....@@ -1342,9 +1998,34 @@
13421998 shadow.material = new cMaterial(obj.material);
13431999 shadow.material.diffuse = 0.0001f;
13442000 shadow.material.specular = 0.0001f;
2001
+ //shadow.projectedVertices[1].x = 300;
13452002
13462003 makeSomething(shadow);
13472004 }
2005
+
2006
+ private void ClearUnpinned()
2007
+ {
2008
+ //for (Object3D obj : listUI)
2009
+ for (int i=listUI.size(); --i>=0;)
2010
+ {
2011
+ Object3D obj = listUI.elementAt(i);
2012
+ if (!obj.pinned)
2013
+ {
2014
+ obj.CloseUI();
2015
+ listUI.remove(i);
2016
+ }
2017
+ }
2018
+ }
2019
+
2020
+ private void EditElement(Object3D elem, boolean newWindow)
2021
+ {
2022
+ // if (!(elem instanceof Composite))
2023
+ // newWindow = false;
2024
+ listUI.add(elem);
2025
+ elem.openEditWindow(this, newWindow); //, false);
2026
+ System.out.println("edit : " + elem);
2027
+ elem.editWindow.refreshContents(true); // ? new
2028
+ }
13482029
13492030 /**
13502031 * applyExample
....@@ -1589,7 +2270,7 @@
15892270 {
15902271 ScreenFit();
15912272 } else
1592
- if (source == switchItem)
2273
+ if (source == switchViewItem)
15932274 {
15942275 cVector v1 = new cVector();
15952276 cVector v2 = new cVector();
....@@ -1598,11 +2279,11 @@
15982279 objEditor.cameraView.renderCamera.setAim(v2, v1);
15992280 objEditor.cameraView.repaint();
16002281 } else
1601
- if (source == rectoidItem)
2282
+ if (source == rectoidItem || source == boxButton)
16022283 {
16032284 makeSomething(new Box());
16042285 } else
1605
- if (source == particleItem)
2286
+ if (source == particleItem || source == particlesButton)
16062287 {
16072288 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
16082289 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1681,27 +2362,27 @@
16812362
16822363 makeSomething(obj);
16832364 } else
1684
- if (source == gridItem)
2365
+ if (source == gridItem || source == gridButton)
16852366 {
16862367 makeSomething(new Grid());
16872368 } else
1688
- if (source == ellipsoidItem)
2369
+ if (source == ellipsoidItem || source == sphereButton)
16892370 {
16902371 makeSomething(new Sphere());
16912372 } else
1692
- if (source == coneItem)
2373
+ if (source == coneItem || source == coneButton)
16932374 {
16942375 makeSomething(new Cone());
16952376 } else
1696
- if (source == torusItem)
2377
+ if (source == torusItem || source == torusButton)
16972378 {
16982379 makeSomething(new Torus());
16992380 } else
1700
- if (source == superItem)
2381
+ if (source == superItem || source == superButton)
17012382 {
17022383 makeSomething(new Superellipsoid());
17032384 } else
1704
- if (source == kleinItem)
2385
+ if (source == kleinItem || source == kleinButton)
17052386 {
17062387 makeSomething(new Klein());
17072388 } else
....@@ -1721,7 +2402,7 @@
17212402 {
17222403 makeSomething(new BezierSurface());
17232404 } else
1724
- if (source == overlayItem)
2405
+ if (source == overlayItem || source == overlayButton)
17252406 {
17262407 /*
17272408 Object3D obj = new BezierSurface(5,8);
....@@ -1769,10 +2450,27 @@
17692450 s.setup();
17702451 makeSomething(s);
17712452 } else
1772
- if (source == lightItem)
2453
+ if (source == lightItem || source == lightButton)
17732454 {
17742455 makeSomething(new Light());
17752456 } else
2457
+// if (source == skybox1Button ||
2458
+// source == skybox2Button ||
2459
+// source == skybox3Button ||
2460
+// source == skybox4Button ||
2461
+// source == skybox5Button ||
2462
+// source == skybox6Button ||
2463
+// source == skybox7Button ||
2464
+// source == skybox11Button ||
2465
+// source == skybox12Button ||
2466
+// source == skybox13Button ||
2467
+// source == skybox14Button ||
2468
+// source == skybox15Button ||
2469
+// source == skybox16Button ||
2470
+// source == skybox17Button)
2471
+// {
2472
+// ChangeSkybox(source);
2473
+// } else
17762474 if (source == csgItem)
17772475 {
17782476 group(new CSG());
....@@ -1819,30 +2517,30 @@
18192517
18202518 group(g);
18212519 } else
1822
- if (source == loopItem)
2520
+ if (source == loopItem || source == loopButton)
18232521 {
18242522 Composite csg = new GroupLeaf();
18252523 csg.count = 5;
18262524 group(csg);
1827
- Composite child = new cGroup();
2525
+ Composite child = new cGroup("Branch");
18282526 csg.addChild(child);
18292527 child.addChild(csg);
18302528 } else
18312529 if (source == doubleItem)
18322530 {
1833
- Composite csg = new GroupLeaf();
2531
+ Composite csg = new GroupLeaf("Fork");
18342532 csg.count = 5;
18352533 group(csg);
1836
- Composite child = new cGroup();
2534
+ Composite child = new cGroup("Branch A");
18372535 csg.addChild(child);
18382536 child.addChild(csg);
1839
- child = new cGroup();
2537
+ child = new cGroup("Branch B");
18402538 csg.addChild(child);
18412539 child.addChild(csg);
18422540 } else
18432541 if (source == tripleItem)
18442542 {
1845
- Composite csg = new GroupLeaf();
2543
+ Composite csg = new GroupLeaf("Trident");
18462544 csg.count = 4;
18472545 group(csg);
18482546 Composite child = new cGroup();
....@@ -1855,35 +2553,10 @@
18552553 csg.addChild(child);
18562554 child.addChild(csg);
18572555 } else
1858
-
1859
- if (source == importGFDItem)
1860
- {
1861
- ImportGFD();
1862
- } else
1863
- if (source == importVRMLX3DItem)
1864
- {
1865
- ImportVRMLX3D();
1866
- } else
1867
- if (source == import3DSItem)
1868
- {
1869
- objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
1870
- } else
1871
- if (source == importOBJItem)
1872
- {
1873
- //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1874
- FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD);
1875
- browser.setVisible(true);
1876
- String filename = browser.getFile();
1877
- if (filename != null && filename.length() > 0)
1878
- {
1879
- String fullname = browser.getDirectory() + filename;
1880
- makeSomething(ReadOBJ(fullname), true);
1881
- }
1882
- } else
18832556 if (source == computeAOItem)
18842557 {
18852558 Globals.drawMode = CameraPane.OCCLUSION;
1886
- Globals.theRenderer.repaint();
2559
+ cameraView.repaint();
18872560 } else
18882561 if (source == recompileItem)
18892562 {
....@@ -1917,6 +2590,48 @@
19172590 {
19182591 DumpObject();
19192592 } else
2593
+ if (source == minButton)
2594
+ {
2595
+ Minimize();
2596
+ } else
2597
+ if (source == maxButton)
2598
+ {
2599
+ Maximize();
2600
+ } else
2601
+ if (source == fullButton)
2602
+ {
2603
+ ToggleFullScreen();
2604
+ } else
2605
+ if (source == undoButton)
2606
+ {
2607
+ // Go to previous version
2608
+ //if (!Undo())
2609
+ //java.awt.Toolkit.getDefaultToolkit().beep();
2610
+ Undo();
2611
+ } else
2612
+ if (source == restoreButton)
2613
+ {
2614
+ // Restore current version
2615
+ Restore();
2616
+ restoreButton.setEnabled(false);
2617
+ } else
2618
+ if (source == replaceButton)
2619
+ {
2620
+ // Overwrite current version
2621
+ Replace();
2622
+ replaceButton.setEnabled(false);
2623
+ } else
2624
+ if (source == redoButton)
2625
+ {
2626
+ // Go to next version
2627
+ Redo();
2628
+ } else
2629
+ if (source == saveButton)
2630
+ {
2631
+ // Save a new version
2632
+ if (!Save(true))
2633
+ java.awt.Toolkit.getDefaultToolkit().beep();
2634
+ } else
19202635 if (source == oneStepButton)
19212636 {
19222637 Globals.ONESTEP = true;
....@@ -1924,17 +2639,14 @@
19242639 } else
19252640 if (source == screenfitButton)
19262641 {
1927
- //Reload(lastConverter, lastFilename, true);
19282642 ScreenFit();
19292643 } else
19302644 if (source == screenfitpointButton)
19312645 {
1932
- //Reload(lastConverter, lastFilename, true);
19332646 ScreenFitPoint();
19342647 } else
19352648 if (source == snapobjectButton)
19362649 {
1937
- //Reload(lastConverter, lastFilename, true);
19382650 SnapObject();
19392651 } else
19402652 // if (event.getSource() == recompileButton)
....@@ -1970,6 +2682,14 @@
19702682 if (source == cutItem || source == clearButton)
19712683 {
19722684 loadClipboard(true);
2685
+ } else
2686
+ if (source == undoItem)
2687
+ {
2688
+ Undo();
2689
+ } else
2690
+ if (source == redoItem)
2691
+ {
2692
+ Redo();
19732693 } else
19742694 if (source == duplicateItem)
19752695 {
....@@ -2290,7 +3010,7 @@
22903010 {
22913011 StepAll();
22923012 } else
2293
- if (source == clearItem) // || event.getSource() == clearButton)
3013
+ if (source == deleteItem) // || event.getSource() == clearButton)
22943014 {
22953015 //int indices[] = jList.getSelectedIndices();
22963016 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2302,9 +3022,9 @@
23023022 {
23033023 ClearSelection(true);
23043024 } else
2305
- if (source == grabItem)
3025
+ if (source == grabItem || source == groupButton)
23063026 {
2307
- group(new cGroup(), true);
3027
+ group(new cGroup(), false); // true);
23083028 } else
23093029 if (source == hideItem)
23103030 {
....@@ -2322,11 +3042,11 @@
23223042 {
23233043 makeSomething(new Camera());
23243044 } else
2325
- if (source == compositeItem)
3045
+ if (source == compositeItem || source == compositeButton)
23263046 {
23273047 group(new Composite());
23283048 } else
2329
- if (source == randomItem)
3049
+ if (source == switchItem || source == switchButton)
23303050 {
23313051 RandomNode random = new RandomNode();
23323052 group(random);
....@@ -2428,7 +3148,7 @@
24283148 {
24293149 group(new cLinker());
24303150 } else
2431
- if (source == textureItem)
3151
+ if (source == textureItem || source == textureButton)
24323152 {
24333153 group(new TextureNode());
24343154 } else
....@@ -2448,17 +3168,30 @@
24483168 {
24493169 CastShadow(2);
24503170 } else
2451
- if (source == ungroupItem)
3171
+ if (source == ungroupItem || source == ungroupButton)
24523172 {
2453
- //ungroup();
3173
+ boolean hasRoot = false;
3174
+
24543175 for (int i=0; i<group.selection.size(); i++)
24553176 {
2456
- Ungroup(group.selection.get(i));
3177
+ if (group.selection.get(i) == group)
3178
+ {
3179
+ hasRoot = true;
3180
+ break;
3181
+ }
24573182 }
24583183
2459
- ClearSelection(false);
2460
-
2461
- refreshContents();
3184
+ if (!hasRoot)
3185
+ {
3186
+ for (int i=0; i<group.selection.size(); i++)
3187
+ {
3188
+ Ungroup(group.selection.get(i));
3189
+ }
3190
+
3191
+ ClearSelection(false);
3192
+
3193
+ refreshContents();
3194
+ }
24623195 } else
24633196 if (source == genUVItem)
24643197 {
....@@ -2470,7 +3203,7 @@
24703203 } else
24713204 if (source == genNormalsMESHItem)
24723205 {
2473
- GenNormals(true); // TODO
3206
+ GenNormalsMESH();
24743207 } else
24753208 if (source == genNormalsORGANItem)
24763209 {
....@@ -2535,6 +3268,22 @@
25353268 if (source == unmarkleavesItem)
25363269 {
25373270 MarkLeaves(false);
3271
+ } else
3272
+ if (source == rewindleavesItem)
3273
+ {
3274
+ RewindLeaves(true);
3275
+ } else
3276
+ if (source == unrewindleavesItem)
3277
+ {
3278
+ RewindLeaves(false);
3279
+ } else
3280
+ if (source == randomleavesItem)
3281
+ {
3282
+ RandomLeaves(true);
3283
+ } else
3284
+ if (source == unrandomleavesItem)
3285
+ {
3286
+ RandomLeaves(false);
25383287 } else
25393288 if (source == flipVItem)
25403289 {
....@@ -2743,7 +3492,7 @@
27433492 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
27443493 {
27453494 obj = (Object3D)e.nextElement();
2746
- obj.SetBumpTexture(null);
3495
+ obj.ResetBumpTexture();
27473496 }
27483497
27493498 refreshContents();
....@@ -2759,6 +3508,31 @@
27593508
27603509 refreshContents();
27613510 } else
3511
+ if (source == embedTexturesItem)
3512
+ {
3513
+ Object3D obj;
3514
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3515
+ {
3516
+ obj = (Object3D)e.nextElement();
3517
+ obj.EmbedTextures(true);
3518
+ }
3519
+
3520
+ refreshContents();
3521
+ } else
3522
+ if (source == deEmbedTexturesItem)
3523
+ {
3524
+ Object3D obj;
3525
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3526
+ {
3527
+ obj = (Object3D)e.nextElement();
3528
+ obj.EmbedTextures(false);
3529
+ }
3530
+
3531
+ CameraPane.texturepigment.clear();
3532
+ CameraPane.texturebump.clear();
3533
+
3534
+ refreshContents();
3535
+ } else
27623536 if (source == flashSelectionButton)
27633537 {
27643538 CameraPane.flash = true;
....@@ -2770,6 +3544,10 @@
27703544 if (source == twoButton)
27713545 {
27723546 radio.layout = twoButton;
3547
+
3548
+ if (CameraPane.FULLSCREEN)
3549
+ fullscreenLayout = radio.layout;
3550
+
27733551 // bug
27743552 //gridPanel.setDividerLocation(1.0);
27753553 //bigPanel.setDividerLocation(0.0);
....@@ -2802,10 +3580,31 @@
28023580 bigThree.ClearUI();
28033581 bigThree.add(centralPanel);
28043582 bigThree.FlushUI();
3583
+
3584
+ cameraView.requestFocusInWindow();
3585
+
3586
+// refreshContents(true);
3587
+//
3588
+// try
3589
+// {
3590
+// java.awt.Robot bot = new java.awt.Robot();
3591
+// int mask = InputEvent.BUTTON1_MASK;
3592
+// bot.mouseMove(100, 100);
3593
+// bot.mousePress(mask);
3594
+// bot.mouseRelease(mask);
3595
+// }
3596
+// catch (Exception e)
3597
+// {
3598
+//
3599
+// }
3600
+
28053601 } else
28063602 if (source == threeButton)
28073603 {
28083604 radio.layout = threeButton;
3605
+
3606
+ if (CameraPane.FULLSCREEN)
3607
+ fullscreenLayout = radio.layout;
28093608
28103609 // bigThree.remove(scenePanel);
28113610 // bigThree.remove(centralPanel);
....@@ -2835,13 +3634,18 @@
28353634 // centralPanel.setVisible(true);
28363635 // XYZPanel.setVisible(true);
28373636 bigThree.ClearUI();
3637
+ bigThree.add(scenePanel);
28383638 bigThree.add(centralPanel);
2839
- bigThree.add(XYZPanel);
28403639 bigThree.FlushUI();
3640
+
3641
+ cameraView.requestFocusInWindow();
28413642 } else
28423643 if (source == fourButton)
28433644 {
28443645 radio.layout = fourButton;
3646
+
3647
+ if (CameraPane.FULLSCREEN)
3648
+ fullscreenLayout = radio.layout;
28453649
28463650 // bigThree.remove(scenePanel);
28473651 // bigThree.remove(centralPanel);
....@@ -2873,10 +3677,15 @@
28733677 bigThree.ClearUI();
28743678 bigThree.add(scenePanel);
28753679 bigThree.FlushUI();
3680
+
3681
+ cameraView.requestFocusInWindow();
28763682 } else
28773683 if (source == sixButton)
28783684 {
28793685 radio.layout = sixButton;
3686
+
3687
+ if (CameraPane.FULLSCREEN)
3688
+ fullscreenLayout = radio.layout;
28803689
28813690 // bigThree.remove(scenePanel);
28823691 // bigThree.remove(centralPanel);
....@@ -2906,13 +3715,18 @@
29063715 // centralPanel.setVisible(true);
29073716 // XYZPanel.setVisible(false);
29083717 bigThree.ClearUI();
2909
- bigThree.add(scenePanel);
29103718 bigThree.add(centralPanel);
3719
+ bigThree.add(scenePanel);
29113720 bigThree.FlushUI();
3721
+
3722
+ cameraView.requestFocusInWindow();
29123723 } else
29133724 if (source == sevenButton)
29143725 {
29153726 radio.layout = sevenButton;
3727
+
3728
+ if (CameraPane.FULLSCREEN)
3729
+ fullscreenLayout = radio.layout;
29163730
29173731 // bigThree.remove(scenePanel);
29183732 // bigThree.remove(centralPanel);
....@@ -2946,6 +3760,8 @@
29463760 bigThree.add(centralPanel);
29473761 bigThree.add(XYZPanel);
29483762 bigThree.FlushUI();
3763
+
3764
+ cameraView.requestFocusInWindow();
29493765 } else
29503766 if (source == rootButton)
29513767 {
....@@ -2957,6 +3773,7 @@
29573773 EditObject(obj);
29583774 }
29593775
3776
+ cameraView.requestFocusInWindow();
29603777 refreshContents(true);
29613778 } else
29623779 if (source == closeButton)
....@@ -2966,22 +3783,37 @@
29663783 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
29673784 {
29683785 ab = (cRadio)e.nextElement();
2969
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3786
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
29703787 {
3788
+ // Patch to avoid bug with transparency.
3789
+ if (!ab.hadMaterial)
3790
+ {
3791
+ ab.object.material = null;
3792
+ }
3793
+
29713794 buttonGroup.remove(ab);
29723795 radioPanel.remove(ab);
29733796
2974
- ab.GetObject().editWindow = null;
3797
+ //ab.GetObject().editWindow = null;
3798
+ ab.GetObject().manipWindow = null;
29753799 // ab.GetObject().objectUI = null; // ?????????
29763800
29773801 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
29783802 break;
29793803 }
29803804 }
3805
+
3806
+ cameraView.requestFocusInWindow();
29813807 refreshContents(true);
29823808 } else
29833809 if (source == editItem || source == editButton)
29843810 {
3811
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3812
+ {
3813
+ Object3D child = (Object3D)e.nextElement();
3814
+ child.pinned = true;
3815
+ }
3816
+
29853817 EditSelection(false);
29863818 } else
29873819 if (source == uneditButton)
....@@ -2990,11 +3822,12 @@
29903822 {
29913823 Object3D child = (Object3D)e.nextElement();
29923824 if(child.editWindow != null)
2993
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3825
+ child.pinned = false;
29943826 child.CloseUI();
29953827 listUI.remove(child);
3828
+// objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
29963829
2997
- child.editWindow = null; // ???????????
3830
+ //child.editWindow = null; // ???????????
29983831 }
29993832 objEditor.ctrlPanel.FlushUI();
30003833 //objEditor.jTree.clearSelection();
....@@ -3007,16 +3840,18 @@
30073840 //copy.ClearUI();
30083841 for (Object3D obj : listUI)
30093842 {
3843
+ obj.pinned = false;
30103844 obj.CloseUI();
30113845 }
30123846 listUI.clear();
3847
+ SetPinStates(group.selection.size() > 0);
30133848 refreshContents(true);
30143849 } else
30153850 if (source == allParamsButton)
30163851 {
30173852 assert(copy == group);
30183853
3019
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3854
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
30203855
30213856 for (Object3D obj : listUI)
30223857 {
....@@ -3065,6 +3900,9 @@
30653900 }
30663901
30673902 copy = group;
3903
+
3904
+ SetUndoStates();
3905
+
30683906 //Globals.theRenderer.object = group;
30693907 if(!useclient)
30703908 {
....@@ -3081,7 +3919,9 @@
30813919 sideView.object = group;
30823920 }
30833921
3084
-// fix "+" issue group.editWindow = this;
3922
+// fix "+" issue
3923
+ //group.editWindow = this;
3924
+ group.manipWindow = this;
30853925
30863926 /*
30873927 currentLayout = radio.layout;
....@@ -3089,13 +3929,38 @@
30893929 currentLayout = sevenButton;
30903930 */
30913931 radio.layout.doClick();
3932
+
3933
+ ClearUnpinned();
3934
+
3935
+ //Grafreed.Assert(group != null);
3936
+ //Grafreed.Assert(group.selection != null);
3937
+ SetPinStates(group.selection == null || group.selection.size() > 0);
3938
+ if (group.selection == null || group.selection.size() == 1)
3939
+ EditSelection(false);
30923940 keepparent = group.parent;
30933941 // PARENT = NULL or not???
30943942 //group.parent = null; // ROOT
30953943 //group.attributes = -1;
30963944 ResetModel();
3945
+
3946
+ cameraView.requestFocusInWindow();
30973947 refreshContents(true);
3098
- }
3948
+ } else if (event.getSource() == editCameraItem)
3949
+ {
3950
+ cameraView.ProtectCamera();
3951
+ cameraView.requestFocusInWindow();
3952
+ cameraView.repaint();
3953
+ return;
3954
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
3955
+ {
3956
+ cameraView.RevertCamera();
3957
+ cameraView.requestFocusInWindow();
3958
+ cameraView.repaint();
3959
+ return;
3960
+ // } else if (event.getSource() == textureButton)
3961
+ // {
3962
+ // return; // true;
3963
+ }
30993964 else
31003965 {
31013966 //return super.action(event, arg);
....@@ -3104,7 +3969,6 @@
31043969 }
31053970
31063971 boolean useclient = false;
3107
- cRadio radio;
31083972
31093973 void ToggleRoot()
31103974 {
....@@ -3343,7 +4207,8 @@
33434207
33444208 int size = obj.MemorySize();
33454209
3346
- System.err.println((size/1024) + " KB is the size of " + obj);
4210
+ //System.err.println((size/1024) + " KB is the size of " + obj);
4211
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
33474212 }
33484213 }
33494214 catch (Exception e)
....@@ -3424,6 +4289,13 @@
34244289 void GenNormals(boolean crease)
34254290 {
34264291 group.GenNormalsS(crease);
4292
+
4293
+ refreshContents();
4294
+ }
4295
+
4296
+ void GenNormalsMESH()
4297
+ {
4298
+ group.GenNormalsMeshS();
34274299
34284300 refreshContents();
34294301 }
....@@ -3659,7 +4531,7 @@
36594531
36604532 try
36614533 {
3662
- texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4534
+ texturedata = Globals.theRenderer.GetTextureData(tex, false, node.texres);
36634535 }
36644536 catch (Exception e)
36654537 {
....@@ -4051,6 +4923,18 @@
40514923 refreshContents();
40524924 }
40534925
4926
+ void RewindLeaves(boolean hide)
4927
+ {
4928
+ group.selection.RewindLeaves(hide);
4929
+ refreshContents();
4930
+ }
4931
+
4932
+ void RandomLeaves(boolean hide)
4933
+ {
4934
+ group.selection.RandomLeaves(hide);
4935
+ refreshContents();
4936
+ }
4937
+
40544938 void SetTexRes(int tr)
40554939 {
40564940 group.selection.SetTexRes(tr);
....@@ -4122,28 +5006,25 @@
41225006 // }
41235007 // }
41245008
4125
- static boolean allparams = true;
4126
-
4127
- static Vector<Object3D> listUI = new Vector<Object3D>();
4128
-
41295009 void EditSelection(boolean newWindow)
41305010 {
5011
+ if (group.selection == null)
5012
+ {
5013
+ EditElement(group, newWindow); // ? new
5014
+ return;
5015
+ }
5016
+
41315017 // aConstraints.gridy = 0;
41325018 for (int i=0; i<group.selection.size(); i++)
41335019 {
41345020 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
41355021 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4136
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
5022
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
41375023
41385024 Object3D elem = (Object3D)group.selection.elementAt(i);
41395025 if(elem != group || !newWindow)
41405026 {
4141
- // if (!(elem instanceof Composite))
4142
- // newWindow = false;
4143
- listUI.add(elem);
4144
- elem.openEditWindow(this, newWindow); //, false);
4145
- System.out.println("edit : " + elem);
4146
- elem.editWindow.refreshContents(true); // ? new
5027
+ EditElement(elem, newWindow); // ? new
41475028 }
41485029 }
41495030 }
....@@ -4206,9 +5087,7 @@
42065087
42075088 freezemodel = false;
42085089 }
4209
-
4210
- boolean flashIt = true;
4211
-
5090
+
42125091 public void valueChanged(TreeSelectionEvent e)
42135092 //public boolean handleEvent(Event event)
42145093 {
....@@ -4218,7 +5097,8 @@
42185097 //new Exception().printStackTrace();
42195098
42205099 freezemodel = true;
4221
-
5100
+ ClearUnpinned();
5101
+
42225102 /**/
42235103 //switch (event.id)
42245104 {
....@@ -4226,7 +5106,6 @@
42265106 //case 702: // Event.LIST_DESELECT
42275107 group.deselectAll();
42285108 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4229
- objEditor.ClearInfo(); // .GetMaterial());
42305109 if (tps != null)
42315110 {
42325111 for (int i=0; i < tps.length; i++)
....@@ -4235,10 +5114,8 @@
42355114
42365115 //if (child.parent != null)
42375116 //child.parent.addSelectee(child);
5117
+ objEditor.SetMaterial(child);
42385118 group.addSelectee(child);
4239
- objEditor.SetMaterial(child); // .GetMaterial());
4240
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4241
- System.err.println("info : " + child.GetPath());
42425119 }
42435120 }
42445121 // else
....@@ -4248,20 +5125,28 @@
42485125 // System.err.println("info : " + group.GetPath());
42495126 // }
42505127
4251
- objEditor.SetText(); // jan 2014
4252
-
4253
- if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
5128
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
42545129 CameraPane.flash = true;
42555130
4256
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
5131
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
42575132 // a camera
42585133 {
4259
- CameraPane.camerachangeframe = 0; // don't refuse it
4260
- Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
5134
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
5135
+ {
5136
+ CameraPane.camerachangeframe = 0; // don't refuse it
5137
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
5138
+ }
42615139 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
42625140 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
42635141 }
42645142
5143
+ if (tps != null && tps.length == 1)
5144
+ {
5145
+ EditSelection(false);
5146
+ }
5147
+
5148
+ SetPinStates(tps != null && tps.length > 0);
5149
+
42655150 refreshContents();
42665151 //return true;
42675152 }
....@@ -4270,6 +5155,37 @@
42705155
42715156 freezemodel = false;
42725157 }
5158
+
5159
+ void SetPinStates(boolean enabled)
5160
+ {
5161
+ editButton.setEnabled(enabled);
5162
+ uneditButton.setEnabled(enabled);
5163
+ unselectButton.setEnabled(enabled);
5164
+ flashSelectionButton.setEnabled(enabled);
5165
+
5166
+ clearPanelButton.setEnabled(!listUI.isEmpty());
5167
+ }
5168
+
5169
+ void refreshContents(boolean cp)
5170
+ {
5171
+ if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
5172
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
5173
+ {
5174
+ objEditor.ClearInfo(); // .GetMaterial());
5175
+
5176
+ for (int i=0; i < group.selection.Size(); i++)
5177
+ {
5178
+ Object3D child = (Object3D) group.selection.get(i);
5179
+
5180
+ objEditor.AddInfo(child, this, true);
5181
+ System.err.println("info : " + child.GetPath());
5182
+ }
5183
+
5184
+ objEditor.SetText(); // jan 2014
5185
+ }
5186
+
5187
+ super.refreshContents(cp);
5188
+ }
42735189
42745190 void linkSomething(Object3D thing)
42755191 {
....@@ -4341,6 +5257,7 @@
43415257 {
43425258 if (group.selection.isEmpty())
43435259 return;
5260
+
43445261 Grafreed.clipboardIsTempGroup = false;
43455262 Composite tGroup = null;
43465263 if (group.selection.size() > 0) // 1)
....@@ -4351,6 +5268,8 @@
43515268
43525269 if (cut)
43535270 {
5271
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
5272
+// Save();
43545273 //int indices[] = jList.getSelectedIndices();
43555274 //for (int i = indices.length - 1; i >= 0; i--)
43565275 //jList.remove(indices[i]);
....@@ -4440,8 +5359,10 @@
44405359 }
44415360
44425361 }
5362
+
44435363 if (Grafreed.clipboardIsTempGroup)
44445364 Grafreed.clipboard = tGroup;
5365
+
44455366 if (cut)
44465367 {
44475368 ResetModel();
....@@ -4451,6 +5372,10 @@
44515372
44525373 void paste(boolean expand)
44535374 {
5375
+ if (Globals.REPLACEONMAKE)
5376
+ Save();
5377
+ boolean keep = Globals.REPLACEONMAKE;
5378
+ Globals.REPLACEONMAKE = false;
44545379 // if (GrafreeD.clipboard == null)
44555380 // return;
44565381 boolean first = true;
....@@ -4510,6 +5435,7 @@
45105435 Grafreed.clipboard.get(0).parent = keepparent;
45115436 }
45125437
5438
+ Globals.REPLACEONMAKE = keep;
45135439 ResetModel();
45145440 refreshContents();
45155441 }
....@@ -4645,6 +5571,10 @@
46455571
46465572 void group(Object3D csg, boolean grab)
46475573 {
5574
+ if (Globals.REPLACEONMAKE)
5575
+ Save();
5576
+ boolean keep = Globals.REPLACEONMAKE;
5577
+ Globals.REPLACEONMAKE = false;
46485578 if (//false) // why??
46495579 !group.selection.isEmpty())
46505580 {
....@@ -4758,10 +5688,15 @@
47585688 //node.add(csg);
47595689 //makeSomething(node);
47605690 makeSomething(csg);
5691
+ Globals.REPLACEONMAKE = keep;
47615692 }
47625693
47635694 void Ungroup(Object3D g)
47645695 {
5696
+ if (Globals.REPLACEONMAKE)
5697
+ Save();
5698
+ boolean keep = Globals.REPLACEONMAKE;
5699
+ Globals.REPLACEONMAKE = false;
47655700 if (g instanceof HiddenObject)
47665701 {
47675702 HiddenObject h = (HiddenObject) g;
....@@ -4778,6 +5713,7 @@
47785713 objEditor.makeSomething(g.get(i), false);
47795714 }
47805715 }
5716
+ Globals.REPLACEONMAKE = keep;
47815717 }
47825718
47835719 void ungroup()
....@@ -4973,21 +5909,6 @@
49735909 }
49745910 */
49755911
4976
- void ImportGFD()
4977
- {
4978
- FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
4979
- browser.show();
4980
- String filename = browser.getFile();
4981
- if (filename != null && filename.length() > 0)
4982
- {
4983
- String fullname = browser.getDirectory() + filename;
4984
-
4985
- //Object3D readobj =
4986
- objEditor.ReadGFD(fullname, objEditor);
4987
- //makeSomething(readobj);
4988
- }
4989
- }
4990
-
49915912 /*
49925913 public void Callback(Object obj)
49935914 {
....@@ -5011,23 +5932,6 @@
50115932 }
50125933 */
50135934
5014
- void ImportVRMLX3D()
5015
- {
5016
- if (Grafreed.standAlone)
5017
- {
5018
- /**/
5019
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
5020
- browser.show();
5021
- String filename = browser.getFile();
5022
- if (filename != null && filename.length() > 0)
5023
- {
5024
- String fullname = browser.getDirectory() + filename;
5025
- LoadVRMLX3D(fullname);
5026
- }
5027
- /**/
5028
- }
5029
- }
5030
-
50315935 String GetFile(String dialogName)
50325936 {
50335937 if (Grafreed.standAlone)
....@@ -5098,7 +6002,44 @@
50986002 cButton clearpanelButton;
50996003 cButton unselectButton;
51006004
6005
+ cButton restoreCameraButton;
6006
+
6007
+ cButton saveButton;
51016008 cButton oneStepButton;
6009
+
6010
+ cButton groupButton;
6011
+ cButton ungroupButton;
6012
+ cButton compositeButton;
6013
+ cButton switchButton;
6014
+ cButton loopButton;
6015
+ cButton textureButton;
6016
+
6017
+ cButton skybox1Button;
6018
+ cButton skybox2Button;
6019
+ cButton skybox3Button;
6020
+ cButton skybox4Button;
6021
+ cButton skybox5Button;
6022
+ cButton skybox6Button;
6023
+ cButton skybox7Button;
6024
+
6025
+ cButton skybox11Button;
6026
+ cButton skybox12Button;
6027
+ cButton skybox13Button;
6028
+ cButton skybox14Button;
6029
+ cButton skybox15Button;
6030
+ cButton skybox16Button;
6031
+ cButton skybox17Button;
6032
+
6033
+ cButton gridButton;
6034
+ cButton boxButton;
6035
+ cButton sphereButton;
6036
+ cButton coneButton;
6037
+ cButton torusButton;
6038
+ cButton superButton;
6039
+ cButton kleinButton;
6040
+ cButton particlesButton;
6041
+ cButton overlayButton;
6042
+ cButton lightButton;
51026043
51036044 cButton screenfitButton;
51046045 cButton screenfitpointButton;
....@@ -5111,14 +6052,6 @@
51116052
51126053 cButton setsupportButton;
51136054
5114
- cButton twoButton;
5115
- cButton sixButton;
5116
- cButton threeButton;
5117
- cButton sevenButton;
5118
- cButton fourButton; // full panel
5119
- cButton oneButton; // full XYZ
5120
- //cButton currentLayout;
5121
-
51226055 //
51236056 //Composite
51246057 Object3D // to do !!
....@@ -5128,9 +6061,11 @@
51286061 //JTree jTree;
51296062 private MenuItem lookAtItem;
51306063 private MenuItem lookFromItem;
5131
- private MenuItem switchItem;
6064
+ private MenuItem switchViewItem;
51326065 private MenuItem cutItem;
5133
- private MenuItem duplicateItem;
6066
+ private MenuItem undoItem;
6067
+ private MenuItem redoItem;
6068
+ private JMenuItem duplicateItem;
51346069 private MenuItem cloneItem;
51356070 private MenuItem cloneSupportItem;
51366071 private MenuItem overwriteGeoItem;
....@@ -5158,7 +6093,7 @@
51586093 private MenuItem pasteLinkItem;
51596094 private MenuItem pasteCloneItem;
51606095 private MenuItem pasteExpandItem;
5161
- private MenuItem clearItem;
6096
+ private MenuItem deleteItem;
51626097 private MenuItem clearAllItem;
51636098 private MenuItem genUVItem;
51646099 private MenuItem genNormalsMESHItem;
....@@ -5193,6 +6128,10 @@
51936128 private MenuItem showleavesItem;
51946129 private MenuItem markleavesItem;
51956130 private MenuItem unmarkleavesItem;
6131
+ private MenuItem rewindleavesItem;
6132
+ private MenuItem unrewindleavesItem;
6133
+ private MenuItem randomleavesItem;
6134
+ private MenuItem unrandomleavesItem;
51966135
51976136 private MenuItem flipVItem;
51986137 private MenuItem unflipVItem;
....@@ -5214,7 +6153,7 @@
52146153 private MenuItem frontItem;
52156154 private MenuItem cameraItem;
52166155 private MenuItem compositeItem;
5217
- private MenuItem randomItem;
6156
+ private MenuItem switchItem;
52186157 private MenuItem physicsItem;
52196158 private MenuItem frameselectorItem;
52206159 private MenuItem scriptNodeItem;
....@@ -5238,6 +6177,8 @@
52386177 private MenuItem attachBumpItem;
52396178 private MenuItem detachBumpItem;
52406179 private MenuItem pigmentBumpItem;
6180
+ private MenuItem embedTexturesItem;
6181
+ private MenuItem deEmbedTexturesItem;
52416182
52426183 private MenuItem particleItem;
52436184 private MenuItem ragdollItem;
....@@ -5276,11 +6217,6 @@
52766217 private MenuItem doubleItem;
52776218 private MenuItem tripleItem;
52786219
5279
- private MenuItem importGFDItem;
5280
- private MenuItem importVRMLX3DItem;
5281
- private MenuItem import3DSItem;
5282
- private MenuItem importOBJItem;
5283
-
52846220 private MenuItem computeAOItem;
52856221 private MenuItem recompileItem;
52866222 private MenuItem editScriptItem;
....@@ -5290,4 +6226,8 @@
52906226 private MenuItem analyzeItem;
52916227 private MenuItem dumpItem;
52926228 //boolean freezemodel = false;
6229
+
6230
+ Menu cameraMenu;
6231
+ MenuItem editCameraItem;
6232
+ MenuItem restoreCameraItem;
52936233 }