Normand Briere
2019-08-01 29d5516687020263d3ae0454ce81879a3a450af0
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.versions == null)
360
+ {
361
+ copy.versions = new byte[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.versions == null)
387
+ {
388
+ copy.versions = new byte[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,14 +513,97 @@
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 {
213
- resetMeshItem = menu.add(new MenuItem("Reset All"));
214
- resetMeshItem.addActionListener(this);
215
- stepAllItem = menu.add(new MenuItem("Step All"));
216
- stepAllItem.addActionListener(this);
217607 revertMeshItem = menu.add(new MenuItem("Revert Meshes"));
218608 revertMeshItem.addActionListener(this);
219609 resetreferencesItem = menu.add(new MenuItem("Reset Mesh References"));
....@@ -253,21 +643,29 @@
253643 }
254644
255645 oe.menuBar.add(menu = new Menu("Group"));
256
- grabItem = menu.add(new MenuItem("Grab"));
257
- grabItem.addActionListener(this);
646
+// grabItem = menu.add(new MenuItem("Grab"));
647
+// grabItem.addActionListener(this);
258648 backItem = menu.add(new MenuItem("Back"));
259649 backItem.addActionListener(this);
260650 frontItem = menu.add(new MenuItem("Front"));
261651 frontItem.addActionListener(this);
262
- compositeItem = menu.add(new MenuItem("Composite"));
263
- compositeItem.addActionListener(this);
652
+// compositeItem = menu.add(new MenuItem("Composite"));
653
+// compositeItem.addActionListener(this);
654
+
655
+ if (Globals.ADVANCED)
656
+ {
264657 hideItem = menu.add(new MenuItem("Hidden Group"));
265658 hideItem.addActionListener(this);
659
+ }
266660 ungroupItem = menu.add(new MenuItem("Ungroup"));
267661 ungroupItem.addActionListener(this);
268
- menu.add("-");
269
- randomItem = menu.add(new MenuItem("Switch node"));
270
- 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
+ {
271669 switchGeoItem = menu.add(new MenuItem("Switch Geometry"));
272670 switchGeoItem.addActionListener(this);
273671 switchTransfoItem = menu.add(new MenuItem("Switch Transform"));
....@@ -275,8 +673,6 @@
275673 morphItem = menu.add(new MenuItem("Morph Group"));
276674 morphItem.addActionListener(this);
277675
278
- if (Globals.ADVANCED)
279
- {
280676 menu.add("-");
281677 physicsItem = menu.add(new MenuItem("Physics"));
282678 physicsItem.addActionListener(this);
....@@ -284,30 +680,29 @@
284680 frameselectorItem.addActionListener(this);
285681 scriptNodeItem = menu.add(new MenuItem("Script Node"));
286682 scriptNodeItem.addActionListener(this);
287
- cameraItem = menu.add(new MenuItem("Camera"));
288
- cameraItem.addActionListener(this);
289683 }
290684
291685 oe.menuBar.add(menu = new Menu("Object"));
292
- textureItem = menu.add(new MenuItem("Texture"));
293
- textureItem.addActionListener(this);
686
+// textureItem = menu.add(new MenuItem("Texture"));
687
+// textureItem.addActionListener(this);
294688 billboardItem = menu.add(new MenuItem("Billboard"));
295689 billboardItem.addActionListener(this);
296690 csgItem = menu.add(new MenuItem("CSG"));
297691 csgItem.addActionListener(this);
298
- shadowXItem = menu.add(new MenuItem("Shadow X"));
692
+ shadowXItem = menu.add(new MenuItem("Shadow Red"));
299693 shadowXItem.addActionListener(this);
300
- shadowYItem = menu.add(new MenuItem("Shadow Y"));
694
+ shadowYItem = menu.add(new MenuItem("Shadow Green"));
301695 shadowYItem.addActionListener(this);
302
- shadowZItem = menu.add(new MenuItem("Shadow Z"));
696
+ shadowZItem = menu.add(new MenuItem("Shadow Blue"));
303697 shadowZItem.addActionListener(this);
698
+ attributeItem = menu.add(new MenuItem("Attribute"));
699
+ attributeItem.addActionListener(this);
700
+
304701 if (Globals.ADVANCED)
305702 {
306703 menu.add("-");
307704 linkerItem = menu.add(new MenuItem("Linker"));
308705 linkerItem.addActionListener(this);
309
- attributeItem = menu.add(new MenuItem("Attribute"));
310
- attributeItem.addActionListener(this);
311706 templateItem = menu.add(new MenuItem("Template"));
312707 templateItem.addActionListener(this);
313708 pointflowItem = menu.add(new MenuItem("Point Flow"));
....@@ -336,7 +731,7 @@
336731 genNormalsMESHItem.addActionListener(this);
337732 if (Globals.ADVANCED)
338733 {
339
- genNormalsMINEItem = menu.add(new MenuItem("My Normals"));
734
+ genNormalsMINEItem = menu.add(new MenuItem("Stitch Normals"));
340735 genNormalsMINEItem.addActionListener(this);
341736 }
342737 stripifyItem = menu.add(new MenuItem("Stripify"));
....@@ -372,6 +767,10 @@
372767 oe.menuBar.add(menu = new Menu("Attributes"));
373768 clearMaterialsItem = menu.add(new MenuItem("Clear Materials"));
374769 clearMaterialsItem.addActionListener(this);
770
+ resetAllItem = menu.add(new MenuItem("Reset All"));
771
+ resetAllItem.addActionListener(this);
772
+ stepAllItem = menu.add(new MenuItem("Step All"));
773
+ stepAllItem.addActionListener(this);
375774 menu.add("-");
376775 liveleavesItem = menu.add(new MenuItem("Live Leaves"));
377776 liveleavesItem.addActionListener(this);
....@@ -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);
496
- liveCB.setToolTipText("Enabled animation");
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("New 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("Restore current");
946
+ restoreButton.addActionListener(this);
947
+ restoreButton.setEnabled(false);
948
+
949
+ updown.add(replaceButton = GetButton("icons/replace.png", !Grafreed.NIMBUSLAF)); //, oe.aConstraints);
950
+ replaceButton.setToolTipText("Replace current");
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);
962
+ 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("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 = new cButton("C", !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 = sixButton; // sevenButton;
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,42 +1261,85 @@
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 = sixButton; // sevenButton;
7261332 radioButton.SetCamera(cameraView.renderCamera, false);
7271333 radioButton.addActionListener(this);
7281334 radioPanel.add(radioButton);
7291335 buttonGroup.add(radioButton);
7301336 radioButton.doClick();
7311337 }
1338
+
7321339 void SetupViews(ObjEditor oe)
7331340 {
1341
+ theFrame = this;
1342
+
7341343 oe.SetupViews();
7351344
7361345 System.out.println("SetupViews");
....@@ -739,23 +1348,30 @@
7391348 /*DropTarget dropTarget =*/ new DropTarget(oe.cameraView, this);
7401349 }
7411350
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;
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;
7531366 // JCheckBox speakerMocapCB;
754
- JCheckBox speakerCameraCB;
755
- JCheckBox speakerFocusCB;
756
- JCheckBox debugCB;
757
- JCheckBox oeilCB;
758
- JCheckBox lookAtCB;
1367
+ cCheckBox speakerCameraCB;
1368
+ cCheckBox speakerFocusCB;
1369
+ cCheckBox debugCB;
1370
+
1371
+ cCheckBox oeilCB;
1372
+ cCheckBox shadowCB;
1373
+ cCheckBox autokeepCB;
1374
+ cCheckBox lookAtCB;
7591375
7601376 // static int COLOR = 1;
7611377 // static int MATERIAL = 2;
....@@ -763,9 +1379,9 @@
7631379
7641380 int dropAttributes = Object3D.COLOR | Object3D.MATERIAL;
7651381
766
- JCheckBox colorCB;
767
- JCheckBox materialCB;
768
- JCheckBox textureCB;
1382
+ cCheckBox colorCB;
1383
+ cCheckBox materialCB;
1384
+ cCheckBox textureCB;
7691385
7701386 public void itemStateChanged(ItemEvent e)
7711387 {
....@@ -793,6 +1409,7 @@
7931409 } else if(e.getSource() == liveCB)
7941410 {
7951411 cameraView.ToggleLive();
1412
+ refreshContents(false);
7961413 }
7971414 else if(e.getSource() == supportCB)
7981415 {
....@@ -808,6 +1425,12 @@
8081425 {
8091426 cameraView.ToggleInertia();
8101427 cameraView.repaint();
1428
+ }
1429
+ else if(e.getSource() == minshaderCB)
1430
+ {
1431
+ Globals.MINSHADER ^= true;
1432
+ cameraView.programInitialized = false;
1433
+ cameraView.repaint();
8111434 }
8121435 else if(e.getSource() == localCB)
8131436 {
....@@ -857,6 +1480,18 @@
8571480 {
8581481 cameraView.ToggleOeil();
8591482 }
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
+ }
8601495 else if(e.getSource() == lookAtCB)
8611496 {
8621497 cameraView.ToggleLookAt();
....@@ -873,7 +1508,8 @@
8731508
8741509 /**/
8751510 //DragSource.getDefaultDragSource().startDrag(dge, DragSource.DefaultMoveNoDrop, new StringSelection("Allo"), this);
876
- TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1511
+ //TreePath path = new TreePath(objEditor.jTree.getSelectionPath().getLastPathComponent());
1512
+ TreePath path = objEditor.jTree.getSelectionPath();
8771513 if ((path == null) || (path.getPathCount() <= 1)) {
8781514 // We can't move the root node or an empty selection
8791515 return;
....@@ -936,8 +1572,6 @@
9361572 }
9371573 }
9381574
939
- String string = (String) object;
940
-
9411575 System.out.println("Transfer = " + object + "; drop : " + target);
9421576 // if( object instanceof java.io.File[])
9431577 // {
....@@ -945,6 +1579,8 @@
9451579 // objEditor.DropFile((java.io.File[]) object, true);
9461580 // return;
9471581 // }
1582
+
1583
+ String string = object.toString();
9481584
9491585 // File path for Mac and Windows
9501586 if (string.charAt(0) == '/' || string.charAt(1) == ':')
....@@ -990,23 +1626,33 @@
9901626
9911627 assert target == objEditor.jTree;
9921628 TreePath destinationPath = objEditor.jTree.getPathForLocation(objEditor.location.x, objEditor.location.y);
1629
+ Object3D destinationLeaf;
9931630 try {
994
- Object3D dummy = (Composite) destinationPath.getLastPathComponent();
1631
+ destinationLeaf = (Composite) destinationPath.getLastPathComponent();
9951632 } catch (Exception e) {
9961633 System.out.println("destinationPath : " + destinationPath);
9971634 return;
9981635 }
9991636
1000
- if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) // ?? LINK)
1637
+ for (int i=group.selection.size(); --i>=0;)
10011638 {
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
+// {
10021648 loadClipboard(true);
10031649 objEditor.jTree.setSelectionPath(destinationPath);
10041650 pasteInto(false, false);
1005
- } else {
1006
- loadClipboard(false);
1007
- objEditor.jTree.setSelectionPath(destinationPath);
1008
- pasteInto(false, false); // true); // ???
1009
- }
1651
+// } else {
1652
+// loadClipboard(false);
1653
+// objEditor.jTree.setSelectionPath(destinationPath);
1654
+// pasteInto(false, false); // true); // ???
1655
+// }
10101656 }
10111657 public void dropActionChanged(DropTargetDragEvent dtde)
10121658 // Called if the user has modified the current drop gesture
....@@ -1111,22 +1757,30 @@
11111757 {
11121758 //heightFieldItem = menu.add(new MenuItem("Height Field"));
11131759 //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);
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
+ {
11261778 kleinItem = menu.add(new MenuItem("Klein Bottle"));
11271779 kleinItem.addActionListener(this);
1128
- particleItem = menu.add(new MenuItem("Particle system"));
1129
- particleItem.addActionListener(this);
1780
+ }
1781
+
1782
+// particleItem = menu.add(new MenuItem("Particle system"));
1783
+// particleItem.addActionListener(this);
11301784 if (Globals.ADVANCED)
11311785 {
11321786 ragdollItem = menu.add(new MenuItem("Rag Walk"));
....@@ -1152,15 +1806,15 @@
11521806 }
11531807 bezierItem = menu.add(new MenuItem("Bezier Patch"));
11541808 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);
1809
+// overlayItem = menu.add(new MenuItem("Overlay"));
1810
+// overlayItem.addActionListener(this);
1811
+// lightItem = menu.add(new MenuItem("Light"));
1812
+// lightItem.addActionListener(this);
11591813 menu.add("-");
11601814 //superLoopItem = menu.add(new MenuItem("Super Loop"));
11611815 //superLoopItem.addActionListener(this);
1162
- loopItem = menu.add(new MenuItem("Loop"));
1163
- loopItem.addActionListener(this);
1816
+// loopItem = menu.add(new MenuItem("Loop"));
1817
+// loopItem.addActionListener(this);
11641818 doubleItem = menu.add(new MenuItem("Fork"));
11651819 doubleItem.addActionListener(this);
11661820 if (Globals.ADVANCED)
....@@ -1176,6 +1830,9 @@
11761830 animationItem.addItemListener(this);
11771831 animationItem.setState(Globals.ANIMATION);
11781832
1833
+ menu.add(archiveItem = new MenuItem("Archive3D..."));
1834
+ archiveItem.addActionListener(this);
1835
+
11791836 menu.add("-");
11801837 parseverticesItem = menu.add(new MenuItem("Multiplicity"));
11811838 parseverticesItem.addActionListener(this);
....@@ -1188,6 +1845,8 @@
11881845 reduce34MorphItem = menu.add(new MenuItem("Reduce Morphs (34)"));
11891846 reduce34MorphItem.addActionListener(this);
11901847 menu.add("-");
1848
+ menu.add(memoryItem = new MenuItem("Memory Usage"));
1849
+ memoryItem.addActionListener(this);
11911850 menu.add(computeAOItem = new MenuItem("Compute AO"));
11921851 computeAOItem.addActionListener(this);
11931852
....@@ -1196,11 +1855,9 @@
11961855 mirrorItem = menu.add(new MenuItem("Mirror Poses"));
11971856 mirrorItem.addActionListener(this);
11981857 menu.add("-");
1199
- menu.add(memoryItem = new MenuItem("Memory Usage"));
1200
- memoryItem.addActionListener(this);
12011858 menu.add(analyzeItem = new MenuItem("Analyze"));
12021859 analyzeItem.addActionListener(this);
1203
- menu.add(dumpItem = new MenuItem("Dump"));
1860
+ menu.add(dumpItem = new MenuItem("Print"));
12041861 dumpItem.addActionListener(this);
12051862 // menu.add(pathItem = new MenuItem("From-to path"));
12061863 // pathItem.addActionListener(this);
....@@ -1341,9 +1998,34 @@
13411998 shadow.material = new cMaterial(obj.material);
13421999 shadow.material.diffuse = 0.0001f;
13432000 shadow.material.specular = 0.0001f;
2001
+ //shadow.projectedVertices[1].x = 300;
13442002
13452003 makeSomething(shadow);
13462004 }
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
+ }
13472029
13482030 /**
13492031 * applyExample
....@@ -1588,7 +2270,7 @@
15882270 {
15892271 ScreenFit();
15902272 } else
1591
- if (source == switchItem)
2273
+ if (source == switchViewItem)
15922274 {
15932275 cVector v1 = new cVector();
15942276 cVector v2 = new cVector();
....@@ -1597,11 +2279,11 @@
15972279 objEditor.cameraView.renderCamera.setAim(v2, v1);
15982280 objEditor.cameraView.repaint();
15992281 } else
1600
- if (source == rectoidItem)
2282
+ if (source == rectoidItem || source == boxButton)
16012283 {
16022284 makeSomething(new Box());
16032285 } else
1604
- if (source == particleItem)
2286
+ if (source == particleItem || source == particlesButton)
16052287 {
16062288 ParticleNode particleGeom = new ParticleNode("Particles", 1000); //, particleType);
16072289 ParticleController particleController = new ParticleController(particleGeom);
....@@ -1680,27 +2362,27 @@
16802362
16812363 makeSomething(obj);
16822364 } else
1683
- if (source == gridItem)
2365
+ if (source == gridItem || source == gridButton)
16842366 {
16852367 makeSomething(new Grid());
16862368 } else
1687
- if (source == ellipsoidItem)
2369
+ if (source == ellipsoidItem || source == sphereButton)
16882370 {
16892371 makeSomething(new Sphere());
16902372 } else
1691
- if (source == coneItem)
2373
+ if (source == coneItem || source == coneButton)
16922374 {
16932375 makeSomething(new Cone());
16942376 } else
1695
- if (source == torusItem)
2377
+ if (source == torusItem || source == torusButton)
16962378 {
16972379 makeSomething(new Torus());
16982380 } else
1699
- if (source == superItem)
2381
+ if (source == superItem || source == superButton)
17002382 {
17012383 makeSomething(new Superellipsoid());
17022384 } else
1703
- if (source == kleinItem)
2385
+ if (source == kleinItem || source == kleinButton)
17042386 {
17052387 makeSomething(new Klein());
17062388 } else
....@@ -1720,7 +2402,7 @@
17202402 {
17212403 makeSomething(new BezierSurface());
17222404 } else
1723
- if (source == overlayItem)
2405
+ if (source == overlayItem || source == overlayButton)
17242406 {
17252407 /*
17262408 Object3D obj = new BezierSurface(5,8);
....@@ -1768,10 +2450,27 @@
17682450 s.setup();
17692451 makeSomething(s);
17702452 } else
1771
- if (source == lightItem)
2453
+ if (source == lightItem || source == lightButton)
17722454 {
17732455 makeSomething(new Light());
17742456 } 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
17752474 if (source == csgItem)
17762475 {
17772476 group(new CSG());
....@@ -1818,30 +2517,30 @@
18182517
18192518 group(g);
18202519 } else
1821
- if (source == loopItem)
2520
+ if (source == loopItem || source == loopButton)
18222521 {
18232522 Composite csg = new GroupLeaf();
18242523 csg.count = 5;
18252524 group(csg);
1826
- Composite child = new cGroup();
2525
+ Composite child = new cGroup("Branch");
18272526 csg.addChild(child);
18282527 child.addChild(csg);
18292528 } else
18302529 if (source == doubleItem)
18312530 {
1832
- Composite csg = new GroupLeaf();
2531
+ Composite csg = new GroupLeaf("Fork");
18332532 csg.count = 5;
18342533 group(csg);
1835
- Composite child = new cGroup();
2534
+ Composite child = new cGroup("Branch A");
18362535 csg.addChild(child);
18372536 child.addChild(csg);
1838
- child = new cGroup();
2537
+ child = new cGroup("Branch B");
18392538 csg.addChild(child);
18402539 child.addChild(csg);
18412540 } else
18422541 if (source == tripleItem)
18432542 {
1844
- Composite csg = new GroupLeaf();
2543
+ Composite csg = new GroupLeaf("Trident");
18452544 csg.count = 4;
18462545 group(csg);
18472546 Composite child = new cGroup();
....@@ -1854,35 +2553,10 @@
18542553 csg.addChild(child);
18552554 child.addChild(csg);
18562555 } 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
18822556 if (source == computeAOItem)
18832557 {
18842558 Globals.drawMode = CameraPane.OCCLUSION;
1885
- Globals.theRenderer.repaint();
2559
+ cameraView.repaint();
18862560 } else
18872561 if (source == recompileItem)
18882562 {
....@@ -1916,6 +2590,46 @@
19162590 {
19172591 DumpObject();
19182592 } 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
+ } else
2617
+ if (source == replaceButton)
2618
+ {
2619
+ // Overwrite current version
2620
+ Replace();
2621
+ } else
2622
+ if (source == redoButton)
2623
+ {
2624
+ // Go to next version
2625
+ Redo();
2626
+ } else
2627
+ if (source == saveButton)
2628
+ {
2629
+ // Save a new version
2630
+ if (!Save(true))
2631
+ java.awt.Toolkit.getDefaultToolkit().beep();
2632
+ } else
19192633 if (source == oneStepButton)
19202634 {
19212635 Globals.ONESTEP = true;
....@@ -1923,17 +2637,14 @@
19232637 } else
19242638 if (source == screenfitButton)
19252639 {
1926
- //Reload(lastConverter, lastFilename, true);
19272640 ScreenFit();
19282641 } else
19292642 if (source == screenfitpointButton)
19302643 {
1931
- //Reload(lastConverter, lastFilename, true);
19322644 ScreenFitPoint();
19332645 } else
19342646 if (source == snapobjectButton)
19352647 {
1936
- //Reload(lastConverter, lastFilename, true);
19372648 SnapObject();
19382649 } else
19392650 // if (event.getSource() == recompileButton)
....@@ -1969,6 +2680,14 @@
19692680 if (source == cutItem || source == clearButton)
19702681 {
19712682 loadClipboard(true);
2683
+ } else
2684
+ if (source == undoItem)
2685
+ {
2686
+ Undo();
2687
+ } else
2688
+ if (source == redoItem)
2689
+ {
2690
+ Redo();
19722691 } else
19732692 if (source == duplicateItem)
19742693 {
....@@ -2281,7 +3000,7 @@
22813000 {
22823001 RevertMeshes();
22833002 } else
2284
- if (source == resetMeshItem)
3003
+ if (source == resetAllItem)
22853004 {
22863005 ResetAll();
22873006 } else
....@@ -2289,7 +3008,7 @@
22893008 {
22903009 StepAll();
22913010 } else
2292
- if (source == clearItem) // || event.getSource() == clearButton)
3011
+ if (source == deleteItem) // || event.getSource() == clearButton)
22933012 {
22943013 //int indices[] = jList.getSelectedIndices();
22953014 //for (int i = indices.length - 1; i >= 0; i--)
....@@ -2301,9 +3020,9 @@
23013020 {
23023021 ClearSelection(true);
23033022 } else
2304
- if (source == grabItem)
3023
+ if (source == grabItem || source == groupButton)
23053024 {
2306
- group(new cGroup(), true);
3025
+ group(new cGroup(), false); // true);
23073026 } else
23083027 if (source == hideItem)
23093028 {
....@@ -2321,11 +3040,11 @@
23213040 {
23223041 makeSomething(new Camera());
23233042 } else
2324
- if (source == compositeItem)
3043
+ if (source == compositeItem || source == compositeButton)
23253044 {
23263045 group(new Composite());
23273046 } else
2328
- if (source == randomItem)
3047
+ if (source == switchItem || source == switchButton)
23293048 {
23303049 RandomNode random = new RandomNode();
23313050 group(random);
....@@ -2427,7 +3146,7 @@
24273146 {
24283147 group(new cLinker());
24293148 } else
2430
- if (source == textureItem)
3149
+ if (source == textureItem || source == textureButton)
24313150 {
24323151 group(new TextureNode());
24333152 } else
....@@ -2447,17 +3166,30 @@
24473166 {
24483167 CastShadow(2);
24493168 } else
2450
- if (source == ungroupItem)
3169
+ if (source == ungroupItem || source == ungroupButton)
24513170 {
2452
- //ungroup();
3171
+ boolean hasRoot = false;
3172
+
24533173 for (int i=0; i<group.selection.size(); i++)
24543174 {
2455
- Ungroup(group.selection.get(i));
3175
+ if (group.selection.get(i) == group)
3176
+ {
3177
+ hasRoot = true;
3178
+ break;
3179
+ }
24563180 }
24573181
2458
- ClearSelection(false);
2459
-
2460
- refreshContents();
3182
+ if (!hasRoot)
3183
+ {
3184
+ for (int i=0; i<group.selection.size(); i++)
3185
+ {
3186
+ Ungroup(group.selection.get(i));
3187
+ }
3188
+
3189
+ ClearSelection(false);
3190
+
3191
+ refreshContents();
3192
+ }
24613193 } else
24623194 if (source == genUVItem)
24633195 {
....@@ -2469,7 +3201,7 @@
24693201 } else
24703202 if (source == genNormalsMESHItem)
24713203 {
2472
- GenNormals(true); // TODO
3204
+ GenNormalsMESH();
24733205 } else
24743206 if (source == genNormalsORGANItem)
24753207 {
....@@ -2534,6 +3266,22 @@
25343266 if (source == unmarkleavesItem)
25353267 {
25363268 MarkLeaves(false);
3269
+ } else
3270
+ if (source == rewindleavesItem)
3271
+ {
3272
+ RewindLeaves(true);
3273
+ } else
3274
+ if (source == unrewindleavesItem)
3275
+ {
3276
+ RewindLeaves(false);
3277
+ } else
3278
+ if (source == randomleavesItem)
3279
+ {
3280
+ RandomLeaves(true);
3281
+ } else
3282
+ if (source == unrandomleavesItem)
3283
+ {
3284
+ RandomLeaves(false);
25373285 } else
25383286 if (source == flipVItem)
25393287 {
....@@ -2742,7 +3490,7 @@
27423490 for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
27433491 {
27443492 obj = (Object3D)e.nextElement();
2745
- obj.SetBumpTexture(null);
3493
+ obj.ResetBumpTexture();
27463494 }
27473495
27483496 refreshContents();
....@@ -2758,6 +3506,31 @@
27583506
27593507 refreshContents();
27603508 } else
3509
+ if (source == embedTexturesItem)
3510
+ {
3511
+ Object3D obj;
3512
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3513
+ {
3514
+ obj = (Object3D)e.nextElement();
3515
+ obj.EmbedTextures(true);
3516
+ }
3517
+
3518
+ refreshContents();
3519
+ } else
3520
+ if (source == deEmbedTexturesItem)
3521
+ {
3522
+ Object3D obj;
3523
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3524
+ {
3525
+ obj = (Object3D)e.nextElement();
3526
+ obj.EmbedTextures(false);
3527
+ }
3528
+
3529
+ CameraPane.texturepigment.clear();
3530
+ CameraPane.texturebump.clear();
3531
+
3532
+ refreshContents();
3533
+ } else
27613534 if (source == flashSelectionButton)
27623535 {
27633536 CameraPane.flash = true;
....@@ -2769,6 +3542,10 @@
27693542 if (source == twoButton)
27703543 {
27713544 radio.layout = twoButton;
3545
+
3546
+ if (CameraPane.FULLSCREEN)
3547
+ fullscreenLayout = radio.layout;
3548
+
27723549 // bug
27733550 //gridPanel.setDividerLocation(1.0);
27743551 //bigPanel.setDividerLocation(0.0);
....@@ -2801,10 +3578,31 @@
28013578 bigThree.ClearUI();
28023579 bigThree.add(centralPanel);
28033580 bigThree.FlushUI();
3581
+
3582
+ cameraView.requestFocusInWindow();
3583
+
3584
+// refreshContents(true);
3585
+//
3586
+// try
3587
+// {
3588
+// java.awt.Robot bot = new java.awt.Robot();
3589
+// int mask = InputEvent.BUTTON1_MASK;
3590
+// bot.mouseMove(100, 100);
3591
+// bot.mousePress(mask);
3592
+// bot.mouseRelease(mask);
3593
+// }
3594
+// catch (Exception e)
3595
+// {
3596
+//
3597
+// }
3598
+
28043599 } else
28053600 if (source == threeButton)
28063601 {
28073602 radio.layout = threeButton;
3603
+
3604
+ if (CameraPane.FULLSCREEN)
3605
+ fullscreenLayout = radio.layout;
28083606
28093607 // bigThree.remove(scenePanel);
28103608 // bigThree.remove(centralPanel);
....@@ -2834,13 +3632,18 @@
28343632 // centralPanel.setVisible(true);
28353633 // XYZPanel.setVisible(true);
28363634 bigThree.ClearUI();
3635
+ bigThree.add(scenePanel);
28373636 bigThree.add(centralPanel);
2838
- bigThree.add(XYZPanel);
28393637 bigThree.FlushUI();
3638
+
3639
+ cameraView.requestFocusInWindow();
28403640 } else
28413641 if (source == fourButton)
28423642 {
28433643 radio.layout = fourButton;
3644
+
3645
+ if (CameraPane.FULLSCREEN)
3646
+ fullscreenLayout = radio.layout;
28443647
28453648 // bigThree.remove(scenePanel);
28463649 // bigThree.remove(centralPanel);
....@@ -2872,10 +3675,15 @@
28723675 bigThree.ClearUI();
28733676 bigThree.add(scenePanel);
28743677 bigThree.FlushUI();
3678
+
3679
+ cameraView.requestFocusInWindow();
28753680 } else
28763681 if (source == sixButton)
28773682 {
28783683 radio.layout = sixButton;
3684
+
3685
+ if (CameraPane.FULLSCREEN)
3686
+ fullscreenLayout = radio.layout;
28793687
28803688 // bigThree.remove(scenePanel);
28813689 // bigThree.remove(centralPanel);
....@@ -2905,13 +3713,18 @@
29053713 // centralPanel.setVisible(true);
29063714 // XYZPanel.setVisible(false);
29073715 bigThree.ClearUI();
2908
- bigThree.add(scenePanel);
29093716 bigThree.add(centralPanel);
3717
+ bigThree.add(scenePanel);
29103718 bigThree.FlushUI();
3719
+
3720
+ cameraView.requestFocusInWindow();
29113721 } else
29123722 if (source == sevenButton)
29133723 {
29143724 radio.layout = sevenButton;
3725
+
3726
+ if (CameraPane.FULLSCREEN)
3727
+ fullscreenLayout = radio.layout;
29153728
29163729 // bigThree.remove(scenePanel);
29173730 // bigThree.remove(centralPanel);
....@@ -2945,6 +3758,8 @@
29453758 bigThree.add(centralPanel);
29463759 bigThree.add(XYZPanel);
29473760 bigThree.FlushUI();
3761
+
3762
+ cameraView.requestFocusInWindow();
29483763 } else
29493764 if (source == rootButton)
29503765 {
....@@ -2956,6 +3771,7 @@
29563771 EditObject(obj);
29573772 }
29583773
3774
+ cameraView.requestFocusInWindow();
29593775 refreshContents(true);
29603776 } else
29613777 if (source == closeButton)
....@@ -2965,22 +3781,37 @@
29653781 for (Enumeration e = buttonGroup.getElements(); e.hasMoreElements();)
29663782 {
29673783 ab = (cRadio)e.nextElement();
2968
- if(ab.getModel().isSelected() && ab.GetObject() != client)
3784
+ if (ab.getModel().isSelected() && ab.GetObject() != client)
29693785 {
3786
+ // Patch to avoid bug with transparency.
3787
+ if (!ab.hadMaterial)
3788
+ {
3789
+ ab.object.material = null;
3790
+ }
3791
+
29703792 buttonGroup.remove(ab);
29713793 radioPanel.remove(ab);
29723794
2973
- ab.GetObject().editWindow = null;
3795
+ //ab.GetObject().editWindow = null;
3796
+ ab.GetObject().manipWindow = null;
29743797 // ab.GetObject().objectUI = null; // ?????????
29753798
29763799 ((cRadio)radioPanel.getComponent(radioPanel.getComponentCount() - 1)).doClick();
29773800 break;
29783801 }
29793802 }
3803
+
3804
+ cameraView.requestFocusInWindow();
29803805 refreshContents(true);
29813806 } else
29823807 if (source == editItem || source == editButton)
29833808 {
3809
+ for (Enumeration e = group.selection.elements(); e.hasMoreElements();)
3810
+ {
3811
+ Object3D child = (Object3D)e.nextElement();
3812
+ child.pinned = true;
3813
+ }
3814
+
29843815 EditSelection(false);
29853816 } else
29863817 if (source == uneditButton)
....@@ -2990,10 +3821,11 @@
29903821 Object3D child = (Object3D)e.nextElement();
29913822 if(child.editWindow != null)
29923823 objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3824
+ child.pinned = false;
29933825 child.CloseUI();
29943826 listUI.remove(child);
29953827
2996
- child.editWindow = null; // ???????????
3828
+ //child.editWindow = null; // ???????????
29973829 }
29983830 objEditor.ctrlPanel.FlushUI();
29993831 //objEditor.jTree.clearSelection();
....@@ -3006,6 +3838,7 @@
30063838 //copy.ClearUI();
30073839 for (Object3D obj : listUI)
30083840 {
3841
+ obj.pinned = false;
30093842 obj.CloseUI();
30103843 }
30113844 listUI.clear();
....@@ -3015,7 +3848,7 @@
30153848 {
30163849 assert(copy == group);
30173850
3018
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
3851
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
30193852
30203853 for (Object3D obj : listUI)
30213854 {
....@@ -3064,6 +3897,9 @@
30643897 }
30653898
30663899 copy = group;
3900
+
3901
+ SetUndoStates();
3902
+
30673903 //Globals.theRenderer.object = group;
30683904 if(!useclient)
30693905 {
....@@ -3079,20 +3915,46 @@
30793915 frontView.object = group;
30803916 sideView.object = group;
30813917 }
3082
- group.editWindow = this;
3918
+
3919
+// fix "+" issue
3920
+ //group.editWindow = this;
3921
+ group.manipWindow = this;
3922
+
30833923 /*
30843924 currentLayout = radio.layout;
30853925 if (currentLayout == null)
30863926 currentLayout = sevenButton;
30873927 */
30883928 radio.layout.doClick();
3929
+
3930
+ ClearUnpinned();
3931
+ //Grafreed.Assert(group != null);
3932
+ //Grafreed.Assert(group.selection != null);
3933
+ SetPinStates(group.selection == null || group.selection.size() > 0);
3934
+ if (group.selection == null || group.selection.size() == 1)
3935
+ EditSelection(false);
30893936 keepparent = group.parent;
30903937 // PARENT = NULL or not???
30913938 //group.parent = null; // ROOT
30923939 //group.attributes = -1;
30933940 ResetModel();
3941
+
3942
+ cameraView.requestFocusInWindow();
30943943 refreshContents(true);
3095
- }
3944
+ } else if (event.getSource() == editCameraItem)
3945
+ {
3946
+ cameraView.ProtectCamera();
3947
+ cameraView.repaint();
3948
+ return;
3949
+ } else if (event.getSource() == restoreCameraItem || event.getSource() == restoreCameraButton)
3950
+ {
3951
+ cameraView.RevertCamera();
3952
+ cameraView.repaint();
3953
+ return;
3954
+ // } else if (event.getSource() == textureButton)
3955
+ // {
3956
+ // return; // true;
3957
+ }
30963958 else
30973959 {
30983960 //return super.action(event, arg);
....@@ -3101,7 +3963,6 @@
31013963 }
31023964
31033965 boolean useclient = false;
3104
- cRadio radio;
31053966
31063967 void ToggleRoot()
31073968 {
....@@ -3340,7 +4201,8 @@
33404201
33414202 int size = obj.MemorySize();
33424203
3343
- System.err.println((size/1024) + " KB is the size of " + obj);
4204
+ //System.err.println((size/1024) + " KB is the size of " + obj);
4205
+ System.err.println("the size of " + obj + " is " + size + " (" + (size/1024) + "KB)");
33444206 }
33454207 }
33464208 catch (Exception e)
....@@ -3421,6 +4283,13 @@
34214283 void GenNormals(boolean crease)
34224284 {
34234285 group.GenNormalsS(crease);
4286
+
4287
+ refreshContents();
4288
+ }
4289
+
4290
+ void GenNormalsMESH()
4291
+ {
4292
+ group.GenNormalsMeshS();
34244293
34254294 refreshContents();
34264295 }
....@@ -3652,7 +4521,16 @@
36524521 String pigment = Object3D.GetPigment(tex);
36534522 //String bump = Object3D.GetBump(tex);
36544523
3655
- com.sun.opengl.util.texture.TextureData texturedata = Globals.theRenderer.GetTextureData(pigment, false, node.texres);
4524
+ com.sun.opengl.util.texture.TextureData texturedata = null;
4525
+
4526
+ try
4527
+ {
4528
+ texturedata = Globals.theRenderer.GetTextureData(tex, false, node.texres);
4529
+ }
4530
+ catch (Exception e)
4531
+ {
4532
+ System.err.println("FAIL: " + node);
4533
+ }
36564534
36574535 double s = v.s;
36584536
....@@ -4039,6 +4917,18 @@
40394917 refreshContents();
40404918 }
40414919
4920
+ void RewindLeaves(boolean hide)
4921
+ {
4922
+ group.selection.RewindLeaves(hide);
4923
+ refreshContents();
4924
+ }
4925
+
4926
+ void RandomLeaves(boolean hide)
4927
+ {
4928
+ group.selection.RandomLeaves(hide);
4929
+ refreshContents();
4930
+ }
4931
+
40424932 void SetTexRes(int tr)
40434933 {
40444934 group.selection.SetTexRes(tr);
....@@ -4110,28 +5000,25 @@
41105000 // }
41115001 // }
41125002
4113
- static boolean allparams = true;
4114
-
4115
- static Vector<Object3D> listUI = new Vector<Object3D>();
4116
-
41175003 void EditSelection(boolean newWindow)
41185004 {
5005
+ if (group.selection == null)
5006
+ {
5007
+ EditElement(group, newWindow); // ? new
5008
+ return;
5009
+ }
5010
+
41195011 // aConstraints.gridy = 0;
41205012 for (int i=0; i<group.selection.size(); i++)
41215013 {
41225014 //System.out.println("edit : " + objectPanel.indexOfTab("Material"));
41235015 //objectPanel.setEnabledAt(objectPanel.indexOfTab("Material"), false);
4124
- objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
5016
+ //objectPanel.setSelectedIndex(objectPanel.indexOfTab("Edit"));
41255017
41265018 Object3D elem = (Object3D)group.selection.elementAt(i);
4127
- if(elem != group)
5019
+ if(elem != group || !newWindow)
41285020 {
4129
- // if (!(elem instanceof Composite))
4130
- // newWindow = false;
4131
- listUI.add(elem);
4132
- elem.openEditWindow(this, newWindow); //, false);
4133
- System.out.println("edit : " + elem);
4134
- elem.editWindow.refreshContents(true); // ? new
5021
+ EditElement(elem, newWindow); // ? new
41355022 }
41365023 }
41375024 }
....@@ -4206,7 +5093,8 @@
42065093 //new Exception().printStackTrace();
42075094
42085095 freezemodel = true;
4209
-
5096
+ ClearUnpinned();
5097
+
42105098 /**/
42115099 //switch (event.id)
42125100 {
....@@ -4214,7 +5102,6 @@
42145102 //case 702: // Event.LIST_DESELECT
42155103 group.deselectAll();
42165104 TreePath tps[] = objEditor.jTree.getSelectionPaths();
4217
- objEditor.ClearInfo(); // .GetMaterial());
42185105 if (tps != null)
42195106 {
42205107 for (int i=0; i < tps.length; i++)
....@@ -4223,10 +5110,8 @@
42235110
42245111 //if (child.parent != null)
42255112 //child.parent.addSelectee(child);
5113
+ objEditor.SetMaterial(child);
42265114 group.addSelectee(child);
4227
- objEditor.SetMaterial(child); // .GetMaterial());
4228
- objEditor.AddInfo(child, this, true); // .GetMaterial());
4229
- System.err.println("info : " + child.GetPath());
42305115 }
42315116 }
42325117 // else
....@@ -4236,20 +5121,28 @@
42365121 // System.err.println("info : " + group.GetPath());
42375122 // }
42385123
4239
- objEditor.SetText(); // jan 2014
4240
-
4241
- if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(((Object3D) tps[0].getLastPathComponent()) instanceof Camera))
5124
+ if (flashIt && !Globals.isLIVE() && tps != null && tps.length > 0 && !(tps[0].getLastPathComponent() instanceof Camera))
42425125 CameraPane.flash = true;
42435126
4244
- if (tps != null && tps.length > 0 && ((Object3D) tps[0].getLastPathComponent()) instanceof Camera)
5127
+ if (tps != null && tps.length > 0 && tps[0].getLastPathComponent() instanceof Camera)
42455128 // a camera
42465129 {
4247
- CameraPane.camerachangeframe = 0; // don't refuse it
4248
- Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
5130
+ if (tps[0].getLastPathComponent() != Globals.theRenderer.LightCamera()) // Crash the camera because of invalid lightspace
5131
+ {
5132
+ CameraPane.camerachangeframe = 0; // don't refuse it
5133
+ Globals.theRenderer.SetCamera((Camera) tps[0].getLastPathComponent());
5134
+ }
42495135 // Globals.theRenderer.renderCamera = Globals.theRenderer.manipCamera;
42505136 // Globals.theRenderer.eyeCamera = Globals.theRenderer.manipCamera;
42515137 }
42525138
5139
+ if (tps != null && tps.length == 1)
5140
+ {
5141
+ EditSelection(false);
5142
+ }
5143
+
5144
+ SetPinStates(tps != null && tps.length > 0);
5145
+
42535146 refreshContents();
42545147 //return true;
42555148 }
....@@ -4258,6 +5151,35 @@
42585151
42595152 freezemodel = false;
42605153 }
5154
+
5155
+ void SetPinStates(boolean enabled)
5156
+ {
5157
+ editButton.setEnabled(enabled);
5158
+ uneditButton.setEnabled(enabled);
5159
+ unselectButton.setEnabled(enabled);
5160
+ flashSelectionButton.setEnabled(enabled);
5161
+ }
5162
+
5163
+ void refreshContents(boolean cp)
5164
+ {
5165
+ if (objectPanel.getSelectedIndex() == 2) // objectPanel.indexOfTab("Info"))
5166
+ if (!Globals.MOUSEDRAGGED && group.selection != null) // && !Globals.TIMERRUNNING)
5167
+ {
5168
+ objEditor.ClearInfo(); // .GetMaterial());
5169
+
5170
+ for (int i=0; i < group.selection.Size(); i++)
5171
+ {
5172
+ Object3D child = (Object3D) group.selection.get(i);
5173
+
5174
+ objEditor.AddInfo(child, this, true);
5175
+ System.err.println("info : " + child.GetPath());
5176
+ }
5177
+
5178
+ objEditor.SetText(); // jan 2014
5179
+ }
5180
+
5181
+ super.refreshContents(cp);
5182
+ }
42615183
42625184 void linkSomething(Object3D thing)
42635185 {
....@@ -4329,6 +5251,7 @@
43295251 {
43305252 if (group.selection.isEmpty())
43315253 return;
5254
+
43325255 Grafreed.clipboardIsTempGroup = false;
43335256 Composite tGroup = null;
43345257 if (group.selection.size() > 0) // 1)
....@@ -4339,6 +5262,8 @@
43395262
43405263 if (cut)
43415264 {
5265
+// if (Globals.SAVEONMAKE) // Moved to the clipboard, no need to save.
5266
+// Save();
43425267 //int indices[] = jList.getSelectedIndices();
43435268 //for (int i = indices.length - 1; i >= 0; i--)
43445269 //jList.remove(indices[i]);
....@@ -4428,8 +5353,10 @@
44285353 }
44295354
44305355 }
5356
+
44315357 if (Grafreed.clipboardIsTempGroup)
44325358 Grafreed.clipboard = tGroup;
5359
+
44335360 if (cut)
44345361 {
44355362 ResetModel();
....@@ -4439,6 +5366,10 @@
44395366
44405367 void paste(boolean expand)
44415368 {
5369
+ if (Globals.REPLACEONMAKE)
5370
+ Save();
5371
+ boolean keep = Globals.REPLACEONMAKE;
5372
+ Globals.REPLACEONMAKE = false;
44425373 // if (GrafreeD.clipboard == null)
44435374 // return;
44445375 boolean first = true;
....@@ -4498,6 +5429,7 @@
44985429 Grafreed.clipboard.get(0).parent = keepparent;
44995430 }
45005431
5432
+ Globals.REPLACEONMAKE = keep;
45015433 ResetModel();
45025434 refreshContents();
45035435 }
....@@ -4633,6 +5565,10 @@
46335565
46345566 void group(Object3D csg, boolean grab)
46355567 {
5568
+ if (Globals.REPLACEONMAKE)
5569
+ Save();
5570
+ boolean keep = Globals.REPLACEONMAKE;
5571
+ Globals.REPLACEONMAKE = false;
46365572 if (//false) // why??
46375573 !group.selection.isEmpty())
46385574 {
....@@ -4746,10 +5682,15 @@
47465682 //node.add(csg);
47475683 //makeSomething(node);
47485684 makeSomething(csg);
5685
+ Globals.REPLACEONMAKE = keep;
47495686 }
47505687
47515688 void Ungroup(Object3D g)
47525689 {
5690
+ if (Globals.REPLACEONMAKE)
5691
+ Save();
5692
+ boolean keep = Globals.REPLACEONMAKE;
5693
+ Globals.REPLACEONMAKE = false;
47535694 if (g instanceof HiddenObject)
47545695 {
47555696 HiddenObject h = (HiddenObject) g;
....@@ -4766,6 +5707,7 @@
47665707 objEditor.makeSomething(g.get(i), false);
47675708 }
47685709 }
5710
+ Globals.REPLACEONMAKE = keep;
47695711 }
47705712
47715713 void ungroup()
....@@ -4961,21 +5903,6 @@
49615903 }
49625904 */
49635905
4964
- void ImportGFD()
4965
- {
4966
- FileDialog browser = new FileDialog(objEditor.frame, "Import GrafreeD", FileDialog.LOAD);
4967
- browser.show();
4968
- String filename = browser.getFile();
4969
- if (filename != null && filename.length() > 0)
4970
- {
4971
- String fullname = browser.getDirectory() + filename;
4972
-
4973
- //Object3D readobj =
4974
- objEditor.ReadGFD(fullname, objEditor);
4975
- //makeSomething(readobj);
4976
- }
4977
- }
4978
-
49795906 /*
49805907 public void Callback(Object obj)
49815908 {
....@@ -4999,23 +5926,6 @@
49995926 }
50005927 */
50015928
5002
- void ImportVRMLX3D()
5003
- {
5004
- if (Grafreed.standAlone)
5005
- {
5006
- /**/
5007
- FileDialog browser = new FileDialog(objEditor.frame, "Import VRML/X3D", FileDialog.LOAD);
5008
- browser.show();
5009
- String filename = browser.getFile();
5010
- if (filename != null && filename.length() > 0)
5011
- {
5012
- String fullname = browser.getDirectory() + filename;
5013
- LoadVRMLX3D(fullname);
5014
- }
5015
- /**/
5016
- }
5017
- }
5018
-
50195929 String GetFile(String dialogName)
50205930 {
50215931 if (Grafreed.standAlone)
....@@ -5086,7 +5996,44 @@
50865996 cButton clearpanelButton;
50875997 cButton unselectButton;
50885998
5999
+ cButton restoreCameraButton;
6000
+
6001
+ cButton saveButton;
50896002 cButton oneStepButton;
6003
+
6004
+ cButton groupButton;
6005
+ cButton ungroupButton;
6006
+ cButton compositeButton;
6007
+ cButton switchButton;
6008
+ cButton loopButton;
6009
+ cButton textureButton;
6010
+
6011
+ cButton skybox1Button;
6012
+ cButton skybox2Button;
6013
+ cButton skybox3Button;
6014
+ cButton skybox4Button;
6015
+ cButton skybox5Button;
6016
+ cButton skybox6Button;
6017
+ cButton skybox7Button;
6018
+
6019
+ cButton skybox11Button;
6020
+ cButton skybox12Button;
6021
+ cButton skybox13Button;
6022
+ cButton skybox14Button;
6023
+ cButton skybox15Button;
6024
+ cButton skybox16Button;
6025
+ cButton skybox17Button;
6026
+
6027
+ cButton gridButton;
6028
+ cButton boxButton;
6029
+ cButton sphereButton;
6030
+ cButton coneButton;
6031
+ cButton torusButton;
6032
+ cButton superButton;
6033
+ cButton kleinButton;
6034
+ cButton particlesButton;
6035
+ cButton overlayButton;
6036
+ cButton lightButton;
50906037
50916038 cButton screenfitButton;
50926039 cButton screenfitpointButton;
....@@ -5099,14 +6046,6 @@
50996046
51006047 cButton setsupportButton;
51016048
5102
- cButton twoButton;
5103
- cButton sixButton;
5104
- cButton threeButton;
5105
- cButton sevenButton;
5106
- cButton fourButton; // full panel
5107
- cButton oneButton; // full XYZ
5108
- //cButton currentLayout;
5109
-
51106049 //
51116050 //Composite
51126051 Object3D // to do !!
....@@ -5116,9 +6055,11 @@
51166055 //JTree jTree;
51176056 private MenuItem lookAtItem;
51186057 private MenuItem lookFromItem;
5119
- private MenuItem switchItem;
6058
+ private MenuItem switchViewItem;
51206059 private MenuItem cutItem;
5121
- private MenuItem duplicateItem;
6060
+ private MenuItem undoItem;
6061
+ private MenuItem redoItem;
6062
+ private JMenuItem duplicateItem;
51226063 private MenuItem cloneItem;
51236064 private MenuItem cloneSupportItem;
51246065 private MenuItem overwriteGeoItem;
....@@ -5131,7 +6072,7 @@
51316072 private MenuItem linkverticesItem;
51326073 private MenuItem relinkverticesItem;
51336074 private MenuItem setMasterItem;
5134
- private MenuItem resetMeshItem;
6075
+ private MenuItem resetAllItem;
51356076 private MenuItem stepAllItem;
51366077 private MenuItem revertMeshItem;
51376078 private MenuItem poseMeshItem;
....@@ -5146,7 +6087,7 @@
51466087 private MenuItem pasteLinkItem;
51476088 private MenuItem pasteCloneItem;
51486089 private MenuItem pasteExpandItem;
5149
- private MenuItem clearItem;
6090
+ private MenuItem deleteItem;
51506091 private MenuItem clearAllItem;
51516092 private MenuItem genUVItem;
51526093 private MenuItem genNormalsMESHItem;
....@@ -5181,6 +6122,10 @@
51816122 private MenuItem showleavesItem;
51826123 private MenuItem markleavesItem;
51836124 private MenuItem unmarkleavesItem;
6125
+ private MenuItem rewindleavesItem;
6126
+ private MenuItem unrewindleavesItem;
6127
+ private MenuItem randomleavesItem;
6128
+ private MenuItem unrandomleavesItem;
51846129
51856130 private MenuItem flipVItem;
51866131 private MenuItem unflipVItem;
....@@ -5202,7 +6147,7 @@
52026147 private MenuItem frontItem;
52036148 private MenuItem cameraItem;
52046149 private MenuItem compositeItem;
5205
- private MenuItem randomItem;
6150
+ private MenuItem switchItem;
52066151 private MenuItem physicsItem;
52076152 private MenuItem frameselectorItem;
52086153 private MenuItem scriptNodeItem;
....@@ -5226,6 +6171,8 @@
52266171 private MenuItem attachBumpItem;
52276172 private MenuItem detachBumpItem;
52286173 private MenuItem pigmentBumpItem;
6174
+ private MenuItem embedTexturesItem;
6175
+ private MenuItem deEmbedTexturesItem;
52296176
52306177 private MenuItem particleItem;
52316178 private MenuItem ragdollItem;
....@@ -5264,11 +6211,6 @@
52646211 private MenuItem doubleItem;
52656212 private MenuItem tripleItem;
52666213
5267
- private MenuItem importGFDItem;
5268
- private MenuItem importVRMLX3DItem;
5269
- private MenuItem import3DSItem;
5270
- private MenuItem importOBJItem;
5271
-
52726214 private MenuItem computeAOItem;
52736215 private MenuItem recompileItem;
52746216 private MenuItem editScriptItem;
....@@ -5278,4 +6220,8 @@
52786220 private MenuItem analyzeItem;
52796221 private MenuItem dumpItem;
52806222 //boolean freezemodel = false;
6223
+
6224
+ Menu cameraMenu;
6225
+ MenuItem editCameraItem;
6226
+ MenuItem restoreCameraItem;
52816227 }