Normand Briere
2019-08-06 b3ae4e889872ca0b9ca76f1d17b2f0b961226729
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,83 @@
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(saveVersionButton = GetButton("icons/down_arrow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
935
+ saveVersionButton.setToolTipText("Duplicate current version");
936
+ saveVersionButton.addActionListener(this);
937
+
938
+ copyOptionsPanel.add(deleteVersionButton = GetButton("icons/trash.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
939
+ deleteVersionButton.setToolTipText("Delete current version");
940
+ deleteVersionButton.addActionListener(this);
941
+
942
+ copyOptionsPanel.add(previousVersionButton = GetButton("icons/undo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
943
+ previousVersionButton.setToolTipText("Previous version");
944
+ previousVersionButton.addActionListener(this);
945
+ previousVersionButton.setEnabled(false);
946
+
947
+ cGridBag updown = new cGridBag().setVertical(true);
948
+ updown.add(restoreButton = GetButton("icons/restore.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
949
+ restoreButton.setToolTipText("Undo (restore current version)");
950
+ restoreButton.addActionListener(this);
951
+ //restoreButton.setEnabled(false);
952
+
953
+ updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
954
+ replaceButton.setToolTipText("Save (replace current version)");
955
+ replaceButton.addActionListener(this);
956
+ //replaceButton.setEnabled(false);
957
+
958
+ copyOptionsPanel.add(updown);
959
+
960
+ copyOptionsPanel.add(nextVersionButton = GetButton("icons/redo.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
961
+ nextVersionButton.setToolTipText("Next version");
962
+ nextVersionButton.addActionListener(this);
963
+ nextVersionButton.setEnabled(false);
964
+
965
+ oe.toolbarPanel.add(liveCB = GetToggleButton("icons/run.png", Globals.isLIVE())); //, oe.aConstraints);
496966 liveCB.setToolTipText("Enable animation");
497967 liveCB.addItemListener(this);
498968
499
- oe.toolbarPanel.add(oneStepButton = new cButton("Step", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
969
+ oe.toolbarPanel.add(oneStepButton = GetButton("icons/step.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
500970 oneStepButton.setToolTipText("Animate one step forward");
501971 oneStepButton.addActionListener(this);
502972
503
- oe.toolbarPanel.add(fastCB = new cCheckBox("Fast", CameraPane.FAST)); //, constraints);
973
+ oe.toolbarPanel.add(fastCB = GetToggleButton("icons/runfast.png", CameraPane.FAST)); //, constraints);
504974 fastCB.setToolTipText("Fast mode");
505975 fastCB.addItemListener(this);
506976
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);
977
+ //oe.toolboxPanel.Return();
978
+
979
+// copyOptionsPanel.add(trackCB = GetToggleButton("icons/track.png", CameraPane.TRACK)); //, oe.aConstraints);
980
+// trackCB.setToolTipText("Enable tracking");
981
+// trackCB.addItemListener(this);
514982
515983 // oe.toolbarPanel.add(screenfitpointButton = new cButton(" @+ ")); //, oe.aConstraints);
516984 // screenfitpointButton.addActionListener(this);
....@@ -520,67 +988,156 @@
520988 oe.toolbarPanel.add(snapobjectButton = new cButton("O+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
521989 snapobjectButton.addActionListener(this);
522990 snapobjectButton.setToolTipText("Snap Object");
991
+
992
+ oe.toolbarPanel.add(fourButton = GetButton("icons/controls-horizontal.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
993
+ fourButton.addActionListener(this);
994
+ fourButton.setToolTipText("Show control panel only");
523995 }
524996
525
- oe.toolbarPanel.add(flashSelectionButton = new cButton("?", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
526
- flashSelectionButton.setToolTipText("Show selection");
527
- flashSelectionButton.addActionListener(this);
997
+ //oe.toolbarPanel.add(new JSeparator(SwingConstants.VERTICAL));
528998
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");
999
+ oe.toolbarPanel.add(twoButton = GetButton("icons/cube.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1000
+ twoButton.setToolTipText("Show 3D view only");
5331001 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");
1002
+ this.fullscreenLayout = twoButton;
1003
+
1004
+ oe.toolbarPanel.add(threeButton = GetButton("icons/controlsview.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1005
+ threeButton.setToolTipText("Show controls and 3D view");
5421006 threeButton.addActionListener(this);
543
- oe.toolbarPanel.add(sevenButton = new cButton("+|+|+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
544
- sevenButton.setToolTipText("3-column layout");
545
- sevenButton.addActionListener(this);
1007
+ oe.toolbarPanel.add(sixButton = GetButton("icons/viewcontrols.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1008
+ sixButton.setToolTipText("Show 3D view and controls");
1009
+ sixButton.addActionListener(this);
1010
+// oe.toolbarPanel.add(sevenButton = new cButton("-|-|-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1011
+// sevenButton.setToolTipText("3-column layout");
1012
+// sevenButton.addActionListener(this);
5461013 //
5471014
548
- oe.toolbarPanel.add(rootButton = new cButton("o o o", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
549
- rootButton.setToolTipText("Edit selection in new tab");
1015
+ oe.toolbarPanel.add(rootButton = GetButton("icons/openwindow.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1016
+ rootButton.setToolTipText("Open selection in new tab");
5501017 rootButton.addActionListener(this);
5511018
552
- oe.toolbarPanel.add(closeButton = new cButton("X", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1019
+ oe.toolbarPanel.add(closeButton = GetButton("icons/close-icon.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
5531020 closeButton.setToolTipText("Close tab");
5541021 closeButton.addActionListener(this);
5551022 //oe.treePanel.add(clearButton = new cButton("X"), oe.aConstraints);
5561023 //clearButton.addActionListener(this);
557
-
558
- cGridBag commandsPanel = new cGridBag();
1024
+
1025
+ cGridBag row1 = new cGridBag();
5591026
560
- commandsPanel.add(editButton = new cButton("+", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
561
- editButton.setToolTipText("Edit selection");
1027
+ // INSERT
1028
+ row1.add(gridButton = GetButton("icons/grid.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1029
+ gridButton.setToolTipText("Create grid");
1030
+ gridButton.addActionListener(this);
1031
+
1032
+ row1.add(boxButton = GetButton("icons/box.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1033
+ boxButton.setToolTipText("Create box");
1034
+ boxButton.addActionListener(this);
1035
+
1036
+ row1.add(sphereButton = GetButton("icons/sphere.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1037
+ sphereButton.setToolTipText("Create sphere");
1038
+ sphereButton.addActionListener(this);
1039
+
1040
+ row1.add(coneButton = GetButton("icons/cone.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1041
+ coneButton.setToolTipText("Create cone");
1042
+ coneButton.addActionListener(this);
1043
+
1044
+ row1.add(torusButton = GetButton("icons/torus.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1045
+ torusButton.setToolTipText("Create torus");
1046
+ torusButton.addActionListener(this);
1047
+
1048
+ row1.add(superButton = GetButton("icons/super.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1049
+ superButton.setToolTipText("Create superellipsoid");
1050
+ superButton.addActionListener(this);
1051
+
1052
+ if (Globals.ADVANCED)
1053
+ {
1054
+ oe.toolboxPanel.add(kleinButton = GetButton("icons/klein.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1055
+ kleinButton.setToolTipText("Create Klein bottle");
1056
+ kleinButton.addActionListener(this);
1057
+ }
1058
+
1059
+ row1.add(particlesButton = GetButton("icons/particles.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1060
+ particlesButton.setToolTipText("Create particle system");
1061
+ particlesButton.addActionListener(this);
1062
+
1063
+ oe.toolboxPanel.add(row1);
1064
+
1065
+ cGridBag row2 = new cGridBag();
1066
+
1067
+ row2.add(groupButton = GetButton("icons/group.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1068
+ groupButton.setToolTipText("Create group");
1069
+ groupButton.addActionListener(this);
1070
+
1071
+ row2.add(compositeButton = GetButton("icons/composite.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1072
+ compositeButton.setToolTipText("Create composite");
1073
+ compositeButton.addActionListener(this);
1074
+
1075
+ row2.add(switchButton = GetButton("icons/switch.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1076
+ switchButton.setToolTipText("Create item switcher");
1077
+ switchButton.addActionListener(this);
1078
+
1079
+ row2.add(loopButton = GetButton("icons/loop.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1080
+ loopButton.setToolTipText("Create loop");
1081
+ loopButton.addActionListener(this);
1082
+
1083
+ row2.add(textureButton = GetButton("icons/texture.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1084
+ textureButton.setToolTipText("Create texture");
1085
+ textureButton.addActionListener(this);
1086
+
1087
+ row2.add(overlayButton = GetButton("icons/overlay.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1088
+ overlayButton.setToolTipText("Create overlay");
1089
+ overlayButton.addActionListener(this);
1090
+
1091
+ row2.add(lightButton = GetButton("icons/light-bulb.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1092
+ lightButton.setToolTipText("Create light");
1093
+ lightButton.addActionListener(this);
1094
+
1095
+ oe.toolboxPanel.add(row2);
1096
+
1097
+ // ENVYMAPS
1098
+ cGridBag skyboxpane = new cGridBag();
1099
+ skyboxpane.preferredHeight = 100;
1100
+
1101
+ oe.toolboxPanel.add(skyboxpane);
1102
+
1103
+ JTabbedPane skyboxpanel = new JTabbedPane();
1104
+ skyboxpane.add(skyboxpanel);
1105
+
1106
+ AddSkyboxTab0(skyboxpanel);
1107
+ AddSkyboxTab1(skyboxpanel);
1108
+ AddSkyboxTab2(skyboxpanel);
1109
+ AddSkyboxTab3(skyboxpanel);
1110
+
1111
+ // EDIT panel
1112
+ editCommandsPanel.add(editButton = GetButton("icons/controls.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1113
+ editButton.setToolTipText("Pin selection controls");
5621114 editButton.addActionListener(this);
5631115
564
- commandsPanel.add(uneditButton = new cButton("-", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
565
- uneditButton.setToolTipText("Unedit selection");
1116
+ editCommandsPanel.add(uneditButton = GetButton("icons/remove.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1117
+ uneditButton.setToolTipText("Unpin and remove selection controls");
5661118 uneditButton.addActionListener(this);
5671119
568
- commandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
569
- allParamsButton.setToolTipText("Edit all params");
1120
+ editCommandsPanel.add(allParamsButton = new JCheckBox("All", allparams)); //, oe.aConstraints);
1121
+ allParamsButton.setToolTipText("Show all controle");
5701122 allParamsButton.addActionListener(this);
5711123
572
- commandsPanel.add(clearPanelButton = new cButton("C", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1124
+ editCommandsPanel.add(clearPanelButton = GetButton("icons/clear.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
5731125 clearPanelButton.setToolTipText("Clear edit panel");
5741126 clearPanelButton.addActionListener(this);
5751127
576
- commandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1128
+ editCommandsPanel.add(unselectButton = new cButton("U", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
5771129 unselectButton.setToolTipText("Unselect");
5781130 unselectButton.addActionListener(this);
5791131
580
- commandsPanel.preferredHeight = 1;
1132
+ editCommandsPanel.add(flashSelectionButton = GetButton("icons/flash-light.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
1133
+ flashSelectionButton.setToolTipText("Highlight selection");
1134
+ flashSelectionButton.addActionListener(this);
5811135
582
- oe.treePanel.add(commandsPanel);
583
- oe.treePanel.Return();
1136
+ editCommandsPanel.preferredHeight = 1;
1137
+
1138
+ SetPinStates(false);
1139
+// oe.treePanel.add(commandsPanel);
1140
+// oe.treePanel.Return();
5841141
5851142 // oe.aConstraints.gridx += 1;
5861143 // oe.aConstraints.weighty = 0;
....@@ -597,32 +1154,20 @@
5971154
5981155 JScrollPane jSP;
5991156 //ctrlPanel.add(new JScrollPane(jTree = new cTree(new cTreeModel(this))), aConstraints);
600
- jSPPanel.add(jSP = new JScrollPane(oe.jTree = new cTree(null))); //, oe.aConstraints);
1157
+ jSPPanel.add(jSP = new JScrollPane(oe.jTree)); //, oe.aConstraints);
6011158 ResetModel();
6021159
6031160 oe.treePanel.add(jSPPanel);
6041161 oe.treePanel.Return();
6051162
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;
6211163 oe.treePanel.add(copyOptionsPanel);
6221164 oe.treePanel.Return();
1165
+ cGridBag sliderPane = AddSlider(oe.treePanel, "Version", 0, 0, 0);
1166
+ versionSlider = (cNumberSlider)sliderPane.getComponent(1);
1167
+ sliderPane.preferredHeight = 1;
6231168
624
-// mainPanel.setDividerLocation(0.5); //1.0);
625
-// mainPanel.setResizeWeight(0.5);
1169
+// mainPanel.setDividerLocation(0.1); //1.0);
1170
+ mainPanel.setResizeWeight(0.4);
6261171
6271172 //jList.addListSelectionListener(this);
6281173 oe.jTree.addTreeSelectionListener(this);
....@@ -630,7 +1175,7 @@
6301175 //jTree.setEditable(true);
6311176 oe.jTree.setDragEnabled(true);
6321177 //jTree.setPreferredSize(new Dimension(10,10));
633
- jSP.setPreferredSize(new Dimension(100,200));
1178
+ //jSP.setPreferredSize(new Dimension(100,200));
6341179
6351180 oe.jTree.setCellRenderer(new cTreeModel.Renderer());
6361181
....@@ -642,29 +1187,49 @@
6421187 dgr.addDragGestureListener(this);
6431188 }catch(Exception e) {}
6441189 */
645
- radio.layout = sevenButton;
1190
+ radio.layout = threeButton; // sixButton;
6461191 oe.toolbarPanel.add(radioPanel); //, oe.aConstraints);
6471192 }
6481193
6491194 void AddOptions(cGridBag panel) //, GridBagConstraints constraints)
6501195 {
1196
+ panel.add(colorCB = new cCheckBox("Color", (dropAttributes&Object3D.COLOR)!=0)); //, oe.aConstraints);
1197
+ colorCB.setToolTipText("Copy color when dropped");
1198
+ colorCB.addItemListener(this);
1199
+
1200
+ panel.add(materialCB = new cCheckBox("Material", (dropAttributes&Object3D.MATERIAL)!=0)); //, oe.aConstraints);
1201
+ materialCB.setToolTipText("Copy material when dropped");
1202
+ materialCB.addItemListener(this);
1203
+
1204
+ panel.add(textureCB = new cCheckBox("Texture", (dropAttributes&Object3D.TEXTURE)!=0)); //, oe.aConstraints);
1205
+ textureCB.setToolTipText("Copy texture when dropped");
1206
+ textureCB.addItemListener(this);
1207
+
1208
+ panel.Return();
1209
+
6511210 panel.add(boxCB = new cCheckBox("Box", CameraPane.BOXMODE)); //, constraints);
6521211 boxCB.setToolTipText("Display bounding boxes");
6531212 boxCB.addItemListener(this);
6541213
6551214 panel.add(zoomBoxCB = new cCheckBox("Zoom", CameraPane.ZOOMBOXMODE)); //, constraints);
656
- zoomBoxCB.setToolTipText("Display bounding boxes when moving the wheel");
1215
+ zoomBoxCB.setToolTipText("Display only for wheel");
6571216 zoomBoxCB.addItemListener(this);
6581217
6591218 if (true) // Globals.ADVANCED)
6601219 {
661
- panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
662
- supportCB.setToolTipText("Enable rigging");
663
- supportCB.addItemListener(this);
1220
+// panel.add(supportCB = new cCheckBox("Support", CameraPane.SUPPORT)); //, constraints);
1221
+// supportCB.setToolTipText("Enable rigging");
1222
+// supportCB.addItemListener(this);
1223
+
1224
+ panel.add(freezeCB = new cCheckBox("Freeze", Globals.FREEZEONMOVE)); //, constraints);
1225
+ freezeCB.setToolTipText("Fast moving camera");
1226
+ freezeCB.addItemListener(this);
6641227
6651228 // panel.add(localCB = new cCheckBox("Local", CameraPane.LOCALTRANSFORM), constraints);
6661229 // localCB.addItemListener(this);
6671230
1231
+ panel.Return();
1232
+
6681233 panel.add(crowdCB = new cCheckBox("Crowd", Globals.CROWD)); //, constraints);
6691234 crowdCB.setToolTipText("Used for crowds");
6701235 crowdCB.addItemListener(this);
....@@ -673,14 +1238,19 @@
6731238 smoothCB.setToolTipText("Snapping delay");
6741239 smoothCB.addItemListener(this);
6751240
676
- panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
677
- slowCB.setToolTipText("Smooth interpolation");
678
- slowCB.addItemListener(this);
1241
+// panel.add(slowCB = new cCheckBox("Slow", CameraPane.SLOWPOSE)); //, constraints);
1242
+// slowCB.setToolTipText("Smooth interpolation");
1243
+// slowCB.addItemListener(this);
1244
+ panel.add(minshaderCB = new cCheckBox("Min shader", Globals.MINSHADER)); //, constraints);
1245
+ minshaderCB.setToolTipText("Minimal fast shader");
1246
+ minshaderCB.addItemListener(this);
6791247
6801248 // constraints.gridy += 1;
6811249 // panel.add(speakerMocapCB = new cCheckBox("Mocap", CameraPane.SPEAKERMOCAP), constraints);
6821250 // speakerMocapCB.addItemListener(this);
6831251
1252
+ panel.Return();
1253
+
6841254 if (false)
6851255 {
6861256 // handled in scripts
....@@ -695,42 +1265,85 @@
6951265 //constraints.gridy += 1;
6961266 panel.add(smoothfocusCB = new cCheckBox("Smooth", CameraPane.SMOOTHFOCUS)); //, constraints);
6971267 smoothfocusCB.addItemListener(this);
1268
+ panel.Return();
6981269 }
6991270
7001271 //constraints.gridx += 1;
7011272 //panel.add(debugCB = new cCheckBox("Debug", CameraPane.DEBUG), constraints);
7021273 // debugCB.addItemListener(this);
7031274
1275
+ panel.add(trackCB = new cCheckBox("Track", CameraPane.TRACK)); //, oe.aConstraints);
1276
+ trackCB.setToolTipText("Enable tracking target");
1277
+ trackCB.addItemListener(this);
1278
+
7041279 panel.add(oeilCB = new cCheckBox("Eye", CameraPane.OEIL)); //, constraints);
1280
+ oeilCB.setToolTipText("Move camera when tracking");
7051281 oeilCB.addItemListener(this);
7061282
1283
+ panel.add(shadowCB = new cCheckBox("Shadow", Globals.COMPUTESHADOWWHENLIVE)); //, constraints);
1284
+ shadowCB.setToolTipText("When live compute shadows");
1285
+ shadowCB.addItemListener(this);
1286
+
1287
+ panel.Return();
1288
+ panel.add(toggleTextureCB = new cCheckBox("Textures", CameraPane.textureon)); //, constraints);
1289
+ toggleTextureCB.setToolTipText("Load textures");
1290
+ toggleTextureCB.addItemListener(this);
1291
+
1292
+ panel.add(toggleSwitchCB = new cCheckBox("Switch", CameraPane.SWITCH)); //, constraints);
1293
+ toggleSwitchCB.setToolTipText("Choose a single item");
1294
+ toggleSwitchCB.addItemListener(this);
1295
+
1296
+ panel.add(autokeepCB = new cCheckBox("Auto-replace", Globals.REPLACEONMAKE)); //, constraints);
1297
+ autokeepCB.setToolTipText("On structure change");
1298
+ autokeepCB.addItemListener(this);
1299
+
1300
+ panel.Return();
1301
+ if (Globals.ADVANCED)
1302
+ {
7071303 panel.add(lookAtCB = new cCheckBox("Target", CameraPane.LOOKAT)); //, constraints);
7081304 lookAtCB.setToolTipText("Look-at target");
7091305 lookAtCB.addItemListener(this);
1306
+ }
7101307
7111308 }
7121309
7131310 cGridBag fill = new cGridBag();
714
-
7151311 fill.preferredHeight = 200;
1312
+ cGridBag fill2 = new cGridBag();
1313
+ fill2.preferredHeight = 200;
1314
+ cGridBag fill3 = new cGridBag();
1315
+ fill3.preferredHeight = 200;
7161316
7171317 panel.add(fill);
1318
+ panel.add(fill2);
1319
+ panel.add(fill3);
7181320
7191321 }
7201322
7211323 void EditObject(Object3D obj)
7221324 {
7231325 cRadio radioButton = new cRadio(obj.name);
1326
+
1327
+ // June 2019. Patch to avoid bug with transparency.
1328
+ radioButton.hadMaterial = obj.material != null;
1329
+ if (!radioButton.hadMaterial)
1330
+ {
1331
+ obj.material = new cMaterial();
1332
+ }
1333
+
7241334 radioButton.SetObject(obj);
725
- radioButton.layout = sevenButton;
1335
+ radioButton.layout = threeButton; // sixButton;
7261336 radioButton.SetCamera(cameraView.renderCamera, false);
7271337 radioButton.addActionListener(this);
7281338 radioPanel.add(radioButton);
7291339 buttonGroup.add(radioButton);
7301340 radioButton.doClick();
7311341 }
1342
+
7321343 void SetupViews(ObjEditor oe)
7331344 {
1345
+ theFrame = this;
1346
+
7341347 oe.SetupViews();
7351348
7361349 System.out.println("SetupViews");
....@@ -739,23 +1352,30 @@
7391352 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
7401353 }
7411354
742
- JCheckBox liveCB;
743
- JCheckBox supportCB;
744
- JCheckBox localCB;
745
- JCheckBox crowdCB;
746
- JCheckBox smoothCB;
747
- JCheckBox fastCB;
748
- JCheckBox slowCB;
749
- JCheckBox boxCB;
750
- JCheckBox zoomBoxCB;
751
- JCheckBox trackCB;
752
- JCheckBox smoothfocusCB;
1355
+ cToggleButton liveCB;
1356
+ cCheckBox supportCB;
1357
+ cCheckBox localCB;
1358
+ cCheckBox crowdCB;
1359
+ cCheckBox smoothCB;
1360
+ cCheckBox minshaderCB;
1361
+
1362
+ cToggleButton fastCB;
1363
+ cCheckBox slowCB;
1364
+ cCheckBox boxCB;
1365
+ cCheckBox zoomBoxCB;
1366
+ cCheckBox freezeCB;
1367
+ //cToggleButton trackCB;
1368
+ cCheckBox trackCB;
1369
+ cCheckBox smoothfocusCB;
7531370 // JCheckBox speakerMocapCB;
754
- JCheckBox speakerCameraCB;
755
- JCheckBox speakerFocusCB;
756
- JCheckBox debugCB;
757
- JCheckBox oeilCB;
758
- JCheckBox lookAtCB;
1371
+ cCheckBox speakerCameraCB;
1372
+ cCheckBox speakerFocusCB;
1373
+ cCheckBox debugCB;
1374
+
1375
+ cCheckBox oeilCB;
1376
+ cCheckBox shadowCB;
1377
+ cCheckBox autokeepCB;
1378
+ cCheckBox lookAtCB;
7591379
7601380 // static int COLOR = 1;
7611381 // static int MATERIAL = 2;
....@@ -763,9 +1383,9 @@
7631383
7641384 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
7651385
766
- JCheckBox colorCB;
767
- JCheckBox materialCB;
768
- JCheckBox textureCB;
1386
+ cCheckBox colorCB;
1387
+ cCheckBox materialCB;
1388
+ cCheckBox textureCB;
7691389
7701390 public void itemStateChanged(ItemEvent e)
7711391 {
....@@ -793,6 +1413,7 @@
7931413 } else if(e.getSource() == liveCB)
7941414 {
7951415 cameraView.ToggleLive();
1416
+ refreshContents(false);
7961417 }
7971418 else if(e.getSource() == supportCB)
7981419 {
....@@ -808,6 +1429,12 @@
8081429 {
8091430 cameraView.ToggleInertia();
8101431 cameraView.repaint();
1432
+ }
1433
+ else if(e.getSource() == minshaderCB)
1434
+ {
1435
+ Globals.MINSHADER ^= true;
1436
+ cameraView.programInitialized = false;
1437
+ cameraView.repaint();
8111438 }
8121439 else if(e.getSource() == localCB)
8131440 {
....@@ -857,6 +1484,18 @@
8571484 {
8581485 cameraView.ToggleOeil();
8591486 }
1487
+ else if(e.getSource() == shadowCB)
1488
+ {
1489
+ Globals.COMPUTESHADOWWHENLIVE ^= true;
1490
+ }
1491
+ else if(e.getSource() == freezeCB)
1492
+ {
1493
+ Globals.FREEZEONMOVE ^= true;
1494
+ }
1495
+ else if(e.getSource() == autokeepCB)
1496
+ {
1497
+ Globals.REPLACEONMAKE ^= true;
1498
+ }
8601499 else if(e.getSource() == lookAtCB)
8611500 {
8621501 cameraView.ToggleLookAt();
....@@ -873,7 +1512,8 @@
8731512
8741513 /**/
8751514 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
876
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1515
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1516
+ TreePath path = objEditor.jTree.getSelectionPath();
8771517 if ((path == null) || (path.getPathCount() <= 1)) {
8781518 // We can't move the root node or an empty selection
8791519 return;
....@@ -936,8 +1576,6 @@
9361576 }
9371577 }
9381578
939
- String string = (String) object;
940
-
9411579 System.out.println("Transfer = " + object + "; drop : " + target);
9421580 // if( object instanceof java.io.File[])
9431581 // {
....@@ -945,6 +1583,8 @@
9451583 // objEditor.DropFile((java.io.File[]) object, true);
9461584 // return;
9471585 // }
1586
+
1587
+ String string = object.toString();
9481588
9491589 // File path for Mac and Windows
9501590 if (string.charAt(0) == '/' || string.charAt(1) == ':')
....@@ -990,23 +1630,33 @@
9901630
9911631 assert target == objEditor.jTree;
9921632 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1633
+ Object3D destinationLeaf;
9931634 try {
994
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1635
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
9951636 } catch (Exception e) {
9961637 System.out.println("destinationPath : " + destinationPath);
9971638 return;
9981639 }
9991640
1000
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1641
+ for (int i=group.selection.size(); --i>=0;)
10011642 {
1643
+ Object3D child = (Object3D)group.selection.elementAt(i);
1644
+
1645
+ // Cannot move into itself
1646
+ if (child == destinationLeaf)
1647
+ return;
1648
+ }
1649
+
1650
+// june 2019 if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1651
+// {
10021652 loadClipboard(true);
10031653 objEditor.jTree.setSelectionPath(destinationPath);
10041654 pasteInto(false, false);
1005
- } else {
1006
- loadClipboard(false);
1007
- objEditor.jTree.setSelectionPath(destinationPath);
1008
- pasteInto(false, false); // true); // ???
1009
- }
1655
+// } else {
1656
+// loadClipboard(false);
1657
+// objEditor.jTree.setSelectionPath(destinationPath);
1658
+// pasteInto(false, false); // true); // ???
1659
+// }
10101660 }
10111661 public void dropActionChanged(DropTargetDragEvent dtde)
10121662 // Called if the user has modified the current drop gesture
....@@ -1111,22 +1761,30 @@
11111761 {
11121762 //heightFieldItem = menu.add(new MenuItem("Height Field"));
11131763 //heightFieldItem.addActionListener(this);
1114
- gridItem = menu.add(new MenuItem("Grid"));
1115
- gridItem.addActionListener(this);
1116
- rectoidItem = menu.add(new MenuItem("Box"));
1117
- rectoidItem.addActionListener(this);
1118
- ellipsoidItem = menu.add(new MenuItem("Sphere"));
1119
- ellipsoidItem.addActionListener(this);
1120
- coneItem = menu.add(new MenuItem("Cone"));
1121
- coneItem.addActionListener(this);
1122
- torusItem = menu.add(new MenuItem("Torus"));
1123
- torusItem.addActionListener(this);
1124
- superItem = menu.add(new MenuItem("Superellipsoid"));
1125
- superItem.addActionListener(this);
1764
+// gridItem = menu.add(new MenuItem("Grid"));
1765
+// gridItem.addActionListener(this);
1766
+// rectoidItem = menu.add(new MenuItem("Box"));
1767
+// rectoidItem.addActionListener(this);
1768
+// ellipsoidItem = menu.add(new MenuItem("Sphere"));
1769
+// ellipsoidItem.addActionListener(this);
1770
+// coneItem = menu.add(new MenuItem("Cone"));
1771
+// coneItem.addActionListener(this);
1772
+// torusItem = menu.add(new MenuItem("Torus"));
1773
+// torusItem.addActionListener(this);
1774
+// superItem = menu.add(new MenuItem("Superellipsoid"));
1775
+// superItem.addActionListener(this);
1776
+
1777
+ cameraItem = menu.add(new MenuItem("Camera"));
1778
+ cameraItem.addActionListener(this);
1779
+
1780
+ if (!Globals.ADVANCED)
1781
+ {
11261782 kleinItem = menu.add(new MenuItem("Klein Bottle"));
11271783 kleinItem.addActionListener(this);
1128
- particleItem = menu.add(new MenuItem("Particle system"));
1129
- particleItem.addActionListener(this);
1784
+ }
1785
+
1786
+// particleItem = menu.add(new MenuItem("Particle system"));
1787
+// particleItem.addActionListener(this);
11301788 if (Globals.ADVANCED)
11311789 {
11321790 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1152,15 +1810,15 @@
11521810 }
11531811 bezierItem = menu.add(new MenuItem("Bezier Patch"));
11541812 bezierItem.addActionListener(this);
1155
- overlayItem = menu.add(new MenuItem("Overlay"));
1156
- overlayItem.addActionListener(this);
1157
- lightItem = menu.add(new MenuItem("Light"));
1158
- lightItem.addActionListener(this);
1813
+// overlayItem = menu.add(new MenuItem("Overlay"));
1814
+// overlayItem.addActionListener(this);
1815
+// lightItem = menu.add(new MenuItem("Light"));
1816
+// lightItem.addActionListener(this);
11591817 menu.add("-");
11601818 //superLoopItem = menu.add(new MenuItem("Super Loop"));
11611819 //superLoopItem.addActionListener(this);
1162
- loopItem = menu.add(new MenuItem("Loop"));
1163
- loopItem.addActionListener(this);
1820
+// loopItem = menu.add(new MenuItem("Loop"));
1821
+// loopItem.addActionListener(this);
11641822 doubleItem = menu.add(new MenuItem("Fork"));
11651823 doubleItem.addActionListener(this);
11661824 if (Globals.ADVANCED)
....@@ -1176,6 +1834,9 @@
11761834 animationItem.addItemListener(this);
11771835 animationItem.setState(Globals.ANIMATION);
11781836
1837
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1838
+ archiveItem.addActionListener(this);
1839
+
11791840 menu.add("-");
11801841 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
11811842 parseverticesItem.addActionListener(this);
....@@ -1188,6 +1849,8 @@
11881849 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
11891850 reduce34MorphItem.addActionListener(this);
11901851 menu.add("-");
1852
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1853
+ memoryItem.addActionListener(this);
11911854 menu.add(computeAOItem = new MenuItem("Compute AO"));
11921855 computeAOItem.addActionListener(this);
11931856
....@@ -1196,11 +1859,9 @@
11961859 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
11971860 mirrorItem.addActionListener(this);
11981861 menu.add("-");
1199
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1200
- memoryItem.addActionListener(this);
12011862 menu.add(analyzeItem = new MenuItem("Analyze"));
12021863 analyzeItem.addActionListener(this);
1203
- menu.add(dumpItem = new MenuItem("Dump"));
1864
+ menu.add(dumpItem = new MenuItem("Print"));
12041865 dumpItem.addActionListener(this);
12051866 // menu.add(pathItem = new MenuItem("From-to path"));
12061867 // pathItem.addActionListener(this);
....@@ -1341,9 +2002,34 @@
13412002 shadow.material = new cMaterial(obj.material);
13422003 shadow.material.diffuse = 0.0001f;
13432004 shadow.material.specular = 0.0001f;
2005
+ //shadow.projectedVertices[1].x = 300;
13442006
13452007 makeSomething(shadow);
13462008 }
2009
+
2010
+ private void ClearUnpinned()
2011
+ {
2012
+ //for (Object3D obj : listUI)
2013
+ for (int i=listUI.size(); --i>=0;)
2014
+ {
2015
+ Object3D obj = listUI.elementAt(i);
2016
+ if (!obj.pinned)
2017
+ {
2018
+ obj.CloseUI();
2019
+ listUI.remove(i);
2020
+ }
2021
+ }
2022
+ }
2023
+
2024
+ private void EditElement(Object3D elem, boolean newWindow)
2025
+ {
2026
+ // if (!(elem instanceof Composite))
2027
+ // newWindow = false;
2028
+ listUI.add(elem);
2029
+ elem.openEditWindow(this, newWindow); //, false);
2030
+ System.out.println("edit : " + elem);
2031
+ elem.editWindow.refreshContents(true); // ? new
2032
+ }
13472033
13482034 /**
13492035 * applyExample
....@@ -1588,7 +2274,7 @@
15882274 {
15892275 ScreenFit();
15902276 } else
1591
- if (source == switchItem)
2277
+ if (source == switchViewItem)
15922278 {
15932279 cVector v1 = new cVector();
15942280 cVector v2 = new cVector();
....@@ -1597,11 +2283,11 @@
15972283 objEditor.cameraView.renderCamera.setAim(v2, v1);
15982284 objEditor.cameraView.repaint();
15992285 } else
1600
- if (source == rectoidItem)
2286
+ if (source == rectoidItem || source == boxButton)
16012287 {
16022288 makeSomething(new Box());
16032289 } else
1604
- if (source == particleItem)
2290
+ if (source == particleItem || source == particlesButton)
16052291 {
16062292 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
16072293 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1680,27 +2366,27 @@
16802366
16812367 makeSomething(obj);
16822368 } else
1683
- if (source == gridItem)
2369
+ if (source == gridItem || source == gridButton)
16842370 {
16852371 makeSomething(new Grid());
16862372 } else
1687
- if (source == ellipsoidItem)
2373
+ if (source == ellipsoidItem || source == sphereButton)
16882374 {
16892375 makeSomething(new Sphere());
16902376 } else
1691
- if (source == coneItem)
2377
+ if (source == coneItem || source == coneButton)
16922378 {
16932379 makeSomething(new Cone());
16942380 } else
1695
- if (source == torusItem)
2381
+ if (source == torusItem || source == torusButton)
16962382 {
16972383 makeSomething(new Torus());
16982384 } else
1699
- if (source == superItem)
2385
+ if (source == superItem || source == superButton)
17002386 {
17012387 makeSomething(new Superellipsoid());
17022388 } else
1703
- if (source == kleinItem)
2389
+ if (source == kleinItem || source == kleinButton)
17042390 {
17052391 makeSomething(new Klein());
17062392 } else
....@@ -1720,7 +2406,7 @@
17202406 {
17212407 makeSomething(new BezierSurface());
17222408 } else
1723
- if (source == overlayItem)
2409
+ if (source == overlayItem || source == overlayButton)
17242410 {
17252411 /*
17262412 Object3D obj = new BezierSurface(5,8);
....@@ -1768,10 +2454,27 @@
17682454 s.setup();
17692455 makeSomething(s);
17702456 } else
1771
- if (source == lightItem)
2457
+ if (source == lightItem || source == lightButton)
17722458 {
17732459 makeSomething(new Light());
17742460 } else
2461
+// if (source == skybox1Button ||
2462
+// source == skybox2Button ||
2463
+// source == skybox3Button ||
2464
+// source == skybox4Button ||
2465
+// source == skybox5Button ||
2466
+// source == skybox6Button ||
2467
+// source == skybox7Button ||
2468
+// source == skybox11Button ||
2469
+// source == skybox12Button ||
2470
+// source == skybox13Button ||
2471
+// source == skybox14Button ||
2472
+// source == skybox15Button ||
2473
+// source == skybox16Button ||
2474
+// source == skybox17Button)
2475
+// {
2476
+// ChangeSkybox(source);
2477
+// } else
17752478 if (source == csgItem)
17762479 {
17772480 group(new CSG());
....@@ -1818,30 +2521,30 @@
18182521
18192522 group(g);
18202523 } else
1821
- if (source == loopItem)
2524
+ if (source == loopItem || source == loopButton)
18222525 {
18232526 Composite csg = new GroupLeaf();
18242527 csg.count = 5;
18252528 group(csg);
1826
- Composite child = new cGroup();
2529
+ Composite child = new cGroup("Branch");
18272530 csg.addChild(child);
18282531 child.addChild(csg);
18292532 } else
18302533 if (source == doubleItem)
18312534 {
1832
- Composite csg = new GroupLeaf();
2535
+ Composite csg = new GroupLeaf("Fork");
18332536 csg.count = 5;
18342537 group(csg);
1835
- Composite child = new cGroup();
2538
+ Composite child = new cGroup("Branch A");
18362539 csg.addChild(child);
18372540 child.addChild(csg);
1838
- child = new cGroup();
2541
+ child = new cGroup("Branch B");
18392542 csg.addChild(child);
18402543 child.addChild(csg);
18412544 } else
18422545 if (source == tripleItem)
18432546 {
1844
- Composite csg = new GroupLeaf();
2547
+ Composite csg = new GroupLeaf("Trident");
18452548 csg.count = 4;
18462549 group(csg);
18472550 Composite child = new cGroup();
....@@ -1854,35 +2557,10 @@
18542557 csg.addChild(child);
18552558 child.addChild(csg);
18562559 } else
1857
-
1858
- if (source == importGFDItem)
1859
- {
1860
- ImportGFD();
1861
- } else
1862
- if (source == importVRMLX3DItem)
1863
- {
1864
- ImportVRMLX3D();
1865
- } else
1866
- if (source == import3DSItem)
1867
- {
1868
- objEditor.ImportJME(new com.jmex.model.converters.MaxToJme(), "3ds", "Import 3DS");
1869
- } else
1870
- if (source == importOBJItem)
1871
- {
1872
- //objEditor.ImportJME(new com.jmex.model.converters.ObjToJme(), "obj", "Import OBJ");
1873
- FileDialog browser = new FileDialog(frame, "Import OBJ", FileDialog.LOAD);
1874
- browser.setVisible(true);
1875
- String filename = browser.getFile();
1876
- if (filename != null && filename.length() > 0)
1877
- {
1878
- String fullname = browser.getDirectory() + filename;
1879
- makeSomething(ReadOBJ(fullname), true);
1880
- }
1881
- } else
18822560 if (source == computeAOItem)
18832561 {
18842562 Globals.drawMode = CameraPane.OCCLUSION;
1885
- Globals.theRenderer.repaint();
2563
+ cameraView.repaint();
18862564 } else
18872565 if (source == recompileItem)
18882566 {
....@@ -1897,7 +2575,7 @@
18972575 if (source == invariantsItem)
18982576 {
18992577 System.out.println("Invariants:");
1900
- Grafreed.grafreeD.universe.invariants();
2578
+ Grafreed.grafreed.universe.invariants();
19012579 } else
19022580 if (source == memoryItem)
19032581 {
....@@ -1916,6 +2594,53 @@
19162594 {
19172595 DumpObject();
19182596 } else
2597
+ if (source == minButton)
2598
+ {
2599
+ Minimize();
2600
+ } else
2601
+ if (source == maxButton)
2602
+ {
2603
+ Maximize();
2604
+ } else
2605
+ if (source == fullButton)
2606
+ {
2607
+ ToggleFullScreen();
2608
+ } else
2609
+ if (source == previousVersionButton)
2610
+ {
2611
+ // Go to previous version
2612
+ //if (!Undo())
2613
+ //java.awt.Toolkit.getDefaultToolkit().beep();
2614
+ PreviousVersion();
2615
+ } else
2616
+ if (source == restoreButton)
2617
+ {
2618
+ // Restore current version
2619
+ Restore();
2620
+ //restoreButton.setEnabled(false);
2621
+ } else
2622
+ if (source == replaceButton)
2623
+ {
2624
+ // Overwrite current version
2625
+ Replace();
2626
+ //replaceButton.setEnabled(false);
2627
+ } else
2628
+ if (source == nextVersionButton)
2629
+ {
2630
+ // Go to next version
2631
+ NextVersion();
2632
+ } else
2633
+ if (source == saveVersionButton)
2634
+ {
2635
+ // Save a new version
2636
+ if (!Save(true))
2637
+ java.awt.Toolkit.getDefaultToolkit().beep();
2638
+ } else
2639
+ if (source == deleteVersionButton)
2640
+ {
2641
+ // Delete a new version
2642
+ DeleteVersion();
2643
+ } else
19192644 if (source == oneStepButton)
19202645 {
19212646 Globals.ONESTEP = true;
....@@ -1923,17 +2648,14 @@
19232648 } else
19242649 if (source == screenfitButton)
19252650 {
1926
- //Reload(lastConverter, lastFilename, true);
19272651 ScreenFit();
19282652 } else
19292653 if (source == screenfitpointButton)
19302654 {
1931
- //Reload(lastConverter, lastFilename, true);
19322655 ScreenFitPoint();
19332656 } else
19342657 if (source == snapobjectButton)
19352658 {
1936
- //Reload(lastConverter, lastFilename, true);
19372659 SnapObject();
19382660 } else
19392661 // if (event.getSource() == recompileButton)
....@@ -1969,6 +2691,14 @@
19692691 if (source == cutItem || source == clearButton)
19702692 {
19712693 loadClipboard(true);
2694
+ } else
2695
+ if (source == undoItem)
2696
+ {
2697
+ PreviousVersion();
2698
+ } else
2699
+ if (source == redoItem)
2700
+ {
2701
+ NextVersion();
19722702 } else
19732703 if (source == duplicateItem)
19742704 {
....@@ -2289,7 +3019,7 @@
22893019 {
22903020 StepAll();
22913021 } else
2292
- if (source == clearItem) // || event.getSource() == clearButton)
3022
+ if (source == deleteItem) // || event.getSource() == clearButton)
22933023 {
22943024 //int indices[] = jList.getSelectedIndices();
22953025 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2301,9 +3031,9 @@
23013031 {
23023032 ClearSelection(true);
23033033 } else
2304
- if (source == grabItem)
3034
+ if (source == grabItem || source == groupButton)
23053035 {
2306
- group(new cGroup(), true);
3036
+ group(new cGroup(), false); // true);
23073037 } else
23083038 if (source == hideItem)
23093039 {
....@@ -2321,11 +3051,11 @@
23213051 {
23223052 makeSomething(new Camera());
23233053 } else
2324
- if (source == compositeItem)
3054
+ if (source == compositeItem || source == compositeButton)
23253055 {
23263056 group(new Composite());
23273057 } else
2328
- if (source == randomItem)
3058
+ if (source == switchItem || source == switchButton)
23293059 {
23303060 RandomNode random = new RandomNode();
23313061 group(random);
....@@ -2427,7 +3157,7 @@
24273157 {
24283158 group(new cLinker());
24293159 } else
2430
- if (source == textureItem)
3160
+ if (source == textureItem || source == textureButton)
24313161 {
24323162 group(new TextureNode());
24333163 } else
....@@ -2447,17 +3177,30 @@
24473177 {
24483178 CastShadow(2);
24493179 } else
2450
- if (source == ungroupItem)
3180
+ if (source == ungroupItem || source == ungroupButton)
24513181 {
2452
- //ungroup();
3182
+ boolean hasRoot = false;
3183
+
24533184 for (int i=0; i<group.selection.size(); i++)
24543185 {
2455
- Ungroup(group.selection.get(i));
3186
+ if (group.selection.get(i) == group)
3187
+ {
3188
+ hasRoot = true;
3189
+ break;
3190
+ }
24563191 }
24573192
2458
- ClearSelection(false);
2459
-
2460
- refreshContents();
3193
+ if (!hasRoot)
3194
+ {
3195
+ for (int i=0; i<group.selection.size(); i++)
3196
+ {
3197
+ Ungroup(group.selection.get(i));
3198
+ }
3199
+
3200
+ ClearSelection(false);
3201
+
3202
+ refreshContents();
3203
+ }
24613204 } else
24623205 if (source == genUVItem)
24633206 {
....@@ -2469,7 +3212,7 @@
24693212 } else
24703213 if (source == genNormalsMESHItem)
24713214 {
2472
- GenNormals(true); // TODO
3215
+ GenNormalsMESH();
24733216 } else
24743217 if (source == genNormalsORGANItem)
24753218 {
....@@ -2534,6 +3277,22 @@
25343277 if (source == unmarkleavesItem)
25353278 {
25363279 MarkLeaves(false);
3280
+ } else
3281
+ if (source == rewindleavesItem)
3282
+ {
3283
+ RewindLeaves(true);
3284
+ } else
3285
+ if (source == unrewindleavesItem)
3286
+ {
3287
+ RewindLeaves(false);
3288
+ } else
3289
+ if (source == randomleavesItem)
3290
+ {
3291
+ RandomLeaves(true);
3292
+ } else
3293
+ if (source == unrandomleavesItem)
3294
+ {
3295
+ RandomLeaves(false);
25373296 } else
25383297 if (source == flipVItem)
25393298 {
....@@ -2742,7 +3501,7 @@
27423501 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
27433502 {
27443503 obj = (Object3D)e.nextElement();
2745
- obj.SetBumpTexture(null);
3504
+ obj.ResetBumpTexture();
27463505 }
27473506
27483507 refreshContents();
....@@ -2758,6 +3517,31 @@
27583517
27593518 refreshContents();
27603519 } else
3520
+ if (source == embedTexturesItem)
3521
+ {
3522
+ Object3D obj;
3523
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3524
+ {
3525
+ obj = (Object3D)e.nextElement();
3526
+ obj.EmbedTextures(true);
3527
+ }
3528
+
3529
+ refreshContents();
3530
+ } else
3531
+ if (source == deEmbedTexturesItem)
3532
+ {
3533
+ Object3D obj;
3534
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3535
+ {
3536
+ obj = (Object3D)e.nextElement();
3537
+ obj.EmbedTextures(false);
3538
+ }
3539
+
3540
+ CameraPane.texturepigment.clear();
3541
+ CameraPane.texturebump.clear();
3542
+
3543
+ refreshContents();
3544
+ } else
27613545 if (source == flashSelectionButton)
27623546 {
27633547 CameraPane.flash = true;
....@@ -2769,6 +3553,10 @@
27693553 if (source == twoButton)
27703554 {
27713555 radio.layout = twoButton;
3556
+
3557
+ if (CameraPane.FULLSCREEN)
3558
+ fullscreenLayout = radio.layout;
3559
+
27723560 // bug
27733561 //gridPanel.setDividerLocation(1.0);
27743562 //bigPanel.setDividerLocation(0.0);
....@@ -2801,10 +3589,31 @@
28013589 bigThree.ClearUI();
28023590 bigThree.add(centralPanel);
28033591 bigThree.FlushUI();
3592
+
3593
+ cameraView.requestFocusInWindow();
3594
+
3595
+// refreshContents(true);
3596
+//
3597
+// try
3598
+// {
3599
+// java.awt.Robot bot = new java.awt.Robot();
3600
+// int mask = InputEvent.BUTTON1_MASK;
3601
+// bot.mouseMove(100, 100);
3602
+// bot.mousePress(mask);
3603
+// bot.mouseRelease(mask);
3604
+// }
3605
+// catch (Exception e)
3606
+// {
3607
+//
3608
+// }
3609
+
28043610 } else
28053611 if (source == threeButton)
28063612 {
28073613 radio.layout = threeButton;
3614
+
3615
+ if (CameraPane.FULLSCREEN)
3616
+ fullscreenLayout = radio.layout;
28083617
28093618 // bigThree.remove(scenePanel);
28103619 // bigThree.remove(centralPanel);
....@@ -2834,13 +3643,18 @@
28343643 // centralPanel.setVisible(true);
28353644 // XYZPanel.setVisible(true);
28363645 bigThree.ClearUI();
3646
+ bigThree.add(scenePanel);
28373647 bigThree.add(centralPanel);
2838
- bigThree.add(XYZPanel);
28393648 bigThree.FlushUI();
3649
+
3650
+ cameraView.requestFocusInWindow();
28403651 } else
28413652 if (source == fourButton)
28423653 {
28433654 radio.layout = fourButton;
3655
+
3656
+ if (CameraPane.FULLSCREEN)
3657
+ fullscreenLayout = radio.layout;
28443658
28453659 // bigThree.remove(scenePanel);
28463660 // bigThree.remove(centralPanel);
....@@ -2872,10 +3686,15 @@
28723686 bigThree.ClearUI();
28733687 bigThree.add(scenePanel);
28743688 bigThree.FlushUI();
3689
+
3690
+ cameraView.requestFocusInWindow();
28753691 } else
28763692 if (source == sixButton)
28773693 {
28783694 radio.layout = sixButton;
3695
+
3696
+ if (CameraPane.FULLSCREEN)
3697
+ fullscreenLayout = radio.layout;
28793698
28803699 // bigThree.remove(scenePanel);
28813700 // bigThree.remove(centralPanel);
....@@ -2905,13 +3724,18 @@
29053724 // centralPanel.setVisible(true);
29063725 // XYZPanel.setVisible(false);
29073726 bigThree.ClearUI();
2908
- bigThree.add(scenePanel);
29093727 bigThree.add(centralPanel);
3728
+ bigThree.add(scenePanel);
29103729 bigThree.FlushUI();
3730
+
3731
+ cameraView.requestFocusInWindow();
29113732 } else
29123733 if (source == sevenButton)
29133734 {
29143735 radio.layout = sevenButton;
3736
+
3737
+ if (CameraPane.FULLSCREEN)
3738
+ fullscreenLayout = radio.layout;
29153739
29163740 // bigThree.remove(scenePanel);
29173741 // bigThree.remove(centralPanel);
....@@ -2945,6 +3769,8 @@
29453769 bigThree.add(centralPanel);
29463770 bigThree.add(XYZPanel);
29473771 bigThree.FlushUI();
3772
+
3773
+ cameraView.requestFocusInWindow();
29483774 } else
29493775 if (source == rootButton)
29503776 {
....@@ -2956,6 +3782,7 @@
29563782 EditObject(obj);
29573783 }
29583784
3785
+ cameraView.requestFocusInWindow();
29593786 refreshContents(true);
29603787 } else
29613788 if (source == closeButton)
....@@ -2965,22 +3792,37 @@
29653792 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
29663793 {
29673794 ab = (cRadio)e.nextElement();
2968
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3795
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
29693796 {
3797
+ // Patch to avoid bug with transparency.
3798
+ if (!ab.hadMaterial)
3799
+ {
3800
+ ab.object.material = null;
3801
+ }
3802
+
29703803 buttonGroup.remove(ab);
29713804 radioPanel.remove(ab);
29723805
2973
- ab.GetObject().editWindow = null;
3806
+ //ab.GetObject().editWindow = null;
3807
+ ab.GetObject().manipWindow = null;
29743808 // ab.GetObject().objectUI = null; // ?????????
29753809
29763810 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
29773811 break;
29783812 }
29793813 }
3814
+
3815
+ cameraView.requestFocusInWindow();
29803816 refreshContents(true);
29813817 } else
29823818 if (source == editItem || source == editButton)
29833819 {
3820
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3821
+ {
3822
+ Object3D child = (Object3D)e.nextElement();
3823
+ child.pinned = true;
3824
+ }
3825
+
29843826 EditSelection(false);
29853827 } else
29863828 if (source == uneditButton)
....@@ -2989,11 +3831,12 @@
29893831 {
29903832 Object3D child = (Object3D)e.nextElement();
29913833 if(child.editWindow != null)
2992
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3834
+ child.pinned = false;
29933835 child.CloseUI();
29943836 listUI.remove(child);
3837
+// objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
29953838
2996
- child.editWindow = null; // ???????????
3839
+ //child.editWindow = null; // ???????????
29973840 }
29983841 objEditor.ctrlPanel.FlushUI();
29993842 //objEditor.jTree.clearSelection();
....@@ -3006,16 +3849,18 @@
30063849 //copy.ClearUI();
30073850 for (Object3D obj : listUI)
30083851 {
3852
+ obj.pinned = false;
30093853 obj.CloseUI();
30103854 }
30113855 listUI.clear();
3856
+ SetPinStates(group.selection.size() > 0);
30123857 refreshContents(true);
30133858 } else
30143859 if (source == allParamsButton)
30153860 {
30163861 assert(copy == group);
30173862
3018
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3863
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
30193864
30203865 for (Object3D obj : listUI)
30213866 {
....@@ -3064,6 +3909,9 @@
30643909 }
30653910
30663911 copy = group;
3912
+
3913
+ SetUndoStates();
3914
+
30673915 //Globals.theRenderer.object = group;
30683916 if(!useclient)
30693917 {
....@@ -3079,20 +3927,49 @@
30793927 frontView.object = group;
30803928 sideView.object = group;
30813929 }
3082
- group.editWindow = this;
3930
+
3931
+// fix "+" issue
3932
+ //group.editWindow = this;
3933
+ group.manipWindow = this;
3934
+
30833935 /*
30843936 currentLayout = radio.layout;
30853937 if (currentLayout == null)
30863938 currentLayout = sevenButton;
30873939 */
30883940 radio.layout.doClick();
3941
+
3942
+ ClearUnpinned();
3943
+
3944
+ //Grafreed.Assert(group != null);
3945
+ //Grafreed.Assert(group.selection != null);
3946
+ SetPinStates(group.selection == null || group.selection.size() > 0);
3947
+ if (group.selection == null || group.selection.size() == 1)
3948
+ EditSelection(false);
30893949 keepparent = group.parent;
30903950 // PARENT = NULL or not???
30913951 //group.parent = null; // ROOT
30923952 //group.attributes = -1;
30933953 ResetModel();
3954
+
3955
+ cameraView.requestFocusInWindow();
30943956 refreshContents(true);
3095
- }
3957
+ } else if (event.getSource() == editCameraItem)
3958
+ {
3959
+ cameraView.ProtectCamera();
3960
+ cameraView.requestFocusInWindow();
3961
+ cameraView.repaint();
3962
+ return;
3963
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
3964
+ {
3965
+ cameraView.RevertCamera();
3966
+ cameraView.requestFocusInWindow();
3967
+ cameraView.repaint();
3968
+ return;
3969
+ // } else if (event.getSource() == textureButton)
3970
+ // {
3971
+ // return; // true;
3972
+ }
30963973 else
30973974 {
30983975 //return super.action(event, arg);
....@@ -3101,7 +3978,6 @@
31013978 }
31023979
31033980 boolean useclient = false;
3104
- cRadio radio;
31053981
31063982 void ToggleRoot()
31073983 {
....@@ -3340,7 +4216,8 @@
33404216
33414217 int size = obj.MemorySize();
33424218
3343
- System.err.println((size/1024) + " KB is the size of " + obj);
4219
+ //System.err.println((size/1024) + " KB is the size of " + obj);
4220
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
33444221 }
33454222 }
33464223 catch (Exception e)
....@@ -3421,6 +4298,13 @@
34214298 void GenNormals(boolean crease)
34224299 {
34234300 group.GenNormalsS(crease);
4301
+
4302
+ refreshContents();
4303
+ }
4304
+
4305
+ void GenNormalsMESH()
4306
+ {
4307
+ group.GenNormalsMeshS();
34244308
34254309 refreshContents();
34264310 }
....@@ -3656,7 +4540,7 @@
36564540
36574541 try
36584542 {
3659
- texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4543
+ texturedata = Globals.theRenderer.GetTextureData(tex, false, node.texres);
36604544 }
36614545 catch (Exception e)
36624546 {
....@@ -4048,6 +4932,18 @@
40484932 refreshContents();
40494933 }
40504934
4935
+ void RewindLeaves(boolean hide)
4936
+ {
4937
+ group.selection.RewindLeaves(hide);
4938
+ refreshContents();
4939
+ }
4940
+
4941
+ void RandomLeaves(boolean hide)
4942
+ {
4943
+ group.selection.RandomLeaves(hide);
4944
+ refreshContents();
4945
+ }
4946
+
40514947 void SetTexRes(int tr)
40524948 {
40534949 group.selection.SetTexRes(tr);
....@@ -4119,28 +5015,25 @@
41195015 // }
41205016 // }
41215017
4122
- static boolean allparams = true;
4123
-
4124
- static Vector<Object3D> listUI = new Vector<Object3D>();
4125
-
41265018 void EditSelection(boolean newWindow)
41275019 {
5020
+ if (group.selection == null)
5021
+ {
5022
+ EditElement(group, newWindow); // ? new
5023
+ return;
5024
+ }
5025
+
41285026 // aConstraints.gridy = 0;
41295027 for (int i=0; i<group.selection.size(); i++)
41305028 {
41315029 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
41325030 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4133
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
5031
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
41345032
41355033 Object3D elem = (Object3D)group.selection.elementAt(i);
4136
- if(elem != group)
5034
+ if(elem != group || !newWindow)
41375035 {
4138
- // if (!(elem instanceof Composite))
4139
- // newWindow = false;
4140
- listUI.add(elem);
4141
- elem.openEditWindow(this, newWindow); //, false);
4142
- System.out.println("edit : " + elem);
4143
- elem.editWindow.refreshContents(true); // ? new
5036
+ EditElement(elem, newWindow); // ? new
41445037 }
41455038 }
41465039 }
....@@ -4203,9 +5096,7 @@
42035096
42045097 freezemodel = false;
42055098 }
4206
-
4207
- boolean flashIt = true;
4208
-
5099
+
42095100 public void valueChanged(TreeSelectionEvent e)
42105101 //public boolean handleEvent(Event event)
42115102 {
....@@ -4215,7 +5106,8 @@
42155106 //new Exception().printStackTrace();
42165107
42175108 freezemodel = true;
4218
-
5109
+ ClearUnpinned();
5110
+
42195111 /**/
42205112 //switch (event.id)
42215113 {
....@@ -4223,7 +5115,6 @@
42235115 //case 702: // Event.LIST_DESELECT
42245116 group.deselectAll();
42255117 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4226
- objEditor.ClearInfo(); // .GetMaterial());
42275118 if (tps != null)
42285119 {
42295120 for (int i=0; i < tps.length; i++)
....@@ -4232,10 +5123,8 @@
42325123
42335124 //if (child.parent != null)
42345125 //child.parent.addSelectee(child);
5126
+ objEditor.SetMaterial(child);
42355127 group.addSelectee(child);
4236
- objEditor.SetMaterial(child); // .GetMaterial());
4237
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4238
- System.err.println("info : " + child.GetPath());
42395128 }
42405129 }
42415130 // else
....@@ -4245,20 +5134,28 @@
42455134 // System.err.println("info : " + group.GetPath());
42465135 // }
42475136
4248
- objEditor.SetText(); // jan 2014
4249
-
4250
- if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
5137
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
42515138 CameraPane.flash = true;
42525139
4253
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
5140
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
42545141 // a camera
42555142 {
4256
- CameraPane.camerachangeframe = 0; // don't refuse it
4257
- Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
5143
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
5144
+ {
5145
+ CameraPane.camerachangeframe = 0; // don't refuse it
5146
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
5147
+ }
42585148 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
42595149 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
42605150 }
42615151
5152
+ if (tps != null && tps.length == 1)
5153
+ {
5154
+ EditSelection(false);
5155
+ }
5156
+
5157
+ SetPinStates(tps != null && tps.length > 0);
5158
+
42625159 refreshContents();
42635160 //return true;
42645161 }
....@@ -4267,6 +5164,37 @@
42675164
42685165 freezemodel = false;
42695166 }
5167
+
5168
+ void SetPinStates(boolean enabled)
5169
+ {
5170
+ editButton.setEnabled(enabled);
5171
+ uneditButton.setEnabled(enabled);
5172
+ unselectButton.setEnabled(enabled);
5173
+ flashSelectionButton.setEnabled(enabled);
5174
+
5175
+ clearPanelButton.setEnabled(!listUI.isEmpty());
5176
+ }
5177
+
5178
+ void refreshContents(boolean cp)
5179
+ {
5180
+ if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
5181
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
5182
+ {
5183
+ objEditor.ClearInfo(); // .GetMaterial());
5184
+
5185
+ for (int i=0; i < group.selection.Size(); i++)
5186
+ {
5187
+ Object3D child = (Object3D) group.selection.get(i);
5188
+
5189
+ objEditor.AddInfo(child, this, true);
5190
+ System.err.println("info : " + child.GetPath());
5191
+ }
5192
+
5193
+ objEditor.SetText(); // jan 2014
5194
+ }
5195
+
5196
+ super.refreshContents(cp);
5197
+ }
42705198
42715199 void linkSomething(Object3D thing)
42725200 {
....@@ -4338,6 +5266,7 @@
43385266 {
43395267 if (group.selection.isEmpty())
43405268 return;
5269
+
43415270 Grafreed.clipboardIsTempGroup = false;
43425271 Composite tGroup = null;
43435272 if (group.selection.size() > 0) // 1)
....@@ -4348,6 +5277,8 @@
43485277
43495278 if (cut)
43505279 {
5280
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
5281
+// Save();
43515282 //int indices[] = jList.getSelectedIndices();
43525283 //for (int i = indices.length - 1; i >= 0; i--)
43535284 //jList.remove(indices[i]);
....@@ -4437,8 +5368,10 @@
44375368 }
44385369
44395370 }
5371
+
44405372 if (Grafreed.clipboardIsTempGroup)
44415373 Grafreed.clipboard = tGroup;
5374
+
44425375 if (cut)
44435376 {
44445377 ResetModel();
....@@ -4448,6 +5381,10 @@
44485381
44495382 void paste(boolean expand)
44505383 {
5384
+ if (Globals.REPLACEONMAKE)
5385
+ Save();
5386
+ boolean keep = Globals.REPLACEONMAKE;
5387
+ Globals.REPLACEONMAKE = false;
44515388 // if (GrafreeD.clipboard == null)
44525389 // return;
44535390 boolean first = true;
....@@ -4507,6 +5444,7 @@
45075444 Grafreed.clipboard.get(0).parent = keepparent;
45085445 }
45095446
5447
+ Globals.REPLACEONMAKE = keep;
45105448 ResetModel();
45115449 refreshContents();
45125450 }
....@@ -4642,6 +5580,10 @@
46425580
46435581 void group(Object3D csg, boolean grab)
46445582 {
5583
+ if (Globals.REPLACEONMAKE)
5584
+ Save();
5585
+ boolean keep = Globals.REPLACEONMAKE;
5586
+ Globals.REPLACEONMAKE = false;
46455587 if (//false) // why??
46465588 !group.selection.isEmpty())
46475589 {
....@@ -4755,10 +5697,15 @@
47555697 //node.add(csg);
47565698 //makeSomething(node);
47575699 makeSomething(csg);
5700
+ Globals.REPLACEONMAKE = keep;
47585701 }
47595702
47605703 void Ungroup(Object3D g)
47615704 {
5705
+ if (Globals.REPLACEONMAKE)
5706
+ Save();
5707
+ boolean keep = Globals.REPLACEONMAKE;
5708
+ Globals.REPLACEONMAKE = false;
47625709 if (g instanceof HiddenObject)
47635710 {
47645711 HiddenObject h = (HiddenObject) g;
....@@ -4775,6 +5722,7 @@
47755722 objEditor.makeSomething(g.get(i), false);
47765723 }
47775724 }
5725
+ Globals.REPLACEONMAKE = keep;
47785726 }
47795727
47805728 void ungroup()
....@@ -4970,21 +5918,6 @@
49705918 }
49715919 */
49725920
4973
- void ImportGFD()
4974
- {
4975
- FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
4976
- browser.show();
4977
- String filename = browser.getFile();
4978
- if (filename != null && filename.length() > 0)
4979
- {
4980
- String fullname = browser.getDirectory() + filename;
4981
-
4982
- //Object3D readobj =
4983
- objEditor.ReadGFD(fullname, objEditor);
4984
- //makeSomething(readobj);
4985
- }
4986
- }
4987
-
49885921 /*
49895922 public void Callback(Object obj)
49905923 {
....@@ -5008,23 +5941,6 @@
50085941 }
50095942 */
50105943
5011
- void ImportVRMLX3D()
5012
- {
5013
- if (Grafreed.standAlone)
5014
- {
5015
- /**/
5016
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
5017
- browser.show();
5018
- String filename = browser.getFile();
5019
- if (filename != null && filename.length() > 0)
5020
- {
5021
- String fullname = browser.getDirectory() + filename;
5022
- LoadVRMLX3D(fullname);
5023
- }
5024
- /**/
5025
- }
5026
- }
5027
-
50285944 String GetFile(String dialogName)
50295945 {
50305946 if (Grafreed.standAlone)
....@@ -5095,7 +6011,43 @@
50956011 cButton clearpanelButton;
50966012 cButton unselectButton;
50976013
6014
+ cButton restoreCameraButton;
6015
+
50986016 cButton oneStepButton;
6017
+
6018
+ cButton groupButton;
6019
+ cButton ungroupButton;
6020
+ cButton compositeButton;
6021
+ cButton switchButton;
6022
+ cButton loopButton;
6023
+ cButton textureButton;
6024
+
6025
+ cButton skybox1Button;
6026
+ cButton skybox2Button;
6027
+ cButton skybox3Button;
6028
+ cButton skybox4Button;
6029
+ cButton skybox5Button;
6030
+ cButton skybox6Button;
6031
+ cButton skybox7Button;
6032
+
6033
+ cButton skybox11Button;
6034
+ cButton skybox12Button;
6035
+ cButton skybox13Button;
6036
+ cButton skybox14Button;
6037
+ cButton skybox15Button;
6038
+ cButton skybox16Button;
6039
+ cButton skybox17Button;
6040
+
6041
+ cButton gridButton;
6042
+ cButton boxButton;
6043
+ cButton sphereButton;
6044
+ cButton coneButton;
6045
+ cButton torusButton;
6046
+ cButton superButton;
6047
+ cButton kleinButton;
6048
+ cButton particlesButton;
6049
+ cButton overlayButton;
6050
+ cButton lightButton;
50996051
51006052 cButton screenfitButton;
51016053 cButton screenfitpointButton;
....@@ -5108,14 +6060,6 @@
51086060
51096061 cButton setsupportButton;
51106062
5111
- cButton twoButton;
5112
- cButton sixButton;
5113
- cButton threeButton;
5114
- cButton sevenButton;
5115
- cButton fourButton; // full panel
5116
- cButton oneButton; // full XYZ
5117
- //cButton currentLayout;
5118
-
51196063 //
51206064 //Composite
51216065 Object3D // to do !!
....@@ -5125,9 +6069,11 @@
51256069 //JTree jTree;
51266070 private MenuItem lookAtItem;
51276071 private MenuItem lookFromItem;
5128
- private MenuItem switchItem;
6072
+ private MenuItem switchViewItem;
51296073 private MenuItem cutItem;
5130
- private MenuItem duplicateItem;
6074
+ private MenuItem undoItem;
6075
+ private MenuItem redoItem;
6076
+ private JMenuItem duplicateItem;
51316077 private MenuItem cloneItem;
51326078 private MenuItem cloneSupportItem;
51336079 private MenuItem overwriteGeoItem;
....@@ -5155,7 +6101,7 @@
51556101 private MenuItem pasteLinkItem;
51566102 private MenuItem pasteCloneItem;
51576103 private MenuItem pasteExpandItem;
5158
- private MenuItem clearItem;
6104
+ private MenuItem deleteItem;
51596105 private MenuItem clearAllItem;
51606106 private MenuItem genUVItem;
51616107 private MenuItem genNormalsMESHItem;
....@@ -5190,6 +6136,10 @@
51906136 private MenuItem showleavesItem;
51916137 private MenuItem markleavesItem;
51926138 private MenuItem unmarkleavesItem;
6139
+ private MenuItem rewindleavesItem;
6140
+ private MenuItem unrewindleavesItem;
6141
+ private MenuItem randomleavesItem;
6142
+ private MenuItem unrandomleavesItem;
51936143
51946144 private MenuItem flipVItem;
51956145 private MenuItem unflipVItem;
....@@ -5211,7 +6161,7 @@
52116161 private MenuItem frontItem;
52126162 private MenuItem cameraItem;
52136163 private MenuItem compositeItem;
5214
- private MenuItem randomItem;
6164
+ private MenuItem switchItem;
52156165 private MenuItem physicsItem;
52166166 private MenuItem frameselectorItem;
52176167 private MenuItem scriptNodeItem;
....@@ -5235,6 +6185,8 @@
52356185 private MenuItem attachBumpItem;
52366186 private MenuItem detachBumpItem;
52376187 private MenuItem pigmentBumpItem;
6188
+ private MenuItem embedTexturesItem;
6189
+ private MenuItem deEmbedTexturesItem;
52386190
52396191 private MenuItem particleItem;
52406192 private MenuItem ragdollItem;
....@@ -5273,11 +6225,6 @@
52736225 private MenuItem doubleItem;
52746226 private MenuItem tripleItem;
52756227
5276
- private MenuItem importGFDItem;
5277
- private MenuItem importVRMLX3DItem;
5278
- private MenuItem import3DSItem;
5279
- private MenuItem importOBJItem;
5280
-
52816228 private MenuItem computeAOItem;
52826229 private MenuItem recompileItem;
52836230 private MenuItem editScriptItem;
....@@ -5287,4 +6234,8 @@
52876234 private MenuItem analyzeItem;
52886235 private MenuItem dumpItem;
52896236 //boolean freezemodel = false;
6237
+
6238
+ Menu cameraMenu;
6239
+ MenuItem editCameraItem;
6240
+ MenuItem restoreCameraItem;
52906241 }